@helpai/elements 1.1.14 → 1.2.0
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/configurator.mjs +1 -1
- package/elements-web-component.esm.js +30 -30
- package/elements-web-component.esm.js.map +3 -3
- package/elements.cjs.js +28 -28
- package/elements.cjs.js.map +3 -3
- package/elements.esm.js +28 -28
- package/elements.esm.js.map +3 -3
- package/elements.js +28 -28
- package/elements.js.map +3 -3
- package/index.d.ts +188 -406
- package/index.mjs +6 -6
- package/package.json +1 -1
- package/schema.d.ts +2 -11
- package/schema.json +7 -17
- package/schema.mjs +1 -1
- package/style.css +1 -1
- package/web-component.mjs +5 -5
package/elements.cjs.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";var ko=Object.defineProperty;var Vu=Object.getOwnPropertyDescriptor;var Wu=Object.getOwnPropertyNames;var Ku=Object.prototype.hasOwnProperty;var Gu=(e,t,n)=>t in e?ko(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ju=(e,t)=>{for(var n in t)ko(e,n,{get:t[n],enumerable:!0})},Xu=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Wu(t))!Ku.call(e,r)&&r!==n&&ko(e,r,{get:()=>t[r],enumerable:!(o=Vu(t,r))||o.enumerable});return e};var Yu=e=>Xu(ko({},"__esModule",{value:!0}),e);var le=(e,t,n)=>Gu(e,typeof t!="symbol"?t+"":t,n);var nv={};ju(nv,{HOOK_WILDCARD:()=>qr,brand:()=>tv,destroy:()=>Yg,getAllInstances:()=>Qg,getInstance:()=>Jg,hook:()=>Zg,init:()=>Xg,mount:()=>lu,resolveInitialHostMode:()=>zr,version:()=>ev});module.exports=Yu(nv);var Ao,te,Ui,sa,Ft,$i,zi,qi,ra,Co,Bn,Vi,la,aa,ia,Ju,To={},Io=[],Qu=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Hn=Array.isArray;function Rt(e,t){for(var n in t)e[n]=t[n];return e}function ca(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Tt(e,t,n){var o,r,a,s={};for(a in t)a=="key"?o=t[a]:a=="ref"?r=t[a]:s[a]=t[a];if(arguments.length>2&&(s.children=arguments.length>3?Ao.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)s[a]===void 0&&(s[a]=e.defaultProps[a]);return Ro(e,s,o,r,null)}function Ro(e,t,n,o,r){var a={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Ui,__i:-1,__u:0};return r==null&&te.vnode!=null&&te.vnode(a),a}function de(e){return e.children}function tt(e,t){this.props=e,this.context=t}function pn(e,t){if(t==null)return e.__?pn(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"?pn(e):null}function Zu(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],r=[],a=Rt({},t);a.__v=t.__v+1,te.vnode&&te.vnode(a),da(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??pn(t),!!(32&t.__u),r),a.__v=t.__v,a.__.__k[a.__i]=a,Xi(o,a,r),t.__e=t.__=null,a.__e!=n&&Wi(a)}}function Wi(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}),Wi(e)}function Fi(e){(!e.__d&&(e.__d=!0)&&Ft.push(e)&&!Eo.__r++||$i!=te.debounceRendering)&&(($i=te.debounceRendering)||zi)(Eo)}function Eo(){try{for(var e,t=1;Ft.length;)Ft.length>t&&Ft.sort(qi),e=Ft.shift(),t=Ft.length,Zu(e)}finally{Ft.length=Eo.__r=0}}function Ki(e,t,n,o,r,a,s,l,c,d,p){var _,u,f,m,h,P,k,S=o&&o.__k||Io,b=t.length;for(c=e_(n,t,S,c,b),_=0;_<b;_++)(f=n.__k[_])!=null&&(u=f.__i!=-1&&S[f.__i]||To,f.__i=_,P=da(e,f,u,r,a,s,l,c,d,p),m=f.__e,f.ref&&u.ref!=f.ref&&(u.ref&&ua(u.ref,null,f),p.push(f.ref,f.__c||m,f)),h==null&&m!=null&&(h=m),(k=!!(4&f.__u))||u.__k===f.__k?(c=Gi(f,c,e,k),k&&u.__e&&(u.__e=null)):typeof f.type=="function"&&P!==void 0?c=P:m&&(c=m.nextSibling),f.__u&=-7);return n.__e=h,c}function e_(e,t,n,o,r){var a,s,l,c,d,p=n.length,_=p,u=0;for(e.__k=new Array(r),a=0;a<r;a++)(s=t[a])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[a]=Ro(null,s,null,null,null):Hn(s)?s=e.__k[a]=Ro(de,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[a]=Ro(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[a]=s,c=a+u,s.__=e,s.__b=e.__b+1,l=null,(d=s.__i=t_(s,n,c,_))!=-1&&(_--,(l=n[d])&&(l.__u|=2)),l==null||l.__v==null?(d==-1&&(r>p?u--:r<p&&u++),typeof s.type!="function"&&(s.__u|=4)):d!=c&&(d==c-1?u--:d==c+1?u++:(d>c?u--:u++,s.__u|=4))):e.__k[a]=null;if(_)for(a=0;a<p;a++)(l=n[a])!=null&&(2&l.__u)==0&&(l.__e==o&&(o=pn(l)),Ji(l,l));return o}function Gi(e,t,n,o){var r,a;if(typeof e.type=="function"){for(r=e.__k,a=0;r&&a<r.length;a++)r[a]&&(r[a].__=e,t=Gi(r[a],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=pn(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Un(e,t){return t=t||[],e==null||typeof e=="boolean"||(Hn(e)?e.some(function(n){Un(n,t)}):t.push(e)),t}function t_(e,t,n,o){var r,a,s,l=e.key,c=e.type,d=t[n],p=d!=null&&(2&d.__u)==0;if(d===null&&l==null||p&&l==d.key&&c==d.type)return n;if(o>(p?1:0)){for(r=n-1,a=n+1;r>=0||a<t.length;)if((d=t[s=r>=0?r--:a++])!=null&&(2&d.__u)==0&&l==d.key&&c==d.type)return s}return-1}function Bi(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Qu.test(t)?n:n+"px"}function wo(e,t,n,o,r){var a,s;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||Bi(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||Bi(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")a=t!=(t=t.replace(Vi,"$1")),s=t.toLowerCase(),t=s in e||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+a]=n,n?o?n[Bn]=o[Bn]:(n[Bn]=la,e.addEventListener(t,a?ia:aa,a)):e.removeEventListener(t,a?ia:aa,a);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Hi(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Co]==null)t[Co]=la++;else if(t[Co]<n[Bn])return;return n(te.event?te.event(t):t)}}}function da(e,t,n,o,r,a,s,l,c,d){var p,_,u,f,m,h,P,k,S,b,x,y,w,D,q,B,M=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[l=t.__e=n.__e]),(p=te.__b)&&p(t);e:if(typeof M=="function"){_=s.length;try{if(S=t.props,b=M.prototype&&M.prototype.render,x=(p=M.contextType)&&o[p.__c],y=p?x?x.props.value:p.__:o,n.__c?k=(u=t.__c=n.__c).__=u.__E:(b?t.__c=u=new M(S,y):(t.__c=u=new tt(S,y),u.constructor=M,u.render=o_),x&&x.sub(u),u.state||(u.state={}),u.__n=o,f=u.__d=!0,u.__h=[],u._sb=[]),b&&u.__s==null&&(u.__s=u.state),b&&M.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=Rt({},u.__s)),Rt(u.__s,M.getDerivedStateFromProps(S,u.__s))),m=u.props,h=u.state,u.__v=t,f)b&&M.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),b&&u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(b&&M.getDerivedStateFromProps==null&&S!==m&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(S,y),t.__v==n.__v||!u.__e&&u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(S,u.__s,y)===!1){t.__v!=n.__v&&(u.props=S,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(F){F&&(F.__=t)}),Io.push.apply(u.__h,u._sb),u._sb=[],u.__h.length&&s.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(S,u.__s,y),b&&u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(m,h,P)})}if(u.context=y,u.props=S,u.__P=e,u.__e=!1,w=te.__r,D=0,b)u.state=u.__s,u.__d=!1,w&&w(t),p=u.render(u.props,u.state,u.context),Io.push.apply(u.__h,u._sb),u._sb=[];else do u.__d=!1,w&&w(t),p=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++D<25);u.state=u.__s,u.getChildContext!=null&&(o=Rt(Rt({},o),u.getChildContext())),b&&!f&&u.getSnapshotBeforeUpdate!=null&&(P=u.getSnapshotBeforeUpdate(m,h)),q=p!=null&&p.type===de&&p.key==null?Yi(p.props.children):p,l=Ki(e,Hn(q)?q:[q],t,n,o,r,a,s,l,c,d),u.base=t.__e,t.__u&=-161,u.__h.length&&s.push(u),k&&(u.__E=u.__=null)}catch(F){if(s.length=_,t.__v=null,c||a!=null){if(F.then){for(t.__u|=c?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;a!=null&&(a[a.indexOf(l)]=null),t.__e=l}else if(a!=null)for(B=a.length;B--;)ca(a[B])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),F.then||ji(t),te.__e(F,t,n)}}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=n_(n.__e,t,n,o,r,a,s,c,d);return(p=te.diffed)&&p(t),128&t.__u?void 0:l}function ji(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ji))}function Xi(e,t,n){for(var o=0;o<n.length;o++)ua(n[o],n[++o],n[++o]);te.__c&&te.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(a){a.call(r)})}catch(a){te.__e(a,r.__v)}})}function Yi(e){return typeof e!="object"||e==null||e.__b>0?e:Hn(e)?e.map(Yi):e.constructor!==void 0?null:Rt({},e)}function n_(e,t,n,o,r,a,s,l,c){var d,p,_,u,f,m,h,P=n.props||To,k=t.props,S=t.type;if(S=="svg"?r="http://www.w3.org/2000/svg":S=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),a!=null){for(d=0;d<a.length;d++)if((f=a[d])&&"setAttribute"in f==!!S&&(S?f.localName==S:f.nodeType==3)){e=f,a[d]=null;break}}if(e==null){if(S==null)return document.createTextNode(k);e=document.createElementNS(r,S,k.is&&k),l&&(te.__m&&te.__m(t,a),l=!1),a=null}if(S==null)P===k||l&&e.data==k||(e.data=k);else{if(a=S=="textarea"&&k.defaultValue!=null?null:a&&Ao.call(e.childNodes),!l&&a!=null)for(P={},d=0;d<e.attributes.length;d++)P[(f=e.attributes[d]).name]=f.value;for(d in P)f=P[d],d=="dangerouslySetInnerHTML"?_=f:d=="children"||d in k||d=="value"&&"defaultValue"in k||d=="checked"&&"defaultChecked"in k||wo(e,d,null,f,r);for(d in k)f=k[d],d=="children"?u=f:d=="dangerouslySetInnerHTML"?p=f:d=="value"?m=f:d=="checked"?h=f:l&&typeof f!="function"||P[d]===f||wo(e,d,f,P[d],r);if(p)l||_&&(p.__html==_.__html||p.__html==e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(_&&(e.innerHTML=""),Ki(t.type=="template"?e.content:e,Hn(u)?u:[u],t,n,o,S=="foreignObject"?"http://www.w3.org/1999/xhtml":r,a,s,a?a[0]:n.__k&&pn(n,0),l,c),a!=null)for(d=a.length;d--;)ca(a[d]);l&&S!="textarea"||(d="value",S=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[d]||S=="progress"&&!m||S=="option"&&m!=P[d])&&wo(e,d,m,P[d],r),d="checked",h!=null&&h!=e[d]&&wo(e,d,h,P[d],r))}return e}function ua(e,t,n){try{if(typeof e=="function"){var o=typeof e.__u=="function";o&&e.__u(),o&&t==null||(e.__u=e(t))}else e.current=t}catch(r){te.__e(r,n)}}function Ji(e,t,n){var o,r;if(te.unmount&&te.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||ua(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(a){te.__e(a,t)}o.base=o.__P=o.__n=null}if(o=e.__k)for(r=0;r<o.length;r++)o[r]&&Ji(o[r],t,n||typeof e.type!="function");n||ca(e.__e),e.__c=e.__=e.__e=void 0}function o_(e,t,n){return this.constructor(e,n)}function zn(e,t,n){var o,r,a,s;t==document&&(t=document.documentElement),te.__&&te.__(e,t),r=(o=typeof n=="function")?null:n&&n.__k||t.__k,a=[],s=[],da(t,e=(!o&&n||t).__k=Tt(de,null,[e]),r||To,To,t.namespaceURI,!o&&n?[n]:r?null:t.firstChild?Ao.call(t.childNodes):null,a,!o&&n?n:r?r.__e:t.firstChild,o,s),Xi(a,e,s),e.props.children=null}Ao=Io.slice,te={__e:function(e,t,n,o){for(var r,a,s;t=t.__;)if((r=t.__c)&&!r.__)try{if((a=r.constructor)&&a.getDerivedStateFromError!=null&&(r.setState(a.getDerivedStateFromError(e)),s=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,o||{}),s=r.__d),s)return r.__E=r}catch(l){e=l}throw e}},Ui=0,sa=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=Rt({},this.state),typeof e=="function"&&(e=e(Rt({},n),this.props)),e&&Rt(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Fi(this))},tt.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Fi(this))},tt.prototype.render=de,Ft=[],zi=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,qi=function(e,t){return e.__v.__b-t.__v.__b},Eo.__r=0,ra=Math.random().toString(8),Co="__d"+ra,Bn="__a"+ra,Vi=/(PointerCapture)$|Capture$/i,la=0,aa=Hi(!1),ia=Hi(!0),Ju=0;var R={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 fn="1.1.14";var Qi={attach:"Attach files",attachmentMimeRejected:"File type not supported",attachmentTooLarge:"File is too large",attachmentTooMany:"Attachment limit reached",conversationClosed:"This chat is closed",conversationLoading:"Loading chat\u2026",loadPreviousMessages:"Load previous messages",close:"Close",collapse:"Collapse",collapseSidebar:"Collapse sidebar",composerPlaceholder:"Type a message\u2026",dateLastWeek:"Last 7 days",dateOlder:"Older",dateToday:"Today",dateYesterday:"Yesterday",dropZone:"Drop files to attach",errorGeneric:"Something went wrong",errorRateLimited:"Too many requests \u2014 please try again in a moment.",errorRetry:"Retry",expand:"Expand",expandSidebar:"Expand sidebar",exitFullscreen:"Exit fullscreen",fullscreen:"Fullscreen",history:"History",historyBack:"Back to chat",historyEmpty:"No previous chats yet",historyLoading:"Loading your chats\u2026",historyContinue:"Continue the chat",historyTitle:"Chat history",loadMoreConversations:"Load more conversations",language:"Language",launcherOpen:"Open chat",launcherLabel:"Chat with us",micStart:"Start voice input",micStop:"Stop voice input",micUnsupported:"Voice input is not supported in this browser",moreActions:"More actions",newConversation:"New chat",panelTitle:"Chat",popOut:"Open in new tab",resizeHandle:"Drag to resize",scrollToBottom:"Scroll to latest",send:"Send",soundOff:"Sound off",soundOn:"Sound on",startNewConversation:"Start a new chat",talkToOperator:"Talk to an operator",connectingOperator:"Connecting you to an operator\u2026",noOperatorAvailable:"No one's available right now \u2014 leave your details and we'll follow up.",chattingWithOperator:"You're chatting with {operator}",cancelOperatorRequest:"Keep chatting with the AI",stop:"Stop",theme:"Theme",themeAuto:"Auto",themeDark:"Dark",themeLight:"Light",textSize:"Text size",textSizeSmall:"Small",textSizeNormal:"Normal",textSizeLarge:"Large",loading:"Loading\u2026",thinking:"Thinking\u2026",thoughts:"Thoughts",toolResult:"Result",sources:"Sources",feedbackUp:"Good response",feedbackDown:"Bad response",feedbackThanks:"Thanks for your feedback",copy:"Copy",copied:"Copied",tabHome:"Home",tabConversations:"Chats",tabHelp:"Help",tabNews:"News",modulesEmpty:"Nothing here yet",moduleBack:"Back",contentLoading:"Loading\u2026",homeGreeting:"How can we help?",homeGreetingNamed:"Hi {name} \u{1F44B}",homeGreetingLead:"How can we help?",homeSearchPlaceholder:"Search for help",homeContentTitle:"Popular articles",homeStatus:"Status",helpTitle:"Help",helpSearchPlaceholder:"Search for help",helpEmpty:"No help articles yet",helpLoading:"Loading help\u2026",helpSearchEmpty:"No results found",newsTitle:"News",newsEmpty:"No news yet",newsLoading:"Loading news\u2026",newsBack:"Back to news",newsPublishedAt:"Published {date}",formSubmit:"Submit",formSkip:"Maybe later",formSubmitted:"Completed",formSkipped:"Maybe later",formFillOut:"Fill out",formRequired:"This field is required",formInvalidEmail:"Enter a valid email address",formInvalidTel:"Enter a valid phone number",formInvalidUrl:"Enter a valid URL",formInvalidNumber:"Enter a valid number",formTooShort:"Too short (min {min} characters)",formTooLong:"Too long (max {max} characters)",formNumberTooSmall:"Must be at least {min}",formNumberTooLarge:"Must be at most {max}",formPatternMismatch:"Please match the requested format",formChooseAtLeast:"Choose at least {min}",formChooseAtMost:"Choose at most {max}",formOther:"Other",formOtherPlaceholder:"Type your answer\u2026",inputRequired:"Questions for you",inputBadge:"Questions",inputAnswered:"Answered",inputSkipped:"Skipped",showOptions:"Show options",hideOptions:"Hide options",qtypeText:"Your answer",qtypeEmail:"Email address",qtypePhone:"Phone number",qtypeNumber:"Number",qtypeDate:"Date",qtypeChooseOne:"Pick one",qtypeChooseAny:"Pick any",qtypeBoolean:"Yes / No",inputSubmit:"Submit answers",inputSubmitHint:"Enter to send \xB7 Shift+Enter = new line",inputSkip:"Skip",confirmYes:"Yes",confirmNo:"No",approve:"Approve",reject:"Reject",approvalPrompt:"{tool} requires your approval to execute.",approvalBody:"Review the tool input above and decide whether to allow this action.",approvalYourResponse:"Your response: {decision}",approvalEditHint:"You can edit this response until this step continues.",approvalSubmitting:"Response submitted. Request in progress\u2026",edit:"Edit",toolParameters:"Parameters",statusAwaiting:"Awaiting Approval",statusResponded:"Submitted",statusRunning:"Running",statusCompleted:"Completed",statusDenied:"Denied",statusError:"Error",statusSuperseded:"Skipped"},r_={attach:"Joindre des fichiers",attachmentMimeRejected:"Type de fichier non pris en charge",attachmentTooLarge:"Le fichier est trop volumineux",attachmentTooMany:"Limite de pi\xE8ces jointes atteinte",conversationClosed:"Ce chat est ferm\xE9",conversationLoading:"Chargement du chat\u2026",loadPreviousMessages:"Charger les messages pr\xE9c\xE9dents",close:"Fermer",collapse:"R\xE9duire",collapseSidebar:"R\xE9duire la barre lat\xE9rale",composerPlaceholder:"\xC9crivez un message\u2026",dateLastWeek:"7 derniers jours",dateOlder:"Plus ancien",dateToday:"Aujourd'hui",dateYesterday:"Hier",dropZone:"D\xE9posez les fichiers \xE0 joindre",errorGeneric:"Une erreur s'est produite",errorRateLimited:"Trop de requ\xEAtes \u2014 veuillez r\xE9essayer dans un instant.",errorRetry:"R\xE9essayer",expand:"Agrandir",expandSidebar:"D\xE9velopper la barre lat\xE9rale",exitFullscreen:"Quitter le plein \xE9cran",fullscreen:"Plein \xE9cran",history:"Historique",historyBack:"Retour au chat",historyEmpty:"Aucun chat pour le moment",historyContinue:"Poursuivre le chat",historyLoading:"Chargement de vos chats\u2026",historyTitle:"Historique des chats",loadMoreConversations:"Charger plus de conversations",language:"Langue",launcherOpen:"Ouvrir le chat",launcherLabel:"Discuter avec nous",micStart:"D\xE9marrer la saisie vocale",micStop:"Arr\xEAter la saisie vocale",micUnsupported:"La saisie vocale n'est pas prise en charge par ce navigateur",moreActions:"Plus d'actions",newConversation:"Nouveau chat",panelTitle:"Chat",popOut:"Ouvrir dans un nouvel onglet",resizeHandle:"Glisser pour redimensionner",scrollToBottom:"Aller au plus r\xE9cent",send:"Envoyer",soundOff:"Son d\xE9sactiv\xE9",soundOn:"Son activ\xE9",startNewConversation:"D\xE9marrer un nouveau chat",talkToOperator:"Parler \xE0 un op\xE9rateur",connectingOperator:"Mise en relation avec un op\xE9rateur\u2026",noOperatorAvailable:"Personne n'est disponible pour le moment \u2014 laissez vos coordonn\xE9es et nous reviendrons vers vous.",chattingWithOperator:"Vous discutez avec {operator}",cancelOperatorRequest:"Continuer avec l'IA",stop:"Arr\xEAter",theme:"Th\xE8me",themeAuto:"Auto",themeDark:"Sombre",themeLight:"Clair",textSize:"Taille du texte",textSizeSmall:"Petite",textSizeNormal:"Normale",textSizeLarge:"Grande",loading:"Chargement\u2026",thinking:"R\xE9flexion\u2026",thoughts:"R\xE9flexions",toolResult:"R\xE9sultat",sources:"Sources",feedbackUp:"Bonne r\xE9ponse",feedbackDown:"Mauvaise r\xE9ponse",feedbackThanks:"Merci pour votre retour",copy:"Copier",copied:"Copi\xE9",tabHome:"Accueil",tabConversations:"Chats",tabHelp:"Aide",tabNews:"Actualit\xE9s",modulesEmpty:"Rien pour le moment",moduleBack:"Retour",contentLoading:"Chargement\u2026",homeGreeting:"Comment pouvons-nous vous aider ?",homeGreetingNamed:"Bonjour {name} \u{1F44B}",homeGreetingLead:"Comment pouvons-nous vous aider ?",homeSearchPlaceholder:"Rechercher de l'aide",homeContentTitle:"Articles populaires",homeStatus:"Statut",helpTitle:"Aide",helpSearchPlaceholder:"Rechercher de l'aide",helpEmpty:"Aucun article d'aide pour le moment",helpLoading:"Chargement de l'aide\u2026",helpSearchEmpty:"Aucun r\xE9sultat trouv\xE9",newsTitle:"Actualit\xE9s",newsEmpty:"Aucune actualit\xE9 pour le moment",newsLoading:"Chargement des actualit\xE9s\u2026",newsBack:"Retour aux actualit\xE9s",newsPublishedAt:"Publi\xE9 le {date}",formSubmit:"Envoyer",formSkip:"Plus tard",formSubmitted:"Termin\xE9",formSkipped:"Plus tard",formFillOut:"Remplir",formRequired:"Ce champ est obligatoire",formInvalidEmail:"Saisissez une adresse e-mail valide",formInvalidTel:"Saisissez un num\xE9ro de t\xE9l\xE9phone valide",formInvalidUrl:"Saisissez une URL valide",formInvalidNumber:"Saisissez un nombre valide",formTooShort:"Trop court (min. {min} caract\xE8res)",formTooLong:"Trop long (max. {max} caract\xE8res)",formNumberTooSmall:"Doit \xEAtre au moins {min}",formNumberTooLarge:"Doit \xEAtre au plus {max}",formPatternMismatch:"Veuillez respecter le format demand\xE9",formChooseAtLeast:"Choisissez au moins {min}",formChooseAtMost:"Choisissez au plus {max}",formOther:"Autre",formOtherPlaceholder:"Saisissez votre r\xE9ponse\u2026",inputRequired:"Questions pour vous",inputBadge:"Questions",inputAnswered:"R\xE9pondu",inputSkipped:"Ignor\xE9",showOptions:"Afficher les options",hideOptions:"Masquer les options",qtypeText:"Votre r\xE9ponse",qtypeEmail:"Adresse e-mail",qtypePhone:"Num\xE9ro de t\xE9l\xE9phone",qtypeNumber:"Nombre",qtypeDate:"Date",qtypeChooseOne:"Choisir une",qtypeChooseAny:"Choisir plusieurs",qtypeBoolean:"Oui / Non",inputSubmit:"Envoyer les r\xE9ponses",inputSubmitHint:"Entr\xE9e pour envoyer \xB7 Maj+Entr\xE9e = saut de ligne",inputSkip:"Ignorer",confirmYes:"Oui",confirmNo:"Non",approve:"Approuver",reject:"Refuser",approvalPrompt:"{tool} n\xE9cessite votre approbation pour s'ex\xE9cuter.",approvalBody:"V\xE9rifiez les param\xE8tres ci-dessus et d\xE9cidez d'autoriser ou non cette action.",approvalYourResponse:"Votre r\xE9ponse : {decision}",approvalEditHint:"Vous pouvez modifier votre r\xE9ponse jusqu'\xE0 la reprise de cette \xE9tape.",approvalSubmitting:"R\xE9ponse envoy\xE9e. Traitement en cours\u2026",edit:"Modifier",toolParameters:"Param\xE8tres",statusAwaiting:"En attente d'approbation",statusResponded:"Envoy\xE9",statusRunning:"En cours",statusCompleted:"Termin\xE9",statusDenied:"Refus\xE9",statusError:"Erreur",statusSuperseded:"Ignor\xE9"},a_={attach:"\u0625\u0631\u0641\u0627\u0642 \u0645\u0644\u0641\u0627\u062A",attachmentMimeRejected:"\u0646\u0648\u0639 \u0627\u0644\u0645\u0644\u0641 \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645",attachmentTooLarge:"\u062D\u062C\u0645 \u0627\u0644\u0645\u0644\u0641 \u0643\u0628\u064A\u0631 \u062C\u062F\u064B\u0627",attachmentTooMany:"\u062A\u0645 \u0628\u0644\u0648\u063A \u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 \u0644\u0644\u0645\u0631\u0641\u0642\u0627\u062A",conversationClosed:"\u062A\u0645 \u0625\u063A\u0644\u0627\u0642 \u0647\u0630\u0647 \u0627\u0644\u062F\u0631\u062F\u0634\u0629",conversationLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u062F\u0631\u062F\u0634\u0629\u2026",loadPreviousMessages:"\u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0631\u0633\u0627\u0626\u0644 \u0627\u0644\u0633\u0627\u0628\u0642\u0629",close:"\u0625\u063A\u0644\u0627\u0642",collapse:"\u0637\u064A\u0651",collapseSidebar:"\u0637\u064A\u0651 \u0627\u0644\u0634\u0631\u064A\u0637 \u0627\u0644\u062C\u0627\u0646\u0628\u064A",composerPlaceholder:"\u0627\u0643\u062A\u0628 \u0631\u0633\u0627\u0644\u0629\u2026",dateLastWeek:"\u0622\u062E\u0631 \u0667 \u0623\u064A\u0627\u0645",dateOlder:"\u0623\u0642\u062F\u0645",dateToday:"\u0627\u0644\u064A\u0648\u0645",dateYesterday:"\u0623\u0645\u0633",dropZone:"\u0623\u0641\u0644\u062A \u0627\u0644\u0645\u0644\u0641\u0627\u062A \u0644\u0625\u0631\u0641\u0627\u0642\u0647\u0627",errorGeneric:"\u062D\u062F\u062B \u062E\u0637\u0623 \u0645\u0627",errorRateLimited:"\u0637\u0644\u0628\u0627\u062A \u0643\u062B\u064A\u0631\u0629 \u062C\u062F\u064B\u0627 \u2014 \u064A\u0631\u062C\u0649 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629 \u0628\u0639\u062F \u0644\u062D\u0638\u0629.",errorRetry:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629",expand:"\u062A\u0648\u0633\u064A\u0639",expandSidebar:"\u062A\u0648\u0633\u064A\u0639 \u0627\u0644\u0634\u0631\u064A\u0637 \u0627\u0644\u062C\u0627\u0646\u0628\u064A",exitFullscreen:"\u0625\u0646\u0647\u0627\u0621 \u0645\u0644\u0621 \u0627\u0644\u0634\u0627\u0634\u0629",fullscreen:"\u0645\u0644\u0621 \u0627\u0644\u0634\u0627\u0634\u0629",history:"\u0627\u0644\u0633\u062C\u0644",historyBack:"\u0627\u0644\u0639\u0648\u062F\u0629 \u0625\u0644\u0649 \u0627\u0644\u062F\u0631\u062F\u0634\u0629",historyEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u062F\u0631\u062F\u0634\u0627\u062A \u0633\u0627\u0628\u0642\u0629 \u0628\u0639\u062F",historyContinue:"\u0645\u062A\u0627\u0628\u0639\u0629 \u0627\u0644\u062F\u0631\u062F\u0634\u0629",historyLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u062F\u0631\u062F\u0634\u0627\u062A\u0643\u2026",historyTitle:"\u0633\u062C\u0644 \u0627\u0644\u062F\u0631\u062F\u0634\u0627\u062A",loadMoreConversations:"\u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u0632\u064A\u062F \u0645\u0646 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0627\u062A",language:"\u0627\u0644\u0644\u063A\u0629",launcherOpen:"\u0641\u062A\u062D \u0627\u0644\u062F\u0631\u062F\u0634\u0629",launcherLabel:"\u062A\u062D\u062F\u062B \u0645\u0639\u0646\u0627",micStart:"\u0628\u062F\u0621 \u0627\u0644\u0625\u062F\u062E\u0627\u0644 \u0627\u0644\u0635\u0648\u062A\u064A",micStop:"\u0625\u064A\u0642\u0627\u0641 \u0627\u0644\u0625\u062F\u062E\u0627\u0644 \u0627\u0644\u0635\u0648\u062A\u064A",micUnsupported:"\u0627\u0644\u0625\u062F\u062E\u0627\u0644 \u0627\u0644\u0635\u0648\u062A\u064A \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645 \u0641\u064A \u0647\u0630\u0627 \u0627\u0644\u0645\u062A\u0635\u0641\u062D",moreActions:"\u0625\u062C\u0631\u0627\u0621\u0627\u062A \u0625\u0636\u0627\u0641\u064A\u0629",newConversation:"\u062F\u0631\u062F\u0634\u0629 \u062C\u062F\u064A\u062F\u0629",panelTitle:"\u0627\u0644\u062F\u0631\u062F\u0634\u0629",popOut:"\u0641\u062A\u062D \u0641\u064A \u0639\u0644\u0627\u0645\u0629 \u062A\u0628\u0648\u064A\u0628 \u062C\u062F\u064A\u062F\u0629",resizeHandle:"\u0627\u0633\u062D\u0628 \u0644\u062A\u063A\u064A\u064A\u0631 \u0627\u0644\u062D\u062C\u0645",scrollToBottom:"\u0627\u0644\u0627\u0646\u062A\u0642\u0627\u0644 \u0625\u0644\u0649 \u0627\u0644\u0623\u062D\u062F\u062B",send:"\u0625\u0631\u0633\u0627\u0644",soundOff:"\u0643\u062A\u0645 \u0627\u0644\u0635\u0648\u062A",soundOn:"\u062A\u0634\u063A\u064A\u0644 \u0627\u0644\u0635\u0648\u062A",startNewConversation:"\u0628\u062F\u0621 \u062F\u0631\u062F\u0634\u0629 \u062C\u062F\u064A\u062F\u0629",talkToOperator:"\u0627\u0644\u062A\u062D\u062F\u062B \u0625\u0644\u0649 \u0645\u0648\u0638\u0641",connectingOperator:"\u062C\u0627\u0631\u064A \u062A\u0648\u0635\u064A\u0644\u0643 \u0628\u0623\u062D\u062F \u0627\u0644\u0645\u0648\u0638\u0641\u064A\u0646\u2026",noOperatorAvailable:"\u0644\u0627 \u064A\u0648\u062C\u062F \u0645\u0648\u0638\u0641\u0648\u0646 \u0645\u062A\u0627\u062D\u0648\u0646 \u0627\u0644\u0622\u0646 \u2014 \u0627\u062A\u0631\u0643 \u0628\u064A\u0627\u0646\u0627\u062A\u0643 \u0648\u0633\u0646\u062A\u0648\u0627\u0635\u0644 \u0645\u0639\u0643.",chattingWithOperator:"\u0623\u0646\u062A \u062A\u062A\u062D\u062F\u062B \u0645\u0639 {operator}",cancelOperatorRequest:"\u0645\u062A\u0627\u0628\u0639\u0629 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629 \u0645\u0639 \u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A",stop:"\u0625\u064A\u0642\u0627\u0641",theme:"\u0627\u0644\u0645\u0638\u0647\u0631",themeAuto:"\u062A\u0644\u0642\u0627\u0626\u064A",themeDark:"\u062F\u0627\u0643\u0646",themeLight:"\u0641\u0627\u062A\u062D",textSize:"\u062D\u062C\u0645 \u0627\u0644\u0646\u0635",textSizeSmall:"\u0635\u063A\u064A\u0631",textSizeNormal:"\u0639\u0627\u062F\u064A",textSizeLarge:"\u0643\u0628\u064A\u0631",loading:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644\u2026",thinking:"\u064A\u0641\u0643\u0651\u0631\u2026",thoughts:"\u0627\u0644\u0623\u0641\u0643\u0627\u0631",toolResult:"\u0627\u0644\u0646\u062A\u064A\u062C\u0629",sources:"\u0627\u0644\u0645\u0635\u0627\u062F\u0631",feedbackUp:"\u0631\u062F \u062C\u064A\u062F",feedbackDown:"\u0631\u062F \u0633\u064A\u0626",feedbackThanks:"\u0634\u0643\u0631\u064B\u0627 \u0639\u0644\u0649 \u0645\u0644\u0627\u062D\u0638\u0627\u062A\u0643",copy:"\u0646\u0633\u062E",copied:"\u062A\u0645 \u0627\u0644\u0646\u0633\u062E",tabHome:"\u0627\u0644\u0631\u0626\u064A\u0633\u064A\u0629",tabConversations:"\u0627\u0644\u062F\u0631\u062F\u0634\u0627\u062A",tabHelp:"\u0627\u0644\u0645\u0633\u0627\u0639\u062F\u0629",tabNews:"\u0627\u0644\u0623\u062E\u0628\u0627\u0631",modulesEmpty:"\u0644\u0627 \u0634\u064A\u0621 \u0647\u0646\u0627 \u0628\u0639\u062F",moduleBack:"\u0631\u062C\u0648\u0639",contentLoading:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644\u2026",homeGreeting:"\u0643\u064A\u0641 \u064A\u0645\u0643\u0646\u0646\u0627 \u0645\u0633\u0627\u0639\u062F\u062A\u0643\u061F",homeGreetingNamed:"\u0645\u0631\u062D\u0628\u064B\u0627 {name} \u{1F44B}",homeGreetingLead:"\u0643\u064A\u0641 \u064A\u0645\u0643\u0646\u0646\u0627 \u0645\u0633\u0627\u0639\u062F\u062A\u0643\u061F",homeSearchPlaceholder:"\u0627\u0628\u062D\u062B \u0639\u0646 \u0645\u0633\u0627\u0639\u062F\u0629",homeContentTitle:"\u0645\u0642\u0627\u0644\u0627\u062A \u0634\u0627\u0626\u0639\u0629",homeStatus:"\u0627\u0644\u062D\u0627\u0644\u0629",helpTitle:"\u0627\u0644\u0645\u0633\u0627\u0639\u062F\u0629",helpSearchPlaceholder:"\u0627\u0628\u062D\u062B \u0639\u0646 \u0645\u0633\u0627\u0639\u062F\u0629",helpEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0645\u0642\u0627\u0644\u0627\u062A \u0645\u0633\u0627\u0639\u062F\u0629 \u0628\u0639\u062F",helpLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u0633\u0627\u0639\u062F\u0629\u2026",helpSearchEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0646\u062A\u0627\u0626\u062C",newsTitle:"\u0627\u0644\u0623\u062E\u0628\u0627\u0631",newsEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0623\u062E\u0628\u0627\u0631 \u0628\u0639\u062F",newsLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0623\u062E\u0628\u0627\u0631\u2026",newsBack:"\u0627\u0644\u0639\u0648\u062F\u0629 \u0625\u0644\u0649 \u0627\u0644\u0623\u062E\u0628\u0627\u0631",newsPublishedAt:"\u0646\u064F\u0634\u0631 \u0641\u064A {date}",formSubmit:"\u0625\u0631\u0633\u0627\u0644",formSkip:"\u0644\u0627\u062D\u0642\u064B\u0627",formSubmitted:"\u062A\u0645",formSkipped:"\u0644\u0627\u062D\u0642\u064B\u0627",formFillOut:"\u062A\u0639\u0628\u0626\u0629",formRequired:"\u0647\u0630\u0627 \u0627\u0644\u062D\u0642\u0644 \u0645\u0637\u0644\u0648\u0628",formInvalidEmail:"\u0623\u062F\u062E\u0644 \u0628\u0631\u064A\u062F\u064B\u0627 \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",formInvalidTel:"\u0623\u062F\u062E\u0644 \u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0635\u062D\u064A\u062D\u064B\u0627",formInvalidUrl:"\u0623\u062F\u062E\u0644 \u0631\u0627\u0628\u0637\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",formInvalidNumber:"\u0623\u062F\u062E\u0644 \u0631\u0642\u0645\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",formTooShort:"\u0642\u0635\u064A\u0631 \u062C\u062F\u064B\u0627 (\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u062F\u0646\u0649 {min} \u062D\u0631\u0641\u064B\u0627)",formTooLong:"\u0637\u0648\u064A\u0644 \u062C\u062F\u064B\u0627 (\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 {max} \u062D\u0631\u0641\u064B\u0627)",formNumberTooSmall:"\u064A\u062C\u0628 \u0623\u0644\u0627 \u064A\u0642\u0644 \u0639\u0646 {min}",formNumberTooLarge:"\u064A\u062C\u0628 \u0623\u0644\u0627 \u064A\u0632\u064A\u062F \u0639\u0646 {max}",formPatternMismatch:"\u064A\u0631\u062C\u0649 \u0645\u0637\u0627\u0628\u0642\u0629 \u0627\u0644\u0635\u064A\u063A\u0629 \u0627\u0644\u0645\u0637\u0644\u0648\u0628\u0629",formChooseAtLeast:"\u0627\u062E\u062A\u0631 {min} \u0639\u0644\u0649 \u0627\u0644\u0623\u0642\u0644",formChooseAtMost:"\u0627\u062E\u062A\u0631 {max} \u0639\u0644\u0649 \u0627\u0644\u0623\u0643\u062B\u0631",formOther:"\u0623\u062E\u0631\u0649",formOtherPlaceholder:"\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643\u2026",inputRequired:"\u0623\u0633\u0626\u0644\u0629 \u0644\u0643",inputBadge:"\u0623\u0633\u0626\u0644\u0629",inputAnswered:"\u062A\u0645\u062A \u0627\u0644\u0625\u062C\u0627\u0628\u0629",inputSkipped:"\u062A\u0645 \u0627\u0644\u062A\u062E\u0637\u064A",showOptions:"\u0625\u0638\u0647\u0627\u0631 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A",hideOptions:"\u0625\u062E\u0641\u0627\u0621 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A",qtypeText:"\u0625\u062C\u0627\u0628\u062A\u0643",qtypeEmail:"\u0639\u0646\u0648\u0627\u0646 \u0627\u0644\u0628\u0631\u064A\u062F \u0627\u0644\u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",qtypePhone:"\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062A\u0641",qtypeNumber:"\u0631\u0642\u0645",qtypeDate:"\u062A\u0627\u0631\u064A\u062E",qtypeChooseOne:"\u0627\u062E\u062A\u0631 \u0648\u0627\u062D\u062F\u064B\u0627",qtypeChooseAny:"\u0627\u062E\u062A\u0631 \u0623\u064A\u064B\u0627",qtypeBoolean:"\u0646\u0639\u0645 / \u0644\u0627",inputSubmit:"\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A",inputSubmitHint:"Enter \u0644\u0644\u0625\u0631\u0633\u0627\u0644 \xB7 Shift+Enter = \u0633\u0637\u0631 \u062C\u062F\u064A\u062F",inputSkip:"\u062A\u062E\u0637\u064D\u0651",confirmYes:"\u0646\u0639\u0645",confirmNo:"\u0644\u0627",approve:"\u0645\u0648\u0627\u0641\u0642\u0629",reject:"\u0631\u0641\u0636",approvalPrompt:"\u062A\u062A\u0637\u0644\u0628 {tool} \u0645\u0648\u0627\u0641\u0642\u062A\u0643 \u0644\u0644\u062A\u0646\u0641\u064A\u0630.",approvalBody:"\u0631\u0627\u062C\u0639 \u0645\u064F\u0639\u0637\u064A\u0627\u062A \u0627\u0644\u0623\u062F\u0627\u0629 \u0623\u0639\u0644\u0627\u0647 \u0648\u0642\u0631\u0651\u0631 \u0627\u0644\u0633\u0645\u0627\u062D \u0628\u0647\u0630\u0627 \u0627\u0644\u0625\u062C\u0631\u0627\u0621 \u0623\u0648 \u0631\u0641\u0636\u0647.",approvalYourResponse:"\u0631\u062F\u0651\u0643: {decision}",approvalEditHint:"\u064A\u0645\u0643\u0646\u0643 \u062A\u0639\u062F\u064A\u0644 \u0631\u062F\u0651\u0643 \u062D\u062A\u0649 \u062A\u0633\u062A\u0623\u0646\u0641 \u0647\u0630\u0647 \u0627\u0644\u062E\u0637\u0648\u0629.",approvalSubmitting:"\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0631\u062F. \u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0646\u0641\u064A\u0630\u2026",edit:"\u062A\u0639\u062F\u064A\u0644",toolParameters:"\u0627\u0644\u0645\u0639\u0637\u064A\u0627\u062A",statusAwaiting:"\u0628\u0627\u0646\u062A\u0638\u0627\u0631 \u0627\u0644\u0645\u0648\u0627\u0641\u0642\u0629",statusResponded:"\u062A\u0645 \u0627\u0644\u0625\u0631\u0633\u0627\u0644",statusRunning:"\u0642\u064A\u062F \u0627\u0644\u062A\u0646\u0641\u064A\u0630",statusCompleted:"\u0645\u0643\u062A\u0645\u0644",statusDenied:"\u0645\u0631\u0641\u0648\u0636",statusError:"\u062E\u0637\u0623",statusSuperseded:"\u062A\u0645 \u0627\u0644\u062A\u062E\u0637\u064A"},i_={attach:"Adjuntar archivos",attachmentMimeRejected:"Tipo de archivo no admitido",attachmentTooLarge:"El archivo es demasiado grande",attachmentTooMany:"Se alcanz\xF3 el l\xEDmite de adjuntos",conversationClosed:"Este chat est\xE1 cerrado",conversationLoading:"Cargando chat\u2026",loadPreviousMessages:"Cargar mensajes anteriores",close:"Cerrar",collapse:"Contraer",collapseSidebar:"Contraer la barra lateral",composerPlaceholder:"Escribe un mensaje\u2026",dateLastWeek:"\xDAltimos 7 d\xEDas",dateOlder:"Anteriores",dateToday:"Hoy",dateYesterday:"Ayer",dropZone:"Suelta los archivos para adjuntarlos",errorGeneric:"Algo sali\xF3 mal",errorRateLimited:"Demasiadas solicitudes: int\xE9ntalo de nuevo en un momento.",errorRetry:"Reintentar",expand:"Ampliar",expandSidebar:"Expandir la barra lateral",exitFullscreen:"Salir de pantalla completa",fullscreen:"Pantalla completa",history:"Historial",historyBack:"Volver al chat",historyEmpty:"A\xFAn no tienes chats",historyContinue:"Continuar el chat",historyLoading:"Cargando tus chats\u2026",historyTitle:"Historial de chats",loadMoreConversations:"Cargar m\xE1s conversaciones",language:"Idioma",launcherOpen:"Abrir el chat",launcherLabel:"Chatea con nosotros",micStart:"Iniciar entrada de voz",micStop:"Detener entrada de voz",micUnsupported:"Este navegador no admite la entrada de voz",moreActions:"M\xE1s acciones",newConversation:"Nuevo chat",panelTitle:"Chat",popOut:"Abrir en una pesta\xF1a nueva",resizeHandle:"Arrastra para cambiar el tama\xF1o",scrollToBottom:"Ir a lo m\xE1s reciente",send:"Enviar",soundOff:"Sonido desactivado",soundOn:"Sonido activado",startNewConversation:"Iniciar un chat nuevo",talkToOperator:"Hablar con un operador",connectingOperator:"Conect\xE1ndote con un operador\u2026",noOperatorAvailable:"Nadie est\xE1 disponible ahora \u2014 deja tus datos y te contactaremos.",chattingWithOperator:"Est\xE1s chateando con {operator}",cancelOperatorRequest:"Seguir con la IA",stop:"Detener",theme:"Tema",themeAuto:"Autom\xE1tico",themeDark:"Oscuro",themeLight:"Claro",textSize:"Tama\xF1o del texto",textSizeSmall:"Peque\xF1o",textSizeNormal:"Normal",textSizeLarge:"Grande",loading:"Cargando\u2026",thinking:"Pensando\u2026",thoughts:"Razonamiento",toolResult:"Resultado",sources:"Fuentes",feedbackUp:"Buena respuesta",feedbackDown:"Mala respuesta",feedbackThanks:"Gracias por tu opini\xF3n",copy:"Copiar",copied:"Copiado",tabHome:"Inicio",tabConversations:"Chats",tabHelp:"Ayuda",tabNews:"Novedades",modulesEmpty:"A\xFAn no hay nada aqu\xED",moduleBack:"Atr\xE1s",contentLoading:"Cargando\u2026",homeGreeting:"\xBFC\xF3mo podemos ayudarte?",homeGreetingNamed:"Hola, {name} \u{1F44B}",homeGreetingLead:"\xBFC\xF3mo podemos ayudarte?",homeSearchPlaceholder:"Buscar ayuda",homeContentTitle:"Art\xEDculos populares",homeStatus:"Estado",helpTitle:"Ayuda",helpSearchPlaceholder:"Buscar ayuda",helpEmpty:"A\xFAn no hay art\xEDculos de ayuda",helpLoading:"Cargando la ayuda\u2026",helpSearchEmpty:"No se encontraron resultados",newsTitle:"Novedades",newsEmpty:"A\xFAn no hay novedades",newsLoading:"Cargando novedades\u2026",newsBack:"Volver a novedades",newsPublishedAt:"Publicado el {date}",formSubmit:"Enviar",formSkip:"Quiz\xE1 m\xE1s tarde",formSubmitted:"Completado",formSkipped:"Quiz\xE1 m\xE1s tarde",formFillOut:"Completar",formRequired:"Este campo es obligatorio",formInvalidEmail:"Introduce un correo electr\xF3nico v\xE1lido",formInvalidTel:"Introduce un n\xFAmero de tel\xE9fono v\xE1lido",formInvalidUrl:"Introduce una URL v\xE1lida",formInvalidNumber:"Introduce un n\xFAmero v\xE1lido",formTooShort:"Demasiado corto (m\xEDn. {min} caracteres)",formTooLong:"Demasiado largo (m\xE1x. {max} caracteres)",formNumberTooSmall:"Debe ser al menos {min}",formNumberTooLarge:"Debe ser como m\xE1ximo {max}",formPatternMismatch:"Respeta el formato solicitado",formChooseAtLeast:"Elige al menos {min}",formChooseAtMost:"Elige como m\xE1ximo {max}",formOther:"Otro",formOtherPlaceholder:"Escribe tu respuesta\u2026",inputRequired:"Preguntas para ti",inputBadge:"Preguntas",inputAnswered:"Respondido",inputSkipped:"Omitido",showOptions:"Mostrar opciones",hideOptions:"Ocultar opciones",qtypeText:"Tu respuesta",qtypeEmail:"Correo electr\xF3nico",qtypePhone:"N\xFAmero de tel\xE9fono",qtypeNumber:"N\xFAmero",qtypeDate:"Fecha",qtypeChooseOne:"Elige una",qtypeChooseAny:"Elige varias",qtypeBoolean:"S\xED / No",inputSubmit:"Enviar respuestas",inputSubmitHint:"Enter para enviar \xB7 May\xFAs+Enter = nueva l\xEDnea",inputSkip:"Omitir",confirmYes:"S\xED",confirmNo:"No",approve:"Aprobar",reject:"Rechazar",approvalPrompt:"{tool} requiere tu aprobaci\xF3n para ejecutarse.",approvalBody:"Revisa los par\xE1metros de arriba y decide si permites esta acci\xF3n.",approvalYourResponse:"Tu respuesta: {decision}",approvalEditHint:"Puedes cambiar tu respuesta hasta que este paso contin\xFAe.",approvalSubmitting:"Respuesta enviada. Procesando\u2026",edit:"Editar",toolParameters:"Par\xE1metros",statusAwaiting:"Esperando aprobaci\xF3n",statusResponded:"Enviado",statusRunning:"En curso",statusCompleted:"Completado",statusDenied:"Denegado",statusError:"Error",statusSuperseded:"Omitido"},s_={attach:"\u05E6\u05D9\u05E8\u05D5\u05E3 \u05E7\u05D1\u05E6\u05D9\u05DD",attachmentMimeRejected:"\u05E1\u05D5\u05D2 \u05D4\u05E7\u05D5\u05D1\u05E5 \u05D0\u05D9\u05E0\u05D5 \u05E0\u05EA\u05DE\u05DA",attachmentTooLarge:"\u05D4\u05E7\u05D5\u05D1\u05E5 \u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9",attachmentTooMany:"\u05D4\u05D2\u05E2\u05EA \u05DC\u05DE\u05E1\u05E4\u05E8 \u05D4\u05DE\u05E8\u05D1\u05D9 \u05E9\u05DC \u05E7\u05D1\u05E6\u05D9\u05DD \u05DE\u05E6\u05D5\u05E8\u05E4\u05D9\u05DD",conversationClosed:"\u05D4\u05E6\u05F3\u05D0\u05D8 \u05D4\u05D6\u05D4 \u05E0\u05E1\u05D2\u05E8",conversationLoading:"\u05D8\u05D5\u05E2\u05DF \u05E6\u05F3\u05D0\u05D8\u2026",loadPreviousMessages:"\u05D8\u05E2\u05D9\u05E0\u05EA \u05D4\u05D5\u05D3\u05E2\u05D5\u05EA \u05E7\u05D5\u05D3\u05DE\u05D5\u05EA",close:"\u05E1\u05D2\u05D9\u05E8\u05D4",collapse:"\u05DB\u05D9\u05D5\u05D5\u05E5",collapseSidebar:"\u05DB\u05D9\u05D5\u05D5\u05E5 \u05E1\u05E8\u05D2\u05DC \u05D4\u05E6\u05D3",composerPlaceholder:"\u05DB\u05EA\u05D5\u05D1 \u05D4\u05D5\u05D3\u05E2\u05D4\u2026",dateLastWeek:"7 \u05D4\u05D9\u05DE\u05D9\u05DD \u05D4\u05D0\u05D7\u05E8\u05D5\u05E0\u05D9\u05DD",dateOlder:"\u05D9\u05E9\u05DF \u05D9\u05D5\u05EA\u05E8",dateToday:"\u05D4\u05D9\u05D5\u05DD",dateYesterday:"\u05D0\u05EA\u05DE\u05D5\u05DC",dropZone:"\u05E9\u05D7\u05E8\u05E8 \u05E7\u05D1\u05E6\u05D9\u05DD \u05DB\u05D3\u05D9 \u05DC\u05E6\u05E8\u05E3",errorGeneric:"\u05DE\u05E9\u05D4\u05D5 \u05D4\u05E9\u05EA\u05D1\u05E9",errorRateLimited:"\u05D9\u05D5\u05EA\u05E8 \u05DE\u05D3\u05D9 \u05D1\u05E7\u05E9\u05D5\u05EA \u2014 \u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1 \u05D1\u05E2\u05D5\u05D3 \u05E8\u05D2\u05E2.",errorRetry:"\u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1",expand:"\u05D4\u05E8\u05D7\u05D1\u05D4",expandSidebar:"\u05D4\u05E8\u05D7\u05D1\u05EA \u05E1\u05E8\u05D2\u05DC \u05D4\u05E6\u05D3",exitFullscreen:"\u05D9\u05E6\u05D9\u05D0\u05D4 \u05DE\u05DE\u05E1\u05DA \u05DE\u05DC\u05D0",fullscreen:"\u05DE\u05E1\u05DA \u05DE\u05DC\u05D0",history:"\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D4",historyBack:"\u05D7\u05D6\u05E8\u05D4 \u05DC\u05E6\u05F3\u05D0\u05D8",historyEmpty:"\u05D0\u05D9\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05E6\u05F3\u05D0\u05D8\u05D9\u05DD \u05E7\u05D5\u05D3\u05DE\u05D9\u05DD",historyContinue:"\u05D4\u05DE\u05E9\u05DA \u05E6\u05F3\u05D0\u05D8",historyLoading:"\u05D8\u05D5\u05E2\u05DF \u05D0\u05EA \u05D4\u05E6\u05F3\u05D0\u05D8\u05D9\u05DD \u05E9\u05DC\u05DA\u2026",historyTitle:"\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05E6\u05F3\u05D0\u05D8\u05D9\u05DD",loadMoreConversations:"\u05D8\u05E2\u05D9\u05E0\u05EA \u05E9\u05D9\u05D7\u05D5\u05EA \u05E0\u05D5\u05E1\u05E4\u05D5\u05EA",language:"\u05E9\u05E4\u05D4",launcherOpen:"\u05E4\u05EA\u05D9\u05D7\u05EA \u05E6\u05F3\u05D0\u05D8",launcherLabel:"\u05D3\u05D1\u05E8\u05D5 \u05D0\u05D9\u05EA\u05E0\u05D5",micStart:"\u05D4\u05EA\u05D7\u05DC\u05EA \u05E7\u05DC\u05D8 \u05E7\u05D5\u05DC\u05D9",micStop:"\u05E2\u05E6\u05D9\u05E8\u05EA \u05E7\u05DC\u05D8 \u05E7\u05D5\u05DC\u05D9",micUnsupported:"\u05E7\u05DC\u05D8 \u05E7\u05D5\u05DC\u05D9 \u05D0\u05D9\u05E0\u05D5 \u05E0\u05EA\u05DE\u05DA \u05D1\u05D3\u05E4\u05D3\u05E4\u05DF \u05D6\u05D4",moreActions:"\u05E4\u05E2\u05D5\u05DC\u05D5\u05EA \u05E0\u05D5\u05E1\u05E4\u05D5\u05EA",newConversation:"\u05E6\u05F3\u05D0\u05D8 \u05D7\u05D3\u05E9",panelTitle:"\u05E6\u05F3\u05D0\u05D8",popOut:"\u05E4\u05EA\u05D9\u05D7\u05D4 \u05D1\u05DB\u05E8\u05D8\u05D9\u05E1\u05D9\u05D9\u05D4 \u05D7\u05D3\u05E9\u05D4",resizeHandle:"\u05D2\u05E8\u05D5\u05E8 \u05DC\u05E9\u05D9\u05E0\u05D5\u05D9 \u05D4\u05D2\u05D5\u05D3\u05DC",scrollToBottom:"\u05DE\u05E2\u05D1\u05E8 \u05DC\u05D7\u05D3\u05E9 \u05D1\u05D9\u05D5\u05EA\u05E8",send:"\u05E9\u05DC\u05D9\u05D7\u05D4",soundOff:"\u05D4\u05E9\u05EA\u05E7\u05EA \u05D4\u05E6\u05DC\u05D9\u05DC",soundOn:"\u05D4\u05E4\u05E2\u05DC\u05EA \u05D4\u05E6\u05DC\u05D9\u05DC",startNewConversation:"\u05D4\u05EA\u05D7\u05DC\u05EA \u05E6\u05F3\u05D0\u05D8 \u05D7\u05D3\u05E9",talkToOperator:"\u05D3\u05D1\u05E8 \u05E2\u05DD \u05E0\u05E6\u05D9\u05D2",connectingOperator:"\u05DE\u05D7\u05D1\u05E8 \u05D0\u05D5\u05EA\u05DA \u05DC\u05E0\u05E6\u05D9\u05D2\u2026",noOperatorAvailable:"\u05D0\u05D9\u05DF \u05E0\u05E6\u05D9\u05D2\u05D9\u05DD \u05D6\u05DE\u05D9\u05E0\u05D9\u05DD \u05DB\u05E2\u05EA \u2014 \u05D4\u05E9\u05D0\u05E8 \u05D0\u05EA \u05D4\u05E4\u05E8\u05D8\u05D9\u05DD \u05E9\u05DC\u05DA \u05D5\u05E0\u05D7\u05D6\u05D5\u05E8 \u05D0\u05DC\u05D9\u05DA.",chattingWithOperator:"\u05D0\u05EA\u05D4 \u05DE\u05E6\u05F3\u05D5\u05D8\u05D8 \u05E2\u05DD {operator}",cancelOperatorRequest:"\u05D4\u05DE\u05E9\u05DA \u05DC\u05E9\u05D5\u05D7\u05D7 \u05E2\u05DD \u05D4-AI",stop:"\u05E2\u05E6\u05D9\u05E8\u05D4",theme:"\u05E2\u05E8\u05DB\u05EA \u05E0\u05D5\u05E9\u05D0",themeAuto:"\u05D0\u05D5\u05D8\u05D5\u05DE\u05D8\u05D9",themeDark:"\u05DB\u05D4\u05D4",themeLight:"\u05D1\u05D4\u05D9\u05E8",textSize:"\u05D2\u05D5\u05D3\u05DC \u05D8\u05E7\u05E1\u05D8",textSizeSmall:"\u05E7\u05D8\u05DF",textSizeNormal:"\u05E8\u05D2\u05D9\u05DC",textSizeLarge:"\u05D2\u05D3\u05D5\u05DC",loading:"\u05D8\u05D5\u05E2\u05DF\u2026",thinking:"\u05D7\u05D5\u05E9\u05D1\u2026",thoughts:"\u05DE\u05D7\u05E9\u05D1\u05D5\u05EA",toolResult:"\u05EA\u05D5\u05E6\u05D0\u05D4",sources:"\u05DE\u05E7\u05D5\u05E8\u05D5\u05EA",feedbackUp:"\u05EA\u05E9\u05D5\u05D1\u05D4 \u05D8\u05D5\u05D1\u05D4",feedbackDown:"\u05EA\u05E9\u05D5\u05D1\u05D4 \u05D2\u05E8\u05D5\u05E2\u05D4",feedbackThanks:"\u05EA\u05D5\u05D3\u05D4 \u05E2\u05DC \u05D4\u05DE\u05E9\u05D5\u05D1",copy:"\u05D4\u05E2\u05EA\u05E7",copied:"\u05D4\u05D5\u05E2\u05EA\u05E7",tabHome:"\u05D1\u05D9\u05EA",tabConversations:"\u05E6\u05F3\u05D0\u05D8\u05D9\u05DD",tabHelp:"\u05E2\u05D6\u05E8\u05D4",tabNews:"\u05D7\u05D3\u05E9\u05D5\u05EA",modulesEmpty:"\u05D0\u05D9\u05DF \u05DB\u05D0\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05DB\u05DC\u05D5\u05DD",moduleBack:"\u05D7\u05D6\u05E8\u05D4",contentLoading:"\u05D8\u05D5\u05E2\u05DF\u2026",homeGreeting:"\u05DB\u05D9\u05E6\u05D3 \u05E0\u05D5\u05DB\u05DC \u05DC\u05E2\u05D6\u05D5\u05E8?",homeGreetingNamed:"\u05E9\u05DC\u05D5\u05DD {name} \u{1F44B}",homeGreetingLead:"\u05DB\u05D9\u05E6\u05D3 \u05E0\u05D5\u05DB\u05DC \u05DC\u05E2\u05D6\u05D5\u05E8?",homeSearchPlaceholder:"\u05D7\u05D9\u05E4\u05D5\u05E9 \u05E2\u05D6\u05E8\u05D4",homeContentTitle:"\u05DE\u05D0\u05DE\u05E8\u05D9\u05DD \u05E4\u05D5\u05E4\u05D5\u05DC\u05E8\u05D9\u05D9\u05DD",homeStatus:"\u05E1\u05D8\u05D8\u05D5\u05E1",helpTitle:"\u05E2\u05D6\u05E8\u05D4",helpSearchPlaceholder:"\u05D7\u05D9\u05E4\u05D5\u05E9 \u05E2\u05D6\u05E8\u05D4",helpEmpty:"\u05D0\u05D9\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05DE\u05D0\u05DE\u05E8\u05D9 \u05E2\u05D6\u05E8\u05D4",helpLoading:"\u05D8\u05D5\u05E2\u05DF \u05E2\u05D6\u05E8\u05D4\u2026",helpSearchEmpty:"\u05DC\u05D0 \u05E0\u05DE\u05E6\u05D0\u05D5 \u05EA\u05D5\u05E6\u05D0\u05D5\u05EA",newsTitle:"\u05D7\u05D3\u05E9\u05D5\u05EA",newsEmpty:"\u05D0\u05D9\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05D7\u05D3\u05E9\u05D5\u05EA",newsLoading:"\u05D8\u05D5\u05E2\u05DF \u05D7\u05D3\u05E9\u05D5\u05EA\u2026",newsBack:"\u05D7\u05D6\u05E8\u05D4 \u05DC\u05D7\u05D3\u05E9\u05D5\u05EA",newsPublishedAt:"\u05E4\u05D5\u05E8\u05E1\u05DD \u05D1-{date}",formSubmit:"\u05E9\u05DC\u05D9\u05D7\u05D4",formSkip:"\u05D0\u05D7\u05E8 \u05DB\u05DA",formSubmitted:"\u05E0\u05E9\u05DC\u05D7",formSkipped:"\u05D3\u05D5\u05DC\u05D2",formFillOut:"\u05DE\u05D9\u05DC\u05D5\u05D9",formRequired:"\u05E9\u05D3\u05D4 \u05D7\u05D5\u05D1\u05D4",formInvalidEmail:"\u05D4\u05D6\u05DF \u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC \u05EA\u05E7\u05D9\u05E0\u05D4",formInvalidTel:"\u05D4\u05D6\u05DF \u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF \u05EA\u05E7\u05D9\u05DF",formInvalidUrl:"\u05D4\u05D6\u05DF \u05DB\u05EA\u05D5\u05D1\u05EA URL \u05EA\u05E7\u05D9\u05E0\u05D4",formInvalidNumber:"\u05D4\u05D6\u05DF \u05DE\u05E1\u05E4\u05E8 \u05EA\u05E7\u05D9\u05DF",formTooShort:"\u05E7\u05E6\u05E8 \u05DE\u05D3\u05D9 (\u05DC\u05E4\u05D7\u05D5\u05EA {min} \u05EA\u05D5\u05D5\u05D9\u05DD)",formTooLong:"\u05D0\u05E8\u05D5\u05DA \u05DE\u05D3\u05D9 (\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8 {max} \u05EA\u05D5\u05D5\u05D9\u05DD)",formNumberTooSmall:"\u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DC\u05E4\u05D7\u05D5\u05EA {min}",formNumberTooLarge:"\u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8 {max}",formPatternMismatch:"\u05D4\u05EA\u05D0\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA \u05D4\u05E0\u05D3\u05E8\u05E9\u05EA",formChooseAtLeast:"\u05D1\u05D7\u05E8 \u05DC\u05E4\u05D7\u05D5\u05EA {min}",formChooseAtMost:"\u05D1\u05D7\u05E8 \u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8 {max}",formOther:"\u05D0\u05D7\u05E8",formOtherPlaceholder:"\u05DB\u05EA\u05D5\u05D1 \u05D0\u05EA \u05EA\u05E9\u05D5\u05D1\u05EA\u05DA\u2026",inputRequired:"\u05E9\u05D0\u05DC\u05D5\u05EA \u05E2\u05D1\u05D5\u05E8\u05DA",inputBadge:"\u05E9\u05D0\u05DC\u05D5\u05EA",inputAnswered:"\u05E0\u05E2\u05E0\u05D4",inputSkipped:"\u05D3\u05D5\u05DC\u05D2",showOptions:"\u05D4\u05E6\u05D2 \u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA",hideOptions:"\u05D4\u05E1\u05EA\u05E8 \u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA",qtypeText:"\u05D4\u05EA\u05E9\u05D5\u05D1\u05D4 \u05E9\u05DC\u05DA",qtypeEmail:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",qtypePhone:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF",qtypeNumber:"\u05DE\u05E1\u05E4\u05E8",qtypeDate:"\u05EA\u05D0\u05E8\u05D9\u05DA",qtypeChooseOne:"\u05D1\u05D7\u05E8 \u05D0\u05D7\u05EA",qtypeChooseAny:"\u05D1\u05D7\u05E8 \u05DB\u05DE\u05D4",qtypeBoolean:"\u05DB\u05DF / \u05DC\u05D0",inputSubmit:"\u05E9\u05DC\u05D9\u05D7\u05EA \u05EA\u05E9\u05D5\u05D1\u05D5\u05EA",inputSubmitHint:"Enter \u05DC\u05E9\u05DC\u05D9\u05D7\u05D4 \xB7 Shift+Enter = \u05E9\u05D5\u05E8\u05D4 \u05D7\u05D3\u05E9\u05D4",inputSkip:"\u05D3\u05D9\u05DC\u05D5\u05D2",confirmYes:"\u05DB\u05DF",confirmNo:"\u05DC\u05D0",approve:"\u05D0\u05D9\u05E9\u05D5\u05E8",reject:"\u05D3\u05D7\u05D9\u05D9\u05D4",approvalPrompt:"\u05D4\u05DB\u05DC\u05D9 {tool} \u05D3\u05D5\u05E8\u05E9 \u05D0\u05EA \u05D0\u05D9\u05E9\u05D5\u05E8\u05DA \u05DB\u05D3\u05D9 \u05DC\u05E4\u05E2\u05D5\u05DC.",approvalBody:"\u05D1\u05D3\u05D5\u05E7 \u05D0\u05EA \u05E4\u05E8\u05DE\u05D8\u05E8\u05D9 \u05D4\u05DB\u05DC\u05D9 \u05E9\u05DC\u05DE\u05E2\u05DC\u05D4 \u05D5\u05D4\u05D7\u05DC\u05D8 \u05D0\u05DD \u05DC\u05D0\u05E9\u05E8 \u05E4\u05E2\u05D5\u05DC\u05D4 \u05D6\u05D5.",approvalYourResponse:"\u05D4\u05EA\u05D2\u05D5\u05D1\u05D4 \u05E9\u05DC\u05DA: {decision}",approvalEditHint:"\u05E0\u05D9\u05EA\u05DF \u05DC\u05E2\u05E8\u05D5\u05DA \u05D0\u05EA \u05EA\u05D2\u05D5\u05D1\u05EA\u05DA \u05E2\u05D3 \u05E9\u05D4\u05E9\u05DC\u05D1 \u05D4\u05D6\u05D4 \u05D9\u05EA\u05D7\u05D3\u05E9.",approvalSubmitting:"\u05D4\u05EA\u05D2\u05D5\u05D1\u05D4 \u05E0\u05E9\u05DC\u05D7\u05D4. \u05DE\u05D1\u05E6\u05E2\u2026",edit:"\u05E2\u05E8\u05D9\u05DB\u05D4",toolParameters:"\u05E4\u05E8\u05DE\u05D8\u05E8\u05D9\u05DD",statusAwaiting:"\u05DE\u05DE\u05EA\u05D9\u05DF \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8",statusResponded:"\u05E0\u05E9\u05DC\u05D7",statusRunning:"\u05E4\u05D5\u05E2\u05DC",statusCompleted:"\u05D4\u05D5\u05E9\u05DC\u05DD",statusDenied:"\u05E0\u05D3\u05D7\u05D4",statusError:"\u05E9\u05D2\u05D9\u05D0\u05D4",statusSuperseded:"\u05D3\u05D5\u05DC\u05D2"},l_={en:Qi,fr:r_,ar:a_,es:i_,he:s_};function Mo(e,t){let n=Zi(e),o=Lo(t),r=n==="en"?{}:l_[n]??{},a=o?t[n]??{}:t??{},s=o?t.en??{}:{};return{...Qi,...r,...s,...a}}function Zi(e){return(e.split("-")[0]??"en").toLowerCase()}var c_=new Set(["ar","he","iw","fa","ur","ps","sd","ug","yi","dv","ckb","ks","nqo","prs","syr"]);function es(e){return c_.has(Zi(e))}function Qe(e,t){return e[t]??t}function Lo(e){if(!e)return!1;for(let t of Object.values(e))if(t&&typeof t=="object")return!0;return!1}function ts(e,t){if(!(!e?.length||!t))return e.find(n=>n.locale===t)}function ns(e,t){let{translations:n,defaultLocale:o,...r}=e,a=ts(n,t);return a?{...r,title:a.title??r.title,description:a.description??r.description,content:a.content??r.content}:r}function os(e,t){let{translations:n,defaultLocale:o,...r}=e,a=ts(n,t);if(!a)return r;let s=new Map((a.fields??[]).map(c=>[c.name,c])),l=r.fields.map(c=>{let d=s.get(c.name);if(!d)return c;let p=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 u=p.get(_.value);return u?{..._,label:u.label??_.label,description:u.description??_.description}:_})}});return{...r,title:a.title??r.title,description:a.description??r.description,submitLabel:a.submitLabel??r.submitLabel,fields:l}}var _a=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{}}},Oo=new _a;var ma=["off","error","warn","info","debug","trace"],ga=R.cssPrefix,rs=`${ga}.debug`,d_=`__${R.global}_DEBUG__`,u_=`${ga}-debug`,No=2,pa=null;function __(){if(typeof window>"u")return 2;try{let e=new URLSearchParams(window.location.search).get(u_);if(e!==null){let t=fa(e);if(t>=0)return t}}catch{}try{let e=window.localStorage?.getItem(rs);if(e){let t=fa(e);if(t>=0)return t}}catch{}return Reflect.get(window,d_)?4:2}function fa(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=ma.indexOf(e);if(t>=0)return t}return-1}function Do(e){let t=fa(e);if(!(t<0)){No=t;try{window.localStorage?.setItem(rs,ma[t])}catch{}}}function va(){return ma[No]}No=__();function as(e){let t=`[${ga}:${e}]`,n=(o,r,a)=>(s,l)=>{if(!(No<o)&&(l===void 0?console[r](t,s):console[r](t,s,l),pa))try{pa({level:a,scope:e,message:s,payload:l})}catch{}};return{error:n(1,"error","error"),warn:n(2,"warn","warn"),info:n(3,"info","info"),debug:n(4,"debug","debug"),trace:n(5,"debug","trace"),scope:o=>as(`${e}:${o}`)}}var ne=as("core");function is(e){pa=e}var Gt=ne.scope("context"),p_=new Set(["visitorId","conversationId","conversationId","jwt","token","authorization","password"]),ss=50,ha=1024,f_=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function ba(e){return ls(e,"userContext",!0)}function ya(e){return ls(e,"pageContext",!1)}function ls(e,t,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){Gt.warn(`ignored ${t} \u2014 expected an object`,{type:Array.isArray(e)?"array":typeof e});return}let o={},r=0;for(let[a,s]of Object.entries(e)){if(p_.has(a)){Gt.warn(`dropped reserved ${t} key "${a}" \u2014 managed by the widget, not host-settable`);continue}if(s==null)continue;if(r>=ss){Gt.warn(`${t} truncated at ${ss} keys \u2014 dropped "${a}"`);continue}let l=m_(t,a,s);l!==void 0&&(o[a]=l,r++)}return n&&typeof o.email=="string"&&!f_.test(o.email)&&(Gt.warn(`dropped malformed ${t}.email "${o.email}"`),delete o.email),Object.keys(o).length>0?o:void 0}function m_(e,t,n){if(typeof n=="boolean")return n;if(typeof n=="number"){if(!Number.isFinite(n)){Gt.warn(`dropped non-finite ${e}.${t}`);return}return n}if(typeof n=="string"){let o=n.trim();return o===""?void 0:o.length>ha?(Gt.warn(`truncated ${e}.${t} to ${ha} chars`),o.slice(0,ha)):o}Gt.warn(`dropped ${e}.${t} \u2014 only string/number/boolean values are allowed`,{type:typeof n})}var $o={maxBytes:10485760,maxCount:10,accept:"*/*"},cs={voice:"local"},ds={list:[],byTrigger:{}},Pa={enabled:!0,sampleRate:1},Fo={upload:"/pai/upload-file",transcribe:"/pai/transcribe-audio",submitForm:"/pai/submit-form"},mn={variant:"circle",size:"md",label:void 0,icon:"chat",hidden:!1},us={floating:["theme","textSize","history","close","clear","expand","fullscreen","popOut","sound","language"],inline:["theme","textSize","history","close","clear","fullscreen","popOut","sound","language"],standalone:["theme","textSize","history","clear","sound","language"],page:["theme","textSize","history","clear","sound","language"],modal:["theme","textSize","history","close","clear","fullscreen","popOut","sound","language"],drawer:["theme","textSize","history","close","clear","fullscreen","popOut","sound","language"]},xa={enabled:!0,volume:.3,events:void 0},_s={enabled:!0,events:void 0},ps=[{label:"tabConversations",layout:"chat"}];function gn(e){let t=e!==null&&typeof e=="object"?e:{},n=t.presentation??{},o=t.behavior??{},r=t.i18n??{},a=t.feedback??{},s=t.footer??{},l=t.header??{},{themeMode:c,themeOverrides:d}=g_(t.theme),p=n.mode??"floating",_=v_(r.defaultLocale),u=r.availableLocales??[r.locale??_],f=vn(r.locale??_,u,_),m=(t.baseUrl??R.defaultBaseUrl).replace(/\/$/,""),h=(t.agentApiBaseUrl??`${m}/api/agent`).replace(/\/$/,""),P=(t.dataApiBaseUrl??`${m}/api/data`).replace(/\/$/,"");return{widgetId:t.widgetId??"default",publicKey:t.publicKey,aiAgentDeploymentId:t.aiAgentDeploymentId,baseUrl:m,agentApiBaseUrl:h,dataApiBaseUrl:P,userContext:ba(t.userContext),pageContext:ya(t.pageContext),position:n.position??"bottom-right",themeMode:c,textSize:"normal",themeOverrides:d,mode:p,iframe:n.iframe??!1,responseMode:o.responseMode??"streaming",showReasoning:o.showReasoning??!1,showToolCalls:o.showToolCalls??!1,showSources:o.showSources??!1,enableMessageFeedback:!(o.disableMessageFeedback??!1),autoSendSuggestions:o.autoSendSuggestions??!1,popOutUrl:o.popOutUrl,features:{voice:t.features?.voice??cs.voice,fileUpload:!(t.features?.disableFileUpload??!1),humanInLoop:!(t.features?.disableHumanInLoop??!1),operatorRequest:t.features?.enableOperatorRequest===!0},forms:qn(t.forms,f),endpoints:{upload:t.endpoints?.upload??Fo.upload,transcribe:t.endpoints?.transcribe??Fo.transcribe,submitForm:t.endpoints?.submitForm??Fo.submitForm},attachments:{accept:t.composer?.attachments?.accept??$o.accept,maxBytes:t.composer?.attachments?.maxBytes??$o.maxBytes,maxCount:t.composer?.attachments?.maxCount??$o.maxCount},locale:f,defaultLocale:_,availableLocales:u,startMinimized:o.startMinimized??!0,actions:h_(p,l.actions),size:n.size??{},launcher:C_(t.launcher),sound:b_(a.sound),haptics:y_(a.haptics),strings:Mo(f,r.strings),stringsOverride:r.strings,composerDisclaimer:s.composerDisclaimer??"",poweredBy:x_(s.poweredBy),composer:S_(t.composer),modules:k_(t.modules),tracking:P_(t.tracking,P),storage:t.storage??Oo,onMessage:t.onMessage,onOpen:t.onOpen,onClose:t.onClose,onError:t.onError}}function g_(e){return typeof e=="string"?{themeMode:e,themeOverrides:{}}:e&&typeof e=="object"?{themeMode:"auto",themeOverrides:e}:{themeMode:"auto",themeOverrides:{}}}function v_(e){return e&&e!=="auto"?e:typeof navigator<"u"&&navigator.language?navigator.language:"en"}function vn(e,t,n){return t.length<=1||t.includes(e)?e:t.includes(n)?n:t[0]??e}function h_(e,t){return t??us[e]}function b_(e){return{enabled:e?.enabled??xa.enabled,volume:e?.volume??xa.volume,events:e?.events}}function y_(e){return{enabled:e?.enabled??_s.enabled,events:e?.events}}function P_(e,t){let n=e?.sampleRate??Pa.sampleRate;return{enabled:e?.enabled??Pa.enabled,endpoint:e?.endpoint??`${t}/pai/elements-px.gif`,sampleRate:Math.min(1,Math.max(0,Number.isFinite(n)?n:1)),token:e?.token}}function x_(e){let n={...{text:`Powered by ${R.displayName}`,href:R.siteUrl},...e};return!!(n.text||n.logoUrl)?n:null}function S_(e){let t=e?.sendButton;return{sendButton:{shape:t?.shape??"circle",icon:t?.icon??"arrowUp",variant:t?.variant??"filled"}}}function k_(e){let t=e===void 0?ps:e,n=new Set,o=[];for(let a of t.slice(0,4)){if(!a?.label||!a?.layout)continue;let s=a.contentTags?.filter(Boolean),l=a.id??s?.[0]??a.layout;for(;n.has(l);)l=`${l}-${o.length}`;n.add(l);let c={id:l,label:a.label,layout:a.layout};s&&s.length>0&&(c.contentTags=s),a.layout==="home"&&(c.brandName=a.brandName,c.greetingText=a.greetingText,c.showGreeting=!(a.hideGreeting??!1),c.showSearchBar=!(a.hideSearchBar??!1),c.showRecentConversations=!(a.hideRecentConversations??!1),a.userAvatars&&a.userAvatars.length>0&&(c.userAvatars=a.userAvatars),a.status&&(c.status=a.status),c.contentBlockTitle=a.contentBlockTitle),o.push(c)}let r=Object.fromEntries(o.map(a=>[a.id,a]));return{list:o,byId:r}}function qn(e,t){var a;if(!e?.length)return ds;let n=[],o=new Set;for(let s of e){if(!s?.id||o.has(s.id))continue;let l=os(s,t),c=(l.fields??[]).filter(p=>!!(p&&p.name&&p.label&&p.type)),d=(Array.isArray(l.on)?l.on:[l.on]).map(w_).filter(p=>p!==null);c.length===0||d.length===0||(o.add(l.id),n.push({id:l.id,triggers:d,when:l.when,fields:c,title:l.title,description:l.description,submitLabel:l.submitLabel,skippable:l.skippable??!1,frequency:l.frequency??"once",mirrorToContext:l.mirrorToContext??!0,reopenable:l.reopenable??!0,reviewable:l.reviewable??!0}))}let r={};for(let s of n)for(let l of s.triggers)(r[a=l.kind]??(r[a]=[])).push(s);return{list:n,byTrigger:r}}function w_(e){if(typeof e!="string")return null;if(e==="pre-chat"||e==="conversation-closed"||e==="panel-close"||e==="manual")return{kind:e};let[t,n]=e.split(":",2);if(t==="after-messages"){let o=Number(n);return Number.isFinite(o)&&o>0?{kind:"after-messages",param:o}:null}if(t==="idle"){let o=Number(n);return Number.isFinite(o)&&o>0?{kind:"idle",param:o}:null}return t==="page-area"&&n?{kind:"page-area",param:n}:null}function C_(e){let t=e?.callout?.text?{shape:"pill",position:"auto",delayMs:1200,autoDismissMs:0,animated:!0,persistent:!0,...e.callout}:null;return{variant:e?.variant??mn.variant,size:e?.size??mn.size,label:e?.label??mn.label,icon:e?.icon??mn.icon,hidden:e?.hidden??mn.hidden,callout:t}}function Sa(e,t,n,o){let r=vn(t,e.availableLocales,e.defaultLocale);if(r===e.locale&&n===e.themeMode&&o===e.textSize)return e;let a={...e};return r!==e.locale&&(a.locale=r,a.strings=Mo(r,e.stringsOverride)),n!==e.themeMode&&(a.themeMode=n),o!==e.textSize&&(a.textSize=o),a}var R_=["presentation","behavior","theme","launcher","header","composer","feedback","i18n","footer","features","tracking","endpoints"];function ka(e,t){if(!t)return e;let n={...e};for(let a of R_){let s=t[a];if(s===void 0)continue;let l=e[a];if(a==="theme"){l===void 0&&(n[a]=s);continue}a!=="i18n"&&(n[a]=fs(s,l))}t.modules!==void 0&&e.modules===void 0&&(n.modules=t.modules),t.dataApiBaseUrl!==void 0&&e.dataApiBaseUrl===void 0&&(n.dataApiBaseUrl=t.dataApiBaseUrl);let o=e.i18n,r=t.i18n;if(o||r){let a=fs(r??{},o);r?.availableLocales!==void 0&&(a.availableLocales=r.availableLocales),r?.defaultLocale!==void 0&&(a.defaultLocale=r.defaultLocale);let s=o?.strings,l=r?.strings;(s||l)&&(a.strings=T_(l,s)),n.i18n=a}return n}function fs(e,t){if(!t)return e;let n={...e};for(let[o,r]of Object.entries(t))r!==void 0&&(n[o]=r);return n}function T_(e,t){if(!e)return t;if(!t)return e;let n=Lo(e),o=Lo(t);if(!n&&!o)return{...e,...t};let r={},a=n?e:{en:e},s=o?t:{en:t};for(let[l,c]of Object.entries(a))r[l]={...c};for(let[l,c]of Object.entries(s))r[l]={...r[l],...c};return r}var I_=["clear","expand","fullscreen","popOut","sound","history","language","theme","textSize","close"],It=e=>e!=="false";var E_=[["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]],A_=[["mode","mode",e=>e],["position","position",e=>e],["iframe","iframe",It]],M_=[["width","width"],["height","height"]],L_=[["response-mode","responseMode",e=>e],["start-minimized","startMinimized",It],["show-reasoning","showReasoning",It],["show-tool-calls","showToolCalls",It],["show-sources","showSources",It],["disable-message-feedback","disableMessageFeedback",It],["auto-send-suggestions","autoSendSuggestions",It],["pop-out-url","popOutUrl"]],O_=[["locale","locale"]],Tv=new Set(I_);var N_=[["launcher-variant","variant",e=>e],["launcher-size","size",e=>e],["launcher-icon","icon"],["launcher-hidden","hidden",It]],D_=[["features-disable-file-upload","disableFileUpload",It],["features-voice","voice",e=>e]],$_=[["endpoint-upload","upload"],["endpoint-transcribe","transcribe"]],F_=[["user-id","id"],["user-email","email"],["user-name","name"]],B_=[["page-area","area"],["page-url","url"],["page-path","path"],["page-title","title"]],H_=["launcher-label","callout-text","callout-delay","actions","user-context","page-context"],U_=[E_,A_,M_,L_,O_,N_,D_,$_,F_,B_],z_=new Set(["iframe","start-minimized"]),q_=[...U_.flatMap(e=>e.map(([t])=>t).filter(t=>!z_.has(t))),...H_];function ms(e){return`${R.cssPrefix}:${e}`}function Vn(e,t,n){e.dispatchEvent(new CustomEvent(ms(t),{detail:n}))}function gs(e,t){let o=Object.entries(t).map(([r,a])=>{let s=ms(r),l=c=>a(c.detail);return e.addEventListener(s,l),[s,l]});return()=>{for(let[r,a]of o)e.removeEventListener(r,a)}}function dt(){let e=Date.now(),t=new Uint8Array(16);t[0]=Math.floor(e/2**40)&255,t[1]=Math.floor(e/2**32)&255,t[2]=e>>>24&255,t[3]=e>>>16&255,t[4]=e>>>8&255,t[5]=e&255,V_(t.subarray(6)),t[6]=t[6]&15|112,t[8]=t[8]&63|128;let n=Array.from(t,o=>o.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function V_(e){if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){crypto.getRandomValues(e);return}for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*256)}var jt=ne.scope("persistence");function hn(e,t=Oo,n){let o=n?`${e}.${n}`:e,r=`${R.cssPrefix}.storageVersion`,a=t.get(r)??void 0,s=a?`.v${a}`:"",l=`${R.cssPrefix}.${o}${s}`,c=`${R.cssPrefix}${s}.visitorId`,d=`${l}.conversationId`,p=`${l}.userPrefs`,_=`${l}.panelOpen`,u=`${l}.panelSize`,f=`${l}.calloutDismissed`,m=`${l}.sidebarCollapsed`,h=`${l}.activeModule`,P=`${l}.historyCount`,k=`${l}.formsDone`,S={getVisitorId(){let b=t.get(c);if(b)return b;let x=dt();return t.set(c,x),x},setVisitorId(b){jt.debug("setVisitorId (rebind)",{id:b,scope:o}),t.set(c,b)},loadConversationId(){return t.get(d)??void 0},saveConversationId(b){jt.trace("saveConversationId",{id:b,scope:o}),b?t.set(d,b):t.remove(d)},loadDraft(b){return t.get(`${l}.draft.${b}`)??""},saveDraft(b,x){let y=`${l}.draft.${b}`;x?t.set(y,x):t.remove(y)},loadUserPrefs(){let b=t.get(p);if(!b)return{};try{let x=JSON.parse(b);return vs(x)?x:{}}catch(x){return jt.warn("loadUserPrefs parse failed",{error:x}),{}}},saveUserPrefs(b){try{t.set(p,JSON.stringify(b))}catch(x){jt.warn("saveUserPrefs serialise failed",{error:x})}},patchUserPrefs(b){let x=S.loadUserPrefs();S.saveUserPrefs({...x,...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(u);return b==="normal"||b==="expanded"||b==="fullscreen"?b:null},savePanelSize(b){t.set(u,b)},loadCalloutDismissed(b){if(!b)return!1;let x=t.get(f);return!!x&&x===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(h)||null},saveActiveModule(b){t.set(h,b)},loadHistoryCount(){let b=t.get(P);if(!b)return null;let x=Number.parseInt(b,10);return Number.isFinite(x)&&x>=0?x:null},saveHistoryCount(b){t.set(P,String(b))},loadFormsDone(){let b=t.get(k);if(!b)return{};try{let x=JSON.parse(b);return vs(x)?x:{}}catch(x){return jt.warn("loadFormsDone parse failed",{error:x}),{}}},saveFormDone(b){try{let x=S.loadFormsDone();x[b]=Date.now(),t.set(k,JSON.stringify(x))}catch(x){jt.warn("saveFormDone serialise failed",{error:x})}},rememberStorageVersion(b){b&&b!==t.get(r)&&(jt.debug("rememberStorageVersion (force-reset on next load)",{version:b}),t.set(r,b))},clearConversation(){t.remove(d)}};return S}function vs(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var hs=`:host{--__P__-accent-user: __BRAND_ACCENT__;--__P__-accent: var(--__P__-accent-user);--__P__-accent-text-user: __BRAND_ACCENT_TEXT__;--__P__-accent-text: var(--__P__-accent-text-user);--__P__-accent-fg: var(--__P__-accent);--__P__-radius: __BRAND_RADIUS__;--__P__-radius-sm: 8px;--__P__-radius-md: 10px;--__P__-radius-lg: 16px;--__P__-font: __BRAND_FONT__;--__P__-font-display: var(--__P__-font);--__P__-font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;--__P__-bg: oklch(1 0 0);--__P__-bg-elevated: oklch(.9789 .0029 278.3);--__P__-surface: var(--__P__-bg-elevated);--__P__-muted: var(--__P__-fg-muted);--__P__-hover: oklch(.1686 .011 278.3 / .06);--__P__-fg: oklch(.1686 .011 278.3);--__P__-fg-muted: oklch(.4932 .0301 278.3);--__P__-border: oklch(.9312 .0084 278.3);--__P__-border-strong: oklch(.8757 .0131 278.3);--__P__-bubble-user: var(--__P__-accent);--__P__-bubble-user-text: var(--__P__-accent-text);--__P__-bubble-assistant: oklch(.9638 .0058 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-on-accent: var(--__P__-accent-text);--__P__-success: oklch(.6456 .1654 151.53);--__P__-warning: oklch(.7135 .1494 74.05);--__P__-danger: oklch(.5966 .1818 24.51);--__P__-danger-text: oklch(.5054 .1905 27.52);--__P__-danger-bg: oklch(.5966 .1818 24.51 / .1);--__P__-neutral: oklch(.7137 .0192 278.3);--__P__-pill-l-min: .3;--__P__-pill-l-max: .46;--__P__-focus: var(--__P__-accent);--__P__-shadow-panel: 0 8px 24px -8px rgba(13, 15, 20, .18), 0 24px 64px -24px rgba(13, 15, 20, .24);--__P__-shadow-card: 0 1px 2px rgba(13, 15, 20, .06), 0 4px 12px -6px rgba(13, 15, 20, .12);--__P__-backdrop: oklch(.1686 .011 278.3 / .55);--__P__-shadow-fab: 0 6px 16px -4px color-mix(in oklch, var(--__P__-accent) 45%, transparent), 0 12px 32px -12px rgba(13, 15, 20, .25);--__P__-z-fab: 2147483600;--__P__-z-panel: 2147483601;--__P__-panel-w: 380px;--__P__-panel-h: 600px;--__P__-fab-size: 56px;--__P__-conversation-max: 768px;--__P__-space-1: 4px;--__P__-space-2: 8px;--__P__-space-3: 12px;--__P__-space-4: 16px;--__P__-space-5: 20px;--__P__-space-6: 24px;--__P__-space-8: 32px;--__P__-text-scale: 1;--__P__-text-xs: calc(12px * var(--__P__-text-scale));--__P__-text-sm: calc(13px * var(--__P__-text-scale));--__P__-text-base: calc(15px * var(--__P__-text-scale));--__P__-text-md: calc(16px * var(--__P__-text-scale));--__P__-text-lg: calc(18px * var(--__P__-text-scale));--__P__-text-xl: calc(22px * var(--__P__-text-scale));--__P__-text-2xl: calc(30px * var(--__P__-text-scale))}:host([data-mode="modal"]),:host([data-mode="drawer"]){--__P__-conversation-max: 100%}:host([data-text-size="small"]){--__P__-text-scale: .9}:host([data-text-size="large"]){--__P__-text-scale: 1.15}:host{--__P__-ease: cubic-bezier(.2, .7, .2, 1);--__P__-ease-out: cubic-bezier(.2, .7, .2, 1);--__P__-ease-in: cubic-bezier(.4, 0, 1, 1);--__P__-ease-in-out: cubic-bezier(.65, 0, .35, 1);--__P__-dur-quick: .12s;--__P__-dur-base: .22s;--__P__-dur-slow: .32s;font-family:var(--__P__-font);color:var(--__P__-fg);color-scheme:light;--__P__-color-scheme: light}:host([data-theme="dark"]){--__P__-bg: oklch(.1783 .0128 278.3);--__P__-bg-elevated: oklch(.2232 .0182 278.3);--__P__-fg: oklch(.9368 .01 278.3);--__P__-fg-muted: oklch(.7048 .0296 278.3);--__P__-border: oklch(.2752 .0266 278.3);--__P__-border-strong: oklch(.335 .0291 278.3);--__P__-hover: oklch(.9368 .01 278.3 / .08);--__P__-bubble-assistant: oklch(.2474 .0311 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-danger-text: oklch(.8077 .1035 19.57);--__P__-danger-bg: oklch(.5966 .1818 24.51 / .18);--__P__-shadow-panel: 0 8px 24px -8px rgba(0, 0, 0, .6), 0 24px 64px -24px rgba(0, 0, 0, .7);--__P__-shadow-card: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 12px -6px rgba(0, 0, 0, .5);--__P__-backdrop: rgba(0, 0, 0, .65);--__P__-pill-l-min: .75;--__P__-pill-l-max: .92;color-scheme:dark;--__P__-color-scheme: dark}@media(prefers-color-scheme:dark){:host([data-theme="auto"]){--__P__-bg: oklch(.1783 .0128 278.3);--__P__-bg-elevated: oklch(.2232 .0182 278.3);--__P__-fg: oklch(.9368 .01 278.3);--__P__-fg-muted: oklch(.7048 .0296 278.3);--__P__-border: oklch(.2752 .0266 278.3);--__P__-border-strong: oklch(.335 .0291 278.3);--__P__-hover: oklch(.9368 .01 278.3 / .08);--__P__-bubble-assistant: oklch(.2474 .0311 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-pill-l-min: .75;--__P__-pill-l-max: .92;--__P__-shadow-panel: 0 8px 24px -8px rgba(0, 0, 0, .6), 0 24px 64px -24px rgba(0, 0, 0, .7);color-scheme:dark;--__P__-color-scheme: dark}}@supports (color: oklch(from red l c h)){:host{--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.3, l, .62) c h);--__P__-accent-text: oklch(from var(--__P__-accent) clamp(0, (l / .623 - 1) * -infinity, 1) 0 h);--__P__-accent-fg: oklch(from var(--__P__-accent-user) clamp(.3, l, .46) c h)}:host([data-theme="dark"]){--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.65, l, .85) c h);--__P__-accent-fg: var(--__P__-accent)}@media(prefers-color-scheme:dark){:host([data-theme="auto"]){--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.65, l, .85) c h);--__P__-accent-fg: var(--__P__-accent)}}}@media(prefers-reduced-motion:reduce){:host{--__P__-dur-quick: 1ms;--__P__-dur-base: 1ms;--__P__-dur-slow: 1ms}}
|
|
2
|
-
`;var
|
|
3
|
-
`;var ys=`.__P__-anchor{color-scheme:var(--__P__-color-scheme, light);right:16px;bottom:16px}.__P__-surface{display:contents}.__P__-surface[hidden]{display:none}:host([data-position="bottom-left"]) .__P__-anchor,:host([data-position="top-left"]) .__P__-anchor{right:auto;left:16px}:host([data-position="top-right"]) .__P__-anchor,:host([data-position="top-left"]) .__P__-anchor{bottom:auto;top:16px}.__P__-anchor{position:fixed;display:flex;flex-direction:column;align-items:flex-end;gap:var(--__P__-space-3);pointer-events:none}.__P__-anchor{--__P__-fab-size: 56px}.__P__-anchor[data-launcher-size=sm]{--__P__-fab-size: 44px}.__P__-anchor[data-launcher-size=md]{--__P__-fab-size: 56px}.__P__-anchor[data-launcher-size=lg]{--__P__-fab-size: 68px}.__P__-anchor>*{pointer-events:auto}.__P__-fab[data-size=sm]{--__P__-fab-size: 44px;font-size:var(--__P__-text-sm)}.__P__-fab[data-size=md]{--__P__-fab-size: 56px;font-size:calc(14px * var(--__P__-text-scale))}.__P__-fab[data-size=lg]{--__P__-fab-size: 68px;font-size:var(--__P__-text-base)}.__P__-fab{display:inline-flex;align-items:center;justify-content:center;gap:var(--__P__-space-2);color:var(--__P__-accent-text);background:var(--__P__-accent);box-shadow:var(--__P__-shadow-fab);font-weight:600;line-height:1;transform-origin:bottom right;animation:__P__-fab-in var(--__P__-dur-base) var(--__P__-ease) both;transition:transform var(--__P__-dur-base) var(--__P__-ease),opacity var(--__P__-dur-base) var(--__P__-ease),box-shadow var(--__P__-dur-base) var(--__P__-ease)}.__P__-fab:hover{transform:translateY(-2px)}.__P__-fab:active{transform:translateY(0)}.__P__-fab:focus-visible{outline:2px solid var(--__P__-on-accent);outline-offset:3px}.__P__-fab svg{width:24px;height:24px;flex-shrink:0}@keyframes __P__-fab-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:none}}.__P__-fab[data-leaving]{position:absolute;right:0;bottom:0;animation:__P__-fab-out var(--__P__-dur-quick) var(--__P__-ease) forwards;pointer-events:none}:host([data-position^="top-"]) .__P__-fab[data-leaving]{bottom:auto;top:0}:host([data-position$="-left"]) .__P__-fab[data-leaving]{right:auto;left:0}@keyframes __P__-fab-out{0%{opacity:1;transform:none}to{opacity:0;transform:scale(.85)}}.__P__-fab[data-variant=circle]{width:var(--__P__-fab-size);height:var(--__P__-fab-size);border-radius:999px}.__P__-fab[data-variant=circle] .__P__-fab-label{display:none}.__P__-fab[data-variant=pill]{height:var(--__P__-fab-size);padding:0 18px 0 16px;border-radius:999px}.__P__-fab[data-variant=bar]{height:var(--__P__-fab-size);padding:0 22px;border-radius:var(--__P__-radius)}.__P__-fab[data-variant=minimal]{height:var(--__P__-fab-size);padding:0 var(--__P__-space-4);border-radius:999px;background:transparent;color:var(--__P__-accent-fg);box-shadow:none;border:1px solid currentColor}.__P__-fab[data-variant=minimal]:hover{background:color-mix(in srgb,var(--__P__-accent) 12%,transparent)}.__P__-callout{--__P__-callout-fab-h: var(--__P__-fab-size, 56px);--__P__-callout-gap: clamp(12px, calc(var(--__P__-callout-fab-h) * .25), 22px);--__P__-callout-nudge-direction: -1;position:absolute;display:inline-flex;align-items:center;gap:var(--__P__-space-2);padding:10px 14px;background:var(--__P__-fg);color:var(--__P__-bg);border-radius:999px;font-size:var(--__P__-text-sm);font-weight:600;line-height:1.2;box-shadow:0 10px 30px -8px #00000059;pointer-events:auto;animation:__P__-callout-in var(--__P__-dur-slow) var(--__P__-ease);z-index:1;max-width:240px;white-space:nowrap}.__P__-callout[data-position=left]{right:calc(100% + var(--__P__-callout-gap));bottom:calc(var(--__P__-callout-fab-h) / 2);transform:translateY(50%)}.__P__-callout[data-position=right]{left:calc(100% + var(--__P__-callout-gap));bottom:calc(var(--__P__-callout-fab-h) / 2);transform:translateY(50%);--__P__-callout-nudge-direction: 1}.__P__-callout[data-position=top]{bottom:calc(100% + var(--__P__-callout-gap));right:0;max-width:min(280px,calc(100vw - 32px))}.__P__-callout[data-position=bottom]{top:calc(100% + var(--__P__-callout-gap));right:0;max-width:min(280px,calc(100vw - 32px))}:host([data-position$="-left"]) .__P__-callout[data-position=top],:host([data-position$="-left"]) .__P__-callout[data-position=bottom]{right:auto;left:0}.__P__-callout[data-shape=bubble]{border-radius:var(--__P__-radius-md);white-space:normal;width:max-content;max-width:min(280px,calc(100vw - 32px))}.__P__-callout[data-shape=callout]{padding:12px 18px;font-size:calc(14px * var(--__P__-text-scale));background:var(--__P__-accent);color:var(--__P__-accent-text)}.__P__-callout:after{content:"";position:absolute;width:12px;height:12px;background:inherit;border-radius:2px;transform:rotate(45deg)}.__P__-callout[data-position=left]:after{right:-5px;top:50%;margin-top:-6px}.__P__-callout[data-position=right]:after{left:-5px;top:50%;margin-top:-6px}.__P__-callout[data-position=top]:after{bottom:-5px;right:calc(var(--__P__-fab-size, 56px) / 2 - 6px)}.__P__-callout[data-position=bottom]:after{top:-5px;right:calc(var(--__P__-fab-size, 56px) / 2 - 6px)}:host([data-position$="-left"]) .__P__-callout[data-position=top]:after,:host([data-position$="-left"]) .__P__-callout[data-position=bottom]:after{right:auto;left:calc(var(--__P__-fab-size, 56px) / 2 - 6px)}.__P__-callout[data-animated]{animation:__P__-callout-in var(--__P__-dur-slow) var(--__P__-ease),__P__-callout-nudge 1.6s var(--__P__-ease-in-out) var(--__P__-dur-slow) infinite}@keyframes __P__-callout-in{0%{opacity:0}to{opacity:1}}@keyframes __P__-callout-nudge{0%,to{margin-left:0;margin-right:0}50%{margin-left:calc(6px * var(--__P__-callout-nudge-direction));margin-right:calc(-6px * var(--__P__-callout-nudge-direction))}}@media(prefers-reduced-motion:reduce){.__P__-callout[data-animated]{animation:__P__-callout-in 1ms var(--__P__-ease)}.__P__-icon-btn[data-recording=true],.__P__-typing span{animation:none}}.__P__-callout-close{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;border-radius:999px;color:inherit;opacity:.7;cursor:pointer}.__P__-callout-close:hover{opacity:1;background:color-mix(in srgb,currentColor 15%,transparent)}.__P__-callout-close:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-callout-close svg{width:12px;height:12px}.__P__-panel{width:var(--__P__-panel-w);height:var(--__P__-panel-h);max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);background:var(--__P__-bg);color:var(--__P__-fg);border-radius:var(--__P__-radius-lg);box-shadow:var(--__P__-shadow-panel);display:flex;flex-direction:column;overflow:hidden;overscroll-behavior:none;transform-origin:bottom right;animation:__P__-panel-in var(--__P__-dur-slow) var(--__P__-ease);border:1px solid var(--__P__-border)}@media(prefers-reduced-motion:no-preference){.__P__-panel{transition:width var(--__P__-dur-base) var(--__P__-ease),height var(--__P__-dur-base) var(--__P__-ease),max-width var(--__P__-dur-base) var(--__P__-ease),max-height var(--__P__-dur-base) var(--__P__-ease)}.__P__-panel[data-resizing]{transition:none}}:host([data-mode="open"]) .__P__-panel{width:var(--__P__-widget-w, var(--__P__-panel-w));height:var(--__P__-widget-h, var(--__P__-panel-h));min-width:var(--__P__-resize-min-w, auto);min-height:var(--__P__-resize-min-h, auto);max-width:var(--__P__-resize-max-w, calc(100vw - 32px) );max-height:var(--__P__-resize-max-h, calc(100dvh - 32px) )}@keyframes __P__-panel-in{0%{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:none}}:host([data-mode="expanded"]) .__P__-panel{width:var(--__P__-expanded-w, 640px);height:var(--__P__-expanded-h, 820px);max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px)}:host([data-mode="fullscreen"]){z-index:var(--__P__-z-panel)!important}:host([data-mode="fullscreen"]) .__P__-anchor{inset:var(--__P__-visual-viewport-top, 0px) 0 auto;height:var(--__P__-visual-viewport-height, 100dvh);padding:0;justify-content:flex-end;align-items:flex-end}:host([data-mode="fullscreen"][data-position*="top"]) .__P__-anchor{justify-content:flex-start}:host([data-mode="fullscreen"][data-position*="left"]) .__P__-anchor{align-items:flex-start}:host([data-mode="fullscreen"]) .__P__-panel{width:100vw;height:100%;max-width:none;max-height:none;border-radius:0;border:0}:host([data-mode="fullscreen"]) .__P__-fab{display:none}@media(max-width:640px){:host([data-mode="open"]) .__P__-anchor,:host([data-mode="expanded"]) .__P__-anchor{inset:var(--__P__-visual-viewport-top, 0px) 0 auto;align-items:stretch;height:var(--__P__-visual-viewport-height, 100dvh);padding:0}:host([data-mode="open"]) .__P__-panel,:host([data-mode="expanded"]) .__P__-panel{width:100vw;height:100%;max-width:none;max-height:none;border-radius:0;border:0}}:host([data-mode="inline"]) .__P__-anchor,:host([data-mode="standalone"]) .__P__-anchor{position:static;inset:auto;padding:0;align-items:stretch;width:100%;height:100%;min-height:0}:host([data-mode="inline"]) .__P__-panel,:host([data-mode="standalone"]) .__P__-panel{width:100%;height:100%;min-width:0;min-height:0;max-width:none;max-height:none;animation:none}:host([data-mode="inline"]) .__P__-fab,:host([data-mode="standalone"]) .__P__-fab{display:none}:host([data-mode="inline"]){min-height:320px}:host([data-mode="inline"]) .__P__-panel{border-radius:var(--__P__-radius)}:host([data-mode="standalone"]) .__P__-panel{border-radius:0;border:0;box-shadow:none}:host([data-mode="modal"]){position:fixed!important;inset:0!important;z-index:var(--__P__-z-panel)!important;display:block!important;width:100vw;height:100dvh;background:var(--__P__-modal-backdrop, var(--__P__-backdrop));animation:__P__-backdrop-in var(--__P__-dur-base) var(--__P__-ease) both;--__P__-panel-w: min(960px, 92vw);--__P__-panel-h: min(720px, 88dvh)}:host([data-mode="modal"]) .__P__-anchor{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:var(--__P__-space-6);pointer-events:none}:host([data-mode="modal"]) .__P__-panel{pointer-events:auto;width:var(--__P__-widget-w, var(--__P__-panel-w));height:var(--__P__-widget-h, var(--__P__-panel-h));max-width:calc(100vw - 48px);max-height:calc(100dvh - 48px);min-width:0;min-height:0;border-radius:var(--__P__-radius);box-shadow:var(--__P__-shadow-panel);animation:__P__-modal-in var(--__P__-dur-base) var(--__P__-ease);translate:var(--__P__-modal-dx, 0px) var(--__P__-modal-dy, 0px)}:host([data-mode="modal"]) .__P__-header,:host([data-mode="modal"]) .__P__-back-header,:host([data-mode="modal"]) .__P__-home-hero{cursor:grab;touch-action:none}:host([data-mode="modal"]) .__P__-panel[data-dragging]{cursor:grabbing;user-select:none}:host([data-mode="modal"]) .__P__-panel[data-dragging] *{cursor:grabbing}:host([data-mode="modal"]) .__P__-fab{display:none}@keyframes __P__-backdrop-in{0%{background:#0000}to{background:var(--__P__-modal-backdrop, var(--__P__-backdrop))}}@keyframes __P__-modal-in{0%{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}:host([data-mode="drawer"]){--__P__-panel-w: min(440px, calc(100vw - 32px) );--__P__-panel-h: 100dvh}:host([data-mode="drawer"]) .__P__-anchor{position:fixed;--__P__-inset-x: var(--__P__-panel-inset, 12px);--__P__-inset-y: var(--__P__-panel-inset, 3dvh);top:var(--__P__-inset-y);bottom:auto;right:var(--__P__-inset-x);left:auto;width:min(var(--__P__-widget-w, var(--__P__-panel-w)),calc(100vw - var(--__P__-inset-x) * 2));height:min(var(--__P__-widget-h, var(--__P__-panel-h)),calc(100dvh - var(--__P__-inset-y) * 2));padding:0;display:block;pointer-events:auto}:host([data-mode="drawer"][data-position$="-left"]) .__P__-anchor{right:auto;left:var(--__P__-inset-x)}:host([data-mode="drawer"][data-position^="bottom-"]) .__P__-anchor{top:auto;bottom:var(--__P__-inset-y)}:host([data-mode="drawer"]) .__P__-panel{width:100%;height:100%;max-width:none;max-height:none;min-width:0;min-height:0;border-radius:var(--__P__-radius, 12px);border:1px solid var(--__P__-border);box-shadow:-8px 16px 32px -12px #00000038;animation:__P__-drawer-in var(--__P__-dur-base) var(--__P__-ease)}:host([data-mode="drawer"][data-position$="-left"]) .__P__-panel{box-shadow:8px 16px 32px -12px #00000038;animation:__P__-drawer-in-left var(--__P__-dur-base) var(--__P__-ease)}.__P__-fab[data-edge-tab]{display:inline-flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--__P__-space-2);position:fixed;top:50%;height:140px;width:auto;min-width:0;padding:10px 8px;writing-mode:vertical-rl;text-orientation:mixed;transform:translateY(-50%);transform-origin:center;animation:__P__-edge-tab-in var(--__P__-dur-base) var(--__P__-ease) both}.__P__-fab[data-edge-tab] svg{writing-mode:horizontal-tb}.__P__-fab[data-edge-tab]:hover{transform:translateY(-50%) scale(1.03)}.__P__-fab[data-edge-tab]:active{transform:translateY(-50%) scale(.97)}:host([data-position$="-right"]) .__P__-fab[data-edge-tab]{right:0;left:auto;border-radius:12px 0 0 12px;box-shadow:-6px 0 18px -8px #0000004d}:host([data-position$="-left"]) .__P__-fab[data-edge-tab]{left:0;right:auto;border-radius:0 12px 12px 0;box-shadow:6px 0 18px -8px #0000004d}.__P__-fab[data-edge-tab][data-leaving]{position:fixed;top:50%;bottom:auto;animation:__P__-edge-tab-out var(--__P__-dur-quick) var(--__P__-ease) forwards}@keyframes __P__-edge-tab-in{0%{opacity:0;transform:translateY(-50%) scale(.9)}to{opacity:1;transform:translateY(-50%) scale(1)}}@keyframes __P__-edge-tab-out{0%{opacity:1;transform:translateY(-50%) scale(1)}to{opacity:0;transform:translateY(-50%) scale(.85)}}@keyframes __P__-drawer-in{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes __P__-drawer-in-left{0%{transform:translate(-100%)}to{transform:translate(0)}}@media(prefers-reduced-motion:reduce){:host([data-mode="drawer"]) .__P__-panel,.__P__-fab[data-edge-tab]{animation:none}}.__P__-header{display:flex;align-items:center;gap:var(--__P__-space-2);padding:10px 12px;border-bottom:1px solid var(--__P__-border);background:var(--__P__-bg)}.__P__-header h1{font-size:calc(14px * var(--__P__-text-scale));font-weight:600;flex:1;letter-spacing:-.01em}.__P__-header-actions{margin-inline-start:auto;display:flex;align-items:center;gap:var(--__P__-space-1);flex-shrink:0}.__P__-agent{flex:1;display:inline-flex;align-items:center;gap:10px;min-width:0}.__P__-agent-avatar{position:relative;width:32px;height:32px;border-radius:999px;background:var(--__P__-bg-elevated);color:var(--__P__-fg-muted);display:inline-flex;align-items:center;justify-content:center;font-weight:700;font-size:var(--__P__-text-xs);overflow:hidden;flex-shrink:0}.__P__-agent-avatar img{width:100%;height:100%;object-fit:cover}.__P__-agent-avatar:after{content:"";position:absolute;right:-1px;bottom:-1px;width:10px;height:10px;border-radius:999px;border:2px solid var(--__P__-bg);background:var(--__P__-neutral)}.__P__-agent-avatar[data-status=online]:after{background:var(--__P__-success)}.__P__-agent-avatar[data-status=away]:after{background:var(--__P__-warning)}.__P__-agent-avatar[data-status=offline]:after{background:var(--__P__-neutral)}.__P__-agent-meta{display:flex;flex-direction:column;line-height:1.15;min-width:0}.__P__-agent-meta strong{font-size:calc(14px * var(--__P__-text-scale));font-weight:600;letter-spacing:-.01em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-agent-meta span{font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-suggestions{display:flex;flex-wrap:nowrap;gap:var(--__P__-space-2);padding:6px 14px 10px;overflow-x:auto;overflow-y:hidden;scroll-behavior:smooth;scroll-snap-type:x proximity;scrollbar-width:none;-ms-overflow-style:none;min-width:0}.__P__-suggestions::-webkit-scrollbar{display:none}.__P__-suggestions:before,.__P__-suggestions:after{content:"";flex:1 1 0;min-width:0}.__P__-suggestion{flex:0 0 auto;scroll-snap-align:center;padding:7px 14px;border-radius:999px;background:var(--__P__-bg-elevated);border:1px solid var(--__P__-border);color:var(--__P__-fg);font-size:var(--__P__-text-sm);font-weight:500;white-space:nowrap;transition:background var(--__P__-dur-quick) var(--__P__-ease),border-color var(--__P__-dur-quick) var(--__P__-ease),transform var(--__P__-dur-quick) var(--__P__-ease)}.__P__-suggestion:hover{border-color:var(--__P__-accent);color:var(--__P__-accent-fg);transform:translateY(-1px)}.__P__-suggestion:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px;border-color:var(--__P__-accent)}.__P__-suggestion:active{transform:translateY(0)}.__P__-icon-btn{width:32px;height:32px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;color:var(--__P__-fg-muted);transition:background var(--__P__-dur-quick) var(--__P__-ease),color var(--__P__-dur-quick) var(--__P__-ease)}.__P__-icon-btn:hover{background:var(--__P__-bg-elevated);color:var(--__P__-fg)}.__P__-icon-btn:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-icon-btn:active{background:var(--__P__-border)}.__P__-icon-btn:disabled{opacity:.45;cursor:not-allowed}.__P__-icon-btn:before{content:"";position:absolute;inset:-6px}.__P__-icon-btn{position:relative}.__P__-icon-btn svg{width:18px;height:18px}.__P__-icon-btn[data-recording=true]{color:var(--__P__-accent-fg);background:color-mix(in srgb,var(--__P__-accent) 12%,transparent);animation:__P__-pulse 1.2s var(--__P__-ease) infinite}@keyframes __P__-pulse{0%,to{box-shadow:0 0 color-mix(in srgb,var(--__P__-accent) 40%,transparent)}50%{box-shadow:0 0 0 6px color-mix(in srgb,var(--__P__-accent) 0%,transparent)}}.__P__-list,.__P__-history,.__P__-module-scroll,.__P__-home-scroll,.__P__-help-list,.__P__-toolui-code,.__P__-sidebar-conversations{scrollbar-width:thin;scrollbar-color:var(--__P__-border-strong) transparent;overscroll-behavior:contain;scrollbar-gutter:stable}.__P__-list::-webkit-scrollbar,.__P__-history::-webkit-scrollbar,.__P__-module-scroll::-webkit-scrollbar,.__P__-home-scroll::-webkit-scrollbar,.__P__-help-list::-webkit-scrollbar,.__P__-toolui-code::-webkit-scrollbar,.__P__-sidebar-conversations::-webkit-scrollbar{width:8px}.__P__-list::-webkit-scrollbar-thumb,.__P__-history::-webkit-scrollbar-thumb,.__P__-module-scroll::-webkit-scrollbar-thumb,.__P__-home-scroll::-webkit-scrollbar-thumb,.__P__-help-list::-webkit-scrollbar-thumb,.__P__-toolui-code::-webkit-scrollbar-thumb,.__P__-sidebar-conversations::-webkit-scrollbar-thumb{background:var(--__P__-border-strong);border-radius:8px}.__P__-list-wrap{position:relative;flex:1;min-height:0;display:flex;flex-direction:column}.__P__-jump{position:absolute;inset-inline-end:14px;bottom:14px;z-index:2;display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;border-radius:999px;border:1px solid var(--__P__-border);background:var(--__P__-bg-elevated);color:var(--__P__-fg);box-shadow:var(--__P__-shadow-panel);cursor:pointer;opacity:.85;transition:opacity var(--__P__-dur-quick) var(--__P__-ease),transform var(--__P__-dur-quick) var(--__P__-ease);animation:__P__-bubble-in var(--__P__-dur-base) var(--__P__-ease)}.__P__-jump:hover{opacity:1}.__P__-jump:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;opacity:1}.__P__-jump:active{transform:translateY(1px)}.__P__-jump svg{width:18px;height:18px}.__P__-list{flex:1;min-height:0;overflow-y:auto;padding:var(--__P__-space-4);padding-bottom:var(--__P__-space-8);display:flex;flex-direction:column;gap:14px}.__P__-list--fade{--__P__-fade-size: 20px;--__P__-fade-top: 0px;--__P__-fade-bottom: 0px;-webkit-mask-image:linear-gradient(to bottom,transparent 0,#000 var(--__P__-fade-top),#000 calc(100% - var(--__P__-fade-bottom)),transparent 100%);mask-image:linear-gradient(to bottom,transparent 0,#000 var(--__P__-fade-top),#000 calc(100% - var(--__P__-fade-bottom)),transparent 100%)}.__P__-list--fade[data-fade-top=true]{--__P__-fade-top: var(--__P__-fade-size)}.__P__-list--fade[data-fade-bottom=true]{--__P__-fade-bottom: var(--__P__-fade-size)}.__P__-list>*{width:100%;max-width:var(--__P__-conversation-max, 768px);margin-inline:auto}.__P__-load-previous,.__P__-history-more{display:flex;justify-content:center}.__P__-load-previous button,.__P__-history-more button{border:0;padding:4px 8px;background:transparent;color:var(--__P__-accent);font:inherit;font-size:var(--__P__-text-sm);font-weight:600;cursor:pointer}.__P__-load-previous button:hover,.__P__-history-more button:hover{text-decoration:underline}.__P__-load-previous button:focus-visible,.__P__-history-more button:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;border-radius:var(--__P__-radius-sm)}.__P__-load-previous button:disabled,.__P__-history-more button:disabled{cursor:wait;opacity:.6}.__P__-date-divider{display:flex;justify-content:center;margin-block:var(--__P__-space-3)}.__P__-date-pill{padding:3px 10px;border-radius:999px;font-size:calc(11px * var(--__P__-text-scale));font-weight:600;color:var(--__P__-fg-muted);background:var(--__P__-bg-elevated);border:1px solid var(--__P__-border);box-shadow:var(--__P__-shadow-card)}.__P__-bubble-row{display:flex}.__P__-bubble-row[data-role=user]{justify-content:flex-end}.__P__-bubble-row[data-role=assistant]{justify-content:flex-start}.__P__-bubble{max-width:100%;min-width:0;padding:var(--__P__-space-3) var(--__P__-space-4);border-radius:var(--__P__-radius);line-height:1.6;font-size:calc(14px * var(--__P__-text-scale));word-wrap:break-word;overflow-wrap:break-word;box-shadow:0 1px 2px #0000000a,0 1px 8px -4px #0000000f;animation:__P__-bubble-in var(--__P__-dur-base) var(--__P__-ease)}.__P__-bubble ::selection{background:color-mix(in srgb,var(--__P__-accent) 30%,transparent)}.__P__-bubble-row[data-role=user] .__P__-bubble ::selection{background:#fff6;color:var(--__P__-bubble-user-text)}@keyframes __P__-bubble-in{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}.__P__-bubble-row[data-role=user] .__P__-bubble{background:var(--__P__-bubble-user);color:var(--__P__-bubble-user-text);border-end-end-radius:5px}.__P__-bubble-row[data-role=assistant] .__P__-bubble{background:var(--__P__-bubble-assistant);color:var(--__P__-bubble-assistant-text);border:1px solid var(--__P__-border);border-end-start-radius:5px}.__P__-bubble-row[data-role=operator] .__P__-bubble{display:flex;align-items:stretch;padding:0;overflow:hidden;background:var(--__P__-bubble-assistant);color:var(--__P__-bubble-assistant-text);border-end-start-radius:5px}.__P__-bubble-row[data-role=operator] .__P__-bubble-col{align-items:flex-start}.__P__-bubble-author{display:flex;flex:0 0 auto;align-items:center;padding:0 .875rem;border-inline-end:1px solid color-mix(in oklab,var(--__P__-accent),transparent 60%);color:var(--__P__-accent);font-size:calc(13px * var(--__P__-text-scale));font-weight:600;letter-spacing:.025em;user-select:none}.__P__-bubble-row[data-role=operator] .__P__-bubble-body{flex:1 1 auto;min-width:0;padding:var(--__P__-space-3) var(--__P__-space-4)}.__P__-bubble-col{display:flex;flex-direction:column;max-width:85%;min-width:0}.__P__-bubble-row[data-role=user] .__P__-bubble-col{align-items:flex-end}.__P__-bubble-row[data-role=assistant] .__P__-bubble-col{align-items:flex-start}.__P__-bubble-row[data-role=assistant] .__P__-bubble-col:has(.__P__-toolui){width:100%}.__P__-bubble-row[data-role=assistant] .__P__-bubble-col:has(.__P__-toolui) .__P__-bubble{width:100%}@media(max-width:640px){.__P__-bubble-col{max-width:92%}.__P__-toolui:not(.__P__-toolui-collapsible){padding:var(--__P__-space-3);gap:var(--__P__-space-2)}details.__P__-toolui-collapsible>summary{padding:var(--__P__-space-2) var(--__P__-space-3)}details.__P__-toolui-collapsible>.__P__-toolui-section{margin:var(--__P__-space-3)}.__P__-toolui-section,.__P__-toolui-desc{padding:var(--__P__-space-2) var(--__P__-space-3)}}.__P__-bubble-meta{display:flex;align-items:center;gap:8px;margin-top:2px;padding:0 2px;min-height:24px}.__P__-bubble-actions{display:flex;align-items:center;gap:2px}.__P__-bubble-time{font-size:calc(11px * var(--__P__-text-scale));line-height:1;color:var(--__P__-fg-muted);user-select:none}.__P__-feedback{display:flex;align-items:center;gap:2px}.__P__-msg-action{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border:0;border-radius:var(--__P__-radius-sm);background:transparent;color:var(--__P__-fg-muted);cursor:pointer;opacity:.65;transition:opacity var(--__P__-dur-quick) var(--__P__-ease),background var(--__P__-dur-quick) var(--__P__-ease),color var(--__P__-dur-quick) var(--__P__-ease)}.__P__-msg-action:hover{opacity:1;background:var(--__P__-bg-elevated);color:var(--__P__-fg)}.__P__-msg-action:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;opacity:1}.__P__-msg-action[data-active=true]{opacity:1;color:var(--__P__-accent-fg)}.__P__-msg-action svg{width:15px;height:15px}.__P__-md>*:first-child{margin-top:0}.__P__-md>*:last-child{margin-bottom:0}.__P__-md p{margin:10px 0}.__P__-md h1,.__P__-md h2,.__P__-md h3,.__P__-md h4,.__P__-md h5,.__P__-md h6{margin:18px 0 8px;line-height:1.3;letter-spacing:-.01em;font-weight:700}.__P__-md h1{font-size:1.4em}.__P__-md h2{font-size:1.22em}.__P__-md h3{font-size:1.08em}.__P__-md h4,.__P__-md h5,.__P__-md h6{font-size:1em}.__P__-md>h1:first-child,.__P__-md>h2:first-child,.__P__-md>h3:first-child,.__P__-md>h4:first-child,.__P__-md>h5:first-child,.__P__-md>h6:first-child{margin-top:0}.__P__-md ul,.__P__-md ol{padding-inline-start:1.5em;margin:10px 0}.__P__-md ul{list-style:disc}.__P__-md ol{list-style:decimal}.__P__-md li{margin:6px 0;padding-inline-start:2px}.__P__-md li::marker{color:var(--__P__-fg-muted)}.__P__-md li>p{margin:6px 0}.__P__-md li>ul,.__P__-md li>ol{margin:6px 0}.__P__-md strong,.__P__-md b{font-weight:650;letter-spacing:-.005em}.__P__-md em,.__P__-md i{font-style:italic}.__P__-md code{font-family:var(--__P__-font-mono);font-size:.86em;padding:1px 6px;border-radius:5px;background:color-mix(in srgb,var(--__P__-accent) 10%,transparent);color:var(--__P__-fg);border:1px solid color-mix(in srgb,var(--__P__-accent) 16%,transparent)}.__P__-md pre{font-family:var(--__P__-font-mono);font-size:calc(12.5px * var(--__P__-text-scale));padding:12px 14px;border-radius:var(--__P__-radius-sm);background:#7f7f7f1f;overflow-x:auto;margin:var(--__P__-space-3) 0;line-height:1.5}.__P__-md pre code{padding:0;background:none}.__P__-md a{color:inherit;text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px}.__P__-md a:hover{text-decoration-thickness:2px}.__P__-md blockquote{margin:14px 0;padding:6px 14px;border-inline-start:3px solid color-mix(in srgb,var(--__P__-accent) 50%,transparent);background:color-mix(in srgb,var(--__P__-accent) 5%,transparent);border-start-end-radius:var(--__P__-radius-sm);border-end-end-radius:var(--__P__-radius-sm);color:var(--__P__-fg-muted)}.__P__-md blockquote>:first-child{margin-top:0}.__P__-md blockquote>:last-child{margin-bottom:0}.__P__-md hr{border:0;height:1px;background:color-mix(in srgb,currentColor 18%,transparent);margin:var(--__P__-space-4) 0}.__P__-md table{border-collapse:collapse;margin:var(--__P__-space-3) 0;font-size:.95em;display:block;overflow-x:auto;max-width:100%;font-variant-numeric:tabular-nums}.__P__-md th,.__P__-md td{padding:6px 10px;border-bottom:1px solid color-mix(in srgb,currentColor 12%,transparent);text-align:start}.__P__-md th{font-weight:700;background:color-mix(in srgb,currentColor 6%,transparent)}.__P__-md h1+ul,.__P__-md h1+ol,.__P__-md h2+ul,.__P__-md h2+ol,.__P__-md h3+ul,.__P__-md h3+ol,.__P__-md h4+ul,.__P__-md h4+ol{margin-top:var(--__P__-space-1)}.__P__-loading{display:inline-flex;align-items:center;gap:var(--__P__-space-2);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm)}.__P__-loading-spinner{width:14px;height:14px;border-radius:999px;border:2px solid currentColor;border-top-color:transparent;animation:__P__-spin .8s linear infinite}@keyframes __P__-spin{to{transform:rotate(1turn)}}.__P__-typing{display:inline-flex;gap:var(--__P__-space-1);padding:var(--__P__-space-1) 0}.__P__-typing span{width:5px;height:5px;border-radius:999px;background:currentColor;opacity:.4;animation:__P__-blink 1.2s var(--__P__-ease) infinite}.__P__-typing span:nth-child(2){animation-delay:.2s}.__P__-typing span:nth-child(3){animation-delay:.4s}@keyframes __P__-blink{0%,80%,to{opacity:.3;transform:translateY(0)}40%{opacity:1;transform:translateY(-2px)}}.__P__-reasoning{margin:var(--__P__-space-1) 0 var(--__P__-space-2);padding-inline-start:var(--__P__-space-3);border-inline-start:2px solid var(--__P__-border-strong)}.__P__-reasoning-summary{display:inline-flex;align-items:center;gap:var(--__P__-space-1);cursor:pointer;list-style:none;user-select:none;color:var(--__P__-fg-muted);font-size:var(--__P__-text-xs);font-weight:600}.__P__-reasoning-summary:hover{color:var(--__P__-fg)}.__P__-reasoning-summary:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;border-radius:var(--__P__-radius-sm)}.__P__-reasoning-summary::-webkit-details-marker{display:none}.__P__-reasoning-summary:before{content:"";width:5px;height:5px;border-inline-end:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:rotate(-45deg);opacity:.7;transition:transform var(--__P__-dur-quick) var(--__P__-ease)}.__P__-reasoning[open] .__P__-reasoning-summary:before{transform:rotate(45deg)}.__P__-reasoning[data-active=true] .__P__-reasoning-label{animation:__P__-reasoning-pulse 1.4s var(--__P__-ease) infinite}@keyframes __P__-reasoning-pulse{0%,to{opacity:.5}50%{opacity:1}}@media(prefers-reduced-motion:reduce){.__P__-reasoning[data-active=true] .__P__-reasoning-label{animation:none}}.__P__-reasoning-body{margin-top:var(--__P__-space-1);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm)}.__P__-reasoning-body>:first-child{margin-top:0}.__P__-reasoning-body>:last-child{margin-bottom:0}.__P__-source{display:inline-flex;align-items:center;gap:6px;max-width:100%;margin-top:6px;margin-inline-end:6px;padding:var(--__P__-space-1) var(--__P__-space-2);border-radius:999px;background:var(--__P__-bg-elevated);border:1px solid var(--__P__-border);color:var(--__P__-fg-muted);font-size:var(--__P__-text-xs);text-decoration:none}a.__P__-source:hover{color:var(--__P__-fg);border-color:var(--__P__-accent)}.__P__-source-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-composer{border-top:1px solid var(--__P__-border);padding:10px 12px;background:var(--__P__-bg);display:flex;flex-direction:column;gap:var(--__P__-space-2)}.__P__-composer>*{width:100%;max-width:var(--__P__-conversation-max, 768px);margin-inline:auto}.__P__-composer-row{display:flex;align-items:flex-end;gap:6px}.__P__-textarea{flex:1;--__P__-textarea-base-height: 40px;height:var(--__P__-textarea-base-height);max-height:160px;padding:10px 12px;border-radius:var(--__P__-radius);background:var(--__P__-bg-elevated);border:1px solid transparent;font-size:calc(14px * var(--__P__-text-scale));line-height:1.4;transition:height var(--__P__-dur-quick) var(--__P__-ease),border-color var(--__P__-dur-quick) var(--__P__-ease)}.__P__-textarea:focus-visible{outline:none;border-color:var(--__P__-focus)}@media(pointer:coarse){.__P__-textarea{--__P__-textarea-base-height: 44px}}.__P__-send{width:40px;height:40px;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;transition:opacity var(--__P__-dur-quick) var(--__P__-ease),transform var(--__P__-dur-quick) var(--__P__-ease),background var(--__P__-dur-quick) var(--__P__-ease)}.__P__-send[data-shape=circle]{border-radius:999px}.__P__-send[data-shape=square]{border-radius:var(--__P__-radius-sm)}.__P__-send[data-shape=pill]{width:auto;padding:0 18px;border-radius:999px}.__P__-send[data-variant=filled]{background:var(--__P__-accent);color:var(--__P__-accent-text)}.__P__-send[data-variant=outline]{background:transparent;color:var(--__P__-accent-fg);border-color:var(--__P__-accent)}.__P__-send[data-variant=outline]:not(:disabled):hover{background:color-mix(in srgb,var(--__P__-accent) 10%,transparent)}.__P__-send[data-variant=ghost]{background:transparent;color:var(--__P__-accent-fg)}.__P__-send[data-variant=ghost]:not(:disabled):hover{background:color-mix(in srgb,var(--__P__-accent) 8%,transparent)}.__P__-send:disabled{opacity:.4;cursor:not-allowed}.__P__-send:not(:disabled):hover{transform:translateY(-1px)}.__P__-send:not(:disabled):active{transform:translateY(0)}.__P__-send:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-send svg{width:18px;height:18px}.__P__-composer-actions{display:flex;gap:var(--__P__-space-1);flex-wrap:wrap}.__P__-attachments{display:flex;flex-wrap:wrap;gap:6px}.__P__-attachment-chip{display:inline-flex;align-items:center;gap:6px;padding:var(--__P__-space-1) var(--__P__-space-2) var(--__P__-space-1) var(--__P__-space-1);border-radius:999px;background:var(--__P__-bg-elevated);border:1px solid var(--__P__-border);font-size:var(--__P__-text-xs);max-width:200px}.__P__-attachment-thumb{width:24px;height:24px;border-radius:999px;object-fit:cover;background:var(--__P__-border)}.__P__-attachment-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.__P__-attachment-remove{width:18px;height:18px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;color:var(--__P__-fg-muted)}.__P__-attachment-remove:hover{background:var(--__P__-border);color:var(--__P__-fg)}.__P__-dropzone{position:absolute;inset:8px;border:2px dashed var(--__P__-accent);border-radius:var(--__P__-radius);background:color-mix(in srgb,var(--__P__-accent) 8%,transparent);display:flex;align-items:center;justify-content:center;font-weight:600;color:var(--__P__-accent-fg);pointer-events:none;z-index:10;animation:__P__-fade-in var(--__P__-dur-quick) var(--__P__-ease)}@keyframes __P__-fade-in{0%{opacity:0}to{opacity:1}}.__P__-error{margin-top:var(--__P__-space-1);padding:8px 12px;border-radius:var(--__P__-radius-sm);background:color-mix(in oklab,var(--__P__-danger) 8%,var(--__P__-bg-elevated));border:1px solid color-mix(in oklab,var(--__P__-danger) 20%,transparent);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);display:flex;align-items:center;gap:var(--__P__-space-2)}.__P__-error span{min-width:0}.__P__-error button{margin-inline-start:auto;flex-shrink:0;border:0;background:none;padding:0;color:var(--__P__-accent-fg);font:inherit;font-size:var(--__P__-text-sm);font-weight:600;text-decoration:underline;white-space:nowrap;cursor:pointer}.__P__-history{flex:1;overflow-y:auto;padding:var(--__P__-space-2) var(--__P__-space-1) var(--__P__-space-3)}.__P__-history-footer{flex:none;padding:var(--__P__-space-2) var(--__P__-space-3) var(--__P__-space-3);border-top:1px solid var(--__P__-border);background:var(--__P__-surface)}.__P__-history-new{width:100%;display:flex;align-items:center;justify-content:center;gap:var(--__P__-space-2);padding:var(--__P__-space-2) var(--__P__-space-3);border:none;border-radius:var(--__P__-radius-md);background:var(--__P__-accent);color:var(--__P__-on-accent);cursor:pointer;font-size:var(--__P__-text-sm);font-weight:600;transition:filter var(--__P__-dur-quick) var(--__P__-ease-out),transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-history-new svg{width:16px;height:16px}.__P__-history-new:hover{filter:brightness(1.08)}.__P__-history-new:active{transform:translateY(1px)}.__P__-history-new:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-history-empty{flex:1;display:flex;align-items:center;justify-content:center;padding:40px 16px;color:var(--__P__-fg-muted);font-size:calc(14px * var(--__P__-text-scale));text-align:center}.__P__-history-group{display:flex;flex-direction:column;padding:0 var(--__P__-space-3)}.__P__-history-heading{font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted);padding:14px 4px 8px;text-transform:uppercase;letter-spacing:.04em}.__P__-history-card{display:flex;flex-direction:column;background:var(--__P__-surface);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-lg, 14px);overflow:hidden}.__P__-history-item{all:unset;display:flex;align-items:center;gap:var(--__P__-space-3);padding:12px var(--__P__-space-3);cursor:pointer;transition:background var(--__P__-dur-base) var(--__P__-ease)}.__P__-history-item+.__P__-history-item{border-top:1px solid var(--__P__-border)}.__P__-history-item:hover{background:var(--__P__-bg-elevated)}.__P__-history-item:focus-visible{background:var(--__P__-bg-elevated);outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-history-avatar{flex:none;display:grid;place-items:center;width:36px;height:36px;border-radius:50%;background:color-mix(in oklab,var(--__P__-accent) 12%,transparent);color:var(--__P__-accent-fg)}.__P__-history-avatar svg{width:18px;height:18px}.__P__-history-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.__P__-history-row{display:flex;align-items:center;justify-content:space-between;gap:var(--__P__-space-2)}.__P__-history-title{flex:1;min-width:0;font-size:calc(14px * var(--__P__-text-scale));font-weight:500;color:var(--__P__-fg);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-history-time{flex:none;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted)}.__P__-history-preview{flex:1;min-width:0;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-history-dot{flex:none;width:8px;height:8px;border-radius:50%;background:var(--__P__-accent)}.__P__-history-item[data-unread=true] .__P__-history-title{font-weight:600}.__P__-history-item[data-closed=true] .__P__-history-title{color:var(--__P__-fg-muted)}.__P__-history-item-skeleton{cursor:default;pointer-events:none}.__P__-skeleton{display:block;border-radius:4px;background:linear-gradient(90deg,color-mix(in oklab,var(--__P__-fg) 9%,transparent) 30%,color-mix(in oklab,var(--__P__-fg) 17%,transparent),color-mix(in oklab,var(--__P__-fg) 9%,transparent) 70%);background-size:200% 100%;animation:__P__-skeleton-shimmer 1.8s ease-in-out infinite}.__P__-history-avatar.__P__-skeleton{border-radius:50%}.__P__-skeleton-heading{width:52px;height:8px}.__P__-skeleton-title{width:55%;height:12px}.__P__-skeleton-time{width:34px;height:10px}.__P__-skeleton-preview{width:80%;height:10px}@keyframes __P__-skeleton-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media(prefers-reduced-motion:reduce){.__P__-skeleton{animation:none}}.__P__-list-loading{margin:auto;padding:var(--__P__-space-6) var(--__P__-space-4);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);text-align:center}.__P__-readonly-banner{display:flex;flex-direction:column;align-items:center;gap:10px;padding:14px 12px;margin:0 var(--__P__-space-3) var(--__P__-space-3);border-radius:var(--__P__-radius-md);background:var(--__P__-bg-elevated);color:var(--__P__-fg-muted);text-align:center;font-size:var(--__P__-text-sm)}.__P__-readonly-label{line-height:1.4}.__P__-readonly-cta{appearance:none;border:0;cursor:pointer;padding:var(--__P__-space-2) var(--__P__-space-4);border-radius:999px;background:var(--__P__-accent);color:var(--__P__-accent-text, #fff);font:inherit;font-weight:600;font-size:var(--__P__-text-sm);transition:filter var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-readonly-cta:hover,.__P__-readonly-cta:focus-visible{filter:brightness(1.1)}.__P__-operator-banner{display:flex;align-items:center;justify-content:center;gap:8px;margin:0 var(--__P__-space-3) var(--__P__-space-1);padding:8px 12px;border-radius:var(--__P__-radius-md);background:color-mix(in oklab,var(--__P__-bg-elevated),var(--__P__-accent) 6%);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);line-height:1.3;text-align:center}.__P__-operator-pulse{flex:0 0 auto;width:8px;height:8px;border-radius:50%;background:var(--__P__-accent)}.__P__-operator-banner[data-mode=awaiting_operator] .__P__-operator-pulse{animation:__P__-operator-pulse 1.4s var(--__P__-ease-out) infinite}.__P__-cancel-operator-request{flex:0 0 auto;padding:0;border:0;background:none;color:var(--__P__-accent);font:inherit;font-weight:600;text-decoration:underline;text-underline-offset:2px;cursor:pointer}.__P__-cancel-operator-request:hover{opacity:.8}.__P__-cancel-operator-request:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px;border-radius:var(--__P__-radius-sm)}@keyframes __P__-operator-pulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.4;transform:scale(.7)}}.__P__-readonly-cta:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px}.__P__-composer-footer{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:10px 16px;margin:0 var(--__P__-space-3);border-top:1px solid var(--__P__-border);text-align:center;font-size:calc(11px * var(--__P__-text-scale));line-height:1.4;color:var(--__P__-fg-muted)}.__P__-disclaimer{max-width:320px;margin:0 auto;opacity:.9;letter-spacing:.01em}.__P__-poweredby{display:inline-flex;align-items:center;justify-content:center;gap:6px;color:inherit;text-decoration:none;opacity:.7;transition:opacity var(--__P__-dur-base) var(--__P__-ease);font-size:calc(11px * var(--__P__-text-scale));letter-spacing:.02em}.__P__-poweredby:hover{opacity:1}.__P__-poweredby-logo{height:12px;width:auto;display:inline-block;vertical-align:middle}.__P__-poweredby-bar{flex:none;display:flex;align-items:center;justify-content:center;padding:6px 16px;border-top:1px solid var(--__P__-border);background:var(--__P__-bg-elevated)}.__P__-menu-wrap{position:relative;display:inline-flex}.__P__-menu{position:absolute;top:100%;inset-inline-end:0;margin-top:6px;min-width:200px;padding:6px;background:var(--__P__-bg);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);box-shadow:var(--__P__-shadow-panel);z-index:10;display:flex;flex-direction:column;gap:2px;animation:__P__-menu-in var(--__P__-dur-base) var(--__P__-ease)}@media(prefers-reduced-motion:reduce){.__P__-menu{animation:none}}@keyframes __P__-menu-in{0%{opacity:0;transform:translateY(-4px) scale(.98);transform-origin:top right}to{opacity:1;transform:none}}.__P__-menu-item{all:unset;display:flex;align-items:center;gap:10px;padding:8px 10px;font-size:var(--__P__-text-sm);color:var(--__P__-fg);border-radius:var(--__P__-radius-sm);cursor:pointer;user-select:none}.__P__-menu-item:hover{background:var(--__P__-bg-elevated)}.__P__-menu-item:focus-visible{background:var(--__P__-bg-elevated);outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-menu-item[disabled]{opacity:.45;cursor:not-allowed}.__P__-menu-icon{display:inline-flex;width:16px;height:16px;color:var(--__P__-fg-muted)}.__P__-menu-icon svg{width:16px;height:16px}.__P__-menu-label{flex:1}.__P__-menu-check{display:inline-flex;color:var(--__P__-accent-fg)}.__P__-menu-check svg{width:14px;height:14px}.__P__-menu-item-segmented{cursor:default}.__P__-menu-item-segmented:hover{background:transparent}.__P__-segmented{display:inline-flex;gap:2px;padding:2px;background:var(--__P__-bg-elevated);border-radius:var(--__P__-radius-sm)}.__P__-segment{all:unset;min-width:26px;padding:3px 8px;font-size:var(--__P__-text-xs);font-weight:600;letter-spacing:.02em;text-align:center;color:var(--__P__-fg-muted);border-radius:calc(var(--__P__-radius-sm) - 2px);cursor:pointer;transition:color .12s ease,background .12s ease}.__P__-segment:hover{color:var(--__P__-fg)}.__P__-segment[data-on=true]{background:var(--__P__-bg);color:var(--__P__-accent-fg);box-shadow:var(--__P__-shadow-card)}.__P__-segment:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-resize-grip{position:absolute;width:18px;height:18px;display:flex;align-items:center;justify-content:center;color:var(--__P__-fg-muted);opacity:.45;transition:opacity var(--__P__-dur-base) var(--__P__-ease);z-index:2;touch-action:none;user-select:none}.__P__-resize-grip:hover,.__P__-resize-grip:focus-visible{opacity:1}.__P__-resize-grip svg{width:10px;height:10px}.__P__-resize-grip--bottom-left{bottom:2px;left:2px;cursor:nesw-resize;transform:scaleX(-1)}.__P__-resize-grip--bottom-right{bottom:2px;right:2px;cursor:nwse-resize}.__P__-resize-grip--top-left{top:2px;left:2px;cursor:nwse-resize;transform:rotate(180deg)}.__P__-resize-grip--top-right{top:2px;right:2px;cursor:nesw-resize;transform:scaleY(-1)}:host(:not([data-mode="open"])) .__P__-resize-grip{display:none}.__P__-messenger{display:flex;flex-direction:column;overflow:hidden}.__P__-messenger-body,.__P__-messenger-pane{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.__P__-messenger-pane[hidden]{display:none}@keyframes __P__-view-in{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}.__P__-module{display:flex;flex-direction:column;height:100%;min-height:0}@media(prefers-reduced-motion:no-preference){.__P__-module,.__P__-history{animation:__P__-view-in .18s var(--__P__-ease-out)}}.__P__-module-scroll{flex:1;min-height:0;overflow-y:auto;padding:var(--__P__-space-3);display:flex;flex-direction:column;gap:var(--__P__-space-3)}.__P__-home{container-type:inline-size;background:radial-gradient(125% 65% at 88% 0%,color-mix(in srgb,#fff 16%,transparent),transparent 55%),linear-gradient(180deg,var(--__P__-accent) 0%,var(--__P__-accent) 22%,color-mix(in srgb,var(--__P__-accent) 28%,var(--__P__-surface)) 44%,var(--__P__-surface) 70%);border-radius:var(--__P__-radius-lg) var(--__P__-radius-lg) 0 0}.__P__-home-scroll{flex:1;min-height:0;overflow-y:auto;display:flex;flex-direction:column;background:transparent}.__P__-home-cards{display:flex;flex-direction:column;gap:var(--__P__-space-3);padding:4px 14px 16px}.__P__-module-pad{padding:var(--__P__-space-3) var(--__P__-space-3) 0}.__P__-module-empty{display:flex;flex-direction:column;align-items:center;gap:var(--__P__-space-3);padding:var(--__P__-space-8) var(--__P__-space-4);text-align:center;color:var(--__P__-fg-muted);font-size:var(--__P__-text-base)}.__P__-module-retry{padding:var(--__P__-space-2) var(--__P__-space-4);border:1px solid var(--__P__-border-strong);border-radius:var(--__P__-radius-sm);color:var(--__P__-fg);font-weight:600;cursor:pointer;transition:background var(--__P__-dur-quick) var(--__P__-ease-out),border-color var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-module-retry:hover{background:var(--__P__-hover);border-color:var(--__P__-accent)}.__P__-module-retry:active{background:var(--__P__-border)}.__P__-module-retry:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-help-list{flex:1;min-height:0;overflow-y:auto;padding-bottom:var(--__P__-space-3)}.__P__-help-group{display:flex;flex-direction:column}.__P__-help-section-title{position:sticky;top:0;z-index:1;margin:0;padding:var(--__P__-space-3) var(--__P__-space-5) var(--__P__-space-2);font-size:var(--__P__-text-xs);font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--__P__-fg-muted);background:var(--__P__-bg)}.__P__-help-card{margin:0 var(--__P__-space-3) var(--__P__-space-3);background:var(--__P__-surface);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);overflow:hidden}.__P__-help-card .__P__-list-row{border-bottom:0;border-radius:0}.__P__-help-card .__P__-list-row+.__P__-list-row{border-top:1px solid var(--__P__-border)}.__P__-tabbar{display:flex;border-top:1px solid var(--__P__-border);background:var(--__P__-bg-elevated);flex-shrink:0}.__P__-tab{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--__P__-space-1);min-height:48px;padding:var(--__P__-space-2) var(--__P__-space-1);color:var(--__P__-fg-muted);font-size:var(--__P__-text-xs);font-weight:600;transition:color var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-tab:hover{color:var(--__P__-fg)}.__P__-tab[aria-selected=true]{color:var(--__P__-accent-fg)}.__P__-tab:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-tab:active{background:var(--__P__-hover)}.__P__-tab-icon{position:relative;display:inline-flex}.__P__-tab-icon svg{width:22px;height:22px}.__P__-tab-badge{position:absolute;top:-2px;left:calc(50% + 6px);width:8px;height:8px;border-radius:50%;background:var(--__P__-accent);box-shadow:0 0 0 2px var(--__P__-bg-elevated)}.__P__-home-hero{flex-shrink:0;padding:var(--__P__-space-5) var(--__P__-space-5) var(--__P__-space-3);color:var(--__P__-on-accent);--__P__-focus: var(--__P__-on-accent)}.__P__-home-hero-top{display:flex;align-items:center;justify-content:space-between;gap:var(--__P__-space-3);min-height:32px}.__P__-home-brand{font-size:clamp(calc(12px * var(--__P__-text-scale)),calc(3.2cqi * var(--__P__-text-scale)),calc(14px * var(--__P__-text-scale)));font-weight:600;letter-spacing:.01em;color:color-mix(in srgb,#fff 82%,transparent);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.__P__-home-brand-spacer{flex:1}.__P__-home-hero-actions{display:flex;align-items:center;gap:var(--__P__-space-2);flex-shrink:0}.__P__-home-hero-actions .__P__-icon-btn{color:#fff}.__P__-home-hero-actions .__P__-icon-btn:hover{background:color-mix(in srgb,#fff 18%,transparent);color:#fff}.__P__-home-hero-actions .__P__-icon-btn:active{background:color-mix(in srgb,#fff 26%,transparent)}.__P__-home-greeting{margin:28px 0 0;font-family:var(--__P__-font-display);font-size:clamp(calc(19px * var(--__P__-text-scale)),calc(5.5cqi * var(--__P__-text-scale)),var(--__P__-text-2xl));font-weight:800;line-height:1.18;letter-spacing:-.01em;overflow-wrap:anywhere}.__P__-home-lead{margin:10px 0 0;font-family:var(--__P__-font-display);font-size:clamp(calc(15px * var(--__P__-text-scale)),calc(4.2cqi * var(--__P__-text-scale)),var(--__P__-text-xl));font-weight:600;line-height:1.25;letter-spacing:-.005em;color:color-mix(in srgb,var(--__P__-on-accent) 78%,transparent);overflow-wrap:anywhere}.__P__-home-avatars{display:flex}.__P__-home-avatar{width:30px;height:30px;border-radius:999px;overflow:hidden;margin-inline-start:-10px;border:2px solid color-mix(in srgb,#fff 92%,transparent);box-shadow:0 1px 3px #0000002e;background:var(--__P__-surface);display:inline-flex;align-items:center;justify-content:center;font-size:var(--__P__-text-xs);font-weight:700;color:var(--__P__-fg)}.__P__-home-avatar:first-child{margin-inline-start:0}.__P__-home-avatar img{width:100%;height:100%;object-fit:cover}.__P__-home-content{background:var(--__P__-surface);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);box-shadow:var(--__P__-shadow-card);overflow:hidden}.__P__-home-content-title{padding:var(--__P__-space-4) var(--__P__-space-4) var(--__P__-space-3);font-size:var(--__P__-text-sm);font-weight:700}.__P__-home-content-list{display:flex;flex-direction:column;padding:0 var(--__P__-space-2) var(--__P__-space-2)}.__P__-home-content-list .__P__-list-row+.__P__-list-row{border-top:1px solid var(--__P__-border)}.__P__-home-card{display:block;width:100%;text-align:start;background:var(--__P__-surface);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);padding:var(--__P__-space-4);box-shadow:var(--__P__-shadow-card)}.__P__-home-card[data-interactive=true]{cursor:pointer;transition:background var(--__P__-dur-quick) var(--__P__-ease-out),transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-home-card[data-interactive=true]:hover{background:var(--__P__-bg-elevated)}.__P__-home-card[data-interactive=true]:active{transform:translateY(1px)}.__P__-home-card[data-interactive=true]:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-home-recent-row{display:flex;align-items:center;gap:var(--__P__-space-3)}.__P__-home-recent-avatar{display:inline-flex;align-items:center;justify-content:center;width:38px;height:38px;flex-shrink:0;border-radius:999px;background:color-mix(in oklch,var(--__P__-accent) 14%,transparent);color:var(--__P__-accent-fg)}.__P__-home-recent-avatar svg{width:20px;height:20px}.__P__-home-recent-body{display:flex;flex-direction:column;gap:3px;min-width:0;flex:1}.__P__-home-recent-title{font-weight:600;font-size:calc(14px * var(--__P__-text-scale))}.__P__-home-recent-preview{color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.__P__-home-recent-dot{width:8px;height:8px;border-radius:999px;background:var(--__P__-accent);flex-shrink:0}.__P__-home-recent-row[data-unread=true] .__P__-home-recent-title{font-weight:700}.__P__-home-status{display:flex;align-items:center;gap:var(--__P__-space-3)}.__P__-home-status-icon svg{width:22px;height:22px;color:var(--__P__-success)}.__P__-home-status[data-level=degraded] .__P__-home-status-icon svg{color:var(--__P__-warning)}.__P__-home-status[data-level=down] .__P__-home-status-icon svg{color:var(--__P__-danger)}.__P__-home-status-text{font-weight:600;font-size:calc(14px * var(--__P__-text-scale))}.__P__-home-search{display:flex;align-items:center;gap:var(--__P__-space-2);width:100%;padding:var(--__P__-space-3) var(--__P__-space-4);border-radius:var(--__P__-radius);border:1px solid var(--__P__-border);background:var(--__P__-surface);text-align:start}.__P__-home-search[data-input=true]{background:var(--__P__-bg-elevated)}.__P__-home-search:hover{border-color:var(--__P__-border-strong)}.__P__-home-search:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-home-search[data-input=true]:focus-within{outline:none;border-color:var(--__P__-focus)}.__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-input:focus-visible{outline:none}.__P__-home-search-icon svg{width:18px;height:18px;color:var(--__P__-accent-fg)}.__P__-list-row{display:flex;align-items:center;gap:var(--__P__-space-3);width:100%;min-height:44px;text-align:start;padding:var(--__P__-space-3) var(--__P__-space-2);border-radius:var(--__P__-radius-sm)}.__P__-list-row:hover{background:var(--__P__-hover)}.__P__-list-row:active{background:var(--__P__-border)}.__P__-list-row:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-list-row-body{display:flex;flex-direction:column;min-width:0;flex:1}.__P__-list-row-title{font-weight:600;font-size:var(--__P__-text-md);line-height:1.35}.__P__-list-row-sub{color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);margin-top:var(--__P__-space-1);line-height:1.45;display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.__P__-list-row-chevron svg{width:18px;height:18px;color:var(--__P__-accent-fg);flex-shrink:0}.__P__-back-header{display:flex;align-items:center;gap:var(--__P__-space-2);padding:10px 12px;border-bottom:1px solid var(--__P__-border);flex-shrink:0}.__P__-back-title{flex:1;text-align:center;font-size:var(--__P__-text-md);font-weight:700;margin:0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-back-spacer{width:32px;height:1px}.__P__-history>*,.__P__-home-scroll>*,.__P__-module-scroll>*,.__P__-help-list>*,.__P__-history-footer>*,.__P__-module-pad{width:100%;max-width:var(--__P__-conversation-max, 768px);margin-inline:auto}.__P__-header,.__P__-back-header{padding-inline:max(12px,calc((100% - var(--__P__-conversation-max, 768px)) / 2))}.__P__-tabbar{padding-inline:max(0px,calc((100% - var(--__P__-conversation-max, 768px)) / 2))}.__P__-content{display:flex;flex-direction:column;gap:14px;width:100%;max-width:68ch;margin:0 auto}.__P__-content-hero{width:100%;border-radius:var(--__P__-radius)}.__P__-content-subtitle{color:var(--__P__-fg-muted);margin:0}.__P__-content-frame{flex:1;min-height:0;width:100%;border:0;background:#fff}.__P__-news-list{display:flex;flex-direction:column;gap:var(--__P__-space-3)}.__P__-news-card{display:block;width:100%;text-align:start;border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);overflow:hidden;background:var(--__P__-surface)}.__P__-news-card{transition:background var(--__P__-dur-quick) var(--__P__-ease-out),transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-news-card:hover{background:var(--__P__-bg-elevated)}.__P__-news-card:active{transform:translateY(1px)}.__P__-news-card:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-news-hero{width:100%;display:block}.__P__-news-body{display:flex;flex-direction:column;gap:6px;padding:14px 16px}.__P__-news-title{font-weight:700;font-size:var(--__P__-text-md)}.__P__-news-summary{color:var(--__P__-fg-muted);font-size:calc(14px * var(--__P__-text-scale));display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.__P__-modules-empty{display:flex;align-items:center;justify-content:center;position:relative}.__P__-modules-empty-close{position:absolute;top:12px;inset-inline-end:12px}.__P__-modules-empty-text{color:var(--__P__-fg-muted);font-size:var(--__P__-text-base)}.__P__-form{display:flex;flex-direction:column;gap:var(--__P__-space-4)}.__P__-field{display:flex;flex-direction:column;gap:6px}.__P__-field-head{display:flex;flex-wrap:wrap;align-items:baseline;gap:var(--__P__-space-2)}.__P__-field-label{font-size:var(--__P__-text-sm);font-weight:600;color:var(--__P__-fg)}.__P__-field-req{color:var(--__P__-danger)}.__P__-field-type{flex-shrink:0;align-self:center;margin-inline-start:auto;border:1px solid var(--__P__-border);border-radius:5px;background:color-mix(in oklab,var(--__P__-fg-muted) 9%,transparent);padding:1px 7px;font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted);white-space:nowrap}.__P__-field-input{width:100%;min-width:0;max-width:100%;box-sizing:border-box;padding:10px var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:var(--__P__-bg);color:var(--__P__-fg);font:inherit;font-size:var(--__P__-text-sm);resize:vertical;transition:border-color var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-field-input:focus-visible{outline:none;border-color:var(--__P__-accent)}.__P__-field[data-invalid=true] .__P__-field-input{border-color:var(--__P__-danger)}.__P__-field-input[type=date],.__P__-field-input[type=time]{appearance:none;-webkit-appearance:none}@media(pointer:coarse){.__P__-textarea,.__P__-home-search-input,.__P__-field-input{font-size:max(16px,calc(16px * var(--__P__-text-scale)))}}.__P__-field-hint{font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted)}.__P__-field-error{font-size:var(--__P__-text-xs);color:var(--__P__-danger)}.__P__-field-choices{display:flex;flex-direction:column;gap:10px;padding-top:2px}.__P__-choice{display:flex;align-items:flex-start;gap:10px;font-size:var(--__P__-text-sm);color:var(--__P__-fg);cursor:pointer}.__P__-choice input{margin-top:2px;accent-color:var(--__P__-accent)}.__P__-form-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:var(--__P__-space-2);margin-top:var(--__P__-space-2)}.__P__-form-hint{flex:1 1 auto;min-width:6rem;margin-inline-end:auto;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted)}.__P__-form-submit{padding:var(--__P__-space-2) var(--__P__-space-4);border:none;border-radius:var(--__P__-radius-md);background:var(--__P__-accent);color:var(--__P__-accent-text, #fff);font:inherit;font-weight:600;font-size:var(--__P__-text-sm);white-space:nowrap;flex-shrink:0;cursor:pointer;transition:filter var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-form-submit:hover:not(:disabled){filter:brightness(1.06)}.__P__-form-submit:disabled{opacity:.6;cursor:default}.__P__-form-skip{padding:var(--__P__-space-2) var(--__P__-space-4);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:transparent;color:var(--__P__-fg-muted);font:inherit;font-size:var(--__P__-text-sm);white-space:nowrap;flex-shrink:0;cursor:pointer;transition:background var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-form-skip:hover:not(:disabled){background:var(--__P__-bg-elevated)}@media(max-width:640px){.__P__-form-hint{flex-basis:100%;margin-inline-end:0;font-size:var(--__P__-text-xs)}.__P__-form-submit,.__P__-form-skip{flex:1 1 0;text-align:center}}.__P__-form-gate{display:flex;flex-direction:column;gap:var(--__P__-space-3);padding:var(--__P__-space-4);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:var(--__P__-bg-elevated)}.__P__-form-gate-title{margin:0;font-size:var(--__P__-text-base);font-weight:700;color:var(--__P__-fg)}.__P__-form-gate-desc{margin:0 0 var(--__P__-space-1);font-size:var(--__P__-text-sm);color:var(--__P__-fg-muted)}.__P__-form-done{display:flex;align-items:center;justify-content:center;gap:6px;padding:6px 12px;border:1px dashed var(--__P__-border);border-radius:999px;align-self:center;font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted)}.__P__-form-done svg{width:14px;height:14px;color:var(--__P__-success, #22c55e)}.__P__-form-done[data-outcome=skipped] svg{color:var(--__P__-fg-muted)}.__P__-form-done-fill{border:0;background:none;padding:0 2px;cursor:pointer;font:inherit;font-weight:600;color:var(--__P__-accent-fg)}.__P__-form-done-fill:hover{text-decoration:underline}details.__P__-form-done{display:block;padding:0;border-radius:var(--__P__-radius-md)}details[open].__P__-form-done{width:min(100%,420px);background:var(--__P__-surface)}.__P__-form-done-summary{display:flex;align-items:center;justify-content:center;gap:6px;padding:8px 12px;cursor:pointer;list-style:none}.__P__-form-done-summary::-webkit-details-marker{display:none}.__P__-form-done-summary>svg:last-child{color:var(--__P__-fg-muted);transition:transform .15s var(--__P__-ease)}details[open]>.__P__-form-done-summary>svg:last-child{transform:rotate(90deg)}.__P__-form-answers{margin:0;padding:var(--__P__-space-2) var(--__P__-space-3) var(--__P__-space-3);display:grid;gap:var(--__P__-space-3);text-align:start}.__P__-form-answer{display:grid;gap:6px}.__P__-form-answer dt{font-size:var(--__P__-text-sm);font-weight:600;color:var(--__P__-fg)}.__P__-form-answer dd{margin:0;padding:10px var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:var(--__P__-bg);font-size:var(--__P__-text-sm);font-weight:400;color:var(--__P__-fg);overflow-wrap:anywhere}.__P__-toolui{margin-block:var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-lg, 14px);background:var(--__P__-bg-elevated);font-size:var(--__P__-text-sm)}.__P__-toolui:not(.__P__-toolui-collapsible){display:flex;flex-direction:column;gap:var(--__P__-space-3);padding:var(--__P__-space-4)}.__P__-toolui-group{display:flex;flex-direction:column;gap:var(--__P__-space-3);margin-block:var(--__P__-space-3)}.__P__-toolui-group>.__P__-toolui{margin-block:0}.__P__-toolui-stale{opacity:.7}details.__P__-toolui-collapsible>summary{display:flex;align-items:center;gap:var(--__P__-space-2);padding:var(--__P__-space-3) var(--__P__-space-4);cursor:pointer;list-style:none;-webkit-tap-highlight-color:transparent;user-select:none}details.__P__-toolui-collapsible>summary::-webkit-details-marker{display:none}details.__P__-toolui-collapsible[open]>summary{border-bottom:1px solid var(--__P__-border)}details.__P__-toolui-collapsible>.__P__-toolui-section{margin:var(--__P__-space-4)}details.__P__-toolui-collapsible>.__P__-toolui-section~.__P__-toolui-section{margin-top:calc(-1 * var(--__P__-space-2))}.__P__-toolui-name-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-toolui-chevron{display:inline-flex;color:var(--__P__-fg-muted);transition:transform var(--__P__-dur-quick) var(--__P__-ease-out)}details.__P__-toolui-collapsible>summary .__P__-toolui-status{margin-inline-start:auto}.__P__-toolui-chevron svg{width:16px;height:16px}details.__P__-toolui-collapsible[open]>summary .__P__-toolui-chevron{transform:rotate(180deg)}.__P__-toolui-badge,.__P__-toolui-name-pill,.__P__-toolui-q-pill{--__P__-pill: var(--__P__-fg-muted);display:inline-flex;min-width:0;align-items:center;gap:5px;padding:3px 7px;border-radius:5px;border:1px solid var(--__P__-border);background:color-mix(in oklab,var(--__P__-fg-muted) 9%,transparent);color:var(--__P__-pill);font-size:var(--__P__-text-xs);font-weight:600;white-space:nowrap}.__P__-toolui-badge svg,.__P__-toolui-name-pill svg,.__P__-toolui-q-pill svg{flex-shrink:0;width:14px;height:14px}.__P__-toolui-status-icon{display:inline-flex}.__P__-toolui-name-pill{--__P__-pill: oklch(.68 .13 233)}.__P__-toolui-q-pill{--__P__-pill: oklch(.66 .12 195)}.__P__-toolui-status[data-status=completed]{--__P__-pill: var(--__P__-success, #16a34a)}.__P__-toolui-status[data-status=responded]{--__P__-pill: oklch(.62 .15 255)}.__P__-toolui-status[data-status=awaiting]{--__P__-pill: var(--__P__-warning, #f59e0b)}.__P__-toolui-status[data-status=denied]{--__P__-pill: oklch(.66 .16 45)}.__P__-toolui-status[data-status=error]{--__P__-pill: var(--__P__-danger, #dc2626)}.__P__-toolui-status[data-status=superseded]{--__P__-pill: var(--__P__-fg-muted)}@supports (color: oklch(from red l c h)){.__P__-toolui-badge,.__P__-toolui-name-pill,.__P__-toolui-q-pill{color:oklch(from var(--__P__-pill) clamp(var(--__P__-pill-l-min),l,var(--__P__-pill-l-max)) c h)}}.__P__-toolui-head{display:flex;align-items:center;flex-wrap:wrap;gap:var(--__P__-space-2)}.__P__-toolui-head-end{display:inline-flex;align-items:center;gap:var(--__P__-space-2);margin-inline-start:auto}.__P__-toolui-collapse-body{display:flex;flex-direction:column;gap:var(--__P__-space-3);padding:var(--__P__-space-4)}.__P__-toolui-summary{display:flex;flex-direction:column;gap:var(--__P__-space-3)}.__P__-toolui-collapse-body>.__P__-form{gap:var(--__P__-space-3)}.__P__-toolui-collapse-body>.__P__-form>.__P__-field,.__P__-toolui-summary>.__P__-field{padding:10px var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:color-mix(in oklab,var(--__P__-bg) 80%,transparent);line-height:1.5}.__P__-toolui-collapse-body>.__P__-form>.__P__-field{gap:var(--__P__-space-2)}.__P__-toolui-summary>.__P__-field{gap:var(--__P__-space-1)}.__P__-toolui-summary .__P__-field-label{color:var(--__P__-fg-muted)}.__P__-toolui-answer{margin:0;font-size:var(--__P__-text-sm);color:var(--__P__-fg-muted);overflow-wrap:anywhere;white-space:pre-wrap}.__P__-toolui-footer{display:flex;align-items:center;justify-content:space-between;gap:var(--__P__-space-3);margin-inline:calc(-1 * var(--__P__-space-4));padding:var(--__P__-space-3) var(--__P__-space-4) 0;border-top:1px solid var(--__P__-border)}.__P__-toolui-options-toggle{display:inline-flex;align-items:center;gap:4px;border:0;background:transparent;padding:0;cursor:pointer;font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted);transition:color var(--__P__-dur-quick) var(--__P__-ease)}.__P__-toolui-options-toggle:hover{color:var(--__P__-fg)}.__P__-toolui-options-chevron{display:inline-flex;transition:transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-toolui-options-chevron svg{width:14px;height:14px}.__P__-toolui-options-chevron.__P__-open{transform:rotate(180deg)}.__P__-toolui-desc{margin:0;padding:var(--__P__-space-3);border-radius:var(--__P__-radius-md);background:var(--__P__-bg);border:1px solid var(--__P__-border);color:var(--__P__-fg-muted);line-height:1.5}.__P__-toolui-section{display:flex;flex-direction:column;gap:8px;padding:var(--__P__-space-3);border-radius:var(--__P__-radius-md);background:var(--__P__-bg);border:1px solid var(--__P__-border)}.__P__-toolui:not(.__P__-toolui-collapsible) .__P__-toolui-section,.__P__-toolui:not(.__P__-toolui-collapsible) .__P__-toolui-desc{padding:0;background:none;border:0;border-radius:0}.__P__-toolui-label{font-size:var(--__P__-text-xs);font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--__P__-fg-muted)}.__P__-toolui-code{margin:0;max-height:240px;overflow:auto;color:var(--__P__-fg);font-family:var(--__P__-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);font-size:var(--__P__-text-xs);line-height:1.5;white-space:pre-wrap;word-break:break-word}.__P__-toolui-code[data-error=true]{color:var(--__P__-danger, #dc2626)}.__P__-toolui-body{gap:6px}.__P__-toolui-prompt{margin:0;font-weight:600;color:var(--__P__-fg);overflow-wrap:anywhere}.__P__-toolui-subtle{margin:0;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted);line-height:1.5}.__P__-toolui-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:var(--__P__-space-2);margin-top:var(--__P__-space-2)}:host([dir="rtl"]) .__P__-icon-dir{transform:scaleX(-1)}:host([dir="rtl"]) .__P__-field-input[type=date],:host([dir="rtl"]) .__P__-field-input[type=time]{position:relative;text-align:right;padding-left:34px}:host([dir="rtl"]) .__P__-field-input[type=date]::-webkit-datetime-edit,:host([dir="rtl"]) .__P__-field-input[type=time]::-webkit-datetime-edit{text-align:right}:host([dir="rtl"]) .__P__-field-input[type=date]::-webkit-calendar-picker-indicator,:host([dir="rtl"]) .__P__-field-input[type=time]::-webkit-calendar-picker-indicator{position:absolute;left:var(--__P__-space-3);margin:0}
|
|
4
|
-
`;var
|
|
5
|
-
`;var
|
|
6
|
-
`;var
|
|
7
|
-
`).replace(/__P__/g,Y_).replaceAll("__BRAND_ACCENT_TEXT__",Q_).replaceAll("__BRAND_ACCENT__",J_).replaceAll("__BRAND_RADIUS__",Z_).replaceAll("__BRAND_FONT__",ep);var tp=ne.scope("mount"),Ss=new WeakMap,ks={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 ws(e,t){e.style.cssText=ks[t]}function Wn(e){return e==="floating"||e==="modal"||e==="drawer"?"floating":e==="standalone"||e==="page"?"viewport":"flow"}function Bo(e={}){let t=e.position??"flow";tp.debug("createShadowMount",{position:t,hasTarget:!!e.target,hasHost:!!e.existingHost});let n=`${R.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",R.id),o.style.cssText=ks[t];let r=o.shadowRoot??o.attachShadow({mode:"open"}),a=o.ownerDocument;if(!np(r,a)){let l=a.createElement("style");l.textContent=wa,r.appendChild(l)}let s=document.createElement("div");return s.className=`${R.cssPrefix}-app`,r.appendChild(s),{appRoot:s,destroy:()=>o.remove(),hostElement:o,shadowRoot:r}}function np(e,t){if(!("adoptedStyleSheets"in e))return!1;let n=t.defaultView;if(!n||typeof n.CSSStyleSheet!="function")return!1;let o=Ss.get(t);if(!o)try{o=new n.CSSStyleSheet,o.replaceSync(wa),Ss.set(t,o)}catch{return!1}try{return e.adoptedStyleSheets=[o],!0}catch{return!1}}function op(e,t){let n=R.cssPrefix;t.accent&&e.style.setProperty(`--${n}-accent-user`,t.accent),t.accentText&&e.style.setProperty(`--${n}-accent-text-user`,t.accentText),t.radius&&e.style.setProperty(`--${n}-radius`,t.radius),t.fontFamily&&e.style.setProperty(`--${n}-font`,t.fontFamily),t.contentMaxWidth&&e.style.setProperty(`--${n}-conversation-max`,t.contentMaxWidth)}function rp(e,t){e.dataset.theme=t}function ap(e,t){let n=R.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 ip(e,t){e.dataset.position=t}function Ho(e,t){e.dataset.mode=t}function Cs(e,t){rp(e,t.themeMode),op(e,t.themeOverrides),ip(e,t.position),ap(e,t.size)}var sp=ne.scope("iframe"),lp='<!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 Is(e,t,n="closed",o="floating",r=null){sp.debug("createIframeMount",{position:t,initialMode:n,layoutMode:o,hasTarget:!!r});let a=document.createElement("iframe");a.title=`${R.name} chat`,a.setAttribute("allow","microphone; clipboard-write"),Ts(a,t,n,o),(o==="inline"&&r?r:document.body).appendChild(a);let l=a.contentDocument;if(!l)throw new Error("iframe contentDocument unavailable (cross-origin?)");l.open(),l.write(lp),l.close();let c=Bo({...e,target:l.body}),d=new MutationObserver(()=>{Ts(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 Uo="border:0;background:transparent;z-index:2147483647;pointer-events:auto;",Rs={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 Ts(e,t,n,o){if(n==="fullscreen"||o==="standalone"){e.style.cssText=`${Uo}position:fixed;inset:0;width:100vw;height:100vh;`;return}if(o==="inline"){e.style.cssText=`${Uo}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=`${Uo}position:fixed;inset:0;width:100vw;height:100vh;`;return}let a=t.startsWith("top-")?"top":"bottom",s=t.endsWith("-left")?"left":"right",{w:l,h:c}=Rs[n]??Rs.open;e.style.cssText=`${Uo}position:fixed;${a}:16px;${s}:16px;width:${l};height:${c};`}var zo=class{constructor(){le(this,"handlers",new Map)}on(t,n){let o=this.handlers.get(t);return o||(o=new Set,this.handlers.set(t,o)),o.add(n),()=>this.handlers.get(t)?.delete(n)}emit(t,n){let o=this.handlers.get(t);if(o)for(let r of o)try{r(n)}catch{}}clear(){this.handlers.clear()}};var bn,Ae,Ca,Es,Kn=0,Fs=[],Ne=te,As=Ne.__b,Ms=Ne.__r,Ls=Ne.diffed,Os=Ne.__c,Ns=Ne.unmount,Ds=Ne.__;function Vo(e,t){Ne.__h&&Ne.__h(Ae,e,Kn||t),Kn=0;var n=Ae.__H||(Ae.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function $(e){return Kn=1,Bs(Hs,e)}function Bs(e,t,n){var o=Vo(bn++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):Hs(void 0,t),function(l){var c=o.__N?o.__N[0]:o.__[0],d=o.t(c,l);c!==d&&(o.__N=[d,o.__[1]],o.__c.setState({}))}],o.__c=Ae,!Ae.__f)){var r=function(l,c,d){if(!o.__c.__H)return!0;var p=!1,_=o.__c.props!==l;if(o.__c.__H.__.some(function(f){if(f.__N){p=!0;var m=f.__[0];f.__=f.__N,f.__N=void 0,m!==f.__[0]&&(_=!0)}}),a){var u=a.call(this,l,c,d);return p?u||_:u}return!p||_};Ae.__f=!0;var a=Ae.shouldComponentUpdate,s=Ae.componentWillUpdate;Ae.componentWillUpdate=function(l,c,d){if(this.__e){var p=a;a=void 0,r(l,c,d),a=p}s&&s.call(this,l,c,d)},Ae.shouldComponentUpdate=r}return o.__N||o.__}function L(e,t){var n=Vo(bn++,3);!Ne.__s&&Ta(n.__H,t)&&(n.__=e,n.u=t,Ae.__H.__h.push(n))}function ht(e,t){var n=Vo(bn++,4);!Ne.__s&&Ta(n.__H,t)&&(n.__=e,n.u=t,Ae.__h.push(n))}function O(e){return Kn=5,ie(function(){return{current:e}},[])}function ie(e,t){var n=Vo(bn++,7);return Ta(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function N(e,t){return Kn=8,ie(function(){return e},t)}function cp(){for(var e;e=Fs.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(qo),t.__h.some(Ra),t.__h=[]}catch(n){t.__h=[],Ne.__e(n,e.__v)}}}Ne.__b=function(e){Ae=null,As&&As(e)},Ne.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ds&&Ds(e,t)},Ne.__r=function(e){Ms&&Ms(e),bn=0;var t=(Ae=e.__c).__H;t&&(Ca===Ae?(t.__h=[],Ae.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(qo),t.__h.some(Ra),t.__h=[],bn=0)),Ca=Ae},Ne.diffed=function(e){Ls&&Ls(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Fs.push(t)!==1&&Es===Ne.requestAnimationFrame||((Es=Ne.requestAnimationFrame)||dp)(cp)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Ca=Ae=null},Ne.__c=function(e,t){t.some(function(n){try{n.__h.some(qo),n.__h=n.__h.filter(function(o){return!o.__||Ra(o)})}catch(o){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Ne.__e(o,n.__v)}}),Os&&Os(e,t)},Ne.unmount=function(e){Ns&&Ns(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(o){try{qo(o)}catch(r){t=r}}),n.__H=void 0,t&&Ne.__e(t,n.__v))};var $s=typeof requestAnimationFrame=="function";function dp(e){var t,n=function(){clearTimeout(o),$s&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);$s&&(t=requestAnimationFrame(n))}function qo(e){var t=Ae,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Ae=t}function Ra(e){var t=Ae;e.__c=e.__(),Ae=t}function Ta(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function Hs(e,t){return typeof t=="function"?t(e):t}var up=Symbol.for("preact-signals");function jo(){if(Et>1)Et--;else{var e,t=!1;for((function(){var r=Ko;for(Ko=void 0;r!==void 0;){var a=r.S;if(a.v===r.v)for(var s=a.t;s!==void 0;s=s.x)s.i===r.i&&(s.i=a.i);r=r.o}})();jn!==void 0;){var n=jn;for(jn=void 0,Wo++;n!==void 0;){var o=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&zs(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if(Wo=0,Et--,t)throw e}}function ft(e){if(Et>0)return e();Ia=++_p,Et++;try{return e()}finally{jo()}}var Gn,Ie=void 0;function Xn(e){var t=Ie,n=Gn;Ie=void 0,Gn=void 0;try{return e()}finally{Ie=t,Gn=n}}var jn=void 0,Et=0,Wo=0,_p=0,Ia=0,Ko=void 0,Go=0;function Us(e){if(Ie!==void 0){var t=e.n;if(t===void 0||t.t!==Ie)return t={i:0,S:e,p:Ie.s,n:void 0,t:Ie,e:void 0,x:void 0,r:t},Ie.s!==void 0&&(Ie.s.n=t),Ie.s=t,e.n=t,32&Ie.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=Ie.s,t.n=void 0,Ie.s.n=t,Ie.s=t),t}}function Be(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}Be.prototype.brand=up;Be.prototype.h=function(){return!0};Be.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:Xn(function(){var o;(o=t.W)==null||o.call(t)}))};Be.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&&Xn(function(){var r;(r=t.Z)==null||r.call(t)}))}};Be.prototype.subscribe=function(e){var t=this;return At(function(){var n=t.value;Xn(function(){return e(n)})},{name:"sub"})};Be.prototype.valueOf=function(){return this.value};Be.prototype.toString=function(){return this.value+""};Be.prototype.toJSON=function(){return this.value};Be.prototype.peek=function(){var e=this;return Xn(function(){return e.value})};Object.defineProperty(Be.prototype,"value",{get:function(){var e=Us(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Wo>100)throw new Error("Cycle detected");(function(n){Et!==0&&Wo===0&&n.l!==Ia&&(n.l=Ia,Ko={S:n,v:n.v,i:n.i,o:Ko})})(this),this.v=e,this.i++,Go++,Et++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{jo()}}}});function oe(e,t){return new Be(e,t)}function zs(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 qs(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 Vs(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 Xt(e,t){Be.call(this,void 0,t),this.x=e,this.s=void 0,this.g=Go-1,this.f=4}Xt.prototype=new Be;Xt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Go))return!0;if(this.g=Go,this.f|=1,this.i>0&&!zs(this))return this.f&=-2,!0;var e=Ie;try{qs(this),Ie=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 Ie=e,Vs(this),this.f&=-2,!0};Xt.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)}Be.prototype.S.call(this,e)};Xt.prototype.U=function(e){if(this.t!==void 0&&(Be.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)}};Xt.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(Xt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Us(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function fe(e,t){return new Xt(e,t)}function Ws(e){var t=e.m;if(e.m=void 0,typeof t=="function"){Et++;var n=Ie;Ie=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,Ea(e),o}finally{Ie=n,jo()}}}function Ea(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Ws(e)}function pp(e){if(Ie!==this)throw new Error("Out-of-order effect");Vs(this),Ie=e,this.f&=-2,8&this.f&&Ea(this),jo()}function yn(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,Gn&&Gn.push(this)}yn.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.m=t)}finally{e()}};yn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Ws(this),qs(this),Et++;var e=Ie;return Ie=this,pp.bind(this,e)};yn.prototype.N=function(){2&this.f||(this.f|=2,this.u=jn,jn=this)};yn.prototype.d=function(){this.f|=8,1&this.f||Ea(this)};yn.prototype.dispose=function(){this.d()};function At(e,t){var n=new yn(e,t);try{n.c()}catch(r){throw n.d(),r}var o=n.d.bind(n);return o[Symbol.dispose]=o,o}var Ks,Jo,Xo,fp=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var Gs=[];At(function(){Ks=this.N})();function Pn(e,t){te[e]=t.bind(null,te[e]||function(){})}function Yo(e){if(Xo){var t=Xo;Xo=void 0,t()}Xo=e&&e.S()}function js(e){var t=this,n=e.data,o=mt(n);o.value=n;var r=ie(function(){for(var l=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var d=fe(function(){var f=o.value.value;return f===0?0:f===!0?"":f||""}),p=fe(function(){return!Array.isArray(d.value)&&!sa(d.value)}),_=At(function(){if(this.N=Xs,p.value){var f=d.value;l.__v&&l.__v.__e&&l.__v.__e.nodeType===3&&(l.__v.__e.data=f)}}),u=t.__$u.d;return t.__$u.d=function(){_(),u.call(this)},[p,d]},[]),a=r[0],s=r[1];return a.value?s.peek():s.value}js.displayName="ReactiveTextNode";Object.defineProperties(Be.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:js},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});Pn("__b",function(e,t){if(typeof t.type=="string"){var n,o=t.props;for(var r in o)if(r!=="children"){var a=o[r];a instanceof Be&&(n||(t.__np=n={}),n[r]=a,o[r]=a.peek())}}e(t)});Pn("__r",function(e,t){if(e(t),t.type!==de){Yo();var n,o=t.__c;o&&(o.__$f&=-2,(n=o.__$u)===void 0&&(o.__$u=n=(function(r,a){var s;return At(function(){s=this},{name:a}),s.c=r,s})(function(){var r;fp&&((r=n.y)==null||r.call(n)),o.__$f|=1,o.setState({})},typeof t.type=="function"?t.type.displayName||t.type.name:""))),Jo=o,Yo(n)}});Pn("__e",function(e,t,n,o){Yo(),Jo=void 0,e(t,n,o)});Pn("diffed",function(e,t){Yo(),Jo=void 0;var n;if(typeof t.type=="string"&&(n=t.__e)){var o=t.__np,r=t.props,a=n.U;if(a)for(var s in a){var l=a[s];l===void 0||o&&s in o||(l.d(),a[s]=void 0)}if(o){a||(a={},n.U=a);for(var c in o){var d=a[c],p=o[c];d===void 0?(d=mp(n,c,p,r),a[c]=d):d.o(p,r)}}}e(t)});function mp(e,t,n,o){var r=t in e&&e.ownerSVGElement===void 0,a=oe(n);return{o:function(s,l){a.value=s,o=l},d:At(function(){this.N=Xs;var s=a.value.value;o[t]!==s&&(o[t]=s,r?e[t]=s:s!=null&&(s!==!1||t[4]==="-")?e.setAttribute(t,s):e.removeAttribute(t))})}}Pn("unmount",function(e,t){if(typeof t.type=="string"){var n=t.__e;if(n){var o=n.U;if(o){n.U=void 0;for(var r in o){var a=o[r];a&&a.d()}}}var s=t.__np;if(s){var l=t.props;for(var c in s)l[c]=s[c]}t.__np=void 0}else{var d=t.__c;if(d){var p=d.__$u;p&&(d.__$u=void 0,p.d())}}e(t)});Pn("__h",function(e,t,n,o){o<3&&(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 r in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var a=2&this.__$f;if(!(o||a||4&this.__$f)||1&this.__$f)return!0}else if(!(o||4&this.__$f)||3&this.__$f)return!0;for(var s in e)if(s!=="__source"&&e[s]!==this.props[s])return!0;for(var l in this.props)if(!(l in e))return!0;return!1};function mt(e,t){return ie(function(){return oe(e,t)},[])}function ut(e,t){var n=O(e);return n.current=e,Jo.__$f|=4,ie(function(){return fe(function(){return n.current()},t)},[])}var gp=function(e){queueMicrotask(function(){queueMicrotask(e)})};function vp(){ft(function(){for(var e;e=Gs.shift();)Ks.call(e)})}function Xs(){Gs.push(this)===1&&(te.requestAnimationFrame||gp)(vp)}function Ys(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Js(e){return Ys(e)}function Qs(e){return!(!Ys(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}function Qo(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 hp=900,bp=640;function Aa(e,t,n){if(e==="standalone"||e==="page")return"fullscreen";let o=t.initialSize;return o==="expanded"||o==="fullscreen"||o==="normal"?o:n>0&&n<bp?"fullscreen":n>=(t.autoSizeBreakpoint??hp)?"expanded":"normal"}function Yn(e,t,n,o=null){let a=e.mode==="inline"||e.mode==="standalone"||e.mode==="page"||(n??!e.startMinimized),l=e.mode!=="standalone"&&e.mode!=="page"&&e.mode!=="inline"&&o?o:Aa(e.mode,e.size,t);return{panelOpen:a,panelSize:l}}function xn(){return typeof window>"u"?0:window.innerWidth}var yp="x-public-key",Pp="x-ai-agent-deployment-id";function Zs(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");return{headers(){let t={[Pp]:e.aiAgentDeploymentId};return e.publicKey&&(t[e.publicKeyHeader??yp]=e.publicKey),t}}}function Jn(e,t){return new Promise(n=>{if(t?.aborted)return n();let o=setTimeout(a,e),r=()=>a();t?.addEventListener("abort",r,{once:!0});function a(){clearTimeout(o),t?.removeEventListener("abort",r),n()}})}var He=class extends Error{constructor(n,o,r,a){super(n);le(this,"code",o);le(this,"status",r);le(this,"cause",a);this.name="StreamError"}};var el=ne.scope("parser");async function*tl(e,t,n){if(!e.ok){let o=await e.text().catch(()=>"");throw new He(`server responded ${e.status}: ${o.slice(0,200)}`,"server",e.status)}for await(let o of xp(e,t)){let r=Sp(o,n);if(r==="done")return;r&&(yield r)}}async function*xp(e,t){if(!e.body)throw new He("response has no body","no-body");let n=e.body.pipeThrough(new TextDecoderStream).getReader(),o="";try{for(;;){if(t.aborted)throw new DOMException("aborted","AbortError");let{done:r,value:a}=await n.read();if(r){let l=o.trim();l&&(yield l);return}o+=a;let s;for(;(s=o.indexOf(`
|
|
1
|
+
"use strict";var To=Object.defineProperty;var Yu=Object.getOwnPropertyDescriptor;var Ju=Object.getOwnPropertyNames;var Zu=Object.prototype.hasOwnProperty;var e_=(e,t,n)=>t in e?To(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var t_=(e,t)=>{for(var n in t)To(e,n,{get:t[n],enumerable:!0})},n_=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ju(t))!Zu.call(e,r)&&r!==n&&To(e,r,{get:()=>t[r],enumerable:!(o=Yu(t,r))||o.enumerable});return e};var o_=e=>n_(To({},"__esModule",{value:!0}),e);var se=(e,t,n)=>e_(e,typeof t!="symbol"?t+"":t,n);var cv={};t_(cv,{HOOK_WILDCARD:()=>Gr,brand:()=>lv,destroy:()=>ov,getAllInstances:()=>av,getInstance:()=>rv,hook:()=>iv,init:()=>nv,mount:()=>pu,resolveInitialHostMode:()=>Kr,version:()=>sv});module.exports=o_(cv);var No,ee,Wi,da,Vt,Ui,Ki,Gi,sa,Eo,qn,ji,ua,la,ca,r_,Mo={},Lo=[],a_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Vn=Array.isArray;function It(e,t){for(var n in t)e[n]=t[n];return e}function _a(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Et(e,t,n){var o,r,a,s={};for(a in t)a=="key"?o=t[a]:a=="ref"?r=t[a]:s[a]=t[a];if(arguments.length>2&&(s.children=arguments.length>3?No.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)s[a]===void 0&&(s[a]=e.defaultProps[a]);return Ao(e,s,o,r,null)}function Ao(e,t,n,o,r){var a={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Wi,__i:-1,__u:0};return r==null&&ee.vnode!=null&&ee.vnode(a),a}function de(e){return e.children}function lt(e,t){this.props=e,this.context=t}function gn(e,t){if(t==null)return e.__?gn(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"?gn(e):null}function i_(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],r=[],a=It({},t);a.__v=t.__v+1,ee.vnode&&ee.vnode(a),pa(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??gn(t),!!(32&t.__u),r),a.__v=t.__v,a.__.__k[a.__i]=a,Zi(o,a,r),t.__e=t.__=null,a.__e!=n&&Qi(a)}}function Qi(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}),Qi(e)}function zi(e){(!e.__d&&(e.__d=!0)&&Vt.push(e)&&!Oo.__r++||Ui!=ee.debounceRendering)&&((Ui=ee.debounceRendering)||Ki)(Oo)}function Oo(){try{for(var e,t=1;Vt.length;)Vt.length>t&&Vt.sort(Gi),e=Vt.shift(),t=Vt.length,i_(e)}finally{Vt.length=Oo.__r=0}}function Xi(e,t,n,o,r,a,s,l,c,d,_){var p,u,m,g,y,S,k,x=o&&o.__k||Lo,h=t.length;for(c=s_(n,t,x,c,h),p=0;p<h;p++)(m=n.__k[p])!=null&&(u=m.__i!=-1&&x[m.__i]||Mo,m.__i=p,S=pa(e,m,u,r,a,s,l,c,d,_),g=m.__e,m.ref&&u.ref!=m.ref&&(u.ref&&fa(u.ref,null,m),_.push(m.ref,m.__c||g,m)),y==null&&g!=null&&(y=g),(k=!!(4&m.__u))||u.__k===m.__k?(c=Yi(m,c,e,k),k&&u.__e&&(u.__e=null)):typeof m.type=="function"&&S!==void 0?c=S:g&&(c=g.nextSibling),m.__u&=-7);return n.__e=y,c}function s_(e,t,n,o,r){var a,s,l,c,d,_=n.length,p=_,u=0;for(e.__k=new Array(r),a=0;a<r;a++)(s=t[a])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[a]=Ao(null,s,null,null,null):Vn(s)?s=e.__k[a]=Ao(de,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[a]=Ao(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[a]=s,c=a+u,s.__=e,s.__b=e.__b+1,l=null,(d=s.__i=l_(s,n,c,p))!=-1&&(p--,(l=n[d])&&(l.__u|=2)),l==null||l.__v==null?(d==-1&&(r>_?u--:r<_&&u++),typeof s.type!="function"&&(s.__u|=4)):d!=c&&(d==c-1?u--:d==c+1?u++:(d>c?u--:u++,s.__u|=4))):e.__k[a]=null;if(p)for(a=0;a<_;a++)(l=n[a])!=null&&(2&l.__u)==0&&(l.__e==o&&(o=gn(l)),ts(l,l));return o}function Yi(e,t,n,o){var r,a;if(typeof e.type=="function"){for(r=e.__k,a=0;r&&a<r.length;a++)r[a]&&(r[a].__=e,t=Yi(r[a],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=gn(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Wn(e,t){return t=t||[],e==null||typeof e=="boolean"||(Vn(e)?e.some(function(n){Wn(n,t)}):t.push(e)),t}function l_(e,t,n,o){var r,a,s,l=e.key,c=e.type,d=t[n],_=d!=null&&(2&d.__u)==0;if(d===null&&l==null||_&&l==d.key&&c==d.type)return n;if(o>(_?1:0)){for(r=n-1,a=n+1;r>=0||a<t.length;)if((d=t[s=r>=0?r--:a++])!=null&&(2&d.__u)==0&&l==d.key&&c==d.type)return s}return-1}function qi(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||a_.test(t)?n:n+"px"}function Io(e,t,n,o,r){var a,s;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||qi(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||qi(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")a=t!=(t=t.replace(ji,"$1")),s=t.toLowerCase(),t=s in e||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+a]=n,n?o?n[qn]=o[qn]:(n[qn]=ua,e.addEventListener(t,a?ca:la,a)):e.removeEventListener(t,a?ca:la,a);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Vi(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Eo]==null)t[Eo]=ua++;else if(t[Eo]<n[qn])return;return n(ee.event?ee.event(t):t)}}}function pa(e,t,n,o,r,a,s,l,c,d){var _,p,u,m,g,y,S,k,x,h,P,b,w,E,Q,z,A=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[l=t.__e=n.__e]),(_=ee.__b)&&_(t);e:if(typeof A=="function"){p=s.length;try{if(x=t.props,h=A.prototype&&A.prototype.render,P=(_=A.contextType)&&o[_.__c],b=_?P?P.props.value:_.__:o,n.__c?k=(u=t.__c=n.__c).__=u.__E:(h?t.__c=u=new A(x,b):(t.__c=u=new lt(x,b),u.constructor=A,u.render=d_),P&&P.sub(u),u.state||(u.state={}),u.__n=o,m=u.__d=!0,u.__h=[],u._sb=[]),h&&u.__s==null&&(u.__s=u.state),h&&A.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=It({},u.__s)),It(u.__s,A.getDerivedStateFromProps(x,u.__s))),g=u.props,y=u.state,u.__v=t,m)h&&A.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),h&&u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(h&&A.getDerivedStateFromProps==null&&x!==g&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(x,b),t.__v==n.__v||!u.__e&&u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(x,u.__s,b)===!1){t.__v!=n.__v&&(u.props=x,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(D){D&&(D.__=t)}),Lo.push.apply(u.__h,u._sb),u._sb=[],u.__h.length&&s.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(x,u.__s,b),h&&u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(g,y,S)})}if(u.context=b,u.props=x,u.__P=e,u.__e=!1,w=ee.__r,E=0,h)u.state=u.__s,u.__d=!1,w&&w(t),_=u.render(u.props,u.state,u.context),Lo.push.apply(u.__h,u._sb),u._sb=[];else do u.__d=!1,w&&w(t),_=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++E<25);u.state=u.__s,u.getChildContext!=null&&(o=It(It({},o),u.getChildContext())),h&&!m&&u.getSnapshotBeforeUpdate!=null&&(S=u.getSnapshotBeforeUpdate(g,y)),Q=_!=null&&_.type===de&&_.key==null?es(_.props.children):_,l=Xi(e,Vn(Q)?Q:[Q],t,n,o,r,a,s,l,c,d),u.base=t.__e,t.__u&=-161,u.__h.length&&s.push(u),k&&(u.__E=u.__=null)}catch(D){if(s.length=p,t.__v=null,c||a!=null){if(D.then){for(t.__u|=c?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;a!=null&&(a[a.indexOf(l)]=null),t.__e=l}else if(a!=null)for(z=a.length;z--;)_a(a[z])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),D.then||Ji(t),ee.__e(D,t,n)}}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=c_(n.__e,t,n,o,r,a,s,c,d);return(_=ee.diffed)&&_(t),128&t.__u?void 0:l}function Ji(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Ji))}function Zi(e,t,n){for(var o=0;o<n.length;o++)fa(n[o],n[++o],n[++o]);ee.__c&&ee.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(a){a.call(r)})}catch(a){ee.__e(a,r.__v)}})}function es(e){return typeof e!="object"||e==null||e.__b>0?e:Vn(e)?e.map(es):e.constructor!==void 0?null:It({},e)}function c_(e,t,n,o,r,a,s,l,c){var d,_,p,u,m,g,y,S=n.props||Mo,k=t.props,x=t.type;if(x=="svg"?r="http://www.w3.org/2000/svg":x=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),a!=null){for(d=0;d<a.length;d++)if((m=a[d])&&"setAttribute"in m==!!x&&(x?m.localName==x:m.nodeType==3)){e=m,a[d]=null;break}}if(e==null){if(x==null)return document.createTextNode(k);e=document.createElementNS(r,x,k.is&&k),l&&(ee.__m&&ee.__m(t,a),l=!1),a=null}if(x==null)S===k||l&&e.data==k||(e.data=k);else{if(a=x=="textarea"&&k.defaultValue!=null?null:a&&No.call(e.childNodes),!l&&a!=null)for(S={},d=0;d<e.attributes.length;d++)S[(m=e.attributes[d]).name]=m.value;for(d in S)m=S[d],d=="dangerouslySetInnerHTML"?p=m:d=="children"||d in k||d=="value"&&"defaultValue"in k||d=="checked"&&"defaultChecked"in k||Io(e,d,null,m,r);for(d in k)m=k[d],d=="children"?u=m:d=="dangerouslySetInnerHTML"?_=m:d=="value"?g=m:d=="checked"?y=m:l&&typeof m!="function"||S[d]===m||Io(e,d,m,S[d],r);if(_)l||p&&(_.__html==p.__html||_.__html==e.innerHTML)||(e.innerHTML=_.__html),t.__k=[];else if(p&&(e.innerHTML=""),Xi(t.type=="template"?e.content:e,Vn(u)?u:[u],t,n,o,x=="foreignObject"?"http://www.w3.org/1999/xhtml":r,a,s,a?a[0]:n.__k&&gn(n,0),l,c),a!=null)for(d=a.length;d--;)_a(a[d]);l&&x!="textarea"||(d="value",x=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[d]||x=="progress"&&!g||x=="option"&&g!=S[d])&&Io(e,d,g,S[d],r),d="checked",y!=null&&y!=e[d]&&Io(e,d,y,S[d],r))}return e}function fa(e,t,n){try{if(typeof e=="function"){var o=typeof e.__u=="function";o&&e.__u(),o&&t==null||(e.__u=e(t))}else e.current=t}catch(r){ee.__e(r,n)}}function ts(e,t,n){var o,r;if(ee.unmount&&ee.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||fa(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(a){ee.__e(a,t)}o.base=o.__P=o.__n=null}if(o=e.__k)for(r=0;r<o.length;r++)o[r]&&ts(o[r],t,n||typeof e.type!="function");n||_a(e.__e),e.__c=e.__=e.__e=void 0}function d_(e,t,n){return this.constructor(e,n)}function Kn(e,t,n){var o,r,a,s;t==document&&(t=document.documentElement),ee.__&&ee.__(e,t),r=(o=typeof n=="function")?null:n&&n.__k||t.__k,a=[],s=[],pa(t,e=(!o&&n||t).__k=Et(de,null,[e]),r||Mo,Mo,t.namespaceURI,!o&&n?[n]:r?null:t.firstChild?No.call(t.childNodes):null,a,!o&&n?n:r?r.__e:t.firstChild,o,s),Zi(a,e,s),e.props.children=null}No=Lo.slice,ee={__e:function(e,t,n,o){for(var r,a,s;t=t.__;)if((r=t.__c)&&!r.__)try{if((a=r.constructor)&&a.getDerivedStateFromError!=null&&(r.setState(a.getDerivedStateFromError(e)),s=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,o||{}),s=r.__d),s)return r.__E=r}catch(l){e=l}throw e}},Wi=0,da=function(e){return e!=null&&e.constructor===void 0},lt.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=It({},this.state),typeof e=="function"&&(e=e(It({},n),this.props)),e&&It(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),zi(this))},lt.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),zi(this))},lt.prototype.render=de,Vt=[],Ki=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Gi=function(e,t){return e.__v.__b-t.__v.__b},Oo.__r=0,sa=Math.random().toString(8),Eo="__d"+sa,qn="__a"+sa,ji=/(PointerCapture)$|Capture$/i,ua=0,la=Vi(!1),ca=Vi(!0),r_=0;var T={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 vn="1.2.0";var ns={attach:"Attach files",attachmentMimeRejected:"File type not supported",attachmentTooLarge:"File is too large",attachmentTooMany:"Attachment limit reached",conversationClosed:"This chat is closed",conversationLoading:"Loading chat\u2026",loadPreviousMessages:"Load previous messages",close:"Close",collapse:"Collapse",collapseSidebar:"Collapse sidebar",composerPlaceholder:"Type a message\u2026",dateLastWeek:"Last 7 days",dateOlder:"Older",dateToday:"Today",dateYesterday:"Yesterday",dropZone:"Drop files to attach",errorGeneric:"Something went wrong",errorRateLimited:"Too many requests \u2014 please try again in a moment.",errorRetry:"Retry",expand:"Expand",expandSidebar:"Expand sidebar",exitFullscreen:"Exit fullscreen",fullscreen:"Fullscreen",history:"History",historyBack:"Back to chat",historyEmpty:"No previous chats yet",historyLoading:"Loading your chats\u2026",historyContinue:"Continue the chat",historyTitle:"Chat history",loadMoreConversations:"Load more conversations",language:"Language",launcherOpen:"Open chat",launcherLabel:"Chat with us",micStart:"Start voice input",micStop:"Stop voice input",micUnsupported:"Voice input is not supported in this browser",moreActions:"More actions",newConversation:"New chat",panelTitle:"Chat",popOut:"Open in new tab",resizeHandle:"Drag to resize",scrollToBottom:"Scroll to latest",send:"Send",queueMessage:"Queue message",removeQueuedMessage:"Remove queued message",compactingContext:"Optimizing conversation context\u2026",soundOff:"Sound off",soundOn:"Sound on",startNewConversation:"Start a new chat",talkToOperator:"Talk to an operator",connectingOperator:"Connecting you to an operator\u2026",noOperatorAvailable:"No one's available right now \u2014 leave your details and we'll follow up.",chattingWithOperator:"You're chatting with {operator}",cancelOperatorRequest:"Keep chatting with the AI",stop:"Stop",theme:"Theme",themeAuto:"Auto",themeDark:"Dark",themeLight:"Light",textSize:"Text size",textSizeSmall:"Small",textSizeNormal:"Normal",textSizeLarge:"Large",loading:"Loading\u2026",thinking:"Thinking\u2026",thoughts:"Thoughts",toolResult:"Result",sources:"Sources",feedbackUp:"Good response",feedbackDown:"Bad response",feedbackThanks:"Thanks for your feedback",copy:"Copy",copied:"Copied",tabHome:"Home",tabConversations:"Chats",tabHelp:"Help",tabNews:"News",modulesEmpty:"Nothing here yet",moduleBack:"Back",contentLoading:"Loading\u2026",homeGreeting:"How can we help?",homeGreetingNamed:"Hi {name} \u{1F44B}",homeGreetingLead:"How can we help?",homeSearchPlaceholder:"Search for help",homeContentTitle:"Popular articles",homeStatus:"Status",helpTitle:"Help",helpSearchPlaceholder:"Search for help",helpEmpty:"No help articles yet",helpLoading:"Loading help\u2026",helpSearchEmpty:"No results found",newsTitle:"News",newsEmpty:"No news yet",newsLoading:"Loading news\u2026",newsBack:"Back to news",newsPublishedAt:"Published {date}",formSubmit:"Submit",formSkip:"Maybe later",formSubmitted:"Completed",formSkipped:"Maybe later",formFillOut:"Fill out",formRequired:"This field is required",formInvalidEmail:"Enter a valid email address",formInvalidTel:"Enter a valid phone number",formInvalidUrl:"Enter a valid URL",formInvalidNumber:"Enter a valid number",formTooShort:"Too short (min {min} characters)",formTooLong:"Too long (max {max} characters)",formNumberTooSmall:"Must be at least {min}",formNumberTooLarge:"Must be at most {max}",formPatternMismatch:"Please match the requested format",formChooseAtLeast:"Choose at least {min}",formChooseAtMost:"Choose at most {max}",formOther:"Other",formOtherPlaceholder:"Type your answer\u2026",inputRequired:"Questions for you",inputBadge:"Questions",inputAnswered:"Answered",inputSkipped:"Skipped",showOptions:"Show options",hideOptions:"Hide options",qtypeText:"Your answer",qtypeEmail:"Email address",qtypePhone:"Phone number",qtypeNumber:"Number",qtypeDate:"Date",qtypeChooseOne:"Pick one",qtypeChooseAny:"Pick any",qtypeBoolean:"Yes / No",inputSubmit:"Submit answers",inputSubmitHint:"Enter to send \xB7 Shift+Enter = new line",inputSkip:"Skip",confirmYes:"Yes",confirmNo:"No",approve:"Approve",reject:"Reject",approvalPrompt:"{tool} requires your approval to execute.",approvalBody:"Review the tool input above and decide whether to allow this action.",approvalYourResponse:"Your response: {decision}",approvalEditHint:"You can edit this response until this step continues.",approvalSubmitting:"Response submitted. Request in progress\u2026",edit:"Edit",toolParameters:"Parameters",statusAwaiting:"Awaiting Approval",statusResponded:"Submitted",statusRunning:"Running",statusCompleted:"Completed",statusDenied:"Denied",statusError:"Error",statusSuperseded:"Skipped"},u_={attach:"Joindre des fichiers",attachmentMimeRejected:"Type de fichier non pris en charge",attachmentTooLarge:"Le fichier est trop volumineux",attachmentTooMany:"Limite de pi\xE8ces jointes atteinte",conversationClosed:"Ce chat est ferm\xE9",conversationLoading:"Chargement du chat\u2026",loadPreviousMessages:"Charger les messages pr\xE9c\xE9dents",close:"Fermer",collapse:"R\xE9duire",collapseSidebar:"R\xE9duire la barre lat\xE9rale",composerPlaceholder:"\xC9crivez un message\u2026",dateLastWeek:"7 derniers jours",dateOlder:"Plus ancien",dateToday:"Aujourd'hui",dateYesterday:"Hier",dropZone:"D\xE9posez les fichiers \xE0 joindre",errorGeneric:"Une erreur s'est produite",errorRateLimited:"Trop de requ\xEAtes \u2014 veuillez r\xE9essayer dans un instant.",errorRetry:"R\xE9essayer",expand:"Agrandir",expandSidebar:"D\xE9velopper la barre lat\xE9rale",exitFullscreen:"Quitter le plein \xE9cran",fullscreen:"Plein \xE9cran",history:"Historique",historyBack:"Retour au chat",historyEmpty:"Aucun chat pour le moment",historyContinue:"Poursuivre le chat",historyLoading:"Chargement de vos chats\u2026",historyTitle:"Historique des chats",loadMoreConversations:"Charger plus de conversations",language:"Langue",launcherOpen:"Ouvrir le chat",launcherLabel:"Discuter avec nous",micStart:"D\xE9marrer la saisie vocale",micStop:"Arr\xEAter la saisie vocale",micUnsupported:"La saisie vocale n'est pas prise en charge par ce navigateur",moreActions:"Plus d'actions",newConversation:"Nouveau chat",panelTitle:"Chat",popOut:"Ouvrir dans un nouvel onglet",resizeHandle:"Glisser pour redimensionner",scrollToBottom:"Aller au plus r\xE9cent",send:"Envoyer",queueMessage:"Mettre le message en attente",removeQueuedMessage:"Retirer le message en attente",compactingContext:"Optimisation du contexte de la conversation\u2026",soundOff:"Son d\xE9sactiv\xE9",soundOn:"Son activ\xE9",startNewConversation:"D\xE9marrer un nouveau chat",talkToOperator:"Parler \xE0 un op\xE9rateur",connectingOperator:"Mise en relation avec un op\xE9rateur\u2026",noOperatorAvailable:"Personne n'est disponible pour le moment \u2014 laissez vos coordonn\xE9es et nous reviendrons vers vous.",chattingWithOperator:"Vous discutez avec {operator}",cancelOperatorRequest:"Continuer avec l'IA",stop:"Arr\xEAter",theme:"Th\xE8me",themeAuto:"Auto",themeDark:"Sombre",themeLight:"Clair",textSize:"Taille du texte",textSizeSmall:"Petite",textSizeNormal:"Normale",textSizeLarge:"Grande",loading:"Chargement\u2026",thinking:"R\xE9flexion\u2026",thoughts:"R\xE9flexions",toolResult:"R\xE9sultat",sources:"Sources",feedbackUp:"Bonne r\xE9ponse",feedbackDown:"Mauvaise r\xE9ponse",feedbackThanks:"Merci pour votre retour",copy:"Copier",copied:"Copi\xE9",tabHome:"Accueil",tabConversations:"Chats",tabHelp:"Aide",tabNews:"Actualit\xE9s",modulesEmpty:"Rien pour le moment",moduleBack:"Retour",contentLoading:"Chargement\u2026",homeGreeting:"Comment pouvons-nous vous aider ?",homeGreetingNamed:"Bonjour {name} \u{1F44B}",homeGreetingLead:"Comment pouvons-nous vous aider ?",homeSearchPlaceholder:"Rechercher de l'aide",homeContentTitle:"Articles populaires",homeStatus:"Statut",helpTitle:"Aide",helpSearchPlaceholder:"Rechercher de l'aide",helpEmpty:"Aucun article d'aide pour le moment",helpLoading:"Chargement de l'aide\u2026",helpSearchEmpty:"Aucun r\xE9sultat trouv\xE9",newsTitle:"Actualit\xE9s",newsEmpty:"Aucune actualit\xE9 pour le moment",newsLoading:"Chargement des actualit\xE9s\u2026",newsBack:"Retour aux actualit\xE9s",newsPublishedAt:"Publi\xE9 le {date}",formSubmit:"Envoyer",formSkip:"Plus tard",formSubmitted:"Termin\xE9",formSkipped:"Plus tard",formFillOut:"Remplir",formRequired:"Ce champ est obligatoire",formInvalidEmail:"Saisissez une adresse e-mail valide",formInvalidTel:"Saisissez un num\xE9ro de t\xE9l\xE9phone valide",formInvalidUrl:"Saisissez une URL valide",formInvalidNumber:"Saisissez un nombre valide",formTooShort:"Trop court (min. {min} caract\xE8res)",formTooLong:"Trop long (max. {max} caract\xE8res)",formNumberTooSmall:"Doit \xEAtre au moins {min}",formNumberTooLarge:"Doit \xEAtre au plus {max}",formPatternMismatch:"Veuillez respecter le format demand\xE9",formChooseAtLeast:"Choisissez au moins {min}",formChooseAtMost:"Choisissez au plus {max}",formOther:"Autre",formOtherPlaceholder:"Saisissez votre r\xE9ponse\u2026",inputRequired:"Questions pour vous",inputBadge:"Questions",inputAnswered:"R\xE9pondu",inputSkipped:"Ignor\xE9",showOptions:"Afficher les options",hideOptions:"Masquer les options",qtypeText:"Votre r\xE9ponse",qtypeEmail:"Adresse e-mail",qtypePhone:"Num\xE9ro de t\xE9l\xE9phone",qtypeNumber:"Nombre",qtypeDate:"Date",qtypeChooseOne:"Choisir une",qtypeChooseAny:"Choisir plusieurs",qtypeBoolean:"Oui / Non",inputSubmit:"Envoyer les r\xE9ponses",inputSubmitHint:"Entr\xE9e pour envoyer \xB7 Maj+Entr\xE9e = saut de ligne",inputSkip:"Ignorer",confirmYes:"Oui",confirmNo:"Non",approve:"Approuver",reject:"Refuser",approvalPrompt:"{tool} n\xE9cessite votre approbation pour s'ex\xE9cuter.",approvalBody:"V\xE9rifiez les param\xE8tres ci-dessus et d\xE9cidez d'autoriser ou non cette action.",approvalYourResponse:"Votre r\xE9ponse : {decision}",approvalEditHint:"Vous pouvez modifier votre r\xE9ponse jusqu'\xE0 la reprise de cette \xE9tape.",approvalSubmitting:"R\xE9ponse envoy\xE9e. Traitement en cours\u2026",edit:"Modifier",toolParameters:"Param\xE8tres",statusAwaiting:"En attente d'approbation",statusResponded:"Envoy\xE9",statusRunning:"En cours",statusCompleted:"Termin\xE9",statusDenied:"Refus\xE9",statusError:"Erreur",statusSuperseded:"Ignor\xE9"},__={attach:"\u0625\u0631\u0641\u0627\u0642 \u0645\u0644\u0641\u0627\u062A",attachmentMimeRejected:"\u0646\u0648\u0639 \u0627\u0644\u0645\u0644\u0641 \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645",attachmentTooLarge:"\u062D\u062C\u0645 \u0627\u0644\u0645\u0644\u0641 \u0643\u0628\u064A\u0631 \u062C\u062F\u064B\u0627",attachmentTooMany:"\u062A\u0645 \u0628\u0644\u0648\u063A \u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 \u0644\u0644\u0645\u0631\u0641\u0642\u0627\u062A",conversationClosed:"\u062A\u0645 \u0625\u063A\u0644\u0627\u0642 \u0647\u0630\u0647 \u0627\u0644\u062F\u0631\u062F\u0634\u0629",conversationLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u062F\u0631\u062F\u0634\u0629\u2026",loadPreviousMessages:"\u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0631\u0633\u0627\u0626\u0644 \u0627\u0644\u0633\u0627\u0628\u0642\u0629",close:"\u0625\u063A\u0644\u0627\u0642",collapse:"\u0637\u064A\u0651",collapseSidebar:"\u0637\u064A\u0651 \u0627\u0644\u0634\u0631\u064A\u0637 \u0627\u0644\u062C\u0627\u0646\u0628\u064A",composerPlaceholder:"\u0627\u0643\u062A\u0628 \u0631\u0633\u0627\u0644\u0629\u2026",dateLastWeek:"\u0622\u062E\u0631 \u0667 \u0623\u064A\u0627\u0645",dateOlder:"\u0623\u0642\u062F\u0645",dateToday:"\u0627\u0644\u064A\u0648\u0645",dateYesterday:"\u0623\u0645\u0633",dropZone:"\u0623\u0641\u0644\u062A \u0627\u0644\u0645\u0644\u0641\u0627\u062A \u0644\u0625\u0631\u0641\u0627\u0642\u0647\u0627",errorGeneric:"\u062D\u062F\u062B \u062E\u0637\u0623 \u0645\u0627",errorRateLimited:"\u0637\u0644\u0628\u0627\u062A \u0643\u062B\u064A\u0631\u0629 \u062C\u062F\u064B\u0627 \u2014 \u064A\u0631\u062C\u0649 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629 \u0628\u0639\u062F \u0644\u062D\u0638\u0629.",errorRetry:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629",expand:"\u062A\u0648\u0633\u064A\u0639",expandSidebar:"\u062A\u0648\u0633\u064A\u0639 \u0627\u0644\u0634\u0631\u064A\u0637 \u0627\u0644\u062C\u0627\u0646\u0628\u064A",exitFullscreen:"\u0625\u0646\u0647\u0627\u0621 \u0645\u0644\u0621 \u0627\u0644\u0634\u0627\u0634\u0629",fullscreen:"\u0645\u0644\u0621 \u0627\u0644\u0634\u0627\u0634\u0629",history:"\u0627\u0644\u0633\u062C\u0644",historyBack:"\u0627\u0644\u0639\u0648\u062F\u0629 \u0625\u0644\u0649 \u0627\u0644\u062F\u0631\u062F\u0634\u0629",historyEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u062F\u0631\u062F\u0634\u0627\u062A \u0633\u0627\u0628\u0642\u0629 \u0628\u0639\u062F",historyContinue:"\u0645\u062A\u0627\u0628\u0639\u0629 \u0627\u0644\u062F\u0631\u062F\u0634\u0629",historyLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u062F\u0631\u062F\u0634\u0627\u062A\u0643\u2026",historyTitle:"\u0633\u062C\u0644 \u0627\u0644\u062F\u0631\u062F\u0634\u0627\u062A",loadMoreConversations:"\u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u0632\u064A\u062F \u0645\u0646 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0627\u062A",language:"\u0627\u0644\u0644\u063A\u0629",launcherOpen:"\u0641\u062A\u062D \u0627\u0644\u062F\u0631\u062F\u0634\u0629",launcherLabel:"\u062A\u062D\u062F\u062B \u0645\u0639\u0646\u0627",micStart:"\u0628\u062F\u0621 \u0627\u0644\u0625\u062F\u062E\u0627\u0644 \u0627\u0644\u0635\u0648\u062A\u064A",micStop:"\u0625\u064A\u0642\u0627\u0641 \u0627\u0644\u0625\u062F\u062E\u0627\u0644 \u0627\u0644\u0635\u0648\u062A\u064A",micUnsupported:"\u0627\u0644\u0625\u062F\u062E\u0627\u0644 \u0627\u0644\u0635\u0648\u062A\u064A \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645 \u0641\u064A \u0647\u0630\u0627 \u0627\u0644\u0645\u062A\u0635\u0641\u062D",moreActions:"\u0625\u062C\u0631\u0627\u0621\u0627\u062A \u0625\u0636\u0627\u0641\u064A\u0629",newConversation:"\u062F\u0631\u062F\u0634\u0629 \u062C\u062F\u064A\u062F\u0629",panelTitle:"\u0627\u0644\u062F\u0631\u062F\u0634\u0629",popOut:"\u0641\u062A\u062D \u0641\u064A \u0639\u0644\u0627\u0645\u0629 \u062A\u0628\u0648\u064A\u0628 \u062C\u062F\u064A\u062F\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",queueMessage:"\u0625\u0636\u0627\u0641\u0629 \u0627\u0644\u0631\u0633\u0627\u0644\u0629 \u0625\u0644\u0649 \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0627\u0646\u062A\u0638\u0627\u0631",removeQueuedMessage:"\u0625\u0632\u0627\u0644\u0629 \u0627\u0644\u0631\u0633\u0627\u0644\u0629 \u0645\u0646 \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0627\u0646\u062A\u0638\u0627\u0631",compactingContext:"\u062C\u0627\u0631\u064D \u062A\u062D\u0633\u064A\u0646 \u0633\u064A\u0627\u0642 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629\u2026",soundOff:"\u0643\u062A\u0645 \u0627\u0644\u0635\u0648\u062A",soundOn:"\u062A\u0634\u063A\u064A\u0644 \u0627\u0644\u0635\u0648\u062A",startNewConversation:"\u0628\u062F\u0621 \u062F\u0631\u062F\u0634\u0629 \u062C\u062F\u064A\u062F\u0629",talkToOperator:"\u0627\u0644\u062A\u062D\u062F\u062B \u0625\u0644\u0649 \u0645\u0648\u0638\u0641",connectingOperator:"\u062C\u0627\u0631\u064A \u062A\u0648\u0635\u064A\u0644\u0643 \u0628\u0623\u062D\u062F \u0627\u0644\u0645\u0648\u0638\u0641\u064A\u0646\u2026",noOperatorAvailable:"\u0644\u0627 \u064A\u0648\u062C\u062F \u0645\u0648\u0638\u0641\u0648\u0646 \u0645\u062A\u0627\u062D\u0648\u0646 \u0627\u0644\u0622\u0646 \u2014 \u0627\u062A\u0631\u0643 \u0628\u064A\u0627\u0646\u0627\u062A\u0643 \u0648\u0633\u0646\u062A\u0648\u0627\u0635\u0644 \u0645\u0639\u0643.",chattingWithOperator:"\u0623\u0646\u062A \u062A\u062A\u062D\u062F\u062B \u0645\u0639 {operator}",cancelOperatorRequest:"\u0645\u062A\u0627\u0628\u0639\u0629 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629 \u0645\u0639 \u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A",stop:"\u0625\u064A\u0642\u0627\u0641",theme:"\u0627\u0644\u0645\u0638\u0647\u0631",themeAuto:"\u062A\u0644\u0642\u0627\u0626\u064A",themeDark:"\u062F\u0627\u0643\u0646",themeLight:"\u0641\u0627\u062A\u062D",textSize:"\u062D\u062C\u0645 \u0627\u0644\u0646\u0635",textSizeSmall:"\u0635\u063A\u064A\u0631",textSizeNormal:"\u0639\u0627\u062F\u064A",textSizeLarge:"\u0643\u0628\u064A\u0631",loading:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644\u2026",thinking:"\u064A\u0641\u0643\u0651\u0631\u2026",thoughts:"\u0627\u0644\u0623\u0641\u0643\u0627\u0631",toolResult:"\u0627\u0644\u0646\u062A\u064A\u062C\u0629",sources:"\u0627\u0644\u0645\u0635\u0627\u062F\u0631",feedbackUp:"\u0631\u062F \u062C\u064A\u062F",feedbackDown:"\u0631\u062F \u0633\u064A\u0626",feedbackThanks:"\u0634\u0643\u0631\u064B\u0627 \u0639\u0644\u0649 \u0645\u0644\u0627\u062D\u0638\u0627\u062A\u0643",copy:"\u0646\u0633\u062E",copied:"\u062A\u0645 \u0627\u0644\u0646\u0633\u062E",tabHome:"\u0627\u0644\u0631\u0626\u064A\u0633\u064A\u0629",tabConversations:"\u0627\u0644\u062F\u0631\u062F\u0634\u0627\u062A",tabHelp:"\u0627\u0644\u0645\u0633\u0627\u0639\u062F\u0629",tabNews:"\u0627\u0644\u0623\u062E\u0628\u0627\u0631",modulesEmpty:"\u0644\u0627 \u0634\u064A\u0621 \u0647\u0646\u0627 \u0628\u0639\u062F",moduleBack:"\u0631\u062C\u0648\u0639",contentLoading:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644\u2026",homeGreeting:"\u0643\u064A\u0641 \u064A\u0645\u0643\u0646\u0646\u0627 \u0645\u0633\u0627\u0639\u062F\u062A\u0643\u061F",homeGreetingNamed:"\u0645\u0631\u062D\u0628\u064B\u0627 {name} \u{1F44B}",homeGreetingLead:"\u0643\u064A\u0641 \u064A\u0645\u0643\u0646\u0646\u0627 \u0645\u0633\u0627\u0639\u062F\u062A\u0643\u061F",homeSearchPlaceholder:"\u0627\u0628\u062D\u062B \u0639\u0646 \u0645\u0633\u0627\u0639\u062F\u0629",homeContentTitle:"\u0645\u0642\u0627\u0644\u0627\u062A \u0634\u0627\u0626\u0639\u0629",homeStatus:"\u0627\u0644\u062D\u0627\u0644\u0629",helpTitle:"\u0627\u0644\u0645\u0633\u0627\u0639\u062F\u0629",helpSearchPlaceholder:"\u0627\u0628\u062D\u062B \u0639\u0646 \u0645\u0633\u0627\u0639\u062F\u0629",helpEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0645\u0642\u0627\u0644\u0627\u062A \u0645\u0633\u0627\u0639\u062F\u0629 \u0628\u0639\u062F",helpLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u0633\u0627\u0639\u062F\u0629\u2026",helpSearchEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0646\u062A\u0627\u0626\u062C",newsTitle:"\u0627\u0644\u0623\u062E\u0628\u0627\u0631",newsEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0623\u062E\u0628\u0627\u0631 \u0628\u0639\u062F",newsLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0623\u062E\u0628\u0627\u0631\u2026",newsBack:"\u0627\u0644\u0639\u0648\u062F\u0629 \u0625\u0644\u0649 \u0627\u0644\u0623\u062E\u0628\u0627\u0631",newsPublishedAt:"\u0646\u064F\u0634\u0631 \u0641\u064A {date}",formSubmit:"\u0625\u0631\u0633\u0627\u0644",formSkip:"\u0644\u0627\u062D\u0642\u064B\u0627",formSubmitted:"\u062A\u0645",formSkipped:"\u0644\u0627\u062D\u0642\u064B\u0627",formFillOut:"\u062A\u0639\u0628\u0626\u0629",formRequired:"\u0647\u0630\u0627 \u0627\u0644\u062D\u0642\u0644 \u0645\u0637\u0644\u0648\u0628",formInvalidEmail:"\u0623\u062F\u062E\u0644 \u0628\u0631\u064A\u062F\u064B\u0627 \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",formInvalidTel:"\u0623\u062F\u062E\u0644 \u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0635\u062D\u064A\u062D\u064B\u0627",formInvalidUrl:"\u0623\u062F\u062E\u0644 \u0631\u0627\u0628\u0637\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",formInvalidNumber:"\u0623\u062F\u062E\u0644 \u0631\u0642\u0645\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",formTooShort:"\u0642\u0635\u064A\u0631 \u062C\u062F\u064B\u0627 (\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u062F\u0646\u0649 {min} \u062D\u0631\u0641\u064B\u0627)",formTooLong:"\u0637\u0648\u064A\u0644 \u062C\u062F\u064B\u0627 (\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 {max} \u062D\u0631\u0641\u064B\u0627)",formNumberTooSmall:"\u064A\u062C\u0628 \u0623\u0644\u0627 \u064A\u0642\u0644 \u0639\u0646 {min}",formNumberTooLarge:"\u064A\u062C\u0628 \u0623\u0644\u0627 \u064A\u0632\u064A\u062F \u0639\u0646 {max}",formPatternMismatch:"\u064A\u0631\u062C\u0649 \u0645\u0637\u0627\u0628\u0642\u0629 \u0627\u0644\u0635\u064A\u063A\u0629 \u0627\u0644\u0645\u0637\u0644\u0648\u0628\u0629",formChooseAtLeast:"\u0627\u062E\u062A\u0631 {min} \u0639\u0644\u0649 \u0627\u0644\u0623\u0642\u0644",formChooseAtMost:"\u0627\u062E\u062A\u0631 {max} \u0639\u0644\u0649 \u0627\u0644\u0623\u0643\u062B\u0631",formOther:"\u0623\u062E\u0631\u0649",formOtherPlaceholder:"\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643\u2026",inputRequired:"\u0623\u0633\u0626\u0644\u0629 \u0644\u0643",inputBadge:"\u0623\u0633\u0626\u0644\u0629",inputAnswered:"\u062A\u0645\u062A \u0627\u0644\u0625\u062C\u0627\u0628\u0629",inputSkipped:"\u062A\u0645 \u0627\u0644\u062A\u062E\u0637\u064A",showOptions:"\u0625\u0638\u0647\u0627\u0631 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A",hideOptions:"\u0625\u062E\u0641\u0627\u0621 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A",qtypeText:"\u0625\u062C\u0627\u0628\u062A\u0643",qtypeEmail:"\u0639\u0646\u0648\u0627\u0646 \u0627\u0644\u0628\u0631\u064A\u062F \u0627\u0644\u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",qtypePhone:"\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062A\u0641",qtypeNumber:"\u0631\u0642\u0645",qtypeDate:"\u062A\u0627\u0631\u064A\u062E",qtypeChooseOne:"\u0627\u062E\u062A\u0631 \u0648\u0627\u062D\u062F\u064B\u0627",qtypeChooseAny:"\u0627\u062E\u062A\u0631 \u0623\u064A\u064B\u0627",qtypeBoolean:"\u0646\u0639\u0645 / \u0644\u0627",inputSubmit:"\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A",inputSubmitHint:"Enter \u0644\u0644\u0625\u0631\u0633\u0627\u0644 \xB7 Shift+Enter = \u0633\u0637\u0631 \u062C\u062F\u064A\u062F",inputSkip:"\u062A\u062E\u0637\u064D\u0651",confirmYes:"\u0646\u0639\u0645",confirmNo:"\u0644\u0627",approve:"\u0645\u0648\u0627\u0641\u0642\u0629",reject:"\u0631\u0641\u0636",approvalPrompt:"\u062A\u062A\u0637\u0644\u0628 {tool} \u0645\u0648\u0627\u0641\u0642\u062A\u0643 \u0644\u0644\u062A\u0646\u0641\u064A\u0630.",approvalBody:"\u0631\u0627\u062C\u0639 \u0645\u064F\u0639\u0637\u064A\u0627\u062A \u0627\u0644\u0623\u062F\u0627\u0629 \u0623\u0639\u0644\u0627\u0647 \u0648\u0642\u0631\u0651\u0631 \u0627\u0644\u0633\u0645\u0627\u062D \u0628\u0647\u0630\u0627 \u0627\u0644\u0625\u062C\u0631\u0627\u0621 \u0623\u0648 \u0631\u0641\u0636\u0647.",approvalYourResponse:"\u0631\u062F\u0651\u0643: {decision}",approvalEditHint:"\u064A\u0645\u0643\u0646\u0643 \u062A\u0639\u062F\u064A\u0644 \u0631\u062F\u0651\u0643 \u062D\u062A\u0649 \u062A\u0633\u062A\u0623\u0646\u0641 \u0647\u0630\u0647 \u0627\u0644\u062E\u0637\u0648\u0629.",approvalSubmitting:"\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0631\u062F. \u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0646\u0641\u064A\u0630\u2026",edit:"\u062A\u0639\u062F\u064A\u0644",toolParameters:"\u0627\u0644\u0645\u0639\u0637\u064A\u0627\u062A",statusAwaiting:"\u0628\u0627\u0646\u062A\u0638\u0627\u0631 \u0627\u0644\u0645\u0648\u0627\u0641\u0642\u0629",statusResponded:"\u062A\u0645 \u0627\u0644\u0625\u0631\u0633\u0627\u0644",statusRunning:"\u0642\u064A\u062F \u0627\u0644\u062A\u0646\u0641\u064A\u0630",statusCompleted:"\u0645\u0643\u062A\u0645\u0644",statusDenied:"\u0645\u0631\u0641\u0648\u0636",statusError:"\u062E\u0637\u0623",statusSuperseded:"\u062A\u0645 \u0627\u0644\u062A\u062E\u0637\u064A"},p_={attach:"Adjuntar archivos",attachmentMimeRejected:"Tipo de archivo no admitido",attachmentTooLarge:"El archivo es demasiado grande",attachmentTooMany:"Se alcanz\xF3 el l\xEDmite de adjuntos",conversationClosed:"Este chat est\xE1 cerrado",conversationLoading:"Cargando chat\u2026",loadPreviousMessages:"Cargar mensajes anteriores",close:"Cerrar",collapse:"Contraer",collapseSidebar:"Contraer la barra lateral",composerPlaceholder:"Escribe un mensaje\u2026",dateLastWeek:"\xDAltimos 7 d\xEDas",dateOlder:"Anteriores",dateToday:"Hoy",dateYesterday:"Ayer",dropZone:"Suelta los archivos para adjuntarlos",errorGeneric:"Algo sali\xF3 mal",errorRateLimited:"Demasiadas solicitudes: int\xE9ntalo de nuevo en un momento.",errorRetry:"Reintentar",expand:"Ampliar",expandSidebar:"Expandir la barra lateral",exitFullscreen:"Salir de pantalla completa",fullscreen:"Pantalla completa",history:"Historial",historyBack:"Volver al chat",historyEmpty:"A\xFAn no tienes chats",historyContinue:"Continuar el chat",historyLoading:"Cargando tus chats\u2026",historyTitle:"Historial de chats",loadMoreConversations:"Cargar m\xE1s conversaciones",language:"Idioma",launcherOpen:"Abrir el chat",launcherLabel:"Chatea con nosotros",micStart:"Iniciar entrada de voz",micStop:"Detener entrada de voz",micUnsupported:"Este navegador no admite la entrada de voz",moreActions:"M\xE1s acciones",newConversation:"Nuevo chat",panelTitle:"Chat",popOut:"Abrir en una pesta\xF1a nueva",resizeHandle:"Arrastra para cambiar el tama\xF1o",scrollToBottom:"Ir a lo m\xE1s reciente",send:"Enviar",queueMessage:"Poner mensaje en cola",removeQueuedMessage:"Quitar mensaje de la cola",compactingContext:"Optimizando el contexto de la conversaci\xF3n\u2026",soundOff:"Sonido desactivado",soundOn:"Sonido activado",startNewConversation:"Iniciar un chat nuevo",talkToOperator:"Hablar con un operador",connectingOperator:"Conect\xE1ndote con un operador\u2026",noOperatorAvailable:"Nadie est\xE1 disponible ahora \u2014 deja tus datos y te contactaremos.",chattingWithOperator:"Est\xE1s chateando con {operator}",cancelOperatorRequest:"Seguir con la IA",stop:"Detener",theme:"Tema",themeAuto:"Autom\xE1tico",themeDark:"Oscuro",themeLight:"Claro",textSize:"Tama\xF1o del texto",textSizeSmall:"Peque\xF1o",textSizeNormal:"Normal",textSizeLarge:"Grande",loading:"Cargando\u2026",thinking:"Pensando\u2026",thoughts:"Razonamiento",toolResult:"Resultado",sources:"Fuentes",feedbackUp:"Buena respuesta",feedbackDown:"Mala respuesta",feedbackThanks:"Gracias por tu opini\xF3n",copy:"Copiar",copied:"Copiado",tabHome:"Inicio",tabConversations:"Chats",tabHelp:"Ayuda",tabNews:"Novedades",modulesEmpty:"A\xFAn no hay nada aqu\xED",moduleBack:"Atr\xE1s",contentLoading:"Cargando\u2026",homeGreeting:"\xBFC\xF3mo podemos ayudarte?",homeGreetingNamed:"Hola, {name} \u{1F44B}",homeGreetingLead:"\xBFC\xF3mo podemos ayudarte?",homeSearchPlaceholder:"Buscar ayuda",homeContentTitle:"Art\xEDculos populares",homeStatus:"Estado",helpTitle:"Ayuda",helpSearchPlaceholder:"Buscar ayuda",helpEmpty:"A\xFAn no hay art\xEDculos de ayuda",helpLoading:"Cargando la ayuda\u2026",helpSearchEmpty:"No se encontraron resultados",newsTitle:"Novedades",newsEmpty:"A\xFAn no hay novedades",newsLoading:"Cargando novedades\u2026",newsBack:"Volver a novedades",newsPublishedAt:"Publicado el {date}",formSubmit:"Enviar",formSkip:"Quiz\xE1 m\xE1s tarde",formSubmitted:"Completado",formSkipped:"Quiz\xE1 m\xE1s tarde",formFillOut:"Completar",formRequired:"Este campo es obligatorio",formInvalidEmail:"Introduce un correo electr\xF3nico v\xE1lido",formInvalidTel:"Introduce un n\xFAmero de tel\xE9fono v\xE1lido",formInvalidUrl:"Introduce una URL v\xE1lida",formInvalidNumber:"Introduce un n\xFAmero v\xE1lido",formTooShort:"Demasiado corto (m\xEDn. {min} caracteres)",formTooLong:"Demasiado largo (m\xE1x. {max} caracteres)",formNumberTooSmall:"Debe ser al menos {min}",formNumberTooLarge:"Debe ser como m\xE1ximo {max}",formPatternMismatch:"Respeta el formato solicitado",formChooseAtLeast:"Elige al menos {min}",formChooseAtMost:"Elige como m\xE1ximo {max}",formOther:"Otro",formOtherPlaceholder:"Escribe tu respuesta\u2026",inputRequired:"Preguntas para ti",inputBadge:"Preguntas",inputAnswered:"Respondido",inputSkipped:"Omitido",showOptions:"Mostrar opciones",hideOptions:"Ocultar opciones",qtypeText:"Tu respuesta",qtypeEmail:"Correo electr\xF3nico",qtypePhone:"N\xFAmero de tel\xE9fono",qtypeNumber:"N\xFAmero",qtypeDate:"Fecha",qtypeChooseOne:"Elige una",qtypeChooseAny:"Elige varias",qtypeBoolean:"S\xED / No",inputSubmit:"Enviar respuestas",inputSubmitHint:"Enter para enviar \xB7 May\xFAs+Enter = nueva l\xEDnea",inputSkip:"Omitir",confirmYes:"S\xED",confirmNo:"No",approve:"Aprobar",reject:"Rechazar",approvalPrompt:"{tool} requiere tu aprobaci\xF3n para ejecutarse.",approvalBody:"Revisa los par\xE1metros de arriba y decide si permites esta acci\xF3n.",approvalYourResponse:"Tu respuesta: {decision}",approvalEditHint:"Puedes cambiar tu respuesta hasta que este paso contin\xFAe.",approvalSubmitting:"Respuesta enviada. Procesando\u2026",edit:"Editar",toolParameters:"Par\xE1metros",statusAwaiting:"Esperando aprobaci\xF3n",statusResponded:"Enviado",statusRunning:"En curso",statusCompleted:"Completado",statusDenied:"Denegado",statusError:"Error",statusSuperseded:"Omitido"},f_={attach:"\u05E6\u05D9\u05E8\u05D5\u05E3 \u05E7\u05D1\u05E6\u05D9\u05DD",attachmentMimeRejected:"\u05E1\u05D5\u05D2 \u05D4\u05E7\u05D5\u05D1\u05E5 \u05D0\u05D9\u05E0\u05D5 \u05E0\u05EA\u05DE\u05DA",attachmentTooLarge:"\u05D4\u05E7\u05D5\u05D1\u05E5 \u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9",attachmentTooMany:"\u05D4\u05D2\u05E2\u05EA \u05DC\u05DE\u05E1\u05E4\u05E8 \u05D4\u05DE\u05E8\u05D1\u05D9 \u05E9\u05DC \u05E7\u05D1\u05E6\u05D9\u05DD \u05DE\u05E6\u05D5\u05E8\u05E4\u05D9\u05DD",conversationClosed:"\u05D4\u05E6\u05F3\u05D0\u05D8 \u05D4\u05D6\u05D4 \u05E0\u05E1\u05D2\u05E8",conversationLoading:"\u05D8\u05D5\u05E2\u05DF \u05E6\u05F3\u05D0\u05D8\u2026",loadPreviousMessages:"\u05D8\u05E2\u05D9\u05E0\u05EA \u05D4\u05D5\u05D3\u05E2\u05D5\u05EA \u05E7\u05D5\u05D3\u05DE\u05D5\u05EA",close:"\u05E1\u05D2\u05D9\u05E8\u05D4",collapse:"\u05DB\u05D9\u05D5\u05D5\u05E5",collapseSidebar:"\u05DB\u05D9\u05D5\u05D5\u05E5 \u05E1\u05E8\u05D2\u05DC \u05D4\u05E6\u05D3",composerPlaceholder:"\u05DB\u05EA\u05D5\u05D1 \u05D4\u05D5\u05D3\u05E2\u05D4\u2026",dateLastWeek:"7 \u05D4\u05D9\u05DE\u05D9\u05DD \u05D4\u05D0\u05D7\u05E8\u05D5\u05E0\u05D9\u05DD",dateOlder:"\u05D9\u05E9\u05DF \u05D9\u05D5\u05EA\u05E8",dateToday:"\u05D4\u05D9\u05D5\u05DD",dateYesterday:"\u05D0\u05EA\u05DE\u05D5\u05DC",dropZone:"\u05E9\u05D7\u05E8\u05E8 \u05E7\u05D1\u05E6\u05D9\u05DD \u05DB\u05D3\u05D9 \u05DC\u05E6\u05E8\u05E3",errorGeneric:"\u05DE\u05E9\u05D4\u05D5 \u05D4\u05E9\u05EA\u05D1\u05E9",errorRateLimited:"\u05D9\u05D5\u05EA\u05E8 \u05DE\u05D3\u05D9 \u05D1\u05E7\u05E9\u05D5\u05EA \u2014 \u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1 \u05D1\u05E2\u05D5\u05D3 \u05E8\u05D2\u05E2.",errorRetry:"\u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1",expand:"\u05D4\u05E8\u05D7\u05D1\u05D4",expandSidebar:"\u05D4\u05E8\u05D7\u05D1\u05EA \u05E1\u05E8\u05D2\u05DC \u05D4\u05E6\u05D3",exitFullscreen:"\u05D9\u05E6\u05D9\u05D0\u05D4 \u05DE\u05DE\u05E1\u05DA \u05DE\u05DC\u05D0",fullscreen:"\u05DE\u05E1\u05DA \u05DE\u05DC\u05D0",history:"\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D4",historyBack:"\u05D7\u05D6\u05E8\u05D4 \u05DC\u05E6\u05F3\u05D0\u05D8",historyEmpty:"\u05D0\u05D9\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05E6\u05F3\u05D0\u05D8\u05D9\u05DD \u05E7\u05D5\u05D3\u05DE\u05D9\u05DD",historyContinue:"\u05D4\u05DE\u05E9\u05DA \u05E6\u05F3\u05D0\u05D8",historyLoading:"\u05D8\u05D5\u05E2\u05DF \u05D0\u05EA \u05D4\u05E6\u05F3\u05D0\u05D8\u05D9\u05DD \u05E9\u05DC\u05DA\u2026",historyTitle:"\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05E6\u05F3\u05D0\u05D8\u05D9\u05DD",loadMoreConversations:"\u05D8\u05E2\u05D9\u05E0\u05EA \u05E9\u05D9\u05D7\u05D5\u05EA \u05E0\u05D5\u05E1\u05E4\u05D5\u05EA",language:"\u05E9\u05E4\u05D4",launcherOpen:"\u05E4\u05EA\u05D9\u05D7\u05EA \u05E6\u05F3\u05D0\u05D8",launcherLabel:"\u05D3\u05D1\u05E8\u05D5 \u05D0\u05D9\u05EA\u05E0\u05D5",micStart:"\u05D4\u05EA\u05D7\u05DC\u05EA \u05E7\u05DC\u05D8 \u05E7\u05D5\u05DC\u05D9",micStop:"\u05E2\u05E6\u05D9\u05E8\u05EA \u05E7\u05DC\u05D8 \u05E7\u05D5\u05DC\u05D9",micUnsupported:"\u05E7\u05DC\u05D8 \u05E7\u05D5\u05DC\u05D9 \u05D0\u05D9\u05E0\u05D5 \u05E0\u05EA\u05DE\u05DA \u05D1\u05D3\u05E4\u05D3\u05E4\u05DF \u05D6\u05D4",moreActions:"\u05E4\u05E2\u05D5\u05DC\u05D5\u05EA \u05E0\u05D5\u05E1\u05E4\u05D5\u05EA",newConversation:"\u05E6\u05F3\u05D0\u05D8 \u05D7\u05D3\u05E9",panelTitle:"\u05E6\u05F3\u05D0\u05D8",popOut:"\u05E4\u05EA\u05D9\u05D7\u05D4 \u05D1\u05DB\u05E8\u05D8\u05D9\u05E1\u05D9\u05D9\u05D4 \u05D7\u05D3\u05E9\u05D4",resizeHandle:"\u05D2\u05E8\u05D5\u05E8 \u05DC\u05E9\u05D9\u05E0\u05D5\u05D9 \u05D4\u05D2\u05D5\u05D3\u05DC",scrollToBottom:"\u05DE\u05E2\u05D1\u05E8 \u05DC\u05D7\u05D3\u05E9 \u05D1\u05D9\u05D5\u05EA\u05E8",send:"\u05E9\u05DC\u05D9\u05D7\u05D4",queueMessage:"\u05D4\u05D5\u05E1\u05E4\u05EA \u05D4\u05D4\u05D5\u05D3\u05E2\u05D4 \u05DC\u05EA\u05D5\u05E8",removeQueuedMessage:"\u05D4\u05E1\u05E8\u05EA \u05D4\u05D4\u05D5\u05D3\u05E2\u05D4 \u05DE\u05D4\u05EA\u05D5\u05E8",compactingContext:"\u05DE\u05D1\u05E6\u05E2 \u05D0\u05D5\u05E4\u05D8\u05D9\u05DE\u05D9\u05D6\u05E6\u05D9\u05D4 \u05DC\u05D4\u05E7\u05E9\u05E8 \u05D4\u05E9\u05D9\u05D7\u05D4\u2026",soundOff:"\u05D4\u05E9\u05EA\u05E7\u05EA \u05D4\u05E6\u05DC\u05D9\u05DC",soundOn:"\u05D4\u05E4\u05E2\u05DC\u05EA \u05D4\u05E6\u05DC\u05D9\u05DC",startNewConversation:"\u05D4\u05EA\u05D7\u05DC\u05EA \u05E6\u05F3\u05D0\u05D8 \u05D7\u05D3\u05E9",talkToOperator:"\u05D3\u05D1\u05E8 \u05E2\u05DD \u05E0\u05E6\u05D9\u05D2",connectingOperator:"\u05DE\u05D7\u05D1\u05E8 \u05D0\u05D5\u05EA\u05DA \u05DC\u05E0\u05E6\u05D9\u05D2\u2026",noOperatorAvailable:"\u05D0\u05D9\u05DF \u05E0\u05E6\u05D9\u05D2\u05D9\u05DD \u05D6\u05DE\u05D9\u05E0\u05D9\u05DD \u05DB\u05E2\u05EA \u2014 \u05D4\u05E9\u05D0\u05E8 \u05D0\u05EA \u05D4\u05E4\u05E8\u05D8\u05D9\u05DD \u05E9\u05DC\u05DA \u05D5\u05E0\u05D7\u05D6\u05D5\u05E8 \u05D0\u05DC\u05D9\u05DA.",chattingWithOperator:"\u05D0\u05EA\u05D4 \u05DE\u05E6\u05F3\u05D5\u05D8\u05D8 \u05E2\u05DD {operator}",cancelOperatorRequest:"\u05D4\u05DE\u05E9\u05DA \u05DC\u05E9\u05D5\u05D7\u05D7 \u05E2\u05DD \u05D4-AI",stop:"\u05E2\u05E6\u05D9\u05E8\u05D4",theme:"\u05E2\u05E8\u05DB\u05EA \u05E0\u05D5\u05E9\u05D0",themeAuto:"\u05D0\u05D5\u05D8\u05D5\u05DE\u05D8\u05D9",themeDark:"\u05DB\u05D4\u05D4",themeLight:"\u05D1\u05D4\u05D9\u05E8",textSize:"\u05D2\u05D5\u05D3\u05DC \u05D8\u05E7\u05E1\u05D8",textSizeSmall:"\u05E7\u05D8\u05DF",textSizeNormal:"\u05E8\u05D2\u05D9\u05DC",textSizeLarge:"\u05D2\u05D3\u05D5\u05DC",loading:"\u05D8\u05D5\u05E2\u05DF\u2026",thinking:"\u05D7\u05D5\u05E9\u05D1\u2026",thoughts:"\u05DE\u05D7\u05E9\u05D1\u05D5\u05EA",toolResult:"\u05EA\u05D5\u05E6\u05D0\u05D4",sources:"\u05DE\u05E7\u05D5\u05E8\u05D5\u05EA",feedbackUp:"\u05EA\u05E9\u05D5\u05D1\u05D4 \u05D8\u05D5\u05D1\u05D4",feedbackDown:"\u05EA\u05E9\u05D5\u05D1\u05D4 \u05D2\u05E8\u05D5\u05E2\u05D4",feedbackThanks:"\u05EA\u05D5\u05D3\u05D4 \u05E2\u05DC \u05D4\u05DE\u05E9\u05D5\u05D1",copy:"\u05D4\u05E2\u05EA\u05E7",copied:"\u05D4\u05D5\u05E2\u05EA\u05E7",tabHome:"\u05D1\u05D9\u05EA",tabConversations:"\u05E6\u05F3\u05D0\u05D8\u05D9\u05DD",tabHelp:"\u05E2\u05D6\u05E8\u05D4",tabNews:"\u05D7\u05D3\u05E9\u05D5\u05EA",modulesEmpty:"\u05D0\u05D9\u05DF \u05DB\u05D0\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05DB\u05DC\u05D5\u05DD",moduleBack:"\u05D7\u05D6\u05E8\u05D4",contentLoading:"\u05D8\u05D5\u05E2\u05DF\u2026",homeGreeting:"\u05DB\u05D9\u05E6\u05D3 \u05E0\u05D5\u05DB\u05DC \u05DC\u05E2\u05D6\u05D5\u05E8?",homeGreetingNamed:"\u05E9\u05DC\u05D5\u05DD {name} \u{1F44B}",homeGreetingLead:"\u05DB\u05D9\u05E6\u05D3 \u05E0\u05D5\u05DB\u05DC \u05DC\u05E2\u05D6\u05D5\u05E8?",homeSearchPlaceholder:"\u05D7\u05D9\u05E4\u05D5\u05E9 \u05E2\u05D6\u05E8\u05D4",homeContentTitle:"\u05DE\u05D0\u05DE\u05E8\u05D9\u05DD \u05E4\u05D5\u05E4\u05D5\u05DC\u05E8\u05D9\u05D9\u05DD",homeStatus:"\u05E1\u05D8\u05D8\u05D5\u05E1",helpTitle:"\u05E2\u05D6\u05E8\u05D4",helpSearchPlaceholder:"\u05D7\u05D9\u05E4\u05D5\u05E9 \u05E2\u05D6\u05E8\u05D4",helpEmpty:"\u05D0\u05D9\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05DE\u05D0\u05DE\u05E8\u05D9 \u05E2\u05D6\u05E8\u05D4",helpLoading:"\u05D8\u05D5\u05E2\u05DF \u05E2\u05D6\u05E8\u05D4\u2026",helpSearchEmpty:"\u05DC\u05D0 \u05E0\u05DE\u05E6\u05D0\u05D5 \u05EA\u05D5\u05E6\u05D0\u05D5\u05EA",newsTitle:"\u05D7\u05D3\u05E9\u05D5\u05EA",newsEmpty:"\u05D0\u05D9\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05D7\u05D3\u05E9\u05D5\u05EA",newsLoading:"\u05D8\u05D5\u05E2\u05DF \u05D7\u05D3\u05E9\u05D5\u05EA\u2026",newsBack:"\u05D7\u05D6\u05E8\u05D4 \u05DC\u05D7\u05D3\u05E9\u05D5\u05EA",newsPublishedAt:"\u05E4\u05D5\u05E8\u05E1\u05DD \u05D1-{date}",formSubmit:"\u05E9\u05DC\u05D9\u05D7\u05D4",formSkip:"\u05D0\u05D7\u05E8 \u05DB\u05DA",formSubmitted:"\u05E0\u05E9\u05DC\u05D7",formSkipped:"\u05D3\u05D5\u05DC\u05D2",formFillOut:"\u05DE\u05D9\u05DC\u05D5\u05D9",formRequired:"\u05E9\u05D3\u05D4 \u05D7\u05D5\u05D1\u05D4",formInvalidEmail:"\u05D4\u05D6\u05DF \u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC \u05EA\u05E7\u05D9\u05E0\u05D4",formInvalidTel:"\u05D4\u05D6\u05DF \u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF \u05EA\u05E7\u05D9\u05DF",formInvalidUrl:"\u05D4\u05D6\u05DF \u05DB\u05EA\u05D5\u05D1\u05EA URL \u05EA\u05E7\u05D9\u05E0\u05D4",formInvalidNumber:"\u05D4\u05D6\u05DF \u05DE\u05E1\u05E4\u05E8 \u05EA\u05E7\u05D9\u05DF",formTooShort:"\u05E7\u05E6\u05E8 \u05DE\u05D3\u05D9 (\u05DC\u05E4\u05D7\u05D5\u05EA {min} \u05EA\u05D5\u05D5\u05D9\u05DD)",formTooLong:"\u05D0\u05E8\u05D5\u05DA \u05DE\u05D3\u05D9 (\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8 {max} \u05EA\u05D5\u05D5\u05D9\u05DD)",formNumberTooSmall:"\u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DC\u05E4\u05D7\u05D5\u05EA {min}",formNumberTooLarge:"\u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8 {max}",formPatternMismatch:"\u05D4\u05EA\u05D0\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA \u05D4\u05E0\u05D3\u05E8\u05E9\u05EA",formChooseAtLeast:"\u05D1\u05D7\u05E8 \u05DC\u05E4\u05D7\u05D5\u05EA {min}",formChooseAtMost:"\u05D1\u05D7\u05E8 \u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8 {max}",formOther:"\u05D0\u05D7\u05E8",formOtherPlaceholder:"\u05DB\u05EA\u05D5\u05D1 \u05D0\u05EA \u05EA\u05E9\u05D5\u05D1\u05EA\u05DA\u2026",inputRequired:"\u05E9\u05D0\u05DC\u05D5\u05EA \u05E2\u05D1\u05D5\u05E8\u05DA",inputBadge:"\u05E9\u05D0\u05DC\u05D5\u05EA",inputAnswered:"\u05E0\u05E2\u05E0\u05D4",inputSkipped:"\u05D3\u05D5\u05DC\u05D2",showOptions:"\u05D4\u05E6\u05D2 \u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA",hideOptions:"\u05D4\u05E1\u05EA\u05E8 \u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA",qtypeText:"\u05D4\u05EA\u05E9\u05D5\u05D1\u05D4 \u05E9\u05DC\u05DA",qtypeEmail:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",qtypePhone:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF",qtypeNumber:"\u05DE\u05E1\u05E4\u05E8",qtypeDate:"\u05EA\u05D0\u05E8\u05D9\u05DA",qtypeChooseOne:"\u05D1\u05D7\u05E8 \u05D0\u05D7\u05EA",qtypeChooseAny:"\u05D1\u05D7\u05E8 \u05DB\u05DE\u05D4",qtypeBoolean:"\u05DB\u05DF / \u05DC\u05D0",inputSubmit:"\u05E9\u05DC\u05D9\u05D7\u05EA \u05EA\u05E9\u05D5\u05D1\u05D5\u05EA",inputSubmitHint:"Enter \u05DC\u05E9\u05DC\u05D9\u05D7\u05D4 \xB7 Shift+Enter = \u05E9\u05D5\u05E8\u05D4 \u05D7\u05D3\u05E9\u05D4",inputSkip:"\u05D3\u05D9\u05DC\u05D5\u05D2",confirmYes:"\u05DB\u05DF",confirmNo:"\u05DC\u05D0",approve:"\u05D0\u05D9\u05E9\u05D5\u05E8",reject:"\u05D3\u05D7\u05D9\u05D9\u05D4",approvalPrompt:"\u05D4\u05DB\u05DC\u05D9 {tool} \u05D3\u05D5\u05E8\u05E9 \u05D0\u05EA \u05D0\u05D9\u05E9\u05D5\u05E8\u05DA \u05DB\u05D3\u05D9 \u05DC\u05E4\u05E2\u05D5\u05DC.",approvalBody:"\u05D1\u05D3\u05D5\u05E7 \u05D0\u05EA \u05E4\u05E8\u05DE\u05D8\u05E8\u05D9 \u05D4\u05DB\u05DC\u05D9 \u05E9\u05DC\u05DE\u05E2\u05DC\u05D4 \u05D5\u05D4\u05D7\u05DC\u05D8 \u05D0\u05DD \u05DC\u05D0\u05E9\u05E8 \u05E4\u05E2\u05D5\u05DC\u05D4 \u05D6\u05D5.",approvalYourResponse:"\u05D4\u05EA\u05D2\u05D5\u05D1\u05D4 \u05E9\u05DC\u05DA: {decision}",approvalEditHint:"\u05E0\u05D9\u05EA\u05DF \u05DC\u05E2\u05E8\u05D5\u05DA \u05D0\u05EA \u05EA\u05D2\u05D5\u05D1\u05EA\u05DA \u05E2\u05D3 \u05E9\u05D4\u05E9\u05DC\u05D1 \u05D4\u05D6\u05D4 \u05D9\u05EA\u05D7\u05D3\u05E9.",approvalSubmitting:"\u05D4\u05EA\u05D2\u05D5\u05D1\u05D4 \u05E0\u05E9\u05DC\u05D7\u05D4. \u05DE\u05D1\u05E6\u05E2\u2026",edit:"\u05E2\u05E8\u05D9\u05DB\u05D4",toolParameters:"\u05E4\u05E8\u05DE\u05D8\u05E8\u05D9\u05DD",statusAwaiting:"\u05DE\u05DE\u05EA\u05D9\u05DF \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8",statusResponded:"\u05E0\u05E9\u05DC\u05D7",statusRunning:"\u05E4\u05D5\u05E2\u05DC",statusCompleted:"\u05D4\u05D5\u05E9\u05DC\u05DD",statusDenied:"\u05E0\u05D3\u05D7\u05D4",statusError:"\u05E9\u05D2\u05D9\u05D0\u05D4",statusSuperseded:"\u05D3\u05D5\u05DC\u05D2"},m_={en:ns,fr:u_,ar:__,es:p_,he:f_};function Do(e,t){let n=os(e),o=$o(t),r=n==="en"?{}:m_[n]??{},a=o?t[n]??{}:t??{},s=o?t.en??{}:{};return{...ns,...r,...s,...a}}function os(e){return(e.split("-")[0]??"en").toLowerCase()}var g_=new Set(["ar","he","iw","fa","ur","ps","sd","ug","yi","dv","ckb","ks","nqo","prs","syr"]);function rs(e){return g_.has(os(e))}function rt(e,t){return e[t]??t}function $o(e){if(!e)return!1;for(let t of Object.values(e))if(t&&typeof t=="object")return!0;return!1}function as(e,t){if(!(!e?.length||!t))return e.find(n=>n.locale===t)}function is(e,t){let{translations:n,defaultLocale:o,...r}=e,a=as(n,t);return a?{...r,title:a.title??r.title,description:a.description??r.description,content:a.content??r.content}:r}function ss(e,t){let{translations:n,defaultLocale:o,...r}=e,a=as(n,t);if(!a)return r;let s=new Map((a.fields??[]).map(c=>[c.name,c])),l=r.fields.map(c=>{let d=s.get(c.name);if(!d)return c;let _=new Map((d.options??[]).map(p=>[p.value,p]));return{...c,label:d.label??c.label,placeholder:d.placeholder??c.placeholder,validationHint:d.validationHint??c.validationHint,options:c.options?.map(p=>{let u=_.get(p.value);return u?{...p,label:u.label??p.label,description:u.description??p.description}:p})}});return{...r,title:a.title??r.title,description:a.description??r.description,submitLabel:a.submitLabel??r.submitLabel,fields:l}}var ma=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{}}},Fo=new ma;var ha=["off","error","warn","info","debug","trace"],ba=T.cssPrefix,ls=`${ba}.debug`,v_=`__${T.global}_DEBUG__`,h_=`${ba}-debug`,Bo=2,ga=null;function b_(){if(typeof window>"u")return 2;try{let e=new URLSearchParams(window.location.search).get(h_);if(e!==null){let t=va(e);if(t>=0)return t}}catch{}try{let e=window.localStorage?.getItem(ls);if(e){let t=va(e);if(t>=0)return t}}catch{}return Reflect.get(window,v_)?4:2}function va(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=ha.findIndex(n=>n===e);if(t>=0)return t}return-1}function Ho(e){let t=va(e);if(!(t<0)){Bo=t;try{window.localStorage?.setItem(ls,ha[t]??"off")}catch{}}}function ya(){return ha[Bo]??"warn"}Bo=b_();function cs(e){let t=`[${ba}:${e}]`,n=(o,r,a)=>(s,l)=>{if(!(Bo<o)&&(l===void 0?console[r](t,s):console[r](t,s,l),ga))try{ga({level:a,scope:e,message:s,payload:l})}catch{}};return{error:n(1,"error","error"),warn:n(2,"warn","warn"),info:n(3,"info","info"),debug:n(4,"debug","debug"),trace:n(5,"debug","trace"),scope:o=>cs(`${e}:${o}`)}}var te=cs("core");function ds(e){ga=e}var Jt=te.scope("context"),y_=new Set(["visitorId","conversationId","conversationId","jwt","token","authorization","password"]),us=50,Pa=1024,P_=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function xa(e){return _s(e,"userContext",!0)}function Sa(e){return _s(e,"pageContext",!1)}function _s(e,t,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){Jt.warn(`ignored ${t} \u2014 expected an object`,{type:Array.isArray(e)?"array":typeof e});return}let o={},r=0;for(let[a,s]of Object.entries(e)){if(y_.has(a)){Jt.warn(`dropped reserved ${t} key "${a}" \u2014 managed by the widget, not host-settable`);continue}if(s==null)continue;if(r>=us){Jt.warn(`${t} truncated at ${us} keys \u2014 dropped "${a}"`);continue}let l=x_(t,a,s);l!==void 0&&(o[a]=l,r++)}return n&&typeof o.email=="string"&&!P_.test(o.email)&&(Jt.warn(`dropped malformed ${t}.email "${o.email}"`),delete o.email),Object.keys(o).length>0?o:void 0}function x_(e,t,n){if(typeof n=="boolean")return n;if(typeof n=="number"){if(!Number.isFinite(n)){Jt.warn(`dropped non-finite ${e}.${t}`);return}return n}if(typeof n=="string"){let o=n.trim();return o===""?void 0:o.length>Pa?(Jt.warn(`truncated ${e}.${t} to ${Pa} chars`),o.slice(0,Pa)):o}Jt.warn(`dropped ${e}.${t} \u2014 only string/number/boolean values are allowed`,{type:typeof n})}var Uo={maxBytes:10485760,maxCount:10,accept:"*/*"},ps={voice:"local"},fs={list:[],byTrigger:{}},ka={enabled:!0,sampleRate:1},zo={upload:"/pai/upload-file",transcribe:"/pai/transcribe-audio",submitForm:"/pai/submit-form"},hn={variant:"circle",size:"md",label:void 0,icon:"chat",hidden:!1},ms={floating:["theme","textSize","history","close","clear","expand","fullscreen","popOut","sound","language"],inline:["theme","textSize","history","close","clear","fullscreen","popOut","sound","language"],standalone:["theme","textSize","history","clear","sound","language"],page:["theme","textSize","history","clear","sound","language"],modal:["theme","textSize","history","close","clear","fullscreen","popOut","sound","language"],drawer:["theme","textSize","history","close","clear","fullscreen","popOut","sound","language"]},wa={enabled:!0,volume:.3,events:void 0},gs={enabled:!0,events:void 0},vs=[{label:"tabConversations",layout:"chat"}];function bn(e){let t=e!==null&&typeof e=="object"?e:{},n=t.presentation??{},o=t.behavior??{},r=t.i18n??{},a=t.feedback??{},s=t.footer??{},l=t.header??{},{themeMode:c,themeOverrides:d}=S_(t.theme),_=n.mode??"floating",p=k_(r.defaultLocale),u=r.availableLocales??[r.locale??p],m=yn(r.locale??p,u,p),g=(t.baseUrl??T.defaultBaseUrl).replace(/\/$/,""),y=(t.agentApiBaseUrl??`${g}/api/agent`).replace(/\/$/,""),S=(t.dataApiBaseUrl??`${g}/api/data`).replace(/\/$/,"");return{widgetId:t.widgetId??"default",publicKey:t.publicKey,aiAgentDeploymentId:t.aiAgentDeploymentId,baseUrl:g,agentApiBaseUrl:y,dataApiBaseUrl:S,userContext:xa(t.userContext),pageContext:Sa(t.pageContext),position:n.position??"bottom-right",themeMode:c,textSize:"normal",themeOverrides:d,mode:_,iframe:n.iframe??!1,responseMode:o.responseMode??"streaming",showReasoning:o.showReasoning??!1,showToolCalls:o.showToolCalls??!1,showSources:o.showSources??!1,enableMessageFeedback:!(o.disableMessageFeedback??!1),autoSendSuggestions:o.autoSendSuggestions??!1,popOutUrl:o.popOutUrl,features:{voice:t.features?.voice??ps.voice,fileUpload:!(t.features?.disableFileUpload??!1),humanInLoop:!(t.features?.disableHumanInLoop??!1),operatorRequest:t.features?.enableOperatorRequest===!0},forms:Gn(t.forms,m),endpoints:{upload:t.endpoints?.upload??zo.upload,transcribe:t.endpoints?.transcribe??zo.transcribe,submitForm:t.endpoints?.submitForm??zo.submitForm},attachments:{accept:t.composer?.attachments?.accept??Uo.accept,maxBytes:t.composer?.attachments?.maxBytes??Uo.maxBytes,maxCount:t.composer?.attachments?.maxCount??Uo.maxCount},locale:m,defaultLocale:p,availableLocales:u,startMinimized:o.startMinimized??!0,actions:w_(_,l.actions),size:n.size??{},launcher:L_(t.launcher),sound:C_(a.sound),haptics:R_(a.haptics),strings:Do(m,r.strings),stringsOverride:r.strings,composerDisclaimer:s.composerDisclaimer??"",poweredBy:I_(s.poweredBy),composer:E_(t.composer),modules:A_(t.modules),tracking:T_(t.tracking,S),storage:t.storage??Fo,onMessage:t.onMessage,onOpen:t.onOpen,onClose:t.onClose,onError:t.onError}}function S_(e){return typeof e=="string"?{themeMode:e,themeOverrides:{}}:e&&typeof e=="object"?{themeMode:"auto",themeOverrides:e}:{themeMode:"auto",themeOverrides:{}}}function k_(e){return e&&e!=="auto"?e:typeof navigator<"u"&&navigator.language?navigator.language:"en"}function yn(e,t,n){return t.length<=1||t.includes(e)?e:t.includes(n)?n:t[0]??e}function w_(e,t){return t??ms[e]}function C_(e){return{enabled:e?.enabled??wa.enabled,volume:e?.volume??wa.volume,events:e?.events}}function R_(e){return{enabled:e?.enabled??gs.enabled,events:e?.events}}function T_(e,t){let n=e?.sampleRate??ka.sampleRate;return{enabled:e?.enabled??ka.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 I_(e){let n={...{text:`Powered by ${T.displayName}`,href:T.siteUrl},...e};return!!(n.text||n.logoUrl)?n:null}function E_(e){let t=e?.sendButton;return{sendButton:{shape:t?.shape??"circle",icon:t?.icon??"arrowUp",variant:t?.variant??"filled"}}}function A_(e){let t=e===void 0?vs:e,n=new Set,o=[];for(let a of t.slice(0,4)){if(!a?.label||!a?.layout)continue;let s=a.contentTags?.filter(Boolean),l=a.id??s?.[0]??a.layout;for(;n.has(l);)l=`${l}-${o.length}`;n.add(l);let c={id:l,label:a.label,layout:a.layout};s&&s.length>0&&(c.contentTags=s),a.layout==="home"&&(c.brandName=a.brandName,c.greetingText=a.greetingText,c.showGreeting=!(a.hideGreeting??!1),c.showSearchBar=!(a.hideSearchBar??!1),c.showRecentConversations=!(a.hideRecentConversations??!1),a.userAvatars&&a.userAvatars.length>0&&(c.userAvatars=a.userAvatars),a.status&&(c.status=a.status),c.contentBlockTitle=a.contentBlockTitle),o.push(c)}let r=Object.fromEntries(o.map(a=>[a.id,a]));return{list:o,byId:r}}function Gn(e,t){var a;if(!e?.length)return fs;let n=[],o=new Set;for(let s of e){if(!s?.id||o.has(s.id))continue;let l=ss(s,t),c=(l.fields??[]).filter(_=>!!(_&&_.name&&_.label&&_.type)),d=(Array.isArray(l.on)?l.on:[l.on]).map(M_).filter(_=>_!==null);c.length===0||d.length===0||(o.add(l.id),n.push({id:l.id,triggers:d,when:l.when,fields:c,title:l.title,description:l.description,submitLabel:l.submitLabel,skippable:l.skippable??!1,frequency:l.frequency??"once",mirrorToContext:l.mirrorToContext??!0,reopenable:l.reopenable??!0,reviewable:l.reviewable??!0}))}let r={};for(let s of n)for(let l of s.triggers)(r[a=l.kind]??(r[a]=[])).push(s);return{list:n,byTrigger:r}}function M_(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 L_(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??hn.variant,size:e?.size??hn.size,label:e?.label??hn.label,icon:e?.icon??hn.icon,hidden:e?.hidden??hn.hidden,callout:t}}function Ca(e,t,n,o){let r=yn(t,e.availableLocales,e.defaultLocale);if(r===e.locale&&n===e.themeMode&&o===e.textSize)return e;let a={...e};return r!==e.locale&&(a.locale=r,a.strings=Do(r,e.stringsOverride)),n!==e.themeMode&&(a.themeMode=n),o!==e.textSize&&(a.textSize=o),a}var O_=["presentation","behavior","theme","launcher","header","composer","feedback","i18n","footer","features","tracking","endpoints"];function Ra(e,t){if(!t)return e;let n={...e};for(let a of O_){let s=t[a];if(s===void 0)continue;let l=e[a];if(a==="theme"){l===void 0&&(n[a]=s);continue}a!=="i18n"&&(n[a]=hs(s,l))}t.modules!==void 0&&e.modules===void 0&&(n.modules=t.modules),t.dataApiBaseUrl!==void 0&&e.dataApiBaseUrl===void 0&&(n.dataApiBaseUrl=t.dataApiBaseUrl);let o=e.i18n,r=t.i18n;if(o||r){let a=hs(r??{},o);r?.availableLocales!==void 0&&(a.availableLocales=r.availableLocales),r?.defaultLocale!==void 0&&(a.defaultLocale=r.defaultLocale);let s=o?.strings,l=r?.strings;(s||l)&&(a.strings=N_(l,s)),n.i18n=a}return n}function hs(e,t){if(!t)return e;let n={...e};for(let[o,r]of Object.entries(t))r!==void 0&&(n[o]=r);return n}function N_(e,t){if(!e)return t;if(!t)return e;let n=$o(e),o=$o(t);if(!n&&!o)return{...e,...t};let r={},a=n?e:{en:e},s=o?t:{en:t};for(let[l,c]of Object.entries(a))r[l]={...c};for(let[l,c]of Object.entries(s))r[l]={...r[l],...c};return r}var D_=["clear","expand","fullscreen","popOut","sound","history","language","theme","textSize","close"],At=e=>e!=="false";var $_=[["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]],F_=[["mode","mode",e=>e],["position","position",e=>e],["iframe","iframe",At]],B_=[["width","width"],["height","height"]],H_=[["response-mode","responseMode",e=>e],["start-minimized","startMinimized",At],["show-reasoning","showReasoning",At],["show-tool-calls","showToolCalls",At],["show-sources","showSources",At],["disable-message-feedback","disableMessageFeedback",At],["auto-send-suggestions","autoSendSuggestions",At],["pop-out-url","popOutUrl"]],U_=[["locale","locale"]],Dv=new Set(D_);var z_=[["launcher-variant","variant",e=>e],["launcher-size","size",e=>e],["launcher-icon","icon"],["launcher-hidden","hidden",At]],q_=[["features-disable-file-upload","disableFileUpload",At],["features-voice","voice",e=>e]],V_=[["endpoint-upload","upload"],["endpoint-transcribe","transcribe"]],W_=[["user-id","id"],["user-email","email"],["user-name","name"]],K_=[["page-area","area"],["page-url","url"],["page-path","path"],["page-title","title"]],G_=["launcher-label","callout-text","callout-delay","actions","user-context","page-context"],j_=[$_,F_,B_,H_,U_,z_,q_,V_,W_,K_],Q_=new Set(["iframe","start-minimized"]),X_=[...j_.flatMap(e=>e.map(([t])=>t).filter(t=>!Q_.has(t))),...G_];function bs(e){return`${T.cssPrefix}:${e}`}function jn(e,t,n){e.dispatchEvent(new CustomEvent(bs(t),{detail:n}))}function ys(e,t){let o=Object.entries(t).map(([r,a])=>{let s=bs(r),l=c=>a(c.detail);return e.addEventListener(s,l),[s,l]});return()=>{for(let[r,a]of o)e.removeEventListener(r,a)}}function ct(){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,Y_(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 Y_(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 Wt=te.scope("persistence");function Pn(e,t=Fo,n){let o=n?`${e}.${n}`:e,r=`${T.cssPrefix}.storageVersion`,a=t.get(r)??void 0,s=a?`.v${a}`:"",l=`${T.cssPrefix}.${o}${s}`,c=`${T.cssPrefix}${s}.visitorId`,d=`${l}.conversationId`,_=`${l}.userPrefs`,p=`${l}.panelOpen`,u=`${l}.panelSize`,m=`${l}.calloutDismissed`,g=`${l}.sidebarCollapsed`,y=`${l}.activeModule`,S=`${l}.historyCount`,k=`${l}.formsDone`,x={getVisitorId(){let h=t.get(c);if(h)return h;let P=ct();return t.set(c,P),P},loadConversationId(){return t.get(d)??void 0},saveConversationId(h){Wt.trace("saveConversationId",{id:h,scope:o}),h?t.set(d,h):t.remove(d)},loadDraft(h){return t.get(`${l}.draft.${h}`)??""},saveDraft(h,P){let b=`${l}.draft.${h}`;P?t.set(b,P):t.remove(b)},loadMessageQueue(h){let P=t.get(`${l}.messageQueue.${h}`);if(!P)return[];try{let b=JSON.parse(P);return!Array.isArray(b)||!b.every(J_)?[]:b}catch(b){return Wt.warn("loadMessageQueue parse failed",{error:b}),[]}},saveMessageQueue(h,P){let b=`${l}.messageQueue.${h}`;if(P.length===0){t.remove(b);return}try{t.set(b,JSON.stringify(P))}catch(w){Wt.warn("saveMessageQueue serialise failed",{error:w})}},loadUserPrefs(){let h=t.get(_);if(!h)return{};try{return Ta(JSON.parse(h))}catch(P){return Wt.warn("loadUserPrefs parse failed",{error:P}),{}}},saveUserPrefs(h){try{t.set(_,JSON.stringify(h))}catch(P){Wt.warn("saveUserPrefs serialise failed",{error:P})}},patchUserPrefs(h){let P=x.loadUserPrefs();x.saveUserPrefs({...P,...h})},loadPanelOpen(){let h=t.get(p);return h==="1"?!0:h==="0"?!1:null},savePanelOpen(h){t.set(p,h?"1":"0")},loadPanelSize(){let h=t.get(u);return h==="normal"||h==="expanded"||h==="fullscreen"?h:null},savePanelSize(h){t.set(u,h)},loadCalloutDismissed(h){if(!h)return!1;let P=t.get(m);return!!P&&P===h},saveCalloutDismissed(h){h?t.set(m,h):t.remove(m)},loadSidebarCollapsed(){let h=t.get(g);return h==="1"?!0:h==="0"?!1:null},saveSidebarCollapsed(h){t.set(g,h?"1":"0")},loadActiveModule(){return t.get(y)||null},saveActiveModule(h){t.set(y,h)},loadHistoryCount(){let h=t.get(S);if(!h)return null;let P=Number.parseInt(h,10);return Number.isFinite(P)&&P>=0?P:null},saveHistoryCount(h){t.set(S,String(h))},loadFormsDone(){let h=t.get(k);if(!h)return{};try{let P=JSON.parse(h);return qo(P)?Object.fromEntries(Object.entries(P).filter(b=>typeof b[1]=="number")):{}}catch(P){return Wt.warn("loadFormsDone parse failed",{error:P}),{}}},saveFormDone(h){try{let P=x.loadFormsDone();P[h]=Date.now(),t.set(k,JSON.stringify(P))}catch(P){Wt.warn("saveFormDone serialise failed",{error:P})}},rememberStorageVersion(h){h&&h!==t.get(r)&&(Wt.debug("rememberStorageVersion (force-reset on next load)",{version:h}),t.set(r,h))},clearConversation(){t.remove(d)}};return x}function qo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function J_(e){return qo(e)&&typeof e.id=="string"&&e.id.length>0&&typeof e.text=="string"}function Ta(e){if(!qo(e))return{};let t={};return typeof e.locale=="string"&&(t.locale=e.locale),typeof e.soundMuted=="boolean"&&(t.soundMuted=e.soundMuted),(e.themeMode==="auto"||e.themeMode==="light"||e.themeMode==="dark")&&(t.themeMode=e.themeMode),(e.textSize==="small"||e.textSize==="normal"||e.textSize==="large")&&(t.textSize=e.textSize),qo(e.widgetSize)&&typeof e.widgetSize.width=="number"&&typeof e.widgetSize.height=="number"&&(t.widgetSize={width:e.widgetSize.width,height:e.widgetSize.height}),t}var Ps=`:host{--__P__-accent-user: __BRAND_ACCENT__;--__P__-accent: var(--__P__-accent-user);--__P__-accent-text-user: __BRAND_ACCENT_TEXT__;--__P__-accent-text: var(--__P__-accent-text-user);--__P__-accent-fg: var(--__P__-accent);--__P__-radius: __BRAND_RADIUS__;--__P__-radius-sm: 8px;--__P__-radius-md: 10px;--__P__-radius-lg: 16px;--__P__-font: __BRAND_FONT__;--__P__-font-display: var(--__P__-font);--__P__-font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;--__P__-bg: oklch(1 0 0);--__P__-bg-elevated: oklch(.9789 .0029 278.3);--__P__-surface: var(--__P__-bg-elevated);--__P__-muted: var(--__P__-fg-muted);--__P__-hover: oklch(.1686 .011 278.3 / .06);--__P__-fg: oklch(.1686 .011 278.3);--__P__-fg-muted: oklch(.4932 .0301 278.3);--__P__-border: oklch(.9312 .0084 278.3);--__P__-border-strong: oklch(.8757 .0131 278.3);--__P__-bubble-user: var(--__P__-accent);--__P__-bubble-user-text: var(--__P__-accent-text);--__P__-bubble-assistant: oklch(.9638 .0058 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-on-accent: var(--__P__-accent-text);--__P__-success: oklch(.6456 .1654 151.53);--__P__-warning: oklch(.7135 .1494 74.05);--__P__-danger: oklch(.5966 .1818 24.51);--__P__-danger-text: oklch(.5054 .1905 27.52);--__P__-danger-bg: oklch(.5966 .1818 24.51 / .1);--__P__-neutral: oklch(.7137 .0192 278.3);--__P__-pill-l-min: .3;--__P__-pill-l-max: .46;--__P__-focus: var(--__P__-accent);--__P__-shadow-panel: 0 8px 24px -8px rgba(13, 15, 20, .18), 0 24px 64px -24px rgba(13, 15, 20, .24);--__P__-shadow-card: 0 1px 2px rgba(13, 15, 20, .06), 0 4px 12px -6px rgba(13, 15, 20, .12);--__P__-backdrop: oklch(.1686 .011 278.3 / .55);--__P__-shadow-fab: 0 6px 16px -4px color-mix(in oklch, var(--__P__-accent) 45%, transparent), 0 12px 32px -12px rgba(13, 15, 20, .25);--__P__-z-fab: 2147483600;--__P__-z-panel: 2147483601;--__P__-panel-w: 380px;--__P__-panel-h: 600px;--__P__-fab-size: 56px;--__P__-conversation-max: 768px;--__P__-space-1: 4px;--__P__-space-2: 8px;--__P__-space-3: 12px;--__P__-space-4: 16px;--__P__-space-5: 20px;--__P__-space-6: 24px;--__P__-space-8: 32px;--__P__-text-scale: 1;--__P__-text-xs: calc(12px * var(--__P__-text-scale));--__P__-text-sm: calc(13px * var(--__P__-text-scale));--__P__-text-base: calc(15px * var(--__P__-text-scale));--__P__-text-md: calc(16px * var(--__P__-text-scale));--__P__-text-lg: calc(18px * var(--__P__-text-scale));--__P__-text-xl: calc(22px * var(--__P__-text-scale));--__P__-text-2xl: calc(30px * var(--__P__-text-scale))}:host([data-mode="modal"]),:host([data-mode="drawer"]){--__P__-conversation-max: 100%}:host([data-text-size="small"]){--__P__-text-scale: .9}:host([data-text-size="large"]){--__P__-text-scale: 1.15}:host{--__P__-ease: cubic-bezier(.2, .7, .2, 1);--__P__-ease-out: cubic-bezier(.2, .7, .2, 1);--__P__-ease-in: cubic-bezier(.4, 0, 1, 1);--__P__-ease-in-out: cubic-bezier(.65, 0, .35, 1);--__P__-dur-quick: .12s;--__P__-dur-base: .22s;--__P__-dur-slow: .32s;font-family:var(--__P__-font);color:var(--__P__-fg);color-scheme:light;--__P__-color-scheme: light}:host([data-theme="dark"]){--__P__-bg: oklch(.1783 .0128 278.3);--__P__-bg-elevated: oklch(.2232 .0182 278.3);--__P__-fg: oklch(.9368 .01 278.3);--__P__-fg-muted: oklch(.7048 .0296 278.3);--__P__-border: oklch(.2752 .0266 278.3);--__P__-border-strong: oklch(.335 .0291 278.3);--__P__-hover: oklch(.9368 .01 278.3 / .08);--__P__-bubble-assistant: oklch(.2474 .0311 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-danger-text: oklch(.8077 .1035 19.57);--__P__-danger-bg: oklch(.5966 .1818 24.51 / .18);--__P__-shadow-panel: 0 8px 24px -8px rgba(0, 0, 0, .6), 0 24px 64px -24px rgba(0, 0, 0, .7);--__P__-shadow-card: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 12px -6px rgba(0, 0, 0, .5);--__P__-backdrop: rgba(0, 0, 0, .65);--__P__-pill-l-min: .75;--__P__-pill-l-max: .92;color-scheme:dark;--__P__-color-scheme: dark}@media(prefers-color-scheme:dark){:host([data-theme="auto"]){--__P__-bg: oklch(.1783 .0128 278.3);--__P__-bg-elevated: oklch(.2232 .0182 278.3);--__P__-fg: oklch(.9368 .01 278.3);--__P__-fg-muted: oklch(.7048 .0296 278.3);--__P__-border: oklch(.2752 .0266 278.3);--__P__-border-strong: oklch(.335 .0291 278.3);--__P__-hover: oklch(.9368 .01 278.3 / .08);--__P__-bubble-assistant: oklch(.2474 .0311 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-pill-l-min: .75;--__P__-pill-l-max: .92;--__P__-shadow-panel: 0 8px 24px -8px rgba(0, 0, 0, .6), 0 24px 64px -24px rgba(0, 0, 0, .7);color-scheme:dark;--__P__-color-scheme: dark}}@supports (color: oklch(from red l c h)){:host{--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.3, l, .62) c h);--__P__-accent-text: oklch(from var(--__P__-accent) clamp(0, (l / .623 - 1) * -infinity, 1) 0 h);--__P__-accent-fg: oklch(from var(--__P__-accent-user) clamp(.3, l, .46) c h)}:host([data-theme="dark"]){--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.65, l, .85) c h);--__P__-accent-fg: var(--__P__-accent)}@media(prefers-color-scheme:dark){:host([data-theme="auto"]){--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.65, l, .85) c h);--__P__-accent-fg: var(--__P__-accent)}}}@media(prefers-reduced-motion:reduce){:host{--__P__-dur-quick: 1ms;--__P__-dur-base: 1ms;--__P__-dur-slow: 1ms}}
|
|
2
|
+
`;var xs=`*,*:before,*:after{box-sizing:border-box;margin:0;padding:0;border:0}button{font:inherit;color:inherit;background:none;cursor:pointer;-webkit-appearance:none;appearance:none;line-height:1}button:focus-visible,[tabindex]:focus-visible,textarea:focus-visible,input:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px}textarea,input{font:inherit;color:inherit;background:none;border:0;outline:0;resize:none}a{color:var(--__P__-accent-fg);text-decoration:underline;text-underline-offset:2px}img,svg{display:block;max-width:100%}ul,ol{list-style:none}.__P__-app{display:block;width:100%;height:100%;font-family:var(--__P__-font);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-feature-settings:"cv11","ss01","ss03"}.__P__-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
|
|
3
|
+
`;var Ss=`.__P__-anchor{color-scheme:var(--__P__-color-scheme, light);right:16px;bottom:16px}.__P__-surface{display:contents}.__P__-surface[hidden]{display:none}:host([data-position="bottom-left"]) .__P__-anchor,:host([data-position="top-left"]) .__P__-anchor{right:auto;left:16px}:host([data-position="top-right"]) .__P__-anchor,:host([data-position="top-left"]) .__P__-anchor{bottom:auto;top:16px}.__P__-anchor{position:fixed;display:flex;flex-direction:column;align-items:flex-end;gap:var(--__P__-space-3);pointer-events:none}.__P__-anchor{--__P__-fab-size: 56px}.__P__-anchor[data-launcher-size=sm]{--__P__-fab-size: 44px}.__P__-anchor[data-launcher-size=md]{--__P__-fab-size: 56px}.__P__-anchor[data-launcher-size=lg]{--__P__-fab-size: 68px}.__P__-anchor>*{pointer-events:auto}.__P__-fab[data-size=sm]{--__P__-fab-size: 44px;font-size:var(--__P__-text-sm)}.__P__-fab[data-size=md]{--__P__-fab-size: 56px;font-size:calc(14px * var(--__P__-text-scale))}.__P__-fab[data-size=lg]{--__P__-fab-size: 68px;font-size:var(--__P__-text-base)}.__P__-fab{display:inline-flex;align-items:center;justify-content:center;gap:var(--__P__-space-2);color:var(--__P__-accent-text);background:var(--__P__-accent);box-shadow:var(--__P__-shadow-fab);font-weight:600;line-height:1;transform-origin:bottom right;animation:__P__-fab-in var(--__P__-dur-base) var(--__P__-ease) both;transition:transform var(--__P__-dur-base) var(--__P__-ease),opacity var(--__P__-dur-base) var(--__P__-ease),box-shadow var(--__P__-dur-base) var(--__P__-ease)}.__P__-fab:hover{transform:translateY(-2px)}.__P__-fab:active{transform:translateY(0)}.__P__-fab:focus-visible{outline:2px solid var(--__P__-on-accent);outline-offset:3px}.__P__-fab svg{width:24px;height:24px;flex-shrink:0}@keyframes __P__-fab-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:none}}.__P__-fab[data-leaving]{position:absolute;right:0;bottom:0;animation:__P__-fab-out var(--__P__-dur-quick) var(--__P__-ease) forwards;pointer-events:none}:host([data-position^="top-"]) .__P__-fab[data-leaving]{bottom:auto;top:0}:host([data-position$="-left"]) .__P__-fab[data-leaving]{right:auto;left:0}@keyframes __P__-fab-out{0%{opacity:1;transform:none}to{opacity:0;transform:scale(.85)}}.__P__-fab[data-variant=circle]{width:var(--__P__-fab-size);height:var(--__P__-fab-size);border-radius:999px}.__P__-fab[data-variant=circle] .__P__-fab-label{display:none}.__P__-fab[data-variant=pill]{height:var(--__P__-fab-size);padding:0 18px 0 16px;border-radius:999px}.__P__-fab[data-variant=bar]{height:var(--__P__-fab-size);padding:0 22px;border-radius:var(--__P__-radius)}.__P__-fab[data-variant=minimal]{height:var(--__P__-fab-size);padding:0 var(--__P__-space-4);border-radius:999px;background:transparent;color:var(--__P__-accent-fg);box-shadow:none;border:1px solid currentColor}.__P__-fab[data-variant=minimal]:hover{background:color-mix(in srgb,var(--__P__-accent) 12%,transparent)}.__P__-callout{--__P__-callout-fab-h: var(--__P__-fab-size, 56px);--__P__-callout-gap: clamp(12px, calc(var(--__P__-callout-fab-h) * .25), 22px);--__P__-callout-nudge-direction: -1;position:absolute;display:inline-flex;align-items:center;gap:var(--__P__-space-2);padding:10px 14px;background:var(--__P__-fg);color:var(--__P__-bg);border-radius:999px;font-size:var(--__P__-text-sm);font-weight:600;line-height:1.2;box-shadow:0 10px 30px -8px #00000059;pointer-events:auto;animation:__P__-callout-in var(--__P__-dur-slow) var(--__P__-ease);z-index:1;max-width:240px;white-space:nowrap}.__P__-callout[data-position=left]{right:calc(100% + var(--__P__-callout-gap));bottom:calc(var(--__P__-callout-fab-h) / 2);transform:translateY(50%)}.__P__-callout[data-position=right]{left:calc(100% + var(--__P__-callout-gap));bottom:calc(var(--__P__-callout-fab-h) / 2);transform:translateY(50%);--__P__-callout-nudge-direction: 1}.__P__-callout[data-position=top]{bottom:calc(100% + var(--__P__-callout-gap));right:0;max-width:min(280px,calc(100vw - 32px))}.__P__-callout[data-position=bottom]{top:calc(100% + var(--__P__-callout-gap));right:0;max-width:min(280px,calc(100vw - 32px))}:host([data-position$="-left"]) .__P__-callout[data-position=top],:host([data-position$="-left"]) .__P__-callout[data-position=bottom]{right:auto;left:0}.__P__-callout[data-shape=bubble]{border-radius:var(--__P__-radius-md);white-space:normal;width:max-content;max-width:min(280px,calc(100vw - 32px))}.__P__-callout[data-shape=callout]{padding:12px 18px;font-size:calc(14px * var(--__P__-text-scale));background:var(--__P__-accent);color:var(--__P__-accent-text)}.__P__-callout:after{content:"";position:absolute;width:12px;height:12px;background:inherit;border-radius:2px;transform:rotate(45deg)}.__P__-callout[data-position=left]:after{right:-5px;top:50%;margin-top:-6px}.__P__-callout[data-position=right]:after{left:-5px;top:50%;margin-top:-6px}.__P__-callout[data-position=top]:after{bottom:-5px;right:calc(var(--__P__-fab-size, 56px) / 2 - 6px)}.__P__-callout[data-position=bottom]:after{top:-5px;right:calc(var(--__P__-fab-size, 56px) / 2 - 6px)}:host([data-position$="-left"]) .__P__-callout[data-position=top]:after,:host([data-position$="-left"]) .__P__-callout[data-position=bottom]:after{right:auto;left:calc(var(--__P__-fab-size, 56px) / 2 - 6px)}.__P__-callout[data-animated]{animation:__P__-callout-in var(--__P__-dur-slow) var(--__P__-ease),__P__-callout-nudge 1.6s var(--__P__-ease-in-out) var(--__P__-dur-slow) infinite}@keyframes __P__-callout-in{0%{opacity:0}to{opacity:1}}@keyframes __P__-callout-nudge{0%,to{margin-left:0;margin-right:0}50%{margin-left:calc(6px * var(--__P__-callout-nudge-direction));margin-right:calc(-6px * var(--__P__-callout-nudge-direction))}}@media(prefers-reduced-motion:reduce){.__P__-callout[data-animated]{animation:__P__-callout-in 1ms var(--__P__-ease)}.__P__-icon-btn[data-recording=true],.__P__-typing span{animation:none}}.__P__-callout-close{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;border-radius:999px;color:inherit;opacity:.7;cursor:pointer}.__P__-callout-close:hover{opacity:1;background:color-mix(in srgb,currentColor 15%,transparent)}.__P__-callout-close:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-callout-close svg{width:12px;height:12px}.__P__-panel{width:var(--__P__-panel-w);height:var(--__P__-panel-h);max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);background:var(--__P__-bg);color:var(--__P__-fg);border-radius:var(--__P__-radius-lg);box-shadow:var(--__P__-shadow-panel);display:flex;flex-direction:column;overflow:hidden;overscroll-behavior:none;transform-origin:bottom right;animation:__P__-panel-in var(--__P__-dur-slow) var(--__P__-ease);border:1px solid var(--__P__-border)}@media(prefers-reduced-motion:no-preference){.__P__-panel{transition:width var(--__P__-dur-base) var(--__P__-ease),height var(--__P__-dur-base) var(--__P__-ease),max-width var(--__P__-dur-base) var(--__P__-ease),max-height var(--__P__-dur-base) var(--__P__-ease)}.__P__-panel[data-resizing]{transition:none}}:host([data-mode="open"]) .__P__-panel{width:var(--__P__-widget-w, var(--__P__-panel-w));height:var(--__P__-widget-h, var(--__P__-panel-h));min-width:var(--__P__-resize-min-w, auto);min-height:var(--__P__-resize-min-h, auto);max-width:var(--__P__-resize-max-w, calc(100vw - 32px) );max-height:var(--__P__-resize-max-h, calc(100dvh - 32px) )}@keyframes __P__-panel-in{0%{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:none}}:host([data-mode="expanded"]) .__P__-panel{width:var(--__P__-expanded-w, 640px);height:var(--__P__-expanded-h, 820px);max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px)}:host([data-mode="fullscreen"]){z-index:var(--__P__-z-panel)!important}:host([data-mode="fullscreen"]) .__P__-anchor{inset:var(--__P__-visual-viewport-top, 0px) 0 auto;height:var(--__P__-visual-viewport-height, 100dvh);padding:0;justify-content:flex-end;align-items:flex-end}:host([data-mode="fullscreen"][data-position*="top"]) .__P__-anchor{justify-content:flex-start}:host([data-mode="fullscreen"][data-position*="left"]) .__P__-anchor{align-items:flex-start}:host([data-mode="fullscreen"]) .__P__-panel{width:100vw;height:100%;max-width:none;max-height:none;border-radius:0;border:0}:host([data-mode="fullscreen"]) .__P__-fab{display:none}@media(max-width:640px){:host([data-mode="open"]) .__P__-anchor,:host([data-mode="expanded"]) .__P__-anchor{inset:var(--__P__-visual-viewport-top, 0px) 0 auto;align-items:stretch;height:var(--__P__-visual-viewport-height, 100dvh);padding:0}:host([data-mode="open"]) .__P__-panel,:host([data-mode="expanded"]) .__P__-panel{width:100vw;height:100%;max-width:none;max-height:none;border-radius:0;border:0}}:host([data-mode="inline"]) .__P__-anchor,:host([data-mode="standalone"]) .__P__-anchor{position:static;inset:auto;padding:0;align-items:stretch;width:100%;height:100%;min-height:0}:host([data-mode="inline"]) .__P__-panel,:host([data-mode="standalone"]) .__P__-panel{width:100%;height:100%;min-width:0;min-height:0;max-width:none;max-height:none;animation:none}:host([data-mode="inline"]) .__P__-fab,:host([data-mode="standalone"]) .__P__-fab{display:none}:host([data-mode="inline"]){min-height:320px}:host([data-mode="inline"]) .__P__-panel{border-radius:var(--__P__-radius)}:host([data-mode="standalone"]) .__P__-panel{border-radius:0;border:0;box-shadow:none}:host([data-mode="modal"]){position:fixed!important;inset:0!important;z-index:var(--__P__-z-panel)!important;display:block!important;width:100vw;height:100dvh;background:var(--__P__-modal-backdrop, var(--__P__-backdrop));animation:__P__-backdrop-in var(--__P__-dur-base) var(--__P__-ease) both;--__P__-panel-w: min(960px, 92vw);--__P__-panel-h: min(720px, 88dvh)}:host([data-mode="modal"]) .__P__-anchor{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:var(--__P__-space-6);pointer-events:none}:host([data-mode="modal"]) .__P__-panel{pointer-events:auto;width:var(--__P__-widget-w, var(--__P__-panel-w));height:var(--__P__-widget-h, var(--__P__-panel-h));max-width:calc(100vw - 48px);max-height:calc(100dvh - 48px);min-width:0;min-height:0;border-radius:var(--__P__-radius);box-shadow:var(--__P__-shadow-panel);animation:__P__-modal-in var(--__P__-dur-base) var(--__P__-ease);translate:var(--__P__-modal-dx, 0px) var(--__P__-modal-dy, 0px)}:host([data-mode="modal"]) .__P__-header,:host([data-mode="modal"]) .__P__-back-header,:host([data-mode="modal"]) .__P__-home-hero{cursor:grab;touch-action:none}:host([data-mode="modal"]) .__P__-panel[data-dragging]{cursor:grabbing;user-select:none}:host([data-mode="modal"]) .__P__-panel[data-dragging] *{cursor:grabbing}:host([data-mode="modal"]) .__P__-fab{display:none}@keyframes __P__-backdrop-in{0%{background:#0000}to{background:var(--__P__-modal-backdrop, var(--__P__-backdrop))}}@keyframes __P__-modal-in{0%{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}:host([data-mode="drawer"]){--__P__-panel-w: min(440px, calc(100vw - 32px) );--__P__-panel-h: 100dvh}:host([data-mode="drawer"]) .__P__-anchor{position:fixed;--__P__-inset-x: var(--__P__-panel-inset, 12px);--__P__-inset-y: var(--__P__-panel-inset, 3dvh);top:var(--__P__-inset-y);bottom:auto;right:var(--__P__-inset-x);left:auto;width:min(var(--__P__-widget-w, var(--__P__-panel-w)),calc(100vw - var(--__P__-inset-x) * 2));height:min(var(--__P__-widget-h, var(--__P__-panel-h)),calc(100dvh - var(--__P__-inset-y) * 2));padding:0;display:block;pointer-events:auto}:host([data-mode="drawer"][data-position$="-left"]) .__P__-anchor{right:auto;left:var(--__P__-inset-x)}:host([data-mode="drawer"][data-position^="bottom-"]) .__P__-anchor{top:auto;bottom:var(--__P__-inset-y)}:host([data-mode="drawer"]) .__P__-panel{width:100%;height:100%;max-width:none;max-height:none;min-width:0;min-height:0;border-radius:var(--__P__-radius, 12px);border:1px solid var(--__P__-border);box-shadow:-8px 16px 32px -12px #00000038;animation:__P__-drawer-in var(--__P__-dur-base) var(--__P__-ease)}:host([data-mode="drawer"][data-position$="-left"]) .__P__-panel{box-shadow:8px 16px 32px -12px #00000038;animation:__P__-drawer-in-left var(--__P__-dur-base) var(--__P__-ease)}.__P__-fab[data-edge-tab]{display:inline-flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--__P__-space-2);position:fixed;top:50%;height:140px;width:auto;min-width:0;padding:10px 8px;writing-mode:vertical-rl;text-orientation:mixed;transform:translateY(-50%);transform-origin:center;animation:__P__-edge-tab-in var(--__P__-dur-base) var(--__P__-ease) both}.__P__-fab[data-edge-tab] svg{writing-mode:horizontal-tb}.__P__-fab[data-edge-tab]:hover{transform:translateY(-50%) scale(1.03)}.__P__-fab[data-edge-tab]:active{transform:translateY(-50%) scale(.97)}:host([data-position$="-right"]) .__P__-fab[data-edge-tab]{right:0;left:auto;border-radius:12px 0 0 12px;box-shadow:-6px 0 18px -8px #0000004d}:host([data-position$="-left"]) .__P__-fab[data-edge-tab]{left:0;right:auto;border-radius:0 12px 12px 0;box-shadow:6px 0 18px -8px #0000004d}.__P__-fab[data-edge-tab][data-leaving]{position:fixed;top:50%;bottom:auto;animation:__P__-edge-tab-out var(--__P__-dur-quick) var(--__P__-ease) forwards}@keyframes __P__-edge-tab-in{0%{opacity:0;transform:translateY(-50%) scale(.9)}to{opacity:1;transform:translateY(-50%) scale(1)}}@keyframes __P__-edge-tab-out{0%{opacity:1;transform:translateY(-50%) scale(1)}to{opacity:0;transform:translateY(-50%) scale(.85)}}@keyframes __P__-drawer-in{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes __P__-drawer-in-left{0%{transform:translate(-100%)}to{transform:translate(0)}}@media(prefers-reduced-motion:reduce){:host([data-mode="drawer"]) .__P__-panel,.__P__-fab[data-edge-tab]{animation:none}}.__P__-header{display:flex;align-items:center;gap:var(--__P__-space-2);padding:10px 12px;border-bottom:1px solid var(--__P__-border);background:var(--__P__-bg)}.__P__-header h1{font-size:calc(14px * var(--__P__-text-scale));font-weight:600;flex:1;letter-spacing:-.01em}.__P__-header-actions{margin-inline-start:auto;display:flex;align-items:center;gap:var(--__P__-space-1);flex-shrink:0}.__P__-agent{flex:1;display:inline-flex;align-items:center;gap:10px;min-width:0}.__P__-agent-avatar{position:relative;width:32px;height:32px;border-radius:999px;background:var(--__P__-bg-elevated);color:var(--__P__-fg-muted);display:inline-flex;align-items:center;justify-content:center;font-weight:700;font-size:var(--__P__-text-xs);overflow:hidden;flex-shrink:0}.__P__-agent-avatar img{width:100%;height:100%;object-fit:cover}.__P__-agent-avatar:after{content:"";position:absolute;right:-1px;bottom:-1px;width:10px;height:10px;border-radius:999px;border:2px solid var(--__P__-bg);background:var(--__P__-neutral)}.__P__-agent-avatar[data-status=online]:after{background:var(--__P__-success)}.__P__-agent-avatar[data-status=away]:after{background:var(--__P__-warning)}.__P__-agent-avatar[data-status=offline]:after{background:var(--__P__-neutral)}.__P__-agent-meta{display:flex;flex-direction:column;line-height:1.15;min-width:0}.__P__-agent-meta strong{font-size:calc(14px * var(--__P__-text-scale));font-weight:600;letter-spacing:-.01em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-agent-meta span{font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-suggestions{display:flex;flex-wrap:nowrap;gap:var(--__P__-space-2);padding:6px 14px 10px;overflow-x:auto;overflow-y:hidden;scroll-behavior:smooth;scroll-snap-type:x proximity;scrollbar-width:none;-ms-overflow-style:none;min-width:0}.__P__-suggestions::-webkit-scrollbar{display:none}.__P__-suggestions:before,.__P__-suggestions:after{content:"";flex:1 1 0;min-width:0}.__P__-suggestion{flex:0 0 auto;scroll-snap-align:center;padding:7px 14px;border-radius:999px;background:var(--__P__-bg-elevated);border:1px solid var(--__P__-border);color:var(--__P__-fg);font-size:var(--__P__-text-sm);font-weight:500;white-space:nowrap;transition:background var(--__P__-dur-quick) var(--__P__-ease),border-color var(--__P__-dur-quick) var(--__P__-ease),transform var(--__P__-dur-quick) var(--__P__-ease)}.__P__-suggestion:hover{border-color:var(--__P__-accent);color:var(--__P__-accent-fg);transform:translateY(-1px)}.__P__-suggestion:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px;border-color:var(--__P__-accent)}.__P__-suggestion:active{transform:translateY(0)}.__P__-icon-btn{width:32px;height:32px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;color:var(--__P__-fg-muted);transition:background var(--__P__-dur-quick) var(--__P__-ease),color var(--__P__-dur-quick) var(--__P__-ease)}.__P__-icon-btn:hover{background:var(--__P__-bg-elevated);color:var(--__P__-fg)}.__P__-icon-btn:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-icon-btn:active{background:var(--__P__-border)}.__P__-icon-btn:disabled{opacity:.45;cursor:not-allowed}.__P__-icon-btn:before{content:"";position:absolute;inset:-6px}.__P__-icon-btn{position:relative}.__P__-icon-btn svg{width:18px;height:18px}.__P__-icon-btn[data-recording=true]{color:var(--__P__-accent-fg);background:color-mix(in srgb,var(--__P__-accent) 12%,transparent);animation:__P__-pulse 1.2s var(--__P__-ease) infinite}@keyframes __P__-pulse{0%,to{box-shadow:0 0 color-mix(in srgb,var(--__P__-accent) 40%,transparent)}50%{box-shadow:0 0 0 6px color-mix(in srgb,var(--__P__-accent) 0%,transparent)}}.__P__-list,.__P__-history,.__P__-module-scroll,.__P__-home-scroll,.__P__-help-list,.__P__-toolui-code,.__P__-sidebar-conversations{scrollbar-width:thin;scrollbar-color:var(--__P__-border-strong) transparent;overscroll-behavior:contain;scrollbar-gutter:stable}.__P__-list::-webkit-scrollbar,.__P__-history::-webkit-scrollbar,.__P__-module-scroll::-webkit-scrollbar,.__P__-home-scroll::-webkit-scrollbar,.__P__-help-list::-webkit-scrollbar,.__P__-toolui-code::-webkit-scrollbar,.__P__-sidebar-conversations::-webkit-scrollbar{width:8px}.__P__-list::-webkit-scrollbar-thumb,.__P__-history::-webkit-scrollbar-thumb,.__P__-module-scroll::-webkit-scrollbar-thumb,.__P__-home-scroll::-webkit-scrollbar-thumb,.__P__-help-list::-webkit-scrollbar-thumb,.__P__-toolui-code::-webkit-scrollbar-thumb,.__P__-sidebar-conversations::-webkit-scrollbar-thumb{background:var(--__P__-border-strong);border-radius:8px}.__P__-list-wrap{position:relative;flex:1;min-height:0;display:flex;flex-direction:column}.__P__-jump{position:absolute;inset-inline-end:14px;bottom:14px;z-index:2;display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;border-radius:999px;border:1px solid var(--__P__-border);background:var(--__P__-bg-elevated);color:var(--__P__-fg);box-shadow:var(--__P__-shadow-panel);cursor:pointer;opacity:.85;transition:opacity var(--__P__-dur-quick) var(--__P__-ease),transform var(--__P__-dur-quick) var(--__P__-ease);animation:__P__-bubble-in var(--__P__-dur-base) var(--__P__-ease)}.__P__-jump:hover{opacity:1}.__P__-jump:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;opacity:1}.__P__-jump:active{transform:translateY(1px)}.__P__-jump svg{width:18px;height:18px}.__P__-list{flex:1;min-height:0;overflow-y:auto;padding:var(--__P__-space-4);padding-bottom:var(--__P__-space-8);display:flex;flex-direction:column;gap:14px}.__P__-list--fade{--__P__-fade-size: 20px;--__P__-fade-top: 0px;--__P__-fade-bottom: 0px;-webkit-mask-image:linear-gradient(to bottom,transparent 0,#000 var(--__P__-fade-top),#000 calc(100% - var(--__P__-fade-bottom)),transparent 100%);mask-image:linear-gradient(to bottom,transparent 0,#000 var(--__P__-fade-top),#000 calc(100% - var(--__P__-fade-bottom)),transparent 100%)}.__P__-list--fade[data-fade-top=true]{--__P__-fade-top: var(--__P__-fade-size)}.__P__-list--fade[data-fade-bottom=true]{--__P__-fade-bottom: var(--__P__-fade-size)}.__P__-list>*{width:100%;max-width:var(--__P__-conversation-max, 768px);margin-inline:auto}.__P__-load-previous,.__P__-history-more{display:flex;justify-content:center}.__P__-load-previous button,.__P__-history-more button{border:0;padding:4px 8px;background:transparent;color:var(--__P__-accent);font:inherit;font-size:var(--__P__-text-sm);font-weight:600;cursor:pointer}.__P__-load-previous button:hover,.__P__-history-more button:hover{text-decoration:underline}.__P__-load-previous button:focus-visible,.__P__-history-more button:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;border-radius:var(--__P__-radius-sm)}.__P__-load-previous button:disabled,.__P__-history-more button:disabled{cursor:wait;opacity:.6}.__P__-date-divider{display:flex;justify-content:center;margin-block:var(--__P__-space-3)}.__P__-date-pill{padding:3px 10px;border-radius:999px;font-size:calc(11px * var(--__P__-text-scale));font-weight:600;color:var(--__P__-fg-muted);background:var(--__P__-bg-elevated);border:1px solid var(--__P__-border);box-shadow:var(--__P__-shadow-card)}.__P__-bubble-row{display:flex}.__P__-bubble-row[data-role=user]{justify-content:flex-end}.__P__-bubble-row[data-role=assistant]{justify-content:flex-start}.__P__-bubble{max-width:100%;min-width:0;padding:var(--__P__-space-3) var(--__P__-space-4);border-radius:var(--__P__-radius);line-height:1.6;font-size:calc(14px * var(--__P__-text-scale));word-wrap:break-word;overflow-wrap:break-word;box-shadow:0 1px 2px #0000000a,0 1px 8px -4px #0000000f;animation:__P__-bubble-in var(--__P__-dur-base) var(--__P__-ease)}.__P__-bubble ::selection{background:color-mix(in srgb,var(--__P__-accent) 30%,transparent)}.__P__-bubble-row[data-role=user] .__P__-bubble ::selection{background:#fff6;color:var(--__P__-bubble-user-text)}@keyframes __P__-bubble-in{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}.__P__-bubble-row[data-role=user] .__P__-bubble{background:var(--__P__-bubble-user);color:var(--__P__-bubble-user-text);border-end-end-radius:5px}.__P__-bubble-row[data-role=assistant] .__P__-bubble{background:var(--__P__-bubble-assistant);color:var(--__P__-bubble-assistant-text);border:1px solid var(--__P__-border);border-end-start-radius:5px}.__P__-bubble-row[data-role=operator] .__P__-bubble{display:flex;align-items:stretch;padding:0;overflow:hidden;background:var(--__P__-bubble-assistant);color:var(--__P__-bubble-assistant-text);border-end-start-radius:5px}.__P__-bubble-row[data-role=operator] .__P__-bubble-col{align-items:flex-start}.__P__-bubble-author{display:flex;flex:0 0 auto;align-items:center;padding:0 .875rem;border-inline-end:1px solid color-mix(in oklab,var(--__P__-accent),transparent 60%);color:var(--__P__-accent);font-size:calc(13px * var(--__P__-text-scale));font-weight:600;letter-spacing:.025em;user-select:none}.__P__-bubble-row[data-role=operator] .__P__-bubble-body{flex:1 1 auto;min-width:0;padding:var(--__P__-space-3) var(--__P__-space-4)}.__P__-bubble-col{display:flex;flex-direction:column;max-width:85%;min-width:0}.__P__-bubble-row[data-role=user] .__P__-bubble-col{align-items:flex-end}.__P__-bubble-row[data-role=assistant] .__P__-bubble-col{align-items:flex-start}.__P__-bubble-row[data-role=assistant] .__P__-bubble-col:has(.__P__-toolui){width:100%}.__P__-bubble-row[data-role=assistant] .__P__-bubble-col:has(.__P__-toolui) .__P__-bubble{width:100%}@media(max-width:640px){.__P__-bubble-col{max-width:92%}.__P__-toolui:not(.__P__-toolui-collapsible){padding:var(--__P__-space-3);gap:var(--__P__-space-2)}details.__P__-toolui-collapsible>summary{padding:var(--__P__-space-2) var(--__P__-space-3)}details.__P__-toolui-collapsible>.__P__-toolui-section{margin:var(--__P__-space-3)}.__P__-toolui-section,.__P__-toolui-desc{padding:var(--__P__-space-2) var(--__P__-space-3)}}.__P__-bubble-meta{display:flex;align-items:center;gap:8px;margin-top:2px;padding:0 2px;min-height:24px}.__P__-bubble-actions{display:flex;align-items:center;gap:2px}.__P__-bubble-time{font-size:calc(11px * var(--__P__-text-scale));line-height:1;color:var(--__P__-fg-muted);user-select:none}.__P__-feedback{display:flex;align-items:center;gap:2px}.__P__-msg-action{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border:0;border-radius:var(--__P__-radius-sm);background:transparent;color:var(--__P__-fg-muted);cursor:pointer;opacity:.65;transition:opacity var(--__P__-dur-quick) var(--__P__-ease),background var(--__P__-dur-quick) var(--__P__-ease),color var(--__P__-dur-quick) var(--__P__-ease)}.__P__-msg-action:hover{opacity:1;background:var(--__P__-bg-elevated);color:var(--__P__-fg)}.__P__-msg-action:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;opacity:1}.__P__-msg-action[data-active=true]{opacity:1;color:var(--__P__-accent-fg)}.__P__-msg-action svg{width:15px;height:15px}.__P__-md>*:first-child{margin-top:0}.__P__-md>*:last-child{margin-bottom:0}.__P__-md p{margin:10px 0}.__P__-md h1,.__P__-md h2,.__P__-md h3,.__P__-md h4,.__P__-md h5,.__P__-md h6{margin:18px 0 8px;line-height:1.3;letter-spacing:-.01em;font-weight:700}.__P__-md h1{font-size:1.4em}.__P__-md h2{font-size:1.22em}.__P__-md h3{font-size:1.08em}.__P__-md h4,.__P__-md h5,.__P__-md h6{font-size:1em}.__P__-md>h1:first-child,.__P__-md>h2:first-child,.__P__-md>h3:first-child,.__P__-md>h4:first-child,.__P__-md>h5:first-child,.__P__-md>h6:first-child{margin-top:0}.__P__-md ul,.__P__-md ol{padding-inline-start:1.5em;margin:10px 0}.__P__-md ul{list-style:disc}.__P__-md ol{list-style:decimal}.__P__-md li{margin:6px 0;padding-inline-start:2px}.__P__-md li::marker{color:var(--__P__-fg-muted)}.__P__-md li>p{margin:6px 0}.__P__-md li>ul,.__P__-md li>ol{margin:6px 0}.__P__-md strong,.__P__-md b{font-weight:650;letter-spacing:-.005em}.__P__-md em,.__P__-md i{font-style:italic}.__P__-md code{font-family:var(--__P__-font-mono);font-size:.86em;padding:1px 6px;border-radius:5px;background:color-mix(in srgb,var(--__P__-accent) 10%,transparent);color:var(--__P__-fg);border:1px solid color-mix(in srgb,var(--__P__-accent) 16%,transparent)}.__P__-md pre{font-family:var(--__P__-font-mono);font-size:calc(12.5px * var(--__P__-text-scale));padding:12px 14px;border-radius:var(--__P__-radius-sm);background:#7f7f7f1f;overflow-x:auto;margin:var(--__P__-space-3) 0;line-height:1.5}.__P__-md pre code{padding:0;background:none}.__P__-md a{color:inherit;text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px}.__P__-md a:hover{text-decoration-thickness:2px}.__P__-md blockquote{margin:14px 0;padding:6px 14px;border-inline-start:3px solid color-mix(in srgb,var(--__P__-accent) 50%,transparent);background:color-mix(in srgb,var(--__P__-accent) 5%,transparent);border-start-end-radius:var(--__P__-radius-sm);border-end-end-radius:var(--__P__-radius-sm);color:var(--__P__-fg-muted)}.__P__-md blockquote>:first-child{margin-top:0}.__P__-md blockquote>:last-child{margin-bottom:0}.__P__-md hr{border:0;height:1px;background:color-mix(in srgb,currentColor 18%,transparent);margin:var(--__P__-space-4) 0}.__P__-md table{border-collapse:collapse;margin:var(--__P__-space-3) 0;font-size:.95em;display:block;overflow-x:auto;max-width:100%;font-variant-numeric:tabular-nums}.__P__-md th,.__P__-md td{padding:6px 10px;border-bottom:1px solid color-mix(in srgb,currentColor 12%,transparent);text-align:start}.__P__-md th{font-weight:700;background:color-mix(in srgb,currentColor 6%,transparent)}.__P__-md h1+ul,.__P__-md h1+ol,.__P__-md h2+ul,.__P__-md h2+ol,.__P__-md h3+ul,.__P__-md h3+ol,.__P__-md h4+ul,.__P__-md h4+ol{margin-top:var(--__P__-space-1)}.__P__-loading{display:inline-flex;align-items:center;gap:var(--__P__-space-2);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm)}.__P__-loading-spinner{width:14px;height:14px;border-radius:999px;border:2px solid currentColor;border-top-color:transparent;animation:__P__-spin .8s linear infinite}@keyframes __P__-spin{to{transform:rotate(1turn)}}.__P__-typing{display:inline-flex;gap:var(--__P__-space-1);padding:var(--__P__-space-1) 0}.__P__-typing span{width:5px;height:5px;border-radius:999px;background:currentColor;opacity:.4;animation:__P__-blink 1.2s var(--__P__-ease) infinite}.__P__-typing span:nth-child(2){animation-delay:.2s}.__P__-typing span:nth-child(3){animation-delay:.4s}@keyframes __P__-blink{0%,80%,to{opacity:.3;transform:translateY(0)}40%{opacity:1;transform:translateY(-2px)}}.__P__-reasoning{margin:var(--__P__-space-1) 0 var(--__P__-space-2);padding-inline-start:var(--__P__-space-3);border-inline-start:2px solid var(--__P__-border-strong)}.__P__-reasoning-summary{display:inline-flex;align-items:center;gap:var(--__P__-space-1);cursor:pointer;list-style:none;user-select:none;color:var(--__P__-fg-muted);font-size:var(--__P__-text-xs);font-weight:600}.__P__-reasoning-summary:hover{color:var(--__P__-fg)}.__P__-reasoning-summary:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;border-radius:var(--__P__-radius-sm)}.__P__-reasoning-summary::-webkit-details-marker{display:none}.__P__-reasoning-summary:before{content:"";width:5px;height:5px;border-inline-end:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:rotate(-45deg);opacity:.7;transition:transform var(--__P__-dur-quick) var(--__P__-ease)}.__P__-reasoning[open] .__P__-reasoning-summary:before{transform:rotate(45deg)}.__P__-reasoning[data-active=true] .__P__-reasoning-label{animation:__P__-reasoning-pulse 1.4s var(--__P__-ease) infinite}@keyframes __P__-reasoning-pulse{0%,to{opacity:.5}50%{opacity:1}}@media(prefers-reduced-motion:reduce){.__P__-reasoning[data-active=true] .__P__-reasoning-label{animation:none}}.__P__-reasoning-body{margin-top:var(--__P__-space-1);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm)}.__P__-reasoning-body>:first-child{margin-top:0}.__P__-reasoning-body>:last-child{margin-bottom:0}.__P__-source{display:inline-flex;align-items:center;gap:6px;max-width:100%;margin-top:6px;margin-inline-end:6px;padding:var(--__P__-space-1) var(--__P__-space-2);border-radius:999px;background:var(--__P__-bg-elevated);border:1px solid var(--__P__-border);color:var(--__P__-fg-muted);font-size:var(--__P__-text-xs);text-decoration:none}a.__P__-source:hover{color:var(--__P__-fg);border-color:var(--__P__-accent)}.__P__-source-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-composer{border-top:1px solid var(--__P__-border);padding:10px 12px;background:var(--__P__-bg);display:flex;flex-direction:column;gap:var(--__P__-space-2)}.__P__-composer>*{width:100%;max-width:var(--__P__-conversation-max, 768px);margin-inline:auto}.__P__-compaction-status{justify-content:center;font-size:var(--__P__-text-xs)}.__P__-message-queue{display:flex;max-height:112px;flex-direction:column;gap:var(--__P__-space-1);overflow-y:auto}.__P__-queued-message{width:100%;max-width:none}.__P__-queued-text{min-width:0;flex:1}.__P__-composer-row{display:flex;align-items:flex-end;gap:6px}.__P__-textarea{flex:1;--__P__-textarea-base-height: 40px;height:var(--__P__-textarea-base-height);max-height:160px;padding:10px 12px;border-radius:var(--__P__-radius);background:var(--__P__-bg-elevated);border:1px solid transparent;font-size:calc(14px * var(--__P__-text-scale));line-height:1.4;transition:height var(--__P__-dur-quick) var(--__P__-ease),border-color var(--__P__-dur-quick) var(--__P__-ease)}.__P__-textarea:focus-visible{outline:none;border-color:var(--__P__-focus)}@media(pointer:coarse){.__P__-textarea{--__P__-textarea-base-height: 44px}}.__P__-send{width:40px;height:40px;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;transition:opacity var(--__P__-dur-quick) var(--__P__-ease),transform var(--__P__-dur-quick) var(--__P__-ease),background var(--__P__-dur-quick) var(--__P__-ease)}.__P__-send[data-shape=circle]{border-radius:999px}.__P__-send[data-shape=square]{border-radius:var(--__P__-radius-sm)}.__P__-send[data-shape=pill]{width:auto;padding:0 18px;border-radius:999px}.__P__-send[data-variant=filled]{background:var(--__P__-accent);color:var(--__P__-accent-text)}.__P__-send[data-variant=outline]{background:transparent;color:var(--__P__-accent-fg);border-color:var(--__P__-accent)}.__P__-send[data-variant=outline]:not(:disabled):hover{background:color-mix(in srgb,var(--__P__-accent) 10%,transparent)}.__P__-send[data-variant=ghost]{background:transparent;color:var(--__P__-accent-fg)}.__P__-send[data-variant=ghost]:not(:disabled):hover{background:color-mix(in srgb,var(--__P__-accent) 8%,transparent)}.__P__-send:disabled{opacity:.4;cursor:not-allowed}.__P__-send:not(:disabled):hover{transform:translateY(-1px)}.__P__-send:not(:disabled):active{transform:translateY(0)}.__P__-send:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-send svg{width:18px;height:18px}.__P__-composer-actions{display:flex;gap:var(--__P__-space-1);flex-wrap:wrap}.__P__-attachments{display:flex;flex-wrap:wrap;gap:6px}.__P__-attachment-chip{display:inline-flex;align-items:center;gap:6px;padding:var(--__P__-space-1) var(--__P__-space-2) var(--__P__-space-1) var(--__P__-space-1);border-radius:999px;background:var(--__P__-bg-elevated);border:1px solid var(--__P__-border);font-size:var(--__P__-text-xs);max-width:200px}.__P__-attachment-thumb{width:24px;height:24px;border-radius:999px;object-fit:cover;background:var(--__P__-border)}.__P__-attachment-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.__P__-attachment-remove{width:18px;height:18px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;color:var(--__P__-fg-muted)}.__P__-attachment-remove:hover{background:var(--__P__-border);color:var(--__P__-fg)}.__P__-dropzone{position:absolute;inset:8px;border:2px dashed var(--__P__-accent);border-radius:var(--__P__-radius);background:color-mix(in srgb,var(--__P__-accent) 8%,transparent);display:flex;align-items:center;justify-content:center;font-weight:600;color:var(--__P__-accent-fg);pointer-events:none;z-index:10;animation:__P__-fade-in var(--__P__-dur-quick) var(--__P__-ease)}@keyframes __P__-fade-in{0%{opacity:0}to{opacity:1}}.__P__-error{margin-top:var(--__P__-space-1);padding:8px 12px;border-radius:var(--__P__-radius-sm);background:color-mix(in oklab,var(--__P__-danger) 8%,var(--__P__-bg-elevated));border:1px solid color-mix(in oklab,var(--__P__-danger) 20%,transparent);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);display:flex;align-items:center;gap:var(--__P__-space-2)}.__P__-error span{min-width:0}.__P__-error button{margin-inline-start:auto;flex-shrink:0;border:0;background:none;padding:0;color:var(--__P__-accent-fg);font:inherit;font-size:var(--__P__-text-sm);font-weight:600;text-decoration:underline;white-space:nowrap;cursor:pointer}.__P__-history{flex:1;overflow-y:auto;padding:var(--__P__-space-2) var(--__P__-space-1) var(--__P__-space-3)}.__P__-history-footer{flex:none;padding:var(--__P__-space-2) var(--__P__-space-3) var(--__P__-space-3);border-top:1px solid var(--__P__-border);background:var(--__P__-surface)}.__P__-history-new{width:100%;display:flex;align-items:center;justify-content:center;gap:var(--__P__-space-2);padding:var(--__P__-space-2) var(--__P__-space-3);border:none;border-radius:var(--__P__-radius-md);background:var(--__P__-accent);color:var(--__P__-on-accent);cursor:pointer;font-size:var(--__P__-text-sm);font-weight:600;transition:filter var(--__P__-dur-quick) var(--__P__-ease-out),transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-history-new svg{width:16px;height:16px}.__P__-history-new:hover{filter:brightness(1.08)}.__P__-history-new:active{transform:translateY(1px)}.__P__-history-new:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-history-empty{flex:1;display:flex;align-items:center;justify-content:center;padding:40px 16px;color:var(--__P__-fg-muted);font-size:calc(14px * var(--__P__-text-scale));text-align:center}.__P__-history-group{display:flex;flex-direction:column;padding:0 var(--__P__-space-3)}.__P__-history-heading{font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted);padding:14px 4px 8px;text-transform:uppercase;letter-spacing:.04em}.__P__-history-card{display:flex;flex-direction:column;background:var(--__P__-surface);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-lg, 14px);overflow:hidden}.__P__-history-item{all:unset;display:flex;align-items:center;gap:var(--__P__-space-3);padding:12px var(--__P__-space-3);cursor:pointer;transition:background var(--__P__-dur-base) var(--__P__-ease)}.__P__-history-item+.__P__-history-item{border-top:1px solid var(--__P__-border)}.__P__-history-item:hover{background:var(--__P__-bg-elevated)}.__P__-history-item:focus-visible{background:var(--__P__-bg-elevated);outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-history-avatar{flex:none;display:grid;place-items:center;width:36px;height:36px;border-radius:50%;background:color-mix(in oklab,var(--__P__-accent) 12%,transparent);color:var(--__P__-accent-fg)}.__P__-history-avatar svg{width:18px;height:18px}.__P__-history-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.__P__-history-row{display:flex;align-items:center;justify-content:space-between;gap:var(--__P__-space-2)}.__P__-history-title{flex:1;min-width:0;font-size:calc(14px * var(--__P__-text-scale));font-weight:500;color:var(--__P__-fg);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-history-time{flex:none;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted)}.__P__-history-preview{flex:1;min-width:0;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-history-dot{flex:none;width:8px;height:8px;border-radius:50%;background:var(--__P__-accent)}.__P__-history-item[data-unread=true] .__P__-history-title{font-weight:600}.__P__-history-item[data-closed=true] .__P__-history-title{color:var(--__P__-fg-muted)}.__P__-history-item-skeleton{cursor:default;pointer-events:none}.__P__-skeleton{display:block;border-radius:4px;background:linear-gradient(90deg,color-mix(in oklab,var(--__P__-fg) 9%,transparent) 30%,color-mix(in oklab,var(--__P__-fg) 17%,transparent),color-mix(in oklab,var(--__P__-fg) 9%,transparent) 70%);background-size:200% 100%;animation:__P__-skeleton-shimmer 1.8s ease-in-out infinite}.__P__-history-avatar.__P__-skeleton{border-radius:50%}.__P__-skeleton-heading{width:52px;height:8px}.__P__-skeleton-title{width:55%;height:12px}.__P__-skeleton-time{width:34px;height:10px}.__P__-skeleton-preview{width:80%;height:10px}@keyframes __P__-skeleton-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media(prefers-reduced-motion:reduce){.__P__-skeleton{animation:none}}.__P__-list-loading{margin:auto;padding:var(--__P__-space-6) var(--__P__-space-4);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);text-align:center}.__P__-readonly-banner{display:flex;flex-direction:column;align-items:center;gap:10px;padding:14px 12px;margin:0 var(--__P__-space-3) var(--__P__-space-3);border-radius:var(--__P__-radius-md);background:var(--__P__-bg-elevated);color:var(--__P__-fg-muted);text-align:center;font-size:var(--__P__-text-sm)}.__P__-readonly-label{line-height:1.4}.__P__-readonly-cta{appearance:none;border:0;cursor:pointer;padding:var(--__P__-space-2) var(--__P__-space-4);border-radius:999px;background:var(--__P__-accent);color:var(--__P__-accent-text, #fff);font:inherit;font-weight:600;font-size:var(--__P__-text-sm);transition:filter var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-readonly-cta:hover,.__P__-readonly-cta:focus-visible{filter:brightness(1.1)}.__P__-operator-banner{display:flex;align-items:center;justify-content:center;gap:8px;margin:0 var(--__P__-space-3) var(--__P__-space-1);padding:8px 12px;border-radius:var(--__P__-radius-md);background:color-mix(in oklab,var(--__P__-bg-elevated),var(--__P__-accent) 6%);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);line-height:1.3;text-align:center}.__P__-operator-pulse{flex:0 0 auto;width:8px;height:8px;border-radius:50%;background:var(--__P__-accent)}.__P__-operator-banner[data-mode=awaiting_operator] .__P__-operator-pulse{animation:__P__-operator-pulse 1.4s var(--__P__-ease-out) infinite}.__P__-cancel-operator-request{flex:0 0 auto;padding:0;border:0;background:none;color:var(--__P__-accent);font:inherit;font-weight:600;text-decoration:underline;text-underline-offset:2px;cursor:pointer}.__P__-cancel-operator-request:hover{opacity:.8}.__P__-cancel-operator-request:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px;border-radius:var(--__P__-radius-sm)}@keyframes __P__-operator-pulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.4;transform:scale(.7)}}.__P__-readonly-cta:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px}.__P__-composer-footer{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:10px 16px;margin:0 var(--__P__-space-3);border-top:1px solid var(--__P__-border);text-align:center;font-size:calc(11px * var(--__P__-text-scale));line-height:1.4;color:var(--__P__-fg-muted)}.__P__-disclaimer{max-width:320px;margin:0 auto;opacity:.9;letter-spacing:.01em}.__P__-poweredby{display:inline-flex;align-items:center;justify-content:center;gap:6px;color:inherit;text-decoration:none;opacity:.7;transition:opacity var(--__P__-dur-base) var(--__P__-ease);font-size:calc(11px * var(--__P__-text-scale));letter-spacing:.02em}.__P__-poweredby:hover{opacity:1}.__P__-poweredby-logo{height:12px;width:auto;display:inline-block;vertical-align:middle}.__P__-poweredby-bar{flex:none;display:flex;align-items:center;justify-content:center;padding:6px 16px;border-top:1px solid var(--__P__-border);background:var(--__P__-bg-elevated)}.__P__-menu-wrap{position:relative;display:inline-flex}.__P__-menu{position:absolute;top:100%;inset-inline-end:0;margin-top:6px;min-width:200px;padding:6px;background:var(--__P__-bg);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);box-shadow:var(--__P__-shadow-panel);z-index:10;display:flex;flex-direction:column;gap:2px;animation:__P__-menu-in var(--__P__-dur-base) var(--__P__-ease)}@media(prefers-reduced-motion:reduce){.__P__-menu{animation:none}}@keyframes __P__-menu-in{0%{opacity:0;transform:translateY(-4px) scale(.98);transform-origin:top right}to{opacity:1;transform:none}}.__P__-menu-item{all:unset;display:flex;align-items:center;gap:10px;padding:8px 10px;font-size:var(--__P__-text-sm);color:var(--__P__-fg);border-radius:var(--__P__-radius-sm);cursor:pointer;user-select:none}.__P__-menu-item:hover{background:var(--__P__-bg-elevated)}.__P__-menu-item:focus-visible{background:var(--__P__-bg-elevated);outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-menu-item[disabled]{opacity:.45;cursor:not-allowed}.__P__-menu-icon{display:inline-flex;width:16px;height:16px;color:var(--__P__-fg-muted)}.__P__-menu-icon svg{width:16px;height:16px}.__P__-menu-label{flex:1}.__P__-menu-check{display:inline-flex;color:var(--__P__-accent-fg)}.__P__-menu-check svg{width:14px;height:14px}.__P__-menu-item-segmented{cursor:default}.__P__-menu-item-segmented:hover{background:transparent}.__P__-segmented{display:inline-flex;gap:2px;padding:2px;background:var(--__P__-bg-elevated);border-radius:var(--__P__-radius-sm)}.__P__-segment{all:unset;min-width:26px;padding:3px 8px;font-size:var(--__P__-text-xs);font-weight:600;letter-spacing:.02em;text-align:center;color:var(--__P__-fg-muted);border-radius:calc(var(--__P__-radius-sm) - 2px);cursor:pointer;transition:color .12s ease,background .12s ease}.__P__-segment:hover{color:var(--__P__-fg)}.__P__-segment[data-on=true]{background:var(--__P__-bg);color:var(--__P__-accent-fg);box-shadow:var(--__P__-shadow-card)}.__P__-segment:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-resize-grip{position:absolute;width:18px;height:18px;display:flex;align-items:center;justify-content:center;color:var(--__P__-fg-muted);opacity:.45;transition:opacity var(--__P__-dur-base) var(--__P__-ease);z-index:2;touch-action:none;user-select:none}.__P__-resize-grip:hover,.__P__-resize-grip:focus-visible{opacity:1}.__P__-resize-grip svg{width:10px;height:10px}.__P__-resize-grip--bottom-left{bottom:2px;left:2px;cursor:nesw-resize;transform:scaleX(-1)}.__P__-resize-grip--bottom-right{bottom:2px;right:2px;cursor:nwse-resize}.__P__-resize-grip--top-left{top:2px;left:2px;cursor:nwse-resize;transform:rotate(180deg)}.__P__-resize-grip--top-right{top:2px;right:2px;cursor:nesw-resize;transform:scaleY(-1)}:host(:not([data-mode="open"])) .__P__-resize-grip{display:none}.__P__-messenger{display:flex;flex-direction:column;overflow:hidden}.__P__-messenger-body,.__P__-messenger-pane{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.__P__-messenger-pane[hidden]{display:none}@keyframes __P__-view-in{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}.__P__-module{display:flex;flex-direction:column;height:100%;min-height:0}@media(prefers-reduced-motion:no-preference){.__P__-module,.__P__-history{animation:__P__-view-in .18s var(--__P__-ease-out)}}.__P__-module-scroll{flex:1;min-height:0;overflow-y:auto;padding:var(--__P__-space-3);display:flex;flex-direction:column;gap:var(--__P__-space-3)}.__P__-home{container-type:inline-size;background:radial-gradient(125% 65% at 88% 0%,color-mix(in srgb,#fff 16%,transparent),transparent 55%),linear-gradient(180deg,var(--__P__-accent) 0%,var(--__P__-accent) 22%,color-mix(in srgb,var(--__P__-accent) 28%,var(--__P__-surface)) 44%,var(--__P__-surface) 70%);border-radius:var(--__P__-radius-lg) var(--__P__-radius-lg) 0 0}.__P__-home-scroll{flex:1;min-height:0;overflow-y:auto;display:flex;flex-direction:column;background:transparent}.__P__-home-cards{display:flex;flex-direction:column;gap:var(--__P__-space-3);padding:4px 14px 16px}.__P__-module-pad{padding:var(--__P__-space-3) var(--__P__-space-3) 0}.__P__-module-empty{display:flex;flex-direction:column;align-items:center;gap:var(--__P__-space-3);padding:var(--__P__-space-8) var(--__P__-space-4);text-align:center;color:var(--__P__-fg-muted);font-size:var(--__P__-text-base)}.__P__-module-retry{padding:var(--__P__-space-2) var(--__P__-space-4);border:1px solid var(--__P__-border-strong);border-radius:var(--__P__-radius-sm);color:var(--__P__-fg);font-weight:600;cursor:pointer;transition:background var(--__P__-dur-quick) var(--__P__-ease-out),border-color var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-module-retry:hover{background:var(--__P__-hover);border-color:var(--__P__-accent)}.__P__-module-retry:active{background:var(--__P__-border)}.__P__-module-retry:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-help-list{flex:1;min-height:0;overflow-y:auto;padding-bottom:var(--__P__-space-3)}.__P__-help-group{display:flex;flex-direction:column}.__P__-help-section-title{position:sticky;top:0;z-index:1;margin:0;padding:var(--__P__-space-3) var(--__P__-space-5) var(--__P__-space-2);font-size:var(--__P__-text-xs);font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--__P__-fg-muted);background:var(--__P__-bg)}.__P__-help-card{margin:0 var(--__P__-space-3) var(--__P__-space-3);background:var(--__P__-surface);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);overflow:hidden}.__P__-help-card .__P__-list-row{border-bottom:0;border-radius:0}.__P__-help-card .__P__-list-row+.__P__-list-row{border-top:1px solid var(--__P__-border)}.__P__-tabbar{display:flex;border-top:1px solid var(--__P__-border);background:var(--__P__-bg-elevated);flex-shrink:0}.__P__-tab{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--__P__-space-1);min-height:48px;padding:var(--__P__-space-2) var(--__P__-space-1);color:var(--__P__-fg-muted);font-size:var(--__P__-text-xs);font-weight:600;transition:color var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-tab:hover{color:var(--__P__-fg)}.__P__-tab[aria-selected=true]{color:var(--__P__-accent-fg)}.__P__-tab:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-tab:active{background:var(--__P__-hover)}.__P__-tab-icon{position:relative;display:inline-flex}.__P__-tab-icon svg{width:22px;height:22px}.__P__-tab-badge{position:absolute;top:-2px;left:calc(50% + 6px);width:8px;height:8px;border-radius:50%;background:var(--__P__-accent);box-shadow:0 0 0 2px var(--__P__-bg-elevated)}.__P__-home-hero{flex-shrink:0;padding:var(--__P__-space-5) var(--__P__-space-5) var(--__P__-space-3);color:var(--__P__-on-accent);--__P__-focus: var(--__P__-on-accent)}.__P__-home-hero-top{display:flex;align-items:center;justify-content:space-between;gap:var(--__P__-space-3);min-height:32px}.__P__-home-brand{font-size:clamp(calc(12px * var(--__P__-text-scale)),calc(3.2cqi * var(--__P__-text-scale)),calc(14px * var(--__P__-text-scale)));font-weight:600;letter-spacing:.01em;color:color-mix(in srgb,#fff 82%,transparent);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.__P__-home-brand-spacer{flex:1}.__P__-home-hero-actions{display:flex;align-items:center;gap:var(--__P__-space-2);flex-shrink:0}.__P__-home-hero-actions .__P__-icon-btn{color:#fff}.__P__-home-hero-actions .__P__-icon-btn:hover{background:color-mix(in srgb,#fff 18%,transparent);color:#fff}.__P__-home-hero-actions .__P__-icon-btn:active{background:color-mix(in srgb,#fff 26%,transparent)}.__P__-home-greeting{margin:28px 0 0;font-family:var(--__P__-font-display);font-size:clamp(calc(19px * var(--__P__-text-scale)),calc(5.5cqi * var(--__P__-text-scale)),var(--__P__-text-2xl));font-weight:800;line-height:1.18;letter-spacing:-.01em;overflow-wrap:anywhere}.__P__-home-lead{margin:10px 0 0;font-family:var(--__P__-font-display);font-size:clamp(calc(15px * var(--__P__-text-scale)),calc(4.2cqi * var(--__P__-text-scale)),var(--__P__-text-xl));font-weight:600;line-height:1.25;letter-spacing:-.005em;color:color-mix(in srgb,var(--__P__-on-accent) 78%,transparent);overflow-wrap:anywhere}.__P__-home-avatars{display:flex}.__P__-home-avatar{width:30px;height:30px;border-radius:999px;overflow:hidden;margin-inline-start:-10px;border:2px solid color-mix(in srgb,#fff 92%,transparent);box-shadow:0 1px 3px #0000002e;background:var(--__P__-surface);display:inline-flex;align-items:center;justify-content:center;font-size:var(--__P__-text-xs);font-weight:700;color:var(--__P__-fg)}.__P__-home-avatar:first-child{margin-inline-start:0}.__P__-home-avatar img{width:100%;height:100%;object-fit:cover}.__P__-home-content{background:var(--__P__-surface);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);box-shadow:var(--__P__-shadow-card);overflow:hidden}.__P__-home-content-title{padding:var(--__P__-space-4) var(--__P__-space-4) var(--__P__-space-3);font-size:var(--__P__-text-sm);font-weight:700}.__P__-home-content-list{display:flex;flex-direction:column;padding:0 var(--__P__-space-2) var(--__P__-space-2)}.__P__-home-content-list .__P__-list-row+.__P__-list-row{border-top:1px solid var(--__P__-border)}.__P__-home-card{display:block;width:100%;text-align:start;background:var(--__P__-surface);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);padding:var(--__P__-space-4);box-shadow:var(--__P__-shadow-card)}.__P__-home-card[data-interactive=true]{cursor:pointer;transition:background var(--__P__-dur-quick) var(--__P__-ease-out),transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-home-card[data-interactive=true]:hover{background:var(--__P__-bg-elevated)}.__P__-home-card[data-interactive=true]:active{transform:translateY(1px)}.__P__-home-card[data-interactive=true]:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-home-recent-row{display:flex;align-items:center;gap:var(--__P__-space-3)}.__P__-home-recent-avatar{display:inline-flex;align-items:center;justify-content:center;width:38px;height:38px;flex-shrink:0;border-radius:999px;background:color-mix(in oklch,var(--__P__-accent) 14%,transparent);color:var(--__P__-accent-fg)}.__P__-home-recent-avatar svg{width:20px;height:20px}.__P__-home-recent-body{display:flex;flex-direction:column;gap:3px;min-width:0;flex:1}.__P__-home-recent-title{font-weight:600;font-size:calc(14px * var(--__P__-text-scale))}.__P__-home-recent-preview{color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.__P__-home-recent-dot{width:8px;height:8px;border-radius:999px;background:var(--__P__-accent);flex-shrink:0}.__P__-home-recent-row[data-unread=true] .__P__-home-recent-title{font-weight:700}.__P__-home-status{display:flex;align-items:center;gap:var(--__P__-space-3)}.__P__-home-status-icon svg{width:22px;height:22px;color:var(--__P__-success)}.__P__-home-status[data-level=degraded] .__P__-home-status-icon svg{color:var(--__P__-warning)}.__P__-home-status[data-level=down] .__P__-home-status-icon svg{color:var(--__P__-danger)}.__P__-home-status-text{font-weight:600;font-size:calc(14px * var(--__P__-text-scale))}.__P__-home-search{display:flex;align-items:center;gap:var(--__P__-space-2);width:100%;padding:var(--__P__-space-3) var(--__P__-space-4);border-radius:var(--__P__-radius);border:1px solid var(--__P__-border);background:var(--__P__-surface);text-align:start}.__P__-home-search[data-input=true]{background:var(--__P__-bg-elevated)}.__P__-home-search:hover{border-color:var(--__P__-border-strong)}.__P__-home-search:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-home-search[data-input=true]:focus-within{outline:none;border-color:var(--__P__-focus)}.__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-input:focus-visible{outline:none}.__P__-home-search-icon svg{width:18px;height:18px;color:var(--__P__-accent-fg)}.__P__-list-row{display:flex;align-items:center;gap:var(--__P__-space-3);width:100%;min-height:44px;text-align:start;padding:var(--__P__-space-3) var(--__P__-space-2);border-radius:var(--__P__-radius-sm)}.__P__-list-row:hover{background:var(--__P__-hover)}.__P__-list-row:active{background:var(--__P__-border)}.__P__-list-row:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-list-row-body{display:flex;flex-direction:column;min-width:0;flex:1}.__P__-list-row-title{font-weight:600;font-size:var(--__P__-text-md);line-height:1.35}.__P__-list-row-sub{color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);margin-top:var(--__P__-space-1);line-height:1.45;display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.__P__-list-row-chevron svg{width:18px;height:18px;color:var(--__P__-accent-fg);flex-shrink:0}.__P__-back-header{display:flex;align-items:center;gap:var(--__P__-space-2);padding:10px 12px;border-bottom:1px solid var(--__P__-border);flex-shrink:0}.__P__-back-title{flex:1;text-align:center;font-size:var(--__P__-text-md);font-weight:700;margin:0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-back-spacer{width:32px;height:1px}.__P__-history>*,.__P__-home-scroll>*,.__P__-module-scroll>*,.__P__-help-list>*,.__P__-history-footer>*,.__P__-module-pad{width:100%;max-width:var(--__P__-conversation-max, 768px);margin-inline:auto}.__P__-header,.__P__-back-header{padding-inline:max(12px,calc((100% - var(--__P__-conversation-max, 768px)) / 2))}.__P__-tabbar{padding-inline:max(0px,calc((100% - var(--__P__-conversation-max, 768px)) / 2))}.__P__-content{display:flex;flex-direction:column;gap:14px;width:100%;max-width:68ch;margin:0 auto}.__P__-content-hero{width:100%;border-radius:var(--__P__-radius)}.__P__-content-subtitle{color:var(--__P__-fg-muted);margin:0}.__P__-content-frame{flex:1;min-height:0;width:100%;border:0;background:#fff}.__P__-news-list{display:flex;flex-direction:column;gap:var(--__P__-space-3)}.__P__-news-card{display:block;width:100%;text-align:start;border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);overflow:hidden;background:var(--__P__-surface)}.__P__-news-card{transition:background var(--__P__-dur-quick) var(--__P__-ease-out),transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-news-card:hover{background:var(--__P__-bg-elevated)}.__P__-news-card:active{transform:translateY(1px)}.__P__-news-card:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-news-hero{width:100%;display:block}.__P__-news-body{display:flex;flex-direction:column;gap:6px;padding:14px 16px}.__P__-news-title{font-weight:700;font-size:var(--__P__-text-md)}.__P__-news-summary{color:var(--__P__-fg-muted);font-size:calc(14px * var(--__P__-text-scale));display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.__P__-modules-empty{display:flex;align-items:center;justify-content:center;position:relative}.__P__-modules-empty-close{position:absolute;top:12px;inset-inline-end:12px}.__P__-modules-empty-text{color:var(--__P__-fg-muted);font-size:var(--__P__-text-base)}.__P__-form{display:flex;flex-direction:column;gap:var(--__P__-space-4)}.__P__-field{display:flex;flex-direction:column;gap:6px}.__P__-field-head{display:flex;flex-wrap:wrap;align-items:baseline;gap:var(--__P__-space-2)}.__P__-field-label{font-size:var(--__P__-text-sm);font-weight:600;color:var(--__P__-fg)}.__P__-field-req{color:var(--__P__-danger)}.__P__-field-type{flex-shrink:0;align-self:center;margin-inline-start:auto;border:1px solid var(--__P__-border);border-radius:5px;background:color-mix(in oklab,var(--__P__-fg-muted) 9%,transparent);padding:1px 7px;font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted);white-space:nowrap}.__P__-field-input{width:100%;min-width:0;max-width:100%;box-sizing:border-box;padding:10px var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:var(--__P__-bg);color:var(--__P__-fg);font:inherit;font-size:var(--__P__-text-sm);resize:vertical;transition:border-color var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-field-input:focus-visible{outline:none;border-color:var(--__P__-accent)}.__P__-field[data-invalid=true] .__P__-field-input{border-color:var(--__P__-danger)}.__P__-field-input[type=date],.__P__-field-input[type=time]{appearance:none;-webkit-appearance:none}@media(pointer:coarse){.__P__-textarea,.__P__-home-search-input,.__P__-field-input{font-size:max(16px,calc(16px * var(--__P__-text-scale)))}}.__P__-field-hint{font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted)}.__P__-field-error{font-size:var(--__P__-text-xs);color:var(--__P__-danger)}.__P__-field-choices{display:flex;flex-direction:column;gap:10px;padding-top:2px}.__P__-choice{display:flex;align-items:flex-start;gap:10px;font-size:var(--__P__-text-sm);color:var(--__P__-fg);cursor:pointer}.__P__-choice input{margin-top:2px;accent-color:var(--__P__-accent)}.__P__-form-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:var(--__P__-space-2);margin-top:var(--__P__-space-2)}.__P__-form-hint{flex:1 1 auto;min-width:6rem;margin-inline-end:auto;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted)}.__P__-form-submit{padding:var(--__P__-space-2) var(--__P__-space-4);border:none;border-radius:var(--__P__-radius-md);background:var(--__P__-accent);color:var(--__P__-accent-text, #fff);font:inherit;font-weight:600;font-size:var(--__P__-text-sm);white-space:nowrap;flex-shrink:0;cursor:pointer;transition:filter var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-form-submit:hover:not(:disabled){filter:brightness(1.06)}.__P__-form-submit:disabled{opacity:.6;cursor:default}.__P__-form-skip{padding:var(--__P__-space-2) var(--__P__-space-4);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:transparent;color:var(--__P__-fg-muted);font:inherit;font-size:var(--__P__-text-sm);white-space:nowrap;flex-shrink:0;cursor:pointer;transition:background var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-form-skip:hover:not(:disabled){background:var(--__P__-bg-elevated)}@media(max-width:640px){.__P__-form-hint{flex-basis:100%;margin-inline-end:0;font-size:var(--__P__-text-xs)}.__P__-form-submit,.__P__-form-skip{flex:1 1 0;text-align:center}}.__P__-form-gate{display:flex;flex-direction:column;gap:var(--__P__-space-3);padding:var(--__P__-space-4);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:var(--__P__-bg-elevated)}.__P__-form-gate-title{margin:0;font-size:var(--__P__-text-base);font-weight:700;color:var(--__P__-fg)}.__P__-form-gate-desc{margin:0 0 var(--__P__-space-1);font-size:var(--__P__-text-sm);color:var(--__P__-fg-muted)}.__P__-form-done{display:flex;align-items:center;justify-content:center;gap:6px;padding:6px 12px;border:1px dashed var(--__P__-border);border-radius:999px;align-self:center;font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted)}.__P__-form-done svg{width:14px;height:14px;color:var(--__P__-success, #22c55e)}.__P__-form-done[data-outcome=skipped] svg{color:var(--__P__-fg-muted)}.__P__-form-done-fill{border:0;background:none;padding:0 2px;cursor:pointer;font:inherit;font-weight:600;color:var(--__P__-accent-fg)}.__P__-form-done-fill:hover{text-decoration:underline}details.__P__-form-done{display:block;padding:0;border-radius:var(--__P__-radius-md)}details[open].__P__-form-done{width:min(100%,420px);background:var(--__P__-surface)}.__P__-form-done-summary{display:flex;align-items:center;justify-content:center;gap:6px;padding:8px 12px;cursor:pointer;list-style:none}.__P__-form-done-summary::-webkit-details-marker{display:none}.__P__-form-done-summary>svg:last-child{color:var(--__P__-fg-muted);transition:transform .15s var(--__P__-ease)}details[open]>.__P__-form-done-summary>svg:last-child{transform:rotate(90deg)}.__P__-form-answers{margin:0;padding:var(--__P__-space-2) var(--__P__-space-3) var(--__P__-space-3);display:grid;gap:var(--__P__-space-3);text-align:start}.__P__-form-answer{display:grid;gap:6px}.__P__-form-answer dt{font-size:var(--__P__-text-sm);font-weight:600;color:var(--__P__-fg)}.__P__-form-answer dd{margin:0;padding:10px var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:var(--__P__-bg);font-size:var(--__P__-text-sm);font-weight:400;color:var(--__P__-fg);overflow-wrap:anywhere}.__P__-toolui{margin-block:var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-lg, 14px);background:var(--__P__-bg-elevated);font-size:var(--__P__-text-sm)}.__P__-toolui:not(.__P__-toolui-collapsible){display:flex;flex-direction:column;gap:var(--__P__-space-3);padding:var(--__P__-space-4)}.__P__-toolui-group{display:flex;flex-direction:column;gap:var(--__P__-space-3);margin-block:var(--__P__-space-3)}.__P__-toolui-group>.__P__-toolui{margin-block:0}.__P__-toolui-stale{opacity:.7}details.__P__-toolui-collapsible>summary{display:flex;align-items:center;gap:var(--__P__-space-2);padding:var(--__P__-space-3) var(--__P__-space-4);cursor:pointer;list-style:none;-webkit-tap-highlight-color:transparent;user-select:none}details.__P__-toolui-collapsible>summary::-webkit-details-marker{display:none}details.__P__-toolui-collapsible[open]>summary{border-bottom:1px solid var(--__P__-border)}details.__P__-toolui-collapsible>.__P__-toolui-section{margin:var(--__P__-space-4)}details.__P__-toolui-collapsible>.__P__-toolui-section~.__P__-toolui-section{margin-top:calc(-1 * var(--__P__-space-2))}.__P__-toolui-name-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-toolui-chevron{display:inline-flex;color:var(--__P__-fg-muted);transition:transform var(--__P__-dur-quick) var(--__P__-ease-out)}details.__P__-toolui-collapsible>summary .__P__-toolui-status{margin-inline-start:auto}.__P__-toolui-chevron svg{width:16px;height:16px}details.__P__-toolui-collapsible[open]>summary .__P__-toolui-chevron{transform:rotate(180deg)}.__P__-toolui-badge,.__P__-toolui-name-pill,.__P__-toolui-q-pill{--__P__-pill: var(--__P__-fg-muted);display:inline-flex;min-width:0;align-items:center;gap:5px;padding:3px 7px;border-radius:5px;border:1px solid var(--__P__-border);background:color-mix(in oklab,var(--__P__-fg-muted) 9%,transparent);color:var(--__P__-pill);font-size:var(--__P__-text-xs);font-weight:600;white-space:nowrap}.__P__-toolui-badge svg,.__P__-toolui-name-pill svg,.__P__-toolui-q-pill svg{flex-shrink:0;width:14px;height:14px}.__P__-toolui-status-icon{display:inline-flex}.__P__-toolui-name-pill{--__P__-pill: oklch(.68 .13 233)}.__P__-toolui-q-pill{--__P__-pill: oklch(.66 .12 195)}.__P__-toolui-status[data-status=completed]{--__P__-pill: var(--__P__-success, #16a34a)}.__P__-toolui-status[data-status=responded]{--__P__-pill: oklch(.62 .15 255)}.__P__-toolui-status[data-status=awaiting]{--__P__-pill: var(--__P__-warning, #f59e0b)}.__P__-toolui-status[data-status=denied]{--__P__-pill: oklch(.66 .16 45)}.__P__-toolui-status[data-status=error]{--__P__-pill: var(--__P__-danger, #dc2626)}.__P__-toolui-status[data-status=superseded]{--__P__-pill: var(--__P__-fg-muted)}@supports (color: oklch(from red l c h)){.__P__-toolui-badge,.__P__-toolui-name-pill,.__P__-toolui-q-pill{color:oklch(from var(--__P__-pill) clamp(var(--__P__-pill-l-min),l,var(--__P__-pill-l-max)) c h)}}.__P__-toolui-head{display:flex;align-items:center;flex-wrap:wrap;gap:var(--__P__-space-2)}.__P__-toolui-head-end{display:inline-flex;align-items:center;gap:var(--__P__-space-2);margin-inline-start:auto}.__P__-toolui-collapse-body{display:flex;flex-direction:column;gap:var(--__P__-space-3);padding:var(--__P__-space-4)}.__P__-toolui-summary{display:flex;flex-direction:column;gap:var(--__P__-space-3)}.__P__-toolui-collapse-body>.__P__-form{gap:var(--__P__-space-3)}.__P__-toolui-collapse-body>.__P__-form>.__P__-field,.__P__-toolui-summary>.__P__-field{padding:10px var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:color-mix(in oklab,var(--__P__-bg) 80%,transparent);line-height:1.5}.__P__-toolui-collapse-body>.__P__-form>.__P__-field{gap:var(--__P__-space-2)}.__P__-toolui-summary>.__P__-field{gap:var(--__P__-space-1)}.__P__-toolui-summary .__P__-field-label{color:var(--__P__-fg-muted)}.__P__-toolui-answer{margin:0;font-size:var(--__P__-text-sm);color:var(--__P__-fg-muted);overflow-wrap:anywhere;white-space:pre-wrap}.__P__-toolui-footer{display:flex;align-items:center;justify-content:space-between;gap:var(--__P__-space-3);margin-inline:calc(-1 * var(--__P__-space-4));padding:var(--__P__-space-3) var(--__P__-space-4) 0;border-top:1px solid var(--__P__-border)}.__P__-toolui-options-toggle{display:inline-flex;align-items:center;gap:4px;border:0;background:transparent;padding:0;cursor:pointer;font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted);transition:color var(--__P__-dur-quick) var(--__P__-ease)}.__P__-toolui-options-toggle:hover{color:var(--__P__-fg)}.__P__-toolui-options-chevron{display:inline-flex;transition:transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-toolui-options-chevron svg{width:14px;height:14px}.__P__-toolui-options-chevron.__P__-open{transform:rotate(180deg)}.__P__-toolui-desc{margin:0;padding:var(--__P__-space-3);border-radius:var(--__P__-radius-md);background:var(--__P__-bg);border:1px solid var(--__P__-border);color:var(--__P__-fg-muted);line-height:1.5}.__P__-toolui-section{display:flex;flex-direction:column;gap:8px;padding:var(--__P__-space-3);border-radius:var(--__P__-radius-md);background:var(--__P__-bg);border:1px solid var(--__P__-border)}.__P__-toolui:not(.__P__-toolui-collapsible) .__P__-toolui-section,.__P__-toolui:not(.__P__-toolui-collapsible) .__P__-toolui-desc{padding:0;background:none;border:0;border-radius:0}.__P__-toolui-label{font-size:var(--__P__-text-xs);font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--__P__-fg-muted)}.__P__-toolui-code{margin:0;max-height:240px;overflow:auto;color:var(--__P__-fg);font-family:var(--__P__-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);font-size:var(--__P__-text-xs);line-height:1.5;white-space:pre-wrap;word-break:break-word}.__P__-toolui-code[data-error=true]{color:var(--__P__-danger, #dc2626)}.__P__-toolui-body{gap:6px}.__P__-toolui-prompt{margin:0;font-weight:600;color:var(--__P__-fg);overflow-wrap:anywhere}.__P__-toolui-subtle{margin:0;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted);line-height:1.5}.__P__-toolui-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:var(--__P__-space-2);margin-top:var(--__P__-space-2)}:host([dir="rtl"]) .__P__-icon-dir{transform:scaleX(-1)}:host([dir="rtl"]) .__P__-field-input[type=date],:host([dir="rtl"]) .__P__-field-input[type=time]{position:relative;text-align:right;padding-left:34px}:host([dir="rtl"]) .__P__-field-input[type=date]::-webkit-datetime-edit,:host([dir="rtl"]) .__P__-field-input[type=time]::-webkit-datetime-edit{text-align:right}:host([dir="rtl"]) .__P__-field-input[type=date]::-webkit-calendar-picker-indicator,:host([dir="rtl"]) .__P__-field-input[type=time]::-webkit-calendar-picker-indicator{position:absolute;left:var(--__P__-space-3);margin:0}
|
|
4
|
+
`;var ks=`.__P__-standalone-page{margin:0;height:100vh;background:var(--__P__-bg, #fff);display:grid;place-items:stretch}
|
|
5
|
+
`;var ws=`: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 rp="helpai",ap="#5B5BD6",ip="#FFFFFF",sp="12px",lp="Inter, system-ui, -apple-system, 'Segoe UI', sans-serif",Ia=[Ps,xs,Ss,ks,ws].join(`
|
|
7
|
+
`).replace(/__P__/g,rp).replaceAll("__BRAND_ACCENT_TEXT__",ip).replaceAll("__BRAND_ACCENT__",ap).replaceAll("__BRAND_RADIUS__",sp).replaceAll("__BRAND_FONT__",lp);var cp=te.scope("mount"),Cs=new WeakMap,Rs={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 Ts(e,t){e.style.cssText=Rs[t]}function Qn(e){return e==="floating"||e==="modal"||e==="drawer"?"floating":e==="standalone"||e==="page"?"viewport":"flow"}function Vo(e={}){let t=e.position??"flow";cp.debug("createShadowMount",{position:t,hasTarget:!!e.target,hasHost:!!e.existingHost});let n=`${T.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",T.id),o.style.cssText=Rs[t];let r=o.shadowRoot??o.attachShadow({mode:"open"}),a=o.ownerDocument;if(!dp(r,a)){let l=a.createElement("style");l.textContent=Ia,r.appendChild(l)}let s=document.createElement("div");return s.className=`${T.cssPrefix}-app`,r.appendChild(s),{appRoot:s,destroy:()=>o.remove(),hostElement:o,shadowRoot:r}}function dp(e,t){if(!("adoptedStyleSheets"in e))return!1;let n=t.defaultView;if(!n||typeof n.CSSStyleSheet!="function")return!1;let o=Cs.get(t);if(!o)try{o=new n.CSSStyleSheet,o.replaceSync(Ia),Cs.set(t,o)}catch{return!1}try{return e.adoptedStyleSheets=[o],!0}catch{return!1}}function up(e,t){let n=T.cssPrefix;t.accent&&e.style.setProperty(`--${n}-accent-user`,t.accent),t.accentText&&e.style.setProperty(`--${n}-accent-text-user`,t.accentText),t.radius&&e.style.setProperty(`--${n}-radius`,t.radius),t.fontFamily&&e.style.setProperty(`--${n}-font`,t.fontFamily),t.contentMaxWidth&&e.style.setProperty(`--${n}-conversation-max`,t.contentMaxWidth)}function _p(e,t){e.dataset.theme=t}function pp(e,t){let n=T.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 fp(e,t){e.dataset.position=t}function Wo(e,t){e.dataset.mode=t}function Is(e,t){_p(e,t.themeMode),up(e,t.themeOverrides),fp(e,t.position),pp(e,t.size)}var mp=te.scope("iframe"),gp='<!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 Ms(e,t,n="closed",o="floating",r=null){mp.debug("createIframeMount",{position:t,initialMode:n,layoutMode:o,hasTarget:!!r});let a=document.createElement("iframe");a.title=`${T.name} chat`,a.setAttribute("allow","microphone; clipboard-write"),As(a,t,n,o),(o==="inline"&&r?r:document.body).appendChild(a);let l=a.contentDocument;if(!l)throw new Error("iframe contentDocument unavailable (cross-origin?)");l.open(),l.write(gp),l.close();let c=Vo({...e,target:l.body}),d=new MutationObserver(()=>{As(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 Ko="border:0;background:transparent;z-index:2147483647;pointer-events:auto;",Es={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 As(e,t,n,o){if(n==="fullscreen"||o==="standalone"){e.style.cssText=`${Ko}position:fixed;inset:0;width:100vw;height:100vh;`;return}if(o==="inline"){e.style.cssText=`${Ko}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=`${Ko}position:fixed;inset:0;width:100vw;height:100vh;`;return}let a=t.startsWith("top-")?"top":"bottom",s=t.endsWith("-left")?"left":"right",{w:l,h:c}=Es[n]??Es.open;e.style.cssText=`${Ko}position:fixed;${a}:16px;${s}:16px;width:${l};height:${c};`}var Go=class{constructor(){se(this,"handlers",new Map)}on(t,n){let o=this.handlers.get(t);return o||(o=new Set,this.handlers.set(t,o)),o.add(n),()=>this.handlers.get(t)?.delete(n)}emit(t,n){let o=this.handlers.get(t);if(o)for(let r of o)try{r(n)}catch{}}clear(){this.handlers.clear()}};var xn,De,Ea,Ls,Xn=0,Us=[],He=ee,Os=He.__b,Ns=He.__r,Ds=He.diffed,$s=He.__c,Fs=He.unmount,Bs=He.__;function Qo(e,t){He.__h&&He.__h(De,e,Xn||t),Xn=0;var n=De.__H||(De.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function $(e){return Xn=1,zs(qs,e)}function zs(e,t,n){var o=Qo(xn++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):qs(void 0,t),function(l){var c=o.__N?o.__N[0]:o.__[0],d=o.t(c,l);c!==d&&(o.__N=[d,o.__[1]],o.__c.setState({}))}],o.__c=De,!De.__f)){var r=function(l,c,d){if(!o.__c.__H)return!0;var _=!1,p=o.__c.props!==l;if(o.__c.__H.__.some(function(m){if(m.__N){_=!0;var g=m.__[0];m.__=m.__N,m.__N=void 0,g!==m.__[0]&&(p=!0)}}),a){var u=a.call(this,l,c,d);return _?u||p:u}return!_||p};De.__f=!0;var a=De.shouldComponentUpdate,s=De.componentWillUpdate;De.componentWillUpdate=function(l,c,d){if(this.__e){var _=a;a=void 0,r(l,c,d),a=_}s&&s.call(this,l,c,d)},De.shouldComponentUpdate=r}return o.__N||o.__}function O(e,t){var n=Qo(xn++,3);!He.__s&&Ma(n.__H,t)&&(n.__=e,n.u=t,De.__H.__h.push(n))}function xt(e,t){var n=Qo(xn++,4);!He.__s&&Ma(n.__H,t)&&(n.__=e,n.u=t,De.__h.push(n))}function N(e){return Xn=5,oe(function(){return{current:e}},[])}function oe(e,t){var n=Qo(xn++,7);return Ma(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function L(e,t){return Xn=8,oe(function(){return e},t)}function vp(){for(var e;e=Us.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(jo),t.__h.some(Aa),t.__h=[]}catch(n){t.__h=[],He.__e(n,e.__v)}}}He.__b=function(e){De=null,Os&&Os(e)},He.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Bs&&Bs(e,t)},He.__r=function(e){Ns&&Ns(e),xn=0;var t=(De=e.__c).__H;t&&(Ea===De?(t.__h=[],De.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(jo),t.__h.some(Aa),t.__h=[],xn=0)),Ea=De},He.diffed=function(e){Ds&&Ds(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Us.push(t)!==1&&Ls===He.requestAnimationFrame||((Ls=He.requestAnimationFrame)||hp)(vp)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Ea=De=null},He.__c=function(e,t){t.some(function(n){try{n.__h.some(jo),n.__h=n.__h.filter(function(o){return!o.__||Aa(o)})}catch(o){t.some(function(r){r.__h&&(r.__h=[])}),t=[],He.__e(o,n.__v)}}),$s&&$s(e,t)},He.unmount=function(e){Fs&&Fs(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(o){try{jo(o)}catch(r){t=r}}),n.__H=void 0,t&&He.__e(t,n.__v))};var Hs=typeof requestAnimationFrame=="function";function hp(e){var t,n=function(){clearTimeout(o),Hs&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);Hs&&(t=requestAnimationFrame(n))}function jo(e){var t=De,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),De=t}function Aa(e){var t=De;e.__c=e.__(),De=t}function Ma(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function qs(e,t){return typeof t=="function"?t(e):t}var bp=Symbol.for("preact-signals");function Zo(){if(Mt>1)Mt--;else{var e,t=!1;for((function(){var r=Yo;for(Yo=void 0;r!==void 0;){var a=r.S;if(a.v===r.v)for(var s=a.t;s!==void 0;s=s.x)s.i===r.i&&(s.i=a.i);r=r.o}})();Jn!==void 0;){var n=Jn;for(Jn=void 0,Xo++;n!==void 0;){var o=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Ws(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if(Xo=0,Mt--,t)throw e}}function ht(e){if(Mt>0)return e();La=++yp,Mt++;try{return e()}finally{Zo()}}var Yn,Te=void 0;function Zn(e){var t=Te,n=Yn;Te=void 0,Yn=void 0;try{return e()}finally{Te=t,Yn=n}}var Jn=void 0,Mt=0,Xo=0,yp=0,La=0,Yo=void 0,Jo=0;function Vs(e){if(Te!==void 0){var t=e.n;if(t===void 0||t.t!==Te)return t={i:0,S:e,p:Te.s,n:void 0,t:Te,e:void 0,x:void 0,r:t},Te.s!==void 0&&(Te.s.n=t),Te.s=t,e.n=t,32&Te.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=Te.s,t.n=void 0,Te.s.n=t,Te.s=t),t}}function je(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}je.prototype.brand=bp;je.prototype.h=function(){return!0};je.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:Zn(function(){var o;(o=t.W)==null||o.call(t)}))};je.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&&Zn(function(){var r;(r=t.Z)==null||r.call(t)}))}};je.prototype.subscribe=function(e){var t=this;return Lt(function(){var n=t.value;Zn(function(){return e(n)})},{name:"sub"})};je.prototype.valueOf=function(){return this.value};je.prototype.toString=function(){return this.value+""};je.prototype.toJSON=function(){return this.value};je.prototype.peek=function(){var e=this;return Zn(function(){return e.value})};Object.defineProperty(je.prototype,"value",{get:function(){var e=Vs(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Xo>100)throw new Error("Cycle detected");(function(n){Mt!==0&&Xo===0&&n.l!==La&&(n.l=La,Yo={S:n,v:n.v,i:n.i,o:Yo})})(this),this.v=e,this.i++,Jo++,Mt++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Zo()}}}});function ne(e,t){return new je(e,t)}function Ws(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 Ks(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 Gs(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 Zt(e,t){je.call(this,void 0,t),this.x=e,this.s=void 0,this.g=Jo-1,this.f=4}Zt.prototype=new je;Zt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Jo))return!0;if(this.g=Jo,this.f|=1,this.i>0&&!Ws(this))return this.f&=-2,!0;var e=Te;try{Ks(this),Te=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 Te=e,Gs(this),this.f&=-2,!0};Zt.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)}je.prototype.S.call(this,e)};Zt.prototype.U=function(e){if(this.t!==void 0&&(je.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)}};Zt.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(Zt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Vs(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function pe(e,t){return new Zt(e,t)}function js(e){var t=e.m;if(e.m=void 0,typeof t=="function"){Mt++;var n=Te;Te=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,Oa(e),o}finally{Te=n,Zo()}}}function Oa(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,js(e)}function Pp(e){if(Te!==this)throw new Error("Out-of-order effect");Gs(this),Te=e,this.f&=-2,8&this.f&&Oa(this),Zo()}function Sn(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,Yn&&Yn.push(this)}Sn.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()}};Sn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,js(this),Ks(this),Mt++;var e=Te;return Te=this,Pp.bind(this,e)};Sn.prototype.N=function(){2&this.f||(this.f|=2,this.u=Jn,Jn=this)};Sn.prototype.d=function(){this.f|=8,1&this.f||Oa(this)};Sn.prototype.dispose=function(){this.d()};function Lt(e,t){var n=new Sn(e,t);try{n.c()}catch(r){throw n.d(),r}var o=n.d.bind(n);return o[Symbol.dispose]=o,o}var Qs,nr,er,xp=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var Xs=[];Lt(function(){Qs=this.N})();function kn(e,t){ee[e]=t.bind(null,ee[e]||function(){})}function tr(e){if(er){var t=er;er=void 0,t()}er=e&&e.S()}function Ys(e){var t=this,n=e.data,o=gt(n);o.value=n;var r=oe(function(){for(var l=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var d=pe(function(){var m=o.value.value;return m===0?0:m===!0?"":m||""}),_=pe(function(){return!Array.isArray(d.value)&&!da(d.value)}),p=Lt(function(){if(this.N=Js,_.value){var m=d.value;l.__v&&l.__v.__e&&l.__v.__e.nodeType===3&&(l.__v.__e.data=m)}}),u=t.__$u.d;return t.__$u.d=function(){p(),u.call(this)},[_,d]},[]),a=r[0],s=r[1];return a.value?s.peek():s.value}Ys.displayName="ReactiveTextNode";Object.defineProperties(je.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Ys},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});kn("__b",function(e,t){if(typeof t.type=="string"){var n,o=t.props;for(var r in o)if(r!=="children"){var a=o[r];a instanceof je&&(n||(t.__np=n={}),n[r]=a,o[r]=a.peek())}}e(t)});kn("__r",function(e,t){if(e(t),t.type!==de){tr();var n,o=t.__c;o&&(o.__$f&=-2,(n=o.__$u)===void 0&&(o.__$u=n=(function(r,a){var s;return Lt(function(){s=this},{name:a}),s.c=r,s})(function(){var r;xp&&((r=n.y)==null||r.call(n)),o.__$f|=1,o.setState({})},typeof t.type=="function"?t.type.displayName||t.type.name:""))),nr=o,tr(n)}});kn("__e",function(e,t,n,o){tr(),nr=void 0,e(t,n,o)});kn("diffed",function(e,t){tr(),nr=void 0;var n;if(typeof t.type=="string"&&(n=t.__e)){var o=t.__np,r=t.props,a=n.U;if(a)for(var s in a){var l=a[s];l===void 0||o&&s in o||(l.d(),a[s]=void 0)}if(o){a||(a={},n.U=a);for(var c in o){var d=a[c],_=o[c];d===void 0?(d=Sp(n,c,_,r),a[c]=d):d.o(_,r)}}}e(t)});function Sp(e,t,n,o){var r=t in e&&e.ownerSVGElement===void 0,a=ne(n);return{o:function(s,l){a.value=s,o=l},d:Lt(function(){this.N=Js;var s=a.value.value;o[t]!==s&&(o[t]=s,r?e[t]=s:s!=null&&(s!==!1||t[4]==="-")?e.setAttribute(t,s):e.removeAttribute(t))})}}kn("unmount",function(e,t){if(typeof t.type=="string"){var n=t.__e;if(n){var o=n.U;if(o){n.U=void 0;for(var r in o){var a=o[r];a&&a.d()}}}var s=t.__np;if(s){var l=t.props;for(var c in s)l[c]=s[c]}t.__np=void 0}else{var d=t.__c;if(d){var _=d.__$u;_&&(d.__$u=void 0,_.d())}}e(t)});kn("__h",function(e,t,n,o){o<3&&(t.__$f|=2),e(t,n,o)});lt.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,o=n&&n.s!==void 0;for(var r in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var a=2&this.__$f;if(!(o||a||4&this.__$f)||1&this.__$f)return!0}else if(!(o||4&this.__$f)||3&this.__$f)return!0;for(var s in e)if(s!=="__source"&&e[s]!==this.props[s])return!0;for(var l in this.props)if(!(l in e))return!0;return!1};function gt(e,t){return oe(function(){return ne(e,t)},[])}function dt(e,t){var n=N(e);return n.current=e,nr.__$f|=4,oe(function(){return pe(function(){return n.current()},t)},[])}var kp=function(e){queueMicrotask(function(){queueMicrotask(e)})};function wp(){ht(function(){for(var e;e=Xs.shift();)Qs.call(e)})}function Js(){Xs.push(this)===1&&(ee.requestAnimationFrame||kp)(wp)}function Zs(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function el(e){return Zs(e)}function tl(e){return!(!Zs(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}function or(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 Cp=900,Rp=640;function Na(e,t,n){if(e==="standalone"||e==="page")return"fullscreen";let o=t.initialSize;return o==="expanded"||o==="fullscreen"||o==="normal"?o:n>0&&n<Rp?"fullscreen":n>=(t.autoSizeBreakpoint??Cp)?"expanded":"normal"}function eo(e,t,n,o=null){let a=e.mode==="inline"||e.mode==="standalone"||e.mode==="page"||(n??!e.startMinimized),l=e.mode!=="standalone"&&e.mode!=="page"&&e.mode!=="inline"&&o?o:Na(e.mode,e.size,t);return{panelOpen:a,panelSize:l}}function wn(){return typeof window>"u"?0:window.innerWidth}var Tp="x-public-key",Ip="x-ai-agent-deployment-id";function nl(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");return{headers(){let t={[Ip]:e.aiAgentDeploymentId};return e.publicKey&&(t[e.publicKeyHeader??Tp]=e.publicKey),t}}}function to(e,t){return new Promise(n=>{if(t?.aborted)return n();let o=setTimeout(a,e),r=()=>a();t?.addEventListener("abort",r,{once:!0});function a(){clearTimeout(o),t?.removeEventListener("abort",r),n()}})}var Qe=class extends Error{constructor(n,o,r,a){super(n);se(this,"code",o);se(this,"status",r);se(this,"cause",a);this.name="StreamError"}};var ol=te.scope("parser");async function*rl(e,t,n){if(!e.ok){let o=await e.text().catch(()=>"");throw new Qe(`server responded ${e.status}: ${o.slice(0,200)}`,"server",e.status)}for await(let o of Ep(e,t)){let r=Ap(o,n);if(r==="done")return;r&&(yield r)}}async function*Ep(e,t){if(!e.body)throw new Qe("response has no body","no-body");let n=e.body.pipeThrough(new TextDecoderStream).getReader(),o="";try{for(;;){if(t.aborted)throw new DOMException("aborted","AbortError");let{done:r,value:a}=await n.read();if(r){let l=o.trim();l&&(yield l);return}o+=a;let s;for(;(s=o.indexOf(`
|
|
8
8
|
|
|
9
|
-
`))!==-1;){let l=o.slice(0,s);o=o.slice(s+2),yield l}}}finally{n.releaseLock()}}function
|
|
9
|
+
`))!==-1;){let l=o.slice(0,s);o=o.slice(s+2),yield l}}}finally{n.releaseLock()}}function Ap(e,t){let n="",o;for(let r of e.split(`
|
|
10
10
|
`))if(r!==""){if(r.startsWith(":")){t?.(r.slice(1).trim());continue}if(r.startsWith("data:")){let a=r.slice(5).replace(/^ /,"");n=n?`${n}
|
|
11
|
-
${a}`:a;continue}r.startsWith("id:")&&(o=r.slice(3).trim())}if(n==="[DONE]")return"done";if(!n)return null;try{let r=JSON.parse(n);return el.trace("chunk",{type:r.type,eventId:o}),{chunk:r,eventId:o}}catch(r){throw el.trace("frame parse failed",{err:r,payload:n.slice(0,200)}),new He("invalid SSE frame","network",void 0,r)}}function kp(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 nl=e=>e&&Object.keys(e).length>0?e:void 0;function ol(e,t){let n=nl(e),o=nl(t);if(!n&&!o)return;let r={};return n&&(r.user=n),o&&(r.page=o),kp(JSON.stringify(r))}function Zo(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function wp(e){return`tool-${e.startsWith("tool:")?e.slice(5):e}`}function rl(e){return e.startsWith("tool-")?e.slice(5):e}var nt={handshake:"/pai/handshake",streamMessage:"/pai/stream-message",streamResume:"/pai/stream-resume",cancelStream:"/pai/cancel-stream",listConversations:"/pai/list-conversations",listMessages:"/pai/list-messages",updateSettings:"/pai/update-settings",markRead:"/pai/mark-read",messageFeedback:"/pai/message-feedback",requestOperator:"/pai/request-operator",cancelOperatorRequest:"/pai/cancel-request-operator",bootstrap:"/pai/bootstrap",content:"/pai/content",submitForm:"/pai/submit-form"},al="context";function Bt(e){let t=e??{},n=t.controlMode;return{controlMode:n==="awaiting_operator"||n==="operator"?n:"ai-agent",controlRevision:typeof t.controlRevision=="number"&&Number.isSafeInteger(t.controlRevision)&&t.controlRevision>=0?t.controlRevision:void 0,assignedOperatorInitials:typeof t.assignedOperatorInitials=="string"&&t.assignedOperatorInitials?t.assignedOperatorInitials:void 0,operatorAvailable:typeof t.operatorAvailable=="boolean"?t.operatorAvailable:void 0}}function er(e){let t=e?.suggestions;if(!Array.isArray(t))return[];let n=[];for(let o of t){if(!o||typeof o!="object")continue;let{id:r,label:a,text:s}=o;typeof a!="string"||!a||n.push({id:typeof r=="string"&&r?r:`s${n.length}`,label:a,text:typeof s=="string"&&s?s:a})}return n}function Ma(e){let n={messages:e.messages.map(o=>({id:o.serverMessageId??o.id,parts:Rp(o),role:o.role,createdAt:o.createdAt!==void 0?new Date(o.createdAt).toISOString():void 0})),conversationId:e.conversationId,responseType:"ack"};return e.visitorId&&(n.visitorId=e.visitorId),e.userPrefs&&(n.userPrefs=e.userPrefs),n}function Cp(e){return e.state==="output-available"||e.state==="output-error"||e.state==="output-denied"||e.approval?.approved!==void 0}function Rp(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"&&Cp(n)){let o=n.dynamic?{type:"dynamic-tool",toolName:n.toolName,toolCallId:n.toolCallId,state:n.state}:{type:wp(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 Ce=ne.scope("transport"),Tp=6e4,Ip=1e4,Oa=50,dl=new WeakMap;function Sn(e){return dl.get(e)}function Qn(e,t){return dl.set(e,t),e}function il(e){return Math.max(e?.upsertRevision??0,e?.read?.revision??0)}function Ep(e,t){return e.conversationId===t.conversationId&&e.title===t.title&&e.lastMessageAt===t.lastMessageAt&&e.preview===t.preview&&e.canContinue===t.canContinue&&e.hasUnread===t.hasUnread&&e.controlState===t.controlState}function Mt(e,t,n=!0){switch(t.type){case"snapshot":{let o=new Map(e.map(s=>[s.conversationId,s])),r=e.filter(s=>(Sn(s)?.activityRevision??0)>t.requestedRevision).toSorted((s,l)=>Sn(l).activityRevision-Sn(s).activityRevision),a=new Set(r.map(s=>s.conversationId));return[...r,...t.result.conversations.filter(s=>!a.has(s.conversationId)).map(s=>{let l=o.get(s.conversationId);if(!l)return s;let c=Sn(l);return(c?.upsertRevision??0)>t.requestedRevision?l:c?.read&&!l.hasUnread&&c.read.lastMessageAt===s.lastMessageAt?Qn({...s,hasUnread:!1},{upsertRevision:0,read:c.read}):s})]}case"read":{let o=e.findIndex(c=>c.conversationId===t.conversationId&&(t.lastMessageAt===void 0||c.lastMessageAt===t.lastMessageAt));if(o<0)return e;let r=e[o],a=Sn(r);if(il(a)>t.revision)return e;let s=t.lastMessageAt??r.lastMessageAt,l={upsertRevision:a?.upsertRevision??0,...a?.activityRevision===void 0?{}:{activityRevision:a.activityRevision},read:{revision:t.revision,...s?{lastMessageAt:s}:{}}};return r.hasUnread?e.map((c,d)=>d===o?Qn({...c,hasUnread:!1},l):c):(Qn(r,l),e)}case"upsert":{let o=e.findIndex(d=>d.conversationId===t.conversation.conversationId);if(o<0&&!n)return e;let r=o<0?void 0:e[o],a=r?Sn(r):void 0;if(il(a)>t.revision)return e;let s=t.activity?t.revision:a?.activityRevision,l={upsertRevision:t.revision,...s===void 0?{}:{activityRevision:s},...!t.conversation.hasUnread&&a?.read?{read:a.read}:{}},c=r?{...r,...t.conversation,title:r.title}:{...t.conversation};return r&&Ep(r,c)?(Qn(r,l),e):(Qn(c,l),t.activity?[c,...e.filter(d=>d.conversationId!==c.conversationId)]:r?e.map((d,p)=>p===o?c:d):[...e,c])}default:return t}}var sl=3,Ap=400,Mp=3e4,Lp=1e4,Op=6e4,Np=15e3,Dp=1024*1024,ll=new Set([408,425,429,500,502,503,504]);function cl(e){return Ap*2**e+Math.floor(Math.random()*250)}function $p(e){return Op+Math.ceil(e/Dp)*Np}function Fp(e){let t=e.get("retry-after");if(!t)return null;let n=Number(t),o=Number.isFinite(n)?n*1e3:Date.parse(t)-Date.now();return Number.isFinite(o)&&o>=0?Math.min(o,3e4):null}var tr=class{constructor(t){le(this,"ttlMs",t);le(this,"map",new Map)}getOrFetch(t,n){let o=this.map.get(t);if(o&&Date.now()-o.at<this.ttlMs)return o.result;let r={at:Date.now(),result:n().then(a=>(r.value=a,a)).catch(a=>{throw this.map.get(t)===r&&this.map.delete(t),a})};return this.map.set(t,r),r.result}peek(t){let n=this.map.get(t);if(n?.value!==void 0&&Date.now()-n.at<this.ttlMs)return n.value}update(t){for(let n of this.map.values()){if(n.value!==void 0){let o=t(n.value);n.value=o,n.result=Promise.resolve(o);continue}n.result=n.result.then(o=>{let r=t(o);return n.value=r,r})}}delete(t){this.map.delete(t)}},nr=class{constructor(t){le(this,"opts",t);le(this,"conversationListeners",new Set);le(this,"conversationRevision",0);le(this,"visitorId");le(this,"conversationId");le(this,"userContext");le(this,"pageContext");le(this,"locale");le(this,"conversationsCache",new tr(Ip));le(this,"contentCache",new tr(Tp))}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:fn};this.visitorId&&(t.visitorId=this.visitorId),this.conversationId&&(t.conversationId=this.conversationId),this.locale&&(t.locale=this.locale);let n=ol(this.userContext,this.pageContext);return n&&(t[al]=n),t}withEnvelope(t){return{...this.envelope(),...t}}appendEnvelope(t){for(let[n,o]of Object.entries(this.envelope()))t.append(n,o);return t}withEnvelopeQuery(t){let n=new URL(this.url(t));for(let[o,r]of Object.entries(this.envelope()))n.searchParams.has(o)||n.searchParams.set(o,r);return n.toString()}async handshake(t){Ce.debug("handshake \u2192",{visitorId:t.visitorId,conversationId:t.conversationId,locale:t.locale});let n=await this.postJson(nt.handshake,t,"handshake");return Ce.debug("handshake \u2190",{visitorId:n.visitorId,conversationId:n.conversationId,hasWelcome:!!n.welcome,hasConfig:!!n.config,rebind:n.rebind}),Up(n)||Ce.warn("handshake response did not match expected shape; using raw response",{response:n}),this.visitorId=n.visitorId??t.visitorId,this.conversationId=n.conversationId,n}async uploadFile(t,n){Ce.debug("uploadFile \u2192",{name:t.name,size:t.size,type:t.type});let o=new FormData;o.append("file",t,t.name);let r=await this.postForm(this.uploadPath,o,"upload",n,$p(t.size));return Ce.debug("uploadFile \u2190",{id:r.id,url:r.url}),r}async transcribe(t,n="audio/webm"){Ce.debug("transcribe \u2192",{size:t.size,mimeType:n});let o=new FormData;o.append("audio",t,`voice.${Bp(n)}`),o.append("mimeType",n);let r=await this.postForm(this.transcribePath,o,"transcribe");return Ce.debug("transcribe \u2190",{textLen:r.text.length}),r}subscribeConversationChanges(t){return this.conversationListeners.add(t),()=>this.conversationListeners.delete(t)}publishConversation(t,n=!1){let o={type:"upsert",conversation:t,revision:++this.conversationRevision,...n?{activity:!0}:{}};this.conversationsCache.update(r=>{let a=r.pagination.page===1,s=r.conversations.some(_=>_.conversationId===t.conversationId),l=Mt(r.conversations,o,a&&n),c=a&&l.length>r.pagination.limit?l.slice(0,r.pagination.limit):l;if(!a||!n||s||r.pagination.hasNext)return c===r.conversations?r:{...r,conversations:c};let d=Math.max(r.pagination.total,r.conversations.length)+1,p=Math.ceil(d/r.pagination.limit);return{...r,conversations:c,pagination:{...r.pagination,total:d,totalPages:p,hasNext:r.pagination.page<p}}});for(let r of this.conversationListeners)r(o)}localeCacheKey(t){return`${this.locale??""}|${JSON.stringify(t,Object.keys(t).toSorted())}`}peekConversations(t={}){return this.conversationsCache.peek(this.localeCacheKey(t))}listConversations(t={},n=!1){if((t.page??1)>1)return this.fetchConversations(t);let o=this.localeCacheKey(t),r=this.conversationRevision;n&&this.conversationsCache.delete(o);let a=this.conversationsCache.getOrFetch(o,()=>this.fetchConversations(t));return n?a.then(s=>{let l={type:"snapshot",result:s,requestedRevision:r};for(let c of this.conversationListeners)c(l);return s}):a}async fetchConversations(t){let n=new URL(this.url(nt.listConversations));return t.visitorId&&n.searchParams.set("visitorId",t.visitorId),t.page&&n.searchParams.set("page",String(t.page)),t.limit&&n.searchParams.set("limit",String(t.limit)),t.ids?.length&&n.searchParams.set("ids",t.ids.join(",")),this.getJson(n.toString(),"listConversations")}async loadConversation(t,{ids:n=[],beforeId:o}={}){let r=new URL(this.url(nt.listMessages));r.searchParams.set("conversationId",t),r.searchParams.set("limit",String(Oa)),r.searchParams.set("sortBy","_id"),r.searchParams.set("sortOrder","desc"),n.length>0&&r.searchParams.set("ids",n.join(",")),o&&r.searchParams.set("beforeId",o);let a=await this.getJson(r.toString(),"loadConversation"),s=(a.messages??[]).toReversed();return{...a,messages:s,canContinue:a.canContinue??!0}}async markRead(t,n){if(!this.visitorId||!t)return;let o={type:"read",conversationId:t,...n===void 0?{}:{lastMessageAt:n},revision:++this.conversationRevision};this.conversationsCache.update(r=>{let a=Mt(r.conversations,o);return a===r.conversations?r:{...r,conversations:a}});for(let r of this.conversationListeners)r(o);try{await this.postJson(nt.markRead,{conversationId:t},"markRead",!0)}catch(r){Ce.debug("markRead failed (non-fatal)",{err:r})}}async requestOperator(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(nt.requestOperator,{},"requestOperator")).controlState}catch(t){Ce.debug("requestOperator failed (non-fatal)",{err:t});return}}async cancelOperatorRequest(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(nt.cancelOperatorRequest,{},"cancelOperatorRequest")).controlState}catch(t){Ce.debug("cancelOperatorRequest failed (non-fatal)",{err:t});return}}listContent(t={}){return this.contentCache.getOrFetch(this.localeCacheKey(t),()=>this.fetchContent(t))}async fetchContent(t){let n=new URL(this.dataUrl(nt.content));for(let[a,s]of Object.entries(t))s!==void 0&&n.searchParams.set(a,Array.isArray(s)?s.join(","):String(s));let o=await this.getJson(n.toString(),"listContent"),r=(o.items??[]).map(a=>ns(a,this.locale));return{...o,items:r}}async bootstrap(t){let n=new URL(this.dataUrl(nt.bootstrap));t&&n.searchParams.set("conversationId",t);let o=await this.getJson(n.toString(),"bootstrap"),r=o.forms??[],a=o.formSubmissions??[];return{forms:r,formSubmissions:a}}async saveUserPrefs(t){return this.postJson(nt.updateSettings,{userPrefs:t},"saveUserPrefs")}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??nt.submitForm}async submitForm(t){Ce.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){Ce.debug("submitForm failed (non-fatal)",{err:n})}}async submitFeedback(t){Ce.debug("submitFeedback \u2192",{messageId:t.messageId,value:t.value});try{await this.postJson(nt.messageFeedback,{messageId:t.messageId,set:{feedback:t.value}},"submitFeedback")}catch(n){Ce.debug("submitFeedback failed (non-fatal)",{err:n})}}async sendTurn(t){Ce.debug("message \u2192",{conversationId:t.conversationId,visitorId:t.visitorId,messageCount:t.messages.length});try{return await this.runWithAbort(async n=>{let o=await this.fetchImpl(this.url(nt.streamMessage),{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope(t)),signal:n});if(o.status!==202)throw new He(`sendTurn failed: expected 202, received ${o.status}`,"server",o.status);let r;try{r=await o.json()}catch(a){throw n?.aborted?a:new He("sendTurn failed: invalid acknowledgement","server",o.status,a)}if(!Hp(r))throw new He("sendTurn failed: invalid acknowledgement","server",o.status);return r},void 0,Mp)}catch(n){throw n instanceof He?n:new He("sendTurn failed: network error","network",void 0,n)}}cancelTurn(t,n){!this.visitorId||!t||!n||(Ce.debug("cancel stream",{conversationId:t,runId:n,visitorId:this.visitorId}),this.fetchImpl(this.url(nt.cancelStream),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope({conversationId:t,runId:n})),keepalive:!0}).catch(o=>Ce.debug("cancel POST failed (non-fatal)",{err:o})))}async connectResumeStream(t){let n=new AbortController,o=()=>n.abort(t.signal.reason);t.signal.aborted?o():t.signal.addEventListener("abort",o,{once:!0});let r=setTimeout(()=>n.abort(),Lp),a=()=>{clearTimeout(r),t.signal.removeEventListener("abort",o)},s;try{s=await this.fetchImpl(this.resumeUrl(),{method:"GET",credentials:"omit",headers:{accept:"text/event-stream",...this.opts.auth.headers()},signal:n.signal})}catch(c){return a(),t.signal.aborted||Ce.debug("resume-stream fetch failed \u2014 reconnecting",{err:c}),"held"}if(!s.ok)return a(),s.status===409||ll.has(s.status)?(Ce.debug("resume-stream \u2192 transient response; reconnecting",{status:s.status}),"held"):(Ce.debug("resume-stream \u2192 endpoint unavailable",{status:s.status}),"unavailable");if(!s.body)return a(),Ce.debug("resume-stream \u2192 bodyless response; stopping",{status:s.status}),"unavailable";if(!(s.headers.get("content-type")??"").includes("text/event-stream"))return a(),Ce.debug("resume-stream \u2192 non-SSE response; stopping"),"unavailable";let l=!1;try{for await(let{chunk:c}of tl(s,n.signal,d=>{l||d!=="connected"||(l=!0,clearTimeout(r),t.onConnected())})){if(t.signal.aborted)return"held";t.onChunk(c)}}catch(c){if(t.signal.aborted)return"held";Ce.debug("resume-stream segment dropped \u2014 reconnecting",{err:c})}finally{a()}return"held"}resumeUrl(){return this.withEnvelopeQuery(nt.streamResume)}async postJson(t,n,o,r=!1){let a=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)),...r?{keepalive:!0}:{}}],o);return this.assertOk(a,o)}async postForm(t,n,o,r,a){return this.runWithAbort(async s=>{let l=await this.fetchImpl(this.url(t),{method:"POST",credentials:"omit",headers:this.opts.auth.headers(),body:this.appendEnvelope(n),signal:s});return this.assertOk(l,o)},r,a)}async runWithAbort(t,n,o){if(!n&&o===void 0)return t();let r=new AbortController,a=()=>r.abort(n?.reason);n?.aborted?a():n?.addEventListener("abort",a,{once:!0});let s=o===void 0?void 0:setTimeout(()=>r.abort(),o);try{return await t(r.signal)}finally{s!==void 0&&clearTimeout(s),n?.removeEventListener("abort",a)}}async getJson(t,n){let o=await this.fetchWithRetry(()=>[this.withEnvelopeQuery(t),{method:"GET",credentials:"omit",headers:{accept:"application/json",...this.opts.auth.headers()}}],n);return this.assertOk(o,n)}async fetchWithRetry(t,n){for(let o=0;;o++){let[r,a]=t(),s;try{s=await this.fetchImpl(r,a)}catch(c){if(o>=sl)throw new He(`${n} failed: network error`,"network",void 0,c);Ce.debug("request network error \u2014 retrying",{label:n,attempt:o}),await Jn(cl(o));continue}if(s.ok||!ll.has(s.status)||o>=sl)return s;let l=Fp(s.headers)??cl(o);Ce.debug("request retryable status \u2014 retrying",{label:n,status:s.status,attempt:o,wait:l}),await Jn(l)}}async assertOk(t,n){if(!t.ok)throw new He(`${n} failed: ${t.status}`,"server",t.status);return await t.json()}url(t){return/^https?:\/\//i.test(t)?t:`${this.opts.agentApiBaseUrl}${t}`}dataUrl(t){return/^https?:\/\//i.test(t)?t:`${this.opts.dataApiBaseUrl}${t}`}get fetchImpl(){return this.opts.fetchImpl??globalThis.fetch.bind(globalThis)}};function Bp(e){return e.includes("webm")?"webm":e.includes("ogg")?"ogg":e.includes("mp4")||e.includes("m4a")?"m4a":e.includes("mpeg")?"mp3":e.includes("wav")?"wav":"bin"}function Hp(e){if(typeof e!="object"||e===null)return!1;let t=Reflect.get(e,"status"),n=Reflect.get(e,"conversationId"),o=Reflect.get(e,"runId");return t==="accepted"&&typeof n=="string"&&n.length>0&&(o===void 0||typeof o=="string"&&o.length>0)}function Up(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.visitorId=="string"&&typeof t.conversationId=="string"}function Da(e,t){let n=e?[{kind:"text",id:"t0",textSig:oe(e),doneSig:oe(!0)}]:[];return{id:dt(),role:"user",createdAt:Date.now(),status:"complete",attachments:t,partsSig:oe(n)}}function Lt(){return{id:dt(),role:"assistant",createdAt:Date.now(),status:"streaming",partsSig:oe([])}}function _l(e){let t=dt();return zp({id:t,role:e.role,createdAt:Date.now(),status:"complete",ephemeral:!0,parts:[{kind:"text",id:`${t}-t0`,text:e.text,done:!0}]})}function zp(e){return{id:e.id,role:e.role,createdAt:e.createdAt,status:e.status,canceled:e.canceled,errorText:e.errorText,finishReason:e.finishReason,serverMessageId:e.serverMessageId,ephemeral:e.ephemeral,attachments:e.attachments,feedback:e.feedback,partsSig:oe(e.parts.map(Xp))}}var pl=new Set(["completed","failed","canceled"]);function qp(e){return e.status==="failed"?"error":e.role==="assistant"&&e.status!=null&&!pl.has(e.status)?"streaming":"complete"}function $a(e){let t=new Set,n=e.parts.map((r,a)=>r.type==="text"?{kind:"text",id:`${e.id}-t${a}`,textSig:oe(r.text),doneSig:oe(!0)}:r.type==="reasoning"?{kind:"reasoning",id:`${e.id}-r${a}`,textSig:oe(r.text),doneSig:oe(r.state!=="streaming")}:r.type==="step-start"?{kind:"step-start",id:`${e.id}-ss${a}`}:r.type==="file"?{kind:"file",url:r.url,mediaType:r.mediaType}:r.type==="source-url"?{kind:"source",sourceId:r.sourceId,url:r.url,title:r.title}:r.type==="source-document"?{kind:"source",sourceId:r.sourceId,title:r.title,filename:r.filename,mediaType:r.mediaType}:r.type==="data-suggestions"?null:r.type==="dynamic-tool"||r.type.startsWith("tool-")?{kind:"tool",toolCallId:r.toolCallId,toolName:r.type==="dynamic-tool"?r.toolName:rl(r.type),dynamic:r.type==="dynamic-tool"?!0:void 0,inputPartialSig:oe(""),inputSig:oe(r.input),outputSig:oe(r.output),errorSig:oe(r.errorText),stateSig:oe(r.state),approvalSig:oe(r.approval)}:null).filter(r=>r!==null).filter(r=>r.kind!=="source"?!0:t.has(r.sourceId)?!1:(t.add(r.sourceId),!0)),o=e.parts.find(r=>r.type==="data-suggestions");return{id:e.id,role:e.role,operatorInitials:e.operatorInitials,suggestions:o?.type==="data-suggestions"?er(o.data):void 0,serverMessageId:e.id,createdAt:Zo(e.createdAt)??Date.now(),status:qp(e),canceled:e.status==="canceled",feedback:e.feedback??null,partsSig:oe(n)}}function Vp(e){return!e.parts.some(t=>t.type==="text"&&t.text.trim()!==""||t.type==="dynamic-tool"||t.type.startsWith("tool-")||t.type==="file"||t.type==="source-url"||t.type==="source-document")}function Wp(e){return e.role==="assistant"&&e.status!=null&&!pl.has(e.status)&&Vp(e)}function Ht(e){let t=e.length-1;return e.filter((n,o)=>o===t||!Wp(n)).map($a)}function fl(e,t){let n=!t&&e.at(-1)?.role==="assistant"?-2:-1,o=e.at(n);return!o||o.ephemeral?[]:[o]}function Fa(e){return{id:e.id,role:e.role,createdAt:e.createdAt,status:e.status,canceled:e.canceled,errorText:e.errorText,finishReason:e.finishReason,serverMessageId:e.serverMessageId,ephemeral:e.ephemeral,attachments:e.attachments,parts:e.partsSig.value.map(Yp)}}function De(e){let t="";for(let n of e.partsSig.value)n.kind==="text"&&(t+=n.textSig.value);return t}function or(e,t,n,o,r,a=t.createdAt){let s=e.find(p=>p.role==="user"&&!p.ephemeral),l=(p,_)=>De(p).replace(/\s+/g," ").trim().slice(0,_),c=s?l(s,80):"",d=l(t,120);return{conversationId:n,title:c||o,lastMessageAt:new Date(a).toISOString(),preview:d||void 0,canContinue:r}}function bt(e){return De(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file"||t.kind==="source")}function Kp(e){return De(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file")}function Ba(e){return e==="approval-responded"||e==="output-available"||e==="output-denied"||e==="output-error"}var kn=e=>e.kind==="tool",ml=e=>e.kind==="text"&&e.textSig.value.trim()!==""||e.kind==="file";function Zn(e){let t=e.partsSig.value,n=t.findLastIndex(o=>o.kind==="tool");return t.slice(n+1).some(ml)}function Qt(e){if(e.role!=="assistant")return!1;let t=e.partsSig.value.filter(kn);return t.length>0&&t.every(n=>Ba(n.stateSig.value))}function Zt(e){return e.role!=="assistant"?!1:e.partsSig.value.some(t=>t.kind==="tool")&&!Zn(e)}function rr(e,t){return!e.partsSig.value.slice(t+1).some(n=>n.kind==="step-start"||ml(n))}function ar(e){return e.partsSig.value.some(t=>kn(t)&&!Ba(t.stateSig.value))}function gl(e,t){if(t.length===0)return e;let n=new Set;for(let s of e)n.add(s.id),s.serverMessageId&&n.add(s.serverMessageId);let o=t.filter(s=>{let l=[s.id,s.serverMessageId].filter(c=>c!==void 0);return l.some(c=>n.has(c))?!1:(l.forEach(c=>n.add(c)),!0)});if(o.length===0)return e;let r=e.findIndex(s=>!s.ephemeral),a=r<0?e.length:r;return[...e.slice(0,a),...o,...e.slice(a)]}function Yt(e,t){return t.id=e.id,e.canceled&&(t.canceled=!0),e.feedback!==void 0&&(t.feedback=e.feedback),t.suggestions??(t.suggestions=e.suggestions),t}function vl(e,t,n,o){if(!Ha(e))return;if(t.length===0){let s=Math.max(...o.values());return n.find(l=>l.role==="assistant"&&o.get(l.serverMessageId??l.id)===s&&De(l).length>=De(e).length)}let r=t.at(-1);if(r?.role!=="user")return;let a=o.get(r.serverMessageId??r.id);if(a!==void 0)return n.find(s=>s.role==="assistant"&&o.get(s.serverMessageId??s.id)===a+1&&De(s).length>=De(e).length)}function Ha(e){return e?.role==="assistant"&&e.status==="streaming"&&e.serverMessageId===void 0}function Gp(e,t){let n=new Map(t.partsSig.value.filter(kn).filter(a=>Ba(a.stateSig.value)).map(a=>[a.toolCallId,a]));if(n.size===0)return;let o=!1,r=e.partsSig.value.map(a=>{if(!kn(a))return a;let s=n.get(a.toolCallId);if(!s)return a;let l=a.approvalSig.value,c=s.approvalSig.value,d=l===void 0||l.approved===void 0&&c?.approved!==void 0?s.approvalSig:a.approvalSig,p=a.inputSig.value===void 0?s.inputSig:a.inputSig,_=a.toolName==="tool"?s.toolName:a.toolName,u=a.dynamic??s.dynamic;return d===a.approvalSig&&p===a.inputSig&&_===a.toolName&&u===a.dynamic?a:(o=!0,{...a,toolName:_,dynamic:u,inputSig:p,approvalSig:d})});o&&(e.partsSig.value=r)}function Ua(e,t){let n=t.filter(_=>!_.ephemeral&&(_.status==="streaming"||_.status==="pending"||_.status==="error"||_.retryAction!==void 0||(_.attachments?.length??0)>0||bt(_))),o=new Map;for(let _ of n)o.set(_.id,_),_.serverMessageId!==void 0&&o.set(_.serverMessageId,_);let r=new Set,a=[],s=e.map(_=>{let u=(_.serverMessageId!==void 0?o.get(_.serverMessageId):void 0)??o.get(_.id);return u===void 0?(a.push(_),_):(r.add(u),u.role!==_.role?_:u.role==="user"&&u.serverMessageId===void 0&&(u.status==="pending"||u.status==="error")?Yt(u,_):u.status==="streaming"||De(u).length>=De(_).length?(Gp(u,_),u.suggestions??(u.suggestions=_.suggestions),u.feedback===void 0&&(u.feedback=_.feedback),_.canceled&&(u.canceled=!0),u):Yt(u,_))}),l=n.filter(_=>!r.has(_)),c=l.findLast(Ha),d=new Map;e.forEach((_,u)=>{d.set(_.id,u),_.serverMessageId!==void 0&&d.set(_.serverMessageId,u)});let p=vl(c,c?n.slice(0,n.indexOf(c)):[],a,d);if(c&&p){let _=s.indexOf(p);_>=0&&(s[_]=Yt(c,p)),l=l.filter(u=>u!==c)}return[...s,...l]}function eo(e,t){let n=new Map(t.filter(_=>_.serverMessageId!==void 0).map(_=>[_.serverMessageId,_])),o=new Map;t.forEach((_,u)=>{o.set(_.id,u),_.serverMessageId!==void 0&&o.set(_.serverMessageId,u)});let r=new Set(e.flatMap(_=>[_.serverMessageId,_.id].filter(u=>u!==void 0))),a=!1,s=e.map(_=>{let u=n.get(_.serverMessageId??_.id);if(u===void 0||u.role!==_.role)return _;if(_.role==="user"&&_.serverMessageId===void 0)return a=!0,Yt(_,u);if(_.serverMessageId===void 0)return _;let f=De(u),m=De(_),h=u.status!=="streaming"&&f.length>=m.length&&Na(_,u);if(f.length>m.length||f===m&&u.partsSig.value.length>_.partsSig.value.length||h)return a=!0,Yt(_,u);if(_.status==="streaming"&&u.status!=="streaming"&&jp(_,u)){if(_.continuationStreaming&&ar(u))return _;if(!Na(u,_))return a=!0,Yt(_,u)}return _}),l=[...n.values()].filter(_=>!r.has(_.serverMessageId)),c=s.findLastIndex(Ha),d=s[c],p=vl(d,s.slice(0,c),l,o);if(d!==void 0&&p!==void 0&&De(p).length>=De(d).length&&(Yt(d,p),s[c]=p,l.splice(l.indexOf(p),1),a=!0),l.length===0)return{messages:a?s:e,changed:a};for(let _ of l){let u=o.get(_.serverMessageId??_.id),f=!1,m=s.findIndex(h=>{let P=o.get(h.serverMessageId??h.id);return u===void 0?!1:P===void 0?f:P>u?!0:(f=!0,!1)});m===-1?s.push(_):s.splice(m,0,_)}return{messages:s,changed:!0}}function hl(e,t){if(e.role!==t.role)return!1;let n=De(t),o=De(e);return n.length>o.length||t.partsSig.value.length>e.partsSig.value.length||Na(e,t)}function jp(e,t){let n=e.partsSig.value,o=t.partsSig.value;return n.length!==o.length?!1:n.every((r,a)=>{let s=o[a];switch(r.kind){case"text":return s?.kind==="text"&&s.textSig.value===r.textSig.value;case"reasoning":return s?.kind==="reasoning"&&s.textSig.value===r.textSig.value;case"step-start":return s?.kind==="step-start";case"tool":return s?.kind==="tool"&&s.toolCallId===r.toolCallId&&ir(s.toolName,r.toolName);case"file":return s?.kind==="file"&&s.url===r.url&&s.mediaType===r.mediaType;case"source":return s?.kind==="source"&&s.sourceId===r.sourceId&&s.url===r.url&&s.title===r.title&&s.filename===r.filename&&s.mediaType===r.mediaType;default:return r}})}function ir(e,t){let n=e.startsWith("tool:")?e.slice(5):e,o=t.startsWith("tool:")?t.slice(5):t;return n===o}var ul={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function Na(e,t){let n=new Map(e.partsSig.value.filter(kn).map(o=>[o.toolCallId,o]));return t.partsSig.value.filter(kn).some(o=>{let r=n.get(o.toolCallId);if(!r||ul[o.stateSig.value]>ul[r.stateSig.value])return!0;let a=o.approvalSig.value?.approved;return a!==void 0&&a!==r.approvalSig.value?.approved})}function Jt(e){return e.role==="assistant"&&e.status!=="streaming"&&!bt(e)}function sr(e,t){if(!e.includes(t)||t.retryAction===null)return;if(t.retryAction)return t.retryAction;if(t!==e.at(-1)||t.role!=="assistant"||t.serverMessageId===void 0||t.status!=="error"&&!Jt(t))return;let n=e.indexOf(t);for(let o=n-1;o>=0;o--){let r=e[o];if(r?.role==="user"&&!r.ephemeral)return{kind:"repeat-user",messageId:r.id}}}function bl(e){return e.canceled===!0&&e.role==="assistant"&&e.status!=="streaming"&&!Kp(e)}function yl(e,t){return e.operatorRoutedTurn?Jt(e)?"drop":"complete-operator-routed":t||Jt(e)?"error":"complete"}function Xp(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,textSig:oe(e.text),doneSig:oe(e.done)}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,dynamic:e.dynamic,inputPartialSig:oe(e.inputPartial),inputSig:oe(e.input),outputSig:oe(e.output),errorSig:oe(e.error),stateSig:oe(e.state),approvalSig:oe(e.approval)}:e}function Yp(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,text:e.textSig.value,done:e.doneSig.value}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,dynamic:e.dynamic,inputPartial:e.inputPartialSig.value,input:e.inputSig.value,output:e.outputSig.value,error:e.errorSig.value,state:e.stateSig.value,approval:e.approvalSig.value}:e}var Pl=ne.scope("feedback:audio"),lr=class{constructor(){le(this,"ctx",null);le(this,"master",null);le(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){Pl.warn("AudioContext init failed",{err:n})}}setVolume(t){if(!this.master||!this.ctx)return;let n=Math.max(0,Math.min(1,t));this.master.gain.setTargetAtTime(n,this.ctx.currentTime,.01)}playTone(t){let n=this.ctx,o=this.master;if(!n||!o||n.state!=="running")return;let r=n.currentTime,a=t.noteMs/1e3;t.notes.forEach((s,l)=>{let c=n.createOscillator();c.type=t.type,c.frequency.value=s;let d=n.createGain(),p=r+l*a;d.gain.setValueAtTime(1e-4,p),d.gain.exponentialRampToValueAtTime(t.peakGain,p+.005),d.gain.exponentialRampToValueAtTime(1e-4,p+a),c.connect(d).connect(o),c.start(p),c.stop(p+a+.01)})}async playUrl(t){let n=this.ctx,o=this.master;if(!n||!o||n.state!=="running")return;let r=await this.getBuffer(t);if(!r)return;let a=n.createBufferSource();a.buffer=r,a.connect(o),a.start()}destroy(){this.ctx&&this.ctx.close().catch(()=>{}),this.ctx=null,this.master=null,this.buffers.clear()}async getBuffer(t){if(!this.ctx)return null;let n=this.buffers.get(t);if(n)return n instanceof Promise,n;let o=this.ctx,r=fetch(t).then(a=>a.ok?a.arrayBuffer():Promise.reject(new Error(`fetch ${a.status}`))).then(a=>o.decodeAudioData(a)).then(a=>(this.buffers.set(t,a),a)).catch(a=>(Pl.warn("audio fetch/decode failed",{url:t,err:a}),this.buffers.delete(t),null));return this.buffers.set(t,r),r}};var xl={messageReceived:10,messageSent:0,error:[20,40,20],voiceStart:10,voiceStop:0},Sl={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 Ut=null,cr=0;function Jp(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}function Qp(){if(typeof document>"u")return null;let e=document.createElement("input");e.type="checkbox",e.setAttribute("switch",""),e.setAttribute("aria-hidden","true"),e.tabIndex=-1,e.id=`__${R.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 kl(e){if(!(e===0||Array.isArray(e)&&e.every(t=>t===0))){if(Jp())try{navigator.vibrate(e);return}catch{}if(Ut||(Ut=Qp()),!!Ut)try{Ut.label.click()}catch{}}}function wl(){cr++;let e=!1;return()=>{e||(e=!0,cr=Math.max(0,cr-1),cr===0&&Ut&&(Ut.input.remove(),Ut.label.remove(),Ut=null))}}var Zp=ne.scope("feedback"),ef=100,dr=class{constructor(t,n){le(this,"mutedSig",oe(!1));le(this,"audio",new lr);le(this,"releaseHaptics");le(this,"sound");le(this,"haptics");le(this,"lastPlayed",new Map);le(this,"reducedMotionMq",null);this.sound=t,this.haptics=n,this.releaseHaptics=wl(),this.audio.setVolume(this.effectiveVolume()),typeof matchMedia<"u"&&(this.reducedMotionMq=matchMedia("(prefers-reduced-motion: reduce)"))}unlock(){this.audio.unlock(),this.audio.setVolume(this.effectiveVolume())}update(t,n){this.sound=t,this.haptics=n,this.audio.setVolume(this.effectiveVolume())}setMuted(t){this.mutedSig.value!==t&&(this.mutedSig.value=t)}toggleMuted(){this.mutedSig.value=!this.mutedSig.value}play(t){this.mutedSig.value||this.isDeduped(t)||(this.lastPlayed.set(t,performance.now()),this.sound.enabled&&this.playSound(t),this.haptics.enabled&&this.isTouchDevice()&&this.playHaptic(t))}destroy(){this.audio.destroy(),this.releaseHaptics()}isDeduped(t){let n=this.lastPlayed.get(t);return n===void 0?!1:performance.now()-n<ef}playSound(t){let n=this.sound.events?.[t];if(n===!1)return;if(typeof n=="string"){this.audio.playUrl(n).catch(r=>Zp.warn("audio play failed",{err:r,url:n}));return}let o=Sl[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?xl[t]:n;kl(o)}effectiveVolume(){let t=this.sound.volume??.3;return this.reducedMotionMq?.matches?t*.5:t}isTouchDevice(){return typeof window>"u"?!1:matchMedia("(hover: none) and (pointer: coarse)").matches}};var tf=0;function i(e,t,n,o,r,a){t||(t={});var s,l,c=t;if("ref"in c)for(l in c={},t)l=="ref"?s=t[l]:c[l]=t[l];var d={type:e,props:c,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--tf,__i:-1,__u:0,__source:r,__self:a};if(typeof e=="function"&&(s=e.defaultProps))for(l in s)c[l]===void 0&&(c[l]=s[l]);return te.vnode&&te.vnode(d),d}var Y={fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24"},to=`${R.cssPrefix}-icon-dir`,za=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M21 12a8 8 0 0 1-12 6.93L3 21l1.65-5.16A8 8 0 1 1 21 12Z"})}),yt=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M18 6 6 18M6 6l12 12"})}),Cl=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M12 5v14M5 12h14"})}),Rl=()=>i("svg",{...Y,class:to,"aria-hidden":"true",children:[i("path",{d:"m22 2-7 20-4-9-9-4Z"}),i("path",{d:"M22 2 11 13"})]}),Tl=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M12 19V5M5 12l7-7 7 7"})}),Il=()=>i("svg",{...Y,class:to,"aria-hidden":"true",children:i("path",{d:"M3 20V4l18 8-18 8Z"})}),wn=()=>i("svg",{...Y,class:to,"aria-hidden":"true",children:i("path",{d:"m9 18 6-6-6-6"})}),El=()=>i("svg",{...Y,"aria-hidden":"true",children:i("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}),Al=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"m21 11-9 9a5.5 5.5 0 0 1-7.78-7.78l8.49-8.49a3.67 3.67 0 0 1 5.19 5.19l-8.49 8.49a1.83 1.83 0 0 1-2.6-2.6l7.78-7.78"})}),Ml=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),i("path",{d:"M5 10a7 7 0 0 0 14 0M12 19v3"})]}),Ll=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M3 8V3h5M21 8V3h-5M3 16v5h5M21 16v5h-5"})}),Ol=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M8 3v5H3M16 3v5h5M8 21v-5H3M16 21v-5h5"})}),Nl=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M3 3h7v2H5v5H3zM21 3h-7v2h5v5h2zM3 21h7v-2H5v-5H3zM21 21h-7v-2h5v-5h2z"})}),Dl=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M10 3v5H3M14 3v5h7M10 21v-5H3M14 21v-5h7"})}),$l=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M14 3h7v7M21 3l-9 9"}),i("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]}),Fl=()=>i("svg",{...Y,"aria-hidden":"true",viewBox:"0 0 10 10",children:i("path",{d:"M9 1L1 9M9 5L5 9M9 9H9",strokeWidth:"1.5"})}),Bl=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"5",r:"1.5",fill:"currentColor",stroke:"none"}),i("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),i("circle",{cx:"12",cy:"19",r:"1.5",fill:"currentColor",stroke:"none"})]}),Hl=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M11 5 6 9H2v6h4l5 4zM15 9a5 5 0 0 1 0 6M18 7a9 9 0 0 1 0 10"})}),Ul=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M11 5 6 9H2v6h4l5 4zM22 9l-6 6M16 9l6 6"})}),zl=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M3 18 8 6l5 12M4.7 14h6.6"}),i("path",{d:"M14.5 18l3.2-7 3.2 7M15.6 15.8h4.2"})]}),ql=()=>i("svg",{...Y,class:to,"aria-hidden":"true",children:i("path",{d:"m5 6 6 6-6 6M13 6l6 6-6 6"})}),en=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M20 6 9 17l-5-5"})}),Vl=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M3 3v6h6"}),i("path",{d:"M3.05 13A9 9 0 1 0 6 5.3L3 9"}),i("path",{d:"M12 7v5l3 2"})]}),Wl=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("path",{d:"M2 12h20"}),i("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]}),no=()=>i("svg",{...Y,class:to,"aria-hidden":"true",children:i("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),Kl=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M12 20h9"}),i("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]}),tn=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"m6 9 6 6 6-6"})}),Gl=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),i("path",{d:"M14 2v6h6"})]}),nf=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"m12 3-1.5 4.5L6 9l4.5 1.5L12 15l1.5-4.5L18 9l-4.5-1.5Z"}),i("path",{d:"M19 15v4M17 17h4M5 3v2M4 4h2"})]}),qa=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2Z"})}),oo=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),i("path",{d:"M12 17h.01"})]}),of=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"m15 4 3 3-9 9-3-3z"}),i("path",{d:"M18 2v2M20 4h2M3 20l3-3M3 16h2M5 14v2"})]}),rf=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("rect",{x:"4",y:"8",width:"16",height:"12",rx:"2"}),i("path",{d:"M12 8V4"}),i("circle",{cx:"12",cy:"3",r:"1"}),i("path",{d:"M2 14h2M20 14h2M9 13h.01M15 13h.01M9.5 17h5"})]}),Va=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M4 14v-2a8 8 0 0 1 16 0v2"}),i("rect",{x:"2",y:"14",width:"4",height:"6",rx:"1.5"}),i("rect",{x:"18",y:"14",width:"4",height:"6",rx:"1.5"}),i("path",{d:"M20 20v1a3 3 0 0 1-3 3h-5"})]}),af=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("circle",{cx:"12",cy:"12",r:"4"}),i("path",{d:"m4.93 4.93 4.24 4.24M14.83 14.83l4.24 4.24M14.83 9.17l4.24-4.24M4.93 19.07l4.24-4.24"})]}),Wa=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"11",cy:"11",r:"7"}),i("path",{d:"m21 21-4.3-4.3"})]}),jl=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]}),Xl=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M3 9.5 12 3l9 6.5"}),i("path",{d:"M5 9v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9"})]}),Yl=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"m3 11 15-5v12L3 13z"}),i("path",{d:"M3 11v2a2 2 0 0 0 2 2h1V9H5a2 2 0 0 0-2 2z"}),i("path",{d:"M7 15v3a2 2 0 0 0 4 0v-2"}),i("path",{d:"M21 10a3 3 0 0 1 0 4"})]}),ro=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z"}),i("path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1"})]}),Jl=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"4"}),i("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}),Ql=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}),Zl=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"M12 3v18"}),i("path",{d:"M12 3a9 9 0 0 1 0 18z",fill:"currentColor",stroke:"none"})]}),sf=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"10.5",cy:"10.5",r:"6.5"}),i("path",{d:"M8 11a2.5 2.5 0 0 0 5 0"}),i("path",{d:"m20 20-4.4-4.4"})]}),lf=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M12 3.5 13.6 9 19 10.5 13.6 12 12 17.5 10.4 12 5 10.5 10.4 9z"}),i("path",{d:"M18.5 4v3M20 5.5h-3M5.5 16v2.5M6.75 17.25h-2.5"})]}),cf=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M4 18h16"}),i("path",{d:"M5 18a7 7 0 0 1 14 0"}),i("path",{d:"M12 8V6"}),i("path",{d:"M10 6h4"})]}),df=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M7 11V6.5a1.5 1.5 0 0 1 3 0V10"}),i("path",{d:"M10 10V5.5a1.5 1.5 0 0 1 3 0V10"}),i("path",{d:"M13 10V6.5a1.5 1.5 0 0 1 3 0V12"}),i("path",{d:"M16 9.5a1.5 1.5 0 0 1 3 0v2.5a7 7 0 0 1-7 7 7 7 0 0 1-6.4-4.2L4 12.5a1.5 1.5 0 0 1 2.6-1.5L7 11"})]}),ec=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2"}),i("path",{d:"M5 15a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2"})]}),tc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M7 10v11H4a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1z"}),i("path",{d:"M7 10l4-7a2.5 2.5 0 0 1 2.5 2.5V8h5a2 2 0 0 1 2 2.3l-1.2 8A2 2 0 0 1 17.3 20H7"})]}),nc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M17 14V3h3a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1z"}),i("path",{d:"M17 14l-4 7a2.5 2.5 0 0 1-2.5-2.5V16h-5a2 2 0 0 1-2-2.3l1.2-8A2 2 0 0 1 6.7 4H17"})]}),oc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"3.5"}),i("path",{d:"M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M19.1 4.9l-2.1 2.1M7 17l-2.1 2.1"})]}),rc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"M12 7v5l3 2"})]}),ur=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]}),_r=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"m15 9-6 6M9 9l6 6"})]}),ac={chat:za,message:qa,bubbles:ro,spark:nf,wand:of,bot:rf,help:oo,lifebuoy:af,headset:Va,search:sf,sparkles:lf,concierge:cf,wave:df};var U=R.cssPrefix,T={launcher:`${U}-launcher`,callout:`${U}-callout`,calloutDismiss:`${U}-callout-dismiss`,panel:`${U}-panel`,panelHeader:`${U}-panel-header`,resizeGrip:`${U}-resize-grip`,scrollToBottom:`${U}-scroll-to-bottom`,loadPreviousMessages:`${U}-load-previous-messages`,actionHistory:`${U}-action-history`,actionClose:`${U}-action-close`,langSegment:`${U}-lang-segment`,composer:`${U}-composer`,composerInput:`${U}-composer-input`,composerSend:`${U}-composer-send`,composerStop:`${U}-composer-stop`,composerAttach:`${U}-composer-attach`,composerFileInput:`${U}-composer-file-input`,composerVoice:`${U}-composer-voice`,attachmentChip:`${U}-attachment-chip`,attachmentRemove:`${U}-attachment-remove`,suggestion:`${U}-suggestion`,messageBubble:`${U}-message`,messageRetry:`${U}-message-retry`,messageFeedback:`${U}-message-feedback`,feedbackUp:`${U}-feedback-up`,feedbackDown:`${U}-feedback-down`,messageCopy:`${U}-message-copy`,historyPane:`${U}-history-pane`,historyBack:`${U}-history-back`,historyItem:`${U}-history-item`,historyLoadMore:`${U}-history-load-more`,sidebar:`${U}-sidebar`,sidebarToggle:`${U}-sidebar-toggle`,sidebarNewConversation:`${U}-sidebar-new-conversation`,sidebarItem:`${U}-sidebar-item`,messengerHome:`${U}-messenger-home`,modulesEmpty:`${U}-modules-empty`,tab:`${U}-tab`,tabBadge:`${U}-tab-badge`,homeView:`${U}-home-view`,homeGreeting:`${U}-home-greeting`,homeBrand:`${U}-home-brand`,backHeader:`${U}-back-header`,contentView:`${U}-content-view`,contentScroll:`${U}-content-scroll`,homeSearch:`${U}-home-search`,helpSearch:`${U}-help-search`,homeRecent:`${U}-home-recent`,homeContentRow:`${U}-home-content-row`,helpArticle:`${U}-help-article`,newsItem:`${U}-news-item`,formGate:`${U}-form-gate`,formDone:`${U}-form-done`,formDoneToggle:`${U}-form-done-toggle`,formAnswers:`${U}-form-answers`,formFill:`${U}-form-fill`,formSubmit:`${U}-form-submit`,formSkip:`${U}-form-skip`,formField:`${U}-form-field`,toolAskQuestions:`${U}-tool-ask-questions`,toolInputSubmit:`${U}-tool-input-submit`,toolInputSkip:`${U}-tool-input-skip`,toolApproval:`${U}-tool-approval`,toolApprove:`${U}-tool-approve`,toolReject:`${U}-tool-reject`,toolEdit:`${U}-tool-edit`,toolDecision:`${U}-tool-decision`,typingDots:`${U}-typing-dots`,reasoning:`${U}-reasoning`,toolAskSummary:`${U}-ask-questions-summary`,toolAskOptions:`${U}-ask-questions-options-toggle`,toolCall:`${U}-tool-call`,source:`${U}-source`,operatorRequest:`${U}-operator-request`,operatorBanner:`${U}-operator-banner`,cancelOperatorRequest:`${U}-cancel-operator-request`};function Ue(e,t){return`${e}-${t}`}var pr=R.cssPrefix;function ic({onToggle:e,launcher:t,strings:n,leaving:o,edgeTab:r}){let a=t.variant!=="circle"&&!!t.label;return i("button",{type:"button",class:`${pr}-fab`,"data-variant":t.variant,"data-size":t.size,"data-edge-tab":r?"true":void 0,"data-leaving":o?"true":void 0,"data-testid":T.launcher,onClick:e,"aria-label":n.launcherOpen,children:[uf(t.icon),a?i("span",{class:`${pr}-fab-label`,children:Qe(n,t.label??"")}):null]})}function uf(e){let t=ac[e];return t?i(t,{}):i(_f,{source:e})}function _f({source:e}){return i("span",{ref:t=>{t&&pf(t,e)},"aria-hidden":"true"})}function pf(e,t){if(e.dataset.svgMounted!==t)try{let o=new DOMParser().parseFromString(t,"image/svg+xml").documentElement;o&&o.tagName.toLowerCase()==="svg"&&(e.replaceChildren(document.importNode(o,!0)),e.dataset.svgMounted=t)}catch{}}function sc({callout:e,launcherPosition:t,strings:n,closeLabel:o,onDismiss:r}){let[a,s]=$(!1);return L(()=>{let l=setTimeout(()=>s(!0),e.delayMs);return()=>clearTimeout(l)},[e.delayMs]),L(()=>{if(!a||e.autoDismissMs<=0)return;let l=setTimeout(r,e.autoDismissMs);return()=>clearTimeout(l)},[a,e.autoDismissMs,r]),a?i("div",{class:`${pr}-callout`,role:"status","data-shape":e.shape,"data-position":ff(e.position,t),"data-animated":e.animated?"true":void 0,"data-testid":T.callout,children:[i("span",{children:Qe(n,e.text)}),i("button",{type:"button",class:`${pr}-callout-close`,onClick:r,"aria-label":o,title:o,"data-testid":T.calloutDismiss,children:i(yt,{})})]}):null}function ff(e,t){let n=t.endsWith("-right"),o=t.startsWith("bottom-");return e==="vertical"?o?"top":"bottom":n?"left":"right"}function fr({panelEl:e,resize:t,position:n,initialSize:o,onSizeChange:r,strings:a}){let s=R.cssPrefix,l=O(null);if(L(()=>{if(!e)return;let m=e.style;t.minWidth&&m.setProperty(`--${s}-resize-min-w`,t.minWidth),t.maxWidth&&m.setProperty(`--${s}-resize-max-w`,t.maxWidth),t.minHeight&&m.setProperty(`--${s}-resize-min-h`,t.minHeight),t.maxHeight&&m.setProperty(`--${s}-resize-max-h`,t.maxHeight),o&&(m.setProperty(`--${s}-widget-w`,`${o.width}px`),m.setProperty(`--${s}-widget-h`,`${o.height}px`))},[e,t.minWidth,t.maxWidth,t.minHeight,t.maxHeight,s,o]),!e)return null;let c=n.startsWith("top-"),d=n.endsWith("-right"),p=`${s}-resize-grip ${s}-resize-grip--${c?"bottom":"top"}-${d?"left":"right"}`,_=m=>{if(!e)return;let h=m.currentTarget,P=e.getBoundingClientRect();l.current={pointerId:m.pointerId,startX:m.clientX,startY:m.clientY,startW:P.width,startH:P.height,dirX:d?-1:1,dirY:c?1:-1},h.setPointerCapture(m.pointerId),e.setAttribute("data-resizing",""),m.preventDefault()},u=m=>{let h=l.current;if(!h||m.pointerId!==h.pointerId||!e)return;let P=(m.clientX-h.startX)*h.dirX,k=(m.clientY-h.startY)*h.dirY;e.style.setProperty(`--${s}-widget-w`,`${h.startW+P}px`),e.style.setProperty(`--${s}-widget-h`,`${h.startH+k}px`)},f=m=>{let h=l.current;if(!h||m.pointerId!==h.pointerId||!e)return;m.currentTarget.releasePointerCapture(m.pointerId),e.removeAttribute("data-resizing");let P=e.getBoundingClientRect();r({width:Math.round(P.width),height:Math.round(P.height)}),l.current=null};return i("div",{class:p,role:"separator","aria-orientation":"vertical","aria-label":a.resizeHandle,title:a.resizeHandle,onPointerDown:_,onPointerMove:u,onPointerUp:f,onPointerCancel:f,"data-testid":T.resizeGrip,children:i(Fl,{})})}var nn=R.cssPrefix,mf=`.${nn}-header, .${nn}-back-header, .${nn}-home-hero`,gf='button, a, input, textarea, select, [role="tab"], [contenteditable]',lc=56;function mr(e,t){L(()=>{if(!t||!e)return;let n=c=>Number.parseFloat(c)||0,o=(c,d)=>Math.min(d,Math.max(-d,c)),r=null,a=c=>{let d=c.target;if(!(d instanceof Element)||!d.closest(mf)||d.closest(gf))return;let p=e.getBoundingClientRect();r={id:c.pointerId,x:c.clientX,y:c.clientY,dx:n(e.style.getPropertyValue(`--${nn}-modal-dx`)),dy:n(e.style.getPropertyValue(`--${nn}-modal-dy`)),maxX:(window.innerWidth+p.width)/2-lc,maxY:(window.innerHeight+p.height)/2-lc},e.dataset.dragging="true",c.preventDefault()},s=c=>{if(!r||c.pointerId!==r.id)return;let d=o(r.dx+c.clientX-r.x,r.maxX),p=o(r.dy+c.clientY-r.y,r.maxY);e.style.setProperty(`--${nn}-modal-dx`,`${d}px`),e.style.setProperty(`--${nn}-modal-dy`,`${p}px`)},l=c=>{!r||c.pointerId!==r.id||(r=null,delete e.dataset.dragging)};return e.addEventListener("pointerdown",a),window.addEventListener("pointermove",s),window.addEventListener("pointerup",l),window.addEventListener("pointercancel",l),()=>{e.removeEventListener("pointerdown",a),window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",l),window.removeEventListener("pointercancel",l)}},[e,t])}function Cn(e,t,n){switch(e){case"clear":case"sound":case"history":case"language":case"theme":case"textSize":return!0;case"popOut":return t!=="standalone"&&t!=="page";case"expand":return t==="floating";case"fullscreen":return t!=="standalone";case"close":return t==="standalone"||t==="page"?!1:t==="inline"?n==="fullscreen":!0}}function gr(e,t,n){return Cn("close",e,t)?n.includes("close"):!1}function cc(e,t){return e==="inline"&&t==="fullscreen"?"exit-fullscreen":"close"}var vf='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function vr(e){let t=n=>{if(n.key!=="Tab")return;let o=[...e.querySelectorAll(vf)].filter(l=>l.offsetParent!==null||l===document.activeElement);if(o.length===0){n.preventDefault();return}let r=o[0],a=o[o.length-1];if(!r||!a)return;let s=e.getRootNode().activeElement;n.shiftKey&&s===r?(n.preventDefault(),a.focus()):!n.shiftKey&&s===a&&(n.preventDefault(),r.focus())};return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)}function hr(e){return e.trim().split(/\s+/).slice(0,2).map(t=>t.charAt(0).toUpperCase()).join("")}var Ka=R.cssPrefix;function dc({agent:e,strings:t}){let n=e.status??"online",o=Qe(t,e.name),r=e.title?Qe(t,e.title):null;return i("div",{class:`${Ka}-agent`,children:[i("div",{class:`${Ka}-agent-avatar`,"data-status":n,children:e.avatar?i("img",{src:e.avatar,alt:""}):i("span",{children:hr(o)})}),i("div",{class:`${Ka}-agent-meta`,children:[i("strong",{children:o}),r?i("span",{children:r}):null]})]})}var uc=ne.scope("attachments");function br(e,t,n){let o=bf(e),r=[],a=[],s=xf(n.accept),l=t.reduce((d,p)=>d+p.size,0),c=t.length;for(let d of o){let p=hf(d,c,l,n,s);if(p){a.push({file:d,reason:p});continue}r.push(Pf(d)),l+=d.size,c+=1}return(r.length||a.length)&&uc.debug("ingest",{accepted:r.length,rejected:a.map(d=>({name:d.file.name,reason:d.reason}))}),{accepted:r,rejected:a}}function yr(e){try{URL.revokeObjectURL(e.previewUrl)}catch(t){uc.debug("revokeObjectURL failed",{error:t})}}function hf(e,t,n,o,r){return t>=o.maxCount?"count":n+e.size>o.maxBytes?"bytes":Sf(e,r)?null:"mime"}function bf(e){return e?Array.isArray(e)?e.filter(t=>t instanceof File):[...e].map(t=>t instanceof File?t:yf(t)).filter(t=>t!==null):[]}function yf(e){let t=e;return!t?.getAsFile||t.kind!=="file"?null:t.getAsFile()}function Pf(e){return{file:e,id:dt(),mediaType:e.type||"application/octet-stream",name:e.name||"pasted-file",previewUrl:URL.createObjectURL(e),size:e.size}}function xf(e){return e.split(",").map(t=>t.trim().toLowerCase()).filter(Boolean).map(t=>{if(t.startsWith("."))return{kind:"ext",ext:t};let[n="*",o="*"]=t.split("/");return{kind:"mime",type:n,subtype:o}})}function Sf(e,t){if(t.length===0)return!0;let[n="*",o="*"]=(e.type||"").toLowerCase().split("/"),r=(e.name||"").toLowerCase();return t.some(a=>a.kind==="ext"?r.endsWith(a.ext):(a.type==="*"||a.type===n)&&(a.subtype==="*"||a.subtype===o))}var ao=R.cssPrefix;function _c({attachment:e,onRemove:t,disabled:n=!1}){let o=e.mediaType.startsWith("image/");return i("span",{class:`${ao}-attachment-chip`,title:e.name,"data-testid":Ue(T.attachmentChip,e.id),children:[o?i("img",{class:`${ao}-attachment-thumb`,src:e.previewUrl,alt:""}):i("span",{class:`${ao}-attachment-thumb`,"aria-hidden":"true",children:i(Gl,{})}),i("span",{class:`${ao}-attachment-name`,children:e.name}),i("button",{type:"button",class:`${ao}-attachment-remove`,onClick:t,disabled:n,"aria-label":`Remove ${e.name}`,"data-testid":Ue(T.attachmentRemove,e.id),children:i(yt,{})})]})}var Ga={isSupported:!1,start:()=>{},stop:()=>{},cancel:()=>{}};function ja(e,t,n){return e==="disabled"?Ga:e==="server"?Rf(n):kf(t)}function kf(e){let t=wf();if(!t)return Ga;let n=null,o=0;return{isSupported:!0,start(r,a){let s=n,l=++o;n=null,s?.abort();let c=new t;n=c,c.continuous=!0,c.interimResults=!0,c.lang=e;let d=!1;c.addEventListener("result",_=>{if(o!==l||n!==c)return;let u=_,f="",m=!1;for(let h=u.resultIndex;h<u.results.length;h++){let P=u.results[h];P&&(f+=P[0].transcript,P.isFinal&&(m=!0))}r(f,m)});let p=()=>{d||o!==l||n!==c||(d=!0,n=null,a())};c.addEventListener("end",p),c.addEventListener("error",p);try{c.start()}catch{p()}},stop(){n?.stop()},cancel(){o++;let r=n;n=null,r?.abort()}}}function wf(){return window.SpeechRecognition??window.webkitSpeechRecognition}var Cf=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];function Rf(e){if(typeof MediaRecorder>"u"||!navigator?.mediaDevices?.getUserMedia)return Ga;let t=0,n=null,o=s=>{for(let l of s.stream?.getTracks()??[])l.stop();s.stream=null},r=()=>{t++;let s=n;n=null,s&&(o(s),s.recorder?.state!=="inactive"&&s.recorder?.stop())},a=async s=>{if(s.finishing)return;s.finishing=!0;let l=s.recorder?.mimeType??"audio/webm";o(s);let c=new Blob(s.chunks,{type:l});s.chunks=[];try{let{text:d}=await e(c,l);n===s&&t===s.generation&&d&&s.onText(d,!0)}catch{}finally{n===s&&t===s.generation&&(n=null,s.onEnd())}};return{isSupported:!0,async start(s,l){r();let c={generation:t,recorder:null,stream:null,chunks:[],onText:s,onEnd:l,finishing:!1};n=c;try{let d=await navigator.mediaDevices.getUserMedia({audio:!0});if(n!==c||t!==c.generation){for(let u of d.getTracks())u.stop();return}c.stream=d;let p=Tf(),_=new MediaRecorder(d,p?{mimeType:p}:void 0);c.recorder=_,_.addEventListener("dataavailable",u=>{n===c&&t===c.generation&&u.data.size>0&&c.chunks.push(u.data)}),_.addEventListener("stop",()=>{n===c&&t===c.generation&&a(c)}),_.start()}catch{o(c),n===c&&t===c.generation&&(n=null,l())}},stop(){let s=n;if(s){if(!s.recorder){r();return}s.recorder.state!=="inactive"&&s.recorder.stop()}},cancel(){r()}}}function Tf(){for(let e of Cf)if(MediaRecorder.isTypeSupported(e))return e}var st=R.cssPrefix,Rn=ne.scope("composer");function Tn(e){return e.reduce((t,n)=>t+n.size,0)}var If={arrowUp:Tl,paperPlane:Rl,send:Il,chevron:wn};function pc(e){return"activeElement"in e}function Ef(e){return"host"in e&&"activeElement"in e}function fc({options:e,transport:t,feedback:n,bus:o,persistence:r,conversationId:a,isStreaming:s,active:l=!0,isPreparing:c=!1,operatorRequestEnabled:d,canRequestOperator:p=!1,controlMode:_,onRequestOperator:u,onSend:f,onStop:m,attachApiRef:h}){let P=e.strings,[k,S]=$(()=>r.loadDraft(a)),[b,x]=$([]),[y,w]=$(!1),[D,q]=$(!1),B=O(!1),M=O(null),F=O(null),H=O(null),V=O(0),ee=O(a);ee.current=a;let W=O(l);W.current=l;let se=O(c);se.current=c;let ae=D||c||!l,xe=N(z=>{S(G=>{let J=typeof z=="function"?z(G):z;return J===G?G:(r.saveDraft(ee.current,J),J)})},[r]),ue=e.features.fileUpload,ye=e.features.voice,[pe,Ze]=$(()=>ja(ye,e.locale,(z,G)=>t.transcribe(z,G))),ot=O(pe);ot.current=pe;let ct=O({mode:ye,locale:e.locale,transport:t});L(()=>{let z=ct.current;z.mode===ye&&z.locale===e.locale&&z.transport===t||(ct.current={mode:ye,locale:e.locale,transport:t},V.current++,ot.current.cancel(),H.current=null,w(!1),Ze(ja(ye,e.locale,(G,J)=>t.transcribe(G,J))))},[e.locale,ye,t]),L(()=>()=>{V.current++,pe.cancel()},[pe]);let Ge=N(z=>{let G=H.current;if(G===null)return!1;let J=Date.now()-G;return Rn[z]("voiceStop",{durationMs:J}),o.emit("voiceStop",{durationMs:J}),H.current=null,!0},[o]),je=N(()=>{H.current!==null&&(pe.stop(),w(!1),Ge("info")&&n.play("voiceStop"))},[Ge,n,pe]),Ye=N(()=>{V.current++,pe.cancel(),w(!1),Ge("info")&&n.play("voiceStop")},[Ge,n,pe]);L(()=>{(c||!l)&&Ye()},[l,Ye,c]),L(()=>{let z=M.current;if(!z)return;let G=z.getRootNode(),J=pc(G)?G.activeElement:null;J&&z.closest(`.${st}-panel`)?.contains(J)||z.focus({preventScroll:!0})},[]),L(()=>{let z=M.current;if(!z)return;if(k.length===0){z.style.height="";return}z.style.height="auto";let G=getComputedStyle(z),J=Number.parseFloat(G.getPropertyValue(`--${st}-textarea-base-height`)),C=Number.parseFloat(G.borderTopWidth)+Number.parseFloat(G.borderBottomWidth),g=Math.min(z.scrollHeight+C,Number.parseFloat(G.maxHeight)),E=Number.parseFloat(G.fontSize)*.7;z.style.height=`${g<J+E?J:g}px`},[k]);let Je=O(b);Je.current=b,L(()=>()=>Je.current.forEach(yr),[]),L(()=>{if(h)return h.current={attachFromDrop:z=>{if(!ue||!W.current||B.current||se.current)return;let G=br(z,Je.current,e.attachments);G.accepted.length!==0&&(Rn.info("attach (drop)",{count:G.accepted.length,totalBytes:Tn(G.accepted)}),o.emit("attach",{count:G.accepted.length,totalBytes:Tn(G.accepted)}),x(J=>[...J,...G.accepted]))},fill:z=>{if(!W.current||B.current||se.current)return;xe(z);let G=M.current;G&&(G.focus({preventScroll:!0}),requestAnimationFrame(()=>G.setSelectionRange(G.value.length,G.value.length)))}},()=>{h.current&&(h.current=null)}},[h,ue,c,e.attachments,xe]),L(()=>{let z=M.current;if(!z)return;let G=z.closest(`.${st}-panel`);if(!G)return;let J=C=>{if(!W.current||B.current||se.current)return;let g=C.clipboardData;if(!g)return;let E=C.target?.closest?.("input, textarea, [contenteditable]:not([contenteditable='false'])");if(E&&E!==z)return;if(ue){let j=br(g.items,Je.current,e.attachments);if(j.accepted.length>0){C.preventDefault(),Rn.info("attach (paste)",{count:j.accepted.length,totalBytes:Tn(j.accepted)}),o.emit("attach",{count:j.accepted.length,totalBytes:Tn(j.accepted)}),x(Z=>[...Z,...j.accepted]);return}}if(E===z)return;let Q=g.getData("text/plain");Q&&(C.preventDefault(),xe(j=>j+Q),z.focus())};return G.addEventListener("paste",J),()=>G.removeEventListener("paste",J)},[ue,e.attachments,xe]);let _t=async()=>{let z=k.trim();if(!z&&b.length===0||!l||s||B.current||c)return;Ye(),B.current=!0,q(!0);let G=k,J=b;try{await f(z,J)&&(xe(C=>C===G?"":C),x(C=>C!==J?C:(J.forEach(yr),Je.current=[],[])))}finally{B.current=!1,q(!1),requestAnimationFrame(()=>{let C=M.current;if(!C||C.disabled||!W.current)return;let g=C.getRootNode(),E=pc(g)?g.activeElement:null,Q=E?.getAttribute("data-testid");if(!(E&&E!==C&&Q!==T.composerSend&&Q!==T.composerStop)){if(Ef(g)){let j=g.host.ownerDocument;if(!j.hasFocus())return;let Z=j.activeElement;if(Z&&Z!==g.host&&Z!==j.body)return}C.focus({preventScroll:!0})}})}},Pe=z=>{z.key!=="Enter"||z.shiftKey||z.isComposing||(z.preventDefault(),s?m():_t())},Fe=z=>{let G=z.target;if(!l||B.current||c){G.value="";return}let J=br(G.files,b,e.attachments);J.accepted.length>0&&(Rn.info("attach (file picker)",{count:J.accepted.length,totalBytes:Tn(J.accepted)}),o.emit("attach",{count:J.accepted.length,totalBytes:Tn(J.accepted)}),x(C=>[...C,...J.accepted])),G.value=""},Ve=z=>{!l||B.current||c||(Rn.info("removeAttachment",{id:z}),o.emit("removeAttachment",{id:z}),x(G=>{let J=G.find(C=>C.id===z);return J&&yr(J),G.filter(C=>C.id!==z)}))},et=()=>{if(y){je();return}if(!l||!pe.isSupported||B.current||c)return;let z=++V.current;H.current=Date.now(),Rn.info("voiceStart"),o.emit("voiceStart",void 0),w(!0),n.play("voiceStart"),pe.start((G,J)=>{V.current!==z||!W.current||se.current||B.current||!J||xe(C=>`${C}${G} `)},()=>{V.current!==z||!W.current||(w(!1),Ge("debug"))})},pt=If[e.composer.sendButton.icon];return i("div",{class:`${st}-composer`,"data-testid":T.composer,children:[b.length>0?i("div",{class:`${st}-attachments`,children:b.map(z=>i(_c,{attachment:z,onRemove:()=>Ve(z.id),disabled:ae},z.id))}):null,i("div",{class:`${st}-composer-row`,children:[i("div",{class:`${st}-composer-actions`,children:[ue?i("button",{type:"button",class:`${st}-icon-btn`,onClick:()=>F.current?.click(),disabled:ae,"aria-label":P.attach,"data-testid":T.composerAttach,children:i(Al,{})}):null,pe.isSupported?i("button",{type:"button",class:`${st}-icon-btn`,onClick:et,disabled:ae,"aria-label":y?P.micStop:P.micStart,"aria-pressed":y,"data-recording":y?"true":void 0,"data-testid":T.composerVoice,children:i(Ml,{})}):null]}),i("textarea",{ref:M,name:"message",class:`${st}-textarea`,rows:1,value:k,placeholder:P.composerPlaceholder,onInput:z=>xe(z.currentTarget.value),onKeyDown:Pe,disabled:ae,"aria-label":P.composerPlaceholder,"data-testid":T.composerInput}),s?i("button",{type:"button",class:`${st}-send`,onClick:m,disabled:ae,"aria-label":P.stop,"data-testid":T.composerStop,children:i(El,{})}):i("button",{type:"button",class:`${st}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:()=>{_t()},disabled:ae||!k.trim()&&b.length===0,"aria-label":P.send,"data-testid":T.composerSend,children:i(pt,{})}),d&&_==="ai-agent"&&u?i("button",{type:"button",class:`${st}-icon-btn`,onClick:u,disabled:ae||!p,"aria-label":P.talkToOperator,title:P.talkToOperator,"data-testid":T.operatorRequest,children:i(Va,{})}):null]}),i("input",{ref:F,name:"attachments",type:"file",multiple:!0,accept:e.attachments.accept,onChange:Fe,disabled:ae,class:`${st}-sr-only`,"data-testid":T.composerFileInput})]})}var Af=R.cssPrefix;function mc({visible:e,strings:t}){return e?i("div",{class:`${Af}-dropzone`,role:"status","aria-live":"polite",children:t.dropZone}):null}function Pr({containerRef:e,onDrop:t,disabled:n=!1}){let[o,r]=$(!1);return L(()=>{if(n){r(!1);return}let a=e.current;if(!a)return;let s=0,l=_=>{s+=1,_.dataTransfer?.types.includes("Files")&&(_.preventDefault(),r(!0))},c=()=>{s-=1,!(s>0)&&(s=0,r(!1))},d=_=>{_.dataTransfer?.types.includes("Files")&&_.preventDefault()},p=_=>{s=0,r(!1),_.dataTransfer&&(_.preventDefault(),t(_.dataTransfer.items))};return a.addEventListener("dragenter",l),a.addEventListener("dragleave",c),a.addEventListener("dragover",d),a.addEventListener("drop",p),()=>{a.removeEventListener("dragenter",l),a.removeEventListener("dragleave",c),a.removeEventListener("dragover",d),a.removeEventListener("drop",p)}},[e,n,t]),{visible:n?!1:o}}function gc({itemCount:e,initialFocusIndex:t}){let[n,o]=$(!1),r=O(null),a=O(null),[s,l]=$(-1),c=N(()=>{o(!1),l(-1),r.current?.focus()},[]),d=N(()=>o(u=>!u),[]);L(()=>{if(!n)return;let u=f=>{let m=a.current,h=r.current;if(!m||!h)return;let P=f.composedPath();P.includes(m)||P.includes(h)||(o(!1),l(-1))};return document.addEventListener("click",u,!0),()=>document.removeEventListener("click",u,!0)},[n]),L(()=>{if(!n||e===0)return;let u=t?.()??0,f=u<0||u>=e?0:u;l(f)},[n,e,t]),L(()=>{if(!n||s<0)return;a.current?.querySelectorAll("[role='menuitem']")?.[s]?.focus()},[n,s]);let p=N(u=>{(u.key==="ArrowDown"||u.key==="Enter"||u.key===" ")&&(u.preventDefault(),o(!0))},[]),_=N(u=>{if(e!==0)switch(u.key){case"Escape":u.preventDefault(),c();return;case"ArrowDown":u.preventDefault(),l(f=>(f+1)%e);return;case"ArrowUp":u.preventDefault(),l(f=>(f-1+e)%e);return;case"Home":u.preventDefault(),l(0);return;case"End":u.preventDefault(),l(e-1)}},[e,c]);return{open:n,focusIndex:s,triggerRef:r,menuRef:a,toggle:d,close:c,onTriggerKey:p,onMenuKey:_}}function vc({items:e,triggerLabel:t}){let n=R.cssPrefix,o=gc({itemCount:e.length}),r=l=>{l.disabled||(l.onSelect?.(),l.keepOpen||o.close())},a=(l,c)=>l.onSelectValue?.(c),s=(l,c)=>{let d=c.segments;if(!d?.length)return;let p=Math.max(0,d.findIndex(u=>u.value===c.value)),_=-1;if(l.key==="ArrowRight"||l.key==="Enter"||l.key===" ")_=(p+1)%d.length;else if(l.key==="ArrowLeft")_=(p-1+d.length)%d.length;else return;l.preventDefault(),l.stopPropagation(),a(c,d[_].value)};return i("div",{class:`${n}-menu-wrap`,children:[i("button",{ref:o.triggerRef,type:"button",class:`${n}-icon-btn`,"aria-label":t,"aria-haspopup":"menu","aria-expanded":o.open,title:t,onClick:o.toggle,onKeyDown:o.onTriggerKey,children:i(Bl,{})}),o.open?i("div",{ref:o.menuRef,class:`${n}-menu`,role:"menu","aria-label":t,onKeyDown:o.onMenuKey,tabIndex:-1,children:e.map(l=>l.segments?i("div",{role:"menuitem",class:`${n}-menu-item ${n}-menu-item-segmented`,"aria-label":l.label,tabIndex:-1,onKeyDown:c=>s(c,l),children:[l.icon?i("span",{class:`${n}-menu-icon`,children:l.icon}):null,i("span",{class:`${n}-menu-label`,children:l.label}),i("span",{class:`${n}-segmented`,role:"group","aria-label":l.label,children:l.segments.map(c=>{let d=c.value===l.value;return i("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":`${T.langSegment}-${c.value}`,onClick:()=>a(l,c.value),children:c.label},c.value)})})]},l.id):i("button",{type:"button",role:"menuitem",class:`${n}-menu-item`,"aria-pressed":l.type==="switch"?l.on:void 0,disabled:l.disabled,onClick:()=>r(l),children:[l.icon?i("span",{class:`${n}-menu-icon`,children:l.icon}):null,i("span",{class:`${n}-menu-label`,children:l.label}),l.type==="switch"&&l.on?i("span",{class:`${n}-menu-check`,"aria-hidden":"true",children:i(en,{})}):null]},l.id))}):null]})}var Xa=R.cssPrefix;function Mf(e){let t=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)").matches:!0;return e==="auto"?t?"light":"dark":t?e==="light"?"dark":"auto":e==="dark"?"light":"auto"}var Lf={normal:"large",large:"small",small:"normal"};function Of(e){return e==="light"?i(Jl,{}):e==="dark"?i(Ql,{}):i(Zl,{})}function Nf(e){return(e.split("-")[0]??e).toUpperCase()}function Df(e,t){let n;try{n=new URL(e,window.location.href)}catch{return}if(!(n.protocol!=="http:"&&n.protocol!=="https:"))return t.conversationId&&n.searchParams.set("chat",t.conversationId),n.searchParams.set("widgetId",t.widgetId),t.publicKey&&n.searchParams.set("public_key",t.publicKey),n.searchParams.set("ai_agent_deployment_id",t.aiAgentDeploymentId),n.href}function Pt({panelProps:e,variant:t}){let{options:n,panelSize:o,feedback:r,onClose:a,onClear:s,onExpand:l,onFullscreen:c,onSoundToggle:d}=e,{onToggleHistory:p,onLocaleChange:_,onThemeChange:u,onTextSizeChange:f}=e,m=n.strings,h=n.mode,P=t==="chat",k=ut(()=>r.mutedSig.value).value,S=new Set(n.actions),b=W=>S.has(W),x=typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches,y=W=>x?!1:Cn(W,h,o),w=n.themeMode,D={auto:m.themeAuto,light:m.themeLight,dark:m.themeDark},q=n.textSize,B={small:m.textSizeSmall,normal:m.textSizeNormal,large:m.textSizeLarge},M=[];if(P&&b("clear")&&M.push({id:"clear",icon:i(Kl,{}),label:m.newConversation,onSelect:s}),b("expand")&&y("expand")){let W=o==="expanded";M.push({id:"expand",icon:W?i(Ol,{}):i(Ll,{}),label:W?m.collapse:m.expand,type:"switch",on:W,onSelect:l})}if(b("fullscreen")&&y("fullscreen")){let W=o==="fullscreen";M.push({id:"fullscreen",icon:W?i(Dl,{}):i(Nl,{}),label:W?m.exitFullscreen:m.fullscreen,type:"switch",on:W,onSelect:c})}let F=n.popOutUrl,H=n.aiAgentDeploymentId;b("popOut")&&F&&H&&Cn("popOut",h,o)&&M.push({id:"popOut",icon:i($l,{}),label:m.popOut,onSelect:()=>{let W=Df(F,{conversationId:e.conversationId,widgetId:n.widgetId,publicKey:n.publicKey,aiAgentDeploymentId:H});W&&window.open(W,"_blank","noopener,noreferrer")}}),P&&b("sound")&&M.push({id:"sound",icon:k?i(Ul,{}):i(Hl,{}),label:k?m.soundOff:m.soundOn,type:"switch",on:!k,onSelect:d}),b("theme")&&M.push({id:"theme",icon:Of(w),label:`${m.theme}: ${D[w]}`,onSelect:()=>u(Mf(w)),keepOpen:!0}),b("textSize")&&M.push({id:"textSize",icon:i(zl,{}),label:`${m.textSize}: ${B[q]}`,onSelect:()=>f(Lf[q]),keepOpen:!0}),b("language")&&n.availableLocales.length>1&&M.push({id:"language",icon:i(Wl,{}),label:m.language,segments:n.availableLocales.map(W=>({value:W,label:Nf(W),lang:W})),value:n.locale,onSelectValue:_});let V=!!a&&gr(h,o,n.actions),ee=P&&b("history");return i("div",{class:`${Xa}-header-actions`,children:[ee?i("button",{type:"button",class:`${Xa}-icon-btn`,onClick:p,"aria-label":m.history,title:m.history,"data-testid":T.actionHistory,children:i(Vl,{})}):null,M.length>0?i(vc,{items:M,triggerLabel:m.moreActions}):null,V?i("button",{type:"button",class:`${Xa}-icon-btn`,onClick:a,"aria-label":m.close,title:m.close,"data-testid":T.actionClose,children:i(yt,{})}):null]})}var $f=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Ff=/^https?:\/\/[^\s.]+\.[^\s]+$/i,Bf=/^[+]?[\d\s().-]{6,}$/;function In(e,t){return e.replace(/\{(\w+)\}/g,(n,o)=>String(t[o]??`{${o}}`))}function Hf(e){return Array.isArray(e)?e.length:e&&e.trim()?1:0}function Uf(e,t,n){let o=e.required??!0,r=e.validation;if(e.type==="multiselect"){let s=Hf(t);return o&&s===0?n.formRequired:s===0?void 0:r?.minSelections!=null&&s<r.minSelections?In(n.formChooseAtLeast,{min:r.minSelections}):r?.maxSelections!=null&&s>r.maxSelections?In(n.formChooseAtMost,{max:r.maxSelections}):void 0}let a=typeof t=="string"?t.trim():"";if(!a)return o?n.formRequired:void 0;switch(e.type){case"email":if(!$f.test(a))return n.formInvalidEmail;break;case"url":if(!Ff.test(a))return n.formInvalidUrl;break;case"tel":if(!Bf.test(a))return n.formInvalidTel;break;case"number":{let s=Number(a);if(!Number.isFinite(s))return n.formInvalidNumber;if(r?.min!=null&&s<r.min)return In(n.formNumberTooSmall,{min:r.min});if(r?.max!=null&&s>r.max)return In(n.formNumberTooLarge,{max:r.max});break}default:break}if(r?.minLength!=null&&a.length<r.minLength)return In(n.formTooShort,{min:r.minLength});if(r?.maxLength!=null&&a.length>r.maxLength)return In(n.formTooLong,{max:r.maxLength});if(r?.pattern)try{if(!new RegExp(r.pattern).test(a))return n.formPatternMismatch}catch{}}function hc(e,t,n){let o={};for(let r of e){let a=Uf(r,t[r.name],n);a&&(o[r.name]=a)}return o}function bc(e){let t={};for(let[n,o]of Object.entries(e)){let r=Array.isArray(o)?o.join(", "):o;r&&r.trim()&&(t[n]=r.trim())}return t}var Re=R.cssPrefix,xr="__other__";function io({fields:e,strings:t,submitLabel:n,onSubmit:o,skipLabel:r,onSkip:a,footerHint:s,submitOnEnter:l,disabled:c,initialValues:d,hideActions:p,fieldTypeLabels:_,rootTestId:u,submitTestId:f,skipTestId:m}){let[h,P]=$(()=>({...Wf(e),...d})),[k,S]=$({}),[b,x]=$({}),y=M=>{b[M]&&x(F=>({...F,[M]:""}))},w=(M,F)=>{P(H=>({...H,[M]:F})),y(M)},D=(M,F)=>{S(H=>({...H,[M]:F})),y(M)},q=M=>{if(M.preventDefault(),c)return;let F=Kf(e,h,k),H=hc(e,F,t);if(Object.keys(H).length>0){x(H);return}o(bc(F))},B=M=>{!l||M.key!=="Enter"||M.shiftKey||M.isComposing||M.target?.tagName==="TEXTAREA"&&q(M)};return i("form",{class:`${Re}-form`,onSubmit:q,onKeyDown:B,"data-testid":u,noValidate:!0,children:[e.map(M=>i(zf,{field:M,value:h[M.name],otherText:k[M.name]??"",error:b[M.name],disabled:c,typeLabel:_?.[M.name],strings:t,onChange:F=>w(M.name,F),onOtherChange:F=>D(M.name,F)},M.name)),p?null:i("div",{class:`${Re}-form-actions`,children:[s?i("span",{class:`${Re}-form-hint`,children:s}):null,r&&a?i("button",{type:"button",class:`${Re}-form-skip`,onClick:a,disabled:c,"data-testid":m,children:r}):null,i("button",{type:"submit",class:`${Re}-form-submit`,disabled:c,"data-testid":f,children:n})]})]})}function zf({field:e,value:t,otherText:n,error:o,disabled:r,typeLabel:a,strings:s,onChange:l,onOtherChange:c}){let d=Ue(T.formField,e.name),p=qf({field:e,value:t,otherText:n,disabled:r,strings:s,onChange:l,onOtherChange:c,fieldTid:d});return i("label",{class:`${Re}-field`,"data-field":e.name,"data-invalid":o?"true":void 0,children:[i("span",{class:`${Re}-field-head`,children:[i("span",{class:`${Re}-field-label`,children:[e.label,e.required??!0?i("span",{class:`${Re}-field-req`,"aria-hidden":"true",children:" *"}):null]}),a?i("span",{class:`${Re}-field-type`,children:a}):null]}),p,e.validationHint&&!o?i("span",{class:`${Re}-field-hint`,children:e.validationHint}):null,o?i("span",{class:`${Re}-field-error`,role:"alert",children:o}):null]})}function qf(e){let{field:t,value:n,otherText:o,disabled:r,strings:a,onChange:s,onOtherChange:l,fieldTid:c}=e,d=typeof n=="string"?n:"";switch(t.type){case"textarea":return i("textarea",{class:`${Re}-field-input`,rows:3,value:d,placeholder:t.placeholder,disabled:r,onInput:p=>s(p.target.value),"data-testid":c});case"select":return i("select",{class:`${Re}-field-input`,value:d,disabled:r,onChange:p=>s(p.target.value),"data-testid":c,children:[i("option",{value:"",children:t.placeholder??"\u2014"}),(t.options??[]).map(p=>i("option",{value:p.value,children:p.label??p.value},p.value))]});case"radio":{let p=t.allowOther&&d===xr;return i("div",{class:`${Re}-field-choices`,role:"radiogroup","data-testid":c,children:[(t.options??[]).map(_=>i("label",{class:`${Re}-choice`,children:[i("input",{type:"radio",name:`${Re}-${t.name}`,checked:d===_.value,disabled:r,onChange:()=>s(_.value)}),i("span",{children:_.label??_.value})]},_.value)),t.allowOther?i("label",{class:`${Re}-choice`,children:[i("input",{type:"radio",name:`${Re}-${t.name}`,checked:d===xr,disabled:r,onChange:()=>s(xr)}),i("span",{children:a.formOther})]}):null,p?i("input",{class:`${Re}-field-input`,value:o,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:r,onInput:_=>l(_.target.value)}):null]})}case"checkbox":return i("label",{class:`${Re}-choice`,children:[i("input",{type:"checkbox",checked:d==="true",disabled:r,onChange:p=>s(p.target.checked?"true":""),"data-testid":c}),i("span",{children:t.placeholder??t.label})]});case"multiselect":{let p=Array.isArray(n)?n:[],_=(u,f)=>s(f?[...p,u]:p.filter(m=>m!==u));return i("div",{class:`${Re}-field-choices`,"data-testid":c,children:[(t.options??[]).map(u=>i("label",{class:`${Re}-choice`,children:[i("input",{type:"checkbox",checked:p.includes(u.value),disabled:r,onChange:f=>_(u.value,f.target.checked)}),i("span",{children:u.label??u.value})]},u.value)),t.allowOther||(t.options??[]).length===0?i("textarea",{class:`${Re}-field-input`,rows:2,value:o,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:r,onInput:u=>l(u.target.value)}):null]})}default:return i("input",{class:`${Re}-field-input`,type:Vf(t.type),value:d,placeholder:t.placeholder,disabled:r,onInput:p=>s(p.target.value),"data-testid":c})}}function Vf(e){switch(e){case"number":case"email":case"tel":case"url":case"date":case"time":return e;default:return"text"}}function Wf(e){let t={};for(let n of e)n.defaultValue!=null&&(t[n.name]=n.type==="multiselect"?n.defaultValue.split(",").map(o=>o.trim()).filter(Boolean):n.defaultValue);return t}function Kf(e,t,n){let o={...t};for(let r of e){let a=n[r.name]?.trim();if(r.type==="radio"&&r.allowOther&&t[r.name]===xr)o[r.name]=a??"";else if(r.type==="multiselect"&&a){let s=a.split(/[,\n;]+/).map(c=>c.trim()).filter(Boolean),l=Array.isArray(t[r.name])?t[r.name]:[];o[r.name]=[...l,...s]}}return o}var xt=R.cssPrefix;function Ya({form:e,strings:t,onSubmit:n,onSkip:o}){return i("div",{class:`${xt}-form-gate`,"data-testid":T.formGate,children:[e.title?i("h3",{class:`${xt}-form-gate-title`,children:e.title}):null,e.description?i("p",{class:`${xt}-form-gate-desc`,children:e.description}):null,i(io,{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:T.formSubmit,skipTestId:T.formSkip})]})}function yc({marker:e,strings:t,onFill:n}){let o=e.outcome==="skipped",r=o?t.formSkipped:t.formSubmitted,a=e.title?i(de,{children:[i("span",{children:e.title}),i("span",{class:`${xt}-sr-only`,children:r})]}):i("span",{children:r}),s=e.form?.reviewable??!1,l=!o&&s&&e.values&&Object.keys(e.values).length>0?e.values:null;if(l){let c=d=>e.form?.fields.find(p=>p.name===d)?.label??d;return i("details",{class:`${xt}-form-done`,"data-outcome":e.outcome,"data-testid":T.formDone,children:[i("summary",{class:`${xt}-form-done-summary`,"data-testid":T.formDoneToggle,children:[i(en,{}),a,i(wn,{})]}),i("dl",{class:`${xt}-form-answers`,"data-testid":T.formAnswers,children:Object.entries(l).map(([d,p])=>i("div",{class:`${xt}-form-answer`,children:[i("dt",{children:c(d)}),i("dd",{children:p})]},d))})]})}return i("div",{class:`${xt}-form-done`,"data-outcome":e.outcome,"data-testid":T.formDone,role:"status",children:[o?i(ql,{}):i(en,{}),a,o&&e.form?.reopenable&&n?i("button",{type:"button",class:`${xt}-form-done-fill`,"data-testid":T.formFill,onClick:n,children:t.formFillOut}):null]})}function Xf(e,t){for(var n in t)e[n]=t[n];return e}function Qa(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var o in t)if(o!=="__source"&&e[o]!==t[o])return!0;return!1}function Pc(e,t){this.props=e,this.context=t}function Ic(e,t){function n(r){var a=this.props.ref;return a!=r.ref&&a&&(typeof a=="function"?a(null):a.current=null),t?!t(this.props,r)||a!=r.ref:Qa(this.props,r)}function o(r){return this.shouldComponentUpdate=n,Tt(e,r)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.__f=o.prototype.isReactComponent=!0,o.type=e,o}(Pc.prototype=new tt).isPureReactComponent=!0,Pc.prototype.shouldComponentUpdate=function(e,t){return Qa(this.props,e)||Qa(this.state,t)};var xc=te.__b;te.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),xc&&xc(e)};var Gy=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var Yf=te.__e;te.__e=function(e,t,n,o){if(e.then){for(var r,a=t;a=a.__;)if((r=a.__c)&&r.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k||[]),r.__c(e,t)}Yf(e,t,n,o)};var Sc=te.unmount;function Ec(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(o){typeof o.__c=="function"&&o.__c()}),e.__c.__H=null),(e=Xf({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(o){return Ec(o,t,n)})),e}function Ac(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(o){return Ac(o,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function Ja(){this.__u=0,this.o=null,this.__b=null}function Mc(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function Sr(){this.i=null,this.l=null}te.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Sc&&Sc(e)},(Ja.prototype=new tt).__c=function(e,t){var n=t.__c,o=this;o.o==null&&(o.o=[]),o.o.push(n);var r=Mc(o.__v),a=!1,s=function(){a||o.__z||(a=!0,n.__R=null,r?r(c):c())};n.__R=s;var l=n.__P;n.__P=null;var c=function(){if(!--o.__u){if(o.state.__a){var d=o.state.__a;o.__v.__k[0]=Ac(d,d.__c.__P,d.__c.__O)}var p;for(o.setState({__a:o.__b=null});p=o.o.pop();)p.__P=l,p.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(s,s)},Ja.prototype.componentWillUnmount=function(){this.o=[]},Ja.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=Ec(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&Tt(de,null,e.fallback);return r&&(r.__u&=-33),[Tt(de,null,t.__a?null:e.children),r]};var kc=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(Sr.prototype=new tt).__a=function(e){var t=this,n=Mc(t.__v),o=t.l.get(e);return o[0]++,function(r){var a=function(){t.props.revealOrder?(o.push(r),kc(t,e,o)):r()};n?n(a):a()}},Sr.prototype.render=function(e){this.i=null,this.l=new Map;var t=Un(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Sr.prototype.componentDidUpdate=Sr.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){kc(e,n,t)})};var Jf=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Qf=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Zf=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,em=/[A-Z0-9]/g,tm=typeof document<"u",nm=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};tt.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(tt.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var wc=te.event;te.event=function(e){return wc&&(e=wc(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Lc,om={configurable:!0,get:function(){return this.class}},Cc=te.vnode;te.vnode=function(e){typeof e.type=="string"&&(function(t){var n=t.props,o=t.type,r={},a=o.indexOf("-")==-1;for(var s in n){var l=n[s];if(!(s==="value"&&"defaultValue"in n&&l==null||tm&&s==="children"&&o==="noscript"||s==="class"||s==="className")){var c=s.toLowerCase();s==="defaultValue"&&"value"in n&&n.value==null?s="value":s==="download"&&l===!0?l="":c==="translate"&&l==="no"?l=!1:c[0]==="o"&&c[1]==="n"?c==="ondoubleclick"?s="ondblclick":c!=="onchange"||o!=="input"&&o!=="textarea"||nm(n.type)?c==="onfocus"?s="onfocusin":c==="onblur"?s="onfocusout":Zf.test(s)&&(s=c):c=s="oninput":a&&Qf.test(s)?s=s.replace(em,"-$&").toLowerCase():l===null&&(l=void 0),c==="oninput"&&r[s=c]&&(s="oninputCapture"),r[s]=l}}o=="select"&&(r.multiple&&Array.isArray(r.value)&&(r.value=Un(n.children).forEach(function(d){d.props.selected=r.value.indexOf(d.props.value)!=-1})),r.defaultValue!=null&&(r.value=Un(n.children).forEach(function(d){d.props.selected=r.multiple?r.defaultValue.indexOf(d.props.value)!=-1:r.defaultValue==d.props.value}))),n.class&&!n.className?(r.class=n.class,Object.defineProperty(r,"className",om)):n.className&&(r.class=r.className=n.className),t.props=r})(e),e.$$typeof=Jf,Cc&&Cc(e)};var Rc=te.__r;te.__r=function(e){Rc&&Rc(e),Lc=e.__c};var Tc=te.diffed;te.diffed=function(e){Tc&&Tc(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value),Lc=null};function kr(e){if(!e)return!1;let t=e.startsWith("tool:")?e.slice(5):e;return t==="ask-user-questions"||t==="ask_user_questions"}var gt=R.cssPrefix;function ei(e){return e.startsWith("tool:")||e.startsWith("tool-")?e.slice(5):e}function wr(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 ti({status:e,icon:t,label:n}){return i("span",{class:`${gt}-toolui-badge ${gt}-toolui-status`,"data-status":e,children:[i("span",{class:`${gt}-toolui-status-icon`,children:t}),n]})}function rm(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 ni(e,t,n={}){return n.submitted?"responded":sm(rm(e,t),n.superseded,n.live??!0)}function am({status:e}){return e==="denied"||e==="error"||e==="superseded"?i(_r,{}):e==="completed"||e==="responded"?i(ur,{}):i(rc,{})}function im(e,t){switch(e){case"awaiting":return t.statusAwaiting;case"responded":return t.statusResponded;case"completed":return t.statusCompleted;case"denied":return t.statusDenied;case"error":return t.statusError;case"superseded":return t.statusSuperseded;default:return t.statusRunning}}function sm(e,t,n){return t&&(e==="awaiting"||e==="running")?"superseded":!n&&e==="running"?"error":e}function lm({state:e,approval:t,strings:n,superseded:o,live:r=!0,submitted:a=!1}){let s=ni(e,t,{superseded:o,live:r,submitted:a});return i(ti,{status:s,icon:i(am,{status:s}),label:im(s,n)})}function cm({name:e,state:t,approval:n,strings:o,superseded:r,live:a,submitted:s}){return i(de,{children:[i("span",{class:`${gt}-toolui-name-pill`,children:[i(oc,{}),i("span",{class:`${gt}-toolui-name-text`,children:e})]}),i(lm,{state:t,approval:n,strings:o,superseded:r,live:a,submitted:s}),i("span",{class:`${gt}-toolui-chevron`,children:i(tn,{})})]})}function Cr({part:e,strings:t,testid:n,superseded:o,live:r,submitted:a}){let s=ie(()=>fe(()=>e.inputSig.value),[e]),l=ie(()=>fe(()=>e.outputSig.value),[e]),c=ie(()=>fe(()=>e.errorSig.value),[e]),d=ie(()=>fe(()=>e.stateSig.value),[e]),p=ie(()=>fe(()=>e.approvalSig.value),[e]);return i("details",{class:`${gt}-toolui ${gt}-toolui-collapsible`,"data-testid":n,children:[i("summary",{class:`${gt}-toolui-head`,children:i(cm,{name:ei(e.toolName),state:d.value,approval:p.value,strings:t,superseded:o,live:r,submitted:a})}),i(Za,{label:t.toolParameters,value:s.value}),l.value!==void 0?i(Za,{label:t.toolResult,value:l.value}):null,c.value?i(Za,{label:t.statusError,value:c.value,error:!0}):null]})}function Za({label:e,value:t,error:n}){let o=n?String(t??""):Rr(oi(t));return o?i("div",{class:`${gt}-toolui-section`,children:[i("span",{class:`${gt}-toolui-label`,children:e}),i("pre",{class:`${gt}-toolui-code`,"data-error":n?"true":void 0,children:o})]}):null}function oi(e){if(e&&typeof e=="object"){let t=e;if(t.storage==="tool-result-ref"&&"summary"in t)return t.summary}return e}function Rr(e){if(e==null)return"";try{let t=typeof e=="string"?e:JSON.stringify(e,null,2);return!t||t==="{}"||t==="[]"||t==='""'?"":t.length>800?`${t.slice(0,800)}\u2026`:t}catch{return""}}function Oc(e){return e.partsSig.value.some(t=>t.kind==="text"&&t.textSig.value.length>0)}function Nc(e){return e.partsSig.value.some(t=>t.kind==="reasoning")}function dm(e){return e.streaming&&!e.bufferedHold&&!(e.reasoningVisible&&e.working)}function Dc(e){let{streaming:t,reasoningVisible:n,emptyReply:o,hidden:r}=e,a=e.responseMode==="buffered"&&t,s=t&&!e.hasAnswerText;return{streaming:t,bufferedHold:a,reasoningVisible:n,working:s,showStreamDots:dm({streaming:t,bufferedHold:a,reasoningVisible:n,working:s}),emptyReply:o,hidden:r}}function $c(e,t){let n=e.stateSig.value,o=e.approvalSig.value,{terminal:r,responded:a,decided:s}=wr(n,o),l=t.continuationStreaming===!0&&!s,c=t.superseded&&!s&&!l;return{pill:ni(n,o,{superseded:c,live:t.live,submitted:l}),state:n,terminal:r,decided:s||l,showApproveReject:!s&&!t.superseded&&!l,showAnswered:a&&!r&&!c,showSubmitted:l,showEdit:a&&t.active&&!r,skipped:c,answeredApproved:o?.approved}}var ii=1,Bc=2,Hc=4,Uc=8,zc=16;function um(e){switch(e){case ii:return"href";case Bc:return"src";case Hc:return"class";case Uc:return"checked";case zc:return"start"}}var _m=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}},pm=_m;var Fc=24;function li(e){let t=new Uint32Array(Fc);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(Fc),indent:"",indent_len:0,table_state:0}}function qc(e){e.pending.length>0&&Ke(e,`
|
|
12
|
-
`)}function
|
|
13
|
-
`:if(console.assert(e.pending.length===1),e.tokens[e.len]===25&&e.token===21){
|
|
14
|
-
`:if(e.hr_chars<3)break;
|
|
15
|
-
`:{
|
|
16
|
-
`:e.table_state=2,e.pending="";continue;default
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
${a}`:a;continue}r.startsWith("id:")&&(o=r.slice(3).trim())}if(n==="[DONE]")return"done";if(!n)return null;try{let r=JSON.parse(n);return ol.trace("chunk",{type:r.type,eventId:o}),{chunk:r,eventId:o}}catch(r){throw ol.trace("frame parse failed",{err:r,payload:n.slice(0,200)}),new Qe("invalid SSE frame","network",void 0,r)}}function Mp(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 al=e=>e&&Object.keys(e).length>0?e:void 0;function il(e,t){let n=al(e),o=al(t);if(!n&&!o)return;let r={};return n&&(r.user=n),o&&(r.page=o),Mp(JSON.stringify(r))}function sl(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function Lp(e){return`tool-${e.startsWith("tool:")?e.slice(5):e}`}function ll(e){return e.startsWith("tool-")?e.slice(5):e}var ut={handshake:"/pai/handshake",streamMessage:"/pai/stream-message",streamResume:"/pai/stream-resume",cancelStream:"/pai/cancel-stream",listConversations:"/pai/list-conversations",listMessages:"/pai/list-messages",updateSettings:"/pai/update-settings",markRead:"/pai/mark-read",messageFeedback:"/pai/message-feedback",requestOperator:"/pai/request-operator",cancelOperatorRequest:"/pai/cancel-request-operator",bootstrap:"/pai/bootstrap",content:"/pai/content",submitForm:"/pai/submit-form"},cl="context";function rr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function dl(e){if(!rr(e))return;let t=e,n=t.controlMode,o=t.controlRevision;if(!(n!=="ai-agent"&&n!=="awaiting_operator"&&n!=="operator"||typeof o!="number"||!Number.isSafeInteger(o)||o<0))return{controlMode:n,controlRevision:o,assignedOperatorInitials:typeof t.assignedOperatorInitials=="string"&&t.assignedOperatorInitials?t.assignedOperatorInitials:void 0,operatorAvailable:typeof t.operatorAvailable=="boolean"?t.operatorAvailable:void 0}}function ul(e){if(!rr(e))return;let t=e.status,n=e.postFinishSequence;if(!(t!=="compacting"&&t!=="ready"||typeof n!="number"||!Number.isSafeInteger(n)||n<0))return{status:t,postFinishSequence:n}}function ar(e){let t=rr(e)?e.suggestions:void 0;if(!Array.isArray(t))return[];let n=[];for(let o of t){if(!rr(o))continue;let{id:r,label:a,text:s}=o;typeof a!="string"||!a||n.push({id:typeof r=="string"&&r?r:`s${n.length}`,label:a,text:typeof s=="string"&&s?s:a})}return n}function Da(e){let n={messages:e.messages.map(o=>({id:o.serverMessageId??o.id,parts:Np(o),role:o.role})),conversationId:e.conversationId,responseType:"ack"};return e.visitorId&&(n.visitorId=e.visitorId),e.userPrefs&&(n.userPrefs=e.userPrefs),n}function Op(e){return e.state==="output-available"||e.state==="output-error"||e.state==="output-denied"||e.approval?.approved!==void 0}function Np(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"&&Op(n)){let o=n.dynamic?{type:"dynamic-tool",toolName:n.toolName,toolCallId:n.toolCallId,state:n.state}:{type:Lp(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 Ie=te.scope("transport"),Dp=6e4,$p=1e4,Fa=50,gl=new WeakMap;function Cn(e){return gl.get(e)}function no(e,t){return gl.set(e,t),e}function _l(e){return Math.max(e?.upsertRevision??0,e?.read?.revision??0)}function Fp(e,t){return e.conversationId===t.conversationId&&e.title===t.title&&e.lastMessageAt===t.lastMessageAt&&e.preview===t.preview&&e.canContinue===t.canContinue&&e.hasUnread===t.hasUnread&&e.controlState===t.controlState}function Ot(e,t,n=!0){switch(t.type){case"snapshot":{let o=new Map(e.map(s=>[s.conversationId,s])),r=e.filter(s=>(Cn(s)?.activityRevision??0)>t.requestedRevision).toSorted((s,l)=>Cn(l).activityRevision-Cn(s).activityRevision),a=new Set(r.map(s=>s.conversationId));return[...r,...t.result.conversations.filter(s=>!a.has(s.conversationId)).map(s=>{let l=o.get(s.conversationId);if(!l)return s;let c=Cn(l);return(c?.upsertRevision??0)>t.requestedRevision?l:c?.read&&!l.hasUnread&&c.read.lastMessageAt===s.lastMessageAt?no({...s,hasUnread:!1},{upsertRevision:0,read:c.read}):s})]}case"read":{let o=e.findIndex(c=>c.conversationId===t.conversationId&&(t.lastMessageAt===void 0||c.lastMessageAt===t.lastMessageAt));if(o<0)return e;let r=e[o],a=Cn(r);if(_l(a)>t.revision)return e;let s=t.lastMessageAt??r.lastMessageAt,l={upsertRevision:a?.upsertRevision??0,...a?.activityRevision===void 0?{}:{activityRevision:a.activityRevision},read:{revision:t.revision,...s?{lastMessageAt:s}:{}}};return r.hasUnread?e.map((c,d)=>d===o?no({...c,hasUnread:!1},l):c):(no(r,l),e)}case"upsert":{let o=e.findIndex(d=>d.conversationId===t.conversation.conversationId);if(o<0&&!n)return e;let r=o<0?void 0:e[o],a=r?Cn(r):void 0;if(_l(a)>t.revision)return e;let s=t.activity?t.revision:a?.activityRevision,l={upsertRevision:t.revision,...s===void 0?{}:{activityRevision:s},...!t.conversation.hasUnread&&a?.read?{read:a.read}:{}},c=r?{...r,...t.conversation,title:r.title}:{...t.conversation};return r&&Fp(r,c)?(no(r,l),e):(no(c,l),t.activity?[c,...e.filter(d=>d.conversationId!==c.conversationId)]:r?e.map((d,_)=>_===o?c:d):[...e,c])}default:return t}}var pl=3,Bp=400,Hp=3e4,Up=1e4,zp=6e4,qp=15e3,Vp=1024*1024,fl=new Set([408,425,429,500,502,503,504]);function ml(e){return Bp*2**e+Math.floor(Math.random()*250)}function Wp(e){return zp+Math.ceil(e/Vp)*qp}function Kp(e){let t=e.get("retry-after");if(!t)return null;let n=Number(t),o=Number.isFinite(n)?n*1e3:Date.parse(t)-Date.now();return Number.isFinite(o)&&o>=0?Math.min(o,3e4):null}var ir=class{constructor(t){se(this,"ttlMs",t);se(this,"map",new Map)}getOrFetch(t,n){let o=this.map.get(t);if(o&&Date.now()-o.at<this.ttlMs)return o.result;let r={at:Date.now(),result:n().then(a=>(r.value=a,a)).catch(a=>{throw this.map.get(t)===r&&this.map.delete(t),a})};return this.map.set(t,r),r.result}peek(t){let n=this.map.get(t);if(n?.value!==void 0&&Date.now()-n.at<this.ttlMs)return n.value}update(t){for(let n of this.map.values()){if(n.value!==void 0){let o=t(n.value);n.value=o,n.result=Promise.resolve(o);continue}n.result=n.result.then(o=>{let r=t(o);return n.value=r,r})}}delete(t){this.map.delete(t)}},sr=class{constructor(t){se(this,"opts",t);se(this,"conversationListeners",new Set);se(this,"conversationRevision",0);se(this,"visitorId");se(this,"conversationId");se(this,"userContext");se(this,"pageContext");se(this,"locale");se(this,"conversationsCache",new ir($p));se(this,"contentCache",new ir(Dp))}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:vn};this.visitorId&&(t.visitorId=this.visitorId),this.conversationId&&(t.conversationId=this.conversationId),this.locale&&(t.locale=this.locale);let n=il(this.userContext,this.pageContext);return n&&(t[cl]=n),t}withEnvelope(t){return{...this.envelope(),...t}}appendEnvelope(t){for(let[n,o]of Object.entries(this.envelope()))t.append(n,o);return t}withEnvelopeQuery(t){let n=new URL(this.url(t));for(let[o,r]of Object.entries(this.envelope()))n.searchParams.has(o)||n.searchParams.set(o,r);return n.toString()}async handshake(t){Ie.debug("handshake \u2192",{visitorId:t.visitorId,conversationId:t.conversationId,locale:t.locale});let n=await this.postJson(ut.handshake,t,"handshake");return Ie.debug("handshake \u2190",{visitorId:n.visitorId,conversationId:n.conversationId,hasWelcome:!!n.welcome,hasConfig:!!n.config,rebind:n.rebind}),this.visitorId=t.visitorId,this.conversationId=n.conversationId,n}async uploadFile(t,n){Ie.debug("uploadFile \u2192",{name:t.name,size:t.size,type:t.type});let o=new FormData;o.append("file",t,t.name);let r=await this.postForm(this.uploadPath,o,"upload",n,Wp(t.size));return Ie.debug("uploadFile \u2190",{id:r.id,url:r.url}),r}async transcribe(t,n="audio/webm"){Ie.debug("transcribe \u2192",{size:t.size,mimeType:n});let o=new FormData;o.append("audio",t,`voice.${Gp(n)}`),o.append("mimeType",n);let r=await this.postForm(this.transcribePath,o,"transcribe");return Ie.debug("transcribe \u2190",{textLen:r.text.length}),r}subscribeConversationChanges(t){return this.conversationListeners.add(t),()=>this.conversationListeners.delete(t)}publishConversation(t,n=!1){let o={type:"upsert",conversation:t,revision:++this.conversationRevision,...n?{activity:!0}:{}};this.conversationsCache.update(r=>{let a=r.pagination.page===1,s=r.conversations.some(p=>p.conversationId===t.conversationId),l=Ot(r.conversations,o,a&&n),c=a&&l.length>r.pagination.limit?l.slice(0,r.pagination.limit):l;if(!a||!n||s||r.pagination.hasNext)return c===r.conversations?r:{...r,conversations:c};let d=Math.max(r.pagination.total,r.conversations.length)+1,_=Math.ceil(d/r.pagination.limit);return{...r,conversations:c,pagination:{...r.pagination,total:d,totalPages:_,hasNext:r.pagination.page<_}}});for(let r of this.conversationListeners)r(o)}localeCacheKey(t){return`${this.locale??""}|${JSON.stringify(t,Object.keys(t).toSorted())}`}peekConversations(t={}){return this.conversationsCache.peek(this.localeCacheKey(t))}listConversations(t={},n=!1){if((t.page??1)>1)return this.fetchConversations(t);let o=this.localeCacheKey(t),r=this.conversationRevision;n&&this.conversationsCache.delete(o);let a=this.conversationsCache.getOrFetch(o,()=>this.fetchConversations(t));return n?a.then(s=>{let l={type:"snapshot",result:s,requestedRevision:r};for(let c of this.conversationListeners)c(l);return s}):a}async fetchConversations(t){let n=new URL(this.url(ut.listConversations));return t.visitorId&&n.searchParams.set("visitorId",t.visitorId),t.page&&n.searchParams.set("page",String(t.page)),t.limit&&n.searchParams.set("limit",String(t.limit)),t.ids?.length&&n.searchParams.set("ids",t.ids.join(",")),this.getJson(n.toString(),"listConversations")}async loadConversation(t,{ids:n=[],beforeId:o,beforeCreatedAt:r}={}){let a=new URL(this.url(ut.listMessages));a.searchParams.set("conversationId",t),a.searchParams.set("limit",String(Fa)),n.length>0&&a.searchParams.set("ids",n.join(",")),o&&a.searchParams.set("beforeId",o),r&&a.searchParams.set("beforeCreatedAt",r);let s=await this.getJson(a.toString(),"loadConversation");return{...s,messages:s.messages.toReversed()}}async markRead(t,n){if(!this.visitorId||!t)return;let o={type:"read",conversationId:t,...n===void 0?{}:{lastMessageAt:n},revision:++this.conversationRevision};this.conversationsCache.update(r=>{let a=Ot(r.conversations,o);return a===r.conversations?r:{...r,conversations:a}});for(let r of this.conversationListeners)r(o);try{await this.postJson(ut.markRead,{conversationId:t},"markRead",!0)}catch(r){Ie.debug("markRead failed (non-fatal)",{err:r})}}async requestOperator(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(ut.requestOperator,{},"requestOperator")).controlState}catch(t){Ie.debug("requestOperator failed (non-fatal)",{err:t});return}}async cancelOperatorRequest(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(ut.cancelOperatorRequest,{},"cancelOperatorRequest")).controlState}catch(t){Ie.debug("cancelOperatorRequest failed (non-fatal)",{err:t});return}}listContent(t={}){return this.contentCache.getOrFetch(this.localeCacheKey(t),()=>this.fetchContent(t))}async fetchContent(t){let n=new URL(this.dataUrl(ut.content));for(let[a,s]of Object.entries(t))s!==void 0&&n.searchParams.set(a,Array.isArray(s)?s.join(","):String(s));let o=await this.getJson(n.toString(),"listContent"),r=(o.items??[]).map(a=>is(a,this.locale));return{...o,items:r}}async bootstrap(t){let n=new URL(this.dataUrl(ut.bootstrap));t&&n.searchParams.set("conversationId",t);let o=await this.getJson(n.toString(),"bootstrap"),r=o.forms??[],a=o.formSubmissions??[];return{forms:r,formSubmissions:a}}async saveUserPrefs(t){return this.postJson(ut.updateSettings,{userPrefs:t},"saveUserPrefs")}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??ut.submitForm}async submitForm(t){Ie.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){Ie.debug("submitForm failed (non-fatal)",{err:n})}}async submitFeedback(t){Ie.debug("submitFeedback \u2192",{messageId:t.messageId,value:t.value});try{await this.postJson(ut.messageFeedback,{messageId:t.messageId,set:{feedback:t.value}},"submitFeedback")}catch(n){Ie.debug("submitFeedback failed (non-fatal)",{err:n})}}async sendTurn(t){Ie.debug("message \u2192",{conversationId:t.conversationId,visitorId:t.visitorId,messageCount:t.messages.length});try{return await this.runWithAbort(async n=>{let o=await this.fetchImpl(this.url(ut.streamMessage),{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope(t)),signal:n});if(o.status!==202)throw new Qe(`sendTurn failed: expected 202, received ${o.status}`,"server",o.status);let r;try{r=await o.json()}catch(a){throw n?.aborted?a:new Qe("sendTurn failed: invalid acknowledgement","server",o.status,a)}if(!jp(r))throw new Qe("sendTurn failed: invalid acknowledgement","server",o.status);return r},void 0,Hp)}catch(n){throw n instanceof Qe?n:new Qe("sendTurn failed: network error","network",void 0,n)}}cancelTurn(t,n){!this.visitorId||!t||!n||(Ie.debug("cancel stream",{conversationId:t,runId:n,visitorId:this.visitorId}),this.fetchImpl(this.url(ut.cancelStream),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope({conversationId:t,runId:n})),keepalive:!0}).catch(o=>Ie.debug("cancel POST failed (non-fatal)",{err:o})))}async connectResumeStream(t){let n=new AbortController,o=()=>n.abort(t.signal.reason);t.signal.aborted?o():t.signal.addEventListener("abort",o,{once:!0});let r=setTimeout(()=>n.abort(),Up),a=()=>{clearTimeout(r),t.signal.removeEventListener("abort",o)},s;try{s=await this.fetchImpl(this.resumeUrl(),{method:"GET",credentials:"omit",headers:{accept:"text/event-stream",...this.opts.auth.headers()},signal:n.signal})}catch(c){return a(),t.signal.aborted||Ie.debug("resume-stream fetch failed \u2014 reconnecting",{err:c}),"held"}if(!s.ok)return a(),s.status===409||fl.has(s.status)?(Ie.debug("resume-stream \u2192 transient response; reconnecting",{status:s.status}),"held"):(Ie.debug("resume-stream \u2192 endpoint unavailable",{status:s.status}),"unavailable");if(!s.body)return a(),Ie.debug("resume-stream \u2192 bodyless response; stopping",{status:s.status}),"unavailable";if(!(s.headers.get("content-type")??"").includes("text/event-stream"))return a(),Ie.debug("resume-stream \u2192 non-SSE response; stopping"),"unavailable";let l=!1;try{for await(let{chunk:c}of rl(s,n.signal,d=>{l||d!=="connected"||(l=!0,clearTimeout(r),t.onConnected())})){if(t.signal.aborted)return"held";t.onChunk(c)}}catch(c){if(t.signal.aborted)return"held";Ie.debug("resume-stream segment dropped \u2014 reconnecting",{err:c})}finally{a()}return"held"}resumeUrl(){return this.withEnvelopeQuery(ut.streamResume)}async postJson(t,n,o,r=!1){let a=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)),...r?{keepalive:!0}:{}}],o);return this.assertOk(a,o)}async postForm(t,n,o,r,a){return this.runWithAbort(async s=>{let l=await this.fetchImpl(this.url(t),{method:"POST",credentials:"omit",headers:this.opts.auth.headers(),body:this.appendEnvelope(n),signal:s});return this.assertOk(l,o)},r,a)}async runWithAbort(t,n,o){if(!n&&o===void 0)return t();let r=new AbortController,a=()=>r.abort(n?.reason);n?.aborted?a():n?.addEventListener("abort",a,{once:!0});let s=o===void 0?void 0:setTimeout(()=>r.abort(),o);try{return await t(r.signal)}finally{s!==void 0&&clearTimeout(s),n?.removeEventListener("abort",a)}}async getJson(t,n){let o=await this.fetchWithRetry(()=>[this.withEnvelopeQuery(t),{method:"GET",credentials:"omit",headers:{accept:"application/json",...this.opts.auth.headers()}}],n);return this.assertOk(o,n)}async fetchWithRetry(t,n){for(let o=0;;o++){let[r,a]=t(),s;try{s=await this.fetchImpl(r,a)}catch(c){if(o>=pl)throw new Qe(`${n} failed: network error`,"network",void 0,c);Ie.debug("request network error \u2014 retrying",{label:n,attempt:o}),await to(ml(o));continue}if(s.ok||!fl.has(s.status)||o>=pl)return s;let l=Kp(s.headers)??ml(o);Ie.debug("request retryable status \u2014 retrying",{label:n,status:s.status,attempt:o,wait:l}),await to(l)}}async assertOk(t,n){if(!t.ok)throw new Qe(`${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 Gp(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 jp(e){if(typeof e!="object"||e===null)return!1;let t=Reflect.get(e,"status"),n=Reflect.get(e,"conversationId"),o=Reflect.get(e,"runId");return t==="accepted"&&typeof n=="string"&&n.length>0&&(o===void 0||typeof o=="string"&&o.length>0)}function Ha(e,t,n=ct()){let o=e?[{kind:"text",id:"t0",textSig:ne(e),doneSig:ne(!0)}]:[];return{id:n,role:"user",createdAt:Date.now(),status:"complete",attachments:t,partsSig:ne(o)}}function Nt(){return{id:ct(),role:"assistant",createdAt:Date.now(),status:"streaming",partsSig:ne([])}}function hl(e){let t=ct();return Qp({id:t,role:e.role,createdAt:Date.now(),status:"complete",ephemeral:!0,parts:[{kind:"text",id:`${t}-t0`,text:e.text,done:!0}]})}function Qp(e){return{id:e.id,role:e.role,createdAt:e.createdAt,status:e.status,canceled:e.canceled,errorText:e.errorText,finishReason:e.finishReason,serverMessageId:e.serverMessageId,ephemeral:e.ephemeral,attachments:e.attachments,feedback:e.feedback,partsSig:ne(e.parts.map(nf))}}function Xp(e){return e.status==="failed"?"error":e.role==="assistant"&&e.status==="streaming"?"streaming":"complete"}function Ua(e){let t=new Set,n=e.parts.map((r,a)=>r.type==="text"?{kind:"text",id:`${e.id}-t${a}`,textSig:ne(r.text),doneSig:ne(!0)}:r.type==="reasoning"?{kind:"reasoning",id:`${e.id}-r${a}`,textSig:ne(r.text),doneSig:ne(r.state!=="streaming")}:r.type==="step-start"?{kind:"step-start",id:`${e.id}-ss${a}`}:r.type==="file"?{kind:"file",url:r.url,mediaType:r.mediaType}:r.type==="source-url"?{kind:"source",sourceId:r.sourceId,url:r.url,title:r.title}:r.type==="source-document"?{kind:"source",sourceId:r.sourceId,title:r.title,filename:r.filename,mediaType:r.mediaType}:r.type==="data-suggestions"?null:r.type==="dynamic-tool"||r.type.startsWith("tool-")?{kind:"tool",toolCallId:r.toolCallId,toolName:r.type==="dynamic-tool"?r.toolName:ll(r.type),dynamic:r.type==="dynamic-tool"?!0:void 0,inputPartialSig:ne(""),inputSig:ne(r.input),outputSig:ne(r.output),errorSig:ne(r.errorText),stateSig:ne(r.state),approvalSig:ne(r.approval)}:null).filter(r=>r!==null).filter(r=>r.kind!=="source"?!0:t.has(r.sourceId)?!1:(t.add(r.sourceId),!0)),o=e.parts.find(r=>r.type==="data-suggestions");return{id:e.id,role:e.role,operatorInitials:e.operatorInitials,suggestions:o?.type==="data-suggestions"?ar(o.data):void 0,serverMessageId:e.id,createdAt:Date.parse(e.createdAt),status:Xp(e),canceled:e.status==="canceled",feedback:e.feedback??null,partsSig:ne(n)}}function Yp(e){return!e.parts.some(t=>t.type==="text"&&t.text.trim()!==""||t.type==="dynamic-tool"||t.type.startsWith("tool-")||t.type==="file"||t.type==="source-url"||t.type==="source-document")}function Jp(e){return e.role==="assistant"&&e.status==="streaming"&&Yp(e)}function Kt(e){let t=e.length-1;return e.filter((n,o)=>o===t||!Jp(n)).map(Ua)}function bl(e,t){let n=!t&&e.at(-1)?.role==="assistant"?-2:-1,o=e.at(n);return!o||o.ephemeral?[]:[o]}function za(e){return{id:e.id,role:e.role,createdAt:e.createdAt,status:e.status,canceled:e.canceled,errorText:e.errorText,finishReason:e.finishReason,serverMessageId:e.serverMessageId,ephemeral:e.ephemeral,attachments:e.attachments,parts:e.partsSig.value.map(of)}}function Ue(e){let t="";for(let n of e.partsSig.value)n.kind==="text"&&(t+=n.textSig.value);return t}function lr(e,t,n,o,r,a=t.createdAt){let s=e.find(_=>_.role==="user"&&!_.ephemeral),l=(_,p)=>Ue(_).replace(/\s+/g," ").trim().slice(0,p),c=s?l(s,80):"",d=l(t,120);return{conversationId:n,title:c||o,lastMessageAt:new Date(a).toISOString(),preview:d||void 0,canContinue:r}}function St(e){return Ue(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file"||t.kind==="source")}function Zp(e){return Ue(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file")}function qa(e){return e==="approval-responded"||e==="output-available"||e==="output-denied"||e==="output-error"}var Rn=e=>e.kind==="tool",yl=e=>e.kind==="text"&&e.textSig.value.trim()!==""||e.kind==="file";function oo(e){let t=e.partsSig.value,n=t.findLastIndex(o=>o.kind==="tool");return t.slice(n+1).some(yl)}function nn(e){if(e.role!=="assistant")return!1;let t=e.partsSig.value.filter(Rn);return t.length>0&&t.every(n=>qa(n.stateSig.value))}function Dt(e){return e.role!=="assistant"?!1:e.partsSig.value.some(t=>t.kind==="tool")&&!oo(e)}function cr(e,t){return!e.partsSig.value.slice(t+1).some(n=>n.kind==="step-start"||yl(n))}function dr(e){return e.partsSig.value.some(t=>Rn(t)&&!qa(t.stateSig.value))}function Pl(e,t){if(t.length===0)return e;let n=new Set;for(let s of e)n.add(s.id),s.serverMessageId&&n.add(s.serverMessageId);let o=t.filter(s=>{let l=[s.id,s.serverMessageId].filter(c=>c!==void 0);return l.some(c=>n.has(c))?!1:(l.forEach(c=>n.add(c)),!0)});if(o.length===0)return e;let r=e.findIndex(s=>!s.ephemeral),a=r<0?e.length:r;return[...e.slice(0,a),...o,...e.slice(a)]}function en(e,t){return t.id=e.id,e.canceled&&(t.canceled=!0),e.feedback!==void 0&&(t.feedback=e.feedback),t.suggestions??(t.suggestions=e.suggestions),t}function xl(e,t,n,o){if(!Va(e))return;if(t.length===0){let s=Math.max(...o.values());return n.find(l=>l.role==="assistant"&&o.get(l.serverMessageId??l.id)===s&&Ue(l).length>=Ue(e).length)}let r=t.at(-1);if(r?.role!=="user")return;let a=o.get(r.serverMessageId??r.id);if(a!==void 0)return n.find(s=>s.role==="assistant"&&o.get(s.serverMessageId??s.id)===a+1&&Ue(s).length>=Ue(e).length)}function Va(e){return e?.role==="assistant"&&e.status==="streaming"&&e.serverMessageId===void 0}function ef(e,t){let n=new Map(t.partsSig.value.filter(Rn).filter(a=>qa(a.stateSig.value)).map(a=>[a.toolCallId,a]));if(n.size===0)return;let o=!1,r=e.partsSig.value.map(a=>{if(!Rn(a))return a;let s=n.get(a.toolCallId);if(!s)return a;let l=a.approvalSig.value,c=s.approvalSig.value,d=l===void 0||l.approved===void 0&&c?.approved!==void 0?s.approvalSig:a.approvalSig,_=a.inputSig.value===void 0?s.inputSig:a.inputSig,p=a.toolName==="tool"?s.toolName:a.toolName,u=a.dynamic??s.dynamic;return d===a.approvalSig&&_===a.inputSig&&p===a.toolName&&u===a.dynamic?a:(o=!0,{...a,toolName:p,dynamic:u,inputSig:_,approvalSig:d})});o&&(e.partsSig.value=r)}function Wa(e,t){let n=t.filter(p=>!p.ephemeral&&(p.status==="streaming"||p.status==="pending"||p.status==="error"||p.retryAction!==void 0||(p.attachments?.length??0)>0||St(p))),o=new Map;for(let p of n)o.set(p.id,p),p.serverMessageId!==void 0&&o.set(p.serverMessageId,p);let r=new Set,a=[],s=e.map(p=>{let u=(p.serverMessageId!==void 0?o.get(p.serverMessageId):void 0)??o.get(p.id);return u===void 0?(a.push(p),p):(r.add(u),u.role!==p.role?p:u.role==="user"&&u.serverMessageId===void 0&&(u.status==="pending"||u.status==="error")?en(u,p):u.status==="streaming"||Ue(u).length>=Ue(p).length?(ef(u,p),u.suggestions??(u.suggestions=p.suggestions),u.feedback===void 0&&(u.feedback=p.feedback),p.canceled&&(u.canceled=!0),u):en(u,p))}),l=n.filter(p=>!r.has(p)),c=l.findLast(Va),d=new Map;e.forEach((p,u)=>{d.set(p.id,u),p.serverMessageId!==void 0&&d.set(p.serverMessageId,u)});let _=xl(c,c?n.slice(0,n.indexOf(c)):[],a,d);if(c&&_){let p=s.indexOf(_);p>=0&&(s[p]=en(c,_)),l=l.filter(u=>u!==c)}return[...s,...l]}function ro(e,t){let n=new Map(t.filter(p=>p.serverMessageId!==void 0).map(p=>[p.serverMessageId,p])),o=new Map;t.forEach((p,u)=>{o.set(p.id,u),p.serverMessageId!==void 0&&o.set(p.serverMessageId,u)});let r=new Set(e.flatMap(p=>[p.serverMessageId,p.id].filter(u=>u!==void 0))),a=!1,s=e.map(p=>{let u=n.get(p.serverMessageId??p.id);if(u===void 0||u.role!==p.role)return p;if(p.role==="user"&&p.serverMessageId===void 0)return a=!0,en(p,u);if(p.serverMessageId===void 0)return p;let m=Ue(u),g=Ue(p),y=u.status!=="streaming"&&m.length>=g.length&&Ba(p,u);if(m.length>g.length||m===g&&u.partsSig.value.length>p.partsSig.value.length||y)return a=!0,en(p,u);if(p.status==="streaming"&&u.status!=="streaming"&&tf(p,u)){if(p.continuationStreaming&&dr(u))return p;if(!Ba(u,p))return a=!0,en(p,u)}return p}),l=[...n.values()].filter(p=>!r.has(p.serverMessageId)),c=s.findLastIndex(Va),d=s[c],_=xl(d,s.slice(0,c),l,o);if(d!==void 0&&_!==void 0&&Ue(_).length>=Ue(d).length&&(en(d,_),s[c]=_,l.splice(l.indexOf(_),1),a=!0),l.length===0)return{messages:a?s:e,changed:a};for(let p of l){let u=o.get(p.serverMessageId??p.id),m=!1,g=s.findIndex(y=>{let S=o.get(y.serverMessageId??y.id);return u===void 0?!1:S===void 0?m:S>u?!0:(m=!0,!1)});g===-1?s.push(p):s.splice(g,0,p)}return{messages:s,changed:!0}}function Sl(e,t){if(e.role!==t.role)return!1;let n=Ue(t),o=Ue(e);return n.length>o.length||t.partsSig.value.length>e.partsSig.value.length||Ba(e,t)}function tf(e,t){let n=e.partsSig.value,o=t.partsSig.value;return n.length!==o.length?!1:n.every((r,a)=>{let s=o[a];switch(r.kind){case"text":return s?.kind==="text"&&s.textSig.value===r.textSig.value;case"reasoning":return s?.kind==="reasoning"&&s.textSig.value===r.textSig.value;case"step-start":return s?.kind==="step-start";case"tool":return s?.kind==="tool"&&s.toolCallId===r.toolCallId&&ur(s.toolName,r.toolName);case"file":return s?.kind==="file"&&s.url===r.url&&s.mediaType===r.mediaType;case"source":return s?.kind==="source"&&s.sourceId===r.sourceId&&s.url===r.url&&s.title===r.title&&s.filename===r.filename&&s.mediaType===r.mediaType;default:return r}})}function ur(e,t){let n=e.startsWith("tool:")?e.slice(5):e,o=t.startsWith("tool:")?t.slice(5):t;return n===o}var vl={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function Ba(e,t){let n=new Map(e.partsSig.value.filter(Rn).map(o=>[o.toolCallId,o]));return t.partsSig.value.filter(Rn).some(o=>{let r=n.get(o.toolCallId);if(!r||vl[o.stateSig.value]>vl[r.stateSig.value])return!0;let a=o.approvalSig.value?.approved;return a!==void 0&&a!==r.approvalSig.value?.approved})}function tn(e){return e.role==="assistant"&&e.status!=="streaming"&&!St(e)}function _r(e,t){if(!e.includes(t)||t.retryAction===null)return;if(t.retryAction)return t.retryAction;if(t!==e.at(-1)||t.role!=="assistant"||t.serverMessageId===void 0||t.status!=="error"&&!tn(t))return;let n=e.indexOf(t);for(let o=n-1;o>=0;o--){let r=e[o];if(r?.role==="user"&&!r.ephemeral)return{kind:"repeat-user",messageId:r.id}}}function kl(e){return e.canceled===!0&&e.role==="assistant"&&e.status!=="streaming"&&!Zp(e)}function wl(e,t){return e.operatorRoutedTurn?tn(e)?"drop":"complete-operator-routed":t||tn(e)?"error":"complete"}function nf(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,textSig:ne(e.text),doneSig:ne(e.done)}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,dynamic:e.dynamic,inputPartialSig:ne(e.inputPartial),inputSig:ne(e.input),outputSig:ne(e.output),errorSig:ne(e.error),stateSig:ne(e.state),approvalSig:ne(e.approval)}:e}function of(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,text:e.textSig.value,done:e.doneSig.value}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,dynamic:e.dynamic,inputPartial:e.inputPartialSig.value,input:e.inputSig.value,output:e.outputSig.value,error:e.errorSig.value,state:e.stateSig.value,approval:e.approvalSig.value}:e}var Cl=te.scope("feedback:audio"),pr=class{constructor(){se(this,"ctx",null);se(this,"master",null);se(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){Cl.warn("AudioContext init failed",{err:n})}}setVolume(t){if(!this.master||!this.ctx)return;let n=Math.max(0,Math.min(1,t));this.master.gain.setTargetAtTime(n,this.ctx.currentTime,.01)}playTone(t){let n=this.ctx,o=this.master;if(!n||!o||n.state!=="running")return;let r=n.currentTime,a=t.noteMs/1e3;t.notes.forEach((s,l)=>{let c=n.createOscillator();c.type=t.type,c.frequency.value=s;let d=n.createGain(),_=r+l*a;d.gain.setValueAtTime(1e-4,_),d.gain.exponentialRampToValueAtTime(t.peakGain,_+.005),d.gain.exponentialRampToValueAtTime(1e-4,_+a),c.connect(d).connect(o),c.start(_),c.stop(_+a+.01)})}async playUrl(t){let n=this.ctx,o=this.master;if(!n||!o||n.state!=="running")return;let r=await this.getBuffer(t);if(!r)return;let a=n.createBufferSource();a.buffer=r,a.connect(o),a.start()}destroy(){this.ctx&&this.ctx.close().catch(()=>{}),this.ctx=null,this.master=null,this.buffers.clear()}async getBuffer(t){if(!this.ctx)return null;let n=this.buffers.get(t);if(n)return n instanceof Promise,n;let o=this.ctx,r=fetch(t).then(a=>a.ok?a.arrayBuffer():Promise.reject(new Error(`fetch ${a.status}`))).then(a=>o.decodeAudioData(a)).then(a=>(this.buffers.set(t,a),a)).catch(a=>(Cl.warn("audio fetch/decode failed",{url:t,err:a}),this.buffers.delete(t),null));return this.buffers.set(t,r),r}};var Rl={messageReceived:10,messageSent:0,error:[20,40,20],voiceStart:10,voiceStop:0},Tl={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 Gt=null,fr=0;function rf(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}function af(){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=`__${T.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 Il(e){if(!(e===0||Array.isArray(e)&&e.every(t=>t===0))){if(rf())try{navigator.vibrate(e);return}catch{}if(Gt||(Gt=af()),!!Gt)try{Gt.label.click()}catch{}}}function El(){fr++;let e=!1;return()=>{e||(e=!0,fr=Math.max(0,fr-1),fr===0&&Gt&&(Gt.input.remove(),Gt.label.remove(),Gt=null))}}var sf=te.scope("feedback"),lf=100,mr=class{constructor(t,n){se(this,"mutedSig",ne(!1));se(this,"audio",new pr);se(this,"releaseHaptics");se(this,"sound");se(this,"haptics");se(this,"lastPlayed",new Map);se(this,"reducedMotionMq",null);this.sound=t,this.haptics=n,this.releaseHaptics=El(),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<lf}playSound(t){let n=this.sound.events?.[t];if(n===!1)return;if(typeof n=="string"){this.audio.playUrl(n).catch(r=>sf.warn("audio play failed",{err:r,url:n}));return}let o=Tl[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?Rl[t]:n;Il(o)}effectiveVolume(){let t=this.sound.volume??.3;return this.reducedMotionMq?.matches?t*.5:t}isTouchDevice(){return typeof window>"u"?!1:matchMedia("(hover: none) and (pointer: coarse)").matches}};var cf=0;function i(e,t,n,o,r,a){t||(t={});var s,l,c=t;if("ref"in c)for(l in c={},t)l=="ref"?s=t[l]:c[l]=t[l];var d={type:e,props:c,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--cf,__i:-1,__u:0,__source:r,__self:a};if(typeof e=="function"&&(s=e.defaultProps))for(l in s)c[l]===void 0&&(c[l]=s[l]);return ee.vnode&&ee.vnode(d),d}var Z={fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24"},ao=`${T.cssPrefix}-icon-dir`,Ka=()=>i("svg",{...Z,"aria-hidden":"true",children:i("path",{d:"M21 12a8 8 0 0 1-12 6.93L3 21l1.65-5.16A8 8 0 1 1 21 12Z"})}),bt=()=>i("svg",{...Z,"aria-hidden":"true",children:i("path",{d:"M18 6 6 18M6 6l12 12"})}),Al=()=>i("svg",{...Z,"aria-hidden":"true",children:i("path",{d:"M12 5v14M5 12h14"})}),Ml=()=>i("svg",{...Z,class:ao,"aria-hidden":"true",children:[i("path",{d:"m22 2-7 20-4-9-9-4Z"}),i("path",{d:"M22 2 11 13"})]}),Ll=()=>i("svg",{...Z,"aria-hidden":"true",children:i("path",{d:"M12 19V5M5 12l7-7 7 7"})}),Ol=()=>i("svg",{...Z,class:ao,"aria-hidden":"true",children:i("path",{d:"M3 20V4l18 8-18 8Z"})}),Tn=()=>i("svg",{...Z,class:ao,"aria-hidden":"true",children:i("path",{d:"m9 18 6-6-6-6"})}),Nl=()=>i("svg",{...Z,"aria-hidden":"true",children:i("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}),Dl=()=>i("svg",{...Z,"aria-hidden":"true",children:i("path",{d:"m21 11-9 9a5.5 5.5 0 0 1-7.78-7.78l8.49-8.49a3.67 3.67 0 0 1 5.19 5.19l-8.49 8.49a1.83 1.83 0 0 1-2.6-2.6l7.78-7.78"})}),$l=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),i("path",{d:"M5 10a7 7 0 0 0 14 0M12 19v3"})]}),Fl=()=>i("svg",{...Z,"aria-hidden":"true",children:i("path",{d:"M3 8V3h5M21 8V3h-5M3 16v5h5M21 16v5h-5"})}),Bl=()=>i("svg",{...Z,"aria-hidden":"true",children:i("path",{d:"M8 3v5H3M16 3v5h5M8 21v-5H3M16 21v-5h5"})}),Hl=()=>i("svg",{...Z,"aria-hidden":"true",children:i("path",{d:"M3 3h7v2H5v5H3zM21 3h-7v2h5v5h2zM3 21h7v-2H5v-5H3zM21 21h-7v-2h5v-5h2z"})}),Ul=()=>i("svg",{...Z,"aria-hidden":"true",children:i("path",{d:"M10 3v5H3M14 3v5h7M10 21v-5H3M14 21v-5h7"})}),zl=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("path",{d:"M14 3h7v7M21 3l-9 9"}),i("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]}),ql=()=>i("svg",{...Z,"aria-hidden":"true",viewBox:"0 0 10 10",children:i("path",{d:"M9 1L1 9M9 5L5 9M9 9H9",strokeWidth:"1.5"})}),Vl=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"5",r:"1.5",fill:"currentColor",stroke:"none"}),i("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),i("circle",{cx:"12",cy:"19",r:"1.5",fill:"currentColor",stroke:"none"})]}),Wl=()=>i("svg",{...Z,"aria-hidden":"true",children:i("path",{d:"M11 5 6 9H2v6h4l5 4zM15 9a5 5 0 0 1 0 6M18 7a9 9 0 0 1 0 10"})}),Kl=()=>i("svg",{...Z,"aria-hidden":"true",children:i("path",{d:"M11 5 6 9H2v6h4l5 4zM22 9l-6 6M16 9l6 6"})}),Gl=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("path",{d:"M3 18 8 6l5 12M4.7 14h6.6"}),i("path",{d:"M14.5 18l3.2-7 3.2 7M15.6 15.8h4.2"})]}),jl=()=>i("svg",{...Z,class:ao,"aria-hidden":"true",children:i("path",{d:"m5 6 6 6-6 6M13 6l6 6-6 6"})}),on=()=>i("svg",{...Z,"aria-hidden":"true",children:i("path",{d:"M20 6 9 17l-5-5"})}),Ql=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("path",{d:"M3 3v6h6"}),i("path",{d:"M3.05 13A9 9 0 1 0 6 5.3L3 9"}),i("path",{d:"M12 7v5l3 2"})]}),Xl=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("path",{d:"M2 12h20"}),i("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]}),io=()=>i("svg",{...Z,class:ao,"aria-hidden":"true",children:i("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),Yl=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("path",{d:"M12 20h9"}),i("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]}),rn=()=>i("svg",{...Z,"aria-hidden":"true",children:i("path",{d:"m6 9 6 6 6-6"})}),Jl=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),i("path",{d:"M14 2v6h6"})]}),df=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("path",{d:"m12 3-1.5 4.5L6 9l4.5 1.5L12 15l1.5-4.5L18 9l-4.5-1.5Z"}),i("path",{d:"M19 15v4M17 17h4M5 3v2M4 4h2"})]}),Ga=()=>i("svg",{...Z,"aria-hidden":"true",children:i("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2Z"})}),so=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),i("path",{d:"M12 17h.01"})]}),uf=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("path",{d:"m15 4 3 3-9 9-3-3z"}),i("path",{d:"M18 2v2M20 4h2M3 20l3-3M3 16h2M5 14v2"})]}),_f=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("rect",{x:"4",y:"8",width:"16",height:"12",rx:"2"}),i("path",{d:"M12 8V4"}),i("circle",{cx:"12",cy:"3",r:"1"}),i("path",{d:"M2 14h2M20 14h2M9 13h.01M15 13h.01M9.5 17h5"})]}),ja=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("path",{d:"M4 14v-2a8 8 0 0 1 16 0v2"}),i("rect",{x:"2",y:"14",width:"4",height:"6",rx:"1.5"}),i("rect",{x:"18",y:"14",width:"4",height:"6",rx:"1.5"}),i("path",{d:"M20 20v1a3 3 0 0 1-3 3h-5"})]}),pf=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("circle",{cx:"12",cy:"12",r:"4"}),i("path",{d:"m4.93 4.93 4.24 4.24M14.83 14.83l4.24 4.24M14.83 9.17l4.24-4.24M4.93 19.07l4.24-4.24"})]}),Qa=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("circle",{cx:"11",cy:"11",r:"7"}),i("path",{d:"m21 21-4.3-4.3"})]}),Zl=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]}),ec=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("path",{d:"M3 9.5 12 3l9 6.5"}),i("path",{d:"M5 9v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9"})]}),tc=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("path",{d:"m3 11 15-5v12L3 13z"}),i("path",{d:"M3 11v2a2 2 0 0 0 2 2h1V9H5a2 2 0 0 0-2 2z"}),i("path",{d:"M7 15v3a2 2 0 0 0 4 0v-2"}),i("path",{d:"M21 10a3 3 0 0 1 0 4"})]}),lo=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z"}),i("path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1"})]}),nc=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"4"}),i("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}),oc=()=>i("svg",{...Z,"aria-hidden":"true",children:i("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}),rc=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"M12 3v18"}),i("path",{d:"M12 3a9 9 0 0 1 0 18z",fill:"currentColor",stroke:"none"})]}),ff=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("circle",{cx:"10.5",cy:"10.5",r:"6.5"}),i("path",{d:"M8 11a2.5 2.5 0 0 0 5 0"}),i("path",{d:"m20 20-4.4-4.4"})]}),mf=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("path",{d:"M12 3.5 13.6 9 19 10.5 13.6 12 12 17.5 10.4 12 5 10.5 10.4 9z"}),i("path",{d:"M18.5 4v3M20 5.5h-3M5.5 16v2.5M6.75 17.25h-2.5"})]}),gf=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("path",{d:"M4 18h16"}),i("path",{d:"M5 18a7 7 0 0 1 14 0"}),i("path",{d:"M12 8V6"}),i("path",{d:"M10 6h4"})]}),vf=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("path",{d:"M7 11V6.5a1.5 1.5 0 0 1 3 0V10"}),i("path",{d:"M10 10V5.5a1.5 1.5 0 0 1 3 0V10"}),i("path",{d:"M13 10V6.5a1.5 1.5 0 0 1 3 0V12"}),i("path",{d:"M16 9.5a1.5 1.5 0 0 1 3 0v2.5a7 7 0 0 1-7 7 7 7 0 0 1-6.4-4.2L4 12.5a1.5 1.5 0 0 1 2.6-1.5L7 11"})]}),ac=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2"}),i("path",{d:"M5 15a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2"})]}),ic=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("path",{d:"M7 10v11H4a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1z"}),i("path",{d:"M7 10l4-7a2.5 2.5 0 0 1 2.5 2.5V8h5a2 2 0 0 1 2 2.3l-1.2 8A2 2 0 0 1 17.3 20H7"})]}),sc=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("path",{d:"M17 14V3h3a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1z"}),i("path",{d:"M17 14l-4 7a2.5 2.5 0 0 1-2.5-2.5V16h-5a2 2 0 0 1-2-2.3l1.2-8A2 2 0 0 1 6.7 4H17"})]}),lc=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"3.5"}),i("path",{d:"M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M19.1 4.9l-2.1 2.1M7 17l-2.1 2.1"})]}),cc=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"M12 7v5l3 2"})]}),gr=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]}),vr=()=>i("svg",{...Z,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"m15 9-6 6M9 9l6 6"})]}),dc={chat:Ka,message:Ga,bubbles:lo,spark:df,wand:uf,bot:_f,help:so,lifebuoy:pf,headset:ja,search:ff,sparkles:mf,concierge:gf,wave:vf};var B=T.cssPrefix,R={launcher:`${B}-launcher`,callout:`${B}-callout`,calloutDismiss:`${B}-callout-dismiss`,panel:`${B}-panel`,panelHeader:`${B}-panel-header`,resizeGrip:`${B}-resize-grip`,scrollToBottom:`${B}-scroll-to-bottom`,loadPreviousMessages:`${B}-load-previous-messages`,actionHistory:`${B}-action-history`,actionClose:`${B}-action-close`,langSegment:`${B}-lang-segment`,composer:`${B}-composer`,composerInput:`${B}-composer-input`,composerSend:`${B}-composer-send`,composerStop:`${B}-composer-stop`,compactionStatus:`${B}-compaction-status`,messageQueue:`${B}-message-queue`,queuedMessage:`${B}-queued-message`,queuedMessageRemove:`${B}-queued-message-remove`,composerAttach:`${B}-composer-attach`,composerFileInput:`${B}-composer-file-input`,composerVoice:`${B}-composer-voice`,attachmentChip:`${B}-attachment-chip`,attachmentRemove:`${B}-attachment-remove`,suggestion:`${B}-suggestion`,messageBubble:`${B}-message`,messageRetry:`${B}-message-retry`,messageFeedback:`${B}-message-feedback`,feedbackUp:`${B}-feedback-up`,feedbackDown:`${B}-feedback-down`,messageCopy:`${B}-message-copy`,historyPane:`${B}-history-pane`,historyBack:`${B}-history-back`,historyItem:`${B}-history-item`,historyLoadMore:`${B}-history-load-more`,sidebar:`${B}-sidebar`,sidebarToggle:`${B}-sidebar-toggle`,sidebarNewConversation:`${B}-sidebar-new-conversation`,sidebarItem:`${B}-sidebar-item`,messengerHome:`${B}-messenger-home`,modulesEmpty:`${B}-modules-empty`,tab:`${B}-tab`,tabBadge:`${B}-tab-badge`,homeView:`${B}-home-view`,homeGreeting:`${B}-home-greeting`,homeBrand:`${B}-home-brand`,backHeader:`${B}-back-header`,contentView:`${B}-content-view`,contentScroll:`${B}-content-scroll`,homeSearch:`${B}-home-search`,helpSearch:`${B}-help-search`,homeRecent:`${B}-home-recent`,homeContentRow:`${B}-home-content-row`,helpArticle:`${B}-help-article`,newsItem:`${B}-news-item`,formGate:`${B}-form-gate`,formDone:`${B}-form-done`,formDoneToggle:`${B}-form-done-toggle`,formAnswers:`${B}-form-answers`,formFill:`${B}-form-fill`,formSubmit:`${B}-form-submit`,formSkip:`${B}-form-skip`,formField:`${B}-form-field`,toolAskQuestions:`${B}-tool-ask-questions`,toolInputSubmit:`${B}-tool-input-submit`,toolInputSkip:`${B}-tool-input-skip`,toolApproval:`${B}-tool-approval`,toolApprove:`${B}-tool-approve`,toolReject:`${B}-tool-reject`,toolEdit:`${B}-tool-edit`,toolDecision:`${B}-tool-decision`,typingDots:`${B}-typing-dots`,reasoning:`${B}-reasoning`,toolAskSummary:`${B}-ask-questions-summary`,toolAskOptions:`${B}-ask-questions-options-toggle`,toolCall:`${B}-tool-call`,source:`${B}-source`,operatorRequest:`${B}-operator-request`,operatorBanner:`${B}-operator-banner`,cancelOperatorRequest:`${B}-cancel-operator-request`};function Xe(e,t){return`${e}-${t}`}var hr=T.cssPrefix;function uc({onToggle:e,launcher:t,strings:n,leaving:o,edgeTab:r}){let a=t.variant!=="circle"&&!!t.label;return i("button",{type:"button",class:`${hr}-fab`,"data-variant":t.variant,"data-size":t.size,"data-edge-tab":r?"true":void 0,"data-leaving":o?"true":void 0,"data-testid":R.launcher,onClick:e,"aria-label":n.launcherOpen,children:[hf(t.icon),a?i("span",{class:`${hr}-fab-label`,children:rt(n,t.label??"")}):null]})}function hf(e){let t=dc[e];return t?i(t,{}):i(bf,{source:e})}function bf({source:e}){return i("span",{ref:t=>{t&&yf(t,e)},"aria-hidden":"true"})}function yf(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 _c({callout:e,launcherPosition:t,strings:n,closeLabel:o,onDismiss:r}){let[a,s]=$(!1);return O(()=>{let l=setTimeout(()=>s(!0),e.delayMs);return()=>clearTimeout(l)},[e.delayMs]),O(()=>{if(!a||e.autoDismissMs<=0)return;let l=setTimeout(r,e.autoDismissMs);return()=>clearTimeout(l)},[a,e.autoDismissMs,r]),a?i("div",{class:`${hr}-callout`,role:"status","data-shape":e.shape,"data-position":Pf(e.position,t),"data-animated":e.animated?"true":void 0,"data-testid":R.callout,children:[i("span",{children:rt(n,e.text)}),i("button",{type:"button",class:`${hr}-callout-close`,onClick:r,"aria-label":o,title:o,"data-testid":R.calloutDismiss,children:i(bt,{})})]}):null}function Pf(e,t){let n=t.endsWith("-right"),o=t.startsWith("bottom-");return e==="vertical"?o?"top":"bottom":n?"left":"right"}function br({panelEl:e,resize:t,position:n,initialSize:o,onSizeChange:r,strings:a}){let s=T.cssPrefix,l=N(null);if(O(()=>{if(!e)return;let g=e.style;t.minWidth&&g.setProperty(`--${s}-resize-min-w`,t.minWidth),t.maxWidth&&g.setProperty(`--${s}-resize-max-w`,t.maxWidth),t.minHeight&&g.setProperty(`--${s}-resize-min-h`,t.minHeight),t.maxHeight&&g.setProperty(`--${s}-resize-max-h`,t.maxHeight),o&&(g.setProperty(`--${s}-widget-w`,`${o.width}px`),g.setProperty(`--${s}-widget-h`,`${o.height}px`))},[e,t.minWidth,t.maxWidth,t.minHeight,t.maxHeight,s,o]),!e)return null;let c=n.startsWith("top-"),d=n.endsWith("-right"),_=`${s}-resize-grip ${s}-resize-grip--${c?"bottom":"top"}-${d?"left":"right"}`,p=g=>{if(!e)return;let y=g.currentTarget,S=e.getBoundingClientRect();l.current={pointerId:g.pointerId,startX:g.clientX,startY:g.clientY,startW:S.width,startH:S.height,dirX:d?-1:1,dirY:c?1:-1},y.setPointerCapture(g.pointerId),e.setAttribute("data-resizing",""),g.preventDefault()},u=g=>{let y=l.current;if(!y||g.pointerId!==y.pointerId||!e)return;let S=(g.clientX-y.startX)*y.dirX,k=(g.clientY-y.startY)*y.dirY;e.style.setProperty(`--${s}-widget-w`,`${y.startW+S}px`),e.style.setProperty(`--${s}-widget-h`,`${y.startH+k}px`)},m=g=>{let y=l.current;if(!y||g.pointerId!==y.pointerId||!e)return;g.currentTarget.releasePointerCapture(g.pointerId),e.removeAttribute("data-resizing");let S=e.getBoundingClientRect();r({width:Math.round(S.width),height:Math.round(S.height)}),l.current=null};return i("div",{class:_,role:"separator","aria-orientation":"vertical","aria-label":a.resizeHandle,title:a.resizeHandle,onPointerDown:p,onPointerMove:u,onPointerUp:m,onPointerCancel:m,"data-testid":R.resizeGrip,children:i(ql,{})})}var an=T.cssPrefix,xf=`.${an}-header, .${an}-back-header, .${an}-home-hero`,Sf='button, a, input, textarea, select, [role="tab"], [contenteditable]',pc=56;function yr(e,t){O(()=>{if(!t||!e)return;let n=c=>Number.parseFloat(c)||0,o=(c,d)=>Math.min(d,Math.max(-d,c)),r=null,a=c=>{let d=c.target;if(!(d instanceof Element)||!d.closest(xf)||d.closest(Sf))return;let _=e.getBoundingClientRect();r={id:c.pointerId,x:c.clientX,y:c.clientY,dx:n(e.style.getPropertyValue(`--${an}-modal-dx`)),dy:n(e.style.getPropertyValue(`--${an}-modal-dy`)),maxX:(window.innerWidth+_.width)/2-pc,maxY:(window.innerHeight+_.height)/2-pc},e.dataset.dragging="true",c.preventDefault()},s=c=>{if(!r||c.pointerId!==r.id)return;let d=o(r.dx+c.clientX-r.x,r.maxX),_=o(r.dy+c.clientY-r.y,r.maxY);e.style.setProperty(`--${an}-modal-dx`,`${d}px`),e.style.setProperty(`--${an}-modal-dy`,`${_}px`)},l=c=>{!r||c.pointerId!==r.id||(r=null,delete e.dataset.dragging)};return e.addEventListener("pointerdown",a),window.addEventListener("pointermove",s),window.addEventListener("pointerup",l),window.addEventListener("pointercancel",l),()=>{e.removeEventListener("pointerdown",a),window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",l),window.removeEventListener("pointercancel",l)}},[e,t])}function In(e,t,n){switch(e){case"clear":case"sound":case"history":case"language":case"theme":case"textSize":return!0;case"popOut":return t!=="standalone"&&t!=="page";case"expand":return t==="floating";case"fullscreen":return t!=="standalone";case"close":return t==="standalone"||t==="page"?!1:t==="inline"?n==="fullscreen":!0}}function Pr(e,t,n){return In("close",e,t)?n.includes("close"):!1}function fc(e,t){return e==="inline"&&t==="fullscreen"?"exit-fullscreen":"close"}var kf='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function xr(e){let t=n=>{if(n.key!=="Tab")return;let o=[...e.querySelectorAll(kf)].filter(l=>l.offsetParent!==null||l===document.activeElement);if(o.length===0){n.preventDefault();return}let r=o[0],a=o[o.length-1];if(!r||!a)return;let s=e.getRootNode().activeElement;n.shiftKey&&s===r?(n.preventDefault(),a.focus()):!n.shiftKey&&s===a&&(n.preventDefault(),r.focus())};return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)}function Sr(e){return e.trim().split(/\s+/).slice(0,2).map(t=>t.charAt(0).toUpperCase()).join("")}var Xa=T.cssPrefix;function mc({agent:e,strings:t}){let n=e.status??"online",o=rt(t,e.name),r=e.title?rt(t,e.title):null;return i("div",{class:`${Xa}-agent`,children:[i("div",{class:`${Xa}-agent-avatar`,"data-status":n,children:e.avatar?i("img",{src:e.avatar,alt:""}):i("span",{children:Sr(o)})}),i("div",{class:`${Xa}-agent-meta`,children:[i("strong",{children:o}),r?i("span",{children:r}):null]})]})}var gc=te.scope("attachments");function kr(e,t,n){let o=Cf(e),r=[],a=[],s=If(n.accept),l=t.reduce((d,_)=>d+_.size,0),c=t.length;for(let d of o){let _=wf(d,c,l,n,s);if(_){a.push({file:d,reason:_});continue}r.push(Tf(d)),l+=d.size,c+=1}return(r.length||a.length)&&gc.debug("ingest",{accepted:r.length,rejected:a.map(d=>({name:d.file.name,reason:d.reason}))}),{accepted:r,rejected:a}}function En(e){try{URL.revokeObjectURL(e.previewUrl)}catch(t){gc.debug("revokeObjectURL failed",{error:t})}}function wf(e,t,n,o,r){return t>=o.maxCount?"count":n+e.size>o.maxBytes?"bytes":Ef(e,r)?null:"mime"}function Cf(e){return e?Array.isArray(e)?e.filter(t=>t instanceof File):[...e].map(t=>t instanceof File?t:Rf(t)).filter(t=>t!==null):[]}function Rf(e){let t=e;return!t?.getAsFile||t.kind!=="file"?null:t.getAsFile()}function Tf(e){return{file:e,id:ct(),mediaType:e.type||"application/octet-stream",name:e.name||"pasted-file",previewUrl:URL.createObjectURL(e),size:e.size}}function If(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 Ef(e,t){if(t.length===0)return!0;let[n="*",o="*"]=(e.type||"").toLowerCase().split("/"),r=(e.name||"").toLowerCase();return t.some(a=>a.kind==="ext"?r.endsWith(a.ext):(a.type==="*"||a.type===n)&&(a.subtype==="*"||a.subtype===o))}var co=T.cssPrefix;function vc({attachment:e,onRemove:t,disabled:n=!1}){let o=e.mediaType.startsWith("image/");return i("span",{class:`${co}-attachment-chip`,title:e.name,"data-testid":Xe(R.attachmentChip,e.id),children:[o?i("img",{class:`${co}-attachment-thumb`,src:e.previewUrl,alt:""}):i("span",{class:`${co}-attachment-thumb`,"aria-hidden":"true",children:i(Jl,{})}),i("span",{class:`${co}-attachment-name`,children:e.name}),i("button",{type:"button",class:`${co}-attachment-remove`,onClick:t,disabled:n,"aria-label":`Remove ${e.name}`,"data-testid":Xe(R.attachmentRemove,e.id),children:i(bt,{})})]})}var Ya={isSupported:!1,start:()=>{},stop:()=>{},cancel:()=>{}};function Ja(e,t,n){return e==="disabled"?Ya:e==="server"?Of(n):Af(t)}function Af(e){let t=Mf();if(!t)return Ya;let n=null,o=0;return{isSupported:!0,start(r,a){let s=n,l=++o;n=null,s?.abort();let c=new t;n=c,c.continuous=!0,c.interimResults=!0,c.lang=e;let d=!1;c.addEventListener("result",p=>{if(o!==l||n!==c)return;let u=p,m="",g=!1;for(let y=u.resultIndex;y<u.results.length;y++){let S=u.results[y];S&&(m+=S[0].transcript,S.isFinal&&(g=!0))}r(m,g)});let _=()=>{d||o!==l||n!==c||(d=!0,n=null,a())};c.addEventListener("end",_),c.addEventListener("error",_);try{c.start()}catch{_()}},stop(){n?.stop()},cancel(){o++;let r=n;n=null,r?.abort()}}}function Mf(){return window.SpeechRecognition??window.webkitSpeechRecognition}var Lf=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];function Of(e){if(typeof MediaRecorder>"u"||!navigator?.mediaDevices?.getUserMedia)return Ya;let t=0,n=null,o=s=>{for(let l of s.stream?.getTracks()??[])l.stop();s.stream=null},r=()=>{t++;let s=n;n=null,s&&(o(s),s.recorder?.state!=="inactive"&&s.recorder?.stop())},a=async s=>{if(s.finishing)return;s.finishing=!0;let l=s.recorder?.mimeType??"audio/webm";o(s);let c=new Blob(s.chunks,{type:l});s.chunks=[];try{let{text:d}=await e(c,l);n===s&&t===s.generation&&d&&s.onText(d,!0)}catch{}finally{n===s&&t===s.generation&&(n=null,s.onEnd())}};return{isSupported:!0,async start(s,l){r();let c={generation:t,recorder:null,stream:null,chunks:[],onText:s,onEnd:l,finishing:!1};n=c;try{let d=await navigator.mediaDevices.getUserMedia({audio:!0});if(n!==c||t!==c.generation){for(let u of d.getTracks())u.stop();return}c.stream=d;let _=Nf(),p=new MediaRecorder(d,_?{mimeType:_}:void 0);c.recorder=p,p.addEventListener("dataavailable",u=>{n===c&&t===c.generation&&u.data.size>0&&c.chunks.push(u.data)}),p.addEventListener("stop",()=>{n===c&&t===c.generation&&a(c)}),p.start()}catch{o(c),n===c&&t===c.generation&&(n=null,l())}},stop(){let s=n;if(s){if(!s.recorder){r();return}s.recorder.state!=="inactive"&&s.recorder.stop()}},cancel(){r()}}}function Nf(){for(let e of Lf)if(MediaRecorder.isTypeSupported(e))return e}var Ee=T.cssPrefix,An=te.scope("composer");function Mn(e){return e.reduce((t,n)=>t+n.size,0)}var Df={arrowUp:Ll,paperPlane:Ml,send:Ol,chevron:Tn};function hc(e){return"activeElement"in e}function $f(e){return"host"in e&&"activeElement"in e}function bc({options:e,transport:t,feedback:n,bus:o,persistence:r,conversationId:a,isStreaming:s,isMemoryCompacting:l=!1,canReleaseQueuedMessages:c=!0,active:d=!0,isPreparing:_=!1,operatorRequestEnabled:p,canRequestOperator:u=!1,controlMode:m,onRequestOperator:g,onSend:y,onStop:S,attachApiRef:k}){let x=e.strings,[h,P]=$(()=>r.loadDraft(a)),[b,w]=$([]),[E,Q]=$(()=>r.loadMessageQueue(a).map(I=>({id:I.id,text:I.text,attachments:[]}))),z=N(E),[A,D]=$(!1),[K,G]=$(!1),X=N(!1),U=N(null),_e=N(null),ie=N(null),Re=N(0),ue=N(a);ue.current=a;let be=N(d);be.current=d;let Ae=N(_);Ae.current=_;let Me=K||_||!d,qe=s||l,at=L(I=>{Q(M=>{let W=I(M);return r.saveMessageQueue(ue.current,W.filter(V=>V.attachments.length===0).map(({id:V,text:ge})=>({id:V,text:ge}))),z.current=W,W})},[r]),_t=L(I=>{at(M=>(M.find(W=>W.id===I)?.attachments.forEach(En),M.filter(W=>W.id!==I)))},[at]),Fe=L(I=>{P(M=>{let W=typeof I=="function"?I(M):I;return W===M?M:(r.saveDraft(ue.current,W),W)})},[r]),Ke=e.features.fileUpload,Ge=e.features.voice,[Le,Be]=$(()=>Ja(Ge,e.locale,(I,M)=>t.transcribe(I,M))),Ze=N(Le);Ze.current=Le;let Oe=N({mode:Ge,locale:e.locale,transport:t});O(()=>{let I=Oe.current;I.mode===Ge&&I.locale===e.locale&&I.transport===t||(Oe.current={mode:Ge,locale:e.locale,transport:t},Re.current++,Ze.current.cancel(),ie.current=null,D(!1),Be(Ja(Ge,e.locale,(M,W)=>t.transcribe(M,W))))},[e.locale,Ge,t]),O(()=>()=>{Re.current++,Le.cancel()},[Le]);let Ve=L(I=>{let M=ie.current;if(M===null)return!1;let W=Date.now()-M;return An[I]("voiceStop",{durationMs:W}),o.emit("voiceStop",{durationMs:W}),ie.current=null,!0},[o]),nt=L(()=>{ie.current!==null&&(Le.stop(),D(!1),Ve("info")&&n.play("voiceStop"))},[Ve,n,Le]),We=L(()=>{Re.current++,Le.cancel(),D(!1),Ve("info")&&n.play("voiceStop")},[Ve,n,Le]);O(()=>{(_||!d)&&We()},[d,We,_]),O(()=>{let I=U.current;if(!I)return;let M=I.getRootNode(),W=hc(M)?M.activeElement:null;W&&I.closest(`.${Ee}-panel`)?.contains(W)||I.focus({preventScroll:!0})},[]),O(()=>{let I=U.current;if(!I)return;if(h.length===0){I.style.height="";return}I.style.height="auto";let M=getComputedStyle(I),W=Number.parseFloat(M.getPropertyValue(`--${Ee}-textarea-base-height`)),V=Number.parseFloat(M.borderTopWidth)+Number.parseFloat(M.borderBottomWidth),ge=Math.min(I.scrollHeight+V,Number.parseFloat(M.maxHeight)),ye=Number.parseFloat(M.fontSize)*.7;I.style.height=`${ge<W+ye?W:ge}px`},[h]);let Se=N(b);Se.current=b,O(()=>()=>{Se.current.forEach(En);for(let I of z.current)I.attachments.forEach(En)},[]),O(()=>{if(k)return k.current={attachFromDrop:I=>{if(!Ke||!be.current||X.current||Ae.current)return;let M=kr(I,Se.current,e.attachments);M.accepted.length!==0&&(An.info("attach (drop)",{count:M.accepted.length,totalBytes:Mn(M.accepted)}),o.emit("attach",{count:M.accepted.length,totalBytes:Mn(M.accepted)}),w(W=>[...W,...M.accepted]))},fill:I=>{if(!be.current||X.current||Ae.current)return;Fe(I);let M=U.current;M&&(M.focus({preventScroll:!0}),requestAnimationFrame(()=>M.setSelectionRange(M.value.length,M.value.length)))}},()=>{k.current&&(k.current=null)}},[k,Ke,_,e.attachments,Fe]),O(()=>{let I=U.current;if(!I)return;let M=I.closest(`.${Ee}-panel`);if(!M)return;let W=V=>{if(!be.current||X.current||Ae.current)return;let ge=V.clipboardData;if(!ge)return;let ye=V.target?.closest?.("input, textarea, [contenteditable]:not([contenteditable='false'])");if(ye&&ye!==I)return;if(Ke){let ke=kr(ge.items,Se.current,e.attachments);if(ke.accepted.length>0){V.preventDefault(),An.info("attach (paste)",{count:ke.accepted.length,totalBytes:Mn(ke.accepted)}),o.emit("attach",{count:ke.accepted.length,totalBytes:Mn(ke.accepted)}),w(pt=>[...pt,...ke.accepted]);return}}if(ye===I)return;let vt=ge.getData("text/plain");vt&&(V.preventDefault(),Fe(ke=>ke+vt),I.focus())};return M.addEventListener("paste",W),()=>M.removeEventListener("paste",W)},[Ke,e.attachments,Fe]);let ot=async()=>{let I=h.trim();if(!I&&b.length===0||!d||s||X.current||_)return;We(),X.current=!0,G(!0);let M=h,W=b;try{await y(I,W)&&(Fe(V=>V===M?"":V),w(V=>V!==W?V:(W.forEach(En),Se.current=[],[])))}finally{X.current=!1,G(!1),requestAnimationFrame(()=>{let V=U.current;if(!V||V.disabled||!be.current)return;let ge=V.getRootNode(),ye=hc(ge)?ge.activeElement:null,vt=ye?.getAttribute("data-testid");if(!(ye&&ye!==V&&vt!==R.composerSend&&vt!==R.composerStop)){if($f(ge)){let ke=ge.host.ownerDocument;if(!ke.hasFocus())return;let pt=ke.activeElement;if(pt&&pt!==ge.host&&pt!==ke.body)return}V.focus({preventScroll:!0})}})}},kt=()=>{let I=h.trim();if(!I&&b.length===0||!d||!qe||X.current||_)return;We();let M=b;at(W=>[...W,{id:ct(),text:I,attachments:M}]),Fe(""),w(W=>W!==M?W:(Se.current=[],[])),U.current?.focus({preventScroll:!0})};O(()=>{let I=E[0];if(!I||!c||qe||K||_||!d)return;let M=setTimeout(()=>{y(I.text,I.attachments,I.id).then(W=>{W&&_t(I.id)})},300);return()=>clearTimeout(M)},[d,c,_,y,qe,E,_t,K]);let f=I=>{I.key!=="Enter"||I.shiftKey||I.isComposing||(I.preventDefault(),qe&&(h.trim()||b.length>0)?kt():s?S():ot())},F=I=>{let M=I.target;if(!d||X.current||_){M.value="";return}let W=kr(M.files,b,e.attachments);W.accepted.length>0&&(An.info("attach (file picker)",{count:W.accepted.length,totalBytes:Mn(W.accepted)}),o.emit("attach",{count:W.accepted.length,totalBytes:Mn(W.accepted)}),w(V=>[...V,...W.accepted])),M.value=""},j=I=>{!d||X.current||_||(An.info("removeAttachment",{id:I}),o.emit("removeAttachment",{id:I}),w(M=>{let W=M.find(V=>V.id===I);return W&&En(W),M.filter(V=>V.id!==I)}))},Y=()=>{if(A){nt();return}if(!d||!Le.isSupported||X.current||_)return;let I=++Re.current;ie.current=Date.now(),An.info("voiceStart"),o.emit("voiceStart",void 0),D(!0),n.play("voiceStart"),Le.start((M,W)=>{Re.current!==I||!be.current||Ae.current||X.current||!W||Fe(V=>`${V}${M} `)},()=>{Re.current!==I||!be.current||(D(!1),Ve("debug"))})},re=Df[e.composer.sendButton.icon],me=!!(h.trim()||b.length>0);return i("div",{class:`${Ee}-composer`,"data-testid":R.composer,children:[l?i("div",{class:`${Ee}-loading ${Ee}-compaction-status`,role:"status","data-testid":R.compactionStatus,children:[i("span",{class:`${Ee}-loading-spinner`,"aria-hidden":"true"}),x.compactingContext]}):null,E.length>0?i("div",{class:`${Ee}-message-queue`,"aria-label":x.queueMessage,"data-testid":R.messageQueue,children:E.map(I=>i("div",{class:`${Ee}-attachment-chip ${Ee}-queued-message`,"data-testid":`${R.queuedMessage}-${I.id}`,children:[i("span",{class:`${Ee}-attachment-name ${Ee}-queued-text`,children:I.text||I.attachments.map(M=>M.name).join(", ")}),i("button",{type:"button",class:`${Ee}-attachment-remove`,onClick:()=>_t(I.id),"aria-label":x.removeQueuedMessage,title:x.removeQueuedMessage,"data-testid":`${R.queuedMessageRemove}-${I.id}`,children:i(bt,{})})]},I.id))}):null,b.length>0?i("div",{class:`${Ee}-attachments`,children:b.map(I=>i(vc,{attachment:I,onRemove:()=>j(I.id),disabled:Me},I.id))}):null,i("div",{class:`${Ee}-composer-row`,children:[i("div",{class:`${Ee}-composer-actions`,children:[Ke?i("button",{type:"button",class:`${Ee}-icon-btn`,onClick:()=>_e.current?.click(),disabled:Me,"aria-label":x.attach,"data-testid":R.composerAttach,children:i(Dl,{})}):null,Le.isSupported?i("button",{type:"button",class:`${Ee}-icon-btn`,onClick:Y,disabled:Me,"aria-label":A?x.micStop:x.micStart,"aria-pressed":A,"data-recording":A?"true":void 0,"data-testid":R.composerVoice,children:i($l,{})}):null]}),i("textarea",{ref:U,name:"message",class:`${Ee}-textarea`,rows:1,value:h,placeholder:x.composerPlaceholder,onInput:I=>Fe(I.currentTarget.value),onKeyDown:f,disabled:Me,"aria-label":x.composerPlaceholder,"data-testid":R.composerInput}),qe&&me?i("button",{type:"button",class:`${Ee}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:kt,disabled:Me,"aria-label":x.queueMessage,title:x.queueMessage,"data-testid":R.composerSend,children:i(re,{})}):null,s?i("button",{type:"button",class:`${Ee}-send`,onClick:S,disabled:Me,"aria-label":x.stop,"data-testid":R.composerStop,children:i(Nl,{})}):null,!s&&(!qe||!me)?i("button",{type:"button",class:`${Ee}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:()=>{ot()},disabled:Me||!h.trim()&&b.length===0,"aria-label":x.send,"data-testid":R.composerSend,children:i(re,{})}):null,p&&m==="ai-agent"&&g?i("button",{type:"button",class:`${Ee}-icon-btn`,onClick:g,disabled:Me||!u,"aria-label":x.talkToOperator,title:x.talkToOperator,"data-testid":R.operatorRequest,children:i(ja,{})}):null]}),i("input",{ref:_e,name:"attachments",type:"file",multiple:!0,accept:e.attachments.accept,onChange:F,disabled:Me,class:`${Ee}-sr-only`,"data-testid":R.composerFileInput})]})}var Ff=T.cssPrefix;function yc({visible:e,strings:t}){return e?i("div",{class:`${Ff}-dropzone`,role:"status","aria-live":"polite",children:t.dropZone}):null}function wr({containerRef:e,onDrop:t,disabled:n=!1}){let[o,r]=$(!1);return O(()=>{if(n){r(!1);return}let a=e.current;if(!a)return;let s=0,l=p=>{s+=1,p.dataTransfer?.types.includes("Files")&&(p.preventDefault(),r(!0))},c=()=>{s-=1,!(s>0)&&(s=0,r(!1))},d=p=>{p.dataTransfer?.types.includes("Files")&&p.preventDefault()},_=p=>{s=0,r(!1),p.dataTransfer&&(p.preventDefault(),t(p.dataTransfer.items))};return a.addEventListener("dragenter",l),a.addEventListener("dragleave",c),a.addEventListener("dragover",d),a.addEventListener("drop",_),()=>{a.removeEventListener("dragenter",l),a.removeEventListener("dragleave",c),a.removeEventListener("dragover",d),a.removeEventListener("drop",_)}},[e,n,t]),{visible:n?!1:o}}function Pc({itemCount:e,initialFocusIndex:t}){let[n,o]=$(!1),r=N(null),a=N(null),[s,l]=$(-1),c=L(()=>{o(!1),l(-1),r.current?.focus()},[]),d=L(()=>o(u=>!u),[]);O(()=>{if(!n)return;let u=m=>{let g=a.current,y=r.current;if(!g||!y)return;let S=m.composedPath();S.includes(g)||S.includes(y)||(o(!1),l(-1))};return document.addEventListener("click",u,!0),()=>document.removeEventListener("click",u,!0)},[n]),O(()=>{if(!n||e===0)return;let u=t?.()??0,m=u<0||u>=e?0:u;l(m)},[n,e,t]),O(()=>{if(!n||s<0)return;a.current?.querySelectorAll("[role='menuitem']")?.[s]?.focus()},[n,s]);let _=L(u=>{(u.key==="ArrowDown"||u.key==="Enter"||u.key===" ")&&(u.preventDefault(),o(!0))},[]),p=L(u=>{if(e!==0)switch(u.key){case"Escape":u.preventDefault(),c();return;case"ArrowDown":u.preventDefault(),l(m=>(m+1)%e);return;case"ArrowUp":u.preventDefault(),l(m=>(m-1+e)%e);return;case"Home":u.preventDefault(),l(0);return;case"End":u.preventDefault(),l(e-1)}},[e,c]);return{open:n,focusIndex:s,triggerRef:r,menuRef:a,toggle:d,close:c,onTriggerKey:_,onMenuKey:p}}function xc({items:e,triggerLabel:t}){let n=T.cssPrefix,o=Pc({itemCount:e.length}),r=l=>{l.disabled||(l.onSelect?.(),l.keepOpen||o.close())},a=(l,c)=>l.onSelectValue?.(c),s=(l,c)=>{let d=c.segments;if(!d?.length)return;let _=Math.max(0,d.findIndex(u=>u.value===c.value)),p=-1;if(l.key==="ArrowRight"||l.key==="Enter"||l.key===" ")p=(_+1)%d.length;else if(l.key==="ArrowLeft")p=(_-1+d.length)%d.length;else return;l.preventDefault(),l.stopPropagation(),a(c,d[p].value)};return i("div",{class:`${n}-menu-wrap`,children:[i("button",{ref:o.triggerRef,type:"button",class:`${n}-icon-btn`,"aria-label":t,"aria-haspopup":"menu","aria-expanded":o.open,title:t,onClick:o.toggle,onKeyDown:o.onTriggerKey,children:i(Vl,{})}),o.open?i("div",{ref:o.menuRef,class:`${n}-menu`,role:"menu","aria-label":t,onKeyDown:o.onMenuKey,tabIndex:-1,children:e.map(l=>l.segments?i("div",{role:"menuitem",class:`${n}-menu-item ${n}-menu-item-segmented`,"aria-label":l.label,tabIndex:-1,onKeyDown:c=>s(c,l),children:[l.icon?i("span",{class:`${n}-menu-icon`,children:l.icon}):null,i("span",{class:`${n}-menu-label`,children:l.label}),i("span",{class:`${n}-segmented`,role:"group","aria-label":l.label,children:l.segments.map(c=>{let d=c.value===l.value;return i("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":`${R.langSegment}-${c.value}`,onClick:()=>a(l,c.value),children:c.label},c.value)})})]},l.id):i("button",{type:"button",role:"menuitem",class:`${n}-menu-item`,"aria-pressed":l.type==="switch"?l.on:void 0,disabled:l.disabled,onClick:()=>r(l),children:[l.icon?i("span",{class:`${n}-menu-icon`,children:l.icon}):null,i("span",{class:`${n}-menu-label`,children:l.label}),l.type==="switch"&&l.on?i("span",{class:`${n}-menu-check`,"aria-hidden":"true",children:i(on,{})}):null]},l.id))}):null]})}var Za=T.cssPrefix;function Bf(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 Hf={normal:"large",large:"small",small:"normal"};function Uf(e){return e==="light"?i(nc,{}):e==="dark"?i(oc,{}):i(rc,{})}function zf(e){return(e.split("-")[0]??e).toUpperCase()}function qf(e,t){let n;try{n=new URL(e,window.location.href)}catch{return}if(!(n.protocol!=="http:"&&n.protocol!=="https:"))return t.conversationId&&n.searchParams.set("chat",t.conversationId),n.searchParams.set("widgetId",t.widgetId),t.publicKey&&n.searchParams.set("public_key",t.publicKey),n.searchParams.set("ai_agent_deployment_id",t.aiAgentDeploymentId),n.href}function wt({panelProps:e,variant:t}){let{options:n,panelSize:o,feedback:r,onClose:a,onClear:s,onExpand:l,onFullscreen:c,onSoundToggle:d}=e,{onToggleHistory:_,onLocaleChange:p,onThemeChange:u,onTextSizeChange:m}=e,g=n.strings,y=n.mode,S=t==="chat",k=dt(()=>r.mutedSig.value).value,x=new Set(n.actions),h=U=>x.has(U),P=typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches,b=U=>P?!1:In(U,y,o),w=n.themeMode,E={auto:g.themeAuto,light:g.themeLight,dark:g.themeDark},Q=n.textSize,z={small:g.textSizeSmall,normal:g.textSizeNormal,large:g.textSizeLarge},A=[];if(S&&h("clear")&&A.push({id:"clear",icon:i(Yl,{}),label:g.newConversation,onSelect:s}),h("expand")&&b("expand")){let U=o==="expanded";A.push({id:"expand",icon:U?i(Bl,{}):i(Fl,{}),label:U?g.collapse:g.expand,type:"switch",on:U,onSelect:l})}if(h("fullscreen")&&b("fullscreen")){let U=o==="fullscreen";A.push({id:"fullscreen",icon:U?i(Ul,{}):i(Hl,{}),label:U?g.exitFullscreen:g.fullscreen,type:"switch",on:U,onSelect:c})}let D=n.popOutUrl,K=n.aiAgentDeploymentId;h("popOut")&&D&&K&&In("popOut",y,o)&&A.push({id:"popOut",icon:i(zl,{}),label:g.popOut,onSelect:()=>{let U=qf(D,{conversationId:e.conversationId,widgetId:n.widgetId,publicKey:n.publicKey,aiAgentDeploymentId:K});U&&window.open(U,"_blank","noopener,noreferrer")}}),S&&h("sound")&&A.push({id:"sound",icon:k?i(Kl,{}):i(Wl,{}),label:k?g.soundOff:g.soundOn,type:"switch",on:!k,onSelect:d}),h("theme")&&A.push({id:"theme",icon:Uf(w),label:`${g.theme}: ${E[w]}`,onSelect:()=>u(Bf(w)),keepOpen:!0}),h("textSize")&&A.push({id:"textSize",icon:i(Gl,{}),label:`${g.textSize}: ${z[Q]}`,onSelect:()=>m(Hf[Q]),keepOpen:!0}),h("language")&&n.availableLocales.length>1&&A.push({id:"language",icon:i(Xl,{}),label:g.language,segments:n.availableLocales.map(U=>({value:U,label:zf(U),lang:U})),value:n.locale,onSelectValue:p});let G=!!a&&Pr(y,o,n.actions),X=S&&h("history");return i("div",{class:`${Za}-header-actions`,children:[X?i("button",{type:"button",class:`${Za}-icon-btn`,onClick:_,"aria-label":g.history,title:g.history,"data-testid":R.actionHistory,children:i(Ql,{})}):null,A.length>0?i(xc,{items:A,triggerLabel:g.moreActions}):null,G?i("button",{type:"button",class:`${Za}-icon-btn`,onClick:a,"aria-label":g.close,title:g.close,"data-testid":R.actionClose,children:i(bt,{})}):null]})}var Vf=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Wf=/^https?:\/\/[^\s.]+\.[^\s]+$/i,Kf=/^[+]?[\d\s().-]{6,}$/;function Ln(e,t){return e.replace(/\{(\w+)\}/g,(n,o)=>String(t[o]??`{${o}}`))}function Gf(e){return Array.isArray(e)?e.length:e&&e.trim()?1:0}function jf(e,t,n){let o=e.required??!0,r=e.validation;if(e.type==="multiselect"){let s=Gf(t);return o&&s===0?n.formRequired:s===0?void 0:r?.minSelections!=null&&s<r.minSelections?Ln(n.formChooseAtLeast,{min:r.minSelections}):r?.maxSelections!=null&&s>r.maxSelections?Ln(n.formChooseAtMost,{max:r.maxSelections}):void 0}let a=typeof t=="string"?t.trim():"";if(!a)return o?n.formRequired:void 0;switch(e.type){case"email":if(!Vf.test(a))return n.formInvalidEmail;break;case"url":if(!Wf.test(a))return n.formInvalidUrl;break;case"tel":if(!Kf.test(a))return n.formInvalidTel;break;case"number":{let s=Number(a);if(!Number.isFinite(s))return n.formInvalidNumber;if(r?.min!=null&&s<r.min)return Ln(n.formNumberTooSmall,{min:r.min});if(r?.max!=null&&s>r.max)return Ln(n.formNumberTooLarge,{max:r.max});break}default:break}if(r?.minLength!=null&&a.length<r.minLength)return Ln(n.formTooShort,{min:r.minLength});if(r?.maxLength!=null&&a.length>r.maxLength)return Ln(n.formTooLong,{max:r.maxLength});if(r?.pattern)try{if(!new RegExp(r.pattern).test(a))return n.formPatternMismatch}catch{}}function Sc(e,t,n){let o={};for(let r of e){let a=jf(r,t[r.name],n);a&&(o[r.name]=a)}return o}function kc(e){let t={};for(let[n,o]of Object.entries(e)){let r=Array.isArray(o)?o.join(", "):o;r&&r.trim()&&(t[n]=r.trim())}return t}var we=T.cssPrefix,Cr="__other__";function uo({fields:e,strings:t,submitLabel:n,onSubmit:o,skipLabel:r,onSkip:a,footerHint:s,submitOnEnter:l,disabled:c,initialValues:d,hideActions:_,fieldTypeLabels:p,rootTestId:u,submitTestId:m,skipTestId:g}){let[y,S]=$(()=>({...Jf(e),...d})),[k,x]=$({}),[h,P]=$({}),b=A=>{h[A]&&P(D=>({...D,[A]:""}))},w=(A,D)=>{S(K=>({...K,[A]:D})),b(A)},E=(A,D)=>{x(K=>({...K,[A]:D})),b(A)},Q=A=>{if(A.preventDefault(),c)return;let D=Zf(e,y,k),K=Sc(e,D,t);if(Object.keys(K).length>0){P(K);return}o(kc(D))},z=A=>{!l||A.key!=="Enter"||A.shiftKey||A.isComposing||A.target?.tagName==="TEXTAREA"&&Q(A)};return i("form",{class:`${we}-form`,onSubmit:Q,onKeyDown:z,"data-testid":u,noValidate:!0,children:[e.map(A=>i(Qf,{field:A,value:y[A.name],otherText:k[A.name]??"",error:h[A.name],disabled:c,typeLabel:p?.[A.name],strings:t,onChange:D=>w(A.name,D),onOtherChange:D=>E(A.name,D)},A.name)),_?null:i("div",{class:`${we}-form-actions`,children:[s?i("span",{class:`${we}-form-hint`,children:s}):null,r&&a?i("button",{type:"button",class:`${we}-form-skip`,onClick:a,disabled:c,"data-testid":g,children:r}):null,i("button",{type:"submit",class:`${we}-form-submit`,disabled:c,"data-testid":m,children:n})]})]})}function Qf({field:e,value:t,otherText:n,error:o,disabled:r,typeLabel:a,strings:s,onChange:l,onOtherChange:c}){let d=Xe(R.formField,e.name),_=Xf({field:e,value:t,otherText:n,disabled:r,strings:s,onChange:l,onOtherChange:c,fieldTid:d});return i("label",{class:`${we}-field`,"data-field":e.name,"data-invalid":o?"true":void 0,children:[i("span",{class:`${we}-field-head`,children:[i("span",{class:`${we}-field-label`,children:[e.label,e.required??!0?i("span",{class:`${we}-field-req`,"aria-hidden":"true",children:" *"}):null]}),a?i("span",{class:`${we}-field-type`,children:a}):null]}),_,e.validationHint&&!o?i("span",{class:`${we}-field-hint`,children:e.validationHint}):null,o?i("span",{class:`${we}-field-error`,role:"alert",children:o}):null]})}function Xf(e){let{field:t,value:n,otherText:o,disabled:r,strings:a,onChange:s,onOtherChange:l,fieldTid:c}=e,d=typeof n=="string"?n:"";switch(t.type){case"textarea":return i("textarea",{class:`${we}-field-input`,rows:3,value:d,placeholder:t.placeholder,disabled:r,onInput:_=>s(_.target.value),"data-testid":c});case"select":return i("select",{class:`${we}-field-input`,value:d,disabled:r,onChange:_=>s(_.target.value),"data-testid":c,children:[i("option",{value:"",children:t.placeholder??"\u2014"}),(t.options??[]).map(_=>i("option",{value:_.value,children:_.label??_.value},_.value))]});case"radio":{let _=t.allowOther&&d===Cr;return i("div",{class:`${we}-field-choices`,role:"radiogroup","data-testid":c,children:[(t.options??[]).map(p=>i("label",{class:`${we}-choice`,children:[i("input",{type:"radio",name:`${we}-${t.name}`,checked:d===p.value,disabled:r,onChange:()=>s(p.value)}),i("span",{children:p.label??p.value})]},p.value)),t.allowOther?i("label",{class:`${we}-choice`,children:[i("input",{type:"radio",name:`${we}-${t.name}`,checked:d===Cr,disabled:r,onChange:()=>s(Cr)}),i("span",{children:a.formOther})]}):null,_?i("input",{class:`${we}-field-input`,value:o,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:r,onInput:p=>l(p.target.value)}):null]})}case"checkbox":return i("label",{class:`${we}-choice`,children:[i("input",{type:"checkbox",checked:d==="true",disabled:r,onChange:_=>s(_.target.checked?"true":""),"data-testid":c}),i("span",{children:t.placeholder??t.label})]});case"multiselect":{let _=Array.isArray(n)?n:[],p=(u,m)=>s(m?[..._,u]:_.filter(g=>g!==u));return i("div",{class:`${we}-field-choices`,"data-testid":c,children:[(t.options??[]).map(u=>i("label",{class:`${we}-choice`,children:[i("input",{type:"checkbox",checked:_.includes(u.value),disabled:r,onChange:m=>p(u.value,m.target.checked)}),i("span",{children:u.label??u.value})]},u.value)),t.allowOther||(t.options??[]).length===0?i("textarea",{class:`${we}-field-input`,rows:2,value:o,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:r,onInput:u=>l(u.target.value)}):null]})}default:return i("input",{class:`${we}-field-input`,type:Yf(t.type),value:d,placeholder:t.placeholder,disabled:r,onInput:_=>s(_.target.value),"data-testid":c})}}function Yf(e){switch(e){case"number":case"email":case"tel":case"url":case"date":case"time":return e;default:return"text"}}function Jf(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 Zf(e,t,n){let o={...t};for(let r of e){let a=n[r.name]?.trim();if(r.type==="radio"&&r.allowOther&&t[r.name]===Cr)o[r.name]=a??"";else if(r.type==="multiselect"&&a){let s=a.split(/[,\n;]+/).map(c=>c.trim()).filter(Boolean),l=Array.isArray(t[r.name])?t[r.name]:[];o[r.name]=[...l,...s]}}return o}var Ct=T.cssPrefix;function ei({form:e,strings:t,onSubmit:n,onSkip:o}){return i("div",{class:`${Ct}-form-gate`,"data-testid":R.formGate,children:[e.title?i("h3",{class:`${Ct}-form-gate-title`,children:e.title}):null,e.description?i("p",{class:`${Ct}-form-gate-desc`,children:e.description}):null,i(uo,{fields:e.fields,strings:t,submitLabel:e.submitLabel??t.formSubmit,onSubmit:n,skipLabel:e.skippable?t.formSkip:void 0,onSkip:e.skippable?o:void 0,submitTestId:R.formSubmit,skipTestId:R.formSkip})]})}function wc({marker:e,strings:t,onFill:n}){let o=e.outcome==="skipped",r=o?t.formSkipped:t.formSubmitted,a=e.title?i(de,{children:[i("span",{children:e.title}),i("span",{class:`${Ct}-sr-only`,children:r})]}):i("span",{children:r}),s=e.form?.reviewable??!1,l=!o&&s&&e.values&&Object.keys(e.values).length>0?e.values:null;if(l){let c=d=>e.form?.fields.find(_=>_.name===d)?.label??d;return i("details",{class:`${Ct}-form-done`,"data-outcome":e.outcome,"data-testid":R.formDone,children:[i("summary",{class:`${Ct}-form-done-summary`,"data-testid":R.formDoneToggle,children:[i(on,{}),a,i(Tn,{})]}),i("dl",{class:`${Ct}-form-answers`,"data-testid":R.formAnswers,children:Object.entries(l).map(([d,_])=>i("div",{class:`${Ct}-form-answer`,children:[i("dt",{children:c(d)}),i("dd",{children:_})]},d))})]})}return i("div",{class:`${Ct}-form-done`,"data-outcome":e.outcome,"data-testid":R.formDone,role:"status",children:[o?i(jl,{}):i(on,{}),a,o&&e.form?.reopenable&&n?i("button",{type:"button",class:`${Ct}-form-done-fill`,"data-testid":R.formFill,onClick:n,children:t.formFillOut}):null]})}function nm(e,t){for(var n in t)e[n]=t[n];return e}function ni(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var o in t)if(o!=="__source"&&e[o]!==t[o])return!0;return!1}function Cc(e,t){this.props=e,this.context=t}function Oc(e,t){function n(r){var a=this.props.ref;return a!=r.ref&&a&&(typeof a=="function"?a(null):a.current=null),t?!t(this.props,r)||a!=r.ref:ni(this.props,r)}function o(r){return this.shouldComponentUpdate=n,Et(e,r)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.__f=o.prototype.isReactComponent=!0,o.type=e,o}(Cc.prototype=new lt).isPureReactComponent=!0,Cc.prototype.shouldComponentUpdate=function(e,t){return ni(this.props,e)||ni(this.state,t)};var Rc=ee.__b;ee.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Rc&&Rc(e)};var nP=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var om=ee.__e;ee.__e=function(e,t,n,o){if(e.then){for(var r,a=t;a=a.__;)if((r=a.__c)&&r.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k||[]),r.__c(e,t)}om(e,t,n,o)};var Tc=ee.unmount;function Nc(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(o){typeof o.__c=="function"&&o.__c()}),e.__c.__H=null),(e=nm({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(o){return Nc(o,t,n)})),e}function Dc(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(o){return Dc(o,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function ti(){this.__u=0,this.o=null,this.__b=null}function $c(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function Rr(){this.i=null,this.l=null}ee.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Tc&&Tc(e)},(ti.prototype=new lt).__c=function(e,t){var n=t.__c,o=this;o.o==null&&(o.o=[]),o.o.push(n);var r=$c(o.__v),a=!1,s=function(){a||o.__z||(a=!0,n.__R=null,r?r(c):c())};n.__R=s;var l=n.__P;n.__P=null;var c=function(){if(!--o.__u){if(o.state.__a){var d=o.state.__a;o.__v.__k[0]=Dc(d,d.__c.__P,d.__c.__O)}var _;for(o.setState({__a:o.__b=null});_=o.o.pop();)_.__P=l,_.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(s,s)},ti.prototype.componentWillUnmount=function(){this.o=[]},ti.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=Nc(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&Et(de,null,e.fallback);return r&&(r.__u&=-33),[Et(de,null,t.__a?null:e.children),r]};var Ic=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(Rr.prototype=new lt).__a=function(e){var t=this,n=$c(t.__v),o=t.l.get(e);return o[0]++,function(r){var a=function(){t.props.revealOrder?(o.push(r),Ic(t,e,o)):r()};n?n(a):a()}},Rr.prototype.render=function(e){this.i=null,this.l=new Map;var t=Wn(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Rr.prototype.componentDidUpdate=Rr.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Ic(e,n,t)})};var rm=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,am=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,im=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,sm=/[A-Z0-9]/g,lm=typeof document<"u",cm=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};lt.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(lt.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Ec=ee.event;ee.event=function(e){return Ec&&(e=Ec(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Fc,dm={configurable:!0,get:function(){return this.class}},Ac=ee.vnode;ee.vnode=function(e){typeof e.type=="string"&&(function(t){var n=t.props,o=t.type,r={},a=o.indexOf("-")==-1;for(var s in n){var l=n[s];if(!(s==="value"&&"defaultValue"in n&&l==null||lm&&s==="children"&&o==="noscript"||s==="class"||s==="className")){var c=s.toLowerCase();s==="defaultValue"&&"value"in n&&n.value==null?s="value":s==="download"&&l===!0?l="":c==="translate"&&l==="no"?l=!1:c[0]==="o"&&c[1]==="n"?c==="ondoubleclick"?s="ondblclick":c!=="onchange"||o!=="input"&&o!=="textarea"||cm(n.type)?c==="onfocus"?s="onfocusin":c==="onblur"?s="onfocusout":im.test(s)&&(s=c):c=s="oninput":a&&am.test(s)?s=s.replace(sm,"-$&").toLowerCase():l===null&&(l=void 0),c==="oninput"&&r[s=c]&&(s="oninputCapture"),r[s]=l}}o=="select"&&(r.multiple&&Array.isArray(r.value)&&(r.value=Wn(n.children).forEach(function(d){d.props.selected=r.value.indexOf(d.props.value)!=-1})),r.defaultValue!=null&&(r.value=Wn(n.children).forEach(function(d){d.props.selected=r.multiple?r.defaultValue.indexOf(d.props.value)!=-1:r.defaultValue==d.props.value}))),n.class&&!n.className?(r.class=n.class,Object.defineProperty(r,"className",dm)):n.className&&(r.class=r.className=n.className),t.props=r})(e),e.$$typeof=rm,Ac&&Ac(e)};var Mc=ee.__r;ee.__r=function(e){Mc&&Mc(e),Fc=e.__c};var Lc=ee.diffed;ee.diffed=function(e){Lc&&Lc(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value),Fc=null};function Tr(e){if(!e)return!1;let t=e.startsWith("tool:")?e.slice(5):e;return t==="ask-user-questions"||t==="ask_user_questions"}var yt=T.cssPrefix;function ri(e){return e.startsWith("tool:")||e.startsWith("tool-")?e.slice(5):e}function Ir(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 ai({status:e,icon:t,label:n}){return i("span",{class:`${yt}-toolui-badge ${yt}-toolui-status`,"data-status":e,children:[i("span",{class:`${yt}-toolui-status-icon`,children:t}),n]})}function um(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 ii(e,t,n={}){return n.submitted?"responded":fm(um(e,t),n.superseded,n.live??!0)}function _m({status:e}){return e==="denied"||e==="error"||e==="superseded"?i(vr,{}):e==="completed"||e==="responded"?i(gr,{}):i(cc,{})}function pm(e,t){switch(e){case"awaiting":return t.statusAwaiting;case"responded":return t.statusResponded;case"completed":return t.statusCompleted;case"denied":return t.statusDenied;case"error":return t.statusError;case"superseded":return t.statusSuperseded;default:return t.statusRunning}}function fm(e,t,n){return t&&(e==="awaiting"||e==="running")?"superseded":!n&&e==="running"?"error":e}function mm({state:e,approval:t,strings:n,superseded:o,live:r=!0,submitted:a=!1}){let s=ii(e,t,{superseded:o,live:r,submitted:a});return i(ai,{status:s,icon:i(_m,{status:s}),label:pm(s,n)})}function gm({name:e,state:t,approval:n,strings:o,superseded:r,live:a,submitted:s}){return i(de,{children:[i("span",{class:`${yt}-toolui-name-pill`,children:[i(lc,{}),i("span",{class:`${yt}-toolui-name-text`,children:e})]}),i(mm,{state:t,approval:n,strings:o,superseded:r,live:a,submitted:s}),i("span",{class:`${yt}-toolui-chevron`,children:i(rn,{})})]})}function Er({part:e,strings:t,testid:n,superseded:o,live:r,submitted:a}){let s=oe(()=>pe(()=>e.inputSig.value),[e]),l=oe(()=>pe(()=>e.outputSig.value),[e]),c=oe(()=>pe(()=>e.errorSig.value),[e]),d=oe(()=>pe(()=>e.stateSig.value),[e]),_=oe(()=>pe(()=>e.approvalSig.value),[e]);return i("details",{class:`${yt}-toolui ${yt}-toolui-collapsible`,"data-testid":n,children:[i("summary",{class:`${yt}-toolui-head`,children:i(gm,{name:ri(e.toolName),state:d.value,approval:_.value,strings:t,superseded:o,live:r,submitted:a})}),i(oi,{label:t.toolParameters,value:s.value}),l.value!==void 0?i(oi,{label:t.toolResult,value:l.value}):null,c.value?i(oi,{label:t.statusError,value:c.value,error:!0}):null]})}function oi({label:e,value:t,error:n}){let o=n?String(t??""):Ar(si(t));return o?i("div",{class:`${yt}-toolui-section`,children:[i("span",{class:`${yt}-toolui-label`,children:e}),i("pre",{class:`${yt}-toolui-code`,"data-error":n?"true":void 0,children:o})]}):null}function si(e){if(e&&typeof e=="object"){let t=e;if(t.storage==="tool-result-ref"&&"summary"in t)return t.summary}return e}function Ar(e){if(e==null)return"";try{let t=typeof e=="string"?e:JSON.stringify(e,null,2);return!t||t==="{}"||t==="[]"||t==='""'?"":t.length>800?`${t.slice(0,800)}\u2026`:t}catch{return""}}function Bc(e){return e.partsSig.value.some(t=>t.kind==="text"&&t.textSig.value.length>0)}function Hc(e){return e.partsSig.value.some(t=>t.kind==="reasoning")}function vm(e){return e.streaming&&!e.bufferedHold&&!(e.reasoningVisible&&e.working)}function Uc(e){let{streaming:t,reasoningVisible:n,emptyReply:o,hidden:r}=e,a=e.responseMode==="buffered"&&t,s=t&&!e.hasAnswerText;return{streaming:t,bufferedHold:a,reasoningVisible:n,working:s,showStreamDots:vm({streaming:t,bufferedHold:a,reasoningVisible:n,working:s}),emptyReply:o,hidden:r}}function zc(e,t){let n=e.stateSig.value,o=e.approvalSig.value,{terminal:r,responded:a,decided:s}=Ir(n,o),l=t.continuationStreaming===!0&&!s,c=t.superseded&&!s&&!l;return{pill:ii(n,o,{superseded:c,live:t.live,submitted:l}),state:n,terminal:r,decided:s||l,showApproveReject:!s&&!t.superseded&&!l,showAnswered:a&&!r&&!c,showSubmitted:l,showEdit:a&&t.active&&!r,skipped:c,answeredApproved:o?.approved}}var di=1,Vc=2,Wc=4,Kc=8,Gc=16;function hm(e){switch(e){case di:return"href";case Vc:return"src";case Wc:return"class";case Kc:return"checked";case Gc:return"start"}}var bm=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}},ym=bm;var qc=24;function _i(e){let t=new Uint32Array(qc);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(qc),indent:"",indent_len:0,table_state:0}}function jc(e){e.pending.length>0&&et(e,`
|
|
12
|
+
`)}function fe(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 $e(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 ve(e,t){(e.tokens[e.len]===24||e.tokens[e.len]===23)&&t!==25&&$e(e),e.len+=1,e.tokens[e.len]=t,e.token=t,e.renderer.add_token(e.renderer.data,t)}function Pm(e,t,n){for(;n<=e.len;){if(e.tokens[n]===t)return n;n+=1}return-1}function sn(e,t){for(e.fence_start=0;e.len>t;)$e(e)}function Mr(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;)$e(e);return t}function li(e,t){let n=-1,o=-1;for(let r=e.blockquote_idx+1;r<=e.len;r+=1)if(e.tokens[r]===25){if(e.indent_len<e.spaces[r]){o=-1;break}o=r}else e.tokens[r]===t&&(n=r);return o===-1?n===-1?(sn(e,e.blockquote_idx),ve(e,t),!0):(sn(e,n),!1):(sn(e,o),ve(e,t),!0)}function ci(e,t){ve(e,25),e.spaces[e.len]=e.indent_len+t,$t(e),e.token=103}function $t(e){e.indent="",e.indent_len=0,e.pending=""}function ui(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 xm(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 Sm(e){return ui(e)||xm(e)}function et(e,t){for(let n of t){if(e.token===101){switch(n){case" ":e.indent_len+=1;continue;case" ":e.indent_len+=4;continue}let r=Mr(e,e.indent_len);e.indent_len=0,e.token=e.tokens[e.len],r>0&&et(e," ".repeat(r))}let o=e.pending+n;switch(e.token){case 21:case 1:case 20:case 24:case 23:switch(console.assert(e.text.length===0,"Root should not have any text"),e.pending[0]){case void 0:e.pending=n;continue;case" ":console.assert(e.pending.length===1),e.pending=n,e.indent+=" ",e.indent_len+=1;continue;case" ":console.assert(e.pending.length===1),e.pending=n,e.indent+=" ",e.indent_len+=4;continue;case`
|
|
13
|
+
`:if(console.assert(e.pending.length===1),e.tokens[e.len]===25&&e.token===21){$e(e),$t(e),e.pending=n;continue}sn(e,e.blockquote_idx),$t(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" ":Mr(e,e.indent_len),ve(e,ym(e.pending.length)),$t(e);continue}break;case">":{let a=Pm(e,20,e.blockquote_idx+1);a===-1?(sn(e,e.blockquote_idx),e.blockquote_idx+=1,e.fence_start=0,ve(e,20)):e.blockquote_idx=a,$t(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;Mr(e,e.indent_len),e.renderer.add_token(e.renderer.data,22),e.renderer.end_token(e.renderer.data),$t(e),e.hr_chars=0;continue}e.hr_chars=0}if(e.pending[0]!=="_"&&e.pending[1]===" "){li(e,23),ci(e,2),et(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):(ve(e,2),$t(e),e.fence_start=0,et(e,o));continue;case`
|
|
15
|
+
`:{Mr(e,e.indent_len),ve(e,10),e.pending.length>e.fence_start&&e.renderer.set_attr(e.renderer.data,Wc,e.pending.slice(e.fence_start)),$t(e),e.token=101;continue}default:e.pending=o;continue}case"+":if(n!==" ")break;li(e,23),ci(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;li(e,24)&&e.pending!=="1."&&e.renderer.set_attr(e.renderer.data,Gc,e.pending.slice(0,-1)),ci(e,e.pending.length+1);continue}else{let a=n.charCodeAt(0);if(a===46||ui(a)){e.pending=o;continue}}break;case"|":sn(e,e.blockquote_idx),ve(e,27),ve(e,28),e.pending="",et(e,n);continue}let r=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}r=e.indent.slice(a)+o,ve(e,9)}else ve(e,2);$t(e),et(e,r);continue;case 27:if(e.table_state===1)switch(n){case"-":case" ":case"|":case":":e.pending=o;continue;case`
|
|
16
|
+
`:e.table_state=2,e.pending="";continue;default:$e(e),e.table_state=0;break}else switch(e.pending){case"|":ve(e,28),e.pending="",et(e,n);continue;case`
|
|
17
|
+
`:$e(e),e.pending="",e.table_state=0,et(e,n);continue}break;case 28:switch(e.pending){case"":break;case"|":ve(e,29),$e(e),e.pending="",et(e,n);continue;case`
|
|
18
|
+
`:$e(e),e.table_state=Math.min(e.table_state+1,2),e.pending="",et(e,n);continue;default:ve(e,29),et(e,n);continue}break;case 29:if(e.pending==="|"){fe(e),$e(e),e.pending="",et(e,n);continue}break;case 9:switch(o){case`
|
|
19
19
|
`:case`
|
|
20
20
|
`:case`
|
|
21
21
|
`:case`
|
|
@@ -25,18 +25,18 @@ ${a}`:a;continue}r.startsWith("id:")&&(o=r.slice(3).trim())}if(n==="[DONE]")retu
|
|
|
25
25
|
`:case`
|
|
26
26
|
`:case`
|
|
27
27
|
`:case`
|
|
28
|
-
`:e.pending=o;continue;default:e.pending.length!==0?(
|
|
29
|
-
`:if(o.length===e.fence_start+e.fence_end+1){
|
|
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]===" ")?(
|
|
31
|
-
`:e.text+=e.pending,e.pending="",e.token=21,e.blockquote_idx=0,
|
|
32
|
-
`?(
|
|
33
|
-
`||n==="\\"?(e.renderer.set_attr(e.renderer.data,
|
|
34
|
-
`:e.pending=n;continue;default:let r=n.charCodeAt(0);e.pending="",e.text+=
|
|
35
|
-
`:switch(e.token){case 19:case 30:case 31:break;case 3:case 4:case 5:case 6:case 7:case 8:
|
|
28
|
+
`:e.pending=o;continue;default:e.pending.length!==0?(fe(e),$e(e),e.pending=n):e.text+=n;continue}case 10:switch(n){case"`":e.pending=o;continue;case`
|
|
29
|
+
`:if(o.length===e.fence_start+e.fence_end+1){fe(e),$e(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
|
+
`){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]===" ")?(fe(e),$e(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,fe(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,Kc,""),e.renderer.end_token(e.renderer.data),e.pending=" ";continue}e.token=e.tokens[e.len],e.pending="",et(e,o);continue;case 14:case 15:{let a="*",s=12;if(e.token===15&&(a="_",s=13),a===e.pending){if(fe(e),a===n){$e(e),e.pending="";continue}ve(e,s),e.pending=n;continue}break}case 12:case 13:{let a="*",s=14;switch(e.token===13&&(a="_",s=15),e.pending){case a:a===n?e.tokens[e.len-1]===s?e.pending=o:(fe(e),ve(e,s),e.pending=""):(fe(e),$e(e),e.pending=n);continue;case a+a:let l=e.token;fe(e),$e(e),$e(e),a!==n?(ve(e,l),e.pending=n):e.pending="";continue}break}case 16:if(o==="~~"){fe(e),$e(e),e.pending="";continue}break;case 105:n===`
|
|
32
|
+
`?(fe(e),ve(e,30),e.pending=""):(e.token=e.tokens[e.len],e.pending[0]==="\\"?e.text+="[":e.text+="$$",e.pending="",et(e,n));continue;case 30:if(o==="\\]"||o==="$$"){fe(e),$e(e),e.pending="";continue}break;case 31:if(o==="\\)"||e.pending[0]==="$"){fe(e),$e(e),n===")"?e.pending="":e.pending=n;continue}break;case 102:o==="http://"||o==="https://"?(fe(e),ve(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],et(e,n));continue;case 17:case 19:if(e.pending==="]"){fe(e),n==="("?e.pending=o:($e(e),e.pending=n);continue}if(e.pending[0]==="]"&&e.pending[1]==="("){if(n===")"){let a=e.token===17?di:Vc,s=e.pending.slice(2);e.renderer.set_attr(e.renderer.data,a,s),$e(e),e.pending=""}else e.pending+=n;continue}break;case 18:n===" "||n===`
|
|
33
|
+
`||n==="\\"?(e.renderer.set_attr(e.renderer.data,di,e.pending),fe(e),$e(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===">"){fe(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),et(e,n);continue}switch(e.pending[0]){case"\\":if(e.token===19||e.token===30||e.token===31)break;switch(n){case"(":fe(e),ve(e,31),e.pending="";continue;case"[":e.token=105,e.pending=o;continue;case`
|
|
34
|
+
`:e.pending=n;continue;default:let r=n.charCodeAt(0);e.pending="",e.text+=ui(r)||r>=65&&r<=90||r>=97&&r<=122?o:n;continue}case`
|
|
35
|
+
`:switch(e.token){case 19:case 30:case 31:break;case 3:case 4:case 5:case 6:case 7:case 8:fe(e),sn(e,e.blockquote_idx),e.blockquote_idx=0,e.pending=n;continue;default:fe(e),e.pending=n,e.token=21,e.blockquote_idx=0;continue}break;case"<":if(e.token!==19&&e.token!==30&&e.token!==31){fe(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,fe(e),ve(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 r=12,a=14,s=e.pending[0];if(s==="_"&&(r=13,a=15),e.pending.length===1){if(s===n){e.pending=o;continue}if(n!==" "&&n!==`
|
|
37
|
-
`){
|
|
38
|
-
`){
|
|
39
|
-
`){me(e),ve(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(gm(n.charCodeAt(0)))break;me(e),ve(e,31),e.pending=n;continue}break;case"[":if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n!=="]"){me(e),ve(e,17),e.pending=n;continue}break;case"!":if(e.token!==19&&n==="["){me(e),ve(e,19),e.pending="";continue}break;case" ":if(e.pending.length===1&&n===" ")continue;break}if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n==="h"&&(e.pending===" "||e.pending==="")){e.text+=e.pending,e.pending=n,e.token=102;continue}e.text+=e.pending,e.pending=n}me(e)}function ci(e){return{add_token:vm,end_token:hm,add_text:bm,set_attr:ym,data:{nodes:[e,,,,,],index:0}}}function vm(e,t){let n=e.nodes[e.index],o;switch(t){case 1:return;case 20:o=document.createElement("blockquote");break;case 2:o=document.createElement("p");break;case 21:o=document.createElement("br");break;case 22:o=document.createElement("hr");break;case 3:o=document.createElement("h1");break;case 4:o=document.createElement("h2");break;case 5:o=document.createElement("h3");break;case 6:o=document.createElement("h4");break;case 7:o=document.createElement("h5");break;case 8:o=document.createElement("h6");break;case 12:case 13:o=document.createElement("em");break;case 14:case 15:o=document.createElement("strong");break;case 16:o=document.createElement("s");break;case 11:o=document.createElement("code");break;case 18:case 17:o=document.createElement("a");break;case 19:o=document.createElement("img");break;case 23:o=document.createElement("ul");break;case 24:o=document.createElement("ol");break;case 25:o=document.createElement("li");break;case 26:let r=o=document.createElement("input");r.type="checkbox",r.disabled=!0;break;case 9:case 10:n=n.appendChild(document.createElement("pre")),o=document.createElement("code");break;case 27:o=document.createElement("table");break;case 28:switch(n.children.length){case 0:n=n.appendChild(document.createElement("thead"));break;case 1:n=n.appendChild(document.createElement("tbody"));break;default:n=n.children[1]}o=document.createElement("tr");break;case 29:o=document.createElement(n.parentElement?.tagName==="THEAD"?"th":"td");break;case 30:o=document.createElement("equation-block");break;case 31:o=document.createElement("equation-inline");break}e.nodes[++e.index]=n.appendChild(o)}function hm(e){e.index-=1}function bm(e,t){e.nodes[e.index].appendChild(document.createTextNode(t))}function ym(e,t,n){e.nodes[e.index].setAttribute(um(t),n)}function Ir({textSig:e,doneSig:t}){let n=O(null);return ht(()=>{let o=n.current;if(!o)return;o.classList.add(`${R.cssPrefix}-md`),o.replaceChildren();let r=ci(o),a=li(r),s=0,l=At(()=>{let p=e.value,_=t.value;p.length<s&&(o.replaceChildren(),r=ci(o),a=li(r),s=0);let u=p.slice(s);u&&Ke(a,u),s=p.length,_&&qc(a)}),c=new MutationObserver(p=>{for(let _ of p)for(let u of _.addedNodes){if(!(u instanceof HTMLElement))continue;let f=u.matches?.("a")?[u]:[...u.querySelectorAll?.("a")??[]];for(let m of f)Vc(m)}});c.observe(o,{childList:!0,subtree:!0});for(let p of o.querySelectorAll("a"))Vc(p);let d=p=>{let _=p.target?.closest?.("a");if(!_||!(_ instanceof HTMLAnchorElement))return;let u=_.getAttribute("href")??"";!u||u.startsWith("#")||(p.preventDefault(),window.open(u,"_blank","noopener,noreferrer"))};return o.addEventListener("click",d),()=>{l(),c.disconnect(),o.removeEventListener("click",d)}},[e,t]),i("div",{ref:n})}function Wc({text:e}){let t=ie(()=>oe(e),[e]),n=ie(()=>oe(!0),[]);return i(Ir,{textSig:t,doneSig:n})}function Vc(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 Er=R.cssPrefix;function Kc({messageId:e,initial:t,strings:n,onFeedback:o}){let[r,a]=$(t);L(()=>a(t),[e,t]);let s=l=>{let c=r===l?null:l;a(c),o(e,c)};return i("div",{class:`${Er}-feedback`,role:"group","data-testid":T.messageFeedback,children:[i("button",{type:"button",class:`${Er}-msg-action`,"data-active":r==="up"?"true":void 0,"aria-pressed":r==="up","aria-label":n.feedbackUp,title:n.feedbackUp,onClick:()=>s("up"),"data-testid":T.feedbackUp,children:i(tc,{})}),i("button",{type:"button",class:`${Er}-msg-action`,"data-active":r==="down"?"true":void 0,"aria-pressed":r==="down","aria-label":n.feedbackDown,title:n.feedbackDown,onClick:()=>s("down"),"data-testid":T.feedbackDown,children:i(nc,{})}),i("span",{class:`${Er}-sr-only`,role:"status","aria-live":"polite",children:r?n.feedbackThanks:""})]})}var En=R.cssPrefix;function Gc({part:e,strings:t}){let n=e.title||e.filename||e.url||t.sources;return e.url?i("a",{class:`${En}-source`,href:e.url,target:"_blank",rel:"noreferrer noopener","data-testid":T.source,children:[i("span",{class:`${En}-source-icon`,"aria-hidden":"true",children:"\u{1F517}"}),i("span",{class:`${En}-source-label`,children:n})]}):i("span",{class:`${En}-source`,"data-testid":T.source,children:[i("span",{class:`${En}-source-icon`,"aria-hidden":"true",children:"\u{1F4C4}"}),i("span",{class:`${En}-source-label`,children:n})]})}var lt=R.cssPrefix;function jc({part:e,strings:t,active:n,superseded:o=!1,continuationStreaming:r=!1,onDecision:a,onEdit:s}){let l=ie(()=>fe(()=>e.approvalSig.value),[e]),c=ie(()=>fe(()=>$c(e,{active:n,superseded:o,continuationStreaming:r})),[e,n,o,r]).value,{terminal:d,showApproveReject:p,showAnswered:_,showSubmitted:u,showEdit:f,skipped:m}=c,h=ei(e.toolName),P=c.answeredApproved,k=e.toolCallId,S=i(de,{children:[i("p",{class:`${lt}-toolui-prompt`,children:t.approvalPrompt.replace("{tool}",h)}),i("p",{class:`${lt}-toolui-subtle`,children:t.approvalBody})]});u?S=i("p",{class:`${lt}-toolui-subtle`,children:t.approvalSubmitting}):_&&P!==!1?S=i(de,{children:[i("p",{class:`${lt}-toolui-prompt`,children:[t.approvalYourResponse.replace("{decision}",P?t.approve:t.reject),l.value?.reason?` \u2014 ${l.value.reason}`:""]}),f?i("p",{class:`${lt}-toolui-subtle`,children:t.approvalEditHint}):null,f?null:i("p",{class:`${lt}-toolui-subtle`,children:t.approvalSubmitting})]}):_&&(S=i(de,{}));let b=p||u||f||_&&P!==!1;return i("div",{class:`${lt}-toolui-group`,"data-testid":c.decided?T.toolDecision:T.toolApproval,children:[i(Cr,{part:e,strings:t,superseded:m,submitted:u}),m||d||!b?null:i("div",{class:`${lt}-toolui ${lt}-toolui-body`,children:[S,p?i("div",{class:`${lt}-toolui-actions`,children:[i("button",{type:"button",class:`${lt}-form-skip`,disabled:!n,onClick:()=>a(k,!1),"data-testid":T.toolReject,children:t.reject}),i("button",{type:"button",class:`${lt}-form-submit`,disabled:!n,onClick:()=>a(k,!0),"data-testid":T.toolApprove,children:t.approve})]}):null,f?i("div",{class:`${lt}-toolui-actions`,children:i("button",{type:"button",class:`${lt}-form-skip`,onClick:()=>s(k),"data-testid":T.toolEdit,children:t.edit})}):null]})]})}var xm=new Set(["text","email","phone","number","date","single-select","multi-select","boolean"]);function Xc(e){let t=e&&typeof e=="object"?e:{},o=(Array.isArray(t.questions)?t.questions:[]).map(Sm).filter(r=>r!==null);return{intro:Ar(t.intro),questions:o}}function Sm(e,t){if(!e||typeof e!="object")return null;let n=e,o=xm.has(n.type)?n.type:"text";return{key:Ar(n.key)??`q${t+1}`,question:Ar(n.question)??"Please provide the missing information.",type:o,options:Array.isArray(n.options)?n.options.filter(r=>typeof r=="string"&&r.trim().length>0):void 0,required:typeof n.required=="boolean"?n.required:void 0,helpText:Ar(n.helpText)}}function km(e){switch(e){case"text":return"textarea";case"phone":return"tel";case"single-select":case"boolean":return"radio";case"multi-select":return"multiselect";default:return e}}function di(e,t,n){return e.questions.map(o=>{let r=km(o.type),a=o.type==="boolean"?[{value:"yes",label:t},{value:"no",label:n}]:(o.options??[]).map(s=>({value:s,label:s}));return{name:o.key,label:o.question,type:r,required:o.required??!1,options:a.length>0?a:void 0,validationHint:o.helpText}})}function Ar(e){return typeof e=="string"&&e.trim()?e.trim():void 0}var $e=R.cssPrefix,wm={text:"qtypeText",email:"qtypeEmail",phone:"qtypePhone",number:"qtypeNumber",date:"qtypeDate","single-select":"qtypeChooseOne","multi-select":"qtypeChooseAny",boolean:"qtypeBoolean"};function Yc(e,t){let n={};for(let o of e)n[o.key]=t[wm[o.type]];return n}function Jc({part:e,strings:t,active:n,superseded:o=!1,continuationStreaming:r=!1,onDecision:a,onEdit:s}){let l=ie(()=>fe(()=>e.stateSig.value),[e]).value,c=ie(()=>fe(()=>e.approvalSig.value),[e]).value,d=ie(()=>fe(()=>Xc(e.inputSig.value)),[e]).value,{terminal:p,decided:_}=wr(l,c),u=_&&c?.approved===!0,f=r&&!_,m=!_&&!o&&!f,h=!m&&!u&&!f,P=u&&n&&!p,k=d.questions,[S,b]=$(null),y=S??(m||u||f),[w,D]=$(!1),q=k.length>1?za:oo,B=m?t.inputRequired:t.inputBadge,M=f?i("p",{class:`${$e}-toolui-subtle`,children:t.approvalSubmitting}):m?i(Cm,{req:d,strings:t,active:n,resolve:(V,ee)=>a(e.toolCallId,ee,V)}):w?i(io,{fields:di(d,t.confirmYes,t.confirmNo),strings:t,submitLabel:t.inputSubmit,onSubmit:()=>{},disabled:!0,hideActions:!0,fieldTypeLabels:Yc(k,t),initialValues:u?Am(k,c?.reason):void 0}):i(Rm,{questions:k,answers:u?Em(c?.reason):{},strings:t}),F="completed",H=t.inputAnswered;return h?(F="superseded",H=t.inputSkipped):f&&(F="responded",H=t.statusResponded),i("details",{class:`${$e}-toolui ${$e}-toolui-collapsible${o?` ${$e}-toolui-stale`:""}`,open:y,onToggle:V=>{let ee=V.currentTarget.open;ee!==y&&b(ee)},"data-testid":m?T.toolAskQuestions:T.toolDecision,children:[i("summary",{class:`${$e}-toolui-head`,children:[i("span",{class:`${$e}-toolui-q-pill`,children:[i(q,{}),B]}),i("span",{class:`${$e}-toolui-head-end`,children:[m?null:i(ti,{status:F,icon:h?i(_r,{}):i(ur,{}),label:H}),i("span",{class:`${$e}-toolui-chevron`,children:i(tn,{})})]})]}),i("div",{class:`${$e}-toolui-collapse-body`,children:[d.intro?i("div",{class:`${$e}-toolui-desc`,children:d.intro}):null,M,m||f?null:i("div",{class:`${$e}-toolui-footer`,children:[i("button",{type:"button",class:`${$e}-toolui-options-toggle`,onClick:()=>D(V=>!V),"data-testid":T.toolAskOptions,children:[i("span",{class:`${$e}-toolui-options-chevron${w?` ${$e}-open`:""}`,children:i(tn,{})}),w?t.hideOptions:t.showOptions]}),P?i("button",{type:"button",class:`${$e}-form-skip`,onClick:()=>s(e.toolCallId),"data-testid":T.toolEdit,children:t.edit}):null]})]})]})}function Cm({req:e,strings:t,active:n,resolve:o}){let r=di(e,t.confirmYes,t.confirmNo),a=e.questions.length===1&&e.questions[0]?.type==="text";return i(io,{fields:r,strings:t,disabled:!n,submitLabel:t.inputSubmit,footerHint:a?t.inputSubmitHint:void 0,onSubmit:s=>o(Im(e.questions,s),!0),skipLabel:t.inputSkip,onSkip:()=>o(void 0,!1),submitOnEnter:a,fieldTypeLabels:Yc(e.questions,t),submitTestId:T.toolInputSubmit,skipTestId:T.toolInputSkip})}function Rm({questions:e,answers:t,strings:n}){return i("div",{class:`${$e}-toolui-summary`,"data-testid":T.toolAskSummary,children:e.map(o=>i("div",{class:`${$e}-field`,children:[i("span",{class:`${$e}-field-head`,children:i("span",{class:`${$e}-field-label`,children:[o.question,o.required?i("span",{class:`${$e}-field-req`,"aria-hidden":"true",children:" *"}):null]})}),i("p",{class:`${$e}-toolui-answer`,children:Tm(o,t[o.key],n)||"\u2014"})]},o.key))})}function Tm(e,t,n){return e.type!=="boolean"?t??"":t==="yes"?n.confirmYes:t==="no"?n.confirmNo:t??""}function Im(e,t){let n=e.flatMap(o=>{let r=t[o.key];if(r==null||r.trim()==="")return[];let a=o.type==="multi-select"?r.split(",").map(s=>s.trim()).filter(Boolean):r;return[{key:o.key,value:a}]});return JSON.stringify({answers:n})}function Qc(e){if(!e)return{};let n=(()=>{try{return JSON.parse(e)}catch{return}})()?.answers;if(!Array.isArray(n))return{};let o={};for(let r of n)if(r&&typeof r=="object"&&"key"in r){let{key:a,value:s}=r;if(typeof a!="string")continue;typeof s=="string"?o[a]=s:Array.isArray(s)&&(o[a]=s.filter(l=>typeof l=="string"))}return o}function Em(e){let t=Qc(e),n={};for(let[o,r]of Object.entries(t))n[o]=Array.isArray(r)?r.join(", "):r;return n}function Am(e,t){let n=Qc(t),o={};for(let r of e){let a=n[r.key];a!==void 0&&(r.type==="multi-select"?o[r.key]=Array.isArray(a)?a:[a]:o[r.key]=Array.isArray(a)?a[0]??"":a)}return o}function Zc({part:e,strings:t,live:n}){let o=ie(()=>fe(()=>e.inputSig.value),[e]),r=ie(()=>fe(()=>e.outputSig.value),[e]),a=ie(()=>fe(()=>e.errorSig.value),[e]);return ie(()=>fe(()=>!!Rr(o.value)||!!a.value||!!Rr(oi(r.value))),[o,r,a]).value?i(Cr,{part:e,strings:t,testid:T.toolCall,live:n}):null}var ze=R.cssPrefix,ed=Ic(Mm);function Mm({message:e,status:t,strings:n,responseMode:o,showReasoning:r,showToolCalls:a,showSources:s,interactive:l=!1,superseded:c=!1,tool:d,onRetry:p,enableMessageFeedback:_=!1,onFeedback:u}){let m=ie(()=>fe(()=>e.partsSig.value),[e]).value,h=ie(()=>fe(()=>Jt(e)),[e]),P=ie(()=>fe(()=>bl(e)),[e]),k=ie(()=>fe(()=>Oc(e)),[e]),S=ie(()=>fe(()=>r&&Nc(e)),[e,r]),b=t==="streaming",x=e.role==="assistant"&&b,y=Dc({streaming:x,responseMode:o,reasoningVisible:S.value,hasAnswerText:k.value,emptyReply:h.value,hidden:P.value}),{bufferedHold:w,working:D,showStreamDots:q}=y;if(y.hidden)return null;let B=Om(e.createdAt),M=e.role==="assistant"||e.role==="operator",F=_&&!!u&&!!e.serverMessageId&&M&&!b&&t!=="error"&&!h.value,H=b?"":m.filter(W=>W.kind==="text").map(W=>W.textSig.peek()).join(`
|
|
37
|
+
`){fe(e),ve(e,r),e.pending=n;continue}}else{if(s===n){fe(e),ve(e,a),ve(e,r),e.pending="";continue}if(n!==" "&&n!==`
|
|
38
|
+
`){fe(e),ve(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
|
+
`){fe(e),ve(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(Sm(n.charCodeAt(0)))break;fe(e),ve(e,31),e.pending=n;continue}break;case"[":if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n!=="]"){fe(e),ve(e,17),e.pending=n;continue}break;case"!":if(e.token!==19&&n==="["){fe(e),ve(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}fe(e)}function pi(e){return{add_token:km,end_token:wm,add_text:Cm,set_attr:Rm,data:{nodes:[e,,,,,],index:0}}}function km(e,t){let n=e.nodes[e.index],o;switch(t){case 1:return;case 20:o=document.createElement("blockquote");break;case 2:o=document.createElement("p");break;case 21:o=document.createElement("br");break;case 22:o=document.createElement("hr");break;case 3:o=document.createElement("h1");break;case 4:o=document.createElement("h2");break;case 5:o=document.createElement("h3");break;case 6:o=document.createElement("h4");break;case 7:o=document.createElement("h5");break;case 8:o=document.createElement("h6");break;case 12:case 13:o=document.createElement("em");break;case 14:case 15:o=document.createElement("strong");break;case 16:o=document.createElement("s");break;case 11:o=document.createElement("code");break;case 18:case 17:o=document.createElement("a");break;case 19:o=document.createElement("img");break;case 23:o=document.createElement("ul");break;case 24:o=document.createElement("ol");break;case 25:o=document.createElement("li");break;case 26:let r=o=document.createElement("input");r.type="checkbox",r.disabled=!0;break;case 9:case 10:n=n.appendChild(document.createElement("pre")),o=document.createElement("code");break;case 27:o=document.createElement("table");break;case 28:switch(n.children.length){case 0:n=n.appendChild(document.createElement("thead"));break;case 1:n=n.appendChild(document.createElement("tbody"));break;default:n=n.children[1]}o=document.createElement("tr");break;case 29:o=document.createElement(n.parentElement?.tagName==="THEAD"?"th":"td");break;case 30:o=document.createElement("equation-block");break;case 31:o=document.createElement("equation-inline");break}e.nodes[++e.index]=n.appendChild(o)}function wm(e){e.index-=1}function Cm(e,t){e.nodes[e.index].appendChild(document.createTextNode(t))}function Rm(e,t,n){e.nodes[e.index].setAttribute(hm(t),n)}function Lr({textSig:e,doneSig:t}){let n=N(null);return xt(()=>{let o=n.current;if(!o)return;o.classList.add(`${T.cssPrefix}-md`),o.replaceChildren();let r=pi(o),a=_i(r),s=0,l=Lt(()=>{let _=e.value,p=t.value;_.length<s&&(o.replaceChildren(),r=pi(o),a=_i(r),s=0);let u=_.slice(s);u&&et(a,u),s=_.length,p&&jc(a)}),c=new MutationObserver(_=>{for(let p of _)for(let u of p.addedNodes){if(!(u instanceof HTMLElement))continue;let m=u.matches?.("a")?[u]:[...u.querySelectorAll?.("a")??[]];for(let g of m)Qc(g)}});c.observe(o,{childList:!0,subtree:!0});for(let _ of o.querySelectorAll("a"))Qc(_);let d=_=>{let p=_.target?.closest?.("a");if(!p||!(p instanceof HTMLAnchorElement))return;let u=p.getAttribute("href")??"";!u||u.startsWith("#")||(_.preventDefault(),window.open(u,"_blank","noopener,noreferrer"))};return o.addEventListener("click",d),()=>{l(),c.disconnect(),o.removeEventListener("click",d)}},[e,t]),i("div",{ref:n})}function Xc({text:e}){let t=oe(()=>ne(e),[e]),n=oe(()=>ne(!0),[]);return i(Lr,{textSig:t,doneSig:n})}function Qc(e){let t=e.getAttribute("href")??"";if(!t||t.startsWith("#"))return;e.target!=="_blank"&&(e.target="_blank");let n=new Set((e.rel||"").split(/\s+/).filter(Boolean));n.add("noopener"),n.add("noreferrer"),e.rel=[...n].join(" ")}var Or=T.cssPrefix;function Yc({messageId:e,initial:t,strings:n,onFeedback:o}){let[r,a]=$(t);O(()=>a(t),[e,t]);let s=l=>{let c=r===l?null:l;a(c),o(e,c)};return i("div",{class:`${Or}-feedback`,role:"group","data-testid":R.messageFeedback,children:[i("button",{type:"button",class:`${Or}-msg-action`,"data-active":r==="up"?"true":void 0,"aria-pressed":r==="up","aria-label":n.feedbackUp,title:n.feedbackUp,onClick:()=>s("up"),"data-testid":R.feedbackUp,children:i(ic,{})}),i("button",{type:"button",class:`${Or}-msg-action`,"data-active":r==="down"?"true":void 0,"aria-pressed":r==="down","aria-label":n.feedbackDown,title:n.feedbackDown,onClick:()=>s("down"),"data-testid":R.feedbackDown,children:i(sc,{})}),i("span",{class:`${Or}-sr-only`,role:"status","aria-live":"polite",children:r?n.feedbackThanks:""})]})}var On=T.cssPrefix;function Jc({part:e,strings:t}){let n=e.title||e.filename||e.url||t.sources;return e.url?i("a",{class:`${On}-source`,href:e.url,target:"_blank",rel:"noreferrer noopener","data-testid":R.source,children:[i("span",{class:`${On}-source-icon`,"aria-hidden":"true",children:"\u{1F517}"}),i("span",{class:`${On}-source-label`,children:n})]}):i("span",{class:`${On}-source`,"data-testid":R.source,children:[i("span",{class:`${On}-source-icon`,"aria-hidden":"true",children:"\u{1F4C4}"}),i("span",{class:`${On}-source-label`,children:n})]})}var mt=T.cssPrefix;function Zc({part:e,strings:t,active:n,superseded:o=!1,continuationStreaming:r=!1,onDecision:a,onEdit:s}){let l=oe(()=>pe(()=>e.approvalSig.value),[e]),c=oe(()=>pe(()=>zc(e,{active:n,superseded:o,continuationStreaming:r})),[e,n,o,r]).value,{terminal:d,showApproveReject:_,showAnswered:p,showSubmitted:u,showEdit:m,skipped:g}=c,y=ri(e.toolName),S=c.answeredApproved,k=e.toolCallId,x=i(de,{children:[i("p",{class:`${mt}-toolui-prompt`,children:t.approvalPrompt.replace("{tool}",y)}),i("p",{class:`${mt}-toolui-subtle`,children:t.approvalBody})]});u?x=i("p",{class:`${mt}-toolui-subtle`,children:t.approvalSubmitting}):p&&S!==!1?x=i(de,{children:[i("p",{class:`${mt}-toolui-prompt`,children:[t.approvalYourResponse.replace("{decision}",S?t.approve:t.reject),l.value?.reason?` \u2014 ${l.value.reason}`:""]}),m?i("p",{class:`${mt}-toolui-subtle`,children:t.approvalEditHint}):null,m?null:i("p",{class:`${mt}-toolui-subtle`,children:t.approvalSubmitting})]}):p&&(x=i(de,{}));let h=_||u||m||p&&S!==!1;return i("div",{class:`${mt}-toolui-group`,"data-testid":c.decided?R.toolDecision:R.toolApproval,children:[i(Er,{part:e,strings:t,superseded:g,submitted:u}),g||d||!h?null:i("div",{class:`${mt}-toolui ${mt}-toolui-body`,children:[x,_?i("div",{class:`${mt}-toolui-actions`,children:[i("button",{type:"button",class:`${mt}-form-skip`,disabled:!n,onClick:()=>a(k,!1),"data-testid":R.toolReject,children:t.reject}),i("button",{type:"button",class:`${mt}-form-submit`,disabled:!n,onClick:()=>a(k,!0),"data-testid":R.toolApprove,children:t.approve})]}):null,m?i("div",{class:`${mt}-toolui-actions`,children:i("button",{type:"button",class:`${mt}-form-skip`,onClick:()=>s(k),"data-testid":R.toolEdit,children:t.edit})}):null]})]})}var Im=new Set(["text","email","phone","number","date","single-select","multi-select","boolean"]);function ed(e){let t=e&&typeof e=="object"?e:{},o=(Array.isArray(t.questions)?t.questions:[]).map(Em).filter(r=>r!==null);return{intro:Nr(t.intro),questions:o}}function Em(e,t){if(!e||typeof e!="object")return null;let n=e,o=Im.has(n.type)?n.type:"text";return{key:Nr(n.key)??`q${t+1}`,question:Nr(n.question)??"Please provide the missing information.",type:o,options:Array.isArray(n.options)?n.options.filter(r=>typeof r=="string"&&r.trim().length>0):void 0,required:typeof n.required=="boolean"?n.required:void 0,helpText:Nr(n.helpText)}}function Am(e){switch(e){case"text":return"textarea";case"phone":return"tel";case"single-select":case"boolean":return"radio";case"multi-select":return"multiselect";default:return e}}function fi(e,t,n){return e.questions.map(o=>{let r=Am(o.type),a=o.type==="boolean"?[{value:"yes",label:t},{value:"no",label:n}]:(o.options??[]).map(s=>({value:s,label:s}));return{name:o.key,label:o.question,type:r,required:o.required??!1,options:a.length>0?a:void 0,validationHint:o.helpText}})}function Nr(e){return typeof e=="string"&&e.trim()?e.trim():void 0}var ze=T.cssPrefix,Mm={text:"qtypeText",email:"qtypeEmail",phone:"qtypePhone",number:"qtypeNumber",date:"qtypeDate","single-select":"qtypeChooseOne","multi-select":"qtypeChooseAny",boolean:"qtypeBoolean"};function td(e,t){let n={};for(let o of e)n[o.key]=t[Mm[o.type]];return n}function nd({part:e,strings:t,active:n,superseded:o=!1,continuationStreaming:r=!1,onDecision:a,onEdit:s}){let l=oe(()=>pe(()=>e.stateSig.value),[e]).value,c=oe(()=>pe(()=>e.approvalSig.value),[e]).value,d=oe(()=>pe(()=>ed(e.inputSig.value)),[e]).value,{terminal:_,decided:p}=Ir(l,c),u=p&&c?.approved===!0,m=r&&!p,g=!p&&!o&&!m,y=!g&&!u&&!m,S=u&&n&&!_,k=d.questions,[x,h]=$(null),b=x??(g||u||m),[w,E]=$(!1),Q=k.length>1?Ka:so,z=g?t.inputRequired:t.inputBadge,A=m?i("p",{class:`${ze}-toolui-subtle`,children:t.approvalSubmitting}):g?i(Lm,{req:d,strings:t,active:n,resolve:(G,X)=>a(e.toolCallId,X,G)}):w?i(uo,{fields:fi(d,t.confirmYes,t.confirmNo),strings:t,submitLabel:t.inputSubmit,onSubmit:()=>{},disabled:!0,hideActions:!0,fieldTypeLabels:td(k,t),initialValues:u?Fm(k,c?.reason):void 0}):i(Om,{questions:k,answers:u?$m(c?.reason):{},strings:t}),D="completed",K=t.inputAnswered;return y?(D="superseded",K=t.inputSkipped):m&&(D="responded",K=t.statusResponded),i("details",{class:`${ze}-toolui ${ze}-toolui-collapsible${o?` ${ze}-toolui-stale`:""}`,open:b,onToggle:G=>{let X=G.currentTarget.open;X!==b&&h(X)},"data-testid":g?R.toolAskQuestions:R.toolDecision,children:[i("summary",{class:`${ze}-toolui-head`,children:[i("span",{class:`${ze}-toolui-q-pill`,children:[i(Q,{}),z]}),i("span",{class:`${ze}-toolui-head-end`,children:[g?null:i(ai,{status:D,icon:y?i(vr,{}):i(gr,{}),label:K}),i("span",{class:`${ze}-toolui-chevron`,children:i(rn,{})})]})]}),i("div",{class:`${ze}-toolui-collapse-body`,children:[d.intro?i("div",{class:`${ze}-toolui-desc`,children:d.intro}):null,A,g||m?null:i("div",{class:`${ze}-toolui-footer`,children:[i("button",{type:"button",class:`${ze}-toolui-options-toggle`,onClick:()=>E(G=>!G),"data-testid":R.toolAskOptions,children:[i("span",{class:`${ze}-toolui-options-chevron${w?` ${ze}-open`:""}`,children:i(rn,{})}),w?t.hideOptions:t.showOptions]}),S?i("button",{type:"button",class:`${ze}-form-skip`,onClick:()=>s(e.toolCallId),"data-testid":R.toolEdit,children:t.edit}):null]})]})]})}function Lm({req:e,strings:t,active:n,resolve:o}){let r=fi(e,t.confirmYes,t.confirmNo),a=e.questions.length===1&&e.questions[0]?.type==="text";return i(uo,{fields:r,strings:t,disabled:!n,submitLabel:t.inputSubmit,footerHint:a?t.inputSubmitHint:void 0,onSubmit:s=>o(Dm(e.questions,s),!0),skipLabel:t.inputSkip,onSkip:()=>o(void 0,!1),submitOnEnter:a,fieldTypeLabels:td(e.questions,t),submitTestId:R.toolInputSubmit,skipTestId:R.toolInputSkip})}function Om({questions:e,answers:t,strings:n}){return i("div",{class:`${ze}-toolui-summary`,"data-testid":R.toolAskSummary,children:e.map(o=>i("div",{class:`${ze}-field`,children:[i("span",{class:`${ze}-field-head`,children:i("span",{class:`${ze}-field-label`,children:[o.question,o.required?i("span",{class:`${ze}-field-req`,"aria-hidden":"true",children:" *"}):null]})}),i("p",{class:`${ze}-toolui-answer`,children:Nm(o,t[o.key],n)||"\u2014"})]},o.key))})}function Nm(e,t,n){return e.type!=="boolean"?t??"":t==="yes"?n.confirmYes:t==="no"?n.confirmNo:t??""}function Dm(e,t){let n=e.flatMap(o=>{let r=t[o.key];if(r==null||r.trim()==="")return[];let a=o.type==="multi-select"?r.split(",").map(s=>s.trim()).filter(Boolean):r;return[{key:o.key,value:a}]});return JSON.stringify({answers:n})}function od(e){if(!e)return{};let n=(()=>{try{return JSON.parse(e)}catch{return}})()?.answers;if(!Array.isArray(n))return{};let o={};for(let r of n)if(r&&typeof r=="object"&&"key"in r){let{key:a,value:s}=r;if(typeof a!="string")continue;typeof s=="string"?o[a]=s:Array.isArray(s)&&(o[a]=s.filter(l=>typeof l=="string"))}return o}function $m(e){let t=od(e),n={};for(let[o,r]of Object.entries(t))n[o]=Array.isArray(r)?r.join(", "):r;return n}function Fm(e,t){let n=od(t),o={};for(let r of e){let a=n[r.key];a!==void 0&&(r.type==="multi-select"?o[r.key]=Array.isArray(a)?a:[a]:o[r.key]=Array.isArray(a)?a[0]??"":a)}return o}function rd({part:e,strings:t,live:n}){let o=oe(()=>pe(()=>e.inputSig.value),[e]),r=oe(()=>pe(()=>e.outputSig.value),[e]),a=oe(()=>pe(()=>e.errorSig.value),[e]);return oe(()=>pe(()=>!!Ar(o.value)||!!a.value||!!Ar(si(r.value))),[o,r,a]).value?i(Er,{part:e,strings:t,testid:R.toolCall,live:n}):null}var Ye=T.cssPrefix,ad=Oc(Bm);function Bm({message:e,status:t,strings:n,responseMode:o,showReasoning:r,showToolCalls:a,showSources:s,interactive:l=!1,superseded:c=!1,tool:d,onRetry:_,enableMessageFeedback:p=!1,onFeedback:u}){let g=oe(()=>pe(()=>e.partsSig.value),[e]).value,y=oe(()=>pe(()=>tn(e)),[e]),S=oe(()=>pe(()=>kl(e)),[e]),k=oe(()=>pe(()=>Bc(e)),[e]),x=oe(()=>pe(()=>r&&Hc(e)),[e,r]),h=t==="streaming",P=e.role==="assistant"&&h,b=Uc({streaming:P,responseMode:o,reasoningVisible:x.value,hasAnswerText:k.value,emptyReply:y.value,hidden:S.value}),{bufferedHold:w,working:E,showStreamDots:Q}=b;if(b.hidden)return null;let z=Um(e.createdAt),A=e.role==="assistant"||e.role==="operator",D=p&&!!u&&!!e.serverMessageId&&A&&!h&&t!=="error"&&!y.value,K=h?"":g.filter(U=>U.kind==="text").map(U=>U.textSig.peek()).join(`
|
|
40
40
|
|
|
41
|
-
`).trim(),V=!b&&t!=="error"&&!h.value&&H.length>0,ee=F||V;return i("div",{class:`${ze}-bubble-row`,"data-role":e.role,"data-testid":Ue(T.messageBubble,e.serverMessageId??e.id),children:i("div",{class:`${ze}-bubble-col`,children:[i("div",{class:`${ze}-bubble`,children:[e.role==="operator"&&e.operatorInitials?i("span",{class:`${ze}-bubble-author`,children:e.operatorInitials}):null,i("div",{class:`${ze}-bubble-body`,children:[w?i(Hm,{label:n.loading}):m.map((W,se)=>i(Nm,{part:W,active:D,live:x,strings:n,showReasoning:r,showToolCalls:a,showSources:s,interactive:l&&t==="complete"&&(W.kind!=="tool"||rr(e,se)),superseded:c,continuationStreaming:e.continuationStreaming===!0,tool:d},`${Fm(W)}#${se}`)),q&&i(Bm,{}),t==="error"||h.value?i("div",{class:`${ze}-error`,role:"alert",children:[i("span",{children:e.errorText??n.errorGeneric}),p?i("button",{type:"button",class:`${ze}-error-retry`,onClick:()=>p(e),"data-testid":T.messageRetry,children:n.errorRetry}):null]}):null]})]}),B||ee?i("div",{class:`${ze}-bubble-meta`,children:[B?i("time",{class:`${ze}-bubble-time`,dateTime:B.iso,title:B.full,children:B.short}):null,ee?i("div",{class:`${ze}-bubble-actions`,children:[F&&e.serverMessageId?i(Kc,{messageId:e.serverMessageId,initial:e.feedback??null,strings:n,onFeedback:u}):null,V?i(Lm,{text:H,strings:n}):null]}):null]}):null]})})}function Lm({text:e,strings:t}){let[n,o]=$(!1),r=()=>{navigator.clipboard?.writeText(e).then(()=>{o(!0),setTimeout(()=>o(!1),1500)}).catch(()=>{})},a=n?t.copied:t.copy;return i("button",{type:"button",class:`${ze}-msg-action`,"data-active":n?"true":void 0,"aria-label":a,title:a,onClick:r,"data-testid":T.messageCopy,children:n?i(en,{}):i(ec,{})})}function Om(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 Nm({part:e,active:t,live:n,strings:o,showReasoning:r,showToolCalls:a,showSources:s,interactive:l,superseded:c,continuationStreaming:d,tool:p}){switch(e.kind){case"step-start":return null;case"text":return i(Ir,{textSig:e.textSig,doneSig:e.doneSig});case"reasoning":return r?i($m,{part:e,active:t,strings:o}):null;case"tool":return i(Dm,{part:e,strings:o,showToolCalls:a,interactive:l,superseded:c,continuationStreaming:d,live:n,tool:p});case"file":return e.mediaType.startsWith("image/")?i("img",{src:e.url,alt:"",loading:"lazy"}):i("a",{href:e.url,target:"_blank",rel:"noreferrer noopener",children:e.url});case"source":return s?i(Gc,{part:e,strings:o}):null}}function Dm({part:e,strings:t,showToolCalls:n,interactive:o,superseded:r,continuationStreaming:a,live:s,tool:l}){let c=ie(()=>fe(()=>e.approvalSig.value!==void 0),[e]);return l?.humanInLoop&&c.value?kr(e.toolName)?i(Jc,{part:e,strings:t,active:o,superseded:r,continuationStreaming:a,onDecision:l.onDecision,onEdit:l.onEdit}):i(jc,{part:e,strings:t,active:o,superseded:r,continuationStreaming:a,onDecision:l.onDecision,onEdit:l.onEdit}):n?i(Zc,{part:e,strings:t,live:s}):null}function $m({part:e,active:t,strings:n}){return i("details",{class:`${ze}-reasoning`,"data-testid":T.reasoning,open:t,"data-active":t?"true":void 0,children:[i("summary",{class:`${ze}-reasoning-summary`,children:i("span",{class:`${ze}-reasoning-label`,children:t?n.thinking:n.thoughts})}),i("div",{class:`${ze}-reasoning-body`,children:i(Ir,{textSig:e.textSig,doneSig:e.doneSig})})]})}function Fm(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 Bm(){return i("span",{class:`${ze}-typing`,"data-testid":T.typingDots,"aria-hidden":"true",children:[i("span",{}),i("span",{}),i("span",{})]})}function Hm({label:e}){return i("span",{class:`${ze}-loading`,role:"status",children:[i("span",{class:`${ze}-loading-spinner`,"aria-hidden":"true"}),i("span",{class:`${ze}-loading-label`,children:e})]})}var zt=R.cssPrefix,ui=120,Um=350;function td({messagesSig:e,strings:t,responseMode:n,showReasoning:o,showToolCalls:r,showSources:a,enableMessageFeedback:s,onFeedback:l,loading:c,onLoadPreviousMessages:d,idle:p,controlMode:_="ai-agent",tool:u,onRetry:f,form:m,formMarkers:h,onFillForm:P}){let k=O(null),S=ut(()=>e.value),[b,x]=$(!1),[y,w]=$(!1),D=O(!1),q=O(!1),[B,M]=$(),F=O(!1),H=O(!1),V=O(!1),ee=O(0),W=()=>V.current||performance.now()-ee.current<Um,se=O(0),ae=g=>{let E=g.scrollHeight-g.clientHeight>1;g.dataset.fadeTop=E&&g.scrollTop>1?"true":"false",g.dataset.fadeBottom=E&&g.scrollHeight-g.scrollTop-g.clientHeight>1?"true":"false"},xe=g=>x(g.scrollHeight-g.scrollTop-g.clientHeight>ui*2),ue=g=>{se.current=performance.now(),g.scrollTop=g.scrollHeight,ae(g)},ye=(g,E)=>{ue(g);let Q=E,j=0,Z=()=>{H.current||W()||(ue(g),--Q>0&&(j=requestAnimationFrame(Z)))};return E>0&&(j=requestAnimationFrame(Z)),()=>cancelAnimationFrame(j)},pe=(g,E)=>{let Q,j,Z,Se=-1,ge=()=>{Q.disconnect(),j.disconnect(),clearTimeout(Z)},ke=()=>{if(H.current||W()||Se>=0&&g.scrollTop<Se-4)return ge();ue(g),Se=g.scrollTop};return Q=new ResizeObserver(ke),j=new MutationObserver(ke),ke(),Q.observe(g),j.observe(g,{childList:!0,subtree:!0,characterData:!0}),Z=setTimeout(ge,E),ge},Ze=S.value[0]?.id;ht(()=>{let g=k.current;if(g&&S.value.length!==0&&!q.current&&(F.current=!0,!!S.value.some(E=>E.role==="user")))return pe(g,300)},[Ze]);let ot=O(0);L(()=>{let g=k.current,E=S.value,Q=ot.current;if(ot.current=E.length,!g||!F.current||q.current)return;if(E.slice(Q).some(Z=>Z.role==="user"))return H.current=!1,ye(g,3);if(!E.some(Z=>Z.role==="user")||H.current||W())return;g.scrollHeight-g.scrollTop-g.clientHeight<ui&&ue(g)},[S.value.length]);let ct=O(null);L(()=>{let g=k.current,E=S.value.at(-1),Q=ct.current;if(ct.current=E?{id:E.id,streaming:E.status==="streaming"}:null,!!g&&F.current&&!(!E||E.id!==Q?.id||Q.streaming||E.status!=="streaming"))return H.current=!1,ye(g,3)},[S.value]),L(()=>{let g=k.current;if(!g)return;let E=S.value.at(-1);if(!E||E.status!=="streaming"&&!S.value.some(Z=>Z.role==="user"))return;let Q=()=>{if(H.current||W())return;g.scrollHeight-g.scrollTop-g.clientHeight<ui*2&&ue(g)};if(E.status!=="streaming")return pe(g,300);Q();let j=new MutationObserver(Q);return j.observe(g,{childList:!0,subtree:!0,characterData:!0}),()=>j.disconnect()},[S.value]);let Ge=m?.form.id,je=!!m&&(h??[]).some(g=>g.formId===m.form.id);ht(()=>{let g=k.current;!g||!Ge||H.current||S.value.some(E=>E.role==="user")&&(je?g.querySelector(`[data-testid="${T.formGate}"]`)?.scrollIntoView({block:"nearest"}):ue(g))},[Ge,je]),L(()=>{let g=k.current;if(!g)return;let E=()=>{xe(g),ae(g),performance.now()-se.current>150&&(H.current=g.scrollHeight-g.scrollTop-g.clientHeight>8)},Q=()=>{H.current=!0},j=We=>{We.deltaY<0&&Q()},Z=0,Se=We=>{Z=We.touches[0]?.clientY??0,V.current=!0},ge=We=>{(We.touches[0]?.clientY??0)>Z+4&&Q()},ke=()=>{V.current=!1,ee.current=performance.now()},be=()=>{V.current=!0};return g.addEventListener("scroll",E,{passive:!0}),g.addEventListener("wheel",j,{passive:!0}),g.addEventListener("touchstart",Se,{passive:!0}),g.addEventListener("touchmove",ge,{passive:!0}),g.addEventListener("touchend",ke,{passive:!0}),g.addEventListener("touchcancel",ke,{passive:!0}),g.addEventListener("pointerdown",be,{passive:!0}),window.addEventListener("pointerup",ke,{passive:!0}),window.addEventListener("pointercancel",ke,{passive:!0}),xe(g),()=>{g.removeEventListener("scroll",E),g.removeEventListener("wheel",j),g.removeEventListener("touchstart",Se),g.removeEventListener("touchmove",ge),g.removeEventListener("touchend",ke),g.removeEventListener("touchcancel",ke),g.removeEventListener("pointerdown",be),window.removeEventListener("pointerup",ke),window.removeEventListener("pointercancel",ke)}},[]);let Ye=()=>{let g=k.current;g&&(H.current=!1,ue(g))},Je=S.value.filter(g=>!g.ephemeral),_t=Je[0],Pe=_t?.serverMessageId??_t?.id,Fe=!!(d&&Je.length>=Oa&&Pe!==B),Ve=async()=>{if(!d||D.current)return;let g=k.current,E=g?.scrollHeight??0,Q=g?.scrollTop??0;D.current=!0,q.current=!0,w(!0);try{let j=await d();j===!1&&Pe&&M(Pe),j&&g&&(await new Promise(Z=>requestAnimationFrame(()=>requestAnimationFrame(()=>Z()))),g.scrollTop=Q+g.scrollHeight-E,ae(g),xe(g))}finally{q.current=!1,D.current=!1,w(!1)}},et=[],pt="",z=S.value.at(-1)?.id,G=[...h??[]].toSorted((g,E)=>(g.createdAt??1/0)-(E.createdAt??1/0)),J=g=>m&&g.formId===m.form.id?i(Ya,{form:m.form,strings:t,onSubmit:m.onSubmit,onSkip:m.onSkip},`gate:${g.formId}`):i(yc,{marker:g,strings:t,onFill:!m&&P?()=>P(g.formId):void 0},g.key),C=g=>{for(let E=G[0];E?.createdAt!==void 0&&!(g!==void 0&&E.createdAt>g);E=G[0])G.shift(),et.push(J(E))};for(let g of S.value){if(g.role==="assistant"&&g.id!==z&&Jt(g))continue;C(g.createdAt);let E=zm(g.createdAt);E&&E!==pt&&(et.push(i("div",{class:`${zt}-date-divider`,children:i("span",{class:`${zt}-date-pill`,title:qm(g.createdAt),children:Vm(g.createdAt,t)})},`day:${E}`)),pt=E);let j=g.retryAction!==void 0||g.role==="assistant"&&g.id===z?sr(S.value,g):void 0,Z=j!==void 0&&(j.kind!=="continue-assistant"||_==="ai-agent");et.push(i(ed,{message:g,status:g.status,strings:t,responseMode:n,showReasoning:o,showToolCalls:r,showSources:a,interactive:!!p&&_==="ai-agent"&&g.id===z,superseded:g.id!==z,tool:u,onRetry:p&&Z&&(g.role==="user"||g.id===z)?f:void 0,enableMessageFeedback:s,onFeedback:l},g.id))}for(let g of G)et.push(J(g));return i("div",{class:`${zt}-list-wrap`,children:[i("div",{ref:k,class:`${zt}-list ${zt}-list--fade`,role:"log","aria-live":"polite","aria-relevant":"additions text",children:[c&&S.value.length===0?i("div",{class:`${zt}-list-loading`,role:"status",children:t.conversationLoading}):null,Fe?i("div",{class:`${zt}-load-previous`,children:i("button",{type:"button",onClick:Ve,disabled:y,"aria-busy":y,"data-testid":T.loadPreviousMessages,children:t.loadPreviousMessages})}):null,et,m&&!je?i(Ya,{form:m.form,strings:t,onSubmit:m.onSubmit,onSkip:m.onSkip}):null]}),b?i("button",{type:"button",class:`${zt}-jump`,onClick:Ye,"aria-label":t.scrollToBottom,title:t.scrollToBottom,"data-testid":T.scrollToBottom,children:i(tn,{})}):null]})}function zm(e){if(typeof e!="number"||!Number.isFinite(e))return"";let t=new Date(e);return`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`}function qm(e){if(typeof e!="number"||!Number.isFinite(e))return"";try{return new Date(e).toLocaleDateString(void 0,{dateStyle:"full"})}catch{return""}}function Vm(e,t){let n=new Date(e),o=a=>new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime(),r=Math.round((o(new Date)-o(n))/864e5);return r<=0?t.dateToday:r===1?t.dateYesterday:r<7?n.toLocaleDateString(void 0,{weekday:"long"}):n.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"})}var Wm=["today","yesterday","lastWeek","older"];function Km(e,t){let n=Date.parse(t);if(!Number.isFinite(n))return"older";let o=Math.floor((nd(e)-nd(n))/(1440*60*1e3));return o<=0?"today":o===1?"yesterday":o<7?"lastWeek":"older"}function od(e,t){let n=new Map;for(let o of t){let r=Km(e,o.lastMessageAt),a=n.get(r);a?a.push(o):n.set(r,[o])}return Wm.filter(o=>n.has(o)).map(o=>({bucket:o,conversations:n.get(o)}))}function nd(e){let t=new Date(e);return t.setUTCHours(0,0,0,0),t.getTime()}var rd=ne.scope("history"),Gm=3,jm=6,Xm={today:"dateToday",yesterday:"dateYesterday",lastWeek:"dateLastWeek",older:"dateOlder"};function ad(e,t){let n=t.type!=="upsert"||t.activity===!0;if(t.type==="snapshot"&&t.result.pagination.page===1&&e.pagination.page>1){let r=Mt(e.conversations.slice(0,t.result.pagination.limit),t,n);if(t.result.conversations.length===0){if(r.length===0)return t.result;let d=Math.max(t.result.pagination.total,r.length);return{...t.result,conversations:r,pagination:{...t.result.pagination,total:d,totalPages:Math.ceil(d/t.result.pagination.limit)}}}let a=new Set(r.map(d=>d.conversationId)),s=e.conversations.slice(t.result.pagination.limit).filter(d=>!a.has(d.conversationId)),l=e.pagination.page,c={...t.result.pagination,page:l,hasPrev:l>1,hasNext:l<t.result.pagination.totalPages};return{conversations:[...r,...s],pagination:c}}let o=Mt(e.conversations,t,n);return o===e.conversations?e:{...t.type==="snapshot"?t.result:e,conversations:o}}function Ym(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 Mr({transport:e,strings:t,locale:n,persistence:o,onSelect:r,onNewConversation:a}){let s=R.cssPrefix,l=e.peekConversations({limit:50}),[c,d]=$(l?"loaded":"loading"),[p,_]=$(l),[u,f]=$(!1),m=O(),h=p?.conversations??[],P=p?.pagination;L(()=>{let y=!1,w=!0,D=[],q=e.subscribeConversationChanges(M=>{w&&D.push(M),_(F=>F&&ad(F,M))});m.current=void 0,f(!1);let B=e.peekConversations({limit:50});return _(B),d(B?"loaded":"loading"),e.listConversations({limit:50}).then(M=>{if(y)return;let F=M;for(let H of D)F=ad(F,H);D=[],w=!1,_(F),d("loaded"),o.saveHistoryCount(F.conversations.length)}).catch(M=>{y||(D=[],w=!1,rd.warn("listConversations failed",{err:M}),d("error"))}),()=>{y=!0,q(),m.current=void 0}},[e,o,n]);let k=async()=>{if(m.current||!P?.hasNext)return;let y={};m.current=y,f(!0);try{let w=await e.listConversations({page:P.page+1,limit:P.limit});if(m.current!==y)return;_(D=>{if(!D)return D;let q=new Set(D.conversations.map(F=>F.conversationId)),B=w.conversations.filter(F=>q.has(F.conversationId)?!1:(q.add(F.conversationId),!0)),M={conversations:[...D.conversations,...B],pagination:w.pagination};return o.saveHistoryCount(M.conversations.length),M})}catch(w){if(m.current!==y)return;rd.warn("listConversations page failed",{err:w,page:P.page+1})}finally{m.current===y&&(m.current=void 0,f(!1))}},S=a?i("div",{class:`${s}-history-footer`,children:i("button",{type:"button",class:`${s}-history-new`,onClick:a,"data-testid":T.sidebarNewConversation,children:[i(Cl,{}),t.newConversation]})}):null;if(c==="loading"){let y=Math.min(o.loadHistoryCount()??Gm,jm);return i(de,{children:[i("div",{class:`${s}-history`,"aria-busy":"true","aria-label":t.historyLoading,children:i("div",{class:`${s}-history-group`,"aria-hidden":"true",children:[i("div",{class:`${s}-history-heading`,children:i("span",{class:`${s}-skeleton ${s}-skeleton-heading`})}),i("div",{class:`${s}-history-card`,children:Array.from({length:Math.max(1,y)},(w,D)=>i("div",{class:`${s}-history-item ${s}-history-item-skeleton`,children:[i("span",{class:`${s}-history-avatar ${s}-skeleton`}),i("span",{class:`${s}-history-body`,children:[i("span",{class:`${s}-history-row`,children:[i("span",{class:`${s}-history-title`,children:i("span",{class:`${s}-skeleton ${s}-skeleton-title`})}),i("span",{class:`${s}-history-time`,children:i("span",{class:`${s}-skeleton ${s}-skeleton-time`})})]}),i("span",{class:`${s}-history-row`,children:i("span",{class:`${s}-history-preview`,children:i("span",{class:`${s}-skeleton ${s}-skeleton-preview`})})})]})]},D))})]})}),S]})}if(c==="error"||h.length===0)return i(de,{children:[i("div",{class:`${s}-history-empty`,children:t.historyEmpty}),S]});let b=Date.now(),x=od(b,h);return i(de,{children:[i("div",{class:`${s}-history`,role:"list",children:[x.map(y=>i("div",{class:`${s}-history-group`,children:[i("div",{class:`${s}-history-heading`,children:t[Xm[y.bucket]]}),i("div",{class:`${s}-history-card`,children:y.conversations.map(w=>i("button",{type:"button",role:"listitem",class:`${s}-history-item`,onClick:()=>r(w),"data-closed":w.canContinue?void 0:"true","data-unread":w.hasUnread?"true":void 0,"data-testid":Ue(T.historyItem,w.conversationId),children:[i("span",{class:`${s}-history-avatar`,"aria-hidden":"true",children:i(qa,{})}),i("span",{class:`${s}-history-body`,children:[i("span",{class:`${s}-history-row`,children:[i("span",{class:`${s}-history-title`,children:w.title}),i("span",{class:`${s}-history-time`,children:Ym(w.lastMessageAt,b,n)})]}),i("span",{class:`${s}-history-row`,children:[i("span",{class:`${s}-history-preview`,children:w.preview??(w.canContinue?t.historyContinue:t.conversationClosed)}),w.hasUnread?i("span",{class:`${s}-history-dot`}):null]})]})]},w.conversationId))})]},y.bucket)),P?.hasNext?i("div",{class:`${s}-history-more`,children:i("button",{type:"button",onClick:k,disabled:u,"aria-busy":u,"data-testid":T.historyLoadMore,children:t.loadMoreConversations})}):null]}),S]})}var id=R.cssPrefix;function sd({suggestions:e,onPick:t,disabled:n=!1}){return e.length===0?null:i("div",{class:`${id}-suggestions`,role:"group","aria-label":"Suggested replies",children:e.map((o,r)=>i("button",{type:"button",class:`${id}-suggestion`,onClick:()=>t(o),disabled:n,"data-testid":Ue(T.suggestion,r),children:o.label},o.id))})}var qe=R.cssPrefix;function ld(e){let{options:t,onClose:n}=e,o=t.strings,r=O(null);L(()=>{let d=r.current;if(!d)return;let p=vr(d),_=u=>{u.key==="Escape"&&n?.()};return d.addEventListener("keydown",_),()=>{p(),d.removeEventListener("keydown",_)}},[n]);let a=e.composerApiRef,s=e.composerActive&&e.view==="chat"&&e.canSend&&!e.activeForm&&!e.sendPreparing&&e.options.features.fileUpload,l=N(d=>{s&&a.current?.attachFromDrop(d)},[a,s]),{visible:c}=Pr({containerRef:r,onDrop:l,disabled:!s});return mr(r.current,t.mode==="modal"),i("div",{ref:r,class:`${qe}-panel`,role:"dialog","aria-modal":"false","aria-label":o.panelTitle,style:{position:"relative"},"data-testid":T.panel,children:[i(_i,{...e,containerEl:r.current,dragOver:c,composerAttachApiRef:a}),i(pi,{poweredBy:e.options.poweredBy})]})}function _i(e){let{options:t,transport:n,feedback:o,bus:r,persistence:a,conversationId:s,composerKey:l,panelSize:c,view:d,canSend:p,isStreaming:_,sendPreparing:u,controlMode:f,assignedOperatorInitials:m,operatorAvailable:h,operatorRequestEnabled:P,onRequestOperator:k,onCancelOperatorRequest:S,loadingMessages:b,onLoadPreviousMessages:x,messagesSig:y,agent:w,suggestions:D,initialWidgetSize:q,onClose:B,onBack:M,onClear:F,onToggleHistory:H,onSelectHistoryConversation:V,onNewConversation:ee,onWidgetSizeChange:W,onSend:se,onStop:ae,onSuggestion:xe,activeForm:ue,formMarkers:ye,onFormSubmit:pe,onFormSkip:Ze,onFormFill:ot,tool:ct,onRetry:Ge,onMessageFeedback:je,containerEl:Ye,dragOver:Je,composerAttachApiRef:_t}=e,Pe=t.strings,Fe=ut(()=>y.value.some(et=>!et.ephemeral&&et.role!=="system")).value,Ve;return ue?Ve=null:p?Ve=i(de,{children:[f&&f!=="ai-agent"?i(Zm,{controlMode:f,operatorInitials:m,operatorAvailable:h,onCancelOperatorRequest:S,strings:Pe}):null,!_&&f==="ai-agent"&&i(sd,{suggestions:D,onPick:xe,disabled:u}),i(fc,{options:t,transport:n,feedback:o,bus:r,persistence:a,conversationId:s,isStreaming:_,active:e.composerActive&&d==="chat",isPreparing:u,operatorRequestEnabled:P,canRequestOperator:Fe,controlMode:f,onRequestOperator:k,onSend:se,onStop:ae,attachApiRef:_t},l)]}):Ve=i(Qm,{label:Pe.conversationClosed,ctaLabel:Pe.startNewConversation,onNewConversation:F}),i(de,{children:[d==="history"?i(Jm,{strings:Pe,onBack:H,onClose:B,showClose:gr(t.mode,c,t.actions)}):i("header",{class:`${qe}-header`,"data-testid":T.panelHeader,children:[M?i("button",{type:"button",class:`${qe}-icon-btn`,onClick:M,"aria-label":Pe.moduleBack,title:Pe.moduleBack,children:i(no,{})}):null,w?i(dc,{agent:w,strings:Pe}):i("h1",{children:Pe.panelTitle}),i(Pt,{panelProps:e,variant:"chat"})]}),d==="history"?i(Mr,{transport:n,strings:Pe,locale:t.locale,persistence:a,onSelect:V,onNewConversation:ee}):i(de,{children:[i(mc,{visible:Je,strings:Pe}),i(td,{messagesSig:y,strings:Pe,responseMode:t.responseMode,showReasoning:t.showReasoning,showToolCalls:t.showToolCalls,showSources:t.showSources,enableMessageFeedback:t.enableMessageFeedback,onFeedback:je,loading:b,onLoadPreviousMessages:x,idle:!_&&!u&&p&&!ue,controlMode:f,tool:ct,onRetry:Ge,form:ue?{form:ue,onSubmit:pe,onSkip:Ze}:null,formMarkers:ye,onFillForm:ot}),Ve,i(tg,{disclaimer:t.composerDisclaimer})]}),t.size.resize?.enabled?i(fr,{panelEl:Ye,resize:t.size.resize,position:t.position,initialSize:q,onSizeChange:W,strings:Pe}):null]})}function Jm({strings:e,onBack:t,onClose:n,showClose:o}){return i("header",{class:`${qe}-header`,children:[i("button",{type:"button",class:`${qe}-icon-btn`,onClick:t,"aria-label":e.historyBack,title:e.historyBack,children:i(no,{})}),i("h1",{children:e.historyTitle}),o?i("button",{type:"button",class:`${qe}-icon-btn`,onClick:n,"aria-label":e.close,title:e.close,children:i(yt,{})}):null]})}function Qm({label:e,ctaLabel:t,onNewConversation:n}){return i("div",{class:`${qe}-readonly-banner`,role:"note",children:[i("span",{class:`${qe}-readonly-label`,children:e}),i("button",{type:"button",class:`${qe}-readonly-cta`,onClick:n,children:t})]})}function Zm({controlMode:e,operatorInitials:t,operatorAvailable:n,onCancelOperatorRequest:o,strings:r}){let a=eg(e,t,n,r);return i("div",{class:`${qe}-operator-banner`,role:"status","data-mode":e,"data-testid":T.operatorBanner,children:[i("span",{class:`${qe}-operator-pulse`,"aria-hidden":"true"}),i("span",{class:`${qe}-operator-label`,children:a}),e==="awaiting_operator"&&o?i("button",{type:"button",class:`${qe}-cancel-operator-request`,"data-testid":T.cancelOperatorRequest,onClick:o,children:r.cancelOperatorRequest}):null]})}function eg(e,t,n,o){return e==="operator"?o.chattingWithOperator.replace("{operator}",t??""):n===!1?o.noOperatorAvailable:o.connectingOperator}function tg({disclaimer:e}){return e?i("div",{class:`${qe}-composer-footer`,children:i("div",{class:`${qe}-disclaimer`,children:e})}):null}function pi({poweredBy:e}){return e?i("div",{class:`${qe}-poweredby-bar`,children:i(ng,{logoUrl:e.logoUrl,text:e.text,href:e.href})}):null}function ng({logoUrl:e,text:t,href:n}){let o=i(de,{children:[e?i("img",{class:`${qe}-poweredby-logo`,src:e,alt:"",loading:"lazy"}):null,t?i("span",{children:t}):null]});return n?i("a",{class:`${qe}-poweredby`,href:n,target:"_blank",rel:"noopener noreferrer",children:o}):i("span",{class:`${qe}-poweredby`,children:o})}function cd(e){let t=O(e);t.current=e;let n=O(null);return n.current??(n.current=og(t)),n.current}function og(e){let t=oe(null),n=new Set,o=c=>`${e.current.conversationId()??""}:${c}`,r=c=>c.frequency==="always"?!1:c.frequency==="conversation"?n.has(o(c.id)):c.id in e.current.persistence.loadFormsDone(),a=(c,d)=>{if(t.value)return;let p=e.current;if(c==="manual"){let _=p.forms.list.find(u=>u.id===d);_&&(t.value={form:_,trigger:"manual"});return}for(let _ of p.forms.byTrigger[c]??[]){let u=_.triggers.find(f=>f.kind===c);if(!(!u||!rg(u,p)||r(_)||!ag(_,p))){t.value={form:_,trigger:c};return}}},s=(c,d)=>{let p=t.value;if(!p)return;t.value=null;let{form:_,trigger:u}=p;_.frequency==="conversation"?n.add(o(_.id)):_.frequency!=="always"&&e.current.persistence.saveFormDone(_.id),e.current.onComplete(_,u,c,d)};return{activeForm:t,fire:a,refresh:()=>{let c=t.value;if(!c)return;let d=e.current.forms.list.find(p=>p.id===c.form.id);d&&d!==c.form&&(t.value={form:d,trigger:c.trigger})},complete:c=>s(c,!1),skip:()=>s({},!0)}}function rg(e,t){return e.kind==="after-messages"?t.messageCount()>=Number(e.param??0):e.kind==="page-area"?t.pageArea()===e.param:!0}function ag(e,t){let n=e.when;if(!n)return!0;if(n.missingContext?.length){let r=t.userContext()??{};if(n.missingContext.some(a=>r[a]!==void 0&&r[a]!==""))return!1}if(n.pageArea&&!(Array.isArray(n.pageArea)?n.pageArea:[n.pageArea]).includes(t.pageArea()??""))return!1;let o=t.messageCount();return!(n.minMessages!=null&&o<n.minMessages||n.maxMessages!=null&&o>n.maxMessages)}function dd(e){let t=R.cssPrefix,{site:n,blocks:o,strings:r,collapsed:a}=e,s=o?.navigation??[],l=o?.linkCards??[],c=a?r.expandSidebar:r.collapseSidebar;return i("aside",{class:`${t}-sidebar`,"data-collapsed":a?"true":"false","data-testid":T.sidebar,children:[i("div",{class:`${t}-sidebar-header`,children:[i(ig,{site:n}),i("button",{type:"button",class:`${t}-sidebar-toggle`,"aria-label":c,"aria-expanded":a?"false":"true",title:c,onClick:e.onToggleCollapsed,"data-testid":T.sidebarToggle,children:i(sg,{collapsed:a})})]}),a?null:i(de,{children:[s.length>0?i("nav",{class:`${t}-sidebar-section`,"data-section":"navigation",children:i(lg,{items:s})}):null,l.length>0?i("div",{class:`${t}-sidebar-section`,"data-section":"link-cards",children:i(cg,{items:l})}):null,e.showConversations?i("div",{class:`${t}-sidebar-conversations`,children:i(Mr,{transport:e.transport,strings:e.strings,locale:e.locale,persistence:e.persistence,onSelect:e.onSelectConversation,onNewConversation:e.onNewConversation})}):null]})]})}function ig({site:e}){let t=R.cssPrefix;if(e?.logo?.url){let n=e.logo.alt??e.title??"Logo";return i("picture",{children:[e.logoDark?.url?i("source",{srcset:e.logoDark.url,media:"(prefers-color-scheme: dark)"}):null,i("img",{class:`${t}-sidebar-logo`,src:e.logo.url,alt:n})]})}return i("div",{class:`${t}-sidebar-title`,children:e?.title??R.name})}function sg({collapsed:e}){return i("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true",children:e?i("polyline",{points:"9 6 15 12 9 18"}):i("polyline",{points:"15 6 9 12 15 18"})})}function lg({items:e}){let t=R.cssPrefix;return i("ul",{class:`${t}-sidebar-nav`,children:e.map(n=>i("li",{children:i("a",{class:`${t}-sidebar-nav-item`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[n.icon?i("span",{class:`${t}-sidebar-nav-icon`,"data-icon":n.icon}):null,i("span",{class:`${t}-sidebar-nav-label`,children:n.label})]})},n.id??n.label))})}function cg({items:e}){let t=R.cssPrefix;return i("div",{class:`${t}-sidebar-cards`,children:e.map(n=>i("a",{class:`${t}-sidebar-card`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[i("div",{class:`${t}-sidebar-card-label`,children:n.label}),n.description?i("div",{class:`${t}-sidebar-card-desc`,children:n.description}):null]},n.id??n.label))})}var ud=R.cssPrefix;function _d(e){return i("main",{class:`${ud}-page-shell`,"data-sidebar-collapsed":e.sidebarCollapsed?"true":"false",children:[i(dd,{site:e.site,blocks:e.blocks,transport:e.transport,strings:e.strings,locale:e.locale,persistence:e.persistence,showConversations:e.showConversations,onSelectConversation:e.onSelectConversation,onNewConversation:e.onNewConversation,collapsed:e.sidebarCollapsed,onToggleCollapsed:e.onToggleSidebarCollapsed}),i("section",{class:`${ud}-page-chat`,"aria-label":"Chat",children:e.children})]})}var pd=e=>Object.fromEntries(e.map(t=>[t,[]]));function fi(e,t,n){return e.includes(t)?t:e.includes(n)?n:e[0]??""}function fd(e,t,n){let o=[...new Set(t)],r=fi(o,e,""),a=oe({activeTab:r,stacks:pd(o)});return{sig:a,reconcile(s,l){let c=[...new Set(s)],d=a.value,p=fi(c,d.activeTab,l),_=Object.fromEntries(c.map(f=>[f,d.stacks[f]??[]])),u=p===d.activeTab&&c.length===Object.keys(d.stacks).length&&c.every(f=>d.stacks[f]===_[f]);o=c,!u&&(a.value={activeTab:p,stacks:_},p!==d.activeTab&&p&&n?.(p))},switchTab(s){!(s in a.value.stacks)||a.value.activeTab===s||(a.value={...a.value,activeTab:s},n?.(s))},push(s){let l=a.value,c=l.stacks[l.activeTab]??[];a.value={...l,stacks:{...l.stacks,[l.activeTab]:[...c,s]}}},pop(){let s=a.value,l=s.stacks[s.activeTab]??[];l.length!==0&&(a.value={...s,stacks:{...s.stacks,[s.activeTab]:l.slice(0,-1)}})},reset(s){a.value={activeTab:fi(o,s,""),stacks:pd(o)}}}}var md=e=>e.stacks[e.activeTab]??[],gd=e=>md(e).at(-1),vd=e=>md(e).length===0;var hd={Icon:ro};var qt=R.cssPrefix;function Lr({title:e,actions:t}){return i("header",{class:`${qt}-back-header`,"data-variant":"title",children:[i("span",{class:`${qt}-back-spacer`,"aria-hidden":"true"}),i("h1",{class:`${qt}-back-title`,children:e}),t??i("span",{class:`${qt}-back-spacer`,"aria-hidden":"true"})]})}function Or({title:e,backLabel:t,onBack:n,actions:o,testid:r}){return i("header",{class:`${qt}-back-header`,"data-testid":r,children:[i("button",{type:"button",class:`${qt}-icon-btn`,onClick:n,"aria-label":t,title:t,children:i(no,{})}),i("h1",{class:`${qt}-back-title`,children:e}),o??i("span",{class:`${qt}-back-spacer`,"aria-hidden":"true"})]})}function rn(e,t){return e instanceof He&&e.status===429?t.errorRateLimited:t.errorGeneric}var An=R.cssPrefix;function bd({placeholder:e,onActivate:t}){return i("button",{type:"button",class:`${An}-home-search`,onClick:t,"data-testid":T.homeSearch,children:[i("span",{class:`${An}-home-search-text`,children:e}),i("span",{class:`${An}-home-search-icon`,"aria-hidden":"true",children:i(Wa,{})})]})}function yd({placeholder:e,value:t,onInput:n}){return i("div",{class:`${An}-home-search`,"data-input":"true",children:[i("input",{type:"search",class:`${An}-home-search-input`,placeholder:e,value:t,onInput:o=>n(o.currentTarget.value),"data-testid":T.helpSearch}),i("span",{class:`${An}-home-search-icon`,"aria-hidden":"true",children:i(Wa,{})})]})}var so=R.cssPrefix;function Nr({title:e,subtitle:t,onClick:n,testid:o}){return i("button",{type:"button",class:`${so}-list-row`,onClick:n,"data-testid":o,children:[i("span",{class:`${so}-list-row-body`,children:[i("span",{class:`${so}-list-row-title`,children:e}),t?i("span",{class:`${so}-list-row-sub`,children:t}):null]}),i("span",{class:`${so}-list-row-chevron`,"aria-hidden":"true",children:i(wn,{})})]})}var Pd=R.cssPrefix;function vt({tone:e="info",message:t,onRetry:n,strings:o}){return i("div",{class:`${Pd}-module-empty`,role:e==="error"?"alert":"status","aria-live":"polite",children:[i("span",{children:t}),n?i("button",{type:"button",class:`${Pd}-module-retry`,onClick:n,children:o.errorRetry}):null]})}var an=R.cssPrefix,dg=ne.scope("help"),ug=(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 _g(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 xd(e,t){let n=t.toLowerCase(),o=n.indexOf(e);if(o!==-1)return 100-Math.min(o,99);let r=0;for(let a of e){if(r=n.indexOf(a,r),r===-1)return 0;r+=1}return 1}function pg(e,t){let n=t.toLowerCase().trim();return n?e.map(o=>({item:o,score:Math.max(xd(n,o.title)*2,xd(n,o.description??""))})).filter(o=>o.score>0).toSorted((o,r)=>r.score-o.score).map(o=>o.item):[]}function Sd({article:e,nav:t}){return i(Nr,{title:e.title,subtitle:e.description,onClick:()=>ug(t,e),testid:Ue(T.helpArticle,e.id)})}function fg({transport:e,strings:t,config:n,nav:o,bus:r,panelProps:a}){let s=n.contentTags,[l,c]=$("loading"),[d,p]=$(t.errorGeneric),[_,u]=$([]),[f,m]=$(""),[h,P]=$(0);L(()=>{let b=!1;return c("loading"),e.listContent({tags:s,sortBy:"order",limit:100}).then(x=>{if(b)return;let y=x.items??[];u(y),c("loaded"),r.emit("contentView",{section:"help",tags:s?.join(","),count:y.length})}).catch(x=>{b||(dg.warn("listContent (help) failed",{err:x}),p(rn(x,t)),c("error"))}),()=>{b=!0}},[e,s,h,r]);let k=ie(()=>pg(_,f),[_,f]);L(()=>{let b=f.trim();if(!b)return;let x=setTimeout(()=>r.emit("contentSearch",{queryLength:b.length,hitCount:k.length}),600);return()=>clearTimeout(x)},[f,k,r]);function S(){return f.trim().length>0?k.length===0?i(vt,{message:t.helpSearchEmpty,strings:t}):i("div",{class:`${an}-help-card`,children:k.map(b=>i(Sd,{article:b,nav:o},b.id))}):l==="loading"?i(vt,{message:t.helpLoading,strings:t}):l==="error"?i(vt,{tone:"error",message:d,onRetry:()=>P(b=>b+1),strings:t}):_.length===0?i(vt,{message:t.helpEmpty,strings:t}):_g(_).map(([b,x])=>i("section",{class:`${an}-help-group`,children:[b?i("h2",{class:`${an}-help-section-title`,children:b}):null,i("div",{class:`${an}-help-card`,children:x.map(y=>i(Sd,{article:y,nav:o},y.id))})]},b))}return i("div",{class:`${an}-module`,children:[i(Lr,{title:t.helpTitle,actions:i(Pt,{panelProps:a,variant:"plain"})}),i("div",{class:`${an}-module-pad`,children:i(yd,{placeholder:t.helpSearchPlaceholder,value:f,onInput:m})}),i("div",{class:`${an}-help-list`,children:S()})]})}var kd={Icon:oo,Root:e=>i(fg,{...e})};var wd=R.cssPrefix;function mi({onClick:e,children:t,testid:n}){return e?i("button",{type:"button",class:`${wd}-home-card`,"data-interactive":"true",onClick:e,"data-testid":n,children:t}):i("div",{class:`${wd}-home-card`,"data-testid":n,children:t})}var Te=R.cssPrefix,Cd=ne.scope("home");function mg(e){let t=e.options.userContext?.name,n=e.config.greetingText?Qe(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 gg=(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 Rd(e,t){return Mt(e,t,t.type!=="upsert"||t.activity===!0)}function vg(e){let{transport:t,strings:n,config:o,nav:r,bus:a,panelProps:s}=e,[l,c]=$(null),[d,p]=$([]),_=o.contentTags?.join(","),u=e.options.modules.list.some(S=>S.layout==="chat");L(()=>{if(o.showRecentConversations===!1)return;let S=!1,b=!0,x=[],y=t.subscribeConversationChanges(w=>{b&&x.push(w),c(D=>Rd(D?[D]:[],w)[0]??null)});return t.listConversations({limit:u?50:1}).then(w=>{if(S)return;let D=x.reduce(Rd,w.conversations);x=[],b=!1,c(D[0]??null)}).catch(w=>{S||(x=[],b=!1,Cd.warn("listConversations (home) failed",{err:w}))}),()=>{S=!0,y()}},[t,o.showRecentConversations,u]),L(()=>{if(!o.contentTags?.length)return;let S=!1;return t.listContent({tags:o.contentTags,limit:6}).then(b=>{if(S)return;let x=b.items??[];p(x),a.emit("contentView",{section:"home",tags:_,count:x.length})}).catch(b=>!S&&Cd.warn("listContent (home) failed",{err:b})),()=>{S=!0}},[t,_,a]);let f=mg(e),m=o.userAvatars??[],h=o.status,P=h?.text?Qe(n,h.text):n.homeStatus,k=o.contentBlockTitle?Qe(n,o.contentBlockTitle):n.homeContentTitle;return i("div",{class:`${Te}-module ${Te}-home`,"data-testid":T.homeView,children:i("div",{class:`${Te}-home-scroll`,children:[i("div",{class:`${Te}-home-hero`,children:[i("div",{class:`${Te}-home-hero-top`,children:[o.brandName?i("span",{class:`${Te}-home-brand`,"data-testid":T.homeBrand,children:o.brandName}):i("span",{class:`${Te}-home-brand-spacer`,"aria-hidden":"true"}),i("div",{class:`${Te}-home-hero-actions`,children:[m.length>0?i("div",{class:`${Te}-home-avatars`,children:m.map(S=>i("span",{class:`${Te}-home-avatar`,title:S.role?`${S.name} \xB7 ${S.role}`:S.name,children:S.avatar?i("img",{src:S.avatar,alt:"",loading:"lazy"}):i("span",{children:hr(S.name)})},S.name))}):null,i(Pt,{panelProps:s,variant:"plain"})]})]}),o.showGreeting!==!1?i(de,{children:[i("h1",{class:`${Te}-home-greeting`,"data-testid":T.homeGreeting,children:f.title}),f.subtitle?i("p",{class:`${Te}-home-lead`,children:f.subtitle}):null]}):null]}),i("div",{class:`${Te}-home-cards`,children:[o.showSearchBar!==!1?i(bd,{placeholder:n.homeSearchPlaceholder,onActivate:()=>r.switchToLayout("help")}):null,l?i(mi,{onClick:()=>r.selectConversation(l),testid:T.homeRecent,children:i("div",{class:`${Te}-home-recent-row`,"data-unread":l.hasUnread?"true":void 0,children:[i("span",{class:`${Te}-home-recent-avatar`,"aria-hidden":"true",children:i(ro,{})}),i("span",{class:`${Te}-home-recent-body`,children:[i("span",{class:`${Te}-home-recent-title`,children:l.title}),l.preview?i("span",{class:`${Te}-home-recent-preview`,children:l.preview}):null]}),l.hasUnread?i("span",{class:`${Te}-home-recent-dot`,"aria-label":"Unread"}):null]})}):null,h?i(mi,{onClick:h.url?()=>r.push({kind:"iframe",url:h.url,title:P}):void 0,children:i("div",{class:`${Te}-home-status`,"data-level":h.level??"operational",children:[i("span",{class:`${Te}-home-status-icon`,"aria-hidden":"true",children:i(jl,{})}),i("span",{class:`${Te}-home-status-text`,children:P})]})}):null,d.length>0?i("section",{class:`${Te}-home-content`,children:[i("div",{class:`${Te}-home-content-title`,children:k}),i("div",{class:`${Te}-home-content-list`,children:d.map(S=>i(Nr,{title:S.title,subtitle:S.description,onClick:()=>gg(r,S),testid:Ue(T.homeContentRow,S.id)},S.id))})]}):null]})]})})}var Td={Icon:Xl,Root:e=>i(vg,{...e})};var Vt=R.cssPrefix,hg=ne.scope("news");function bg({transport:e,strings:t,config:n,nav:o,bus:r,panelProps:a}){let s=n.contentTags,[l,c]=$("loading"),[d,p]=$(t.errorGeneric),[_,u]=$([]),[f,m]=$(0);L(()=>{let P=!1;return c("loading"),e.listContent({tags:s,sortBy:"publishedAt",sortOrder:"desc"}).then(k=>{if(P)return;let S=k.items??[];u(S),c("loaded"),r.emit("contentView",{section:"news",tags:s?.join(","),count:S.length})}).catch(k=>{P||(hg.warn("listContent (news) failed",{err:k}),p(rn(k,t)),c("error"))}),()=>{P=!0}},[e,s,f,r]);function h(){return l==="loading"?i(vt,{message:t.newsLoading,strings:t}):l==="error"?i(vt,{tone:"error",message:d,onRetry:()=>m(P=>P+1),strings:t}):_.length===0?i(vt,{message:t.newsEmpty,strings:t}):i("div",{class:`${Vt}-news-list`,children:_.map(P=>i("button",{type:"button",class:`${Vt}-news-card`,onClick:()=>o.push({kind:"content",id:P.id,title:P.title}),"data-testid":Ue(T.newsItem,P.id),children:[P.image?i("img",{class:`${Vt}-news-hero`,src:P.image,alt:"",loading:"lazy"}):null,i("span",{class:`${Vt}-news-body`,children:[i("span",{class:`${Vt}-news-title`,children:P.title}),P.description?i("span",{class:`${Vt}-news-summary`,children:P.description}):null]})]},P.id))})}return i("div",{class:`${Vt}-module`,children:[i(Lr,{title:t.newsTitle,actions:i(Pt,{panelProps:a,variant:"plain"})}),i("div",{class:`${Vt}-module-scroll`,children:h()})]})}var Id={Icon:Yl,Root:e=>i(bg,{...e})};var Dr={chat:hd,home:Td,help:kd,news:Id};var lo=R.cssPrefix;function Ed({modules:e,activeTab:t,strings:n,hasUnread:o,onSelect:r}){return i("nav",{class:`${lo}-tabbar`,role:"tablist","aria-label":n.panelTitle,children:e.map(a=>{let s=Dr[a.layout].Icon,l=a.id===t,c=a.layout==="chat"&&o;return i("button",{type:"button",role:"tab","aria-selected":l,class:`${lo}-tab`,onClick:()=>r(a.id),"data-testid":Ue(T.tab,a.id),children:[i("span",{class:`${lo}-tab-icon`,"aria-hidden":"true",children:[i(s,{}),c?i("span",{class:`${lo}-tab-badge`,"data-testid":T.tabBadge,"aria-label":"Unread"}):null]}),i("span",{class:`${lo}-tab-label`,children:Qe(n,a.label)})]},a.id)})})}var Ad=R.cssPrefix,yg="allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads";function Md({url:e,title:t,strings:n,onBack:o,actions:r}){return i("div",{class:`${Ad}-module`,children:[i(Or,{title:t||n.moduleBack,backLabel:n.moduleBack,onBack:o,actions:r}),i("iframe",{class:`${Ad}-content-frame`,src:e,title:t||"content",sandbox:yg,referrerpolicy:"no-referrer",loading:"lazy",allow:"fullscreen"})]})}var co=R.cssPrefix,Pg=ne.scope("content"),xg=5e3;function Ld({id:e,title:t,transport:n,strings:o,bus:r,onBack:a,actions:s}){let[l,c]=$(null),[d,p]=$(!1),[_,u]=$(0),f=N(()=>{p(!1),c(null),u(P=>P+1)},[]);L(()=>{let P=!1;return n.listContent({ids:[e],limit:1}).then(k=>{if(P)return;let S=k.items[0];S?(c(S),r.emit("contentOpen",{contentId:e,tags:S.tags?.length?S.tags.join(","):void 0})):p(!0)}).catch(k=>{P||(Pg.warn("listContent (reader) failed",{err:k}),p(!0))}),()=>{P=!0}},[n,e,_,r]),L(()=>{if(!l)return;let P=setTimeout(()=>r.emit("contentRead",{contentId:e}),xg);return()=>clearTimeout(P)},[l,e,r]);let m=N(P=>{let S=P.target?.closest?.("a")?.getAttribute("href")??"";S&&!S.startsWith("#")&&r.emit("contentLinkClick",{contentId:e})},[r,e]);function h(){return d?i(vt,{tone:"error",message:o.errorGeneric,onRetry:f,strings:o}):l===null?i(vt,{message:o.contentLoading,strings:o}):i("article",{class:`${co}-content`,"data-testid":T.contentView,onClick:m,children:[l.image?i("img",{class:`${co}-content-hero`,src:l.image,alt:"",loading:"lazy"}):null,l.description?i("p",{class:`${co}-content-subtitle`,children:l.description}):null,i(Wc,{text:l.content??""})]})}return i("div",{class:`${co}-module`,children:[i(Or,{title:l?.title||t||o.moduleBack,backLabel:o.moduleBack,onBack:a,actions:s,testid:T.backHeader}),i("div",{class:`${co}-module-scroll`,"data-testid":T.contentScroll,children:h()})]})}var $r=R.cssPrefix;function Od({panelProps:e,enabledModules:t,nav:n,bus:o,hasUnread:r,onSelectConversation:a,onStartNewConversation:s,onSetPanelSize:l}){let c=e.options,d=c.strings,p=O(null),_=O(new Set);L(()=>{let V=p.current;if(!V)return;let ee=vr(V),W=se=>{se.key==="Escape"&&e.onClose?.()};return V.addEventListener("keydown",W),()=>{ee(),V.removeEventListener("keydown",W)}},[e.onClose]);let u=ut(()=>n.sig.value).value,f=gd(u),m=c.modules.byId[u.activeTab],h=e.composerActive&&m?.layout==="chat"&&f===void 0,P=e.composerApiRef,k=h&&e.view==="chat"&&e.canSend&&!e.activeForm&&!e.sendPreparing&&e.options.features.fileUpload,S=N(V=>{k&&P.current?.attachFromDrop(V)},[P,k]),{visible:b}=Pr({containerRef:p,onDrop:S,disabled:!k});mr(p.current,c.mode==="modal");let x=f?.kind==="iframe"||f?.kind==="content",y=t.length>1&&(vd(u)||!x),w=O(null);L(()=>{if(x&&w.current===null)w.current=e.panelSize,e.panelSize==="normal"&&l("expanded");else if(!x&&w.current!==null){let V=w.current;w.current=null,l(V)}},[x]);let D={push:n.push,pop:n.pop,switchTab:n.switchTab,switchToLayout:V=>{let ee=t.find(W=>W.layout===V);ee&&n.switchTab(ee.id)},selectConversation:a,startNewConversation:s},q=V=>({options:c,transport:e.transport,strings:d,config:V,nav:D,bus:o,panelProps:e}),B=i(Pt,{panelProps:e,variant:"plain"});m&&_.current.add(m.id);let M=t.filter(V=>_.current.has(V.id)),F=V=>{if(V.layout==="chat")return i(_i,{...e,composerActive:h,containerEl:p.current,dragOver:b,composerAttachApiRef:P});let ee=Dr[V.layout].Root;return ee?i(ee,{...q(V)}):null},H=()=>f?.kind==="iframe"?i(Md,{url:f.url,title:f.title,strings:d,onBack:n.pop,actions:B}):f?.kind==="content"?i(Ld,{id:f.id,title:f.title,transport:e.transport,strings:d,bus:o,onBack:n.pop,actions:B}):null;return i("div",{ref:p,class:`${$r}-panel ${$r}-messenger`,role:"dialog","aria-modal":"false","aria-label":d.panelTitle,style:{position:"relative"},"data-testid":T.messengerHome,children:[i("div",{class:`${$r}-messenger-body`,children:[M.map(V=>i("div",{class:`${$r}-messenger-pane`,hidden:x||V.id!==m?.id,children:F(V)},V.id)),H()]}),y?i(Ed,{modules:t,activeTab:u.activeTab,strings:d,hasUnread:r,onSelect:n.switchTab}):null,i(pi,{poweredBy:c.poweredBy}),c.size.resize?.enabled&&!(m?.layout==="chat"&&!f)?i(fr,{panelEl:p.current,resize:c.size.resize,position:c.position,initialSize:e.initialWidgetSize,onSizeChange:e.onWidgetSizeChange,strings:d}):null]})}var uo=R.cssPrefix;function Nd({strings:e,onClose:t}){return i("div",{class:`${uo}-panel ${uo}-modules-empty`,role:"dialog","aria-label":e.panelTitle,"data-testid":T.modulesEmpty,children:[t?i("button",{type:"button",class:`${uo}-icon-btn ${uo}-modules-empty-close`,onClick:t,"aria-label":e.close,title:e.close,children:i(yt,{})}):null,i("p",{class:`${uo}-modules-empty-text`,children:e.modulesEmpty})]})}function Mn(e,t,n,o){let r={role:n,text:o};e.emit("message",r),t.onMessage?.(r)}var gi=ne.scope("hitl");function Dd(e){let{streaming:t,controlModeSig:n,messagesSig:o,sendAiTurn:r,bus:a,humanInLoop:s}=e,l=O(t);l.current=t;let c=N((u,f,m)=>{if(l.current||n.value!=="ai-agent")return!1;let h=o.value.at(-1),P=h?.partsSig.value.findIndex(S=>S.kind==="tool"&&S.toolCallId===u)??-1,k=h?.partsSig.value[P];return!h||k?.kind!=="tool"?(gi.warn("decideTool: tool part not found",{toolCallId:u}),!1):h.status!=="complete"||!rr(h,P)||!f(k)?!1:(m(k),h.partsSig.value=[...h.partsSig.value],Qt(h)&&(h.status="streaming",h.retryAction={kind:"continue-assistant",messageId:h.serverMessageId??h.id},h.awaitingContinuation=!0,o.value=[...o.value],r({continueExisting:!0})),!0)},[n,o,r]),d=N((u,f,m)=>{let h=!1;if(c(u,k=>k.stateSig.value==="approval-requested",k=>{h=kr(k.toolName);let S=k.approvalSig.value?.id??u;k.approvalSig.value={id:S,approved:f,reason:m},k.stateSig.value="approval-responded"})){if(h){gi.info("toolResult",{toolCallId:u}),a.emit("toolResult",{toolCallId:u});return}gi.info("toolDecision",{toolCallId:u,approved:f}),a.emit("toolDecision",{toolCallId:u,approved:f})}},[a,c]),p=N(u=>{c(u,f=>f.stateSig.value==="approval-responded"&&f.approvalSig.value?.approved!==void 0,f=>{let m=f.approvalSig.value?.id??u;f.approvalSig.value={id:m},f.stateSig.value="approval-requested"})},[c]);return{toolInteraction:ie(()=>({humanInLoop:s,onDecision:d,onEdit:p}),[s,d,p])}}function $d({callout:e,persistence:t}){let n=e?.text??"",o=e?.persistent??!0,[r,a]=$(()=>o?!1:t.loadCalloutDismissed(n));L(()=>{a(o?!1:t.loadCalloutDismissed(n))},[n,o,t]);let s=N(()=>{a(!0),o||t.saveCalloutDismissed(n)},[t,n,o]);return{dismissed:r,dismissCallout:s}}function Fd(e){let{transport:t,conversationIdSig:n}=e,o=mt("ai-agent"),r=mt(void 0),a=mt(void 0),s=O(),l=N(_=>{let u=_.controlRevision??0,f=s.current;f&&f.conversationId===n.value&&u<f.revision||(s.current={conversationId:n.value,revision:u},o.value=_.controlMode,r.value=_.assignedOperatorInitials,_.controlMode!=="awaiting_operator"?a.value=void 0:_.operatorAvailable!==void 0&&(a.value=_.operatorAvailable))},[n,o,r,a]),c=N(_=>{_.type==="data-control-state"&&l(Bt(_.data))},[l]),d=N(async()=>{let _=n.value,u=await t.requestOperator();u&&n.value===_&&l(Bt(u))},[t,n,l]),p=N(async()=>{let _=n.value,u=await t.cancelOperatorRequest();u&&n.value===_&&l(Bt(u))},[t,n,l]);return{controlModeSig:o,assignedOperatorInitialsSig:r,operatorAvailableSig:a,applyControlState:l,adoptControlStateChunk:c,requestOperator:d,cancelOperatorRequest:p}}var Fr=R.cssPrefix,Bd=`--${Fr}-visual-viewport-height`,Hd=`--${Fr}-visual-viewport-top`;function Ud(e){let{hostElement:t,mode:n,panelSize:o,isOpen:r,surfaceReady:a,setIsOpen:s}=e;ht(()=>{Ho(t,Qo(n,o,r))},[t,r,o,n]),ht(()=>{if(!r||!a)return;let l=t.ownerDocument.defaultView,c=l?.visualViewport,d=t.shadowRoot?.querySelector(`.${Fr}-anchor`);if(!l||!c||!d)return;let p=()=>{d.style.setProperty(Bd,`${c.height}px`),d.style.setProperty(Hd,`${c.offsetTop}px`)},_=0,u=()=>{l.cancelAnimationFrame(_),_=l.requestAnimationFrame(()=>{_=l.requestAnimationFrame(p)})};return p(),c.addEventListener("resize",u),c.addEventListener("scroll",u),()=>{l.cancelAnimationFrame(_),c.removeEventListener("resize",u),c.removeEventListener("scroll",u),d.style.removeProperty(Bd),d.style.removeProperty(Hd)}},[t,r,a]),L(()=>{if(n!=="modal"||!r)return;let l=c=>{c.composedPath().some(p=>p instanceof HTMLElement&&p.classList.contains(`${Fr}-panel`))||s(!1)};return t.addEventListener("click",l),()=>t.removeEventListener("click",l)},[t,r,n,s]),L(()=>{if(n!=="drawer"||!r)return;let l=c=>{c.key==="Escape"&&s(!1)};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[r,n,s])}var vi=ne.scope("reducer"),Br=class{constructor(t,n){le(this,"messagesSig",t);le(this,"onReconcileNeeded",n);le(this,"active",null);le(this,"openTextParts",new Map);le(this,"partSeq",0);le(this,"replay",null)}attach(t){this.active=t,this.openTextParts.clear()}detach(){this.active=null,this.replay=null,this.openTextParts.clear()}beginReplay(t,n){let o=Lt();o.id=t.id;let r=sn(t)||Zt(t)&&(t.status!=="streaming"||Qt(t)),a=t.status==="streaming"&&Qt(t)&&Zn(t);this.replay={baseline:t,shadow:o,chunks:[n],probeContinuation:r,continuationTailReplay:a,liveCatchUp:t.status==="streaming"&&!r},this.attach(o),this.apply(n)}refreshReplayBaseline(){let t=this.replay;if(!t)return null;let n=t.shadow.serverMessageId??t.baseline.serverMessageId,o=this.messagesSig.value,r=o.at(-1),a=r===t.baseline||r?.id===t.baseline.id||n!==void 0&&r?.serverMessageId===n?r:o.find(l=>l===t.baseline)??o.find(l=>l.id===t.baseline.id||n!==void 0&&l.serverMessageId===n);if(!a)return this.detach(),null;if(a===t.baseline)return t;let s=t.baseline;return t.baseline=a,zd(s,a),t.liveCatchUp&&sn(t.shadow)&&(a.status==="streaming"||Zt(a))?(t.probeContinuation=!1,t.continuationTailReplay=!1,t):(t.probeContinuation=sn(a)||Zt(a)&&(a.status!=="streaming"||Qt(a)),t.continuationTailReplay=a.status==="streaming"&&Qt(a)&&Zn(a),t.liveCatchUp=a.status==="streaming"&&!t.probeContinuation,t)}refreshActive(){let t=this.active;if(!t)return null;let n=t.serverMessageId,o=this.messagesSig.value,r=o.at(-1),a=r===t||r?.id===t.id||n!==void 0&&r?.serverMessageId===n?r:o.find(l=>l===t)??o.find(l=>l.id===t.id||n!==void 0&&l.serverMessageId===n);if(!a)return this.detach(),null;if(a===t)return t;zd(t,a);let s=sn(t)&&Zt(a);return a.status!=="streaming"&&!s?(this.detach(),null):(this.replay={baseline:a,shadow:t,chunks:[],probeContinuation:!1,continuationTailReplay:!1,liveCatchUp:!0},t)}promoteReplay(){let{baseline:t,shadow:n}=this.replay;return ft(()=>{t.role=n.role,t.serverMessageId=n.serverMessageId,t.operatorInitials=n.operatorInitials,t.status=n.status,n.canceled&&(t.canceled=!0),t.finishReason=n.finishReason,t.errorText=n.errorText,t.suggestions=n.suggestions??t.suggestions,t.partsSig.value=n.partsSig.value,this.messagesSig.value=[...this.messagesSig.value]}),this.replay=null,this.active=t,t}promoteContinuation(t=!1){let{baseline:n,chunks:o}=this.replay,r=ar(n);return this.replay=null,ft(()=>{if(t){let a=n.partsSig.value.findLastIndex(s=>s.kind==="tool");n.partsSig.value=n.partsSig.value.slice(0,a+1)}n.awaitingContinuation=!1,n.status="streaming",n.finishReason=void 0,n.errorText=void 0,n.suggestions=void 0,this.attach(n);for(let a of o)this.apply(a);n.continuationStreaming=r||void 0,this.messagesSig.value=[...this.messagesSig.value]}),n}settleOwnedContinuation(t){let{baseline:n}=this.replay,o=ar(n);return this.replay=null,ft(()=>{n.awaitingContinuation=!1,n.status="streaming",n.finishReason=void 0,n.errorText=void 0,n.suggestions=void 0,this.attach(n),this.apply(t),n.continuationStreaming=o||void 0,this.messagesSig.value=[...this.messagesSig.value]}),n}applyResume(t){if(t.type==="start"){let r=(this.replay?.baseline??this.active)?.serverMessageId;r!==void 0&&t.messageId!==void 0&&r!==t.messageId&&this.onReconcileNeeded?.({messageId:r}),this.detach();let a=t.messageId,s=a!==void 0?this.messagesSig.value.find(p=>p.serverMessageId===a||p.id===a):void 0;if(s!==void 0)return t.messageMetadata?.senderRole==="visitor"&&s.role==="user"&&(s.status==="pending"||s.status==="error")&&(s.serverMessageId=a,s.status="complete",s.errorText=void 0,s.retryAction=void 0,this.messagesSig.value=[...this.messagesSig.value]),this.beginReplay(s,t),null;let l=t.messageMetadata?.senderRole,c=this.messagesSig.value.at(-1);if(l===void 0&&c?.role==="assistant"&&c.status==="streaming"&&c.serverMessageId===void 0&&!bt(c))return this.attach(c),this.apply(t),null;let d=Lt();return this.attach(d),this.messagesSig.value=[...this.messagesSig.value,d],this.apply(t),null}if(this.replay){let o=this.refreshReplayBaseline();if(!o)return null;o.chunks.push(t),t.type==="data-control-state"&&(o.baseline.operatorRoutedTurn=t.data.controlMode!=="ai-agent"),this.apply(t);let{baseline:r,shadow:a,probeContinuation:s,continuationTailReplay:l,liveCatchUp:c}=o,d=t.type==="finish"||t.type==="error"||t.type==="abort";if(s){if(!wg(r,a,t))return d&&(Ig(r,a)&&(r.continuationStreaming=!0,this.messagesSig.value=[...this.messagesSig.value],this.onReconcileNeeded?.({messageId:r.serverMessageId??r.id})),this.detach()),null;let _=sn(r)&&d?this.settleOwnedContinuation(t):this.promoteContinuation();return d?(_.continuationStreaming&&(t.type==="finish"?this.onReconcileNeeded?.({messageId:_.serverMessageId??_.id}):_.continuationStreaming=!1),this.detach(),_):null}if(l&&kg(r,a)){let _=this.promoteContinuation(!0);return d?(this.detach(),_):null}if(!c)return d&&this.detach(),null;if(d&&!bt(r)&&bt(a)){let _=this.promoteReplay();return this.detach(),_}if(!Sg(r,a))return d&&(this.onReconcileNeeded?.({messageId:r.serverMessageId??r.id}),this.detach()),null;let p=this.promoteReplay();return d?(this.detach(),p):null}let n=this.refreshActive();if(!n)return null;if(this.replay)return this.applyResume(t);if(this.apply(t),t.type==="finish"||t.type==="error"||t.type==="abort"){let o=n;return o.continuationStreaming&&(t.type==="finish"?this.onReconcileNeeded?.({messageId:o.serverMessageId??o.id}):o.continuationStreaming=!1),this.detach(),o}return null}ensureTextPart(t,n,o){let r=`${n}:${o}`,a=this.openTextParts.get(r);if(a)return a;let s={kind:n,id:`${o}#${this.partSeq++}`,textSig:oe(""),doneSig:oe(!1)};return this.openTextParts.set(r,s),_o(t,s),s}apply(t){let n=this.active;if(n)switch(t.type){case"start":{t.messageId&&(n.serverMessageId=t.messageId);let o=t.messageMetadata;o?.senderRole==="operator"?(n.role="operator",o.operatorInitials&&(n.operatorInitials=o.operatorInitials)):o?.senderRole==="visitor"&&(n.role="user");return}case"finish-step":this.openTextParts.clear();return;case"start-step":_o(n,{kind:"step-start",id:`ss-${this.partSeq++}`});return;case"finish":vi.debug("finish",{reason:t.finishReason,canContinue:t.canContinue}),n.status="complete",n.retryAction=void 0,t.finishReason&&(n.finishReason=t.finishReason),this.bumpDone(n);return;case"error":vi.warn("stream error chunk",{errorText:t.errorText}),n.status="error",n.errorText=t.errorText,this.bumpDone(n);return;case"abort":vi.debug("stream abort chunk (canceled)"),n.status="complete",n.canceled=!0,n.retryAction=void 0,this.bumpDone(n);return;case"text-start":this.ensureTextPart(n,"text",t.id);return;case"text-delta":{let o=this.ensureTextPart(n,"text",t.id);o.textSig.value+=t.delta;return}case"text-end":this.ensureTextPart(n,"text",t.id).doneSig.value=!0;return;case"reasoning-start":this.ensureTextPart(n,"reasoning",t.id).doneSig.value=!1;return;case"reasoning-delta":{let o=this.ensureTextPart(n,"reasoning",t.id);o.textSig.value+=t.delta;return}case"reasoning-end":this.ensureTextPart(n,"reasoning",t.id).doneSig.value=!0;return;case"tool-input-start":case"tool-input-delta":case"tool-input-available":case"tool-input-error":case"tool-output-available":case"tool-output-error":case"tool-output-denied":case"tool-approval-request":Eg(n,t);return;case"file":_o(n,{kind:"file",url:t.url,mediaType:t.mediaType});return;case"source-url":qd(n,{kind:"source",sourceId:t.sourceId,url:t.url,title:t.title});return;case"source-document":qd(n,{kind:"source",sourceId:t.sourceId,title:t.title,filename:t.filename,mediaType:t.mediaType});return;case"data-suggestions":n.suggestions=er(t.data);return;case"data-control-state":n.operatorRoutedTurn=t.data.controlMode!=="ai-agent";return;default:{let o=t}}}bumpDone(t){ft(()=>{t.partsSig.value=[...t.partsSig.value],this.messagesSig.value.includes(t)&&(this.messagesSig.value=[...this.messagesSig.value])})}},hi={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function sn(e){return e.awaitingContinuation===!0||e.continuationStreaming===!0||e.retryAction?.kind==="continue-assistant"}function zd(e,t){e.canceled&&(t.canceled=!0),!(!sn(e)||t.status!=="streaming"&&!Zt(t))&&(t.awaitingContinuation??(t.awaitingContinuation=e.awaitingContinuation),t.continuationStreaming??(t.continuationStreaming=e.continuationStreaming),t.retryAction===void 0&&(t.retryAction=e.retryAction))}function Sg(e,t){let n=e.partsSig.value,o=t.partsSig.value;return e.role!==t.role||o.length<n.length?!1:n.every((r,a)=>Vd(r,o[a]))}function kg(e,t){let n=e.partsSig.value,o=n.findLastIndex(l=>l.kind==="tool"),r=new Set(n.slice(0,o+1).flatMap(l=>l.kind==="tool"?[l.toolCallId]:[])),a=t.partsSig.value.filter(l=>l.kind!=="tool"||!r.has(l.toolCallId)),s=n.slice(o+1);return a.length<s.length?!1:s.every((l,c)=>Vd(l,a[c]))}function Vd(e,t){switch(e.kind){case"text":case"reasoning":return t?.kind===e.kind&&t.textSig.value.startsWith(e.textSig.value);case"step-start":return t?.kind==="step-start";case"tool":{if(t?.kind!=="tool"||t.toolCallId!==e.toolCallId||!ir(t.toolName,e.toolName)||hi[t.stateSig.value]<hi[e.stateSig.value])return!1;let n=e.approvalSig.value?.approved;return n===void 0||t.approvalSig.value?.approved===n}case"file":return t?.kind==="file"&&t.url===e.url&&t.mediaType===e.mediaType;case"source":return t?.kind==="source"&&t.sourceId===e.sourceId&&t.url===e.url&&t.title===e.title&&t.filename===e.filename&&t.mediaType===e.mediaType;default:return e}}function wg(e,t,n){return Cg(e,n)||!Rg(e,t)?!0:n.type!=="finish"&&n.type!=="error"&&n.type!=="abort"?!1:Zn(t)||e.awaitingContinuation===!0&&n.type!=="finish"?!0:e.awaitingContinuation===!0&&t.partsSig.value.every(o=>o.kind==="step-start")}function Cg(e,t){if(t.type!=="tool-output-available"&&t.type!=="tool-output-error"&&t.type!=="tool-output-denied")return!1;let n=e.partsSig.value.find(o=>o.kind==="tool"&&o.toolCallId===t.toolCallId);return n!==void 0&&hi[n.stateSig.value]<4}function Rg(e,t){let n=t.partsSig.value;if(n.length===0)return!0;let o=e.partsSig.value;return o.some((r,a)=>n.every((s,l)=>Tg(o[a+l],s)))}function Tg(e,t){switch(t.kind){case"text":case"reasoning":return e?.kind===t.kind&&e.textSig.value.startsWith(t.textSig.value);case"step-start":return e?.kind==="step-start";case"tool":return e?.kind==="tool"&&e.toolCallId===t.toolCallId&&(t.toolName==="tool"||ir(e.toolName,t.toolName));case"file":return e?.kind==="file"&&e.url===t.url&&e.mediaType===t.mediaType;case"source":return e?.kind==="source"&&e.sourceId===t.sourceId&&e.url===t.url&&e.title===t.title&&e.filename===t.filename&&e.mediaType===t.mediaType;default:return t}}function Ig(e,t){if(sn(e)||!Zt(e))return!1;let n=new Set(e.partsSig.value.filter(r=>r.kind==="tool").map(r=>r.toolCallId));return!t.partsSig.value.some(r=>r.kind==="tool"&&n.has(r.toolCallId))}function Wt(e,t,n,o){let r=e.partsSig.value.find(s=>s.kind==="tool"&&s.toolCallId===t);if(r)return o&&(r.dynamic=!0),r;let a={kind:"tool",toolCallId:t,toolName:n??"tool",dynamic:o?!0:void 0,inputPartialSig:oe(""),inputSig:oe(void 0),outputSig:oe(void 0),errorSig:oe(void 0),stateSig:oe("input-streaming"),approvalSig:oe(void 0)};return _o(e,a),a}function _o(e,t){e.partsSig.value=[...e.partsSig.value,t]}function qd(e,t){e.partsSig.value.some(n=>n.kind==="source"&&n.sourceId===t.sourceId)||_o(e,t)}function Eg(e,t){switch(t.type){case"tool-input-start":Wt(e,t.toolCallId,t.toolName,t.dynamic);return;case"tool-input-delta":{let n=Wt(e,t.toolCallId);n.inputPartialSig.value+=t.inputTextDelta;return}case"tool-input-available":{let n=Wt(e,t.toolCallId,t.toolName,t.dynamic);n.inputSig.value=t.input,n.stateSig.value="input-available";return}case"tool-input-error":{let n=Wt(e,t.toolCallId,t.toolName,t.dynamic);n.inputSig.value=t.input,n.errorSig.value=t.errorText,n.stateSig.value="output-error";return}case"tool-approval-request":{let n=Wt(e,t.toolCallId,t.toolName);n.approvalSig.value={id:t.approvalId},n.stateSig.value="approval-requested";return}case"tool-output-available":{let n=Wt(e,t.toolCallId,void 0,t.dynamic);n.outputSig.value=t.output,n.stateSig.value="output-available";return}case"tool-output-error":{let n=Wt(e,t.toolCallId,void 0,t.dynamic);n.errorSig.value=t.errorText,n.stateSig.value="output-error";return}case"tool-output-denied":{let n=Wt(e,t.toolCallId);n.stateSig.value="output-denied";return}default:return}}async function Wd(e){let t=1e3,n=!1,o=!1,r=!1,a=()=>{r||e.signal.aborted||(r=!0,e.onInitialBoundaryReady())};for(;!e.signal.aborted;){let s,l="held";try{l=await e.connect(()=>{if(e.signal.aborted)return;s=e.now();let c=n||o;n=!0,o=!1,r?c&&e.backfill():a()})}catch{}if(e.signal.aborted||(!n&&s===void 0&&(o=!0,a()),l==="unavailable"))return;s!==void 0&&e.now()-s>=1e3&&(t=1e3),await e.sleep(t),t=Math.min(t*2,15e3)}}var Ag=120;function Kd(e){let{activated:t,conversationReady:n,conversationIdSig:o,messagesSig:r,optionsRef:a,transport:s,visitorId:l,adoptControlStateChunk:c,settleSuggestions:d,recordConversationReply:p,transcriptRecoverySig:_,beginConversationTranscript:u,commitConversationTranscript:f,onReplyLanded:m,runCancellation:h,canContinueRef:P,setCanSend:k,feedback:S,bus:b,loadInitialThread:x,shouldReconcileOnConnect:y}=e,w=O(0);L(()=>{if(!t||!n||!o.value)return;let D=o.value,q=new AbortController,B=C=>{},M=new Br(r,C=>B(C));s.primeIdentity(l,D);let F=!1,H=!1,V,ee=!1,W,se=0,ae=P.current,xe,ue,ye=Date.now(),pe,Ze=!1,ot=!1,ct=(C,g,E)=>{if(!bt(C))return;let Q=r.value.findLast(Z=>!Z.ephemeral),j=C.serverMessageId??C.id;if(!(Q&&(Q.serverMessageId??Q.id)!==j))return or(r.value,C,D,a.current.strings.newConversation,g,E)},Ge=(C,g,E,Q)=>{let j=ct(C,g,Q);if(!j)return;let Se=`${C.serverMessageId??C.id}:${E}:${j.preview??""}`;Se!==ue&&(ue=Se,s.publishConversation({...j,hasUnread:!0},!0))},je,Ye=()=>{je&&(clearTimeout(je.timer),je=void 0)},Je=()=>{let C=je;if(!C)return;clearTimeout(C.timer),je=void 0;let g=r.value.find(E=>(E.serverMessageId??E.id)===C.replyId);g?.role!=="assistant"&&g?.role!=="operator"||Ge(g,C.canContinue,C.generation,C.activityAt)},_t=(C,g,E,Q)=>{Ye(),je={replyId:C.serverMessageId??C.id,canContinue:g,generation:E,activityAt:Q,timer:setTimeout(Je,Ag)}},Pe=(C,g,E,Q=Date.now(),j=!0)=>{Ye();let Z=ct(C,g,Q);if(!Z)return;let ge=`${C.serverMessageId??C.id}:${E}`;ge!==xe&&(xe=ge,p(Z),j&&pe&&(Ze=!0))},Fe=(C,g)=>{(C||!h.localSendRef.current)&&h.settle(g),C&&m()},Ve=(C,g=[],E=!1,Q,j=ae,Z=se,Se=Date.now(),ge=!0)=>{let ke=a.current;if(C.canceled){Pe(C,j,Z,Se,ge),Fe(E,Q);return}let be=!0,We=C.status==="error";switch(yl(C,We)){case"drop":r.value=r.value.filter(Le=>Le!==C),be=!1;break;case"complete-operator-routed":C.status="complete",E&&(S.play("messageReceived"),Mn(b,ke,"assistant",De(C)));break;case"error":{if(C.status="error",C.errorText=ke.strings.errorGeneric,E){S.play("error");let Le=new Error(We?"stream error chunk":"empty reply");b.emit("error",Le),ke.onError?.(Le)}break}case"complete":C.status="complete",E&&(S.play("messageReceived"),Mn(b,ke,"assistant",De(C))),d(C,g);break}be&&Pe(C,j,Z,Se,ge),Fe(E,Q)},et=C=>{if(q.signal.aborted||o.value!==D)return;if(c(C),C.type==="start"){Je();let Le=C.messageId===void 0?void 0:r.value.find(rt=>rt.serverMessageId===C.messageId||rt.id===C.messageId);ee=Le!==void 0&&Le.status!=="streaming";let St=W?.senderRole==="visitor"?W.messageId:void 0;if(W={messageId:C.messageId,senderRole:C.messageMetadata?.senderRole},se+=1,ye=Date.now(),ue=void 0,F=C.messageMetadata?.senderRole===void 0,H=!1,V=F?C.messageMetadata?.runId:void 0,F){let rt=C.messageId!==void 0&&r.value.some(go=>go.serverMessageId===C.messageId||go.id===C.messageId),Dt=r.value.at(-1),mo=C.messageId!==void 0&&(Dt?.serverMessageId===C.messageId||Dt?.id===C.messageId),Vr=h.localSendRef.current&&(!rt||mo)&&Dt?.role==="assistant"&&Dt.status==="streaming"&&(mo||Dt.serverMessageId===void 0&&Dt.partsSig.value.length===0);H=h.captureStart(D,C,Vr,St)}}let g=F&&(C.type==="finish"||C.type==="error"||C.type==="abort"),E=g?V:void 0,Q=g&&(H||h.ownsLocalRun(E)),j=se,Z=ee;C.type==="finish"&&C.canContinue!==void 0&&(ae=C.canContinue);let Se=ae;g&&(F=!1,H=!1,V=void 0);let ge=M.applyResume(C),ke=W?.messageId,be=ke===void 0?void 0:r.value.find(Le=>Le.serverMessageId===ke||Le.id===ke);ee&&W?.senderRole!=="visitor"&&(ge!==null||be?.status==="streaming")&&(ee=!1,Z=!1);let We=!ee&&(be?.role==="assistant"||be?.role==="operator");if(C.type==="text-delta"&&We&&_t(be,ae,se,ye),C.type==="text-end"&&(Ye(),We&&Ge(be,ae,se,ye)),C.type==="finish"&&C.canContinue===!1&&k(!1),!ge){g&&(Q||!h.localSendRef.current)&&h.settle(E);return}if(ge.role==="operator"){Z||(S.play("messageReceived"),Mn(b,a.current,"operator",De(ge))),Pe(ge,Se,j,ye),ee=!1,g&&(Q||!h.localSendRef.current)&&h.settle(E);return}ge.role==="assistant"&&(Ve(ge,[],Q,E,Se,j,ye),ee=!1)},pt=async C=>{let g=se,E=await s.loadConversation(D,C?{ids:[C]}:void 0).catch(()=>null);if(q.signal.aborted||o.value!==D||!E)return!1;E.controlState&&c({type:"data-control-state",data:E.controlState});let Q=r.value.at(-1),j=g===se&&(C===void 0||Q!==void 0&&(Q.serverMessageId===C||Q.id===C));if(!E.messages?.length)return!0;j&&(ae=E.canContinue??ae,k(ae));let Z=r.value,Se=C===void 0?Z.at(-1):Z.find(rt=>rt.serverMessageId===C||rt.id===C),{messages:ge,changed:ke}=eo(Z,Ht(E.messages));if(!ke)return!0;r.value=ge;let be=C===void 0?ge.at(-1):ge.find(rt=>rt.serverMessageId===C||rt.id===C),We=Se!==void 0&&be!==void 0&&(Se.id===be.id||Se.serverMessageId!==void 0&&Se.serverMessageId===be.serverMessageId),Le=be!==void 0&&be.status!=="streaming"&&(!We||Se?.status==="streaming"),St=We&&Se?.status==="streaming"?Date.now():be?.createdAt;return j&&Le&&be.role==="assistant"?Ve(be,E.suggestions??[],h.localSendRef.current,void 0,E.canContinue??ae,g,St,!1):j&&Le&&be.role==="operator"?Pe(be,E.canContinue??ae,g,St,!1):j&&be?.role==="assistant"&&be.status!=="streaming"&&d(be,E.suggestions??[]),!0},z=new Set;B=({messageId:C})=>{if(z.has(C)||!r.value.some(E=>E.serverMessageId===C||E.id===C))return;z.add(C);let g=()=>z.delete(C);pt(C).then(g,g)};let G=(C=!1)=>{if(q.signal.aborted||o.value!==D){Ze=!1;return}if(pe){Ze=!0;return}let g=C?x(D)??(y()?pt():void 0):pt();if(!g)return;u(D),pe=g;let E=(Q=!1)=>{if(pe===g){if(pe=void 0,Ze){Ze=!1,G();return}Q&&f(D)}};g.then(E,()=>E(!1))},J=_.subscribe(C=>{C<=w.current||(w.current=C,ot&&G())});return Wd({signal:q.signal,now:()=>performance.now(),sleep:C=>Jn(C,q.signal),connect:C=>s.connectResumeStream({signal:q.signal,onChunk:et,onConnected:C}),onInitialBoundaryReady:()=>{ot=!0,G(!0)},backfill:()=>G()}),()=>{q.abort(),Ye(),J(),M.detach()}},[t,n,o,o.value,l,s,c,d,p,_,u,f,m,h,P,k,r,b,S,x,y])}var Mg=32;function Gd(e){let{transport:t,setStreaming:n}=e,o=O(),r=O(),a=O(!1),s=O(),l=O(!1),c=O(new Map),d=O(new Set),p=N((y,w)=>{let D=`${y}:${w}`;s.current!==D&&(s.current=D,t.cancelTurn(y,w))},[t]),_=N(y=>{o.current=void 0,r.current=y,a.current=!1,s.current=void 0,l.current=!0,n(!0)},[n]),u=N((y,w)=>{c.current.set(y,{messageId:w})},[]),f=N(y=>{y!==void 0&&(d.current.add(y),d.current.size>Mg&&d.current.delete(d.current.values().next().value)),!(y!==void 0&&o.current?.runId!==y)&&(o.current=void 0,r.current=void 0,a.current=!1,l.current=!1,n(!1))},[n]),m=N((y,w)=>r.current!==y?w.runId&&o.current?.runId===w.runId?(o.current={conversationId:w.conversationId,runId:w.runId},a.current&&p(w.conversationId,w.runId),!0):!1:(r.current=void 0,w.runId?(o.current={conversationId:w.conversationId,runId:w.runId},n(!0),a.current&&p(w.conversationId,w.runId),!0):(f(),!0)),[p,n,f]),h=N((y,w)=>{let D=c.current.get(y);return D?(c.current.delete(y),!w.runId||d.current.has(w.runId)?!0:D.runId!==void 0?(D.runId!==w.runId||o.current?.runId===w.runId&&(o.current={conversationId:w.conversationId,runId:w.runId},a.current&&p(w.conversationId,w.runId)),!0):(l.current||r.current||(o.current={conversationId:w.conversationId,runId:w.runId},r.current=void 0,a.current=!1,s.current=void 0,l.current=!0,n(!0)),!0)):!1},[p,n]),P=N(y=>r.current!==y?!1:(f(),!0),[f]),k=N(y=>{let w=c.current.get(y);return w?(c.current.delete(y),w.runId===void 0):!1},[]),S=N((y,w,D,q)=>{let B=w.messageMetadata?.runId;if(w.messageMetadata?.senderRole!==void 0||typeof B!="string"||!B||d.current.has(B))return!1;if(o.current?.runId===B)return l.current;if(l.current)return o.current||!D?!1:(r.current=void 0,o.current={conversationId:y,runId:B},n(!0),a.current&&p(y,B),!0);let F=[...c.current.values()].filter(H=>H.runId===void 0).find(H=>H.messageId===q);return F?(F.runId=B,o.current={conversationId:y,runId:B},r.current=void 0,a.current=!1,s.current=void 0,l.current=!0,n(!0),!0):(r.current=void 0,o.current={conversationId:y,runId:B},n(!0),a.current&&p(y,B),l.current)},[p,n]),b=N(y=>typeof y=="string"&&o.current?.runId===y&&l.current,[]),x=N(()=>{let y=o.current;if(y)return a.current=!0,p(y.conversationId,y.runId),!0;let w=r.current;return w?(a.current=!0,w.then(D=>{D.runId&&p(D.conversationId,D.runId)}).catch(()=>{}),!0):!1},[p]);return ie(()=>({localSendRef:l,begin:_,beginRouted:u,acceptAck:m,acceptRoutedAck:h,reject:P,rejectRouted:k,captureStart:S,ownsLocalRun:b,settle:f,stop:x}),[m,h,_,u,S,b,P,k,f,x])}var Lg=ne.scope("send");function Xd(e,t,n,o,r,a=!0){e.publishConversation({...or(t,n,o,r,a),hasUnread:!1},!0)}function Yd(e,t){return e.id===t.id||(e.serverMessageId??e.id)===(t.serverMessageId??t.id)}function Jd(e){return e.findLast(t=>!t.ephemeral&&t.role!=="system"&&(t.role==="user"||t.status!=="streaming"||bt(t)))}function po(e,t,n,o,r){let a=Jd(t);!a||a.role!=="user"||!Yd(a,n)||Xd(e,t,a,o,r)}function jd(e){return!(e instanceof He)||e.code==="network"||e.status===void 0||e.status===202?!0:e.status===408||e.status===425||e.status===429||e.status>=500&&e.status<600}function Qd(e){let{transport:t,messagesSig:n,conversationIdSig:o,options:r,bus:a,feedback:s,persistence:l,visitorId:c,adoptConversationId:d,applyControlState:p,setCanSend:_,settleSuggestions:u,runCancellation:f}=e,m=N(()=>{let k=o.value??dt();return o.value||(o.value=k,l.saveConversationId(k)),k},[o,l]),h=N(async({continueExisting:k,turn:S})=>{let b=m(),x=n.value.at(-1),y=S?[S]:fl(n.value,k),w=y[0],D=Ma({messages:y.map(Fa),conversationId:b,visitorId:c,userPrefs:l.loadUserPrefs()}),q=t.sendTurn(D);f.begin(q);try{let B=await q;if(o.value!==b||!f.acceptAck(q,B))return;if(d(B.conversationId),B.runId&&w?.role==="user"&&po(t,n.value,w,B.conversationId,r.strings.newConversation),!B.runId){let M=await t.loadConversation(B.conversationId).catch(()=>null);if(o.value!==B.conversationId)return;if(M){M.controlState&&p(M.controlState),_(M.canContinue??!0);let F=Ht(M.messages??[]),{messages:H,changed:V}=eo(n.value,F);V&&(n.value=H);let ee=F.findLast(ae=>!ae.ephemeral&&ae.role!=="system"),W=Jd(n.value);W&&ee&&Yd(W,ee)&&Xd(t,n.value,W,B.conversationId,r.strings.newConversation,M.canContinue??!0);let se=x?n.value.find(ae=>ae.id===x.id&&ae.role==="assistant"&&ae.status!=="streaming"):void 0;se&&u(se,M.suggestions??[]),!k&&x?.role==="assistant"&&n.value.includes(x)&&x.serverMessageId===void 0&&!bt(x)&&(n.value=n.value.filter(ae=>ae!==x))}else x?.role==="assistant"&&n.value.includes(x)&&(x.status="error",x.errorText=r.strings.errorGeneric,k?x.retryAction={kind:"continue-assistant",messageId:x.serverMessageId??x.id}:x.retryAction=w?.role==="user"?{kind:"resend-user",messageId:w.id}:null,n.value=[...n.value])}}catch(B){if(o.value!==b)return;if(!f.reject(q)){w?.role==="user"&&po(t,n.value,w,b,r.strings.newConversation);return}let M=rn(B,r.strings),F=jd(B),H=S?.role==="assistant"?S:n.value.at(-1);if(k&&H?.role==="assistant"&&B instanceof He&&B.status===409){let V=H.serverMessageId??H.id,ee=await t.loadConversation(b,{ids:[V]}).catch(()=>null);if(o.value!==b)return;if(ee){ee.controlState&&p(ee.controlState),_(ee.canContinue??!0);let W=Ht(ee.messages??[]),se=W.find(ae=>(ae.serverMessageId??ae.id)===V);if(se&&hl(H,se)){let{messages:ae,changed:xe}=eo(n.value,W),ue=ae.find(ye=>(ye.serverMessageId??ye.id)===V);if(xe&&ue&&ue!==H){ue.awaitingContinuation=!1,ue.continuationStreaming=void 0,ue.retryAction=null,n.value=ae,ue.status!=="streaming"&&u(ue,ee.suggestions??[]);return}}}if(!n.value.includes(H)||H.status!=="streaming")return;H.continuationStreaming=!0}if(k&&H?.role==="assistant")H.status="error",H.errorText=M,H.retryAction=F?{kind:"continue-assistant",messageId:H.serverMessageId??H.id}:null,n.value=[...n.value];else if(x?.role==="assistant"&&n.value.includes(x)){x.status="error",x.errorText=M;let V=y[0];x.retryAction=F&&V?.role==="user"?{kind:"resend-user",messageId:V.id}:null,n.value=[...n.value]}else{let V=Lt();V.status="error",V.errorText=M;let ee=y[0];V.retryAction=F&&ee?.role==="user"?{kind:"resend-user",messageId:ee.id}:null,n.value=[...n.value,V]}s.play("error"),a.emit("error",B),r.onError?.(B)}},[t,n,r,a,s,l,c,d,p,_,u,m,f]),P=N(async k=>{let S=m();k.status="pending",k.errorText=void 0,k.retryAction=void 0,n.value.includes(k)&&(n.value=[...n.value]);let b=Ma({messages:[Fa(k)],conversationId:S,visitorId:c,userPrefs:l.loadUserPrefs()}),x=t.sendTurn(b);f.beginRouted(x,k.id);try{let y=await x;if(o.value!==S){f.rejectRouted(x);return}if(!f.acceptRoutedAck(x,y))return;d(y.conversationId),po(t,n.value,k,y.conversationId,r.strings.newConversation),k.status==="pending"&&(k.status="complete",n.value.includes(k)&&(n.value=[...n.value]))}catch(y){let w=f.rejectRouted(x);if(o.value!==S)return;if(!w){po(t,n.value,k,S,r.strings.newConversation),k.status==="pending"&&(k.status="complete",n.value.includes(k)&&(n.value=[...n.value]));return}if(k.status!=="pending"){po(t,n.value,k,S,r.strings.newConversation);return}Lg.debug("operator-routed send failed",{error:y});let D=y instanceof Error?y:new Error(String(y));k.status="error",k.errorText=rn(y,r.strings),k.retryAction=jd(y)?{kind:"resend-user",messageId:k.id}:null,n.value.includes(k)&&(n.value=[...n.value]),s.play("error"),a.emit("error",D),r.onError?.(D)}},[t,n,r,a,s,l,c,d,m,f]);return{sendAiTurn:h,sendRoutedTurn:P}}var Og=ne.scope("unread");function Zd(e){let{transport:t,options:n,conversationIdSig:o,isConversationVisibleRef:r,activated:a,conversationReady:s}=e,l=mt(!1),c=mt(0),d=O([]),p=O(),_=O(!1),u=N(()=>{let y=o.value,w=r.current()&&p.current===y?y:void 0;l.value=d.current.some(D=>D.hasUnread&&D.conversationId!==w)},[o,l,r]),f=N(y=>{let w=o.value,D=d.current.find(F=>F.conversationId===w),q=Mt(d.current,y),B=q.find(F=>F.conversationId===w),M=y.type==="snapshot"&&w!==void 0&&B?.hasUnread===!0&&p.current===w&&D!==void 0&&D.lastMessageAt!==B.lastMessageAt;M&&(p.current=void 0),d.current=q,u(),M&&(c.value+=1)},[o,u,c]),m=N(()=>{if(u(),!r.current())return;let y=o.value;if(!y||p.current!==y)return;let w=d.current.find(D=>D.conversationId===y);w?.hasUnread&&t.markRead(y,w.lastMessageAt)},[o,r,u,t]),h=N(y=>{o.value===y&&(p.current=void 0,u())},[o,u]),P=N(y=>{o.value===y&&(p.current=y,m())},[o,m]),k=N(y=>p.current===y,[]),S=N((y=!1)=>{n.modules.list.some(w=>w.layout==="chat")&&(_.current||(_.current=!0,t.listConversations({limit:50},y).then(w=>{y||f({type:"snapshot",result:w,requestedRevision:0}),m()}).catch(w=>Og.debug("refreshUnread failed (non-fatal)",{err:w})).finally(()=>{_.current=!1})))},[f,m,n.modules,t]),b=N(y=>{let w=y.conversationId,D=r.current()&&o.value===w&&p.current===w,q=d.current.find(M=>M.conversationId===w),B=D&&(q?.lastMessageAt!==y.lastMessageAt||q.hasUnread);t.publishConversation({...y,hasUnread:!D},!0),B&&t.markRead(w,y.lastMessageAt)},[o,r,t]);L(()=>t.subscribeConversationChanges(f),[f,t]);let x=O(!1);return L(()=>{!a||!s||x.current||(x.current=!0,S())},[a,s,S]),L(()=>{if(!a)return;let y=()=>{document.visibilityState==="visible"&&(m(),S(!0))};return document.addEventListener("visibilitychange",y),()=>document.removeEventListener("visibilitychange",y)},[a,m,S]),{hasUnreadSig:l,transcriptRecoverySig:c,markVisibleConversationRead:m,beginConversationTranscript:h,commitConversationTranscript:P,isConversationTranscriptCommitted:k,recordConversationReply:b}}var fo=ne.scope("settings");function eu(e){let{options:t,persistence:n,transport:o,feedback:r,hostElement:a,bus:s}=e,l=n.loadUserPrefs(),[c,d]=$(()=>l.locale??t.locale),[p,_]=$(()=>l.themeMode??t.themeMode),[u,f]=$(()=>l.textSize??t.textSize),m=N(x=>{n.patchUserPrefs(x),o.saveUserPrefs(n.loadUserPrefs()).catch(y=>fo.warn("saveUserPrefs failed",{err:y}))},[n,o]);L(()=>{l.soundMuted!==void 0&&r.setMuted(l.soundMuted)},[]),L(()=>{a.dataset.theme=p},[a,p,t]),L(()=>{a.dataset.textSize=u},[a,u,t]),L(()=>{let x=!0;return r.mutedSig.subscribe(y=>{if(x){x=!1;return}m({soundMuted:y})})},[r,m]);let h=vn(c,t.availableLocales,t.defaultLocale);L(()=>{o.setLocale(h)},[o,h]),L(()=>{a.dir=es(h)?"rtl":"ltr"},[a,h]),L(()=>{h!==c&&d(h)},[h,c]);let P=N(x=>{fo.info("localeChange",{locale:x}),d(x),m({locale:x}),s.emit("localeChange",x)},[m,s]),k=N(x=>{fo.info("themeChange",{mode:x}),_(x),a.dataset.theme=x,m({themeMode:x}),s.emit("themeChange",x)},[a,m,s]),S=N(x=>{fo.info("textSizeChange",{size:x}),f(x),a.dataset.textSize=x,m({textSize:x}),s.emit("textSizeChange",x)},[a,m,s]),b=N(()=>{r.toggleMuted();let x=r.mutedSig.value;fo.info("soundToggle",{muted:x}),s.emit("soundToggle",{muted:x})},[r,s]);return{activeLocale:c,activeThemeMode:p,activeTextSize:u,effectiveLocale:h,setActiveLocale:d,setActiveThemeMode:_,setActiveTextSize:f,patchAndSync:m,handleLocaleChange:P,handleThemeChange:k,handleTextSizeChange:S,handleSoundToggle:b}}var he=ne.scope("app"),Hr=R.cssPrefix;function tu(e,t){return _l({...e,text:Qe(t,e.text)})}function nu({options:e,hostElement:t,bus:n}){let o=e.aiAgentDeploymentId;if(!o)throw new Error("aiAgentDeploymentId is required");let[r]=$(()=>hn(e.widgetId,e.storage,e.aiAgentDeploymentId)),[a,s]=$(()=>r.getVisitorId()),l=r.loadUserPrefs(),c=mt(r.loadConversationId()),d=O(c.value!==void 0),p=mt(c.value??""),_=mt([]),[u,f]=$(!1),m=O(),[h,P]=$([]);function k(){let v=e.modules.list,A=new Set(v.map(K=>K.id)),X=r.loadActiveModule();return X&&A.has(X)?X:v[0]?.id??""}function S(){return e.modules.list.find(v=>v.layout==="chat")?.id}function b(){let v=S();return v?e.modules.list.length===1?!0:y.sig.value.activeTab===v:!1}let x=O();if(!x.current){let v=e.modules.list.map(X=>X.id),A=r.loadActiveModule()??v[0]??"";x.current=fd(A,A?[...v,A]:v,X=>r.saveActiveModule(X))}let y=x.current,w=ut(()=>y.sig.value.activeTab).value,D=ut(()=>c.value).value,[q,B]=$(!1),[M,F]=$(null),[H,V]=$(!1),ee=e.mode==="standalone"||e.mode==="inline",W=O(Yn(e,xn(),r.loadPanelOpen(),r.loadPanelSize())),[se,ae]=$(W.current.panelOpen),[xe,ue]=$(W.current.panelOpen),ye=O(),pe=O(),Ze=O(!1),ot=O(void 0);L(()=>{se&&ue(!0)},[se]);let ct=O(!1),[Ge,je]=$(!1),{dismissed:Ye,dismissCallout:Je}=$d({callout:e.launcher.callout,persistence:r}),_t=e.launcher.callout?.persistent??!0,Pe=N(()=>{he.info("calloutDismiss"),n.emit("calloutDismiss",void 0),Je()},[n,Je]),[Fe,Ve]=$(W.current.panelSize),et=O(!1),[pt,z]=$("chat"),G=O(()=>!1);G.current=()=>se&&pt==="chat"&&!document.hidden&&b();let[J,C]=$(!0),g=O(J);g.current=J;let[E,Q]=$(!1),j=O(E);j.current=E;let Z=O(null),[Se,ge]=$(!1),[ke,be]=$(null),[We,Le]=$([]),St=O(e.strings),rt=O(e);rt.current=e;let[Dt,mo]=$(void 0),[Vr,go]=$(void 0),[cu,du]=$(()=>r.loadSidebarCollapsed()??!1),[Wr,uu]=$({}),[ce]=$(()=>new nr({agentApiBaseUrl:e.agentApiBaseUrl,dataApiBaseUrl:e.dataApiBaseUrl,auth:Zs({publicKey:e.publicKey,aiAgentDeploymentId:o,publicKeyHeader:"x-public-key"}),endpoints:e.endpoints})),[at]=$(()=>new dr(e.sound,e.haptics)),$t=Gd({transport:ce,setStreaming:Q}),{activeLocale:vo,activeThemeMode:yi,activeTextSize:Pi,effectiveLocale:ln,setActiveLocale:_u,setActiveThemeMode:pu,setActiveTextSize:fu,patchAndSync:xi,handleLocaleChange:mu,handleThemeChange:gu,handleTextSizeChange:vu,handleSoundToggle:hu}=eu({options:e,persistence:r,transport:ce,feedback:at,hostElement:t,bus:n}),{controlModeSig:kt,assignedOperatorInitialsSig:bu,operatorAvailableSig:yu,applyControlState:cn,adoptControlStateChunk:Pu,requestOperator:xu,cancelOperatorRequest:Su}=Fd({transport:ce,conversationIdSig:c}),{hasUnreadSig:ku,transcriptRecoverySig:wu,markVisibleConversationRead:Si,beginConversationTranscript:Kr,commitConversationTranscript:dn,isConversationTranscriptCommitted:ki,recordConversationReply:Cu}=Zd({transport:ce,options:e,conversationIdSig:c,isConversationVisibleRef:G,activated:xe,conversationReady:q});L(()=>{Si()},[w,se,pt,D,Si]),L(()=>{at.update(e.sound,e.haptics)},[at,e.sound,e.haptics]),L(()=>()=>at.destroy(),[at]),L(()=>{et.current||!e.size.initialSize||(et.current=!0,!r.loadPanelSize()&&Ve(Aa(e.mode,e.size,xn())))},[e.mode,e.size,r]),L(()=>{if(!q||ct.current)return;ct.current=!0;let v=Yn(e,xn(),r.loadPanelOpen(),r.loadPanelSize());ae(v.panelOpen),Ve(v.panelSize)},[q,e,r]);let wi=O(null);L(()=>{q&&y.reconcile(e.modules.list.map(v=>v.id),k())},[q,e.modules.list,y]);let ho=N(v=>{!v||v.length===0||(_.value=v.map(A=>tu(A,St.current)))},[_]),Gr=O(null),bo=N(async v=>{try{let{formSubmissions:A}=await(v?ce.bootstrap(v):Gr.current??ce.bootstrap()),X=new Map;return A.forEach((K,re)=>X.set(K.formId,re)),A.filter((K,re)=>!K.skipped||X.get(K.formId)===re).map((K,re)=>({key:`wire:${K.formId}:${K.createdAt??re}`,formId:K.formId,outcome:K.skipped?"skipped":"submitted",createdAt:Zo(K.createdAt),values:K.values}))}catch(A){return he.debug("bootstrap failed \u2014 no form markers (non-fatal)",{err:A}),[]}},[ce]),Ln=O(0),wt=O(0),jr=N((v,A)=>{if(v===c.value)return;let X=c.value;wt.current++,f(!1),X&&(r.saveDraft(v,r.loadDraft(X)),r.saveDraft(X,"")),c.value=v,r.saveConversationId(v),ce.primeIdentity(void 0,v),he.info("conversation rebound",{previous:X,current:v,reason:A}),X&&n.emit("conversationRebound",{previous:X,current:v,...A?{reason:A}:{}})},[n,c,r,ce]),yo=N((v,A)=>{let X=[...v.map(I=>I.createdAt),...A.map(I=>I.createdAt)].filter(I=>I!==void 0),K=(X.length?Math.min(...X):Date.now())-1;return[...(ot.current?.messages??[]).map(I=>{let Oe=tu(I,St.current);return Oe.createdAt=K,Oe}),...v]},[]),Ci=N(async v=>{let A=wt.current,X=()=>A!==wt.current||c.value!==v;pe.current===v&&(pe.current=void 0),f(!0);try{let[K,re]=await Promise.all([ce.loadConversation(v),bo()]);if(X())return!1;let I=Ht(K.messages??[]);P(re);let Oe=yo(Ua(I,_.value),re);if(_.value=Oe,pe.current=Oe.some(we=>we.role==="user")?void 0:v,I.length>0||K.controlState!==void 0){C(K.canContinue??!0),cn(Bt(K.controlState));let we=I.findLast(it=>it.role==="assistant"&&!it.ephemeral);Le(we?.suggestions??K.suggestions??[])}return!0}catch(K){return X()||(he.warn("loadThread failed; keeping conversation active",{err:K,conversationId:v}),n.emit("error",K),rt.current.onError?.(K)),!1}finally{X()||f(!1)}},[ce,bo,_,c,yo,n]),Ru=N(v=>{if(ye.current===v)return ye.current=void 0,Ci(v)},[Ci]),Tu=N(()=>{if(m.current)return Promise.resolve(void 0);let v=c.value,A=_.value.find(I=>!I.ephemeral),X=A?.serverMessageId??A?.id;if(!v||!X)return Promise.resolve(void 0);let K=wt.current,re={};return m.current=re,(async()=>{try{let I=await ce.loadConversation(v,{beforeId:X});if(m.current!==re||wt.current!==K||c.value!==v)return;if(I.messages.length===0)return!1;let Oe=I.messages.map($a),_e=_.value,we=gl(_e,Oe);if(we!==_e){let it=Math.min(...Oe.map(Ct=>Ct.createdAt??1/0),...h.map(Ct=>Ct.createdAt??1/0));if(Number.isFinite(it))for(let Ct of _e){if(!Ct.ephemeral)break;(Ct.createdAt??1/0)>=it&&(Ct.createdAt=it-1)}_.value=we}return!0}catch(I){if(m.current!==re||wt.current!==K||c.value!==v)return;he.warn("load previous messages failed",{err:I,conversationId:v,beforeId:X}),n.emit("error",I),e.onError?.(I);return}finally{m.current===re&&(m.current=void 0)}})()},[n,c,h,_,e,ce]),On=N(async({newConversation:v})=>{let A=++Ln.current,X=()=>A!==Ln.current,K=c.value,re=v||!K?dt():K;re!==K&&(wt.current++,f(!1),ft(()=>{c.value=re,p.value=re}),r.saveConversationId(re)),ce.primeIdentity(a,re);let I;try{I=await ce.handshake({visitorId:a,conversationId:re,userPrefs:r.loadUserPrefs(),locale:vo})}catch(_e){if(X())return;n.emit("error",_e),e.onError?.(_e),v||B(!0);return}if(X())return;if(I.visitorId&&I.visitorId!==a&&(he.info("visitor rebound",{previous:a,current:I.visitorId,reason:I.rebind?.visitorId}),r.setVisitorId(I.visitorId),s(I.visitorId),n.emit("visitorRebound",{previous:a,current:I.visitorId,reason:I.rebind?.visitorId})),I.conversationId!==re&&jr(I.conversationId,I.rebind?.conversationId),I.agent&&be(I.agent),cn(Bt(I.controlState)),e.mode==="page"&&(I.site&&Js(I.site)?mo(I.site):I.site&&he.warn("invalid site config, using fallback",{site:I.site}),I.blocks&&Qs(I.blocks)?go(I.blocks):I.blocks&&he.warn("invalid blocks config, using fallback",{blocks:I.blocks})),I.userPrefs&&!v&&(r.saveUserPrefs(I.userPrefs),I.userPrefs.locale&&_u(I.userPrefs.locale),I.userPrefs.soundMuted!==void 0&&at.setMuted(I.userPrefs.soundMuted),I.userPrefs.themeMode&&pu(I.userPrefs.themeMode),I.userPrefs.textSize&&fu(I.userPrefs.textSize)),ot.current=I.welcome,v||n.emit("handshake",I),I.welcome?.suggestions){let _e=St.current;Le(I.welcome.suggestions.map(we=>({...we,label:Qe(_e,we.label),...we.text===void 0?{}:{text:Qe(_e,we.text)}})))}let Oe=!v&&K&&I.conversationId===K;d.current=!!Oe,Oe?Ze.current||(ye.current=I.conversationId):(pe.current=I.conversationId,ho(I.welcome?.messages),dn(I.conversationId)),v||B(!0)},[ce,a,r,e,n,c,p,at,ho,vo,jr,dn]),Nn=JSON.stringify(e.userContext??null),Iu=JSON.stringify(e.pageContext??null),Eu=JSON.stringify(Wr);L(()=>{let v=Object.keys(Wr).length?{...Wr,...e.userContext}:e.userContext;ce.setContext(v,Ng(e.pageContext))},[ce,Nn,Iu,Eu]);let Ri=N((v,A=[])=>Le(v.suggestions??A),[]);L(()=>(ce.primeIdentity(a,c.value),On({newConversation:!1}),()=>{Ln.current++,wt.current++}),[]),L(()=>{!xe||!q||Ze.current||(Ze.current=!0,Gr.current=ce.bootstrap(),(async()=>{try{let v=await Gr.current;F(qn((v??{forms:[]}).forms,ln))}catch(v){he.debug("bootstrap failed \u2014 treating as no forms",{err:v})}finally{V(!0)}})(),ye.current===c.value&&f(!0))},[xe,q]);let Po=O(null);L(()=>{if(!xe||!q)return;if(Po.current===null){Po.current=ln;return}if(Po.current===ln)return;Po.current=ln;let v=!1;return ce.bootstrap().then(A=>{v||F(qn((A??{forms:[]}).forms,ln))}).catch(A=>he.debug("forms re-localize failed \u2014 keeping current copy",{err:A})),()=>{v=!0}},[xe,q,ln,ce]);let Ti=O(Nn);L(()=>{!q||Ti.current===Nn||(Ti.current=Nn,On({newConversation:!1}))},[Nn,q,On]),Ud({hostElement:t,mode:e.mode,panelSize:Fe,isOpen:se,surfaceReady:q,setIsOpen:ae});let{sendAiTurn:Kt,sendRoutedTurn:Dn}=Qd({transport:ce,messagesSig:_,conversationIdSig:c,options:e,bus:n,feedback:at,persistence:r,visitorId:a,adoptConversationId:jr,applyControlState:cn,setCanSend:C,settleSuggestions:Ri,runCancellation:$t}),{toolInteraction:Au}=Dd({streaming:E,controlModeSig:kt,messagesSig:_,sendAiTurn:Kt,bus:n,humanInLoop:e.features.humanInLoop}),Mu=N((v,A)=>{let X=_.value.find(K=>K.serverMessageId===v);X&&(X.feedback=A),he.info("messageFeedback",{messageId:v,value:A}),n.emit("messageFeedback",{messageId:v,value:A}),ce.submitFeedback({messageId:v,value:A})},[n,_,ce]),Lu=()=>_.value.reduce((v,A)=>v+(A.role==="user"?1:0),0),un=e.forms.list.length>0?e.forms:M??e.forms,Ee=cd({forms:un,persistence:r,userContext:()=>e.userContext,messageCount:Lu,pageArea:()=>e.pageContext?.area?String(e.pageContext.area):void 0,conversationId:()=>c.value,onComplete:(v,A,X,K)=>{he.info("formSubmit",{formId:v.id,trigger:A,skipped:K}),n.emit("formSubmit",{formId:v.id,values:X,skipped:K}),P(I=>{let _e=I.find(we=>we.formId===v.id&&we.outcome==="skipped")?.createdAt??Date.now();return[...I.filter(we=>!(we.formId===v.id&&we.outcome==="skipped")),{key:`local:${v.id}:${_e}`,formId:v.id,outcome:K?"skipped":"submitted",createdAt:_e,...K?{}:{values:X}}]});let re=c.value??dt();c.value||(c.value=re,r.saveConversationId(re),ce.primeIdentity(void 0,re)),!K&&v.mirrorToContext&&uu(I=>({...I,...X})),ce.submitForm({formId:v.id,conversationId:re,trigger:A,values:X,skipped:K})}}),Xr=ut(()=>Ee.activeForm.value),Ou=N(()=>Ee.fire("after-messages"),[Ee]),Nu=N(()=>d.current||_.value.some(v=>!v.ephemeral&&v.role==="user"),[_]);Kd({activated:xe,conversationReady:q,conversationIdSig:c,messagesSig:_,optionsRef:rt,transport:ce,visitorId:a,adoptControlStateChunk:Pu,settleSuggestions:Ri,recordConversationReply:Cu,transcriptRecoverySig:wu,beginConversationTranscript:Kr,commitConversationTranscript:dn,onReplyLanded:Ou,runCancellation:$t,canContinueRef:g,setCanSend:C,feedback:at,bus:n,loadInitialThread:Ru,shouldReconcileOnConnect:Nu}),L(()=>{Ee.refresh()},[un,Ee]);let Ii=e.pageContext?.area?String(e.pageContext.area):void 0,Du=ut(()=>_.value.length);L(()=>{q&&H&&Ee.fire("pre-chat")},[q,H,Ee]),L(()=>{H&&!J&&Ee.fire("conversation-closed")},[H,J,Ee]),L(()=>{q&&H&&Ii&&Ee.fire("page-area")},[q,H,Ii,Ee]);let Yr=ie(()=>{let v=un.list.flatMap(A=>A.triggers).filter(A=>A.kind==="idle").map(A=>Number(A.param));return v.length?Math.min(...v)*1e3:0},[un]);L(()=>{if(!Yr||!se)return;let v=setTimeout(()=>Ee.fire("idle"),Yr);return()=>clearTimeout(v)},[Yr,se,Ee,Du.value]);let Ei=N(async(v,A)=>{if(Z.current)return!1;let X=c.value,K=kt.value!=="ai-agent";if(he.info("send",{textLen:v.length,attachments:A.length,streaming:j.current,routedToOperator:K}),j.current&&!K)return!1;let re=new AbortController,I={conversationId:X,controller:re};Z.current=I,ge(!0);try{at.unlock();let Oe=await $g(ce,A,re.signal,it=>{re.signal.aborted||(he.warn("upload failed",{err:it}),n.emit("error",it),e.onError?.(it))});if(re.signal.aborted||c.value!==X||!g.current||Ee.activeForm.value)return!1;let _e=kt.value!=="ai-agent";if(j.current&&!_e||!v&&Oe.length===0)return!1;n.emit("send",{text:v,attachmentCount:A.length}),We.length>0&&Le([]),at.play("messageSent");let we=Da(v,Oe);return Mn(n,e,"user",v),_e?(_.value=[..._.value,we],Dn(we),!0):(_.value=[..._.value,we,Lt()],Kt({continueExisting:!1}),!0)}finally{Z.current===I&&(Z.current=null,ge(!1))}},[ce,n,e,We.length,_,c,Kt,Dn,kt]);L(()=>{let v=c.value;return()=>{let A=Z.current;!A||A.conversationId!==v||(Z.current=null,ge(!1),A.controller.abort())}},[c.value]),L(()=>{J&&!Xr.value||Z.current?.controller.abort()},[Xr.value,J]);let $u=N(()=>{if(!$t.stop())return;he.info("stop"),n.emit("stop",void 0);let v=_.value.at(-1);v&&v.role!=="user"&&v.status==="streaming"&&(v.canceled=!0,_.value=[..._.value])},[$t,n,_]),Fu=N(v=>{if(E)return;let A=_.value,X=sr(A,v);if(X)switch(he.info("retry",{kind:X.kind,messageId:X.messageId}),X.kind){case"continue-assistant":{if(kt.value!=="ai-agent"||v.role!=="assistant"||(v.serverMessageId??v.id)!==X.messageId)return;v.status="streaming",v.errorText=void 0,v.retryAction=void 0,v.awaitingContinuation=!0,_.value=[...A],Kt({continueExisting:!0,turn:v});return}case"resend-user":{let K=A.find(I=>I.role==="user"&&I.id===X.messageId);if(!K)return;if(K.status="complete",K.errorText=void 0,K.retryAction=void 0,kt.value!=="ai-agent"){_.value=v.role==="assistant"?A.filter(I=>I!==v):[...A],Dn(K);return}let re=Lt();_.value=v.role==="assistant"?A.map(I=>I===v?re:I):[...A,re],Kt({continueExisting:!1,turn:K});return}case"repeat-user":{let K=A.find(_e=>_e.role==="user"&&_e.id===X.messageId);if(!K)return;let re=Da(De(K),K.attachments?.map(_e=>({..._e}))??[]),I=new Set(re.attachments?.flatMap(_e=>_e.url?[_e.url]:[])??[]),Oe=K.partsSig.value.flatMap(_e=>_e.kind==="file"&&!I.has(_e.url)?[{..._e}]:[]);if(Oe.length>0&&(re.partsSig.value=[...re.partsSig.value,...Oe]),kt.value!=="ai-agent"){_.value=[...A,re],Dn(re);return}_.value=[...A,re,Lt()],Kt({continueExisting:!1,turn:re});return}default:return X}},[E,_,kt,Kt,Dn]),$n=N(()=>{if(cc(e.mode,Fe)==="exit-fullscreen"){he.info("close \u2192 exit-fullscreen",{mode:e.mode}),Ve("normal"),n.emit("fullscreen",!1);return}he.info("close \u2192 panel closed",{mode:e.mode}),Ee.fire("panel-close"),ae(!1),r.savePanelOpen(!1),n.emit("close",void 0),e.onClose?.()},[n,e,r,Fe,Ee]),Jr=N(()=>{he.info("open",{mode:e.mode}),at.unlock(),je(!0),ae(!0),r.savePanelOpen(!0),!Ye&&!_t&&Pe(),setTimeout(()=>je(!1),Dg),n.emit("open",void 0),e.onOpen?.()},[n,e,at,r,Ye,_t,Pe]),Qr=N(()=>{let v=_.value.some(A=>A.role==="user");if(pe.current===c.value&&!v&&J&&c.value){he.info("clear \u2192 reusing empty conversation",{conversationId:c.value}),_.value.length===0&&ho(ot.current?.messages);return}he.info("clear \u2192 new conversation",{wasStreaming:E}),n.emit("clear",void 0),$t.settle(),d.current=!1,ye.current=void 0,pe.current=void 0,ft(()=>{_.value=[],c.value=void 0,cn({controlMode:"ai-agent",controlRevision:0})}),r.clearConversation(),C(!0),P([]),Le([]),On({newConversation:!0})},[E,_,c,r,On,n,J,ho,$t,cn]),Zr=N(()=>{Qr(),z("chat");let v=e.modules.list.find(A=>A.layout==="chat")?.id;v&&y.switchTab(v)},[Qr,y,e]),ea=N(()=>{let v=Fe==="expanded"?"normal":"expanded";he.info("expand",{from:Fe,expanded:v==="expanded"}),Ve(v),r.savePanelSize(v),n.emit("expand",v==="expanded")},[n,Fe,r]),ta=N(()=>{let v=Fe==="fullscreen"?"normal":"fullscreen";he.info("fullscreen",{from:Fe,fullscreen:v==="fullscreen"}),Ve(v),r.savePanelSize(v),n.emit("fullscreen",v==="fullscreen")},[n,Fe,r]),Bu=N(()=>{z(v=>{let A=v==="history"?"chat":"history";return he.info("toggleHistory",{view:A}),n.emit("toggleHistory",{view:A}),A})},[n]),Hu=N(()=>{du(v=>{let A=!v;return he.info("sidebarToggle",{collapsed:A}),r.saveSidebarCollapsed(A),n.emit("sidebarToggle",{collapsed:A}),A})},[r,n]),Uu=N(v=>{he.info("resize",v),xi({widgetSize:v}),n.emit("resize",v)},[xi,n]),zu=N(async v=>{let A=v.conversationId;if(A===c.value&&ki(A)){he.info("selectConversation",{conversationId:A,cached:!0}),n.emit("selectConversation",{conversationId:A}),ce.publishConversation(v),z("chat");let I=S();I&&y.switchTab(I),dn(A);return}let K=++Ln.current;wt.current++,f(!1);let re=()=>K!==Ln.current;he.info("selectConversation",{conversationId:A,wasStreaming:E}),n.emit("selectConversation",{conversationId:A}),ce.publishConversation(v);try{let[I,Oe]=await Promise.all([ce.loadConversation(A),bo(A)]);if(re())return;$t.settle(),d.current=!0,ye.current=void 0;let _e=Ht(I.messages),we=I.conversationId!==c.value,it=we?_e:Ua(_e,_.value);pe.current=it.some(So=>So.role==="user")?void 0:I.conversationId,ft(()=>{_.value=yo(it,Oe),we&&(p.value=I.conversationId),c.value=I.conversationId}),P(Oe),r.saveConversationId(I.conversationId),ce.primeIdentity(a,I.conversationId),I.agent&&be(I.agent),C(I.canContinue),cn(Bt(I.controlState));let Ct=it.findLast(So=>So.role==="assistant"&&!So.ephemeral);Le(Ct?.suggestions??I.suggestions??[]),we?Kr(I.conversationId):dn(I.conversationId),z("chat");let Di=S();Di&&y.switchTab(Di)}catch(I){if(re())return;n.emit("error",I),e.onError?.(I)}},[ce,_,c,p,n,e,r,bo,yo,E,a,$t,Kr,dn,ki,y]),xo=O(null),Ai=N(v=>{typeof v=="string"&&(H?Ee.fire("manual",v):xo.current=v)},[H,Ee]);L(()=>{!H||!xo.current||(Ee.fire("manual",xo.current),xo.current=null)},[H,Ee]);let _n=O({handleOpen:Jr,handleClose:$n,handleExpand:ea,handleFullscreen:ta,openForm:Ai});_n.current={handleOpen:Jr,handleClose:$n,handleExpand:ea,handleFullscreen:ta,openForm:Ai},ht(()=>gs(t,{open:()=>_n.current.handleOpen(),close:()=>_n.current.handleClose(),expand:()=>_n.current.handleExpand(),fullscreen:()=>_n.current.handleFullscreen(),openForm:v=>_n.current.openForm(v)}),[t]);let Xe=ie(()=>Sa(e,vo,yi,Pi),[e,vo,yi,Pi]);St.current=Xe.strings;let qu=ie(()=>h.map(v=>{let A=un.list.find(X=>X.id===v.formId);return{...v,title:A?.title,form:A}}),[h,un]),na=v=>{zu(v)},Mi={options:Xe,transport:ce,feedback:at,bus:n,persistence:r,conversationId:c.value??"",composerKey:p.value,composerApiRef:wi,view:pt,canSend:J,isStreaming:E,sendPreparing:Se,composerActive:Xe.mode==="page"||Xe.mode==="inline"||Xe.mode==="standalone"||se,controlMode:kt.value,assignedOperatorInitials:bu.value,operatorAvailable:yu.value,operatorRequestEnabled:e.features.operatorRequest,onRequestOperator:xu,onCancelOperatorRequest:Su,loadingMessages:u,onLoadPreviousMessages:Tu,messagesSig:_,agent:ke,suggestions:We,initialWidgetSize:l.widgetSize??null,onClose:$n,onClear:Qr,onExpand:ea,onFullscreen:ta,onSoundToggle:hu,onToggleHistory:Bu,onSelectHistoryConversation:na,onNewConversation:Zr,onLocaleChange:mu,onThemeChange:gu,onTextSizeChange:vu,onWidgetSizeChange:Uu,onSend:Ei,onStop:$u,onSuggestion:v=>{if(Z.current)return;let A=v.text??v.label;he.info("suggestion",{text:A,autoSend:e.autoSendSuggestions}),n.emit("suggestion",{text:A}),e.autoSendSuggestions?Ei(A,[]):wi.current?.fill(A)},activeForm:Xr.value?.form??null,formMarkers:qu,onFormSubmit:Ee.complete,onFormSkip:Ee.skip,onFormFill:v=>Ee.fire("manual",v),tool:Au,onRetry:Fu,onMessageFeedback:Mu};if(!q)return null;let Fn=Xe.modules.list,oa=v=>{let A=Cn("close",Xe.mode,v);return Fn.length===0?i(Nd,{strings:Xe.strings,onClose:A?$n:void 0}):Fn.length===1&&Fn[0]?.layout==="chat"?i(ld,{...Mi,panelSize:v}):i(Od,{panelProps:{...Mi,panelSize:v,onClose:A?$n:void 0},enabledModules:Fn,nav:y,bus:n,hasUnread:ku.value,onSelectConversation:na,onStartNewConversation:Zr,onSetPanelSize:Ve})};if(e.mode==="page"){let v=Fn.some(A=>A.layout==="chat");return i("div",{class:`${Hr}-anchor`,children:i(_d,{site:Dt,blocks:Vr,transport:ce,strings:Xe.strings,locale:Xe.locale,persistence:r,showConversations:v,onSelectConversation:na,onNewConversation:Zr,sidebarCollapsed:cu,onToggleSidebarCollapsed:Hu,children:oa("fullscreen")})})}if(ee){let v=e.mode==="standalone"?"fullscreen":Fe;return i("div",{class:`${Hr}-anchor`,children:oa(v)})}let Li=e.mode==="drawer",Oi=!(e.mode==="modal")&&!e.launcher.hidden&&(!se||Ge),Ni=Oi&&!Ge&&!Ye&&!Li?Xe.launcher.callout:null;return i("div",{class:`${Hr}-anchor`,"data-launcher-size":Xe.launcher.size,children:[se||xe?i("div",{class:`${Hr}-surface`,hidden:!se,children:oa(Fe)}):null,Oi?i(ic,{onToggle:Jr,launcher:Xe.launcher,strings:Xe.strings,leaving:Ge,edgeTab:Li}):null,Ni?i(sc,{callout:Ni,launcherPosition:Xe.position,strings:Xe.strings,closeLabel:Xe.strings.close,onDismiss:Pe}):null]})}function Ng(e){let t=e?.url??(typeof location<"u"?location.href:void 0);if(!(!e&&!t))return{...e,...t?{url:t}:{}}}var Dg=120;async function $g(e,t,n,o){return(await Promise.all(t.map(async a=>{try{let{id:s,url:l}=await e.uploadFile(a.file,n);return{id:s,name:a.name,mediaType:a.mediaType,size:a.size,url:l}}catch(s){o(s);return}}))).filter(a=>a!==void 0)}var Fg=ne.scope("error-boundary"),Ur=class extends tt{constructor(){super(...arguments);le(this,"state",{crashed:!1})}componentDidCatch(n,o){Fg.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 Bg="1",Hg=60,Ug=2e3,ou={open:()=>{},close:()=>{},expand:e=>({on:e}),fullscreen:e=>({on:e}),send:e=>({attachments:e.attachmentCount}),message:e=>({role:e.role}),stop:()=>{},clear:()=>{},suggestion:()=>{},toggleHistory:e=>({view:e.view}),handshake:()=>{},formSubmit:e=>({formId:e.formId,skipped:e.skipped}),toolResult:()=>{},toolDecision:e=>({approved:e.approved}),messageFeedback:e=>({value:e.value??"none"}),contentView:e=>({section:e.section,tags:e.tags,count:e.count}),contentOpen:e=>({contentId:e.contentId,tags:e.tags}),contentSearch:e=>({qlen:e.queryLength,hits:e.hitCount}),contentRead:e=>({contentId:e.contentId}),contentLinkClick:e=>({contentId:e.contentId}),attach:e=>({count:e.count,bytes:e.totalBytes}),voiceStart:()=>{},voiceStop:e=>({ms:e.durationMs}),voiceCancel:()=>{},localeChange:e=>({locale:e}),themeChange:e=>({theme:e}),textSizeChange:e=>({size:e}),soundToggle:e=>({muted:e.muted}),sidebarToggle:e=>({collapsed:e.collapsed}),calloutDismiss:()=>{},error:()=>{}};function zg(){let e=navigator;return e.globalPrivacyControl===!0||e.doNotTrack==="1"}function qg(){return location.origin+location.pathname}function Vg(){try{return document.referrer?new URL(document.referrer).origin:""}catch{return""}}function ru(e,t){let n=Math.random(),o=0,r=0,a=new Set,s=(c,d)=>{let{tracking:p,publicKey:_,aiAgentDeploymentId:u,mode:f,themeMode:m}=t.getOptions();if(!p.enabled||zg()||n>=p.sampleRate)return;let h=performance.now();if(h-o>6e4&&(o=h,r=0),++r>Hg)return;let P=new URLSearchParams;P.set("v",Bg),P.set("_ev",fn),P.set("e",c),p.token&&P.set("tk",p.token),_&&P.set("pk",_),u&&P.set("dep",u),P.set("vid",t.getVisitorId());let k=t.getConversationId();k&&P.set("cid",k),P.set("url",qg());let S=Vg();S&&P.set("ref",S),P.set("sw",String(screen.width)),P.set("sh",String(screen.height)),P.set("vw",String(innerWidth)),P.set("vh",String(innerHeight)),P.set("dpr",String(devicePixelRatio)),P.set("lang",navigator.language);try{P.set("tz",Intl.DateTimeFormat().resolvedOptions().timeZone)}catch{}if(P.set("m",f),P.set("th",m),d)for(let[w,D]of Object.entries(d))D!==void 0&&P.set(w,String(D));P.set("ts",String(Date.now()));let b=`${p.endpoint}?${P}`;if(b.length>Ug)return;let x=new Image(1,1);a.add(x);let y=()=>a.delete(x);x.addEventListener("load",y,{once:!0}),x.addEventListener("error",y,{once:!0}),x.src=b},l=Object.keys(ou).map(c=>e.on(c,d=>s(c,ou[c]?.(d))));return()=>{for(let c of l)c();a.clear()}}function au(e){let{bus:t,host:n,appRoot:o,persistence:r,reportError:a}=e,s=e.initialRaw,l,c=gn(s),d=!0,p=()=>{c=gn(l?ka(s,l):s)},_=()=>{ws(n,Wn(c.mode));let m=r.loadUserPrefs().themeMode;Cs(n,m?{...c,themeMode:m}:c),d&&(Ho(n,zr(c)),d=!1)},u=()=>{_(),zn(Tt(Ur,{onError:a},Tt(nu,{bus:t,hostElement:n,options:c})),o)};t.on("handshake",m=>{m.config&&(m.config.storageVersion&&r.rememberStorageVersion(m.config.storageVersion),l=m.config,p(),u())});let f=ru(t,{getOptions:()=>c,getVisitorId:()=>r.getVisitorId(),getConversationId:()=>r.loadConversationId()});return{getOptions:()=>c,getUserOptions:()=>s,render:u,setUserOptions:m=>{s=m,p(),u()},patchUserOptions:m=>{s={...s,...m},p(),u()},destroy:()=>f()}}function zr(e){if(e.mode==="standalone")return"standalone";if(e.mode==="inline")return"inline";let t=hn(e.widgetId,e.storage,e.aiAgentDeploymentId),{panelOpen:n,panelSize:o}=Yn(e,xn(),t.loadPanelOpen(),t.loadPanelSize());return Qo(e.mode,o,n)}var Wg=ne.scope("hooks"),qr="*",bi=new Set;function iu(e,t,n){let o={widgetId:e,event:t,listener:n};return bi.add(o),()=>{bi.delete(o)}}function Kg(e,t,n){let o=[...bi];for(let r of o)if(Gg(r.widgetId,e.widgetId)&&!(r.event!==qr&&r.event!==t))try{r.listener(e,t,n)}catch(a){Wg.warn("hook listener threw",{event:t,error:a})}}function su(e,t){let n=[];for(let o of jg)n.push(t.on(o,r=>{Kg(e,o,r)}));return()=>{for(let o of n)o()}}function Gg(e,t){return e===qr||e===t}var jg=["open","close","expand","fullscreen","resize","message","send","stop","clear","selectConversation","suggestion","toggleHistory","formSubmit","toolResult","toolDecision","messageFeedback","contentView","contentOpen","contentSearch","contentRead","contentLinkClick","attach","removeAttachment","voiceStart","voiceStop","voiceCancel","localeChange","themeChange","textSizeChange","soundToggle","sidebarToggle","calloutDismiss","error","handshake","visitorRebound","conversationRebound"];var Nt=new Map;function lu(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");e.debug!==void 0&&Do(e.debug);let t=ne.scope("mount");t.info("mount",{widgetId:e.widgetId,publicKey:e.publicKey,mode:e.presentation?.mode});let n=gn(e),o=n.widgetId,r=Nt.get(o);r&&(t.debug("destroy existing instance at slot",{widgetId:o}),r.destroy());let a=zr(n),s=n.iframe?Is({position:Wn(n.mode)},n.position,a,n.mode,e.target??null):Bo({position:Wn(n.mode),target:e.target??null});s.hostElement.dataset.widgetId=o;let l=new zo,c=hn(o,n.storage,n.aiAgentDeploymentId),d=h=>{l.emit("error",h),p.getOptions().onError?.(h)},p=au({bus:l,host:s.hostElement,appRoot:s.appRoot,persistence:c,initialRaw:e,reportError:d});p.render();let _=s.hostElement,u=null,f=h=>{h.debug!==void 0&&Do(h.debug),p.patchUserOptions(h)},m={widgetId:o,open:()=>Vn(_,"open"),close:()=>Vn(_,"close"),expand:()=>Vn(_,"expand"),openForm:h=>Vn(_,"openForm",h),on:(h,P)=>l.on(h,P),update:h=>{t.debug("update",{patch:h}),f(h)},setUserContext:h=>{t.debug("setUserContext",{keys:Object.keys(h)}),f({userContext:{...p.getUserOptions().userContext,...h}})},clearUserContext:()=>{t.debug("clearUserContext"),f({userContext:void 0})},setPageContext:h=>{t.debug("setPageContext",{keys:Object.keys(h)}),f({pageContext:{...p.getUserOptions().pageContext,...h}})},clearPageContext:()=>{t.debug("clearPageContext"),f({pageContext:void 0})},setDebug:h=>{Do(h),t.info("debug level set",{level:va()})},debugLevel:()=>va(),onLog:h=>is(h),destroy:()=>{t.info("destroy",{widgetId:o}),u?.(),p.destroy(),l.clear(),zn(null,s.appRoot),s.destroy(),Nt.get(o)===m&&Nt.delete(o)}};return u=su(m,l),Nt.set(o,m),m}function Xg(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");let t=e.widgetId??"default",n=Nt.get(t);return n?(n.update(e),n):lu(e)}function Yg(e){if(e!==void 0){Nt.get(e)?.destroy();return}let t=[...Nt.values()];for(let n of t)n.destroy()}function Jg(e="default"){return Nt.get(e)??null}function Qg(){return[...Nt.values()]}function Zg(e,t,n){return iu(e,t,n)}var ev=fn,tv=R;
|
|
41
|
+
`).trim(),G=!h&&t!=="error"&&!y.value&&K.length>0,X=D||G;return i("div",{class:`${Ye}-bubble-row`,"data-role":e.role,"data-testid":Xe(R.messageBubble,e.serverMessageId??e.id),children:i("div",{class:`${Ye}-bubble-col`,children:[i("div",{class:`${Ye}-bubble`,children:[e.role==="operator"&&e.operatorInitials?i("span",{class:`${Ye}-bubble-author`,children:e.operatorInitials}):null,i("div",{class:`${Ye}-bubble-body`,children:[w?i(Gm,{label:n.loading}):g.map((U,_e)=>i(zm,{part:U,active:E,live:P,strings:n,showReasoning:r,showToolCalls:a,showSources:s,interactive:l&&t==="complete"&&(U.kind!=="tool"||cr(e,_e)),superseded:c,continuationStreaming:e.continuationStreaming===!0,tool:d},`${Wm(U)}#${_e}`)),Q&&i(Km,{}),t==="error"||y.value?i("div",{class:`${Ye}-error`,role:"alert",children:[i("span",{children:e.errorText??n.errorGeneric}),_?i("button",{type:"button",class:`${Ye}-error-retry`,onClick:()=>_(e),"data-testid":R.messageRetry,children:n.errorRetry}):null]}):null]})]}),z||X?i("div",{class:`${Ye}-bubble-meta`,children:[z?i("time",{class:`${Ye}-bubble-time`,dateTime:z.iso,title:z.full,children:z.short}):null,X?i("div",{class:`${Ye}-bubble-actions`,children:[D&&e.serverMessageId?i(Yc,{messageId:e.serverMessageId,initial:e.feedback??null,strings:n,onFeedback:u}):null,G?i(Hm,{text:K,strings:n}):null]}):null]}):null]})})}function Hm({text:e,strings:t}){let[n,o]=$(!1),r=()=>{navigator.clipboard?.writeText(e).then(()=>{o(!0),setTimeout(()=>o(!1),1500)}).catch(()=>{})},a=n?t.copied:t.copy;return i("button",{type:"button",class:`${Ye}-msg-action`,"data-active":n?"true":void 0,"aria-label":a,title:a,onClick:r,"data-testid":R.messageCopy,children:n?i(on,{}):i(ac,{})})}function Um(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 zm({part:e,active:t,live:n,strings:o,showReasoning:r,showToolCalls:a,showSources:s,interactive:l,superseded:c,continuationStreaming:d,tool:_}){switch(e.kind){case"step-start":return null;case"text":return i(Lr,{textSig:e.textSig,doneSig:e.doneSig});case"reasoning":return r?i(Vm,{part:e,active:t,strings:o}):null;case"tool":return i(qm,{part:e,strings:o,showToolCalls:a,interactive:l,superseded:c,continuationStreaming:d,live:n,tool:_});case"file":return e.mediaType.startsWith("image/")?i("img",{src:e.url,alt:"",loading:"lazy"}):i("a",{href:e.url,target:"_blank",rel:"noreferrer noopener",children:e.url});case"source":return s?i(Jc,{part:e,strings:o}):null}}function qm({part:e,strings:t,showToolCalls:n,interactive:o,superseded:r,continuationStreaming:a,live:s,tool:l}){let c=oe(()=>pe(()=>e.approvalSig.value!==void 0),[e]);return l?.humanInLoop&&c.value?Tr(e.toolName)?i(nd,{part:e,strings:t,active:o,superseded:r,continuationStreaming:a,onDecision:l.onDecision,onEdit:l.onEdit}):i(Zc,{part:e,strings:t,active:o,superseded:r,continuationStreaming:a,onDecision:l.onDecision,onEdit:l.onEdit}):n?i(rd,{part:e,strings:t,live:s}):null}function Vm({part:e,active:t,strings:n}){return i("details",{class:`${Ye}-reasoning`,"data-testid":R.reasoning,open:t,"data-active":t?"true":void 0,children:[i("summary",{class:`${Ye}-reasoning-summary`,children:i("span",{class:`${Ye}-reasoning-label`,children:t?n.thinking:n.thoughts})}),i("div",{class:`${Ye}-reasoning-body`,children:i(Lr,{textSig:e.textSig,doneSig:e.doneSig})})]})}function Wm(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 Km(){return i("span",{class:`${Ye}-typing`,"data-testid":R.typingDots,"aria-hidden":"true",children:[i("span",{}),i("span",{}),i("span",{})]})}function Gm({label:e}){return i("span",{class:`${Ye}-loading`,role:"status",children:[i("span",{class:`${Ye}-loading-spinner`,"aria-hidden":"true"}),i("span",{class:`${Ye}-loading-label`,children:e})]})}var jt=T.cssPrefix,mi=120,jm=350;function id({messagesSig:e,strings:t,responseMode:n,showReasoning:o,showToolCalls:r,showSources:a,enableMessageFeedback:s,onFeedback:l,loading:c,onLoadPreviousMessages:d,idle:_,controlMode:p="ai-agent",tool:u,onRetry:m,form:g,formMarkers:y,onFillForm:S}){let k=N(null),x=dt(()=>e.value),[h,P]=$(!1),[b,w]=$(!1),E=N(!1),Q=N(!1),[z,A]=$(),D=N(!1),K=N(!1),G=N(!1),X=N(0),U=()=>G.current||performance.now()-X.current<jm,_e=N(0),ie=f=>{let F=f.scrollHeight-f.clientHeight>1;f.dataset.fadeTop=F&&f.scrollTop>1?"true":"false",f.dataset.fadeBottom=F&&f.scrollHeight-f.scrollTop-f.clientHeight>1?"true":"false"},Re=f=>P(f.scrollHeight-f.scrollTop-f.clientHeight>mi*2),ue=f=>{_e.current=performance.now(),f.scrollTop=f.scrollHeight,ie(f)},be=(f,F)=>{ue(f);let j=F,Y=0,re=()=>{K.current||U()||(ue(f),--j>0&&(Y=requestAnimationFrame(re)))};return F>0&&(Y=requestAnimationFrame(re)),()=>cancelAnimationFrame(Y)},Ae=(f,F)=>{let j,Y,re,me=-1,I=()=>{j.disconnect(),Y.disconnect(),clearTimeout(re)},M=()=>{if(K.current||U()||me>=0&&f.scrollTop<me-4)return I();ue(f),me=f.scrollTop};return j=new ResizeObserver(M),Y=new MutationObserver(M),M(),j.observe(f),Y.observe(f,{childList:!0,subtree:!0,characterData:!0}),re=setTimeout(I,F),I},Me=x.value[0]?.id;xt(()=>{let f=k.current;if(f&&x.value.length!==0&&!Q.current&&(D.current=!0,!!x.value.some(F=>F.role==="user")))return Ae(f,300)},[Me]);let qe=N(0);O(()=>{let f=k.current,F=x.value,j=qe.current;if(qe.current=F.length,!f||!D.current||Q.current)return;if(F.slice(j).some(re=>re.role==="user"))return K.current=!1,be(f,3);if(!F.some(re=>re.role==="user")||K.current||U())return;f.scrollHeight-f.scrollTop-f.clientHeight<mi&&ue(f)},[x.value.length]);let at=N(null);O(()=>{let f=k.current,F=x.value.at(-1),j=at.current;if(at.current=F?{id:F.id,streaming:F.status==="streaming"}:null,!!f&&D.current&&!(!F||F.id!==j?.id||j.streaming||F.status!=="streaming"))return K.current=!1,be(f,3)},[x.value]),O(()=>{let f=k.current;if(!f)return;let F=x.value.at(-1);if(!F||F.status!=="streaming"&&!x.value.some(re=>re.role==="user"))return;let j=()=>{if(K.current||U())return;f.scrollHeight-f.scrollTop-f.clientHeight<mi*2&&ue(f)};if(F.status!=="streaming")return Ae(f,300);j();let Y=new MutationObserver(j);return Y.observe(f,{childList:!0,subtree:!0,characterData:!0}),()=>Y.disconnect()},[x.value]);let _t=g?.form.id,Fe=!!g&&(y??[]).some(f=>f.formId===g.form.id);xt(()=>{let f=k.current;!f||!_t||K.current||x.value.some(F=>F.role==="user")&&(Fe?f.querySelector(`[data-testid="${R.formGate}"]`)?.scrollIntoView({block:"nearest"}):ue(f))},[_t,Fe]),O(()=>{let f=k.current;if(!f)return;let F=()=>{Re(f),ie(f),performance.now()-_e.current>150&&(K.current=f.scrollHeight-f.scrollTop-f.clientHeight>8)},j=()=>{K.current=!0},Y=V=>{V.deltaY<0&&j()},re=0,me=V=>{re=V.touches[0]?.clientY??0,G.current=!0},I=V=>{(V.touches[0]?.clientY??0)>re+4&&j()},M=()=>{G.current=!1,X.current=performance.now()},W=()=>{G.current=!0};return f.addEventListener("scroll",F,{passive:!0}),f.addEventListener("wheel",Y,{passive:!0}),f.addEventListener("touchstart",me,{passive:!0}),f.addEventListener("touchmove",I,{passive:!0}),f.addEventListener("touchend",M,{passive:!0}),f.addEventListener("touchcancel",M,{passive:!0}),f.addEventListener("pointerdown",W,{passive:!0}),window.addEventListener("pointerup",M,{passive:!0}),window.addEventListener("pointercancel",M,{passive:!0}),Re(f),()=>{f.removeEventListener("scroll",F),f.removeEventListener("wheel",Y),f.removeEventListener("touchstart",me),f.removeEventListener("touchmove",I),f.removeEventListener("touchend",M),f.removeEventListener("touchcancel",M),f.removeEventListener("pointerdown",W),window.removeEventListener("pointerup",M),window.removeEventListener("pointercancel",M)}},[]);let Ke=()=>{let f=k.current;f&&(K.current=!1,ue(f))},Ge=x.value.filter(f=>!f.ephemeral),Le=Ge[0],Be=Le?.serverMessageId??Le?.id,Ze=!!(d&&Ge.length>=Fa&&Be!==z),Oe=async()=>{if(!d||E.current)return;let f=k.current,F=f?.scrollHeight??0,j=f?.scrollTop??0;E.current=!0,Q.current=!0,w(!0);try{let Y=await d();Y===!1&&Be&&A(Be),Y&&f&&(await new Promise(re=>requestAnimationFrame(()=>requestAnimationFrame(()=>re()))),f.scrollTop=j+f.scrollHeight-F,ie(f),Re(f))}finally{Q.current=!1,E.current=!1,w(!1)}},Ve=[],nt="",We=x.value.at(-1)?.id,Se=[...y??[]].toSorted((f,F)=>(f.createdAt??1/0)-(F.createdAt??1/0)),ot=f=>g&&f.formId===g.form.id?i(ei,{form:g.form,strings:t,onSubmit:g.onSubmit,onSkip:g.onSkip},`gate:${f.formId}`):i(wc,{marker:f,strings:t,onFill:!g&&S?()=>S(f.formId):void 0},f.key),kt=f=>{for(let F=Se[0];F?.createdAt!==void 0&&!(f!==void 0&&F.createdAt>f);F=Se[0])Se.shift(),Ve.push(ot(F))};for(let f of x.value){if(f.role==="assistant"&&f.id!==We&&tn(f))continue;kt(f.createdAt);let F=Qm(f.createdAt);F&&F!==nt&&(Ve.push(i("div",{class:`${jt}-date-divider`,children:i("span",{class:`${jt}-date-pill`,title:Xm(f.createdAt),children:Ym(f.createdAt,t)})},`day:${F}`)),nt=F);let Y=f.retryAction!==void 0||f.role==="assistant"&&f.id===We?_r(x.value,f):void 0,re=Y!==void 0&&(Y.kind!=="continue-assistant"||p==="ai-agent");Ve.push(i(ad,{message:f,status:f.status,strings:t,responseMode:n,showReasoning:o,showToolCalls:r,showSources:a,interactive:!!_&&p==="ai-agent"&&f.id===We,superseded:f.id!==We,tool:u,onRetry:_&&re&&(f.role==="user"||f.id===We)?m:void 0,enableMessageFeedback:s,onFeedback:l},f.id))}for(let f of Se)Ve.push(ot(f));return i("div",{class:`${jt}-list-wrap`,children:[i("div",{ref:k,class:`${jt}-list ${jt}-list--fade`,role:"log","aria-live":"polite","aria-relevant":"additions text",children:[c&&x.value.length===0?i("div",{class:`${jt}-list-loading`,role:"status",children:t.conversationLoading}):null,Ze?i("div",{class:`${jt}-load-previous`,children:i("button",{type:"button",onClick:Oe,disabled:b,"aria-busy":b,"data-testid":R.loadPreviousMessages,children:t.loadPreviousMessages})}):null,Ve,g&&!Fe?i(ei,{form:g.form,strings:t,onSubmit:g.onSubmit,onSkip:g.onSkip}):null]}),h?i("button",{type:"button",class:`${jt}-jump`,onClick:Ke,"aria-label":t.scrollToBottom,title:t.scrollToBottom,"data-testid":R.scrollToBottom,children:i(rn,{})}):null]})}function Qm(e){if(typeof e!="number"||!Number.isFinite(e))return"";let t=new Date(e);return`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`}function Xm(e){if(typeof e!="number"||!Number.isFinite(e))return"";try{return new Date(e).toLocaleDateString(void 0,{dateStyle:"full"})}catch{return""}}function Ym(e,t){let n=new Date(e),o=a=>new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime(),r=Math.round((o(new Date)-o(n))/864e5);return r<=0?t.dateToday:r===1?t.dateYesterday:r<7?n.toLocaleDateString(void 0,{weekday:"long"}):n.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"})}var Jm=["today","yesterday","lastWeek","older"];function Zm(e,t){let n=Date.parse(t);if(!Number.isFinite(n))return"older";let o=Math.floor((sd(e)-sd(n))/(1440*60*1e3));return o<=0?"today":o===1?"yesterday":o<7?"lastWeek":"older"}function ld(e,t){let n=new Map;for(let o of t){let r=Zm(e,o.lastMessageAt),a=n.get(r);a?a.push(o):n.set(r,[o])}return Jm.filter(o=>n.has(o)).map(o=>({bucket:o,conversations:n.get(o)}))}function sd(e){let t=new Date(e);return t.setUTCHours(0,0,0,0),t.getTime()}var cd=te.scope("history"),eg=3,tg=6,ng={today:"dateToday",yesterday:"dateYesterday",lastWeek:"dateLastWeek",older:"dateOlder"};function dd(e,t){let n=t.type!=="upsert"||t.activity===!0;if(t.type==="snapshot"&&t.result.pagination.page===1&&e.pagination.page>1){let r=Ot(e.conversations.slice(0,t.result.pagination.limit),t,n);if(t.result.conversations.length===0){if(r.length===0)return t.result;let d=Math.max(t.result.pagination.total,r.length);return{...t.result,conversations:r,pagination:{...t.result.pagination,total:d,totalPages:Math.ceil(d/t.result.pagination.limit)}}}let a=new Set(r.map(d=>d.conversationId)),s=e.conversations.slice(t.result.pagination.limit).filter(d=>!a.has(d.conversationId)),l=e.pagination.page,c={...t.result.pagination,page:l,hasPrev:l>1,hasNext:l<t.result.pagination.totalPages};return{conversations:[...r,...s],pagination:c}}let o=Ot(e.conversations,t,n);return o===e.conversations?e:{...t.type==="snapshot"?t.result:e,conversations:o}}function og(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 Dr({transport:e,strings:t,locale:n,persistence:o,onSelect:r,onNewConversation:a}){let s=T.cssPrefix,l=e.peekConversations({limit:50}),[c,d]=$(l?"loaded":"loading"),[_,p]=$(l),[u,m]=$(!1),g=N(),y=_?.conversations??[],S=_?.pagination;O(()=>{let b=!1,w=!0,E=[],Q=e.subscribeConversationChanges(A=>{w&&E.push(A),p(D=>D&&dd(D,A))});g.current=void 0,m(!1);let z=e.peekConversations({limit:50});return p(z),d(z?"loaded":"loading"),e.listConversations({limit:50}).then(A=>{if(b)return;let D=A;for(let K of E)D=dd(D,K);E=[],w=!1,p(D),d("loaded"),o.saveHistoryCount(D.conversations.length)}).catch(A=>{b||(E=[],w=!1,cd.warn("listConversations failed",{err:A}),d("error"))}),()=>{b=!0,Q(),g.current=void 0}},[e,o,n]);let k=async()=>{if(g.current||!S?.hasNext)return;let b={};g.current=b,m(!0);try{let w=await e.listConversations({page:S.page+1,limit:S.limit});if(g.current!==b)return;p(E=>{if(!E)return E;let Q=new Set(E.conversations.map(D=>D.conversationId)),z=w.conversations.filter(D=>Q.has(D.conversationId)?!1:(Q.add(D.conversationId),!0)),A={conversations:[...E.conversations,...z],pagination:w.pagination};return o.saveHistoryCount(A.conversations.length),A})}catch(w){if(g.current!==b)return;cd.warn("listConversations page failed",{err:w,page:S.page+1})}finally{g.current===b&&(g.current=void 0,m(!1))}},x=a?i("div",{class:`${s}-history-footer`,children:i("button",{type:"button",class:`${s}-history-new`,onClick:a,"data-testid":R.sidebarNewConversation,children:[i(Al,{}),t.newConversation]})}):null;if(c==="loading"){let b=Math.min(o.loadHistoryCount()??eg,tg);return i(de,{children:[i("div",{class:`${s}-history`,"aria-busy":"true","aria-label":t.historyLoading,children:i("div",{class:`${s}-history-group`,"aria-hidden":"true",children:[i("div",{class:`${s}-history-heading`,children:i("span",{class:`${s}-skeleton ${s}-skeleton-heading`})}),i("div",{class:`${s}-history-card`,children:Array.from({length:Math.max(1,b)},(w,E)=>i("div",{class:`${s}-history-item ${s}-history-item-skeleton`,children:[i("span",{class:`${s}-history-avatar ${s}-skeleton`}),i("span",{class:`${s}-history-body`,children:[i("span",{class:`${s}-history-row`,children:[i("span",{class:`${s}-history-title`,children:i("span",{class:`${s}-skeleton ${s}-skeleton-title`})}),i("span",{class:`${s}-history-time`,children:i("span",{class:`${s}-skeleton ${s}-skeleton-time`})})]}),i("span",{class:`${s}-history-row`,children:i("span",{class:`${s}-history-preview`,children:i("span",{class:`${s}-skeleton ${s}-skeleton-preview`})})})]})]},E))})]})}),x]})}if(c==="error"||y.length===0)return i(de,{children:[i("div",{class:`${s}-history-empty`,children:t.historyEmpty}),x]});let h=Date.now(),P=ld(h,y);return i(de,{children:[i("div",{class:`${s}-history`,role:"list",children:[P.map(b=>i("div",{class:`${s}-history-group`,children:[i("div",{class:`${s}-history-heading`,children:t[ng[b.bucket]]}),i("div",{class:`${s}-history-card`,children:b.conversations.map(w=>i("button",{type:"button",role:"listitem",class:`${s}-history-item`,onClick:()=>r(w),"data-closed":w.canContinue?void 0:"true","data-unread":w.hasUnread?"true":void 0,"data-testid":Xe(R.historyItem,w.conversationId),children:[i("span",{class:`${s}-history-avatar`,"aria-hidden":"true",children:i(Ga,{})}),i("span",{class:`${s}-history-body`,children:[i("span",{class:`${s}-history-row`,children:[i("span",{class:`${s}-history-title`,children:w.title}),i("span",{class:`${s}-history-time`,children:og(w.lastMessageAt,h,n)})]}),i("span",{class:`${s}-history-row`,children:[i("span",{class:`${s}-history-preview`,children:w.preview??(w.canContinue?t.historyContinue:t.conversationClosed)}),w.hasUnread?i("span",{class:`${s}-history-dot`}):null]})]})]},w.conversationId))})]},b.bucket)),S?.hasNext?i("div",{class:`${s}-history-more`,children:i("button",{type:"button",onClick:k,disabled:u,"aria-busy":u,"data-testid":R.historyLoadMore,children:t.loadMoreConversations})}):null]}),x]})}var ud=T.cssPrefix;function _d({suggestions:e,onPick:t,disabled:n=!1}){return e.length===0?null:i("div",{class:`${ud}-suggestions`,role:"group","aria-label":"Suggested replies",children:e.map((o,r)=>i("button",{type:"button",class:`${ud}-suggestion`,onClick:()=>t(o),disabled:n,"data-testid":Xe(R.suggestion,r),children:o.label},o.id))})}var Je=T.cssPrefix;function pd(e){let{options:t,onClose:n}=e,o=t.strings,r=N(null);O(()=>{let d=r.current;if(!d)return;let _=xr(d),p=u=>{u.key==="Escape"&&n?.()};return d.addEventListener("keydown",p),()=>{_(),d.removeEventListener("keydown",p)}},[n]);let a=e.composerApiRef,s=e.composerActive&&e.view==="chat"&&e.canSend&&!e.activeForm&&!e.sendPreparing&&e.options.features.fileUpload,l=L(d=>{s&&a.current?.attachFromDrop(d)},[a,s]),{visible:c}=wr({containerRef:r,onDrop:l,disabled:!s});return yr(r.current,t.mode==="modal"),i("div",{ref:r,class:`${Je}-panel`,role:"dialog","aria-modal":"false","aria-label":o.panelTitle,style:{position:"relative"},"data-testid":R.panel,children:[i(gi,{...e,containerEl:r.current,dragOver:c,composerAttachApiRef:a}),i(vi,{poweredBy:e.options.poweredBy})]})}function gi(e){let{options:t,transport:n,feedback:o,bus:r,persistence:a,conversationId:s,composerKey:l,panelSize:c,view:d,canSend:_,isStreaming:p,isMemoryCompacting:u,canReleaseQueuedMessages:m,sendPreparing:g,controlMode:y,assignedOperatorInitials:S,operatorAvailable:k,operatorRequestEnabled:x,onRequestOperator:h,onCancelOperatorRequest:P,loadingMessages:b,onLoadPreviousMessages:w,messagesSig:E,agent:Q,suggestions:z,initialWidgetSize:A,onClose:D,onBack:K,onClear:G,onToggleHistory:X,onSelectHistoryConversation:U,onNewConversation:_e,onWidgetSizeChange:ie,onSend:Re,onStop:ue,onSuggestion:be,activeForm:Ae,formMarkers:Me,onFormSubmit:qe,onFormSkip:at,onFormFill:_t,tool:Fe,onRetry:Ke,onMessageFeedback:Ge,containerEl:Le,dragOver:Be,composerAttachApiRef:Ze}=e,Oe=t.strings,Ve=dt(()=>E.value.some(We=>!We.ephemeral&&We.role!=="system")).value,nt;return Ae?nt=null:_?nt=i(de,{children:[y&&y!=="ai-agent"?i(ig,{controlMode:y,operatorInitials:S,operatorAvailable:k,onCancelOperatorRequest:P,strings:Oe}):null,!p&&!u&&y==="ai-agent"&&i(_d,{suggestions:z,onPick:be,disabled:g}),i(bc,{options:t,transport:n,feedback:o,bus:r,persistence:a,conversationId:s,isStreaming:p,isMemoryCompacting:u,canReleaseQueuedMessages:m,active:e.composerActive&&d==="chat",isPreparing:g,operatorRequestEnabled:x,canRequestOperator:Ve,controlMode:y,onRequestOperator:h,onSend:Re,onStop:ue,attachApiRef:Ze},l)]}):nt=i(ag,{label:Oe.conversationClosed,ctaLabel:Oe.startNewConversation,onNewConversation:G}),i(de,{children:[d==="history"?i(rg,{strings:Oe,onBack:X,onClose:D,showClose:Pr(t.mode,c,t.actions)}):i("header",{class:`${Je}-header`,"data-testid":R.panelHeader,children:[K?i("button",{type:"button",class:`${Je}-icon-btn`,onClick:K,"aria-label":Oe.moduleBack,title:Oe.moduleBack,children:i(io,{})}):null,Q?i(mc,{agent:Q,strings:Oe}):i("h1",{children:Oe.panelTitle}),i(wt,{panelProps:e,variant:"chat"})]}),d==="history"?i(Dr,{transport:n,strings:Oe,locale:t.locale,persistence:a,onSelect:U,onNewConversation:_e}):i(de,{children:[i(yc,{visible:Be,strings:Oe}),i(id,{messagesSig:E,strings:Oe,responseMode:t.responseMode,showReasoning:t.showReasoning,showToolCalls:t.showToolCalls,showSources:t.showSources,enableMessageFeedback:t.enableMessageFeedback,onFeedback:Ge,loading:b,onLoadPreviousMessages:w,idle:!p&&!g&&_&&!Ae,controlMode:y,tool:Fe,onRetry:Ke,form:Ae?{form:Ae,onSubmit:qe,onSkip:at}:null,formMarkers:Me,onFillForm:_t}),nt,i(lg,{disclaimer:t.composerDisclaimer})]}),t.size.resize?.enabled?i(br,{panelEl:Le,resize:t.size.resize,position:t.position,initialSize:A,onSizeChange:ie,strings:Oe}):null]})}function rg({strings:e,onBack:t,onClose:n,showClose:o}){return i("header",{class:`${Je}-header`,children:[i("button",{type:"button",class:`${Je}-icon-btn`,onClick:t,"aria-label":e.historyBack,title:e.historyBack,children:i(io,{})}),i("h1",{children:e.historyTitle}),o?i("button",{type:"button",class:`${Je}-icon-btn`,onClick:n,"aria-label":e.close,title:e.close,children:i(bt,{})}):null]})}function ag({label:e,ctaLabel:t,onNewConversation:n}){return i("div",{class:`${Je}-readonly-banner`,role:"note",children:[i("span",{class:`${Je}-readonly-label`,children:e}),i("button",{type:"button",class:`${Je}-readonly-cta`,onClick:n,children:t})]})}function ig({controlMode:e,operatorInitials:t,operatorAvailable:n,onCancelOperatorRequest:o,strings:r}){let a=sg(e,t,n,r);return i("div",{class:`${Je}-operator-banner`,role:"status","data-mode":e,"data-testid":R.operatorBanner,children:[i("span",{class:`${Je}-operator-pulse`,"aria-hidden":"true"}),i("span",{class:`${Je}-operator-label`,children:a}),e==="awaiting_operator"&&o?i("button",{type:"button",class:`${Je}-cancel-operator-request`,"data-testid":R.cancelOperatorRequest,onClick:o,children:r.cancelOperatorRequest}):null]})}function sg(e,t,n,o){return e==="operator"?o.chattingWithOperator.replace("{operator}",t??""):n===!1?o.noOperatorAvailable:o.connectingOperator}function lg({disclaimer:e}){return e?i("div",{class:`${Je}-composer-footer`,children:i("div",{class:`${Je}-disclaimer`,children:e})}):null}function vi({poweredBy:e}){return e?i("div",{class:`${Je}-poweredby-bar`,children:i(cg,{logoUrl:e.logoUrl,text:e.text,href:e.href})}):null}function cg({logoUrl:e,text:t,href:n}){let o=i(de,{children:[e?i("img",{class:`${Je}-poweredby-logo`,src:e,alt:"",loading:"lazy"}):null,t?i("span",{children:t}):null]});return n?i("a",{class:`${Je}-poweredby`,href:n,target:"_blank",rel:"noopener noreferrer",children:o}):i("span",{class:`${Je}-poweredby`,children:o})}function fd(e){let t=N(e);t.current=e;let n=N(null);return n.current??(n.current=dg(t)),n.current}function dg(e){let t=ne(null),n=new Set,o=c=>`${e.current.conversationId()??""}:${c}`,r=c=>c.frequency==="always"?!1:c.frequency==="conversation"?n.has(o(c.id)):c.id in e.current.persistence.loadFormsDone(),a=(c,d)=>{if(t.value)return;let _=e.current;if(c==="manual"){let p=_.forms.list.find(u=>u.id===d);p&&(t.value={form:p,trigger:"manual"});return}for(let p of _.forms.byTrigger[c]??[]){let u=p.triggers.find(m=>m.kind===c);if(!(!u||!ug(u,_)||r(p)||!_g(p,_))){t.value={form:p,trigger:c};return}}},s=(c,d)=>{let _=t.value;if(!_)return;t.value=null;let{form:p,trigger:u}=_;p.frequency==="conversation"?n.add(o(p.id)):p.frequency!=="always"&&e.current.persistence.saveFormDone(p.id),e.current.onComplete(p,u,c,d)};return{activeForm:t,fire:a,refresh:()=>{let c=t.value;if(!c)return;let d=e.current.forms.list.find(_=>_.id===c.form.id);d&&d!==c.form&&(t.value={form:d,trigger:c.trigger})},complete:c=>s(c,!1),skip:()=>s({},!0)}}function ug(e,t){return e.kind==="after-messages"?t.messageCount()>=Number(e.param??0):e.kind==="page-area"?t.pageArea()===e.param:!0}function _g(e,t){let n=e.when;if(!n)return!0;if(n.missingContext?.length){let r=t.userContext()??{};if(n.missingContext.some(a=>r[a]!==void 0&&r[a]!==""))return!1}if(n.pageArea&&!(Array.isArray(n.pageArea)?n.pageArea:[n.pageArea]).includes(t.pageArea()??""))return!1;let o=t.messageCount();return!(n.minMessages!=null&&o<n.minMessages||n.maxMessages!=null&&o>n.maxMessages)}function md(e){let t=T.cssPrefix,{site:n,blocks:o,strings:r,collapsed:a}=e,s=o?.navigation??[],l=o?.linkCards??[],c=a?r.expandSidebar:r.collapseSidebar;return i("aside",{class:`${t}-sidebar`,"data-collapsed":a?"true":"false","data-testid":R.sidebar,children:[i("div",{class:`${t}-sidebar-header`,children:[i(pg,{site:n}),i("button",{type:"button",class:`${t}-sidebar-toggle`,"aria-label":c,"aria-expanded":a?"false":"true",title:c,onClick:e.onToggleCollapsed,"data-testid":R.sidebarToggle,children:i(fg,{collapsed:a})})]}),a?null:i(de,{children:[s.length>0?i("nav",{class:`${t}-sidebar-section`,"data-section":"navigation",children:i(mg,{items:s})}):null,l.length>0?i("div",{class:`${t}-sidebar-section`,"data-section":"link-cards",children:i(gg,{items:l})}):null,e.showConversations?i("div",{class:`${t}-sidebar-conversations`,children:i(Dr,{transport:e.transport,strings:e.strings,locale:e.locale,persistence:e.persistence,onSelect:e.onSelectConversation,onNewConversation:e.onNewConversation})}):null]})]})}function pg({site:e}){let t=T.cssPrefix;if(e?.logo?.url){let n=e.logo.alt??e.title??"Logo";return i("picture",{children:[e.logoDark?.url?i("source",{srcset:e.logoDark.url,media:"(prefers-color-scheme: dark)"}):null,i("img",{class:`${t}-sidebar-logo`,src:e.logo.url,alt:n})]})}return i("div",{class:`${t}-sidebar-title`,children:e?.title??T.name})}function fg({collapsed:e}){return i("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true",children:e?i("polyline",{points:"9 6 15 12 9 18"}):i("polyline",{points:"15 6 9 12 15 18"})})}function mg({items:e}){let t=T.cssPrefix;return i("ul",{class:`${t}-sidebar-nav`,children:e.map(n=>i("li",{children:i("a",{class:`${t}-sidebar-nav-item`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[n.icon?i("span",{class:`${t}-sidebar-nav-icon`,"data-icon":n.icon}):null,i("span",{class:`${t}-sidebar-nav-label`,children:n.label})]})},n.id??n.label))})}function gg({items:e}){let t=T.cssPrefix;return i("div",{class:`${t}-sidebar-cards`,children:e.map(n=>i("a",{class:`${t}-sidebar-card`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[i("div",{class:`${t}-sidebar-card-label`,children:n.label}),n.description?i("div",{class:`${t}-sidebar-card-desc`,children:n.description}):null]},n.id??n.label))})}var gd=T.cssPrefix;function vd(e){return i("main",{class:`${gd}-page-shell`,"data-sidebar-collapsed":e.sidebarCollapsed?"true":"false",children:[i(md,{site:e.site,blocks:e.blocks,transport:e.transport,strings:e.strings,locale:e.locale,persistence:e.persistence,showConversations:e.showConversations,onSelectConversation:e.onSelectConversation,onNewConversation:e.onNewConversation,collapsed:e.sidebarCollapsed,onToggleCollapsed:e.onToggleSidebarCollapsed}),i("section",{class:`${gd}-page-chat`,"aria-label":"Chat",children:e.children})]})}var hd=e=>Object.fromEntries(e.map(t=>[t,[]]));function hi(e,t,n){return e.includes(t)?t:e.includes(n)?n:e[0]??""}function bd(e,t,n){let o=[...new Set(t)],r=hi(o,e,""),a=ne({activeTab:r,stacks:hd(o)});return{sig:a,reconcile(s,l){let c=[...new Set(s)],d=a.value,_=hi(c,d.activeTab,l),p=Object.fromEntries(c.map(m=>[m,d.stacks[m]??[]])),u=_===d.activeTab&&c.length===Object.keys(d.stacks).length&&c.every(m=>d.stacks[m]===p[m]);o=c,!u&&(a.value={activeTab:_,stacks:p},_!==d.activeTab&&_&&n?.(_))},switchTab(s){!(s in a.value.stacks)||a.value.activeTab===s||(a.value={...a.value,activeTab:s},n?.(s))},push(s){let l=a.value,c=l.stacks[l.activeTab]??[];a.value={...l,stacks:{...l.stacks,[l.activeTab]:[...c,s]}}},pop(){let s=a.value,l=s.stacks[s.activeTab]??[];l.length!==0&&(a.value={...s,stacks:{...s.stacks,[s.activeTab]:l.slice(0,-1)}})},reset(s){a.value={activeTab:hi(o,s,""),stacks:hd(o)}}}}var yd=e=>e.stacks[e.activeTab]??[],Pd=e=>yd(e).at(-1),xd=e=>yd(e).length===0;var Sd={Icon:lo};var Qt=T.cssPrefix;function $r({title:e,actions:t}){return i("header",{class:`${Qt}-back-header`,"data-variant":"title",children:[i("span",{class:`${Qt}-back-spacer`,"aria-hidden":"true"}),i("h1",{class:`${Qt}-back-title`,children:e}),t??i("span",{class:`${Qt}-back-spacer`,"aria-hidden":"true"})]})}function Fr({title:e,backLabel:t,onBack:n,actions:o,testid:r}){return i("header",{class:`${Qt}-back-header`,"data-testid":r,children:[i("button",{type:"button",class:`${Qt}-icon-btn`,onClick:n,"aria-label":t,title:t,children:i(io,{})}),i("h1",{class:`${Qt}-back-title`,children:e}),o??i("span",{class:`${Qt}-back-spacer`,"aria-hidden":"true"})]})}function ln(e,t){return e instanceof Qe&&e.status===429?t.errorRateLimited:t.errorGeneric}var Nn=T.cssPrefix;function kd({placeholder:e,onActivate:t}){return i("button",{type:"button",class:`${Nn}-home-search`,onClick:t,"data-testid":R.homeSearch,children:[i("span",{class:`${Nn}-home-search-text`,children:e}),i("span",{class:`${Nn}-home-search-icon`,"aria-hidden":"true",children:i(Qa,{})})]})}function wd({placeholder:e,value:t,onInput:n}){return i("div",{class:`${Nn}-home-search`,"data-input":"true",children:[i("input",{type:"search",class:`${Nn}-home-search-input`,placeholder:e,value:t,onInput:o=>n(o.currentTarget.value),"data-testid":R.helpSearch}),i("span",{class:`${Nn}-home-search-icon`,"aria-hidden":"true",children:i(Qa,{})})]})}var _o=T.cssPrefix;function Br({title:e,subtitle:t,onClick:n,testid:o}){return i("button",{type:"button",class:`${_o}-list-row`,onClick:n,"data-testid":o,children:[i("span",{class:`${_o}-list-row-body`,children:[i("span",{class:`${_o}-list-row-title`,children:e}),t?i("span",{class:`${_o}-list-row-sub`,children:t}):null]}),i("span",{class:`${_o}-list-row-chevron`,"aria-hidden":"true",children:i(Tn,{})})]})}var Cd=T.cssPrefix;function Pt({tone:e="info",message:t,onRetry:n,strings:o}){return i("div",{class:`${Cd}-module-empty`,role:e==="error"?"alert":"status","aria-live":"polite",children:[i("span",{children:t}),n?i("button",{type:"button",class:`${Cd}-module-retry`,onClick:n,children:o.errorRetry}):null]})}var cn=T.cssPrefix,vg=te.scope("help"),hg=(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 bg(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 Rd(e,t){let n=t.toLowerCase(),o=n.indexOf(e);if(o!==-1)return 100-Math.min(o,99);let r=0;for(let a of e){if(r=n.indexOf(a,r),r===-1)return 0;r+=1}return 1}function yg(e,t){let n=t.toLowerCase().trim();return n?e.map(o=>({item:o,score:Math.max(Rd(n,o.title)*2,Rd(n,o.description??""))})).filter(o=>o.score>0).toSorted((o,r)=>r.score-o.score).map(o=>o.item):[]}function Td({article:e,nav:t}){return i(Br,{title:e.title,subtitle:e.description,onClick:()=>hg(t,e),testid:Xe(R.helpArticle,e.id)})}function Pg({transport:e,strings:t,config:n,nav:o,bus:r,panelProps:a}){let s=n.contentTags,[l,c]=$("loading"),[d,_]=$(t.errorGeneric),[p,u]=$([]),[m,g]=$(""),[y,S]=$(0);O(()=>{let h=!1;return c("loading"),e.listContent({tags:s,sortBy:"order",limit:100}).then(P=>{if(h)return;let b=P.items??[];u(b),c("loaded"),r.emit("contentView",{section:"help",tags:s?.join(","),count:b.length})}).catch(P=>{h||(vg.warn("listContent (help) failed",{err:P}),_(ln(P,t)),c("error"))}),()=>{h=!0}},[e,s,y,r]);let k=oe(()=>yg(p,m),[p,m]);O(()=>{let h=m.trim();if(!h)return;let P=setTimeout(()=>r.emit("contentSearch",{queryLength:h.length,hitCount:k.length}),600);return()=>clearTimeout(P)},[m,k,r]);function x(){return m.trim().length>0?k.length===0?i(Pt,{message:t.helpSearchEmpty,strings:t}):i("div",{class:`${cn}-help-card`,children:k.map(h=>i(Td,{article:h,nav:o},h.id))}):l==="loading"?i(Pt,{message:t.helpLoading,strings:t}):l==="error"?i(Pt,{tone:"error",message:d,onRetry:()=>S(h=>h+1),strings:t}):p.length===0?i(Pt,{message:t.helpEmpty,strings:t}):bg(p).map(([h,P])=>i("section",{class:`${cn}-help-group`,children:[h?i("h2",{class:`${cn}-help-section-title`,children:h}):null,i("div",{class:`${cn}-help-card`,children:P.map(b=>i(Td,{article:b,nav:o},b.id))})]},h))}return i("div",{class:`${cn}-module`,children:[i($r,{title:t.helpTitle,actions:i(wt,{panelProps:a,variant:"plain"})}),i("div",{class:`${cn}-module-pad`,children:i(wd,{placeholder:t.helpSearchPlaceholder,value:m,onInput:g})}),i("div",{class:`${cn}-help-list`,children:x()})]})}var Id={Icon:so,Root:e=>i(Pg,{...e})};var Ed=T.cssPrefix;function bi({onClick:e,children:t,testid:n}){return e?i("button",{type:"button",class:`${Ed}-home-card`,"data-interactive":"true",onClick:e,"data-testid":n,children:t}):i("div",{class:`${Ed}-home-card`,"data-testid":n,children:t})}var Ce=T.cssPrefix,Ad=te.scope("home");function xg(e){let t=e.options.userContext?.name,n=e.config.greetingText?rt(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 Sg=(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 Md(e,t){return Ot(e,t,t.type!=="upsert"||t.activity===!0)}function kg(e){let{transport:t,strings:n,config:o,nav:r,bus:a,panelProps:s}=e,[l,c]=$(null),[d,_]=$([]),p=o.contentTags?.join(","),u=e.options.modules.list.some(x=>x.layout==="chat");O(()=>{if(o.showRecentConversations===!1)return;let x=!1,h=!0,P=[],b=t.subscribeConversationChanges(w=>{h&&P.push(w),c(E=>Md(E?[E]:[],w)[0]??null)});return t.listConversations({limit:u?50:1}).then(w=>{if(x)return;let E=P.reduce(Md,w.conversations);P=[],h=!1,c(E[0]??null)}).catch(w=>{x||(P=[],h=!1,Ad.warn("listConversations (home) failed",{err:w}))}),()=>{x=!0,b()}},[t,o.showRecentConversations,u]),O(()=>{if(!o.contentTags?.length)return;let x=!1;return t.listContent({tags:o.contentTags,limit:6}).then(h=>{if(x)return;let P=h.items??[];_(P),a.emit("contentView",{section:"home",tags:p,count:P.length})}).catch(h=>!x&&Ad.warn("listContent (home) failed",{err:h})),()=>{x=!0}},[t,p,a]);let m=xg(e),g=o.userAvatars??[],y=o.status,S=y?.text?rt(n,y.text):n.homeStatus,k=o.contentBlockTitle?rt(n,o.contentBlockTitle):n.homeContentTitle;return i("div",{class:`${Ce}-module ${Ce}-home`,"data-testid":R.homeView,children:i("div",{class:`${Ce}-home-scroll`,children:[i("div",{class:`${Ce}-home-hero`,children:[i("div",{class:`${Ce}-home-hero-top`,children:[o.brandName?i("span",{class:`${Ce}-home-brand`,"data-testid":R.homeBrand,children:o.brandName}):i("span",{class:`${Ce}-home-brand-spacer`,"aria-hidden":"true"}),i("div",{class:`${Ce}-home-hero-actions`,children:[g.length>0?i("div",{class:`${Ce}-home-avatars`,children:g.map(x=>i("span",{class:`${Ce}-home-avatar`,title:x.role?`${x.name} \xB7 ${x.role}`:x.name,children:x.avatar?i("img",{src:x.avatar,alt:"",loading:"lazy"}):i("span",{children:Sr(x.name)})},x.name))}):null,i(wt,{panelProps:s,variant:"plain"})]})]}),o.showGreeting!==!1?i(de,{children:[i("h1",{class:`${Ce}-home-greeting`,"data-testid":R.homeGreeting,children:m.title}),m.subtitle?i("p",{class:`${Ce}-home-lead`,children:m.subtitle}):null]}):null]}),i("div",{class:`${Ce}-home-cards`,children:[o.showSearchBar!==!1?i(kd,{placeholder:n.homeSearchPlaceholder,onActivate:()=>r.switchToLayout("help")}):null,l?i(bi,{onClick:()=>r.selectConversation(l),testid:R.homeRecent,children:i("div",{class:`${Ce}-home-recent-row`,"data-unread":l.hasUnread?"true":void 0,children:[i("span",{class:`${Ce}-home-recent-avatar`,"aria-hidden":"true",children:i(lo,{})}),i("span",{class:`${Ce}-home-recent-body`,children:[i("span",{class:`${Ce}-home-recent-title`,children:l.title}),l.preview?i("span",{class:`${Ce}-home-recent-preview`,children:l.preview}):null]}),l.hasUnread?i("span",{class:`${Ce}-home-recent-dot`,"aria-label":"Unread"}):null]})}):null,y?i(bi,{onClick:y.url?()=>r.push({kind:"iframe",url:y.url,title:S}):void 0,children:i("div",{class:`${Ce}-home-status`,"data-level":y.level??"operational",children:[i("span",{class:`${Ce}-home-status-icon`,"aria-hidden":"true",children:i(Zl,{})}),i("span",{class:`${Ce}-home-status-text`,children:S})]})}):null,d.length>0?i("section",{class:`${Ce}-home-content`,children:[i("div",{class:`${Ce}-home-content-title`,children:k}),i("div",{class:`${Ce}-home-content-list`,children:d.map(x=>i(Br,{title:x.title,subtitle:x.description,onClick:()=>Sg(r,x),testid:Xe(R.homeContentRow,x.id)},x.id))})]}):null]})]})})}var Ld={Icon:ec,Root:e=>i(kg,{...e})};var Xt=T.cssPrefix,wg=te.scope("news");function Cg({transport:e,strings:t,config:n,nav:o,bus:r,panelProps:a}){let s=n.contentTags,[l,c]=$("loading"),[d,_]=$(t.errorGeneric),[p,u]=$([]),[m,g]=$(0);O(()=>{let S=!1;return c("loading"),e.listContent({tags:s,sortBy:"publishedAt",sortOrder:"desc"}).then(k=>{if(S)return;let x=k.items??[];u(x),c("loaded"),r.emit("contentView",{section:"news",tags:s?.join(","),count:x.length})}).catch(k=>{S||(wg.warn("listContent (news) failed",{err:k}),_(ln(k,t)),c("error"))}),()=>{S=!0}},[e,s,m,r]);function y(){return l==="loading"?i(Pt,{message:t.newsLoading,strings:t}):l==="error"?i(Pt,{tone:"error",message:d,onRetry:()=>g(S=>S+1),strings:t}):p.length===0?i(Pt,{message:t.newsEmpty,strings:t}):i("div",{class:`${Xt}-news-list`,children:p.map(S=>i("button",{type:"button",class:`${Xt}-news-card`,onClick:()=>o.push({kind:"content",id:S.id,title:S.title}),"data-testid":Xe(R.newsItem,S.id),children:[S.image?i("img",{class:`${Xt}-news-hero`,src:S.image,alt:"",loading:"lazy"}):null,i("span",{class:`${Xt}-news-body`,children:[i("span",{class:`${Xt}-news-title`,children:S.title}),S.description?i("span",{class:`${Xt}-news-summary`,children:S.description}):null]})]},S.id))})}return i("div",{class:`${Xt}-module`,children:[i($r,{title:t.newsTitle,actions:i(wt,{panelProps:a,variant:"plain"})}),i("div",{class:`${Xt}-module-scroll`,children:y()})]})}var Od={Icon:tc,Root:e=>i(Cg,{...e})};var Hr={chat:Sd,home:Ld,help:Id,news:Od};var po=T.cssPrefix;function Nd({modules:e,activeTab:t,strings:n,hasUnread:o,onSelect:r}){return i("nav",{class:`${po}-tabbar`,role:"tablist","aria-label":n.panelTitle,children:e.map(a=>{let s=Hr[a.layout].Icon,l=a.id===t,c=a.layout==="chat"&&o;return i("button",{type:"button",role:"tab","aria-selected":l,class:`${po}-tab`,onClick:()=>r(a.id),"data-testid":Xe(R.tab,a.id),children:[i("span",{class:`${po}-tab-icon`,"aria-hidden":"true",children:[i(s,{}),c?i("span",{class:`${po}-tab-badge`,"data-testid":R.tabBadge,"aria-label":"Unread"}):null]}),i("span",{class:`${po}-tab-label`,children:rt(n,a.label)})]},a.id)})})}var Dd=T.cssPrefix,Rg="allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads";function $d({url:e,title:t,strings:n,onBack:o,actions:r}){return i("div",{class:`${Dd}-module`,children:[i(Fr,{title:t||n.moduleBack,backLabel:n.moduleBack,onBack:o,actions:r}),i("iframe",{class:`${Dd}-content-frame`,src:e,title:t||"content",sandbox:Rg,referrerpolicy:"no-referrer",loading:"lazy",allow:"fullscreen"})]})}var fo=T.cssPrefix,Tg=te.scope("content"),Ig=5e3;function Fd({id:e,title:t,transport:n,strings:o,bus:r,onBack:a,actions:s}){let[l,c]=$(null),[d,_]=$(!1),[p,u]=$(0),m=L(()=>{_(!1),c(null),u(S=>S+1)},[]);O(()=>{let S=!1;return n.listContent({ids:[e],limit:1}).then(k=>{if(S)return;let x=k.items[0];x?(c(x),r.emit("contentOpen",{contentId:e,tags:x.tags?.length?x.tags.join(","):void 0})):_(!0)}).catch(k=>{S||(Tg.warn("listContent (reader) failed",{err:k}),_(!0))}),()=>{S=!0}},[n,e,p,r]),O(()=>{if(!l)return;let S=setTimeout(()=>r.emit("contentRead",{contentId:e}),Ig);return()=>clearTimeout(S)},[l,e,r]);let g=L(S=>{let x=S.target?.closest?.("a")?.getAttribute("href")??"";x&&!x.startsWith("#")&&r.emit("contentLinkClick",{contentId:e})},[r,e]);function y(){return d?i(Pt,{tone:"error",message:o.errorGeneric,onRetry:m,strings:o}):l===null?i(Pt,{message:o.contentLoading,strings:o}):i("article",{class:`${fo}-content`,"data-testid":R.contentView,onClick:g,children:[l.image?i("img",{class:`${fo}-content-hero`,src:l.image,alt:"",loading:"lazy"}):null,l.description?i("p",{class:`${fo}-content-subtitle`,children:l.description}):null,i(Xc,{text:l.content??""})]})}return i("div",{class:`${fo}-module`,children:[i(Fr,{title:l?.title||t||o.moduleBack,backLabel:o.moduleBack,onBack:a,actions:s,testid:R.backHeader}),i("div",{class:`${fo}-module-scroll`,"data-testid":R.contentScroll,children:y()})]})}var Ur=T.cssPrefix;function Bd({panelProps:e,enabledModules:t,nav:n,bus:o,hasUnread:r,onSelectConversation:a,onStartNewConversation:s,onSetPanelSize:l}){let c=e.options,d=c.strings,_=N(null),p=N(new Set);O(()=>{let G=_.current;if(!G)return;let X=xr(G),U=_e=>{_e.key==="Escape"&&e.onClose?.()};return G.addEventListener("keydown",U),()=>{X(),G.removeEventListener("keydown",U)}},[e.onClose]);let u=dt(()=>n.sig.value).value,m=Pd(u),g=c.modules.byId[u.activeTab],y=e.composerActive&&g?.layout==="chat"&&m===void 0,S=e.composerApiRef,k=y&&e.view==="chat"&&e.canSend&&!e.activeForm&&!e.sendPreparing&&e.options.features.fileUpload,x=L(G=>{k&&S.current?.attachFromDrop(G)},[S,k]),{visible:h}=wr({containerRef:_,onDrop:x,disabled:!k});yr(_.current,c.mode==="modal");let P=m?.kind==="iframe"||m?.kind==="content",b=t.length>1&&(xd(u)||!P),w=N(null);O(()=>{if(P&&w.current===null)w.current=e.panelSize,e.panelSize==="normal"&&l("expanded");else if(!P&&w.current!==null){let G=w.current;w.current=null,l(G)}},[P]);let E={push:n.push,pop:n.pop,switchTab:n.switchTab,switchToLayout:G=>{let X=t.find(U=>U.layout===G);X&&n.switchTab(X.id)},selectConversation:a,startNewConversation:s},Q=G=>({options:c,transport:e.transport,strings:d,config:G,nav:E,bus:o,panelProps:e}),z=i(wt,{panelProps:e,variant:"plain"});g&&p.current.add(g.id);let A=t.filter(G=>p.current.has(G.id)),D=G=>{if(G.layout==="chat")return i(gi,{...e,composerActive:y,containerEl:_.current,dragOver:h,composerAttachApiRef:S});let X=Hr[G.layout].Root;return X?i(X,{...Q(G)}):null},K=()=>m?.kind==="iframe"?i($d,{url:m.url,title:m.title,strings:d,onBack:n.pop,actions:z}):m?.kind==="content"?i(Fd,{id:m.id,title:m.title,transport:e.transport,strings:d,bus:o,onBack:n.pop,actions:z}):null;return i("div",{ref:_,class:`${Ur}-panel ${Ur}-messenger`,role:"dialog","aria-modal":"false","aria-label":d.panelTitle,style:{position:"relative"},"data-testid":R.messengerHome,children:[i("div",{class:`${Ur}-messenger-body`,children:[A.map(G=>i("div",{class:`${Ur}-messenger-pane`,hidden:P||G.id!==g?.id,children:D(G)},G.id)),K()]}),b?i(Nd,{modules:t,activeTab:u.activeTab,strings:d,hasUnread:r,onSelect:n.switchTab}):null,i(vi,{poweredBy:c.poweredBy}),c.size.resize?.enabled&&!(g?.layout==="chat"&&!m)?i(br,{panelEl:_.current,resize:c.size.resize,position:c.position,initialSize:e.initialWidgetSize,onSizeChange:e.onWidgetSizeChange,strings:d}):null]})}var mo=T.cssPrefix;function Hd({strings:e,onClose:t}){return i("div",{class:`${mo}-panel ${mo}-modules-empty`,role:"dialog","aria-label":e.panelTitle,"data-testid":R.modulesEmpty,children:[t?i("button",{type:"button",class:`${mo}-icon-btn ${mo}-modules-empty-close`,onClick:t,"aria-label":e.close,title:e.close,children:i(bt,{})}):null,i("p",{class:`${mo}-modules-empty-text`,children:e.modulesEmpty})]})}function Dn(e,t,n,o){let r={role:n,text:o};e.emit("message",r),t.onMessage?.(r)}var yi=te.scope("hitl");function Ud(e){let{streaming:t,controlModeSig:n,messagesSig:o,sendAiTurn:r,bus:a,humanInLoop:s}=e,l=N(t);l.current=t;let c=L((u,m,g)=>{if(l.current||n.value!=="ai-agent")return!1;let y=o.value.at(-1),S=y?.partsSig.value.findIndex(x=>x.kind==="tool"&&x.toolCallId===u)??-1,k=y?.partsSig.value[S];return!y||k?.kind!=="tool"?(yi.warn("decideTool: tool part not found",{toolCallId:u}),!1):y.status!=="complete"||!cr(y,S)||!m(k)?!1:(g(k),y.partsSig.value=[...y.partsSig.value],nn(y)&&(y.status="streaming",y.retryAction={kind:"continue-assistant",messageId:y.serverMessageId??y.id},y.awaitingContinuation=!0,o.value=[...o.value],r({continueExisting:!0})),!0)},[n,o,r]),d=L((u,m,g)=>{let y=!1;if(c(u,k=>k.stateSig.value==="approval-requested",k=>{y=Tr(k.toolName);let x=k.approvalSig.value?.id??u;k.approvalSig.value={id:x,approved:m,reason:g},k.stateSig.value="approval-responded"})){if(y){yi.info("toolResult",{toolCallId:u}),a.emit("toolResult",{toolCallId:u});return}yi.info("toolDecision",{toolCallId:u,approved:m}),a.emit("toolDecision",{toolCallId:u,approved:m})}},[a,c]),_=L(u=>{c(u,m=>m.stateSig.value==="approval-responded"&&m.approvalSig.value?.approved!==void 0,m=>{let g=m.approvalSig.value?.id??u;m.approvalSig.value={id:g},m.stateSig.value="approval-requested"})},[c]);return{toolInteraction:oe(()=>({humanInLoop:s,onDecision:d,onEdit:_}),[s,d,_])}}function zd({callout:e,persistence:t}){let n=e?.text??"",o=e?.persistent??!0,[r,a]=$(()=>o?!1:t.loadCalloutDismissed(n));O(()=>{a(o?!1:t.loadCalloutDismissed(n))},[n,o,t]);let s=L(()=>{a(!0),o||t.saveCalloutDismissed(n)},[t,n,o]);return{dismissed:r,dismissCallout:s}}function qd(e){let{transport:t,conversationIdSig:n}=e,o=gt("ai-agent"),r=gt(void 0),a=gt(void 0),s=N(),l=L(p=>{let u=p.controlRevision,m=s.current;m&&m.conversationId===n.value&&u<m.revision||(s.current={conversationId:n.value,revision:u},o.value=p.controlMode,r.value=p.assignedOperatorInitials,p.controlMode!=="awaiting_operator"?a.value=void 0:p.operatorAvailable!==void 0&&(a.value=p.operatorAvailable))},[n,o,r,a]),c=L(p=>{if(p.type!=="data-control-state")return;let u=dl(p.data);u&&l(u)},[l]),d=L(async()=>{let p=n.value,u=await t.requestOperator();u&&n.value===p&&l(u)},[t,n,l]),_=L(async()=>{let p=n.value,u=await t.cancelOperatorRequest();u&&n.value===p&&l(u)},[t,n,l]);return{controlModeSig:o,assignedOperatorInitialsSig:r,operatorAvailableSig:a,applyControlState:l,adoptControlStateChunk:c,requestOperator:d,cancelOperatorRequest:_}}var zr=T.cssPrefix,Vd=`--${zr}-visual-viewport-height`,Wd=`--${zr}-visual-viewport-top`;function Kd(e){let{hostElement:t,mode:n,panelSize:o,isOpen:r,surfaceReady:a,setIsOpen:s}=e;xt(()=>{Wo(t,or(n,o,r))},[t,r,o,n]),xt(()=>{if(!r||!a)return;let l=t.ownerDocument.defaultView,c=l?.visualViewport,d=t.shadowRoot?.querySelector(`.${zr}-anchor`);if(!l||!c||!d)return;let _=()=>{d.style.setProperty(Vd,`${c.height}px`),d.style.setProperty(Wd,`${c.offsetTop}px`)},p=0,u=()=>{l.cancelAnimationFrame(p),p=l.requestAnimationFrame(()=>{p=l.requestAnimationFrame(_)})};return _(),c.addEventListener("resize",u),c.addEventListener("scroll",u),()=>{l.cancelAnimationFrame(p),c.removeEventListener("resize",u),c.removeEventListener("scroll",u),d.style.removeProperty(Vd),d.style.removeProperty(Wd)}},[t,r,a]),O(()=>{if(n!=="modal"||!r)return;let l=c=>{c.composedPath().some(_=>_ instanceof HTMLElement&&_.classList.contains(`${zr}-panel`))||s(!1)};return t.addEventListener("click",l),()=>t.removeEventListener("click",l)},[t,r,n,s]),O(()=>{if(n!=="drawer"||!r)return;let l=c=>{c.key==="Escape"&&s(!1)};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[r,n,s])}var Pi=te.scope("reducer"),qr=class{constructor(t,n){se(this,"messagesSig",t);se(this,"onReconcileNeeded",n);se(this,"active",null);se(this,"openTextParts",new Map);se(this,"partSeq",0);se(this,"replay",null)}attach(t){this.active=t,this.openTextParts.clear()}detach(){this.active=null,this.replay=null,this.openTextParts.clear()}beginReplay(t,n){let o=Nt();o.id=t.id;let r=dn(t)||Dt(t)&&(t.status!=="streaming"||nn(t)),a=t.status==="streaming"&&nn(t)&&oo(t);this.replay={baseline:t,shadow:o,chunks:[n],probeContinuation:r,continuationTailReplay:a,liveCatchUp:t.status==="streaming"&&!r},this.attach(o),this.apply(n)}refreshReplayBaseline(){let t=this.replay;if(!t)return null;let n=t.shadow.serverMessageId??t.baseline.serverMessageId,o=this.messagesSig.value,r=o.at(-1),a=r===t.baseline||r?.id===t.baseline.id||n!==void 0&&r?.serverMessageId===n?r:o.find(l=>l===t.baseline)??o.find(l=>l.id===t.baseline.id||n!==void 0&&l.serverMessageId===n);if(!a)return this.detach(),null;if(a===t.baseline)return t;let s=t.baseline;return t.baseline=a,Gd(s,a),t.liveCatchUp&&dn(t.shadow)&&(a.status==="streaming"||Dt(a))?(t.probeContinuation=!1,t.continuationTailReplay=!1,t):(t.probeContinuation=dn(a)||Dt(a)&&(a.status!=="streaming"||nn(a)),t.continuationTailReplay=a.status==="streaming"&&nn(a)&&oo(a),t.liveCatchUp=a.status==="streaming"&&!t.probeContinuation,t)}refreshActive(){let t=this.active;if(!t)return null;let n=t.serverMessageId,o=this.messagesSig.value,r=o.at(-1),a=r===t||r?.id===t.id||n!==void 0&&r?.serverMessageId===n?r:o.find(l=>l===t)??o.find(l=>l.id===t.id||n!==void 0&&l.serverMessageId===n);if(!a)return this.detach(),null;if(a===t)return t;Gd(t,a);let s=dn(t)&&Dt(a);return a.status!=="streaming"&&!s?(this.detach(),null):(this.replay={baseline:a,shadow:t,chunks:[],probeContinuation:!1,continuationTailReplay:!1,liveCatchUp:!0},t)}promoteReplay(){let{baseline:t,shadow:n}=this.replay;return ht(()=>{t.role=n.role,t.serverMessageId=n.serverMessageId,t.operatorInitials=n.operatorInitials,t.status=n.status,n.canceled&&(t.canceled=!0),t.finishReason=n.finishReason,t.errorText=n.errorText,t.suggestions=n.suggestions??t.suggestions,t.partsSig.value=n.partsSig.value,this.messagesSig.value=[...this.messagesSig.value]}),this.replay=null,this.active=t,t}promoteContinuation(t=!1){let{baseline:n,chunks:o}=this.replay,r=dr(n);return this.replay=null,ht(()=>{if(t){let a=n.partsSig.value.findLastIndex(s=>s.kind==="tool");n.partsSig.value=n.partsSig.value.slice(0,a+1)}n.awaitingContinuation=!1,n.status="streaming",n.finishReason=void 0,n.errorText=void 0,n.suggestions=void 0,this.attach(n);for(let a of o)this.apply(a);n.continuationStreaming=r||void 0,this.messagesSig.value=[...this.messagesSig.value]}),n}settleOwnedContinuation(t){let{baseline:n}=this.replay,o=dr(n);return this.replay=null,ht(()=>{n.awaitingContinuation=!1,n.status="streaming",n.finishReason=void 0,n.errorText=void 0,n.suggestions=void 0,this.attach(n),this.apply(t),n.continuationStreaming=o||void 0,this.messagesSig.value=[...this.messagesSig.value]}),n}applyResume(t){if(t.type==="start"){let r=(this.replay?.baseline??this.active)?.serverMessageId;r!==void 0&&t.messageId!==void 0&&r!==t.messageId&&this.onReconcileNeeded?.({messageId:r}),this.detach();let a=t.messageId,s=a!==void 0?this.messagesSig.value.find(_=>_.serverMessageId===a||_.id===a):void 0;if(s!==void 0)return t.messageMetadata?.senderRole==="visitor"&&s.role==="user"&&(s.status==="pending"||s.status==="error")&&(s.serverMessageId=a,s.status="complete",s.errorText=void 0,s.retryAction=void 0,this.messagesSig.value=[...this.messagesSig.value]),this.beginReplay(s,t),null;let l=t.messageMetadata?.senderRole,c=this.messagesSig.value.at(-1);if(l===void 0&&c?.role==="assistant"&&c.status==="streaming"&&c.serverMessageId===void 0&&!St(c))return this.attach(c),this.apply(t),null;let d=Nt();return this.attach(d),this.messagesSig.value=[...this.messagesSig.value,d],this.apply(t),null}if(this.replay){let o=this.refreshReplayBaseline();if(!o)return null;o.chunks.push(t),t.type==="data-control-state"&&(o.baseline.operatorRoutedTurn=t.data.controlMode!=="ai-agent"),this.apply(t);let{baseline:r,shadow:a,probeContinuation:s,continuationTailReplay:l,liveCatchUp:c}=o,d=t.type==="finish"||t.type==="error"||t.type==="abort";if(s){if(!Mg(r,a,t))return d&&(Dg(r,a)&&(r.continuationStreaming=!0,this.messagesSig.value=[...this.messagesSig.value],this.onReconcileNeeded?.({messageId:r.serverMessageId??r.id})),this.detach()),null;let p=dn(r)&&d?this.settleOwnedContinuation(t):this.promoteContinuation();return d?(p.continuationStreaming&&(t.type==="finish"?this.onReconcileNeeded?.({messageId:p.serverMessageId??p.id}):p.continuationStreaming=!1),this.detach(),p):null}if(l&&Ag(r,a)){let p=this.promoteContinuation(!0);return d?(this.detach(),p):null}if(!c)return d&&this.detach(),null;if(d&&!St(r)&&St(a)){let p=this.promoteReplay();return this.detach(),p}if(!Eg(r,a))return d&&(this.onReconcileNeeded?.({messageId:r.serverMessageId??r.id}),this.detach()),null;let _=this.promoteReplay();return d?(this.detach(),_):null}let n=this.refreshActive();if(!n)return null;if(this.replay)return this.applyResume(t);if(this.apply(t),t.type==="finish"||t.type==="error"||t.type==="abort"){let o=n;return o.continuationStreaming&&(t.type==="finish"?this.onReconcileNeeded?.({messageId:o.serverMessageId??o.id}):o.continuationStreaming=!1),this.detach(),o}return null}ensureTextPart(t,n,o){let r=`${n}:${o}`,a=this.openTextParts.get(r);if(a)return a;let s={kind:n,id:`${o}#${this.partSeq++}`,textSig:ne(""),doneSig:ne(!1)};return this.openTextParts.set(r,s),go(t,s),s}apply(t){let n=this.active;if(n)switch(t.type){case"start":{t.messageId&&(n.serverMessageId=t.messageId);let o=t.messageMetadata;o?.senderRole==="operator"?(n.role="operator",o.operatorInitials&&(n.operatorInitials=o.operatorInitials)):o?.senderRole==="visitor"&&(n.role="user");return}case"finish-step":this.openTextParts.clear();return;case"start-step":go(n,{kind:"step-start",id:`ss-${this.partSeq++}`});return;case"finish":Pi.debug("finish",{reason:t.finishReason,canContinue:t.canContinue}),n.status="complete",n.retryAction=void 0,t.finishReason&&(n.finishReason=t.finishReason),this.bumpDone(n);return;case"error":Pi.warn("stream error chunk",{errorText:t.errorText}),n.status="error",n.errorText=t.errorText,this.bumpDone(n);return;case"abort":Pi.debug("stream abort chunk (canceled)"),n.status="complete",n.canceled=!0,n.retryAction=void 0,this.bumpDone(n);return;case"text-start":this.ensureTextPart(n,"text",t.id);return;case"text-delta":{let o=this.ensureTextPart(n,"text",t.id);o.textSig.value+=t.delta;return}case"text-end":this.ensureTextPart(n,"text",t.id).doneSig.value=!0;return;case"reasoning-start":this.ensureTextPart(n,"reasoning",t.id).doneSig.value=!1;return;case"reasoning-delta":{let o=this.ensureTextPart(n,"reasoning",t.id);o.textSig.value+=t.delta;return}case"reasoning-end":this.ensureTextPart(n,"reasoning",t.id).doneSig.value=!0;return;case"tool-input-start":case"tool-input-delta":case"tool-input-available":case"tool-input-error":case"tool-output-available":case"tool-output-error":case"tool-output-denied":case"tool-approval-request":$g(n,t);return;case"file":go(n,{kind:"file",url:t.url,mediaType:t.mediaType});return;case"source-url":jd(n,{kind:"source",sourceId:t.sourceId,url:t.url,title:t.title});return;case"source-document":jd(n,{kind:"source",sourceId:t.sourceId,title:t.title,filename:t.filename,mediaType:t.mediaType});return;case"data-suggestions":n.suggestions=ar(t.data);return;case"data-control-state":n.operatorRoutedTurn=t.data.controlMode!=="ai-agent";return;case"data-memory-compaction-state":return;default:{let o=t}}}bumpDone(t){ht(()=>{t.partsSig.value=[...t.partsSig.value],this.messagesSig.value.includes(t)&&(this.messagesSig.value=[...this.messagesSig.value])})}},xi={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function dn(e){return e.awaitingContinuation===!0||e.continuationStreaming===!0||e.retryAction?.kind==="continue-assistant"}function Gd(e,t){e.canceled&&(t.canceled=!0),!(!dn(e)||t.status!=="streaming"&&!Dt(t))&&(t.awaitingContinuation??(t.awaitingContinuation=e.awaitingContinuation),t.continuationStreaming??(t.continuationStreaming=e.continuationStreaming),t.retryAction===void 0&&(t.retryAction=e.retryAction))}function Eg(e,t){let n=e.partsSig.value,o=t.partsSig.value;return e.role!==t.role||o.length<n.length?!1:n.every((r,a)=>Qd(r,o[a]))}function Ag(e,t){let n=e.partsSig.value,o=n.findLastIndex(l=>l.kind==="tool"),r=new Set(n.slice(0,o+1).flatMap(l=>l.kind==="tool"?[l.toolCallId]:[])),a=t.partsSig.value.filter(l=>l.kind!=="tool"||!r.has(l.toolCallId)),s=n.slice(o+1);return a.length<s.length?!1:s.every((l,c)=>Qd(l,a[c]))}function Qd(e,t){switch(e.kind){case"text":case"reasoning":return t?.kind===e.kind&&t.textSig.value.startsWith(e.textSig.value);case"step-start":return t?.kind==="step-start";case"tool":{if(t?.kind!=="tool"||t.toolCallId!==e.toolCallId||!ur(t.toolName,e.toolName)||xi[t.stateSig.value]<xi[e.stateSig.value])return!1;let n=e.approvalSig.value?.approved;return n===void 0||t.approvalSig.value?.approved===n}case"file":return t?.kind==="file"&&t.url===e.url&&t.mediaType===e.mediaType;case"source":return t?.kind==="source"&&t.sourceId===e.sourceId&&t.url===e.url&&t.title===e.title&&t.filename===e.filename&&t.mediaType===e.mediaType;default:return e}}function Mg(e,t,n){return Lg(e,n)||!Og(e,t)?!0:n.type!=="finish"&&n.type!=="error"&&n.type!=="abort"?!1:oo(t)||e.awaitingContinuation===!0&&n.type!=="finish"?!0:e.awaitingContinuation===!0&&t.partsSig.value.every(o=>o.kind==="step-start")}function Lg(e,t){if(t.type!=="tool-output-available"&&t.type!=="tool-output-error"&&t.type!=="tool-output-denied")return!1;let n=e.partsSig.value.find(o=>o.kind==="tool"&&o.toolCallId===t.toolCallId);return n!==void 0&&xi[n.stateSig.value]<4}function Og(e,t){let n=t.partsSig.value;if(n.length===0)return!0;let o=e.partsSig.value;return o.some((r,a)=>n.every((s,l)=>Ng(o[a+l],s)))}function Ng(e,t){switch(t.kind){case"text":case"reasoning":return e?.kind===t.kind&&e.textSig.value.startsWith(t.textSig.value);case"step-start":return e?.kind==="step-start";case"tool":return e?.kind==="tool"&&e.toolCallId===t.toolCallId&&(t.toolName==="tool"||ur(e.toolName,t.toolName));case"file":return e?.kind==="file"&&e.url===t.url&&e.mediaType===t.mediaType;case"source":return e?.kind==="source"&&e.sourceId===t.sourceId&&e.url===t.url&&e.title===t.title&&e.filename===t.filename&&e.mediaType===t.mediaType;default:return t}}function Dg(e,t){if(dn(e)||!Dt(e))return!1;let n=new Set(e.partsSig.value.filter(r=>r.kind==="tool").map(r=>r.toolCallId));return!t.partsSig.value.some(r=>r.kind==="tool"&&n.has(r.toolCallId))}function Yt(e,t,n,o){let r=e.partsSig.value.find(s=>s.kind==="tool"&&s.toolCallId===t);if(r)return o&&(r.dynamic=!0),r;let a={kind:"tool",toolCallId:t,toolName:n??"tool",dynamic:o?!0:void 0,inputPartialSig:ne(""),inputSig:ne(void 0),outputSig:ne(void 0),errorSig:ne(void 0),stateSig:ne("input-streaming"),approvalSig:ne(void 0)};return go(e,a),a}function go(e,t){e.partsSig.value=[...e.partsSig.value,t]}function jd(e,t){e.partsSig.value.some(n=>n.kind==="source"&&n.sourceId===t.sourceId)||go(e,t)}function $g(e,t){switch(t.type){case"tool-input-start":Yt(e,t.toolCallId,t.toolName,t.dynamic);return;case"tool-input-delta":{let n=Yt(e,t.toolCallId);n.inputPartialSig.value+=t.inputTextDelta;return}case"tool-input-available":{let n=Yt(e,t.toolCallId,t.toolName,t.dynamic);n.inputSig.value=t.input,n.stateSig.value="input-available";return}case"tool-input-error":{let n=Yt(e,t.toolCallId,t.toolName,t.dynamic);n.inputSig.value=t.input,n.errorSig.value=t.errorText,n.stateSig.value="output-error";return}case"tool-approval-request":{let n=Yt(e,t.toolCallId,t.toolName);n.approvalSig.value={id:t.approvalId},n.stateSig.value="approval-requested";return}case"tool-output-available":{let n=Yt(e,t.toolCallId,void 0,t.dynamic);n.outputSig.value=t.output,n.stateSig.value="output-available";return}case"tool-output-error":{let n=Yt(e,t.toolCallId,void 0,t.dynamic);n.errorSig.value=t.errorText,n.stateSig.value="output-error";return}case"tool-output-denied":{let n=Yt(e,t.toolCallId);n.stateSig.value="output-denied";return}default:return}}async function Xd(e){let t=1e3,n=!1,o=!1,r=!1,a=()=>{r||e.signal.aborted||(r=!0,e.onInitialBoundaryReady())};for(;!e.signal.aborted;){let s,l="held";try{l=await e.connect(()=>{if(e.signal.aborted)return;s=e.now();let c=n||o;n=!0,o=!1,r?c&&e.backfill():a()})}catch{}if(e.signal.aborted||(!n&&s===void 0&&(o=!0,a()),l==="unavailable"))return;s!==void 0&&e.now()-s>=1e3&&(t=1e3),await e.sleep(t),t=Math.min(t*2,15e3)}}var Fg=120;function Yd(e){let{activated:t,conversationReady:n,conversationIdSig:o,messagesSig:r,optionsRef:a,transport:s,visitorId:l,adoptControlStateChunk:c,adoptMemoryCompactionStateChunk:d,settleSuggestions:_,recordConversationReply:p,transcriptRecoverySig:u,beginConversationTranscript:m,commitConversationTranscript:g,onReplyLanded:y,runCancellation:S,canContinueRef:k,setCanSend:x,feedback:h,bus:P,loadInitialThread:b,shouldReconcileOnConnect:w}=e,E=N(0);O(()=>{if(!t||!n||!o.value)return;let Q=o.value,z=new AbortController,A=f=>{},D=new qr(r,f=>A(f));s.primeIdentity(l,Q);let K=!1,G=!1,X,U=!1,_e,ie=0,Re=k.current,ue,be,Ae=Date.now(),Me,qe=!1,at=!1,_t=(f,F,j)=>{if(!St(f))return;let Y=r.value.findLast(me=>!me.ephemeral),re=f.serverMessageId??f.id;if(!(Y&&(Y.serverMessageId??Y.id)!==re))return lr(r.value,f,Q,a.current.strings.newConversation,F,j)},Fe=(f,F,j,Y)=>{let re=_t(f,F,Y);if(!re)return;let I=`${f.serverMessageId??f.id}:${j}:${re.preview??""}`;I!==be&&(be=I,s.publishConversation({...re,hasUnread:!0},!0))},Ke,Ge=()=>{Ke&&(clearTimeout(Ke.timer),Ke=void 0)},Le=()=>{let f=Ke;if(!f)return;clearTimeout(f.timer),Ke=void 0;let F=r.value.find(j=>(j.serverMessageId??j.id)===f.replyId);F?.role!=="assistant"&&F?.role!=="operator"||Fe(F,f.canContinue,f.generation,f.activityAt)},Be=(f,F,j,Y)=>{Ge(),Ke={replyId:f.serverMessageId??f.id,canContinue:F,generation:j,activityAt:Y,timer:setTimeout(Le,Fg)}},Ze=(f,F,j,Y=Date.now(),re=!0)=>{Ge();let me=_t(f,F,Y);if(!me)return;let M=`${f.serverMessageId??f.id}:${j}`;M!==ue&&(ue=M,p(me),re&&Me&&(qe=!0))},Oe=(f,F)=>{(f||!S.localSendRef.current)&&S.settle(F),f&&y()},Ve=(f,F=[],j=!1,Y,re=Re,me=ie,I=Date.now(),M=!0)=>{let W=a.current;if(f.canceled){Ze(f,re,me,I,M),Oe(j,Y);return}let V=!0,ge=f.status==="error";switch(wl(f,ge)){case"drop":r.value=r.value.filter(ye=>ye!==f),V=!1;break;case"complete-operator-routed":f.status="complete",j&&(h.play("messageReceived"),Dn(P,W,"assistant",Ue(f)));break;case"error":{if(f.status="error",f.errorText=W.strings.errorGeneric,j){h.play("error");let ye=new Error(ge?"stream error chunk":"empty reply");P.emit("error",ye),W.onError?.(ye)}break}case"complete":f.status="complete",j&&(h.play("messageReceived"),Dn(P,W,"assistant",Ue(f))),_(f,F);break}V&&Ze(f,re,me,I,M),Oe(j,Y)},nt=f=>{if(z.signal.aborted||o.value!==Q)return;if(c(f),d?.(f),f.type==="start"){Le();let ye=f.messageId===void 0?void 0:r.value.find(ke=>ke.serverMessageId===f.messageId||ke.id===f.messageId);U=ye!==void 0&&ye.status!=="streaming";let vt=_e?.senderRole==="visitor"?_e.messageId:void 0;if(_e={messageId:f.messageId,senderRole:f.messageMetadata?.senderRole},ie+=1,Ae=Date.now(),be=void 0,K=f.messageMetadata?.senderRole===void 0,G=!1,X=K?f.messageMetadata?.runId:void 0,K){let ke=f.messageId!==void 0&&r.value.some(yo=>yo.serverMessageId===f.messageId||yo.id===f.messageId),pt=r.value.at(-1),bo=f.messageId!==void 0&&(pt?.serverMessageId===f.messageId||pt?.id===f.messageId),jr=S.localSendRef.current&&(!ke||bo)&&pt?.role==="assistant"&&pt.status==="streaming"&&(bo||pt.serverMessageId===void 0&&pt.partsSig.value.length===0);G=S.captureStart(Q,f,jr,vt)}}let F=K&&(f.type==="finish"||f.type==="error"||f.type==="abort"),j=F?X:void 0,Y=F&&(G||S.ownsLocalRun(j)),re=ie,me=U;f.type==="finish"&&f.canContinue!==void 0&&(Re=f.canContinue);let I=Re;F&&(K=!1,G=!1,X=void 0);let M=D.applyResume(f),W=_e?.messageId,V=W===void 0?void 0:r.value.find(ye=>ye.serverMessageId===W||ye.id===W);U&&_e?.senderRole!=="visitor"&&(M!==null||V?.status==="streaming")&&(U=!1,me=!1);let ge=!U&&(V?.role==="assistant"||V?.role==="operator");if(f.type==="text-delta"&&ge&&Be(V,Re,ie,Ae),f.type==="text-end"&&(Ge(),ge&&Fe(V,Re,ie,Ae)),f.type==="finish"&&f.canContinue===!1&&x(!1),!M){F&&(Y||!S.localSendRef.current)&&S.settle(j);return}if(M.role==="operator"){me||(h.play("messageReceived"),Dn(P,a.current,"operator",Ue(M))),Ze(M,I,re,Ae),U=!1,F&&(Y||!S.localSendRef.current)&&S.settle(j);return}M.role==="assistant"&&(Ve(M,[],Y,j,I,re,Ae),U=!1)},We=async f=>{let F=ie,j=await s.loadConversation(Q,f?{ids:[f]}:void 0).catch(()=>null);if(z.signal.aborted||o.value!==Q||!j)return!1;j.controlState&&c({type:"data-control-state",data:j.controlState});let Y=r.value.at(-1),re=F===ie&&(f===void 0||Y!==void 0&&(Y.serverMessageId===f||Y.id===f));if(j.messages.length===0)return!0;re&&(Re=j.canContinue,x(Re));let me=r.value,I=f===void 0?me.at(-1):me.find(ke=>ke.serverMessageId===f||ke.id===f),{messages:M,changed:W}=ro(me,Kt(j.messages));if(!W)return!0;r.value=M;let V=f===void 0?M.at(-1):M.find(ke=>ke.serverMessageId===f||ke.id===f),ge=I!==void 0&&V!==void 0&&(I.id===V.id||I.serverMessageId!==void 0&&I.serverMessageId===V.serverMessageId),ye=V!==void 0&&V.status!=="streaming"&&(!ge||I?.status==="streaming"),vt=ge&&I?.status==="streaming"?Date.now():V?.createdAt;return re&&ye&&V.role==="assistant"?Ve(V,V.suggestions??[],S.localSendRef.current,void 0,j.canContinue,F,vt,!1):re&&ye&&V.role==="operator"?Ze(V,j.canContinue,F,vt,!1):re&&V?.role==="assistant"&&V.status!=="streaming"&&_(V,V.suggestions??[]),!0},Se=new Set;A=({messageId:f})=>{if(Se.has(f)||!r.value.some(j=>j.serverMessageId===f||j.id===f))return;Se.add(f);let F=()=>Se.delete(f);We(f).then(F,F)};let ot=(f=!1)=>{if(z.signal.aborted||o.value!==Q){qe=!1;return}if(Me){qe=!0;return}let F=f?b(Q)??(w()?We():void 0):We();if(!F)return;m(Q),Me=F;let j=(Y=!1)=>{if(Me===F){if(Me=void 0,qe){qe=!1,ot();return}Y&&g(Q)}};F.then(j,()=>j(!1))},kt=u.subscribe(f=>{f<=E.current||(E.current=f,at&&ot())});return Xd({signal:z.signal,now:()=>performance.now(),sleep:f=>to(f,z.signal),connect:f=>s.connectResumeStream({signal:z.signal,onChunk:nt,onConnected:f}),onInitialBoundaryReady:()=>{at=!0,ot(!0)},backfill:()=>ot()}),()=>{z.abort(),Ge(),kt(),D.detach()}},[t,n,o,o.value,l,s,c,d,_,p,u,m,g,y,S,k,x,r,P,h,b,w])}var Bg=32;function Jd(e){let{transport:t,setStreaming:n}=e,o=N(),r=N(),a=N(!1),s=N(),l=N(!1),c=N(new Map),d=N(new Set),_=L((b,w)=>{let E=`${b}:${w}`;s.current!==E&&(s.current=E,t.cancelTurn(b,w))},[t]),p=L(b=>{o.current=void 0,r.current=b,a.current=!1,s.current=void 0,l.current=!0,n(!0)},[n]),u=L((b,w)=>{c.current.set(b,{messageId:w})},[]),m=L(b=>{b!==void 0&&(d.current.add(b),d.current.size>Bg&&d.current.delete(d.current.values().next().value)),!(b!==void 0&&o.current?.runId!==b)&&(o.current=void 0,r.current=void 0,a.current=!1,l.current=!1,n(!1))},[n]),g=L((b,w)=>r.current!==b?w.runId&&o.current?.runId===w.runId?(o.current={conversationId:w.conversationId,runId:w.runId},a.current&&_(w.conversationId,w.runId),!0):!1:(r.current=void 0,w.runId?(o.current={conversationId:w.conversationId,runId:w.runId},n(!0),a.current&&_(w.conversationId,w.runId),!0):(m(),!0)),[_,n,m]),y=L((b,w)=>{let E=c.current.get(b);return E?(c.current.delete(b),!w.runId||d.current.has(w.runId)?!0:E.runId!==void 0?(E.runId!==w.runId||o.current?.runId===w.runId&&(o.current={conversationId:w.conversationId,runId:w.runId},a.current&&_(w.conversationId,w.runId)),!0):(l.current||r.current||(o.current={conversationId:w.conversationId,runId:w.runId},r.current=void 0,a.current=!1,s.current=void 0,l.current=!0,n(!0)),!0)):!1},[_,n]),S=L(b=>r.current!==b?!1:(m(),!0),[m]),k=L(b=>{let w=c.current.get(b);return w?(c.current.delete(b),w.runId===void 0):!1},[]),x=L((b,w,E,Q)=>{let z=w.messageMetadata?.runId;if(w.messageMetadata?.senderRole!==void 0||typeof z!="string"||!z||d.current.has(z))return!1;if(o.current?.runId===z)return l.current;if(l.current)return o.current||!E?!1:(r.current=void 0,o.current={conversationId:b,runId:z},n(!0),a.current&&_(b,z),!0);let D=[...c.current.values()].filter(K=>K.runId===void 0).find(K=>K.messageId===Q);return D?(D.runId=z,o.current={conversationId:b,runId:z},r.current=void 0,a.current=!1,s.current=void 0,l.current=!0,n(!0),!0):(r.current=void 0,o.current={conversationId:b,runId:z},n(!0),a.current&&_(b,z),l.current)},[_,n]),h=L(b=>typeof b=="string"&&o.current?.runId===b&&l.current,[]),P=L(()=>{let b=o.current;if(b)return a.current=!0,_(b.conversationId,b.runId),!0;let w=r.current;return w?(a.current=!0,w.then(E=>{E.runId&&_(E.conversationId,E.runId)}).catch(()=>{}),!0):!1},[_]);return oe(()=>({localSendRef:l,begin:p,beginRouted:u,acceptAck:g,acceptRoutedAck:y,reject:S,rejectRouted:k,captureStart:x,ownsLocalRun:h,settle:m,stop:P}),[g,y,p,u,x,h,S,k,m,P])}var Hg=te.scope("send");function eu(e,t,n,o,r,a=!0){e.publishConversation({...lr(t,n,o,r,a),hasUnread:!1},!0)}function tu(e,t){return e.id===t.id||(e.serverMessageId??e.id)===(t.serverMessageId??t.id)}function nu(e){return e.findLast(t=>!t.ephemeral&&t.role!=="system"&&(t.role==="user"||t.status!=="streaming"||St(t)))}function vo(e,t,n,o,r){let a=nu(t);!a||a.role!=="user"||!tu(a,n)||eu(e,t,a,o,r)}function Zd(e){return!(e instanceof Qe)||e.code==="network"||e.status===void 0||e.status===202?!0:e.status===408||e.status===425||e.status===429||e.status>=500&&e.status<600}function ou(e){let{transport:t,messagesSig:n,conversationIdSig:o,options:r,bus:a,feedback:s,persistence:l,visitorId:c,adoptConversationId:d,applyControlState:_,setCanSend:p,settleSuggestions:u,runCancellation:m}=e,g=L(()=>{let k=o.value??ct();return o.value||(o.value=k,l.saveConversationId(k)),k},[o,l]),y=L(async({continueExisting:k,turn:x})=>{let h=g(),P=n.value.at(-1),b=x?[x]:bl(n.value,k),w=b[0],E=Da({messages:b.map(za),conversationId:h,visitorId:c,userPrefs:l.loadUserPrefs()}),Q=t.sendTurn(E);m.begin(Q);try{let z=await Q;if(o.value!==h||!m.acceptAck(Q,z))return!1;if(d(z.conversationId),z.runId&&w?.role==="user"&&vo(t,n.value,w,z.conversationId,r.strings.newConversation),!z.runId){let A=await t.loadConversation(z.conversationId).catch(()=>null);if(o.value!==z.conversationId)return!0;if(A){A.controlState&&_(A.controlState),p(A.canContinue);let D=Kt(A.messages),{messages:K,changed:G}=ro(n.value,D);G&&(n.value=K);let X=D.findLast(ie=>!ie.ephemeral&&ie.role!=="system"),U=nu(n.value);U&&X&&tu(U,X)&&eu(t,n.value,U,z.conversationId,r.strings.newConversation,A.canContinue);let _e=P?n.value.find(ie=>ie.id===P.id&&ie.role==="assistant"&&ie.status!=="streaming"):void 0;_e&&u(_e,_e.suggestions??[]),!k&&P?.role==="assistant"&&n.value.includes(P)&&P.serverMessageId===void 0&&!St(P)&&(n.value=n.value.filter(ie=>ie!==P))}else P?.role==="assistant"&&n.value.includes(P)&&(P.status="error",P.errorText=r.strings.errorGeneric,k?P.retryAction={kind:"continue-assistant",messageId:P.serverMessageId??P.id}:P.retryAction=w?.role==="user"?{kind:"resend-user",messageId:w.id}:null,n.value=[...n.value])}return!0}catch(z){if(o.value!==h)return!1;if(!m.reject(Q))return w?.role==="user"&&vo(t,n.value,w,h,r.strings.newConversation),!0;let A=ln(z,r.strings),D=Zd(z),K=x?.role==="assistant"?x:n.value.at(-1);if(k&&K?.role==="assistant"&&z instanceof Qe&&z.status===409){let G=K.serverMessageId??K.id,X=await t.loadConversation(h,{ids:[G]}).catch(()=>null);if(o.value!==h)return!1;if(X){X.controlState&&_(X.controlState),p(X.canContinue);let U=Kt(X.messages),_e=U.find(ie=>(ie.serverMessageId??ie.id)===G);if(_e&&Sl(K,_e)){let{messages:ie,changed:Re}=ro(n.value,U),ue=ie.find(be=>(be.serverMessageId??be.id)===G);if(Re&&ue&&ue!==K)return ue.awaitingContinuation=!1,ue.continuationStreaming=void 0,ue.retryAction=null,n.value=ie,ue.status!=="streaming"&&u(ue,ue.suggestions??[]),!0}}if(!n.value.includes(K)||K.status!=="streaming")return!1;K.continuationStreaming=!0}if(k&&K?.role==="assistant")K.status="error",K.errorText=A,K.retryAction=D?{kind:"continue-assistant",messageId:K.serverMessageId??K.id}:null,n.value=[...n.value];else if(P?.role==="assistant"&&n.value.includes(P)){P.status="error",P.errorText=A;let G=b[0];P.retryAction=D&&G?.role==="user"?{kind:"resend-user",messageId:G.id}:null,n.value=[...n.value]}else{let G=Nt();G.status="error",G.errorText=A;let X=b[0];G.retryAction=D&&X?.role==="user"?{kind:"resend-user",messageId:X.id}:null,n.value=[...n.value,G]}return s.play("error"),a.emit("error",z),r.onError?.(z),!1}},[t,n,r,a,s,l,c,d,_,p,u,g,m]),S=L(async k=>{let x=g();k.status="pending",k.errorText=void 0,k.retryAction=void 0,n.value.includes(k)&&(n.value=[...n.value]);let h=Da({messages:[za(k)],conversationId:x,visitorId:c,userPrefs:l.loadUserPrefs()}),P=t.sendTurn(h);m.beginRouted(P,k.id);try{let b=await P;return o.value!==x?(m.rejectRouted(P),!1):m.acceptRoutedAck(P,b)?(d(b.conversationId),vo(t,n.value,k,b.conversationId,r.strings.newConversation),k.status==="pending"&&(k.status="complete",n.value.includes(k)&&(n.value=[...n.value])),!0):!1}catch(b){let w=m.rejectRouted(P);if(o.value!==x)return!1;if(!w)return vo(t,n.value,k,x,r.strings.newConversation),k.status==="pending"&&(k.status="complete",n.value.includes(k)&&(n.value=[...n.value])),!0;if(k.status!=="pending")return vo(t,n.value,k,x,r.strings.newConversation),!0;Hg.debug("operator-routed send failed",{error:b});let E=b instanceof Error?b:new Error(String(b));return k.status="error",k.errorText=ln(b,r.strings),k.retryAction=Zd(b)?{kind:"resend-user",messageId:k.id}:null,n.value.includes(k)&&(n.value=[...n.value]),s.play("error"),a.emit("error",E),r.onError?.(E),!1}},[t,n,r,a,s,l,c,d,g,m]);return{sendAiTurn:y,sendRoutedTurn:S}}var Ug=te.scope("unread");function ru(e){let{transport:t,options:n,conversationIdSig:o,isConversationVisibleRef:r,activated:a,conversationReady:s}=e,l=gt(!1),c=gt(0),d=N([]),_=N(),p=N(!1),u=L(()=>{let b=o.value,w=r.current()&&_.current===b?b:void 0;l.value=d.current.some(E=>E.hasUnread&&E.conversationId!==w)},[o,l,r]),m=L(b=>{let w=o.value,E=d.current.find(D=>D.conversationId===w),Q=Ot(d.current,b),z=Q.find(D=>D.conversationId===w),A=b.type==="snapshot"&&w!==void 0&&z?.hasUnread===!0&&_.current===w&&E!==void 0&&E.lastMessageAt!==z.lastMessageAt;A&&(_.current=void 0),d.current=Q,u(),A&&(c.value+=1)},[o,u,c]),g=L(()=>{if(u(),!r.current())return;let b=o.value;if(!b||_.current!==b)return;let w=d.current.find(E=>E.conversationId===b);w?.hasUnread&&t.markRead(b,w.lastMessageAt)},[o,r,u,t]),y=L(b=>{o.value===b&&(_.current=void 0,u())},[o,u]),S=L(b=>{o.value===b&&(_.current=b,g())},[o,g]),k=L(b=>_.current===b,[]),x=L((b=!1)=>{n.modules.list.some(w=>w.layout==="chat")&&(p.current||(p.current=!0,t.listConversations({limit:50},b).then(w=>{b||m({type:"snapshot",result:w,requestedRevision:0}),g()}).catch(w=>Ug.debug("refreshUnread failed (non-fatal)",{err:w})).finally(()=>{p.current=!1})))},[m,g,n.modules,t]),h=L(b=>{let w=b.conversationId,E=r.current()&&o.value===w&&_.current===w,Q=d.current.find(A=>A.conversationId===w),z=E&&(Q?.lastMessageAt!==b.lastMessageAt||Q.hasUnread);t.publishConversation({...b,hasUnread:!E},!0),z&&t.markRead(w,b.lastMessageAt)},[o,r,t]);O(()=>t.subscribeConversationChanges(m),[m,t]);let P=N(!1);return O(()=>{!a||!s||P.current||(P.current=!0,x())},[a,s,x]),O(()=>{if(!a)return;let b=()=>{document.visibilityState==="visible"&&(g(),x(!0))};return document.addEventListener("visibilitychange",b),()=>document.removeEventListener("visibilitychange",b)},[a,g,x]),{hasUnreadSig:l,transcriptRecoverySig:c,markVisibleConversationRead:g,beginConversationTranscript:y,commitConversationTranscript:S,isConversationTranscriptCommitted:k,recordConversationReply:h}}var ho=te.scope("settings");function au(e){let{options:t,persistence:n,transport:o,feedback:r,hostElement:a,bus:s}=e,l=n.loadUserPrefs(),[c,d]=$(()=>l.locale??t.locale),[_,p]=$(()=>l.themeMode??t.themeMode),[u,m]=$(()=>l.textSize??t.textSize),g=L(P=>{n.patchUserPrefs(P),o.saveUserPrefs(n.loadUserPrefs()).catch(b=>ho.warn("saveUserPrefs failed",{err:b}))},[n,o]);O(()=>{l.soundMuted!==void 0&&r.setMuted(l.soundMuted)},[]),O(()=>{a.dataset.theme=_},[a,_,t]),O(()=>{a.dataset.textSize=u},[a,u,t]),O(()=>{let P=!0;return r.mutedSig.subscribe(b=>{if(P){P=!1;return}g({soundMuted:b})})},[r,g]);let y=yn(c,t.availableLocales,t.defaultLocale);O(()=>{o.setLocale(y)},[o,y]),O(()=>{a.dir=rs(y)?"rtl":"ltr"},[a,y]),O(()=>{y!==c&&d(y)},[y,c]);let S=L(P=>{ho.info("localeChange",{locale:P}),d(P),g({locale:P}),s.emit("localeChange",P)},[g,s]),k=L(P=>{ho.info("themeChange",{mode:P}),p(P),a.dataset.theme=P,g({themeMode:P}),s.emit("themeChange",P)},[a,g,s]),x=L(P=>{ho.info("textSizeChange",{size:P}),m(P),a.dataset.textSize=P,g({textSize:P}),s.emit("textSizeChange",P)},[a,g,s]),h=L(()=>{r.toggleMuted();let P=r.mutedSig.value;ho.info("soundToggle",{muted:P}),s.emit("soundToggle",{muted:P})},[r,s]);return{activeLocale:c,activeThemeMode:_,activeTextSize:u,effectiveLocale:y,setActiveLocale:d,setActiveThemeMode:p,setActiveTextSize:m,patchAndSync:g,handleLocaleChange:S,handleThemeChange:k,handleTextSizeChange:x,handleSoundToggle:h}}var he=te.scope("app"),Vr=T.cssPrefix;function iu(e,t){return hl({...e,text:rt(t,e.text)})}function su({options:e,hostElement:t,bus:n}){let o=e.aiAgentDeploymentId;if(!o)throw new Error("aiAgentDeploymentId is required");let[r]=$(()=>Pn(e.widgetId,e.storage,e.aiAgentDeploymentId)),[a]=$(()=>r.getVisitorId()),s=r.loadUserPrefs(),l=gt(r.loadConversationId()),c=N(l.value!==void 0),d=gt(l.value??""),_=gt([]),[p,u]=$(!1),m=N(),[g,y]=$([]);function S(){let v=e.modules.list,C=new Set(v.map(q=>q.id)),J=r.loadActiveModule();return J&&C.has(J)?J:v[0]?.id??""}function k(){return e.modules.list.find(v=>v.layout==="chat")?.id}function x(){let v=k();return v?e.modules.list.length===1?!0:P.sig.value.activeTab===v:!1}let h=N();if(!h.current){let v=e.modules.list.map(J=>J.id),C=r.loadActiveModule()??v[0]??"";h.current=bd(C,C?[...v,C]:v,J=>r.saveActiveModule(J))}let P=h.current,b=dt(()=>P.sig.value.activeTab).value,w=dt(()=>l.value).value,[E,Q]=$(!1),[z,A]=$(null),[D,K]=$(!1),G=e.mode==="standalone"||e.mode==="inline",X=N(eo(e,wn(),r.loadPanelOpen(),r.loadPanelSize())),[U,_e]=$(X.current.panelOpen),[ie,Re]=$(X.current.panelOpen),ue=N(),be=N(),Ae=N(!1),Me=N(void 0);O(()=>{U&&Re(!0)},[U]);let qe=N(!1),[at,_t]=$(!1),{dismissed:Fe,dismissCallout:Ke}=zd({callout:e.launcher.callout,persistence:r}),Ge=e.launcher.callout?.persistent??!0,Le=L(()=>{he.info("calloutDismiss"),n.emit("calloutDismiss",void 0),Ke()},[n,Ke]),[Be,Ze]=$(X.current.panelSize),Oe=N(!1),[Ve,nt]=$("chat"),We=N(()=>!1);We.current=()=>U&&Ve==="chat"&&!document.hidden&&x();let[Se,ot]=$(!0),kt=N(Se);kt.current=Se;let[f,F]=$(!1),j=N(f);j.current=f;let Y=N(null),[re,me]=$(!1),[I,M]=$(null),[W,V]=$([]),ge=N(e.strings),ye=N(e);ye.current=e;let[vt,ke]=$(void 0),[pt,bo]=$(void 0),[jr,yo]=$(()=>r.loadSidebarCollapsed()??!1),[Qr,fu]=$({}),[le]=$(()=>new sr({agentApiBaseUrl:e.agentApiBaseUrl,dataApiBaseUrl:e.dataApiBaseUrl,auth:nl({publicKey:e.publicKey,aiAgentDeploymentId:o,publicKeyHeader:"x-public-key"}),endpoints:e.endpoints})),[ft]=$(()=>new mr(e.sound,e.haptics)),Bt=Jd({transport:le,setStreaming:F}),{activeLocale:Po,activeThemeMode:ki,activeTextSize:wi,effectiveLocale:un,setActiveLocale:mu,setActiveThemeMode:gu,setActiveTextSize:vu,patchAndSync:Ci,handleLocaleChange:hu,handleThemeChange:bu,handleTextSizeChange:yu,handleSoundToggle:Pu}=au({options:e,persistence:r,transport:le,feedback:ft,hostElement:t,bus:n}),{controlModeSig:Rt,assignedOperatorInitialsSig:xu,operatorAvailableSig:Su,applyControlState:$n,adoptControlStateChunk:ku,requestOperator:wu,cancelOperatorRequest:Cu}=qd({transport:le,conversationIdSig:l}),Ht=gt(new Map),Ru=L(v=>{if(v.type!=="data-memory-compaction-state")return;let C=l.value;if(!C)return;let J=ul(v.data);if(!J)return;let q=Ht.value.get(C);if(q&&(J.postFinishSequence<q.postFinishSequence||J.postFinishSequence===q.postFinishSequence&&(q.status==="ready"||q.status===J.status)))return;let ae=new Map(Ht.value);ae.set(C,J),Ht.value=ae},[l,Ht]),{hasUnreadSig:Tu,transcriptRecoverySig:Iu,markVisibleConversationRead:Ri,beginConversationTranscript:Xr,commitConversationTranscript:_n,isConversationTranscriptCommitted:Ti,recordConversationReply:Eu}=ru({transport:le,options:e,conversationIdSig:l,isConversationVisibleRef:We,activated:ie,conversationReady:E});O(()=>{Ri()},[b,U,Ve,w,Ri]),O(()=>{ft.update(e.sound,e.haptics)},[ft,e.sound,e.haptics]),O(()=>()=>ft.destroy(),[ft]),O(()=>{Oe.current||!e.size.initialSize||(Oe.current=!0,!r.loadPanelSize()&&Ze(Na(e.mode,e.size,wn())))},[e.mode,e.size,r]),O(()=>{if(!E||qe.current)return;qe.current=!0;let v=eo(e,wn(),r.loadPanelOpen(),r.loadPanelSize());_e(v.panelOpen),Ze(v.panelSize)},[E,e,r]);let Ii=N(null);O(()=>{E&&P.reconcile(e.modules.list.map(v=>v.id),S())},[E,e.modules.list,P]);let xo=L(v=>{!v||v.length===0||(_.value=v.map(C=>iu(C,ge.current)))},[_]),Yr=N(null),So=L(async v=>{try{let{formSubmissions:C}=await(v?le.bootstrap(v):Yr.current??le.bootstrap()),J=new Map;return C.forEach((q,ae)=>J.set(q.formId,ae)),C.filter((q,ae)=>!q.skipped||J.get(q.formId)===ae).map((q,ae)=>({key:`wire:${q.formId}:${q.createdAt??ae}`,formId:q.formId,outcome:q.skipped?"skipped":"submitted",createdAt:sl(q.createdAt),values:q.values}))}catch(C){return he.debug("bootstrap failed \u2014 no form markers (non-fatal)",{err:C}),[]}},[le]),Fn=N(0),Tt=N(0),Jr=L(v=>{if(v===l.value)return;let C=l.value;Tt.current++,u(!1),C&&(r.saveDraft(v,r.loadDraft(C)),r.saveDraft(C,""),r.saveMessageQueue(v,r.loadMessageQueue(C)),r.saveMessageQueue(C,[])),l.value=v,r.saveConversationId(v),le.primeIdentity(void 0,v),he.info("conversation rebound",{previous:C,current:v}),C&&n.emit("conversationRebound",{previous:C,current:v})},[n,l,r,le]),ko=L((v,C)=>{let J=[...v.map(H=>H.createdAt),...C.map(H=>H.createdAt)].filter(H=>H!==void 0),q=(J.length?Math.min(...J):Date.now())-1;return[...(Me.current?.messages??[]).map(H=>{let ce=iu(H,ge.current);return ce.createdAt=q,ce}),...v]},[]),Ei=L(async v=>{let C=Tt.current,J=()=>C!==Tt.current||l.value!==v;be.current===v&&(be.current=void 0),u(!0);try{let[q,ae]=await Promise.all([le.loadConversation(v),So()]);if(J())return!1;let H=Kt(q.messages);y(ae);let ce=ko(Wa(H,_.value),ae);if(_.value=ce,be.current=ce.some(xe=>xe.role==="user")?void 0:v,H.length>0||q.controlState!==void 0){ot(q.canContinue),q.controlState&&$n(q.controlState);let xe=H.findLast(it=>it.role==="assistant"&&!it.ephemeral);V(xe?.suggestions??[])}return!0}catch(q){return J()||(he.warn("loadThread failed; keeping conversation active",{err:q,conversationId:v}),n.emit("error",q),ye.current.onError?.(q)),!1}finally{J()||u(!1)}},[le,So,_,l,ko,n]),Au=L(v=>{if(ue.current===v)return ue.current=void 0,Ei(v)},[Ei]),Mu=L(()=>{if(m.current)return Promise.resolve(void 0);let v=l.value,C=_.value.find(ce=>ce.serverMessageId!==void 0),J=C?.serverMessageId,q=C?new Date(C.createdAt).toISOString():void 0;if(!v||!J||!q)return Promise.resolve(void 0);let ae=Tt.current,H={};return m.current=H,(async()=>{try{let ce=await le.loadConversation(v,{beforeId:J,beforeCreatedAt:q});if(m.current!==H||Tt.current!==ae||l.value!==v)return;if(ce.messages.length===0)return!1;let Pe=ce.messages.map(Ua),xe=_.value,it=Pl(xe,Pe);if(it!==xe){let zt=Math.min(...Pe.map(st=>st.createdAt??1/0),...g.map(st=>st.createdAt??1/0));if(Number.isFinite(zt))for(let st of xe){if(!st.ephemeral)break;(st.createdAt??1/0)>=zt&&(st.createdAt=zt-1)}_.value=it}return!0}catch(ce){if(m.current!==H||Tt.current!==ae||l.value!==v)return;he.warn("load previous messages failed",{err:ce,conversationId:v,beforeId:J}),n.emit("error",ce),e.onError?.(ce);return}finally{m.current===H&&(m.current=void 0)}})()},[n,l,g,_,e,le]),Bn=L(async({newConversation:v})=>{let C=++Fn.current,J=()=>C!==Fn.current,q=l.value,ae=v||!q?ct():q;ae!==q&&(Tt.current++,u(!1),ht(()=>{l.value=ae,d.value=ae}),r.saveConversationId(ae)),le.primeIdentity(a,ae);let H;try{H=await le.handshake({visitorId:a,conversationId:ae,userPrefs:r.loadUserPrefs(),locale:Po})}catch(xe){if(J())return;n.emit("error",xe),e.onError?.(xe),v||Q(!0);return}if(J())return;H.conversationId!==ae&&Jr(H.conversationId),M(H.agent),e.mode==="page"&&(H.site&&el(H.site)?ke(H.site):H.site&&he.warn("invalid site config, using fallback",{site:H.site}),H.blocks&&tl(H.blocks)?bo(H.blocks):H.blocks&&he.warn("invalid blocks config, using fallback",{blocks:H.blocks}));let ce=Ta(H.userPrefs);if(Object.keys(ce).length>0&&!v&&(r.saveUserPrefs(ce),ce.locale&&mu(ce.locale),ce.soundMuted!==void 0&&ft.setMuted(ce.soundMuted),ce.themeMode&&gu(ce.themeMode),ce.textSize&&vu(ce.textSize)),Me.current=H.welcome,v||n.emit("handshake",H),H.welcome?.suggestions){let xe=ge.current;V(H.welcome.suggestions.map(it=>({...it,label:rt(xe,it.label),...it.text===void 0?{}:{text:rt(xe,it.text)}})))}let Pe=!v&&q&&H.conversationId===q;c.current=!!Pe,Pe?Ae.current||(ue.current=H.conversationId):(be.current=H.conversationId,xo(H.welcome?.messages),_n(H.conversationId)),v||Q(!0)},[le,a,r,e,n,l,d,ft,xo,Po,Jr,_n]),Hn=JSON.stringify(e.userContext??null),Lu=JSON.stringify(e.pageContext??null),Ou=JSON.stringify(Qr);O(()=>{let v=Object.keys(Qr).length?{...Qr,...e.userContext}:e.userContext;le.setContext(v,zg(e.pageContext))},[le,Hn,Lu,Ou]);let Ai=L((v,C=[])=>V(v.suggestions??C),[]);O(()=>(le.primeIdentity(a,l.value),Bn({newConversation:!1}),()=>{Fn.current++,Tt.current++}),[]),O(()=>{!ie||!E||Ae.current||(Ae.current=!0,Yr.current=le.bootstrap(),(async()=>{try{let v=await Yr.current;A(Gn((v??{forms:[]}).forms,un))}catch(v){he.debug("bootstrap failed \u2014 treating as no forms",{err:v})}finally{K(!0)}})(),ue.current===l.value&&u(!0))},[ie,E]);let wo=N(null);O(()=>{if(!ie||!E)return;if(wo.current===null){wo.current=un;return}if(wo.current===un)return;wo.current=un;let v=!1;return le.bootstrap().then(C=>{v||A(Gn((C??{forms:[]}).forms,un))}).catch(C=>he.debug("forms re-localize failed \u2014 keeping current copy",{err:C})),()=>{v=!0}},[ie,E,un,le]);let Mi=N(Hn);O(()=>{!E||Mi.current===Hn||(Mi.current=Hn,Bn({newConversation:!1}))},[Hn,E,Bn]),Kd({hostElement:t,mode:e.mode,panelSize:Be,isOpen:U,surfaceReady:E,setIsOpen:_e});let{sendAiTurn:Ut,sendRoutedTurn:pn}=ou({transport:le,messagesSig:_,conversationIdSig:l,options:e,bus:n,feedback:ft,persistence:r,visitorId:a,adoptConversationId:Jr,applyControlState:$n,setCanSend:ot,settleSuggestions:Ai,runCancellation:Bt}),{toolInteraction:Nu}=Ud({streaming:f,controlModeSig:Rt,messagesSig:_,sendAiTurn:Ut,bus:n,humanInLoop:e.features.humanInLoop}),Du=L((v,C)=>{let J=_.value.find(q=>q.serverMessageId===v);J&&(J.feedback=C),he.info("messageFeedback",{messageId:v,value:C}),n.emit("messageFeedback",{messageId:v,value:C}),le.submitFeedback({messageId:v,value:C})},[n,_,le]),$u=()=>_.value.reduce((v,C)=>v+(C.role==="user"?1:0),0),fn=e.forms.list.length>0?e.forms:z??e.forms,Ne=fd({forms:fn,persistence:r,userContext:()=>e.userContext,messageCount:$u,pageArea:()=>e.pageContext?.area?String(e.pageContext.area):void 0,conversationId:()=>l.value,onComplete:(v,C,J,q)=>{he.info("formSubmit",{formId:v.id,trigger:C,skipped:q}),n.emit("formSubmit",{formId:v.id,values:J,skipped:q}),y(H=>{let Pe=H.find(xe=>xe.formId===v.id&&xe.outcome==="skipped")?.createdAt??Date.now();return[...H.filter(xe=>!(xe.formId===v.id&&xe.outcome==="skipped")),{key:`local:${v.id}:${Pe}`,formId:v.id,outcome:q?"skipped":"submitted",createdAt:Pe,...q?{}:{values:J}}]});let ae=l.value??ct();l.value||(l.value=ae,r.saveConversationId(ae),le.primeIdentity(void 0,ae)),!q&&v.mirrorToContext&&fu(H=>({...H,...J})),le.submitForm({formId:v.id,conversationId:ae,trigger:C,values:J,skipped:q})}}),Co=dt(()=>Ne.activeForm.value),Fu=L(()=>Ne.fire("after-messages"),[Ne]),Bu=L(()=>c.current||_.value.some(v=>!v.ephemeral&&v.role==="user"),[_]);Yd({activated:ie,conversationReady:E,conversationIdSig:l,messagesSig:_,optionsRef:ye,transport:le,visitorId:a,adoptControlStateChunk:ku,adoptMemoryCompactionStateChunk:Ru,settleSuggestions:Ai,recordConversationReply:Eu,transcriptRecoverySig:Iu,beginConversationTranscript:Xr,commitConversationTranscript:_n,onReplyLanded:Fu,runCancellation:Bt,canContinueRef:kt,setCanSend:ot,feedback:ft,bus:n,loadInitialThread:Au,shouldReconcileOnConnect:Bu}),O(()=>{Ne.refresh()},[fn,Ne]);let Li=e.pageContext?.area?String(e.pageContext.area):void 0,Hu=dt(()=>_.value.length);O(()=>{E&&D&&Ne.fire("pre-chat")},[E,D,Ne]),O(()=>{D&&!Se&&Ne.fire("conversation-closed")},[D,Se,Ne]),O(()=>{E&&D&&Li&&Ne.fire("page-area")},[E,D,Li,Ne]);let Zr=oe(()=>{let v=fn.list.flatMap(C=>C.triggers).filter(C=>C.kind==="idle").map(C=>Number(C.param));return v.length?Math.min(...v)*1e3:0},[fn]);O(()=>{if(!Zr||!U)return;let v=setTimeout(()=>Ne.fire("idle"),Zr);return()=>clearTimeout(v)},[Zr,U,Ne,Hu.value]);let Oi=L(async(v,C,J)=>{if(Y.current)return!1;let q=l.value;if((q?Ht.value.get(q):void 0)?.status==="compacting")return!1;let H=Rt.value!=="ai-agent";if(he.info("send",{textLen:v.length,attachments:C.length,streaming:j.current,routedToOperator:H}),j.current&&!H)return!1;let ce=new AbortController,Pe={conversationId:q,controller:ce};Y.current=Pe,me(!0);try{ft.unlock();let xe=await Vg(le,C,ce.signal,qt=>{ce.signal.aborted||(he.warn("upload failed",{err:qt}),n.emit("error",qt),e.onError?.(qt))});if(ce.signal.aborted||l.value!==q||!kt.current||Ne.activeForm.value||(q?Ht.value.get(q):void 0)?.status==="compacting")return!1;let zt=Rt.value!=="ai-agent";if(j.current&&!zt||!v&&xe.length===0)return!1;n.emit("send",{text:v,attachmentCount:C.length}),W.length>0&&V([]),ft.play("messageSent");let st=Ha(v,xe,J);return Dn(n,e,"user",v),zt?(_.value=[..._.value,st],J?await pn(st):(pn(st),!0)):(_.value=[..._.value,st,Nt()],J?await Ut({continueExisting:!1}):(Ut({continueExisting:!1}),!0))}finally{Y.current===Pe&&(Y.current=null,me(!1))}},[le,n,e,W.length,_,l,Ht,Ut,pn,Rt]),Ni=l.value,Uu=(Ni?Ht.value.get(Ni):void 0)?.status==="compacting",zu=dt(()=>{let v=_.value.at(-1);return v?Dt(v):!1}),qu=dt(()=>_.value.some(v=>v.retryAction?.kind==="resend-user"));O(()=>{let v=l.value;return()=>{let C=Y.current;!C||C.conversationId!==v||(Y.current=null,me(!1),C.controller.abort())}},[l.value]),O(()=>{Se&&!Co.value||Y.current?.controller.abort()},[Co.value,Se]);let Vu=L(()=>{if(!Bt.stop())return;he.info("stop"),n.emit("stop",void 0);let v=_.value.at(-1);v&&v.role!=="user"&&v.status==="streaming"&&(v.canceled=!0,_.value=[..._.value])},[Bt,n,_]),Wu=L(v=>{if(f)return;let C=_.value,J=_r(C,v);if(J)switch(he.info("retry",{kind:J.kind,messageId:J.messageId}),J.kind){case"continue-assistant":{if(Rt.value!=="ai-agent"||v.role!=="assistant"||(v.serverMessageId??v.id)!==J.messageId)return;v.status="streaming",v.errorText=void 0,v.retryAction=void 0,v.awaitingContinuation=!0,_.value=[...C],Ut({continueExisting:!0,turn:v});return}case"resend-user":{let q=C.find(H=>H.role==="user"&&H.id===J.messageId);if(!q)return;if(q.status="complete",q.errorText=void 0,q.retryAction=void 0,Rt.value!=="ai-agent"){_.value=v.role==="assistant"?C.filter(H=>H!==v):[...C],pn(q);return}let ae=Nt();_.value=v.role==="assistant"?C.map(H=>H===v?ae:H):[...C,ae],Ut({continueExisting:!1,turn:q});return}case"repeat-user":{let q=C.find(Pe=>Pe.role==="user"&&Pe.id===J.messageId);if(!q)return;let ae=Ha(Ue(q),q.attachments?.map(Pe=>({...Pe}))??[]),H=new Set(ae.attachments?.flatMap(Pe=>Pe.url?[Pe.url]:[])??[]),ce=q.partsSig.value.flatMap(Pe=>Pe.kind==="file"&&!H.has(Pe.url)?[{...Pe}]:[]);if(ce.length>0&&(ae.partsSig.value=[...ae.partsSig.value,...ce]),Rt.value!=="ai-agent"){_.value=[...C,ae],pn(ae);return}_.value=[...C,ae,Nt()],Ut({continueExisting:!1,turn:ae});return}default:return J}},[f,_,Rt,Ut,pn]),Un=L(()=>{if(fc(e.mode,Be)==="exit-fullscreen"){he.info("close \u2192 exit-fullscreen",{mode:e.mode}),Ze("normal"),n.emit("fullscreen",!1);return}he.info("close \u2192 panel closed",{mode:e.mode}),Ne.fire("panel-close"),_e(!1),r.savePanelOpen(!1),n.emit("close",void 0),e.onClose?.()},[n,e,r,Be,Ne]),ea=L(()=>{he.info("open",{mode:e.mode}),ft.unlock(),_t(!0),_e(!0),r.savePanelOpen(!0),!Fe&&!Ge&&Le(),setTimeout(()=>_t(!1),qg),n.emit("open",void 0),e.onOpen?.()},[n,e,ft,r,Fe,Ge,Le]),ta=L(()=>{let v=_.value.some(C=>C.role==="user");if(be.current===l.value&&!v&&Se&&l.value){he.info("clear \u2192 reusing empty conversation",{conversationId:l.value}),_.value.length===0&&xo(Me.current?.messages);return}he.info("clear \u2192 new conversation",{wasStreaming:f}),n.emit("clear",void 0),Bt.settle(),c.current=!1,ue.current=void 0,be.current=void 0,ht(()=>{_.value=[],l.value=void 0,$n({controlMode:"ai-agent",controlRevision:0})}),r.clearConversation(),ot(!0),y([]),V([]),Bn({newConversation:!0})},[f,_,l,r,Bn,n,Se,xo,Bt,$n]),na=L(()=>{ta(),nt("chat");let v=e.modules.list.find(C=>C.layout==="chat")?.id;v&&P.switchTab(v)},[ta,P,e]),oa=L(()=>{let v=Be==="expanded"?"normal":"expanded";he.info("expand",{from:Be,expanded:v==="expanded"}),Ze(v),r.savePanelSize(v),n.emit("expand",v==="expanded")},[n,Be,r]),ra=L(()=>{let v=Be==="fullscreen"?"normal":"fullscreen";he.info("fullscreen",{from:Be,fullscreen:v==="fullscreen"}),Ze(v),r.savePanelSize(v),n.emit("fullscreen",v==="fullscreen")},[n,Be,r]),Ku=L(()=>{nt(v=>{let C=v==="history"?"chat":"history";return he.info("toggleHistory",{view:C}),n.emit("toggleHistory",{view:C}),C})},[n]),Gu=L(()=>{yo(v=>{let C=!v;return he.info("sidebarToggle",{collapsed:C}),r.saveSidebarCollapsed(C),n.emit("sidebarToggle",{collapsed:C}),C})},[r,n]),ju=L(v=>{he.info("resize",v),Ci({widgetSize:v}),n.emit("resize",v)},[Ci,n]),Qu=L(async v=>{let C=v.conversationId;if(C===l.value&&Ti(C)){he.info("selectConversation",{conversationId:C,cached:!0}),n.emit("selectConversation",{conversationId:C}),le.publishConversation(v),nt("chat");let H=k();H&&P.switchTab(H),_n(C);return}let q=++Fn.current;Tt.current++,u(!1);let ae=()=>q!==Fn.current;he.info("selectConversation",{conversationId:C,wasStreaming:f}),n.emit("selectConversation",{conversationId:C}),le.publishConversation(v);try{let[H,ce]=await Promise.all([le.loadConversation(C),So(C)]);if(ae())return;Bt.settle(),c.current=!0,ue.current=void 0;let Pe=Kt(H.messages),xe=H.conversationId!==l.value,it=xe?Pe:Wa(Pe,_.value);be.current=it.some(qt=>qt.role==="user")?void 0:H.conversationId,ht(()=>{_.value=ko(it,ce),xe&&(d.value=H.conversationId),l.value=H.conversationId}),y(ce),r.saveConversationId(H.conversationId),le.primeIdentity(a,H.conversationId),ot(H.canContinue),H.controlState&&$n(H.controlState);let zt=it.findLast(qt=>qt.role==="assistant"&&!qt.ephemeral);V(zt?.suggestions??[]),xe?Xr(H.conversationId):_n(H.conversationId),nt("chat");let st=k();st&&P.switchTab(st)}catch(H){if(ae())return;n.emit("error",H),e.onError?.(H)}},[le,_,l,d,n,e,r,So,ko,f,a,Bt,Xr,_n,Ti,P]),Ro=N(null),Di=L(v=>{typeof v=="string"&&(D?Ne.fire("manual",v):Ro.current=v)},[D,Ne]);O(()=>{!D||!Ro.current||(Ne.fire("manual",Ro.current),Ro.current=null)},[D,Ne]);let mn=N({handleOpen:ea,handleClose:Un,handleExpand:oa,handleFullscreen:ra,openForm:Di});mn.current={handleOpen:ea,handleClose:Un,handleExpand:oa,handleFullscreen:ra,openForm:Di},xt(()=>ys(t,{open:()=>mn.current.handleOpen(),close:()=>mn.current.handleClose(),expand:()=>mn.current.handleExpand(),fullscreen:()=>mn.current.handleFullscreen(),openForm:v=>mn.current.openForm(v)}),[t]);let tt=oe(()=>Ca(e,Po,ki,wi),[e,Po,ki,wi]);ge.current=tt.strings;let Xu=oe(()=>g.map(v=>{let C=fn.list.find(J=>J.id===v.formId);return{...v,title:C?.title,form:C}}),[g,fn]),aa=v=>{Qu(v)},$i={options:tt,transport:le,feedback:ft,bus:n,persistence:r,conversationId:l.value??"",composerKey:d.value,composerApiRef:Ii,view:Ve,canSend:Se,isStreaming:f,isMemoryCompacting:Uu,canReleaseQueuedMessages:E&&!p&&!Co.value&&!zu.value&&!qu.value,sendPreparing:re,composerActive:tt.mode==="page"||tt.mode==="inline"||tt.mode==="standalone"||U,controlMode:Rt.value,assignedOperatorInitials:xu.value,operatorAvailable:Su.value,operatorRequestEnabled:e.features.operatorRequest,onRequestOperator:wu,onCancelOperatorRequest:Cu,loadingMessages:p,onLoadPreviousMessages:Mu,messagesSig:_,agent:I,suggestions:W,initialWidgetSize:s.widgetSize??null,onClose:Un,onClear:ta,onExpand:oa,onFullscreen:ra,onSoundToggle:Pu,onToggleHistory:Ku,onSelectHistoryConversation:aa,onNewConversation:na,onLocaleChange:hu,onThemeChange:bu,onTextSizeChange:yu,onWidgetSizeChange:ju,onSend:Oi,onStop:Vu,onSuggestion:v=>{if(Y.current)return;let C=v.text??v.label;he.info("suggestion",{text:C,autoSend:e.autoSendSuggestions}),n.emit("suggestion",{text:C}),e.autoSendSuggestions?Oi(C,[]):Ii.current?.fill(C)},activeForm:Co.value?.form??null,formMarkers:Xu,onFormSubmit:Ne.complete,onFormSkip:Ne.skip,onFormFill:v=>Ne.fire("manual",v),tool:Nu,onRetry:Wu,onMessageFeedback:Du};if(!E)return null;let zn=tt.modules.list,ia=v=>{let C=In("close",tt.mode,v);return zn.length===0?i(Hd,{strings:tt.strings,onClose:C?Un:void 0}):zn.length===1&&zn[0]?.layout==="chat"?i(pd,{...$i,panelSize:v}):i(Bd,{panelProps:{...$i,panelSize:v,onClose:C?Un:void 0},enabledModules:zn,nav:P,bus:n,hasUnread:Tu.value,onSelectConversation:aa,onStartNewConversation:na,onSetPanelSize:Ze})};if(e.mode==="page"){let v=zn.some(C=>C.layout==="chat");return i("div",{class:`${Vr}-anchor`,children:i(vd,{site:vt,blocks:pt,transport:le,strings:tt.strings,locale:tt.locale,persistence:r,showConversations:v,onSelectConversation:aa,onNewConversation:na,sidebarCollapsed:jr,onToggleSidebarCollapsed:Gu,children:ia("fullscreen")})})}if(G){let v=e.mode==="standalone"?"fullscreen":Be;return i("div",{class:`${Vr}-anchor`,children:ia(v)})}let Fi=e.mode==="drawer",Bi=!(e.mode==="modal")&&!e.launcher.hidden&&(!U||at),Hi=Bi&&!at&&!Fe&&!Fi?tt.launcher.callout:null;return i("div",{class:`${Vr}-anchor`,"data-launcher-size":tt.launcher.size,children:[U||ie?i("div",{class:`${Vr}-surface`,hidden:!U,children:ia(Be)}):null,Bi?i(uc,{onToggle:ea,launcher:tt.launcher,strings:tt.strings,leaving:at,edgeTab:Fi}):null,Hi?i(_c,{callout:Hi,launcherPosition:tt.position,strings:tt.strings,closeLabel:tt.strings.close,onDismiss:Le}):null]})}function zg(e){let t=e?.url??(typeof location<"u"?location.href:void 0);if(!(!e&&!t))return{...e,...t?{url:t}:{}}}var qg=120;async function Vg(e,t,n,o){return(await Promise.all(t.map(async a=>{try{let{id:s,url:l}=await e.uploadFile(a.file,n);return{id:s,name:a.name,mediaType:a.mediaType,size:a.size,url:l}}catch(s){o(s);return}}))).filter(a=>a!==void 0)}var Wg=te.scope("error-boundary"),Wr=class extends lt{constructor(){super(...arguments);se(this,"state",{crashed:!1})}componentDidCatch(n,o){Wg.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 Kg="1",Gg=60,jg=2e3,lu={open:()=>{},close:()=>{},expand:e=>({on:e}),fullscreen:e=>({on:e}),send:e=>({attachments:e.attachmentCount}),message:e=>({role:e.role}),stop:()=>{},clear:()=>{},suggestion:()=>{},toggleHistory:e=>({view:e.view}),handshake:()=>{},formSubmit:e=>({formId:e.formId,skipped:e.skipped}),toolResult:()=>{},toolDecision:e=>({approved:e.approved}),messageFeedback:e=>({value:e.value??"none"}),contentView:e=>({section:e.section,tags:e.tags,count:e.count}),contentOpen:e=>({contentId:e.contentId,tags:e.tags}),contentSearch:e=>({qlen:e.queryLength,hits:e.hitCount}),contentRead:e=>({contentId:e.contentId}),contentLinkClick:e=>({contentId:e.contentId}),attach:e=>({count:e.count,bytes:e.totalBytes}),voiceStart:()=>{},voiceStop:e=>({ms:e.durationMs}),voiceCancel:()=>{},localeChange:e=>({locale:e}),themeChange:e=>({theme:e}),textSizeChange:e=>({size:e}),soundToggle:e=>({muted:e.muted}),sidebarToggle:e=>({collapsed:e.collapsed}),calloutDismiss:()=>{},error:()=>{}};function Qg(){let e=navigator;return e.globalPrivacyControl===!0||e.doNotTrack==="1"}function Xg(){return location.origin+location.pathname}function Yg(){try{return document.referrer?new URL(document.referrer).origin:""}catch{return""}}function cu(e,t){let n=Math.random(),o=0,r=0,a=new Set,s=(c,d)=>{let{tracking:_,publicKey:p,aiAgentDeploymentId:u,mode:m,themeMode:g}=t.getOptions();if(!_.enabled||Qg()||n>=_.sampleRate)return;let y=performance.now();if(y-o>6e4&&(o=y,r=0),++r>Gg)return;let S=new URLSearchParams;S.set("v",Kg),S.set("_ev",vn),S.set("e",c),_.token&&S.set("tk",_.token),p&&S.set("pk",p),u&&S.set("dep",u),S.set("vid",t.getVisitorId());let k=t.getConversationId();k&&S.set("cid",k),S.set("url",Xg());let x=Yg();x&&S.set("ref",x),S.set("sw",String(screen.width)),S.set("sh",String(screen.height)),S.set("vw",String(innerWidth)),S.set("vh",String(innerHeight)),S.set("dpr",String(devicePixelRatio)),S.set("lang",navigator.language);try{S.set("tz",Intl.DateTimeFormat().resolvedOptions().timeZone)}catch{}if(S.set("m",m),S.set("th",g),d)for(let[w,E]of Object.entries(d))E!==void 0&&S.set(w,String(E));S.set("ts",String(Date.now()));let h=`${_.endpoint}?${S}`;if(h.length>jg)return;let P=new Image(1,1);a.add(P);let b=()=>a.delete(P);P.addEventListener("load",b,{once:!0}),P.addEventListener("error",b,{once:!0}),P.src=h},l=Object.keys(lu).map(c=>e.on(c,d=>s(c,lu[c]?.(d))));return()=>{for(let c of l)c();a.clear()}}function du(e){let{bus:t,host:n,appRoot:o,persistence:r,reportError:a}=e,s=e.initialRaw,l,c=bn(s),d=!0,_=()=>{c=bn(l?Ra(s,l):s)},p=()=>{Ts(n,Qn(c.mode));let g=r.loadUserPrefs().themeMode;Is(n,g?{...c,themeMode:g}:c),d&&(Wo(n,Kr(c)),d=!1)},u=()=>{p(),Kn(Et(Wr,{onError:a},Et(su,{bus:t,hostElement:n,options:c})),o)};t.on("handshake",g=>{g.config&&(g.config.storageVersion&&r.rememberStorageVersion(g.config.storageVersion),l=g.config,_(),u())});let m=cu(t,{getOptions:()=>c,getVisitorId:()=>r.getVisitorId(),getConversationId:()=>r.loadConversationId()});return{getOptions:()=>c,getUserOptions:()=>s,render:u,setUserOptions:g=>{s=g,_(),u()},patchUserOptions:g=>{s={...s,...g},_(),u()},destroy:()=>m()}}function Kr(e){if(e.mode==="standalone")return"standalone";if(e.mode==="inline")return"inline";let t=Pn(e.widgetId,e.storage,e.aiAgentDeploymentId),{panelOpen:n,panelSize:o}=eo(e,wn(),t.loadPanelOpen(),t.loadPanelSize());return or(e.mode,o,n)}var Jg=te.scope("hooks"),Gr="*",Si=new Set;function uu(e,t,n){let o={widgetId:e,event:t,listener:n};return Si.add(o),()=>{Si.delete(o)}}function Zg(e,t,n){let o=[...Si];for(let r of o)if(ev(r.widgetId,e.widgetId)&&!(r.event!==Gr&&r.event!==t))try{r.listener(e,t,n)}catch(a){Jg.warn("hook listener threw",{event:t,error:a})}}function _u(e,t){let n=[];for(let o of tv)n.push(t.on(o,r=>{Zg(e,o,r)}));return()=>{for(let o of n)o()}}function ev(e,t){return e===Gr||e===t}var tv=["open","close","expand","fullscreen","resize","message","send","stop","clear","selectConversation","suggestion","toggleHistory","formSubmit","toolResult","toolDecision","messageFeedback","contentView","contentOpen","contentSearch","contentRead","contentLinkClick","attach","removeAttachment","voiceStart","voiceStop","voiceCancel","localeChange","themeChange","textSizeChange","soundToggle","sidebarToggle","calloutDismiss","error","handshake","conversationRebound"];var Ft=new Map;function pu(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");e.debug!==void 0&&Ho(e.debug);let t=te.scope("mount");t.info("mount",{widgetId:e.widgetId,publicKey:e.publicKey,mode:e.presentation?.mode});let n=bn(e),o=n.widgetId,r=Ft.get(o);r&&(t.debug("destroy existing instance at slot",{widgetId:o}),r.destroy());let a=Kr(n),s=n.iframe?Ms({position:Qn(n.mode)},n.position,a,n.mode,e.target??null):Vo({position:Qn(n.mode),target:e.target??null});s.hostElement.dataset.widgetId=o;let l=new Go,c=Pn(o,n.storage,n.aiAgentDeploymentId),d=y=>{l.emit("error",y),_.getOptions().onError?.(y)},_=du({bus:l,host:s.hostElement,appRoot:s.appRoot,persistence:c,initialRaw:e,reportError:d});_.render();let p=s.hostElement,u=null,m=y=>{y.debug!==void 0&&Ho(y.debug),_.patchUserOptions(y)},g={widgetId:o,open:()=>jn(p,"open"),close:()=>jn(p,"close"),expand:()=>jn(p,"expand"),openForm:y=>jn(p,"openForm",y),on:(y,S)=>l.on(y,S),update:y=>{t.debug("update",{patch:y}),m(y)},setUserContext:y=>{t.debug("setUserContext",{keys:Object.keys(y)}),m({userContext:{..._.getUserOptions().userContext,...y}})},clearUserContext:()=>{t.debug("clearUserContext"),m({userContext:void 0})},setPageContext:y=>{t.debug("setPageContext",{keys:Object.keys(y)}),m({pageContext:{..._.getUserOptions().pageContext,...y}})},clearPageContext:()=>{t.debug("clearPageContext"),m({pageContext:void 0})},setDebug:y=>{Ho(y),t.info("debug level set",{level:ya()})},debugLevel:()=>ya(),onLog:y=>ds(y),destroy:()=>{t.info("destroy",{widgetId:o}),u?.(),_.destroy(),l.clear(),Kn(null,s.appRoot),s.destroy(),Ft.get(o)===g&&Ft.delete(o)}};return u=_u(g,l),Ft.set(o,g),g}function nv(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");let t=e.widgetId??"default",n=Ft.get(t);return n?(n.update(e),n):pu(e)}function ov(e){if(e!==void 0){Ft.get(e)?.destroy();return}let t=[...Ft.values()];for(let n of t)n.destroy()}function rv(e="default"){return Ft.get(e)??null}function av(){return[...Ft.values()]}function iv(e,t,n){return uu(e,t,n)}var sv=vn,lv=T;
|
|
42
42
|
//# sourceMappingURL=elements.cjs.js.map
|