@helpai/elements 1.10.0 → 1.11.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.
@@ -1,17 +1,17 @@
1
- var Q_=Object.defineProperty;var Y_=(e,t,n)=>t in e?Q_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ee=(e,t,n)=>Y_(e,typeof t!="symbol"?t+"":t,n);var pe,pl,si,sn,oi,vo,_l,go,fl,li,ai,X_,ho={},bo=[],J_=/^m(i|n|o|s|text|space)$/,yo=Array.isArray,ci=bo.slice,Pn=Object.assign;function yn(e){e&&e.parentNode&&e.remove()}function Hn(e,t,n){var r,o,a,i={},s=arguments.length;for(a in t)a=="key"?r=t[a]:a=="ref"&&typeof e!="function"?o=t[a]:i[a]=t[a];return s>2&&(i.children=s>3?ci.call(arguments,2):n),xr(e,i,r,o,null)}function xr(e,t,n,r,o){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o||++pl,__i:-1,__u:0};return!o&&pe.vnode&&pe.vnode(a),a}function _e(e){return e.children}function Ot(e,t){this.props=e,this.context=t,this.__g=0}function ln(e,t){if(t==null)return e.__&&ln(e.__,e.__i+1);for(var n;t<e.__k.length;t++)if((n=e.__k[t])&&n.__e)return n.__e;return typeof e.type!="function"||e.props.__P?null:ln(e)}function ml(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),ml(e)}function ul(e){(8&e.__g||(e.__g|=8,sn.push(e),vo++))&&oi==pe.debounceRendering||((oi=pe.debounceRendering)||queueMicrotask)(gl)}function gl(){var e,t,n,r,o,a,i,s,c;try{for(t=1;sn.length;)sn.length>t&&sn.sort(_l),e=sn.shift(),t=sn.length,8&e.__g&&(r=void 0,o=void 0,a=(o=(n=e).__v).__e,i=[],s=[],(c=n.__P)&&((r=Pn({constructor:void 0},o)).__v=o.__v+1,pe.vnode&&pe.vnode(r),ui(c,r,o,n.__n,c.namespaceURI,32&o.__u?[a]:null,i,a||ln(o),32&o.__u,s),r.__v=o.__v,r.__.__k[r.__i]=r,yl(i,r,s),o.__=o.__e=null,r.__e!=a&&ml(r)))}finally{(vo=sn.length)&&(oi||queueMicrotask)(gl)}}function vl(e,t,n,r,o,a,i,s,c,p,d){var _,u,f,m,h,y,x=r.__k||bo,S=t.length;for(c=Z_(n,t,x,c,S),_=0;_<S;_++)(f=n.__k[_])!=null&&(u=~f.__i&&x[f.__i]||ho,f.__i=_,y=ui(e,f,u,o,a,i,s,c,p,d),m=f.__e,(u.ref!=f.ref||8&u.__u)&&(u.ref&&di(u.ref,null,f,u),f.ref&&d.push(f.ref,f.__c||m,f)),h=h||m,4&f.__u?(c=hl(f,c,e,!u.__v),u.__e&&(u.__e=null)):typeof f.type=="function"&&y!==void 0?c=y:m&&(c=m.nextSibling),f.__u&=-21);return n.__e=h,c}function Z_(e,t,n,r,o){var a,i,s,c,p,d,_,u,f,m=n.length,h=m,y=0,x=0,S=e.__k=Array(o);for(a=0;a<o;a++)(i=t[a])!=null&&typeof i!="boolean"&&typeof i!="function"?(typeof i!="object"||i.constructor==String?i=S[a]=xr(null,i):yo(i)?i=S[a]=xr(_e,{children:i}):i.constructor===void 0&&i.__b?i=S[a]=xr(i.type,i.props,i.key,i.ref,i.__v):S[a]=i,c=a+y,i.__=e,i.__b=e.__b+1,s=null,~(p=i.__i=ef(i,n,c,h))&&(h--,(s=n[p])&&(s.__u|=2)),s&&s.__v?(i.__u|=16,p==c-1?y--:p==c+1?y++:p!=c&&(p>c?y--:y++,x=1)):(~p||(o>m?y--:o<m&&y++),typeof i.type!="function"&&(i.__u|=4))):S[a]=null;if(x){for(d=[],_=[],a=0;a<o;a++)if((i=S[a])&&16&i.__u){for(y=0,u=d.length;y<u;)d[f=y+u>>1]<i.__i?y=f+1:u=f;d[y]=i.__i,_[a]=y+1}for(y=d.length;a--;)_[a]&&(_[a]==y?y--:S[a].__u|=4)}if(h)for(a=0;a<m;a++)!(s=n[a])||2&s.__u||(s.__e==r&&(r=ln(s)),pi(s,s));return r}function hl(e,t,n,r){var o,a,i,s;if(typeof e.type=="function"){if(e.props.__P)return t;if(o=e.__k)for(a=0;a<o.length;a++)o[a]&&(o[a].__=e,t=hl(o[a],t,n,!1));return t}for(t&&!t.parentNode&&(t=ln(e))&&!t.parentNode&&(t=null),i=e.__e,s=t;s&&s.nodeType==8;)s=s.nextSibling;for(i!=s&&(!r&&n.moveBefore&&i.parentNode?n.moveBefore(i,t):n.insertBefore(i,t||null)),t=i;(t=t&&t.nextSibling)&&t.nodeType==8&&!t.data.startsWith("$s"););return t}function Po(e,t){return t=t||[],e!=null&&typeof e!="boolean"&&(yo(e)?e.some(function(n){Po(n,t)}):t.push(e)),t}function ef(e,t,n,r){var o,a=e.key,i=e.type,s=t[n],c=s&&!(2&s.__u);if(s===null&&a==null||c&&a==s.key&&i==s.type)return n;if(r>(c?1:0)){for(o=n-1;o>=0;o--)if((s=t[o])&&!(2&s.__u)&&a==s.key&&i==s.type)return o;for(o=n+1;o<t.length;o++)if((s=t[o])&&!(2&s.__u)&&a==s.key&&i==s.type)return o}return-1}function dl(e,t,n){n==null&&(n=""),t[0]=="-"?e.setProperty(t,n):e[t]=n}function mo(e,t,n,r,o){var a,i;if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||dl(e.style,t);if(n)for(t in n)r&&n[t]==r[t]||dl(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")(e.__e||(e.__e={}))[t]=n,n&&r||(i=ai[t]||(ai[t]=tf(t)),(e.__a||(e.__a={}))[t]=li,a=t!=(t=t.replace(fl,"$1")),(t=t.slice(2))[0]<"a"&&(t=t.toLowerCase()),n?e.addEventListener(t,i,a):e.removeEventListener(t,i,a));else{if(o=="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{return void(e[t]=n??"")}catch{}if(typeof n=="function")return;n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n)}}function tf(e){return function(t){var n=this.__e;if(n){if(n=n[e],t[go]==null)t[go]=li++;else if(t[go]<this.__a[e])return;return n(pe.event?pe.event(t):t)}}}function ui(e,t,n,r,o,a,i,s,c,p){var d,_,u,f,m,h,y,x,S,w,g,v,k,C,T,M,N,L,$=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=32&n.__u,d=n.__c.__z)&&(t.__u|=c,_=a=[],d.nodeType==8?s=ii(d,a):a.push(d),s=a[0]||s),(d=pe.__b)&&d(t);e:if(typeof $=="function"){u=i.length;try{if(x=t.props,S=(d=$.prototype)&&d.render,w=(d=$.contextType)&&r[d.__c],g=d?w?w.props.value:d.__:r,(f=n.__c)?(t.__c=f,2&f.__g&&(f.__g|=1)):(S?t.__c=f=new $(x,g):(t.__c=f=new Ot(x,g),f.constructor=$,f.render=rf),w&&w.sub(f),f.state||(f.state={}),f.__n=r,f.__g|=8,f.__h=[],f.__k=[]),S&&(f.__s||(f.__s=f.state),$.getDerivedStateFromProps&&(f.__s==f.state&&(f.__s=Pn({},f.__s)),Pn(f.__s,$.getDerivedStateFromProps(x,f.__s)))),m=f.props,h=f.state,f.__v=t,n.__c){if(x!==m&&S&&!$.getDerivedStateFromProps&&f.componentWillReceiveProps&&f.componentWillReceiveProps(x,g),t.__v==n.__v&&!(8&f.__g)||!(4&f.__g)&&f.shouldComponentUpdate&&f.shouldComponentUpdate(x,f.__s,g)===!1){t.__v!=n.__v&&(f.props=x,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(W){W&&(W.__=t)}),bo.push.apply(f.__h,f.__k),f.__k=[],f.__h.length&&i.push(f),s=ln(n);break e}f.componentWillUpdate&&f.componentWillUpdate(x,f.__s,g),S&&f.componentDidUpdate&&f.__h.push(function(){f.componentDidUpdate(m,h,y)})}else S&&!$.getDerivedStateFromProps&&f.componentWillMount&&f.componentWillMount(),S&&f.componentDidMount&&f.__h.push(f.componentDidMount);if(f.context=g,f.props=x,f.__P=e,f.__g&=-5,v=pe.__r,k=0,S)f.state=f.__s,f.__g&=-9,v&&v(t),d=f.render(f.props,f.state,f.context),bo.push.apply(f.__h,f.__k),f.__k=[];else do f.__g&=-9,v&&v(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++k<25);f.state=f.__s,f.getChildContext&&(r=Pn({},r,f.getChildContext())),S&&n.__c&&f.getSnapshotBeforeUpdate&&(y=f.getSnapshotBeforeUpdate(m,h)),C=d&&d.type===_e&&d.key==null?d.props.children:d,x.__P&&(d=s,o=(e=x.__P).namespaceURI,c=a=null,n.props&&n.props.__P!=e&&(n.__k.some(function(W){W&&pi(W,W)}),n.__k=null),s=n.__k?ln(n,0):null),s=vl(e,yo(C)?C:[C],t,n,r,o,a,i,s,c,p),x.__P&&(t.__e=null,s=d),t.__u&=-161,_&&_.some(yn),f.__h.length&&i.push(f),1&f.__g&&(f.__g&=-4)}catch(W){if(i.length=u,t.__v=null,c||a)if(W.then){if(T=0,t.__u|=128|c,a){for(~(N=a.indexOf(s||void 0))||(N=a.length);(L=a[N-1])&&L.nodeType==8;)N--;for(;N<a.length;N++)if(L=a[N]){if(a[N]=null,L.nodeType==8){if(L.data.startsWith("$s"))T++||(M=L);else if(T&&L.data.startsWith("/$s")&&!--T)break}else if(!T)break}}if(!M){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;M=s}(d=ii(M=t.__c.__z||(t.__c.__z=M)))?(t.__e=M,s=d):t.__e=s,s=s&&s.nextSibling}else a&&a.some(yn);else t.__e=n.__e;t.__k||(t.__k=n.__k||[]),W.then||bl(t),pe.__e(W,t,n)}}else s=t.__e=nf(n.__e,t,n,r,o,a,i,c,p,e);return(d=pe.diffed)&&d(t),s}function ii(e,t){if(e&&e.nodeType==8&&e.data.startsWith("$s"))for(var n=1;e=e.nextSibling;){if(e.nodeType==8){if(e.data.startsWith("$s"))n++;else if(e.data.startsWith("/$s")&&!--n)return e}t&&t.push(e)}}function bl(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(bl))}function yl(e,t,n){for(var r=0;r<n.length;)di(n[r++],n[r++],n[r++]);pe.__c&&pe.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(a){a.call(o)})}catch(a){pe.__e(a,o.__v)}})}function nf(e,t,n,r,o,a,i,s,c,p){var d,_,u,f,m,h,y,x,S,w=n.props||ho,g=t.props,v=t.type;if(v=="svg"?o="http://www.w3.org/2000/svg":v=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),a){for(d=0;d<a.length;d++)if((m=a[d])&&(v?m.localName==v:m.nodeType==3)){e=m,a[d]=null;break}}if(!e){if(x=p.ownerDocument||document,!v)return x.createTextNode(g);e=x.createElementNS(o,v,g.is&&g),s&&(pe.__m&&pe.__m(t,a),s=!1),a=null}if(v){if(p=v=="template"?e.content:e,a=v=="textarea"&&g.defaultValue!=null?null:a&&ci.call(p.childNodes),!s&&a)for(w={},d=0;d<e.attributes.length;d++)w[(m=e.attributes[d]).name]=m.value;for(d in w)m=w[d],d=="dangerouslySetInnerHTML"?u=m:d=="children"||d in g||d=="value"&&"defaultValue"in g||d=="checked"&&"defaultChecked"in g||mo(e,d,null,m,o);for(d in S=1&n.__u,g)m=g[d],d=="children"?f=m:d=="dangerouslySetInnerHTML"?_=m:d=="value"?h=m:d=="checked"?y=m:s&&typeof m!="function"||!(w[d]!==m||S&&m!=null)||mo(e,d,m,w[d],o);_?(s||u&&(_.__html==u.__html||_.__html==e.innerHTML)||(e.innerHTML=_.__html),t.__k=[]):(u&&(e.textContent=""),(v=="foreignObject"||o=="http://www.w3.org/1998/Math/MathML"&&J_.test(v))&&(o="http://www.w3.org/1999/xhtml"),vl(p,yo(f)?f:[f],t,n,r,o,a,i,a?a[0]:n.__k&&ln(n,0),s,c),a&&a.some(yn)),s&&v!="textarea"||(d="value",v=="progress"&&h==null?e.removeAttribute(d):h==null||h===e[d]&&(v!="progress"||h)||mo(e,d,h,w[d],o),d="checked",y!=null&&y!=e[d]&&mo(e,d,y,w[d],o))}else w===g||s&&e.data==g||(e.data=g);return e}function di(e,t,n,r){try{typeof e=="function"?t?t.__x=e(t)||1:r&&(r=r.__c||r.__e)&&(t=r.__x)&&(r.__x=null,typeof t=="function"?t():e(null)):e.current=t}catch(o){pe.__e(o,n)}}function pi(e,t,n){var r,o,a,i;if(pe.unmount&&pe.unmount(e),!(r=e.ref)||r.current&&r.current!=e.__e||di(r,null,t,e),r=e.__c){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(s){pe.__e(s,t)}r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&pi(r[i],t,typeof e.type!="function"||n&&!e.props.__P);!n&&(r=e.__c)&&(r=r.__z)&&(o=ii(r,a=[]))&&(r==e.__e&&a.some(yn),yn(o),yn(r)),(r=e.__e)&&(n||yn(r),r.__e&&(r.__e=null)),e.__e=e.__c=e.__=null}function rf(e,t,n){return this.constructor(e,n)}function cn(e,t){var n,r,o,a;pe.__&&pe.__(e,t),t.nodeType==9&&(t=t.documentElement),r=(n=e&&32&e.__u)?null:t.__k,t.__k=xr(_e,{children:[e]}),o=[],a=[],ui(t,t.__k,r||ho,ho,t.namespaceURI,r?null:t.firstChild?ci.call(t.childNodes):null,o,r?r.__e:t.firstChild,n,a),yl(o,t.__k,a),t.__k.props.children=null}pe={__e:function(e,t,n,r){for(var o,a,i;t=t.__;)if((o=t.__c)&&!(1&o.__g)){o.__g|=4;try{if((i=(a=o.constructor)&&a.getDerivedStateFromError)&&o.setState(a.getDerivedStateFromError(e)),o.componentDidCatch&&(o.componentDidCatch(e,r||{}),i=1),i&&8&o.__g)return void(o.__g|=2)}catch(s){e=s}}throw vo=0,e}},pl=0,si=function(e){return e!=null&&e.constructor===void 0},Ot.prototype.setState=function(e,t){var n=this.__s;n&&n!=this.state||(n=this.__s=Pn({},this.state)),typeof e=="function"&&(e=e(Pn({},n),this.props)),e&&(Pn(n,e),this.__v&&(t&&this.__k.push(t),ul(this)))},Ot.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),ul(this))},Ot.prototype.render=_e,sn=[],vo=0,_l=function(e,t){return e.__v.__b-t.__v.__b},go=Symbol(),fl=/(PointerCapture)$|Capture$/i,li=0,ai={},X_=0;function _i(e,t){if(!(!e?.length||!t))return e.find(n=>n.locale===t)}function Pl(e,t){let{translations:n,defaultLocale:r,...o}=e,a=_i(n,t);return a?{...o,title:a.title??o.title,description:a.description??o.description,content:a.content??o.content}:o}function xl(e,t){let{translations:n,defaultLocale:r,...o}=e,a=_i(n,t);return a?{...o,title:a.title??o.title,description:a.description??o.description}:o}function Sl(e,t){let{translations:n,defaultLocale:r,...o}=e,a=_i(n,t);if(!a)return o;let i=new Map((a.fields??[]).map(c=>[c.name,c])),s=o.fields.map(c=>{let p=i.get(c.name);if(!p)return c;let d=new Map((p.options??[]).map(_=>[_.value,_]));return{...c,label:p.label??c.label,placeholder:p.placeholder??c.placeholder,validationHint:p.validationHint??c.validationHint,options:c.options?.map(_=>{let u=d.get(_.value);return u?{..._,label:u.label??_.label,description:u.description??_.description}:_})}});return{...o,title:a.title??o.title,description:a.description??o.description,submitLabel:a.submitLabel??o.submitLabel,fields:s}}var xo={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 a person",connectingOperator:"Connecting you to a person\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",visualPreparing:"Preparing visual\u2026",visualError:"This visual could not be displayed.",visualPartial:"Some parts of this visual could not be displayed.",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",contentHelpful:"Was this helpful?",homeGreeting:"How can we help?",homeGreetingNamed:"Hi {name} \u{1F44B}",homeGreetingLead:"How can we help?",homeSearchPlaceholder:"Search for help",homeAskPlaceholder:"Ask a question\u2026",homeWhatsNew:"What's new",homeContentTitle:"Popular articles",homeStatus:"Status",helpTitle:"Help",helpSearchPlaceholder:"Search for help",helpEmpty:"No help articles yet",helpLoading:"Loading help\u2026",helpSearchEmpty:"No results for \u201C{query}\u201D",helpShowMore:"Show more",newsTitle:"News",newsEmpty:"No news yet",newsLoading:"Loading news\u2026",newsBack:"Back to news",newsPublishedAt:"Published {date}",newsShowMore:"Show more",newsUnseen:"New post",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"},of={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 une personne",connectingOperator:"Mise en relation avec une personne\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",visualPreparing:"Pr\xE9paration du visuel\u2026",visualError:"Ce visuel n\u2019a pas pu \xEAtre affich\xE9.",visualPartial:"Certaines parties de ce visuel n\u2019ont pas pu \xEAtre affich\xE9es.",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",contentHelpful:"Cela vous a-t-il aid\xE9 ?",homeGreeting:"Comment pouvons-nous vous aider ?",homeGreetingNamed:"Bonjour {name} \u{1F44B}",homeGreetingLead:"Comment pouvons-nous vous aider ?",homeSearchPlaceholder:"Rechercher de l'aide",homeAskPlaceholder:"Posez une question\u2026",homeWhatsNew:"Nouveaut\xE9s",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 pour \xAB\xA0{query}\xA0\xBB",helpShowMore:"Afficher plus",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}",newsShowMore:"Afficher plus",newsUnseen:"Nouvelle publication",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"},af={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 \u0634\u062E\u0635",connectingOperator:"\u062C\u0627\u0631\u064D \u062A\u0648\u0635\u064A\u0644\u0643 \u0628\u0634\u062E\u0635\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",visualPreparing:"\u062C\u0627\u0631\u064D \u0625\u0639\u062F\u0627\u062F \u0627\u0644\u0645\u062D\u062A\u0648\u0649 \u0627\u0644\u0645\u0631\u0626\u064A\u2026",visualError:"\u062A\u0639\u0630\u0631 \u0639\u0631\u0636 \u0647\u0630\u0627 \u0627\u0644\u0645\u062D\u062A\u0648\u0649 \u0627\u0644\u0645\u0631\u0626\u064A.",visualPartial:"\u062A\u0639\u0630\u0631 \u0639\u0631\u0636 \u0628\u0639\u0636 \u0623\u062C\u0632\u0627\u0621 \u0647\u0630\u0627 \u0627\u0644\u0645\u062D\u062A\u0648\u0649 \u0627\u0644\u0645\u0631\u0626\u064A.",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",contentHelpful:"\u0647\u0644 \u0643\u0627\u0646 \u0647\u0630\u0627 \u0645\u0641\u064A\u062F\u064B\u0627\u061F",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",homeAskPlaceholder:"\u0627\u0637\u0631\u062D \u0633\u0624\u0627\u0644\u0627\u064B\u2026",homeWhatsNew:"\u0645\u0627 \u0627\u0644\u062C\u062F\u064A\u062F",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 \u0646\u062A\u0627\u0626\u062C \u0644\u0640 \xAB{query}\xBB",helpShowMore:"\u0639\u0631\u0636 \u0627\u0644\u0645\u0632\u064A\u062F",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}",newsShowMore:"\u0639\u0631\u0636 \u0627\u0644\u0645\u0632\u064A\u062F",newsUnseen:"\u0645\u0646\u0634\u0648\u0631 \u062C\u062F\u064A\u062F",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"},sf={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 una persona",connectingOperator:"Conect\xE1ndote con una persona\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",visualPreparing:"Preparando visualizaci\xF3n\u2026",visualError:"No se pudo mostrar esta visualizaci\xF3n.",visualPartial:"No se pudieron mostrar algunas partes de esta visualizaci\xF3n.",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",contentHelpful:"\xBFTe result\xF3 \xFAtil?",homeGreeting:"\xBFC\xF3mo podemos ayudarte?",homeGreetingNamed:"Hola, {name} \u{1F44B}",homeGreetingLead:"\xBFC\xF3mo podemos ayudarte?",homeSearchPlaceholder:"Buscar ayuda",homeAskPlaceholder:"Haz una pregunta\u2026",homeWhatsNew:"Lo nuevo",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:"Sin resultados para \xAB{query}\xBB",helpShowMore:"Mostrar m\xE1s",newsTitle:"Novedades",newsEmpty:"A\xFAn no hay novedades",newsLoading:"Cargando novedades\u2026",newsBack:"Volver a novedades",newsPublishedAt:"Publicado el {date}",newsShowMore:"Mostrar m\xE1s",newsUnseen:"Publicaci\xF3n nueva",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"},lf={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\u05D5 \u05E2\u05DD \u05D0\u05D3\u05DD",connectingOperator:"\u05DE\u05D7\u05D1\u05E8\u05D9\u05DD \u05D0\u05D5\u05EA\u05DA \u05DC\u05D0\u05D3\u05DD\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",visualPreparing:"\u05DE\u05DB\u05D9\u05DF \u05EA\u05E6\u05D5\u05D2\u05D4\u2026",visualError:"\u05DC\u05D0 \u05E0\u05D9\u05EA\u05DF \u05D4\u05D9\u05D4 \u05DC\u05D4\u05E6\u05D9\u05D2 \u05EA\u05E6\u05D5\u05D2\u05D4 \u05D6\u05D5.",visualPartial:"\u05DC\u05D0 \u05E0\u05D9\u05EA\u05DF \u05D4\u05D9\u05D4 \u05DC\u05D4\u05E6\u05D9\u05D2 \u05D7\u05DC\u05E7\u05D9\u05DD \u05DE\u05EA\u05E6\u05D5\u05D2\u05D4 \u05D6\u05D5.",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",contentHelpful:"\u05D4\u05D0\u05DD \u05D6\u05D4 \u05E2\u05D6\u05E8?",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",homeAskPlaceholder:"\u05E9\u05D0\u05DC\u05D5 \u05E9\u05D0\u05DC\u05D4\u2026",homeWhatsNew:"\u05DE\u05D4 \u05D7\u05D3\u05E9",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:"\u05D0\u05D9\u05DF \u05EA\u05D5\u05E6\u05D0\u05D5\u05EA \u05E2\u05D1\u05D5\u05E8 \u201E{query}\u201D",helpShowMore:"\u05D4\u05E6\u05D2\u05EA \u05E2\u05D5\u05D3",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}",newsShowMore:"\u05D4\u05E6\u05D2\u05EA \u05E2\u05D5\u05D3",newsUnseen:"\u05E4\u05D5\u05E1\u05D8 \u05D7\u05D3\u05E9",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"},cf={en:xo,fr:of,ar:af,es:sf,he:lf};function So(e,t){let n=kl(e),r=ko(t),o=n==="en"?{}:cf[n]??{},a=r?t[n]??{}:t??{},i=r?t.en??{}:{};return{...xo,...o,...i,...a}}function kl(e){return(e.split("-")[0]??"en").toLowerCase()}var uf=new Set(["ar","he","iw","fa","ur","ps","sd","ug","yi","dv","ckb","ks","nqo","prs","syr"]);function wl(e){return uf.has(kl(e))}function ht(e,t){return e[t]??t}function ko(e){if(!e)return!1;for(let t of Object.values(e))if(t&&typeof t=="object")return!0;return!1}var A={id:"help-ai",name:"@helpai/elements",global:"HelpAI",tagName:"web-ai-chat",cssPrefix:"helpai",defaultBaseUrl:"https://help.ai",displayName:"Help AI",domain:"help.ai",siteUrl:"https://help.ai"};var fi=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{}}},wo=new fi;var Co={maxBytes:10485760,maxCount:10,accept:"*/*"},Cl={voice:"local"},Rl={list:[],byTrigger:{}},mi={enabled:!0,sampleRate:1},Ro={upload:"/pai/upload-file",transcribe:"/pai/transcribe-audio",submitForm:"/pai/submit-form"},jn={variant:"circle",size:"md",label:void 0,icon:"chat",hidden:!1},Il={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"]},gi={enabled:!0,volume:.3,events:void 0},Tl={enabled:!0,events:void 0},Al=[{label:"tabConversations",layout:"chat"}];var df=["off","error","warn","info","debug","trace"],vi=A.cssPrefix,pf=`${vi}.debug`,_f=`__${A.global}_DEBUG__`,ff=`${vi}-debug`,Nl=2,El=null;function mf(){if(typeof window>"u")return 2;try{let e=new URLSearchParams(window.location.search).get(ff);if(e!==null){let t=Ml(e);if(t>=0)return t}}catch{}try{let e=window.localStorage?.getItem(pf);if(e){let t=Ml(e);if(t>=0)return t}}catch{}return Reflect.get(window,_f)?4:2}function Ml(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=df.findIndex(n=>n===e);if(t>=0)return t}return-1}Nl=mf();function Ll(e){let t=`[${vi}:${e}]`;function n(r,o,a){return(i,s)=>{if(!(Nl<r)&&(s===void 0?console[o](t,i):console[o](t,i,s),El))try{El({level:a,scope:e,message:i,payload:s})}catch{}}}return{error:n(1,"error","error"),warn:n(2,"warn","warn"),info:n(3,"info","info"),debug:n(4,"debug","debug"),trace:n(5,"debug","trace"),scope:r=>Ll(`${e}:${r}`)}}var le=Ll("core");var xn=le.scope("context"),gf=new Set(["visitorId","conversationId","jwt","token","authorization","password"]),Ol=50,hi=1024,vf=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function bi(e){return $l(e,"userContext",!0)}function yi(e){return $l(e,"pageContext",!1)}function $l(e,t,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){xn.warn(`ignored ${t} \u2014 expected an object`,{type:Array.isArray(e)?"array":typeof e});return}let r={},o=0;for(let[a,i]of Object.entries(e)){if(gf.has(a)){xn.warn(`dropped reserved ${t} key "${a}" \u2014 managed by the widget, not host-settable`);continue}if(i==null)continue;if(o>=Ol){xn.warn(`${t} truncated at ${Ol} keys \u2014 dropped "${a}"`);continue}let s=hf(t,a,i);s!==void 0&&(r[a]=s,o++)}return n&&typeof r.email=="string"&&!vf.test(r.email)&&(xn.warn("dropped malformed context field",{field:`${t}.email`,reason:"invalid format"}),delete r.email),Object.keys(r).length>0?r:void 0}function hf(e,t,n){if(typeof n=="boolean")return n;if(typeof n=="number"){if(!Number.isFinite(n)){xn.warn(`dropped non-finite ${e}.${t}`);return}return n}if(typeof n=="string"){let r=n.trim();return r===""?void 0:r.length>hi?(xn.warn(`truncated ${e}.${t} to ${hi} chars`),r.slice(0,hi)):r}xn.warn(`dropped ${e}.${t} \u2014 only string/number/boolean values are allowed`,{type:typeof n})}function Vn(e){let t=e!==null&&typeof e=="object"?e:{},n=t.presentation??{},r=t.behavior??{},o=t.i18n??{},a=t.feedback??{},i=t.footer??{},s=t.header??{},{themeMode:c,themeOverrides:p}=bf(t.theme),d=n.mode??"floating",_=yf(o.defaultLocale),u=o.availableLocales??[o.locale??_],f=Wn(o.locale??_,u,_),m=(t.baseUrl??A.defaultBaseUrl).replace(/\/$/,""),h=(t.agentApiBaseUrl??`${m}/api/agent`).replace(/\/$/,""),y=(t.dataApiBaseUrl??`${m}/api/data`).replace(/\/$/,"");return{widgetId:t.widgetId??"default",publicKey:t.publicKey,aiAgentDeploymentId:t.aiAgentDeploymentId,baseUrl:m,agentApiBaseUrl:h,dataApiBaseUrl:y,userContext:bi(t.userContext),pageContext:yi(t.pageContext),position:n.position??"bottom-right",themeMode:c,textSize:"normal",themeOverrides:p,mode:d,iframe:n.iframe??!1,responseMode:r.responseMode??"streaming",showReasoning:r.showReasoning??!1,showToolCalls:r.showToolCalls??!1,showSources:r.showSources??!1,enableMessageFeedback:!(r.disableMessageFeedback??!1),autoSendSuggestions:r.autoSendSuggestions??!1,popOutUrl:r.popOutUrl,features:{voice:t.features?.voice??Cl.voice,fileUpload:!(t.features?.disableFileUpload??!1),humanInLoop:!(t.features?.disableHumanInLoop??!1),operatorRequest:t.features?.enableOperatorRequest===!0},forms:Sr(t.forms,f),endpoints:{upload:t.endpoints?.upload??Ro.upload,transcribe:t.endpoints?.transcribe??Ro.transcribe,submitForm:t.endpoints?.submitForm??Ro.submitForm},attachments:{accept:t.composer?.attachments?.accept??Co.accept,maxBytes:t.composer?.attachments?.maxBytes??Co.maxBytes,maxCount:t.composer?.attachments?.maxCount??Co.maxCount},locale:f,defaultLocale:_,availableLocales:u,startMinimized:r.startMinimized??!0,actions:Pf(d,s.actions),size:n.size??{},launcher:Tf(t.launcher),sound:xf(a.sound),haptics:Sf(a.haptics),strings:So(f,o.strings),stringsOverride:o.strings,composerDisclaimer:i.composerDisclaimer??"",poweredBy:wf(i.poweredBy),composer:Cf(t.composer),modules:Rf(t.modules),tracking:kf(t.tracking,y),storage:t.storage??wo,userToken:t.userToken,onMessage:t.onMessage,onOpen:t.onOpen,onClose:t.onClose,onError:t.onError}}function bf(e){if(typeof e=="string")return{themeMode:e,themeOverrides:{}};if(!e||typeof e!="object")return{themeMode:"auto",themeOverrides:{}};let{mode:t,...n}=e;return{themeMode:t??"auto",themeOverrides:n}}function yf(e){return e&&e!=="auto"?e:globalThis.navigator?.language||"en"}function Wn(e,t,n){return t.length<=1||t.includes(e)?e:t.includes(n)?n:t[0]??e}function Pf(e,t){return t??Il[e]}function xf(e){return{enabled:e?.enabled??gi.enabled,volume:e?.volume??gi.volume,events:e?.events}}function Sf(e){return{enabled:e?.enabled??Tl.enabled,events:e?.events}}function kf(e,t){let n=e?.sampleRate??mi.sampleRate;return{enabled:e?.enabled??mi.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 wf(e){let n={...{text:`Powered by ${A.displayName}`,href:A.siteUrl},...e};return!!(n.text||n.logoUrl)?n:null}function Cf(e){let t=e?.sendButton;return{sendButton:{shape:t?.shape??"circle",icon:t?.icon??"arrowUp",variant:t?.variant??"filled"}}}function Rf(e){let t=e??Al,n=new Set,r=[];for(let a of t.slice(0,4)){if(!a?.label||!a?.layout)continue;let i=a.contentCollectionIds?.filter(Boolean),s=a.id??i?.[0]??a.layout;for(;n.has(s);)s=`${s}-${r.length}`;n.add(s);let c={id:s,label:a.label,layout:a.layout};i?.length&&(c.contentCollectionIds=i),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?.length&&(c.userAvatars=a.userAvatars),a.status&&(c.status=a.status),c.contentBlockTitle=a.contentBlockTitle),r.push(c)}let o=Object.fromEntries(r.map(a=>[a.id,a]));return{list:r,byId:o}}function Sr(e,t){var a;if(!e?.length)return Rl;let n=[],r=new Set;for(let i of e){if(!i?.id||r.has(i.id))continue;let s=Sl(i,t),c=(s.fields??[]).filter(d=>!!(d?.name&&d.label&&d.type)),p=(Array.isArray(s.on)?s.on:[s.on]).map(If).filter(d=>d!==null);c.length===0||p.length===0||(r.add(s.id),n.push({id:s.id,triggers:p,when:s.when,fields:c,title:s.title,description:s.description,submitLabel:s.submitLabel,skippable:s.skippable??!1,frequency:s.frequency??"once",mirrorToContext:s.mirrorToContext??!0,reopenable:s.reopenable??!0,reviewable:s.reviewable??!0}))}let o={};for(let i of n)for(let s of i.triggers)(o[a=s.kind]??(o[a]=[])).push(i);return{list:n,byTrigger:o}}function If(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 r=Number(n);return Number.isFinite(r)&&r>0?{kind:"after-messages",param:r}:null}if(t==="idle"){let r=Number(n);return Number.isFinite(r)&&r>0?{kind:"idle",param:r}:null}return t==="page-area"&&n?{kind:"page-area",param:n}:null}function Tf(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??jn.variant,size:e?.size??jn.size,label:e?.label??jn.label,icon:e?.icon??jn.icon,hidden:e?.hidden??jn.hidden,callout:t}}function Pi(e,t,n,r){let o=Wn(t,e.availableLocales,e.defaultLocale);if(o===e.locale&&n===e.themeMode&&r===e.textSize)return e;let a={...e};return o!==e.locale&&(a.locale=o,a.strings=So(o,e.stringsOverride)),n!==e.themeMode&&(a.themeMode=n),r!==e.textSize&&(a.textSize=r),a}var Af=["presentation","behavior","theme","launcher","header","composer","feedback","i18n","footer","features","tracking","endpoints"];function xi(e,t){if(!t)return e;let n={...e};for(let a of Af){let i=t[a];if(i===void 0)continue;let s=e[a];if(a==="theme"){s===void 0?n[a]=i:typeof s=="string"&&typeof i=="object"&&i!==null&&(n[a]={...i,mode:s});continue}a!=="i18n"&&(n[a]=Dl(i,s))}t.modules!==void 0&&e.modules===void 0&&(n.modules=t.modules),t.dataApiBaseUrl!==void 0&&e.dataApiBaseUrl===void 0&&(n.dataApiBaseUrl=t.dataApiBaseUrl);let r=e.i18n,o=t.i18n;if(r||o){let a=Dl(o??{},r);o?.availableLocales!==void 0&&(a.availableLocales=o.availableLocales),o?.defaultLocale!==void 0&&(a.defaultLocale=o.defaultLocale);let i=r?.strings,s=o?.strings;(i||s)&&(a.strings=Ef(s,i)),n.i18n=a}return n}function Dl(e,t){if(!t)return e;let n={...e};for(let[r,o]of Object.entries(t))o!==void 0&&(n[r]=o);return n}function Ef(e,t){if(!e)return t;if(!t)return e;let n=ko(e),r=ko(t);if(!n&&!r)return{...e,...t};let o={},a=n?e:{en:e},i=r?t:{en:t};for(let[s,c]of Object.entries(a))o[s]={...c};for(let[s,c]of Object.entries(i))o[s]={...o[s],...c};return o}var Mf=["clear","expand","fullscreen","popOut","sound","history","language","theme","textSize","close"];function Yt(e){return e!=="false"}function Nf(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}var Fl=[["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]],Ul=[["mode","mode",e=>e],["position","position",e=>e],["iframe","iframe",Yt]],ql=[["width","width"],["height","height"]],zl=[["response-mode","responseMode",e=>e],["start-minimized","startMinimized",Yt],["show-reasoning","showReasoning",Yt],["show-tool-calls","showToolCalls",Yt],["show-sources","showSources",Yt],["disable-message-feedback","disableMessageFeedback",Yt],["auto-send-suggestions","autoSendSuggestions",Yt],["pop-out-url","popOutUrl"]],Hl=[["locale","locale"]],Lf=new Set(Mf);function Of(e){return Nf(e).filter(t=>Lf.has(t))}var jl=[["launcher-variant","variant",e=>e],["launcher-size","size",e=>e],["launcher-icon","icon"],["launcher-hidden","hidden",Yt]],Vl=[["features-disable-file-upload","disableFileUpload",Yt],["features-voice","voice",e=>e]],Wl=[["endpoint-upload","upload"],["endpoint-transcribe","transcribe"]],Gl=[["user-id","id"],["user-email","email"],["user-name","name"]],Kl=[["page-area","area"],["page-url","url"],["page-path","path"],["page-title","title"]],$f=["launcher-label","callout-text","callout-delay","actions","user-context","page-context"],Df=[Fl,Ul,ql,zl,Hl,jl,Vl,Wl,Gl,Kl],Bf=new Set(["iframe","start-minimized"]),Si=[...Df.flatMap(e=>e.map(([t])=>t).filter(t=>!Bf.has(t))),...$f];function ki(e){let t={};function n(f){let m=e(f);return m===null||m===""?void 0:m}for(let[f,m,h]of Fl){let y=n(f);y!==void 0&&(t[m]=h?h(y):y)}let r=Sn(n,Ul),o=Sn(n,ql);(r||o)&&(t.presentation={...r,...o?{size:o}:{}});let a=Sn(n,zl);a&&(t.behavior=a);let i=Sn(n,Hl);i&&(t.i18n=i);let s=Ff(e,n);s&&(t.launcher=s);let c=Sn(n,Vl);c&&(t.features=c);let p=Sn(n,Wl);p&&(t.endpoints=p);let d=Bl(n,Gl,"user-context");d&&(t.userContext=d);let _=Bl(n,Kl,"page-context");_&&(t.pageContext=_);let u=n("actions");return u!==void 0&&(t.header={actions:Of(u)}),t}function Sn(e,t){let n={};for(let[r,o,a]of t){let i=e(r);i!==void 0&&(n[o]=a?a(i):i)}return Object.keys(n).length>0?n:null}function Bl(e,t,n){let r={};for(let[s,c]of t){let p=e(s);p!==void 0&&(r[c]=p)}let o={},a=e(n);if(a)try{let s=JSON.parse(a);s&&typeof s=="object"&&!Array.isArray(s)&&(o=s)}catch{}let i={...o,...r};return Object.keys(i).length>0?i:null}function Ff(e,t){let n=Sn(t,jl)??{},r=e("launcher-label");r!==null&&(n.label=r);let o=t("callout-text");if(o){let a=Number.parseInt(t("callout-delay")??"",10);n.callout={text:o,...Number.isFinite(a)?{delayMs:a}:{}}}return Object.keys(n).length>0?n:null}function kt(){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,Uf(t.subarray(6)),t[6]=t[6]&15|112,t[8]=t[8]&63|128;let n=Array.from(t,r=>r.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 Uf(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 Xt=le.scope("persistence");function Gn(e,t=wo,n){let r=n?`${e}.${n}`:e,o=`${A.cssPrefix}.storageVersion`,a=t.get(o)??void 0,i=a?`.v${a}`:"",s=`${A.cssPrefix}.${r}${i}`,c=`${A.cssPrefix}${i}.visitorId`,p=`${s}.conversationId`,d=`${s}.userPrefs`,_=`${s}.panelOpen`,u=`${s}.panelSize`,f=`${s}.calloutDismissed`,m=`${s}.sidebarCollapsed`,h=`${s}.activeModule`,y=`${s}.seenNewsId`,x=`${s}.historyCount`,S=`${s}.formsDone`,w={getVisitorId(){let g=t.get(c);if(g)return g;let v=kt();return t.set(c,v),v},loadConversationId(){return t.get(p)??void 0},saveConversationId(g){Xt.trace("saveConversationId",{id:g,scope:r}),g?t.set(p,g):t.remove(p)},loadDraft(g){return t.get(`${s}.draft.${g}`)??""},saveDraft(g,v){let k=`${s}.draft.${g}`;v?t.set(k,v):t.remove(k)},loadMessageQueue(g){let v=t.get(`${s}.messageQueue.${g}`);if(!v)return[];try{let k=JSON.parse(v);return!Array.isArray(k)||!k.every(qf)?[]:k}catch(k){return Xt.warn("loadMessageQueue parse failed",{error:k}),[]}},saveMessageQueue(g,v){let k=`${s}.messageQueue.${g}`;if(v.length===0){t.remove(k);return}try{t.set(k,JSON.stringify(v))}catch(C){Xt.warn("saveMessageQueue serialise failed",{error:C})}},loadUserPrefs(){let g=t.get(d);if(!g)return{};try{return wi(JSON.parse(g))}catch(v){return Xt.warn("loadUserPrefs parse failed",{error:v}),{}}},saveUserPrefs(g){try{t.set(d,JSON.stringify(g))}catch(v){Xt.warn("saveUserPrefs serialise failed",{error:v})}},patchUserPrefs(g){let v=w.loadUserPrefs();w.saveUserPrefs({...v,...g})},loadPanelOpen(){let g=t.get(_);return g==="1"?!0:g==="0"?!1:null},savePanelOpen(g){t.set(_,g?"1":"0")},loadPanelSize(){let g=t.get(u);return g==="normal"||g==="expanded"||g==="fullscreen"?g:null},savePanelSize(g){t.set(u,g)},loadCalloutDismissed(g){if(!g)return!1;let v=t.get(f);return!!v&&v===g},saveCalloutDismissed(g){g?t.set(f,g):t.remove(f)},loadSidebarCollapsed(){let g=t.get(m);return g==="1"?!0:g==="0"?!1:null},saveSidebarCollapsed(g){t.set(m,g?"1":"0")},loadActiveModule(){return t.get(h)||null},saveActiveModule(g){t.set(h,g)},loadSeenNewsId(){return t.get(y)||null},saveSeenNewsId(g){t.set(y,g)},loadHistoryCount(){let g=t.get(x);if(!g)return null;let v=Number.parseInt(g,10);return Number.isFinite(v)&&v>=0?v:null},saveHistoryCount(g){t.set(x,String(g))},loadFormsDone(){let g=t.get(S);if(!g)return{};try{let v=JSON.parse(g);return Io(v)?Object.fromEntries(Object.entries(v).filter(k=>typeof k[1]=="number")):{}}catch(v){return Xt.warn("loadFormsDone parse failed",{error:v}),{}}},saveFormDone(g){try{let v=w.loadFormsDone();v[g]=Date.now(),t.set(S,JSON.stringify(v))}catch(v){Xt.warn("saveFormDone serialise failed",{error:v})}},rememberStorageVersion(g){g&&g!==t.get(o)&&(Xt.debug("rememberStorageVersion (force-reset on next load)",{version:g}),t.set(o,g))},clearConversation(){t.remove(p)},reset(){let g=t.get(p);g&&(t.remove(`${s}.draft.${g}`),t.remove(`${s}.messageQueue.${g}`));for(let v of[c,p,d,_,u,f,m,h,y,x,S])t.remove(v);Xt.info("reset: forgot the visitor",{scope:r})}};return w}function Io(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function qf(e){return Io(e)&&typeof e.id=="string"&&e.id.length>0&&typeof e.text=="string"}function wi(e){if(!Io(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),Io(e.widgetSize)&&typeof e.widgetSize.width=="number"&&typeof e.widgetSize.height=="number"&&(t.widgetSize={width:e.widgetSize.width,height:e.widgetSize.height}),t}var To="1.10.0";var zf="1",Ql=60,Hf=2e3,Yl={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,count:e.count}),contentOpen:e=>({contentId:e.contentId,contentCollectionId:e.contentCollectionId}),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 jf(){let e=navigator;return e.globalPrivacyControl===!0||e.doNotTrack==="1"}function Vf(){return location.origin+location.pathname}function Wf(){try{return document.referrer?new URL(document.referrer).origin:""}catch{return""}}function Xl(e,t){let n=Math.random(),r=0,o=0,a=new Set;function i(d,_){let{tracking:u,publicKey:f,aiAgentDeploymentId:m,mode:h,themeMode:y}=t.getOptions();if(!u.enabled||jf()||n>=u.sampleRate)return;let x=performance.now();if(x-r>6e4&&(r=x,o=0),++o>Ql)return;let S=new URLSearchParams;S.set("v",zf),S.set("_ev",To),S.set("e",d),u.token&&S.set("tk",u.token),f&&S.set("pk",f),m&&S.set("dep",m),S.set("vid",t.getVisitorId());let w=t.getConversationId();w&&S.set("cid",w),S.set("url",Vf());let g=Wf();g&&S.set("ref",g),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",h),S.set("th",y),_)for(let[T,M]of Object.entries(_))M!==void 0&&S.set(T,String(M));S.set("ts",String(Date.now()));let v=`${u.endpoint}?${S}`;if(v.length>Hf)return;let k=new Image(1,1);a.add(k);function C(){return a.delete(k)}k.addEventListener("load",C,{once:!0}),k.addEventListener("error",C,{once:!0}),k.src=v}let s=[];function c(d,_){if(s&&d!=="handshake"){s.length<Ql&&s.push([d,_]);return}let u=s??[];s=void 0;for(let[f,m]of u)i(f,m);i(d,_)}let p=Object.keys(Yl).map(d=>e.on(d,_=>c(d,Yl[d]?.(_))));return()=>{for(let d of p)d();a.clear()}}var Jl=`.__P__-generative-ui{display:grid;gap:var(--__P__-space-3);overflow-wrap:anywhere;white-space:pre-wrap}.__P__-generative-ui p{margin:0}.__P__-generative-ui-grid-container{container:__P__-generative-ui-grid / inline-size;min-width:0}.__P__-generative-ui-grid{display:grid;grid-template-columns:minmax(0,1fr);align-items:start;gap:16px}.__P__-generative-ui-cell{display:grid;align-content:start;min-width:0;gap:16px}@container __P__-generative-ui-grid (min-width: 496px){.__P__-generative-ui-grid:is([data-columns="2"],[data-columns="3"],[data-columns="4"]){grid-template-columns:repeat(2,minmax(0,1fr))}.__P__-generative-ui-grid:is([data-columns="2"],[data-columns="3"],[data-columns="4"])>.__P__-generative-ui-cell:is([data-span="2"],[data-span="3"],[data-span="4"]){grid-column:span 2}}@container __P__-generative-ui-grid (min-width: 752px){.__P__-generative-ui-grid:is([data-columns="3"],[data-columns="4"]){grid-template-columns:repeat(3,minmax(0,1fr))}.__P__-generative-ui-grid:is([data-columns="3"],[data-columns="4"])>.__P__-generative-ui-cell:is([data-span="3"],[data-span="4"]){grid-column:span 3}}@container __P__-generative-ui-grid (min-width: 1008px){.__P__-generative-ui-grid[data-columns="4"]{grid-template-columns:repeat(4,minmax(0,1fr))}.__P__-generative-ui-grid[data-columns="4"]>.__P__-generative-ui-cell[data-span="4"]{grid-column:span 4}}.__P__-generative-ui section{display:grid;gap:var(--__P__-space-2);padding:var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);min-width:0}.__P__-generative-ui-metric{font-size:1.6em;font-weight:700}.__P__-generative-ui-table{overflow-x:auto}.__P__-generative-ui table{width:100%;border-collapse:collapse;white-space:normal}.__P__-generative-ui caption{text-align:start;font-weight:600;padding-bottom:var(--__P__-space-2)}.__P__-generative-ui th,.__P__-generative-ui td{text-align:start;padding:var(--__P__-space-2);border-bottom:1px solid var(--__P__-border)}.__P__-generative-ui-chart{display:block;width:100%;color:var(--__P__-accent)}.__P__-generative-ui-axis{stroke:var(--__P__-border)}.__P__-generative-ui-data{display:flex;flex-wrap:wrap;gap:var(--__P__-space-2);font-size:.85em}
2
- `;var Zl=`: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}}
3
- `;var ec=`.__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;position:relative;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 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{width:100%;padding:10px 14px;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__-attachment-chip.__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-card>[role=listitem]{display:flex;flex-direction:column}.__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-card>*+*{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__-help-more{justify-content:center;color:var(--__P__-accent-fg);font-weight:600}.__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)}@media(hover:hover){.__P__-tab:hover{background:var(--__P__-hover)}}.__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;line-height:1.45}.__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__-home-ask{padding-block:6px;padding-inline-end:6px}.__P__-home-ask .__P__-send{width:32px;height:32px;flex-shrink:0}.__P__-home-ask .__P__-send[data-shape=pill]{width:auto;padding:0 14px}.__P__-home-ask .__P__-send svg{width:16px;height:16px}.__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-vote{display:flex;align-items:center;flex-wrap:wrap;gap:var(--__P__-space-2);padding-top:var(--__P__-space-3);border-top:1px solid var(--__P__-border)}.__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;line-height:1.45;border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);overflow:hidden;background:var(--__P__-surface);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-meta{display:flex;flex-wrap:wrap;align-items:center;gap:6px;color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm)}.__P__-news-tag{padding:1px 8px;border-radius:6px;background:var(--__P__-hover);color:var(--__P__-fg);font-size:calc(12px * var(--__P__-text-scale));white-space:nowrap}.__P__-news-more{display:flex;align-items:center;justify-content:center;gap:var(--__P__-space-2);width:100%;min-height:44px;border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);background:var(--__P__-surface);color:var(--__P__-accent-fg);font-weight:600}.__P__-news-more:hover{background:var(--__P__-bg-elevated)}.__P__-news-more:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__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 tc=`*,*: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}
5
- `;var nc=`: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}}
6
- `;var Jf="helpai",Zf="#5B5BD6",em="#FFFFFF",tm="12px",nm="Inter, system-ui, -apple-system, 'Segoe UI', sans-serif",Ri=[nc,tc,ec,Jl,Zl].join(`
7
- `).replace(/__P__/g,Jf).replaceAll("__BRAND_ACCENT_TEXT__",em).replaceAll("__BRAND_ACCENT__",Zf).replaceAll("__BRAND_RADIUS__",tm).replaceAll("__BRAND_FONT__",nm);var oc=["data-theme","data-color-scheme","data-mode","data-bs-theme"];function rc(e){if(e){if(e.classList.contains("dark"))return"dark";if(e.classList.contains("light"))return"light";for(let t of oc){let n=e.getAttribute(t);if(n==="dark"||n==="light")return n}}}function Kn(e=document){let t=rc(e.documentElement)??rc(e.body);if(t)return t;let n=getComputedStyle(e.documentElement).colorScheme.trim();return n==="dark"||n==="light"?n:typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function ac(e,t=document){let n=Kn(t);e(n);function r(){let s=Kn(t);s!==n&&(n=s,e(s))}let o=new MutationObserver(r),a={attributes:!0,attributeFilter:["class","style",...oc]};o.observe(t.documentElement,a),t.body&&o.observe(t.body,a);let i=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)"):void 0;return i?.addEventListener("change",r),()=>{o.disconnect(),i?.removeEventListener("change",r)}}var rm=le.scope("mount"),ic=new WeakMap,sc={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 lc(e,t){e.style.cssText=sc[t]}function Ao(e){return e==="floating"||e==="modal"||e==="drawer"?"floating":e==="standalone"||e==="page"?"viewport":"flow"}function cc(e={}){let t=e.position??"flow";rm.debug("createShadowMount",{position:t,hasTarget:!!e.target,hasHost:!!e.existingHost});let n=`${A.cssPrefix}-chat-host`;typeof customElements<"u"&&!customElements.get(n)&&customElements.define(n,class extends HTMLElement{});let r;e.existingHost?r=e.existingHost:(r=document.createElement(n),(e.target??document.body).appendChild(r)),r.setAttribute("data-brand",A.id),r.style.cssText=sc[t];let o=r.shadowRoot??r.attachShadow({mode:"open"}),a=r.ownerDocument;if(!om(o,a)){let s=a.createElement("style");s.textContent=Ri,o.appendChild(s)}let i=document.createElement("div");return i.className=`${A.cssPrefix}-app`,o.appendChild(i),{appRoot:i,destroy:()=>r.remove(),hostElement:r,shadowRoot:o}}function om(e,t){if(!("adoptedStyleSheets"in e))return!1;let n=t.defaultView;if(!n||typeof n.CSSStyleSheet!="function")return!1;let r=ic.get(t);if(!r)try{r=new n.CSSStyleSheet,r.replaceSync(Ri),ic.set(t,r)}catch{return!1}try{return e.adoptedStyleSheets=[r],!0}catch{return!1}}function am(e,t){let n=A.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 im(e,t){e.dataset.theme=t==="host"?Kn():t}function sm(e,t){let n=A.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 lm(e,t){e.dataset.position=t}function Eo(e,t){e.dataset.mode=t}function uc(e,t){im(e,t.themeMode),am(e,t.themeOverrides),lm(e,t.position),sm(e,t.size)}var Qn,Ye,Ii,dc,Ti=Object.is,wr=0,yc=[],Ai=[],Ue=pe,pc=Ue.__b,_c=Ue.__r,fc=Ue.diffed,mc=Ue.__c,gc=Ue.unmount,vc=Ue.__;function Mo(e,t){Ue.__h&&Ue.__h(Ye,e,wr||t),wr=0;var n=Ye.__H||(Ye.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function z(e){return wr=1,Pc(xc,e)}function Pc(e,t,n){var r=Mo(Qn++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):xc(void 0,t),function(a){var i=r.__N?r.__N[0]:r.__[0],s=r.t(i,a);Ti(i,s)||(r.__N=[s,r.__[1]],r.__c.setState({}))}],r.__c=Ye,!Ye.__f)){Ye.__f=!0;var o=Ye.shouldComponentUpdate;Ye.shouldComponentUpdate=function(a,i,s){var c=this.__H;if(!c)return!0;var p=!1,d=this.props!=a;if(c.__.some(function(u){u.__N&&(p=!0,Ti(u.__[0],u.__N[0])||(d=!0))}),o){var _=o.call(this,a,i,s);return p?_||d:_}return!p||d}}return r.__}function F(e,t){var n=Mo(Qn++,3);!Ue.__s&&Mi(n.__H,t)&&(n.__P=!0,n.__=e,n.u=t,Ye.__H.__h.push(n))}function wt(e,t){var n=Mo(Qn++,4);!Ue.__s&&Mi(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,Ye.__h.push(n))}function D(e){return wr=5,ie(function(){return{current:e}},[])}function ie(e,t){var n=Mo(Qn++,7);return Mi(n.__H,t)&&(n.__=e(),n.__H=t),n.__}function B(e,t){return wr=8,ie(function(){return e},t)}function cm(){var e;do{for(;e=Ai.shift();)try{kr(e)}catch(n){Ue.__e(n,{__:(e=e.__P)&&e.__v})}for(;e=yc.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(kr),t.__h.some(Ei),t.__h=[]}catch(n){t.__h=[],Ue.__e(n,e.__v)}}}while(Ai.length)}Ue.__b=function(e){Ye=null,pc&&pc(e)},Ue.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),vc&&vc(e,t)},Ue.__r=function(e){_c&&_c(e),Qn=0;var t=(Ye=e.__c).__H;t&&(Ii==Ye?Ye.__h=[]:(t.__h.some(kr),t.__h.some(Ei),Qn=0),t.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})),Ii=Ye},Ue.diffed=function(e){fc&&fc(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&bc(yc.push(t)),t.__H.__.some(function(n){n.u&&(n.__H=n.u)})),Ii=Ye=null},Ue.__c=function(e,t){t.some(function(n){try{n.__h.some(kr),n.__h=n.__h.filter(function(r){return!r.__||Ei(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],Ue.__e(r,n.__v)}}),mc&&mc(e,t)},Ue.unmount=function(e){gc&&gc(e);var t,n,r=e.__c;r&&r.__H&&(r.__H.__.some(function(o){try{if(o.__P&&o.__c){if(n===void 0){for(n=e.__;n&&(!n.__c||!n.__c.__P);)n=n.__;n=n&&n.__c}o.__P=n,bc(Ai.push(o))}else kr(o)}catch(a){t=a}}),r.__H=void 0,t&&Ue.__e(t,r.__v))};var hc=typeof requestAnimationFrame=="function";function um(e){var t,n=function(){clearTimeout(r),hc&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);hc&&(t=requestAnimationFrame(n))}function bc(e){e!=1&&dc==Ue.requestAnimationFrame||((dc=Ue.requestAnimationFrame)||um)(cm)}function kr(e){var t=Ye,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Ye=t}function Ei(e){var t=Ye;e.__c=e.__(),Ye=t}function Mi(e,t){return!e||e.length!=t.length||t.some(function(n,r){return!Ti(n,e[r])})}function xc(e,t){return typeof t=="function"?t(e):t}var dm=Symbol.for("preact-signals");function $o(){if(Jt>1)Jt--;else{var e,t=!1;for((function(){var o=Lo;for(Lo=void 0;o!==void 0;){var a=o.S;if(a.v===o.v)for(var i=a.t;i!==void 0;i=i.x)i.i===o.i&&(i.i=a.i);o=o.o}})();Rr!==void 0;){var n=Rr;for(Rr=void 0,No++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&kc(n))try{n.c()}catch(o){t||(e=o,t=!0)}n=r}}if(No=0,Jt--,t)throw e}}function $t(e){if(Jt>0)return e();Ni=++pm,Jt++;try{return e()}finally{$o()}}var Cr,De=void 0;function Ir(e){var t=De,n=Cr;De=void 0,Cr=void 0;try{return e()}finally{De=t,Cr=n}}var Rr=void 0,Jt=0,No=0,pm=0,Ni=0,Lo=void 0,Oo=0;function Sc(e){if(De!==void 0){var t=e.n;if(t===void 0||t.t!==De)return t={i:0,S:e,p:De.s,n:void 0,t:De,e:void 0,x:void 0,r:t},De.s!==void 0&&(De.s.n=t),De.s=t,e.n=t,32&De.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=De.s,t.n=void 0,De.s.n=t,De.s=t),t}}function ot(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}ot.prototype.brand=dm;ot.prototype.h=function(){return!0};ot.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:Ir(function(){var r;(r=t.W)==null||r.call(t)}))};ot.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&Ir(function(){var o;(o=t.Z)==null||o.call(t)}))}};ot.prototype.subscribe=function(e){var t=this;return Ut(function(){var n=t.value;Ir(function(){return e(n)})},{name:"sub"})};ot.prototype.valueOf=function(){return this.value};ot.prototype.toString=function(){return this.value+""};ot.prototype.toJSON=function(){return this.value};ot.prototype.peek=function(){var e=this;return Ir(function(){return e.value})};Object.defineProperty(ot.prototype,"value",{get:function(){var e=Sc(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(No>100)throw new Error("Cycle detected");(function(n){Jt!==0&&No===0&&n.l!==Ni&&(n.l=Ni,Lo={S:n,v:n.v,i:n.i,o:Lo})})(this),this.v=e,this.i++,Oo++,Jt++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{$o()}}}});function re(e,t){return new ot(e,t)}function kc(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 wc(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 Cc(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function kn(e,t){ot.call(this,void 0,t),this.x=e,this.s=void 0,this.g=Oo-1,this.f=4}kn.prototype=new ot;kn.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Oo))return!0;if(this.g=Oo,this.f|=1,this.i>0&&!kc(this))return this.f&=-2,!0;var e=De;try{wc(this),De=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 De=e,Cc(this),this.f&=-2,!0};kn.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)}ot.prototype.S.call(this,e)};kn.prototype.U=function(e){if(this.t!==void 0&&(ot.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)}};kn.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(kn.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Sc(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function he(e,t){return new kn(e,t)}function Rc(e){var t=e.m;if(e.m=void 0,typeof t=="function"){Jt++;var n=De;De=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,Li(e),r}finally{De=n,$o()}}}function Li(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Rc(e)}function _m(e){if(De!==this)throw new Error("Out-of-order effect");Cc(this),De=e,this.f&=-2,8&this.f&&Li(this),$o()}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,Cr&&Cr.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,Rc(this),wc(this),Jt++;var e=De;return De=this,_m.bind(this,e)};Yn.prototype.N=function(){2&this.f||(this.f|=2,this.u=Rr,Rr=this)};Yn.prototype.d=function(){this.f|=8,1&this.f||Li(this)};Yn.prototype.dispose=function(){this.d()};function Ut(e,t){var n=new Yn(e,t);try{n.c()}catch(o){throw n.d(),o}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var Ic,Ar,Do,fm=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var Tc=[];Ut(function(){Ic=this.N})();function Xn(e,t){pe[e]=t.bind(null,pe[e]||function(){})}function Tr(e){if(Do){var t=Do;Do=void 0,t()}Do=e&&e.S()}function Ac(e){var t=this,n=e.data,r=It(n);r.name="ReactiveDom",r.value=n;var o=ie(function(){for(var s=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var p=he(function(){var f=r.value.value;return f===0?0:f===!0?"":f||""}),d=he(function(){return!Array.isArray(p.value)&&!si(p.value)}),_=Ut(function(){if(this.N=Ec,d.value){var f=p.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=f)}}),u=t.__$u.d;return t.__$u.d=function(){_(),u.call(this)},[d,p]},[]),a=o[0],i=o[1];return a.value?i.peek():i.value}Ac.displayName="ReactiveTextNode";Object.defineProperties(ot.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Ac},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});Xn("__b",function(e,t){if(Tr(),Ar=void 0,typeof t.type=="string"){var n,r=t.props;for(var o in r)if(o!=="children"){var a=r[o];a instanceof ot&&(n||(t.__np=n={}),n[o]=a,r[o]=a.peek())}}e(t)});Xn("__r",function(e,t){if(e(t),t.type!==_e){Tr();var n,r=t.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=(function(o,a){var i;return Ut(function(){i=this},{name:a}),i.c=o,i})((function(o){return function(){var a;fm&&((a=this.y)==null||a.call(this)),o.__$f|=1,o.setState({})}})(r),typeof t.type=="function"?t.type.displayName||t.type.name:""))),Ar=r,Tr(n)}});Xn("__e",function(e,t,n,r){Tr(),Ar=void 0,e(t,n,r)});Xn("diffed",function(e,t){Tr(),Ar=void 0;var n;if(typeof t.type=="string"&&(n=t.__e)){var r=t.__np,o=t.props,a=n.U;if(a)for(var i in a){var s=a[i];s===void 0||r&&i in r||(s.d(),a[i]=void 0)}if(r){a||(a={},n.U=a);for(var c in r){var p=a[c],d=r[c];p===void 0?(p=mm(n,c,d,o),a[c]=p):p.o(d,o)}}}e(t)});function mm(e,t,n,r){var o=t in e&&e.ownerSVGElement===void 0,a=re(n);return{o:function(i,s){a.value=i,r=s},d:Ut(function(){this.N=Ec;var i=a.value.value;r[t]!==i&&(r[t]=i,o?e[t]=i:i!=null&&(i!==!1||t[4]==="-")?e.setAttribute(t,i):e.removeAttribute(t))})}}Xn("unmount",function(e,t){if(typeof t.type=="string"){var n=t.__e;if(n){var r=n.U;if(r){n.U=void 0;for(var o in r){var a=r[o];a&&a.d()}}}var i=t.__np;if(i){var s=t.props;for(var c in i)s[c]=i[c]}t.__np=void 0}else{var p=t.__c;if(p){p.__$f|=8;var d=p.__$u;d&&(p.__$u=void 0,d.d())}}e(t)});Xn("__h",function(e,t,n,r){r<3&&(t.__$f|=2),e(t,n,r)});Ot.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,r=n&&n.s!==void 0;for(var o in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var a=2&this.__$f;if(!(r||a||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var i in e)if(i!=="__source"&&e[i]!==this.props[i])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function It(e,t){return ie(function(){return re(e,t)},[])}function Ct(e,t){var n=D(e);return n.current=e,Ar.__$f|=4,ie(function(){return he(function(){return n.current()},t)},[])}var gm=function(e){queueMicrotask(function(){queueMicrotask(e)})};function vm(){$t(function(){for(var e;e=Tc.shift();)Ic.call(e)})}function Ec(){Tc.push(this)===1&&(pe.requestAnimationFrame||gm)(vm)}var hm="x-public-key",bm="x-ai-agent-deployment-id";function Mc(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");return{headers(){let t={[bm]:e.aiAgentDeploymentId};return e.publicKey&&(t[e.publicKeyHeader??hm]=e.publicKey),t}}}var ym=new Set(["home","chats","help","news"]);function Nc(e){return typeof e!="object"||e===null||!("to"in e)||typeof e.to!="string"||!ym.has(e.to)?!1:!("id"in e)||e.id===void 0||typeof e.id=="string"}function Bo(e){let[t="",...n]=e.trim().split("/");if(t===""||t==="open")return;let r=n.join("/");return r?{to:t,id:r}:{to:t}}function Er(e,t){return{text:e,send:typeof t=="object"&&t!==null&&"send"in t&&t.send===!0}}function Lc(e){if(typeof e!="object"||e===null||!("text"in e)||typeof e.text!="string")return;let t=e.text.trim();return t?{text:t,send:"send"in e&&e.send===!0}:void 0}function Oc(e){return`${A.cssPrefix}:${e}`}function Nt(e,t,n){e.dispatchEvent(new CustomEvent(Oc(t),{detail:n}))}function $c(e,t){let r=Object.entries(t).map(([o,a])=>{let i=Oc(o);function s(c){return a(c.detail)}return e.addEventListener(i,s),[i,s]});return()=>{for(let[o,a]of r)e.removeEventListener(o,a)}}function Fo(e,t){let n=[],r;for(let o of e){let a=new URLSearchParams(o);a.has(t)?r??(r=a.get(t)??""):n.push(o)}return{value:r,rest:n}}function Dc(e){let t=new URL(e),n=A.cssPrefix,r=`${A.cssPrefix}-ask`,o=t.search.slice(1).split("&").filter(Boolean),a=t.hash.slice(1).split("&").filter(Boolean),i=Fo(o,n),s=Fo(i.rest,r),c=Fo(a,n),p=Fo(c.rest,r),d=i.value??c.value,_=(s.value??p.value)?.trim()||void 0;if(!(d===void 0&&_===void 0))return t.search=s.rest.join("&"),t.hash=p.rest.join("&"),{target:d===void 0?void 0:Bo(d),..._?{ask:_}:{},url:t.toString()}}var Mr={open:!1,ready:!1,unread:0},Uo=class{constructor(){ee(this,"handlers",new Map)}on(t,n){let r=this.handlers.get(t);return r||(r=new Set,this.handlers.set(t,r)),r.add(n),()=>this.handlers.get(t)?.delete(n)}emit(t,n){let r=this.handlers.get(t);if(r)for(let o of r)try{o(n)}catch{}}clear(){this.handlers.clear()}};var Bc=le.scope("feedback:audio"),qo=class{constructor(){ee(this,"ctx",null);ee(this,"master",null);ee(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){Bc.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,r=this.master;if(!n||!r||n.state!=="running")return;let o=n.currentTime,a=t.noteMs/1e3;t.notes.forEach((i,s)=>{let c=n.createOscillator();c.type=t.type,c.frequency.value=i;let p=n.createGain(),d=o+s*a;p.gain.setValueAtTime(1e-4,d),p.gain.exponentialRampToValueAtTime(t.peakGain,d+.005),p.gain.exponentialRampToValueAtTime(1e-4,d+a),c.connect(p).connect(r),c.start(d),c.stop(d+a+.01)})}async playUrl(t){let n=this.ctx,r=this.master;if(!n||!r||n.state!=="running")return;let o=await this.getBuffer(t);if(!o)return;let a=n.createBufferSource();a.buffer=o,a.connect(r),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 r=this.ctx,o=fetch(t).then(a=>a.ok?a.arrayBuffer():Promise.reject(new Error(`fetch ${a.status}`))).then(a=>r.decodeAudioData(a)).then(a=>(this.buffers.set(t,a),a)).catch(a=>(Bc.warn("audio fetch/decode failed",{url:t,err:a}),this.buffers.delete(t),null));return this.buffers.set(t,o),o}};var Fc={messageReceived:10,messageSent:0,error:[20,40,20],voiceStart:10,voiceStop:0},Uc={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 un=null,zo=0;function Pm(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}function xm(){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=`__${A.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 qc(e){if(!(e===0||Array.isArray(e)&&e.every(t=>t===0))){if(Pm())try{navigator.vibrate(e);return}catch{}if(un??(un=xm()),!!un)try{un.label.click()}catch{}}}function zc(){zo++;let e=!1;return()=>{e||(e=!0,zo=Math.max(0,zo-1),zo===0&&un&&(un.input.remove(),un.label.remove(),un=null))}}var Sm=le.scope("feedback"),km=100,Ho=class{constructor(t,n){ee(this,"mutedSig",re(!1));ee(this,"audio",new qo);ee(this,"releaseHaptics");ee(this,"sound");ee(this,"haptics");ee(this,"lastPlayed",new Map);ee(this,"reducedMotionMq",null);this.sound=t,this.haptics=n,this.releaseHaptics=zc(),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<km}playSound(t){let n=this.sound.events?.[t];if(n===!1)return;if(typeof n=="string"){this.audio.playUrl(n).catch(o=>Sm.warn("audio play failed",{err:o,url:n}));return}let r=Uc[t];r&&this.audio.playTone(r)}playHaptic(t){if(this.reducedMotionMq?.matches)return;let n=this.haptics.events?.[t];if(n===!1)return;let r=n===!0||n===void 0?Fc[t]:n;qc(r)}effectiveVolume(){let t=this.sound.volume??.3;return this.reducedMotionMq?.matches?t*.5:t}isTouchDevice(){return typeof window>"u"?!1:matchMedia("(hover: none) and (pointer: coarse)").matches}};function Hc(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function jc(e){return Hc(e)}function Vc(e){return!(!Hc(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}var wm=0;function l(e,t,n,r,o,a){t||(t={});var i,s,c=t;if("ref"in c&&typeof e!="function")for(s in c={},t)s=="ref"?i=t[s]:c[s]=t[s];var p={type:e,props:c,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--wm,__i:-1,__u:0};return(o||a)&&(p.__source=o,p.__self=a),pe.vnode&&pe.vnode(p),p}var Di=1,Gc=2,Nr=4,Kc=8,Qc=16;function Cm(e){switch(e){case Di:return"href";case Gc:return"src";case Nr:return"class";case Kc:return"checked";case Qc:return"start"}}var Rm=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}},Im=Rm;var Wc=24;function Jn(e){let t=new Uint32Array(Wc);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(Wc),indent:"",indent_len:0,table_state:0}}function Lr(e){e.pending.length>0&&We(e,`
8
- `)}function Pe(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 qe(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 ke(e,t){(e.tokens[e.len]===24||e.tokens[e.len]===23)&&t!==25&&qe(e),e.len+=1,e.tokens[e.len]=t,e.token=t,e.renderer.add_token(e.renderer.data,t)}function Tm(e,t,n){for(;n<=e.len;){if(e.tokens[n]===t)return n;n+=1}return-1}function wn(e,t){for(e.fence_start=0;e.len>t;)qe(e)}function jo(e,t){let n=0;for(let r=0;r<=e.len&&(t-=e.spaces[r],!(t<0));r+=1)switch(e.tokens[r]){case 9:case 10:case 20:case 25:n=r;break}for(;e.len>n;)qe(e);return t}function Oi(e,t){let n=-1,r=-1;for(let o=e.blockquote_idx+1;o<=e.len;o+=1)if(e.tokens[o]===25){if(e.indent_len<e.spaces[o]){r=-1;break}r=o}else e.tokens[o]===t&&(n=o);return r===-1?n===-1?(wn(e,e.blockquote_idx),ke(e,t),!0):(wn(e,n),!1):(wn(e,r),ke(e,t),!0)}function $i(e,t){ke(e,25),e.spaces[e.len]=e.indent_len+t,Zt(e),e.token=103}function Zt(e){e.indent="",e.indent_len=0,e.pending=""}function Bi(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 Am(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 Em(e){return Bi(e)||Am(e)}function We(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 o=jo(e,e.indent_len);e.indent_len=0,e.token=e.tokens[e.len],o>0&&We(e," ".repeat(o))}let r=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`
9
- `:if(console.assert(e.pending.length===1),e.tokens[e.len]===25&&e.token===21){qe(e),Zt(e),e.pending=n;continue}wn(e,e.blockquote_idx),Zt(e),e.blockquote_idx=0,e.fence_start=0,e.pending=n;continue;case"#":switch(n){case"#":if(e.pending.length<6){e.pending=r;continue}break;case" ":jo(e,e.indent_len),ke(e,Im(e.pending.length)),Zt(e);continue}break;case">":{let a=Tm(e,20,e.blockquote_idx+1);a===-1?(wn(e,e.blockquote_idx),e.blockquote_idx+=1,e.fence_start=0,ke(e,20)):e.blockquote_idx=a,Zt(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=r;continue;case" ":e.pending=r;continue;case`
10
- `:if(e.hr_chars<3)break;jo(e,e.indent_len),e.renderer.add_token(e.renderer.data,22),e.renderer.end_token(e.renderer.data),Zt(e),e.hr_chars=0;continue}e.hr_chars=0}if(e.pending[0]!=="_"&&e.pending[1]===" "){Oi(e,23),$i(e,2),We(e,r.slice(2));continue}break;case"`":if(e.pending.length<3){if(n==="`"){e.pending=r,e.fence_start=r.length;continue}e.fence_start=0;break}switch(n){case"`":e.pending.length===e.fence_start?(e.pending=r,e.fence_start=r.length):(ke(e,2),Zt(e),e.fence_start=0,We(e,r));continue;case`
11
- `:{jo(e,e.indent_len),ke(e,10),e.pending.length>e.fence_start&&e.renderer.set_attr(e.renderer.data,Nr,e.pending.slice(e.fence_start)),Zt(e),e.token=101;continue}default:e.pending=r;continue}case"+":if(n!==" ")break;Oi(e,23),$i(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;Oi(e,24)&&e.pending!=="1."&&e.renderer.set_attr(e.renderer.data,Qc,e.pending.slice(0,-1)),$i(e,e.pending.length+1);continue}else{let a=n.charCodeAt(0);if(a===46||Bi(a)){e.pending=r;continue}}break;case"|":wn(e,e.blockquote_idx),ke(e,27),ke(e,28),e.pending="",We(e,n);continue}let o=r;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}o=e.indent.slice(a)+r,ke(e,9)}else ke(e,2);Zt(e),We(e,o);continue;case 27:if(e.table_state===1)switch(n){case"-":case" ":case"|":case":":e.pending=r;continue;case`
12
- `:e.table_state=2,e.pending="";continue;default:qe(e),e.table_state=0;break}else switch(e.pending){case"|":ke(e,28),e.pending="",We(e,n);continue;case`
13
- `:qe(e),e.pending="",e.table_state=0,We(e,n);continue}break;case 28:switch(e.pending){case"":break;case"|":ke(e,29),qe(e),e.pending="",We(e,n);continue;case`
14
- `:qe(e),e.table_state=Math.min(e.table_state+1,2),e.pending="",We(e,n);continue;default:ke(e,29),We(e,n);continue}break;case 29:if(e.pending==="|"){Pe(e),qe(e),e.pending="",We(e,n);continue}break;case 9:switch(r){case`
1
+ var Nf=Object.defineProperty;var Lf=(e,t,n)=>t in e?Nf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var te=(e,t,n)=>Lf(e,typeof t!="symbol"?t+"":t,n);var de,Nl,yi,dn,hi,wo,Ll,ko,Ol,Pi,vi,Of,Co={},To=[],$f=/^m(i|n|o|s|text|space)$/,Ro=Array.isArray,xi=To.slice,wn=Object.assign;function kn(e){e&&e.parentNode&&e.remove()}function Kn(e,t,n){var r,o,a,i={},s=arguments.length;for(a in t)a=="key"?r=t[a]:a=="ref"&&typeof e!="function"?o=t[a]:i[a]=t[a];return s>2&&(i.children=s>3?xi.call(arguments,2):n),Tr(e,i,r,o,null)}function Tr(e,t,n,r,o){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o||++Nl,__i:-1,__u:0};return!o&&de.vnode&&de.vnode(a),a}function _e(e){return e.children}function $t(e,t){this.props=e,this.context=t,this.__g=0}function pn(e,t){if(t==null)return e.__&&pn(e.__,e.__i+1);for(var n;t<e.__k.length;t++)if((n=e.__k[t])&&n.__e)return n.__e;return typeof e.type!="function"||e.props.__P?null:pn(e)}function $l(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),$l(e)}function El(e){(8&e.__g||(e.__g|=8,dn.push(e),wo++))&&hi==de.debounceRendering||((hi=de.debounceRendering)||queueMicrotask)(Dl)}function Dl(){var e,t,n,r,o,a,i,s,c;try{for(t=1;dn.length;)dn.length>t&&dn.sort(Ll),e=dn.shift(),t=dn.length,8&e.__g&&(r=void 0,o=void 0,a=(o=(n=e).__v).__e,i=[],s=[],(c=n.__P)&&((r=wn({constructor:void 0},o)).__v=o.__v+1,de.vnode&&de.vnode(r),Si(c,r,o,n.__n,c.namespaceURI,32&o.__u?[a]:null,i,a||pn(o),32&o.__u,s),r.__v=o.__v,r.__.__k[r.__i]=r,ql(i,r,s),o.__=o.__e=null,r.__e!=a&&$l(r)))}finally{(wo=dn.length)&&(hi||queueMicrotask)(Dl)}}function Bl(e,t,n,r,o,a,i,s,c,p,_){var d,u,f,m,v,P,x=r.__k||To,k=t.length;for(c=Df(n,t,x,c,k),d=0;d<k;d++)(f=n.__k[d])!=null&&(u=~f.__i&&x[f.__i]||Co,f.__i=d,P=Si(e,f,u,o,a,i,s,c,p,_),m=f.__e,(u.ref!=f.ref||8&u.__u)&&(u.ref&&ki(u.ref,null,f,u),f.ref&&_.push(f.ref,f.__c||m,f)),v=v||m,4&f.__u?(c=Fl(f,c,e,!u.__v),u.__e&&(u.__e=null)):typeof f.type=="function"&&P!==void 0?c=P:m&&(c=m.nextSibling),f.__u&=-21);return n.__e=v,c}function Df(e,t,n,r,o){var a,i,s,c,p,_,d,u,f,m=n.length,v=m,P=0,x=0,k=e.__k=Array(o);for(a=0;a<o;a++)(i=t[a])!=null&&typeof i!="boolean"&&typeof i!="function"?(typeof i!="object"||i.constructor==String?i=k[a]=Tr(null,i):Ro(i)?i=k[a]=Tr(_e,{children:i}):i.constructor===void 0&&i.__b?i=k[a]=Tr(i.type,i.props,i.key,i.ref,i.__v):k[a]=i,c=a+P,i.__=e,i.__b=e.__b+1,s=null,~(p=i.__i=Bf(i,n,c,v))&&(v--,(s=n[p])&&(s.__u|=2)),s&&s.__v?(i.__u|=16,p==c-1?P--:p==c+1?P++:p!=c&&(p>c?P--:P++,x=1)):(~p||(o>m?P--:o<m&&P++),typeof i.type!="function"&&(i.__u|=4))):k[a]=null;if(x){for(_=[],d=[],a=0;a<o;a++)if((i=k[a])&&16&i.__u){for(P=0,u=_.length;P<u;)_[f=P+u>>1]<i.__i?P=f+1:u=f;_[P]=i.__i,d[a]=P+1}for(P=_.length;a--;)d[a]&&(d[a]==P?P--:k[a].__u|=4)}if(v)for(a=0;a<m;a++)!(s=n[a])||2&s.__u||(s.__e==r&&(r=pn(s)),wi(s,s));return r}function Fl(e,t,n,r){var o,a,i,s;if(typeof e.type=="function"){if(e.props.__P)return t;if(o=e.__k)for(a=0;a<o.length;a++)o[a]&&(o[a].__=e,t=Fl(o[a],t,n,!1));return t}for(t&&!t.parentNode&&(t=pn(e))&&!t.parentNode&&(t=null),i=e.__e,s=t;s&&s.nodeType==8;)s=s.nextSibling;for(i!=s&&(!r&&n.moveBefore&&i.parentNode?n.moveBefore(i,t):n.insertBefore(i,t||null)),t=i;(t=t&&t.nextSibling)&&t.nodeType==8&&!t.data.startsWith("$s"););return t}function Io(e,t){return t=t||[],e!=null&&typeof e!="boolean"&&(Ro(e)?e.some(function(n){Io(n,t)}):t.push(e)),t}function Bf(e,t,n,r){var o,a=e.key,i=e.type,s=t[n],c=s&&!(2&s.__u);if(s===null&&a==null||c&&a==s.key&&i==s.type)return n;if(r>(c?1:0)){for(o=n-1;o>=0;o--)if((s=t[o])&&!(2&s.__u)&&a==s.key&&i==s.type)return o;for(o=n+1;o<t.length;o++)if((s=t[o])&&!(2&s.__u)&&a==s.key&&i==s.type)return o}return-1}function Ml(e,t,n){n==null&&(n=""),t[0]=="-"?e.setProperty(t,n):e[t]=n}function So(e,t,n,r,o){var a,i;if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||Ml(e.style,t);if(n)for(t in n)r&&n[t]==r[t]||Ml(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")(e.__e||(e.__e={}))[t]=n,n&&r||(i=vi[t]||(vi[t]=Ff(t)),(e.__a||(e.__a={}))[t]=Pi,a=t!=(t=t.replace(Ol,"$1")),(t=t.slice(2))[0]<"a"&&(t=t.toLowerCase()),n?e.addEventListener(t,i,a):e.removeEventListener(t,i,a));else{if(o=="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{return void(e[t]=n??"")}catch{}if(typeof n=="function")return;n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n)}}function Ff(e){return function(t){var n=this.__e;if(n){if(n=n[e],t[ko]==null)t[ko]=Pi++;else if(t[ko]<this.__a[e])return;return n(de.event?de.event(t):t)}}}function Si(e,t,n,r,o,a,i,s,c,p){var _,d,u,f,m,v,P,x,k,T,h,g,S,w,C,A,E,N,O=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=32&n.__u,_=n.__c.__z)&&(t.__u|=c,d=a=[],_.nodeType==8?s=bi(_,a):a.push(_),s=a[0]||s),(_=de.__b)&&_(t);e:if(typeof O=="function"){u=i.length;try{if(x=t.props,k=(_=O.prototype)&&_.render,T=(_=O.contextType)&&r[_.__c],h=_?T?T.props.value:_.__:r,(f=n.__c)?(t.__c=f,2&f.__g&&(f.__g|=1)):(k?t.__c=f=new O(x,h):(t.__c=f=new $t(x,h),f.constructor=O,f.render=qf),T&&T.sub(f),f.state||(f.state={}),f.__n=r,f.__g|=8,f.__h=[],f.__k=[]),k&&(f.__s||(f.__s=f.state),O.getDerivedStateFromProps&&(f.__s==f.state&&(f.__s=wn({},f.__s)),wn(f.__s,O.getDerivedStateFromProps(x,f.__s)))),m=f.props,v=f.state,f.__v=t,n.__c){if(x!==m&&k&&!O.getDerivedStateFromProps&&f.componentWillReceiveProps&&f.componentWillReceiveProps(x,h),t.__v==n.__v&&!(8&f.__g)||!(4&f.__g)&&f.shouldComponentUpdate&&f.shouldComponentUpdate(x,f.__s,h)===!1){t.__v!=n.__v&&(f.props=x,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(j){j&&(j.__=t)}),To.push.apply(f.__h,f.__k),f.__k=[],f.__h.length&&i.push(f),s=pn(n);break e}f.componentWillUpdate&&f.componentWillUpdate(x,f.__s,h),k&&f.componentDidUpdate&&f.__h.push(function(){f.componentDidUpdate(m,v,P)})}else k&&!O.getDerivedStateFromProps&&f.componentWillMount&&f.componentWillMount(),k&&f.componentDidMount&&f.__h.push(f.componentDidMount);if(f.context=h,f.props=x,f.__P=e,f.__g&=-5,g=de.__r,S=0,k)f.state=f.__s,f.__g&=-9,g&&g(t),_=f.render(f.props,f.state,f.context),To.push.apply(f.__h,f.__k),f.__k=[];else do f.__g&=-9,g&&g(t),_=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++S<25);f.state=f.__s,f.getChildContext&&(r=wn({},r,f.getChildContext())),k&&n.__c&&f.getSnapshotBeforeUpdate&&(P=f.getSnapshotBeforeUpdate(m,v)),w=_&&_.type===_e&&_.key==null?_.props.children:_,x.__P&&(_=s,o=(e=x.__P).namespaceURI,c=a=null,n.props&&n.props.__P!=e&&(n.__k.some(function(j){j&&wi(j,j)}),n.__k=null),s=n.__k?pn(n,0):null),s=Bl(e,Ro(w)?w:[w],t,n,r,o,a,i,s,c,p),x.__P&&(t.__e=null,s=_),t.__u&=-161,d&&d.some(kn),f.__h.length&&i.push(f),1&f.__g&&(f.__g&=-4)}catch(j){if(i.length=u,t.__v=null,c||a)if(j.then){if(C=0,t.__u|=128|c,a){for(~(E=a.indexOf(s||void 0))||(E=a.length);(N=a[E-1])&&N.nodeType==8;)E--;for(;E<a.length;E++)if(N=a[E]){if(a[E]=null,N.nodeType==8){if(N.data.startsWith("$s"))C++||(A=N);else if(C&&N.data.startsWith("/$s")&&!--C)break}else if(!C)break}}if(!A){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;A=s}(_=bi(A=t.__c.__z||(t.__c.__z=A)))?(t.__e=A,s=_):t.__e=s,s=s&&s.nextSibling}else a&&a.some(kn);else t.__e=n.__e;t.__k||(t.__k=n.__k||[]),j.then||Ul(t),de.__e(j,t,n)}}else s=t.__e=Uf(n.__e,t,n,r,o,a,i,c,p,e);return(_=de.diffed)&&_(t),s}function bi(e,t){if(e&&e.nodeType==8&&e.data.startsWith("$s"))for(var n=1;e=e.nextSibling;){if(e.nodeType==8){if(e.data.startsWith("$s"))n++;else if(e.data.startsWith("/$s")&&!--n)return e}t&&t.push(e)}}function Ul(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(Ul))}function ql(e,t,n){for(var r=0;r<n.length;)ki(n[r++],n[r++],n[r++]);de.__c&&de.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(a){a.call(o)})}catch(a){de.__e(a,o.__v)}})}function Uf(e,t,n,r,o,a,i,s,c,p){var _,d,u,f,m,v,P,x,k,T=n.props||Co,h=t.props,g=t.type;if(g=="svg"?o="http://www.w3.org/2000/svg":g=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),a){for(_=0;_<a.length;_++)if((m=a[_])&&(g?m.localName==g:m.nodeType==3)){e=m,a[_]=null;break}}if(!e){if(x=p.ownerDocument||document,!g)return x.createTextNode(h);e=x.createElementNS(o,g,h.is&&h),s&&(de.__m&&de.__m(t,a),s=!1),a=null}if(g){if(p=g=="template"?e.content:e,a=g=="textarea"&&h.defaultValue!=null?null:a&&xi.call(p.childNodes),!s&&a)for(T={},_=0;_<e.attributes.length;_++)T[(m=e.attributes[_]).name]=m.value;for(_ in T)m=T[_],_=="dangerouslySetInnerHTML"?u=m:_=="children"||_ in h||_=="value"&&"defaultValue"in h||_=="checked"&&"defaultChecked"in h||So(e,_,null,m,o);for(_ in k=1&n.__u,h)m=h[_],_=="children"?f=m:_=="dangerouslySetInnerHTML"?d=m:_=="value"?v=m:_=="checked"?P=m:s&&typeof m!="function"||!(T[_]!==m||k&&m!=null)||So(e,_,m,T[_],o);d?(s||u&&(d.__html==u.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[]):(u&&(e.textContent=""),(g=="foreignObject"||o=="http://www.w3.org/1998/Math/MathML"&&$f.test(g))&&(o="http://www.w3.org/1999/xhtml"),Bl(p,Ro(f)?f:[f],t,n,r,o,a,i,a?a[0]:n.__k&&pn(n,0),s,c),a&&a.some(kn)),s&&g!="textarea"||(_="value",g=="progress"&&v==null?e.removeAttribute(_):v==null||v===e[_]&&(g!="progress"||v)||So(e,_,v,T[_],o),_="checked",P!=null&&P!=e[_]&&So(e,_,P,T[_],o))}else T===h||s&&e.data==h||(e.data=h);return e}function ki(e,t,n,r){try{typeof e=="function"?t?t.__x=e(t)||1:r&&(r=r.__c||r.__e)&&(t=r.__x)&&(r.__x=null,typeof t=="function"?t():e(null)):e.current=t}catch(o){de.__e(o,n)}}function wi(e,t,n){var r,o,a,i;if(de.unmount&&de.unmount(e),!(r=e.ref)||r.current&&r.current!=e.__e||ki(r,null,t,e),r=e.__c){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(s){de.__e(s,t)}r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&wi(r[i],t,typeof e.type!="function"||n&&!e.props.__P);!n&&(r=e.__c)&&(r=r.__z)&&(o=bi(r,a=[]))&&(r==e.__e&&a.some(kn),kn(o),kn(r)),(r=e.__e)&&(n||kn(r),r.__e&&(r.__e=null)),e.__e=e.__c=e.__=null}function qf(e,t,n){return this.constructor(e,n)}function _n(e,t){var n,r,o,a;de.__&&de.__(e,t),t.nodeType==9&&(t=t.documentElement),r=(n=e&&32&e.__u)?null:t.__k,t.__k=Tr(_e,{children:[e]}),o=[],a=[],Si(t,t.__k,r||Co,Co,t.namespaceURI,r?null:t.firstChild?xi.call(t.childNodes):null,o,r?r.__e:t.firstChild,n,a),ql(o,t.__k,a),t.__k.props.children=null}de={__e:function(e,t,n,r){for(var o,a,i;t=t.__;)if((o=t.__c)&&!(1&o.__g)){o.__g|=4;try{if((i=(a=o.constructor)&&a.getDerivedStateFromError)&&o.setState(a.getDerivedStateFromError(e)),o.componentDidCatch&&(o.componentDidCatch(e,r||{}),i=1),i&&8&o.__g)return void(o.__g|=2)}catch(s){e=s}}throw wo=0,e}},Nl=0,yi=function(e){return e!=null&&e.constructor===void 0},$t.prototype.setState=function(e,t){var n=this.__s;n&&n!=this.state||(n=this.__s=wn({},this.state)),typeof e=="function"&&(e=e(wn({},n),this.props)),e&&(wn(n,e),this.__v&&(t&&this.__k.push(t),El(this)))},$t.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),El(this))},$t.prototype.render=_e,dn=[],wo=0,Ll=function(e,t){return e.__v.__b-t.__v.__b},ko=Symbol(),Ol=/(PointerCapture)$|Capture$/i,Pi=0,vi={},Of=0;function Ci(e,t){if(!(!e?.length||!t))return e.find(n=>n.locale===t)}function Hl(e,t){let{translations:n,defaultLocale:r,...o}=e,a=Ci(n,t);return a?{...o,title:a.title??o.title,description:a.description??o.description,content:a.content??o.content}:o}function zl(e,t){let{translations:n,defaultLocale:r,...o}=e,a=Ci(n,t);return a?{...o,title:a.title??o.title,description:a.description??o.description}:o}function jl(e,t){let{translations:n,defaultLocale:r,...o}=e,a=Ci(n,t);if(!a)return o;let i=new Map((a.fields??[]).map(c=>[c.name,c])),s=o.fields.map(c=>{let p=i.get(c.name);if(!p)return c;let _=new Map((p.options??[]).map(d=>[d.value,d]));return{...c,label:p.label??c.label,placeholder:p.placeholder??c.placeholder,validationHint:p.validationHint??c.validationHint,options:c.options?.map(d=>{let u=_.get(d.value);return u?{...d,label:u.label??d.label,description:u.description??d.description}:d})}});return{...o,title:a.title??o.title,description:a.description??o.description,submitLabel:a.submitLabel??o.submitLabel,fields:s}}var Ao={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 a person",connectingOperator:"Connecting you to a person\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",visualPreparing:"Preparing visual\u2026",visualError:"This visual could not be displayed.",visualPartial:"Some parts of this visual could not be displayed.",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",contentHelpful:"Was this helpful?",homeGreeting:"How can we help?",homeGreetingNamed:"Hi {name} \u{1F44B}",homeGreetingLead:"How can we help?",homeSearchPlaceholder:"Search for help",homeAskPlaceholder:"Ask a question\u2026",homeWhatsNew:"What's new",homeContentTitle:"Popular articles",homeStatus:"Status",helpTitle:"Help",helpSearchPlaceholder:"Search for help",helpEmpty:"No help articles yet",helpLoading:"Loading help\u2026",helpSearchEmpty:"No results for \u201C{query}\u201D",helpShowMore:"Show more",newsTitle:"News",newsEmpty:"No news yet",newsLoading:"Loading news\u2026",newsBack:"Back to news",newsPublishedAt:"Published {date}",newsShowMore:"Show more",newsUnseen:"New post",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",statusIncomplete:"Not completed"},Hf={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 une personne",connectingOperator:"Mise en relation avec une personne\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",visualPreparing:"Pr\xE9paration du visuel\u2026",visualError:"Ce visuel n\u2019a pas pu \xEAtre affich\xE9.",visualPartial:"Certaines parties de ce visuel n\u2019ont pas pu \xEAtre affich\xE9es.",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",contentHelpful:"Cela vous a-t-il aid\xE9 ?",homeGreeting:"Comment pouvons-nous vous aider ?",homeGreetingNamed:"Bonjour {name} \u{1F44B}",homeGreetingLead:"Comment pouvons-nous vous aider ?",homeSearchPlaceholder:"Rechercher de l'aide",homeAskPlaceholder:"Posez une question\u2026",homeWhatsNew:"Nouveaut\xE9s",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 pour \xAB\xA0{query}\xA0\xBB",helpShowMore:"Afficher plus",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}",newsShowMore:"Afficher plus",newsUnseen:"Nouvelle publication",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",statusIncomplete:"Non termin\xE9"},zf={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 \u0634\u062E\u0635",connectingOperator:"\u062C\u0627\u0631\u064D \u062A\u0648\u0635\u064A\u0644\u0643 \u0628\u0634\u062E\u0635\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",visualPreparing:"\u062C\u0627\u0631\u064D \u0625\u0639\u062F\u0627\u062F \u0627\u0644\u0645\u062D\u062A\u0648\u0649 \u0627\u0644\u0645\u0631\u0626\u064A\u2026",visualError:"\u062A\u0639\u0630\u0631 \u0639\u0631\u0636 \u0647\u0630\u0627 \u0627\u0644\u0645\u062D\u062A\u0648\u0649 \u0627\u0644\u0645\u0631\u0626\u064A.",visualPartial:"\u062A\u0639\u0630\u0631 \u0639\u0631\u0636 \u0628\u0639\u0636 \u0623\u062C\u0632\u0627\u0621 \u0647\u0630\u0627 \u0627\u0644\u0645\u062D\u062A\u0648\u0649 \u0627\u0644\u0645\u0631\u0626\u064A.",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",contentHelpful:"\u0647\u0644 \u0643\u0627\u0646 \u0647\u0630\u0627 \u0645\u0641\u064A\u062F\u064B\u0627\u061F",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",homeAskPlaceholder:"\u0627\u0637\u0631\u062D \u0633\u0624\u0627\u0644\u0627\u064B\u2026",homeWhatsNew:"\u0645\u0627 \u0627\u0644\u062C\u062F\u064A\u062F",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 \u0646\u062A\u0627\u0626\u062C \u0644\u0640 \xAB{query}\xBB",helpShowMore:"\u0639\u0631\u0636 \u0627\u0644\u0645\u0632\u064A\u062F",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}",newsShowMore:"\u0639\u0631\u0636 \u0627\u0644\u0645\u0632\u064A\u062F",newsUnseen:"\u0645\u0646\u0634\u0648\u0631 \u062C\u062F\u064A\u062F",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",statusIncomplete:"\u0644\u0645 \u064A\u0643\u062A\u0645\u0644"},jf={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 una persona",connectingOperator:"Conect\xE1ndote con una persona\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",visualPreparing:"Preparando visualizaci\xF3n\u2026",visualError:"No se pudo mostrar esta visualizaci\xF3n.",visualPartial:"No se pudieron mostrar algunas partes de esta visualizaci\xF3n.",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",contentHelpful:"\xBFTe result\xF3 \xFAtil?",homeGreeting:"\xBFC\xF3mo podemos ayudarte?",homeGreetingNamed:"Hola, {name} \u{1F44B}",homeGreetingLead:"\xBFC\xF3mo podemos ayudarte?",homeSearchPlaceholder:"Buscar ayuda",homeAskPlaceholder:"Haz una pregunta\u2026",homeWhatsNew:"Lo nuevo",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:"Sin resultados para \xAB{query}\xBB",helpShowMore:"Mostrar m\xE1s",newsTitle:"Novedades",newsEmpty:"A\xFAn no hay novedades",newsLoading:"Cargando novedades\u2026",newsBack:"Volver a novedades",newsPublishedAt:"Publicado el {date}",newsShowMore:"Mostrar m\xE1s",newsUnseen:"Publicaci\xF3n nueva",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",statusIncomplete:"No completado"},Vf={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\u05D5 \u05E2\u05DD \u05D0\u05D3\u05DD",connectingOperator:"\u05DE\u05D7\u05D1\u05E8\u05D9\u05DD \u05D0\u05D5\u05EA\u05DA \u05DC\u05D0\u05D3\u05DD\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",visualPreparing:"\u05DE\u05DB\u05D9\u05DF \u05EA\u05E6\u05D5\u05D2\u05D4\u2026",visualError:"\u05DC\u05D0 \u05E0\u05D9\u05EA\u05DF \u05D4\u05D9\u05D4 \u05DC\u05D4\u05E6\u05D9\u05D2 \u05EA\u05E6\u05D5\u05D2\u05D4 \u05D6\u05D5.",visualPartial:"\u05DC\u05D0 \u05E0\u05D9\u05EA\u05DF \u05D4\u05D9\u05D4 \u05DC\u05D4\u05E6\u05D9\u05D2 \u05D7\u05DC\u05E7\u05D9\u05DD \u05DE\u05EA\u05E6\u05D5\u05D2\u05D4 \u05D6\u05D5.",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",contentHelpful:"\u05D4\u05D0\u05DD \u05D6\u05D4 \u05E2\u05D6\u05E8?",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",homeAskPlaceholder:"\u05E9\u05D0\u05DC\u05D5 \u05E9\u05D0\u05DC\u05D4\u2026",homeWhatsNew:"\u05DE\u05D4 \u05D7\u05D3\u05E9",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:"\u05D0\u05D9\u05DF \u05EA\u05D5\u05E6\u05D0\u05D5\u05EA \u05E2\u05D1\u05D5\u05E8 \u201E{query}\u201D",helpShowMore:"\u05D4\u05E6\u05D2\u05EA \u05E2\u05D5\u05D3",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}",newsShowMore:"\u05D4\u05E6\u05D2\u05EA \u05E2\u05D5\u05D3",newsUnseen:"\u05E4\u05D5\u05E1\u05D8 \u05D7\u05D3\u05E9",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",statusIncomplete:"\u05DC\u05D0 \u05D4\u05D5\u05E9\u05DC\u05DD"},Wf={en:Ao,fr:Hf,ar:zf,es:jf,he:Vf};function Eo(e,t){let n=Vl(e),r=Mo(t),o=n==="en"?{}:Wf[n]??{},a=r?t[n]??{}:t??{},i=r?t.en??{}:{};return{...Ao,...o,...i,...a}}function Vl(e){return(e.split("-")[0]??"en").toLowerCase()}var Gf=new Set(["ar","he","iw","fa","ur","ps","sd","ug","yi","dv","ckb","ks","nqo","prs","syr"]);function Wl(e){return Gf.has(Vl(e))}function vt(e,t){return e[t]??t}function Mo(e){if(!e)return!1;for(let t of Object.values(e))if(t&&typeof t=="object")return!0;return!1}var M={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 Ti=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{}}},No=new Ti;var Lo={maxBytes:10485760,maxCount:10,accept:"*/*"},Gl={voice:"local"},Kl={list:[],byTrigger:{}},Ri={enabled:!0,sampleRate:1},Oo={upload:"/pai/upload-file",transcribe:"/pai/transcribe-audio",submitForm:"/pai/submit-form"},Qn={variant:"circle",size:"md",label:void 0,icon:"chat",hidden:!1},Ql={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"]},Ii={enabled:!0,volume:.3,events:void 0},Xl={enabled:!0,events:void 0},Jl=[{label:"tabConversations",layout:"chat"}];var Kf=["off","error","warn","info","debug","trace"],Ai=M.cssPrefix,Qf=`${Ai}.debug`,Xf=`__${M.global}_DEBUG__`,Jf=`${Ai}-debug`,ec=2,Yl=null;function Yf(){if(typeof window>"u")return 2;try{let e=new URLSearchParams(window.location.search).get(Jf);if(e!==null){let t=Zl(e);if(t>=0)return t}}catch{}try{let e=window.localStorage?.getItem(Qf);if(e){let t=Zl(e);if(t>=0)return t}}catch{}return Reflect.get(window,Xf)?4:2}function Zl(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=Kf.findIndex(n=>n===e);if(t>=0)return t}return-1}ec=Yf();function tc(e){let t=`[${Ai}:${e}]`;function n(r,o,a){return(i,s)=>{if(!(ec<r)&&(s===void 0?console[o](t,i):console[o](t,i,s),Yl))try{Yl({level:a,scope:e,message:i,payload:s})}catch{}}}return{error:n(1,"error","error"),warn:n(2,"warn","warn"),info:n(3,"info","info"),debug:n(4,"debug","debug"),trace:n(5,"debug","trace"),scope:r=>tc(`${e}:${r}`)}}var se=tc("core");var Cn=se.scope("context"),Zf=new Set(["visitorId","conversationId","jwt","token","authorization","password"]),nc=50,Ei=1024,em=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function Mi(e){return rc(e,"userContext",!0)}function Ni(e){return rc(e,"pageContext",!1)}function rc(e,t,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){Cn.warn(`ignored ${t} \u2014 expected an object`,{type:Array.isArray(e)?"array":typeof e});return}let r={},o=0;for(let[a,i]of Object.entries(e)){if(Zf.has(a)){Cn.warn(`dropped reserved ${t} key "${a}" \u2014 managed by the widget, not host-settable`);continue}if(i==null)continue;if(o>=nc){Cn.warn(`${t} truncated at ${nc} keys \u2014 dropped "${a}"`);continue}let s=tm(t,a,i);s!==void 0&&(r[a]=s,o++)}return n&&typeof r.email=="string"&&!em.test(r.email)&&(Cn.warn("dropped malformed context field",{field:`${t}.email`,reason:"invalid format"}),delete r.email),Object.keys(r).length>0?r:void 0}function tm(e,t,n){if(typeof n=="boolean")return n;if(typeof n=="number"){if(!Number.isFinite(n)){Cn.warn(`dropped non-finite ${e}.${t}`);return}return n}if(typeof n=="string"){let r=n.trim();return r===""?void 0:r.length>Ei?(Cn.warn(`truncated ${e}.${t} to ${Ei} chars`),r.slice(0,Ei)):r}Cn.warn(`dropped ${e}.${t} \u2014 only string/number/boolean values are allowed`,{type:typeof n})}function Xn(e){let t=e!==null&&typeof e=="object"?e:{},n=t.presentation??{},r=t.behavior??{},o=t.i18n??{},a=t.feedback??{},i=t.footer??{},s=t.header??{},{themeMode:c,themeOverrides:p}=nm(t.theme),_=n.mode??"floating",d=rm(o.defaultLocale),u=o.availableLocales??[o.locale??d],f=Jn(o.locale??d,u,d),m=(t.baseUrl??M.defaultBaseUrl).replace(/\/$/,""),v=(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:v,dataApiBaseUrl:P,userContext:Mi(t.userContext),pageContext:Ni(t.pageContext),position:n.position??"bottom-right",themeMode:c,textSize:"normal",themeOverrides:p,mode:_,iframe:n.iframe??!1,responseMode:r.responseMode??"streaming",showReasoning:r.showReasoning??!1,showToolCalls:r.showToolCalls??!1,showSources:r.showSources??!1,enableMessageFeedback:!(r.disableMessageFeedback??!1),autoSendSuggestions:r.autoSendSuggestions??!1,popOutUrl:r.popOutUrl,features:{voice:t.features?.voice??Gl.voice,fileUpload:!(t.features?.disableFileUpload??!1),humanInLoop:!(t.features?.disableHumanInLoop??!1),operatorRequest:t.features?.enableOperatorRequest===!0},forms:Rr(t.forms,f),endpoints:{upload:t.endpoints?.upload??Oo.upload,transcribe:t.endpoints?.transcribe??Oo.transcribe,submitForm:t.endpoints?.submitForm??Oo.submitForm},attachments:{accept:t.composer?.attachments?.accept??Lo.accept,maxBytes:t.composer?.attachments?.maxBytes??Lo.maxBytes,maxCount:t.composer?.attachments?.maxCount??Lo.maxCount},locale:f,defaultLocale:d,availableLocales:u,startMinimized:r.startMinimized??!0,actions:om(_,s.actions),size:n.size??{},launcher:pm(t.launcher),sound:am(a.sound),haptics:im(a.haptics),strings:Eo(f,o.strings),stringsOverride:o.strings,composerDisclaimer:i.composerDisclaimer??"",poweredBy:lm(i.poweredBy),composer:cm(t.composer),modules:um(t.modules),tracking:sm(t.tracking,P),storage:t.storage??No,userToken:t.userToken,tools:t.tools,onMessage:t.onMessage,onOpen:t.onOpen,onClose:t.onClose,onError:t.onError}}function nm(e){if(typeof e=="string")return{themeMode:e,themeOverrides:{}};if(!e||typeof e!="object")return{themeMode:"auto",themeOverrides:{}};let{mode:t,...n}=e;return{themeMode:t??"auto",themeOverrides:n}}function rm(e){return e&&e!=="auto"?e:globalThis.navigator?.language||"en"}function Jn(e,t,n){return t.length<=1||t.includes(e)?e:t.includes(n)?n:t[0]??e}function om(e,t){return t??Ql[e]}function am(e){return{enabled:e?.enabled??Ii.enabled,volume:e?.volume??Ii.volume,events:e?.events}}function im(e){return{enabled:e?.enabled??Xl.enabled,events:e?.events}}function sm(e,t){let n=e?.sampleRate??Ri.sampleRate;return{enabled:e?.enabled??Ri.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 lm(e){let n={...{text:`Powered by ${M.displayName}`,href:M.siteUrl},...e};return!!(n.text||n.logoUrl)?n:null}function cm(e){let t=e?.sendButton;return{sendButton:{shape:t?.shape??"circle",icon:t?.icon??"arrowUp",variant:t?.variant??"filled"}}}function um(e){let t=e??Jl,n=new Set,r=[];for(let a of t.slice(0,4)){if(!a?.label||!a?.layout)continue;let i=a.contentCollectionIds?.filter(Boolean),s=a.id??i?.[0]??a.layout;for(;n.has(s);)s=`${s}-${r.length}`;n.add(s);let c={id:s,label:a.label,layout:a.layout};i?.length&&(c.contentCollectionIds=i),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?.length&&(c.userAvatars=a.userAvatars),a.status&&(c.status=a.status),c.contentBlockTitle=a.contentBlockTitle),r.push(c)}let o=Object.fromEntries(r.map(a=>[a.id,a]));return{list:r,byId:o}}function Rr(e,t){var a;if(!e?.length)return Kl;let n=[],r=new Set;for(let i of e){if(!i?.id||r.has(i.id))continue;let s=jl(i,t),c=(s.fields??[]).filter(_=>!!(_?.name&&_.label&&_.type)),p=(Array.isArray(s.on)?s.on:[s.on]).map(dm).filter(_=>_!==null);c.length===0||p.length===0||(r.add(s.id),n.push({id:s.id,triggers:p,when:s.when,fields:c,title:s.title,description:s.description,submitLabel:s.submitLabel,skippable:s.skippable??!1,frequency:s.frequency??"once",mirrorToContext:s.mirrorToContext??!0,reopenable:s.reopenable??!0,reviewable:s.reviewable??!0}))}let o={};for(let i of n)for(let s of i.triggers)(o[a=s.kind]??(o[a]=[])).push(i);return{list:n,byTrigger:o}}function dm(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 r=Number(n);return Number.isFinite(r)&&r>0?{kind:"after-messages",param:r}:null}if(t==="idle"){let r=Number(n);return Number.isFinite(r)&&r>0?{kind:"idle",param:r}:null}return t==="page-area"&&n?{kind:"page-area",param:n}:null}function pm(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??Qn.variant,size:e?.size??Qn.size,label:e?.label??Qn.label,icon:e?.icon??Qn.icon,hidden:e?.hidden??Qn.hidden,callout:t}}function Li(e,t,n,r){let o=Jn(t,e.availableLocales,e.defaultLocale);if(o===e.locale&&n===e.themeMode&&r===e.textSize)return e;let a={...e};return o!==e.locale&&(a.locale=o,a.strings=Eo(o,e.stringsOverride)),n!==e.themeMode&&(a.themeMode=n),r!==e.textSize&&(a.textSize=r),a}var _m=["presentation","behavior","theme","launcher","header","composer","feedback","i18n","footer","features","tracking","endpoints"];function Oi(e,t){if(!t)return e;let n={...e};for(let a of _m){let i=t[a];if(i===void 0)continue;let s=e[a];if(a==="theme"){s===void 0?n[a]=i:typeof s=="string"&&typeof i=="object"&&i!==null&&(n[a]={...i,mode:s});continue}a!=="i18n"&&(n[a]=oc(i,s))}t.modules!==void 0&&e.modules===void 0&&(n.modules=t.modules),t.dataApiBaseUrl!==void 0&&e.dataApiBaseUrl===void 0&&(n.dataApiBaseUrl=t.dataApiBaseUrl);let r=e.i18n,o=t.i18n;if(r||o){let a=oc(o??{},r);o?.availableLocales!==void 0&&(a.availableLocales=o.availableLocales),o?.defaultLocale!==void 0&&(a.defaultLocale=o.defaultLocale);let i=r?.strings,s=o?.strings;(i||s)&&(a.strings=fm(s,i)),n.i18n=a}return n}function oc(e,t){if(!t)return e;let n={...e};for(let[r,o]of Object.entries(t))o!==void 0&&(n[r]=o);return n}function fm(e,t){if(!e)return t;if(!t)return e;let n=Mo(e),r=Mo(t);if(!n&&!r)return{...e,...t};let o={},a=n?e:{en:e},i=r?t:{en:t};for(let[s,c]of Object.entries(a))o[s]={...c};for(let[s,c]of Object.entries(i))o[s]={...o[s],...c};return o}var mm=["clear","expand","fullscreen","popOut","sound","history","language","theme","textSize","close"];function Zt(e){return e!=="false"}function gm(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}var ic=[["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]],sc=[["mode","mode",e=>e],["position","position",e=>e],["iframe","iframe",Zt]],lc=[["width","width"],["height","height"]],cc=[["response-mode","responseMode",e=>e],["start-minimized","startMinimized",Zt],["show-reasoning","showReasoning",Zt],["show-tool-calls","showToolCalls",Zt],["show-sources","showSources",Zt],["disable-message-feedback","disableMessageFeedback",Zt],["auto-send-suggestions","autoSendSuggestions",Zt],["pop-out-url","popOutUrl"]],uc=[["locale","locale"]],hm=new Set(mm);function vm(e){return gm(e).filter(t=>hm.has(t))}var dc=[["launcher-variant","variant",e=>e],["launcher-size","size",e=>e],["launcher-icon","icon"],["launcher-hidden","hidden",Zt]],pc=[["features-disable-file-upload","disableFileUpload",Zt],["features-voice","voice",e=>e]],_c=[["endpoint-upload","upload"],["endpoint-transcribe","transcribe"]],fc=[["user-id","id"],["user-email","email"],["user-name","name"]],mc=[["page-area","area"],["page-url","url"],["page-path","path"],["page-title","title"]],bm=["launcher-label","callout-text","callout-delay","actions","user-context","page-context"],ym=[ic,sc,lc,cc,uc,dc,pc,_c,fc,mc],Pm=new Set(["iframe","start-minimized"]),$i=[...ym.flatMap(e=>e.map(([t])=>t).filter(t=>!Pm.has(t))),...bm];function Di(e){let t={};function n(f){let m=e(f);return m===null||m===""?void 0:m}for(let[f,m,v]of ic){let P=n(f);P!==void 0&&(t[m]=v?v(P):P)}let r=Tn(n,sc),o=Tn(n,lc);(r||o)&&(t.presentation={...r,...o?{size:o}:{}});let a=Tn(n,cc);a&&(t.behavior=a);let i=Tn(n,uc);i&&(t.i18n=i);let s=xm(e,n);s&&(t.launcher=s);let c=Tn(n,pc);c&&(t.features=c);let p=Tn(n,_c);p&&(t.endpoints=p);let _=ac(n,fc,"user-context");_&&(t.userContext=_);let d=ac(n,mc,"page-context");d&&(t.pageContext=d);let u=n("actions");return u!==void 0&&(t.header={actions:vm(u)}),t}function Tn(e,t){let n={};for(let[r,o,a]of t){let i=e(r);i!==void 0&&(n[o]=a?a(i):i)}return Object.keys(n).length>0?n:null}function ac(e,t,n){let r={};for(let[s,c]of t){let p=e(s);p!==void 0&&(r[c]=p)}let o={},a=e(n);if(a)try{let s=JSON.parse(a);s&&typeof s=="object"&&!Array.isArray(s)&&(o=s)}catch{}let i={...o,...r};return Object.keys(i).length>0?i:null}function xm(e,t){let n=Tn(t,dc)??{},r=e("launcher-label");r!==null&&(n.label=r);let o=t("callout-text");if(o){let a=Number.parseInt(t("callout-delay")??"",10);n.callout={text:o,...Number.isFinite(a)?{delayMs:a}:{}}}return Object.keys(n).length>0?n:null}var gc=se.scope("track"),Sm=64,km=256,wm=10;function hc(e,t){let n=typeof e=="string"?e.trim():"";if(!n||n.length>Sm){gc.warn("track: ignored an event without a name of 1\u201364 characters",{name:e});return}let r=Object.fromEntries(Object.entries(typeof t=="object"&&t!==null?t:{}).filter(o=>typeof o[1]=="string"||typeof o[1]=="boolean"||Number.isFinite(o[1])));return JSON.stringify(r).length>km?(gc.warn("track: sent the event without its data, which is over 256 characters",{name:n}),{name:n}):Object.keys(r).length>0?{name:n,data:r}:{name:n}}function vc(e){let t=[];return e.on("hostEvent",n=>{t.push({...n,at:Date.now()}),t.length>wm&&t.shift()}),t}function wt(){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,Cm(t.subarray(6)),t[6]=t[6]&15|112,t[8]=t[8]&63|128;let n=Array.from(t,r=>r.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 Cm(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 en=se.scope("persistence");function Yn(e,t=No,n){let r=n?`${e}.${n}`:e,o=`${M.cssPrefix}.storageVersion`,a=t.get(o)??void 0,i=a?`.v${a}`:"",s=`${M.cssPrefix}.${r}${i}`,c=`${M.cssPrefix}${i}.visitorId`,p=`${s}.conversationId`,_=`${s}.userPrefs`,d=`${s}.panelOpen`,u=`${s}.panelSize`,f=`${s}.calloutDismissed`,m=`${s}.sidebarCollapsed`,v=`${s}.activeModule`,P=`${s}.seenNewsId`,x=`${s}.historyCount`,k=`${s}.formsDone`,T={getVisitorId(){let h=t.get(c);if(h)return h;let g=wt();return t.set(c,g),g},loadConversationId(){return t.get(p)??void 0},saveConversationId(h){en.trace("saveConversationId",{id:h,scope:r}),h?t.set(p,h):t.remove(p)},loadDraft(h){return t.get(`${s}.draft.${h}`)??""},saveDraft(h,g){let S=`${s}.draft.${h}`;g?t.set(S,g):t.remove(S)},loadMessageQueue(h){let g=t.get(`${s}.messageQueue.${h}`);if(!g)return[];try{let S=JSON.parse(g);return!Array.isArray(S)||!S.every(Tm)?[]:S}catch(S){return en.warn("loadMessageQueue parse failed",{error:S}),[]}},saveMessageQueue(h,g){let S=`${s}.messageQueue.${h}`;if(g.length===0){t.remove(S);return}try{t.set(S,JSON.stringify(g))}catch(w){en.warn("saveMessageQueue serialise failed",{error:w})}},loadUserPrefs(){let h=t.get(_);if(!h)return{};try{return Bi(JSON.parse(h))}catch(g){return en.warn("loadUserPrefs parse failed",{error:g}),{}}},saveUserPrefs(h){try{t.set(_,JSON.stringify(h))}catch(g){en.warn("saveUserPrefs serialise failed",{error:g})}},patchUserPrefs(h){let g=T.loadUserPrefs();T.saveUserPrefs({...g,...h})},loadPanelOpen(){let h=t.get(d);return h==="1"?!0:h==="0"?!1:null},savePanelOpen(h){t.set(d,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 g=t.get(f);return!!g&&g===h},saveCalloutDismissed(h){h?t.set(f,h):t.remove(f)},loadSidebarCollapsed(){let h=t.get(m);return h==="1"?!0:h==="0"?!1:null},saveSidebarCollapsed(h){t.set(m,h?"1":"0")},loadActiveModule(){return t.get(v)||null},saveActiveModule(h){t.set(v,h)},loadSeenNewsId(){return t.get(P)||null},saveSeenNewsId(h){t.set(P,h)},loadHistoryCount(){let h=t.get(x);if(!h)return null;let g=Number.parseInt(h,10);return Number.isFinite(g)&&g>=0?g:null},saveHistoryCount(h){t.set(x,String(h))},loadFormsDone(){let h=t.get(k);if(!h)return{};try{let g=JSON.parse(h);return $o(g)?Object.fromEntries(Object.entries(g).filter(S=>typeof S[1]=="number")):{}}catch(g){return en.warn("loadFormsDone parse failed",{error:g}),{}}},saveFormDone(h){try{let g=T.loadFormsDone();g[h]=Date.now(),t.set(k,JSON.stringify(g))}catch(g){en.warn("saveFormDone serialise failed",{error:g})}},rememberStorageVersion(h){h&&h!==t.get(o)&&(en.debug("rememberStorageVersion (force-reset on next load)",{version:h}),t.set(o,h))},clearConversation(){t.remove(p)},reset(){let h=t.get(p);h&&(t.remove(`${s}.draft.${h}`),t.remove(`${s}.messageQueue.${h}`));for(let g of[c,p,_,d,u,f,m,v,P,x,k])t.remove(g);en.info("reset: forgot the visitor",{scope:r})}};return T}function $o(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Tm(e){return $o(e)&&typeof e.id=="string"&&e.id.length>0&&typeof e.text=="string"}function Bi(e){if(!$o(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),$o(e.widgetSize)&&typeof e.widgetSize.width=="number"&&typeof e.widgetSize.height=="number"&&(t.widgetSize={width:e.widgetSize.width,height:e.widgetSize.height}),t}var Do="1.11.0";var Rm="1",bc=60,Im=2e3,yc={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}),hostEvent:e=>({name:e.name,data:e.data&&JSON.stringify(e.data)}),messageFeedback:e=>({value:e.value??"none"}),contentView:e=>({section:e.section,count:e.count}),contentOpen:e=>({contentId:e.contentId,contentCollectionId:e.contentCollectionId}),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 Am(){let e=navigator;return e.globalPrivacyControl===!0||e.doNotTrack==="1"}function Em(){return location.origin+location.pathname}function Mm(){try{return document.referrer?new URL(document.referrer).origin:""}catch{return""}}function Pc(e,t){let n=Math.random(),r=0,o=0,a=new Set;function i(_,d){let{tracking:u,publicKey:f,aiAgentDeploymentId:m,mode:v,themeMode:P}=t.getOptions();if(!u.enabled||Am()||n>=u.sampleRate)return;let x=performance.now();if(x-r>6e4&&(r=x,o=0),++o>bc)return;let k=new URLSearchParams;k.set("v",Rm),k.set("_ev",Do),k.set("e",_),u.token&&k.set("tk",u.token),f&&k.set("pk",f),m&&k.set("dep",m),k.set("vid",t.getVisitorId());let T=t.getConversationId();T&&k.set("cid",T),k.set("url",Em());let h=Mm();h&&k.set("ref",h),k.set("sw",String(screen.width)),k.set("sh",String(screen.height)),k.set("vw",String(innerWidth)),k.set("vh",String(innerHeight)),k.set("dpr",String(devicePixelRatio)),k.set("lang",navigator.language);try{k.set("tz",Intl.DateTimeFormat().resolvedOptions().timeZone)}catch{}if(k.set("m",v),k.set("th",P),d)for(let[C,A]of Object.entries(d))A!==void 0&&k.set(C,String(A));k.set("ts",String(Date.now()));let g=`${u.endpoint}?${k}`;if(g.length>Im)return;let S=new Image(1,1);a.add(S);function w(){return a.delete(S)}S.addEventListener("load",w,{once:!0}),S.addEventListener("error",w,{once:!0}),S.src=g}let s=[];function c(_,d){if(s&&_!=="handshake"){s.length<bc&&s.push([_,d]);return}let u=s??[];s=void 0;for(let[f,m]of u)i(f,m);i(_,d)}let p=Object.keys(yc).map(_=>e.on(_,d=>c(_,yc[_]?.(d))));return()=>{for(let _ of p)_();a.clear()}}var xc=`.__P__-generative-ui{display:grid;gap:var(--__P__-space-3);overflow-wrap:anywhere;white-space:pre-wrap}.__P__-generative-ui p{margin:0}.__P__-generative-ui-grid-container{container:__P__-generative-ui-grid / inline-size;min-width:0}.__P__-generative-ui-grid{display:grid;grid-template-columns:minmax(0,1fr);align-items:start;gap:16px}.__P__-generative-ui-cell{display:grid;align-content:start;min-width:0;gap:16px}@container __P__-generative-ui-grid (min-width: 496px){.__P__-generative-ui-grid:is([data-columns="2"],[data-columns="3"],[data-columns="4"]){grid-template-columns:repeat(2,minmax(0,1fr))}.__P__-generative-ui-grid:is([data-columns="2"],[data-columns="3"],[data-columns="4"])>.__P__-generative-ui-cell:is([data-span="2"],[data-span="3"],[data-span="4"]){grid-column:span 2}}@container __P__-generative-ui-grid (min-width: 752px){.__P__-generative-ui-grid:is([data-columns="3"],[data-columns="4"]){grid-template-columns:repeat(3,minmax(0,1fr))}.__P__-generative-ui-grid:is([data-columns="3"],[data-columns="4"])>.__P__-generative-ui-cell:is([data-span="3"],[data-span="4"]){grid-column:span 3}}@container __P__-generative-ui-grid (min-width: 1008px){.__P__-generative-ui-grid[data-columns="4"]{grid-template-columns:repeat(4,minmax(0,1fr))}.__P__-generative-ui-grid[data-columns="4"]>.__P__-generative-ui-cell[data-span="4"]{grid-column:span 4}}.__P__-generative-ui section{display:grid;gap:var(--__P__-space-2);padding:var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);min-width:0}.__P__-generative-ui-metric{font-size:1.6em;font-weight:700}.__P__-generative-ui-table{overflow-x:auto}.__P__-generative-ui table{width:100%;border-collapse:collapse;white-space:normal}.__P__-generative-ui caption{text-align:start;font-weight:600;padding-bottom:var(--__P__-space-2)}.__P__-generative-ui th,.__P__-generative-ui td{text-align:start;padding:var(--__P__-space-2);border-bottom:1px solid var(--__P__-border)}.__P__-generative-ui-chart{display:block;width:100%;color:var(--__P__-accent)}.__P__-generative-ui-axis{stroke:var(--__P__-border)}.__P__-generative-ui-data{display:flex;flex-wrap:wrap;gap:var(--__P__-space-2);font-size:.85em}
2
+ `;var Sc=`: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}}
3
+ `;var kc=`.__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;position:relative;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 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{width:100%;padding:10px 14px;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__-attachment-chip.__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-card>[role=listitem]{display:flex;flex-direction:column}.__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-card>*+*{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__-help-more{justify-content:center;color:var(--__P__-accent-fg);font-weight:600}.__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)}@media(hover:hover){.__P__-tab:hover{background:var(--__P__-hover)}}.__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;line-height:1.45}.__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__-home-ask{padding-block:6px;padding-inline-end:6px}.__P__-home-ask .__P__-send{width:32px;height:32px;flex-shrink:0}.__P__-home-ask .__P__-send[data-shape=pill]{width:auto;padding:0 14px}.__P__-home-ask .__P__-send svg{width:16px;height:16px}.__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-vote{display:flex;align-items:center;flex-wrap:wrap;gap:var(--__P__-space-2);padding-top:var(--__P__-space-3);border-top:1px solid var(--__P__-border)}.__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;line-height:1.45;border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);overflow:hidden;background:var(--__P__-surface);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-meta{display:flex;flex-wrap:wrap;align-items:center;gap:6px;color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm)}.__P__-news-tag{padding:1px 8px;border-radius:6px;background:var(--__P__-hover);color:var(--__P__-fg);font-size:calc(12px * var(--__P__-text-scale));white-space:nowrap}.__P__-news-more{display:flex;align-items:center;justify-content:center;gap:var(--__P__-space-2);width:100%;min-height:44px;border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);background:var(--__P__-surface);color:var(--__P__-accent-fg);font-weight:600}.__P__-news-more:hover{background:var(--__P__-bg-elevated)}.__P__-news-more:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__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__-toolui-status[data-status=incomplete]{--__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 wc=`*,*: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}
5
+ `;var Cc=`: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}}
6
+ `;var Bm="helpai",Fm="#5B5BD6",Um="#FFFFFF",qm="12px",Hm="Inter, system-ui, -apple-system, 'Segoe UI', sans-serif",Ui=[Cc,wc,kc,xc,Sc].join(`
7
+ `).replace(/__P__/g,Bm).replaceAll("__BRAND_ACCENT_TEXT__",Um).replaceAll("__BRAND_ACCENT__",Fm).replaceAll("__BRAND_RADIUS__",qm).replaceAll("__BRAND_FONT__",Hm);var Rc=["data-theme","data-color-scheme","data-mode","data-bs-theme"];function Tc(e){if(e){if(e.classList.contains("dark"))return"dark";if(e.classList.contains("light"))return"light";for(let t of Rc){let n=e.getAttribute(t);if(n==="dark"||n==="light")return n}}}function Zn(e=document){let t=Tc(e.documentElement)??Tc(e.body);if(t)return t;let n=getComputedStyle(e.documentElement).colorScheme.trim();return n==="dark"||n==="light"?n:typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Ic(e,t=document){let n=Zn(t);e(n);function r(){let s=Zn(t);s!==n&&(n=s,e(s))}let o=new MutationObserver(r),a={attributes:!0,attributeFilter:["class","style",...Rc]};o.observe(t.documentElement,a),t.body&&o.observe(t.body,a);let i=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)"):void 0;return i?.addEventListener("change",r),()=>{o.disconnect(),i?.removeEventListener("change",r)}}var zm=se.scope("mount"),Ac=new WeakMap,Ec={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 Mc(e,t){e.style.cssText=Ec[t]}function Bo(e){return e==="floating"||e==="modal"||e==="drawer"?"floating":e==="standalone"||e==="page"?"viewport":"flow"}function Nc(e={}){let t=e.position??"flow";zm.debug("createShadowMount",{position:t,hasTarget:!!e.target,hasHost:!!e.existingHost});let n=`${M.cssPrefix}-chat-host`;typeof customElements<"u"&&!customElements.get(n)&&customElements.define(n,class extends HTMLElement{});let r;e.existingHost?r=e.existingHost:(r=document.createElement(n),(e.target??document.body).appendChild(r)),r.setAttribute("data-brand",M.id),r.style.cssText=Ec[t];let o=r.shadowRoot??r.attachShadow({mode:"open"}),a=r.ownerDocument;if(!jm(o,a)){let s=a.createElement("style");s.textContent=Ui,o.appendChild(s)}let i=document.createElement("div");return i.className=`${M.cssPrefix}-app`,o.appendChild(i),{appRoot:i,destroy:()=>r.remove(),hostElement:r,shadowRoot:o}}function jm(e,t){if(!("adoptedStyleSheets"in e))return!1;let n=t.defaultView;if(!n||typeof n.CSSStyleSheet!="function")return!1;let r=Ac.get(t);if(!r)try{r=new n.CSSStyleSheet,r.replaceSync(Ui),Ac.set(t,r)}catch{return!1}try{return e.adoptedStyleSheets=[r],!0}catch{return!1}}function Vm(e,t){let n=M.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 Wm(e,t){e.dataset.theme=t==="host"?Zn():t}function Gm(e,t){let n=M.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 Km(e,t){e.dataset.position=t}function Fo(e,t){e.dataset.mode=t}function Lc(e,t){Wm(e,t.themeMode),Vm(e,t.themeOverrides),Km(e,t.position),Gm(e,t.size)}var er,Ye,qi,Oc,Hi=Object.is,Ar=0,jc=[],zi=[],Ue=de,$c=Ue.__b,Dc=Ue.__r,Bc=Ue.diffed,Fc=Ue.__c,Uc=Ue.unmount,qc=Ue.__;function Uo(e,t){Ue.__h&&Ue.__h(Ye,e,Ar||t),Ar=0;var n=Ye.__H||(Ye.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function q(e){return Ar=1,Vc(Wc,e)}function Vc(e,t,n){var r=Uo(er++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Wc(void 0,t),function(a){var i=r.__N?r.__N[0]:r.__[0],s=r.t(i,a);Hi(i,s)||(r.__N=[s,r.__[1]],r.__c.setState({}))}],r.__c=Ye,!Ye.__f)){Ye.__f=!0;var o=Ye.shouldComponentUpdate;Ye.shouldComponentUpdate=function(a,i,s){var c=this.__H;if(!c)return!0;var p=!1,_=this.props!=a;if(c.__.some(function(u){u.__N&&(p=!0,Hi(u.__[0],u.__N[0])||(_=!0))}),o){var d=o.call(this,a,i,s);return p?d||_:d}return!p||_}}return r.__}function D(e,t){var n=Uo(er++,3);!Ue.__s&&Vi(n.__H,t)&&(n.__P=!0,n.__=e,n.u=t,Ye.__H.__h.push(n))}function Ct(e,t){var n=Uo(er++,4);!Ue.__s&&Vi(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,Ye.__h.push(n))}function B(e){return Ar=5,ce(function(){return{current:e}},[])}function ce(e,t){var n=Uo(er++,7);return Vi(n.__H,t)&&(n.__=e(),n.__H=t),n.__}function $(e,t){return Ar=8,ce(function(){return e},t)}function Qm(){var e;do{for(;e=zi.shift();)try{Ir(e)}catch(n){Ue.__e(n,{__:(e=e.__P)&&e.__v})}for(;e=jc.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Ir),t.__h.some(ji),t.__h=[]}catch(n){t.__h=[],Ue.__e(n,e.__v)}}}while(zi.length)}Ue.__b=function(e){Ye=null,$c&&$c(e)},Ue.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),qc&&qc(e,t)},Ue.__r=function(e){Dc&&Dc(e),er=0;var t=(Ye=e.__c).__H;t&&(qi==Ye?Ye.__h=[]:(t.__h.some(Ir),t.__h.some(ji),er=0),t.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})),qi=Ye},Ue.diffed=function(e){Bc&&Bc(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&zc(jc.push(t)),t.__H.__.some(function(n){n.u&&(n.__H=n.u)})),qi=Ye=null},Ue.__c=function(e,t){t.some(function(n){try{n.__h.some(Ir),n.__h=n.__h.filter(function(r){return!r.__||ji(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],Ue.__e(r,n.__v)}}),Fc&&Fc(e,t)},Ue.unmount=function(e){Uc&&Uc(e);var t,n,r=e.__c;r&&r.__H&&(r.__H.__.some(function(o){try{if(o.__P&&o.__c){if(n===void 0){for(n=e.__;n&&(!n.__c||!n.__c.__P);)n=n.__;n=n&&n.__c}o.__P=n,zc(zi.push(o))}else Ir(o)}catch(a){t=a}}),r.__H=void 0,t&&Ue.__e(t,r.__v))};var Hc=typeof requestAnimationFrame=="function";function Xm(e){var t,n=function(){clearTimeout(r),Hc&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Hc&&(t=requestAnimationFrame(n))}function zc(e){e!=1&&Oc==Ue.requestAnimationFrame||((Oc=Ue.requestAnimationFrame)||Xm)(Qm)}function Ir(e){var t=Ye,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Ye=t}function ji(e){var t=Ye;e.__c=e.__(),Ye=t}function Vi(e,t){return!e||e.length!=t.length||t.some(function(n,r){return!Hi(n,e[r])})}function Wc(e,t){return typeof t=="function"?t(e):t}var Jm=Symbol.for("preact-signals");function jo(){if(tn>1)tn--;else{var e,t=!1;for((function(){var o=Ho;for(Ho=void 0;o!==void 0;){var a=o.S;if(a.v===o.v)for(var i=a.t;i!==void 0;i=i.x)i.i===o.i&&(i.i=a.i);o=o.o}})();Mr!==void 0;){var n=Mr;for(Mr=void 0,qo++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Kc(n))try{n.c()}catch(o){t||(e=o,t=!0)}n=r}}if(qo=0,tn--,t)throw e}}function Dt(e){if(tn>0)return e();Wi=++Ym,tn++;try{return e()}finally{jo()}}var Er,Le=void 0;function Nr(e){var t=Le,n=Er;Le=void 0,Er=void 0;try{return e()}finally{Le=t,Er=n}}var Mr=void 0,tn=0,qo=0,Ym=0,Wi=0,Ho=void 0,zo=0;function Gc(e){if(Le!==void 0){var t=e.n;if(t===void 0||t.t!==Le)return t={i:0,S:e,p:Le.s,n:void 0,t:Le,e:void 0,x:void 0,r:t},Le.s!==void 0&&(Le.s.n=t),Le.s=t,e.n=t,32&Le.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=Le.s,t.n=void 0,Le.s.n=t,Le.s=t),t}}function at(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}at.prototype.brand=Jm;at.prototype.h=function(){return!0};at.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:Nr(function(){var r;(r=t.W)==null||r.call(t)}))};at.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&Nr(function(){var o;(o=t.Z)==null||o.call(t)}))}};at.prototype.subscribe=function(e){var t=this;return zt(function(){var n=t.value;Nr(function(){return e(n)})},{name:"sub"})};at.prototype.valueOf=function(){return this.value};at.prototype.toString=function(){return this.value+""};at.prototype.toJSON=function(){return this.value};at.prototype.peek=function(){var e=this;return Nr(function(){return e.value})};Object.defineProperty(at.prototype,"value",{get:function(){var e=Gc(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(qo>100)throw new Error("Cycle detected");(function(n){tn!==0&&qo===0&&n.l!==Wi&&(n.l=Wi,Ho={S:n,v:n.v,i:n.i,o:Ho})})(this),this.v=e,this.i++,zo++,tn++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{jo()}}}});function ae(e,t){return new at(e,t)}function Kc(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 Qc(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 Xc(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function Rn(e,t){at.call(this,void 0,t),this.x=e,this.s=void 0,this.g=zo-1,this.f=4}Rn.prototype=new at;Rn.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===zo))return!0;if(this.g=zo,this.f|=1,this.i>0&&!Kc(this))return this.f&=-2,!0;var e=Le;try{Qc(this),Le=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 Le=e,Xc(this),this.f&=-2,!0};Rn.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)}at.prototype.S.call(this,e)};Rn.prototype.U=function(e){if(this.t!==void 0&&(at.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)}};Rn.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(Rn.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Gc(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function ve(e,t){return new Rn(e,t)}function Jc(e){var t=e.m;if(e.m=void 0,typeof t=="function"){tn++;var n=Le;Le=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,Gi(e),r}finally{Le=n,jo()}}}function Gi(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Jc(e)}function Zm(e){if(Le!==this)throw new Error("Out-of-order effect");Xc(this),Le=e,this.f&=-2,8&this.f&&Gi(this),jo()}function tr(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,Er&&Er.push(this)}tr.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()}};tr.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Jc(this),Qc(this),tn++;var e=Le;return Le=this,Zm.bind(this,e)};tr.prototype.N=function(){2&this.f||(this.f|=2,this.u=Mr,Mr=this)};tr.prototype.d=function(){this.f|=8,1&this.f||Gi(this)};tr.prototype.dispose=function(){this.d()};function zt(e,t){var n=new tr(e,t);try{n.c()}catch(o){throw n.d(),o}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var Yc,Or,Vo,eg=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var Zc=[];zt(function(){Yc=this.N})();function nr(e,t){de[e]=t.bind(null,de[e]||function(){})}function Lr(e){if(Vo){var t=Vo;Vo=void 0,t()}Vo=e&&e.S()}function eu(e){var t=this,n=e.data,r=Et(n);r.name="ReactiveDom",r.value=n;var o=ce(function(){for(var s=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var p=ve(function(){var f=r.value.value;return f===0?0:f===!0?"":f||""}),_=ve(function(){return!Array.isArray(p.value)&&!yi(p.value)}),d=zt(function(){if(this.N=tu,_.value){var f=p.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=f)}}),u=t.__$u.d;return t.__$u.d=function(){d(),u.call(this)},[_,p]},[]),a=o[0],i=o[1];return a.value?i.peek():i.value}eu.displayName="ReactiveTextNode";Object.defineProperties(at.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:eu},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});nr("__b",function(e,t){if(Lr(),Or=void 0,typeof t.type=="string"){var n,r=t.props;for(var o in r)if(o!=="children"){var a=r[o];a instanceof at&&(n||(t.__np=n={}),n[o]=a,r[o]=a.peek())}}e(t)});nr("__r",function(e,t){if(e(t),t.type!==_e){Lr();var n,r=t.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=(function(o,a){var i;return zt(function(){i=this},{name:a}),i.c=o,i})((function(o){return function(){var a;eg&&((a=this.y)==null||a.call(this)),o.__$f|=1,o.setState({})}})(r),typeof t.type=="function"?t.type.displayName||t.type.name:""))),Or=r,Lr(n)}});nr("__e",function(e,t,n,r){Lr(),Or=void 0,e(t,n,r)});nr("diffed",function(e,t){Lr(),Or=void 0;var n;if(typeof t.type=="string"&&(n=t.__e)){var r=t.__np,o=t.props,a=n.U;if(a)for(var i in a){var s=a[i];s===void 0||r&&i in r||(s.d(),a[i]=void 0)}if(r){a||(a={},n.U=a);for(var c in r){var p=a[c],_=r[c];p===void 0?(p=tg(n,c,_,o),a[c]=p):p.o(_,o)}}}e(t)});function tg(e,t,n,r){var o=t in e&&e.ownerSVGElement===void 0,a=ae(n);return{o:function(i,s){a.value=i,r=s},d:zt(function(){this.N=tu;var i=a.value.value;r[t]!==i&&(r[t]=i,o?e[t]=i:i!=null&&(i!==!1||t[4]==="-")?e.setAttribute(t,i):e.removeAttribute(t))})}}nr("unmount",function(e,t){if(typeof t.type=="string"){var n=t.__e;if(n){var r=n.U;if(r){n.U=void 0;for(var o in r){var a=r[o];a&&a.d()}}}var i=t.__np;if(i){var s=t.props;for(var c in i)s[c]=i[c]}t.__np=void 0}else{var p=t.__c;if(p){p.__$f|=8;var _=p.__$u;_&&(p.__$u=void 0,_.d())}}e(t)});nr("__h",function(e,t,n,r){r<3&&(t.__$f|=2),e(t,n,r)});$t.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,r=n&&n.s!==void 0;for(var o in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var a=2&this.__$f;if(!(r||a||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var i in e)if(i!=="__source"&&e[i]!==this.props[i])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function Et(e,t){return ce(function(){return ae(e,t)},[])}function Tt(e,t){var n=B(e);return n.current=e,Or.__$f|=4,ce(function(){return ve(function(){return n.current()},t)},[])}var ng=function(e){queueMicrotask(function(){queueMicrotask(e)})};function rg(){Dt(function(){for(var e;e=Zc.shift();)Yc.call(e)})}function tu(){Zc.push(this)===1&&(de.requestAnimationFrame||ng)(rg)}var og="x-public-key",ag="x-ai-agent-deployment-id";function nu(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");return{headers(){let t={[ag]:e.aiAgentDeploymentId};return e.publicKey&&(t[e.publicKeyHeader??og]=e.publicKey),t}}}var ig=new Set(["home","chats","help","news"]);function ru(e){return typeof e!="object"||e===null||!("to"in e)||typeof e.to!="string"||!ig.has(e.to)?!1:!("id"in e)||e.id===void 0||typeof e.id=="string"}function Wo(e){let[t="",...n]=e.trim().split("/");if(t===""||t==="open")return;let r=n.join("/");return r?{to:t,id:r}:{to:t}}function $r(e,t){return{text:e,send:typeof t=="object"&&t!==null&&"send"in t&&t.send===!0}}function ou(e){if(typeof e!="object"||e===null||!("text"in e)||typeof e.text!="string")return;let t=e.text.trim();return t?{text:t,send:"send"in e&&e.send===!0}:void 0}function au(e){return`${M.cssPrefix}:${e}`}function Nt(e,t,n){e.dispatchEvent(new CustomEvent(au(t),{detail:n}))}function iu(e,t){let r=Object.entries(t).map(([o,a])=>{let i=au(o);function s(c){return a(c.detail)}return e.addEventListener(i,s),[i,s]});return()=>{for(let[o,a]of r)e.removeEventListener(o,a)}}function Go(e,t){let n=[],r;for(let o of e){let a=new URLSearchParams(o);a.has(t)?r??(r=a.get(t)??""):n.push(o)}return{value:r,rest:n}}function su(e){let t=new URL(e),n=M.cssPrefix,r=`${M.cssPrefix}-ask`,o=t.search.slice(1).split("&").filter(Boolean),a=t.hash.slice(1).split("&").filter(Boolean),i=Go(o,n),s=Go(i.rest,r),c=Go(a,n),p=Go(c.rest,r),_=i.value??c.value,d=(s.value??p.value)?.trim()||void 0;if(!(_===void 0&&d===void 0))return t.search=s.rest.join("&"),t.hash=p.rest.join("&"),{target:_===void 0?void 0:Wo(_),...d?{ask:d}:{},url:t.toString()}}var Dr={open:!1,ready:!1,unread:0},Ko=class{constructor(){te(this,"handlers",new Map)}on(t,n){let r=this.handlers.get(t);return r||(r=new Set,this.handlers.set(t,r)),r.add(n),()=>this.handlers.get(t)?.delete(n)}emit(t,n){let r=this.handlers.get(t);if(r)for(let o of r)try{o(n)}catch{}}clear(){this.handlers.clear()}};var lu=se.scope("feedback:audio"),Qo=class{constructor(){te(this,"ctx",null);te(this,"master",null);te(this,"buffers",new Map)}unlock(){if(this.ctx){this.ctx.state==="suspended"&&this.ctx.resume();return}let t=globalThis.AudioContext??globalThis.webkitAudioContext;if(t)try{this.ctx=new t,this.master=this.ctx.createGain(),this.master.gain.value=1,this.master.connect(this.ctx.destination)}catch(n){lu.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,r=this.master;if(!n||!r||n.state!=="running")return;let o=n.currentTime,a=t.noteMs/1e3;t.notes.forEach((i,s)=>{let c=n.createOscillator();c.type=t.type,c.frequency.value=i;let p=n.createGain(),_=o+s*a;p.gain.setValueAtTime(1e-4,_),p.gain.exponentialRampToValueAtTime(t.peakGain,_+.005),p.gain.exponentialRampToValueAtTime(1e-4,_+a),c.connect(p).connect(r),c.start(_),c.stop(_+a+.01)})}async playUrl(t){let n=this.ctx,r=this.master;if(!n||!r||n.state!=="running")return;let o=await this.getBuffer(t);if(!o)return;let a=n.createBufferSource();a.buffer=o,a.connect(r),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 r=this.ctx,o=fetch(t).then(a=>a.ok?a.arrayBuffer():Promise.reject(new Error(`fetch ${a.status}`))).then(a=>r.decodeAudioData(a)).then(a=>(this.buffers.set(t,a),a)).catch(a=>(lu.warn("audio fetch/decode failed",{url:t,err:a}),this.buffers.delete(t),null));return this.buffers.set(t,o),o}};var cu={messageReceived:10,messageSent:0,error:[20,40,20],voiceStart:10,voiceStop:0},uu={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 fn=null,Xo=0;function sg(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}function lg(){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=`__${M.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 du(e){if(!(e===0||Array.isArray(e)&&e.every(t=>t===0))){if(sg())try{navigator.vibrate(e);return}catch{}if(fn??(fn=lg()),!!fn)try{fn.label.click()}catch{}}}function pu(){Xo++;let e=!1;return()=>{e||(e=!0,Xo=Math.max(0,Xo-1),Xo===0&&fn&&(fn.input.remove(),fn.label.remove(),fn=null))}}var cg=se.scope("feedback"),ug=100,Jo=class{constructor(t,n){te(this,"mutedSig",ae(!1));te(this,"audio",new Qo);te(this,"releaseHaptics");te(this,"sound");te(this,"haptics");te(this,"lastPlayed",new Map);te(this,"reducedMotionMq",null);this.sound=t,this.haptics=n,this.releaseHaptics=pu(),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<ug}playSound(t){let n=this.sound.events?.[t];if(n===!1)return;if(typeof n=="string"){this.audio.playUrl(n).catch(o=>cg.warn("audio play failed",{err:o,url:n}));return}let r=uu[t];r&&this.audio.playTone(r)}playHaptic(t){if(this.reducedMotionMq?.matches)return;let n=this.haptics.events?.[t];if(n===!1)return;let r=n===!0||n===void 0?cu[t]:n;du(r)}effectiveVolume(){let t=this.sound.volume??.3;return this.reducedMotionMq?.matches?t*.5:t}isTouchDevice(){return typeof window>"u"?!1:matchMedia("(hover: none) and (pointer: coarse)").matches}};function _u(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function fu(e){return _u(e)}function mu(e){return!(!_u(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}var dg=0;function l(e,t,n,r,o,a){t||(t={});var i,s,c=t;if("ref"in c&&typeof e!="function")for(s in c={},t)s=="ref"?i=t[s]:c[s]=t[s];var p={type:e,props:c,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--dg,__i:-1,__u:0};return(o||a)&&(p.__source=o,p.__self=a),de.vnode&&de.vnode(p),p}var Xi=1,hu=2,Br=4,vu=8,bu=16;function pg(e){switch(e){case Xi:return"href";case hu:return"src";case Br:return"class";case vu:return"checked";case bu:return"start"}}var _g=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}},fg=_g;var gu=24;function rr(e){let t=new Uint32Array(gu);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(gu),indent:"",indent_len:0,table_state:0}}function Fr(e){e.pending.length>0&&Ge(e,`
8
+ `)}function ke(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 qe(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 Ce(e,t){(e.tokens[e.len]===24||e.tokens[e.len]===23)&&t!==25&&qe(e),e.len+=1,e.tokens[e.len]=t,e.token=t,e.renderer.add_token(e.renderer.data,t)}function mg(e,t,n){for(;n<=e.len;){if(e.tokens[n]===t)return n;n+=1}return-1}function In(e,t){for(e.fence_start=0;e.len>t;)qe(e)}function Yo(e,t){let n=0;for(let r=0;r<=e.len&&(t-=e.spaces[r],!(t<0));r+=1)switch(e.tokens[r]){case 9:case 10:case 20:case 25:n=r;break}for(;e.len>n;)qe(e);return t}function Ki(e,t){let n=-1,r=-1;for(let o=e.blockquote_idx+1;o<=e.len;o+=1)if(e.tokens[o]===25){if(e.indent_len<e.spaces[o]){r=-1;break}r=o}else e.tokens[o]===t&&(n=o);return r===-1?n===-1?(In(e,e.blockquote_idx),Ce(e,t),!0):(In(e,n),!1):(In(e,r),Ce(e,t),!0)}function Qi(e,t){Ce(e,25),e.spaces[e.len]=e.indent_len+t,nn(e),e.token=103}function nn(e){e.indent="",e.indent_len=0,e.pending=""}function Ji(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 gg(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 hg(e){return Ji(e)||gg(e)}function Ge(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 o=Yo(e,e.indent_len);e.indent_len=0,e.token=e.tokens[e.len],o>0&&Ge(e," ".repeat(o))}let r=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`
9
+ `:if(console.assert(e.pending.length===1),e.tokens[e.len]===25&&e.token===21){qe(e),nn(e),e.pending=n;continue}In(e,e.blockquote_idx),nn(e),e.blockquote_idx=0,e.fence_start=0,e.pending=n;continue;case"#":switch(n){case"#":if(e.pending.length<6){e.pending=r;continue}break;case" ":Yo(e,e.indent_len),Ce(e,fg(e.pending.length)),nn(e);continue}break;case">":{let a=mg(e,20,e.blockquote_idx+1);a===-1?(In(e,e.blockquote_idx),e.blockquote_idx+=1,e.fence_start=0,Ce(e,20)):e.blockquote_idx=a,nn(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=r;continue;case" ":e.pending=r;continue;case`
10
+ `:if(e.hr_chars<3)break;Yo(e,e.indent_len),e.renderer.add_token(e.renderer.data,22),e.renderer.end_token(e.renderer.data),nn(e),e.hr_chars=0;continue}e.hr_chars=0}if(e.pending[0]!=="_"&&e.pending[1]===" "){Ki(e,23),Qi(e,2),Ge(e,r.slice(2));continue}break;case"`":if(e.pending.length<3){if(n==="`"){e.pending=r,e.fence_start=r.length;continue}e.fence_start=0;break}switch(n){case"`":e.pending.length===e.fence_start?(e.pending=r,e.fence_start=r.length):(Ce(e,2),nn(e),e.fence_start=0,Ge(e,r));continue;case`
11
+ `:{Yo(e,e.indent_len),Ce(e,10),e.pending.length>e.fence_start&&e.renderer.set_attr(e.renderer.data,Br,e.pending.slice(e.fence_start)),nn(e),e.token=101;continue}default:e.pending=r;continue}case"+":if(n!==" ")break;Ki(e,23),Qi(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;Ki(e,24)&&e.pending!=="1."&&e.renderer.set_attr(e.renderer.data,bu,e.pending.slice(0,-1)),Qi(e,e.pending.length+1);continue}else{let a=n.charCodeAt(0);if(a===46||Ji(a)){e.pending=r;continue}}break;case"|":In(e,e.blockquote_idx),Ce(e,27),Ce(e,28),e.pending="",Ge(e,n);continue}let o=r;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}o=e.indent.slice(a)+r,Ce(e,9)}else Ce(e,2);nn(e),Ge(e,o);continue;case 27:if(e.table_state===1)switch(n){case"-":case" ":case"|":case":":e.pending=r;continue;case`
12
+ `:e.table_state=2,e.pending="";continue;default:qe(e),e.table_state=0;break}else switch(e.pending){case"|":Ce(e,28),e.pending="",Ge(e,n);continue;case`
13
+ `:qe(e),e.pending="",e.table_state=0,Ge(e,n);continue}break;case 28:switch(e.pending){case"":break;case"|":Ce(e,29),qe(e),e.pending="",Ge(e,n);continue;case`
14
+ `:qe(e),e.table_state=Math.min(e.table_state+1,2),e.pending="",Ge(e,n);continue;default:Ce(e,29),Ge(e,n);continue}break;case 29:if(e.pending==="|"){ke(e),qe(e),e.pending="",Ge(e,n);continue}break;case 9:switch(r){case`
15
15
  `:case`
16
16
  `:case`
17
17
  `:case`
@@ -21,40 +21,40 @@ var Q_=Object.defineProperty;var Y_=(e,t,n)=>t in e?Q_(e,t,{enumerable:!0,config
21
21
  `:case`
22
22
  `:case`
23
23
  `:case`
24
- `:e.pending=r;continue;default:e.pending.length!==0?(Pe(e),qe(e),e.pending=n):e.text+=n;continue}case 10:switch(n){case"`":e.pending=r;continue;case`
25
- `:if(r.length===e.fence_start+e.fence_end+1){Pe(e),qe(e),e.pending="",e.fence_start=0,e.fence_end=0,e.token=101;continue}e.token=101;break;case" ":if(e.pending[0]===`
26
- `){e.pending=r,e.fence_end+=1;continue}break}e.text+=e.pending,e.pending=n,e.fence_end=1;continue;case 11:switch(n){case"`":r.length===e.fence_start+ +(e.pending[0]===" ")?(Pe(e),qe(e),e.pending="",e.fence_start=0):e.pending=r;continue;case`
27
- `:e.text+=e.pending,e.pending="",e.token=21,e.blockquote_idx=0,Pe(e);continue;case" ":e.text+=e.pending,e.pending=n;continue;default:e.text+=r,e.pending="";continue}case 103:switch(e.pending.length){case 0:if(n!=="[")break;e.pending=r;continue;case 1:if(n!==" "&&n!=="x")break;e.pending=r;continue;case 2:if(n!=="]")break;e.pending=r;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="",We(e,r);continue;case 14:case 15:{let a="*",i=12;if(e.token===15&&(a="_",i=13),a===e.pending){if(Pe(e),a===n){qe(e),e.pending="";continue}ke(e,i),e.pending=n;continue}break}case 12:case 13:{let a="*",i=14;switch(e.token===13&&(a="_",i=15),e.pending){case a:a===n?e.tokens[e.len-1]===i?e.pending=r:(Pe(e),ke(e,i),e.pending=""):(Pe(e),qe(e),e.pending=n);continue;case a+a:let s=e.token;Pe(e),qe(e),qe(e),a!==n?(ke(e,s),e.pending=n):e.pending="";continue}break}case 16:if(r==="~~"){Pe(e),qe(e),e.pending="";continue}break;case 105:n===`
28
- `?(Pe(e),ke(e,30),e.pending=""):(e.token=e.tokens[e.len],e.pending[0]==="\\"?e.text+="[":e.text+="$$",e.pending="",We(e,n));continue;case 30:if(r==="\\]"||r==="$$"){Pe(e),qe(e),e.pending="";continue}break;case 31:if(r==="\\)"||e.pending[0]==="$"){Pe(e),qe(e),n===")"?e.pending="":e.pending=n;continue}break;case 102:r==="http://"||r==="https://"?(Pe(e),ke(e,18),e.pending=r,e.text=r):"http:/"[e.pending.length]===n||"https:/"[e.pending.length]===n?e.pending=r:(e.token=e.tokens[e.len],We(e,n));continue;case 17:case 19:if(e.pending==="]"){Pe(e),n==="("?e.pending=r:(qe(e),e.pending=n);continue}if(e.pending[0]==="]"&&e.pending[1]==="("){if(n===")"){let a=e.token===17?Di:Gc,i=e.pending.slice(2);e.renderer.set_attr(e.renderer.data,a,i),qe(e),e.pending=""}else e.pending+=n;continue}break;case 18:n===" "||n===`
29
- `||n==="\\"?(e.renderer.set_attr(e.renderer.data,Di,e.pending),Pe(e),qe(e),e.pending=n):(e.text+=n,e.pending=r);continue;case 104:if(r.startsWith("<br")){if(r.length===3||n===" "||n==="/"&&(r.length===4||e.pending[e.pending.length-1]===" ")){e.pending=r;continue}if(n===">"){Pe(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),We(e,n);continue}switch(e.pending[0]){case"\\":if(e.token===19||e.token===30||e.token===31)break;switch(n){case"(":Pe(e),ke(e,31),e.pending="";continue;case"[":e.token=105,e.pending=r;continue;case`
30
- `:e.pending=n;continue;default:let o=n.charCodeAt(0);e.pending="",e.text+=Bi(o)||o>=65&&o<=90||o>=97&&o<=122?r:n;continue}case`
31
- `:switch(e.token){case 19:case 30:case 31:break;case 3:case 4:case 5:case 6:case 7:case 8:Pe(e),wn(e,e.blockquote_idx),e.blockquote_idx=0,e.pending=n;continue;default:Pe(e),e.pending=n,e.token=21,e.blockquote_idx=0;continue}break;case"<":if(e.token!==19&&e.token!==30&&e.token!==31){Pe(e),e.pending=r,e.token=104;continue}break;case"`":if(e.token===19)break;n==="`"?(e.fence_start+=1,e.pending=r):(e.fence_start+=1,Pe(e),ke(e,11),e.text=n===" "||n===`
24
+ `:e.pending=r;continue;default:e.pending.length!==0?(ke(e),qe(e),e.pending=n):e.text+=n;continue}case 10:switch(n){case"`":e.pending=r;continue;case`
25
+ `:if(r.length===e.fence_start+e.fence_end+1){ke(e),qe(e),e.pending="",e.fence_start=0,e.fence_end=0,e.token=101;continue}e.token=101;break;case" ":if(e.pending[0]===`
26
+ `){e.pending=r,e.fence_end+=1;continue}break}e.text+=e.pending,e.pending=n,e.fence_end=1;continue;case 11:switch(n){case"`":r.length===e.fence_start+ +(e.pending[0]===" ")?(ke(e),qe(e),e.pending="",e.fence_start=0):e.pending=r;continue;case`
27
+ `:e.text+=e.pending,e.pending="",e.token=21,e.blockquote_idx=0,ke(e);continue;case" ":e.text+=e.pending,e.pending=n;continue;default:e.text+=r,e.pending="";continue}case 103:switch(e.pending.length){case 0:if(n!=="[")break;e.pending=r;continue;case 1:if(n!==" "&&n!=="x")break;e.pending=r;continue;case 2:if(n!=="]")break;e.pending=r;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,vu,""),e.renderer.end_token(e.renderer.data),e.pending=" ";continue}e.token=e.tokens[e.len],e.pending="",Ge(e,r);continue;case 14:case 15:{let a="*",i=12;if(e.token===15&&(a="_",i=13),a===e.pending){if(ke(e),a===n){qe(e),e.pending="";continue}Ce(e,i),e.pending=n;continue}break}case 12:case 13:{let a="*",i=14;switch(e.token===13&&(a="_",i=15),e.pending){case a:a===n?e.tokens[e.len-1]===i?e.pending=r:(ke(e),Ce(e,i),e.pending=""):(ke(e),qe(e),e.pending=n);continue;case a+a:let s=e.token;ke(e),qe(e),qe(e),a!==n?(Ce(e,s),e.pending=n):e.pending="";continue}break}case 16:if(r==="~~"){ke(e),qe(e),e.pending="";continue}break;case 105:n===`
28
+ `?(ke(e),Ce(e,30),e.pending=""):(e.token=e.tokens[e.len],e.pending[0]==="\\"?e.text+="[":e.text+="$$",e.pending="",Ge(e,n));continue;case 30:if(r==="\\]"||r==="$$"){ke(e),qe(e),e.pending="";continue}break;case 31:if(r==="\\)"||e.pending[0]==="$"){ke(e),qe(e),n===")"?e.pending="":e.pending=n;continue}break;case 102:r==="http://"||r==="https://"?(ke(e),Ce(e,18),e.pending=r,e.text=r):"http:/"[e.pending.length]===n||"https:/"[e.pending.length]===n?e.pending=r:(e.token=e.tokens[e.len],Ge(e,n));continue;case 17:case 19:if(e.pending==="]"){ke(e),n==="("?e.pending=r:(qe(e),e.pending=n);continue}if(e.pending[0]==="]"&&e.pending[1]==="("){if(n===")"){let a=e.token===17?Xi:hu,i=e.pending.slice(2);e.renderer.set_attr(e.renderer.data,a,i),qe(e),e.pending=""}else e.pending+=n;continue}break;case 18:n===" "||n===`
29
+ `||n==="\\"?(e.renderer.set_attr(e.renderer.data,Xi,e.pending),ke(e),qe(e),e.pending=n):(e.text+=n,e.pending=r);continue;case 104:if(r.startsWith("<br")){if(r.length===3||n===" "||n==="/"&&(r.length===4||e.pending[e.pending.length-1]===" ")){e.pending=r;continue}if(n===">"){ke(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),Ge(e,n);continue}switch(e.pending[0]){case"\\":if(e.token===19||e.token===30||e.token===31)break;switch(n){case"(":ke(e),Ce(e,31),e.pending="";continue;case"[":e.token=105,e.pending=r;continue;case`
30
+ `:e.pending=n;continue;default:let o=n.charCodeAt(0);e.pending="",e.text+=Ji(o)||o>=65&&o<=90||o>=97&&o<=122?r:n;continue}case`
31
+ `:switch(e.token){case 19:case 30:case 31:break;case 3:case 4:case 5:case 6:case 7:case 8:ke(e),In(e,e.blockquote_idx),e.blockquote_idx=0,e.pending=n;continue;default:ke(e),e.pending=n,e.token=21,e.blockquote_idx=0;continue}break;case"<":if(e.token!==19&&e.token!==30&&e.token!==31){ke(e),e.pending=r,e.token=104;continue}break;case"`":if(e.token===19)break;n==="`"?(e.fence_start+=1,e.pending=r):(e.fence_start+=1,ke(e),Ce(e,11),e.text=n===" "||n===`
32
32
  `?"":n,e.pending="");continue;case"_":case"*":{if(e.token===19||e.token===30||e.token===31||e.token===14)break;let o=12,a=14,i=e.pending[0];if(i==="_"&&(o=13,a=15),e.pending.length===1){if(i===n){e.pending=r;continue}if(n!==" "&&n!==`
33
- `){Pe(e),ke(e,o),e.pending=n;continue}}else{if(i===n){Pe(e),ke(e,a),ke(e,o),e.pending="";continue}if(n!==" "&&n!==`
34
- `){Pe(e),ke(e,a),e.pending=n;continue}}break}case"~":if(e.token!==19&&e.token!==16){if(e.pending==="~"){if(n==="~"){e.pending=r;continue}}else if(n!==" "&&n!==`
35
- `){Pe(e),ke(e,16),e.pending=n;continue}}break;case"$":if(e.token!==19&&e.token!==16&&e.pending==="$")if(n==="$"){e.token=105,e.pending=r;continue}else{if(Em(n.charCodeAt(0)))break;Pe(e),ke(e,31),e.pending=n;continue}break;case"[":if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n!=="]"){Pe(e),ke(e,17),e.pending=n;continue}break;case"!":if(e.token!==19&&n==="["){Pe(e),ke(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}Pe(e)}function Or(e){return{add_token:Mm,end_token:Fi,add_text:Ui,set_attr:qi,data:{nodes:[e,,,,,],index:0}}}function Mm(e,t){let n=e.nodes[e.index],r;switch(t){case 1:return;case 20:r=document.createElement("blockquote");break;case 2:r=document.createElement("p");break;case 21:r=document.createElement("br");break;case 22:r=document.createElement("hr");break;case 3:r=document.createElement("h1");break;case 4:r=document.createElement("h2");break;case 5:r=document.createElement("h3");break;case 6:r=document.createElement("h4");break;case 7:r=document.createElement("h5");break;case 8:r=document.createElement("h6");break;case 12:case 13:r=document.createElement("em");break;case 14:case 15:r=document.createElement("strong");break;case 16:r=document.createElement("s");break;case 11:r=document.createElement("code");break;case 18:case 17:r=document.createElement("a");break;case 19:r=document.createElement("img");break;case 23:r=document.createElement("ul");break;case 24:r=document.createElement("ol");break;case 25:r=document.createElement("li");break;case 26:let o=r=document.createElement("input");o.type="checkbox",o.disabled=!0;break;case 9:case 10:n=n.appendChild(document.createElement("pre")),r=document.createElement("code");break;case 27:r=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]}r=document.createElement("tr");break;case 29:r=document.createElement(n.parentElement?.tagName==="THEAD"?"th":"td");break;case 30:r=document.createElement("equation-block");break;case 31:r=document.createElement("equation-inline");break}e.nodes[++e.index]=n.appendChild(r)}function Fi(e){e.index-=1}function Ui(e,t){e.nodes[e.index].appendChild(document.createTextNode(t))}function qi(e,t,n){e.nodes[e.index].setAttribute(Cm(t),n)}var Zn={root:"Root",schema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{Root:{$ref:"#/$defs/Root"},Grid:{$ref:"#/$defs/Grid"},Cell:{$ref:"#/$defs/Cell"},Text:{$ref:"#/$defs/Text"},Card:{$ref:"#/$defs/Card"},Metric:{$ref:"#/$defs/Metric"},Table:{$ref:"#/$defs/Table"},Chart:{$ref:"#/$defs/Chart"}},required:["Root","Grid","Cell","Text","Card","Metric","Table","Chart"],additionalProperties:!1,$defs:{Root:{type:"object",properties:{children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Grid"},{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}}},required:["children"],additionalProperties:!1},Grid:{type:"object",properties:{columns:{type:"integer",enum:[1,2,3,4],default:1},children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Cell"},{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}}},required:["columns","children"],additionalProperties:!1},Cell:{type:"object",properties:{children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}},span:{type:"integer",enum:[1,2,3,4],default:1}},required:["children"],additionalProperties:!1},Text:{type:"object",properties:{text:{type:"string"}},required:["text"],additionalProperties:!1},Card:{type:"object",properties:{title:{type:"string"},body:{type:"string"}},required:["title","body"],additionalProperties:!1},Metric:{type:"object",properties:{label:{type:"string"},value:{type:"string"},detail:{type:"string"}},required:["label","value","detail"],additionalProperties:!1},Table:{type:"object",properties:{title:{type:"string"},columns:{type:"array",items:{type:"string"}},rows:{type:"array",items:{type:"array",items:{type:"string"}}}},required:["title","columns","rows"],additionalProperties:!1},Chart:{type:"object",properties:{title:{type:"string"},type:{type:"string",enum:["bar","line"]},data:{type:"array",items:{type:"object",properties:{label:{type:"string"},value:{type:"number"}},required:["label","value"],additionalProperties:!1}}},required:["title","type","data"],additionalProperties:!1}}}};var Xc=$r;var Nm={type:"object",properties:{typeName:{const:"Grid"},statementId:{type:"string"},props:{type:"object",properties:{columns:{type:"integer",enum:[1,2,3,4],default:1},children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Cell"},{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}}},required:["columns","children"],additionalProperties:!1}},required:["typeName","statementId","props"]},Lm={type:"object",properties:{typeName:{const:"Cell"},statementId:{type:"string"},props:{type:"object",properties:{children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}},span:{type:"integer",enum:[1,2,3,4],default:1}},required:["children"],additionalProperties:!1}},required:["typeName","statementId","props"]};function Je(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=Je.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let d;if(e.typeName===void 0&&(d="typeName")||e.statementId===void 0&&(d="statementId")||e.props===void 0&&(d="props"))return Je.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:d}}],!1;if(e.typeName!==void 0){let _=s;if(e.typeName!=="Text")return Je.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Text"}}],!1;var p=_===s}else var p=!0;if(p){if(e.statementId!==void 0){let _=s;if(typeof e.statementId!="string")return Je.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=_===s}else var p=!0;if(p)if(e.props!==void 0){let _=e.props,u=s;if(s===u)if(_&&typeof _=="object"&&!Array.isArray(_)){let m;if(_.text===void 0&&(m="text"))return Je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:m}}],!1;{let h=s;for(let y in _)if(y!=="text"){return Je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:y}}],!1;break}if(h===s&&_.text!==void 0&&typeof _.text!="string")return Je.errors=[{instancePath:t+"/props/text",schemaPath:"#/properties/props/properties/text/type",keyword:"type",params:{type:"string"}}],!1}}else return Je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=u===s}else var p=!0}}else return Je.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return Je.errors=i,s===0}Je.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function Ge(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=Ge.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let _;if(e.typeName===void 0&&(_="typeName")||e.statementId===void 0&&(_="statementId")||e.props===void 0&&(_="props"))return Ge.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:_}}],!1;if(e.typeName!==void 0){let u=s;if(e.typeName!=="Card")return Ge.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Card"}}],!1;var p=u===s}else var p=!0;if(p){if(e.statementId!==void 0){let u=s;if(typeof e.statementId!="string")return Ge.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=u===s}else var p=!0;if(p)if(e.props!==void 0){let u=e.props,f=s;if(s===f)if(u&&typeof u=="object"&&!Array.isArray(u)){let h;if(u.title===void 0&&(h="title")||u.body===void 0&&(h="body"))return Ge.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:h}}],!1;{let y=s;for(let x in u)if(!(x==="title"||x==="body")){return Ge.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:x}}],!1;break}if(y===s){if(u.title!==void 0){let x=s;if(typeof u.title!="string")return Ge.errors=[{instancePath:t+"/props/title",schemaPath:"#/properties/props/properties/title/type",keyword:"type",params:{type:"string"}}],!1;var d=x===s}else var d=!0;if(d)if(u.body!==void 0){let x=s;if(typeof u.body!="string")return Ge.errors=[{instancePath:t+"/props/body",schemaPath:"#/properties/props/properties/body/type",keyword:"type",params:{type:"string"}}],!1;var d=x===s}else var d=!0}}}else return Ge.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=f===s}else var p=!0}}else return Ge.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return Ge.errors=i,s===0}Ge.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function ze(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=ze.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let _;if(e.typeName===void 0&&(_="typeName")||e.statementId===void 0&&(_="statementId")||e.props===void 0&&(_="props"))return ze.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:_}}],!1;if(e.typeName!==void 0){let u=s;if(e.typeName!=="Metric")return ze.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Metric"}}],!1;var p=u===s}else var p=!0;if(p){if(e.statementId!==void 0){let u=s;if(typeof e.statementId!="string")return ze.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=u===s}else var p=!0;if(p)if(e.props!==void 0){let u=e.props,f=s;if(s===f)if(u&&typeof u=="object"&&!Array.isArray(u)){let h;if(u.label===void 0&&(h="label")||u.value===void 0&&(h="value")||u.detail===void 0&&(h="detail"))return ze.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:h}}],!1;{let y=s;for(let x in u)if(!(x==="label"||x==="value"||x==="detail")){return ze.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:x}}],!1;break}if(y===s){if(u.label!==void 0){let x=s;if(typeof u.label!="string")return ze.errors=[{instancePath:t+"/props/label",schemaPath:"#/properties/props/properties/label/type",keyword:"type",params:{type:"string"}}],!1;var d=x===s}else var d=!0;if(d){if(u.value!==void 0){let x=s;if(typeof u.value!="string")return ze.errors=[{instancePath:t+"/props/value",schemaPath:"#/properties/props/properties/value/type",keyword:"type",params:{type:"string"}}],!1;var d=x===s}else var d=!0;if(d)if(u.detail!==void 0){let x=s;if(typeof u.detail!="string")return ze.errors=[{instancePath:t+"/props/detail",schemaPath:"#/properties/props/properties/detail/type",keyword:"type",params:{type:"string"}}],!1;var d=x===s}else var d=!0}}}}else return ze.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=f===s}else var p=!0}}else return ze.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return ze.errors=i,s===0}ze.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function Me(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=Me.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let m;if(e.typeName===void 0&&(m="typeName")||e.statementId===void 0&&(m="statementId")||e.props===void 0&&(m="props"))return Me.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:m}}],!1;if(e.typeName!==void 0){let h=s;if(e.typeName!=="Table")return Me.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Table"}}],!1;var p=h===s}else var p=!0;if(p){if(e.statementId!==void 0){let h=s;if(typeof e.statementId!="string")return Me.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=h===s}else var p=!0;if(p)if(e.props!==void 0){let h=e.props,y=s;if(s===y)if(h&&typeof h=="object"&&!Array.isArray(h)){let S;if(h.title===void 0&&(S="title")||h.columns===void 0&&(S="columns")||h.rows===void 0&&(S="rows"))return Me.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:S}}],!1;{let w=s;for(let g in h)if(!(g==="title"||g==="columns"||g==="rows")){return Me.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:g}}],!1;break}if(w===s){if(h.title!==void 0){let g=s;if(typeof h.title!="string")return Me.errors=[{instancePath:t+"/props/title",schemaPath:"#/properties/props/properties/title/type",keyword:"type",params:{type:"string"}}],!1;var d=g===s}else var d=!0;if(d){if(h.columns!==void 0){let g=h.columns,v=s;if(s===v)if(Array.isArray(g)){var _=!0;let C=g.length;for(let T=0;T<C;T++){let M=s;if(typeof g[T]!="string")return Me.errors=[{instancePath:t+"/props/columns/"+T,schemaPath:"#/properties/props/properties/columns/items/type",keyword:"type",params:{type:"string"}}],!1;var _=M===s;if(!_)break}}else return Me.errors=[{instancePath:t+"/props/columns",schemaPath:"#/properties/props/properties/columns/type",keyword:"type",params:{type:"array"}}],!1;var d=v===s}else var d=!0;if(d)if(h.rows!==void 0){let g=h.rows,v=s;if(s===v)if(Array.isArray(g)){var u=!0;let C=g.length;for(let T=0;T<C;T++){let M=g[T],N=s;if(s===N)if(Array.isArray(M)){var f=!0;let $=M.length;for(let W=0;W<$;W++){let G=s;if(typeof M[W]!="string")return Me.errors=[{instancePath:t+"/props/rows/"+T+"/"+W,schemaPath:"#/properties/props/properties/rows/items/items/type",keyword:"type",params:{type:"string"}}],!1;var f=G===s;if(!f)break}}else return Me.errors=[{instancePath:t+"/props/rows/"+T,schemaPath:"#/properties/props/properties/rows/items/type",keyword:"type",params:{type:"array"}}],!1;var u=N===s;if(!u)break}}else return Me.errors=[{instancePath:t+"/props/rows",schemaPath:"#/properties/props/properties/rows/type",keyword:"type",params:{type:"array"}}],!1;var d=v===s}else var d=!0}}}}else return Me.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=y===s}else var p=!0}}else return Me.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return Me.errors=i,s===0}Me.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};var Om={type:"object",properties:{typeName:{const:"Chart"},statementId:{type:"string"},props:{type:"object",properties:{title:{type:"string"},type:{type:"string",enum:["bar","line"]},data:{type:"array",items:{type:"object",properties:{label:{type:"string"},value:{type:"number"}},required:["label","value"],additionalProperties:!1}}},required:["title","type","data"],additionalProperties:!1}},required:["typeName","statementId","props"]};function Re(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=Re.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let f;if(e.typeName===void 0&&(f="typeName")||e.statementId===void 0&&(f="statementId")||e.props===void 0&&(f="props"))return Re.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:f}}],!1;if(e.typeName!==void 0){let m=s;if(e.typeName!=="Chart")return Re.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Chart"}}],!1;var p=m===s}else var p=!0;if(p){if(e.statementId!==void 0){let m=s;if(typeof e.statementId!="string")return Re.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=m===s}else var p=!0;if(p)if(e.props!==void 0){let m=e.props,h=s;if(s===h)if(m&&typeof m=="object"&&!Array.isArray(m)){let x;if(m.title===void 0&&(x="title")||m.type===void 0&&(x="type")||m.data===void 0&&(x="data"))return Re.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:x}}],!1;{let S=s;for(let w in m)if(!(w==="title"||w==="type"||w==="data")){return Re.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:w}}],!1;break}if(S===s){if(m.title!==void 0){let w=s;if(typeof m.title!="string")return Re.errors=[{instancePath:t+"/props/title",schemaPath:"#/properties/props/properties/title/type",keyword:"type",params:{type:"string"}}],!1;var d=w===s}else var d=!0;if(d){if(m.type!==void 0){let w=m.type,g=s;if(typeof w!="string")return Re.errors=[{instancePath:t+"/props/type",schemaPath:"#/properties/props/properties/type/type",keyword:"type",params:{type:"string"}}],!1;if(!(w==="bar"||w==="line"))return Re.errors=[{instancePath:t+"/props/type",schemaPath:"#/properties/props/properties/type/enum",keyword:"enum",params:{allowedValues:Om.properties.props.properties.type.enum}}],!1;var d=g===s}else var d=!0;if(d)if(m.data!==void 0){let w=m.data,g=s;if(s===g)if(Array.isArray(w)){var _=!0;let k=w.length;for(let C=0;C<k;C++){let T=w[C],M=s;if(s===M)if(T&&typeof T=="object"&&!Array.isArray(T)){let L;if(T.label===void 0&&(L="label")||T.value===void 0&&(L="value"))return Re.errors=[{instancePath:t+"/props/data/"+C,schemaPath:"#/properties/props/properties/data/items/required",keyword:"required",params:{missingProperty:L}}],!1;{let $=s;for(let W in T)if(!(W==="label"||W==="value")){return Re.errors=[{instancePath:t+"/props/data/"+C,schemaPath:"#/properties/props/properties/data/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:W}}],!1;break}if($===s){if(T.label!==void 0){let W=s;if(typeof T.label!="string")return Re.errors=[{instancePath:t+"/props/data/"+C+"/label",schemaPath:"#/properties/props/properties/data/items/properties/label/type",keyword:"type",params:{type:"string"}}],!1;var u=W===s}else var u=!0;if(u)if(T.value!==void 0){let W=T.value,G=s;if(!(typeof W=="number"&&isFinite(W)))return Re.errors=[{instancePath:t+"/props/data/"+C+"/value",schemaPath:"#/properties/props/properties/data/items/properties/value/type",keyword:"type",params:{type:"number"}}],!1;var u=G===s}else var u=!0}}}else return Re.errors=[{instancePath:t+"/props/data/"+C,schemaPath:"#/properties/props/properties/data/items/type",keyword:"type",params:{type:"object"}}],!1;var _=M===s;if(!_)break}}else return Re.errors=[{instancePath:t+"/props/data",schemaPath:"#/properties/props/properties/data/type",keyword:"type",params:{type:"array"}}],!1;var d=g===s}else var d=!0}}}}else return Re.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=h===s}else var p=!0}}else return Re.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return Re.errors=i,s===0}Re.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function Xe(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=Xe.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let m;if(e.typeName===void 0&&(m="typeName")||e.statementId===void 0&&(m="statementId")||e.props===void 0&&(m="props"))return Xe.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:m}}],!1;if(e.typeName!==void 0){let h=s;if(e.typeName!=="Cell")return Xe.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Cell"}}],!1;var p=h===s}else var p=!0;if(p){if(e.statementId!==void 0){let h=s;if(typeof e.statementId!="string")return Xe.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=h===s}else var p=!0;if(p)if(e.props!==void 0){let h=e.props,y=s;if(s===y)if(h&&typeof h=="object"&&!Array.isArray(h)){let S;if(h.children===void 0&&(S="children"))return Xe.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:S}}],!1;{let w=s;for(let g in h)if(!(g==="children"||g==="span")){return Xe.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:g}}],!1;break}if(w===s){if(h.children!==void 0){let g=h.children,v=s;if(s===v)if(Array.isArray(g)){var d=!0;let k=g.length;for(let C=0;C<k;C++){let T=g[C],M=s,N=s,L=!1,$=s;Je(T,{instancePath:t+"/props/children/"+C,parentData:g,parentDataProperty:C,rootData:o,dynamicAnchors:a})||(i=i===null?Je.errors:i.concat(Je.errors),s=i.length);var u=$===s;if(L=L||u,u){var _={};_.typeName=!0,_.statementId=!0,_.props=!0}let W=s;Ge(T,{instancePath:t+"/props/children/"+C,parentData:g,parentDataProperty:C,rootData:o,dynamicAnchors:a})||(i=i===null?Ge.errors:i.concat(Ge.errors),s=i.length);var u=W===s;L=L||u,u&&_!==!0&&(_=_||{},_.typeName=!0,_.statementId=!0,_.props=!0);let G=s;ze(T,{instancePath:t+"/props/children/"+C,parentData:g,parentDataProperty:C,rootData:o,dynamicAnchors:a})||(i=i===null?ze.errors:i.concat(ze.errors),s=i.length);var u=G===s;L=L||u,u&&_!==!0&&(_=_||{},_.typeName=!0,_.statementId=!0,_.props=!0);let U=s;Me(T,{instancePath:t+"/props/children/"+C,parentData:g,parentDataProperty:C,rootData:o,dynamicAnchors:a})||(i=i===null?Me.errors:i.concat(Me.errors),s=i.length);var u=U===s;L=L||u,u&&_!==!0&&(_=_||{},_.typeName=!0,_.statementId=!0,_.props=!0);let oe=s;Re(T,{instancePath:t+"/props/children/"+C,parentData:g,parentDataProperty:C,rootData:o,dynamicAnchors:a})||(i=i===null?Re.errors:i.concat(Re.errors),s=i.length);var u=oe===s;if(L=L||u,u&&_!==!0&&(_=_||{},_.typeName=!0,_.statementId=!0,_.props=!0),L)s=N,i!==null&&(N?i.length=N:i=null);else{let Te={instancePath:t+"/props/children/"+C,schemaPath:"#/properties/props/properties/children/items/anyOf",keyword:"anyOf",params:{}};return i===null?i=[Te]:i.push(Te),s++,Xe.errors=i,!1}var d=M===s;if(!d)break}}else return Xe.errors=[{instancePath:t+"/props/children",schemaPath:"#/properties/props/properties/children/type",keyword:"type",params:{type:"array"}}],!1;var f=v===s}else var f=!0;if(f)if(h.span!==void 0){let g=h.span,v=s;if(!(typeof g=="number"&&!(g%1)&&!isNaN(g)&&isFinite(g)))return Xe.errors=[{instancePath:t+"/props/span",schemaPath:"#/properties/props/properties/span/type",keyword:"type",params:{type:"integer"}}],!1;if(!(g===1||g===2||g===3||g===4))return Xe.errors=[{instancePath:t+"/props/span",schemaPath:"#/properties/props/properties/span/enum",keyword:"enum",params:{allowedValues:Lm.properties.props.properties.span.enum}}],!1;var f=v===s}else var f=!0}}}else return Xe.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=y===s}else var p=!0}}else return Xe.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return Xe.errors=i,s===0}Xe.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function ft(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=ft.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let m;if(e.typeName===void 0&&(m="typeName")||e.statementId===void 0&&(m="statementId")||e.props===void 0&&(m="props"))return ft.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:m}}],!1;if(e.typeName!==void 0){let h=s;if(e.typeName!=="Grid")return ft.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Grid"}}],!1;var p=h===s}else var p=!0;if(p){if(e.statementId!==void 0){let h=s;if(typeof e.statementId!="string")return ft.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=h===s}else var p=!0;if(p)if(e.props!==void 0){let h=e.props,y=s;if(s===y)if(h&&typeof h=="object"&&!Array.isArray(h)){let S;if(h.columns===void 0&&(S="columns")||h.children===void 0&&(S="children"))return ft.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:S}}],!1;{let w=s;for(let g in h)if(!(g==="columns"||g==="children")){return ft.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:g}}],!1;break}if(w===s){if(h.columns!==void 0){let g=h.columns,v=s;if(!(typeof g=="number"&&!(g%1)&&!isNaN(g)&&isFinite(g)))return ft.errors=[{instancePath:t+"/props/columns",schemaPath:"#/properties/props/properties/columns/type",keyword:"type",params:{type:"integer"}}],!1;if(!(g===1||g===2||g===3||g===4))return ft.errors=[{instancePath:t+"/props/columns",schemaPath:"#/properties/props/properties/columns/enum",keyword:"enum",params:{allowedValues:Nm.properties.props.properties.columns.enum}}],!1;var d=v===s}else var d=!0;if(d)if(h.children!==void 0){let g=h.children,v=s;if(s===v)if(Array.isArray(g)){var _=!0;let C=g.length;for(let T=0;T<C;T++){let M=g[T],N=s,L=s,$=!1,W=s;Xe(M,{instancePath:t+"/props/children/"+T,parentData:g,parentDataProperty:T,rootData:o,dynamicAnchors:a})||(i=i===null?Xe.errors:i.concat(Xe.errors),s=i.length);var f=W===s;if($=$||f,f){var u={};u.typeName=!0,u.statementId=!0,u.props=!0}let G=s;Je(M,{instancePath:t+"/props/children/"+T,parentData:g,parentDataProperty:T,rootData:o,dynamicAnchors:a})||(i=i===null?Je.errors:i.concat(Je.errors),s=i.length);var f=G===s;$=$||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let U=s;Ge(M,{instancePath:t+"/props/children/"+T,parentData:g,parentDataProperty:T,rootData:o,dynamicAnchors:a})||(i=i===null?Ge.errors:i.concat(Ge.errors),s=i.length);var f=U===s;$=$||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let oe=s;ze(M,{instancePath:t+"/props/children/"+T,parentData:g,parentDataProperty:T,rootData:o,dynamicAnchors:a})||(i=i===null?ze.errors:i.concat(ze.errors),s=i.length);var f=oe===s;$=$||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let ae=s;Me(M,{instancePath:t+"/props/children/"+T,parentData:g,parentDataProperty:T,rootData:o,dynamicAnchors:a})||(i=i===null?Me.errors:i.concat(Me.errors),s=i.length);var f=ae===s;$=$||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let Te=s;Re(M,{instancePath:t+"/props/children/"+T,parentData:g,parentDataProperty:T,rootData:o,dynamicAnchors:a})||(i=i===null?Re.errors:i.concat(Re.errors),s=i.length);var f=Te===s;if($=$||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0),$)s=L,i!==null&&(L?i.length=L:i=null);else{let xe={instancePath:t+"/props/children/"+T,schemaPath:"#/properties/props/properties/children/items/anyOf",keyword:"anyOf",params:{}};return i===null?i=[xe]:i.push(xe),s++,ft.errors=i,!1}var _=N===s;if(!_)break}}else return ft.errors=[{instancePath:t+"/props/children",schemaPath:"#/properties/props/properties/children/type",keyword:"type",params:{type:"array"}}],!1;var d=v===s}else var d=!0}}}else return ft.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=y===s}else var p=!0}}else return ft.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return ft.errors=i,s===0}ft.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function $r(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=$r.evaluated;c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0);let p=s,d=!1,_=s;ft(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?ft.errors:i.concat(ft.errors),s=i.length);var w=_===s;if(d=d||w,w){var u={};u.typeName=!0,u.statementId=!0,u.props=!0}let f=s;Xe(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?Xe.errors:i.concat(Xe.errors),s=i.length);var w=f===s;d=d||w,w&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let m=s;Je(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?Je.errors:i.concat(Je.errors),s=i.length);var w=m===s;d=d||w,w&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let h=s;Ge(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?Ge.errors:i.concat(Ge.errors),s=i.length);var w=h===s;d=d||w,w&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let y=s;ze(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?ze.errors:i.concat(ze.errors),s=i.length);var w=y===s;d=d||w,w&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let x=s;Me(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?Me.errors:i.concat(Me.errors),s=i.length);var w=x===s;d=d||w,w&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let S=s;Re(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?Re.errors:i.concat(Re.errors),s=i.length);var w=S===s;if(d=d||w,w&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0),d)s=p,i!==null&&(p?i.length=p:i=null);else{let g={instancePath:t,schemaPath:"#/anyOf",keyword:"anyOf",params:{}};return i===null?i=[g]:i.push(g),s++,$r.errors=i,!1}return $r.errors=i,c.props=u,s===0}$r.evaluated={dynamicProps:!0,dynamicItems:!1};function Jc(e){switch(e.k){case"StateRef":case"RuntimeRef":case"BinOp":case"UnaryOp":case"Ternary":case"Member":case"Index":case"Assign":return!0;default:return!1}}var $m=new Set(["Comp","Ref","StateRef","RuntimeRef","BinOp","UnaryOp","Ternary","Member","Index","Assign","Str","Num","Bool","Null","Arr","Obj","Ph"]);function Cn(e){return!e||typeof e!="object"||Array.isArray(e)?!1:$m.has(e.k)}function Dr(e,t){let n=r=>{switch(t(r),r.k){case"Comp":r.args.forEach(n),Object.values(r.mappedProps??{}).forEach(n);break;case"Arr":r.els.forEach(n);break;case"Obj":r.entries.forEach(([,o])=>n(o));break;case"BinOp":n(r.left),n(r.right);break;case"UnaryOp":n(r.operand);break;case"Ternary":n(r.cond),n(r.then),n(r.else);break;case"Member":n(r.obj);break;case"Index":n(r.obj),n(r.index);break;case"Assign":n(r.value);break}};n(e)}function Vo(e){return e==null?{k:"Null"}:typeof e=="string"?{k:"Str",v:e}:typeof e=="number"?{k:"Num",v:e}:typeof e=="boolean"?{k:"Bool",v:e}:Array.isArray(e)?{k:"Arr",els:e.map(Vo)}:typeof e=="object"?{k:"Obj",entries:Object.entries(e).map(([t,n])=>[t,Vo(n)])}:{k:"Null"}}function Wo(e){switch(e.k){case"Str":case"Num":case"Bool":return{v:e.v};case"Null":return{v:null};case"Arr":{let t=[];for(let n of e.els){let r=Wo(n);if(!r)return;t.push(r.v)}return{v:t}}case"Obj":{let t={};for(let[n,r]of e.entries){let o=Wo(r);if(!o)return;t[n]=o.v}return{v:t}}default:return}}var Go=new Map([["Count",{kind:"function",params:[{name:"array",required:!1}],builtin:!0}],["First",{kind:"function",params:[{name:"array",required:!1}],builtin:!0}],["Last",{kind:"function",params:[{name:"array",required:!1}],builtin:!0}],["Sum",{kind:"function",params:[{name:"numbers",required:!1}],builtin:!0}],["Avg",{kind:"function",params:[{name:"numbers",required:!1}],builtin:!0}],["Min",{kind:"function",params:[{name:"numbers",required:!1}],builtin:!0}],["Max",{kind:"function",params:[{name:"numbers",required:!1}],builtin:!0}],["Sort",{kind:"function",params:[{name:"array",required:!1},{name:"field",required:!1},{name:"direction",required:!1}],builtin:!0}],["Filter",{kind:"function",params:[{name:"array",required:!1},{name:"field",required:!1},{name:"operator",required:!1},{name:"value",required:!1}],builtin:!0}],["Round",{kind:"function",params:[{name:"number",required:!1},{name:"decimals",required:!1}],builtin:!0}],["Abs",{kind:"function",params:[{name:"number",required:!1}],builtin:!0}],["Floor",{kind:"function",params:[{name:"number",required:!1}],builtin:!0}],["Ceil",{kind:"function",params:[{name:"number",required:!1}],builtin:!0}],["Each",{kind:"function",params:[{name:"array",required:!1},{name:"varName",required:!1},{name:"template",required:!1}],builtin:!0,lazy:!0}],["Run",{kind:"action",params:[{name:"ref",required:!1}],builtin:!0,lazy:!0}],["ToAssistant",{kind:"action",params:[{name:"message",required:!1},{name:"context",required:!1}],builtin:!0}],["OpenUrl",{kind:"action",params:[{name:"url",required:!1}],builtin:!0}],["Set",{kind:"action",params:[{name:"variable",required:!1},{name:"value",required:!1}],builtin:!0,lazy:!0}],["Reset",{kind:"action",params:[{name:"variable",required:!1}],builtin:!0,lazy:!0}],["Action",{kind:"action",params:[{name:"steps",required:!0}],builtin:!0,lazy:!0}]]),Zc={ActionExpression:!0,OpenUrl:!0,ToAssistant:!0},dn={Query:"Query",Mutation:"Mutation"};function Br(e){return e?.callDefs??Go}function Fr(e){return Go.has(e)}function er(e){return e in dn}var R;(function(e){e[e.Newline=0]="Newline",e[e.LParen=1]="LParen",e[e.RParen=2]="RParen",e[e.LBrack=3]="LBrack",e[e.RBrack=4]="RBrack",e[e.LBrace=5]="LBrace",e[e.RBrace=6]="RBrace",e[e.Comma=7]="Comma",e[e.Colon=8]="Colon",e[e.Equals=9]="Equals",e[e.True=10]="True",e[e.False=11]="False",e[e.Null=12]="Null",e[e.EOF=13]="EOF",e[e.Str=14]="Str",e[e.Num=15]="Num",e[e.Ident=16]="Ident",e[e.Type=17]="Type",e[e.StateVar=18]="StateVar",e[e.Dot=19]="Dot",e[e.Plus=20]="Plus",e[e.Minus=21]="Minus",e[e.Star=22]="Star",e[e.Slash=23]="Slash",e[e.Percent=24]="Percent",e[e.EqEq=25]="EqEq",e[e.NotEq=26]="NotEq",e[e.Greater=27]="Greater",e[e.Less=28]="Less",e[e.GreaterEq=29]="GreaterEq",e[e.LessEq=30]="LessEq",e[e.And=31]="And",e[e.Or=32]="Or",e[e.Not=33]="Not",e[e.Question=34]="Question",e[e.BuiltinCall=35]="BuiltinCall"})(R||(R={}));var Dm=1,eu=2,tu=3,zi=4,Ur=5,Hi=6,Ko=7,nu=8,Bm=9;function Qo(e){let t=0,n=()=>e[t]??{t:R.EOF},r=()=>{let u=n();return t++,u},o=u=>{n().t===u&&t++};function a(u){switch(u.t){case R.Question:return Dm;case R.Or:return eu;case R.And:return tu;case R.EqEq:case R.NotEq:return zi;case R.Greater:case R.Less:case R.GreaterEq:case R.LessEq:return Ur;case R.Plus:case R.Minus:return Hi;case R.Star:case R.Slash:case R.Percent:return Ko;case R.Dot:case R.LBrack:return Bm;default:return 0}}function i(u=0){let f=s();for(;a(n())>u;)f=c(f);return f}function s(){let u=n();if(u.t===R.Str)return r(),{k:"Str",v:u.v};if(u.t===R.Num)return r(),{k:"Num",v:u.v};if(u.t===R.True)return r(),{k:"Bool",v:!0};if(u.t===R.False)return r(),{k:"Bool",v:!1};if(u.t===R.Null)return r(),{k:"Null"};if(u.t===R.LBrack)return d();if(u.t===R.LBrace)return _();if(u.t===R.StateVar){let f=u.v;if(r(),n().t===R.Equals){r();let m=i(0);return{k:"Assign",target:f,value:m}}return{k:"StateRef",n:f}}if(u.t===R.Type){let f=u.v;return e[t+1]?.t===R.LParen&&(!Fr(f)||f==="Action")?p():(r(),{k:"Ref",n:f})}if(u.t===R.BuiltinCall){if(e[t+1]?.t===R.LParen){let f=p();return f.k==="Comp"&&!Fr(f.name)&&(f.fn=!0),f}return r(),{k:"Ref",n:u.v}}if(u.t===R.Ident)return r(),{k:"Ref",n:u.v};if(u.t===R.Not)return r(),{k:"UnaryOp",op:"!",operand:i(nu)};if(u.t===R.Minus)return r(),{k:"UnaryOp",op:"-",operand:i(nu)};if(u.t===R.LParen){r();let f=i(0);return o(R.RParen),f}return r(),{k:"Null"}}function c(u){let f=n();if(f.t===R.Plus)return r(),{k:"BinOp",op:"+",left:u,right:i(Hi)};if(f.t===R.Minus)return r(),{k:"BinOp",op:"-",left:u,right:i(Hi)};if(f.t===R.Star)return r(),{k:"BinOp",op:"*",left:u,right:i(Ko)};if(f.t===R.Slash)return r(),{k:"BinOp",op:"/",left:u,right:i(Ko)};if(f.t===R.Percent)return r(),{k:"BinOp",op:"%",left:u,right:i(Ko)};if(f.t===R.EqEq)return r(),{k:"BinOp",op:"==",left:u,right:i(zi)};if(f.t===R.NotEq)return r(),{k:"BinOp",op:"!=",left:u,right:i(zi)};if(f.t===R.Greater)return r(),{k:"BinOp",op:">",left:u,right:i(Ur)};if(f.t===R.Less)return r(),{k:"BinOp",op:"<",left:u,right:i(Ur)};if(f.t===R.GreaterEq)return r(),{k:"BinOp",op:">=",left:u,right:i(Ur)};if(f.t===R.LessEq)return r(),{k:"BinOp",op:"<=",left:u,right:i(Ur)};if(f.t===R.And)return r(),{k:"BinOp",op:"&&",left:u,right:i(tu)};if(f.t===R.Or)return r(),{k:"BinOp",op:"||",left:u,right:i(eu)};if(f.t===R.Question){r();let m=i(0);o(R.Colon);let h=i(0);return{k:"Ternary",cond:u,then:m,else:h}}if(f.t===R.Dot){r();let m=n(),h=m.t===R.Ident||m.t===R.Type||m.t===R.Str||m.t===R.Num?(r(),String(m.v)):m.t===R.StateVar?(r(),m.v.replace(/^\$/,"")):(r(),"?");return{k:"Member",obj:u,field:h}}if(f.t===R.LBrack){r();let m=i(0);return o(R.RBrack),{k:"Index",obj:u,index:m}}return u}function p(){let u=n().v;r(),o(R.LParen);let f=[];for(;n().t!==R.RParen&&n().t!==R.EOF;)f.push(i(0)),n().t===R.Comma&&r();return o(R.RParen),{k:"Comp",name:u,args:f}}function d(){r();let u=[];for(;n().t!==R.RBrack&&n().t!==R.EOF;)u.push(i(0)),n().t===R.Comma&&r();return o(R.RBrack),{k:"Arr",els:u}}function _(){r();let u=[];for(;n().t!==R.RBrace&&n().t!==R.EOF;){let f=n(),m=f.t===R.Ident||f.t===R.Str||f.t===R.Type||f.t===R.Num?(r(),String(f.v)):f.t===R.StateVar?(r(),f.v.replace(/^\$/,"")):(r(),"?");o(R.Colon),u.push([m,i(0)]),n().t===R.Comma&&r()}return o(R.RBrace),{k:"Obj",entries:u}}return i(0)}function Yo(e){let t=[],n=0,r=e.length;for(;n<r;){for(;n<r&&(e[n]===" "||e[n]===" "||e[n]==="\r");)n++;if(n>=r)break;let o=e[n];if(o===`
36
- `){t.push({t:R.Newline}),n++;continue}if(o==="("){t.push({t:R.LParen}),n++;continue}if(o===")"){t.push({t:R.RParen}),n++;continue}if(o==="["){t.push({t:R.LBrack}),n++;continue}if(o==="]"){t.push({t:R.RBrack}),n++;continue}if(o==="{"){t.push({t:R.LBrace}),n++;continue}if(o==="}"){t.push({t:R.RBrace}),n++;continue}if(o===","){t.push({t:R.Comma}),n++;continue}if(o===":"){t.push({t:R.Colon}),n++;continue}if(o==="="){n+1<r&&e[n+1]==="="?(t.push({t:R.EqEq}),n+=2):(t.push({t:R.Equals}),n++);continue}if(o==="!"){n+1<r&&e[n+1]==="="?(t.push({t:R.NotEq}),n+=2):(t.push({t:R.Not}),n++);continue}if(o===">"){n+1<r&&e[n+1]==="="?(t.push({t:R.GreaterEq}),n+=2):(t.push({t:R.Greater}),n++);continue}if(o==="<"){n+1<r&&e[n+1]==="="?(t.push({t:R.LessEq}),n+=2):(t.push({t:R.Less}),n++);continue}if(o==="&"){n+1<r&&e[n+1]==="&"?(t.push({t:R.And}),n+=2):(t.push({t:R.And}),n++);continue}if(o==="|"){n+1<r&&e[n+1]==="|"?(t.push({t:R.Or}),n+=2):(t.push({t:R.Or}),n++);continue}if(o==="."){t.push({t:R.Dot}),n++;continue}if(o==="?"){t.push({t:R.Question}),n++;continue}if(o==="+"){t.push({t:R.Plus}),n++;continue}if(o==="*"){t.push({t:R.Star}),n++;continue}if(o==="/"){t.push({t:R.Slash}),n++;continue}if(o==="%"){t.push({t:R.Percent}),n++;continue}if(o==='"'){let c=n;n++;let p=!1;for(;n<r;)if(e[n]==="\\")n+=2;else if(e[n]==='"'){n++,p=!0;break}else n++;let d=e.slice(c,n);try{let _=p?d:d+'"';t.push({t:R.Str,v:JSON.parse(_)})}catch{let _=d.replace(/^"|"$/g,"");t.push({t:R.Str,v:_})}continue}if(o==="'"){n++;let c="",p=!1;for(;n<r;)if(e[n]==="\\"){if(n++,n<r){let d=e[n];d==="'"?c+="'":d==="\\"?c+="\\":d==="n"?c+=`
37
- `:d==="t"?c+=" ":c+=d,n++}}else if(e[n]==="'"){n++,p=!0;break}else c+=e[n],n++;t.push({t:R.Str,v:c});continue}if(o==="-"){let c=t.length>0?t[t.length-1]:null;if(!(!(c!=null&&(c.t===R.Num||c.t===R.Str||c.t===R.Ident||c.t===R.Type||c.t===R.RParen||c.t===R.RBrack||c.t===R.True||c.t===R.False||c.t===R.Null||c.t===R.StateVar||c.t===R.BuiltinCall))&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9")){t.push({t:R.Minus}),n++;continue}}let a=o>="0"&&o<="9",i=o==="-"&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9";if(a||i){let c=n;for(e[n]==="-"&&n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;if(n<r&&e[n]==="."&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9")for(n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;if(n<r&&(e[n]==="e"||e[n]==="E"))for(n++,n<r&&(e[n]==="+"||e[n]==="-")&&n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;t.push({t:R.Num,v:+e.slice(c,n)});continue}if(o==="$"&&n+1<r&&(e[n+1]>="a"&&e[n+1]<="z"||e[n+1]>="A"&&e[n+1]<="Z"||e[n+1]==="_")){let c=n;for(n++;n<r&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;t.push({t:R.StateVar,v:e.slice(c,n)});continue}if(o>="a"&&o<="z"||o>="A"&&o<="Z"||o==="_"){let c=n;for(;n<r&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;let p=e.slice(c,n);if(p==="true"){t.push({t:R.True});continue}if(p==="false"){t.push({t:R.False});continue}if(p==="null"){t.push({t:R.Null});continue}let d=o>="A"&&o<="Z"?R.Type:R.Ident;t.push({t:d,v:p});continue}if(o==="@"&&n+1<r&&(e[n+1]>="a"&&e[n+1]<="z"||e[n+1]>="A"&&e[n+1]<="Z"||e[n+1]==="_")){n++;let c=n;for(;n<r&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;t.push({t:R.BuiltinCall,v:e.slice(c,n)});continue}n++}return t.push({t:R.EOF}),t}function jt(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return t.type==="element"&&typeof t.typeName=="string"&&typeof t.props=="object"&&t.props!==null&&typeof t.partial=="boolean"}var ru;(function(e){e.ContinueConversation="continue_conversation",e.OpenUrl="open_url"})(ru||(ru={}));var Fm={},Um=[];function Xo(e){return Array.isArray(e)?"array":typeof e}function ou(e){return typeof e.$ref=="string"?e.$ref.split("/").pop():void 0}function au(e){return"$ref"in e||"anyOf"in e||"oneOf"in e||"allOf"in e}function iu(e){if(Array.isArray(e.enum))return{enumValues:e.enum};if("const"in e)return{enumValues:[e.const]};switch(e.type){case"string":return{expectedType:"string"};case"number":case"integer":return{expectedType:"number"};case"boolean":return{expectedType:"boolean"};default:return{}}}function Jo(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e.default}function ji(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e,n=ou(t);if(n)return n;let r=iu(t);return r.enumValues?r.enumValues.map(o=>JSON.stringify(o)).join("|"):r.expectedType?r.expectedType:typeof t.type=="string"?t.type:void 0}function Vi(e,t){let n=t.map(r=>{let o=ji(r.schema),a=r.required?`${r.name}*`:r.name;return o?`${a}: ${o}`:a}).join(", ");return`${e}(${n})`}function qm(e,t){let n=typeof e;return t.enumValues?t.enumValues.includes(e)?null:{expected:`one of [${t.enumValues.map(r=>JSON.stringify(r)).join(", ")}]`,actual:Xo(e)}:t.expectedType&&t.expectedType!==n?{expected:t.expectedType,actual:Xo(e)}:null}function zm(e,t,n){switch(n.code){case"type-mismatch":return`field "${t}" expects ${n.expected} but got ${n.actual}`;case"pruned-value":return`field "${t}" lost an unresolved or invalid value`;case"missing-required":return`missing required field "${t}"${n.signature?` \u2014 signature: ${n.signature}`:""}`;case"null-required":return`required field "${t}" cannot be null${n.signature?` \u2014 signature: ${n.signature}`:""}`;case"unknown-component":return`Unknown component "${e}" \u2014 not found in catalog or builtins${n.available?.length?`. Available components: ${n.available.join(", ")}`:""}`;case"inline-reserved":return`${e}() must be declared as a top-level statement, not used inline as a value`;case"excess-args":return`${e} takes ${n.declared} arg(s), got ${n.got} (${n.got-n.declared} excess dropped)`;case"unknown-function":return`Unknown function "@${e}": not a built-in or action step. The call evaluates to null`;case"no-root":return n.reason==="not-component"?"root does not evaluate to a component":n.reason==="fallback"?`No root statement. Rendering the first statement that calls the root component ${e}`:e?`No root statement, and no statement calls the root component ${e}`:"No root statement"}}function Fe(e,t,n,r){e.errors.push({code:r.code,component:t,path:n,message:zm(t,n,r),statementId:e.currentStatementId,...r.code==="no-root"&&r.reason==="fallback"&&{severity:"warning"}})}var bt=Symbol("invalid");function Zo(e,t){return t!==void 0?t:e?bt:void 0}function Hm(e,t,n,r,o){return au(t)?!1:typeof t.type=="string"||Array.isArray(t.enum)||"const"in t?(Fe(o,n,r,{code:"type-mismatch",expected:typeof t.type=="string"?t.type:"a literal value",actual:`component "${e.typeName}"`}),!0):!1}function su(e){return(e.anyOf??e.oneOf??[e]).map(ou)}function jm(e,t){let n=su(e);return n.length>0&&n.every(r=>r!==void 0&&t.cat?.has(r))}function Vm(e,t,n,r,o){if(typeof e!="object"||Array.isArray(e))return Fe(o,n,r,{code:"type-mismatch",expected:"object",actual:Xo(e)}),bt;let a=e,i,s=t.properties&&typeof t.properties=="object"?t.properties:Fm,c=Array.isArray(t.required)?t.required:Um,p=!1;if(!o.partial)for(let d of c){let _=d in a;if(!_||a[d]==null){let u=Jo(s[d]);if(u!==void 0){(i??(i={...a}))[d]=u;continue}Fe(o,n,`${r}/${d}`,{code:_?"null-required":"missing-required"}),p=!0}}for(let d of Object.keys(s)){if(!(d in a))continue;let _=s[d],u=qr(a[d],_,n,`${r}/${d}`,o);if(u===bt&&(u=Zo(c.includes(d),Jo(_)),u===bt)){p=!0;continue}u!==a[d]&&(i??(i={...a}),u===void 0?delete i[d]:i[d]=u)}return p?bt:i??a}function Wm(e,t,n,r,o){if(!Array.isArray(e))return Fe(o,n,r,{code:"type-mismatch",expected:"array",actual:Xo(e)}),bt;let a=t.items;if(!a||typeof a!="object"||Array.isArray(a))return e;let i;for(let s=0;s<e.length;s++){let c=qr(e[s],a,n,`${r}/${s}`,o);c!==e[s]&&!i&&(i=e.slice(0,s)),i&&c!==bt&&i.push(c)}return i??e}function Gm(e,t,n,r,o){let a=iu(t);if(a.expectedType==null&&a.enumValues==null||a.enumValues&&o.partial)return!1;let i=qm(e,a);return i?(Fe(o,n,r,{code:"type-mismatch",...i}),!0):!1}function qr(e,t,n,r,o){if(!t||typeof t!="object"||Array.isArray(t))return e;let a=t;if(e==null||Cn(e))return e;if(jt(e))return Hm(e,a,n,r,o)?bt:e;if(au(a))return jm(a,o)?(Fe(o,n,r,{code:"type-mismatch",expected:su(a).join(" | "),actual:Array.isArray(e)?"array":typeof e=="object"?"plain object":typeof e}),bt):e;let i=a.type;return i==="object"?Vm(e,a,n,r,o):i==="array"?Wm(e,a,n,r,o):Gm(e,a,n,r,o)?bt:e}function ea(e){if(e==null||typeof e!="object")return!1;if(Cn(e))return!0;if(Array.isArray(e))return e.some(ea);if(jt(e))return Object.values(e.props).some(ea);let t=e;return Array.isArray(t.steps)?!0:Object.values(t).some(ea)}function lu(e,t,n){if(t.visited.has(e))return t.unres.push(e),n==="expr"?{k:"Ph",n:e}:null;if(!t.syms.has(e))return t.unres.push(e),n==="expr"?{k:"Ph",n:e}:null;let r=t.syms.get(e);if(t.unreached?.delete(e),r.k==="Comp"&&er(r.name)){let a=r.name===dn.Mutation?"mutation":"query";return{k:"RuntimeRef",n:e,refType:a}}t.visited.add(e);let o=t.currentStatementId;t.currentStatementId=e;try{let a=n==="value"?Rn(r,t):Wi(r,t);return n==="value"&&jt(a)&&(a.statementId=e),a}finally{t.currentStatementId=o,t.visited.delete(e)}}function ta(e,t){return Br(t.cat).has(e)||er(e)}function Gi(e,t){let n={};for(let r=0;r<t.length&&r<e.length;r++)n[t[r].name]=e[r];return n}function cu(e,t,n,r){let{params:o}=n;t.length>o.length&&Fe(r,e,"",{code:"excess-args",declared:o.length,got:t.length});let a=Gi(t,o),i=!1,s=r.errors.length;for(let c of o){let p=a[c.name],d=p?Wo(p):{v:void 0};if(!d)continue;if(d.v==null){if(!c.required||c.defaultValue!==void 0)continue;Fe(r,e,`/${c.name}`,{code:p?"null-required":"missing-required",signature:Vi(e,o)}),i=!0;continue}let _=qr(d.v,c.schema,e,`/${c.name}`,r);_===bt&&(_=Zo(c.required,c.defaultValue)),_===bt?i=!0:_===void 0?delete a[c.name]:_!==d.v&&(a[c.name]=Vo(_))}return n.kind==="action"&&r.errors.length>s&&(i=!0),i?null:a}function uu(e,t,n){let r=e.args.map(n),o=Br(t.cat).get(e.name);if(!o||o.lazy)return{...e,args:r};let a=o.builtin?Gi(r,o.params):cu(e.name,r,o,t);return a?{...e,args:r,mappedProps:a}:o.kind==="action"?{k:"Comp",name:"Action",args:[{k:"Arr",els:[]}]}:{k:"Null"}}function Ki(e,t,n){let r=t.currentStatementId;t.currentStatementId=n;let o=new Set;for(let a of e)Dr(a,i=>{if(i.k!=="Comp"||o.has(i))return;o.add(i);let s=Br(t.cat).get(i.name);if(!s||s.lazy)return;let c=s.builtin?null:cu(i.name,i.args,s,t);i.mappedProps=c??Gi(i.args,s.params)});t.currentStatementId=r}function du(e,t,n){let r=Br(t.cat).get(e.name);if(r?.kind!=="function"||!r.lazy||e.args.length<3)return null;let o=e.args[1],a=o.k==="Ref"?o.n:o.k==="Str"?o.v:null;if(!a)return null;let i=new Set(n);i.add(a);let s=e.args.map((c,p)=>p===1?c:yt(c,t,i));return{...e,args:s}}function yt(e,t,n){switch(e.k){case"Ref":return n.has(e.n)?e:lu(e.n,t,"expr");case"Ph":return e;case"Comp":{if(e.fn&&!ta(e.name,t))return Fe(t,e.name,"",{code:"unknown-function"}),{k:"Null"};let r=du(e,t,n);if(r)return r;if(ta(e.name,t))return uu(e,t,i=>yt(i,t,n));let o=e.args.map(i=>yt(i,t,n)),a=t.cat?.get(e.name);if(a){let i={};for(let s=0;s<a.params.length&&s<o.length;s++)i[a.params[s].name]=o[s];return{...e,args:o,mappedProps:i}}return Fe(t,e.name,"",{code:"unknown-component",available:t.cat&&[...t.cat.keys()]}),{...e,args:o}}case"Arr":return{...e,els:e.els.map(r=>yt(r,t,n))};case"Obj":return{...e,entries:e.entries.map(([r,o])=>[r,yt(o,t,n)])};case"BinOp":return{...e,left:yt(e.left,t,n),right:yt(e.right,t,n)};case"UnaryOp":return{...e,operand:yt(e.operand,t,n)};case"Ternary":return{...e,cond:yt(e.cond,t,n),then:yt(e.then,t,n),else:yt(e.else,t,n)};case"Member":return{...e,obj:yt(e.obj,t,n)};case"Index":return{...e,obj:yt(e.obj,t,n),index:yt(e.index,t,n)};case"Assign":return{...e,value:yt(e.value,t,n)};default:return e}}function Wi(e,t){return yt(e,t,new Set)}function Rn(e,t){switch(e.k){case"Ref":return lu(e.n,t,"value");case"Str":return e.v;case"Num":return e.v;case"Bool":return e.v;case"Null":return null;case"Ph":return null;case"Arr":{let n=[];for(let r of e.els){if(r.k==="Ph"){t.prunedValues++;continue}let o=Rn(r,t);if(o===null&&(r.k==="Comp"||r.k==="Ref")){t.prunedValues++;continue}n.push(o)}return n}case"Obj":{let n={};for(let[r,o]of e.entries)n[r]=Rn(o,t);return n}case"Comp":{let{name:n,args:r}=e;if(e.fn&&!ta(n,t))return Fe(t,n,"",{code:"unknown-function"}),null;if(er(n))return Fe(t,n,"",{code:"inline-reserved"}),null;if(ta(n,t)){let s=du(e,t,new Set);return s||uu(e,t,c=>Wi(c,t))}let o=t.cat?.get(n),a={};if(o){let s=!1;for(let p=0;p<o.params.length&&p<r.length;p++){let d=o.params[p],_=t.prunedValues,u=Rn(r[p],t);if(t.prunedValues>_&&Fe(t,n,`/${d.name}`,{code:"pruned-value"}),a[d.name]=u,d.schema===void 0)continue;if(u==null&&d.defaultValue!==void 0){Fe(t,n,`/${d.name}`,{code:"type-mismatch",expected:ji(d.schema)??"a defined value",actual:u===null?"null":"undefined"}),a[d.name]=d.defaultValue,t.prunedValues=_;continue}let f=qr(u,d.schema,n,`/${d.name}`,t);f===bt&&(f=Zo(d.required,d.defaultValue),d.defaultValue!==void 0&&(t.prunedValues=_),f===bt?s=!0:f===void 0&&delete a[d.name]),f!==bt&&f!==void 0&&(a[d.name]=f)}r.length>o.params.length&&Fe(t,n,"",{code:"excess-args",declared:o.params.length,got:r.length});let c=o.params.filter(p=>p.required&&(!(p.name in a)||a[p.name]===null));if(c.length){let p=c.filter(d=>d.defaultValue!==void 0?(Fe(t,n,`/${d.name}`,{code:d.name in a?"null-required":"missing-required"}),a[d.name]=d.defaultValue,!1):!0);if(p.length){for(let d of p)Fe(t,n,`/${d.name}`,{code:d.name in a?"null-required":"missing-required",signature:Vi(n,o.params)});return null}}if(s)return null}else return Fe(t,n,"",{code:"unknown-component",available:t.cat&&[...t.cat.keys()]}),null;let i=Object.values(a).some(s=>ea(s));return{type:"element",typeName:n,props:a,partial:t.partial,hasDynamicProps:i}}default:return Jc(e)?Wi(e,t):e}}function Qi(e){let t=[],n=!1,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(r){r=!1;continue}if(s==="\\"&&n){r=!0;continue}if(n){s===n&&(n=!1);continue}if(s==='"'||s==="'"){n=s;continue}s==="("||s==="["||s==="{"?t.push(s):(s===")"&&t[t.length-1]==="("||s==="]"&&t[t.length-1]==="["||s==="}"&&t[t.length-1]==="{")&&t.pop()}if(!(!!n||t.length>0))return{text:e,wasIncomplete:!1};let a=e;n&&(r&&(a+="\\"),a+=n);for(let i=t.length-1;i>=0;i--)a+=t[i]==="("?")":t[i]==="["?"]":"}";return{text:a,wasIncomplete:!0}}function na(e){let t=[],n=0;for(;n<e.length;){for(;n<e.length&&e[n].t===R.Newline;)n++;if(n>=e.length||e[n].t===R.EOF)break;let r=e[n];if(r.t!==R.Ident&&r.t!==R.Type&&r.t!==R.StateVar){for(;n<e.length&&e[n].t!==R.Newline&&e[n].t!==R.EOF;)n++;continue}let o=r.v,a=r.t;if(n++,n>=e.length||e[n].t!==R.Equals){for(;n<e.length&&e[n].t!==R.Newline&&e[n].t!==R.EOF;)n++;continue}n++;let i=[],s=0,c=0;for(;n<e.length&&e[n].t!==R.EOF;){let p=e[n].t;if(p===R.Newline&&s<=0&&c<=0){let d=n+1;for(;d<e.length&&e[d].t===R.Newline;)d++;let _=d<e.length?e[d].t:R.EOF;if(_===R.Question||_===R.Colon&&c>0){n++;continue}break}if(p===R.Newline){n++;continue}p===R.LParen||p===R.LBrack||p===R.LBrace?s++:(p===R.RParen||p===R.RBrack||p===R.RBrace)&&s>0?s--:p===R.Question&&s===0?c++:p===R.Colon&&s===0&&c>0&&c--,i.push(e[n++])}i.length&&t.push({id:o,idTokenType:a,tokens:i})}return t}function oa(e=!0){return{root:null,meta:{incomplete:e,unresolved:[],orphaned:[],statementCount:0,errors:[]},stateDeclarations:{},queryStatements:[],mutationStatements:[]}}function fu(e){if(!Cn(e))return[];let t=new Set;return Dr(e,n=>{n.k==="StateRef"&&t.add(n.n)}),[...t]}function Xi(e,t){if(t.k==="Comp"&&t.name===dn.Query){let n=fu(t.args[1]);return{kind:"query",id:e.id,call:{callee:dn.Query,args:t.args},expr:t,deps:n.length>0?n:void 0}}return t.k==="Comp"&&t.name===dn.Mutation?{kind:"mutation",id:e.id,call:{callee:dn.Mutation,args:t.args},expr:t}:e.idTokenType===R.StateVar?{kind:"state",id:e.id,init:t}:{kind:"value",id:e.id,expr:t}}function Km(e,t,n){let r={},o=[],a=[];for(let i of e)switch(i.kind){case"state":r[i.id]=Rn(i.init,t);break;case"query":Ki(i.call.args,t,i.id),o.push({statementId:i.id,toolAST:i.call.args[0]??null,argsAST:i.call.args[1]??null,defaultsAST:i.call.args[2]??null,refreshAST:i.call.args[3]??null,deps:i.deps,complete:!0});break;case"mutation":Ki(i.call.args,t,i.id),a.push({statementId:i.id,toolAST:i.call.args[0]??null,argsAST:i.call.args[1]??null});break}for(let i of e){let s=i.kind==="state"?[i.init]:i.kind==="value"?[i.expr]:i.kind==="query"||i.kind==="mutation"?i.call.args:[];for(let c of s)for(let p of fu(c))p===n?.name&&n.stmts.has(i)||p in r||(r[p]=null)}return{stateDeclarations:r,queryStatements:o,mutationStatements:a}}var pu="root";function Zi(e){return e?.k==="Comp"&&!e.fn&&!Fr(e.name)&&!er(e.name)}function Qm(e,t){if(e.has(pu))return{id:pu,fallback:!1};for(let n of e.values())if(n.kind==="value"&&Zi(n.expr)&&n.expr.name===t)return{id:n.id,fallback:!0};return null}function Ym(e,t){let n=new Set;for(;e?.k==="Ref"&&!n.has(e.n);)n.add(e.n),e=t.get(e.n);return Zi(e)}function Xm(e){let t=!1;return Dr(e,n=>{Zi(n)&&(t=!0)}),t}function ra(e,t,n,r,o,a,i){let s=Qm(e,a),c=new Map;for(let[g,v]of e)c.set(g,v.kind==="state"?v.init:v.expr);let p=[],d=[],_=new Set;for(let[g,v]of e)g!==s?.id&&(v.kind==="state"||v.kind==="query"||v.kind==="mutation"||_.add(g));let u={syms:c,cat:o,errors:d,unres:p,prunedValues:0,visited:new Set,partial:n,currentStatementId:s?.id,unreached:_},f=null,m;if(s){let g=Rn(c.get(s.id),u);jt(g)?(f=g,f.statementId=s.id):Cn(g)&&Xm(g)&&(m=g)}let{stateDeclarations:h,queryStatements:y,mutationStatements:x}=Km(t,u,i);u.currentStatementId=s?.id;let S=a??"";s?!f&&!m&&!Ym(c.get(s.id),c)?Fe(u,S,"",{code:"no-root",reason:"not-component"}):s.fallback&&Fe(u,S,"",{code:"no-root",reason:f?"fallback":"missing"}):Fe(u,S,"",{code:"no-root",reason:"missing"});let w=s?[..._]:[];return{root:f,...m?{rootExpression:m}:{},meta:{incomplete:n,unresolved:p,orphaned:w,statementCount:r,errors:d},stateDeclarations:h,queryStatements:y,mutationStatements:x}}function _u(e,t){if(e[t]!=='"')return t;let n=t+1;for(;n<e.length;){let r=e[n];if(r==="\\")n+=2;else{if(r==='"')return n+1;n++}}return n}function Jm(e){let t=[],n=0;for(;n<e.length;){let r=-1;for(;n<e.length;){let s=_u(e,n);if(s>n){n=s;continue}if(e[n]==="`"&&n+1<e.length&&e[n+1]==="`"&&n+2<e.length&&e[n+2]==="`"){r=n;break}n++}if(r===-1)break;let o=r+3;for(;o<e.length&&e[o]!==`
38
- `;)o++;if(o>=e.length){t.push(e.slice(r+3).replace(/^[^\n]*\n?/,"")),n=e.length;break}o++;let a=-1,i=o;for(;i<e.length;){let s=_u(e,i);if(s>i){i=s;continue}if(e[i]==="`"&&i+1<e.length&&e[i+1]==="`"&&i+2<e.length&&e[i+2]==="`"){a=i;break}i++}a!==-1?(t.push(e.slice(o,a)),n=a+3):(t.push(e.slice(o)),n=e.length)}if(t.length>0)return t.join(`
33
+ `){ke(e),Ce(e,o),e.pending=n;continue}}else{if(i===n){ke(e),Ce(e,a),Ce(e,o),e.pending="";continue}if(n!==" "&&n!==`
34
+ `){ke(e),Ce(e,a),e.pending=n;continue}}break}case"~":if(e.token!==19&&e.token!==16){if(e.pending==="~"){if(n==="~"){e.pending=r;continue}}else if(n!==" "&&n!==`
35
+ `){ke(e),Ce(e,16),e.pending=n;continue}}break;case"$":if(e.token!==19&&e.token!==16&&e.pending==="$")if(n==="$"){e.token=105,e.pending=r;continue}else{if(hg(n.charCodeAt(0)))break;ke(e),Ce(e,31),e.pending=n;continue}break;case"[":if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n!=="]"){ke(e),Ce(e,17),e.pending=n;continue}break;case"!":if(e.token!==19&&n==="["){ke(e),Ce(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}ke(e)}function Ur(e){return{add_token:vg,end_token:Yi,add_text:Zi,set_attr:es,data:{nodes:[e,,,,,],index:0}}}function vg(e,t){let n=e.nodes[e.index],r;switch(t){case 1:return;case 20:r=document.createElement("blockquote");break;case 2:r=document.createElement("p");break;case 21:r=document.createElement("br");break;case 22:r=document.createElement("hr");break;case 3:r=document.createElement("h1");break;case 4:r=document.createElement("h2");break;case 5:r=document.createElement("h3");break;case 6:r=document.createElement("h4");break;case 7:r=document.createElement("h5");break;case 8:r=document.createElement("h6");break;case 12:case 13:r=document.createElement("em");break;case 14:case 15:r=document.createElement("strong");break;case 16:r=document.createElement("s");break;case 11:r=document.createElement("code");break;case 18:case 17:r=document.createElement("a");break;case 19:r=document.createElement("img");break;case 23:r=document.createElement("ul");break;case 24:r=document.createElement("ol");break;case 25:r=document.createElement("li");break;case 26:let o=r=document.createElement("input");o.type="checkbox",o.disabled=!0;break;case 9:case 10:n=n.appendChild(document.createElement("pre")),r=document.createElement("code");break;case 27:r=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]}r=document.createElement("tr");break;case 29:r=document.createElement(n.parentElement?.tagName==="THEAD"?"th":"td");break;case 30:r=document.createElement("equation-block");break;case 31:r=document.createElement("equation-inline");break}e.nodes[++e.index]=n.appendChild(r)}function Yi(e){e.index-=1}function Zi(e,t){e.nodes[e.index].appendChild(document.createTextNode(t))}function es(e,t,n){e.nodes[e.index].setAttribute(pg(t),n)}var or={root:"Root",schema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{Root:{$ref:"#/$defs/Root"},Grid:{$ref:"#/$defs/Grid"},Cell:{$ref:"#/$defs/Cell"},Text:{$ref:"#/$defs/Text"},Card:{$ref:"#/$defs/Card"},Metric:{$ref:"#/$defs/Metric"},Table:{$ref:"#/$defs/Table"},Chart:{$ref:"#/$defs/Chart"}},required:["Root","Grid","Cell","Text","Card","Metric","Table","Chart"],additionalProperties:!1,$defs:{Root:{type:"object",properties:{children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Grid"},{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}}},required:["children"],additionalProperties:!1},Grid:{type:"object",properties:{columns:{type:"integer",enum:[1,2,3,4],default:1},children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Cell"},{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}}},required:["columns","children"],additionalProperties:!1},Cell:{type:"object",properties:{children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}},span:{type:"integer",enum:[1,2,3,4],default:1}},required:["children"],additionalProperties:!1},Text:{type:"object",properties:{text:{type:"string"}},required:["text"],additionalProperties:!1},Card:{type:"object",properties:{title:{type:"string"},body:{type:"string"}},required:["title","body"],additionalProperties:!1},Metric:{type:"object",properties:{label:{type:"string"},value:{type:"string"},detail:{type:"string"}},required:["label","value","detail"],additionalProperties:!1},Table:{type:"object",properties:{title:{type:"string"},columns:{type:"array",items:{type:"string"}},rows:{type:"array",items:{type:"array",items:{type:"string"}}}},required:["title","columns","rows"],additionalProperties:!1},Chart:{type:"object",properties:{title:{type:"string"},type:{type:"string",enum:["bar","line"]},data:{type:"array",items:{type:"object",properties:{label:{type:"string"},value:{type:"number"}},required:["label","value"],additionalProperties:!1}}},required:["title","type","data"],additionalProperties:!1}}}};var Pu=qr;var bg={type:"object",properties:{typeName:{const:"Grid"},statementId:{type:"string"},props:{type:"object",properties:{columns:{type:"integer",enum:[1,2,3,4],default:1},children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Cell"},{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}}},required:["columns","children"],additionalProperties:!1}},required:["typeName","statementId","props"]},yg={type:"object",properties:{typeName:{const:"Cell"},statementId:{type:"string"},props:{type:"object",properties:{children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}},span:{type:"integer",enum:[1,2,3,4],default:1}},required:["children"],additionalProperties:!1}},required:["typeName","statementId","props"]};function et(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=et.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let _;if(e.typeName===void 0&&(_="typeName")||e.statementId===void 0&&(_="statementId")||e.props===void 0&&(_="props"))return et.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:_}}],!1;if(e.typeName!==void 0){let d=s;if(e.typeName!=="Text")return et.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Text"}}],!1;var p=d===s}else var p=!0;if(p){if(e.statementId!==void 0){let d=s;if(typeof e.statementId!="string")return et.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=d===s}else var p=!0;if(p)if(e.props!==void 0){let d=e.props,u=s;if(s===u)if(d&&typeof d=="object"&&!Array.isArray(d)){let m;if(d.text===void 0&&(m="text"))return et.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:m}}],!1;{let v=s;for(let P in d)if(P!=="text"){return et.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:P}}],!1;break}if(v===s&&d.text!==void 0&&typeof d.text!="string")return et.errors=[{instancePath:t+"/props/text",schemaPath:"#/properties/props/properties/text/type",keyword:"type",params:{type:"string"}}],!1}}else return et.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=u===s}else var p=!0}}else return et.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return et.errors=i,s===0}et.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function Ke(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=Ke.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let d;if(e.typeName===void 0&&(d="typeName")||e.statementId===void 0&&(d="statementId")||e.props===void 0&&(d="props"))return Ke.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:d}}],!1;if(e.typeName!==void 0){let u=s;if(e.typeName!=="Card")return Ke.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Card"}}],!1;var p=u===s}else var p=!0;if(p){if(e.statementId!==void 0){let u=s;if(typeof e.statementId!="string")return Ke.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=u===s}else var p=!0;if(p)if(e.props!==void 0){let u=e.props,f=s;if(s===f)if(u&&typeof u=="object"&&!Array.isArray(u)){let v;if(u.title===void 0&&(v="title")||u.body===void 0&&(v="body"))return Ke.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:v}}],!1;{let P=s;for(let x in u)if(!(x==="title"||x==="body")){return Ke.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:x}}],!1;break}if(P===s){if(u.title!==void 0){let x=s;if(typeof u.title!="string")return Ke.errors=[{instancePath:t+"/props/title",schemaPath:"#/properties/props/properties/title/type",keyword:"type",params:{type:"string"}}],!1;var _=x===s}else var _=!0;if(_)if(u.body!==void 0){let x=s;if(typeof u.body!="string")return Ke.errors=[{instancePath:t+"/props/body",schemaPath:"#/properties/props/properties/body/type",keyword:"type",params:{type:"string"}}],!1;var _=x===s}else var _=!0}}}else return Ke.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=f===s}else var p=!0}}else return Ke.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return Ke.errors=i,s===0}Ke.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function He(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=He.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let d;if(e.typeName===void 0&&(d="typeName")||e.statementId===void 0&&(d="statementId")||e.props===void 0&&(d="props"))return He.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:d}}],!1;if(e.typeName!==void 0){let u=s;if(e.typeName!=="Metric")return He.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Metric"}}],!1;var p=u===s}else var p=!0;if(p){if(e.statementId!==void 0){let u=s;if(typeof e.statementId!="string")return He.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=u===s}else var p=!0;if(p)if(e.props!==void 0){let u=e.props,f=s;if(s===f)if(u&&typeof u=="object"&&!Array.isArray(u)){let v;if(u.label===void 0&&(v="label")||u.value===void 0&&(v="value")||u.detail===void 0&&(v="detail"))return He.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:v}}],!1;{let P=s;for(let x in u)if(!(x==="label"||x==="value"||x==="detail")){return He.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:x}}],!1;break}if(P===s){if(u.label!==void 0){let x=s;if(typeof u.label!="string")return He.errors=[{instancePath:t+"/props/label",schemaPath:"#/properties/props/properties/label/type",keyword:"type",params:{type:"string"}}],!1;var _=x===s}else var _=!0;if(_){if(u.value!==void 0){let x=s;if(typeof u.value!="string")return He.errors=[{instancePath:t+"/props/value",schemaPath:"#/properties/props/properties/value/type",keyword:"type",params:{type:"string"}}],!1;var _=x===s}else var _=!0;if(_)if(u.detail!==void 0){let x=s;if(typeof u.detail!="string")return He.errors=[{instancePath:t+"/props/detail",schemaPath:"#/properties/props/properties/detail/type",keyword:"type",params:{type:"string"}}],!1;var _=x===s}else var _=!0}}}}else return He.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=f===s}else var p=!0}}else return He.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return He.errors=i,s===0}He.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function Me(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=Me.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let m;if(e.typeName===void 0&&(m="typeName")||e.statementId===void 0&&(m="statementId")||e.props===void 0&&(m="props"))return Me.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:m}}],!1;if(e.typeName!==void 0){let v=s;if(e.typeName!=="Table")return Me.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Table"}}],!1;var p=v===s}else var p=!0;if(p){if(e.statementId!==void 0){let v=s;if(typeof e.statementId!="string")return Me.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=v===s}else var p=!0;if(p)if(e.props!==void 0){let v=e.props,P=s;if(s===P)if(v&&typeof v=="object"&&!Array.isArray(v)){let k;if(v.title===void 0&&(k="title")||v.columns===void 0&&(k="columns")||v.rows===void 0&&(k="rows"))return Me.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:k}}],!1;{let T=s;for(let h in v)if(!(h==="title"||h==="columns"||h==="rows")){return Me.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:h}}],!1;break}if(T===s){if(v.title!==void 0){let h=s;if(typeof v.title!="string")return Me.errors=[{instancePath:t+"/props/title",schemaPath:"#/properties/props/properties/title/type",keyword:"type",params:{type:"string"}}],!1;var _=h===s}else var _=!0;if(_){if(v.columns!==void 0){let h=v.columns,g=s;if(s===g)if(Array.isArray(h)){var d=!0;let w=h.length;for(let C=0;C<w;C++){let A=s;if(typeof h[C]!="string")return Me.errors=[{instancePath:t+"/props/columns/"+C,schemaPath:"#/properties/props/properties/columns/items/type",keyword:"type",params:{type:"string"}}],!1;var d=A===s;if(!d)break}}else return Me.errors=[{instancePath:t+"/props/columns",schemaPath:"#/properties/props/properties/columns/type",keyword:"type",params:{type:"array"}}],!1;var _=g===s}else var _=!0;if(_)if(v.rows!==void 0){let h=v.rows,g=s;if(s===g)if(Array.isArray(h)){var u=!0;let w=h.length;for(let C=0;C<w;C++){let A=h[C],E=s;if(s===E)if(Array.isArray(A)){var f=!0;let O=A.length;for(let j=0;j<O;j++){let W=s;if(typeof A[j]!="string")return Me.errors=[{instancePath:t+"/props/rows/"+C+"/"+j,schemaPath:"#/properties/props/properties/rows/items/items/type",keyword:"type",params:{type:"string"}}],!1;var f=W===s;if(!f)break}}else return Me.errors=[{instancePath:t+"/props/rows/"+C,schemaPath:"#/properties/props/properties/rows/items/type",keyword:"type",params:{type:"array"}}],!1;var u=E===s;if(!u)break}}else return Me.errors=[{instancePath:t+"/props/rows",schemaPath:"#/properties/props/properties/rows/type",keyword:"type",params:{type:"array"}}],!1;var _=g===s}else var _=!0}}}}else return Me.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=P===s}else var p=!0}}else return Me.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return Me.errors=i,s===0}Me.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};var Pg={type:"object",properties:{typeName:{const:"Chart"},statementId:{type:"string"},props:{type:"object",properties:{title:{type:"string"},type:{type:"string",enum:["bar","line"]},data:{type:"array",items:{type:"object",properties:{label:{type:"string"},value:{type:"number"}},required:["label","value"],additionalProperties:!1}}},required:["title","type","data"],additionalProperties:!1}},required:["typeName","statementId","props"]};function Ie(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=Ie.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let f;if(e.typeName===void 0&&(f="typeName")||e.statementId===void 0&&(f="statementId")||e.props===void 0&&(f="props"))return Ie.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:f}}],!1;if(e.typeName!==void 0){let m=s;if(e.typeName!=="Chart")return Ie.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Chart"}}],!1;var p=m===s}else var p=!0;if(p){if(e.statementId!==void 0){let m=s;if(typeof e.statementId!="string")return Ie.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=m===s}else var p=!0;if(p)if(e.props!==void 0){let m=e.props,v=s;if(s===v)if(m&&typeof m=="object"&&!Array.isArray(m)){let x;if(m.title===void 0&&(x="title")||m.type===void 0&&(x="type")||m.data===void 0&&(x="data"))return Ie.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:x}}],!1;{let k=s;for(let T in m)if(!(T==="title"||T==="type"||T==="data")){return Ie.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:T}}],!1;break}if(k===s){if(m.title!==void 0){let T=s;if(typeof m.title!="string")return Ie.errors=[{instancePath:t+"/props/title",schemaPath:"#/properties/props/properties/title/type",keyword:"type",params:{type:"string"}}],!1;var _=T===s}else var _=!0;if(_){if(m.type!==void 0){let T=m.type,h=s;if(typeof T!="string")return Ie.errors=[{instancePath:t+"/props/type",schemaPath:"#/properties/props/properties/type/type",keyword:"type",params:{type:"string"}}],!1;if(!(T==="bar"||T==="line"))return Ie.errors=[{instancePath:t+"/props/type",schemaPath:"#/properties/props/properties/type/enum",keyword:"enum",params:{allowedValues:Pg.properties.props.properties.type.enum}}],!1;var _=h===s}else var _=!0;if(_)if(m.data!==void 0){let T=m.data,h=s;if(s===h)if(Array.isArray(T)){var d=!0;let S=T.length;for(let w=0;w<S;w++){let C=T[w],A=s;if(s===A)if(C&&typeof C=="object"&&!Array.isArray(C)){let N;if(C.label===void 0&&(N="label")||C.value===void 0&&(N="value"))return Ie.errors=[{instancePath:t+"/props/data/"+w,schemaPath:"#/properties/props/properties/data/items/required",keyword:"required",params:{missingProperty:N}}],!1;{let O=s;for(let j in C)if(!(j==="label"||j==="value")){return Ie.errors=[{instancePath:t+"/props/data/"+w,schemaPath:"#/properties/props/properties/data/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:j}}],!1;break}if(O===s){if(C.label!==void 0){let j=s;if(typeof C.label!="string")return Ie.errors=[{instancePath:t+"/props/data/"+w+"/label",schemaPath:"#/properties/props/properties/data/items/properties/label/type",keyword:"type",params:{type:"string"}}],!1;var u=j===s}else var u=!0;if(u)if(C.value!==void 0){let j=C.value,W=s;if(!(typeof j=="number"&&isFinite(j)))return Ie.errors=[{instancePath:t+"/props/data/"+w+"/value",schemaPath:"#/properties/props/properties/data/items/properties/value/type",keyword:"type",params:{type:"number"}}],!1;var u=W===s}else var u=!0}}}else return Ie.errors=[{instancePath:t+"/props/data/"+w,schemaPath:"#/properties/props/properties/data/items/type",keyword:"type",params:{type:"object"}}],!1;var d=A===s;if(!d)break}}else return Ie.errors=[{instancePath:t+"/props/data",schemaPath:"#/properties/props/properties/data/type",keyword:"type",params:{type:"array"}}],!1;var _=h===s}else var _=!0}}}}else return Ie.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=v===s}else var p=!0}}else return Ie.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return Ie.errors=i,s===0}Ie.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function Ze(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=Ze.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let m;if(e.typeName===void 0&&(m="typeName")||e.statementId===void 0&&(m="statementId")||e.props===void 0&&(m="props"))return Ze.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:m}}],!1;if(e.typeName!==void 0){let v=s;if(e.typeName!=="Cell")return Ze.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Cell"}}],!1;var p=v===s}else var p=!0;if(p){if(e.statementId!==void 0){let v=s;if(typeof e.statementId!="string")return Ze.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=v===s}else var p=!0;if(p)if(e.props!==void 0){let v=e.props,P=s;if(s===P)if(v&&typeof v=="object"&&!Array.isArray(v)){let k;if(v.children===void 0&&(k="children"))return Ze.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:k}}],!1;{let T=s;for(let h in v)if(!(h==="children"||h==="span")){return Ze.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:h}}],!1;break}if(T===s){if(v.children!==void 0){let h=v.children,g=s;if(s===g)if(Array.isArray(h)){var _=!0;let S=h.length;for(let w=0;w<S;w++){let C=h[w],A=s,E=s,N=!1,O=s;et(C,{instancePath:t+"/props/children/"+w,parentData:h,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?et.errors:i.concat(et.errors),s=i.length);var u=O===s;if(N=N||u,u){var d={};d.typeName=!0,d.statementId=!0,d.props=!0}let j=s;Ke(C,{instancePath:t+"/props/children/"+w,parentData:h,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?Ke.errors:i.concat(Ke.errors),s=i.length);var u=j===s;N=N||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0);let W=s;He(C,{instancePath:t+"/props/children/"+w,parentData:h,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?He.errors:i.concat(He.errors),s=i.length);var u=W===s;N=N||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0);let z=s;Me(C,{instancePath:t+"/props/children/"+w,parentData:h,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?Me.errors:i.concat(Me.errors),s=i.length);var u=z===s;N=N||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0);let J=s;Ie(C,{instancePath:t+"/props/children/"+w,parentData:h,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?Ie.errors:i.concat(Ie.errors),s=i.length);var u=J===s;if(N=N||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0),N)s=E,i!==null&&(E?i.length=E:i=null);else{let ie={instancePath:t+"/props/children/"+w,schemaPath:"#/properties/props/properties/children/items/anyOf",keyword:"anyOf",params:{}};return i===null?i=[ie]:i.push(ie),s++,Ze.errors=i,!1}var _=A===s;if(!_)break}}else return Ze.errors=[{instancePath:t+"/props/children",schemaPath:"#/properties/props/properties/children/type",keyword:"type",params:{type:"array"}}],!1;var f=g===s}else var f=!0;if(f)if(v.span!==void 0){let h=v.span,g=s;if(!(typeof h=="number"&&!(h%1)&&!isNaN(h)&&isFinite(h)))return Ze.errors=[{instancePath:t+"/props/span",schemaPath:"#/properties/props/properties/span/type",keyword:"type",params:{type:"integer"}}],!1;if(!(h===1||h===2||h===3||h===4))return Ze.errors=[{instancePath:t+"/props/span",schemaPath:"#/properties/props/properties/span/enum",keyword:"enum",params:{allowedValues:yg.properties.props.properties.span.enum}}],!1;var f=g===s}else var f=!0}}}else return Ze.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=P===s}else var p=!0}}else return Ze.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return Ze.errors=i,s===0}Ze.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function ft(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=ft.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let m;if(e.typeName===void 0&&(m="typeName")||e.statementId===void 0&&(m="statementId")||e.props===void 0&&(m="props"))return ft.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:m}}],!1;if(e.typeName!==void 0){let v=s;if(e.typeName!=="Grid")return ft.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Grid"}}],!1;var p=v===s}else var p=!0;if(p){if(e.statementId!==void 0){let v=s;if(typeof e.statementId!="string")return ft.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=v===s}else var p=!0;if(p)if(e.props!==void 0){let v=e.props,P=s;if(s===P)if(v&&typeof v=="object"&&!Array.isArray(v)){let k;if(v.columns===void 0&&(k="columns")||v.children===void 0&&(k="children"))return ft.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:k}}],!1;{let T=s;for(let h in v)if(!(h==="columns"||h==="children")){return ft.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:h}}],!1;break}if(T===s){if(v.columns!==void 0){let h=v.columns,g=s;if(!(typeof h=="number"&&!(h%1)&&!isNaN(h)&&isFinite(h)))return ft.errors=[{instancePath:t+"/props/columns",schemaPath:"#/properties/props/properties/columns/type",keyword:"type",params:{type:"integer"}}],!1;if(!(h===1||h===2||h===3||h===4))return ft.errors=[{instancePath:t+"/props/columns",schemaPath:"#/properties/props/properties/columns/enum",keyword:"enum",params:{allowedValues:bg.properties.props.properties.columns.enum}}],!1;var _=g===s}else var _=!0;if(_)if(v.children!==void 0){let h=v.children,g=s;if(s===g)if(Array.isArray(h)){var d=!0;let w=h.length;for(let C=0;C<w;C++){let A=h[C],E=s,N=s,O=!1,j=s;Ze(A,{instancePath:t+"/props/children/"+C,parentData:h,parentDataProperty:C,rootData:o,dynamicAnchors:a})||(i=i===null?Ze.errors:i.concat(Ze.errors),s=i.length);var f=j===s;if(O=O||f,f){var u={};u.typeName=!0,u.statementId=!0,u.props=!0}let W=s;et(A,{instancePath:t+"/props/children/"+C,parentData:h,parentDataProperty:C,rootData:o,dynamicAnchors:a})||(i=i===null?et.errors:i.concat(et.errors),s=i.length);var f=W===s;O=O||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let z=s;Ke(A,{instancePath:t+"/props/children/"+C,parentData:h,parentDataProperty:C,rootData:o,dynamicAnchors:a})||(i=i===null?Ke.errors:i.concat(Ke.errors),s=i.length);var f=z===s;O=O||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let J=s;He(A,{instancePath:t+"/props/children/"+C,parentData:h,parentDataProperty:C,rootData:o,dynamicAnchors:a})||(i=i===null?He.errors:i.concat(He.errors),s=i.length);var f=J===s;O=O||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let ue=s;Me(A,{instancePath:t+"/props/children/"+C,parentData:h,parentDataProperty:C,rootData:o,dynamicAnchors:a})||(i=i===null?Me.errors:i.concat(Me.errors),s=i.length);var f=ue===s;O=O||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let ie=s;Ie(A,{instancePath:t+"/props/children/"+C,parentData:h,parentDataProperty:C,rootData:o,dynamicAnchors:a})||(i=i===null?Ie.errors:i.concat(Ie.errors),s=i.length);var f=ie===s;if(O=O||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0),O)s=N,i!==null&&(N?i.length=N:i=null);else{let he={instancePath:t+"/props/children/"+C,schemaPath:"#/properties/props/properties/children/items/anyOf",keyword:"anyOf",params:{}};return i===null?i=[he]:i.push(he),s++,ft.errors=i,!1}var d=E===s;if(!d)break}}else return ft.errors=[{instancePath:t+"/props/children",schemaPath:"#/properties/props/properties/children/type",keyword:"type",params:{type:"array"}}],!1;var _=g===s}else var _=!0}}}else return ft.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=P===s}else var p=!0}}else return ft.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return ft.errors=i,s===0}ft.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function qr(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=qr.evaluated;c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0);let p=s,_=!1,d=s;ft(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?ft.errors:i.concat(ft.errors),s=i.length);var T=d===s;if(_=_||T,T){var u={};u.typeName=!0,u.statementId=!0,u.props=!0}let f=s;Ze(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?Ze.errors:i.concat(Ze.errors),s=i.length);var T=f===s;_=_||T,T&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let m=s;et(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?et.errors:i.concat(et.errors),s=i.length);var T=m===s;_=_||T,T&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let v=s;Ke(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?Ke.errors:i.concat(Ke.errors),s=i.length);var T=v===s;_=_||T,T&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let P=s;He(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?He.errors:i.concat(He.errors),s=i.length);var T=P===s;_=_||T,T&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let x=s;Me(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?Me.errors:i.concat(Me.errors),s=i.length);var T=x===s;_=_||T,T&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let k=s;Ie(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?Ie.errors:i.concat(Ie.errors),s=i.length);var T=k===s;if(_=_||T,T&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0),_)s=p,i!==null&&(p?i.length=p:i=null);else{let h={instancePath:t,schemaPath:"#/anyOf",keyword:"anyOf",params:{}};return i===null?i=[h]:i.push(h),s++,qr.errors=i,!1}return qr.errors=i,c.props=u,s===0}qr.evaluated={dynamicProps:!0,dynamicItems:!1};function xu(e){switch(e.k){case"StateRef":case"RuntimeRef":case"BinOp":case"UnaryOp":case"Ternary":case"Member":case"Index":case"Assign":return!0;default:return!1}}var xg=new Set(["Comp","Ref","StateRef","RuntimeRef","BinOp","UnaryOp","Ternary","Member","Index","Assign","Str","Num","Bool","Null","Arr","Obj","Ph"]);function An(e){return!e||typeof e!="object"||Array.isArray(e)?!1:xg.has(e.k)}function Hr(e,t){let n=r=>{switch(t(r),r.k){case"Comp":r.args.forEach(n),Object.values(r.mappedProps??{}).forEach(n);break;case"Arr":r.els.forEach(n);break;case"Obj":r.entries.forEach(([,o])=>n(o));break;case"BinOp":n(r.left),n(r.right);break;case"UnaryOp":n(r.operand);break;case"Ternary":n(r.cond),n(r.then),n(r.else);break;case"Member":n(r.obj);break;case"Index":n(r.obj),n(r.index);break;case"Assign":n(r.value);break}};n(e)}function Zo(e){return e==null?{k:"Null"}:typeof e=="string"?{k:"Str",v:e}:typeof e=="number"?{k:"Num",v:e}:typeof e=="boolean"?{k:"Bool",v:e}:Array.isArray(e)?{k:"Arr",els:e.map(Zo)}:typeof e=="object"?{k:"Obj",entries:Object.entries(e).map(([t,n])=>[t,Zo(n)])}:{k:"Null"}}function ea(e){switch(e.k){case"Str":case"Num":case"Bool":return{v:e.v};case"Null":return{v:null};case"Arr":{let t=[];for(let n of e.els){let r=ea(n);if(!r)return;t.push(r.v)}return{v:t}}case"Obj":{let t={};for(let[n,r]of e.entries){let o=ea(r);if(!o)return;t[n]=o.v}return{v:t}}default:return}}var ta=new Map([["Count",{kind:"function",params:[{name:"array",required:!1}],builtin:!0}],["First",{kind:"function",params:[{name:"array",required:!1}],builtin:!0}],["Last",{kind:"function",params:[{name:"array",required:!1}],builtin:!0}],["Sum",{kind:"function",params:[{name:"numbers",required:!1}],builtin:!0}],["Avg",{kind:"function",params:[{name:"numbers",required:!1}],builtin:!0}],["Min",{kind:"function",params:[{name:"numbers",required:!1}],builtin:!0}],["Max",{kind:"function",params:[{name:"numbers",required:!1}],builtin:!0}],["Sort",{kind:"function",params:[{name:"array",required:!1},{name:"field",required:!1},{name:"direction",required:!1}],builtin:!0}],["Filter",{kind:"function",params:[{name:"array",required:!1},{name:"field",required:!1},{name:"operator",required:!1},{name:"value",required:!1}],builtin:!0}],["Round",{kind:"function",params:[{name:"number",required:!1},{name:"decimals",required:!1}],builtin:!0}],["Abs",{kind:"function",params:[{name:"number",required:!1}],builtin:!0}],["Floor",{kind:"function",params:[{name:"number",required:!1}],builtin:!0}],["Ceil",{kind:"function",params:[{name:"number",required:!1}],builtin:!0}],["Each",{kind:"function",params:[{name:"array",required:!1},{name:"varName",required:!1},{name:"template",required:!1}],builtin:!0,lazy:!0}],["Run",{kind:"action",params:[{name:"ref",required:!1}],builtin:!0,lazy:!0}],["ToAssistant",{kind:"action",params:[{name:"message",required:!1},{name:"context",required:!1}],builtin:!0}],["OpenUrl",{kind:"action",params:[{name:"url",required:!1}],builtin:!0}],["Set",{kind:"action",params:[{name:"variable",required:!1},{name:"value",required:!1}],builtin:!0,lazy:!0}],["Reset",{kind:"action",params:[{name:"variable",required:!1}],builtin:!0,lazy:!0}],["Action",{kind:"action",params:[{name:"steps",required:!0}],builtin:!0,lazy:!0}]]),Su={ActionExpression:!0,OpenUrl:!0,ToAssistant:!0},mn={Query:"Query",Mutation:"Mutation"};function zr(e){return e?.callDefs??ta}function jr(e){return ta.has(e)}function ar(e){return e in mn}var R;(function(e){e[e.Newline=0]="Newline",e[e.LParen=1]="LParen",e[e.RParen=2]="RParen",e[e.LBrack=3]="LBrack",e[e.RBrack=4]="RBrack",e[e.LBrace=5]="LBrace",e[e.RBrace=6]="RBrace",e[e.Comma=7]="Comma",e[e.Colon=8]="Colon",e[e.Equals=9]="Equals",e[e.True=10]="True",e[e.False=11]="False",e[e.Null=12]="Null",e[e.EOF=13]="EOF",e[e.Str=14]="Str",e[e.Num=15]="Num",e[e.Ident=16]="Ident",e[e.Type=17]="Type",e[e.StateVar=18]="StateVar",e[e.Dot=19]="Dot",e[e.Plus=20]="Plus",e[e.Minus=21]="Minus",e[e.Star=22]="Star",e[e.Slash=23]="Slash",e[e.Percent=24]="Percent",e[e.EqEq=25]="EqEq",e[e.NotEq=26]="NotEq",e[e.Greater=27]="Greater",e[e.Less=28]="Less",e[e.GreaterEq=29]="GreaterEq",e[e.LessEq=30]="LessEq",e[e.And=31]="And",e[e.Or=32]="Or",e[e.Not=33]="Not",e[e.Question=34]="Question",e[e.BuiltinCall=35]="BuiltinCall"})(R||(R={}));var Sg=1,ku=2,wu=3,ts=4,Vr=5,ns=6,na=7,Cu=8,kg=9;function ra(e){let t=0,n=()=>e[t]??{t:R.EOF},r=()=>{let u=n();return t++,u},o=u=>{n().t===u&&t++};function a(u){switch(u.t){case R.Question:return Sg;case R.Or:return ku;case R.And:return wu;case R.EqEq:case R.NotEq:return ts;case R.Greater:case R.Less:case R.GreaterEq:case R.LessEq:return Vr;case R.Plus:case R.Minus:return ns;case R.Star:case R.Slash:case R.Percent:return na;case R.Dot:case R.LBrack:return kg;default:return 0}}function i(u=0){let f=s();for(;a(n())>u;)f=c(f);return f}function s(){let u=n();if(u.t===R.Str)return r(),{k:"Str",v:u.v};if(u.t===R.Num)return r(),{k:"Num",v:u.v};if(u.t===R.True)return r(),{k:"Bool",v:!0};if(u.t===R.False)return r(),{k:"Bool",v:!1};if(u.t===R.Null)return r(),{k:"Null"};if(u.t===R.LBrack)return _();if(u.t===R.LBrace)return d();if(u.t===R.StateVar){let f=u.v;if(r(),n().t===R.Equals){r();let m=i(0);return{k:"Assign",target:f,value:m}}return{k:"StateRef",n:f}}if(u.t===R.Type){let f=u.v;return e[t+1]?.t===R.LParen&&(!jr(f)||f==="Action")?p():(r(),{k:"Ref",n:f})}if(u.t===R.BuiltinCall){if(e[t+1]?.t===R.LParen){let f=p();return f.k==="Comp"&&!jr(f.name)&&(f.fn=!0),f}return r(),{k:"Ref",n:u.v}}if(u.t===R.Ident)return r(),{k:"Ref",n:u.v};if(u.t===R.Not)return r(),{k:"UnaryOp",op:"!",operand:i(Cu)};if(u.t===R.Minus)return r(),{k:"UnaryOp",op:"-",operand:i(Cu)};if(u.t===R.LParen){r();let f=i(0);return o(R.RParen),f}return r(),{k:"Null"}}function c(u){let f=n();if(f.t===R.Plus)return r(),{k:"BinOp",op:"+",left:u,right:i(ns)};if(f.t===R.Minus)return r(),{k:"BinOp",op:"-",left:u,right:i(ns)};if(f.t===R.Star)return r(),{k:"BinOp",op:"*",left:u,right:i(na)};if(f.t===R.Slash)return r(),{k:"BinOp",op:"/",left:u,right:i(na)};if(f.t===R.Percent)return r(),{k:"BinOp",op:"%",left:u,right:i(na)};if(f.t===R.EqEq)return r(),{k:"BinOp",op:"==",left:u,right:i(ts)};if(f.t===R.NotEq)return r(),{k:"BinOp",op:"!=",left:u,right:i(ts)};if(f.t===R.Greater)return r(),{k:"BinOp",op:">",left:u,right:i(Vr)};if(f.t===R.Less)return r(),{k:"BinOp",op:"<",left:u,right:i(Vr)};if(f.t===R.GreaterEq)return r(),{k:"BinOp",op:">=",left:u,right:i(Vr)};if(f.t===R.LessEq)return r(),{k:"BinOp",op:"<=",left:u,right:i(Vr)};if(f.t===R.And)return r(),{k:"BinOp",op:"&&",left:u,right:i(wu)};if(f.t===R.Or)return r(),{k:"BinOp",op:"||",left:u,right:i(ku)};if(f.t===R.Question){r();let m=i(0);o(R.Colon);let v=i(0);return{k:"Ternary",cond:u,then:m,else:v}}if(f.t===R.Dot){r();let m=n(),v=m.t===R.Ident||m.t===R.Type||m.t===R.Str||m.t===R.Num?(r(),String(m.v)):m.t===R.StateVar?(r(),m.v.replace(/^\$/,"")):(r(),"?");return{k:"Member",obj:u,field:v}}if(f.t===R.LBrack){r();let m=i(0);return o(R.RBrack),{k:"Index",obj:u,index:m}}return u}function p(){let u=n().v;r(),o(R.LParen);let f=[];for(;n().t!==R.RParen&&n().t!==R.EOF;)f.push(i(0)),n().t===R.Comma&&r();return o(R.RParen),{k:"Comp",name:u,args:f}}function _(){r();let u=[];for(;n().t!==R.RBrack&&n().t!==R.EOF;)u.push(i(0)),n().t===R.Comma&&r();return o(R.RBrack),{k:"Arr",els:u}}function d(){r();let u=[];for(;n().t!==R.RBrace&&n().t!==R.EOF;){let f=n(),m=f.t===R.Ident||f.t===R.Str||f.t===R.Type||f.t===R.Num?(r(),String(f.v)):f.t===R.StateVar?(r(),f.v.replace(/^\$/,"")):(r(),"?");o(R.Colon),u.push([m,i(0)]),n().t===R.Comma&&r()}return o(R.RBrace),{k:"Obj",entries:u}}return i(0)}function oa(e){let t=[],n=0,r=e.length;for(;n<r;){for(;n<r&&(e[n]===" "||e[n]===" "||e[n]==="\r");)n++;if(n>=r)break;let o=e[n];if(o===`
36
+ `){t.push({t:R.Newline}),n++;continue}if(o==="("){t.push({t:R.LParen}),n++;continue}if(o===")"){t.push({t:R.RParen}),n++;continue}if(o==="["){t.push({t:R.LBrack}),n++;continue}if(o==="]"){t.push({t:R.RBrack}),n++;continue}if(o==="{"){t.push({t:R.LBrace}),n++;continue}if(o==="}"){t.push({t:R.RBrace}),n++;continue}if(o===","){t.push({t:R.Comma}),n++;continue}if(o===":"){t.push({t:R.Colon}),n++;continue}if(o==="="){n+1<r&&e[n+1]==="="?(t.push({t:R.EqEq}),n+=2):(t.push({t:R.Equals}),n++);continue}if(o==="!"){n+1<r&&e[n+1]==="="?(t.push({t:R.NotEq}),n+=2):(t.push({t:R.Not}),n++);continue}if(o===">"){n+1<r&&e[n+1]==="="?(t.push({t:R.GreaterEq}),n+=2):(t.push({t:R.Greater}),n++);continue}if(o==="<"){n+1<r&&e[n+1]==="="?(t.push({t:R.LessEq}),n+=2):(t.push({t:R.Less}),n++);continue}if(o==="&"){n+1<r&&e[n+1]==="&"?(t.push({t:R.And}),n+=2):(t.push({t:R.And}),n++);continue}if(o==="|"){n+1<r&&e[n+1]==="|"?(t.push({t:R.Or}),n+=2):(t.push({t:R.Or}),n++);continue}if(o==="."){t.push({t:R.Dot}),n++;continue}if(o==="?"){t.push({t:R.Question}),n++;continue}if(o==="+"){t.push({t:R.Plus}),n++;continue}if(o==="*"){t.push({t:R.Star}),n++;continue}if(o==="/"){t.push({t:R.Slash}),n++;continue}if(o==="%"){t.push({t:R.Percent}),n++;continue}if(o==='"'){let c=n;n++;let p=!1;for(;n<r;)if(e[n]==="\\")n+=2;else if(e[n]==='"'){n++,p=!0;break}else n++;let _=e.slice(c,n);try{let d=p?_:_+'"';t.push({t:R.Str,v:JSON.parse(d)})}catch{let d=_.replace(/^"|"$/g,"");t.push({t:R.Str,v:d})}continue}if(o==="'"){n++;let c="",p=!1;for(;n<r;)if(e[n]==="\\"){if(n++,n<r){let _=e[n];_==="'"?c+="'":_==="\\"?c+="\\":_==="n"?c+=`
37
+ `:_==="t"?c+=" ":c+=_,n++}}else if(e[n]==="'"){n++,p=!0;break}else c+=e[n],n++;t.push({t:R.Str,v:c});continue}if(o==="-"){let c=t.length>0?t[t.length-1]:null;if(!(!(c!=null&&(c.t===R.Num||c.t===R.Str||c.t===R.Ident||c.t===R.Type||c.t===R.RParen||c.t===R.RBrack||c.t===R.True||c.t===R.False||c.t===R.Null||c.t===R.StateVar||c.t===R.BuiltinCall))&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9")){t.push({t:R.Minus}),n++;continue}}let a=o>="0"&&o<="9",i=o==="-"&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9";if(a||i){let c=n;for(e[n]==="-"&&n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;if(n<r&&e[n]==="."&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9")for(n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;if(n<r&&(e[n]==="e"||e[n]==="E"))for(n++,n<r&&(e[n]==="+"||e[n]==="-")&&n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;t.push({t:R.Num,v:+e.slice(c,n)});continue}if(o==="$"&&n+1<r&&(e[n+1]>="a"&&e[n+1]<="z"||e[n+1]>="A"&&e[n+1]<="Z"||e[n+1]==="_")){let c=n;for(n++;n<r&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;t.push({t:R.StateVar,v:e.slice(c,n)});continue}if(o>="a"&&o<="z"||o>="A"&&o<="Z"||o==="_"){let c=n;for(;n<r&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;let p=e.slice(c,n);if(p==="true"){t.push({t:R.True});continue}if(p==="false"){t.push({t:R.False});continue}if(p==="null"){t.push({t:R.Null});continue}let _=o>="A"&&o<="Z"?R.Type:R.Ident;t.push({t:_,v:p});continue}if(o==="@"&&n+1<r&&(e[n+1]>="a"&&e[n+1]<="z"||e[n+1]>="A"&&e[n+1]<="Z"||e[n+1]==="_")){n++;let c=n;for(;n<r&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;t.push({t:R.BuiltinCall,v:e.slice(c,n)});continue}n++}return t.push({t:R.EOF}),t}function Wt(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return t.type==="element"&&typeof t.typeName=="string"&&typeof t.props=="object"&&t.props!==null&&typeof t.partial=="boolean"}var Tu;(function(e){e.ContinueConversation="continue_conversation",e.OpenUrl="open_url"})(Tu||(Tu={}));var wg={},Cg=[];function aa(e){return Array.isArray(e)?"array":typeof e}function Ru(e){return typeof e.$ref=="string"?e.$ref.split("/").pop():void 0}function Iu(e){return"$ref"in e||"anyOf"in e||"oneOf"in e||"allOf"in e}function Au(e){if(Array.isArray(e.enum))return{enumValues:e.enum};if("const"in e)return{enumValues:[e.const]};switch(e.type){case"string":return{expectedType:"string"};case"number":case"integer":return{expectedType:"number"};case"boolean":return{expectedType:"boolean"};default:return{}}}function ia(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e.default}function rs(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e,n=Ru(t);if(n)return n;let r=Au(t);return r.enumValues?r.enumValues.map(o=>JSON.stringify(o)).join("|"):r.expectedType?r.expectedType:typeof t.type=="string"?t.type:void 0}function os(e,t){let n=t.map(r=>{let o=rs(r.schema),a=r.required?`${r.name}*`:r.name;return o?`${a}: ${o}`:a}).join(", ");return`${e}(${n})`}function Tg(e,t){let n=typeof e;return t.enumValues?t.enumValues.includes(e)?null:{expected:`one of [${t.enumValues.map(r=>JSON.stringify(r)).join(", ")}]`,actual:aa(e)}:t.expectedType&&t.expectedType!==n?{expected:t.expectedType,actual:aa(e)}:null}function Rg(e,t,n){switch(n.code){case"type-mismatch":return`field "${t}" expects ${n.expected} but got ${n.actual}`;case"pruned-value":return`field "${t}" lost an unresolved or invalid value`;case"missing-required":return`missing required field "${t}"${n.signature?` \u2014 signature: ${n.signature}`:""}`;case"null-required":return`required field "${t}" cannot be null${n.signature?` \u2014 signature: ${n.signature}`:""}`;case"unknown-component":return`Unknown component "${e}" \u2014 not found in catalog or builtins${n.available?.length?`. Available components: ${n.available.join(", ")}`:""}`;case"inline-reserved":return`${e}() must be declared as a top-level statement, not used inline as a value`;case"excess-args":return`${e} takes ${n.declared} arg(s), got ${n.got} (${n.got-n.declared} excess dropped)`;case"unknown-function":return`Unknown function "@${e}": not a built-in or action step. The call evaluates to null`;case"no-root":return n.reason==="not-component"?"root does not evaluate to a component":n.reason==="fallback"?`No root statement. Rendering the first statement that calls the root component ${e}`:e?`No root statement, and no statement calls the root component ${e}`:"No root statement"}}function $e(e,t,n,r){e.errors.push({code:r.code,component:t,path:n,message:Rg(t,n,r),statementId:e.currentStatementId,...r.code==="no-root"&&r.reason==="fallback"&&{severity:"warning"}})}var bt=Symbol("invalid");function sa(e,t){return t!==void 0?t:e?bt:void 0}function Ig(e,t,n,r,o){return Iu(t)?!1:typeof t.type=="string"||Array.isArray(t.enum)||"const"in t?($e(o,n,r,{code:"type-mismatch",expected:typeof t.type=="string"?t.type:"a literal value",actual:`component "${e.typeName}"`}),!0):!1}function Eu(e){return(e.anyOf??e.oneOf??[e]).map(Ru)}function Ag(e,t){let n=Eu(e);return n.length>0&&n.every(r=>r!==void 0&&t.cat?.has(r))}function Eg(e,t,n,r,o){if(typeof e!="object"||Array.isArray(e))return $e(o,n,r,{code:"type-mismatch",expected:"object",actual:aa(e)}),bt;let a=e,i,s=t.properties&&typeof t.properties=="object"?t.properties:wg,c=Array.isArray(t.required)?t.required:Cg,p=!1;if(!o.partial)for(let _ of c){let d=_ in a;if(!d||a[_]==null){let u=ia(s[_]);if(u!==void 0){(i??(i={...a}))[_]=u;continue}$e(o,n,`${r}/${_}`,{code:d?"null-required":"missing-required"}),p=!0}}for(let _ of Object.keys(s)){if(!(_ in a))continue;let d=s[_],u=Wr(a[_],d,n,`${r}/${_}`,o);if(u===bt&&(u=sa(c.includes(_),ia(d)),u===bt)){p=!0;continue}u!==a[_]&&(i??(i={...a}),u===void 0?delete i[_]:i[_]=u)}return p?bt:i??a}function Mg(e,t,n,r,o){if(!Array.isArray(e))return $e(o,n,r,{code:"type-mismatch",expected:"array",actual:aa(e)}),bt;let a=t.items;if(!a||typeof a!="object"||Array.isArray(a))return e;let i;for(let s=0;s<e.length;s++){let c=Wr(e[s],a,n,`${r}/${s}`,o);c!==e[s]&&!i&&(i=e.slice(0,s)),i&&c!==bt&&i.push(c)}return i??e}function Ng(e,t,n,r,o){let a=Au(t);if(a.expectedType==null&&a.enumValues==null||a.enumValues&&o.partial)return!1;let i=Tg(e,a);return i?($e(o,n,r,{code:"type-mismatch",...i}),!0):!1}function Wr(e,t,n,r,o){if(!t||typeof t!="object"||Array.isArray(t))return e;let a=t;if(e==null||An(e))return e;if(Wt(e))return Ig(e,a,n,r,o)?bt:e;if(Iu(a))return Ag(a,o)?($e(o,n,r,{code:"type-mismatch",expected:Eu(a).join(" | "),actual:Array.isArray(e)?"array":typeof e=="object"?"plain object":typeof e}),bt):e;let i=a.type;return i==="object"?Eg(e,a,n,r,o):i==="array"?Mg(e,a,n,r,o):Ng(e,a,n,r,o)?bt:e}function la(e){if(e==null||typeof e!="object")return!1;if(An(e))return!0;if(Array.isArray(e))return e.some(la);if(Wt(e))return Object.values(e.props).some(la);let t=e;return Array.isArray(t.steps)?!0:Object.values(t).some(la)}function Mu(e,t,n){if(t.visited.has(e))return t.unres.push(e),n==="expr"?{k:"Ph",n:e}:null;if(!t.syms.has(e))return t.unres.push(e),n==="expr"?{k:"Ph",n:e}:null;let r=t.syms.get(e);if(t.unreached?.delete(e),r.k==="Comp"&&ar(r.name)){let a=r.name===mn.Mutation?"mutation":"query";return{k:"RuntimeRef",n:e,refType:a}}t.visited.add(e);let o=t.currentStatementId;t.currentStatementId=e;try{let a=n==="value"?En(r,t):as(r,t);return n==="value"&&Wt(a)&&(a.statementId=e),a}finally{t.currentStatementId=o,t.visited.delete(e)}}function ca(e,t){return zr(t.cat).has(e)||ar(e)}function is(e,t){let n={};for(let r=0;r<t.length&&r<e.length;r++)n[t[r].name]=e[r];return n}function Nu(e,t,n,r){let{params:o}=n;t.length>o.length&&$e(r,e,"",{code:"excess-args",declared:o.length,got:t.length});let a=is(t,o),i=!1,s=r.errors.length;for(let c of o){let p=a[c.name],_=p?ea(p):{v:void 0};if(!_)continue;if(_.v==null){if(!c.required||c.defaultValue!==void 0)continue;$e(r,e,`/${c.name}`,{code:p?"null-required":"missing-required",signature:os(e,o)}),i=!0;continue}let d=Wr(_.v,c.schema,e,`/${c.name}`,r);d===bt&&(d=sa(c.required,c.defaultValue)),d===bt?i=!0:d===void 0?delete a[c.name]:d!==_.v&&(a[c.name]=Zo(d))}return n.kind==="action"&&r.errors.length>s&&(i=!0),i?null:a}function Lu(e,t,n){let r=e.args.map(n),o=zr(t.cat).get(e.name);if(!o||o.lazy)return{...e,args:r};let a=o.builtin?is(r,o.params):Nu(e.name,r,o,t);return a?{...e,args:r,mappedProps:a}:o.kind==="action"?{k:"Comp",name:"Action",args:[{k:"Arr",els:[]}]}:{k:"Null"}}function ss(e,t,n){let r=t.currentStatementId;t.currentStatementId=n;let o=new Set;for(let a of e)Hr(a,i=>{if(i.k!=="Comp"||o.has(i))return;o.add(i);let s=zr(t.cat).get(i.name);if(!s||s.lazy)return;let c=s.builtin?null:Nu(i.name,i.args,s,t);i.mappedProps=c??is(i.args,s.params)});t.currentStatementId=r}function Ou(e,t,n){let r=zr(t.cat).get(e.name);if(r?.kind!=="function"||!r.lazy||e.args.length<3)return null;let o=e.args[1],a=o.k==="Ref"?o.n:o.k==="Str"?o.v:null;if(!a)return null;let i=new Set(n);i.add(a);let s=e.args.map((c,p)=>p===1?c:yt(c,t,i));return{...e,args:s}}function yt(e,t,n){switch(e.k){case"Ref":return n.has(e.n)?e:Mu(e.n,t,"expr");case"Ph":return e;case"Comp":{if(e.fn&&!ca(e.name,t))return $e(t,e.name,"",{code:"unknown-function"}),{k:"Null"};let r=Ou(e,t,n);if(r)return r;if(ca(e.name,t))return Lu(e,t,i=>yt(i,t,n));let o=e.args.map(i=>yt(i,t,n)),a=t.cat?.get(e.name);if(a){let i={};for(let s=0;s<a.params.length&&s<o.length;s++)i[a.params[s].name]=o[s];return{...e,args:o,mappedProps:i}}return $e(t,e.name,"",{code:"unknown-component",available:t.cat&&[...t.cat.keys()]}),{...e,args:o}}case"Arr":return{...e,els:e.els.map(r=>yt(r,t,n))};case"Obj":return{...e,entries:e.entries.map(([r,o])=>[r,yt(o,t,n)])};case"BinOp":return{...e,left:yt(e.left,t,n),right:yt(e.right,t,n)};case"UnaryOp":return{...e,operand:yt(e.operand,t,n)};case"Ternary":return{...e,cond:yt(e.cond,t,n),then:yt(e.then,t,n),else:yt(e.else,t,n)};case"Member":return{...e,obj:yt(e.obj,t,n)};case"Index":return{...e,obj:yt(e.obj,t,n),index:yt(e.index,t,n)};case"Assign":return{...e,value:yt(e.value,t,n)};default:return e}}function as(e,t){return yt(e,t,new Set)}function En(e,t){switch(e.k){case"Ref":return Mu(e.n,t,"value");case"Str":return e.v;case"Num":return e.v;case"Bool":return e.v;case"Null":return null;case"Ph":return null;case"Arr":{let n=[];for(let r of e.els){if(r.k==="Ph"){t.prunedValues++;continue}let o=En(r,t);if(o===null&&(r.k==="Comp"||r.k==="Ref")){t.prunedValues++;continue}n.push(o)}return n}case"Obj":{let n={};for(let[r,o]of e.entries)n[r]=En(o,t);return n}case"Comp":{let{name:n,args:r}=e;if(e.fn&&!ca(n,t))return $e(t,n,"",{code:"unknown-function"}),null;if(ar(n))return $e(t,n,"",{code:"inline-reserved"}),null;if(ca(n,t)){let s=Ou(e,t,new Set);return s||Lu(e,t,c=>as(c,t))}let o=t.cat?.get(n),a={};if(o){let s=!1;for(let p=0;p<o.params.length&&p<r.length;p++){let _=o.params[p],d=t.prunedValues,u=En(r[p],t);if(t.prunedValues>d&&$e(t,n,`/${_.name}`,{code:"pruned-value"}),a[_.name]=u,_.schema===void 0)continue;if(u==null&&_.defaultValue!==void 0){$e(t,n,`/${_.name}`,{code:"type-mismatch",expected:rs(_.schema)??"a defined value",actual:u===null?"null":"undefined"}),a[_.name]=_.defaultValue,t.prunedValues=d;continue}let f=Wr(u,_.schema,n,`/${_.name}`,t);f===bt&&(f=sa(_.required,_.defaultValue),_.defaultValue!==void 0&&(t.prunedValues=d),f===bt?s=!0:f===void 0&&delete a[_.name]),f!==bt&&f!==void 0&&(a[_.name]=f)}r.length>o.params.length&&$e(t,n,"",{code:"excess-args",declared:o.params.length,got:r.length});let c=o.params.filter(p=>p.required&&(!(p.name in a)||a[p.name]===null));if(c.length){let p=c.filter(_=>_.defaultValue!==void 0?($e(t,n,`/${_.name}`,{code:_.name in a?"null-required":"missing-required"}),a[_.name]=_.defaultValue,!1):!0);if(p.length){for(let _ of p)$e(t,n,`/${_.name}`,{code:_.name in a?"null-required":"missing-required",signature:os(n,o.params)});return null}}if(s)return null}else return $e(t,n,"",{code:"unknown-component",available:t.cat&&[...t.cat.keys()]}),null;let i=Object.values(a).some(s=>la(s));return{type:"element",typeName:n,props:a,partial:t.partial,hasDynamicProps:i}}default:return xu(e)?as(e,t):e}}function ls(e){let t=[],n=!1,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(r){r=!1;continue}if(s==="\\"&&n){r=!0;continue}if(n){s===n&&(n=!1);continue}if(s==='"'||s==="'"){n=s;continue}s==="("||s==="["||s==="{"?t.push(s):(s===")"&&t[t.length-1]==="("||s==="]"&&t[t.length-1]==="["||s==="}"&&t[t.length-1]==="{")&&t.pop()}if(!(!!n||t.length>0))return{text:e,wasIncomplete:!1};let a=e;n&&(r&&(a+="\\"),a+=n);for(let i=t.length-1;i>=0;i--)a+=t[i]==="("?")":t[i]==="["?"]":"}";return{text:a,wasIncomplete:!0}}function ua(e){let t=[],n=0;for(;n<e.length;){for(;n<e.length&&e[n].t===R.Newline;)n++;if(n>=e.length||e[n].t===R.EOF)break;let r=e[n];if(r.t!==R.Ident&&r.t!==R.Type&&r.t!==R.StateVar){for(;n<e.length&&e[n].t!==R.Newline&&e[n].t!==R.EOF;)n++;continue}let o=r.v,a=r.t;if(n++,n>=e.length||e[n].t!==R.Equals){for(;n<e.length&&e[n].t!==R.Newline&&e[n].t!==R.EOF;)n++;continue}n++;let i=[],s=0,c=0;for(;n<e.length&&e[n].t!==R.EOF;){let p=e[n].t;if(p===R.Newline&&s<=0&&c<=0){let _=n+1;for(;_<e.length&&e[_].t===R.Newline;)_++;let d=_<e.length?e[_].t:R.EOF;if(d===R.Question||d===R.Colon&&c>0){n++;continue}break}if(p===R.Newline){n++;continue}p===R.LParen||p===R.LBrack||p===R.LBrace?s++:(p===R.RParen||p===R.RBrack||p===R.RBrace)&&s>0?s--:p===R.Question&&s===0?c++:p===R.Colon&&s===0&&c>0&&c--,i.push(e[n++])}i.length&&t.push({id:o,idTokenType:a,tokens:i})}return t}function pa(e=!0){return{root:null,meta:{incomplete:e,unresolved:[],orphaned:[],statementCount:0,errors:[]},stateDeclarations:{},queryStatements:[],mutationStatements:[]}}function Bu(e){if(!An(e))return[];let t=new Set;return Hr(e,n=>{n.k==="StateRef"&&t.add(n.n)}),[...t]}function us(e,t){if(t.k==="Comp"&&t.name===mn.Query){let n=Bu(t.args[1]);return{kind:"query",id:e.id,call:{callee:mn.Query,args:t.args},expr:t,deps:n.length>0?n:void 0}}return t.k==="Comp"&&t.name===mn.Mutation?{kind:"mutation",id:e.id,call:{callee:mn.Mutation,args:t.args},expr:t}:e.idTokenType===R.StateVar?{kind:"state",id:e.id,init:t}:{kind:"value",id:e.id,expr:t}}function Lg(e,t,n){let r={},o=[],a=[];for(let i of e)switch(i.kind){case"state":r[i.id]=En(i.init,t);break;case"query":ss(i.call.args,t,i.id),o.push({statementId:i.id,toolAST:i.call.args[0]??null,argsAST:i.call.args[1]??null,defaultsAST:i.call.args[2]??null,refreshAST:i.call.args[3]??null,deps:i.deps,complete:!0});break;case"mutation":ss(i.call.args,t,i.id),a.push({statementId:i.id,toolAST:i.call.args[0]??null,argsAST:i.call.args[1]??null});break}for(let i of e){let s=i.kind==="state"?[i.init]:i.kind==="value"?[i.expr]:i.kind==="query"||i.kind==="mutation"?i.call.args:[];for(let c of s)for(let p of Bu(c))p===n?.name&&n.stmts.has(i)||p in r||(r[p]=null)}return{stateDeclarations:r,queryStatements:o,mutationStatements:a}}var $u="root";function ps(e){return e?.k==="Comp"&&!e.fn&&!jr(e.name)&&!ar(e.name)}function Og(e,t){if(e.has($u))return{id:$u,fallback:!1};for(let n of e.values())if(n.kind==="value"&&ps(n.expr)&&n.expr.name===t)return{id:n.id,fallback:!0};return null}function $g(e,t){let n=new Set;for(;e?.k==="Ref"&&!n.has(e.n);)n.add(e.n),e=t.get(e.n);return ps(e)}function Dg(e){let t=!1;return Hr(e,n=>{ps(n)&&(t=!0)}),t}function da(e,t,n,r,o,a,i){let s=Og(e,a),c=new Map;for(let[h,g]of e)c.set(h,g.kind==="state"?g.init:g.expr);let p=[],_=[],d=new Set;for(let[h,g]of e)h!==s?.id&&(g.kind==="state"||g.kind==="query"||g.kind==="mutation"||d.add(h));let u={syms:c,cat:o,errors:_,unres:p,prunedValues:0,visited:new Set,partial:n,currentStatementId:s?.id,unreached:d},f=null,m;if(s){let h=En(c.get(s.id),u);Wt(h)?(f=h,f.statementId=s.id):An(h)&&Dg(h)&&(m=h)}let{stateDeclarations:v,queryStatements:P,mutationStatements:x}=Lg(t,u,i);u.currentStatementId=s?.id;let k=a??"";s?!f&&!m&&!$g(c.get(s.id),c)?$e(u,k,"",{code:"no-root",reason:"not-component"}):s.fallback&&$e(u,k,"",{code:"no-root",reason:f?"fallback":"missing"}):$e(u,k,"",{code:"no-root",reason:"missing"});let T=s?[...d]:[];return{root:f,...m?{rootExpression:m}:{},meta:{incomplete:n,unresolved:p,orphaned:T,statementCount:r,errors:_},stateDeclarations:v,queryStatements:P,mutationStatements:x}}function Du(e,t){if(e[t]!=='"')return t;let n=t+1;for(;n<e.length;){let r=e[n];if(r==="\\")n+=2;else{if(r==='"')return n+1;n++}}return n}function Bg(e){let t=[],n=0;for(;n<e.length;){let r=-1;for(;n<e.length;){let s=Du(e,n);if(s>n){n=s;continue}if(e[n]==="`"&&n+1<e.length&&e[n+1]==="`"&&n+2<e.length&&e[n+2]==="`"){r=n;break}n++}if(r===-1)break;let o=r+3;for(;o<e.length&&e[o]!==`
38
+ `;)o++;if(o>=e.length){t.push(e.slice(r+3).replace(/^[^\n]*\n?/,"")),n=e.length;break}o++;let a=-1,i=o;for(;i<e.length;){let s=Du(e,i);if(s>i){i=s;continue}if(e[i]==="`"&&i+1<e.length&&e[i+1]==="`"&&i+2<e.length&&e[i+2]==="`"){a=i;break}i++}a!==-1?(t.push(e.slice(o,a)),n=a+3):(t.push(e.slice(o)),n=e.length)}if(t.length>0)return t.join(`
39
39
  `);if(e.startsWith("```")){let r=3;for(;r<e.length&&e[r]!==`
40
- `;)r++;let o=r<e.length?r+1:3,a=e.slice(o),i=a.lastIndexOf("```");return i!==-1?a.slice(0,i):a}return e}function Zm(e){let t=!1;return e.split(`
40
+ `;)r++;let o=r<e.length?r+1:3,a=e.slice(o),i=a.lastIndexOf("```");return i!==-1?a.slice(0,i):a}return e}function Fg(e){let t=!1;return e.split(`
41
41
  `).map(n=>{for(let r=0;r<n.length;r++){let o=n[r];if(t){if(o==="\\"&&r+1<n.length){r++;continue}o===t&&(t=!1);continue}if(o==='"'||o==="'"){t=o;continue}if(o==="/"&&n[r+1]==="/"||o==="#")return n.substring(0,r).trimEnd()}return n}).join(`
42
- `)}function mu(e){return Zm(Jm(e.trim())).trim()}function gu(e,t,n){let r=mu(e);if(!r)return oa();let{text:o,wasIncomplete:a}=Qi(r),i=na(Yo(o));if(!i.length)return oa(a);let s=new Map;for(let p of i){let d=Qo(p.tokens),_=Xi(p,d);s.set(p.id,_)}let c=[...s.values()];return ra(s,c,a,s.size,t,n)}function vu(e,t){let n="",r="",o=0,a=new Map,i=0;function s(u){let f=u.trim();if(f)for(let m of na(Yo(f))){let h=Qo(m.tokens),y=Xi(m,h);a.set(m.id,y),i++}}function c(){let u=mu(n);u.startsWith(r.slice(0,o))||(o=0,a.clear(),i=0),r=u}function p(){let u=0,f=0,m=!1,h=!1,y=o;for(let x=o;x<r.length;x++){let S=r[x];if(h){h=!1;continue}if(S==="\\"&&m){h=!0;continue}if(m){S===m&&(m=!1);continue}if(S==='"'||S==="'"){m=S;continue}if(S==="("||S==="["||S==="{")u++;else if(S===")"||S==="]"||S==="}")u=Math.max(0,u-1);else if(S==="?"&&u===0)f++;else if(S===":"&&u===0&&f>0)f--;else if(S===`
43
- `&&u<=0&&f<=0){let w=x+1;for(;w<r.length&&(r[w]===" "||r[w]===" "||r[w]==="\r"||r[w]===`
44
- `);)w++;if(w<r.length&&(r[w]==="?"||r[w]===":"&&f>0))continue;let g=r.slice(y,x).trim();g&&s(g),y=x+1,o=x+1}}return y}function d(u=!1){c();let f=p(),m=r.slice(f).trim();if(!m)return i===0?oa():ra(a,[...a.values()],!1,i,e,t);let{text:h,wasIncomplete:y}=Qi(m),x=na(Yo(h));if(!x.length)return i===0?oa(y):ra(a,[...a.values()],y,i,e,t);let S=new Map(a),w=new Set;for(let C of x){if(a.has(C.id)&&y)continue;let T=Qo(C.tokens),M=Xi(C,T);S.set(C.id,M),w.add(M)}let g=u?void 0:/\$\w+$/.exec(n)?.[0],v=g&&m.endsWith(g)&&!new RegExp(`\\${g}(?!\\w)`).test(m.slice(0,-g.length))?g:void 0,k=[...S.values()];return ra(S,k,y,i+x.length,e,t,v?{name:v,stmts:w}:void 0)}function _(){n="",r="",o=0,a.clear(),i=0}return{push(u,f){return n+=u,d(f)},set(u,f){(u.length<n.length||!u.startsWith(n))&&_();let m=u.slice(n.length);return m&&(n+=m),d(f)},getResult:d}}function Ji(e,t){if(!e||typeof e!="object")return e;let n=e.$ref;if(typeof n=="string")return t.has(n)?Ji(t.get(n),t):e;let r=Array.isArray(e)?[...e]:{...e},o=!1;for(let[a,i]of Object.entries(r))r[a]=Ji(i,t),o||(o=r[a]!==i);return o?r:e}function Yi(e,t){let n=e.properties??{},r=e.required??[];return Object.keys(n).map(o=>({name:o,required:r.includes(o),defaultValue:Jo(n[o]),schema:t.size?Ji(n[o],t):n[o]}))}function hu(e){let t=new Map,n=e.properties&&new Set(Object.keys(e.properties)),r=new Map;for(let o of[...Object.keys(Zc),...Object.keys(e.actions??{})]){let a=e.$defs?.[o];a&&!n?.has(o)&&r.set(`#/$defs/${o}`,a)}for(let[o,a]of Object.entries(e.$defs??{}))(n?!n.has(o):r.has(`#/$defs/${o}`))||t.set(o,{params:Yi(a,r)});t.callDefs=new Map(Go);for(let[o,a]of Object.entries(e.functions??{}))t.callDefs.set(o,{kind:"function",params:Yi(a.params,r)});for(let[o,a]of Object.entries(e.actions??{}))t.callDefs.set(o,{kind:"action",params:Yi(a.params,r)});return t}var bu=hu(Zn.schema),eg={parse(e){return gu(e,bu,Zn.root)}};function yu(){return vu(bu,Zn.root)}function es(e,t){let n=e.root?.props.children,r=new Set,o=e.meta,a=e.meta.errors.some(f=>f.severity!=="warning"&&!(f.component==="Grid"&&f.path==="/columns"||f.component==="Cell"&&f.path==="/span"));function i(f,m,h){o===e.meta&&(o={...e.meta,errors:[...e.meta.errors]}),o.errors.push({code:"type-mismatch",component:f.typeName,path:m,message:h,statementId:f.statementId}),a=!0}function s(f,m,h){if(!jt(f)||typeof f.statementId!="string"||r.has(f.statementId)){i(m,`/children/${h}`,"Child must be a valid, uniquely named component");return}if(f.typeName==="Root"||f.typeName==="Grid"&&m.typeName!=="Root"||f.typeName==="Cell"&&m.typeName==="Cell"){i(m,`/children/${h}`,"Component is not allowed at this nesting level");return}if(r.add(f.statementId),(f.typeName==="Chart"||f.typeName==="Table")&&e.meta.errors.some(S=>S.statementId===f.statementId&&S.severity!=="warning"))return;let y=(f.typeName==="Grid"||f.typeName==="Cell")&&Array.isArray(f.props.children)?f.props.children.flatMap((S,w)=>{let g=s(S,f,w);return g?[g]:[]}):void 0,x=y?{...f,props:{...f.props,children:y}}:f;if(!Xc(x)){i(f,"","Component does not match the catalog");return}if(x.typeName==="Table"&&x.props.rows.some(S=>S.length!==x.props.columns.length)){i(f,"/rows","Every table row must contain one value per column");return}if(y?.length!==0&&!((x.typeName==="Chart"||x.typeName==="Table")&&(t||e.meta.incomplete)))return x}let c=e.root,p=c&&Array.isArray(n)?n.flatMap((f,m)=>{if(jt(f)&&f.typeName==="Cell")return i(c,`/children/${m}`,"Cell must be inside a Grid"),[];let h=s(f,c,m);return h&&h.typeName!=="Cell"?[h]:[]}):[],d=c?.hasDynamicProps===!0||e.queryStatements.length>0||e.mutationStatements.length>0||Object.keys(e.stateDeclarations).length>0||e.meta.errors.some(f=>f.code==="unknown-function"||f.code==="inline-reserved");d&&c&&i(c,"","Executable content is not supported by the static catalog"),c&&c.typeName!==Zn.root&&i(c,"","The block must use the catalog root component");let _=d||c!==null&&c.typeName!==Zn.root||!t&&(!Array.isArray(n)||p.length===0),u=!t&&!_&&(a||e.meta.incomplete);return!t&&(_||o.errors.length>0||o.unresolved.length>0||o.incomplete)&&console.warn("Generative UI diagnostics",{error:_,partial:u,diagnostics:o}),{elements:_?[]:p,error:_,partial:u,diagnostics:o}}function Pu(e){return es(eg.parse(e),!1).elements.flatMap(xu).join(`
42
+ `)}function Fu(e){return Fg(Bg(e.trim())).trim()}function Uu(e,t,n){let r=Fu(e);if(!r)return pa();let{text:o,wasIncomplete:a}=ls(r),i=ua(oa(o));if(!i.length)return pa(a);let s=new Map;for(let p of i){let _=ra(p.tokens),d=us(p,_);s.set(p.id,d)}let c=[...s.values()];return da(s,c,a,s.size,t,n)}function qu(e,t){let n="",r="",o=0,a=new Map,i=0;function s(u){let f=u.trim();if(f)for(let m of ua(oa(f))){let v=ra(m.tokens),P=us(m,v);a.set(m.id,P),i++}}function c(){let u=Fu(n);u.startsWith(r.slice(0,o))||(o=0,a.clear(),i=0),r=u}function p(){let u=0,f=0,m=!1,v=!1,P=o;for(let x=o;x<r.length;x++){let k=r[x];if(v){v=!1;continue}if(k==="\\"&&m){v=!0;continue}if(m){k===m&&(m=!1);continue}if(k==='"'||k==="'"){m=k;continue}if(k==="("||k==="["||k==="{")u++;else if(k===")"||k==="]"||k==="}")u=Math.max(0,u-1);else if(k==="?"&&u===0)f++;else if(k===":"&&u===0&&f>0)f--;else if(k===`
43
+ `&&u<=0&&f<=0){let T=x+1;for(;T<r.length&&(r[T]===" "||r[T]===" "||r[T]==="\r"||r[T]===`
44
+ `);)T++;if(T<r.length&&(r[T]==="?"||r[T]===":"&&f>0))continue;let h=r.slice(P,x).trim();h&&s(h),P=x+1,o=x+1}}return P}function _(u=!1){c();let f=p(),m=r.slice(f).trim();if(!m)return i===0?pa():da(a,[...a.values()],!1,i,e,t);let{text:v,wasIncomplete:P}=ls(m),x=ua(oa(v));if(!x.length)return i===0?pa(P):da(a,[...a.values()],P,i,e,t);let k=new Map(a),T=new Set;for(let w of x){if(a.has(w.id)&&P)continue;let C=ra(w.tokens),A=us(w,C);k.set(w.id,A),T.add(A)}let h=u?void 0:/\$\w+$/.exec(n)?.[0],g=h&&m.endsWith(h)&&!new RegExp(`\\${h}(?!\\w)`).test(m.slice(0,-h.length))?h:void 0,S=[...k.values()];return da(k,S,P,i+x.length,e,t,g?{name:g,stmts:T}:void 0)}function d(){n="",r="",o=0,a.clear(),i=0}return{push(u,f){return n+=u,_(f)},set(u,f){(u.length<n.length||!u.startsWith(n))&&d();let m=u.slice(n.length);return m&&(n+=m),_(f)},getResult:_}}function ds(e,t){if(!e||typeof e!="object")return e;let n=e.$ref;if(typeof n=="string")return t.has(n)?ds(t.get(n),t):e;let r=Array.isArray(e)?[...e]:{...e},o=!1;for(let[a,i]of Object.entries(r))r[a]=ds(i,t),o||(o=r[a]!==i);return o?r:e}function cs(e,t){let n=e.properties??{},r=e.required??[];return Object.keys(n).map(o=>({name:o,required:r.includes(o),defaultValue:ia(n[o]),schema:t.size?ds(n[o],t):n[o]}))}function Hu(e){let t=new Map,n=e.properties&&new Set(Object.keys(e.properties)),r=new Map;for(let o of[...Object.keys(Su),...Object.keys(e.actions??{})]){let a=e.$defs?.[o];a&&!n?.has(o)&&r.set(`#/$defs/${o}`,a)}for(let[o,a]of Object.entries(e.$defs??{}))(n?!n.has(o):r.has(`#/$defs/${o}`))||t.set(o,{params:cs(a,r)});t.callDefs=new Map(ta);for(let[o,a]of Object.entries(e.functions??{}))t.callDefs.set(o,{kind:"function",params:cs(a.params,r)});for(let[o,a]of Object.entries(e.actions??{}))t.callDefs.set(o,{kind:"action",params:cs(a.params,r)});return t}var zu=Hu(or.schema),Ug={parse(e){return Uu(e,zu,or.root)}};function ju(){return qu(zu,or.root)}function _s(e,t){let n=e.root?.props.children,r=new Set,o=e.meta,a=e.meta.errors.some(f=>f.severity!=="warning"&&!(f.component==="Grid"&&f.path==="/columns"||f.component==="Cell"&&f.path==="/span"));function i(f,m,v){o===e.meta&&(o={...e.meta,errors:[...e.meta.errors]}),o.errors.push({code:"type-mismatch",component:f.typeName,path:m,message:v,statementId:f.statementId}),a=!0}function s(f,m,v){if(!Wt(f)||typeof f.statementId!="string"||r.has(f.statementId)){i(m,`/children/${v}`,"Child must be a valid, uniquely named component");return}if(f.typeName==="Root"||f.typeName==="Grid"&&m.typeName!=="Root"||f.typeName==="Cell"&&m.typeName==="Cell"){i(m,`/children/${v}`,"Component is not allowed at this nesting level");return}if(r.add(f.statementId),(f.typeName==="Chart"||f.typeName==="Table")&&e.meta.errors.some(k=>k.statementId===f.statementId&&k.severity!=="warning"))return;let P=(f.typeName==="Grid"||f.typeName==="Cell")&&Array.isArray(f.props.children)?f.props.children.flatMap((k,T)=>{let h=s(k,f,T);return h?[h]:[]}):void 0,x=P?{...f,props:{...f.props,children:P}}:f;if(!Pu(x)){i(f,"","Component does not match the catalog");return}if(x.typeName==="Table"&&x.props.rows.some(k=>k.length!==x.props.columns.length)){i(f,"/rows","Every table row must contain one value per column");return}if(P?.length!==0&&!((x.typeName==="Chart"||x.typeName==="Table")&&(t||e.meta.incomplete)))return x}let c=e.root,p=c&&Array.isArray(n)?n.flatMap((f,m)=>{if(Wt(f)&&f.typeName==="Cell")return i(c,`/children/${m}`,"Cell must be inside a Grid"),[];let v=s(f,c,m);return v&&v.typeName!=="Cell"?[v]:[]}):[],_=c?.hasDynamicProps===!0||e.queryStatements.length>0||e.mutationStatements.length>0||Object.keys(e.stateDeclarations).length>0||e.meta.errors.some(f=>f.code==="unknown-function"||f.code==="inline-reserved");_&&c&&i(c,"","Executable content is not supported by the static catalog"),c&&c.typeName!==or.root&&i(c,"","The block must use the catalog root component");let d=_||c!==null&&c.typeName!==or.root||!t&&(!Array.isArray(n)||p.length===0),u=!t&&!d&&(a||e.meta.incomplete);return!t&&(d||o.errors.length>0||o.unresolved.length>0||o.incomplete)&&console.warn("Generative UI diagnostics",{error:d,partial:u,diagnostics:o}),{elements:d?[]:p,error:d,partial:u,diagnostics:o}}function Vu(e){return _s(Ug.parse(e),!1).elements.flatMap(Wu).join(`
45
45
 
46
- `)}function xu(e){return e.typeName==="Grid"||e.typeName==="Cell"?e.props.children.flatMap(xu):e.typeName==="Text"?[e.props.text]:e.typeName==="Card"?[`${e.props.title}
46
+ `)}function Wu(e){return e.typeName==="Grid"||e.typeName==="Cell"?e.props.children.flatMap(Wu):e.typeName==="Text"?[e.props.text]:e.typeName==="Card"?[`${e.props.title}
47
47
  ${e.props.body}`]:e.typeName==="Metric"?[[e.props.label,e.props.value,e.props.detail].filter(Boolean).join(`
48
48
  `)]:e.typeName==="Table"?[[e.props.title,e.props.columns.join(" "),...e.props.rows.map(t=>t.join(" "))].join(`
49
49
  `)]:[[e.props.title,...e.props.data.map(t=>`${t.label}: ${t.value}`)].join(`
50
- `)]}function ns(e,{cssPrefix:t,strings:n}){let r=[],o;return{...Or(e),set_attr(a,i,s){if(i!==Nr||s!=="openui"||a.index!==1)return qi(a,i,s);let c=document.createElement("div");a.nodes[a.index]?.parentElement?.replaceWith(c),o={textSig:re(""),doneSig:re(!1)},r.push(c),cn(l(ng,{cssPrefix:t,textSig:o.textSig,doneSig:o.doneSig,strings:n}),c)},add_text(a,i){o?o.textSig.value=o.textSig.peek()+i:Ui(a,i)},end_token(a){o&&(o.doneSig.value=!0,o=void 0),Fi(a)},finish(){o&&(o.doneSig.value=!0)},dispose(){for(let a of r)cn(null,a);r.length=0,o=void 0}}}function ng({textSig:e,doneSig:t,cssPrefix:n,strings:r}){let o=ie(()=>{let a=yu();return he(()=>es(a.set(e.value,t.value),!t.value))},[e,t]);return o.value.error?l("div",{role:"alert",children:r.visualError}):l("div",{class:`${n}-generative-ui`,"aria-busy":!t.value,children:[o.value.elements.map(a=>l(ts,{element:a,cssPrefix:n},a.statementId)),o.value.partial&&l("p",{role:"status",children:r.visualPartial}),o.value.elements.length===0&&!t.value?l("span",{role:"status",children:r.visualPreparing}):null]})}function ts({element:e,cssPrefix:t}){if(e.typeName==="Grid")return l("div",{class:`${t}-generative-ui-grid-container`,children:l("div",{class:`${t}-generative-ui-grid`,"data-columns":e.props.columns,children:e.props.children.map(n=>l("div",{class:`${t}-generative-ui-cell`,"data-span":n.typeName==="Cell"?n.props.span??1:1,children:n.typeName==="Cell"?n.props.children.map(r=>l(ts,{element:r,cssPrefix:t},r.statementId)):l(ts,{element:n,cssPrefix:t})},n.statementId))})});switch(e.typeName){case"Text":return l("p",{children:e.props.text});case"Card":return l("section",{children:[l("strong",{children:e.props.title}),l("p",{children:e.props.body})]});case"Metric":return l("section",{children:[l("strong",{children:e.props.label}),l("span",{class:`${t}-generative-ui-metric`,children:e.props.value}),e.props.detail&&l("p",{children:e.props.detail})]});case"Table":return l("section",{children:l("div",{class:`${t}-generative-ui-table`,children:l("table",{children:[l("caption",{children:e.props.title}),l("thead",{children:l("tr",{children:e.props.columns.map((n,r)=>l("th",{scope:"col",children:n},r))})}),l("tbody",{children:e.props.rows.map((n,r)=>l("tr",{children:n.map((o,a)=>l("td",{children:o},a))},r))})]})})});case"Chart":return l(rg,{element:e,cssPrefix:t})}}function rg({element:e,cssPrefix:t}){let n=Math.min(0,...e.props.data.map(s=>s.value)),o=Math.max(0,...e.props.data.map(s=>s.value))-n||1,a=148+n/o*136,i=e.props.data.map((s,c)=>({x:24+(c+.5)*272/e.props.data.length,y:148-(s.value-n)/o*136}));return l("section",{children:[l("strong",{children:e.props.title}),l("svg",{class:`${t}-generative-ui-chart`,viewBox:"0 0 320 168",role:"img","aria-label":`${e.props.title}. ${e.props.data.map(s=>`${s.label}: ${s.value}`).join(", ")}`,children:[l("line",{class:`${t}-generative-ui-axis`,x1:24,x2:296,y1:a,y2:a}),e.props.type==="line"&&l("polyline",{points:i.map(s=>`${s.x},${s.y}`).join(" "),fill:"none",stroke:"currentColor","stroke-width":3}),i.map((s,c)=>e.props.type==="bar"?l("rect",{x:s.x-96/e.props.data.length,y:Math.min(s.y,a),width:192/e.props.data.length,height:Math.abs(s.y-a),fill:"currentColor"},c):l("circle",{cx:s.x,cy:s.y,r:3,fill:"currentColor"},c))]}),l("div",{class:`${t}-generative-ui-data`,children:e.props.data.map((s,c)=>l("span",{children:[s.label,": ",s.value]},c))})]})}function aa(e){if(!e.includes("```openui"))return e;let t="",n=0,r=0,o=0,a=0,i;function s(p){i?.language==="openui"&&(t+=e.slice(n,i.start)+Pu(i.source)+(e[p-1]===`
50
+ `)]}function ms(e,{cssPrefix:t,strings:n}){let r=[],o;return{...Ur(e),set_attr(a,i,s){if(i!==Br||s!=="openui"||a.index!==1)return es(a,i,s);let c=document.createElement("div");a.nodes[a.index]?.parentElement?.replaceWith(c),o={textSig:ae(""),doneSig:ae(!1)},r.push(c),_n(l(Hg,{cssPrefix:t,textSig:o.textSig,doneSig:o.doneSig,strings:n}),c)},add_text(a,i){o?o.textSig.value=o.textSig.peek()+i:Zi(a,i)},end_token(a){o&&(o.doneSig.value=!0,o=void 0),Yi(a)},finish(){o&&(o.doneSig.value=!0)},dispose(){for(let a of r)_n(null,a);r.length=0,o=void 0}}}function Hg({textSig:e,doneSig:t,cssPrefix:n,strings:r}){let o=ce(()=>{let a=ju();return ve(()=>_s(a.set(e.value,t.value),!t.value))},[e,t]);return o.value.error?l("div",{role:"alert",children:r.visualError}):l("div",{class:`${n}-generative-ui`,"aria-busy":!t.value,children:[o.value.elements.map(a=>l(fs,{element:a,cssPrefix:n},a.statementId)),o.value.partial&&l("p",{role:"status",children:r.visualPartial}),o.value.elements.length===0&&!t.value?l("span",{role:"status",children:r.visualPreparing}):null]})}function fs({element:e,cssPrefix:t}){if(e.typeName==="Grid")return l("div",{class:`${t}-generative-ui-grid-container`,children:l("div",{class:`${t}-generative-ui-grid`,"data-columns":e.props.columns,children:e.props.children.map(n=>l("div",{class:`${t}-generative-ui-cell`,"data-span":n.typeName==="Cell"?n.props.span??1:1,children:n.typeName==="Cell"?n.props.children.map(r=>l(fs,{element:r,cssPrefix:t},r.statementId)):l(fs,{element:n,cssPrefix:t})},n.statementId))})});switch(e.typeName){case"Text":return l("p",{children:e.props.text});case"Card":return l("section",{children:[l("strong",{children:e.props.title}),l("p",{children:e.props.body})]});case"Metric":return l("section",{children:[l("strong",{children:e.props.label}),l("span",{class:`${t}-generative-ui-metric`,children:e.props.value}),e.props.detail&&l("p",{children:e.props.detail})]});case"Table":return l("section",{children:l("div",{class:`${t}-generative-ui-table`,children:l("table",{children:[l("caption",{children:e.props.title}),l("thead",{children:l("tr",{children:e.props.columns.map((n,r)=>l("th",{scope:"col",children:n},r))})}),l("tbody",{children:e.props.rows.map((n,r)=>l("tr",{children:n.map((o,a)=>l("td",{children:o},a))},r))})]})})});case"Chart":return l(zg,{element:e,cssPrefix:t})}}function zg({element:e,cssPrefix:t}){let n=Math.min(0,...e.props.data.map(s=>s.value)),o=Math.max(0,...e.props.data.map(s=>s.value))-n||1,a=148+n/o*136,i=e.props.data.map((s,c)=>({x:24+(c+.5)*272/e.props.data.length,y:148-(s.value-n)/o*136}));return l("section",{children:[l("strong",{children:e.props.title}),l("svg",{class:`${t}-generative-ui-chart`,viewBox:"0 0 320 168",role:"img","aria-label":`${e.props.title}. ${e.props.data.map(s=>`${s.label}: ${s.value}`).join(", ")}`,children:[l("line",{class:`${t}-generative-ui-axis`,x1:24,x2:296,y1:a,y2:a}),e.props.type==="line"&&l("polyline",{points:i.map(s=>`${s.x},${s.y}`).join(" "),fill:"none",stroke:"currentColor","stroke-width":3}),i.map((s,c)=>e.props.type==="bar"?l("rect",{x:s.x-96/e.props.data.length,y:Math.min(s.y,a),width:192/e.props.data.length,height:Math.abs(s.y-a),fill:"currentColor"},c):l("circle",{cx:s.x,cy:s.y,r:3,fill:"currentColor"},c))]}),l("div",{class:`${t}-generative-ui-data`,children:e.props.data.map((s,c)=>l("span",{children:[s.label,": ",s.value]},c))})]})}function _a(e){if(!e.includes("```openui"))return e;let t="",n=0,r=0,o=0,a=0,i;function s(p){i?.language==="openui"&&(t+=e.slice(n,i.start)+Vu(i.source)+(e[p-1]===`
51
51
  `?`
52
- `:""),n=p),i=void 0}let c=Jn({data:void 0,add_token(p,d){a+=1,d===10&&a===1&&(i={start:o,source:"",language:""})},set_attr(p,d,_){i&&d===Nr&&(i.language=_)},add_text(p,d){i&&(i.source+=d)},end_token(){i&&s(Math.min(r+1,e.length)),a-=1}});for(;r<e.length;r++)We(c,e.charAt(r)),e[r]===`
53
- `&&(o=r+1);return Lr(c),i&&s(e.length),t+e.slice(n)}function Su(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function og(e){return`tool-${e.startsWith("tool:")?e.slice(5):e}`}function ku(e){return e.startsWith("tool-")?e.slice(5):e}var at={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",contentCollections:"/pai/content/collection/list",contentVoteSet:"/pai/content/vote/set",submitForm:"/pai/submit-form"},wu="context";function ia(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Cu(e){if(!ia(e))return;let t=e,n=t.controlMode,r=t.controlRevision;if(!(n!=="ai-agent"&&n!=="awaiting-operator"&&n!=="operator"||typeof r!="number"||!Number.isSafeInteger(r)||r<0))return{controlMode:n,controlRevision:r,assignedOperatorInitials:typeof t.assignedOperatorInitials=="string"&&t.assignedOperatorInitials?t.assignedOperatorInitials:void 0,operatorAvailable:typeof t.operatorAvailable=="boolean"?t.operatorAvailable:void 0}}function Ru(e){if(!ia(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 sa(e){let t=ia(e)?e.suggestions:void 0;if(!Array.isArray(t))return[];let n=[];for(let r of t){if(!ia(r))continue;let{id:o,label:a,text:i}=r;typeof a!="string"||!a||n.push({id:typeof o=="string"&&o?o:`s${n.length}`,label:a,text:typeof i=="string"&&i?i:a})}return n}function rs(e){let n={messages:e.messages.map(r=>({id:r.serverMessageId??r.id,parts:ig(r),role:r.role})),conversationId:e.conversationId,responseType:"ack"};return e.visitorId&&(n.visitorId=e.visitorId),e.userPrefs&&(n.userPrefs=e.userPrefs),n}function ag(e){return e.state==="output-available"||e.state==="output-error"||e.state==="output-denied"||e.approval?.approved!==void 0}function ig(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"&&ag(n)){let r=n.dynamic?{type:"dynamic-tool",toolName:n.toolName,toolCallId:n.toolCallId,state:n.state}:{type:og(n.toolName),toolCallId:n.toolCallId,state:n.state};n.input!==void 0&&(r.input=n.input),n.output!==void 0&&(r.output=n.output),n.error!==void 0&&(r.errorText=n.error),n.approval?.approved!==void 0&&(r.approval=n.approval),t.push(r)}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}function as(e,t,n=kt()){let r=e?[{kind:"text",id:"t0",textSig:re(e),doneSig:re(!0)}]:[];return{id:n,role:"user",createdAt:Date.now(),status:"complete",attachments:t,partsSig:re(r)}}function en(){return{id:kt(),role:"assistant",createdAt:Date.now(),status:"streaming",partsSig:re([])}}function Tu(e){let t=kt();return sg({id:t,role:e.role,createdAt:Date.now(),status:"complete",ephemeral:!0,parts:[{kind:"text",id:`${t}-t0`,text:e.text,done:!0}]})}function sg(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:re(e.parts.map(fg))}}function lg(e){return e.status==="failed"?"error":e.role==="assistant"&&e.status==="streaming"?"streaming":"complete"}function is(e){let t=new Set,n=e.parts.map((o,a)=>o.type==="text"?{kind:"text",id:`${e.id}-t${a}`,textSig:re(o.text),doneSig:re(!0)}:o.type==="reasoning"?{kind:"reasoning",id:`${e.id}-r${a}`,textSig:re(o.text),doneSig:re(o.state!=="streaming")}:o.type==="step-start"?{kind:"step-start",id:`${e.id}-ss${a}`}:o.type==="file"?{kind:"file",url:o.url,mediaType:o.mediaType}:o.type==="source-url"?{kind:"source",sourceId:o.sourceId,url:o.url,title:o.title}:o.type==="source-document"?{kind:"source",sourceId:o.sourceId,title:o.title,filename:o.filename,mediaType:o.mediaType}:o.type==="data-suggestions"?null:o.type==="dynamic-tool"||o.type.startsWith("tool-")?{kind:"tool",toolCallId:o.toolCallId,toolName:o.type==="dynamic-tool"?o.toolName:ku(o.type),dynamic:o.type==="dynamic-tool"?!0:void 0,inputPartialSig:re(""),inputSig:re(o.input),outputSig:re(o.output),errorSig:re(o.errorText),stateSig:re(o.state),approvalSig:re(o.approval)}:null).filter(o=>o!==null).filter(o=>o.kind!=="source"?!0:t.has(o.sourceId)?!1:(t.add(o.sourceId),!0)),r=e.parts.find(o=>o.type==="data-suggestions");return{id:e.id,role:e.role,operatorInitials:e.operatorInitials,suggestions:r?.type==="data-suggestions"?sa(r.data):void 0,serverMessageId:e.id,createdAt:Date.parse(e.createdAt),status:lg(e),canceled:e.status==="canceled",feedback:e.feedback??null,partsSig:re(n)}}function cg(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 ug(e){return e.role==="assistant"&&e.status==="streaming"&&cg(e)}function pn(e){let t=e.length-1;return e.filter((n,r)=>r===t||!ug(n)).map(is)}function Au(e,t){let n=!t&&e.at(-1)?.role==="assistant"?-2:-1,r=e.at(n);return!r||r.ephemeral?[]:[r]}function ss(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(mg)}}function He(e){let t="";for(let n of e.partsSig.value)n.kind==="text"&&(t+=n.textSig.value);return t}function la(e,t,n,r,o,a=t.createdAt){let i=e.find(d=>d.role==="user"&&!d.ephemeral);function s(d,_){return(d.role==="assistant"?aa(He(d)):He(d)).replace(/\s+/g," ").trim().slice(0,_)}let c=i?s(i,80):"",p=s(t,120);return{conversationId:n,title:c||r,lastMessageAt:new Date(a).toISOString(),preview:p||void 0,canContinue:o}}function qt(e){return He(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file"||t.kind==="source")}function dg(e){return He(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file")}function ls(e){return e==="approval-responded"||e==="output-available"||e==="output-denied"||e==="output-error"}function tr(e){return e.kind==="tool"}function Eu(e){return e.kind==="text"&&e.textSig.value.trim()!==""||e.kind==="file"}function zr(e){let t=e.partsSig.value,n=t.findLastIndex(r=>r.kind==="tool");return t.slice(n+1).some(Eu)}function An(e){if(e.role!=="assistant")return!1;let t=e.partsSig.value.filter(tr);return t.length>0&&t.every(n=>ls(n.stateSig.value))}function En(e){return e.role!=="assistant"?!1:e.partsSig.value.some(t=>t.kind==="tool")&&!zr(e)}function ca(e,t){return!e.partsSig.value.slice(t+1).some(n=>n.kind==="step-start"||Eu(n))}function ua(e){return e.partsSig.value.some(t=>tr(t)&&!ls(t.stateSig.value))}function Mu(e,t){if(t.length===0)return e;let n=new Set;for(let i of e)n.add(i.id),i.serverMessageId&&n.add(i.serverMessageId);let r=t.filter(i=>{let s=[i.id,i.serverMessageId].filter(c=>c!==void 0);return s.some(c=>n.has(c))?!1:(s.forEach(c=>n.add(c)),!0)});if(r.length===0)return e;let o=e.findIndex(i=>!i.ephemeral),a=o<0?e.length:o;return[...e.slice(0,a),...r,...e.slice(a)]}function In(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 Nu(e,t,n,r){if(!cs(e))return;if(t.length===0){let i=Math.max(...r.values());return n.find(s=>s.role==="assistant"&&r.get(s.serverMessageId??s.id)===i&&He(s).length>=He(e).length)}let o=t.at(-1);if(o?.role!=="user")return;let a=r.get(o.serverMessageId??o.id);if(a!==void 0)return n.find(i=>i.role==="assistant"&&r.get(i.serverMessageId??i.id)===a+1&&He(i).length>=He(e).length)}function cs(e){return e?.role==="assistant"&&e.status==="streaming"&&e.serverMessageId===void 0}function pg(e,t){let n=new Map(t.partsSig.value.filter(tr).filter(a=>ls(a.stateSig.value)).map(a=>[a.toolCallId,a]));if(n.size===0)return;let r=!1,o=e.partsSig.value.map(a=>{if(!tr(a))return a;let i=n.get(a.toolCallId);if(!i)return a;let s=a.approvalSig.value,c=i.approvalSig.value,p=s===void 0||s.approved===void 0&&c?.approved!==void 0?i.approvalSig:a.approvalSig,d=a.inputSig.value===void 0?i.inputSig:a.inputSig,_=a.toolName==="tool"?i.toolName:a.toolName,u=a.dynamic??i.dynamic;return p===a.approvalSig&&d===a.inputSig&&_===a.toolName&&u===a.dynamic?a:(r=!0,{...a,toolName:_,dynamic:u,inputSig:d,approvalSig:p})});r&&(e.partsSig.value=o)}function us(e,t){let n=t.filter(_=>!_.ephemeral&&(_.status==="streaming"||_.status==="pending"||_.status==="error"||_.retryAction!==void 0||(_.attachments?.length??0)>0||qt(_))),r=new Map;for(let _ of n)r.set(_.id,_),_.serverMessageId!==void 0&&r.set(_.serverMessageId,_);let o=new Set,a=[],i=e.map(_=>{let u=(_.serverMessageId!==void 0?r.get(_.serverMessageId):void 0)??r.get(_.id);return u===void 0?(a.push(_),_):(o.add(u),u.role!==_.role?_:u.role==="user"&&u.serverMessageId===void 0&&(u.status==="pending"||u.status==="error")?In(u,_):u.status==="streaming"||He(u).length>=He(_).length?(pg(u,_),u.suggestions??(u.suggestions=_.suggestions),u.feedback===void 0&&(u.feedback=_.feedback),_.canceled&&(u.canceled=!0),u):In(u,_))}),s=n.filter(_=>!o.has(_)),c=s.findLast(cs),p=new Map;e.forEach((_,u)=>{p.set(_.id,u),_.serverMessageId!==void 0&&p.set(_.serverMessageId,u)});let d=Nu(c,c?n.slice(0,n.indexOf(c)):[],a,p);if(c&&d){let _=i.indexOf(d);_>=0&&(i[_]=In(c,d)),s=s.filter(u=>u!==c)}return[...i,...s]}function Hr(e,t){let n=new Map(t.filter(_=>_.serverMessageId!==void 0).map(_=>[_.serverMessageId,_])),r=new Map;t.forEach((_,u)=>{r.set(_.id,u),_.serverMessageId!==void 0&&r.set(_.serverMessageId,u)});let o=new Set(e.flatMap(_=>[_.serverMessageId,_.id].filter(u=>u!==void 0))),a=!1,i=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,In(_,u);if(_.serverMessageId===void 0)return _;let f=He(u),m=He(_),h=u.status!=="streaming"&&f.length>=m.length&&os(_,u);if(f.length>m.length||f===m&&u.partsSig.value.length>_.partsSig.value.length||h)return a=!0,In(_,u);if(_.status==="streaming"&&u.status!=="streaming"&&_g(_,u)){if(_.continuationStreaming&&ua(u))return _;if(!os(u,_))return a=!0,In(_,u)}return _}),s=[...n.values()].filter(_=>!o.has(_.serverMessageId)),c=i.findLastIndex(cs),p=i[c],d=Nu(p,i.slice(0,c),s,r);if(p!==void 0&&d!==void 0&&He(d).length>=He(p).length&&(In(p,d),i[c]=d,s.splice(s.indexOf(d),1),a=!0),s.length===0)return{messages:a?i:e,changed:a};for(let _ of s){let u=r.get(_.serverMessageId??_.id),f=!1,m=i.findIndex(h=>{let y=r.get(h.serverMessageId??h.id);return u===void 0?!1:y===void 0?f:y>u?!0:(f=!0,!1)});m===-1?i.push(_):i.splice(m,0,_)}return{messages:i,changed:!0}}function Lu(e,t){if(e.role!==t.role)return!1;let n=He(t),r=He(e);return n.length>r.length||t.partsSig.value.length>e.partsSig.value.length||os(e,t)}function _g(e,t){let n=e.partsSig.value,r=t.partsSig.value;return n.length!==r.length?!1:n.every((o,a)=>{let i=r[a];switch(o.kind){case"text":return i?.kind==="text"&&i.textSig.value===o.textSig.value;case"reasoning":return i?.kind==="reasoning"&&i.textSig.value===o.textSig.value;case"step-start":return i?.kind==="step-start";case"tool":return i?.kind==="tool"&&i.toolCallId===o.toolCallId&&da(i.toolName,o.toolName);case"file":return i?.kind==="file"&&i.url===o.url&&i.mediaType===o.mediaType;case"source":return i?.kind==="source"&&i.sourceId===o.sourceId&&i.url===o.url&&i.title===o.title&&i.filename===o.filename&&i.mediaType===o.mediaType;default:return o}})}function da(e,t){let n=e.startsWith("tool:")?e.slice(5):e,r=t.startsWith("tool:")?t.slice(5):t;return n===r}var Iu={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function os(e,t){let n=new Map(e.partsSig.value.filter(tr).map(r=>[r.toolCallId,r]));return t.partsSig.value.filter(tr).some(r=>{let o=n.get(r.toolCallId);if(!o||Iu[r.stateSig.value]>Iu[o.stateSig.value])return!0;let a=r.approvalSig.value?.approved;return a!==void 0&&a!==o.approvalSig.value?.approved})}function Tn(e){return e.role==="assistant"&&e.status!=="streaming"&&!qt(e)}function pa(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 r=n-1;r>=0;r--){let o=e[r];if(o?.role==="user"&&!o.ephemeral)return{kind:"repeat-user",messageId:o.id}}}function Ou(e){return e.canceled===!0&&e.role==="assistant"&&e.status!=="streaming"&&!dg(e)}function $u(e,t){return e.operatorRoutedTurn?Tn(e)?"drop":"complete-operator-routed":t||Tn(e)?"error":"complete"}function fg(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,textSig:re(e.text),doneSig:re(e.done)}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,dynamic:e.dynamic,inputPartialSig:re(e.inputPartial),inputSig:re(e.input),outputSig:re(e.output),errorSig:re(e.error),stateSig:re(e.state),approvalSig:re(e.approval)}:e}function mg(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}function jr(e,t){return new Promise(n=>{if(t?.aborted)return n();let r=setTimeout(a,e);function o(){return a()}t?.addEventListener("abort",o,{once:!0});function a(){clearTimeout(r),t?.removeEventListener("abort",o),n()}})}function gg(e){let t=new TextEncoder().encode(e),n="";for(let r of t)n+=String.fromCharCode(r);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Du(e){return e&&Object.keys(e).length>0?e:void 0}function Bu(e,t){let n=Du(e),r=Du(t);if(!n&&!r)return;let o={};return n&&(o.user=n),r&&(o.page=r),gg(JSON.stringify(o))}var it=class extends Error{constructor(n,r,o,a){super(n);ee(this,"code",r);ee(this,"status",o);ee(this,"cause",a);this.name="StreamError"}};var Fu=le.scope("parser");async function*Uu(e,t,n){if(!e.ok){let r=await e.text().catch(()=>"");throw new it(`server responded ${e.status}: ${r.slice(0,200)}`,"server",e.status)}for await(let r of vg(e,t)){let o=hg(r,n);if(o==="done")return;o&&(yield o)}}async function*vg(e,t){if(!e.body)throw new it("response has no body","no-body");let n=e.body.pipeThrough(new TextDecoderStream).getReader(),r="";try{for(;;){if(t.aborted)throw new DOMException("aborted","AbortError");let{done:o,value:a}=await n.read();if(o){let s=r.trim();s&&(yield s);return}r+=a;let i;for(;(i=r.indexOf(`
52
+ `:""),n=p),i=void 0}let c=rr({data:void 0,add_token(p,_){a+=1,_===10&&a===1&&(i={start:o,source:"",language:""})},set_attr(p,_,d){i&&_===Br&&(i.language=d)},add_text(p,_){i&&(i.source+=_)},end_token(){i&&s(Math.min(r+1,e.length)),a-=1}});for(;r<e.length;r++)Ge(c,e.charAt(r)),e[r]===`
53
+ `&&(o=r+1);return Fr(c),i&&s(e.length),t+e.slice(n)}function Gu(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function jg(e){return`tool-${e.startsWith("tool:")?e.slice(5):e}`}function Ku(e){return e.startsWith("tool-")?e.slice(5):e}var it={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",contentCollections:"/pai/content/collection/list",contentVoteSet:"/pai/content/vote/set",submitForm:"/pai/submit-form"},gs="context";function fa(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Qu(e){if(!fa(e))return;let t=e,n=t.controlMode,r=t.controlRevision;if(!(n!=="ai-agent"&&n!=="awaiting-operator"&&n!=="operator"||typeof r!="number"||!Number.isSafeInteger(r)||r<0))return{controlMode:n,controlRevision:r,assignedOperatorInitials:typeof t.assignedOperatorInitials=="string"&&t.assignedOperatorInitials?t.assignedOperatorInitials:void 0,operatorAvailable:typeof t.operatorAvailable=="boolean"?t.operatorAvailable:void 0}}function Xu(e){if(!fa(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 ma(e){let t=fa(e)?e.suggestions:void 0;if(!Array.isArray(t))return[];let n=[];for(let r of t){if(!fa(r))continue;let{id:o,label:a,text:i}=r;typeof a!="string"||!a||n.push({id:typeof o=="string"&&o?o:`s${n.length}`,label:a,text:typeof i=="string"&&i?i:a})}return n}function hs(e){let n={messages:e.messages.map(r=>({id:r.serverMessageId??r.id,parts:Wg(r),role:r.role})),conversationId:e.conversationId,responseType:"ack"};return e.visitorId&&(n.visitorId=e.visitorId),e.userPrefs&&(n.userPrefs=e.userPrefs),e.clientTools?.length&&(n.clientTools=e.clientTools),n}function Vg(e){return e.state==="output-available"||e.state==="output-error"||e.state==="output-denied"||e.approval?.approved!==void 0}function Wg(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"&&Vg(n)){let r=n.dynamic?{type:"dynamic-tool",toolName:n.toolName,toolCallId:n.toolCallId,state:n.state}:{type:jg(n.toolName),toolCallId:n.toolCallId,state:n.state};n.input!==void 0&&(r.input=n.input),n.output!==void 0&&(r.output=n.output),n.error!==void 0&&(r.errorText=n.error),n.approval?.approved!==void 0&&(r.approval=n.approval),n.toolMetadata&&(r.toolMetadata=n.toolMetadata),t.push(r)}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}function bs(e,t,n=wt()){let r=e?[{kind:"text",id:"t0",textSig:ae(e),doneSig:ae(!0)}]:[];return{id:n,role:"user",createdAt:Date.now(),status:"complete",attachments:t,partsSig:ae(r)}}function rn(){return{id:wt(),role:"assistant",createdAt:Date.now(),status:"streaming",partsSig:ae([])}}function Yu(e){let t=wt();return Gg({id:t,role:e.role,createdAt:Date.now(),status:"complete",ephemeral:!0,parts:[{kind:"text",id:`${t}-t0`,text:e.text,done:!0}]})}function Gg(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:ae(e.parts.map(eh))}}function Kg(e){return e.status==="failed"?"error":e.role==="assistant"&&e.status==="streaming"?"streaming":"complete"}function ys(e){let t=new Set,n=e.parts.map((o,a)=>o.type==="text"?{kind:"text",id:`${e.id}-t${a}`,textSig:ae(o.text),doneSig:ae(!0)}:o.type==="reasoning"?{kind:"reasoning",id:`${e.id}-r${a}`,textSig:ae(o.text),doneSig:ae(o.state!=="streaming")}:o.type==="step-start"?{kind:"step-start",id:`${e.id}-ss${a}`}:o.type==="file"?{kind:"file",url:o.url,mediaType:o.mediaType}:o.type==="source-url"?{kind:"source",sourceId:o.sourceId,url:o.url,title:o.title}:o.type==="source-document"?{kind:"source",sourceId:o.sourceId,title:o.title,filename:o.filename,mediaType:o.mediaType}:o.type==="data-suggestions"?null:o.type==="dynamic-tool"||o.type.startsWith("tool-")?{kind:"tool",toolCallId:o.toolCallId,toolName:o.type==="dynamic-tool"?o.toolName:Ku(o.type),dynamic:o.type==="dynamic-tool"?!0:void 0,toolMetadata:o.toolMetadata,inputPartialSig:ae(""),inputSig:ae(o.input),outputSig:ae(o.output),errorSig:ae(o.errorText),stateSig:ae(o.state),approvalSig:ae(o.approval)}:null).filter(o=>o!==null).filter(o=>o.kind!=="source"?!0:t.has(o.sourceId)?!1:(t.add(o.sourceId),!0)),r=e.parts.find(o=>o.type==="data-suggestions");return{id:e.id,role:e.role,operatorInitials:e.operatorInitials,suggestions:r?.type==="data-suggestions"?ma(r.data):void 0,serverMessageId:e.id,createdAt:Date.parse(e.createdAt),status:Kg(e),canceled:e.status==="canceled",feedback:e.feedback??null,partsSig:ae(n)}}function Qg(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 Xg(e){return e.role==="assistant"&&e.status==="streaming"&&Qg(e)}function gn(e){let t=e.length-1;return e.filter((n,r)=>r===t||!Xg(n)).map(ys)}function Zu(e,t){let n=!t&&e.at(-1)?.role==="assistant"?-2:-1,r=e.at(n);return!r||r.ephemeral?[]:[r]}function Ps(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(th)}}function ze(e){let t="";for(let n of e.partsSig.value)n.kind==="text"&&(t+=n.textSig.value);return t}function ga(e,t,n,r,o,a=t.createdAt){let i=e.find(_=>_.role==="user"&&!_.ephemeral);function s(_,d){return(_.role==="assistant"?_a(ze(_)):ze(_)).replace(/\s+/g," ").trim().slice(0,d)}let c=i?s(i,80):"",p=s(t,120);return{conversationId:n,title:c||r,lastMessageAt:new Date(a).toISOString(),preview:p||void 0,canContinue:o}}function jt(e){return ze(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file"||t.kind==="source")}function Jg(e){return ze(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file")}function xs(e){return e==="approval-responded"||e==="output-available"||e==="output-denied"||e==="output-error"}function ir(e){return e.kind==="tool"}function ed(e){return e.kind==="text"&&e.textSig.value.trim()!==""||e.kind==="file"}function Gr(e){let t=e.partsSig.value,n=t.findLastIndex(r=>r.kind==="tool");return t.slice(n+1).some(ed)}function Ln(e){if(e.role!=="assistant")return!1;let t=e.partsSig.value.filter(ir);return t.length>0&&t.every(n=>xs(n.stateSig.value))}function On(e){return e.role!=="assistant"?!1:e.partsSig.value.some(t=>t.kind==="tool")&&!Gr(e)}function ha(e,t){return!e.partsSig.value.slice(t+1).some(n=>n.kind==="step-start"||ed(n))}function va(e){return e.partsSig.value.some(t=>ir(t)&&!xs(t.stateSig.value))}function td(e,t){if(t.length===0)return e;let n=new Set;for(let i of e)n.add(i.id),i.serverMessageId&&n.add(i.serverMessageId);let r=t.filter(i=>{let s=[i.id,i.serverMessageId].filter(c=>c!==void 0);return s.some(c=>n.has(c))?!1:(s.forEach(c=>n.add(c)),!0)});if(r.length===0)return e;let o=e.findIndex(i=>!i.ephemeral),a=o<0?e.length:o;return[...e.slice(0,a),...r,...e.slice(a)]}function Mn(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 nd(e,t,n,r){if(!Ss(e))return;if(t.length===0){let i=Math.max(...r.values());return n.find(s=>s.role==="assistant"&&r.get(s.serverMessageId??s.id)===i&&ze(s).length>=ze(e).length)}let o=t.at(-1);if(o?.role!=="user")return;let a=r.get(o.serverMessageId??o.id);if(a!==void 0)return n.find(i=>i.role==="assistant"&&r.get(i.serverMessageId??i.id)===a+1&&ze(i).length>=ze(e).length)}function Ss(e){return e?.role==="assistant"&&e.status==="streaming"&&e.serverMessageId===void 0}function Yg(e,t){let n=new Map(t.partsSig.value.filter(ir).filter(a=>xs(a.stateSig.value)).map(a=>[a.toolCallId,a]));if(n.size===0)return;let r=!1,o=e.partsSig.value.map(a=>{if(!ir(a))return a;let i=n.get(a.toolCallId);if(!i)return a;let s=a.approvalSig.value,c=i.approvalSig.value,p=s===void 0||s.approved===void 0&&c?.approved!==void 0?i.approvalSig:a.approvalSig,_=a.inputSig.value===void 0?i.inputSig:a.inputSig,d=a.toolName==="tool"?i.toolName:a.toolName,u=a.dynamic??i.dynamic;return p===a.approvalSig&&_===a.inputSig&&d===a.toolName&&u===a.dynamic?a:(r=!0,{...a,toolName:d,dynamic:u,inputSig:_,approvalSig:p})});r&&(e.partsSig.value=o)}function ks(e,t){let n=t.filter(d=>!d.ephemeral&&(d.status==="streaming"||d.status==="pending"||d.status==="error"||d.retryAction!==void 0||(d.attachments?.length??0)>0||jt(d))),r=new Map;for(let d of n)r.set(d.id,d),d.serverMessageId!==void 0&&r.set(d.serverMessageId,d);let o=new Set,a=[],i=e.map(d=>{let u=(d.serverMessageId!==void 0?r.get(d.serverMessageId):void 0)??r.get(d.id);return u===void 0?(a.push(d),d):(o.add(u),u.role!==d.role?d:u.role==="user"&&u.serverMessageId===void 0&&(u.status==="pending"||u.status==="error")?Mn(u,d):u.status==="streaming"||ze(u).length>=ze(d).length?(Yg(u,d),u.suggestions??(u.suggestions=d.suggestions),u.feedback===void 0&&(u.feedback=d.feedback),d.canceled&&(u.canceled=!0),u):Mn(u,d))}),s=n.filter(d=>!o.has(d)),c=s.findLast(Ss),p=new Map;e.forEach((d,u)=>{p.set(d.id,u),d.serverMessageId!==void 0&&p.set(d.serverMessageId,u)});let _=nd(c,c?n.slice(0,n.indexOf(c)):[],a,p);if(c&&_){let d=i.indexOf(_);d>=0&&(i[d]=Mn(c,_)),s=s.filter(u=>u!==c)}return[...i,...s]}function Kr(e,t){let n=new Map(t.filter(d=>d.serverMessageId!==void 0).map(d=>[d.serverMessageId,d])),r=new Map;t.forEach((d,u)=>{r.set(d.id,u),d.serverMessageId!==void 0&&r.set(d.serverMessageId,u)});let o=new Set(e.flatMap(d=>[d.serverMessageId,d.id].filter(u=>u!==void 0))),a=!1,i=e.map(d=>{let u=n.get(d.serverMessageId??d.id);if(u===void 0||u.role!==d.role)return d;if(d.role==="user"&&d.serverMessageId===void 0)return a=!0,Mn(d,u);if(d.serverMessageId===void 0)return d;let f=ze(u),m=ze(d),v=u.status!=="streaming"&&f.length>=m.length&&vs(d,u);if(f.length>m.length||f===m&&u.partsSig.value.length>d.partsSig.value.length||v)return a=!0,Mn(d,u);if(d.status==="streaming"&&u.status!=="streaming"&&Zg(d,u)){if(d.continuationStreaming&&va(u))return d;if(!vs(u,d))return a=!0,Mn(d,u)}return d}),s=[...n.values()].filter(d=>!o.has(d.serverMessageId)),c=i.findLastIndex(Ss),p=i[c],_=nd(p,i.slice(0,c),s,r);if(p!==void 0&&_!==void 0&&ze(_).length>=ze(p).length&&(Mn(p,_),i[c]=_,s.splice(s.indexOf(_),1),a=!0),s.length===0)return{messages:a?i:e,changed:a};for(let d of s){let u=r.get(d.serverMessageId??d.id),f=!1,m=i.findIndex(v=>{let P=r.get(v.serverMessageId??v.id);return u===void 0?!1:P===void 0?f:P>u?!0:(f=!0,!1)});m===-1?i.push(d):i.splice(m,0,d)}return{messages:i,changed:!0}}function rd(e,t){if(e.role!==t.role)return!1;let n=ze(t),r=ze(e);return n.length>r.length||t.partsSig.value.length>e.partsSig.value.length||vs(e,t)}function Zg(e,t){let n=e.partsSig.value,r=t.partsSig.value;return n.length!==r.length?!1:n.every((o,a)=>{let i=r[a];switch(o.kind){case"text":return i?.kind==="text"&&i.textSig.value===o.textSig.value;case"reasoning":return i?.kind==="reasoning"&&i.textSig.value===o.textSig.value;case"step-start":return i?.kind==="step-start";case"tool":return i?.kind==="tool"&&i.toolCallId===o.toolCallId&&ba(i.toolName,o.toolName);case"file":return i?.kind==="file"&&i.url===o.url&&i.mediaType===o.mediaType;case"source":return i?.kind==="source"&&i.sourceId===o.sourceId&&i.url===o.url&&i.title===o.title&&i.filename===o.filename&&i.mediaType===o.mediaType;default:return o}})}function ba(e,t){let n=e.startsWith("tool:")?e.slice(5):e,r=t.startsWith("tool:")?t.slice(5):t;return n===r}var Ju={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function vs(e,t){let n=new Map(e.partsSig.value.filter(ir).map(r=>[r.toolCallId,r]));return t.partsSig.value.filter(ir).some(r=>{let o=n.get(r.toolCallId);if(!o||Ju[r.stateSig.value]>Ju[o.stateSig.value])return!0;let a=r.approvalSig.value?.approved;return a!==void 0&&a!==o.approvalSig.value?.approved})}function Nn(e){return e.role==="assistant"&&e.status!=="streaming"&&!jt(e)}function ya(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"&&!Nn(t))return;let n=e.indexOf(t);for(let r=n-1;r>=0;r--){let o=e[r];if(o?.role==="user"&&!o.ephemeral)return{kind:"repeat-user",messageId:o.id}}}function od(e){return e.canceled===!0&&e.role==="assistant"&&e.status!=="streaming"&&!Jg(e)}function ad(e,t){return e.operatorRoutedTurn?Nn(e)?"drop":"complete-operator-routed":t||Nn(e)?"error":"complete"}function eh(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,textSig:ae(e.text),doneSig:ae(e.done)}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,dynamic:e.dynamic,toolMetadata:e.toolMetadata,inputPartialSig:ae(e.inputPartial),inputSig:ae(e.input),outputSig:ae(e.output),errorSig:ae(e.error),stateSig:ae(e.state),approvalSig:ae(e.approval)}:e}function th(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,toolMetadata:e.toolMetadata,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}function $n(e,t){return new Promise(n=>{if(t?.aborted)return n();let r=setTimeout(a,e);function o(){return a()}t?.addEventListener("abort",o,{once:!0});function a(){clearTimeout(r),t?.removeEventListener("abort",o),n()}})}function nh(e){let t=new TextEncoder().encode(e),n="";for(let r of t)n+=String.fromCharCode(r);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function id(e){return e&&Object.keys(e).length>0?e:void 0}function ws(e,t,n=[]){let r=id(e),o=id(t),a=Date.now();for(let i=n.length;;i-=1){let s=n.slice(n.length-i).map(({name:_,data:d,at:u})=>({name:_,data:d,secondsAgo:Math.round((a-u)/1e3)})),c=s.length>0?{...o,recentEvents:s}:o;if(!r&&!c)return;let p=nh(JSON.stringify({...r&&{user:r},...c&&{page:c}}));if(p.length<=8192||i===0)return p}}var st=class extends Error{constructor(n,r,o,a){super(n);te(this,"code",r);te(this,"status",o);te(this,"cause",a);this.name="StreamError"}};var sd=se.scope("parser");async function*ld(e,t,n){if(!e.ok){let r=await e.text().catch(()=>"");throw new st(`server responded ${e.status}: ${r.slice(0,200)}`,"server",e.status)}for await(let r of rh(e,t)){let o=oh(r,n);if(o==="done")return;o&&(yield o)}}async function*rh(e,t){if(!e.body)throw new st("response has no body","no-body");let n=e.body.pipeThrough(new TextDecoderStream).getReader(),r="";try{for(;;){if(t.aborted)throw new DOMException("aborted","AbortError");let{done:o,value:a}=await n.read();if(o){let s=r.trim();s&&(yield s);return}r+=a;let i;for(;(i=r.indexOf(`
54
54
 
55
- `))!==-1;){let s=r.slice(0,i);r=r.slice(i+2),yield s}}}finally{n.releaseLock()}}function hg(e,t){let n="",r;for(let o of e.split(`
55
+ `))!==-1;){let s=r.slice(0,i);r=r.slice(i+2),yield s}}}finally{n.releaseLock()}}function oh(e,t){let n="",r;for(let o of e.split(`
56
56
  `))if(o!==""){if(o.startsWith(":")){t?.(o.slice(1).trim());continue}if(o.startsWith("data:")){let a=o.slice(5).replace(/^ /,"");n=n?`${n}
57
- ${a}`:a;continue}o.startsWith("id:")&&(r=o.slice(3).trim())}if(n==="[DONE]")return"done";if(!n)return null;try{let o=JSON.parse(n);return Fu.trace("chunk",{type:o.type,eventId:r}),{chunk:o,eventId:r}}catch(o){throw Fu.trace("frame parse failed",{errorType:o instanceof Error?o.name:typeof o,payloadLength:n.length}),new it("invalid SSE frame","network",void 0,o)}}var Ie=le.scope("transport"),bg="x-user-token",qu=6e4,yg=1e4,ds=50,Wu=new WeakMap;function nr(e){return Wu.get(e)}function Vr(e,t){return Wu.set(e,t),e}function zu(e){return Math.max(e?.upsertRevision??0,e?.read?.revision??0)}function Pg(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 tn(e,t,n=!0){switch(t.type){case"snapshot":{let r=new Map(e.map(i=>[i.conversationId,i])),o=e.filter(i=>(nr(i)?.activityRevision??0)>t.requestedRevision).toSorted((i,s)=>nr(s).activityRevision-nr(i).activityRevision),a=new Set(o.map(i=>i.conversationId));return[...o,...t.result.conversations.filter(i=>!a.has(i.conversationId)).map(i=>{let s=r.get(i.conversationId);if(!s)return i;let c=nr(s);return(c?.upsertRevision??0)>t.requestedRevision?s:c?.read&&!s.hasUnread&&c.read.lastMessageAt===i.lastMessageAt?Vr({...i,hasUnread:!1},{upsertRevision:0,read:c.read}):i})]}case"read":{let r=e.findIndex(c=>c.conversationId===t.conversationId&&(t.lastMessageAt===void 0||c.lastMessageAt===t.lastMessageAt));if(r<0)return e;let o=e[r],a=nr(o);if(zu(a)>t.revision)return e;let i=t.lastMessageAt??o.lastMessageAt,s={upsertRevision:a?.upsertRevision??0,...a?.activityRevision===void 0?{}:{activityRevision:a.activityRevision},read:{revision:t.revision,...i?{lastMessageAt:i}:{}}};return o.hasUnread?e.map((c,p)=>p===r?Vr({...c,hasUnread:!1},s):c):(Vr(o,s),e)}case"upsert":{let r=e.findIndex(p=>p.conversationId===t.conversation.conversationId);if(r<0&&!n)return e;let o=r<0?void 0:e[r],a=o?nr(o):void 0;if(zu(a)>t.revision)return e;let i=t.activity?t.revision:a?.activityRevision,s={upsertRevision:t.revision,...i===void 0?{}:{activityRevision:i},...!t.conversation.hasUnread&&a?.read?{read:a.read}:{}},c=o?{...o,...t.conversation,title:o.title}:{...t.conversation};return o&&Pg(o,c)?(Vr(o,s),e):(Vr(c,s),t.activity?[c,...e.filter(p=>p.conversationId!==c.conversationId)]:o?e.map((p,d)=>d===r?c:p):[...e,c])}default:return t}}var Hu=3,xg=400,Sg=3e4,kg=1e4,wg=6e4,Cg=15e3,Rg=1024*1024,ju=new Set([408,425,429,500,502,503,504]);function Vu(e){return xg*2**e+Math.floor(Math.random()*250)}function Ig(e){return wg+Math.ceil(e/Rg)*Cg}function Tg(e){let t=e.get("retry-after");if(!t)return null;let n=Number(t),r=Number.isFinite(n)?n*1e3:Date.parse(t)-Date.now();return Number.isFinite(r)&&r>=0?Math.min(r,3e4):null}var Wr=class{constructor(t){ee(this,"ttlMs",t);ee(this,"map",new Map)}getOrFetch(t,n){let r=this.map.get(t);if(r&&performance.now()-r.at<this.ttlMs)return r.result;let o={at:performance.now(),result:n().then(a=>(o.value=a,a)).catch(a=>{throw this.map.get(t)===o&&this.map.delete(t),a})};return this.map.set(t,o),o.result}peek(t){let n=this.map.get(t);if(n?.value!==void 0&&performance.now()-n.at<this.ttlMs)return n.value}update(t){for(let n of this.map.values()){if(n.value!==void 0){let r=t(n.value);n.value=r,n.result=Promise.resolve(r);continue}n.result=n.result.then(r=>{let o=t(r);return n.value=o,o})}}delete(t){this.map.delete(t)}},_a=class{constructor(t){ee(this,"opts",t);ee(this,"conversationListeners",new Set);ee(this,"conversationRevision",0);ee(this,"visitorId");ee(this,"conversationId");ee(this,"userContext");ee(this,"pageContext");ee(this,"locale");ee(this,"userTokenSource");ee(this,"userToken");ee(this,"userTokenRequest");ee(this,"conversationsCache",new Wr(yg));ee(this,"contentCache",new Wr(qu));ee(this,"contentCollectionsCache",new Wr(qu))}setUserToken(t){this.userTokenSource=t,this.userToken=typeof t=="string"&&t||void 0,this.userTokenRequest=typeof t=="function"?this.fetchUserToken():void 0}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:To};this.visitorId&&(t.visitorId=this.visitorId),this.conversationId&&(t.conversationId=this.conversationId),this.locale&&(t.locale=this.locale);let n=Bu(this.userContext,this.pageContext);return n&&(t[wu]=n),t}withEnvelope(t){return{...this.envelope(),...t}}appendEnvelope(t){for(let[n,r]of Object.entries(this.envelope()))t.append(n,r);return t}withEnvelopeQuery(t){let n=new URL(this.url(t));for(let[r,o]of Object.entries(this.envelope()))n.searchParams.has(r)||n.searchParams.set(r,o);return n.toString()}async handshake(t){Ie.debug("handshake \u2192",{visitorId:t.visitorId,conversationId:t.conversationId,locale:t.locale}),this.userTokenRequest&&await this.userTokenRequest;let n=await this.postJson(at.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 r=new FormData;r.append("file",t,t.name);let o=await this.postForm(this.uploadPath,r,"upload",n,Ig(t.size));return Ie.debug("uploadFile \u2190",{id:o.id,url:o.url}),o}async transcribe(t,n="audio/webm"){Ie.debug("transcribe \u2192",{size:t.size,mimeType:n});let r=new FormData;r.append("audio",t,`voice.${Ag(n)}`),r.append("mimeType",n);let o=await this.postForm(this.transcribePath,r,"transcribe");return Ie.debug("transcribe \u2190",{textLen:o.text.length}),o}subscribeConversationChanges(t){return this.conversationListeners.add(t),()=>this.conversationListeners.delete(t)}publishConversation(t,n=!1){let r={type:"upsert",conversation:t,revision:++this.conversationRevision,...n?{activity:!0}:{}};this.conversationsCache.update(o=>{let a=o.pagination.page===1,i=o.conversations.some(_=>_.conversationId===t.conversationId),s=tn(o.conversations,r,a&&n),c=a&&s.length>o.pagination.limit?s.slice(0,o.pagination.limit):s;if(!a||!n||i||o.pagination.hasNext)return c===o.conversations?o:{...o,conversations:c};let p=Math.max(o.pagination.total,o.conversations.length)+1,d=Math.ceil(p/o.pagination.limit);return{...o,conversations:c,pagination:{...o.pagination,total:p,totalPages:d,hasNext:o.pagination.page<d}}});for(let o of this.conversationListeners)o(r)}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 r=this.localeCacheKey(t),o=this.conversationRevision;n&&this.conversationsCache.delete(r);let a=this.conversationsCache.getOrFetch(r,()=>this.fetchConversations(t));return n?a.then(i=>{let s={type:"snapshot",result:i,requestedRevision:o};for(let c of this.conversationListeners)c(s);return i}):a}async fetchConversations(t){let n=new URL(this.url(at.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:r,beforeCreatedAt:o}={}){let a=new URL(this.url(at.listMessages));a.searchParams.set("conversationId",t),a.searchParams.set("limit",String(ds)),n.length>0&&a.searchParams.set("ids",n.join(",")),r&&a.searchParams.set("beforeId",r),o&&a.searchParams.set("beforeCreatedAt",o);let i=await this.getJson(a.toString(),"loadConversation");return{...i,messages:i.messages.toReversed()}}async markRead(t,n){if(!this.visitorId||!t)return;let r={type:"read",conversationId:t,...n===void 0?{}:{lastMessageAt:n},revision:++this.conversationRevision};this.conversationsCache.update(o=>{let a=tn(o.conversations,r);return a===o.conversations?o:{...o,conversations:a}});for(let o of this.conversationListeners)o(r);try{await this.postJson(at.markRead,{conversationId:t},"markRead",!0)}catch(o){Ie.debug("markRead failed (non-fatal)",{err:o})}}async requestOperator(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(at.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(at.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(at.content));for(let[a,i]of Object.entries(t))i!==void 0&&n.searchParams.set(a,Array.isArray(i)?i.join(","):String(i));let r=await this.getJson(n.toString(),"listContent"),o=r.items?.map(a=>Pl(a,this.locale))??[];return{...r,items:o}}async setContentVote(t){try{await this.postJson(this.dataUrl(at.contentVoteSet),t,"setContentVote")}catch{}}listContentCollections(t){return this.contentCollectionsCache.getOrFetch(this.localeCacheKey({ids:t}),()=>this.fetchContentCollections(t))}async fetchContentCollections(t){let n=new URL(this.dataUrl(at.contentCollections));return t.length&&n.searchParams.set("ids",t.join(",")),{items:(await this.getJson(n.toString(),"listContentCollections")).items?.map(o=>xl(o,this.locale))??[]}}async bootstrap(t){let n=new URL(this.dataUrl(at.bootstrap));t&&n.searchParams.set("conversationId",t);let r=await this.getJson(n.toString(),"bootstrap"),o=r.forms??[],a=r.formSubmissions??[];return{forms:o,formSubmissions:a}}async saveUserPrefs(t){return this.postJson(at.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??at.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(at.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 r=await this.withFreshUserToken(()=>this.fetchImpl(this.url(at.streamMessage),{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json",...this.headersFor(this.url(at.streamMessage))},body:JSON.stringify(this.withEnvelope(t)),signal:n}));if(r.status!==202)throw new it(`sendTurn failed: expected 202, received ${r.status}`,"server",r.status);let o;try{o=await r.json()}catch(a){throw n?.aborted?a:new it("sendTurn failed: invalid acknowledgement","server",r.status,a)}if(!Eg(o))throw new it("sendTurn failed: invalid acknowledgement","server",r.status);return o},void 0,Sg)}catch(n){throw n instanceof it?n:new it("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(at.cancelStream),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.headersFor(this.url(at.cancelStream))},body:JSON.stringify(this.withEnvelope({conversationId:t,runId:n})),keepalive:!0}).catch(r=>Ie.debug("cancel POST failed (non-fatal)",{err:r})))}async connectResumeStream(t){let n=new AbortController;function r(){return n.abort(t.signal.reason)}t.signal.aborted?r():t.signal.addEventListener("abort",r,{once:!0});let o=setTimeout(()=>n.abort(),kg);function a(){clearTimeout(o),t.signal.removeEventListener("abort",r)}let i;try{this.userTokenRequest&&await this.userTokenRequest,i=await this.fetchImpl(this.resumeUrl(),{method:"GET",credentials:"omit",headers:{accept:"text/event-stream",...this.headersFor(this.resumeUrl())},signal:n.signal})}catch(c){return a(),t.signal.aborted||Ie.debug("resume-stream fetch failed \u2014 reconnecting",{err:c}),"held"}if(!i.ok)return a(),i.status===401&&typeof this.userTokenSource=="function"?(await this.fetchUserToken(),"held"):i.status===409||ju.has(i.status)?(Ie.debug("resume-stream \u2192 transient response; reconnecting",{status:i.status}),"held"):(Ie.debug("resume-stream \u2192 endpoint unavailable",{status:i.status}),"unavailable");if(!i.body)return a(),Ie.debug("resume-stream \u2192 bodyless response; stopping",{status:i.status}),"unavailable";if(!(i.headers.get("content-type")??"").includes("text/event-stream"))return a(),Ie.debug("resume-stream \u2192 non-SSE response; stopping"),"unavailable";let s=!1;try{for await(let{chunk:c}of Uu(i,n.signal,p=>{s||p!=="connected"||(s=!0,clearTimeout(o),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(at.streamResume)}async postJson(t,n,r,o=!1){let a=await this.fetchWithRetry(()=>[this.url(t),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.headersFor(this.url(t))},body:JSON.stringify(this.withEnvelope(n)),...o?{keepalive:!0}:{}}],r);return this.assertOk(a,r)}async postForm(t,n,r,o,a){return this.runWithAbort(async i=>{let s=await this.withFreshUserToken(()=>this.fetchImpl(this.url(t),{method:"POST",credentials:"omit",headers:this.headersFor(this.url(t)),body:this.appendEnvelope(n),signal:i}));return this.assertOk(s,r)},o,a)}async runWithAbort(t,n,r){if(!n&&r===void 0)return t();let o=new AbortController;function a(){return o.abort(n?.reason)}n?.aborted?a():n?.addEventListener("abort",a,{once:!0});let i=r===void 0?void 0:setTimeout(()=>o.abort(),r);try{return await t(o.signal)}finally{i!==void 0&&clearTimeout(i),n?.removeEventListener("abort",a)}}async getJson(t,n){let r=await this.fetchWithRetry(()=>[this.withEnvelopeQuery(t),{method:"GET",credentials:"omit",headers:{accept:"application/json",...this.headersFor(this.url(t))}}],n);return this.assertOk(r,n)}async fetchWithRetry(t,n){for(let r=0;;r++){let o;try{o=await this.withFreshUserToken(()=>this.fetchImpl(...t()))}catch(i){if(r>=Hu)throw new it(`${n} failed: network error`,"network",void 0,i);Ie.debug("request network error \u2014 retrying",{label:n,attempt:r}),await jr(Vu(r));continue}if(o.ok||!ju.has(o.status)||r>=Hu)return o;let a=Tg(o.headers)??Vu(r);Ie.debug("request retryable status \u2014 retrying",{label:n,status:o.status,attempt:r,wait:a}),await jr(a)}}async assertOk(t,n){if(!t.ok)throw new it(`${n} failed: ${t.status}`,"server",t.status);return await t.json()}fetchUserToken(){let t=this.userTokenSource;if(typeof t!="function")return Promise.resolve();let n=Promise.resolve().then(t).then(r=>{this.userTokenSource===t&&(this.userToken=r||void 0)},r=>{Ie.warn("userToken function failed; continuing as an anonymous visitor",{err:r})});return this.userTokenRequest=n,n}headersFor(t){let n=!/^https?:\/\//i.test(t)||t.startsWith(`${this.opts.agentApiBaseUrl}/`);return{...this.opts.auth.headers(),...n&&this.userToken?{[bg]:this.userToken}:{}}}async withFreshUserToken(t){let n=await t();return n.status!==401||!this.userTokenSource?n:typeof this.userTokenSource!="function"?(Ie.warn("userToken rejected as invalid or expired; pass a function so the widget can fetch a fresh one"),n):(await this.fetchUserToken(),t())}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 Ag(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 Eg(e){if(typeof e!="object"||e===null)return!1;let t=Reflect.get(e,"status"),n=Reflect.get(e,"conversationId"),r=Reflect.get(e,"runId");return t==="accepted"&&typeof n=="string"&&n.length>0&&(r===void 0||typeof r=="string"&&r.length>0)}function rr(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 fa(e,t,n){return rr("close",e,t)?n.includes("close"):!1}function Gu(e,t){return e==="inline"&&t==="fullscreen"?"exit-fullscreen":"close"}function or(e,t,n,r){let o={role:n,text:r};e.emit("message",o),t.onMessage?.(o)}function Ku(e){let t=D(e);t.current=e;let n=D(null);return n.current??(n.current=Mg(t)),n.current}function Mg(e){let t=re(null),n=new Set;function r(c){return`${e.current.conversationId()??""}:${c}`}function o(c){return c.frequency==="always"?!1:c.frequency==="conversation"?n.has(r(c.id)):c.id in e.current.persistence.loadFormsDone()}function a(c,p){if(t.value)return;let d=e.current;if(c==="manual"){let _=d.forms.list.find(u=>u.id===p);_&&(t.value={form:_,trigger:"manual"});return}for(let _ of d.forms.byTrigger[c]??[]){let u=_.triggers.find(f=>f.kind===c);if(!(!u||!Ng(u,d)||o(_)||!Lg(_,d))){t.value={form:_,trigger:c};return}}}function i(c,p){let d=t.value;if(!d)return;t.value=null;let{form:_,trigger:u}=d;_.frequency==="conversation"?n.add(r(_.id)):_.frequency!=="always"&&e.current.persistence.saveFormDone(_.id),e.current.onComplete(_,u,c,p)}function s(){let c=t.value;if(!c)return;let p=e.current.forms.list.find(d=>d.id===c.form.id);p&&p!==c.form&&(t.value={form:p,trigger:c.trigger})}return{activeForm:t,fire:a,refresh:s,complete:c=>i(c,!1),skip:()=>i({},!0)}}function Ng(e,t){return e.kind==="after-messages"?t.messageCount()>=Number(e.param??0):e.kind==="page-area"?t.pageArea()===e.param:!0}function Lg(e,t){let n=e.when;if(!n)return!0;if(n.missingContext?.length){let o=t.userContext()??{};if(n.missingContext.some(a=>o[a]!==void 0&&o[a]!==""))return!1}if(n.pageArea&&!(Array.isArray(n.pageArea)?n.pageArea:[n.pageArea]).includes(t.pageArea()??""))return!1;let r=t.messageCount();return!(n.minMessages!=null&&r<n.minMessages||n.maxMessages!=null&&r>n.maxMessages)}function Qu(e){return Object.fromEntries(e.map(t=>[t,[]]))}function ps(e,t,n){return e.includes(t)?t:e.includes(n)?n:e[0]??""}function Yu(e,t,n){let r=[...new Set(t)],o=ps(r,e,""),a=re({activeTab:o,stacks:Qu(r)});return{sig:a,reconcile(i,s){let c=[...new Set(i)],p=a.value,d=ps(c,p.activeTab,s),_=Object.fromEntries(c.map(f=>[f,p.stacks[f]??[]])),u=d===p.activeTab&&c.length===Object.keys(p.stacks).length&&c.every(f=>p.stacks[f]===_[f]);r=c,!u&&(a.value={activeTab:d,stacks:_},d!==p.activeTab&&d&&n?.(d))},switchTab(i){!(i in a.value.stacks)||a.value.activeTab===i||(a.value={...a.value,activeTab:i},n?.(i))},open(i,s){let c=a.value;i in c.stacks&&(a.value={activeTab:i,stacks:{...c.stacks,[i]:s?[s]:[]}},c.activeTab!==i&&n?.(i))},push(i){let s=a.value,c=s.stacks[s.activeTab]??[];a.value={...s,stacks:{...s.stacks,[s.activeTab]:[...c,i]}}},pop(){let i=a.value,s=i.stacks[i.activeTab]??[];s.length!==0&&(a.value={...i,stacks:{...i.stacks,[i.activeTab]:s.slice(0,-1)}})},reset(i){a.value={activeTab:ps(r,i,""),stacks:Qu(r)}}}}function Xu(e){return e.stacks[e.activeTab]??[]}function Ju(e){return Xu(e).at(-1)}function Zu(e){return Xu(e).length===0}function ma(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 Og=900,$g=640;function _s(e,t,n){if(e==="standalone"||e==="page")return"fullscreen";let r=t.initialSize;return r==="expanded"||r==="fullscreen"||r==="normal"?r:n>0&&n<$g?"fullscreen":n>=(t.autoSizeBreakpoint??Og)?"expanded":"normal"}function Gr(e,t,n,r=null){let a=e.mode==="inline"||e.mode==="standalone"||e.mode==="page"||(n??!e.startMinimized),s=e.mode!=="standalone"&&e.mode!=="page"&&e.mode!=="inline"&&r?r:_s(e.mode,e.size,t);return{panelOpen:a,panelSize:s}}function ar(){return typeof window>"u"?0:window.innerWidth}var Z={fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24"},Kr=`${A.cssPrefix}-icon-dir`;function fs(){return l("svg",{...Z,"aria-hidden":"true",children:l("path",{d:"M21 12a8 8 0 0 1-12 6.93L3 21l1.65-5.16A8 8 0 1 1 21 12Z"})})}function Dt(){return l("svg",{...Z,"aria-hidden":"true",children:l("path",{d:"M18 6 6 18M6 6l12 12"})})}function ed(){return l("svg",{...Z,"aria-hidden":"true",children:l("path",{d:"M12 5v14M5 12h14"})})}function td(){return l("svg",{...Z,class:Kr,"aria-hidden":"true",children:[l("path",{d:"m22 2-7 20-4-9-9-4Z"}),l("path",{d:"M22 2 11 13"})]})}function nd(){return l("svg",{...Z,"aria-hidden":"true",children:l("path",{d:"M12 19V5M5 12l7-7 7 7"})})}function rd(){return l("svg",{...Z,class:Kr,"aria-hidden":"true",children:l("path",{d:"M3 20V4l18 8-18 8Z"})})}function ir(){return l("svg",{...Z,class:Kr,"aria-hidden":"true",children:l("path",{d:"m9 18 6-6-6-6"})})}function od(){return l("svg",{...Z,"aria-hidden":"true",children:l("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}function ad(){return l("svg",{...Z,"aria-hidden":"true",children:l("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"})})}function id(){return l("svg",{...Z,"aria-hidden":"true",children:[l("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),l("path",{d:"M5 10a7 7 0 0 0 14 0M12 19v3"})]})}function sd(){return l("svg",{...Z,"aria-hidden":"true",children:l("path",{d:"M3 8V3h5M21 8V3h-5M3 16v5h5M21 16v5h-5"})})}function ld(){return l("svg",{...Z,"aria-hidden":"true",children:l("path",{d:"M8 3v5H3M16 3v5h5M8 21v-5H3M16 21v-5h5"})})}function cd(){return l("svg",{...Z,"aria-hidden":"true",children:l("path",{d:"M3 3h7v2H5v5H3zM21 3h-7v2h5v5h2zM3 21h7v-2H5v-5H3zM21 21h-7v-2h5v-5h2z"})})}function ud(){return l("svg",{...Z,"aria-hidden":"true",children:l("path",{d:"M10 3v5H3M14 3v5h7M10 21v-5H3M14 21v-5h7"})})}function dd(){return l("svg",{...Z,"aria-hidden":"true",children:[l("path",{d:"M14 3h7v7M21 3l-9 9"}),l("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]})}function pd(){return l("svg",{...Z,"aria-hidden":"true",viewBox:"0 0 10 10",children:l("path",{d:"M9 1L1 9M9 5L5 9M9 9H9",strokeWidth:"1.5"})})}function _d(){return l("svg",{...Z,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"5",r:"1.5",fill:"currentColor",stroke:"none"}),l("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),l("circle",{cx:"12",cy:"19",r:"1.5",fill:"currentColor",stroke:"none"})]})}function fd(){return l("svg",{...Z,"aria-hidden":"true",children:l("path",{d:"M11 5 6 9H2v6h4l5 4zM15 9a5 5 0 0 1 0 6M18 7a9 9 0 0 1 0 10"})})}function md(){return l("svg",{...Z,"aria-hidden":"true",children:l("path",{d:"M11 5 6 9H2v6h4l5 4zM22 9l-6 6M16 9l6 6"})})}function gd(){return l("svg",{...Z,"aria-hidden":"true",children:[l("path",{d:"M3 18 8 6l5 12M4.7 14h6.6"}),l("path",{d:"M14.5 18l3.2-7 3.2 7M15.6 15.8h4.2"})]})}function vd(){return l("svg",{...Z,class:Kr,"aria-hidden":"true",children:l("path",{d:"m5 6 6 6-6 6M13 6l6 6-6 6"})})}function Mn(){return l("svg",{...Z,"aria-hidden":"true",children:l("path",{d:"M20 6 9 17l-5-5"})})}function hd(){return l("svg",{...Z,"aria-hidden":"true",children:[l("path",{d:"M3 3v6h6"}),l("path",{d:"M3.05 13A9 9 0 1 0 6 5.3L3 9"}),l("path",{d:"M12 7v5l3 2"})]})}function bd(){return l("svg",{...Z,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"10"}),l("path",{d:"M2 12h20"}),l("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"})]})}function Qr(){return l("svg",{...Z,class:Kr,"aria-hidden":"true",children:l("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}function yd(){return l("svg",{...Z,"aria-hidden":"true",children:[l("path",{d:"M12 20h9"}),l("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function Nn(){return l("svg",{...Z,"aria-hidden":"true",children:l("path",{d:"m6 9 6 6 6-6"})})}function Pd(){return l("svg",{...Z,"aria-hidden":"true",children:[l("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),l("path",{d:"M14 2v6h6"})]})}function Dg(){return l("svg",{...Z,"aria-hidden":"true",children:[l("path",{d:"m12 3-1.5 4.5L6 9l4.5 1.5L12 15l1.5-4.5L18 9l-4.5-1.5Z"}),l("path",{d:"M19 15v4M17 17h4M5 3v2M4 4h2"})]})}function ms(){return l("svg",{...Z,"aria-hidden":"true",children:l("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2Z"})})}function Yr(){return l("svg",{...Z,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"10"}),l("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),l("path",{d:"M12 17h.01"})]})}function Bg(){return l("svg",{...Z,"aria-hidden":"true",children:[l("path",{d:"m15 4 3 3-9 9-3-3z"}),l("path",{d:"M18 2v2M20 4h2M3 20l3-3M3 16h2M5 14v2"})]})}function Fg(){return l("svg",{...Z,"aria-hidden":"true",children:[l("rect",{x:"4",y:"8",width:"16",height:"12",rx:"2"}),l("path",{d:"M12 8V4"}),l("circle",{cx:"12",cy:"3",r:"1"}),l("path",{d:"M2 14h2M20 14h2M9 13h.01M15 13h.01M9.5 17h5"})]})}function gs(){return l("svg",{...Z,"aria-hidden":"true",children:[l("path",{d:"M4 14v-2a8 8 0 0 1 16 0v2"}),l("rect",{x:"2",y:"14",width:"4",height:"6",rx:"1.5"}),l("rect",{x:"18",y:"14",width:"4",height:"6",rx:"1.5"}),l("path",{d:"M20 20v1a3 3 0 0 1-3 3h-5"})]})}function Ug(){return l("svg",{...Z,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"10"}),l("circle",{cx:"12",cy:"12",r:"4"}),l("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"})]})}function vs(){return l("svg",{...Z,"aria-hidden":"true",children:[l("circle",{cx:"11",cy:"11",r:"7"}),l("path",{d:"m21 21-4.3-4.3"})]})}function xd(){return l("svg",{...Z,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]})}function Sd(){return l("svg",{...Z,"aria-hidden":"true",children:[l("path",{d:"M3 9.5 12 3l9 6.5"}),l("path",{d:"M5 9v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9"})]})}function ga(){return l("svg",{...Z,"aria-hidden":"true",children:[l("path",{d:"m3 11 15-5v12L3 13z"}),l("path",{d:"M3 11v2a2 2 0 0 0 2 2h1V9H5a2 2 0 0 0-2 2z"}),l("path",{d:"M7 15v3a2 2 0 0 0 4 0v-2"}),l("path",{d:"M21 10a3 3 0 0 1 0 4"})]})}function Xr(){return l("svg",{...Z,"aria-hidden":"true",children:[l("path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z"}),l("path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1"})]})}function kd(){return l("svg",{...Z,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"4"}),l("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"})]})}function wd(){return l("svg",{...Z,"aria-hidden":"true",children:l("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})}function Cd(){return l("svg",{...Z,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"M12 3v18"}),l("path",{d:"M12 3a9 9 0 0 1 0 18z",fill:"currentColor",stroke:"none"})]})}function qg(){return l("svg",{...Z,"aria-hidden":"true",children:[l("circle",{cx:"10.5",cy:"10.5",r:"6.5"}),l("path",{d:"M8 11a2.5 2.5 0 0 0 5 0"}),l("path",{d:"m20 20-4.4-4.4"})]})}function zg(){return l("svg",{...Z,"aria-hidden":"true",children:[l("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"}),l("path",{d:"M18.5 4v3M20 5.5h-3M5.5 16v2.5M6.75 17.25h-2.5"})]})}function Hg(){return l("svg",{...Z,"aria-hidden":"true",children:[l("path",{d:"M4 18h16"}),l("path",{d:"M5 18a7 7 0 0 1 14 0"}),l("path",{d:"M12 8V6"}),l("path",{d:"M10 6h4"})]})}function jg(){return l("svg",{...Z,"aria-hidden":"true",children:[l("path",{d:"M7 11V6.5a1.5 1.5 0 0 1 3 0V10"}),l("path",{d:"M10 10V5.5a1.5 1.5 0 0 1 3 0V10"}),l("path",{d:"M13 10V6.5a1.5 1.5 0 0 1 3 0V12"}),l("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"})]})}function Rd(){return l("svg",{...Z,"aria-hidden":"true",children:[l("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2"}),l("path",{d:"M5 15a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2"})]})}function Id(){return l("svg",{...Z,"aria-hidden":"true",children:[l("path",{d:"M7 10v11H4a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1z"}),l("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"})]})}function Td(){return l("svg",{...Z,"aria-hidden":"true",children:[l("path",{d:"M17 14V3h3a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1z"}),l("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"})]})}function Ad(){return l("svg",{...Z,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"3.5"}),l("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"})]})}function Ed(){return l("svg",{...Z,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"M12 7v5l3 2"})]})}function va(){return l("svg",{...Z,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]})}function ha(){return l("svg",{...Z,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"m15 9-6 6M9 9l6 6"})]})}var Md={chat:fs,message:ms,bubbles:Xr,spark:Dg,wand:Bg,bot:Fg,help:Yr,lifebuoy:Ug,headset:gs,search:qg,sparkles:zg,concierge:Hg,wave:jg};var H=A.cssPrefix,E={launcher:`${H}-launcher`,callout:`${H}-callout`,calloutDismiss:`${H}-callout-dismiss`,panel:`${H}-panel`,panelHeader:`${H}-panel-header`,resizeGrip:`${H}-resize-grip`,scrollToBottom:`${H}-scroll-to-bottom`,loadPreviousMessages:`${H}-load-previous-messages`,actionHistory:`${H}-action-history`,actionClose:`${H}-action-close`,langSegment:`${H}-lang-segment`,composer:`${H}-composer`,composerInput:`${H}-composer-input`,composerSend:`${H}-composer-send`,composerStop:`${H}-composer-stop`,compactionStatus:`${H}-compaction-status`,messageQueue:`${H}-message-queue`,queuedMessage:`${H}-queued-message`,queuedMessageRemove:`${H}-queued-message-remove`,composerAttach:`${H}-composer-attach`,composerFileInput:`${H}-composer-file-input`,composerVoice:`${H}-composer-voice`,attachmentChip:`${H}-attachment-chip`,attachmentRemove:`${H}-attachment-remove`,suggestion:`${H}-suggestion`,messageBubble:`${H}-message`,messageRetry:`${H}-message-retry`,messageFeedback:`${H}-message-feedback`,feedbackUp:`${H}-feedback-up`,feedbackDown:`${H}-feedback-down`,messageCopy:`${H}-message-copy`,historyPane:`${H}-history-pane`,historyBack:`${H}-history-back`,historyItem:`${H}-history-item`,historyLoadMore:`${H}-history-load-more`,sidebar:`${H}-sidebar`,sidebarToggle:`${H}-sidebar-toggle`,sidebarNewConversation:`${H}-sidebar-new-conversation`,sidebarItem:`${H}-sidebar-item`,messengerHome:`${H}-messenger-home`,modulesEmpty:`${H}-modules-empty`,tab:`${H}-tab`,tabBadge:`${H}-tab-badge`,homeView:`${H}-home-view`,homeGreeting:`${H}-home-greeting`,homeBrand:`${H}-home-brand`,backHeader:`${H}-back-header`,contentView:`${H}-content-view`,contentScroll:`${H}-content-scroll`,homeSearch:`${H}-home-search`,helpSearch:`${H}-help-search`,homeRecent:`${H}-home-recent`,homeAsk:`${H}-home-ask`,homeWhatsNew:`${H}-home-whats-new`,homeContentRow:`${H}-home-content-row`,helpArticle:`${H}-help-article`,newsItem:`${H}-news-item`,newsMore:`${H}-news-more`,formGate:`${H}-form-gate`,formDone:`${H}-form-done`,formDoneToggle:`${H}-form-done-toggle`,formAnswers:`${H}-form-answers`,formFill:`${H}-form-fill`,formSubmit:`${H}-form-submit`,formSkip:`${H}-form-skip`,formField:`${H}-form-field`,toolAskQuestions:`${H}-tool-ask-questions`,toolInputSubmit:`${H}-tool-input-submit`,toolInputSkip:`${H}-tool-input-skip`,toolApproval:`${H}-tool-approval`,toolApprove:`${H}-tool-approve`,toolReject:`${H}-tool-reject`,toolEdit:`${H}-tool-edit`,toolDecision:`${H}-tool-decision`,typingDots:`${H}-typing-dots`,reasoning:`${H}-reasoning`,toolAskSummary:`${H}-ask-questions-summary`,toolAskOptions:`${H}-ask-questions-options-toggle`,toolCall:`${H}-tool-call`,source:`${H}-source`,operatorRequest:`${H}-operator-request`,operatorBanner:`${H}-operator-banner`,cancelOperatorRequest:`${H}-cancel-operator-request`};function st(e,t){return`${e}-${t}`}var ba=A.cssPrefix;function Nd({onToggle:e,launcher:t,strings:n,leaving:r,edgeTab:o}){let a=t.variant!=="circle"&&!!t.label;return l("button",{type:"button",class:`${ba}-fab`,part:"launcher","data-variant":t.variant,"data-size":t.size,"data-edge-tab":o?"true":void 0,"data-leaving":r?"true":void 0,"data-testid":E.launcher,onClick:e,"aria-label":n.launcherOpen,children:[Vg(t.icon),a?l("span",{class:`${ba}-fab-label`,children:ht(n,t.label??"")}):null]})}function Vg(e){let t=Md[e];return t?l(t,{}):l(Wg,{source:e})}function Wg({source:e}){return l("span",{ref:t=>{t&&Gg(t,e)},"aria-hidden":"true"})}function Gg(e,t){if(e.dataset.svgMounted!==t)try{let r=new DOMParser().parseFromString(t,"image/svg+xml").documentElement;r.tagName.toLowerCase()==="svg"&&(e.replaceChildren(document.importNode(r,!0)),e.dataset.svgMounted=t)}catch{}}function Ld({callout:e,launcherPosition:t,strings:n,closeLabel:r,onDismiss:o}){let[a,i]=z(!1);return F(()=>{let s=setTimeout(()=>i(!0),e.delayMs);return()=>clearTimeout(s)},[e.delayMs]),F(()=>{if(!a||e.autoDismissMs<=0)return;let s=setTimeout(o,e.autoDismissMs);return()=>clearTimeout(s)},[a,e.autoDismissMs,o]),a?l("div",{class:`${ba}-callout`,role:"status","data-shape":e.shape,"data-position":Kg(e.position,t),"data-animated":e.animated?"true":void 0,"data-testid":E.callout,children:[l("span",{children:ht(n,e.text)}),l("button",{type:"button",class:`${ba}-callout-close`,onClick:o,"aria-label":r,title:r,"data-testid":E.calloutDismiss,children:l(Dt,{})})]}):null}function Kg(e,t){let n=t.endsWith("-right"),r=t.startsWith("bottom-");return e==="vertical"?r?"top":"bottom":n?"left":"right"}var Qg='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function ya(e){function t(n){if(n.key!=="Tab")return;let r=[...e.querySelectorAll(Qg)].filter(s=>s.offsetParent!==null||s===document.activeElement);if(r.length===0){n.preventDefault();return}let o=r[0],a=r[r.length-1];if(!o||!a)return;let i=e.getRootNode().activeElement;n.shiftKey&&i===o?(n.preventDefault(),a.focus()):!n.shiftKey&&i===a&&(n.preventDefault(),o.focus())}return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)}var _n=A.cssPrefix;function Pa({title:e,actions:t}){return l("header",{class:`${_n}-back-header`,part:"header","data-variant":"title",children:[l("span",{class:`${_n}-back-spacer`,"aria-hidden":"true"}),l("h1",{class:`${_n}-back-title`,children:e}),t??l("span",{class:`${_n}-back-spacer`,"aria-hidden":"true"})]})}function xa({title:e,backLabel:t,onBack:n,actions:r,testid:o}){return l("header",{class:`${_n}-back-header`,part:"header","data-testid":o,children:[l("button",{type:"button",class:`${_n}-icon-btn`,onClick:n,"aria-label":t,title:t,children:l(Qr,{})}),l("h1",{class:`${_n}-back-title`,children:e}),r??l("span",{class:`${_n}-back-spacer`,"aria-hidden":"true"})]})}function Sa({textSig:e,doneSig:t,generativeUi:n=!1,strings:r=xo}){let o=D(null);return wt(()=>{let a=o.current;if(!a)return;a.classList.add(`${A.cssPrefix}-md`),a.replaceChildren();let i=n?ns(a,{cssPrefix:A.cssPrefix,strings:r}):void 0,s=Jn(i??Or(a)),c=0,p=Ut(()=>{let u=e.value,f=t.value;u.length<c&&(i?.dispose(),a.replaceChildren(),i=n?ns(a,{cssPrefix:A.cssPrefix,strings:r}):void 0,s=Jn(i??Or(a)),c=0);let m=u.slice(c);m&&We(s,m),c=u.length,f&&(Lr(s),i?.finish())}),d=new MutationObserver(u=>{for(let f of u)for(let m of f.addedNodes){if(!(m instanceof HTMLElement))continue;let h=m.matches?.("a")?[m]:[...m.querySelectorAll?.("a")??[]];for(let y of h)Od(y)}});d.observe(a,{childList:!0,subtree:!0});for(let u of a.querySelectorAll("a"))Od(u);function _(u){let f=u.target?.closest?.("a");if(!f||!(f instanceof HTMLAnchorElement))return;let m=f.getAttribute("href")??"";!m||m.startsWith("#")||(u.preventDefault(),window.open(m,"_blank","noopener,noreferrer"))}return a.addEventListener("click",_),()=>{p(),i?.dispose(),d.disconnect(),a.removeEventListener("click",_)}},[e,t,n,r]),l("div",{ref:o})}function Dd({text:e}){let t=ie(()=>re(e),[e]),n=ie(()=>re(!0),[]);return l(Sa,{textSig:t,doneSig:n})}function Od(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 $d=new Set([11,12,13,14,15,16,17,18,19,31]);function ka(e){let t="",n=[],r=Jn({data:void 0,add_token:(o,a)=>{n.push(a),$d.has(a)||(t+=" ")},end_token:()=>{let o=n.pop();o!==void 0&&!$d.has(o)&&(t+=" ")},add_text:(o,a)=>{t+=a},set_attr:()=>{}});return We(r,e),Lr(r),t.replace(/\s+/g," ").trim()}var Bd=A.cssPrefix;function Lt({tone:e="info",message:t,onRetry:n,strings:r}){return l("div",{class:`${Bd}-module-empty`,role:e==="error"?"alert":"status","aria-live":"polite",children:[l("span",{children:t}),n?l("button",{type:"button",class:`${Bd}-module-retry`,onClick:n,children:r.errorRetry}):null]})}var fn=A.cssPrefix,iv=le.scope("content"),sv=5e3;function Fd({id:e,title:t,transport:n,strings:r,bus:o,onBack:a,actions:i}){let[s,c]=z(null),[p,d]=z(!1),[_,u]=z(!1),[f,m]=z(0),[h,y]=z(null),x=B(()=>{u(!1),c(null),m(v=>v+1)},[]);F(()=>{let v=!1,k=n.listContentCollections([]).catch(()=>{});return Promise.all([n.listContent({ids:[e],limit:1}),k]).then(([C,T])=>{if(v)return;let M=C.items[0];M?(c(M),d(T?.items.find(N=>N.id===M.contentCollectionId)?.settings?.voteAccess==="portal"),o.emit("contentOpen",{contentId:e,contentCollectionId:M.contentCollectionId})):u(!0)}).catch(C=>{v||(iv.warn("listContent (reader) failed",{err:C}),u(!0))}),()=>{v=!0}},[n,e,f,o]),F(()=>{if(!s)return;let v=setTimeout(()=>o.emit("contentRead",{contentId:e}),sv);return()=>clearTimeout(v)},[s,e,o]);let S=B(v=>{let C=v.target?.closest?.("a")?.getAttribute("href")??"";C&&!C.startsWith("#")&&o.emit("contentLinkClick",{contentId:e})},[o,e]);function w(v){y(e),n.setContentVote({contentId:e,value:v})}function g(){return _?l(Lt,{tone:"error",message:r.errorGeneric,onRetry:x,strings:r}):s===null?l(Lt,{message:r.contentLoading,strings:r}):l("article",{class:`${fn}-content`,"data-testid":E.contentView,onClick:S,children:[s.image?l("img",{class:`${fn}-content-hero`,src:s.image,alt:"",loading:"lazy"}):null,s.description?l("p",{class:`${fn}-content-subtitle`,children:s.description}):null,l(Dd,{text:s.content??""}),p?l("div",{class:`${fn}-content-vote`,"aria-live":"polite",children:h===e?r.feedbackThanks:l(_e,{children:[l("span",{children:r.contentHelpful}),l("button",{type:"button",class:`${fn}-module-retry`,onClick:()=>w(1),children:r.confirmYes}),l("button",{type:"button",class:`${fn}-module-retry`,onClick:()=>w(0),children:r.confirmNo})]})}):null]})}return l("div",{class:`${fn}-module`,children:[l(xa,{title:s?.title||t||r.moduleBack,backLabel:r.moduleBack,onBack:a,actions:i,testid:E.backHeader}),l("div",{class:`${fn}-module-scroll`,"data-testid":E.contentScroll,children:g()})]})}function Ud({itemCount:e,initialFocusIndex:t}){let[n,r]=z(!1),o=D(null),a=D(null),[i,s]=z(-1),c=B(()=>{r(!1),s(-1),o.current?.focus()},[]),p=B(()=>r(u=>!u),[]);F(()=>{if(!n)return;function u(f){let m=a.current,h=o.current;if(!m||!h)return;let y=f.composedPath();y.includes(m)||y.includes(h)||(r(!1),s(-1))}return document.addEventListener("click",u,!0),()=>document.removeEventListener("click",u,!0)},[n]),F(()=>{if(!n||e===0)return;let u=t?.()??0,f=u<0||u>=e?0:u;s(f)},[n,e,t]),F(()=>{if(!n||i<0)return;a.current?.querySelectorAll("[role='menuitem']")?.[i]?.focus()},[n,i]);let d=B(u=>{(u.key==="ArrowDown"||u.key==="Enter"||u.key===" ")&&(u.preventDefault(),r(!0))},[]),_=B(u=>{if(e!==0)switch(u.key){case"Escape":u.preventDefault(),c();return;case"ArrowDown":u.preventDefault(),s(f=>(f+1)%e);return;case"ArrowUp":u.preventDefault(),s(f=>(f-1+e)%e);return;case"Home":u.preventDefault(),s(0);return;case"End":u.preventDefault(),s(e-1)}},[e,c]);return{open:n,focusIndex:i,triggerRef:o,menuRef:a,toggle:p,close:c,onTriggerKey:d,onMenuKey:_}}function qd({items:e,triggerLabel:t}){let n=A.cssPrefix,r=Ud({itemCount:e.length});function o(s){s.disabled||(s.onSelect?.(),s.keepOpen||r.close())}function a(s,c){return s.onSelectValue?.(c)}function i(s,c){let p=c.segments;if(!p?.length)return;let d=Math.max(0,p.findIndex(u=>u.value===c.value)),_=-1;if(s.key==="ArrowRight"||s.key==="Enter"||s.key===" ")_=(d+1)%p.length;else if(s.key==="ArrowLeft")_=(d-1+p.length)%p.length;else return;s.preventDefault(),s.stopPropagation(),a(c,p[_].value)}return l("div",{class:`${n}-menu-wrap`,children:[l("button",{ref:r.triggerRef,type:"button",class:`${n}-icon-btn`,"aria-label":t,"aria-haspopup":"menu","aria-expanded":r.open,title:t,onClick:r.toggle,onKeyDown:r.onTriggerKey,children:l(_d,{})}),r.open?l("div",{ref:r.menuRef,class:`${n}-menu`,role:"menu","aria-label":t,onKeyDown:r.onMenuKey,tabIndex:-1,children:e.map(s=>s.segments?l("div",{role:"menuitem",class:`${n}-menu-item ${n}-menu-item-segmented`,"aria-label":s.label,tabIndex:-1,onKeyDown:c=>i(c,s),children:[s.icon?l("span",{class:`${n}-menu-icon`,children:s.icon}):null,l("span",{class:`${n}-menu-label`,children:s.label}),l("span",{class:`${n}-segmented`,role:"group","aria-label":s.label,children:s.segments.map(c=>{let p=c.value===s.value;return l("button",{type:"button",role:"menuitemradio","aria-checked":p,class:`${n}-segment`,"data-on":p?"true":void 0,lang:c.lang,title:c.value,tabIndex:-1,"data-testid":`${E.langSegment}-${c.value}`,onClick:()=>a(s,c.value),children:c.label},c.value)})})]},s.id):l("button",{type:"button",role:"menuitem",class:`${n}-menu-item`,"aria-pressed":s.type==="switch"?s.on:void 0,disabled:s.disabled,onClick:()=>o(s),children:[s.icon?l("span",{class:`${n}-menu-icon`,children:s.icon}):null,l("span",{class:`${n}-menu-label`,children:s.label}),s.type==="switch"&&s.on?l("span",{class:`${n}-menu-check`,"aria-hidden":"true",children:l(Mn,{})}):null]},s.id))}):null]})}var hs=A.cssPrefix;function lv(e){let t=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)").matches:!0;return e==="host"?Kn()==="dark"?"light":"dark":e==="auto"?t?"light":"dark":t?e==="light"?"dark":"auto":e==="dark"?"light":"auto"}var cv={normal:"large",large:"small",small:"normal"};function uv(e){return e==="light"?l(kd,{}):e==="dark"?l(wd,{}):l(Cd,{})}function dv(e){return(e.split("-")[0]??e).toUpperCase()}function pv(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 Vt({panelProps:e,variant:t}){let{options:n,panelSize:r,feedback:o,onClose:a,onClear:i,onExpand:s,onFullscreen:c,onSoundToggle:p}=e,{onToggleHistory:d,onLocaleChange:_,onThemeChange:u,onTextSizeChange:f}=e,m=n.strings,h=n.mode,y=t==="chat",x=Ct(()=>o.mutedSig.value).value,S=new Set(n.actions);function w(U){return S.has(U)}let g=typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches;function v(U){return g?!1:rr(U,h,r)}let k=n.themeMode,C={auto:m.themeAuto,light:m.themeLight,dark:m.themeDark,host:m.themeAuto},T=n.textSize,M={small:m.textSizeSmall,normal:m.textSizeNormal,large:m.textSizeLarge},N=[];if(y&&w("clear")&&N.push({id:"clear",icon:l(yd,{}),label:m.newConversation,onSelect:i}),w("expand")&&v("expand")){let U=r==="expanded";N.push({id:"expand",icon:U?l(ld,{}):l(sd,{}),label:U?m.collapse:m.expand,type:"switch",on:U,onSelect:s})}if(w("fullscreen")&&v("fullscreen")){let U=r==="fullscreen";N.push({id:"fullscreen",icon:U?l(ud,{}):l(cd,{}),label:U?m.exitFullscreen:m.fullscreen,type:"switch",on:U,onSelect:c})}let L=n.popOutUrl,$=n.aiAgentDeploymentId;w("popOut")&&L&&$&&rr("popOut",h,r)&&N.push({id:"popOut",icon:l(dd,{}),label:m.popOut,onSelect:()=>{let U=pv(L,{conversationId:e.conversationId,widgetId:n.widgetId,publicKey:n.publicKey,aiAgentDeploymentId:$});U&&window.open(U,"_blank","noopener,noreferrer")}}),y&&w("sound")&&N.push({id:"sound",icon:x?l(md,{}):l(fd,{}),label:x?m.soundOff:m.soundOn,type:"switch",on:!x,onSelect:p}),w("theme")&&N.push({id:"theme",icon:uv(k),label:`${m.theme}: ${C[k]}`,onSelect:()=>u(lv(k)),keepOpen:!0}),w("textSize")&&N.push({id:"textSize",icon:l(gd,{}),label:`${m.textSize}: ${M[T]}`,onSelect:()=>f(cv[T]),keepOpen:!0}),w("language")&&n.availableLocales.length>1&&N.push({id:"language",icon:l(bd,{}),label:m.language,segments:n.availableLocales.map(U=>({value:U,label:dv(U),lang:U})),value:n.locale,onSelectValue:_});let W=!!a&&fa(h,r,n.actions),G=y&&w("history");return l("div",{class:`${hs}-header-actions`,children:[G?l("button",{type:"button",class:`${hs}-icon-btn`,onClick:d,"aria-label":m.history,title:m.history,"data-testid":E.actionHistory,children:l(hd,{})}):null,N.length>0?l(qd,{items:N,triggerLabel:m.moreActions}):null,W?l("button",{type:"button",class:`${hs}-icon-btn`,onClick:a,"aria-label":m.close,title:m.close,"data-testid":E.actionClose,children:l(Dt,{})}):null]})}var zd={Icon:Xr};function Ln(e,t){return e instanceof it&&e.status===429?t.errorRateLimited:t.errorGeneric}var sr=A.cssPrefix;function Hd({placeholder:e,onActivate:t}){return l("button",{type:"button",class:`${sr}-home-search`,onClick:t,"data-testid":E.homeSearch,children:[l("span",{class:`${sr}-home-search-text`,children:e}),l("span",{class:`${sr}-home-search-icon`,"aria-hidden":"true",children:l(vs,{})})]})}function jd({placeholder:e,value:t,onInput:n}){return l("div",{class:`${sr}-home-search`,"data-input":"true",children:[l("input",{type:"search",class:`${sr}-home-search-input`,placeholder:e,value:t,maxLength:200,onInput:r=>n(r.currentTarget.value),"data-testid":E.helpSearch}),l("span",{class:`${sr}-home-search-icon`,"aria-hidden":"true",children:l(vs,{})})]})}var Jr=A.cssPrefix;function wa({title:e,subtitle:t,onClick:n,testid:r}){return l("button",{type:"button",class:`${Jr}-list-row`,onClick:n,"data-testid":r,children:[l("span",{class:`${Jr}-list-row-body`,children:[l("span",{class:`${Jr}-list-row-title`,children:e}),t?l("span",{class:`${Jr}-list-row-sub`,children:t}):null]}),l("span",{class:`${Jr}-list-row-chevron`,"aria-hidden":"true",children:l(ir,{})})]})}var Wt=A.cssPrefix,_v=le.scope("help"),fv=20,mv=300;function gv(e,t,n){let r=new Map(n.map(o=>[o.id,o.title]));return t.map(o=>({id:o,title:r.get(o),rows:e.filter(a=>a.contentCollectionId===o)})).filter(o=>o.rows.length>0)}function Vd({transport:e,strings:t,bus:n},r,o){let[a,i]=z(),s=D(void 0);function c(p){if(!r?.length)return;let d={};s.current=d,i(_=>({search:o,items:[],collections:[],..._,pagination:p>1?_?.pagination:void 0,loading:!0,error:void 0})),Promise.all([e.listContent({contentCollectionIds:r,sortBy:"order",page:p,limit:fv,search:o}),p>1?void 0:e.listContentCollections(r)]).then(([_,u])=>{s.current===d&&(i(f=>({search:o,items:[...p>1?f?.items??[]:[],..._.items],collections:u?.items??f?.collections??[],pagination:_.pagination,loading:!1})),!(p>1)&&(o?n.emit("contentSearch",{queryLength:o.length,hitCount:_.pagination.total}):n.emit("contentView",{section:"help",count:_.items.length})))}).catch(_=>{s.current===d&&(_v.warn("listContent (help) failed",{err:_,page:p}),i(u=>u&&{...u,loading:!1,error:Ln(_,t)}))})}return F(()=>{if(!r?.length){i(void 0);return}return c(1),()=>{s.current=void 0}},[e,r,o]),[a,()=>!a?.loading&&c((a?.pagination?.page??0)+1)]}function vv(e){let{strings:t,config:n,nav:r,panelProps:o}=e,a=n.contentCollectionIds,[i,s]=z(""),[c,p]=z(""),d=Vd(e,a),_=Vd(e,c?a:void 0,c),[u,f]=i.trim()?_:d;F(()=>{let h=setTimeout(()=>p(i.trim()),mv);return()=>clearTimeout(h)},[i]);function m(){if(!a?.length)return l(Lt,{message:t.helpEmpty,strings:t});let h=u?.error?l(Lt,{tone:"error",message:u.error,onRetry:f,strings:t}):null;return h&&!u?.pagination?h:!u||!u.pagination&&!u.items.length?l(Lt,{message:t.helpLoading,strings:t}):u.items.length?l(_e,{children:[gv(u.items,a,u.collections).map(y=>l("section",{class:`${Wt}-help-group`,children:[y.title?l("h2",{class:`${Wt}-help-section-title`,children:y.title}):null,l("div",{class:`${Wt}-help-card`,children:y.rows.map(x=>l(wa,{title:x.title,subtitle:x.description,onClick:()=>r.push(x.url?{kind:"iframe",url:x.url,title:x.title}:{kind:"content",id:x.id,title:x.title}),testid:st(E.helpArticle,x.id)},x.id))})]},y.id)),h,u.pagination?.hasNext&&!h?l("div",{children:l("div",{class:`${Wt}-help-card`,children:l("button",{type:"button",class:`${Wt}-list-row ${Wt}-help-more`,onClick:f,"aria-busy":u.loading,children:[u.loading?l("span",{class:`${Wt}-loading-spinner`,"aria-hidden":"true"}):null,t.helpShowMore]})})}):null]}):l(Lt,{message:u.search?t.helpSearchEmpty.replace("{query}",u.search):t.helpEmpty,strings:t})}return l("div",{class:`${Wt}-module`,children:[l(Pa,{title:t.helpTitle,actions:l(Vt,{panelProps:o,variant:"plain"})}),l("div",{class:`${Wt}-module-pad`,children:l(jd,{placeholder:t.helpSearchPlaceholder,value:i,onInput:s})}),l("div",{class:`${Wt}-help-list`,children:m()})]})}var Wd={Icon:Yr,Root:e=>l(vv,{...e})};var Gd=le.scope("attachments");function Ca(e,t,n){let r=bv(e),o=[],a=[],i=xv(n.accept),s=t.reduce((p,d)=>p+d.size,0),c=t.length;for(let p of r){let d=hv(p,c,s,n,i);if(d){a.push({file:p,reason:d});continue}o.push(Pv(p)),s+=p.size,c+=1}return(o.length||a.length)&&Gd.debug("ingest",{accepted:o.length,rejected:a.map(p=>({name:p.file.name,reason:p.reason}))}),{accepted:o,rejected:a}}function lr(e){try{URL.revokeObjectURL(e.previewUrl)}catch(t){Gd.debug("revokeObjectURL failed",{error:t})}}function hv(e,t,n,r,o){return t>=r.maxCount?"count":n+e.size>r.maxBytes?"bytes":Sv(e,o)?null:"mime"}function bv(e){return e?Array.isArray(e)?e.filter(t=>t instanceof File):[...e].map(t=>t instanceof File?t:yv(t)).filter(t=>t!==null):[]}function yv(e){let t=e;return!t?.getAsFile||t.kind!=="file"?null:t.getAsFile()}function Pv(e){return{file:e,id:kt(),mediaType:e.type||"application/octet-stream",name:e.name||"pasted-file",previewUrl:URL.createObjectURL(e),size:e.size}}function xv(e){return e.split(",").map(t=>t.trim().toLowerCase()).filter(Boolean).map(t=>{if(t.startsWith("."))return{kind:"ext",ext:t};let[n="*",r="*"]=t.split("/");return{kind:"mime",type:n,subtype:r}})}function Sv(e,t){if(t.length===0)return!0;let[n="*",r="*"]=(e.type||"").toLowerCase().split("/"),o=(e.name||"").toLowerCase();return t.some(a=>a.kind==="ext"?o.endsWith(a.ext):a.type==="image"&&a.subtype==="*"&&/\.(heic|heif|avif|bmp|tif|tiff)$/.test(o)?!0:(a.type==="*"||a.type===n)&&(a.subtype==="*"||a.subtype===r))}var Zr=A.cssPrefix;function Kd({attachment:e,onRemove:t,disabled:n=!1}){let r=/^image\/(jpeg|png|gif|webp|avif|bmp|x-ms-bmp|svg\+xml)$/i.test(e.mediaType);return l("span",{class:`${Zr}-attachment-chip`,title:e.name,"data-testid":st(E.attachmentChip,e.id),children:[r?l("img",{class:`${Zr}-attachment-thumb`,src:e.previewUrl,alt:""}):l("span",{class:`${Zr}-attachment-thumb`,"aria-hidden":"true",children:l(Pd,{})}),l("span",{class:`${Zr}-attachment-name`,children:e.name}),l("button",{type:"button",class:`${Zr}-attachment-remove`,onClick:t,disabled:n,"aria-label":`Remove ${e.name}`,"data-testid":st(E.attachmentRemove,e.id),children:l(Dt,{})})]})}var bs={isSupported:!1,start:()=>{},stop:()=>{},cancel:()=>{}};function ys(e,t,n){return e==="disabled"?bs:e==="server"?Rv(n):kv(t)}function kv(e){let t=wv();if(!t)return bs;let n=null,r=0;return{isSupported:!0,start(o,a){let i=n,s=++r;n=null,i?.abort();let c=new t;n=c,c.continuous=!0,c.interimResults=!0,c.lang=e;let p=!1;c.addEventListener("result",_=>{if(r!==s||n!==c)return;let u=_,f="",m=!1;for(let h=u.resultIndex;h<u.results.length;h++){let y=u.results[h];y&&(f+=y[0].transcript,y.isFinal&&(m=!0))}o(f,m)});function d(){p||r!==s||n!==c||(p=!0,n=null,a())}c.addEventListener("end",d),c.addEventListener("error",d);try{c.start()}catch{d()}},stop(){n?.stop()},cancel(){r++;let o=n;n=null,o?.abort()}}}function wv(){return window.SpeechRecognition??window.webkitSpeechRecognition}var Cv=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];function Rv(e){if(typeof MediaRecorder>"u"||!navigator?.mediaDevices?.getUserMedia)return bs;let t=0,n=null;function r(i){for(let s of i.stream?.getTracks()??[])s.stop();i.stream=null}function o(){t++;let i=n;n=null,i&&(r(i),i.recorder?.state!=="inactive"&&i.recorder?.stop())}async function a(i){if(i.finishing)return;i.finishing=!0;let s=i.recorder?.mimeType??"audio/webm";r(i);let c=new Blob(i.chunks,{type:s});i.chunks=[];try{let{text:p}=await e(c,s);n===i&&t===i.generation&&p&&i.onText(p,!0)}catch{}finally{n===i&&t===i.generation&&(n=null,i.onEnd())}}return{isSupported:!0,async start(i,s){o();let c={generation:t,recorder:null,stream:null,chunks:[],onText:i,onEnd:s,finishing:!1};n=c;try{let p=await navigator.mediaDevices.getUserMedia({audio:!0});if(n!==c||t!==c.generation){for(let u of p.getTracks())u.stop();return}c.stream=p;let d=Iv(),_=new MediaRecorder(p,d?{mimeType:d}: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{r(c),n===c&&t===c.generation&&(n=null,s())}},stop(){let i=n;if(i){if(!i.recorder){o();return}i.recorder.state!=="inactive"&&i.recorder.stop()}},cancel(){o()}}}function Iv(){for(let e of Cv)if(MediaRecorder.isTypeSupported(e))return e}var Ke=A.cssPrefix,cr=le.scope("composer");function ur(e){return e.reduce((t,n)=>t+n.size,0)}var Ps={arrowUp:nd,paperPlane:td,send:rd,chevron:ir};function Qd(e){return"activeElement"in e}function Tv(e){return"host"in e&&"activeElement"in e}function Yd({options:e,transport:t,feedback:n,bus:r,persistence:o,conversationId:a,isStreaming:i,isMemoryCompacting:s=!1,canReleaseQueuedMessages:c=!0,queueManualMessages:p=!1,active:d=!0,isPreparing:_=!1,operatorRequestEnabled:u,canRequestOperator:f=!1,controlMode:m="ai-agent",onRequestOperator:h,onSend:y,onStop:x,apiRef:S}){let w=e.strings,[g,v]=z(()=>o.loadDraft(a)),[k,C]=z([]),[T,M]=z(()=>o.loadMessageQueue(a).map(O=>({id:O.id,text:O.text,attachments:[]}))),N=D(T),L=D(!1),[$,W]=z(!1),[G,U]=z(!1),oe=D(!1),ae=D(null),Te=D(null),ge=D(null),xe=D(0),ct=D(a);ct.current=a;let Le=D(d);Le.current=d;let Ze=D(_);Ze.current=_;let Ve=G||_||!d,mt=i&&m==="ai-agent",et=mt||s&&m==="ai-agent",dt=m==="ai-agent"&&(et||p||T.length>0),Pt=B(O=>{M(Y=>{let X=O(Y);return o.saveMessageQueue(ct.current,X.filter(ue=>ue.attachments.length===0).map(({id:ue,text:rt})=>({id:ue,text:rt}))),N.current=X,X})},[o]),Ae=B(O=>{Pt(Y=>(Y.find(X=>X.id===O)?.attachments.forEach(lr),Y.filter(X=>X.id!==O)))},[Pt]),Oe=B(O=>{v(Y=>{let X=typeof O=="function"?O(Y):O;return X===Y?Y:(o.saveDraft(ct.current,X),X)})},[o]),xt=e.features.fileUpload,fe=e.features.voice,[$e,tt]=z(()=>ys(fe,e.locale,(O,Y)=>t.transcribe(O,Y))),Ee=D($e);Ee.current=$e;let gt=D({mode:fe,locale:e.locale,transport:t});F(()=>{let O=gt.current;O.mode===fe&&O.locale===e.locale&&O.transport===t||(gt.current={mode:fe,locale:e.locale,transport:t},xe.current++,Ee.current.cancel(),ge.current=null,W(!1),tt(ys(fe,e.locale,(Y,X)=>t.transcribe(Y,X))))},[e.locale,fe,t]),wt(()=>()=>{xe.current++,$e.cancel()},[$e]);let Et=B(O=>{let Y=ge.current;if(Y===null)return!1;let X=Math.round(performance.now()-Y);return cr[O]("voiceStop",{durationMs:X}),r.emit("voiceStop",{durationMs:X}),ge.current=null,!0},[r]),b=B(()=>{ge.current!==null&&($e.stop(),W(!1),Et("info")&&n.play("voiceStop"))},[Et,n,$e]),q=B(()=>{xe.current++,$e.cancel(),W(!1),Et("info")&&n.play("voiceStop")},[Et,n,$e]);F(()=>{(_||!d)&&q()},[d,q,_]),F(()=>{let O=ae.current;if(!O)return;let Y=O.getRootNode(),X=Qd(Y)?Y.activeElement:null;X&&O.closest(`.${Ke}-panel`)?.contains(X)||O.focus({preventScroll:!0})},[]),F(()=>{let O=ae.current;if(!O)return;if(g.length===0){O.style.height="";return}O.style.height="auto";let Y=getComputedStyle(O),X=Number.parseFloat(Y.getPropertyValue(`--${Ke}-textarea-base-height`)),ue=Number.parseFloat(Y.borderTopWidth)+Number.parseFloat(Y.borderBottomWidth),rt=Math.min(O.scrollHeight+ue,Number.parseFloat(Y.maxHeight)),Mt=Number.parseFloat(Y.fontSize)*.7;O.style.height=`${rt<X+Mt?X:rt}px`},[g]);let K=D(k);K.current=k,F(()=>()=>{K.current.forEach(lr);for(let O of N.current)O.attachments.forEach(lr)},[]),wt(()=>{if(S)return S.current={attachFromDrop:O=>{if(!xt||!Le.current||oe.current||Ze.current)return;let Y=Ca(O,K.current,e.attachments);Y.accepted.length!==0&&(cr.info("attach (drop)",{count:Y.accepted.length,totalBytes:ur(Y.accepted)}),r.emit("attach",{count:Y.accepted.length,totalBytes:ur(Y.accepted)}),C(X=>[...X,...Y.accepted]))},fill:O=>{if(!Le.current||oe.current||Ze.current)return;Oe(O);let Y=ae.current;Y&&(Y.focus({preventScroll:!0}),requestAnimationFrame(()=>Y.setSelectionRange(Y.value.length,Y.value.length)))},acceptQueuedMessage:Ae},()=>{S.current&&(S.current=null)}},[S,xt,_,e.attachments,Ae,Oe]),F(()=>{let O=ae.current;if(!O)return;let Y=O.closest(`.${Ke}-panel`);if(!Y)return;let X=ue=>{if(!Le.current||oe.current||Ze.current)return;let rt=ue.clipboardData;if(!rt)return;let Mt=ue.target?.closest?.("input, textarea, [contenteditable]:not([contenteditable='false'])");if(Mt&&Mt!==O)return;if(xt){let vt=Ca(rt.items,K.current,e.attachments);if(vt.accepted.length>0){ue.preventDefault(),cr.info("attach (paste)",{count:vt.accepted.length,totalBytes:ur(vt.accepted)}),r.emit("attach",{count:vt.accepted.length,totalBytes:ur(vt.accepted)}),C(vn=>[...vn,...vt.accepted]);return}}if(Mt===O)return;let zt=rt.getData("text/plain");zt&&(ue.preventDefault(),Oe(vt=>vt+zt),O.focus())};return Y.addEventListener("paste",X),()=>Y.removeEventListener("paste",X)},[xt,e.attachments,Oe]);async function J(){let O=g.trim();if(!O&&k.length===0||!d||mt||oe.current||_)return;q(),oe.current=!0,U(!0);let Y=g,X=k;try{await y(O,X)&&(Oe(ue=>ue===Y?"":ue),C(ue=>ue!==X?ue:(X.forEach(lr),K.current=[],[])))}finally{oe.current=!1,U(!1),requestAnimationFrame(()=>{let ue=ae.current;if(!ue||ue.disabled||!Le.current)return;let rt=ue.getRootNode(),Mt=Qd(rt)?rt.activeElement:null,zt=Mt?.getAttribute("data-testid");if(!(Mt&&Mt!==ue&&zt!==E.composerSend&&zt!==E.composerStop)){if(Tv(rt)){let vt=rt.host.ownerDocument;if(!vt.hasFocus())return;let vn=vt.activeElement;if(vn&&vn!==rt.host&&vn!==vt.body)return}ue.focus({preventScroll:!0})}})}}function se(){let O=g.trim();if(!O&&k.length===0||!d||!dt||oe.current||_)return;q();let Y=k;Pt(X=>[...X,{id:kt(),text:O,attachments:Y}]),Oe(""),C(X=>X!==Y?X:(K.current=[],[])),ae.current?.focus({preventScroll:!0})}F(()=>{et&&(L.current=!1)},[et]),F(()=>{let O=T[0];if(!O||!c||et||L.current||G||_||!d)return;let Y=setTimeout(()=>{L.current=!0,y(O.text,O.attachments,O.id).then(X=>{if(X){Ae(O.id);return}L.current=!1})},300);return()=>clearTimeout(Y)},[d,c,_,y,et,T,Ae,G]);function we(O){O.key!=="Enter"||O.shiftKey||O.isComposing||(O.preventDefault(),dt&&(g.trim()||k.length>0)?se():mt?x():J())}function Ce(O){let Y=O.target;if(!d||oe.current||_){Y.value="";return}let X=Ca(Y.files,k,e.attachments);X.accepted.length>0&&(cr.info("attach (file picker)",{count:X.accepted.length,totalBytes:ur(X.accepted)}),r.emit("attach",{count:X.accepted.length,totalBytes:ur(X.accepted)}),C(ue=>[...ue,...X.accepted])),Y.value=""}function ve(O){!d||oe.current||_||(cr.info("removeAttachment",{id:O}),r.emit("removeAttachment",{id:O}),C(Y=>{let X=Y.find(ue=>ue.id===O);return X&&lr(X),Y.filter(ue=>ue.id!==O)}))}function nt(){if($){b();return}if(!d||!$e.isSupported||oe.current||_)return;let O=++xe.current;ge.current=performance.now(),cr.info("voiceStart"),r.emit("voiceStart",void 0),W(!0),n.play("voiceStart"),$e.start((Y,X)=>{xe.current!==O||!Le.current||Ze.current||oe.current||!X||Oe(ue=>`${ue}${Y} `)},()=>{xe.current!==O||!Le.current||(W(!1),Et("debug"))})}let ce=Ps[e.composer.sendButton.icon],pt=!!(g.trim()||k.length>0);return l("div",{class:`${Ke}-composer`,part:"composer","data-testid":E.composer,children:[T.length>0?l("div",{class:`${Ke}-message-queue`,"aria-label":w.queueMessage,"data-testid":E.messageQueue,children:T.map(O=>l("div",{class:`${Ke}-attachment-chip ${Ke}-queued-message`,"data-testid":`${E.queuedMessage}-${O.id}`,children:[l("span",{class:`${Ke}-attachment-name ${Ke}-queued-text`,children:O.text||O.attachments.map(Y=>Y.name).join(", ")}),l("button",{type:"button",class:`${Ke}-attachment-remove`,onClick:()=>Ae(O.id),"aria-label":w.removeQueuedMessage,title:w.removeQueuedMessage,"data-testid":`${E.queuedMessageRemove}-${O.id}`,children:l(Dt,{})})]},O.id))}):null,k.length>0?l("div",{class:`${Ke}-attachments`,children:k.map(O=>l(Kd,{attachment:O,onRemove:()=>ve(O.id),disabled:Ve},O.id))}):null,l("div",{class:`${Ke}-composer-row`,children:[l("div",{class:`${Ke}-composer-actions`,children:[xt?l("button",{type:"button",class:`${Ke}-icon-btn`,onClick:()=>Te.current?.click(),disabled:Ve,"aria-label":w.attach,"data-testid":E.composerAttach,children:l(ad,{})}):null,$e.isSupported?l("button",{type:"button",class:`${Ke}-icon-btn`,onClick:nt,disabled:Ve,"aria-label":$?w.micStop:w.micStart,"aria-pressed":$,"data-recording":$?"true":void 0,"data-testid":E.composerVoice,children:l(id,{})}):null]}),l("textarea",{ref:ae,name:"message",class:`${Ke}-textarea`,rows:1,value:g,placeholder:w.composerPlaceholder,onInput:O=>Oe(O.currentTarget.value),onKeyDown:we,disabled:Ve,"aria-label":w.composerPlaceholder,"data-testid":E.composerInput}),dt&&pt?l("button",{type:"button",class:`${Ke}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:se,disabled:Ve,"aria-label":w.queueMessage,title:w.queueMessage,"data-testid":E.composerSend,children:l(ce,{})}):null,mt?l("button",{type:"button",class:`${Ke}-send`,onClick:x,disabled:Ve,"aria-label":w.stop,"data-testid":E.composerStop,children:l(od,{})}):null,!mt&&(!dt||!pt)?l("button",{type:"button",class:`${Ke}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:()=>{J()},disabled:Ve||!g.trim()&&k.length===0,"aria-label":w.send,"data-testid":E.composerSend,children:l(ce,{})}):null,u&&m==="ai-agent"&&h?l("button",{type:"button",class:`${Ke}-icon-btn`,onClick:h,disabled:Ve||!f,"aria-label":w.talkToOperator,title:w.talkToOperator,"data-testid":E.operatorRequest,children:l(gs,{})}):null]}),l("input",{ref:Te,name:"attachments",type:"file",multiple:!0,accept:e.attachments.accept,onChange:Ce,disabled:Ve,class:`${Ke}-sr-only`,"data-testid":E.composerFileInput})]})}var Xd=A.cssPrefix;function Ra({onClick:e,children:t,testid:n}){return e?l("button",{type:"button",class:`${Xd}-home-card`,"data-interactive":"true",onClick:e,"data-testid":n,children:t}):l("div",{class:`${Xd}-home-card`,"data-testid":n,children:t})}function Ia(e){return e.trim().split(/\s+/).slice(0,2).map(t=>t.charAt(0).toUpperCase()).join("")}var Bt=A.cssPrefix,Av=le.scope("news"),Ev=10;function xs(e,t){let n=e?new Date(e):void 0;if(!(!n||Number.isNaN(n.getTime())))return new Intl.DateTimeFormat(t,{dateStyle:"medium"}).format(n)}function Mv({options:e,transport:t,strings:n,config:r,nav:o,bus:a,panelProps:i,latestNews:s}){let c=r.contentCollectionIds,[p,d]=z({items:[],loading:!0}),_=D(void 0);function u(y){if(!c?.length)return;let x={};_.current=x,d(S=>({...S,loading:!0,error:void 0})),t.listContent({contentCollectionIds:c,sortBy:"publishedAt",sortOrder:"desc",page:y,limit:Ev}).then(S=>{if(_.current!==x||(d(g=>({items:y>1?[...g.items,...S.items]:S.items,pagination:S.pagination,loading:!1})),y>1))return;a.emit("contentView",{section:"news",count:S.items.length});let w=S.items[0];w&&s.markSeen(w.id)}).catch(S=>{_.current===x&&(Av.warn("listContent (news) failed",{err:S,page:y}),d(w=>({...w,loading:!1,error:Ln(S,n)})))})}function f(){p.loading||u((p.pagination?.page??0)+1)}F(()=>(d({items:[],loading:!0}),u(1),()=>{_.current=void 0}),[t,c]);function m(y){let x=xs(y.publishedAt,e.locale);return l("button",{type:"button",class:`${Bt}-news-card`,onClick:()=>o.push({kind:"content",id:y.id,title:y.title}),"data-testid":st(E.newsItem,y.id),children:[y.image?l("img",{class:`${Bt}-news-hero`,src:y.image,alt:"",loading:"lazy"}):null,l("span",{class:`${Bt}-news-body`,children:[l("span",{class:`${Bt}-news-title`,children:y.title}),x||y.tags?.length?l("span",{class:`${Bt}-news-meta`,children:[x?l("time",{dateTime:y.publishedAt,children:x}):null,y.tags?.map(S=>l("span",{class:`${Bt}-news-tag`,children:S},S))]}):null,y.description?l("span",{class:`${Bt}-news-summary`,children:y.description}):null]})]},y.id)}function h(){if(!c?.length)return l(Lt,{message:n.newsEmpty,strings:n});let y=p.error?l(Lt,{tone:"error",message:p.error,onRetry:f,strings:n}):null;return y&&!p.pagination?y:p.pagination?p.items.length?l("div",{class:`${Bt}-news-list`,children:[p.items.map(m),y,p.pagination.hasNext&&!y?l("button",{type:"button",class:`${Bt}-news-more`,onClick:f,"aria-busy":p.loading,"data-testid":E.newsMore,children:[p.loading?l("span",{class:`${Bt}-loading-spinner`,"aria-hidden":"true"}):null,n.newsShowMore]}):null]}):l(Lt,{message:n.newsEmpty,strings:n}):l(Lt,{message:n.newsLoading,strings:n})}return l("div",{class:`${Bt}-module`,children:[l(Pa,{title:n.newsTitle,actions:l(Vt,{panelProps:i,variant:"plain"})}),l("div",{class:`${Bt}-module-scroll`,children:h()})]})}var Jd={Icon:ga,Root:e=>l(Mv,{...e})};var me=A.cssPrefix,Zd=le.scope("home");function Nv(e){let t=e.options.userContext?.name,n=e.config.greetingText?ht(e.strings,e.config.greetingText):void 0;if(n){let r=t?n.replace("{name}",t):n.replace(/\s*\{name\}\s*/," ").trim(),o=e.strings.homeGreetingLead;return{title:r,subtitle:r.toLowerCase()===o.toLowerCase()?void 0:o}}return t?{title:e.strings.homeGreetingNamed.replace("{name}",t),subtitle:e.strings.homeGreetingLead}:{title:e.strings.homeGreeting}}function Lv(e,t){return t.url?e.push({kind:"iframe",url:t.url,title:t.title}):e.push({kind:"content",id:t.id,title:t.title})}function Ov({options:e,onAsk:t}){let[n,r]=z(""),{sendButton:o}=e.composer,a=Ps[o.icon];function i(s){s.preventDefault();let c=n.trim();c&&(r(""),t(c))}return l("form",{class:`${me}-home-search ${me}-home-ask`,"data-input":"true",onSubmit:i,"data-testid":E.homeAsk,children:[l("input",{type:"text",class:`${me}-home-search-input`,placeholder:e.strings.homeAskPlaceholder,"aria-label":e.strings.homeAskPlaceholder,value:n,enterKeyHint:"send",onInput:s=>r(s.currentTarget.value)}),l("button",{type:"submit",class:`${me}-send`,"data-shape":o.shape,"data-variant":o.variant,disabled:!n.trim(),"aria-label":e.strings.send,children:l(a,{})})]})}function ep(e,t){return tn(e,t,t.type!=="upsert"||t.activity===!0)}function $v(e){let{transport:t,strings:n,config:r,nav:o,bus:a,panelProps:i,latestNews:s}=e,[c,p]=z(null),[d,_]=z([]),u=r.contentCollectionIds?.join(","),f=e.options.modules.list.some(v=>v.layout==="chat");F(()=>{if(r.showRecentConversations===!1)return;let v=!1,k=!0,C=[],T=t.subscribeConversationChanges(M=>{k&&C.push(M),p(N=>ep(N?[N]:[],M)[0]??null)});return t.listConversations({limit:f?50:1}).then(M=>{if(v)return;let N=C.reduce(ep,M.conversations);C=[],k=!1,p(N[0]??null)}).catch(M=>{v||(C=[],k=!1,Zd.warn("listConversations (home) failed",{err:M}))}),()=>{v=!0,T()}},[t,r.showRecentConversations,f]),F(()=>{if(!r.contentCollectionIds?.length)return;let v=!1;return t.listContent({contentCollectionIds:r.contentCollectionIds,pinned:!0,limit:6}).then(k=>{v||(_(k.items),a.emit("contentView",{section:"home",count:k.items.length}))}).catch(k=>!v&&Zd.warn("listContent (home) failed",{err:k})),()=>{v=!0}},[t,u,a]);let m=Nv(e),h=r.userAvatars??[],y=r.status,x=y?.text?ht(n,y.text):n.homeStatus,S=r.contentBlockTitle?ht(n,r.contentBlockTitle):n.homeContentTitle,w=s.item,g=xs(w?.publishedAt,e.options.locale);return l("div",{class:`${me}-module ${me}-home`,"data-testid":E.homeView,children:l("div",{class:`${me}-home-scroll`,children:[l("div",{class:`${me}-home-hero`,children:[l("div",{class:`${me}-home-hero-top`,children:[r.brandName?l("span",{class:`${me}-home-brand`,"data-testid":E.homeBrand,children:r.brandName}):l("span",{class:`${me}-home-brand-spacer`,"aria-hidden":"true"}),l("div",{class:`${me}-home-hero-actions`,children:[h.length>0?l("div",{class:`${me}-home-avatars`,children:h.map(v=>l("span",{class:`${me}-home-avatar`,title:v.role?`${v.name} \xB7 ${v.role}`:v.name,children:v.avatar?l("img",{src:v.avatar,alt:"",loading:"lazy"}):l("span",{children:Ia(v.name)})},v.name))}):null,l(Vt,{panelProps:i,variant:"plain"})]})]}),r.showGreeting!==!1?l(_e,{children:[l("h1",{class:`${me}-home-greeting`,"data-testid":E.homeGreeting,children:m.title}),m.subtitle?l("p",{class:`${me}-home-lead`,children:m.subtitle}):null]}):null]}),l("div",{class:`${me}-home-cards`,children:[f?l(Ov,{options:e.options,onAsk:v=>o.startNewConversation(v)}):null,r.showSearchBar!==!1?l(Hd,{placeholder:n.homeSearchPlaceholder,onActivate:()=>o.switchToLayout("help")}):null,w?l(Ra,{onClick:()=>{s.markSeen(w.id),o.push({kind:"content",id:w.id,title:w.title})},testid:E.homeWhatsNew,children:l("div",{class:`${me}-home-recent-row`,"data-unread":s.unseen?"true":void 0,children:[l("span",{class:`${me}-home-recent-avatar`,"aria-hidden":"true",children:l(ga,{})}),l("span",{class:`${me}-home-recent-body`,children:[l("span",{class:`${me}-home-recent-title`,children:n.homeWhatsNew}),l("span",{class:`${me}-home-recent-preview`,children:g?`${w.title} \xB7 ${g}`:w.title})]}),s.unseen?l("span",{class:`${me}-home-recent-dot`,role:"img","aria-label":n.newsUnseen}):null]})}):null,c?l(Ra,{onClick:()=>o.selectConversation(c),testid:E.homeRecent,children:l("div",{class:`${me}-home-recent-row`,"data-unread":c.hasUnread?"true":void 0,children:[l("span",{class:`${me}-home-recent-avatar`,"aria-hidden":"true",children:l(Xr,{})}),l("span",{class:`${me}-home-recent-body`,children:[l("span",{class:`${me}-home-recent-title`,children:c.title}),c.preview?l("span",{class:`${me}-home-recent-preview`,children:ka(c.preview)}):null]}),c.hasUnread?l("span",{class:`${me}-home-recent-dot`,"aria-label":"Unread"}):null]})}):null,y?l(Ra,{onClick:y.url?()=>o.push({kind:"iframe",url:y.url,title:x}):void 0,children:l("div",{class:`${me}-home-status`,"data-level":y.level??"operational",children:[l("span",{class:`${me}-home-status-icon`,"aria-hidden":"true",children:l(xd,{})}),l("span",{class:`${me}-home-status-text`,children:x})]})}):null,d.length>0?l("section",{class:`${me}-home-content`,children:[l("div",{class:`${me}-home-content-title`,children:S}),l("div",{class:`${me}-home-content-list`,children:d.map(v=>l(wa,{title:v.title,subtitle:v.description,onClick:()=>Lv(o,v),testid:st(E.homeContentRow,v.id)},v.id))})]}):null]})]})})}var tp={Icon:Sd,Root:e=>l($v,{...e})};var Ta={chat:zd,home:tp,help:Wd,news:Jd};var eo=A.cssPrefix;function np({modules:e,activeTab:t,strings:n,hasUnread:r,onSelect:o}){return l("nav",{class:`${eo}-tabbar`,role:"tablist","aria-label":n.panelTitle,children:e.map(a=>{let i=Ta[a.layout].Icon,s=a.id===t,c=a.layout==="chat"&&r;return l("button",{type:"button",role:"tab","aria-selected":s,class:`${eo}-tab`,onClick:()=>o(a.id),"data-testid":st(E.tab,a.id),children:[l("span",{class:`${eo}-tab-icon`,"aria-hidden":"true",children:[l(i,{}),c?l("span",{class:`${eo}-tab-badge`,"data-testid":E.tabBadge,"aria-label":"Unread"}):null]}),l("span",{class:`${eo}-tab-label`,children:ht(n,a.label)})]},a.id)})})}var rp=A.cssPrefix,Dv="allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads";function op({url:e,title:t,strings:n,onBack:r,actions:o}){return l("div",{class:`${rp}-module`,children:[l(xa,{title:t||n.moduleBack,backLabel:n.moduleBack,onBack:r,actions:o}),l("iframe",{class:`${rp}-content-frame`,src:e,title:t||"content",sandbox:Dv,referrerpolicy:"no-referrer",loading:"lazy",allow:"fullscreen"})]})}var Ss=A.cssPrefix;function ap({agent:e,strings:t}){let n=e.status??"online",r=ht(t,e.name),o=e.title?ht(t,e.title):null;return l("div",{class:`${Ss}-agent`,children:[l("div",{class:`${Ss}-agent-avatar`,"data-status":n,children:e.avatar?l("img",{src:e.avatar,alt:""}):l("span",{children:Ia(r)})}),l("div",{class:`${Ss}-agent-meta`,children:[l("strong",{children:r}),o?l("span",{children:o}):null]})]})}var Bv=["today","yesterday","lastWeek","older"];function Fv(e,t){let n=Date.parse(t);if(!Number.isFinite(n))return"older";let r=Math.floor((ip(e)-ip(n))/(1440*60*1e3));return r<=0?"today":r===1?"yesterday":r<7?"lastWeek":"older"}function sp(e,t){let n=new Map;for(let r of t){let o=Fv(e,r.lastMessageAt),a=n.get(o);a?a.push(r):n.set(o,[r])}return Bv.filter(r=>n.has(r)).map(r=>({bucket:r,conversations:n.get(r)}))}function ip(e){let t=new Date(e);return t.setUTCHours(0,0,0,0),t.getTime()}var lp=le.scope("history"),Uv=3,qv=6,zv={today:"dateToday",yesterday:"dateYesterday",lastWeek:"dateLastWeek",older:"dateOlder"};function cp(e,t){let n=t.type!=="upsert"||t.activity===!0;if(t.type==="snapshot"&&t.result.pagination.page===1&&e.pagination.page>1){let o=tn(e.conversations.slice(0,t.result.pagination.limit),t,n);if(t.result.conversations.length===0){if(o.length===0)return t.result;let p=Math.max(t.result.pagination.total,o.length);return{...t.result,conversations:o,pagination:{...t.result.pagination,total:p,totalPages:Math.ceil(p/t.result.pagination.limit)}}}let a=new Set(o.map(p=>p.conversationId)),i=e.conversations.slice(t.result.pagination.limit).filter(p=>!a.has(p.conversationId)),s=e.pagination.page,c={...t.result.pagination,page:s,hasPrev:s>1,hasNext:s<t.result.pagination.totalPages};return{conversations:[...o,...i],pagination:c}}let r=tn(e.conversations,t,n);return r===e.conversations?e:{...t.type==="snapshot"?t.result:e,conversations:r}}function Hv(e,t,n){let r=Date.parse(e);return Number.isFinite(r)?new Date(r).toDateString()===new Date(t).toDateString()?new Intl.DateTimeFormat(n,{hour:"numeric",minute:"2-digit"}).format(r):t-r<10080*60*1e3?new Intl.DateTimeFormat(n,{weekday:"short"}).format(r):new Intl.DateTimeFormat(n,{month:"short",day:"numeric"}).format(r):""}function Aa({transport:e,strings:t,locale:n,persistence:r,onSelect:o,onNewConversation:a}){let i=A.cssPrefix,s=e.peekConversations({limit:50}),[c,p]=z(s?"loaded":"loading"),[d,_]=z(s),[u,f]=z(!1),m=D(void 0),h=d?.conversations??[],y=d?.pagination;F(()=>{let v=!1,k=!0,C=[],T=e.subscribeConversationChanges(N=>{k&&C.push(N),_(L=>L&&cp(L,N))});m.current=void 0,f(!1);let M=e.peekConversations({limit:50});return _(M),p(M?"loaded":"loading"),e.listConversations({limit:50}).then(N=>{if(v)return;let L=N;for(let $ of C)L=cp(L,$);C=[],k=!1,_(L),p("loaded"),r.saveHistoryCount(L.conversations.length)}).catch(N=>{v||(C=[],k=!1,lp.warn("listConversations failed",{err:N}),p("error"))}),()=>{v=!0,T(),m.current=void 0}},[e,r,n]);async function x(){if(m.current||!y?.hasNext)return;let v={};m.current=v,f(!0);try{let k=await e.listConversations({page:y.page+1,limit:y.limit});if(m.current!==v)return;_(C=>{if(!C)return C;let T=new Set(C.conversations.map(L=>L.conversationId)),M=k.conversations.filter(L=>T.has(L.conversationId)?!1:(T.add(L.conversationId),!0)),N={conversations:[...C.conversations,...M],pagination:k.pagination};return r.saveHistoryCount(N.conversations.length),N})}catch(k){if(m.current!==v)return;lp.warn("listConversations page failed",{err:k,page:y.page+1})}finally{m.current===v&&(m.current=void 0,f(!1))}}let S=a?l("div",{class:`${i}-history-footer`,children:l("button",{type:"button",class:`${i}-history-new`,onClick:a,"data-testid":E.sidebarNewConversation,children:[l(ed,{}),t.newConversation]})}):null;if(c==="loading"){let v=Math.min(r.loadHistoryCount()??Uv,qv);return l(_e,{children:[l("div",{class:`${i}-history`,"aria-busy":"true","aria-label":t.historyLoading,children:l("div",{class:`${i}-history-group`,"aria-hidden":"true",children:[l("div",{class:`${i}-history-heading`,children:l("span",{class:`${i}-skeleton ${i}-skeleton-heading`})}),l("div",{class:`${i}-history-card`,children:Array.from({length:Math.max(1,v)},(k,C)=>l("div",{class:`${i}-history-item ${i}-history-item-skeleton`,children:[l("span",{class:`${i}-history-avatar ${i}-skeleton`}),l("span",{class:`${i}-history-body`,children:[l("span",{class:`${i}-history-row`,children:[l("span",{class:`${i}-history-title`,children:l("span",{class:`${i}-skeleton ${i}-skeleton-title`})}),l("span",{class:`${i}-history-time`,children:l("span",{class:`${i}-skeleton ${i}-skeleton-time`})})]}),l("span",{class:`${i}-history-row`,children:l("span",{class:`${i}-history-preview`,children:l("span",{class:`${i}-skeleton ${i}-skeleton-preview`})})})]})]},C))})]})}),S]})}if(c==="error"||h.length===0)return l(_e,{children:[l("div",{class:`${i}-history-empty`,children:t.historyEmpty}),S]});let w=Date.now(),g=sp(w,h);return l(_e,{children:[l("div",{class:`${i}-history`,role:"list",children:[g.map(v=>l("div",{class:`${i}-history-group`,children:[l("div",{class:`${i}-history-heading`,children:t[zv[v.bucket]]}),l("div",{class:`${i}-history-card`,children:v.conversations.map(k=>l("div",{role:"listitem",children:l("button",{type:"button",class:`${i}-history-item`,onClick:()=>o(k),"data-closed":k.canContinue?void 0:"true","data-unread":k.hasUnread?"true":void 0,"data-testid":st(E.historyItem,k.conversationId),children:[l("span",{class:`${i}-history-avatar`,"aria-hidden":"true",children:l(ms,{})}),l("span",{class:`${i}-history-body`,children:[l("span",{class:`${i}-history-row`,children:[l("span",{class:`${i}-history-title`,children:k.title}),l("span",{class:`${i}-history-time`,children:Hv(k.lastMessageAt,w,n)})]}),l("span",{class:`${i}-history-row`,children:[l("span",{class:`${i}-history-preview`,children:k.preview&&ka(k.preview)||(k.canContinue?t.historyContinue:t.conversationClosed)}),k.hasUnread?l("span",{class:`${i}-history-dot`}):null]})]})]})},k.conversationId))})]},v.bucket)),y?.hasNext?l("div",{class:`${i}-history-more`,children:l("button",{type:"button",onClick:x,disabled:u,"aria-busy":u,"data-testid":E.historyLoadMore,children:t.loadMoreConversations})}):null]}),S]})}var jv=A.cssPrefix;function up({visible:e,strings:t}){return e?l("div",{class:`${jv}-dropzone`,role:"status","aria-live":"polite",children:t.dropZone}):null}var Vv=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Wv=/^https?:\/\/[^\s.]+\.[^\s]+$/i,Gv=/^[+]?[\d\s().-]{6,}$/;function dr(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>String(t[r]??`{${r}}`))}function Kv(e){return Array.isArray(e)?e.length:e?.trim()?1:0}function Qv(e,t,n){let r=e.required??!0,o=e.validation;if(e.type==="multiselect"){let i=Kv(t);return r&&i===0?n.formRequired:i===0?void 0:o?.minSelections!=null&&i<o.minSelections?dr(n.formChooseAtLeast,{min:o.minSelections}):o?.maxSelections!=null&&i>o.maxSelections?dr(n.formChooseAtMost,{max:o.maxSelections}):void 0}let a=typeof t=="string"?t.trim():"";if(!a)return r?n.formRequired:void 0;switch(e.type){case"email":if(!Vv.test(a))return n.formInvalidEmail;break;case"url":if(!Wv.test(a))return n.formInvalidUrl;break;case"tel":if(!Gv.test(a))return n.formInvalidTel;break;case"number":{let i=Number(a);if(!Number.isFinite(i))return n.formInvalidNumber;if(o?.min!=null&&i<o.min)return dr(n.formNumberTooSmall,{min:o.min});if(o?.max!=null&&i>o.max)return dr(n.formNumberTooLarge,{max:o.max});break}default:break}if(o?.minLength!=null&&a.length<o.minLength)return dr(n.formTooShort,{min:o.minLength});if(o?.maxLength!=null&&a.length>o.maxLength)return dr(n.formTooLong,{max:o.maxLength});if(o?.pattern)try{if(!new RegExp(o.pattern).test(a))return n.formPatternMismatch}catch{}}function dp(e,t,n){let r={};for(let o of e){let a=Qv(o,t[o.name],n);a&&(r[o.name]=a)}return r}function pp(e){let t={};for(let[n,r]of Object.entries(e)){let o=Array.isArray(r)?r.join(", "):r;o.trim()&&(t[n]=o.trim())}return t}var Ne=A.cssPrefix,Ea="__other__";function to({fields:e,strings:t,submitLabel:n,onSubmit:r,skipLabel:o,onSkip:a,footerHint:i,submitOnEnter:s,disabled:c,initialValues:p,hideActions:d,fieldTypeLabels:_,rootTestId:u,submitTestId:f,skipTestId:m}){let[h,y]=z(()=>({...Zv(e),...p})),[x,S]=z({}),[w,g]=z({});function v(N){w[N]&&g(L=>({...L,[N]:""}))}function k(N,L){y($=>({...$,[N]:L})),v(N)}function C(N,L){S($=>({...$,[N]:L})),v(N)}function T(N){if(N.preventDefault(),c)return;let L=eh(e,h,x),$=dp(e,L,t);if(Object.keys($).length>0){g($);return}r(pp(L))}function M(N){!s||N.key!=="Enter"||N.shiftKey||N.isComposing||!N.target||!("tagName"in N.target)||N.target.tagName!=="TEXTAREA"||T(N)}return l("form",{class:`${Ne}-form`,onSubmit:T,onKeyDown:M,"data-testid":u,noValidate:!0,children:[e.map(N=>l(Yv,{field:N,value:h[N.name],otherText:x[N.name]??"",error:w[N.name],disabled:c,typeLabel:_?.[N.name],strings:t,onChange:L=>k(N.name,L),onOtherChange:L=>C(N.name,L)},N.name)),d?null:l("div",{class:`${Ne}-form-actions`,children:[i?l("span",{class:`${Ne}-form-hint`,children:i}):null,o&&a?l("button",{type:"button",class:`${Ne}-form-skip`,onClick:a,disabled:c,"data-testid":m,children:o}):null,l("button",{type:"submit",class:`${Ne}-form-submit`,disabled:c,"data-testid":f,children:n})]})]})}function Yv({field:e,value:t,otherText:n,error:r,disabled:o,typeLabel:a,strings:i,onChange:s,onOtherChange:c}){let p=st(E.formField,e.name),d=Xv({field:e,value:t,otherText:n,disabled:o,strings:i,onChange:s,onOtherChange:c,fieldTid:p});return l("label",{class:`${Ne}-field`,"data-field":e.name,"data-invalid":r?"true":void 0,children:[l("span",{class:`${Ne}-field-head`,children:[l("span",{class:`${Ne}-field-label`,children:[e.label,e.required??!0?l("span",{class:`${Ne}-field-req`,"aria-hidden":"true",children:" *"}):null]}),a?l("span",{class:`${Ne}-field-type`,children:a}):null]}),d,e.validationHint&&!r?l("span",{class:`${Ne}-field-hint`,children:e.validationHint}):null,r?l("span",{class:`${Ne}-field-error`,role:"alert",children:r}):null]})}function Xv(e){let{field:t,value:n,otherText:r,disabled:o,strings:a,onChange:i,onOtherChange:s,fieldTid:c}=e,p=typeof n=="string"?n:"";switch(t.type){case"textarea":return l("textarea",{class:`${Ne}-field-input`,rows:3,value:p,placeholder:t.placeholder,disabled:o,onInput:_=>i(_.currentTarget.value),"data-testid":c});case"select":return l("select",{class:`${Ne}-field-input`,value:p,disabled:o,onChange:_=>i(_.currentTarget.value),"data-testid":c,children:[l("option",{value:"",children:t.placeholder??"\u2014"}),(t.options??[]).map(_=>l("option",{value:_.value,children:_.label??_.value},_.value))]});case"radio":{let _=t.allowOther&&p===Ea;return l("div",{class:`${Ne}-field-choices`,role:"radiogroup","data-testid":c,children:[(t.options??[]).map(u=>l("label",{class:`${Ne}-choice`,children:[l("input",{type:"radio",name:`${Ne}-${t.name}`,checked:p===u.value,disabled:o,onChange:()=>i(u.value)}),l("span",{children:u.label??u.value})]},u.value)),t.allowOther?l("label",{class:`${Ne}-choice`,children:[l("input",{type:"radio",name:`${Ne}-${t.name}`,checked:p===Ea,disabled:o,onChange:()=>i(Ea)}),l("span",{children:a.formOther})]}):null,_?l("input",{class:`${Ne}-field-input`,value:r,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:o,onInput:u=>s(u.currentTarget.value)}):null]})}case"checkbox":return l("label",{class:`${Ne}-choice`,children:[l("input",{type:"checkbox",checked:p==="true",disabled:o,onChange:_=>i(_.currentTarget.checked?"true":""),"data-testid":c}),l("span",{children:t.placeholder??t.label})]});case"multiselect":{let u=function(f,m){return i(m?[..._,f]:_.filter(h=>h!==f))};var d=u;let _=Array.isArray(n)?n:[];return l("div",{class:`${Ne}-field-choices`,"data-testid":c,children:[(t.options??[]).map(f=>l("label",{class:`${Ne}-choice`,children:[l("input",{type:"checkbox",checked:_.includes(f.value),disabled:o,onChange:m=>u(f.value,m.currentTarget.checked)}),l("span",{children:f.label??f.value})]},f.value)),t.allowOther||(t.options??[]).length===0?l("textarea",{class:`${Ne}-field-input`,rows:2,value:r,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:o,onInput:f=>s(f.currentTarget.value)}):null]})}default:return l("input",{...Jv(t.type),class:`${Ne}-field-input`,value:p,placeholder:t.placeholder,disabled:o,onInput:_=>i(_.currentTarget.value),"data-testid":c})}}function Jv(e){switch(e){case"number":return{type:e};case"email":return{type:e};case"tel":return{type:e};case"url":return{type:e};case"date":case"time":return{type:e};default:return{type:"text"}}}function Zv(e){let t={};for(let n of e)n.defaultValue!=null&&(t[n.name]=n.type==="multiselect"?n.defaultValue.split(",").map(r=>r.trim()).filter(Boolean):n.defaultValue);return t}function eh(e,t,n){let r={...t};for(let o of e){let a=n[o.name]?.trim();if(o.type==="radio"&&o.allowOther&&t[o.name]===Ea)r[o.name]=a??"";else if(o.type==="multiselect"&&a){let i=a.split(/[,\n;]+/).map(c=>c.trim()).filter(Boolean),s=t[o.name];r[o.name]=[...Array.isArray(s)?s:[],...i]}}return r}var Gt=A.cssPrefix;function ks({form:e,strings:t,onSubmit:n,onSkip:r}){return l("div",{class:`${Gt}-form-gate`,"data-testid":E.formGate,children:[e.title?l("h3",{class:`${Gt}-form-gate-title`,children:e.title}):null,e.description?l("p",{class:`${Gt}-form-gate-desc`,children:e.description}):null,l(to,{fields:e.fields,strings:t,submitLabel:e.submitLabel??t.formSubmit,onSubmit:n,skipLabel:e.skippable?t.formSkip:void 0,onSkip:e.skippable?r:void 0,submitTestId:E.formSubmit,skipTestId:E.formSkip})]})}function _p({marker:e,strings:t,onFill:n}){let r=e.outcome==="skipped",o=r?t.formSkipped:t.formSubmitted,a=e.title?l(_e,{children:[l("span",{children:e.title}),l("span",{class:`${Gt}-sr-only`,children:o})]}):l("span",{children:o}),i=e.form?.reviewable??!1,s=!r&&i&&e.values&&Object.keys(e.values).length>0?e.values:null;if(s){let p=function(d){return e.form?.fields.find(_=>_.name===d)?.label??d};var c=p;return l("details",{class:`${Gt}-form-done`,"data-outcome":e.outcome,"data-testid":E.formDone,children:[l("summary",{class:`${Gt}-form-done-summary`,"data-testid":E.formDoneToggle,children:[l(Mn,{}),a,l(ir,{})]}),l("dl",{class:`${Gt}-form-answers`,"data-testid":E.formAnswers,children:Object.entries(s).map(([d,_])=>l("div",{class:`${Gt}-form-answer`,children:[l("dt",{children:p(d)}),l("dd",{children:_})]},d))})]})}return l("div",{class:`${Gt}-form-done`,"data-outcome":e.outcome,"data-testid":E.formDone,role:"status",children:[r?l(vd,{}):l(Mn,{}),a,r&&e.form?.reopenable&&n?l("button",{type:"button",class:`${Gt}-form-done-fill`,"data-testid":E.formFill,onClick:n,children:t.formFillOut}):null]})}var fp=Object.assign;function rh(e,t){for(var n in e)if(n!="__source"&&e[n]!==t[n])return!0;for(var r in t)if(r!="__source"&&!(r in e))return!0;return!1}var oh=/^(-|f[lo].*[^se]$|g.{5,}[^ps]$|z|o[pr]|(W.{5})?[lL]i.*(t|mp)$|an|(bo|s).{4}Im|sca|m.{6}[ds]|ta|c.*[st]$|wido|ini)/;function vp(e,t){function n(o){var a=this.props.ref;return a!=o.ref&&a&&(typeof a=="function"?a(null):a.current=null),t?!t(this.props,o)||a!=o.ref:rh(this.props,o)}function r(o){return this.shouldComponentUpdate=n,Hn(e,o)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.type=e,r}var ah=Symbol.for("react.element"),ih=/^(?: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]/,sh=/[A-Z0-9]/g,lh=typeof document<"u";var ch=function(e){return/fil|che|rad/.test(e)};Ot.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Ot.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var mp=pe.event;pe.event=function(e){return mp&&(e=mp(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var uh={configurable:!0,get:function(){return this.class}},gp=pe.vnode;pe.vnode=function(e){if(typeof e.type=="string")(function(r){var o=r.props,a=r.type,i={},s=a.indexOf("-")==-1;for(var c in o){var p=o[c];if(!(c=="value"&&"defaultValue"in o&&p==null||lh&&c=="children"&&a=="noscript"||c=="class"||c=="className")){if(c=="style"&&p&&p.constructor==Object){var d=void 0;for(var _ in p)typeof p[_]!="number"||oh.test(_)||(d||(d=p=fp({},p)),p[_]+="px")}else if(c=="defaultValue"&&"value"in o&&o.value==null)c="value";else if(c=="download"&&p===!0)p="";else if(c=="translate"&&p==="no")p=!1;else if(c[0]=="o"&&c[1]=="n"){var u=c.toLowerCase();u=="ondoubleclick"?c="ondblclick":u!="onchange"||a!="input"&&a!="textarea"||ch(o.type)?u=="onfocus"?c="onfocusin":u=="onblur"&&(c="onfocusout"):u=c="oninput",u=="oninput"&&i[c=u]&&(c="oninputCapture")}else s&&ih.test(c)?c=c.replace(sh,"-$&").toLowerCase():p===null&&(p=void 0);i[c]=p}}a=="select"&&(i.multiple&&Array.isArray(i.value)&&(i.value=Po(o.children).forEach(function(f){f.props.selected=i.value.indexOf(f.props.value)!=-1})),i.defaultValue!=null&&(i.value=Po(o.children).forEach(function(f){f.props.selected=i.multiple?i.defaultValue.indexOf(f.props.value)!=-1:i.defaultValue==f.props.value}))),o.class&&!o.className?(i.class=o.class,Object.defineProperty(i,"className",uh)):o.className&&(i.class=i.className=o.className),r.props=i})(e);else if(typeof e.type=="function"&&("ref"in e.props&&"prototype"in e.type&&e.type.prototype.render&&(e.ref=e.props.ref,delete e.props.ref),e.type.defaultProps)){var t=fp({},e.props);for(var n in e.type.defaultProps)t[n]===void 0&&(t[n]=e.type.defaultProps[n]);e.props=t}e.ref&&!("ref"in e.props)&&Object.defineProperty(e.props,"ref",{value:e.ref,configurable:!0,writable:!0}),e.$$typeof=ah,gp&&gp(e)};function Ma(e){return e?(e.startsWith("tool:")?e.slice(5):e)==="ask-user-questions":!1}var Na=A.cssPrefix;function hp({messageId:e,initial:t,strings:n,onFeedback:r}){let[o,a]=z(t);F(()=>a(t),[e,t]);function i(s){let c=o===s?null:s;a(c),r(e,c)}return l("div",{class:`${Na}-feedback`,role:"group","data-testid":E.messageFeedback,children:[l("button",{type:"button",class:`${Na}-msg-action`,"data-active":o==="up"?"true":void 0,"aria-pressed":o==="up","aria-label":n.feedbackUp,title:n.feedbackUp,onClick:()=>i("up"),"data-testid":E.feedbackUp,children:l(Id,{})}),l("button",{type:"button",class:`${Na}-msg-action`,"data-active":o==="down"?"true":void 0,"aria-pressed":o==="down","aria-label":n.feedbackDown,title:n.feedbackDown,onClick:()=>i("down"),"data-testid":E.feedbackDown,children:l(Td,{})}),l("span",{class:`${Na}-sr-only`,role:"status","aria-live":"polite",children:o?n.feedbackThanks:""})]})}var Ft=A.cssPrefix;function bp(e){let t=e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim().toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)}function Cs(e){if(e.startsWith("tool:")||e.startsWith("tool-"))return e.slice(5);let t=e.indexOf("__"),n=e.slice(t+2);return t>0&&n?`${bp(e.slice(0,t))} \xB7 ${bp(n)}`:e}function La(e,t){let n=e==="output-available"||e==="output-error"||e==="output-denied",r=e==="approval-responded"||t?.approved!==void 0;return{terminal:n,responded:r,decided:n||r}}function Rs({status:e,icon:t,label:n}){return l("span",{class:`${Ft}-toolui-badge ${Ft}-toolui-status`,"data-status":e,children:[l("span",{class:`${Ft}-toolui-status-icon`,children:t}),n]})}function dh(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 Is(e,t,n={}){return n.submitted?"responded":fh(dh(e,t),n.superseded,n.live??!0)}function ph({status:e}){return e==="denied"||e==="error"||e==="superseded"?l(ha,{}):e==="completed"||e==="responded"?l(va,{}):l(Ed,{})}function _h(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 fh(e,t,n){return t&&(e==="awaiting"||e==="running")?"superseded":!n&&e==="running"?"error":e}function mh({state:e,approval:t,strings:n,superseded:r,live:o=!0,submitted:a=!1}){let i=Is(e,t,{superseded:r,live:o,submitted:a});return l(Rs,{status:i,icon:l(ph,{status:i}),label:_h(i,n)})}function gh({name:e,state:t,approval:n,strings:r,superseded:o,live:a,submitted:i}){return l(_e,{children:[l("span",{class:`${Ft}-toolui-name-pill`,children:[l(Ad,{}),l("span",{class:`${Ft}-toolui-name-text`,children:e})]}),l(mh,{state:t,approval:n,strings:r,superseded:o,live:a,submitted:i}),l("span",{class:`${Ft}-toolui-chevron`,children:l(Nn,{})})]})}function Oa({part:e,strings:t,testid:n,superseded:r,live:o,submitted:a}){let i=ie(()=>he(()=>e.inputSig.value),[e]),s=ie(()=>he(()=>e.outputSig.value),[e]),c=ie(()=>he(()=>e.errorSig.value),[e]),p=ie(()=>he(()=>e.stateSig.value),[e]),d=ie(()=>he(()=>e.approvalSig.value),[e]);return l("details",{class:`${Ft}-toolui ${Ft}-toolui-collapsible`,"data-testid":n,children:[l("summary",{class:`${Ft}-toolui-head`,children:l(gh,{name:Cs(e.toolName),state:p.value,approval:d.value,strings:t,superseded:r,live:o,submitted:a})}),l(ws,{label:t.toolParameters,value:i.value}),s.value!==void 0?l(ws,{label:t.toolResult,value:s.value}):null,c.value?l(ws,{label:t.statusError,value:c.value,error:!0}):null]})}function ws({label:e,value:t,error:n}){let r=n?typeof t=="string"?t:"":$a(Ts(t));return r?l("div",{class:`${Ft}-toolui-section`,children:[l("span",{class:`${Ft}-toolui-label`,children:e}),l("pre",{class:`${Ft}-toolui-code`,"data-error":n?"true":void 0,children:r})]}):null}function Ts(e){if(e&&typeof e=="object"){let t=e;if(t.storage==="tool-result-ref"&&"summary"in t)return t.summary}return e}function $a(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 yp(e){return e.partsSig.value.some(t=>t.kind==="text"&&t.textSig.value.length>0)}function Pp(e){return e.partsSig.value.some(t=>t.kind==="reasoning")}function vh(e){return e.streaming&&!e.bufferedHold&&!(e.reasoningVisible&&e.working)}function xp(e){let{streaming:t,reasoningVisible:n,emptyReply:r,hidden:o}=e,a=e.responseMode==="buffered"&&t,i=t&&!e.hasAnswerText;return{streaming:t,bufferedHold:a,reasoningVisible:n,working:i,showStreamDots:vh({streaming:t,bufferedHold:a,reasoningVisible:n,working:i}),emptyReply:r,hidden:o}}function Sp(e,t){let n=e.stateSig.value,r=e.approvalSig.value,{terminal:o,responded:a,decided:i}=La(n,r),s=t.continuationStreaming===!0&&!i,c=t.superseded&&!i&&!s;return{pill:Is(n,r,{superseded:c,live:t.live,submitted:s}),state:n,terminal:o,decided:i||s,showApproveReject:!i&&!t.superseded&&!s,showAnswered:a&&!o&&!c,showSubmitted:s,showEdit:a&&t.active&&!o,skipped:c,answeredApproved:r?.approved}}var pr=A.cssPrefix;function kp({part:e,strings:t}){let n=e.title||e.filename||e.url||t.sources;return e.url?l("a",{class:`${pr}-source`,href:e.url,target:"_blank",rel:"noreferrer noopener","data-testid":E.source,children:[l("span",{class:`${pr}-source-icon`,"aria-hidden":"true",children:"\u{1F517}"}),l("span",{class:`${pr}-source-label`,children:n})]}):l("span",{class:`${pr}-source`,"data-testid":E.source,children:[l("span",{class:`${pr}-source-icon`,"aria-hidden":"true",children:"\u{1F4C4}"}),l("span",{class:`${pr}-source-label`,children:n})]})}var Tt=A.cssPrefix;function wp({part:e,strings:t,active:n,superseded:r=!1,continuationStreaming:o=!1,onDecision:a,onEdit:i}){let s=ie(()=>he(()=>e.approvalSig.value),[e]),c=ie(()=>he(()=>Sp(e,{active:n,superseded:r,continuationStreaming:o})),[e,n,r,o]).value,{terminal:p,showApproveReject:d,showAnswered:_,showSubmitted:u,showEdit:f,skipped:m}=c,h=Cs(e.toolName),y=c.answeredApproved,x=e.toolCallId,S=l(_e,{children:[l("p",{class:`${Tt}-toolui-prompt`,children:t.approvalPrompt.replace("{tool}",h)}),l("p",{class:`${Tt}-toolui-subtle`,children:t.approvalBody})]});u?S=l("p",{class:`${Tt}-toolui-subtle`,children:t.approvalSubmitting}):_&&y!==!1?S=l(_e,{children:[l("p",{class:`${Tt}-toolui-prompt`,children:[t.approvalYourResponse.replace("{decision}",y?t.approve:t.reject),s.value?.reason?` \u2014 ${s.value.reason}`:""]}),f?l("p",{class:`${Tt}-toolui-subtle`,children:t.approvalEditHint}):null,f?null:l("p",{class:`${Tt}-toolui-subtle`,children:t.approvalSubmitting})]}):_&&(S=l(_e,{}));let w=d||u||f||_&&y!==!1;return l("div",{class:`${Tt}-toolui-group`,"data-testid":c.decided?E.toolDecision:E.toolApproval,children:[l(Oa,{part:e,strings:t,superseded:m,submitted:u}),m||p||!w?null:l("div",{class:`${Tt}-toolui ${Tt}-toolui-body`,children:[S,d?l("div",{class:`${Tt}-toolui-actions`,children:[l("button",{type:"button",class:`${Tt}-form-skip`,disabled:!n,onClick:()=>a(x,!1),"data-testid":E.toolReject,children:t.reject}),l("button",{type:"button",class:`${Tt}-form-submit`,disabled:!n,onClick:()=>a(x,!0),"data-testid":E.toolApprove,children:t.approve})]}):null,f?l("div",{class:`${Tt}-toolui-actions`,children:l("button",{type:"button",class:`${Tt}-form-skip`,onClick:()=>i(x),"data-testid":E.toolEdit,children:t.edit})}):null]})]})}var hh=["text","email","phone","number","date","single-select","multi-select","boolean"];function Cp(e){return e!==null&&typeof e=="object"}function Rp(e){let t=Cp(e)?e:{},r=(Array.isArray(t.questions)?t.questions:[]).map(bh).filter(o=>o!==null);return{intro:Da(t.intro),questions:r}}function bh(e,t){if(!Cp(e))return null;let n=hh.find(r=>r===e.type)??"text";return{key:Da(e.key)??`q${t+1}`,question:Da(e.question)??"Please provide the missing information.",type:n,options:Array.isArray(e.options)?e.options.filter(r=>typeof r=="string"&&r.trim().length>0):void 0,required:typeof e.required=="boolean"?e.required:void 0,helpText:Da(e.helpText)}}function yh(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 As(e,t,n){return e.questions.map(r=>{let o=yh(r.type),a=r.type==="boolean"?[{value:"yes",label:t},{value:"no",label:n}]:(r.options??[]).map(i=>({value:i,label:i}));return{name:r.key,label:r.question,type:o,required:r.required??!1,options:a.length>0?a:void 0,validationHint:r.helpText}})}function Da(e){return typeof e=="string"&&e.trim()?e.trim():void 0}var Qe=A.cssPrefix;function Ph({skipped:e,submitted:t,strings:n}){return e?{status:"superseded",statusLabel:n.inputSkipped}:t?{status:"responded",statusLabel:n.statusResponded}:{status:"completed",statusLabel:n.inputAnswered}}var xh={text:"qtypeText",email:"qtypeEmail",phone:"qtypePhone",number:"qtypeNumber",date:"qtypeDate","single-select":"qtypeChooseOne","multi-select":"qtypeChooseAny",boolean:"qtypeBoolean"};function Ip(e,t){let n={};for(let r of e)n[r.key]=t[xh[r.type]];return n}function Tp({part:e,strings:t,active:n,superseded:r=!1,continuationStreaming:o=!1,onDecision:a,onEdit:i}){let s=ie(()=>he(()=>e.stateSig.value),[e]).value,c=ie(()=>he(()=>e.approvalSig.value),[e]).value,p=ie(()=>he(()=>Rp(e.inputSig.value)),[e]).value,{terminal:d,decided:_}=La(s,c),u=_&&c?.approved===!0,f=o&&!_,m=!_&&!r&&!f,h=!m&&!u&&!f,y=u&&n&&!d,x=p.questions,[S,w]=z(null),v=S??(m||u||f),[k,C]=z(!1),T=x.length>1?fs:Yr,M=m?t.inputRequired:t.inputBadge,N=f?l("p",{class:`${Qe}-toolui-subtle`,children:t.approvalSubmitting}):m?l(Sh,{req:p,strings:t,active:n,resolve:(W,G)=>a(e.toolCallId,G,W)}):k?l(to,{fields:As(p,t.confirmYes,t.confirmNo),strings:t,submitLabel:t.inputSubmit,onSubmit:()=>{},disabled:!0,hideActions:!0,fieldTypeLabels:Ip(x,t),initialValues:u?Ih(x,c?.reason):void 0}):l(kh,{questions:x,answers:u?Rh(c?.reason):{},strings:t}),{status:L,statusLabel:$}=Ph({skipped:h,submitted:f,strings:t});return l("details",{class:`${Qe}-toolui ${Qe}-toolui-collapsible${r?` ${Qe}-toolui-stale`:""}`,open:v,onToggle:W=>{let G=W.currentTarget.open;G!==v&&w(G)},"data-testid":m?E.toolAskQuestions:E.toolDecision,children:[l("summary",{class:`${Qe}-toolui-head`,children:[l("span",{class:`${Qe}-toolui-q-pill`,children:[l(T,{}),M]}),l("span",{class:`${Qe}-toolui-head-end`,children:[m?null:l(Rs,{status:L,icon:h?l(ha,{}):l(va,{}),label:$}),l("span",{class:`${Qe}-toolui-chevron`,children:l(Nn,{})})]})]}),l("div",{class:`${Qe}-toolui-collapse-body`,children:[p.intro?l("div",{class:`${Qe}-toolui-desc`,children:p.intro}):null,N,m||f?null:l("div",{class:`${Qe}-toolui-footer`,children:[l("button",{type:"button",class:`${Qe}-toolui-options-toggle`,onClick:()=>C(W=>!W),"data-testid":E.toolAskOptions,children:[l("span",{class:`${Qe}-toolui-options-chevron${k?` ${Qe}-open`:""}`,children:l(Nn,{})}),k?t.hideOptions:t.showOptions]}),y?l("button",{type:"button",class:`${Qe}-form-skip`,onClick:()=>i(e.toolCallId),"data-testid":E.toolEdit,children:t.edit}):null]})]})]})}function Sh({req:e,strings:t,active:n,resolve:r}){let o=As(e,t.confirmYes,t.confirmNo),a=e.questions.length===1&&e.questions[0]?.type==="text";return l(to,{fields:o,strings:t,disabled:!n,submitLabel:t.inputSubmit,footerHint:a?t.inputSubmitHint:void 0,onSubmit:i=>r(Ch(e.questions,i),!0),skipLabel:t.inputSkip,onSkip:()=>r(void 0,!1),submitOnEnter:a,fieldTypeLabels:Ip(e.questions,t),submitTestId:E.toolInputSubmit,skipTestId:E.toolInputSkip})}function kh({questions:e,answers:t,strings:n}){return l("div",{class:`${Qe}-toolui-summary`,"data-testid":E.toolAskSummary,children:e.map(r=>l("div",{class:`${Qe}-field`,children:[l("span",{class:`${Qe}-field-head`,children:l("span",{class:`${Qe}-field-label`,children:[r.question,r.required?l("span",{class:`${Qe}-field-req`,"aria-hidden":"true",children:" *"}):null]})}),l("p",{class:`${Qe}-toolui-answer`,children:wh(r,t[r.key],n)||"\u2014"})]},r.key))})}function wh(e,t,n){return e.type!=="boolean"?t??"":t==="yes"?n.confirmYes:t==="no"?n.confirmNo:t??""}function Ch(e,t){let n=e.flatMap(r=>{let o=t[r.key];if(o==null||o.trim()==="")return[];let a=r.type==="multi-select"?o.split(",").map(i=>i.trim()).filter(Boolean):o;return[{key:r.key,value:a}]});return JSON.stringify({answers:n})}function Ap(e){if(!e)return{};let n=(()=>{try{return JSON.parse(e)}catch{return}})()?.answers;if(!Array.isArray(n))return{};let r={};for(let o of n)if(o&&typeof o=="object"&&"key"in o){let{key:a,value:i}=o;if(typeof a!="string")continue;typeof i=="string"?r[a]=i:Array.isArray(i)&&(r[a]=i.filter(s=>typeof s=="string"))}return r}function Rh(e){let t=Ap(e),n={};for(let[r,o]of Object.entries(t))n[r]=Array.isArray(o)?o.join(", "):o;return n}function Ih(e,t){let n=Ap(t),r={};for(let o of e){let a=n[o.key];a!==void 0&&(o.type==="multi-select"?r[o.key]=Array.isArray(a)?a:[a]:r[o.key]=Array.isArray(a)?a[0]??"":a)}return r}function Ep({part:e,strings:t,live:n}){let r=ie(()=>he(()=>e.inputSig.value),[e]),o=ie(()=>he(()=>e.outputSig.value),[e]),a=ie(()=>he(()=>e.errorSig.value),[e]);return ie(()=>he(()=>!!$a(r.value)||!!a.value||!!$a(Ts(o.value))),[r,o,a]).value?l(Oa,{part:e,strings:t,testid:E.toolCall,live:n}):null}var lt=A.cssPrefix,Mp=vp(Th);function Th({message:e,status:t,strings:n,responseMode:r,showReasoning:o,showToolCalls:a,showSources:i,interactive:s=!1,superseded:c=!1,tool:p,onRetry:d,enableMessageFeedback:_=!1,onFeedback:u}){let m=[...ie(()=>he(()=>e.partsSig.value),[e]).value];for(let U of e.attachments??[])!U.url||m.some(oe=>oe.kind==="file"&&oe.url===U.url)||m.push({kind:"file",url:U.url,mediaType:U.mediaType});let h=ie(()=>he(()=>Tn(e)),[e]),y=ie(()=>he(()=>Ou(e)),[e]),x=ie(()=>he(()=>yp(e)),[e]),S=ie(()=>he(()=>o&&Pp(e)),[e,o]),w=t==="streaming",g=e.role==="assistant"&&w,v=xp({streaming:g,responseMode:r,reasoningVisible:S.value,hasAnswerText:x.value,emptyReply:h.value,hidden:y.value}),{bufferedHold:k,working:C,showStreamDots:T}=v;if(v.hidden)return null;let M=Eh(e.createdAt),N=e.role==="assistant"||e.role==="operator",L=_&&!!u&&!!e.serverMessageId&&N&&!w&&t!=="error"&&!h.value,$=w?"":m.filter(U=>U.kind==="text").map(U=>e.role==="assistant"?aa(U.textSig.peek()):U.textSig.peek()).join(`
57
+ ${a}`:a;continue}o.startsWith("id:")&&(r=o.slice(3).trim())}if(n==="[DONE]")return"done";if(!n)return null;try{let o=JSON.parse(n);return sd.trace("chunk",{type:o.type,eventId:r}),{chunk:o,eventId:r}}catch(o){throw sd.trace("frame parse failed",{errorType:o instanceof Error?o.name:typeof o,payloadLength:n.length}),new st("invalid SSE frame","network",void 0,o)}}var Ee=se.scope("transport"),ah="x-user-token",cd=6e4,ih=1e4,Cs=50,fd=new WeakMap;function sr(e){return fd.get(e)}function Qr(e,t){return fd.set(e,t),e}function ud(e){return Math.max(e?.upsertRevision??0,e?.read?.revision??0)}function sh(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 on(e,t,n=!0){switch(t.type){case"snapshot":{let r=new Map(e.map(i=>[i.conversationId,i])),o=e.filter(i=>(sr(i)?.activityRevision??0)>t.requestedRevision).toSorted((i,s)=>sr(s).activityRevision-sr(i).activityRevision),a=new Set(o.map(i=>i.conversationId));return[...o,...t.result.conversations.filter(i=>!a.has(i.conversationId)).map(i=>{let s=r.get(i.conversationId);if(!s)return i;let c=sr(s);return(c?.upsertRevision??0)>t.requestedRevision?s:c?.read&&!s.hasUnread&&c.read.lastMessageAt===i.lastMessageAt?Qr({...i,hasUnread:!1},{upsertRevision:0,read:c.read}):i})]}case"read":{let r=e.findIndex(c=>c.conversationId===t.conversationId&&(t.lastMessageAt===void 0||c.lastMessageAt===t.lastMessageAt));if(r<0)return e;let o=e[r],a=sr(o);if(ud(a)>t.revision)return e;let i=t.lastMessageAt??o.lastMessageAt,s={upsertRevision:a?.upsertRevision??0,...a?.activityRevision===void 0?{}:{activityRevision:a.activityRevision},read:{revision:t.revision,...i?{lastMessageAt:i}:{}}};return o.hasUnread?e.map((c,p)=>p===r?Qr({...c,hasUnread:!1},s):c):(Qr(o,s),e)}case"upsert":{let r=e.findIndex(p=>p.conversationId===t.conversation.conversationId);if(r<0&&!n)return e;let o=r<0?void 0:e[r],a=o?sr(o):void 0;if(ud(a)>t.revision)return e;let i=t.activity?t.revision:a?.activityRevision,s={upsertRevision:t.revision,...i===void 0?{}:{activityRevision:i},...!t.conversation.hasUnread&&a?.read?{read:a.read}:{}},c=o?{...o,...t.conversation,title:o.title}:{...t.conversation};return o&&sh(o,c)?(Qr(o,s),e):(Qr(c,s),t.activity?[c,...e.filter(p=>p.conversationId!==c.conversationId)]:o?e.map((p,_)=>_===r?c:p):[...e,c])}default:return t}}var dd=3,lh=400,ch=3e4,uh=6e4,dh=1e4,ph=6e4,_h=15e3,fh=1024*1024,pd=new Set([408,425,429,500,502,503,504]);function _d(e){return lh*2**e+Math.floor(Math.random()*250)}function mh(e){return ph+Math.ceil(e/fh)*_h}function gh(e){let t=e.get("retry-after");if(!t)return null;let n=Number(t),r=Number.isFinite(n)?n*1e3:Date.parse(t)-Date.now();return Number.isFinite(r)&&r>=0?Math.min(r,3e4):null}var Xr=class{constructor(t){te(this,"ttlMs",t);te(this,"map",new Map)}getOrFetch(t,n){let r=this.map.get(t);if(r&&performance.now()-r.at<this.ttlMs)return r.result;let o={at:performance.now(),result:n().then(a=>(o.value=a,a)).catch(a=>{throw this.map.get(t)===o&&this.map.delete(t),a})};return this.map.set(t,o),o.result}peek(t){let n=this.map.get(t);if(n?.value!==void 0&&performance.now()-n.at<this.ttlMs)return n.value}update(t){for(let n of this.map.values()){if(n.value!==void 0){let r=t(n.value);n.value=r,n.result=Promise.resolve(r);continue}n.result=n.result.then(r=>{let o=t(r);return n.value=o,o})}}delete(t){this.map.delete(t)}},Pa=class{constructor(t){te(this,"opts",t);te(this,"conversationListeners",new Set);te(this,"conversationRevision",0);te(this,"visitorId");te(this,"conversationId");te(this,"userContext");te(this,"pageContext");te(this,"locale");te(this,"userTokenSource");te(this,"userToken");te(this,"userTokenRequest");te(this,"conversationsCache",new Xr(ih));te(this,"contentCache",new Xr(cd));te(this,"contentCollectionsCache",new Xr(cd))}setUserToken(t){this.userTokenSource=t,this.userToken=typeof t=="string"&&t||void 0,this.userTokenRequest=typeof t=="function"?this.fetchUserToken():void 0}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:Do};this.visitorId&&(t.visitorId=this.visitorId),this.conversationId&&(t.conversationId=this.conversationId),this.locale&&(t.locale=this.locale);let n=ws(this.userContext,this.pageContext);return n&&(t[gs]=n),t}withEnvelope(t){return{...this.envelope(),...t}}appendEnvelope(t){for(let[n,r]of Object.entries(this.envelope()))t.append(n,r);return t}withEnvelopeQuery(t){let n=new URL(this.url(t));for(let[r,o]of Object.entries(this.envelope()))n.searchParams.has(r)||n.searchParams.set(r,o);return n.toString()}async handshake(t){Ee.debug("handshake \u2192",{visitorId:t.visitorId,conversationId:t.conversationId,locale:t.locale}),this.userTokenRequest&&await this.userTokenRequest;let n=await this.postJson(it.handshake,t,"handshake");return Ee.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){Ee.debug("uploadFile \u2192",{name:t.name,size:t.size,type:t.type});let r=new FormData;r.append("file",t,t.name);let o=await this.postForm(this.uploadPath,r,"upload",n,mh(t.size));return Ee.debug("uploadFile \u2190",{id:o.id,url:o.url}),o}async transcribe(t,n="audio/webm"){Ee.debug("transcribe \u2192",{size:t.size,mimeType:n});let r=new FormData;r.append("audio",t,`voice.${hh(n)}`),r.append("mimeType",n);let o=await this.postForm(this.transcribePath,r,"transcribe");return Ee.debug("transcribe \u2190",{textLen:o.text.length}),o}subscribeConversationChanges(t){return this.conversationListeners.add(t),()=>this.conversationListeners.delete(t)}publishConversation(t,n=!1){let r={type:"upsert",conversation:t,revision:++this.conversationRevision,...n?{activity:!0}:{}};this.conversationsCache.update(o=>{let a=o.pagination.page===1,i=o.conversations.some(d=>d.conversationId===t.conversationId),s=on(o.conversations,r,a&&n),c=a&&s.length>o.pagination.limit?s.slice(0,o.pagination.limit):s;if(!a||!n||i||o.pagination.hasNext)return c===o.conversations?o:{...o,conversations:c};let p=Math.max(o.pagination.total,o.conversations.length)+1,_=Math.ceil(p/o.pagination.limit);return{...o,conversations:c,pagination:{...o.pagination,total:p,totalPages:_,hasNext:o.pagination.page<_}}});for(let o of this.conversationListeners)o(r)}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 r=this.localeCacheKey(t),o=this.conversationRevision;n&&this.conversationsCache.delete(r);let a=this.conversationsCache.getOrFetch(r,()=>this.fetchConversations(t));return n?a.then(i=>{let s={type:"snapshot",result:i,requestedRevision:o};for(let c of this.conversationListeners)c(s);return i}):a}async fetchConversations(t){let n=new URL(this.url(it.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:r,beforeCreatedAt:o}={}){let a=new URL(this.url(it.listMessages));a.searchParams.set("conversationId",t),a.searchParams.set("limit",String(Cs)),n.length>0&&a.searchParams.set("ids",n.join(",")),r&&a.searchParams.set("beforeId",r),o&&a.searchParams.set("beforeCreatedAt",o);let i=await this.getJson(a.toString(),"loadConversation");return{...i,messages:i.messages.toReversed()}}async markRead(t,n){if(!this.visitorId||!t)return;let r={type:"read",conversationId:t,...n===void 0?{}:{lastMessageAt:n},revision:++this.conversationRevision};this.conversationsCache.update(o=>{let a=on(o.conversations,r);return a===o.conversations?o:{...o,conversations:a}});for(let o of this.conversationListeners)o(r);try{await this.postJson(it.markRead,{conversationId:t},"markRead",!0)}catch(o){Ee.debug("markRead failed (non-fatal)",{err:o})}}async requestOperator(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(it.requestOperator,{},"requestOperator")).controlState}catch(t){Ee.debug("requestOperator failed (non-fatal)",{err:t});return}}async cancelOperatorRequest(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(it.cancelOperatorRequest,{},"cancelOperatorRequest")).controlState}catch(t){Ee.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(it.content));for(let[a,i]of Object.entries(t))i!==void 0&&n.searchParams.set(a,Array.isArray(i)?i.join(","):String(i));let r=await this.getJson(n.toString(),"listContent"),o=r.items?.map(a=>Hl(a,this.locale))??[];return{...r,items:o}}async setContentVote(t){try{await this.postJson(this.dataUrl(it.contentVoteSet),t,"setContentVote")}catch{}}listContentCollections(t){return this.contentCollectionsCache.getOrFetch(this.localeCacheKey({ids:t}),()=>this.fetchContentCollections(t))}async fetchContentCollections(t){let n=new URL(this.dataUrl(it.contentCollections));return t.length&&n.searchParams.set("ids",t.join(",")),{items:(await this.getJson(n.toString(),"listContentCollections")).items?.map(o=>zl(o,this.locale))??[]}}async bootstrap(t){let n=new URL(this.dataUrl(it.bootstrap));t&&n.searchParams.set("conversationId",t);let r=await this.getJson(n.toString(),"bootstrap"),o=r.forms??[],a=r.formSubmissions??[];return{forms:o,formSubmissions:a}}async saveUserPrefs(t){return this.postJson(it.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??it.submitForm}async submitForm(t){Ee.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){Ee.debug("submitForm failed (non-fatal)",{err:n})}}async submitFeedback(t){Ee.debug("submitFeedback \u2192",{messageId:t.messageId,value:t.value});try{await this.postJson(it.messageFeedback,{messageId:t.messageId,set:{feedback:t.value}},"submitFeedback")}catch(n){Ee.debug("submitFeedback failed (non-fatal)",{err:n})}}async sendTurn(t,n={}){Ee.debug("message \u2192",{conversationId:t.conversationId,visitorId:t.visitorId,messageCount:t.messages.length});let r=JSON.stringify({...this.withEnvelope(t),[gs]:ws(this.userContext,this.pageContext,this.opts.recentHostEvents)}),o=n.keepalive===!0&&new Blob([r]).size<uh;try{return await this.runWithAbort(async a=>{let i=await this.withFreshUserToken(()=>this.fetchImpl(this.url(it.streamMessage),{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json",...this.headersFor(this.url(it.streamMessage))},body:r,keepalive:o,signal:a}));if(i.status!==202)throw new st(`sendTurn failed: expected 202, received ${i.status}`,"server",i.status);let s;try{s=await i.json()}catch(c){throw a?.aborted?c:new st("sendTurn failed: invalid acknowledgement","server",i.status,c)}if(!vh(s))throw new st("sendTurn failed: invalid acknowledgement","server",i.status);return s},void 0,ch)}catch(a){throw a instanceof st?a:new st("sendTurn failed: network error","network",void 0,a)}}cancelTurn(t,n){!this.visitorId||!t||!n||(Ee.debug("cancel stream",{conversationId:t,runId:n,visitorId:this.visitorId}),this.fetchImpl(this.url(it.cancelStream),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.headersFor(this.url(it.cancelStream))},body:JSON.stringify(this.withEnvelope({conversationId:t,runId:n})),keepalive:!0}).catch(r=>Ee.debug("cancel POST failed (non-fatal)",{err:r})))}async connectResumeStream(t){let n=new AbortController;function r(){return n.abort(t.signal.reason)}t.signal.aborted?r():t.signal.addEventListener("abort",r,{once:!0});let o=setTimeout(()=>n.abort(),dh);function a(){clearTimeout(o),t.signal.removeEventListener("abort",r)}let i;try{this.userTokenRequest&&await this.userTokenRequest,i=await this.fetchImpl(this.resumeUrl(),{method:"GET",credentials:"omit",headers:{accept:"text/event-stream",...this.headersFor(this.resumeUrl())},signal:n.signal})}catch(c){return a(),t.signal.aborted||Ee.debug("resume-stream fetch failed \u2014 reconnecting",{err:c}),"held"}if(!i.ok)return a(),i.status===401&&typeof this.userTokenSource=="function"?(await this.fetchUserToken(),"held"):i.status===409||pd.has(i.status)?(Ee.debug("resume-stream \u2192 transient response; reconnecting",{status:i.status}),"held"):(Ee.debug("resume-stream \u2192 endpoint unavailable",{status:i.status}),"unavailable");if(!i.body)return a(),Ee.debug("resume-stream \u2192 bodyless response; stopping",{status:i.status}),"unavailable";if(!(i.headers.get("content-type")??"").includes("text/event-stream"))return a(),Ee.debug("resume-stream \u2192 non-SSE response; stopping"),"unavailable";let s=!1;try{for await(let{chunk:c}of ld(i,n.signal,p=>{s||p!=="connected"||(s=!0,clearTimeout(o),t.onConnected())})){if(t.signal.aborted)return"held";t.onChunk(c)}}catch(c){if(t.signal.aborted)return"held";Ee.debug("resume-stream segment dropped \u2014 reconnecting",{err:c})}finally{a()}return"held"}resumeUrl(){return this.withEnvelopeQuery(it.streamResume)}async postJson(t,n,r,o=!1){let a=await this.fetchWithRetry(()=>[this.url(t),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.headersFor(this.url(t))},body:JSON.stringify(this.withEnvelope(n)),...o?{keepalive:!0}:{}}],r);return this.assertOk(a,r)}async postForm(t,n,r,o,a){return this.runWithAbort(async i=>{let s=await this.withFreshUserToken(()=>this.fetchImpl(this.url(t),{method:"POST",credentials:"omit",headers:this.headersFor(this.url(t)),body:this.appendEnvelope(n),signal:i}));return this.assertOk(s,r)},o,a)}async runWithAbort(t,n,r){if(!n&&r===void 0)return t();let o=new AbortController;function a(){return o.abort(n?.reason)}n?.aborted?a():n?.addEventListener("abort",a,{once:!0});let i=r===void 0?void 0:setTimeout(()=>o.abort(),r);try{return await t(o.signal)}finally{i!==void 0&&clearTimeout(i),n?.removeEventListener("abort",a)}}async getJson(t,n){let r=await this.fetchWithRetry(()=>[this.withEnvelopeQuery(t),{method:"GET",credentials:"omit",headers:{accept:"application/json",...this.headersFor(this.url(t))}}],n);return this.assertOk(r,n)}async fetchWithRetry(t,n){for(let r=0;;r++){let o;try{o=await this.withFreshUserToken(()=>this.fetchImpl(...t()))}catch(i){if(r>=dd)throw new st(`${n} failed: network error`,"network",void 0,i);Ee.debug("request network error \u2014 retrying",{label:n,attempt:r}),await $n(_d(r));continue}if(o.ok||!pd.has(o.status)||r>=dd)return o;let a=gh(o.headers)??_d(r);Ee.debug("request retryable status \u2014 retrying",{label:n,status:o.status,attempt:r,wait:a}),await $n(a)}}async assertOk(t,n){if(!t.ok)throw new st(`${n} failed: ${t.status}`,"server",t.status);return await t.json()}fetchUserToken(){let t=this.userTokenSource;if(typeof t!="function")return Promise.resolve();let n=Promise.resolve().then(t).then(r=>{this.userTokenSource===t&&(this.userToken=r||void 0)},r=>{Ee.warn("userToken function failed; continuing as an anonymous visitor",{err:r})});return this.userTokenRequest=n,n}headersFor(t){let n=!/^https?:\/\//i.test(t)||t.startsWith(`${this.opts.agentApiBaseUrl}/`);return{...this.opts.auth.headers(),...n&&this.userToken?{[ah]:this.userToken}:{}}}async withFreshUserToken(t){let n=await t();return n.status!==401||!this.userTokenSource?n:typeof this.userTokenSource!="function"?(Ee.warn("userToken rejected as invalid or expired; pass a function so the widget can fetch a fresh one"),n):(await this.fetchUserToken(),t())}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 hh(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 vh(e){if(typeof e!="object"||e===null)return!1;let t=Reflect.get(e,"status"),n=Reflect.get(e,"conversationId"),r=Reflect.get(e,"runId");return t==="accepted"&&typeof n=="string"&&n.length>0&&(r===void 0||typeof r=="string"&&r.length>0)}function lr(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 xa(e,t,n){return lr("close",e,t)?n.includes("close"):!1}function md(e,t){return e==="inline"&&t==="fullscreen"?"exit-fullscreen":"close"}function cr(e,t,n,r){let o={role:n,text:r};e.emit("message",o),t.onMessage?.(o)}function gd(e){let t=B(e);t.current=e;let n=B(null);return n.current??(n.current=bh(t)),n.current}function bh(e){let t=ae(null),n=new Set;function r(c){return`${e.current.conversationId()??""}:${c}`}function o(c){return c.frequency==="always"?!1:c.frequency==="conversation"?n.has(r(c.id)):c.id in e.current.persistence.loadFormsDone()}function a(c,p){if(t.value)return;let _=e.current;if(c==="manual"){let d=_.forms.list.find(u=>u.id===p);d&&(t.value={form:d,trigger:"manual"});return}for(let d of _.forms.byTrigger[c]??[]){let u=d.triggers.find(f=>f.kind===c);if(!(!u||!yh(u,_)||o(d)||!Ph(d,_))){t.value={form:d,trigger:c};return}}}function i(c,p){let _=t.value;if(!_)return;t.value=null;let{form:d,trigger:u}=_;d.frequency==="conversation"?n.add(r(d.id)):d.frequency!=="always"&&e.current.persistence.saveFormDone(d.id),e.current.onComplete(d,u,c,p)}function s(){let c=t.value;if(!c)return;let p=e.current.forms.list.find(_=>_.id===c.form.id);p&&p!==c.form&&(t.value={form:p,trigger:c.trigger})}return{activeForm:t,fire:a,refresh:s,complete:c=>i(c,!1),skip:()=>i({},!0)}}function yh(e,t){return e.kind==="after-messages"?t.messageCount()>=Number(e.param??0):e.kind==="page-area"?t.pageArea()===e.param:!0}function Ph(e,t){let n=e.when;if(!n)return!0;if(n.missingContext?.length){let o=t.userContext()??{};if(n.missingContext.some(a=>o[a]!==void 0&&o[a]!==""))return!1}if(n.pageArea&&!(Array.isArray(n.pageArea)?n.pageArea:[n.pageArea]).includes(t.pageArea()??""))return!1;let r=t.messageCount();return!(n.minMessages!=null&&r<n.minMessages||n.maxMessages!=null&&r>n.maxMessages)}function hd(e){return Object.fromEntries(e.map(t=>[t,[]]))}function Ts(e,t,n){return e.includes(t)?t:e.includes(n)?n:e[0]??""}function vd(e,t,n){let r=[...new Set(t)],o=Ts(r,e,""),a=ae({activeTab:o,stacks:hd(r)});return{sig:a,reconcile(i,s){let c=[...new Set(i)],p=a.value,_=Ts(c,p.activeTab,s),d=Object.fromEntries(c.map(f=>[f,p.stacks[f]??[]])),u=_===p.activeTab&&c.length===Object.keys(p.stacks).length&&c.every(f=>p.stacks[f]===d[f]);r=c,!u&&(a.value={activeTab:_,stacks:d},_!==p.activeTab&&_&&n?.(_))},switchTab(i){!(i in a.value.stacks)||a.value.activeTab===i||(a.value={...a.value,activeTab:i},n?.(i))},open(i,s){let c=a.value;i in c.stacks&&(a.value={activeTab:i,stacks:{...c.stacks,[i]:s?[s]:[]}},c.activeTab!==i&&n?.(i))},push(i){let s=a.value,c=s.stacks[s.activeTab]??[];a.value={...s,stacks:{...s.stacks,[s.activeTab]:[...c,i]}}},pop(){let i=a.value,s=i.stacks[i.activeTab]??[];s.length!==0&&(a.value={...i,stacks:{...i.stacks,[i.activeTab]:s.slice(0,-1)}})},reset(i){a.value={activeTab:Ts(r,i,""),stacks:hd(r)}}}}function bd(e){return e.stacks[e.activeTab]??[]}function yd(e){return bd(e).at(-1)}function Pd(e){return bd(e).length===0}function Sa(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 xh=900,Sh=640;function Rs(e,t,n){if(e==="standalone"||e==="page")return"fullscreen";let r=t.initialSize;return r==="expanded"||r==="fullscreen"||r==="normal"?r:n>0&&n<Sh?"fullscreen":n>=(t.autoSizeBreakpoint??xh)?"expanded":"normal"}function Jr(e,t,n,r=null){let a=e.mode==="inline"||e.mode==="standalone"||e.mode==="page"||(n??!e.startMinimized),s=e.mode!=="standalone"&&e.mode!=="page"&&e.mode!=="inline"&&r?r:Rs(e.mode,e.size,t);return{panelOpen:a,panelSize:s}}function ur(){return typeof window>"u"?0:window.innerWidth}var ee={fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24"},Yr=`${M.cssPrefix}-icon-dir`;function Is(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M21 12a8 8 0 0 1-12 6.93L3 21l1.65-5.16A8 8 0 1 1 21 12Z"})})}function Bt(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M18 6 6 18M6 6l12 12"})})}function xd(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M12 5v14M5 12h14"})})}function Sd(){return l("svg",{...ee,class:Yr,"aria-hidden":"true",children:[l("path",{d:"m22 2-7 20-4-9-9-4Z"}),l("path",{d:"M22 2 11 13"})]})}function kd(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M12 19V5M5 12l7-7 7 7"})})}function wd(){return l("svg",{...ee,class:Yr,"aria-hidden":"true",children:l("path",{d:"M3 20V4l18 8-18 8Z"})})}function dr(){return l("svg",{...ee,class:Yr,"aria-hidden":"true",children:l("path",{d:"m9 18 6-6-6-6"})})}function Cd(){return l("svg",{...ee,"aria-hidden":"true",children:l("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}function Td(){return l("svg",{...ee,"aria-hidden":"true",children:l("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"})})}function Rd(){return l("svg",{...ee,"aria-hidden":"true",children:[l("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),l("path",{d:"M5 10a7 7 0 0 0 14 0M12 19v3"})]})}function Id(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M3 8V3h5M21 8V3h-5M3 16v5h5M21 16v5h-5"})})}function Ad(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M8 3v5H3M16 3v5h5M8 21v-5H3M16 21v-5h5"})})}function Ed(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M3 3h7v2H5v5H3zM21 3h-7v2h5v5h2zM3 21h7v-2H5v-5H3zM21 21h-7v-2h5v-5h2z"})})}function Md(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M10 3v5H3M14 3v5h7M10 21v-5H3M14 21v-5h7"})})}function Nd(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"M14 3h7v7M21 3l-9 9"}),l("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]})}function Ld(){return l("svg",{...ee,"aria-hidden":"true",viewBox:"0 0 10 10",children:l("path",{d:"M9 1L1 9M9 5L5 9M9 9H9",strokeWidth:"1.5"})})}function Od(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"5",r:"1.5",fill:"currentColor",stroke:"none"}),l("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),l("circle",{cx:"12",cy:"19",r:"1.5",fill:"currentColor",stroke:"none"})]})}function $d(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M11 5 6 9H2v6h4l5 4zM15 9a5 5 0 0 1 0 6M18 7a9 9 0 0 1 0 10"})})}function Dd(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M11 5 6 9H2v6h4l5 4zM22 9l-6 6M16 9l6 6"})})}function Bd(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"M3 18 8 6l5 12M4.7 14h6.6"}),l("path",{d:"M14.5 18l3.2-7 3.2 7M15.6 15.8h4.2"})]})}function Fd(){return l("svg",{...ee,class:Yr,"aria-hidden":"true",children:l("path",{d:"m5 6 6 6-6 6M13 6l6 6-6 6"})})}function Dn(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M20 6 9 17l-5-5"})})}function Ud(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"M3 3v6h6"}),l("path",{d:"M3.05 13A9 9 0 1 0 6 5.3L3 9"}),l("path",{d:"M12 7v5l3 2"})]})}function qd(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"10"}),l("path",{d:"M2 12h20"}),l("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"})]})}function Zr(){return l("svg",{...ee,class:Yr,"aria-hidden":"true",children:l("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}function Hd(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"M12 20h9"}),l("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function Bn(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"m6 9 6 6 6-6"})})}function zd(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),l("path",{d:"M14 2v6h6"})]})}function kh(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"m12 3-1.5 4.5L6 9l4.5 1.5L12 15l1.5-4.5L18 9l-4.5-1.5Z"}),l("path",{d:"M19 15v4M17 17h4M5 3v2M4 4h2"})]})}function As(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2Z"})})}function eo(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"10"}),l("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),l("path",{d:"M12 17h.01"})]})}function wh(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"m15 4 3 3-9 9-3-3z"}),l("path",{d:"M18 2v2M20 4h2M3 20l3-3M3 16h2M5 14v2"})]})}function Ch(){return l("svg",{...ee,"aria-hidden":"true",children:[l("rect",{x:"4",y:"8",width:"16",height:"12",rx:"2"}),l("path",{d:"M12 8V4"}),l("circle",{cx:"12",cy:"3",r:"1"}),l("path",{d:"M2 14h2M20 14h2M9 13h.01M15 13h.01M9.5 17h5"})]})}function Es(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"M4 14v-2a8 8 0 0 1 16 0v2"}),l("rect",{x:"2",y:"14",width:"4",height:"6",rx:"1.5"}),l("rect",{x:"18",y:"14",width:"4",height:"6",rx:"1.5"}),l("path",{d:"M20 20v1a3 3 0 0 1-3 3h-5"})]})}function Th(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"10"}),l("circle",{cx:"12",cy:"12",r:"4"}),l("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"})]})}function Ms(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"11",cy:"11",r:"7"}),l("path",{d:"m21 21-4.3-4.3"})]})}function jd(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]})}function Vd(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"M3 9.5 12 3l9 6.5"}),l("path",{d:"M5 9v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9"})]})}function ka(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"m3 11 15-5v12L3 13z"}),l("path",{d:"M3 11v2a2 2 0 0 0 2 2h1V9H5a2 2 0 0 0-2 2z"}),l("path",{d:"M7 15v3a2 2 0 0 0 4 0v-2"}),l("path",{d:"M21 10a3 3 0 0 1 0 4"})]})}function to(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z"}),l("path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1"})]})}function Wd(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"4"}),l("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"})]})}function Gd(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})}function Kd(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"M12 3v18"}),l("path",{d:"M12 3a9 9 0 0 1 0 18z",fill:"currentColor",stroke:"none"})]})}function Rh(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"10.5",cy:"10.5",r:"6.5"}),l("path",{d:"M8 11a2.5 2.5 0 0 0 5 0"}),l("path",{d:"m20 20-4.4-4.4"})]})}function Ih(){return l("svg",{...ee,"aria-hidden":"true",children:[l("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"}),l("path",{d:"M18.5 4v3M20 5.5h-3M5.5 16v2.5M6.75 17.25h-2.5"})]})}function Ah(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"M4 18h16"}),l("path",{d:"M5 18a7 7 0 0 1 14 0"}),l("path",{d:"M12 8V6"}),l("path",{d:"M10 6h4"})]})}function Eh(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"M7 11V6.5a1.5 1.5 0 0 1 3 0V10"}),l("path",{d:"M10 10V5.5a1.5 1.5 0 0 1 3 0V10"}),l("path",{d:"M13 10V6.5a1.5 1.5 0 0 1 3 0V12"}),l("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"})]})}function Qd(){return l("svg",{...ee,"aria-hidden":"true",children:[l("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2"}),l("path",{d:"M5 15a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2"})]})}function Xd(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"M7 10v11H4a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1z"}),l("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"})]})}function Jd(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"M17 14V3h3a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1z"}),l("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"})]})}function Yd(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"3.5"}),l("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"})]})}function Zd(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"M12 7v5l3 2"})]})}function wa(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]})}function Ca(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"m15 9-6 6M9 9l6 6"})]})}var ep={chat:Is,message:As,bubbles:to,spark:kh,wand:wh,bot:Ch,help:eo,lifebuoy:Th,headset:Es,search:Rh,sparkles:Ih,concierge:Ah,wave:Eh};var H=M.cssPrefix,L={launcher:`${H}-launcher`,callout:`${H}-callout`,calloutDismiss:`${H}-callout-dismiss`,panel:`${H}-panel`,panelHeader:`${H}-panel-header`,resizeGrip:`${H}-resize-grip`,scrollToBottom:`${H}-scroll-to-bottom`,loadPreviousMessages:`${H}-load-previous-messages`,actionHistory:`${H}-action-history`,actionClose:`${H}-action-close`,langSegment:`${H}-lang-segment`,composer:`${H}-composer`,composerInput:`${H}-composer-input`,composerSend:`${H}-composer-send`,composerStop:`${H}-composer-stop`,compactionStatus:`${H}-compaction-status`,messageQueue:`${H}-message-queue`,queuedMessage:`${H}-queued-message`,queuedMessageRemove:`${H}-queued-message-remove`,composerAttach:`${H}-composer-attach`,composerFileInput:`${H}-composer-file-input`,composerVoice:`${H}-composer-voice`,attachmentChip:`${H}-attachment-chip`,attachmentRemove:`${H}-attachment-remove`,suggestion:`${H}-suggestion`,messageBubble:`${H}-message`,messageRetry:`${H}-message-retry`,messageFeedback:`${H}-message-feedback`,feedbackUp:`${H}-feedback-up`,feedbackDown:`${H}-feedback-down`,messageCopy:`${H}-message-copy`,historyPane:`${H}-history-pane`,historyBack:`${H}-history-back`,historyItem:`${H}-history-item`,historyLoadMore:`${H}-history-load-more`,sidebar:`${H}-sidebar`,sidebarToggle:`${H}-sidebar-toggle`,sidebarNewConversation:`${H}-sidebar-new-conversation`,sidebarItem:`${H}-sidebar-item`,messengerHome:`${H}-messenger-home`,modulesEmpty:`${H}-modules-empty`,tab:`${H}-tab`,tabBadge:`${H}-tab-badge`,homeView:`${H}-home-view`,homeGreeting:`${H}-home-greeting`,homeBrand:`${H}-home-brand`,backHeader:`${H}-back-header`,contentView:`${H}-content-view`,contentScroll:`${H}-content-scroll`,homeSearch:`${H}-home-search`,helpSearch:`${H}-help-search`,homeRecent:`${H}-home-recent`,homeAsk:`${H}-home-ask`,homeWhatsNew:`${H}-home-whats-new`,homeContentRow:`${H}-home-content-row`,helpArticle:`${H}-help-article`,newsItem:`${H}-news-item`,newsMore:`${H}-news-more`,formGate:`${H}-form-gate`,formDone:`${H}-form-done`,formDoneToggle:`${H}-form-done-toggle`,formAnswers:`${H}-form-answers`,formFill:`${H}-form-fill`,formSubmit:`${H}-form-submit`,formSkip:`${H}-form-skip`,formField:`${H}-form-field`,toolAskQuestions:`${H}-tool-ask-questions`,toolInputSubmit:`${H}-tool-input-submit`,toolInputSkip:`${H}-tool-input-skip`,toolApproval:`${H}-tool-approval`,toolApprove:`${H}-tool-approve`,toolReject:`${H}-tool-reject`,toolEdit:`${H}-tool-edit`,toolDecision:`${H}-tool-decision`,typingDots:`${H}-typing-dots`,reasoning:`${H}-reasoning`,toolAskSummary:`${H}-ask-questions-summary`,toolAskOptions:`${H}-ask-questions-options-toggle`,toolCall:`${H}-tool-call`,source:`${H}-source`,operatorRequest:`${H}-operator-request`,operatorBanner:`${H}-operator-banner`,cancelOperatorRequest:`${H}-cancel-operator-request`};function lt(e,t){return`${e}-${t}`}var Ta=M.cssPrefix;function tp({onToggle:e,launcher:t,strings:n,leaving:r,edgeTab:o}){let a=t.variant!=="circle"&&!!t.label;return l("button",{type:"button",class:`${Ta}-fab`,part:"launcher","data-variant":t.variant,"data-size":t.size,"data-edge-tab":o?"true":void 0,"data-leaving":r?"true":void 0,"data-testid":L.launcher,onClick:e,"aria-label":n.launcherOpen,children:[Mh(t.icon),a?l("span",{class:`${Ta}-fab-label`,children:vt(n,t.label??"")}):null]})}function Mh(e){let t=ep[e];return t?l(t,{}):l(Nh,{source:e})}function Nh({source:e}){return l("span",{ref:t=>{t&&Lh(t,e)},"aria-hidden":"true"})}function Lh(e,t){if(e.dataset.svgMounted!==t)try{let r=new DOMParser().parseFromString(t,"image/svg+xml").documentElement;r.tagName.toLowerCase()==="svg"&&(e.replaceChildren(document.importNode(r,!0)),e.dataset.svgMounted=t)}catch{}}function np({callout:e,launcherPosition:t,strings:n,closeLabel:r,onDismiss:o}){let[a,i]=q(!1);return D(()=>{let s=setTimeout(()=>i(!0),e.delayMs);return()=>clearTimeout(s)},[e.delayMs]),D(()=>{if(!a||e.autoDismissMs<=0)return;let s=setTimeout(o,e.autoDismissMs);return()=>clearTimeout(s)},[a,e.autoDismissMs,o]),a?l("div",{class:`${Ta}-callout`,role:"status","data-shape":e.shape,"data-position":Oh(e.position,t),"data-animated":e.animated?"true":void 0,"data-testid":L.callout,children:[l("span",{children:vt(n,e.text)}),l("button",{type:"button",class:`${Ta}-callout-close`,onClick:o,"aria-label":r,title:r,"data-testid":L.calloutDismiss,children:l(Bt,{})})]}):null}function Oh(e,t){let n=t.endsWith("-right"),r=t.startsWith("bottom-");return e==="vertical"?r?"top":"bottom":n?"left":"right"}var $h='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function Ra(e){function t(n){if(n.key!=="Tab")return;let r=[...e.querySelectorAll($h)].filter(s=>s.offsetParent!==null||s===document.activeElement);if(r.length===0){n.preventDefault();return}let o=r[0],a=r[r.length-1];if(!o||!a)return;let i=e.getRootNode().activeElement;n.shiftKey&&i===o?(n.preventDefault(),a.focus()):!n.shiftKey&&i===a&&(n.preventDefault(),o.focus())}return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)}var hn=M.cssPrefix;function Ia({title:e,actions:t}){return l("header",{class:`${hn}-back-header`,part:"header","data-variant":"title",children:[l("span",{class:`${hn}-back-spacer`,"aria-hidden":"true"}),l("h1",{class:`${hn}-back-title`,children:e}),t??l("span",{class:`${hn}-back-spacer`,"aria-hidden":"true"})]})}function Aa({title:e,backLabel:t,onBack:n,actions:r,testid:o}){return l("header",{class:`${hn}-back-header`,part:"header","data-testid":o,children:[l("button",{type:"button",class:`${hn}-icon-btn`,onClick:n,"aria-label":t,title:t,children:l(Zr,{})}),l("h1",{class:`${hn}-back-title`,children:e}),r??l("span",{class:`${hn}-back-spacer`,"aria-hidden":"true"})]})}function Ea({textSig:e,doneSig:t,generativeUi:n=!1,strings:r=Ao}){let o=B(null);return Ct(()=>{let a=o.current;if(!a)return;a.classList.add(`${M.cssPrefix}-md`),a.replaceChildren();let i=n?ms(a,{cssPrefix:M.cssPrefix,strings:r}):void 0,s=rr(i??Ur(a)),c=0,p=zt(()=>{let u=e.value,f=t.value;u.length<c&&(i?.dispose(),a.replaceChildren(),i=n?ms(a,{cssPrefix:M.cssPrefix,strings:r}):void 0,s=rr(i??Ur(a)),c=0);let m=u.slice(c);m&&Ge(s,m),c=u.length,f&&(Fr(s),i?.finish())}),_=new MutationObserver(u=>{for(let f of u)for(let m of f.addedNodes){if(!(m instanceof HTMLElement))continue;let v=m.matches?.("a")?[m]:[...m.querySelectorAll?.("a")??[]];for(let P of v)rp(P)}});_.observe(a,{childList:!0,subtree:!0});for(let u of a.querySelectorAll("a"))rp(u);function d(u){let f=u.target?.closest?.("a");if(!f||!(f instanceof HTMLAnchorElement))return;let m=f.getAttribute("href")??"";!m||m.startsWith("#")||(u.preventDefault(),window.open(m,"_blank","noopener,noreferrer"))}return a.addEventListener("click",d),()=>{p(),i?.dispose(),_.disconnect(),a.removeEventListener("click",d)}},[e,t,n,r]),l("div",{ref:o})}function ap({text:e}){let t=ce(()=>ae(e),[e]),n=ce(()=>ae(!0),[]);return l(Ea,{textSig:t,doneSig:n})}function rp(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 op=new Set([11,12,13,14,15,16,17,18,19,31]);function Ma(e){let t="",n=[],r=rr({data:void 0,add_token:(o,a)=>{n.push(a),op.has(a)||(t+=" ")},end_token:()=>{let o=n.pop();o!==void 0&&!op.has(o)&&(t+=" ")},add_text:(o,a)=>{t+=a},set_attr:()=>{}});return Ge(r,e),Fr(r),t.replace(/\s+/g," ").trim()}var ip=M.cssPrefix;function Lt({tone:e="info",message:t,onRetry:n,strings:r}){return l("div",{class:`${ip}-module-empty`,role:e==="error"?"alert":"status","aria-live":"polite",children:[l("span",{children:t}),n?l("button",{type:"button",class:`${ip}-module-retry`,onClick:n,children:r.errorRetry}):null]})}var vn=M.cssPrefix,Gh=se.scope("content"),Kh=5e3;function sp({id:e,title:t,transport:n,strings:r,bus:o,onBack:a,actions:i}){let[s,c]=q(null),[p,_]=q(!1),[d,u]=q(!1),[f,m]=q(0),[v,P]=q(null),x=$(()=>{u(!1),c(null),m(g=>g+1)},[]);D(()=>{let g=!1,S=n.listContentCollections([]).catch(()=>{});return Promise.all([n.listContent({ids:[e],limit:1}),S]).then(([w,C])=>{if(g)return;let A=w.items[0];A?(c(A),_(C?.items.find(E=>E.id===A.contentCollectionId)?.settings?.voteAccess==="portal"),o.emit("contentOpen",{contentId:e,contentCollectionId:A.contentCollectionId})):u(!0)}).catch(w=>{g||(Gh.warn("listContent (reader) failed",{err:w}),u(!0))}),()=>{g=!0}},[n,e,f,o]),D(()=>{if(!s)return;let g=setTimeout(()=>o.emit("contentRead",{contentId:e}),Kh);return()=>clearTimeout(g)},[s,e,o]);let k=$(g=>{let w=g.target?.closest?.("a")?.getAttribute("href")??"";w&&!w.startsWith("#")&&o.emit("contentLinkClick",{contentId:e})},[o,e]);function T(g){P(e),n.setContentVote({contentId:e,value:g})}function h(){return d?l(Lt,{tone:"error",message:r.errorGeneric,onRetry:x,strings:r}):s===null?l(Lt,{message:r.contentLoading,strings:r}):l("article",{class:`${vn}-content`,"data-testid":L.contentView,onClick:k,children:[s.image?l("img",{class:`${vn}-content-hero`,src:s.image,alt:"",loading:"lazy"}):null,s.description?l("p",{class:`${vn}-content-subtitle`,children:s.description}):null,l(ap,{text:s.content??""}),p?l("div",{class:`${vn}-content-vote`,"aria-live":"polite",children:v===e?r.feedbackThanks:l(_e,{children:[l("span",{children:r.contentHelpful}),l("button",{type:"button",class:`${vn}-module-retry`,onClick:()=>T(1),children:r.confirmYes}),l("button",{type:"button",class:`${vn}-module-retry`,onClick:()=>T(0),children:r.confirmNo})]})}):null]})}return l("div",{class:`${vn}-module`,children:[l(Aa,{title:s?.title||t||r.moduleBack,backLabel:r.moduleBack,onBack:a,actions:i,testid:L.backHeader}),l("div",{class:`${vn}-module-scroll`,"data-testid":L.contentScroll,children:h()})]})}function lp({itemCount:e,initialFocusIndex:t}){let[n,r]=q(!1),o=B(null),a=B(null),[i,s]=q(-1),c=$(()=>{r(!1),s(-1),o.current?.focus()},[]),p=$(()=>r(u=>!u),[]);D(()=>{if(!n)return;function u(f){let m=a.current,v=o.current;if(!m||!v)return;let P=f.composedPath();P.includes(m)||P.includes(v)||(r(!1),s(-1))}return document.addEventListener("click",u,!0),()=>document.removeEventListener("click",u,!0)},[n]),D(()=>{if(!n||e===0)return;let u=t?.()??0,f=u<0||u>=e?0:u;s(f)},[n,e,t]),D(()=>{if(!n||i<0)return;a.current?.querySelectorAll("[role='menuitem']")?.[i]?.focus()},[n,i]);let _=$(u=>{(u.key==="ArrowDown"||u.key==="Enter"||u.key===" ")&&(u.preventDefault(),r(!0))},[]),d=$(u=>{if(e!==0)switch(u.key){case"Escape":u.preventDefault(),c();return;case"ArrowDown":u.preventDefault(),s(f=>(f+1)%e);return;case"ArrowUp":u.preventDefault(),s(f=>(f-1+e)%e);return;case"Home":u.preventDefault(),s(0);return;case"End":u.preventDefault(),s(e-1)}},[e,c]);return{open:n,focusIndex:i,triggerRef:o,menuRef:a,toggle:p,close:c,onTriggerKey:_,onMenuKey:d}}function cp({items:e,triggerLabel:t}){let n=M.cssPrefix,r=lp({itemCount:e.length});function o(s){s.disabled||(s.onSelect?.(),s.keepOpen||r.close())}function a(s,c){return s.onSelectValue?.(c)}function i(s,c){let p=c.segments;if(!p?.length)return;let _=Math.max(0,p.findIndex(u=>u.value===c.value)),d=-1;if(s.key==="ArrowRight"||s.key==="Enter"||s.key===" ")d=(_+1)%p.length;else if(s.key==="ArrowLeft")d=(_-1+p.length)%p.length;else return;s.preventDefault(),s.stopPropagation(),a(c,p[d].value)}return l("div",{class:`${n}-menu-wrap`,children:[l("button",{ref:r.triggerRef,type:"button",class:`${n}-icon-btn`,"aria-label":t,"aria-haspopup":"menu","aria-expanded":r.open,title:t,onClick:r.toggle,onKeyDown:r.onTriggerKey,children:l(Od,{})}),r.open?l("div",{ref:r.menuRef,class:`${n}-menu`,role:"menu","aria-label":t,onKeyDown:r.onMenuKey,tabIndex:-1,children:e.map(s=>s.segments?l("div",{role:"menuitem",class:`${n}-menu-item ${n}-menu-item-segmented`,"aria-label":s.label,tabIndex:-1,onKeyDown:c=>i(c,s),children:[s.icon?l("span",{class:`${n}-menu-icon`,children:s.icon}):null,l("span",{class:`${n}-menu-label`,children:s.label}),l("span",{class:`${n}-segmented`,role:"group","aria-label":s.label,children:s.segments.map(c=>{let p=c.value===s.value;return l("button",{type:"button",role:"menuitemradio","aria-checked":p,class:`${n}-segment`,"data-on":p?"true":void 0,lang:c.lang,title:c.value,tabIndex:-1,"data-testid":`${L.langSegment}-${c.value}`,onClick:()=>a(s,c.value),children:c.label},c.value)})})]},s.id):l("button",{type:"button",role:"menuitem",class:`${n}-menu-item`,"aria-pressed":s.type==="switch"?s.on:void 0,disabled:s.disabled,onClick:()=>o(s),children:[s.icon?l("span",{class:`${n}-menu-icon`,children:s.icon}):null,l("span",{class:`${n}-menu-label`,children:s.label}),s.type==="switch"&&s.on?l("span",{class:`${n}-menu-check`,"aria-hidden":"true",children:l(Dn,{})}):null]},s.id))}):null]})}var Ns=M.cssPrefix;function Qh(e){let t=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)").matches:!0;return e==="host"?Zn()==="dark"?"light":"dark":e==="auto"?t?"light":"dark":t?e==="light"?"dark":"auto":e==="dark"?"light":"auto"}var Xh={normal:"large",large:"small",small:"normal"};function Jh(e){return e==="light"?l(Wd,{}):e==="dark"?l(Gd,{}):l(Kd,{})}function Yh(e){return(e.split("-")[0]??e).toUpperCase()}function Zh(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 Gt({panelProps:e,variant:t}){let{options:n,panelSize:r,feedback:o,onClose:a,onClear:i,onExpand:s,onFullscreen:c,onSoundToggle:p}=e,{onToggleHistory:_,onLocaleChange:d,onThemeChange:u,onTextSizeChange:f}=e,m=n.strings,v=n.mode,P=t==="chat",x=Tt(()=>o.mutedSig.value).value,k=new Set(n.actions);function T(z){return k.has(z)}let h=typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches;function g(z){return h?!1:lr(z,v,r)}let S=n.themeMode,w={auto:m.themeAuto,light:m.themeLight,dark:m.themeDark,host:m.themeAuto},C=n.textSize,A={small:m.textSizeSmall,normal:m.textSizeNormal,large:m.textSizeLarge},E=[];if(P&&T("clear")&&E.push({id:"clear",icon:l(Hd,{}),label:m.newConversation,onSelect:i}),T("expand")&&g("expand")){let z=r==="expanded";E.push({id:"expand",icon:z?l(Ad,{}):l(Id,{}),label:z?m.collapse:m.expand,type:"switch",on:z,onSelect:s})}if(T("fullscreen")&&g("fullscreen")){let z=r==="fullscreen";E.push({id:"fullscreen",icon:z?l(Md,{}):l(Ed,{}),label:z?m.exitFullscreen:m.fullscreen,type:"switch",on:z,onSelect:c})}let N=n.popOutUrl,O=n.aiAgentDeploymentId;T("popOut")&&N&&O&&lr("popOut",v,r)&&E.push({id:"popOut",icon:l(Nd,{}),label:m.popOut,onSelect:()=>{let z=Zh(N,{conversationId:e.conversationId,widgetId:n.widgetId,publicKey:n.publicKey,aiAgentDeploymentId:O});z&&window.open(z,"_blank","noopener,noreferrer")}}),P&&T("sound")&&E.push({id:"sound",icon:x?l(Dd,{}):l($d,{}),label:x?m.soundOff:m.soundOn,type:"switch",on:!x,onSelect:p}),T("theme")&&E.push({id:"theme",icon:Jh(S),label:`${m.theme}: ${w[S]}`,onSelect:()=>u(Qh(S)),keepOpen:!0}),T("textSize")&&E.push({id:"textSize",icon:l(Bd,{}),label:`${m.textSize}: ${A[C]}`,onSelect:()=>f(Xh[C]),keepOpen:!0}),T("language")&&n.availableLocales.length>1&&E.push({id:"language",icon:l(qd,{}),label:m.language,segments:n.availableLocales.map(z=>({value:z,label:Yh(z),lang:z})),value:n.locale,onSelectValue:d});let j=!!a&&xa(v,r,n.actions),W=P&&T("history");return l("div",{class:`${Ns}-header-actions`,children:[W?l("button",{type:"button",class:`${Ns}-icon-btn`,onClick:_,"aria-label":m.history,title:m.history,"data-testid":L.actionHistory,children:l(Ud,{})}):null,E.length>0?l(cp,{items:E,triggerLabel:m.moreActions}):null,j?l("button",{type:"button",class:`${Ns}-icon-btn`,onClick:a,"aria-label":m.close,title:m.close,"data-testid":L.actionClose,children:l(Bt,{})}):null]})}var up={Icon:to};function Fn(e,t){return e instanceof st&&e.status===429?t.errorRateLimited:t.errorGeneric}var pr=M.cssPrefix;function dp({placeholder:e,onActivate:t}){return l("button",{type:"button",class:`${pr}-home-search`,onClick:t,"data-testid":L.homeSearch,children:[l("span",{class:`${pr}-home-search-text`,children:e}),l("span",{class:`${pr}-home-search-icon`,"aria-hidden":"true",children:l(Ms,{})})]})}function pp({placeholder:e,value:t,onInput:n}){return l("div",{class:`${pr}-home-search`,"data-input":"true",children:[l("input",{type:"search",class:`${pr}-home-search-input`,placeholder:e,value:t,maxLength:200,onInput:r=>n(r.currentTarget.value),"data-testid":L.helpSearch}),l("span",{class:`${pr}-home-search-icon`,"aria-hidden":"true",children:l(Ms,{})})]})}var no=M.cssPrefix;function Na({title:e,subtitle:t,onClick:n,testid:r}){return l("button",{type:"button",class:`${no}-list-row`,onClick:n,"data-testid":r,children:[l("span",{class:`${no}-list-row-body`,children:[l("span",{class:`${no}-list-row-title`,children:e}),t?l("span",{class:`${no}-list-row-sub`,children:t}):null]}),l("span",{class:`${no}-list-row-chevron`,"aria-hidden":"true",children:l(dr,{})})]})}var Kt=M.cssPrefix,ev=se.scope("help"),tv=20,nv=300;function rv(e,t,n){let r=new Map(n.map(o=>[o.id,o.title]));return t.map(o=>({id:o,title:r.get(o),rows:e.filter(a=>a.contentCollectionId===o)})).filter(o=>o.rows.length>0)}function _p({transport:e,strings:t,bus:n},r,o){let[a,i]=q(),s=B(void 0);function c(p){if(!r?.length)return;let _={};s.current=_,i(d=>({search:o,items:[],collections:[],...d,pagination:p>1?d?.pagination:void 0,loading:!0,error:void 0})),Promise.all([e.listContent({contentCollectionIds:r,sortBy:"order",page:p,limit:tv,search:o}),p>1?void 0:e.listContentCollections(r)]).then(([d,u])=>{s.current===_&&(i(f=>({search:o,items:[...p>1?f?.items??[]:[],...d.items],collections:u?.items??f?.collections??[],pagination:d.pagination,loading:!1})),!(p>1)&&(o?n.emit("contentSearch",{queryLength:o.length,hitCount:d.pagination.total}):n.emit("contentView",{section:"help",count:d.items.length})))}).catch(d=>{s.current===_&&(ev.warn("listContent (help) failed",{err:d,page:p}),i(u=>u&&{...u,loading:!1,error:Fn(d,t)}))})}return D(()=>{if(!r?.length){i(void 0);return}return c(1),()=>{s.current=void 0}},[e,r,o]),[a,()=>!a?.loading&&c((a?.pagination?.page??0)+1)]}function ov(e){let{strings:t,config:n,nav:r,panelProps:o}=e,a=n.contentCollectionIds,[i,s]=q(""),[c,p]=q(""),_=_p(e,a),d=_p(e,c?a:void 0,c),[u,f]=i.trim()?d:_;D(()=>{let v=setTimeout(()=>p(i.trim()),nv);return()=>clearTimeout(v)},[i]);function m(){if(!a?.length)return l(Lt,{message:t.helpEmpty,strings:t});let v=u?.error?l(Lt,{tone:"error",message:u.error,onRetry:f,strings:t}):null;return v&&!u?.pagination?v:!u||!u.pagination&&!u.items.length?l(Lt,{message:t.helpLoading,strings:t}):u.items.length?l(_e,{children:[rv(u.items,a,u.collections).map(P=>l("section",{class:`${Kt}-help-group`,children:[P.title?l("h2",{class:`${Kt}-help-section-title`,children:P.title}):null,l("div",{class:`${Kt}-help-card`,children:P.rows.map(x=>l(Na,{title:x.title,subtitle:x.description,onClick:()=>r.push(x.url?{kind:"iframe",url:x.url,title:x.title}:{kind:"content",id:x.id,title:x.title}),testid:lt(L.helpArticle,x.id)},x.id))})]},P.id)),v,u.pagination?.hasNext&&!v?l("div",{children:l("div",{class:`${Kt}-help-card`,children:l("button",{type:"button",class:`${Kt}-list-row ${Kt}-help-more`,onClick:f,"aria-busy":u.loading,children:[u.loading?l("span",{class:`${Kt}-loading-spinner`,"aria-hidden":"true"}):null,t.helpShowMore]})})}):null]}):l(Lt,{message:u.search?t.helpSearchEmpty.replace("{query}",u.search):t.helpEmpty,strings:t})}return l("div",{class:`${Kt}-module`,children:[l(Ia,{title:t.helpTitle,actions:l(Gt,{panelProps:o,variant:"plain"})}),l("div",{class:`${Kt}-module-pad`,children:l(pp,{placeholder:t.helpSearchPlaceholder,value:i,onInput:s})}),l("div",{class:`${Kt}-help-list`,children:m()})]})}var fp={Icon:eo,Root:e=>l(ov,{...e})};var mp=se.scope("attachments");function La(e,t,n){let r=iv(e),o=[],a=[],i=cv(n.accept),s=t.reduce((p,_)=>p+_.size,0),c=t.length;for(let p of r){let _=av(p,c,s,n,i);if(_){a.push({file:p,reason:_});continue}o.push(lv(p)),s+=p.size,c+=1}return(o.length||a.length)&&mp.debug("ingest",{accepted:o.length,rejected:a.map(p=>({name:p.file.name,reason:p.reason}))}),{accepted:o,rejected:a}}function _r(e){try{URL.revokeObjectURL(e.previewUrl)}catch(t){mp.debug("revokeObjectURL failed",{error:t})}}function av(e,t,n,r,o){return t>=r.maxCount?"count":n+e.size>r.maxBytes?"bytes":uv(e,o)?null:"mime"}function iv(e){return e?Array.isArray(e)?e.filter(t=>t instanceof File):[...e].map(t=>t instanceof File?t:sv(t)).filter(t=>t!==null):[]}function sv(e){let t=e;return!t?.getAsFile||t.kind!=="file"?null:t.getAsFile()}function lv(e){return{file:e,id:wt(),mediaType:e.type||"application/octet-stream",name:e.name||"pasted-file",previewUrl:URL.createObjectURL(e),size:e.size}}function cv(e){return e.split(",").map(t=>t.trim().toLowerCase()).filter(Boolean).map(t=>{if(t.startsWith("."))return{kind:"ext",ext:t};let[n="*",r="*"]=t.split("/");return{kind:"mime",type:n,subtype:r}})}function uv(e,t){if(t.length===0)return!0;let[n="*",r="*"]=(e.type||"").toLowerCase().split("/"),o=(e.name||"").toLowerCase();return t.some(a=>a.kind==="ext"?o.endsWith(a.ext):a.type==="image"&&a.subtype==="*"&&/\.(heic|heif|avif|bmp|tif|tiff)$/.test(o)?!0:(a.type==="*"||a.type===n)&&(a.subtype==="*"||a.subtype===r))}var ro=M.cssPrefix;function gp({attachment:e,onRemove:t,disabled:n=!1}){let r=/^image\/(jpeg|png|gif|webp|avif|bmp|x-ms-bmp|svg\+xml)$/i.test(e.mediaType);return l("span",{class:`${ro}-attachment-chip`,title:e.name,"data-testid":lt(L.attachmentChip,e.id),children:[r?l("img",{class:`${ro}-attachment-thumb`,src:e.previewUrl,alt:""}):l("span",{class:`${ro}-attachment-thumb`,"aria-hidden":"true",children:l(zd,{})}),l("span",{class:`${ro}-attachment-name`,children:e.name}),l("button",{type:"button",class:`${ro}-attachment-remove`,onClick:t,disabled:n,"aria-label":`Remove ${e.name}`,"data-testid":lt(L.attachmentRemove,e.id),children:l(Bt,{})})]})}var Ls={isSupported:!1,start:()=>{},stop:()=>{},cancel:()=>{}};function Os(e,t,n){return e==="disabled"?Ls:e==="server"?fv(n):dv(t)}function dv(e){let t=pv();if(!t)return Ls;let n=null,r=0;return{isSupported:!0,start(o,a){let i=n,s=++r;n=null,i?.abort();let c=new t;n=c,c.continuous=!0,c.interimResults=!0,c.lang=e;let p=!1;c.addEventListener("result",d=>{if(r!==s||n!==c)return;let u=d,f="",m=!1;for(let v=u.resultIndex;v<u.results.length;v++){let P=u.results[v];P&&(f+=P[0].transcript,P.isFinal&&(m=!0))}o(f,m)});function _(){p||r!==s||n!==c||(p=!0,n=null,a())}c.addEventListener("end",_),c.addEventListener("error",_);try{c.start()}catch{_()}},stop(){n?.stop()},cancel(){r++;let o=n;n=null,o?.abort()}}}function pv(){return window.SpeechRecognition??window.webkitSpeechRecognition}var _v=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];function fv(e){if(typeof MediaRecorder>"u"||!navigator?.mediaDevices?.getUserMedia)return Ls;let t=0,n=null;function r(i){for(let s of i.stream?.getTracks()??[])s.stop();i.stream=null}function o(){t++;let i=n;n=null,i&&(r(i),i.recorder?.state!=="inactive"&&i.recorder?.stop())}async function a(i){if(i.finishing)return;i.finishing=!0;let s=i.recorder?.mimeType??"audio/webm";r(i);let c=new Blob(i.chunks,{type:s});i.chunks=[];try{let{text:p}=await e(c,s);n===i&&t===i.generation&&p&&i.onText(p,!0)}catch{}finally{n===i&&t===i.generation&&(n=null,i.onEnd())}}return{isSupported:!0,async start(i,s){o();let c={generation:t,recorder:null,stream:null,chunks:[],onText:i,onEnd:s,finishing:!1};n=c;try{let p=await navigator.mediaDevices.getUserMedia({audio:!0});if(n!==c||t!==c.generation){for(let u of p.getTracks())u.stop();return}c.stream=p;let _=mv(),d=new MediaRecorder(p,_?{mimeType:_}:void 0);c.recorder=d,d.addEventListener("dataavailable",u=>{n===c&&t===c.generation&&u.data.size>0&&c.chunks.push(u.data)}),d.addEventListener("stop",()=>{n===c&&t===c.generation&&a(c)}),d.start()}catch{r(c),n===c&&t===c.generation&&(n=null,s())}},stop(){let i=n;if(i){if(!i.recorder){o();return}i.recorder.state!=="inactive"&&i.recorder.stop()}},cancel(){o()}}}function mv(){for(let e of _v)if(MediaRecorder.isTypeSupported(e))return e}var Qe=M.cssPrefix,fr=se.scope("composer");function mr(e){return e.reduce((t,n)=>t+n.size,0)}var $s={arrowUp:kd,paperPlane:Sd,send:wd,chevron:dr};function hp(e){return"activeElement"in e}function gv(e){return"host"in e&&"activeElement"in e}function vp({options:e,transport:t,feedback:n,bus:r,persistence:o,conversationId:a,isStreaming:i,pageToolRunning:s=!1,isMemoryCompacting:c=!1,canReleaseQueuedMessages:p=!0,queueManualMessages:_=!1,active:d=!0,isPreparing:u=!1,operatorRequestEnabled:f,canRequestOperator:m=!1,controlMode:v="ai-agent",onRequestOperator:P,onSend:x,onStop:k,apiRef:T}){let h=e.strings,[g,S]=q(()=>o.loadDraft(a)),[w,C]=q([]),[A,E]=q(()=>o.loadMessageQueue(a).map(F=>({id:F.id,text:F.text,attachments:[]}))),N=B(A),O=B(!1),[j,W]=q(!1),[z,J]=q(!1),ue=B(!1),ie=B(null),tt=B(null),he=B(null),Te=B(0),Je=B(a);Je.current=a;let De=B(d);De.current=d;let mt=B(u);mt.current=u;let Ve=z||u||!d,gt=i&&v==="ai-agent",ut=gt||c&&v==="ai-agent",xt=v==="ai-agent"&&(ut||_||A.length>0),St=$(F=>{E(K=>{let Z=F(K);return o.saveMessageQueue(Je.current,Z.filter(fe=>fe.attachments.length===0).map(({id:fe,text:ot})=>({id:fe,text:ot}))),N.current=Z,Z})},[o]),Ae=$(F=>{St(K=>(K.find(Z=>Z.id===F)?.attachments.forEach(_r),K.filter(Z=>Z.id!==F)))},[St]),Be=$(F=>{S(K=>{let Z=typeof F=="function"?F(K):F;return Z===K?K:(o.saveDraft(Je.current,Z),Z)})},[o]),Pe=e.features.fileUpload,nt=e.features.voice,[ye,ht]=q(()=>Os(nt,e.locale,(F,K)=>t.transcribe(F,K))),We=B(ye);We.current=ye;let Ot=B({mode:nt,locale:e.locale,transport:t});D(()=>{let F=Ot.current;F.mode===nt&&F.locale===e.locale&&F.transport===t||(Ot.current={mode:nt,locale:e.locale,transport:t},Te.current++,We.current.cancel(),he.current=null,W(!1),ht(Os(nt,e.locale,(K,Z)=>t.transcribe(K,Z))))},[e.locale,nt,t]),Ct(()=>()=>{Te.current++,ye.cancel()},[ye]);let b=$(F=>{let K=he.current;if(K===null)return!1;let Z=Math.round(performance.now()-K);return fr[F]("voiceStop",{durationMs:Z}),r.emit("voiceStop",{durationMs:Z}),he.current=null,!0},[r]),U=$(()=>{he.current!==null&&(ye.stop(),W(!1),b("info")&&n.play("voiceStop"))},[b,n,ye]),X=$(()=>{Te.current++,ye.cancel(),W(!1),b("info")&&n.play("voiceStop")},[b,n,ye]);D(()=>{(u||!d)&&X()},[d,X,u]),D(()=>{let F=ie.current;if(!F)return;let K=F.getRootNode(),Z=hp(K)?K.activeElement:null;Z&&F.closest(`.${Qe}-panel`)?.contains(Z)||F.focus({preventScroll:!0})},[]),D(()=>{let F=ie.current;if(!F)return;if(g.length===0){F.style.height="";return}F.style.height="auto";let K=getComputedStyle(F),Z=Number.parseFloat(K.getPropertyValue(`--${Qe}-textarea-base-height`)),fe=Number.parseFloat(K.borderTopWidth)+Number.parseFloat(K.borderBottomWidth),ot=Math.min(F.scrollHeight+fe,Number.parseFloat(K.maxHeight)),Ht=Number.parseFloat(K.fontSize)*.7;F.style.height=`${ot<Z+Ht?Z:ot}px`},[g]);let Y=B(w);Y.current=w,D(()=>()=>{Y.current.forEach(_r);for(let F of N.current)F.attachments.forEach(_r)},[]),Ct(()=>{if(T)return T.current={attachFromDrop:F=>{if(!Pe||!De.current||ue.current||mt.current)return;let K=La(F,Y.current,e.attachments);K.accepted.length!==0&&(fr.info("attach (drop)",{count:K.accepted.length,totalBytes:mr(K.accepted)}),r.emit("attach",{count:K.accepted.length,totalBytes:mr(K.accepted)}),C(Z=>[...Z,...K.accepted]))},fill:F=>{if(!De.current||ue.current||mt.current)return;Be(F);let K=ie.current;K&&(K.focus({preventScroll:!0}),requestAnimationFrame(()=>K.setSelectionRange(K.value.length,K.value.length)))},acceptQueuedMessage:Ae},()=>{T.current&&(T.current=null)}},[T,Pe,u,e.attachments,Ae,Be]),D(()=>{let F=ie.current;if(!F)return;let K=F.closest(`.${Qe}-panel`);if(!K)return;let Z=fe=>{if(!De.current||ue.current||mt.current)return;let ot=fe.clipboardData;if(!ot)return;let Ht=fe.target?.closest?.("input, textarea, [contenteditable]:not([contenteditable='false'])");if(Ht&&Ht!==F)return;if(Pe){let It=La(ot.items,Y.current,e.attachments);if(It.accepted.length>0){fe.preventDefault(),fr.info("attach (paste)",{count:It.accepted.length,totalBytes:mr(It.accepted)}),r.emit("attach",{count:It.accepted.length,totalBytes:mr(It.accepted)}),C(le=>[...le,...It.accepted]);return}}if(Ht===F)return;let Xt=ot.getData("text/plain");Xt&&(fe.preventDefault(),Be(It=>It+Xt),F.focus())};return K.addEventListener("paste",Z),()=>K.removeEventListener("paste",Z)},[Pe,e.attachments,Be]);async function re(){let F=g.trim();if(!F&&w.length===0||!d||gt||ue.current||u)return;X(),ue.current=!0,J(!0);let K=g,Z=w;try{await x(F,Z)&&(Be(fe=>fe===K?"":fe),C(fe=>fe!==Z?fe:(Z.forEach(_r),Y.current=[],[])))}finally{ue.current=!1,J(!1),requestAnimationFrame(()=>{let fe=ie.current;if(!fe||fe.disabled||!De.current)return;let ot=fe.getRootNode(),Ht=hp(ot)?ot.activeElement:null,Xt=Ht?.getAttribute("data-testid");if(!(Ht&&Ht!==fe&&Xt!==L.composerSend&&Xt!==L.composerStop)){if(gv(ot)){let It=ot.host.ownerDocument;if(!It.hasFocus())return;let le=It.activeElement;if(le&&le!==ot.host&&le!==It.body)return}fe.focus({preventScroll:!0})}})}}function Re(){let F=g.trim();if(!F&&w.length===0||!d||!xt||ue.current||u)return;X();let K=w;St(Z=>[...Z,{id:wt(),text:F,attachments:K}]),Be(""),C(Z=>Z!==K?Z:(Y.current=[],[])),ie.current?.focus({preventScroll:!0})}D(()=>{ut&&(O.current=!1)},[ut]),D(()=>{let F=A[0];if(!F||!p||ut||O.current||z||u||!d)return;let K=setTimeout(()=>{O.current=!0,x(F.text,F.attachments,F.id).then(Z=>{if(Z){Ae(F.id);return}O.current=!1})},300);return()=>clearTimeout(K)},[d,p,u,x,ut,A,Ae,z]);function xe(F){F.key!=="Enter"||F.shiftKey||F.isComposing||(F.preventDefault(),xt&&(g.trim()||w.length>0)?Re():gt?k():re())}function ge(F){let K=F.target;if(!d||ue.current||u){K.value="";return}let Z=La(K.files,w,e.attachments);Z.accepted.length>0&&(fr.info("attach (file picker)",{count:Z.accepted.length,totalBytes:mr(Z.accepted)}),r.emit("attach",{count:Z.accepted.length,totalBytes:mr(Z.accepted)}),C(fe=>[...fe,...Z.accepted])),K.value=""}function pt(F){!d||ue.current||u||(fr.info("removeAttachment",{id:F}),r.emit("removeAttachment",{id:F}),C(K=>{let Z=K.find(fe=>fe.id===F);return Z&&_r(Z),K.filter(fe=>fe.id!==F)}))}function pe(){if(j){U();return}if(!d||!ye.isSupported||ue.current||u)return;let F=++Te.current;he.current=performance.now(),fr.info("voiceStart"),r.emit("voiceStart",void 0),W(!0),n.play("voiceStart"),ye.start((K,Z)=>{Te.current!==F||!De.current||mt.current||ue.current||!Z||Be(fe=>`${fe}${K} `)},()=>{Te.current!==F||!De.current||(W(!1),b("debug"))})}let rt=$s[e.composer.sendButton.icon],Fe=!!(g.trim()||w.length>0),qt=gt||s&&!Fe;return l("div",{class:`${Qe}-composer`,part:"composer","data-testid":L.composer,children:[A.length>0?l("div",{class:`${Qe}-message-queue`,"aria-label":h.queueMessage,"data-testid":L.messageQueue,children:A.map(F=>l("div",{class:`${Qe}-attachment-chip ${Qe}-queued-message`,"data-testid":`${L.queuedMessage}-${F.id}`,children:[l("span",{class:`${Qe}-attachment-name ${Qe}-queued-text`,children:F.text||F.attachments.map(K=>K.name).join(", ")}),l("button",{type:"button",class:`${Qe}-attachment-remove`,onClick:()=>Ae(F.id),"aria-label":h.removeQueuedMessage,title:h.removeQueuedMessage,"data-testid":`${L.queuedMessageRemove}-${F.id}`,children:l(Bt,{})})]},F.id))}):null,w.length>0?l("div",{class:`${Qe}-attachments`,children:w.map(F=>l(gp,{attachment:F,onRemove:()=>pt(F.id),disabled:Ve},F.id))}):null,l("div",{class:`${Qe}-composer-row`,children:[l("div",{class:`${Qe}-composer-actions`,children:[Pe?l("button",{type:"button",class:`${Qe}-icon-btn`,onClick:()=>tt.current?.click(),disabled:Ve,"aria-label":h.attach,"data-testid":L.composerAttach,children:l(Td,{})}):null,ye.isSupported?l("button",{type:"button",class:`${Qe}-icon-btn`,onClick:pe,disabled:Ve,"aria-label":j?h.micStop:h.micStart,"aria-pressed":j,"data-recording":j?"true":void 0,"data-testid":L.composerVoice,children:l(Rd,{})}):null]}),l("textarea",{ref:ie,name:"message",class:`${Qe}-textarea`,rows:1,value:g,placeholder:h.composerPlaceholder,onInput:F=>Be(F.currentTarget.value),onKeyDown:xe,disabled:Ve,"aria-label":h.composerPlaceholder,"data-testid":L.composerInput}),xt&&Fe?l("button",{type:"button",class:`${Qe}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:Re,disabled:Ve,"aria-label":h.queueMessage,title:h.queueMessage,"data-testid":L.composerSend,children:l(rt,{})}):null,qt?l("button",{type:"button",class:`${Qe}-send`,onClick:k,disabled:Ve,"aria-label":h.stop,"data-testid":L.composerStop,children:l(Cd,{})}):null,!qt&&(!xt||!Fe)?l("button",{type:"button",class:`${Qe}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:()=>{re()},disabled:Ve||!g.trim()&&w.length===0,"aria-label":h.send,"data-testid":L.composerSend,children:l(rt,{})}):null,f&&v==="ai-agent"&&P?l("button",{type:"button",class:`${Qe}-icon-btn`,onClick:P,disabled:Ve||!m,"aria-label":h.talkToOperator,title:h.talkToOperator,"data-testid":L.operatorRequest,children:l(Es,{})}):null]}),l("input",{ref:tt,name:"attachments",type:"file",multiple:!0,accept:e.attachments.accept,onChange:ge,disabled:Ve,class:`${Qe}-sr-only`,"data-testid":L.composerFileInput})]})}var bp=M.cssPrefix;function Oa({onClick:e,children:t,testid:n}){return e?l("button",{type:"button",class:`${bp}-home-card`,"data-interactive":"true",onClick:e,"data-testid":n,children:t}):l("div",{class:`${bp}-home-card`,"data-testid":n,children:t})}function $a(e){return e.trim().split(/\s+/).slice(0,2).map(t=>t.charAt(0).toUpperCase()).join("")}var Ft=M.cssPrefix,hv=se.scope("news"),vv=10;function Ds(e,t){let n=e?new Date(e):void 0;if(!(!n||Number.isNaN(n.getTime())))return new Intl.DateTimeFormat(t,{dateStyle:"medium"}).format(n)}function bv({options:e,transport:t,strings:n,config:r,nav:o,bus:a,panelProps:i,latestNews:s}){let c=r.contentCollectionIds,[p,_]=q({items:[],loading:!0}),d=B(void 0);function u(P){if(!c?.length)return;let x={};d.current=x,_(k=>({...k,loading:!0,error:void 0})),t.listContent({contentCollectionIds:c,sortBy:"publishedAt",sortOrder:"desc",page:P,limit:vv}).then(k=>{if(d.current!==x||(_(h=>({items:P>1?[...h.items,...k.items]:k.items,pagination:k.pagination,loading:!1})),P>1))return;a.emit("contentView",{section:"news",count:k.items.length});let T=k.items[0];T&&s.markSeen(T.id)}).catch(k=>{d.current===x&&(hv.warn("listContent (news) failed",{err:k,page:P}),_(T=>({...T,loading:!1,error:Fn(k,n)})))})}function f(){p.loading||u((p.pagination?.page??0)+1)}D(()=>(_({items:[],loading:!0}),u(1),()=>{d.current=void 0}),[t,c]);function m(P){let x=Ds(P.publishedAt,e.locale);return l("button",{type:"button",class:`${Ft}-news-card`,onClick:()=>o.push({kind:"content",id:P.id,title:P.title}),"data-testid":lt(L.newsItem,P.id),children:[P.image?l("img",{class:`${Ft}-news-hero`,src:P.image,alt:"",loading:"lazy"}):null,l("span",{class:`${Ft}-news-body`,children:[l("span",{class:`${Ft}-news-title`,children:P.title}),x||P.tags?.length?l("span",{class:`${Ft}-news-meta`,children:[x?l("time",{dateTime:P.publishedAt,children:x}):null,P.tags?.map(k=>l("span",{class:`${Ft}-news-tag`,children:k},k))]}):null,P.description?l("span",{class:`${Ft}-news-summary`,children:P.description}):null]})]},P.id)}function v(){if(!c?.length)return l(Lt,{message:n.newsEmpty,strings:n});let P=p.error?l(Lt,{tone:"error",message:p.error,onRetry:f,strings:n}):null;return P&&!p.pagination?P:p.pagination?p.items.length?l("div",{class:`${Ft}-news-list`,children:[p.items.map(m),P,p.pagination.hasNext&&!P?l("button",{type:"button",class:`${Ft}-news-more`,onClick:f,"aria-busy":p.loading,"data-testid":L.newsMore,children:[p.loading?l("span",{class:`${Ft}-loading-spinner`,"aria-hidden":"true"}):null,n.newsShowMore]}):null]}):l(Lt,{message:n.newsEmpty,strings:n}):l(Lt,{message:n.newsLoading,strings:n})}return l("div",{class:`${Ft}-module`,children:[l(Ia,{title:n.newsTitle,actions:l(Gt,{panelProps:i,variant:"plain"})}),l("div",{class:`${Ft}-module-scroll`,children:v()})]})}var yp={Icon:ka,Root:e=>l(bv,{...e})};var me=M.cssPrefix,Pp=se.scope("home");function yv(e){let t=e.options.userContext?.name,n=e.config.greetingText?vt(e.strings,e.config.greetingText):void 0;if(n){let r=t?n.replace("{name}",t):n.replace(/\s*\{name\}\s*/," ").trim(),o=e.strings.homeGreetingLead;return{title:r,subtitle:r.toLowerCase()===o.toLowerCase()?void 0:o}}return t?{title:e.strings.homeGreetingNamed.replace("{name}",t),subtitle:e.strings.homeGreetingLead}:{title:e.strings.homeGreeting}}function Pv(e,t){return t.url?e.push({kind:"iframe",url:t.url,title:t.title}):e.push({kind:"content",id:t.id,title:t.title})}function xv({options:e,onAsk:t}){let[n,r]=q(""),{sendButton:o}=e.composer,a=$s[o.icon];function i(s){s.preventDefault();let c=n.trim();c&&(r(""),t(c))}return l("form",{class:`${me}-home-search ${me}-home-ask`,"data-input":"true",onSubmit:i,"data-testid":L.homeAsk,children:[l("input",{type:"text",class:`${me}-home-search-input`,placeholder:e.strings.homeAskPlaceholder,"aria-label":e.strings.homeAskPlaceholder,value:n,enterKeyHint:"send",onInput:s=>r(s.currentTarget.value)}),l("button",{type:"submit",class:`${me}-send`,"data-shape":o.shape,"data-variant":o.variant,disabled:!n.trim(),"aria-label":e.strings.send,children:l(a,{})})]})}function xp(e,t){return on(e,t,t.type!=="upsert"||t.activity===!0)}function Sv(e){let{transport:t,strings:n,config:r,nav:o,bus:a,panelProps:i,latestNews:s}=e,[c,p]=q(null),[_,d]=q([]),u=r.contentCollectionIds?.join(","),f=e.options.modules.list.some(g=>g.layout==="chat");D(()=>{if(r.showRecentConversations===!1)return;let g=!1,S=!0,w=[],C=t.subscribeConversationChanges(A=>{S&&w.push(A),p(E=>xp(E?[E]:[],A)[0]??null)});return t.listConversations({limit:f?50:1}).then(A=>{if(g)return;let E=w.reduce(xp,A.conversations);w=[],S=!1,p(E[0]??null)}).catch(A=>{g||(w=[],S=!1,Pp.warn("listConversations (home) failed",{err:A}))}),()=>{g=!0,C()}},[t,r.showRecentConversations,f]),D(()=>{if(!r.contentCollectionIds?.length)return;let g=!1;return t.listContent({contentCollectionIds:r.contentCollectionIds,pinned:!0,limit:6}).then(S=>{g||(d(S.items),a.emit("contentView",{section:"home",count:S.items.length}))}).catch(S=>!g&&Pp.warn("listContent (home) failed",{err:S})),()=>{g=!0}},[t,u,a]);let m=yv(e),v=r.userAvatars??[],P=r.status,x=P?.text?vt(n,P.text):n.homeStatus,k=r.contentBlockTitle?vt(n,r.contentBlockTitle):n.homeContentTitle,T=s.item,h=Ds(T?.publishedAt,e.options.locale);return l("div",{class:`${me}-module ${me}-home`,"data-testid":L.homeView,children:l("div",{class:`${me}-home-scroll`,children:[l("div",{class:`${me}-home-hero`,children:[l("div",{class:`${me}-home-hero-top`,children:[r.brandName?l("span",{class:`${me}-home-brand`,"data-testid":L.homeBrand,children:r.brandName}):l("span",{class:`${me}-home-brand-spacer`,"aria-hidden":"true"}),l("div",{class:`${me}-home-hero-actions`,children:[v.length>0?l("div",{class:`${me}-home-avatars`,children:v.map(g=>l("span",{class:`${me}-home-avatar`,title:g.role?`${g.name} \xB7 ${g.role}`:g.name,children:g.avatar?l("img",{src:g.avatar,alt:"",loading:"lazy"}):l("span",{children:$a(g.name)})},g.name))}):null,l(Gt,{panelProps:i,variant:"plain"})]})]}),r.showGreeting!==!1?l(_e,{children:[l("h1",{class:`${me}-home-greeting`,"data-testid":L.homeGreeting,children:m.title}),m.subtitle?l("p",{class:`${me}-home-lead`,children:m.subtitle}):null]}):null]}),l("div",{class:`${me}-home-cards`,children:[f?l(xv,{options:e.options,onAsk:g=>o.startNewConversation(g)}):null,r.showSearchBar!==!1?l(dp,{placeholder:n.homeSearchPlaceholder,onActivate:()=>o.switchToLayout("help")}):null,T?l(Oa,{onClick:()=>{s.markSeen(T.id),o.push({kind:"content",id:T.id,title:T.title})},testid:L.homeWhatsNew,children:l("div",{class:`${me}-home-recent-row`,"data-unread":s.unseen?"true":void 0,children:[l("span",{class:`${me}-home-recent-avatar`,"aria-hidden":"true",children:l(ka,{})}),l("span",{class:`${me}-home-recent-body`,children:[l("span",{class:`${me}-home-recent-title`,children:n.homeWhatsNew}),l("span",{class:`${me}-home-recent-preview`,children:h?`${T.title} \xB7 ${h}`:T.title})]}),s.unseen?l("span",{class:`${me}-home-recent-dot`,role:"img","aria-label":n.newsUnseen}):null]})}):null,c?l(Oa,{onClick:()=>o.selectConversation(c),testid:L.homeRecent,children:l("div",{class:`${me}-home-recent-row`,"data-unread":c.hasUnread?"true":void 0,children:[l("span",{class:`${me}-home-recent-avatar`,"aria-hidden":"true",children:l(to,{})}),l("span",{class:`${me}-home-recent-body`,children:[l("span",{class:`${me}-home-recent-title`,children:c.title}),c.preview?l("span",{class:`${me}-home-recent-preview`,children:Ma(c.preview)}):null]}),c.hasUnread?l("span",{class:`${me}-home-recent-dot`,"aria-label":"Unread"}):null]})}):null,P?l(Oa,{onClick:P.url?()=>o.push({kind:"iframe",url:P.url,title:x}):void 0,children:l("div",{class:`${me}-home-status`,"data-level":P.level??"operational",children:[l("span",{class:`${me}-home-status-icon`,"aria-hidden":"true",children:l(jd,{})}),l("span",{class:`${me}-home-status-text`,children:x})]})}):null,_.length>0?l("section",{class:`${me}-home-content`,children:[l("div",{class:`${me}-home-content-title`,children:k}),l("div",{class:`${me}-home-content-list`,children:_.map(g=>l(Na,{title:g.title,subtitle:g.description,onClick:()=>Pv(o,g),testid:lt(L.homeContentRow,g.id)},g.id))})]}):null]})]})})}var Sp={Icon:Vd,Root:e=>l(Sv,{...e})};var Da={chat:up,home:Sp,help:fp,news:yp};var oo=M.cssPrefix;function kp({modules:e,activeTab:t,strings:n,hasUnread:r,onSelect:o}){return l("nav",{class:`${oo}-tabbar`,role:"tablist","aria-label":n.panelTitle,children:e.map(a=>{let i=Da[a.layout].Icon,s=a.id===t,c=a.layout==="chat"&&r;return l("button",{type:"button",role:"tab","aria-selected":s,class:`${oo}-tab`,onClick:()=>o(a.id),"data-testid":lt(L.tab,a.id),children:[l("span",{class:`${oo}-tab-icon`,"aria-hidden":"true",children:[l(i,{}),c?l("span",{class:`${oo}-tab-badge`,"data-testid":L.tabBadge,"aria-label":"Unread"}):null]}),l("span",{class:`${oo}-tab-label`,children:vt(n,a.label)})]},a.id)})})}var wp=M.cssPrefix,kv="allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads";function Cp({url:e,title:t,strings:n,onBack:r,actions:o}){return l("div",{class:`${wp}-module`,children:[l(Aa,{title:t||n.moduleBack,backLabel:n.moduleBack,onBack:r,actions:o}),l("iframe",{class:`${wp}-content-frame`,src:e,title:t||"content",sandbox:kv,referrerpolicy:"no-referrer",loading:"lazy",allow:"fullscreen"})]})}var Bs=M.cssPrefix;function Tp({agent:e,strings:t}){let n=e.status??"online",r=vt(t,e.name),o=e.title?vt(t,e.title):null;return l("div",{class:`${Bs}-agent`,children:[l("div",{class:`${Bs}-agent-avatar`,"data-status":n,children:e.avatar?l("img",{src:e.avatar,alt:""}):l("span",{children:$a(r)})}),l("div",{class:`${Bs}-agent-meta`,children:[l("strong",{children:r}),o?l("span",{children:o}):null]})]})}var wv=["today","yesterday","lastWeek","older"];function Cv(e,t){let n=Date.parse(t);if(!Number.isFinite(n))return"older";let r=Math.floor((Rp(e)-Rp(n))/(1440*60*1e3));return r<=0?"today":r===1?"yesterday":r<7?"lastWeek":"older"}function Ip(e,t){let n=new Map;for(let r of t){let o=Cv(e,r.lastMessageAt),a=n.get(o);a?a.push(r):n.set(o,[r])}return wv.filter(r=>n.has(r)).map(r=>({bucket:r,conversations:n.get(r)}))}function Rp(e){let t=new Date(e);return t.setUTCHours(0,0,0,0),t.getTime()}var Ap=se.scope("history"),Tv=3,Rv=6,Iv={today:"dateToday",yesterday:"dateYesterday",lastWeek:"dateLastWeek",older:"dateOlder"};function Ep(e,t){let n=t.type!=="upsert"||t.activity===!0;if(t.type==="snapshot"&&t.result.pagination.page===1&&e.pagination.page>1){let o=on(e.conversations.slice(0,t.result.pagination.limit),t,n);if(t.result.conversations.length===0){if(o.length===0)return t.result;let p=Math.max(t.result.pagination.total,o.length);return{...t.result,conversations:o,pagination:{...t.result.pagination,total:p,totalPages:Math.ceil(p/t.result.pagination.limit)}}}let a=new Set(o.map(p=>p.conversationId)),i=e.conversations.slice(t.result.pagination.limit).filter(p=>!a.has(p.conversationId)),s=e.pagination.page,c={...t.result.pagination,page:s,hasPrev:s>1,hasNext:s<t.result.pagination.totalPages};return{conversations:[...o,...i],pagination:c}}let r=on(e.conversations,t,n);return r===e.conversations?e:{...t.type==="snapshot"?t.result:e,conversations:r}}function Av(e,t,n){let r=Date.parse(e);return Number.isFinite(r)?new Date(r).toDateString()===new Date(t).toDateString()?new Intl.DateTimeFormat(n,{hour:"numeric",minute:"2-digit"}).format(r):t-r<10080*60*1e3?new Intl.DateTimeFormat(n,{weekday:"short"}).format(r):new Intl.DateTimeFormat(n,{month:"short",day:"numeric"}).format(r):""}function Ba({transport:e,strings:t,locale:n,persistence:r,onSelect:o,onNewConversation:a}){let i=M.cssPrefix,s=e.peekConversations({limit:50}),[c,p]=q(s?"loaded":"loading"),[_,d]=q(s),[u,f]=q(!1),m=B(void 0),v=_?.conversations??[],P=_?.pagination;D(()=>{let g=!1,S=!0,w=[],C=e.subscribeConversationChanges(E=>{S&&w.push(E),d(N=>N&&Ep(N,E))});m.current=void 0,f(!1);let A=e.peekConversations({limit:50});return d(A),p(A?"loaded":"loading"),e.listConversations({limit:50}).then(E=>{if(g)return;let N=E;for(let O of w)N=Ep(N,O);w=[],S=!1,d(N),p("loaded"),r.saveHistoryCount(N.conversations.length)}).catch(E=>{g||(w=[],S=!1,Ap.warn("listConversations failed",{err:E}),p("error"))}),()=>{g=!0,C(),m.current=void 0}},[e,r,n]);async function x(){if(m.current||!P?.hasNext)return;let g={};m.current=g,f(!0);try{let S=await e.listConversations({page:P.page+1,limit:P.limit});if(m.current!==g)return;d(w=>{if(!w)return w;let C=new Set(w.conversations.map(N=>N.conversationId)),A=S.conversations.filter(N=>C.has(N.conversationId)?!1:(C.add(N.conversationId),!0)),E={conversations:[...w.conversations,...A],pagination:S.pagination};return r.saveHistoryCount(E.conversations.length),E})}catch(S){if(m.current!==g)return;Ap.warn("listConversations page failed",{err:S,page:P.page+1})}finally{m.current===g&&(m.current=void 0,f(!1))}}let k=a?l("div",{class:`${i}-history-footer`,children:l("button",{type:"button",class:`${i}-history-new`,onClick:a,"data-testid":L.sidebarNewConversation,children:[l(xd,{}),t.newConversation]})}):null;if(c==="loading"){let g=Math.min(r.loadHistoryCount()??Tv,Rv);return l(_e,{children:[l("div",{class:`${i}-history`,"aria-busy":"true","aria-label":t.historyLoading,children:l("div",{class:`${i}-history-group`,"aria-hidden":"true",children:[l("div",{class:`${i}-history-heading`,children:l("span",{class:`${i}-skeleton ${i}-skeleton-heading`})}),l("div",{class:`${i}-history-card`,children:Array.from({length:Math.max(1,g)},(S,w)=>l("div",{class:`${i}-history-item ${i}-history-item-skeleton`,children:[l("span",{class:`${i}-history-avatar ${i}-skeleton`}),l("span",{class:`${i}-history-body`,children:[l("span",{class:`${i}-history-row`,children:[l("span",{class:`${i}-history-title`,children:l("span",{class:`${i}-skeleton ${i}-skeleton-title`})}),l("span",{class:`${i}-history-time`,children:l("span",{class:`${i}-skeleton ${i}-skeleton-time`})})]}),l("span",{class:`${i}-history-row`,children:l("span",{class:`${i}-history-preview`,children:l("span",{class:`${i}-skeleton ${i}-skeleton-preview`})})})]})]},w))})]})}),k]})}if(c==="error"||v.length===0)return l(_e,{children:[l("div",{class:`${i}-history-empty`,children:t.historyEmpty}),k]});let T=Date.now(),h=Ip(T,v);return l(_e,{children:[l("div",{class:`${i}-history`,role:"list",children:[h.map(g=>l("div",{class:`${i}-history-group`,children:[l("div",{class:`${i}-history-heading`,children:t[Iv[g.bucket]]}),l("div",{class:`${i}-history-card`,children:g.conversations.map(S=>l("div",{role:"listitem",children:l("button",{type:"button",class:`${i}-history-item`,onClick:()=>o(S),"data-closed":S.canContinue?void 0:"true","data-unread":S.hasUnread?"true":void 0,"data-testid":lt(L.historyItem,S.conversationId),children:[l("span",{class:`${i}-history-avatar`,"aria-hidden":"true",children:l(As,{})}),l("span",{class:`${i}-history-body`,children:[l("span",{class:`${i}-history-row`,children:[l("span",{class:`${i}-history-title`,children:S.title}),l("span",{class:`${i}-history-time`,children:Av(S.lastMessageAt,T,n)})]}),l("span",{class:`${i}-history-row`,children:[l("span",{class:`${i}-history-preview`,children:S.preview&&Ma(S.preview)||(S.canContinue?t.historyContinue:t.conversationClosed)}),S.hasUnread?l("span",{class:`${i}-history-dot`}):null]})]})]})},S.conversationId))})]},g.bucket)),P?.hasNext?l("div",{class:`${i}-history-more`,children:l("button",{type:"button",onClick:x,disabled:u,"aria-busy":u,"data-testid":L.historyLoadMore,children:t.loadMoreConversations})}):null]}),k]})}var Ev=M.cssPrefix;function Mp({visible:e,strings:t}){return e?l("div",{class:`${Ev}-dropzone`,role:"status","aria-live":"polite",children:t.dropZone}):null}var Mv=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Nv=/^https?:\/\/[^\s.]+\.[^\s]+$/i,Lv=/^[+]?[\d\s().-]{6,}$/;function gr(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>String(t[r]??`{${r}}`))}function Ov(e){return Array.isArray(e)?e.length:e?.trim()?1:0}function $v(e,t,n){let r=e.required??!0,o=e.validation;if(e.type==="multiselect"){let i=Ov(t);return r&&i===0?n.formRequired:i===0?void 0:o?.minSelections!=null&&i<o.minSelections?gr(n.formChooseAtLeast,{min:o.minSelections}):o?.maxSelections!=null&&i>o.maxSelections?gr(n.formChooseAtMost,{max:o.maxSelections}):void 0}let a=typeof t=="string"?t.trim():"";if(!a)return r?n.formRequired:void 0;switch(e.type){case"email":if(!Mv.test(a))return n.formInvalidEmail;break;case"url":if(!Nv.test(a))return n.formInvalidUrl;break;case"tel":if(!Lv.test(a))return n.formInvalidTel;break;case"number":{let i=Number(a);if(!Number.isFinite(i))return n.formInvalidNumber;if(o?.min!=null&&i<o.min)return gr(n.formNumberTooSmall,{min:o.min});if(o?.max!=null&&i>o.max)return gr(n.formNumberTooLarge,{max:o.max});break}default:break}if(o?.minLength!=null&&a.length<o.minLength)return gr(n.formTooShort,{min:o.minLength});if(o?.maxLength!=null&&a.length>o.maxLength)return gr(n.formTooLong,{max:o.maxLength});if(o?.pattern)try{if(!new RegExp(o.pattern).test(a))return n.formPatternMismatch}catch{}}function Np(e,t,n){let r={};for(let o of e){let a=$v(o,t[o.name],n);a&&(r[o.name]=a)}return r}function Lp(e){let t={};for(let[n,r]of Object.entries(e)){let o=Array.isArray(r)?r.join(", "):r;o.trim()&&(t[n]=o.trim())}return t}var Ne=M.cssPrefix,Fa="__other__";function ao({fields:e,strings:t,submitLabel:n,onSubmit:r,skipLabel:o,onSkip:a,footerHint:i,submitOnEnter:s,disabled:c,initialValues:p,hideActions:_,fieldTypeLabels:d,rootTestId:u,submitTestId:f,skipTestId:m}){let[v,P]=q(()=>({...Uv(e),...p})),[x,k]=q({}),[T,h]=q({});function g(E){T[E]&&h(N=>({...N,[E]:""}))}function S(E,N){P(O=>({...O,[E]:N})),g(E)}function w(E,N){k(O=>({...O,[E]:N})),g(E)}function C(E){if(E.preventDefault(),c)return;let N=qv(e,v,x),O=Np(e,N,t);if(Object.keys(O).length>0){h(O);return}r(Lp(N))}function A(E){!s||E.key!=="Enter"||E.shiftKey||E.isComposing||!E.target||!("tagName"in E.target)||E.target.tagName!=="TEXTAREA"||C(E)}return l("form",{class:`${Ne}-form`,onSubmit:C,onKeyDown:A,"data-testid":u,noValidate:!0,children:[e.map(E=>l(Dv,{field:E,value:v[E.name],otherText:x[E.name]??"",error:T[E.name],disabled:c,typeLabel:d?.[E.name],strings:t,onChange:N=>S(E.name,N),onOtherChange:N=>w(E.name,N)},E.name)),_?null:l("div",{class:`${Ne}-form-actions`,children:[i?l("span",{class:`${Ne}-form-hint`,children:i}):null,o&&a?l("button",{type:"button",class:`${Ne}-form-skip`,onClick:a,disabled:c,"data-testid":m,children:o}):null,l("button",{type:"submit",class:`${Ne}-form-submit`,disabled:c,"data-testid":f,children:n})]})]})}function Dv({field:e,value:t,otherText:n,error:r,disabled:o,typeLabel:a,strings:i,onChange:s,onOtherChange:c}){let p=lt(L.formField,e.name),_=Bv({field:e,value:t,otherText:n,disabled:o,strings:i,onChange:s,onOtherChange:c,fieldTid:p});return l("label",{class:`${Ne}-field`,"data-field":e.name,"data-invalid":r?"true":void 0,children:[l("span",{class:`${Ne}-field-head`,children:[l("span",{class:`${Ne}-field-label`,children:[e.label,e.required??!0?l("span",{class:`${Ne}-field-req`,"aria-hidden":"true",children:" *"}):null]}),a?l("span",{class:`${Ne}-field-type`,children:a}):null]}),_,e.validationHint&&!r?l("span",{class:`${Ne}-field-hint`,children:e.validationHint}):null,r?l("span",{class:`${Ne}-field-error`,role:"alert",children:r}):null]})}function Bv(e){let{field:t,value:n,otherText:r,disabled:o,strings:a,onChange:i,onOtherChange:s,fieldTid:c}=e,p=typeof n=="string"?n:"";switch(t.type){case"textarea":return l("textarea",{class:`${Ne}-field-input`,rows:3,value:p,placeholder:t.placeholder,disabled:o,onInput:d=>i(d.currentTarget.value),"data-testid":c});case"select":return l("select",{class:`${Ne}-field-input`,value:p,disabled:o,onChange:d=>i(d.currentTarget.value),"data-testid":c,children:[l("option",{value:"",children:t.placeholder??"\u2014"}),(t.options??[]).map(d=>l("option",{value:d.value,children:d.label??d.value},d.value))]});case"radio":{let d=t.allowOther&&p===Fa;return l("div",{class:`${Ne}-field-choices`,role:"radiogroup","data-testid":c,children:[(t.options??[]).map(u=>l("label",{class:`${Ne}-choice`,children:[l("input",{type:"radio",name:`${Ne}-${t.name}`,checked:p===u.value,disabled:o,onChange:()=>i(u.value)}),l("span",{children:u.label??u.value})]},u.value)),t.allowOther?l("label",{class:`${Ne}-choice`,children:[l("input",{type:"radio",name:`${Ne}-${t.name}`,checked:p===Fa,disabled:o,onChange:()=>i(Fa)}),l("span",{children:a.formOther})]}):null,d?l("input",{class:`${Ne}-field-input`,value:r,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:o,onInput:u=>s(u.currentTarget.value)}):null]})}case"checkbox":return l("label",{class:`${Ne}-choice`,children:[l("input",{type:"checkbox",checked:p==="true",disabled:o,onChange:d=>i(d.currentTarget.checked?"true":""),"data-testid":c}),l("span",{children:t.placeholder??t.label})]});case"multiselect":{let u=function(f,m){return i(m?[...d,f]:d.filter(v=>v!==f))};var _=u;let d=Array.isArray(n)?n:[];return l("div",{class:`${Ne}-field-choices`,"data-testid":c,children:[(t.options??[]).map(f=>l("label",{class:`${Ne}-choice`,children:[l("input",{type:"checkbox",checked:d.includes(f.value),disabled:o,onChange:m=>u(f.value,m.currentTarget.checked)}),l("span",{children:f.label??f.value})]},f.value)),t.allowOther||(t.options??[]).length===0?l("textarea",{class:`${Ne}-field-input`,rows:2,value:r,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:o,onInput:f=>s(f.currentTarget.value)}):null]})}default:return l("input",{...Fv(t.type),class:`${Ne}-field-input`,value:p,placeholder:t.placeholder,disabled:o,onInput:d=>i(d.currentTarget.value),"data-testid":c})}}function Fv(e){switch(e){case"number":return{type:e};case"email":return{type:e};case"tel":return{type:e};case"url":return{type:e};case"date":case"time":return{type:e};default:return{type:"text"}}}function Uv(e){let t={};for(let n of e)n.defaultValue!=null&&(t[n.name]=n.type==="multiselect"?n.defaultValue.split(",").map(r=>r.trim()).filter(Boolean):n.defaultValue);return t}function qv(e,t,n){let r={...t};for(let o of e){let a=n[o.name]?.trim();if(o.type==="radio"&&o.allowOther&&t[o.name]===Fa)r[o.name]=a??"";else if(o.type==="multiselect"&&a){let i=a.split(/[,\n;]+/).map(c=>c.trim()).filter(Boolean),s=t[o.name];r[o.name]=[...Array.isArray(s)?s:[],...i]}}return r}var Qt=M.cssPrefix;function Fs({form:e,strings:t,onSubmit:n,onSkip:r}){return l("div",{class:`${Qt}-form-gate`,"data-testid":L.formGate,children:[e.title?l("h3",{class:`${Qt}-form-gate-title`,children:e.title}):null,e.description?l("p",{class:`${Qt}-form-gate-desc`,children:e.description}):null,l(ao,{fields:e.fields,strings:t,submitLabel:e.submitLabel??t.formSubmit,onSubmit:n,skipLabel:e.skippable?t.formSkip:void 0,onSkip:e.skippable?r:void 0,submitTestId:L.formSubmit,skipTestId:L.formSkip})]})}function Op({marker:e,strings:t,onFill:n}){let r=e.outcome==="skipped",o=r?t.formSkipped:t.formSubmitted,a=e.title?l(_e,{children:[l("span",{children:e.title}),l("span",{class:`${Qt}-sr-only`,children:o})]}):l("span",{children:o}),i=e.form?.reviewable??!1,s=!r&&i&&e.values&&Object.keys(e.values).length>0?e.values:null;if(s){let p=function(_){return e.form?.fields.find(d=>d.name===_)?.label??_};var c=p;return l("details",{class:`${Qt}-form-done`,"data-outcome":e.outcome,"data-testid":L.formDone,children:[l("summary",{class:`${Qt}-form-done-summary`,"data-testid":L.formDoneToggle,children:[l(Dn,{}),a,l(dr,{})]}),l("dl",{class:`${Qt}-form-answers`,"data-testid":L.formAnswers,children:Object.entries(s).map(([_,d])=>l("div",{class:`${Qt}-form-answer`,children:[l("dt",{children:p(_)}),l("dd",{children:d})]},_))})]})}return l("div",{class:`${Qt}-form-done`,"data-outcome":e.outcome,"data-testid":L.formDone,role:"status",children:[r?l(Fd,{}):l(Dn,{}),a,r&&e.form?.reopenable&&n?l("button",{type:"button",class:`${Qt}-form-done-fill`,"data-testid":L.formFill,onClick:n,children:t.formFillOut}):null]})}var $p=Object.assign;function jv(e,t){for(var n in e)if(n!="__source"&&e[n]!==t[n])return!0;for(var r in t)if(r!="__source"&&!(r in e))return!0;return!1}var Vv=/^(-|f[lo].*[^se]$|g.{5,}[^ps]$|z|o[pr]|(W.{5})?[lL]i.*(t|mp)$|an|(bo|s).{4}Im|sca|m.{6}[ds]|ta|c.*[st]$|wido|ini)/;function Fp(e,t){function n(o){var a=this.props.ref;return a!=o.ref&&a&&(typeof a=="function"?a(null):a.current=null),t?!t(this.props,o)||a!=o.ref:jv(this.props,o)}function r(o){return this.shouldComponentUpdate=n,Kn(e,o)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.type=e,r}var Wv=Symbol.for("react.element"),Gv=/^(?: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]/,Kv=/[A-Z0-9]/g,Qv=typeof document<"u";var Xv=function(e){return/fil|che|rad/.test(e)};$t.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty($t.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Dp=de.event;de.event=function(e){return Dp&&(e=Dp(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Jv={configurable:!0,get:function(){return this.class}},Bp=de.vnode;de.vnode=function(e){if(typeof e.type=="string")(function(r){var o=r.props,a=r.type,i={},s=a.indexOf("-")==-1;for(var c in o){var p=o[c];if(!(c=="value"&&"defaultValue"in o&&p==null||Qv&&c=="children"&&a=="noscript"||c=="class"||c=="className")){if(c=="style"&&p&&p.constructor==Object){var _=void 0;for(var d in p)typeof p[d]!="number"||Vv.test(d)||(_||(_=p=$p({},p)),p[d]+="px")}else if(c=="defaultValue"&&"value"in o&&o.value==null)c="value";else if(c=="download"&&p===!0)p="";else if(c=="translate"&&p==="no")p=!1;else if(c[0]=="o"&&c[1]=="n"){var u=c.toLowerCase();u=="ondoubleclick"?c="ondblclick":u!="onchange"||a!="input"&&a!="textarea"||Xv(o.type)?u=="onfocus"?c="onfocusin":u=="onblur"&&(c="onfocusout"):u=c="oninput",u=="oninput"&&i[c=u]&&(c="oninputCapture")}else s&&Gv.test(c)?c=c.replace(Kv,"-$&").toLowerCase():p===null&&(p=void 0);i[c]=p}}a=="select"&&(i.multiple&&Array.isArray(i.value)&&(i.value=Io(o.children).forEach(function(f){f.props.selected=i.value.indexOf(f.props.value)!=-1})),i.defaultValue!=null&&(i.value=Io(o.children).forEach(function(f){f.props.selected=i.multiple?i.defaultValue.indexOf(f.props.value)!=-1:i.defaultValue==f.props.value}))),o.class&&!o.className?(i.class=o.class,Object.defineProperty(i,"className",Jv)):o.className&&(i.class=i.className=o.className),r.props=i})(e);else if(typeof e.type=="function"&&("ref"in e.props&&"prototype"in e.type&&e.type.prototype.render&&(e.ref=e.props.ref,delete e.props.ref),e.type.defaultProps)){var t=$p({},e.props);for(var n in e.type.defaultProps)t[n]===void 0&&(t[n]=e.type.defaultProps[n]);e.props=t}e.ref&&!("ref"in e.props)&&Object.defineProperty(e.props,"ref",{value:e.ref,configurable:!0,writable:!0}),e.$$typeof=Wv,Bp&&Bp(e)};function Ua(e){return e?(e.startsWith("tool:")?e.slice(5):e)==="ask-user-questions":!1}var qa=M.cssPrefix;function Up({messageId:e,initial:t,strings:n,onFeedback:r}){let[o,a]=q(t);D(()=>a(t),[e,t]);function i(s){let c=o===s?null:s;a(c),r(e,c)}return l("div",{class:`${qa}-feedback`,role:"group","data-testid":L.messageFeedback,children:[l("button",{type:"button",class:`${qa}-msg-action`,"data-active":o==="up"?"true":void 0,"aria-pressed":o==="up","aria-label":n.feedbackUp,title:n.feedbackUp,onClick:()=>i("up"),"data-testid":L.feedbackUp,children:l(Xd,{})}),l("button",{type:"button",class:`${qa}-msg-action`,"data-active":o==="down"?"true":void 0,"aria-pressed":o==="down","aria-label":n.feedbackDown,title:n.feedbackDown,onClick:()=>i("down"),"data-testid":L.feedbackDown,children:l(Jd,{})}),l("span",{class:`${qa}-sr-only`,role:"status","aria-live":"polite",children:o?n.feedbackThanks:""})]})}var Yv=new Set(["hidden","submit","button","reset","image","file","password"]);function Hp(e){return e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement}function Zv(e){return!Hp(e)||e.name===""||e.disabled?!1:!(e instanceof HTMLInputElement&&Yv.has(e.type))}function eb(e){let t=e.labels?.[0]?.textContent?.trim();return e.getAttribute("toolparamdescription")??(t||e.getAttribute("aria-description"))??void 0}function tb(e,t){let n=eb(e),r=n?{description:n}:{};return e instanceof HTMLSelectElement?{...r,type:"string",enum:[...e.options].map(o=>o.value)}:e instanceof HTMLTextAreaElement?{...r,type:"string"}:e.type==="checkbox"?{...r,type:"boolean"}:e.type==="radio"?{...r,type:"string",enum:t}:e.type==="number"||e.type==="range"?{...r,type:"number"}:{...r,type:"string"}}function nb(e,t){Object.getOwnPropertyDescriptor(Reflect.getPrototypeOf(e)??e,"value")?.set?.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function qp(e){return e==null?"":typeof e=="string"?e:JSON.stringify(e)}function rb(e,t){if(e instanceof HTMLInputElement&&e.type==="checkbox"){e.checked!==(t===!0||t==="true")&&e.click();return}if(e instanceof HTMLInputElement&&e.type==="radio"){e.value===qp(t)&&!e.checked&&e.click();return}nb(e,qp(t))}function ob(e,t,n){var i;let r=[...e.elements].filter(Zv),o={},a=new Set;for(let s of r){let c=r.flatMap(p=>p instanceof HTMLInputElement&&p.type==="radio"&&p.name===s.name?[p.value]:[]);o[i=s.name]??(o[i]=tb(s,c)),s.required&&a.add(s.name)}return{name:t,description:n,inputSchema:{type:"object",properties:o,...a.size>0?{required:[...a]}:{}},execute(s){let c=typeof s=="object"&&s!==null?Object.entries(s):[];for(let[_,d]of c)for(let u of r)u.name===_&&rb(u,d);if(!e.hasAttribute("toolautosubmit"))return"Filled in the form. The visitor still needs to check it and press its submit button.";let p=[...new Set([...e.elements].flatMap(_=>Hp(_)&&_.name&&!_.checkValidity()?[_.name]:[]))];return p.length>0?`Filled in the form, but it can't be submitted yet: ${p.join(", ")} still needs the visitor. Ask them to complete it and press the submit button.`:(setTimeout(()=>e.requestSubmit(),0),"Filled in the form and submitted it.")}}}function zp(){return[...document.querySelectorAll("form[toolname][tooldescription]")].flatMap(e=>{let t=e.getAttribute("toolname")?.trim()??"",n=e.getAttribute("tooldescription")?.trim()??"";return t&&n?[ob(e,t,n)]:[]})}var jp=`${M.cssPrefix}.page-tools`,ab=20,ib=50;function Ha(e){return typeof e=="object"&&e!==null}function sb(e){return Ha(e)&&(e.state==="running"||e.state==="stopped"||e.state==="finished"&&Ha(e.outcome))}function lb(e){let t=e?JSON.parse(e):void 0;if(!Ha(t))return{sent:[],calls:{}};let n=Array.isArray(t.sent)?t.sent.filter(o=>typeof o=="string"):[],r=Object.fromEntries(Object.entries(Ha(t.calls)?t.calls:{}).filter(o=>sb(o[1])));return{sent:n,calls:r}}var qs={sent:[],calls:{}};function io(){try{qs=lb(sessionStorage.getItem(jp))}catch{}return qs}function Us(e){qs=e;try{sessionStorage.setItem(jp,JSON.stringify(e))}catch{}}var Rt={markSent(e){let t=io();Us({...t,sent:[...t.sent.filter(n=>n!==e),e].slice(-ab)})},sentHere(e){return io().sent.includes(e)},get(e){return io().calls[e]},set(e,t){let n=io(),r=Object.entries(n.calls).filter(([o])=>o!==e);Us({...n,calls:Object.fromEntries([...r,[e,t]].slice(-ib))})},clear(e){let t=io();e.some(n=>n in t.calls)&&Us({...t,calls:Object.fromEntries(Object.entries(t.calls).filter(([n])=>!e.includes(n)))})}};var Qp=se.scope("page-tools"),Vp="site__",Wp=3e4,cb=1e3,Gp=Symbol.for(`${M.cssPrefix}.page-tools`),zs={state:"output-error",errorText:"The page reloaded before this finished, so it may or may not have taken effect. Check with the visitor before trying it again."},Xp="The visitor stopped this before it finished.";function bn(e){return typeof e=="object"&&e!==null}function ub(e){return bn(e)&&Array.isArray(e.registered)&&e.runs instanceof Map}function so(){let e=Reflect.get(globalThis,Gp);if(ub(e))return e;let t={registered:[],runs:new Map};return Reflect.set(globalThis,Gp,t),t}function Jp(e,t){let n=bn(t)&&t.signal instanceof AbortSignal?t.signal:void 0;if(n?.aborted)return;let r=so().registered;r.push(e);function o(){let a=r.indexOf(e);a>=0&&r.splice(a,1)}n?.addEventListener("abort",o,{once:!0})}function Kp(e){return e.replace(/[^A-Za-z0-9_-]/g,"_").slice(0,58)}function Yp(e){if(!bn(e)||typeof e.name!="string"||!Kp(e.name))return;let t=[e.description,e.title].find(n=>typeof n=="string"&&n.trim()!=="")??e.name;return{name:Kp(e.name),description:t.trim().slice(0,1024),inputSchema:{properties:{},...bn(e.inputSchema)?e.inputSchema:{},type:"object"},consequential:bn(e.annotations)&&e.annotations.consequentialHint===!0}}function Hs(e){return e.flatMap(t=>{let n=Yp(t),r=bn(t)?t.execute:void 0;return!n||typeof r!="function"?(Qp.warn("skipped a tool without a name or an execute function",t),[]):[{...n,run:(o,a)=>Reflect.apply(r,t,[o,{signal:a}])}]})}async function db(){let e=Reflect.get(document,"modelContext")??Reflect.get(navigator,"modelContext");if(!bn(e)||typeof e.getTools!="function"||typeof e.executeTool!="function")return[];let t=e.getTools,n=e.executeTool,r=await Promise.race([Promise.resolve().then(()=>Reflect.apply(t,e,[])),$n(cb).then(()=>[])]).catch(()=>[]);return(Array.isArray(r)?r:[]).flatMap(o=>{let a=Yp(o);return a?[{...a,run:(i,s)=>Reflect.apply(n,e,[o,i,{signal:s}])}]:[]})}async function za(e=[]){let t=Hs(zp()),n=new Set(t.map(a=>a.name)),o=[...(await db()).filter(a=>!n.has(a.name)),...t,...Hs(e),...Hs(so().registered)];return new Map(o.map(a=>[a.name,a]))}function js(e){return[...e.values()].map(({name:t,description:n,inputSchema:r,consequential:o})=>o?{name:t,description:n,inputSchema:r,annotations:{consequentialHint:!0}}:{name:t,description:n,inputSchema:r})}function an(e){return e?.execution==="client"}function lo(e){return e.startsWith(Vp)?e.slice(Vp.length):e}function pb(e){if(e===void 0||typeof e=="function"||typeof e=="symbol")return null;let t=new WeakSet,n=JSON.stringify(e,(r,o)=>{if(typeof o=="bigint")return o.toString();if(!(typeof o=="function"||typeof o=="symbol"))return o instanceof Node?`[${o.nodeName.toLowerCase()}]`:bn(o)?t.has(o)?"[circular]":(t.add(o),o):o});return n.length>Wp?{truncated:!0,preview:n.slice(0,Wp)}:JSON.parse(n)}async function _b(e){let t=lo(e.toolName),n=(await za(e.optionTools)).get(t);return n?Promise.resolve().then(()=>n.run(e.input,e.signal)).then(r=>({state:"output-available",output:pb(r)})).catch(r=>(Qp.warn("a page tool failed",{name:t,error:r}),{state:"output-error",errorText:(r instanceof Error?r.message:String(r)).slice(0,1e3)||"The page tool failed."})):{state:"output-error",errorText:`This page doesn't offer "${t}" right now; the visitor may have moved on. Tell them, or continue without it.`}}function Zp(e){let{toolCallId:t}=e,n=Rt.get(t);if(n?.state==="finished")return Promise.resolve(n.outcome);let{runs:r}=so(),o=r.get(t);if(o)return o.outcome;if(n?.state==="running")return Rt.set(t,{state:"finished",outcome:zs}),e.onSettled("interrupted",0),Promise.resolve(zs);let a=new AbortController,i=performance.now();Rt.set(t,{state:"running"});let s=_b({...e,signal:a.signal}).then(c=>(r.delete(t),Rt.get(t)?.state!=="running"||(Rt.set(t,{state:"finished",outcome:c}),e.onSettled(c.state==="output-available"?"completed":"failed",Math.round(performance.now()-i))),c));return r.set(t,{outcome:s,controller:a}),s}function ja(e){return e===zs.errorText||e===Xp}function Vs(e){return Rt.set(e,{state:"stopped"}),so().runs.get(e)?.controller.abort(),Xp}function e_(e){Rt.clear([e]),so().runs.get(e)?.controller.abort()}var Ut=M.cssPrefix;function t_(e){let t=e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim().toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)}function Gs(e){if(e.startsWith("tool:")||e.startsWith("tool-"))return e.slice(5);let t=e.indexOf("__"),n=e.slice(t+2);return t>0&&n?`${t_(e.slice(0,t))} \xB7 ${t_(n)}`:e}function Va(e,t){let n=e==="output-available"||e==="output-error"||e==="output-denied",r=e==="approval-responded"||t?.approved!==void 0;return{terminal:n,responded:r,decided:n||r}}function Ks({status:e,icon:t,label:n}){return l("span",{class:`${Ut}-toolui-badge ${Ut}-toolui-status`,"data-status":e,children:[l("span",{class:`${Ut}-toolui-status-icon`,children:t}),n]})}function fb(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 Qs(e,t,n={}){return n.submitted?"responded":n.incomplete?"incomplete":hb(fb(e,t),n.superseded,n.live??!0)}function mb({status:e}){return e==="denied"||e==="error"||e==="superseded"||e==="incomplete"?l(Ca,{}):e==="completed"||e==="responded"?l(wa,{}):l(Zd,{})}function gb(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;case"incomplete":return t.statusIncomplete;default:return t.statusRunning}}function hb(e,t,n){return t&&(e==="awaiting"||e==="running")?"superseded":!n&&e==="running"?"error":e}function vb({state:e,approval:t,strings:n,superseded:r,live:o=!0,submitted:a=!1,incomplete:i=!1}){let s=Qs(e,t,{superseded:r,live:o,submitted:a,incomplete:i});return l(Ks,{status:s,icon:l(mb,{status:s}),label:gb(s,n)})}function bb({name:e,state:t,approval:n,strings:r,superseded:o,live:a,submitted:i,incomplete:s}){return l(_e,{children:[l("span",{class:`${Ut}-toolui-name-pill`,children:[l(Yd,{}),l("span",{class:`${Ut}-toolui-name-text`,children:e})]}),l(vb,{state:t,approval:n,strings:r,superseded:o,live:a,submitted:i,incomplete:s}),l("span",{class:`${Ut}-toolui-chevron`,children:l(Bn,{})})]})}function Wa({part:e,strings:t,testid:n,superseded:r,live:o,submitted:a,incomplete:i}){let s=ce(()=>ve(()=>e.inputSig.value),[e]),c=ce(()=>ve(()=>e.outputSig.value),[e]),p=ce(()=>ve(()=>e.errorSig.value),[e]),_=ce(()=>ve(()=>e.stateSig.value),[e]),d=ce(()=>ve(()=>e.approvalSig.value),[e]),u=ce(()=>ve(()=>an(e.toolMetadata)&&ja(e.errorSig.value)),[e]),f=i===!0||u.value;return l("details",{class:`${Ut}-toolui ${Ut}-toolui-collapsible`,"data-testid":n,children:[l("summary",{class:`${Ut}-toolui-head`,children:l(bb,{name:Gs(e.toolName),state:_.value,approval:d.value,strings:t,superseded:r,live:o,submitted:a,incomplete:f})}),l(Ws,{label:t.toolParameters,value:s.value}),c.value!==void 0?l(Ws,{label:t.toolResult,value:c.value}):null,p.value&&!f?l(Ws,{label:t.statusError,value:p.value,error:!0}):null]})}function Ws({label:e,value:t,error:n}){let r=n?typeof t=="string"?t:"":Ga(Xs(t));return r?l("div",{class:`${Ut}-toolui-section`,children:[l("span",{class:`${Ut}-toolui-label`,children:e}),l("pre",{class:`${Ut}-toolui-code`,"data-error":n?"true":void 0,children:r})]}):null}function Xs(e){if(e&&typeof e=="object"){let t=e;if(t.storage==="tool-result-ref"&&"summary"in t)return t.summary}return e}function Ga(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 n_(e){return e.partsSig.value.some(t=>t.kind==="text"&&t.textSig.value.length>0)}function r_(e){return e.partsSig.value.some(t=>t.kind==="reasoning")}function yb(e){return e.streaming&&!e.bufferedHold&&!(e.reasoningVisible&&e.working)}function o_(e){let{streaming:t,reasoningVisible:n,emptyReply:r,hidden:o}=e,a=e.responseMode==="buffered"&&t,i=t&&!e.hasAnswerText;return{streaming:t,bufferedHold:a,reasoningVisible:n,working:i,showStreamDots:yb({streaming:t,bufferedHold:a,reasoningVisible:n,working:i}),emptyReply:r,hidden:o}}function a_(e,t){let n=e.stateSig.value,r=e.approvalSig.value,{terminal:o,responded:a,decided:i}=Va(n,r),s=t.continuationStreaming===!0&&!i,c=t.superseded&&!i&&!s;return{pill:Qs(n,r,{superseded:c,live:t.live,submitted:s,incomplete:an(e.toolMetadata)&&ja(e.errorSig.value)}),state:n,terminal:o,decided:i||s,showApproveReject:!i&&!t.superseded&&!s,showAnswered:a&&!o&&!c,showSubmitted:s,showEdit:a&&t.active&&!o,skipped:c,answeredApproved:r?.approved}}var hr=M.cssPrefix;function i_({part:e,strings:t}){let n=e.title||e.filename||e.url||t.sources;return e.url?l("a",{class:`${hr}-source`,href:e.url,target:"_blank",rel:"noreferrer noopener","data-testid":L.source,children:[l("span",{class:`${hr}-source-icon`,"aria-hidden":"true",children:"\u{1F517}"}),l("span",{class:`${hr}-source-label`,children:n})]}):l("span",{class:`${hr}-source`,"data-testid":L.source,children:[l("span",{class:`${hr}-source-icon`,"aria-hidden":"true",children:"\u{1F4C4}"}),l("span",{class:`${hr}-source-label`,children:n})]})}var Mt=M.cssPrefix;function s_({part:e,strings:t,active:n,superseded:r=!1,continuationStreaming:o=!1,onDecision:a,onEdit:i}){let s=ce(()=>ve(()=>e.approvalSig.value),[e]),c=ce(()=>ve(()=>a_(e,{active:n,superseded:r,continuationStreaming:o})),[e,n,r,o]).value,{terminal:p,showApproveReject:_,showAnswered:d,showSubmitted:u,showEdit:f,skipped:m}=c,v=Gs(e.toolName),P=c.answeredApproved,x=e.toolCallId,k=l(_e,{children:[l("p",{class:`${Mt}-toolui-prompt`,children:t.approvalPrompt.replace("{tool}",v)}),l("p",{class:`${Mt}-toolui-subtle`,children:t.approvalBody})]});u?k=l("p",{class:`${Mt}-toolui-subtle`,children:t.approvalSubmitting}):d&&P!==!1?k=l(_e,{children:[l("p",{class:`${Mt}-toolui-prompt`,children:[t.approvalYourResponse.replace("{decision}",P?t.approve:t.reject),s.value?.reason?` \u2014 ${s.value.reason}`:""]}),f?l("p",{class:`${Mt}-toolui-subtle`,children:t.approvalEditHint}):null,f?null:l("p",{class:`${Mt}-toolui-subtle`,children:t.approvalSubmitting})]}):d&&(k=l(_e,{}));let T=_||u||f||d&&P!==!1;return l("div",{class:`${Mt}-toolui-group`,"data-testid":c.decided?L.toolDecision:L.toolApproval,children:[l(Wa,{part:e,strings:t,superseded:m,submitted:u}),m||p||!T?null:l("div",{class:`${Mt}-toolui ${Mt}-toolui-body`,children:[k,_?l("div",{class:`${Mt}-toolui-actions`,children:[l("button",{type:"button",class:`${Mt}-form-skip`,disabled:!n,onClick:()=>a(x,!1),"data-testid":L.toolReject,children:t.reject}),l("button",{type:"button",class:`${Mt}-form-submit`,disabled:!n,onClick:()=>a(x,!0),"data-testid":L.toolApprove,children:t.approve})]}):null,f?l("div",{class:`${Mt}-toolui-actions`,children:l("button",{type:"button",class:`${Mt}-form-skip`,onClick:()=>i(x),"data-testid":L.toolEdit,children:t.edit})}):null]})]})}var Pb=["text","email","phone","number","date","single-select","multi-select","boolean"];function l_(e){return e!==null&&typeof e=="object"}function c_(e){let t=l_(e)?e:{},r=(Array.isArray(t.questions)?t.questions:[]).map(xb).filter(o=>o!==null);return{intro:Ka(t.intro),questions:r}}function xb(e,t){if(!l_(e))return null;let n=Pb.find(r=>r===e.type)??"text";return{key:Ka(e.key)??`q${t+1}`,question:Ka(e.question)??"Please provide the missing information.",type:n,options:Array.isArray(e.options)?e.options.filter(r=>typeof r=="string"&&r.trim().length>0):void 0,required:typeof e.required=="boolean"?e.required:void 0,helpText:Ka(e.helpText)}}function Sb(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 Js(e,t,n){return e.questions.map(r=>{let o=Sb(r.type),a=r.type==="boolean"?[{value:"yes",label:t},{value:"no",label:n}]:(r.options??[]).map(i=>({value:i,label:i}));return{name:r.key,label:r.question,type:o,required:r.required??!1,options:a.length>0?a:void 0,validationHint:r.helpText}})}function Ka(e){return typeof e=="string"&&e.trim()?e.trim():void 0}var Xe=M.cssPrefix;function kb({skipped:e,submitted:t,strings:n}){return e?{status:"superseded",statusLabel:n.inputSkipped}:t?{status:"responded",statusLabel:n.statusResponded}:{status:"completed",statusLabel:n.inputAnswered}}var wb={text:"qtypeText",email:"qtypeEmail",phone:"qtypePhone",number:"qtypeNumber",date:"qtypeDate","single-select":"qtypeChooseOne","multi-select":"qtypeChooseAny",boolean:"qtypeBoolean"};function u_(e,t){let n={};for(let r of e)n[r.key]=t[wb[r.type]];return n}function d_({part:e,strings:t,active:n,superseded:r=!1,continuationStreaming:o=!1,onDecision:a,onEdit:i}){let s=ce(()=>ve(()=>e.stateSig.value),[e]).value,c=ce(()=>ve(()=>e.approvalSig.value),[e]).value,p=ce(()=>ve(()=>c_(e.inputSig.value)),[e]).value,{terminal:_,decided:d}=Va(s,c),u=d&&c?.approved===!0,f=o&&!d,m=!d&&!r&&!f,v=!m&&!u&&!f,P=u&&n&&!_,x=p.questions,[k,T]=q(null),g=k??(m||u||f),[S,w]=q(!1),C=x.length>1?Is:eo,A=m?t.inputRequired:t.inputBadge,E=f?l("p",{class:`${Xe}-toolui-subtle`,children:t.approvalSubmitting}):m?l(Cb,{req:p,strings:t,active:n,resolve:(j,W)=>a(e.toolCallId,W,j)}):S?l(ao,{fields:Js(p,t.confirmYes,t.confirmNo),strings:t,submitLabel:t.inputSubmit,onSubmit:()=>{},disabled:!0,hideActions:!0,fieldTypeLabels:u_(x,t),initialValues:u?Eb(x,c?.reason):void 0}):l(Tb,{questions:x,answers:u?Ab(c?.reason):{},strings:t}),{status:N,statusLabel:O}=kb({skipped:v,submitted:f,strings:t});return l("details",{class:`${Xe}-toolui ${Xe}-toolui-collapsible${r?` ${Xe}-toolui-stale`:""}`,open:g,onToggle:j=>{let W=j.currentTarget.open;W!==g&&T(W)},"data-testid":m?L.toolAskQuestions:L.toolDecision,children:[l("summary",{class:`${Xe}-toolui-head`,children:[l("span",{class:`${Xe}-toolui-q-pill`,children:[l(C,{}),A]}),l("span",{class:`${Xe}-toolui-head-end`,children:[m?null:l(Ks,{status:N,icon:v?l(Ca,{}):l(wa,{}),label:O}),l("span",{class:`${Xe}-toolui-chevron`,children:l(Bn,{})})]})]}),l("div",{class:`${Xe}-toolui-collapse-body`,children:[p.intro?l("div",{class:`${Xe}-toolui-desc`,children:p.intro}):null,E,m||f?null:l("div",{class:`${Xe}-toolui-footer`,children:[l("button",{type:"button",class:`${Xe}-toolui-options-toggle`,onClick:()=>w(j=>!j),"data-testid":L.toolAskOptions,children:[l("span",{class:`${Xe}-toolui-options-chevron${S?` ${Xe}-open`:""}`,children:l(Bn,{})}),S?t.hideOptions:t.showOptions]}),P?l("button",{type:"button",class:`${Xe}-form-skip`,onClick:()=>i(e.toolCallId),"data-testid":L.toolEdit,children:t.edit}):null]})]})]})}function Cb({req:e,strings:t,active:n,resolve:r}){let o=Js(e,t.confirmYes,t.confirmNo),a=e.questions.length===1&&e.questions[0]?.type==="text";return l(ao,{fields:o,strings:t,disabled:!n,submitLabel:t.inputSubmit,footerHint:a?t.inputSubmitHint:void 0,onSubmit:i=>r(Ib(e.questions,i),!0),skipLabel:t.inputSkip,onSkip:()=>r(void 0,!1),submitOnEnter:a,fieldTypeLabels:u_(e.questions,t),submitTestId:L.toolInputSubmit,skipTestId:L.toolInputSkip})}function Tb({questions:e,answers:t,strings:n}){return l("div",{class:`${Xe}-toolui-summary`,"data-testid":L.toolAskSummary,children:e.map(r=>l("div",{class:`${Xe}-field`,children:[l("span",{class:`${Xe}-field-head`,children:l("span",{class:`${Xe}-field-label`,children:[r.question,r.required?l("span",{class:`${Xe}-field-req`,"aria-hidden":"true",children:" *"}):null]})}),l("p",{class:`${Xe}-toolui-answer`,children:Rb(r,t[r.key],n)||"\u2014"})]},r.key))})}function Rb(e,t,n){return e.type!=="boolean"?t??"":t==="yes"?n.confirmYes:t==="no"?n.confirmNo:t??""}function Ib(e,t){let n=e.flatMap(r=>{let o=t[r.key];if(o==null||o.trim()==="")return[];let a=r.type==="multi-select"?o.split(",").map(i=>i.trim()).filter(Boolean):o;return[{key:r.key,value:a}]});return JSON.stringify({answers:n})}function p_(e){if(!e)return{};let n=(()=>{try{return JSON.parse(e)}catch{return}})()?.answers;if(!Array.isArray(n))return{};let r={};for(let o of n)if(o&&typeof o=="object"&&"key"in o){let{key:a,value:i}=o;if(typeof a!="string")continue;typeof i=="string"?r[a]=i:Array.isArray(i)&&(r[a]=i.filter(s=>typeof s=="string"))}return r}function Ab(e){let t=p_(e),n={};for(let[r,o]of Object.entries(t))n[r]=Array.isArray(o)?o.join(", "):o;return n}function Eb(e,t){let n=p_(t),r={};for(let o of e){let a=n[o.key];a!==void 0&&(o.type==="multi-select"?r[o.key]=Array.isArray(a)?a:[a]:r[o.key]=Array.isArray(a)?a[0]??"":a)}return r}function __({part:e,strings:t,live:n,superseded:r}){let o=ce(()=>ve(()=>e.inputSig.value),[e]),a=ce(()=>ve(()=>e.outputSig.value),[e]),i=ce(()=>ve(()=>e.errorSig.value),[e]),s=an(e.toolMetadata);if(!ce(()=>ve(()=>!!Ga(o.value)||!!i.value||!!Ga(Xs(a.value))),[o,a,i]).value&&!s)return null;let p=a.value===void 0&&!i.value;return l(Wa,{part:e,strings:t,testid:L.toolCall,live:n||s&&!r,incomplete:s&&r&&p})}var ct=M.cssPrefix,f_=Fp(Mb);function Mb({message:e,status:t,strings:n,responseMode:r,showReasoning:o,showToolCalls:a,showSources:i,interactive:s=!1,superseded:c=!1,tool:p,onRetry:_,enableMessageFeedback:d=!1,onFeedback:u}){let m=[...ce(()=>ve(()=>e.partsSig.value),[e]).value];for(let z of e.attachments??[])!z.url||m.some(J=>J.kind==="file"&&J.url===z.url)||m.push({kind:"file",url:z.url,mediaType:z.mediaType});let v=ce(()=>ve(()=>Nn(e)),[e]),P=ce(()=>ve(()=>od(e)),[e]),x=ce(()=>ve(()=>n_(e)),[e]),k=ce(()=>ve(()=>o&&r_(e)),[e,o]),T=t==="streaming",h=e.role==="assistant"&&T,g=o_({streaming:h,responseMode:r,reasoningVisible:k.value,hasAnswerText:x.value,emptyReply:v.value,hidden:P.value}),{bufferedHold:S,working:w,showStreamDots:C}=g;if(g.hidden)return null;let A=Lb(e.createdAt),E=e.role==="assistant"||e.role==="operator",N=d&&!!u&&!!e.serverMessageId&&E&&!T&&t!=="error"&&!v.value,O=T?"":m.filter(z=>z.kind==="text").map(z=>e.role==="assistant"?_a(z.textSig.peek()):z.textSig.peek()).join(`
58
58
 
59
- `).trim(),W=!w&&t!=="error"&&!h.value&&$.length>0,G=L||W;return l("div",{class:`${lt}-bubble-row`,"data-role":e.role,"data-testid":st(E.messageBubble,e.serverMessageId??e.id),children:l("div",{class:`${lt}-bubble-col`,children:[l("div",{class:`${lt}-bubble`,children:[e.role==="operator"&&e.operatorInitials?l("span",{class:`${lt}-bubble-author`,children:e.operatorInitials}):null,l("div",{class:`${lt}-bubble-body`,children:[k?l(Dh,{label:n.loading}):m.map((U,oe)=>l(Mh,{part:U,generativeUi:e.role==="assistant",active:C,live:g,strings:n,showReasoning:o,showToolCalls:a,showSources:i,interactive:s&&t==="complete"&&(U.kind!=="tool"||ca(e,oe)),superseded:c,continuationStreaming:e.continuationStreaming===!0,tool:p},`${Oh(U)}#${oe}`)),T&&l($h,{}),t==="error"||h.value?l("div",{class:`${lt}-error`,role:"alert",children:[l("span",{children:e.errorText??n.errorGeneric}),d?l("button",{type:"button",class:`${lt}-error-retry`,onClick:()=>d(e),"data-testid":E.messageRetry,children:n.errorRetry}):null]}):null]})]}),M||G?l("div",{class:`${lt}-bubble-meta`,children:[M?l("time",{class:`${lt}-bubble-time`,dateTime:M.iso,title:M.full,children:M.short}):null,G?l("div",{class:`${lt}-bubble-actions`,children:[L&&e.serverMessageId?l(hp,{messageId:e.serverMessageId,initial:e.feedback??null,strings:n,onFeedback:u}):null,W?l(Ah,{text:$,strings:n}):null]}):null]}):null]})})}function Ah({text:e,strings:t}){let[n,r]=z(!1);function o(){navigator.clipboard?.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)}).catch(()=>{})}let a=n?t.copied:t.copy;return l("button",{type:"button",class:`${lt}-msg-action`,"data-active":n?"true":void 0,"aria-label":a,title:a,onClick:o,"data-testid":E.messageCopy,children:n?l(Mn,{}):l(Rd,{})})}function Eh(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 Mh({part:e,generativeUi:t,active:n,live:r,strings:o,showReasoning:a,showToolCalls:i,showSources:s,interactive:c,superseded:p,continuationStreaming:d,tool:_}){switch(e.kind){case"step-start":return null;case"text":return l(Sa,{textSig:e.textSig,doneSig:e.doneSig,generativeUi:t,strings:o});case"reasoning":return a?l(Lh,{part:e,active:n,strings:o}):null;case"tool":return l(Nh,{part:e,strings:o,showToolCalls:i,interactive:c,superseded:p,continuationStreaming:d,live:r,tool:_});case"file":return e.mediaType.startsWith("image/")?l("img",{src:e.url,alt:"",loading:"lazy"}):l("a",{href:e.url,target:"_blank",rel:"noreferrer noopener",children:e.url});case"source":return s?l(kp,{part:e,strings:o}):null}}function Nh({part:e,strings:t,showToolCalls:n,interactive:r,superseded:o,continuationStreaming:a,live:i,tool:s}){let c=ie(()=>he(()=>e.approvalSig.value!==void 0),[e]);return s?.humanInLoop&&c.value?Ma(e.toolName)?l(Tp,{part:e,strings:t,active:r,superseded:o,continuationStreaming:a,onDecision:s.onDecision,onEdit:s.onEdit}):l(wp,{part:e,strings:t,active:r,superseded:o,continuationStreaming:a,onDecision:s.onDecision,onEdit:s.onEdit}):n?l(Ep,{part:e,strings:t,live:i}):null}function Lh({part:e,active:t,strings:n}){return l("details",{class:`${lt}-reasoning`,"data-testid":E.reasoning,open:t,"data-active":t?"true":void 0,children:[l("summary",{class:`${lt}-reasoning-summary`,children:l("span",{class:`${lt}-reasoning-label`,children:t?n.thinking:n.thoughts})}),l("div",{class:`${lt}-reasoning-body`,children:l(Sa,{textSig:e.textSig,doneSig:e.doneSig})})]})}function Oh(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 $h(){return l("span",{class:`${lt}-typing`,"data-testid":E.typingDots,"aria-hidden":"true",children:[l("span",{}),l("span",{}),l("span",{})]})}function Dh({label:e}){return l("span",{class:`${lt}-loading`,role:"status",children:[l("span",{class:`${lt}-loading-spinner`,"aria-hidden":"true"}),l("span",{class:`${lt}-loading-label`,children:e})]})}var mn=A.cssPrefix,Es=120,Bh=350;function Np({messagesSig:e,strings:t,responseMode:n,showReasoning:r,showToolCalls:o,showSources:a,enableMessageFeedback:i,onFeedback:s,loading:c,onLoadPreviousMessages:p,idle:d,controlMode:_="ai-agent",tool:u,onRetry:f,form:m,formMarkers:h,onFillForm:y}){let x=D(null),S=Ct(()=>e.value),[w,g]=z(!1),[v,k]=z(!1),C=D(!1),T=D(!1),[M,N]=z(),L=D(!1),$=D(!1),W=D(!1),G=D(0);function U(){return W.current||performance.now()-G.current<Bh}let oe=D(0);function ae(b){let q=b.scrollHeight-b.clientHeight>1;b.dataset.fadeTop=q&&b.scrollTop>1?"true":"false",b.dataset.fadeBottom=q&&b.scrollHeight-b.scrollTop-b.clientHeight>1?"true":"false"}function Te(b){return g(b.scrollHeight-b.scrollTop-b.clientHeight>Es*2)}function ge(b){oe.current=performance.now(),b.scrollTop=b.scrollHeight,ae(b)}function xe(b,q){ge(b);let K=q,J=0;function se(){$.current||U()||(ge(b),--K>0&&(J=requestAnimationFrame(se)))}return q>0&&(J=requestAnimationFrame(se)),()=>cancelAnimationFrame(J)}function ct(b,q){let K,J,se,we=-1;function Ce(){K.disconnect(),J.disconnect(),clearTimeout(se)}function ve(){if($.current||U()||we>=0&&b.scrollTop<we-4)return Ce();ge(b),we=b.scrollTop}return K=new ResizeObserver(ve),J=new MutationObserver(ve),ve(),K.observe(b),J.observe(b,{childList:!0,subtree:!0,characterData:!0}),se=setTimeout(Ce,q),Ce}let Le=S.value[0]?.id;wt(()=>{let b=x.current;if(b&&S.value.length!==0&&!T.current&&(L.current=!0,!!S.value.some(q=>q.role==="user")))return ct(b,300)},[Le]);let Ze=D(0);F(()=>{let b=x.current,q=S.value,K=Ze.current;if(Ze.current=q.length,!b||!L.current||T.current)return;if(q.slice(K).some(se=>se.role==="user"))return $.current=!1,xe(b,3);if(!q.some(se=>se.role==="user")||$.current||U())return;b.scrollHeight-b.scrollTop-b.clientHeight<Es&&ge(b)},[S.value.length]);let Ve=D(null);F(()=>{let b=x.current,q=S.value.at(-1),K=Ve.current;if(Ve.current=q?{id:q.id,streaming:q.status==="streaming"}:null,!!b&&L.current&&!(!q||q.id!==K?.id||K.streaming||q.status!=="streaming"))return $.current=!1,xe(b,3)},[S.value]),F(()=>{let b=x.current;if(!b)return;let q=S.value.at(-1);if(!q||q.status!=="streaming"&&!S.value.some(se=>se.role==="user"))return;let K=()=>{if($.current||U())return;b.scrollHeight-b.scrollTop-b.clientHeight<Es*2&&ge(b)};if(q.status!=="streaming")return ct(b,300);K();let J=new MutationObserver(K);return J.observe(b,{childList:!0,subtree:!0,characterData:!0}),()=>J.disconnect()},[S.value]);let mt=m?.form.id,At=!!m&&(h??[]).some(b=>b.formId===m.form.id);wt(()=>{let b=x.current;!b||!mt||$.current||S.value.some(q=>q.role==="user")&&(At?b.querySelector(`[data-testid="${E.formGate}"]`)?.scrollIntoView({block:"nearest"}):ge(b))},[mt,At]),F(()=>{let b=x.current;if(!b)return;let q=()=>{Te(b),ae(b),performance.now()-oe.current>150&&($.current=b.scrollHeight-b.scrollTop-b.clientHeight>8)};function K(){$.current=!0}function J(ce){ce.deltaY<0&&K()}let se=0;function we(ce){se=ce.touches[0]?.clientY??0,W.current=!0}function Ce(ce){(ce.touches[0]?.clientY??0)>se+4&&K()}function ve(){W.current=!1,G.current=performance.now()}function nt(){W.current=!0}return b.addEventListener("scroll",q,{passive:!0}),b.addEventListener("wheel",J,{passive:!0}),b.addEventListener("touchstart",we,{passive:!0}),b.addEventListener("touchmove",Ce,{passive:!0}),b.addEventListener("touchend",ve,{passive:!0}),b.addEventListener("touchcancel",ve,{passive:!0}),b.addEventListener("pointerdown",nt,{passive:!0}),window.addEventListener("pointerup",ve,{passive:!0}),window.addEventListener("pointercancel",ve,{passive:!0}),Te(b),()=>{b.removeEventListener("scroll",q),b.removeEventListener("wheel",J),b.removeEventListener("touchstart",we),b.removeEventListener("touchmove",Ce),b.removeEventListener("touchend",ve),b.removeEventListener("touchcancel",ve),b.removeEventListener("pointerdown",nt),window.removeEventListener("pointerup",ve),window.removeEventListener("pointercancel",ve)}},[]);function et(){let b=x.current;b&&($.current=!1,ge(b))}let dt=S.value.filter(b=>!b.ephemeral),Pt=dt[0],Ae=Pt?.serverMessageId??Pt?.id,Oe=!!(p&&dt.length>=ds&&Ae!==M);async function xt(){if(!p||C.current)return;let b=x.current,q=b?.scrollHeight??0,K=b?.scrollTop??0;C.current=!0,T.current=!0,k(!0);try{let J=await p();J===!1&&Ae&&N(Ae),J&&b&&(await new Promise(se=>requestAnimationFrame(()=>requestAnimationFrame(()=>se()))),b.scrollTop=K+b.scrollHeight-q,ae(b),Te(b))}finally{T.current=!1,C.current=!1,k(!1)}}let fe=[],$e="",tt=S.value.at(-1)?.id,Ee=[...h??[]].toSorted((b,q)=>(b.createdAt??1/0)-(q.createdAt??1/0));function gt(b){return m&&b.formId===m.form.id?l(ks,{form:m.form,strings:t,onSubmit:m.onSubmit,onSkip:m.onSkip},`gate:${b.formId}`):l(_p,{marker:b,strings:t,onFill:!m&&y?()=>y(b.formId):void 0},b.key)}function Et(b){for(let q=Ee[0];q?.createdAt!==void 0&&!(b!==void 0&&q.createdAt>b);q=Ee[0])Ee.shift(),fe.push(gt(q))}for(let b of S.value){if(b.role==="assistant"&&b.id!==tt&&Tn(b))continue;Et(b.createdAt);let q=Fh(b.createdAt);q&&q!==$e&&(fe.push(l("div",{class:`${mn}-date-divider`,children:l("span",{class:`${mn}-date-pill`,title:Uh(b.createdAt),children:qh(b.createdAt,t)})},`day:${q}`)),$e=q);let J=b.retryAction!==void 0||b.role==="assistant"&&b.id===tt?pa(S.value,b):void 0,se=J!==void 0&&(J.kind!=="continue-assistant"||_==="ai-agent");fe.push(l(Mp,{message:b,status:b.status,strings:t,responseMode:n,showReasoning:r,showToolCalls:o,showSources:a,interactive:!!d&&_==="ai-agent"&&b.id===tt,superseded:b.id!==tt,tool:u,onRetry:d&&se&&(b.role==="user"||b.id===tt)?f:void 0,enableMessageFeedback:i,onFeedback:s},b.id))}for(let b of Ee)fe.push(gt(b));return l("div",{class:`${mn}-list-wrap`,children:[l("div",{ref:x,class:`${mn}-list ${mn}-list--fade`,part:"messages",role:"log","aria-live":"polite","aria-relevant":"additions text",children:[c&&S.value.length===0?l("div",{class:`${mn}-list-loading`,role:"status",children:t.conversationLoading}):null,Oe?l("div",{class:`${mn}-load-previous`,children:l("button",{type:"button",onClick:xt,disabled:v,"aria-busy":v,"data-testid":E.loadPreviousMessages,children:t.loadPreviousMessages})}):null,fe,m&&!At?l(ks,{form:m.form,strings:t,onSubmit:m.onSubmit,onSkip:m.onSkip}):null]}),w?l("button",{type:"button",class:`${mn}-jump`,onClick:et,"aria-label":t.scrollToBottom,title:t.scrollToBottom,"data-testid":E.scrollToBottom,children:l(Nn,{})}):null]})}function Fh(e){if(typeof e!="number"||!Number.isFinite(e))return"";let t=new Date(e);return`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`}function Uh(e){if(typeof e!="number"||!Number.isFinite(e))return"";try{return new Date(e).toLocaleDateString(void 0,{dateStyle:"full"})}catch{return""}}function qh(e,t){let n=new Date(e);function r(a){return new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime()}let o=Math.round((r(new Date)-r(n))/864e5);return o<=0?t.dateToday:o===1?t.dateYesterday:o<7?n.toLocaleDateString(void 0,{weekday:"long"}):n.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"})}function Ba({panelEl:e,resize:t,position:n,initialSize:r,onSizeChange:o,strings:a}){let i=A.cssPrefix,s=D(null);if(F(()=>{if(!e)return;let m=e.style;t.minWidth&&m.setProperty(`--${i}-resize-min-w`,t.minWidth),t.maxWidth&&m.setProperty(`--${i}-resize-max-w`,t.maxWidth),t.minHeight&&m.setProperty(`--${i}-resize-min-h`,t.minHeight),t.maxHeight&&m.setProperty(`--${i}-resize-max-h`,t.maxHeight),r&&(m.setProperty(`--${i}-widget-w`,`${r.width}px`),m.setProperty(`--${i}-widget-h`,`${r.height}px`))},[e,t.minWidth,t.maxWidth,t.minHeight,t.maxHeight,i,r]),!e)return null;let c=n.startsWith("top-"),p=n.endsWith("-right"),d=`${i}-resize-grip ${i}-resize-grip--${c?"bottom":"top"}-${p?"left":"right"}`;function _(m){if(!e)return;let h=m.currentTarget,y=e.getBoundingClientRect();s.current={pointerId:m.pointerId,startX:m.clientX,startY:m.clientY,startW:y.width,startH:y.height,dirX:p?-1:1,dirY:c?1:-1},h.setPointerCapture(m.pointerId),e.setAttribute("data-resizing",""),m.preventDefault()}function u(m){let h=s.current;if(!h||m.pointerId!==h.pointerId||!e)return;let y=(m.clientX-h.startX)*h.dirX,x=(m.clientY-h.startY)*h.dirY;e.style.setProperty(`--${i}-widget-w`,`${h.startW+y}px`),e.style.setProperty(`--${i}-widget-h`,`${h.startH+x}px`)}function f(m){let h=s.current;if(!h||m.pointerId!==h.pointerId||!e)return;m.currentTarget.releasePointerCapture(m.pointerId),e.removeAttribute("data-resizing");let y=e.getBoundingClientRect();o({width:Math.round(y.width),height:Math.round(y.height)}),s.current=null}return l("div",{class:d,role:"separator","aria-orientation":"vertical","aria-label":a.resizeHandle,title:a.resizeHandle,onPointerDown:_,onPointerMove:u,onPointerUp:f,onPointerCancel:f,"data-testid":E.resizeGrip,children:l(pd,{})})}var Lp=A.cssPrefix;function Op({suggestions:e,onPick:t,disabled:n=!1}){return e.length===0?null:l("div",{class:`${Lp}-suggestions`,role:"group","aria-label":"Suggested replies",children:e.map((r,o)=>l("button",{type:"button",class:`${Lp}-suggestion`,onClick:()=>t(r),disabled:n,"data-testid":st(E.suggestion,o),children:r.label},r.id))})}var On=A.cssPrefix,zh=`.${On}-header, .${On}-back-header, .${On}-home-hero`,Hh='button, a, input, textarea, select, [role="tab"], [contenteditable]',$p=56;function Fa(e,t){F(()=>{if(!t||!e)return;function n(c){return Number.parseFloat(c)||0}function r(c,p){return Math.min(p,Math.max(-p,c))}let o=null,a=c=>{let p=c.target;if(!(p instanceof Element)||!p.closest(zh)||p.closest(Hh))return;let d=e.getBoundingClientRect();o={id:c.pointerId,x:c.clientX,y:c.clientY,dx:n(e.style.getPropertyValue(`--${On}-modal-dx`)),dy:n(e.style.getPropertyValue(`--${On}-modal-dy`)),maxX:(window.innerWidth+d.width)/2-$p,maxY:(window.innerHeight+d.height)/2-$p},e.dataset.dragging="true",c.preventDefault()},i=c=>{if(!o||c.pointerId!==o.id)return;let p=r(o.dx+c.clientX-o.x,o.maxX),d=r(o.dy+c.clientY-o.y,o.maxY);e.style.setProperty(`--${On}-modal-dx`,`${p}px`),e.style.setProperty(`--${On}-modal-dy`,`${d}px`)},s=c=>{!o||c.pointerId!==o.id||(o=null,delete e.dataset.dragging)};return e.addEventListener("pointerdown",a),window.addEventListener("pointermove",i),window.addEventListener("pointerup",s),window.addEventListener("pointercancel",s),()=>{e.removeEventListener("pointerdown",a),window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",s),window.removeEventListener("pointercancel",s)}},[e,t])}function Ua({containerRef:e,onDrop:t,disabled:n=!1}){let[r,o]=z(!1);return F(()=>{if(n){o(!1);return}let a=e.current;if(!a)return;let i=0;function s(_){i+=1,_.dataTransfer?.types.includes("Files")&&(_.preventDefault(),o(!0))}function c(){i-=1,!(i>0)&&(i=0,o(!1))}function p(_){_.dataTransfer?.types.includes("Files")&&_.preventDefault()}function d(_){i=0,o(!1),_.dataTransfer&&(_.preventDefault(),t(_.dataTransfer.items))}return a.addEventListener("dragenter",s),a.addEventListener("dragleave",c),a.addEventListener("dragover",p),a.addEventListener("drop",d),()=>{a.removeEventListener("dragenter",s),a.removeEventListener("dragleave",c),a.removeEventListener("dragover",p),a.removeEventListener("drop",d)}},[e,n,t]),{visible:n?!1:r}}var je=A.cssPrefix;function Dp(e){let{options:t,onClose:n}=e,r=t.strings,o=D(null);F(()=>{let p=o.current;if(!p)return;let d=ya(p);function _(u){u.key==="Escape"&&n?.()}return p.addEventListener("keydown",_),()=>{d(),p.removeEventListener("keydown",_)}},[n]);let a=e.composerApiRef,i=e.composerActive&&e.view==="chat"&&e.canSend&&!e.activeForm&&!e.sendPreparing&&e.options.features.fileUpload,s=B(p=>{i&&a.current?.attachFromDrop(p)},[a,i]),{visible:c}=Ua({containerRef:o,onDrop:s,disabled:!i});return Fa(o.current,t.mode==="modal"),l("div",{ref:o,class:`${je}-panel`,part:"panel",role:"dialog","aria-modal":"false","aria-label":r.panelTitle,style:{position:"relative"},"data-testid":E.panel,children:[l(Ms,{...e,containerEl:o.current,dragOver:c}),l(Ns,{poweredBy:e.options.poweredBy})]})}function Ms(e){let{options:t,transport:n,feedback:r,bus:o,persistence:a,conversationId:i,composerKey:s,panelSize:c,view:p,canSend:d,isStreaming:_,isMemoryCompacting:u,canReleaseQueuedMessages:f,queueManualMessages:m,sendPreparing:h,controlMode:y,assignedOperatorInitials:x,operatorAvailable:S,operatorRequestEnabled:w,onRequestOperator:g,onCancelOperatorRequest:v,loadingMessages:k,onLoadPreviousMessages:C,messagesSig:T,agent:M,suggestions:N,initialWidgetSize:L,onClose:$,onBack:W,onClear:G,onToggleHistory:U,onSelectHistoryConversation:oe,onNewConversation:ae,onWidgetSizeChange:Te,onSend:ge,onStop:xe,onSuggestion:ct,activeForm:Le,formMarkers:Ze,onFormSubmit:Ve,onFormSkip:mt,onFormFill:At,tool:et,onRetry:dt,onMessageFeedback:Pt,containerEl:Ae,dragOver:Oe,composerApiRef:xt}=e,fe=t.strings,$e=Ct(()=>T.value.some(Ee=>!Ee.ephemeral&&Ee.role!=="system")).value,tt;return Le?tt=null:d?tt=l(_e,{children:[y&&y!=="ai-agent"?l(Wh,{controlMode:y,operatorInitials:x,operatorAvailable:S,onCancelOperatorRequest:v,strings:fe}):null,u&&y==="ai-agent"?l("div",{class:`${je}-loading ${je}-compaction-status`,role:"status","data-testid":E.compactionStatus,children:[l("span",{class:`${je}-loading-spinner`,"aria-hidden":"true"}),fe.compactingContext]}):null,!_&&!u&&y==="ai-agent"&&l(Op,{suggestions:N,onPick:ct,disabled:h}),l(Yd,{options:t,transport:n,feedback:r,bus:o,persistence:a,conversationId:i,isStreaming:_,isMemoryCompacting:u,canReleaseQueuedMessages:f,queueManualMessages:m,active:e.composerActive&&p==="chat",isPreparing:h,operatorRequestEnabled:w,canRequestOperator:$e,controlMode:y,onRequestOperator:g,onSend:ge,onStop:xe,apiRef:xt},s)]}):tt=l(Vh,{label:fe.conversationClosed,ctaLabel:fe.startNewConversation,onNewConversation:G}),l(_e,{children:[p==="history"?l(jh,{strings:fe,onBack:U,onClose:$,showClose:fa(t.mode,c,t.actions)}):l("header",{class:`${je}-header`,part:"header","data-testid":E.panelHeader,children:[W?l("button",{type:"button",class:`${je}-icon-btn`,onClick:W,"aria-label":fe.moduleBack,title:fe.moduleBack,children:l(Qr,{})}):null,M?l(ap,{agent:M,strings:fe}):l("h1",{children:fe.panelTitle}),l(Vt,{panelProps:e,variant:"chat"})]}),p==="history"?l(Aa,{transport:n,strings:fe,locale:t.locale,persistence:a,onSelect:oe,onNewConversation:ae}):l(_e,{children:[l(up,{visible:Oe,strings:fe}),l(Np,{messagesSig:T,strings:fe,responseMode:t.responseMode,showReasoning:t.showReasoning,showToolCalls:t.showToolCalls,showSources:t.showSources,enableMessageFeedback:t.enableMessageFeedback,onFeedback:Pt,loading:k,onLoadPreviousMessages:C,idle:!_&&!h&&d&&!Le,controlMode:y,tool:et,onRetry:dt,form:Le?{form:Le,onSubmit:Ve,onSkip:mt}:null,formMarkers:Ze,onFillForm:At}),tt,l(Kh,{disclaimer:t.composerDisclaimer})]}),t.size.resize?.enabled?l(Ba,{panelEl:Ae,resize:t.size.resize,position:t.position,initialSize:L,onSizeChange:Te,strings:fe}):null]})}function jh({strings:e,onBack:t,onClose:n,showClose:r}){return l("header",{class:`${je}-header`,part:"header",children:[l("button",{type:"button",class:`${je}-icon-btn`,onClick:t,"aria-label":e.historyBack,title:e.historyBack,children:l(Qr,{})}),l("h1",{children:e.historyTitle}),r?l("button",{type:"button",class:`${je}-icon-btn`,onClick:n,"aria-label":e.close,title:e.close,children:l(Dt,{})}):null]})}function Vh({label:e,ctaLabel:t,onNewConversation:n}){return l("div",{class:`${je}-readonly-banner`,role:"note",children:[l("span",{class:`${je}-readonly-label`,children:e}),l("button",{type:"button",class:`${je}-readonly-cta`,onClick:n,children:t})]})}function Wh({controlMode:e,operatorInitials:t,operatorAvailable:n,onCancelOperatorRequest:r,strings:o}){let a=Gh(e,t,n,o);return l("div",{class:`${je}-operator-banner`,role:"status","data-mode":e,"data-testid":E.operatorBanner,children:[l("span",{class:`${je}-operator-pulse`,"aria-hidden":"true"}),l("span",{class:`${je}-operator-label`,children:a}),e==="awaiting-operator"&&r?l("button",{type:"button",class:`${je}-cancel-operator-request`,"data-testid":E.cancelOperatorRequest,onClick:r,children:o.cancelOperatorRequest}):null]})}function Gh(e,t,n,r){return e==="operator"?r.chattingWithOperator.replace("{operator}",t??""):n===!1?r.noOperatorAvailable:r.connectingOperator}function Kh({disclaimer:e}){return e?l("div",{class:`${je}-composer-footer`,children:l("div",{class:`${je}-disclaimer`,children:e})}):null}function Ns({poweredBy:e}){return e?l("div",{class:`${je}-poweredby-bar`,children:l(Qh,{logoUrl:e.logoUrl,text:e.text,href:e.href})}):null}function Qh({logoUrl:e,text:t,href:n}){let r=l(_e,{children:[e?l("img",{class:`${je}-poweredby-logo`,src:e,alt:"",loading:"lazy"}):null,t?l("span",{children:t}):null]});return n?l("a",{class:`${je}-poweredby`,href:n,target:"_blank",rel:"noopener noreferrer",children:r}):l("span",{class:`${je}-poweredby`,children:r})}var qa=A.cssPrefix;function Bp({panelProps:e,enabledModules:t,nav:n,bus:r,hasUnread:o,latestNews:a,onSelectConversation:i,onStartNewConversation:s,onSetPanelSize:c}){let p=e.options,d=p.strings,_=D(null),u=D(new Set);F(()=>{let G=_.current;if(!G)return;let U=ya(G);function oe(ae){ae.key==="Escape"&&e.onClose?.()}return G.addEventListener("keydown",oe),()=>{U(),G.removeEventListener("keydown",oe)}},[e.onClose]);let f=Ct(()=>n.sig.value).value,m=Ju(f),h=p.modules.byId[f.activeTab],y=e.composerActive&&h?.layout==="chat"&&m===void 0,x=e.composerApiRef,S=y&&e.view==="chat"&&e.canSend&&!e.activeForm&&!e.sendPreparing&&e.options.features.fileUpload,w=B(G=>{S&&x.current?.attachFromDrop(G)},[x,S]),{visible:g}=Ua({containerRef:_,onDrop:w,disabled:!S});Fa(_.current,p.mode==="modal");let v=m?.kind==="iframe"||m?.kind==="content",k=t.length>1&&(Zu(f)||!v),C=D(null);F(()=>{if(v&&C.current===null)C.current=e.panelSize,e.panelSize==="normal"&&c("expanded");else if(!v&&C.current!==null){let G=C.current;C.current=null,c(G)}},[v]);let T={push:G=>n.push(G),pop:()=>n.pop(),switchTab:G=>n.switchTab(G),switchToLayout:G=>{let U=t.find(oe=>oe.layout===G);U&&n.switchTab(U.id)},selectConversation:i,startNewConversation:s};function M(G){return{options:p,transport:e.transport,strings:d,config:G,nav:T,bus:r,panelProps:e,latestNews:a}}let N=l(Vt,{panelProps:e,variant:"plain"});h&&u.current.add(h.id);let L=t.filter(G=>u.current.has(G.id));function $(G){if(G.layout==="chat")return l(Ms,{...e,composerActive:y,containerEl:_.current,dragOver:g});let U=Ta[G.layout].Root;return U?l(U,{...M(G)}):null}function W(){return m?.kind==="iframe"?l(op,{url:m.url,title:m.title,strings:d,onBack:()=>n.pop(),actions:N}):m?.kind==="content"?l(Fd,{id:m.id,title:m.title,transport:e.transport,strings:d,bus:r,onBack:()=>n.pop(),actions:N}):null}return l("div",{ref:_,class:`${qa}-panel ${qa}-messenger`,part:"panel",role:"dialog","aria-modal":"false","aria-label":d.panelTitle,style:{position:"relative"},"data-testid":E.messengerHome,children:[l("div",{class:`${qa}-messenger-body`,children:[L.map(G=>l("div",{class:`${qa}-messenger-pane`,hidden:v||G.id!==h?.id,children:$(G)},G.id)),W()]}),k?l(np,{modules:t,activeTab:f.activeTab,strings:d,hasUnread:o,onSelect:G=>n.switchTab(G)}):null,l(Ns,{poweredBy:p.poweredBy}),p.size.resize?.enabled&&!(h?.layout==="chat"&&!m)?l(Ba,{panelEl:_.current,resize:p.size.resize,position:p.position,initialSize:e.initialWidgetSize,onSizeChange:e.onWidgetSizeChange,strings:d}):null]})}var no=A.cssPrefix;function Fp({strings:e,onClose:t}){return l("div",{class:`${no}-panel ${no}-modules-empty`,part:"panel",role:"dialog","aria-label":e.panelTitle,"data-testid":E.modulesEmpty,children:[t?l("button",{type:"button",class:`${no}-icon-btn ${no}-modules-empty-close`,onClick:t,"aria-label":e.close,title:e.close,children:l(Dt,{})}):null,l("p",{class:`${no}-modules-empty-text`,children:e.modulesEmpty})]})}function Up(e){let t=A.cssPrefix,{site:n,blocks:r,strings:o,collapsed:a}=e,i=r?.navigation??[],s=r?.linkCards??[],c=a?o.expandSidebar:o.collapseSidebar;return l("aside",{class:`${t}-sidebar`,"data-collapsed":a?"true":"false","data-testid":E.sidebar,children:[l("div",{class:`${t}-sidebar-header`,children:[l(Yh,{site:n}),l("button",{type:"button",class:`${t}-sidebar-toggle`,"aria-label":c,"aria-expanded":a?"false":"true",title:c,onClick:e.onToggleCollapsed,"data-testid":E.sidebarToggle,children:l(Xh,{collapsed:a})})]}),a?null:l(_e,{children:[i.length>0?l("nav",{class:`${t}-sidebar-section`,"data-section":"navigation",children:l(Jh,{items:i})}):null,s.length>0?l("div",{class:`${t}-sidebar-section`,"data-section":"link-cards",children:l(Zh,{items:s})}):null,e.showConversations?l("div",{class:`${t}-sidebar-conversations`,children:l(Aa,{transport:e.transport,strings:e.strings,locale:e.locale,persistence:e.persistence,onSelect:e.onSelectConversation,onNewConversation:e.onNewConversation})}):null]})]})}function Yh({site:e}){let t=A.cssPrefix;if(e?.logo?.url){let n=e.logo.alt??e.title??"Logo";return l("picture",{children:[e.logoDark?.url?l("source",{srcset:e.logoDark.url,media:"(prefers-color-scheme: dark)"}):null,l("img",{class:`${t}-sidebar-logo`,src:e.logo.url,alt:n})]})}return l("div",{class:`${t}-sidebar-title`,children:e?.title??A.name})}function Xh({collapsed:e}){return l("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true",children:e?l("polyline",{points:"9 6 15 12 9 18"}):l("polyline",{points:"15 6 9 12 15 18"})})}function Jh({items:e}){let t=A.cssPrefix;return l("ul",{class:`${t}-sidebar-nav`,children:e.map(n=>l("li",{children:l("a",{class:`${t}-sidebar-nav-item`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[n.icon?l("span",{class:`${t}-sidebar-nav-icon`,"data-icon":n.icon}):null,l("span",{class:`${t}-sidebar-nav-label`,children:n.label})]})},n.id??n.label))})}function Zh({items:e}){let t=A.cssPrefix;return l("div",{class:`${t}-sidebar-cards`,children:e.map(n=>l("a",{class:`${t}-sidebar-card`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[l("div",{class:`${t}-sidebar-card-label`,children:n.label}),n.description?l("div",{class:`${t}-sidebar-card-desc`,children:n.description}):null]},n.id??n.label))})}var qp=A.cssPrefix;function zp(e){return l("main",{class:`${qp}-page-shell`,"data-sidebar-collapsed":e.sidebarCollapsed?"true":"false",children:[l(Up,{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}),l("section",{class:`${qp}-page-chat`,"aria-label":e.strings.panelTitle,children:e.children})]})}var Ls=le.scope("hitl");function Hp(e){let{streaming:t,controlModeSig:n,messagesSig:r,sendAiTurn:o,bus:a,humanInLoop:i}=e,s=D(t);s.current=t;let c=B((u,f,m)=>{if(s.current||n.value!=="ai-agent")return!1;let h=r.value.at(-1),y=h?.partsSig.value.findIndex(S=>S.kind==="tool"&&S.toolCallId===u)??-1,x=h?.partsSig.value[y];return!h||x?.kind!=="tool"?(Ls.warn("decideTool: tool part not found",{toolCallId:u}),!1):h.status!=="complete"||!ca(h,y)||!f(x)?!1:(m(x),h.partsSig.value=[...h.partsSig.value],An(h)&&(h.status="streaming",h.retryAction={kind:"continue-assistant",messageId:h.serverMessageId??h.id},h.awaitingContinuation=!0,r.value=[...r.value],o({continueExisting:!0})),!0)},[n,r,o]),p=B((u,f,m)=>{let h=!1;if(c(u,x=>x.stateSig.value==="approval-requested",x=>{h=Ma(x.toolName);let S=x.approvalSig.value?.id??u;x.approvalSig.value={id:S,approved:f,reason:m},x.stateSig.value="approval-responded"})){if(h){Ls.info("toolResult",{toolCallId:u}),a.emit("toolResult",{toolCallId:u});return}Ls.info("toolDecision",{toolCallId:u,approved:f}),a.emit("toolDecision",{toolCallId:u,approved:f})}},[a,c]),d=B(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:i,onDecision:p,onEdit:d}),[i,p,d])}}var eb=le.scope("latest-news");function jp({transport:e,options:t,persistence:n,enabled:r}){let o=t.modules.list.find(_=>_.layout==="news")?.contentCollectionIds,a=o?.join(","),[i,s]=z(),[c,p]=z(()=>n.loadSeenNewsId());F(()=>{if(!r||!o?.length)return;let _=!1;return e.listContent({contentCollectionIds:o,sortBy:"publishedAt",sortOrder:"desc",limit:1}).then(u=>{_||s(u.items[0])}).catch(u=>eb.debug("listContent (latest news) failed (non-fatal)",{err:u})),()=>{_=!0}},[e,r,a]);let d=B(_=>{n.saveSeenNewsId(_),p(_)},[n]);return{item:i,unseen:i!==void 0&&i.id!==c,markSeen:d}}function Vp({callout:e,persistence:t}){let n=e?.text??"",r=e?.persistent??!0,[o,a]=z(()=>r?!1:t.loadCalloutDismissed(n));F(()=>{a(r?!1:t.loadCalloutDismissed(n))},[n,r,t]);let i=B(()=>{a(!0),r||t.saveCalloutDismissed(n)},[t,n,r]);return{dismissed:o,dismissCallout:i}}function Wp(e){let{transport:t,conversationIdSig:n}=e,r=It("ai-agent"),o=It(void 0),a=It(void 0),i=D(void 0),s=B(_=>{let u=_.controlRevision,f=i.current;f&&f.conversationId===n.value&&u<f.revision||(i.current={conversationId:n.value,revision:u},r.value=_.controlMode,o.value=_.assignedOperatorInitials,_.controlMode!=="awaiting-operator"?a.value=void 0:_.operatorAvailable!==void 0&&(a.value=_.operatorAvailable))},[n,r,o,a]),c=B(_=>{if(_.type!=="data-control-state")return;let u=Cu(_.data);u&&s(u)},[s]),p=B(async()=>{let _=n.value,u=await t.requestOperator();u&&n.value===_&&s(u)},[t,n,s]),d=B(async()=>{let _=n.value,u=await t.cancelOperatorRequest();u&&n.value===_&&s(u)},[t,n,s]);return{controlModeSig:r,assignedOperatorInitialsSig:o,operatorAvailableSig:a,applyControlState:s,adoptControlStateChunk:c,requestOperator:p,cancelOperatorRequest:d}}var za=A.cssPrefix,Gp=`--${za}-visual-viewport-height`,Kp=`--${za}-visual-viewport-top`;function Qp(e){let{hostElement:t,mode:n,panelSize:r,isOpen:o,surfaceReady:a,setIsOpen:i}=e;wt(()=>{Eo(t,ma(n,r,o))},[t,o,r,n]),wt(()=>{if(!o||!a)return;let s=t.ownerDocument.defaultView,c=s?.visualViewport,p=t.shadowRoot?.querySelector(`.${za}-anchor`);if(!s||!c||!p)return;let d=()=>{p.style.setProperty(Gp,`${c.height}px`),p.style.setProperty(Kp,`${c.offsetTop}px`)},_=0,u=()=>{s.cancelAnimationFrame(_),_=s.requestAnimationFrame(()=>{_=s.requestAnimationFrame(d)})};return d(),c.addEventListener("resize",u),c.addEventListener("scroll",u),()=>{s.cancelAnimationFrame(_),c.removeEventListener("resize",u),c.removeEventListener("scroll",u),p.style.removeProperty(Gp),p.style.removeProperty(Kp)}},[t,o,a]),F(()=>{if(n!=="modal"||!o)return;function s(c){c.composedPath().some(d=>d instanceof HTMLElement&&d.classList.contains(`${za}-panel`))||i(!1)}return t.addEventListener("click",s),()=>t.removeEventListener("click",s)},[t,o,n,i]),F(()=>{if(n!=="drawer"||!o)return;function s(c){c.key==="Escape"&&i(!1)}return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[o,n,i])}var Os=le.scope("reducer"),Ha=class{constructor(t,n){ee(this,"messagesSig",t);ee(this,"onReconcileNeeded",n);ee(this,"active",null);ee(this,"openTextParts",new Map);ee(this,"partSeq",0);ee(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 r=en();r.id=t.id;let o=$n(t)||En(t)&&(t.status!=="streaming"||An(t)),a=t.status==="streaming"&&An(t)&&zr(t);this.replay={baseline:t,shadow:r,chunks:[n],probeContinuation:o,continuationTailReplay:a,liveCatchUp:t.status==="streaming"&&!o},this.attach(r),this.apply(n)}refreshReplayBaseline(){let t=this.replay;if(!t)return null;let n=t.shadow.serverMessageId??t.baseline.serverMessageId,r=this.messagesSig.value,o=r.at(-1),a=o===t.baseline||o?.id===t.baseline.id||n!==void 0&&o?.serverMessageId===n?o:r.find(s=>s===t.baseline)??r.find(s=>s.id===t.baseline.id||n!==void 0&&s.serverMessageId===n);if(!a)return this.detach(),null;if(a===t.baseline)return t;let i=t.baseline;return t.baseline=a,Yp(i,a),t.liveCatchUp&&$n(t.shadow)&&(a.status==="streaming"||En(a))?(t.probeContinuation=!1,t.continuationTailReplay=!1,t):(t.probeContinuation=$n(a)||En(a)&&(a.status!=="streaming"||An(a)),t.continuationTailReplay=a.status==="streaming"&&An(a)&&zr(a),t.liveCatchUp=a.status==="streaming"&&!t.probeContinuation,t)}refreshActive(){let t=this.active;if(!t)return null;let n=t.serverMessageId,r=this.messagesSig.value,o=r.at(-1),a=o===t||o?.id===t.id||n!==void 0&&o?.serverMessageId===n?o:r.find(s=>s===t)??r.find(s=>s.id===t.id||n!==void 0&&s.serverMessageId===n);if(!a)return this.detach(),null;if(a===t)return t;Yp(t,a);let i=$n(t)&&En(a);return a.status!=="streaming"&&!i?(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 $t(()=>{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:r}=this.replay,o=ua(n);return this.replay=null,$t(()=>{if(t){let a=n.partsSig.value.findLastIndex(i=>i.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 r)this.apply(a);n.continuationStreaming=o||void 0,this.messagesSig.value=[...this.messagesSig.value]}),n}settleOwnedContinuation(t){let{baseline:n}=this.replay,r=ua(n);return this.replay=null,$t(()=>{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=r||void 0,this.messagesSig.value=[...this.messagesSig.value]}),n}applyResume(t){if(t.type==="start"){let o=(this.replay?.baseline??this.active)?.serverMessageId;o!==void 0&&t.messageId!==void 0&&o!==t.messageId&&this.onReconcileNeeded?.({messageId:o}),this.detach();let a=t.messageId,i=a!==void 0?this.messagesSig.value.find(d=>d.serverMessageId===a||d.id===a):void 0;if(i!==void 0)return t.messageMetadata?.senderRole==="visitor"&&i.role==="user"&&(i.status==="pending"||i.status==="error")&&(i.serverMessageId=a,i.status="complete",i.errorText=void 0,i.retryAction=void 0,this.messagesSig.value=[...this.messagesSig.value]),this.beginReplay(i,t),null;let s=t.messageMetadata?.senderRole,c=this.messagesSig.value.at(-1);if(s===void 0&&c?.role==="assistant"&&c.status==="streaming"&&c.serverMessageId===void 0&&!qt(c))return this.attach(c),this.apply(t),null;let p=en();return this.attach(p),this.messagesSig.value=[...this.messagesSig.value,p],this.apply(t),null}if(this.replay){let r=this.refreshReplayBaseline();if(!r)return null;r.chunks.push(t),t.type==="data-control-state"&&(r.baseline.operatorRoutedTurn=t.data.controlMode!=="ai-agent"),this.apply(t);let{baseline:o,shadow:a,probeContinuation:i,continuationTailReplay:s,liveCatchUp:c}=r,p=t.type==="finish"||t.type==="error"||t.type==="abort";if(i){if(!rb(o,a,t))return p&&(sb(o,a)&&(o.continuationStreaming=!0,this.messagesSig.value=[...this.messagesSig.value],this.onReconcileNeeded?.({messageId:o.serverMessageId??o.id})),this.detach()),null;let _=$n(o)&&p?this.settleOwnedContinuation(t):this.promoteContinuation();return p?(_.continuationStreaming&&(t.type==="finish"?this.onReconcileNeeded?.({messageId:_.serverMessageId??_.id}):_.continuationStreaming=!1),this.detach(),_):null}if(s&&nb(o,a)){let _=this.promoteContinuation(!0);return p?(this.detach(),_):null}if(!c)return p&&this.detach(),null;if(p&&!qt(o)&&qt(a)){let _=this.promoteReplay();return this.detach(),_}if(!tb(o,a))return p&&(this.onReconcileNeeded?.({messageId:o.serverMessageId??o.id}),this.detach()),null;let d=this.promoteReplay();return p?(this.detach(),d):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 r=n;return r.continuationStreaming&&(t.type==="finish"?this.onReconcileNeeded?.({messageId:r.serverMessageId??r.id}):r.continuationStreaming=!1),this.detach(),r}return null}ensureTextPart(t,n,r){let o=`${n}:${r}`,a=this.openTextParts.get(o);if(a)return a;let i={kind:n,id:`${r}#${this.partSeq++}`,textSig:re(""),doneSig:re(!1)};return this.openTextParts.set(o,i),ro(t,i),i}apply(t){let n=this.active;if(n)switch(t.type){case"start":{t.messageId&&(n.serverMessageId=t.messageId);let r=t.messageMetadata;r?.senderRole==="operator"?(n.role="operator",r.operatorInitials&&(n.operatorInitials=r.operatorInitials)):r?.senderRole==="visitor"&&(n.role="user");return}case"finish-step":this.openTextParts.clear();return;case"start-step":ro(n,{kind:"step-start",id:`ss-${this.partSeq++}`});return;case"finish":Os.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":Os.warn("stream error chunk",{errorText:t.errorText}),n.status="error",n.errorText=t.errorText,this.bumpDone(n);return;case"abort":Os.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 r=this.ensureTextPart(n,"text",t.id);r.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 r=this.ensureTextPart(n,"reasoning",t.id);r.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":lb(n,t);return;case"file":ro(n,{kind:"file",url:t.url,mediaType:t.mediaType});return;case"source-url":Xp(n,{kind:"source",sourceId:t.sourceId,url:t.url,title:t.title});return;case"source-document":Xp(n,{kind:"source",sourceId:t.sourceId,title:t.title,filename:t.filename,mediaType:t.mediaType});return;case"data-suggestions":n.suggestions=sa(t.data);return;case"data-control-state":n.operatorRoutedTurn=t.data.controlMode!=="ai-agent";return;case"data-memory-compaction-state":return;default:{let r=t}}}bumpDone(t){$t(()=>{t.partsSig.value=[...t.partsSig.value],this.messagesSig.value.includes(t)&&(this.messagesSig.value=[...this.messagesSig.value])})}},$s={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function $n(e){return e.awaitingContinuation===!0||e.continuationStreaming===!0||e.retryAction?.kind==="continue-assistant"}function Yp(e,t){e.canceled&&(t.canceled=!0),!(!$n(e)||t.status!=="streaming"&&!En(t))&&(t.awaitingContinuation??(t.awaitingContinuation=e.awaitingContinuation),t.continuationStreaming??(t.continuationStreaming=e.continuationStreaming),t.retryAction===void 0&&(t.retryAction=e.retryAction))}function tb(e,t){let n=e.partsSig.value,r=t.partsSig.value;return e.role!==t.role||r.length<n.length?!1:n.every((o,a)=>Jp(o,r[a]))}function nb(e,t){let n=e.partsSig.value,r=n.findLastIndex(s=>s.kind==="tool"),o=new Set(n.slice(0,r+1).flatMap(s=>s.kind==="tool"?[s.toolCallId]:[])),a=t.partsSig.value.filter(s=>s.kind!=="tool"||!o.has(s.toolCallId)),i=n.slice(r+1);return a.length<i.length?!1:i.every((s,c)=>Jp(s,a[c]))}function Jp(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||!da(t.toolName,e.toolName)||$s[t.stateSig.value]<$s[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 rb(e,t,n){return ob(e,n)||!ab(e,t)?!0:n.type!=="finish"&&n.type!=="error"&&n.type!=="abort"?!1:zr(t)||e.awaitingContinuation===!0&&n.type!=="finish"?!0:e.awaitingContinuation===!0&&t.partsSig.value.every(r=>r.kind==="step-start")}function ob(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(r=>r.kind==="tool"&&r.toolCallId===t.toolCallId);return n!==void 0&&$s[n.stateSig.value]<4}function ab(e,t){let n=t.partsSig.value;if(n.length===0)return!0;let r=e.partsSig.value;return r.some((o,a)=>n.every((i,s)=>ib(r[a+s],i)))}function ib(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"||da(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 sb(e,t){if($n(e)||!En(e))return!1;let n=new Set(e.partsSig.value.filter(o=>o.kind==="tool").map(o=>o.toolCallId));return!t.partsSig.value.some(o=>o.kind==="tool"&&n.has(o.toolCallId))}function gn(e,t,n,r){let o=e.partsSig.value.find(i=>i.kind==="tool"&&i.toolCallId===t);if(o)return r&&(o.dynamic=!0),o;let a={kind:"tool",toolCallId:t,toolName:n??"tool",dynamic:r?!0:void 0,inputPartialSig:re(""),inputSig:re(void 0),outputSig:re(void 0),errorSig:re(void 0),stateSig:re("input-streaming"),approvalSig:re(void 0)};return ro(e,a),a}function ro(e,t){e.partsSig.value=[...e.partsSig.value,t]}function Xp(e,t){e.partsSig.value.some(n=>n.kind==="source"&&n.sourceId===t.sourceId)||ro(e,t)}function lb(e,t){switch(t.type){case"tool-input-start":gn(e,t.toolCallId,t.toolName,t.dynamic);return;case"tool-input-delta":{let n=gn(e,t.toolCallId);n.inputPartialSig.value+=t.inputTextDelta;return}case"tool-input-available":{let n=gn(e,t.toolCallId,t.toolName,t.dynamic);n.inputSig.value=t.input,n.stateSig.value="input-available";return}case"tool-input-error":{let n=gn(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=gn(e,t.toolCallId,t.toolName);n.approvalSig.value={id:t.approvalId},n.stateSig.value="approval-requested";return}case"tool-output-available":{let n=gn(e,t.toolCallId,void 0,t.dynamic);n.outputSig.value=t.output,n.stateSig.value="output-available";return}case"tool-output-error":{let n=gn(e,t.toolCallId,void 0,t.dynamic);n.errorSig.value=t.errorText,n.stateSig.value="output-error";return}case"tool-output-denied":{let n=gn(e,t.toolCallId);n.stateSig.value="output-denied";return}default:return}}async function Zp(e){let t=1e3,n=!1,r=!1,o=!1;function a(){o||e.signal.aborted||(o=!0,e.onInitialBoundaryReady())}for(;!e.signal.aborted;){let i,s="held";try{s=await e.connect(()=>{if(e.signal.aborted)return;i=e.now();let c=n||r;n=!0,r=!1,o?c&&e.backfill():a()})}catch{}if(e.signal.aborted||(!n&&i===void 0&&(r=!0,a()),s==="unavailable"))return;i!==void 0&&e.now()-i>=1e3&&(t=1e3),await e.sleep(t),t=Math.min(t*2,15e3)}}var cb=120;function e_(e){let{activated:t,conversationReady:n,conversationIdSig:r,messagesSig:o,optionsRef:a,transport:i,visitorId:s,adoptControlStateChunk:c,adoptMemoryCompactionStateChunk:p,settleSuggestions:d,recordConversationReply:_,transcriptRecoverySig:u,beginConversationTranscript:f,commitConversationTranscript:m,onReplyLanded:h,runCancellation:y,canContinueRef:x,setCanSend:S,feedback:w,bus:g,loadInitialThread:v,shouldReconcileOnConnect:k}=e,C=D(0);F(()=>{if(!t||!n||!r.value)return;let T=r.value,M=new AbortController,N=b=>{},L=new Ha(o,b=>N(b));i.primeIdentity(s,T);let $=!1,W=!1,G,U=!1,oe,ae=0,Te=x.current,ge,xe,ct=Date.now(),Le,Ze=!1,Ve=!1;function mt(b,q,K){if(!qt(b))return;let J=o.value.findLast(we=>!we.ephemeral),se=b.serverMessageId??b.id;if(!(J&&(J.serverMessageId??J.id)!==se))return la(o.value,b,T,a.current.strings.newConversation,q,K)}function At(b,q,K,J){let se=mt(b,q,J);if(!se)return;let Ce=`${b.serverMessageId??b.id}:${K}:${se.preview??""}`;Ce!==xe&&(xe=Ce,i.publishConversation({...se,hasUnread:!0},!0))}let et;function dt(){et&&(clearTimeout(et.timer),et=void 0)}function Pt(){let b=et;if(!b)return;clearTimeout(b.timer),et=void 0;let q=o.value.find(K=>(K.serverMessageId??K.id)===b.replyId);q?.role!=="assistant"&&q?.role!=="operator"||At(q,b.canContinue,b.generation,b.activityAt)}function Ae(b,q,K,J){dt(),et={replyId:b.serverMessageId??b.id,canContinue:q,generation:K,activityAt:J,timer:setTimeout(Pt,cb)}}function Oe(b,q,K,J=Date.now(),se=!0){dt();let we=mt(b,q,J);if(!we)return;let ve=`${b.serverMessageId??b.id}:${K}`;ve!==ge&&(ge=ve,_(we),se&&Le&&(Ze=!0))}function xt(b,q){(b||!y.localSendRef.current)&&y.settle(q),b&&h()}function fe(b,q=[],K=!1,J,se=Te,we=ae,Ce=Date.now(),ve=!0){let nt=a.current;if(b.canceled){Oe(b,se,we,Ce,ve),xt(K,J);return}let ce=!0,pt=b.status==="error";switch($u(b,pt)){case"drop":o.value=o.value.filter(O=>O!==b),ce=!1;break;case"complete-operator-routed":b.status="complete",K&&(w.play("messageReceived"),or(g,nt,"assistant",He(b)));break;case"error":{if(b.status="error",b.errorText=nt.strings.errorGeneric,K){w.play("error");let O=new Error(pt?"stream error chunk":"empty reply");g.emit("error",O),nt.onError?.(O)}break}case"complete":b.status="complete",K&&(w.play("messageReceived"),or(g,nt,"assistant",He(b))),d(b,q);break}ce&&Oe(b,se,we,Ce,ve),xt(K,J)}function $e(b){if(M.signal.aborted||r.value!==T)return;if(c(b),p?.(b),b.type==="start"){Pt();let O=b.messageId===void 0?void 0:o.value.find(X=>X.serverMessageId===b.messageId||X.id===b.messageId);U=O!==void 0&&O.status!=="streaming";let Y=oe?.senderRole==="visitor"?oe.messageId:void 0;if(oe={messageId:b.messageId,senderRole:b.messageMetadata?.senderRole},ae+=1,ct=Date.now(),xe=void 0,$=b.messageMetadata?.senderRole===void 0,W=!1,G=$?b.messageMetadata?.runId:void 0,$){let X=b.messageId!==void 0&&o.value.some(zt=>zt.serverMessageId===b.messageId||zt.id===b.messageId),ue=o.value.at(-1),rt=b.messageId!==void 0&&(ue?.serverMessageId===b.messageId||ue?.id===b.messageId),Mt=y.localSendRef.current&&(!X||rt)&&ue?.role==="assistant"&&ue.status==="streaming"&&(rt||ue.serverMessageId===void 0&&ue.partsSig.value.length===0);W=y.captureStart(T,b,Mt,Y)}}let q=$&&(b.type==="finish"||b.type==="error"||b.type==="abort"),K=q?G:void 0,J=q&&(W||y.ownsLocalRun(K)),se=ae,we=U;b.type==="finish"&&b.canContinue!==void 0&&(Te=b.canContinue);let Ce=Te;q&&($=!1,W=!1,G=void 0);let ve=L.applyResume(b),nt=oe?.messageId,ce=nt===void 0?void 0:o.value.find(O=>O.serverMessageId===nt||O.id===nt);U&&oe?.senderRole!=="visitor"&&(ve!==null||ce?.status==="streaming")&&(U=!1,we=!1);let pt=!U&&(ce?.role==="assistant"||ce?.role==="operator");if(b.type==="text-delta"&&pt&&Ae(ce,Te,ae,ct),b.type==="text-end"&&(dt(),pt&&At(ce,Te,ae,ct)),b.type==="finish"&&b.canContinue===!1&&S(!1),!ve){q&&(J||!y.localSendRef.current)&&y.settle(K);return}if(ve.role==="operator"){we||(w.play("messageReceived"),or(g,a.current,"operator",He(ve))),Oe(ve,Ce,se,ct),U=!1,q&&(J||!y.localSendRef.current)&&y.settle(K);return}ve.role==="assistant"&&(fe(ve,[],J,K,Ce,se,ct),U=!1)}async function tt(b){let q=ae,K=await i.loadConversation(T,b?{ids:[b]}:void 0).catch(()=>null);if(M.signal.aborted||r.value!==T||!K)return!1;K.controlState&&c({type:"data-control-state",data:K.controlState});let J=o.value.at(-1),se=q===ae&&(b===void 0||J!==void 0&&(J.serverMessageId===b||J.id===b));if(K.messages.length===0)return!0;se&&(Te=K.canContinue,S(Te));let we=o.value,Ce=b===void 0?we.at(-1):we.find(X=>X.serverMessageId===b||X.id===b),{messages:ve,changed:nt}=Hr(we,pn(K.messages));if(!nt)return!0;o.value=ve;let ce=b===void 0?ve.at(-1):ve.find(X=>X.serverMessageId===b||X.id===b),pt=Ce!==void 0&&ce!==void 0&&(Ce.id===ce.id||Ce.serverMessageId!==void 0&&Ce.serverMessageId===ce.serverMessageId),O=ce!==void 0&&ce.status!=="streaming"&&(!pt||Ce?.status==="streaming"),Y=pt&&Ce?.status==="streaming"?Date.now():ce?.createdAt;return se&&O&&ce.role==="assistant"?fe(ce,ce.suggestions??[],y.localSendRef.current,void 0,K.canContinue,q,Y,!1):se&&O&&ce.role==="operator"?Oe(ce,K.canContinue,q,Y,!1):se&&ce?.role==="assistant"&&ce.status!=="streaming"&&d(ce,ce.suggestions??[]),!0}let Ee=new Set;N=({messageId:b})=>{if(Ee.has(b)||!o.value.some(K=>K.serverMessageId===b||K.id===b))return;Ee.add(b);function q(){return Ee.delete(b)}tt(b).then(q,q)};function gt(b=!1){if(M.signal.aborted||r.value!==T){Ze=!1;return}if(Le){Ze=!0;return}let q=b?v(T)??(k()?tt():void 0):tt();if(!q)return;f(T),Le=q;function K(J=!1){if(Le===q){if(Le=void 0,Ze){Ze=!1,gt();return}J&&m(T)}}q.then(K,()=>K(!1))}let Et=u.subscribe(b=>{b<=C.current||(C.current=b,Ve&&gt())});return Zp({signal:M.signal,now:()=>performance.now(),sleep:b=>jr(b,M.signal),connect:b=>i.connectResumeStream({signal:M.signal,onChunk:$e,onConnected:b}),onInitialBoundaryReady:()=>{Ve=!0,gt(!0)},backfill:()=>gt()}),()=>{M.abort(),dt(),Et(),L.detach()}},[t,n,r,r.value,s,i,c,p,d,_,u,f,m,h,y,x,S,o,g,w,v,k])}var ub=32;function t_(e){let{transport:t,setStreaming:n}=e,r=D(void 0),o=D(void 0),a=D(!1),i=D(void 0),s=D(!1),c=D(new Map),p=D(new Set),d=B((v,k)=>{let C=`${v}:${k}`;i.current!==C&&(i.current=C,t.cancelTurn(v,k))},[t]),_=B(v=>{r.current=void 0,o.current=v,a.current=!1,i.current=void 0,s.current=!0,n(!0)},[n]),u=B((v,k)=>{c.current.set(v,{messageId:k})},[]),f=B(v=>{v!==void 0&&(p.current.add(v),p.current.size>ub&&p.current.delete(p.current.values().next().value)),!(v!==void 0&&r.current?.runId!==v)&&(r.current=void 0,o.current=void 0,a.current=!1,s.current=!1,n(!1))},[n]),m=B((v,k)=>o.current!==v?k.runId&&r.current?.runId===k.runId?(r.current={conversationId:k.conversationId,runId:k.runId},a.current&&d(k.conversationId,k.runId),!0):!1:(o.current=void 0,k.runId?(r.current={conversationId:k.conversationId,runId:k.runId},n(!0),a.current&&d(k.conversationId,k.runId),!0):(f(),!0)),[d,n,f]),h=B((v,k)=>{let C=c.current.get(v);return C?(c.current.delete(v),!k.runId||p.current.has(k.runId)?!0:C.runId!==void 0?(C.runId!==k.runId||r.current?.runId===k.runId&&(r.current={conversationId:k.conversationId,runId:k.runId},a.current&&d(k.conversationId,k.runId)),!0):(s.current||o.current||(r.current={conversationId:k.conversationId,runId:k.runId},o.current=void 0,a.current=!1,i.current=void 0,s.current=!0,n(!0)),!0)):!1},[d,n]),y=B(v=>o.current!==v?!1:(f(),!0),[f]),x=B(v=>{let k=c.current.get(v);return k?(c.current.delete(v),k.runId===void 0):!1},[]),S=B((v,k,C,T)=>{let M=k.messageMetadata?.runId;if(k.messageMetadata?.senderRole!==void 0||typeof M!="string"||!M||p.current.has(M))return!1;if(r.current?.runId===M)return s.current;if(s.current)return r.current||!C?!1:(o.current=void 0,r.current={conversationId:v,runId:M},n(!0),a.current&&d(v,M),!0);let L=[...c.current.values()].filter($=>$.runId===void 0).find($=>$.messageId===T);return L?(L.runId=M,r.current={conversationId:v,runId:M},o.current=void 0,a.current=!1,i.current=void 0,s.current=!0,n(!0),!0):(o.current=void 0,r.current={conversationId:v,runId:M},n(!0),a.current&&d(v,M),s.current)},[d,n]),w=B(v=>typeof v=="string"&&r.current?.runId===v&&s.current,[]),g=B(()=>{let v=r.current;if(v)return a.current=!0,d(v.conversationId,v.runId),!0;let k=o.current;return k?(a.current=!0,k.then(C=>{C.runId&&d(C.conversationId,C.runId)}).catch(()=>{}),!0):!1},[d]);return ie(()=>({localSendRef:s,begin:_,beginRouted:u,acceptAck:m,acceptRoutedAck:h,reject:y,rejectRouted:x,captureStart:S,ownsLocalRun:w,settle:f,stop:g}),[m,h,_,u,S,w,y,x,f,g])}var db=le.scope("send");function r_(e,t,n,r,o,a=!0){e.publishConversation({...la(t,n,r,o,a),hasUnread:!1},!0)}function o_(e,t){return e.id===t.id||(e.serverMessageId??e.id)===(t.serverMessageId??t.id)}function a_(e){return e.findLast(t=>!t.ephemeral&&t.role!=="system"&&(t.role==="user"||t.status!=="streaming"||qt(t)))}function oo(e,t,n,r,o){let a=a_(t);a?.role!=="user"||!o_(a,n)||r_(e,t,a,r,o)}function n_(e){return!(e instanceof it)||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 i_(e){let{transport:t,messagesSig:n,conversationIdSig:r,options:o,bus:a,feedback:i,persistence:s,visitorId:c,adoptConversationId:p,applyControlState:d,setCanSend:_,settleSuggestions:u,runCancellation:f}=e,m=B(()=>{let x=r.value??kt();return r.value||(r.value=x,s.saveConversationId(x)),x},[r,s]),h=B(async({continueExisting:x,turn:S})=>{let w=m(),g=n.value.at(-1),v=S?[S]:Au(n.value,x),k=v[0],C=rs({messages:v.map(ss),conversationId:w,visitorId:c,userPrefs:s.loadUserPrefs()}),T=t.sendTurn(C);f.begin(T);try{let M=await T;if(r.value!==w||!f.acceptAck(T,M))return!1;if(p(M.conversationId),M.runId&&k?.role==="user"&&oo(t,n.value,k,M.conversationId,o.strings.newConversation),!M.runId){let N=await t.loadConversation(M.conversationId).catch(()=>null);if(r.value!==M.conversationId)return!0;if(N){N.controlState&&d(N.controlState),_(N.canContinue);let L=pn(N.messages),{messages:$,changed:W}=Hr(n.value,L);W&&(n.value=$);let G=L.findLast(ae=>!ae.ephemeral&&ae.role!=="system"),U=a_(n.value);U&&G&&o_(U,G)&&r_(t,n.value,U,M.conversationId,o.strings.newConversation,N.canContinue);let oe=g?n.value.find(ae=>ae.id===g.id&&ae.role==="assistant"&&ae.status!=="streaming"):void 0;oe&&u(oe,oe.suggestions??[]),!x&&g?.role==="assistant"&&n.value.includes(g)&&g.serverMessageId===void 0&&!qt(g)&&(n.value=n.value.filter(ae=>ae!==g))}else g?.role==="assistant"&&n.value.includes(g)&&(g.status="error",g.errorText=o.strings.errorGeneric,x?g.retryAction={kind:"continue-assistant",messageId:g.serverMessageId??g.id}:g.retryAction=k?.role==="user"?{kind:"resend-user",messageId:k.id}:null,n.value=[...n.value])}return!0}catch(M){if(r.value!==w)return!1;if(!f.reject(T))return k?.role==="user"&&oo(t,n.value,k,w,o.strings.newConversation),!0;let N=Ln(M,o.strings),L=n_(M),$=S?.role==="assistant"?S:n.value.at(-1);if(x&&$?.role==="assistant"&&M instanceof it&&M.status===409){let W=$.serverMessageId??$.id,G=await t.loadConversation(w,{ids:[W]}).catch(()=>null);if(r.value!==w)return!1;if(G){G.controlState&&d(G.controlState),_(G.canContinue);let U=pn(G.messages),oe=U.find(ae=>(ae.serverMessageId??ae.id)===W);if(oe&&Lu($,oe)){let{messages:ae,changed:Te}=Hr(n.value,U),ge=ae.find(xe=>(xe.serverMessageId??xe.id)===W);if(Te&&ge&&ge!==$)return ge.awaitingContinuation=!1,ge.continuationStreaming=void 0,ge.retryAction=null,n.value=ae,ge.status!=="streaming"&&u(ge,ge.suggestions??[]),!0}}if(!n.value.includes($)||$.status!=="streaming")return!1;$.continuationStreaming=!0}if(x&&$?.role==="assistant")$.status="error",$.errorText=N,$.retryAction=L?{kind:"continue-assistant",messageId:$.serverMessageId??$.id}:null,n.value=[...n.value];else if(g?.role==="assistant"&&n.value.includes(g)){g.status="error",g.errorText=N;let W=v[0];g.retryAction=L&&W?.role==="user"?{kind:"resend-user",messageId:W.id}:null,n.value=[...n.value]}else{let W=en();W.status="error",W.errorText=N;let G=v[0];W.retryAction=L&&G?.role==="user"?{kind:"resend-user",messageId:G.id}:null,n.value=[...n.value,W]}return i.play("error"),a.emit("error",M),o.onError?.(M),!1}},[t,n,o,a,i,s,c,p,d,_,u,m,f]),y=B(async x=>{let S=m();x.status="pending",x.errorText=void 0,x.retryAction=void 0,n.value.includes(x)&&(n.value=[...n.value]);let w=rs({messages:[ss(x)],conversationId:S,visitorId:c,userPrefs:s.loadUserPrefs()}),g=t.sendTurn(w);f.beginRouted(g,x.id);try{let v=await g;return r.value!==S?(f.rejectRouted(g),!1):f.acceptRoutedAck(g,v)?(p(v.conversationId),oo(t,n.value,x,v.conversationId,o.strings.newConversation),x.status==="pending"&&(x.status="complete",n.value.includes(x)&&(n.value=[...n.value])),!0):!1}catch(v){let k=f.rejectRouted(g);if(r.value!==S)return!1;if(!k)return oo(t,n.value,x,S,o.strings.newConversation),x.status==="pending"&&(x.status="complete",n.value.includes(x)&&(n.value=[...n.value])),!0;if(x.status!=="pending")return oo(t,n.value,x,S,o.strings.newConversation),!0;db.debug("operator-routed send failed",{error:v});let C=v instanceof Error?v:new Error(String(v));return x.status="error",x.errorText=Ln(v,o.strings),x.retryAction=n_(v)?{kind:"resend-user",messageId:x.id}:null,n.value.includes(x)&&(n.value=[...n.value]),i.play("error"),a.emit("error",C),o.onError?.(C),!1}},[t,n,o,a,i,s,c,p,m,f]);return{sendAiTurn:h,sendRoutedTurn:y}}var pb=le.scope("unread");function s_(e){let{transport:t,options:n,conversationIdSig:r,isConversationVisibleRef:o,activated:a,conversationReady:i}=e,s=It(!1),c=It(0),p=It(0),d=D([]),_=D(void 0),u=D(!1),f=B(()=>{let k=r.value,C=o.current()&&_.current===k?k:void 0,T=d.current.filter(M=>M.hasUnread&&M.conversationId!==C).length;c.value=T,s.value=T>0},[r,s,c,o]),m=B(k=>{let C=r.value,T=d.current.find($=>$.conversationId===C),M=tn(d.current,k),N=M.find($=>$.conversationId===C),L=k.type==="snapshot"&&C!==void 0&&N?.hasUnread===!0&&_.current===C&&T!==void 0&&T.lastMessageAt!==N.lastMessageAt;L&&(_.current=void 0),d.current=M,f(),L&&(p.value+=1)},[r,f,p]),h=B(()=>{if(f(),!o.current())return;let k=r.value;if(!k||_.current!==k)return;let C=d.current.find(T=>T.conversationId===k);C?.hasUnread&&t.markRead(k,C.lastMessageAt)},[r,o,f,t]),y=B(k=>{r.value===k&&(_.current=void 0,f())},[r,f]),x=B(k=>{r.value===k&&(_.current=k,h())},[r,h]),S=B(k=>_.current===k,[]),w=B((k=!1)=>{n.modules.list.some(C=>C.layout==="chat")&&(u.current||(u.current=!0,t.listConversations({limit:50},k).then(C=>{k||m({type:"snapshot",result:C,requestedRevision:0}),h()}).catch(C=>pb.debug("refreshUnread failed (non-fatal)",{err:C})).finally(()=>{u.current=!1})))},[m,h,n.modules,t]),g=B(k=>{let C=k.conversationId,T=o.current()&&r.value===C&&_.current===C,M=d.current.find(L=>L.conversationId===C),N=T&&(M?.lastMessageAt!==k.lastMessageAt||M.hasUnread);t.publishConversation({...k,hasUnread:!T},!0),N&&t.markRead(C,k.lastMessageAt)},[r,o,t]);F(()=>t.subscribeConversationChanges(m),[m,t]);let v=D(!1);return F(()=>{!a||!i||v.current||(v.current=!0,w())},[a,i,w]),F(()=>{if(!a)return;function k(){document.visibilityState==="visible"&&(h(),w(!0))}return document.addEventListener("visibilitychange",k),()=>document.removeEventListener("visibilitychange",k)},[a,h,w]),{hasUnreadSig:s,unreadCountSig:c,transcriptRecoverySig:p,markVisibleConversationRead:h,beginConversationTranscript:y,commitConversationTranscript:x,isConversationTranscriptCommitted:S,recordConversationReply:g}}var ao=le.scope("settings");function l_(e){let{options:t,persistence:n,transport:r,feedback:o,hostElement:a,bus:i}=e,s=n.loadUserPrefs(),[c,p]=z(()=>s.locale??t.locale),[d,_]=z(s.themeMode),u=d??t.themeMode,[f,m]=z(()=>s.textSize??t.textSize),h=B(v=>{n.patchUserPrefs(v),r.saveUserPrefs(n.loadUserPrefs()).catch(k=>ao.warn("saveUserPrefs failed",{err:k}))},[n,r]);F(()=>{s.soundMuted!==void 0&&o.setMuted(s.soundMuted)},[]),F(()=>{if(u!=="host"){a.dataset.theme=u;return}return ac(v=>{a.dataset.theme=v})},[a,u,t]),F(()=>{a.dataset.textSize=f},[a,f,t]),F(()=>{let v=!0;return o.mutedSig.subscribe(k=>{if(v){v=!1;return}h({soundMuted:k})})},[o,h]);let y=Wn(c,t.availableLocales,t.defaultLocale);F(()=>{r.setLocale(y)},[r,y]),F(()=>{a.dir=wl(y)?"rtl":"ltr"},[a,y]),F(()=>{y!==c&&p(y)},[y,c]);let x=B(v=>{ao.info("localeChange",{locale:v}),p(v),h({locale:v}),i.emit("localeChange",v)},[h,i]),S=B(v=>{ao.info("themeChange",{mode:v}),_(v),a.dataset.theme=v,h({themeMode:v}),i.emit("themeChange",v)},[a,h,i]),w=B(v=>{ao.info("textSizeChange",{size:v}),m(v),a.dataset.textSize=v,h({textSize:v}),i.emit("textSizeChange",v)},[a,h,i]),g=B(()=>{o.toggleMuted();let v=o.mutedSig.value;ao.info("soundToggle",{muted:v}),i.emit("soundToggle",{muted:v})},[o,i]);return{activeLocale:c,activeThemeMode:u,activeTextSize:f,effectiveLocale:y,setActiveLocale:p,setActiveThemeMode:_,setActiveTextSize:m,patchAndSync:h,handleLocaleChange:x,handleThemeChange:S,handleTextSizeChange:w,handleSoundToggle:g}}var be=le.scope("app"),ja=A.cssPrefix,_b={home:"home",chats:"chat",help:"help",news:"news"};function c_(e,t){return Tu({...e,text:ht(t,e.text)})}function u_({options:e,hostElement:t,bus:n}){let r=e.aiAgentDeploymentId;if(!r)throw new Error("aiAgentDeploymentId is required");let[o]=z(()=>Gn(e.widgetId,e.storage,e.aiAgentDeploymentId)),[a]=z(()=>o.getVisitorId()),i=o.loadUserPrefs(),s=It(o.loadConversationId()),c=D(s.value!==void 0),p=It(s.value??""),d=It([]),[_,u]=z(!1),f=D(void 0),[m,h]=z([]);function y(){let P=e.modules.list,I=new Set(P.map(j=>j.id)),Q=o.loadActiveModule();return Q&&I.has(Q)?Q:P[0]?.id??""}function x(){return e.modules.list.find(P=>P.layout==="chat")?.id}function S(){let P=x();return P?e.modules.list.length===1?!0:g.sig.value.activeTab===P:!1}let w=D(void 0);if(!w.current){let P=e.modules.list.map(Q=>Q.id),I=o.loadActiveModule()??P[0]??"";w.current=Yu(I,I?[...P,I]:P,Q=>o.saveActiveModule(Q))}let g=w.current,v=Ct(()=>g.sig.value.activeTab).value,k=Ct(()=>s.value).value,[C,T]=z(!1),[M,N]=z(null),[L,$]=z(!1),W=e.mode==="standalone"||e.mode==="inline",G=D(Gr(e,ar(),o.loadPanelOpen(),o.loadPanelSize())),[U,oe]=z(G.current.panelOpen),[ae,Te]=z(G.current.panelOpen),ge=D(void 0),xe=D(void 0),ct=D(!1),Le=D(void 0);F(()=>{U&&Te(!0)},[U]);let Ze=D(!1),[Ve,mt]=z(!1),{dismissed:At,dismissCallout:et}=Vp({callout:e.launcher.callout,persistence:o}),dt=e.launcher.callout?.persistent??!0,Pt=B(()=>{be.info("calloutDismiss"),n.emit("calloutDismiss",void 0),et()},[n,et]),[Ae,Oe]=z(G.current.panelSize),xt=D(!1),[fe,$e]=z("chat"),tt=D(()=>!1);tt.current=()=>U&&fe==="chat"&&!document.hidden&&S();let[Ee,gt]=z(!0),Et=D(Ee);Et.current=Ee;let[b,q]=z(!1),K=D(b);K.current=b;let J=D(null),[se,we]=z(!1),[Ce,ve]=z(null),[nt,ce]=z([]),pt=D(e.strings),O=D(e);O.current=e;let[Y,X]=z(void 0),[ue,rt]=z(void 0),[Mt,zt]=z(()=>o.loadSidebarCollapsed()??!1),[vt,vn]=z({}),[de]=z(()=>new _a({agentApiBaseUrl:e.agentApiBaseUrl,dataApiBaseUrl:e.dataApiBaseUrl,auth:Mc({publicKey:e.publicKey,aiAgentDeploymentId:r,publicKeyHeader:"x-public-key"}),endpoints:e.endpoints})),[Rt]=z(()=>new Ho(e.sound,e.haptics)),nn=t_({transport:de,setStreaming:q}),{activeLocale:io,activeThemeMode:Bs,activeTextSize:Fs,effectiveLocale:Dn,setActiveLocale:__,setActiveThemeMode:f_,setActiveTextSize:m_,patchAndSync:Us,handleLocaleChange:g_,handleThemeChange:v_,handleTextSizeChange:h_,handleSoundToggle:b_}=l_({options:e,persistence:o,transport:de,feedback:Rt,hostElement:t,bus:n}),{controlModeSig:Ht,assignedOperatorInitialsSig:y_,operatorAvailableSig:P_,applyControlState:_r,adoptControlStateChunk:x_,requestOperator:S_,cancelOperatorRequest:k_}=Wp({transport:de,conversationIdSig:s}),rn=It(new Map),w_=B(P=>{if(P.type!=="data-memory-compaction-state")return;let I=s.value;if(!I)return;let Q=Ru(P.data);if(!Q)return;let j=rn.value.get(I);if(j&&(Q.postFinishSequence<j.postFinishSequence||Q.postFinishSequence===j.postFinishSequence&&(j.status==="ready"||j.status===Q.status)))return;let te=new Map(rn.value);te.set(I,Q),rn.value=te},[s,rn]),{hasUnreadSig:C_,unreadCountSig:qs,transcriptRecoverySig:R_,markVisibleConversationRead:zs,beginConversationTranscript:Wa,commitConversationTranscript:Bn,isConversationTranscriptCommitted:Hs,recordConversationReply:I_}=s_({transport:de,options:e,conversationIdSig:s,isConversationVisibleRef:tt,activated:ae,conversationReady:C}),T_=U&&e.modules.byId[v]?.layout==="home",A_=jp({transport:de,options:e,persistence:o,enabled:C&&T_});F(()=>{zs()},[v,U,fe,k,zs]),F(()=>{Rt.update(e.sound,e.haptics)},[Rt,e.sound,e.haptics]),F(()=>()=>Rt.destroy(),[Rt]),F(()=>{xt.current||!e.size.initialSize||(xt.current=!0,!o.loadPanelSize()&&Oe(_s(e.mode,e.size,ar())))},[e.mode,e.size,o]),F(()=>{if(!C||Ze.current)return;Ze.current=!0;let P=Gr(e,ar(),o.loadPanelOpen(),o.loadPanelSize());oe(P.panelOpen),Oe(P.panelSize)},[C,e,o]);let Fn=D(null);F(()=>{C&&g.reconcile(e.modules.list.map(P=>P.id),y())},[C,e.modules.list,g]);let so=B(P=>{!P||P.length===0||(d.value=P.map(I=>c_(I,pt.current)))},[d]),Ga=D(null),lo=B(async P=>{try{let{formSubmissions:I}=await(P?de.bootstrap(P):Ga.current??de.bootstrap()),Q=new Map;return I.forEach((j,te)=>Q.set(j.formId,te)),I.filter((j,te)=>!j.skipped||Q.get(j.formId)===te).map((j,te)=>({key:`wire:${j.formId}:${j.createdAt??te}`,formId:j.formId,outcome:j.skipped?"skipped":"submitted",createdAt:Su(j.createdAt),values:j.values}))}catch(I){return be.debug("bootstrap failed \u2014 no form markers (non-fatal)",{err:I}),[]}},[de]),fr=D(0),Kt=D(0),Ka=B(P=>{if(P===s.value)return;let I=s.value;Kt.current++,u(!1),I&&(o.saveDraft(P,o.loadDraft(I)),o.saveDraft(I,""),o.saveMessageQueue(P,o.loadMessageQueue(I)),o.saveMessageQueue(I,[])),s.value=P,o.saveConversationId(P),de.primeIdentity(void 0,P),be.info("conversation rebound",{previous:I,current:P}),I&&n.emit("conversationRebound",{previous:I,current:P})},[n,s,o,de]),co=B((P,I)=>{let Q=[...P.map(V=>V.createdAt),...I.map(V=>V.createdAt)].filter(V=>V!==void 0),j=(Q.length?Math.min(...Q):Date.now())-1;return[...(Le.current?.messages??[]).map(V=>{let ne=c_(V,pt.current);return ne.createdAt=j,ne}),...P]},[]),js=B(async P=>{let I=Kt.current;function Q(){return I!==Kt.current||s.value!==P}xe.current===P&&(xe.current=void 0),u(!0);try{let[j,te]=await Promise.all([de.loadConversation(P),lo()]);if(Q())return!1;let V=pn(j.messages);h(te);let ne=co(us(V,d.value),te);if(d.value=ne,xe.current=ne.some(Se=>Se.role==="user")?void 0:P,V.length>0||j.controlState!==void 0){gt(j.canContinue),j.controlState&&_r(j.controlState);let Se=V.findLast(ut=>ut.role==="assistant"&&!ut.ephemeral);ce(Se?.suggestions??[])}return!0}catch(j){return Q()||(be.warn("loadThread failed; keeping conversation active",{err:j,conversationId:P}),n.emit("error",j),O.current.onError?.(j)),!1}finally{Q()||u(!1)}},[de,lo,d,s,co,n]),E_=B(P=>{if(ge.current===P)return ge.current=void 0,js(P)},[js]),M_=B(()=>{if(f.current)return Promise.resolve(void 0);let P=s.value,I=d.value.find(ne=>ne.serverMessageId!==void 0),Q=I?.serverMessageId,j=I?new Date(I.createdAt).toISOString():void 0;if(!P||!Q||!j)return Promise.resolve(void 0);let te=Kt.current,V={};return f.current=V,(async()=>{try{let ne=await de.loadConversation(P,{beforeId:Q,beforeCreatedAt:j});if(f.current!==V||Kt.current!==te||s.value!==P)return;if(ne.messages.length===0)return!1;let ye=ne.messages.map(is),Se=d.value,ut=Mu(Se,ye);if(ut!==Se){let Qt=Math.min(...ye.map(St=>St.createdAt??1/0),...m.map(St=>St.createdAt??1/0));if(Number.isFinite(Qt))for(let St of Se){if(!St.ephemeral)break;(St.createdAt??1/0)>=Qt&&(St.createdAt=Qt-1)}d.value=ut}return!0}catch(ne){if(f.current!==V||Kt.current!==te||s.value!==P)return;be.warn("load previous messages failed",{err:ne,conversationId:P,beforeId:Q}),n.emit("error",ne),e.onError?.(ne);return}finally{f.current===V&&(f.current=void 0)}})()},[n,s,m,d,e,de]),mr=B(async({newConversation:P})=>{let I=++fr.current;function Q(){return I!==fr.current}let j=s.value,te=P||!j?kt():j;te!==j&&(Kt.current++,u(!1),$t(()=>{s.value=te,p.value=te}),o.saveConversationId(te)),de.primeIdentity(a,te);let V;try{V=await de.handshake({visitorId:a,conversationId:te,userPrefs:o.loadUserPrefs(),locale:io})}catch(Se){if(Q())return;n.emit("error",Se),e.onError?.(Se),P||T(!0);return}if(Q())return;V.conversationId!==te&&Ka(V.conversationId),ve(V.agent),e.mode==="page"&&(V.site&&jc(V.site)?X(V.site):V.site&&be.warn("invalid site config, using fallback",{site:V.site}),V.blocks&&Vc(V.blocks)?rt(V.blocks):V.blocks&&be.warn("invalid blocks config, using fallback",{blocks:V.blocks}));let ne=wi(V.userPrefs);if(Object.keys(ne).length>0&&!P&&(o.saveUserPrefs(ne),ne.locale&&__(ne.locale),ne.soundMuted!==void 0&&Rt.setMuted(ne.soundMuted),ne.themeMode&&f_(ne.themeMode),ne.textSize&&m_(ne.textSize)),Le.current=V.welcome,P||n.emit("handshake",V),V.welcome?.suggestions){let Se=pt.current;ce(V.welcome.suggestions.map(ut=>({...ut,label:ht(Se,ut.label),...ut.text===void 0?{}:{text:ht(Se,ut.text)}})))}let ye=!P&&j&&V.conversationId===j;c.current=!!ye,ye?ct.current||(ge.current=V.conversationId):(xe.current=V.conversationId,so(V.welcome?.messages),Bn(V.conversationId)),P||T(!0)},[de,a,o,e,n,s,p,Rt,so,io,Ka,Bn]),gr=JSON.stringify(e.userContext??null),N_=JSON.stringify(e.pageContext??null),L_=JSON.stringify(vt);F(()=>{let P=Object.keys(vt).length?{...vt,...e.userContext}:e.userContext;de.setContext(P,fb(e.pageContext))},[de,gr,N_,L_]),F(()=>de.setUserToken(e.userToken),[de,e.userToken]);let Vs=B((P,I=[])=>ce(P.suggestions??I),[]);F(()=>(de.primeIdentity(a,s.value),mr({newConversation:!1}),()=>{fr.current++,Kt.current++}),[]),F(()=>{!ae||!C||ct.current||(ct.current=!0,Ga.current=de.bootstrap(),(async()=>{try{let P=await Ga.current;N(Sr((P??{forms:[]}).forms,Dn))}catch(P){be.debug("bootstrap failed \u2014 treating as no forms",{err:P})}finally{$(!0)}})(),ge.current===s.value&&u(!0))},[ae,C]);let vr=D(null);F(()=>{if(!ae||!C||(vr.current??(vr.current=Dn),vr.current===Dn))return;vr.current=Dn;let P=!1;return de.bootstrap().then(I=>{P||N(Sr((I??{forms:[]}).forms,Dn))}).catch(I=>be.debug("forms re-localize failed \u2014 keeping current copy",{err:I})),()=>{P=!0}},[ae,C,Dn,de]);let Ws=D(gr);F(()=>{!C||Ws.current===gr||(Ws.current=gr,mr({newConversation:!1}))},[gr,C,mr]),Qp({hostElement:t,mode:e.mode,panelSize:Ae,isOpen:U,surfaceReady:C,setIsOpen:oe});let{sendAiTurn:on,sendRoutedTurn:Un}=i_({transport:de,messagesSig:d,conversationIdSig:s,options:e,bus:n,feedback:Rt,persistence:o,visitorId:a,adoptConversationId:Ka,applyControlState:_r,setCanSend:gt,settleSuggestions:Vs,runCancellation:nn}),{toolInteraction:O_}=Hp({streaming:b,controlModeSig:Ht,messagesSig:d,sendAiTurn:on,bus:n,humanInLoop:e.features.humanInLoop}),$_=B((P,I)=>{let Q=d.value.find(j=>j.serverMessageId===P);Q&&(Q.feedback=I),be.info("messageFeedback",{messageId:P,value:I}),n.emit("messageFeedback",{messageId:P,value:I}),de.submitFeedback({messageId:P,value:I})},[n,d,de]);function D_(){return d.value.reduce((P,I)=>P+(I.role==="user"?1:0),0)}let qn=e.forms.list.length>0?e.forms:M??e.forms,Be=Ku({forms:qn,persistence:o,userContext:()=>e.userContext,messageCount:D_,pageArea:()=>e.pageContext?.area?String(e.pageContext.area):void 0,conversationId:()=>s.value,onComplete:(P,I,Q,j)=>{be.info("formSubmit",{formId:P.id,trigger:I,skipped:j}),n.emit("formSubmit",{formId:P.id,values:Q,skipped:j}),h(V=>{let ye=V.find(Se=>Se.formId===P.id&&Se.outcome==="skipped")?.createdAt??Date.now();return[...V.filter(Se=>!(Se.formId===P.id&&Se.outcome==="skipped")),{key:`local:${P.id}:${ye}`,formId:P.id,outcome:j?"skipped":"submitted",createdAt:ye,...j?{}:{values:Q}}]});let te=s.value??kt();s.value||(s.value=te,o.saveConversationId(te),de.primeIdentity(void 0,te)),!j&&P.mirrorToContext&&vn(V=>({...V,...Q})),de.submitForm({formId:P.id,conversationId:te,trigger:I,values:Q,skipped:j})}}),hr=Ct(()=>Be.activeForm.value),B_=B(()=>Be.fire("after-messages"),[Be]),F_=B(()=>c.current||d.value.some(P=>!P.ephemeral&&P.role==="user"),[d]);e_({activated:ae,conversationReady:C,conversationIdSig:s,messagesSig:d,optionsRef:O,transport:de,visitorId:a,adoptControlStateChunk:x_,adoptMemoryCompactionStateChunk:w_,settleSuggestions:Vs,recordConversationReply:I_,transcriptRecoverySig:R_,beginConversationTranscript:Wa,commitConversationTranscript:Bn,onReplyLanded:B_,runCancellation:nn,canContinueRef:Et,setCanSend:gt,feedback:Rt,bus:n,loadInitialThread:E_,shouldReconcileOnConnect:F_}),F(()=>{Be.refresh()},[qn,Be]);let Gs=e.pageContext?.area?String(e.pageContext.area):void 0,U_=Ct(()=>d.value.length);F(()=>{C&&L&&Be.fire("pre-chat")},[C,L,Be]),F(()=>{L&&!Ee&&Be.fire("conversation-closed")},[L,Ee,Be]),F(()=>{C&&L&&Gs&&Be.fire("page-area")},[C,L,Gs,Be]);let Qa=ie(()=>{let P=qn.list.flatMap(I=>I.triggers).filter(I=>I.kind==="idle").map(I=>Number(I.param));return P.length?Math.min(...P)*1e3:0},[qn]);F(()=>{if(!Qa||!U)return;let P=setTimeout(()=>Be.fire("idle"),Qa);return()=>clearTimeout(P)},[Qa,U,Be,U_.value]);let zn=B(async(P,I,Q)=>{if(J.current)return!1;let j=s.value,te=j?rn.value.get(j):void 0,V=Ht.value!=="ai-agent";if(!V&&te?.status==="compacting"||(be.info("send",{textLen:P.length,attachments:I.length,streaming:K.current,routedToOperator:V}),K.current&&!V))return!1;let ne=new AbortController,ye={conversationId:j,controller:ne};J.current=ye,we(!0);try{Rt.unlock();let Se=await gb(de,I,ne.signal,an=>{ne.signal.aborted||(be.warn("upload failed",{err:an}),n.emit("error",an),e.onError?.(an))});if(ne.signal.aborted||s.value!==j||!Et.current||Be.activeForm.value)return!1;let ut=j?rn.value.get(j):void 0,Qt=Ht.value!=="ai-agent";if(!Qt&&ut?.status==="compacting"||K.current&&!Qt||!P&&Se.length===0)return!1;n.emit("send",{text:P,attachmentCount:I.length}),nt.length>0&&ce([]),Rt.play("messageSent");let St=as(P,Se,Q);return or(n,e,"user",P),Qt?(d.value=[...d.value,St],Q?await Un(St):(Un(St),!0)):(d.value=[...d.value,St,en()],Q?await on({continueExisting:!1}):(on({continueExisting:!1}),!0))}finally{J.current===ye&&(J.current=null,we(!1))}},[de,n,e,nt.length,d,s,rn,on,Un,Ht]),Ks=D(zn);Ks.current=zn;let Qs=s.value,Ys=(Qs?rn.value.get(Qs):void 0)?.status==="compacting",Ya=Ht.value==="ai-agent",Xs=Ct(()=>{let P=d.value.at(-1);return P?.role==="assistant"&&P.partsSig.value.some(I=>I.kind==="tool"&&I.stateSig.value==="approval-requested")}),Js=Ct(()=>d.value.some(P=>P.retryAction?.kind==="resend-user"||P.retryAction?.kind==="continue-assistant"));wt(()=>{let P=s.value;return()=>{let I=J.current;!I||I.conversationId!==P||(J.current=null,we(!1),I.controller.abort())}},[s.value]),F(()=>{Ee&&!hr.value||J.current?.controller.abort()},[hr.value,Ee]);let q_=B(()=>{if(!nn.stop())return;be.info("stop"),n.emit("stop",void 0);let P=d.value.at(-1);P&&P.role!=="user"&&P.status==="streaming"&&(P.canceled=!0,d.value=[...d.value])},[nn,n,d]),z_=B(P=>{if(b)return;let I=d.value,Q=pa(I,P);if(Q)switch(be.info("retry",{kind:Q.kind,messageId:Q.messageId}),Q.kind){case"continue-assistant":{if(Ht.value!=="ai-agent"||P.role!=="assistant"||(P.serverMessageId??P.id)!==Q.messageId)return;P.status="streaming",P.errorText=void 0,P.retryAction=void 0,P.awaitingContinuation=!0,d.value=[...I],on({continueExisting:!0,turn:P});return}case"resend-user":{let j=I.find(ne=>ne.role==="user"&&ne.id===Q.messageId);if(!j)return;let te=ne=>{ne&&Fn.current?.acceptQueuedMessage(Q.messageId)};if(j.status="complete",j.errorText=void 0,j.retryAction=void 0,Ht.value!=="ai-agent"){d.value=P.role==="assistant"?I.filter(ne=>ne!==P):[...I],Un(j).then(te);return}let V=en();d.value=P.role==="assistant"?I.map(ne=>ne===P?V:ne):[...I,V],on({continueExisting:!1,turn:j}).then(te);return}case"repeat-user":{let j=I.find(ye=>ye.role==="user"&&ye.id===Q.messageId);if(!j)return;let te=as(He(j),j.attachments?.map(ye=>({...ye}))??[]),V=new Set(te.attachments?.flatMap(ye=>ye.url?[ye.url]:[])??[]),ne=j.partsSig.value.flatMap(ye=>ye.kind==="file"&&!V.has(ye.url)?[{...ye}]:[]);if(ne.length>0&&(te.partsSig.value=[...te.partsSig.value,...ne]),Ht.value!=="ai-agent"){d.value=[...I,te],Un(te);return}d.value=[...I,te,en()],on({continueExisting:!1,turn:te});return}default:return Q}},[b,d,Ht,on,Un]),br=B(()=>{if(Gu(e.mode,Ae)==="exit-fullscreen"){be.info("close \u2192 exit-fullscreen",{mode:e.mode}),Oe("normal"),n.emit("fullscreen",!1);return}be.info("close \u2192 panel closed",{mode:e.mode}),Be.fire("panel-close"),oe(!1),o.savePanelOpen(!1),n.emit("close",void 0),e.onClose?.()},[n,e,o,Ae,Be]),yr=B(()=>{be.info("open",{mode:e.mode}),Rt.unlock(),mt(!0),oe(!0),o.savePanelOpen(!0),!At&&!dt&&Pt(),setTimeout(()=>mt(!1),mb),n.emit("open",void 0),e.onOpen?.()},[n,e,Rt,o,At,dt,Pt]),Xa=B(()=>{let P=d.value.some(I=>I.role==="user");if(xe.current===s.value&&!P&&Ee&&s.value){be.info("clear \u2192 reusing empty conversation",{conversationId:s.value}),d.value.length===0&&so(Le.current?.messages);return}return be.info("clear \u2192 new conversation",{wasStreaming:b}),n.emit("clear",void 0),nn.settle(),c.current=!1,ge.current=void 0,xe.current=void 0,$t(()=>{d.value=[],s.value=void 0,_r({controlMode:"ai-agent",controlRevision:0})}),o.clearConversation(),gt(!0),h([]),ce([]),mr({newConversation:!0})},[b,d,s,o,mr,n,Ee,so,nn,_r]),uo=B(()=>{let P=Xa();$e("chat");let I=e.modules.list.find(Q=>Q.layout==="chat")?.id;return I&&g.switchTab(I),P},[Xa,g,e]),H_=B(async P=>{await uo(),await Ks.current(P,[])||Fn.current?.fill(P)},[uo]),Ja=B(()=>{let P=Ae==="expanded"?"normal":"expanded";be.info("expand",{from:Ae,expanded:P==="expanded"}),Oe(P),o.savePanelSize(P),n.emit("expand",P==="expanded")},[n,Ae,o]),Za=B(()=>{let P=Ae==="fullscreen"?"normal":"fullscreen";be.info("fullscreen",{from:Ae,fullscreen:P==="fullscreen"}),Oe(P),o.savePanelSize(P),n.emit("fullscreen",P==="fullscreen")},[n,Ae,o]),j_=B(()=>{$e(P=>{let I=P==="history"?"chat":"history";return be.info("toggleHistory",{view:I}),n.emit("toggleHistory",{view:I}),I})},[n]),V_=B(()=>{zt(P=>{let I=!P;return be.info("sidebarToggle",{collapsed:I}),o.saveSidebarCollapsed(I),n.emit("sidebarToggle",{collapsed:I}),I})},[o,n]),W_=B(P=>{be.info("resize",P),Us({widgetSize:P}),n.emit("resize",P)},[Us,n]),G_=B(async P=>{let I=P.conversationId;if(I===s.value&&Hs(I)){be.info("selectConversation",{conversationId:I,cached:!0}),n.emit("selectConversation",{conversationId:I}),de.publishConversation(P),$e("chat");let V=x();V&&g.switchTab(V),Bn(I);return}let j=++fr.current;Kt.current++,u(!1);function te(){return j!==fr.current}be.info("selectConversation",{conversationId:I,wasStreaming:b}),n.emit("selectConversation",{conversationId:I}),de.publishConversation(P);try{let[V,ne]=await Promise.all([de.loadConversation(I),lo(I)]);if(te())return;nn.settle(),c.current=!0,ge.current=void 0;let ye=pn(V.messages),Se=V.conversationId!==s.value,ut=Se?ye:us(ye,d.value);xe.current=ut.some(an=>an.role==="user")?void 0:V.conversationId,$t(()=>{d.value=co(ut,ne),Se&&(p.value=V.conversationId),s.value=V.conversationId}),h(ne),o.saveConversationId(V.conversationId),de.primeIdentity(a,V.conversationId),gt(V.canContinue),V.controlState&&_r(V.controlState);let Qt=ut.findLast(an=>an.role==="assistant"&&!an.ephemeral);ce(Qt?.suggestions??[]),Se?Wa(V.conversationId):Bn(V.conversationId),$e("chat");let St=x();St&&g.switchTab(St)}catch(V){if(te())return;n.emit("error",V),e.onError?.(V)}},[de,d,s,p,n,e,o,lo,co,b,a,nn,Wa,Bn,Hs,g]),po=D(null),Zs=B(P=>{typeof P=="string"&&(L?Be.fire("manual",P):po.current=P)},[L,Be]);F(()=>{!L||!po.current||(Be.fire("manual",po.current),po.current=null)},[L,Be]);let _o=D(void 0),fo=B(P=>{let I=e.modules.list.find(j=>j.layout===_b[P.to]);if(!I){be.warn("open: the widget has no such tab",{to:P.to});return}let Q=P.id&&(I.layout==="help"||I.layout==="news")?{kind:"content",id:P.id,title:""}:void 0;g.open(I.id,Q)},[e.modules,g]),el=B(P=>{if(U||yr(),P!==void 0){if(!Nc(P)){be.warn("open: unknown target",{detail:P});return}C?fo(P):_o.current=P}},[U,yr,C,fo]);F(()=>{!C||!_o.current||(fo(_o.current),_o.current=void 0)},[C,fo]);let tl=C&&!_&&!hr.value&&(!Ya||!Xs.value&&!Js.value),[hn,ei]=z(),nl=B(P=>{let I=Lc(P);if(!I){be.warn("ask: expected { text, send? } with non-empty text",{detail:P});return}U||yr(),ei(I)},[U,yr]),ti=U&&L&&Ee&&C&&!_&&!hr.value,rl=ti&&tl&&!se&&!(Ya&&(b||Ys));F(()=>{if(hn===void 0||!(hn.send?rl:ti))return;let P=x();if(!P){be.warn("ask: the widget has no chat"),ei(void 0);return}if(fe!=="chat"||!S()){$e("chat"),g.switchTab(P);return}if(ei(void 0),!hn.send){Fn.current?.fill(hn.text);return}zn(hn.text,[]).then(I=>{I||Fn.current?.fill(hn.text)})},[hn,ti,rl,fe,v,e.modules,g,zn]),F(()=>{if(e.widgetId!=="default")return;let P=`data-${A.cssPrefix}-`,I=["ask","open","close","form"].map(j=>P+j);function Q(j){let te=j.composedPath().find(Se=>Se instanceof Element&&I.some(ut=>Se.hasAttribute(ut)));if(!(te instanceof Element))return;j.preventDefault();let V=te.getAttribute(`${P}ask`),ne=te.getAttribute(`${P}open`),ye=te.getAttribute(`${P}form`);V!==null?Nt(t,"ask",Er(V||(te.textContent??""),{send:te.hasAttribute(`${P}send`)})):ne!==null?Nt(t,"open",Bo(ne)):ye!==null?Nt(t,"openForm",ye):Nt(t,"close")}return document.addEventListener("click",Q),()=>document.removeEventListener("click",Q)},[e.widgetId,t]),F(()=>{if(e.widgetId!=="default")return;let P=Dc(location.href);P&&(history.replaceState(history.state,"",P.url),P.ask?Nt(t,"ask",Er(P.ask)):Nt(t,"open",P.target))},[e.widgetId,t]);let ol=D(Mr),al=e.mode==="page"||e.mode==="inline"||e.mode==="standalone";F(()=>Ut(()=>{let P=s.value,I={open:al||U,ready:C,unread:qs.value,...P?{conversationId:P}:{}},Q=ol.current;I.open===Q.open&&I.ready===Q.ready&&I.unread===Q.unread&&I.conversationId===Q.conversationId||(ol.current=I,n.emit("state",I),I.unread!==Q.unread&&n.emit("unread",I.unread))}),[n,al,U,C,qs,s]);let bn=D({handleOpenCommand:el,handleClose:br,handleExpand:Ja,handleFullscreen:Za,openForm:Zs,handleAskCommand:nl});bn.current={handleOpenCommand:el,handleClose:br,handleExpand:Ja,handleFullscreen:Za,openForm:Zs,handleAskCommand:nl},wt(()=>$c(t,{open:P=>bn.current.handleOpenCommand(P),close:()=>bn.current.handleClose(),expand:()=>bn.current.handleExpand(),fullscreen:()=>bn.current.handleFullscreen(),openForm:P=>bn.current.openForm(P),ask:P=>bn.current.handleAskCommand(P)}),[t]);let _t=ie(()=>Pi(e,io,Bs,Fs),[e,io,Bs,Fs]);pt.current=_t.strings;let K_=ie(()=>m.map(P=>{let I=qn.list.find(Q=>Q.id===P.formId);return{...P,title:I?.title,form:I}}),[m,qn]);function ni(P){G_(P)}let il={options:_t,transport:de,feedback:Rt,bus:n,persistence:o,conversationId:s.value??"",composerKey:p.value,composerApiRef:Fn,view:fe,canSend:Ee,isStreaming:b,isMemoryCompacting:Ys,canReleaseQueuedMessages:tl,queueManualMessages:Ya&&(Xs.value||Js.value),sendPreparing:se,composerActive:_t.mode==="page"||_t.mode==="inline"||_t.mode==="standalone"||U,controlMode:Ht.value,assignedOperatorInitials:y_.value,operatorAvailable:P_.value,operatorRequestEnabled:e.features.operatorRequest,onRequestOperator:S_,onCancelOperatorRequest:k_,loadingMessages:_,onLoadPreviousMessages:M_,messagesSig:d,agent:Ce,suggestions:nt,initialWidgetSize:i.widgetSize??null,onClose:br,onClear:Xa,onExpand:Ja,onFullscreen:Za,onSoundToggle:b_,onToggleHistory:j_,onSelectHistoryConversation:ni,onNewConversation:uo,onLocaleChange:g_,onThemeChange:v_,onTextSizeChange:h_,onWidgetSizeChange:W_,onSend:zn,onStop:q_,onSuggestion:P=>{if(J.current)return;let I=P.text??P.label;be.info("suggestion",{text:I,autoSend:e.autoSendSuggestions}),n.emit("suggestion",{text:I}),e.autoSendSuggestions?zn(I,[]):Fn.current?.fill(I)},activeForm:hr.value?.form??null,formMarkers:K_,onFormSubmit:Be.complete,onFormSkip:Be.skip,onFormFill:P=>Be.fire("manual",P),tool:O_,onRetry:z_,onMessageFeedback:$_};if(!C)return null;let Pr=_t.modules.list;function ri(P){let I=rr("close",_t.mode,P);return Pr.length===0?l(Fp,{strings:_t.strings,onClose:I?br:void 0}):Pr.length===1&&Pr[0]?.layout==="chat"?l(Dp,{...il,panelSize:P}):l(Bp,{panelProps:{...il,panelSize:P,onClose:I?br:void 0},enabledModules:Pr,nav:g,bus:n,hasUnread:C_.value,latestNews:A_,onSelectConversation:ni,onStartNewConversation:H_,onSetPanelSize:Oe})}if(e.mode==="page"){let P=Pr.some(I=>I.layout==="chat");return l("div",{class:`${ja}-anchor`,children:l(zp,{site:Y,blocks:ue,transport:de,strings:_t.strings,locale:_t.locale,persistence:o,showConversations:P,onSelectConversation:ni,onNewConversation:uo,sidebarCollapsed:Mt,onToggleSidebarCollapsed:V_,children:ri("fullscreen")})})}if(W){let P=e.mode==="standalone"?"fullscreen":Ae;return l("div",{class:`${ja}-anchor`,children:ri(P)})}let sl=e.mode==="drawer",ll=!(e.mode==="modal")&&!e.launcher.hidden&&(!U||Ve),cl=ll&&!Ve&&!At&&!sl?_t.launcher.callout:null;return l("div",{class:`${ja}-anchor`,"data-launcher-size":_t.launcher.size,children:[U||ae?l("div",{class:`${ja}-surface`,hidden:!U,children:ri(Ae)}):null,ll?l(Nd,{onToggle:yr,launcher:_t.launcher,strings:_t.strings,leaving:Ve,edgeTab:sl}):null,cl?l(Ld,{callout:cl,launcherPosition:_t.position,strings:_t.strings,closeLabel:_t.strings.close,onDismiss:Pt}):null]})}function fb(e){let t=e?.url??(typeof location<"u"?location.href:void 0);if(!(!e&&!t))return{...e,...t?{url:t}:{}}}var mb=120;async function gb(e,t,n,r){return(await Promise.all(t.map(async a=>{try{let{id:i,url:s,originalName:c,mimeType:p,fileSize:d}=await e.uploadFile(a.file,n);return{id:i,name:c,mediaType:p,size:d,url:s}}catch(i){r(i);return}}))).filter(a=>a!==void 0)}var vb=le.scope("error-boundary"),Va=class extends Ot{constructor(){super(...arguments);ee(this,"state",{crashed:!1})}componentDidCatch(n,r){vb.error("widget render crashed",{error:n,componentStack:r?.componentStack}),this.setState({crashed:!0}),this.props.onError(n,r?.componentStack)}render(){return this.state.crashed?this.props.fallback:this.props.children}};function d_(e){let{bus:t,host:n,appRoot:r,persistence:o,reportError:a}=e,i=e.initialRaw,s,c=Vn(i),p=!0,d=0;function _(){c=Vn(s?xi(i,s):i)}function u(){lc(n,Ao(c.mode));let y=o.loadUserPrefs().themeMode;uc(n,y?{...c,themeMode:y}:c),p&&(Eo(n,hb(c)),p=!1)}function f(){u(),cn(Hn(Va,{onError:a},Hn(u_,{key:d,bus:t,hostElement:n,options:c})),r)}t.on("handshake",y=>{y.config&&(y.config.storageVersion&&o.rememberStorageVersion(y.config.storageVersion),s=y.config,_(),f())});let m=Xl(t,{getOptions:()=>c,getVisitorId:()=>o.getVisitorId(),getConversationId:()=>o.loadConversationId()});function h(y={}){o.reset(),i={...i,userContext:void 0,userToken:void 0,...y},d+=1,p=!0,_(),f()}return{getOptions:()=>c,getUserOptions:()=>i,render:f,setUserOptions:y=>{i=y,_(),f()},patchUserOptions:y=>{let x="userToken"in y&&y.userToken!==i.userToken;if(x&&i.userToken){h(y);return}x&&(d+=1),i={...i,...y},_(),f()},reset:()=>h(),destroy:()=>m()}}function hb(e){if(e.mode==="standalone")return"standalone";if(e.mode==="inline")return"inline";let t=Gn(e.widgetId,e.storage,e.aiAgentDeploymentId),{panelOpen:n,panelSize:r}=Gr(e,ar(),t.loadPanelOpen(),t.loadPanelSize());return ma(e.mode,r,n)}var Ds=class extends HTMLElement{constructor(){super(...arguments);ee(this,"bus",new Uo);ee(this,"widgetState",Mr);ee(this,"userToken");ee(this,"markReady",()=>{});ee(this,"ready",new Promise(n=>{this.markReady=n}));ee(this,"mountResult",null);ee(this,"runtime",null)}static get observedAttributes(){return Si}connectedCallback(){this.boot()}disconnectedCallback(){this.mountResult&&(this.runtime?.destroy(),this.runtime=null,cn(null,this.mountResult.appRoot),this.bus.clear(),this.widgetState=Mr)}attributeChangedCallback(){this.isConnected&&this.boot()}open(n){Nt(this,"open",n)}close(){Nt(this,"close")}expand(){Nt(this,"expand")}openForm(n){Nt(this,"openForm",n)}ask(n,r){Nt(this,"ask",Er(n,r))}get state(){return this.widgetState}reset(){this.userToken=void 0,this.runtime?.reset()}login(n){this.userToken=n,this.runtime?.patchUserOptions({userToken:n})}on(n,r){return this.bus.on(n,r)}boot(){let n={...ki(a=>this.getAttribute(a)),...this.userToken?{userToken:this.userToken}:{}};if(!n.aiAgentDeploymentId)throw new Error("ai-agent-deployment-id is required");if(this.runtime){this.runtime.setUserOptions(n);return}let r=Vn(n);this.mountResult??(this.mountResult=cc({existingHost:this,position:Ao(r.mode)}));let o=Gn(r.widgetId,r.storage,r.aiAgentDeploymentId);this.bus.on("state",a=>{this.widgetState=a,a.ready&&this.markReady()}),this.runtime=d_({bus:this.bus,host:this.mountResult.hostElement,appRoot:this.mountResult.appRoot,persistence:o,initialRaw:n,reportError:a=>this.bus.emit("error",a)}),this.runtime.render()}},p_=!1;function bb(){if(p_||typeof customElements>"u")return;let e=A.tagName;customElements.get(e)||customElements.define(e,Ds),p_=!0}typeof customElements<"u"&&bb();export{bb as registerWebComponent};
59
+ `).trim(),j=!T&&t!=="error"&&!v.value&&O.length>0,W=N||j;return l("div",{class:`${ct}-bubble-row`,"data-role":e.role,"data-testid":lt(L.messageBubble,e.serverMessageId??e.id),children:l("div",{class:`${ct}-bubble-col`,children:[l("div",{class:`${ct}-bubble`,children:[e.role==="operator"&&e.operatorInitials?l("span",{class:`${ct}-bubble-author`,children:e.operatorInitials}):null,l("div",{class:`${ct}-bubble-body`,children:[S?l(Ub,{label:n.loading}):m.map((z,J)=>l(Ob,{part:z,generativeUi:e.role==="assistant",active:w,live:h,strings:n,showReasoning:o,showToolCalls:a,showSources:i,interactive:s&&t==="complete"&&(z.kind!=="tool"||ha(e,J)),superseded:c,continuationStreaming:e.continuationStreaming===!0,tool:p},`${Bb(z)}#${J}`)),C&&l(Fb,{}),t==="error"||v.value?l("div",{class:`${ct}-error`,role:"alert",children:[l("span",{children:e.errorText??n.errorGeneric}),_?l("button",{type:"button",class:`${ct}-error-retry`,onClick:()=>_(e),"data-testid":L.messageRetry,children:n.errorRetry}):null]}):null]})]}),A||W?l("div",{class:`${ct}-bubble-meta`,children:[A?l("time",{class:`${ct}-bubble-time`,dateTime:A.iso,title:A.full,children:A.short}):null,W?l("div",{class:`${ct}-bubble-actions`,children:[N&&e.serverMessageId?l(Up,{messageId:e.serverMessageId,initial:e.feedback??null,strings:n,onFeedback:u}):null,j?l(Nb,{text:O,strings:n}):null]}):null]}):null]})})}function Nb({text:e,strings:t}){let[n,r]=q(!1);function o(){navigator.clipboard?.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)}).catch(()=>{})}let a=n?t.copied:t.copy;return l("button",{type:"button",class:`${ct}-msg-action`,"data-active":n?"true":void 0,"aria-label":a,title:a,onClick:o,"data-testid":L.messageCopy,children:n?l(Dn,{}):l(Qd,{})})}function Lb(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 Ob({part:e,generativeUi:t,active:n,live:r,strings:o,showReasoning:a,showToolCalls:i,showSources:s,interactive:c,superseded:p,continuationStreaming:_,tool:d}){switch(e.kind){case"step-start":return null;case"text":return l(Ea,{textSig:e.textSig,doneSig:e.doneSig,generativeUi:t,strings:o});case"reasoning":return a?l(Db,{part:e,active:n,strings:o}):null;case"tool":return l($b,{part:e,strings:o,showToolCalls:i,interactive:c,superseded:p,continuationStreaming:_,live:r,tool:d});case"file":return e.mediaType.startsWith("image/")?l("img",{src:e.url,alt:"",loading:"lazy"}):l("a",{href:e.url,target:"_blank",rel:"noreferrer noopener",children:e.url});case"source":return s?l(i_,{part:e,strings:o}):null}}function $b({part:e,strings:t,showToolCalls:n,interactive:r,superseded:o,continuationStreaming:a,live:i,tool:s}){let c=ce(()=>ve(()=>e.approvalSig.value!==void 0),[e]);return s?.humanInLoop&&c.value?Ua(e.toolName)?l(d_,{part:e,strings:t,active:r,superseded:o,continuationStreaming:a,onDecision:s.onDecision,onEdit:s.onEdit}):l(s_,{part:e,strings:t,active:r,superseded:o,continuationStreaming:a,onDecision:s.onDecision,onEdit:s.onEdit}):n?l(__,{part:e,strings:t,live:i,superseded:o}):null}function Db({part:e,active:t,strings:n}){return l("details",{class:`${ct}-reasoning`,"data-testid":L.reasoning,open:t,"data-active":t?"true":void 0,children:[l("summary",{class:`${ct}-reasoning-summary`,children:l("span",{class:`${ct}-reasoning-label`,children:t?n.thinking:n.thoughts})}),l("div",{class:`${ct}-reasoning-body`,children:l(Ea,{textSig:e.textSig,doneSig:e.doneSig})})]})}function Bb(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 Fb(){return l("span",{class:`${ct}-typing`,"data-testid":L.typingDots,"aria-hidden":"true",children:[l("span",{}),l("span",{}),l("span",{})]})}function Ub({label:e}){return l("span",{class:`${ct}-loading`,role:"status",children:[l("span",{class:`${ct}-loading-spinner`,"aria-hidden":"true"}),l("span",{class:`${ct}-loading-label`,children:e})]})}var yn=M.cssPrefix,Ys=120,qb=350;function m_({messagesSig:e,strings:t,responseMode:n,showReasoning:r,showToolCalls:o,showSources:a,enableMessageFeedback:i,onFeedback:s,loading:c,onLoadPreviousMessages:p,idle:_,controlMode:d="ai-agent",tool:u,onRetry:f,form:m,formMarkers:v,onFillForm:P}){let x=B(null),k=Tt(()=>e.value),[T,h]=q(!1),[g,S]=q(!1),w=B(!1),C=B(!1),[A,E]=q(),N=B(!1),O=B(!1),j=B(!1),W=B(0);function z(){return j.current||performance.now()-W.current<qb}let J=B(0);function ue(b){let U=b.scrollHeight-b.clientHeight>1;b.dataset.fadeTop=U&&b.scrollTop>1?"true":"false",b.dataset.fadeBottom=U&&b.scrollHeight-b.scrollTop-b.clientHeight>1?"true":"false"}function ie(b){return h(b.scrollHeight-b.scrollTop-b.clientHeight>Ys*2)}function tt(b){J.current=performance.now(),b.scrollTop=b.scrollHeight,ue(b)}function he(b,U){tt(b);let X=U,Y=0;function re(){O.current||z()||(tt(b),--X>0&&(Y=requestAnimationFrame(re)))}return U>0&&(Y=requestAnimationFrame(re)),()=>cancelAnimationFrame(Y)}function Te(b,U){let X,Y,re,Re=-1;function xe(){X.disconnect(),Y.disconnect(),clearTimeout(re)}function ge(){if(O.current||z()||Re>=0&&b.scrollTop<Re-4)return xe();tt(b),Re=b.scrollTop}return X=new ResizeObserver(ge),Y=new MutationObserver(ge),ge(),X.observe(b),Y.observe(b,{childList:!0,subtree:!0,characterData:!0}),re=setTimeout(xe,U),xe}let Je=k.value[0]?.id;Ct(()=>{let b=x.current;if(b&&k.value.length!==0&&!C.current&&(N.current=!0,!!k.value.some(U=>U.role==="user")))return Te(b,300)},[Je]);let De=B(0);D(()=>{let b=x.current,U=k.value,X=De.current;if(De.current=U.length,!b||!N.current||C.current)return;if(U.slice(X).some(re=>re.role==="user"))return O.current=!1,he(b,3);if(!U.some(re=>re.role==="user")||O.current||z())return;b.scrollHeight-b.scrollTop-b.clientHeight<Ys&&tt(b)},[k.value.length]);let mt=B(null);D(()=>{let b=x.current,U=k.value.at(-1),X=mt.current;if(mt.current=U?{id:U.id,streaming:U.status==="streaming"}:null,!!b&&N.current&&!(!U||U.id!==X?.id||X.streaming||U.status!=="streaming"))return O.current=!1,he(b,3)},[k.value]),D(()=>{let b=x.current;if(!b)return;let U=k.value.at(-1);if(!U||U.status!=="streaming"&&!k.value.some(re=>re.role==="user"))return;let X=()=>{if(O.current||z())return;b.scrollHeight-b.scrollTop-b.clientHeight<Ys*2&&tt(b)};if(U.status!=="streaming")return Te(b,300);X();let Y=new MutationObserver(X);return Y.observe(b,{childList:!0,subtree:!0,characterData:!0}),()=>Y.disconnect()},[k.value]);let Ve=m?.form.id,gt=!!m&&(v??[]).some(b=>b.formId===m.form.id);Ct(()=>{let b=x.current;!b||!Ve||O.current||k.value.some(U=>U.role==="user")&&(gt?b.querySelector(`[data-testid="${L.formGate}"]`)?.scrollIntoView({block:"nearest"}):tt(b))},[Ve,gt]),D(()=>{let b=x.current;if(!b)return;let U=()=>{ie(b),ue(b),performance.now()-J.current>150&&(O.current=b.scrollHeight-b.scrollTop-b.clientHeight>8)};function X(){O.current=!0}function Y(pe){pe.deltaY<0&&X()}let re=0;function Re(pe){re=pe.touches[0]?.clientY??0,j.current=!0}function xe(pe){(pe.touches[0]?.clientY??0)>re+4&&X()}function ge(){j.current=!1,W.current=performance.now()}function pt(){j.current=!0}return b.addEventListener("scroll",U,{passive:!0}),b.addEventListener("wheel",Y,{passive:!0}),b.addEventListener("touchstart",Re,{passive:!0}),b.addEventListener("touchmove",xe,{passive:!0}),b.addEventListener("touchend",ge,{passive:!0}),b.addEventListener("touchcancel",ge,{passive:!0}),b.addEventListener("pointerdown",pt,{passive:!0}),window.addEventListener("pointerup",ge,{passive:!0}),window.addEventListener("pointercancel",ge,{passive:!0}),ie(b),()=>{b.removeEventListener("scroll",U),b.removeEventListener("wheel",Y),b.removeEventListener("touchstart",Re),b.removeEventListener("touchmove",xe),b.removeEventListener("touchend",ge),b.removeEventListener("touchcancel",ge),b.removeEventListener("pointerdown",pt),window.removeEventListener("pointerup",ge),window.removeEventListener("pointercancel",ge)}},[]);function Pt(){let b=x.current;b&&(O.current=!1,tt(b))}let ut=k.value.filter(b=>!b.ephemeral),xt=ut[0],St=xt?.serverMessageId??xt?.id,Ae=!!(p&&ut.length>=Cs&&St!==A);async function Be(){if(!p||w.current)return;let b=x.current,U=b?.scrollHeight??0,X=b?.scrollTop??0;w.current=!0,C.current=!0,S(!0);try{let Y=await p();Y===!1&&St&&E(St),Y&&b&&(await new Promise(re=>requestAnimationFrame(()=>requestAnimationFrame(()=>re()))),b.scrollTop=X+b.scrollHeight-U,ue(b),ie(b))}finally{C.current=!1,w.current=!1,S(!1)}}let Pe=[],nt="",ye=k.value.at(-1)?.id,ht=[...v??[]].toSorted((b,U)=>(b.createdAt??1/0)-(U.createdAt??1/0));function We(b){return m&&b.formId===m.form.id?l(Fs,{form:m.form,strings:t,onSubmit:m.onSubmit,onSkip:m.onSkip},`gate:${b.formId}`):l(Op,{marker:b,strings:t,onFill:!m&&P?()=>P(b.formId):void 0},b.key)}function Ot(b){for(let U=ht[0];U?.createdAt!==void 0&&!(b!==void 0&&U.createdAt>b);U=ht[0])ht.shift(),Pe.push(We(U))}for(let b of k.value){if(b.role==="assistant"&&b.id!==ye&&Nn(b))continue;Ot(b.createdAt);let U=Hb(b.createdAt);U&&U!==nt&&(Pe.push(l("div",{class:`${yn}-date-divider`,children:l("span",{class:`${yn}-date-pill`,title:zb(b.createdAt),children:jb(b.createdAt,t)})},`day:${U}`)),nt=U);let Y=b.retryAction!==void 0||b.role==="assistant"&&b.id===ye?ya(k.value,b):void 0,re=Y!==void 0&&(Y.kind!=="continue-assistant"||d==="ai-agent");Pe.push(l(f_,{message:b,status:b.status,strings:t,responseMode:n,showReasoning:r,showToolCalls:o,showSources:a,interactive:!!_&&d==="ai-agent"&&b.id===ye,superseded:b.id!==ye,tool:u,onRetry:_&&re&&(b.role==="user"||b.id===ye)?f:void 0,enableMessageFeedback:i,onFeedback:s},b.id))}for(let b of ht)Pe.push(We(b));return l("div",{class:`${yn}-list-wrap`,children:[l("div",{ref:x,class:`${yn}-list ${yn}-list--fade`,part:"messages",role:"log","aria-live":"polite","aria-relevant":"additions text",children:[c&&k.value.length===0?l("div",{class:`${yn}-list-loading`,role:"status",children:t.conversationLoading}):null,Ae?l("div",{class:`${yn}-load-previous`,children:l("button",{type:"button",onClick:Be,disabled:g,"aria-busy":g,"data-testid":L.loadPreviousMessages,children:t.loadPreviousMessages})}):null,Pe,m&&!gt?l(Fs,{form:m.form,strings:t,onSubmit:m.onSubmit,onSkip:m.onSkip}):null]}),T?l("button",{type:"button",class:`${yn}-jump`,onClick:Pt,"aria-label":t.scrollToBottom,title:t.scrollToBottom,"data-testid":L.scrollToBottom,children:l(Bn,{})}):null]})}function Hb(e){if(typeof e!="number"||!Number.isFinite(e))return"";let t=new Date(e);return`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`}function zb(e){if(typeof e!="number"||!Number.isFinite(e))return"";try{return new Date(e).toLocaleDateString(void 0,{dateStyle:"full"})}catch{return""}}function jb(e,t){let n=new Date(e);function r(a){return new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime()}let o=Math.round((r(new Date)-r(n))/864e5);return o<=0?t.dateToday:o===1?t.dateYesterday:o<7?n.toLocaleDateString(void 0,{weekday:"long"}):n.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"})}function Qa({panelEl:e,resize:t,position:n,initialSize:r,onSizeChange:o,strings:a}){let i=M.cssPrefix,s=B(null);if(D(()=>{if(!e)return;let m=e.style;t.minWidth&&m.setProperty(`--${i}-resize-min-w`,t.minWidth),t.maxWidth&&m.setProperty(`--${i}-resize-max-w`,t.maxWidth),t.minHeight&&m.setProperty(`--${i}-resize-min-h`,t.minHeight),t.maxHeight&&m.setProperty(`--${i}-resize-max-h`,t.maxHeight),r&&(m.setProperty(`--${i}-widget-w`,`${r.width}px`),m.setProperty(`--${i}-widget-h`,`${r.height}px`))},[e,t.minWidth,t.maxWidth,t.minHeight,t.maxHeight,i,r]),!e)return null;let c=n.startsWith("top-"),p=n.endsWith("-right"),_=`${i}-resize-grip ${i}-resize-grip--${c?"bottom":"top"}-${p?"left":"right"}`;function d(m){if(!e)return;let v=m.currentTarget,P=e.getBoundingClientRect();s.current={pointerId:m.pointerId,startX:m.clientX,startY:m.clientY,startW:P.width,startH:P.height,dirX:p?-1:1,dirY:c?1:-1},v.setPointerCapture(m.pointerId),e.setAttribute("data-resizing",""),m.preventDefault()}function u(m){let v=s.current;if(!v||m.pointerId!==v.pointerId||!e)return;let P=(m.clientX-v.startX)*v.dirX,x=(m.clientY-v.startY)*v.dirY;e.style.setProperty(`--${i}-widget-w`,`${v.startW+P}px`),e.style.setProperty(`--${i}-widget-h`,`${v.startH+x}px`)}function f(m){let v=s.current;if(!v||m.pointerId!==v.pointerId||!e)return;m.currentTarget.releasePointerCapture(m.pointerId),e.removeAttribute("data-resizing");let P=e.getBoundingClientRect();o({width:Math.round(P.width),height:Math.round(P.height)}),s.current=null}return l("div",{class:_,role:"separator","aria-orientation":"vertical","aria-label":a.resizeHandle,title:a.resizeHandle,onPointerDown:d,onPointerMove:u,onPointerUp:f,onPointerCancel:f,"data-testid":L.resizeGrip,children:l(Ld,{})})}var g_=M.cssPrefix;function h_({suggestions:e,onPick:t,disabled:n=!1}){return e.length===0?null:l("div",{class:`${g_}-suggestions`,role:"group","aria-label":"Suggested replies",children:e.map((r,o)=>l("button",{type:"button",class:`${g_}-suggestion`,onClick:()=>t(r),disabled:n,"data-testid":lt(L.suggestion,o),children:r.label},r.id))})}var Un=M.cssPrefix,Vb=`.${Un}-header, .${Un}-back-header, .${Un}-home-hero`,Wb='button, a, input, textarea, select, [role="tab"], [contenteditable]',v_=56;function Xa(e,t){D(()=>{if(!t||!e)return;function n(c){return Number.parseFloat(c)||0}function r(c,p){return Math.min(p,Math.max(-p,c))}let o=null,a=c=>{let p=c.target;if(!(p instanceof Element)||!p.closest(Vb)||p.closest(Wb))return;let _=e.getBoundingClientRect();o={id:c.pointerId,x:c.clientX,y:c.clientY,dx:n(e.style.getPropertyValue(`--${Un}-modal-dx`)),dy:n(e.style.getPropertyValue(`--${Un}-modal-dy`)),maxX:(window.innerWidth+_.width)/2-v_,maxY:(window.innerHeight+_.height)/2-v_},e.dataset.dragging="true",c.preventDefault()},i=c=>{if(!o||c.pointerId!==o.id)return;let p=r(o.dx+c.clientX-o.x,o.maxX),_=r(o.dy+c.clientY-o.y,o.maxY);e.style.setProperty(`--${Un}-modal-dx`,`${p}px`),e.style.setProperty(`--${Un}-modal-dy`,`${_}px`)},s=c=>{!o||c.pointerId!==o.id||(o=null,delete e.dataset.dragging)};return e.addEventListener("pointerdown",a),window.addEventListener("pointermove",i),window.addEventListener("pointerup",s),window.addEventListener("pointercancel",s),()=>{e.removeEventListener("pointerdown",a),window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",s),window.removeEventListener("pointercancel",s)}},[e,t])}function Ja({containerRef:e,onDrop:t,disabled:n=!1}){let[r,o]=q(!1);return D(()=>{if(n){o(!1);return}let a=e.current;if(!a)return;let i=0;function s(d){i+=1,d.dataTransfer?.types.includes("Files")&&(d.preventDefault(),o(!0))}function c(){i-=1,!(i>0)&&(i=0,o(!1))}function p(d){d.dataTransfer?.types.includes("Files")&&d.preventDefault()}function _(d){i=0,o(!1),d.dataTransfer&&(d.preventDefault(),t(d.dataTransfer.items))}return a.addEventListener("dragenter",s),a.addEventListener("dragleave",c),a.addEventListener("dragover",p),a.addEventListener("drop",_),()=>{a.removeEventListener("dragenter",s),a.removeEventListener("dragleave",c),a.removeEventListener("dragover",p),a.removeEventListener("drop",_)}},[e,n,t]),{visible:n?!1:r}}var je=M.cssPrefix;function b_(e){let{options:t,onClose:n}=e,r=t.strings,o=B(null);D(()=>{let p=o.current;if(!p)return;let _=Ra(p);function d(u){u.key==="Escape"&&n?.()}return p.addEventListener("keydown",d),()=>{_(),p.removeEventListener("keydown",d)}},[n]);let a=e.composerApiRef,i=e.composerActive&&e.view==="chat"&&e.canSend&&!e.activeForm&&!e.sendPreparing&&e.options.features.fileUpload,s=$(p=>{i&&a.current?.attachFromDrop(p)},[a,i]),{visible:c}=Ja({containerRef:o,onDrop:s,disabled:!i});return Xa(o.current,t.mode==="modal"),l("div",{ref:o,class:`${je}-panel`,part:"panel",role:"dialog","aria-modal":"false","aria-label":r.panelTitle,style:{position:"relative"},"data-testid":L.panel,children:[l(Zs,{...e,containerEl:o.current,dragOver:c}),l(el,{poweredBy:e.options.poweredBy})]})}function Zs(e){let{options:t,transport:n,feedback:r,bus:o,persistence:a,conversationId:i,composerKey:s,panelSize:c,view:p,canSend:_,isStreaming:d,isMemoryCompacting:u,canReleaseQueuedMessages:f,queueManualMessages:m,sendPreparing:v,controlMode:P,assignedOperatorInitials:x,operatorAvailable:k,operatorRequestEnabled:T,onRequestOperator:h,onCancelOperatorRequest:g,loadingMessages:S,onLoadPreviousMessages:w,messagesSig:C,agent:A,suggestions:E,initialWidgetSize:N,onClose:O,onBack:j,onClear:W,onToggleHistory:z,onSelectHistoryConversation:J,onNewConversation:ue,onWidgetSizeChange:ie,onSend:tt,onStop:he,onSuggestion:Te,activeForm:Je,formMarkers:De,onFormSubmit:mt,onFormSkip:Ve,onFormFill:gt,tool:Pt,onRetry:ut,onMessageFeedback:xt,containerEl:St,dragOver:Ae,composerApiRef:Be}=e,Pe=t.strings,nt=Tt(()=>C.value.some(ht=>!ht.ephemeral&&ht.role!=="system")).value,ye;return Je?ye=null:_?ye=l(_e,{children:[P&&P!=="ai-agent"?l(Qb,{controlMode:P,operatorInitials:x,operatorAvailable:k,onCancelOperatorRequest:g,strings:Pe}):null,u&&P==="ai-agent"?l("div",{class:`${je}-loading ${je}-compaction-status`,role:"status","data-testid":L.compactionStatus,children:[l("span",{class:`${je}-loading-spinner`,"aria-hidden":"true"}),Pe.compactingContext]}):null,!d&&!u&&P==="ai-agent"&&l(h_,{suggestions:E,onPick:Te,disabled:v}),l(vp,{options:t,transport:n,feedback:r,bus:o,persistence:a,conversationId:i,isStreaming:d,pageToolRunning:e.pageToolRunning,isMemoryCompacting:u,canReleaseQueuedMessages:f,queueManualMessages:m,active:e.composerActive&&p==="chat",isPreparing:v,operatorRequestEnabled:T,canRequestOperator:nt,controlMode:P,onRequestOperator:h,onSend:tt,onStop:he,apiRef:Be},s)]}):ye=l(Kb,{label:Pe.conversationClosed,ctaLabel:Pe.startNewConversation,onNewConversation:W}),l(_e,{children:[p==="history"?l(Gb,{strings:Pe,onBack:z,onClose:O,showClose:xa(t.mode,c,t.actions)}):l("header",{class:`${je}-header`,part:"header","data-testid":L.panelHeader,children:[j?l("button",{type:"button",class:`${je}-icon-btn`,onClick:j,"aria-label":Pe.moduleBack,title:Pe.moduleBack,children:l(Zr,{})}):null,A?l(Tp,{agent:A,strings:Pe}):l("h1",{children:Pe.panelTitle}),l(Gt,{panelProps:e,variant:"chat"})]}),p==="history"?l(Ba,{transport:n,strings:Pe,locale:t.locale,persistence:a,onSelect:J,onNewConversation:ue}):l(_e,{children:[l(Mp,{visible:Ae,strings:Pe}),l(m_,{messagesSig:C,strings:Pe,responseMode:t.responseMode,showReasoning:t.showReasoning,showToolCalls:t.showToolCalls,showSources:t.showSources,enableMessageFeedback:t.enableMessageFeedback,onFeedback:xt,loading:S,onLoadPreviousMessages:w,idle:!d&&!v&&_&&!Je,controlMode:P,tool:Pt,onRetry:ut,form:Je?{form:Je,onSubmit:mt,onSkip:Ve}:null,formMarkers:De,onFillForm:gt}),ye,l(Jb,{disclaimer:t.composerDisclaimer})]}),t.size.resize?.enabled?l(Qa,{panelEl:St,resize:t.size.resize,position:t.position,initialSize:N,onSizeChange:ie,strings:Pe}):null]})}function Gb({strings:e,onBack:t,onClose:n,showClose:r}){return l("header",{class:`${je}-header`,part:"header",children:[l("button",{type:"button",class:`${je}-icon-btn`,onClick:t,"aria-label":e.historyBack,title:e.historyBack,children:l(Zr,{})}),l("h1",{children:e.historyTitle}),r?l("button",{type:"button",class:`${je}-icon-btn`,onClick:n,"aria-label":e.close,title:e.close,children:l(Bt,{})}):null]})}function Kb({label:e,ctaLabel:t,onNewConversation:n}){return l("div",{class:`${je}-readonly-banner`,role:"note",children:[l("span",{class:`${je}-readonly-label`,children:e}),l("button",{type:"button",class:`${je}-readonly-cta`,onClick:n,children:t})]})}function Qb({controlMode:e,operatorInitials:t,operatorAvailable:n,onCancelOperatorRequest:r,strings:o}){let a=Xb(e,t,n,o);return l("div",{class:`${je}-operator-banner`,role:"status","data-mode":e,"data-testid":L.operatorBanner,children:[l("span",{class:`${je}-operator-pulse`,"aria-hidden":"true"}),l("span",{class:`${je}-operator-label`,children:a}),e==="awaiting-operator"&&r?l("button",{type:"button",class:`${je}-cancel-operator-request`,"data-testid":L.cancelOperatorRequest,onClick:r,children:o.cancelOperatorRequest}):null]})}function Xb(e,t,n,r){return e==="operator"?r.chattingWithOperator.replace("{operator}",t??""):n===!1?r.noOperatorAvailable:r.connectingOperator}function Jb({disclaimer:e}){return e?l("div",{class:`${je}-composer-footer`,children:l("div",{class:`${je}-disclaimer`,children:e})}):null}function el({poweredBy:e}){return e?l("div",{class:`${je}-poweredby-bar`,children:l(Yb,{logoUrl:e.logoUrl,text:e.text,href:e.href})}):null}function Yb({logoUrl:e,text:t,href:n}){let r=l(_e,{children:[e?l("img",{class:`${je}-poweredby-logo`,src:e,alt:"",loading:"lazy"}):null,t?l("span",{children:t}):null]});return n?l("a",{class:`${je}-poweredby`,href:n,target:"_blank",rel:"noopener noreferrer",children:r}):l("span",{class:`${je}-poweredby`,children:r})}var Ya=M.cssPrefix;function y_({panelProps:e,enabledModules:t,nav:n,bus:r,hasUnread:o,latestNews:a,onSelectConversation:i,onStartNewConversation:s,onSetPanelSize:c}){let p=e.options,_=p.strings,d=B(null),u=B(new Set);D(()=>{let W=d.current;if(!W)return;let z=Ra(W);function J(ue){ue.key==="Escape"&&e.onClose?.()}return W.addEventListener("keydown",J),()=>{z(),W.removeEventListener("keydown",J)}},[e.onClose]);let f=Tt(()=>n.sig.value).value,m=yd(f),v=p.modules.byId[f.activeTab],P=e.composerActive&&v?.layout==="chat"&&m===void 0,x=e.composerApiRef,k=P&&e.view==="chat"&&e.canSend&&!e.activeForm&&!e.sendPreparing&&e.options.features.fileUpload,T=$(W=>{k&&x.current?.attachFromDrop(W)},[x,k]),{visible:h}=Ja({containerRef:d,onDrop:T,disabled:!k});Xa(d.current,p.mode==="modal");let g=m?.kind==="iframe"||m?.kind==="content",S=t.length>1&&(Pd(f)||!g),w=B(null);D(()=>{if(g&&w.current===null)w.current=e.panelSize,e.panelSize==="normal"&&c("expanded");else if(!g&&w.current!==null){let W=w.current;w.current=null,c(W)}},[g]);let C={push:W=>n.push(W),pop:()=>n.pop(),switchTab:W=>n.switchTab(W),switchToLayout:W=>{let z=t.find(J=>J.layout===W);z&&n.switchTab(z.id)},selectConversation:i,startNewConversation:s};function A(W){return{options:p,transport:e.transport,strings:_,config:W,nav:C,bus:r,panelProps:e,latestNews:a}}let E=l(Gt,{panelProps:e,variant:"plain"});v&&u.current.add(v.id);let N=t.filter(W=>u.current.has(W.id));function O(W){if(W.layout==="chat")return l(Zs,{...e,composerActive:P,containerEl:d.current,dragOver:h});let z=Da[W.layout].Root;return z?l(z,{...A(W)}):null}function j(){return m?.kind==="iframe"?l(Cp,{url:m.url,title:m.title,strings:_,onBack:()=>n.pop(),actions:E}):m?.kind==="content"?l(sp,{id:m.id,title:m.title,transport:e.transport,strings:_,bus:r,onBack:()=>n.pop(),actions:E}):null}return l("div",{ref:d,class:`${Ya}-panel ${Ya}-messenger`,part:"panel",role:"dialog","aria-modal":"false","aria-label":_.panelTitle,style:{position:"relative"},"data-testid":L.messengerHome,children:[l("div",{class:`${Ya}-messenger-body`,children:[N.map(W=>l("div",{class:`${Ya}-messenger-pane`,hidden:g||W.id!==v?.id,children:O(W)},W.id)),j()]}),S?l(kp,{modules:t,activeTab:f.activeTab,strings:_,hasUnread:o,onSelect:W=>n.switchTab(W)}):null,l(el,{poweredBy:p.poweredBy}),p.size.resize?.enabled&&!(v?.layout==="chat"&&!m)?l(Qa,{panelEl:d.current,resize:p.size.resize,position:p.position,initialSize:e.initialWidgetSize,onSizeChange:e.onWidgetSizeChange,strings:_}):null]})}var co=M.cssPrefix;function P_({strings:e,onClose:t}){return l("div",{class:`${co}-panel ${co}-modules-empty`,part:"panel",role:"dialog","aria-label":e.panelTitle,"data-testid":L.modulesEmpty,children:[t?l("button",{type:"button",class:`${co}-icon-btn ${co}-modules-empty-close`,onClick:t,"aria-label":e.close,title:e.close,children:l(Bt,{})}):null,l("p",{class:`${co}-modules-empty-text`,children:e.modulesEmpty})]})}function x_(e){let t=M.cssPrefix,{site:n,blocks:r,strings:o,collapsed:a}=e,i=r?.navigation??[],s=r?.linkCards??[],c=a?o.expandSidebar:o.collapseSidebar;return l("aside",{class:`${t}-sidebar`,"data-collapsed":a?"true":"false","data-testid":L.sidebar,children:[l("div",{class:`${t}-sidebar-header`,children:[l(Zb,{site:n}),l("button",{type:"button",class:`${t}-sidebar-toggle`,"aria-label":c,"aria-expanded":a?"false":"true",title:c,onClick:e.onToggleCollapsed,"data-testid":L.sidebarToggle,children:l(ey,{collapsed:a})})]}),a?null:l(_e,{children:[i.length>0?l("nav",{class:`${t}-sidebar-section`,"data-section":"navigation",children:l(ty,{items:i})}):null,s.length>0?l("div",{class:`${t}-sidebar-section`,"data-section":"link-cards",children:l(ny,{items:s})}):null,e.showConversations?l("div",{class:`${t}-sidebar-conversations`,children:l(Ba,{transport:e.transport,strings:e.strings,locale:e.locale,persistence:e.persistence,onSelect:e.onSelectConversation,onNewConversation:e.onNewConversation})}):null]})]})}function Zb({site:e}){let t=M.cssPrefix;if(e?.logo?.url){let n=e.logo.alt??e.title??"Logo";return l("picture",{children:[e.logoDark?.url?l("source",{srcset:e.logoDark.url,media:"(prefers-color-scheme: dark)"}):null,l("img",{class:`${t}-sidebar-logo`,src:e.logo.url,alt:n})]})}return l("div",{class:`${t}-sidebar-title`,children:e?.title??M.name})}function ey({collapsed:e}){return l("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true",children:e?l("polyline",{points:"9 6 15 12 9 18"}):l("polyline",{points:"15 6 9 12 15 18"})})}function ty({items:e}){let t=M.cssPrefix;return l("ul",{class:`${t}-sidebar-nav`,children:e.map(n=>l("li",{children:l("a",{class:`${t}-sidebar-nav-item`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[n.icon?l("span",{class:`${t}-sidebar-nav-icon`,"data-icon":n.icon}):null,l("span",{class:`${t}-sidebar-nav-label`,children:n.label})]})},n.id??n.label))})}function ny({items:e}){let t=M.cssPrefix;return l("div",{class:`${t}-sidebar-cards`,children:e.map(n=>l("a",{class:`${t}-sidebar-card`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[l("div",{class:`${t}-sidebar-card-label`,children:n.label}),n.description?l("div",{class:`${t}-sidebar-card-desc`,children:n.description}):null]},n.id??n.label))})}var S_=M.cssPrefix;function k_(e){return l("main",{class:`${S_}-page-shell`,"data-sidebar-collapsed":e.sidebarCollapsed?"true":"false",children:[l(x_,{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}),l("section",{class:`${S_}-page-chat`,"aria-label":e.strings.panelTitle,children:e.children})]})}var uo=se.scope("hitl");function Za(e){return e.kind==="tool"&&an(e.toolMetadata)&&(e.stateSig.value==="input-available"||e.stateSig.value==="approval-responded"&&e.approvalSig.value?.approved===!0)}function w_(e,t){t.errorSig.value=Vs(t.toolCallId),t.stateSig.value="output-error",e.partsSig.value=[...e.partsSig.value]}function ry(e,t){let n=e.slice(0,e.indexOf(t)).findLast(r=>r.role==="user");return n!==void 0&&Rt.sentHere(n.id)}function C_(e){let{streaming:t,controlModeSig:n,messagesSig:r,sendAiTurn:o,bus:a,humanInLoop:i,tools:s}=e,c=B(t);c.current=t;let p=B(s);p.current=s;let _=B(new Map),[d,u]=q(!1),f=$((h,g,S)=>{if(c.current||n.value!=="ai-agent")return!1;let w=r.value.at(-1),C=w?.partsSig.value.findIndex(N=>N.kind==="tool"&&N.toolCallId===h)??-1,A=w?.partsSig.value[C];if(!w||A?.kind!=="tool")return uo.warn("decideTool: tool part not found",{toolCallId:h}),!1;if(w.status!=="complete"||!ha(w,C)||!g(A))return!1;if(S(A),w.partsSig.value=[...w.partsSig.value],!Ln(w)||w.partsSig.value.some(Za))return!0;w.status="streaming",w.retryAction={kind:"continue-assistant",messageId:w.serverMessageId??w.id},w.awaitingContinuation=!0,r.value=[...r.value];let E=w.partsSig.value.flatMap(N=>N.kind==="tool"?[N.toolCallId]:[]);return o({continueExisting:!0}).then(N=>N&&Rt.clear(E)),!0},[n,r,o]),m=$((h,g)=>{let{toolCallId:S,toolName:w}=g;_.current.has(S)||(_.current.set(S,h),u(!0),Zp({toolCallId:S,toolName:w,input:g.inputSig.value,optionTools:p.current??[],onSettled:(C,A)=>{uo.info("toolResult",{toolCallId:S,status:C}),a.emit("toolResult",{toolCallId:S,name:lo(w),status:C,durationMs:A})}}).then(C=>{_.current.delete(S)&&(u(_.current.size>0),f(S,Za,A=>{C.state==="output-available"?A.outputSig.value=C.output:A.errorSig.value=C.errorText,A.stateSig.value=C.state}))}))},[a,f]),v=$(()=>{let h=r.value;for(let[w,C]of _.current){let A=h.findIndex(E=>E.id===C);A<0||A===h.length-1||(_.current.delete(w),e_(w),u(_.current.size>0))}let g=h.at(-1);if(c.current||g?.role!=="assistant"||g.status!=="complete")return;let S=g.partsSig.value.filter(w=>Za(w)&&w.stateSig.value==="input-available");if(!(S.length===0||!ry(h,g)))for(let w of S)Rt.get(w.toolCallId)?.state==="stopped"?w_(g,w):m(g.id,w)},[r,m]);D(()=>v(),[t,v]),D(()=>r.subscribe(()=>v()),[r,v]);let P=$((h,g,S)=>{let w=!1,C;if(!f(h,N=>N.stateSig.value==="approval-requested",N=>{an(N.toolMetadata)&&(C=N),w=Ua(N.toolName);let O=N.approvalSig.value?.id??h;N.approvalSig.value={id:O,approved:g,reason:S},N.stateSig.value="approval-responded"}))return;let E=r.value.at(-1);if(C&&g&&E&&m(E.id,C),C&&!g&&a.emit("toolResult",{toolCallId:h,name:lo(C.toolName),status:"declined",durationMs:0}),w){uo.info("toolResult",{toolCallId:h}),a.emit("toolResult",{toolCallId:h});return}uo.info("toolDecision",{toolCallId:h,approved:g}),a.emit("toolDecision",{toolCallId:h,approved:g})},[a,f,r,m]),x=$(h=>{f(h,g=>g.stateSig.value==="approval-responded"&&g.approvalSig.value?.approved!==void 0&&!Za(g),g=>{let S=g.approvalSig.value?.id??h;g.approvalSig.value={id:S},g.stateSig.value="approval-requested"})},[f]),k=ce(()=>({humanInLoop:i,onDecision:P,onEdit:x}),[i,P,x]),T=$(()=>{let h=r.value.at(-1);for(let g of _.current.keys()){let S=h?.partsSig.value.find(w=>w.kind==="tool"&&w.toolCallId===g);h&&S?w_(h,S):Vs(g),uo.info("toolResult",{toolCallId:g,status:"stopped"}),a.emit("toolResult",{toolCallId:g,name:S?lo(S.toolName):void 0,status:"stopped",durationMs:0})}_.current.clear(),u(!1)},[a,r]);return{toolInteraction:k,pageToolsRunning:d,stopPageTools:T}}var oy=se.scope("latest-news");function T_({transport:e,options:t,persistence:n,enabled:r}){let o=t.modules.list.find(d=>d.layout==="news")?.contentCollectionIds,a=o?.join(","),[i,s]=q(),[c,p]=q(()=>n.loadSeenNewsId());D(()=>{if(!r||!o?.length)return;let d=!1;return e.listContent({contentCollectionIds:o,sortBy:"publishedAt",sortOrder:"desc",limit:1}).then(u=>{d||s(u.items[0])}).catch(u=>oy.debug("listContent (latest news) failed (non-fatal)",{err:u})),()=>{d=!0}},[e,r,a]);let _=$(d=>{n.saveSeenNewsId(d),p(d)},[n]);return{item:i,unseen:i!==void 0&&i.id!==c,markSeen:_}}function R_({callout:e,persistence:t}){let n=e?.text??"",r=e?.persistent??!0,[o,a]=q(()=>r?!1:t.loadCalloutDismissed(n));D(()=>{a(r?!1:t.loadCalloutDismissed(n))},[n,r,t]);let i=$(()=>{a(!0),r||t.saveCalloutDismissed(n)},[t,n,r]);return{dismissed:o,dismissCallout:i}}function I_(e){let{transport:t,conversationIdSig:n}=e,r=Et("ai-agent"),o=Et(void 0),a=Et(void 0),i=B(void 0),s=$(d=>{let u=d.controlRevision,f=i.current;f&&f.conversationId===n.value&&u<f.revision||(i.current={conversationId:n.value,revision:u},r.value=d.controlMode,o.value=d.assignedOperatorInitials,d.controlMode!=="awaiting-operator"?a.value=void 0:d.operatorAvailable!==void 0&&(a.value=d.operatorAvailable))},[n,r,o,a]),c=$(d=>{if(d.type!=="data-control-state")return;let u=Qu(d.data);u&&s(u)},[s]),p=$(async()=>{let d=n.value,u=await t.requestOperator();u&&n.value===d&&s(u)},[t,n,s]),_=$(async()=>{let d=n.value,u=await t.cancelOperatorRequest();u&&n.value===d&&s(u)},[t,n,s]);return{controlModeSig:r,assignedOperatorInitialsSig:o,operatorAvailableSig:a,applyControlState:s,adoptControlStateChunk:c,requestOperator:p,cancelOperatorRequest:_}}var ei=M.cssPrefix,A_=`--${ei}-visual-viewport-height`,E_=`--${ei}-visual-viewport-top`;function M_(e){let{hostElement:t,mode:n,panelSize:r,isOpen:o,surfaceReady:a,setIsOpen:i}=e;Ct(()=>{Fo(t,Sa(n,r,o))},[t,o,r,n]),Ct(()=>{if(!o||!a)return;let s=t.ownerDocument.defaultView,c=s?.visualViewport,p=t.shadowRoot?.querySelector(`.${ei}-anchor`);if(!s||!c||!p)return;let _=()=>{p.style.setProperty(A_,`${c.height}px`),p.style.setProperty(E_,`${c.offsetTop}px`)},d=0,u=()=>{s.cancelAnimationFrame(d),d=s.requestAnimationFrame(()=>{d=s.requestAnimationFrame(_)})};return _(),c.addEventListener("resize",u),c.addEventListener("scroll",u),()=>{s.cancelAnimationFrame(d),c.removeEventListener("resize",u),c.removeEventListener("scroll",u),p.style.removeProperty(A_),p.style.removeProperty(E_)}},[t,o,a]),D(()=>{if(n!=="modal"||!o)return;function s(c){c.composedPath().some(_=>_ instanceof HTMLElement&&_.classList.contains(`${ei}-panel`))||i(!1)}return t.addEventListener("click",s),()=>t.removeEventListener("click",s)},[t,o,n,i]),D(()=>{if(n!=="drawer"||!o)return;function s(c){c.key==="Escape"&&i(!1)}return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[o,n,i])}var tl=se.scope("reducer"),ti=class{constructor(t,n){te(this,"messagesSig",t);te(this,"onReconcileNeeded",n);te(this,"active",null);te(this,"openTextParts",new Map);te(this,"partSeq",0);te(this,"replay",null)}attach(t){this.active=t,this.openTextParts.clear()}detach(){this.active=null,this.replay=null,this.openTextParts.clear()}beginReplay(t,n){let r=rn();r.id=t.id;let o=qn(t)||On(t)&&(t.status!=="streaming"||Ln(t)),a=t.status==="streaming"&&Ln(t)&&Gr(t);this.replay={baseline:t,shadow:r,chunks:[n],probeContinuation:o,continuationTailReplay:a,liveCatchUp:t.status==="streaming"&&!o},this.attach(r),this.apply(n)}refreshReplayBaseline(){let t=this.replay;if(!t)return null;let n=t.shadow.serverMessageId??t.baseline.serverMessageId,r=this.messagesSig.value,o=r.at(-1),a=o===t.baseline||o?.id===t.baseline.id||n!==void 0&&o?.serverMessageId===n?o:r.find(s=>s===t.baseline)??r.find(s=>s.id===t.baseline.id||n!==void 0&&s.serverMessageId===n);if(!a)return this.detach(),null;if(a===t.baseline)return t;let i=t.baseline;return t.baseline=a,N_(i,a),t.liveCatchUp&&qn(t.shadow)&&(a.status==="streaming"||On(a))?(t.probeContinuation=!1,t.continuationTailReplay=!1,t):(t.probeContinuation=qn(a)||On(a)&&(a.status!=="streaming"||Ln(a)),t.continuationTailReplay=a.status==="streaming"&&Ln(a)&&Gr(a),t.liveCatchUp=a.status==="streaming"&&!t.probeContinuation,t)}refreshActive(){let t=this.active;if(!t)return null;let n=t.serverMessageId,r=this.messagesSig.value,o=r.at(-1),a=o===t||o?.id===t.id||n!==void 0&&o?.serverMessageId===n?o:r.find(s=>s===t)??r.find(s=>s.id===t.id||n!==void 0&&s.serverMessageId===n);if(!a)return this.detach(),null;if(a===t)return t;N_(t,a);let i=qn(t)&&On(a);return a.status!=="streaming"&&!i?(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 Dt(()=>{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:r}=this.replay,o=va(n);return this.replay=null,Dt(()=>{if(t){let a=n.partsSig.value.findLastIndex(i=>i.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 r)this.apply(a);n.continuationStreaming=o||void 0,this.messagesSig.value=[...this.messagesSig.value]}),n}settleOwnedContinuation(t){let{baseline:n}=this.replay,r=va(n);return this.replay=null,Dt(()=>{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=r||void 0,this.messagesSig.value=[...this.messagesSig.value]}),n}applyResume(t){if(t.type==="start"){let o=(this.replay?.baseline??this.active)?.serverMessageId;o!==void 0&&t.messageId!==void 0&&o!==t.messageId&&this.onReconcileNeeded?.({messageId:o}),this.detach();let a=t.messageId,i=a!==void 0?this.messagesSig.value.find(_=>_.serverMessageId===a||_.id===a):void 0;if(i!==void 0)return t.messageMetadata?.senderRole==="visitor"&&i.role==="user"&&(i.status==="pending"||i.status==="error")&&(i.serverMessageId=a,i.status="complete",i.errorText=void 0,i.retryAction=void 0,this.messagesSig.value=[...this.messagesSig.value]),this.beginReplay(i,t),null;let s=t.messageMetadata?.senderRole,c=this.messagesSig.value.at(-1);if(s===void 0&&c?.role==="assistant"&&c.status==="streaming"&&c.serverMessageId===void 0&&!jt(c))return this.attach(c),this.apply(t),null;let p=rn();return this.attach(p),this.messagesSig.value=[...this.messagesSig.value,p],this.apply(t),null}if(this.replay){let r=this.refreshReplayBaseline();if(!r)return null;r.chunks.push(t),t.type==="data-control-state"&&(r.baseline.operatorRoutedTurn=t.data.controlMode!=="ai-agent"),this.apply(t);let{baseline:o,shadow:a,probeContinuation:i,continuationTailReplay:s,liveCatchUp:c}=r,p=t.type==="finish"||t.type==="error"||t.type==="abort";if(i){if(!sy(o,a,t))return p&&(dy(o,a)&&(o.continuationStreaming=!0,this.messagesSig.value=[...this.messagesSig.value],this.onReconcileNeeded?.({messageId:o.serverMessageId??o.id})),this.detach()),null;let d=qn(o)&&p?this.settleOwnedContinuation(t):this.promoteContinuation();return p?(d.continuationStreaming&&(t.type==="finish"?this.onReconcileNeeded?.({messageId:d.serverMessageId??d.id}):d.continuationStreaming=!1),this.detach(),d):null}if(s&&iy(o,a)){let d=this.promoteContinuation(!0);return p?(this.detach(),d):null}if(!c)return p&&this.detach(),null;if(p&&!jt(o)&&jt(a)){let d=this.promoteReplay();return this.detach(),d}if(!ay(o,a))return p&&(this.onReconcileNeeded?.({messageId:o.serverMessageId??o.id}),this.detach()),null;let _=this.promoteReplay();return p?(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 r=n;return r.continuationStreaming&&(t.type==="finish"?this.onReconcileNeeded?.({messageId:r.serverMessageId??r.id}):r.continuationStreaming=!1),this.detach(),r}return null}ensureTextPart(t,n,r){let o=`${n}:${r}`,a=this.openTextParts.get(o);if(a)return a;let i={kind:n,id:`${r}#${this.partSeq++}`,textSig:ae(""),doneSig:ae(!1)};return this.openTextParts.set(o,i),po(t,i),i}apply(t){let n=this.active;if(n)switch(t.type){case"start":{t.messageId&&(n.serverMessageId=t.messageId);let r=t.messageMetadata;r?.senderRole==="operator"?(n.role="operator",r.operatorInitials&&(n.operatorInitials=r.operatorInitials)):r?.senderRole==="visitor"&&(n.role="user");return}case"finish-step":this.openTextParts.clear();return;case"start-step":po(n,{kind:"step-start",id:`ss-${this.partSeq++}`});return;case"finish":tl.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":tl.warn("stream error chunk",{errorText:t.errorText}),n.status="error",n.errorText=t.errorText,this.bumpDone(n);return;case"abort":tl.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 r=this.ensureTextPart(n,"text",t.id);r.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 r=this.ensureTextPart(n,"reasoning",t.id);r.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":py(n,t);return;case"file":po(n,{kind:"file",url:t.url,mediaType:t.mediaType});return;case"source-url":L_(n,{kind:"source",sourceId:t.sourceId,url:t.url,title:t.title});return;case"source-document":L_(n,{kind:"source",sourceId:t.sourceId,title:t.title,filename:t.filename,mediaType:t.mediaType});return;case"data-suggestions":n.suggestions=ma(t.data);return;case"data-control-state":n.operatorRoutedTurn=t.data.controlMode!=="ai-agent";return;case"data-memory-compaction-state":return;default:{let r=t}}}bumpDone(t){Dt(()=>{t.partsSig.value=[...t.partsSig.value],this.messagesSig.value.includes(t)&&(this.messagesSig.value=[...this.messagesSig.value])})}},nl={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function qn(e){return e.awaitingContinuation===!0||e.continuationStreaming===!0||e.retryAction?.kind==="continue-assistant"}function N_(e,t){e.canceled&&(t.canceled=!0),!(!qn(e)||t.status!=="streaming"&&!On(t))&&(t.awaitingContinuation??(t.awaitingContinuation=e.awaitingContinuation),t.continuationStreaming??(t.continuationStreaming=e.continuationStreaming),t.retryAction===void 0&&(t.retryAction=e.retryAction))}function ay(e,t){let n=e.partsSig.value,r=t.partsSig.value;return e.role!==t.role||r.length<n.length?!1:n.every((o,a)=>O_(o,r[a]))}function iy(e,t){let n=e.partsSig.value,r=n.findLastIndex(s=>s.kind==="tool"),o=new Set(n.slice(0,r+1).flatMap(s=>s.kind==="tool"?[s.toolCallId]:[])),a=t.partsSig.value.filter(s=>s.kind!=="tool"||!o.has(s.toolCallId)),i=n.slice(r+1);return a.length<i.length?!1:i.every((s,c)=>O_(s,a[c]))}function O_(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||!ba(t.toolName,e.toolName)||nl[t.stateSig.value]<nl[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 sy(e,t,n){return ly(e,n)||!cy(e,t)?!0:n.type!=="finish"&&n.type!=="error"&&n.type!=="abort"?!1:Gr(t)||e.awaitingContinuation===!0&&n.type!=="finish"?!0:e.awaitingContinuation===!0&&t.partsSig.value.every(r=>r.kind==="step-start")}function ly(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(r=>r.kind==="tool"&&r.toolCallId===t.toolCallId);return n!==void 0&&nl[n.stateSig.value]<4}function cy(e,t){let n=t.partsSig.value;if(n.length===0)return!0;let r=e.partsSig.value;return r.some((o,a)=>n.every((i,s)=>uy(r[a+s],i)))}function uy(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"||ba(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 dy(e,t){if(qn(e)||!On(e))return!1;let n=new Set(e.partsSig.value.filter(o=>o.kind==="tool").map(o=>o.toolCallId));return!t.partsSig.value.some(o=>o.kind==="tool"&&n.has(o.toolCallId))}function Pn(e,t,n,r,o){let a=e.partsSig.value.find(s=>s.kind==="tool"&&s.toolCallId===t);if(a)return r&&(a.dynamic=!0),a.toolMetadata??(a.toolMetadata=o),a;let i={kind:"tool",toolCallId:t,toolName:n??"tool",dynamic:r?!0:void 0,toolMetadata:o,inputPartialSig:ae(""),inputSig:ae(void 0),outputSig:ae(void 0),errorSig:ae(void 0),stateSig:ae("input-streaming"),approvalSig:ae(void 0)};return po(e,i),i}function po(e,t){e.partsSig.value=[...e.partsSig.value,t]}function L_(e,t){e.partsSig.value.some(n=>n.kind==="source"&&n.sourceId===t.sourceId)||po(e,t)}function py(e,t){switch(t.type){case"tool-input-start":Pn(e,t.toolCallId,t.toolName,t.dynamic,t.toolMetadata);return;case"tool-input-delta":{let n=Pn(e,t.toolCallId);n.inputPartialSig.value+=t.inputTextDelta;return}case"tool-input-available":{let n=Pn(e,t.toolCallId,t.toolName,t.dynamic,t.toolMetadata);n.inputSig.value=t.input,n.stateSig.value="input-available";return}case"tool-input-error":{let n=Pn(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=Pn(e,t.toolCallId,t.toolName);n.approvalSig.value={id:t.approvalId},n.stateSig.value="approval-requested";return}case"tool-output-available":{let n=Pn(e,t.toolCallId,void 0,t.dynamic);n.outputSig.value=t.output,n.stateSig.value="output-available";return}case"tool-output-error":{let n=Pn(e,t.toolCallId,void 0,t.dynamic);n.errorSig.value=t.errorText,n.stateSig.value="output-error";return}case"tool-output-denied":{let n=Pn(e,t.toolCallId);n.stateSig.value="output-denied";return}default:return}}async function $_(e){let t=1e3,n=!1,r=!1,o=!1;function a(){o||e.signal.aborted||(o=!0,e.onInitialBoundaryReady())}for(;!e.signal.aborted;){let i,s="held";try{s=await e.connect(()=>{if(e.signal.aborted)return;i=e.now();let c=n||r;n=!0,r=!1,o?c&&e.backfill():a()})}catch{}if(e.signal.aborted||(!n&&i===void 0&&(r=!0,a()),s==="unavailable"))return;i!==void 0&&e.now()-i>=1e3&&(t=1e3),await e.sleep(t),t=Math.min(t*2,15e3)}}var _y=120;function D_(e){let{activated:t,conversationReady:n,conversationIdSig:r,messagesSig:o,optionsRef:a,transport:i,visitorId:s,adoptControlStateChunk:c,adoptMemoryCompactionStateChunk:p,settleSuggestions:_,recordConversationReply:d,transcriptRecoverySig:u,beginConversationTranscript:f,commitConversationTranscript:m,onReplyLanded:v,runCancellation:P,canContinueRef:x,setCanSend:k,feedback:T,bus:h,loadInitialThread:g,shouldReconcileOnConnect:S}=e,w=B(0);D(()=>{if(!t||!n||!r.value)return;let C=r.value,A=new AbortController,E=b=>{},N=new ti(o,b=>E(b));i.primeIdentity(s,C);let O=!1,j=!1,W,z=!1,J,ue=0,ie=x.current,tt,he,Te=Date.now(),Je,De=!1,mt=!1;function Ve(b,U,X){if(!jt(b))return;let Y=o.value.findLast(Re=>!Re.ephemeral),re=b.serverMessageId??b.id;if(!(Y&&(Y.serverMessageId??Y.id)!==re))return ga(o.value,b,C,a.current.strings.newConversation,U,X)}function gt(b,U,X,Y){let re=Ve(b,U,Y);if(!re)return;let xe=`${b.serverMessageId??b.id}:${X}:${re.preview??""}`;xe!==he&&(he=xe,i.publishConversation({...re,hasUnread:!0},!0))}let Pt;function ut(){Pt&&(clearTimeout(Pt.timer),Pt=void 0)}function xt(){let b=Pt;if(!b)return;clearTimeout(b.timer),Pt=void 0;let U=o.value.find(X=>(X.serverMessageId??X.id)===b.replyId);U?.role!=="assistant"&&U?.role!=="operator"||gt(U,b.canContinue,b.generation,b.activityAt)}function St(b,U,X,Y){ut(),Pt={replyId:b.serverMessageId??b.id,canContinue:U,generation:X,activityAt:Y,timer:setTimeout(xt,_y)}}function Ae(b,U,X,Y=Date.now(),re=!0){ut();let Re=Ve(b,U,Y);if(!Re)return;let ge=`${b.serverMessageId??b.id}:${X}`;ge!==tt&&(tt=ge,d(Re),re&&Je&&(De=!0))}function Be(b,U){(b||!P.localSendRef.current)&&P.settle(U),b&&v()}function Pe(b,U=[],X=!1,Y,re=ie,Re=ue,xe=Date.now(),ge=!0){let pt=a.current;if(b.canceled){Ae(b,re,Re,xe,ge),Be(X,Y);return}let pe=!0,rt=b.status==="error";switch(ad(b,rt)){case"drop":o.value=o.value.filter(Fe=>Fe!==b),pe=!1;break;case"complete-operator-routed":b.status="complete",X&&(T.play("messageReceived"),cr(h,pt,"assistant",ze(b)));break;case"error":{if(b.status="error",b.errorText=pt.strings.errorGeneric,X){T.play("error");let Fe=new Error(rt?"stream error chunk":"empty reply");h.emit("error",Fe),pt.onError?.(Fe)}break}case"complete":b.status="complete",X&&(T.play("messageReceived"),cr(h,pt,"assistant",ze(b))),_(b,U);break}pe&&Ae(b,re,Re,xe,ge),Be(X,Y)}function nt(b){if(A.signal.aborted||r.value!==C)return;if(c(b),p?.(b),b.type==="start"){xt();let Fe=b.messageId===void 0?void 0:o.value.find(F=>F.serverMessageId===b.messageId||F.id===b.messageId);z=Fe!==void 0&&Fe.status!=="streaming";let qt=J?.senderRole==="visitor"?J.messageId:void 0;if(J={messageId:b.messageId,senderRole:b.messageMetadata?.senderRole},ue+=1,Te=Date.now(),he=void 0,O=b.messageMetadata?.senderRole===void 0,j=!1,W=O?b.messageMetadata?.runId:void 0,O){let F=b.messageId!==void 0&&o.value.some(ot=>ot.serverMessageId===b.messageId||ot.id===b.messageId),K=o.value.at(-1),Z=b.messageId!==void 0&&(K?.serverMessageId===b.messageId||K?.id===b.messageId),fe=P.localSendRef.current&&(!F||Z)&&K?.role==="assistant"&&K.status==="streaming"&&(Z||K.serverMessageId===void 0&&K.partsSig.value.length===0);j=P.captureStart(C,b,fe,qt)}}let U=O&&(b.type==="finish"||b.type==="error"||b.type==="abort"),X=U?W:void 0,Y=U&&(j||P.ownsLocalRun(X)),re=ue,Re=z;b.type==="finish"&&b.canContinue!==void 0&&(ie=b.canContinue);let xe=ie;U&&(O=!1,j=!1,W=void 0);let ge=N.applyResume(b),pt=J?.messageId,pe=pt===void 0?void 0:o.value.find(Fe=>Fe.serverMessageId===pt||Fe.id===pt);z&&J?.senderRole!=="visitor"&&(ge!==null||pe?.status==="streaming")&&(z=!1,Re=!1);let rt=!z&&(pe?.role==="assistant"||pe?.role==="operator");if(b.type==="text-delta"&&rt&&St(pe,ie,ue,Te),b.type==="text-end"&&(ut(),rt&&gt(pe,ie,ue,Te)),b.type==="finish"&&b.canContinue===!1&&k(!1),!ge){U&&(Y||!P.localSendRef.current)&&P.settle(X);return}if(ge.role==="operator"){Re||(T.play("messageReceived"),cr(h,a.current,"operator",ze(ge))),Ae(ge,xe,re,Te),z=!1,U&&(Y||!P.localSendRef.current)&&P.settle(X);return}ge.role==="assistant"&&(Pe(ge,[],Y,X,xe,re,Te),z=!1)}async function ye(b){let U=ue,X=await i.loadConversation(C,b?{ids:[b]}:void 0).catch(()=>null);if(A.signal.aborted||r.value!==C||!X)return!1;X.controlState&&c({type:"data-control-state",data:X.controlState});let Y=o.value.at(-1),re=U===ue&&(b===void 0||Y!==void 0&&(Y.serverMessageId===b||Y.id===b));if(X.messages.length===0)return!0;re&&(ie=X.canContinue,k(ie));let Re=o.value,xe=b===void 0?Re.at(-1):Re.find(F=>F.serverMessageId===b||F.id===b),{messages:ge,changed:pt}=Kr(Re,gn(X.messages));if(!pt)return!0;o.value=ge;let pe=b===void 0?ge.at(-1):ge.find(F=>F.serverMessageId===b||F.id===b),rt=xe!==void 0&&pe!==void 0&&(xe.id===pe.id||xe.serverMessageId!==void 0&&xe.serverMessageId===pe.serverMessageId),Fe=pe!==void 0&&pe.status!=="streaming"&&(!rt||xe?.status==="streaming"),qt=rt&&xe?.status==="streaming"?Date.now():pe?.createdAt;return re&&Fe&&pe.role==="assistant"?Pe(pe,pe.suggestions??[],P.localSendRef.current,void 0,X.canContinue,U,qt,!1):re&&Fe&&pe.role==="operator"?Ae(pe,X.canContinue,U,qt,!1):re&&pe?.role==="assistant"&&pe.status!=="streaming"&&_(pe,pe.suggestions??[]),!0}let ht=new Set;E=({messageId:b})=>{if(ht.has(b)||!o.value.some(X=>X.serverMessageId===b||X.id===b))return;ht.add(b);function U(){return ht.delete(b)}ye(b).then(U,U)};function We(b=!1){if(A.signal.aborted||r.value!==C){De=!1;return}if(Je){De=!0;return}let U=b?g(C)??(S()?ye():void 0):ye();if(!U)return;f(C),Je=U;function X(Y=!1){if(Je===U){if(Je=void 0,De){De=!1,We();return}Y&&m(C)}}U.then(X,()=>X(!1))}let Ot=u.subscribe(b=>{b<=w.current||(w.current=b,mt&&We())});return $_({signal:A.signal,now:()=>performance.now(),sleep:b=>$n(b,A.signal),connect:b=>i.connectResumeStream({signal:A.signal,onChunk:nt,onConnected:b}),onInitialBoundaryReady:()=>{mt=!0,We(!0)},backfill:()=>We()}),()=>{A.abort(),ut(),Ot(),N.detach()}},[t,n,r,r.value,s,i,c,p,_,d,u,f,m,v,P,x,k,o,h,T,g,S])}var fy=32;function B_(e){let{transport:t,setStreaming:n}=e,r=B(void 0),o=B(void 0),a=B(!1),i=B(void 0),s=B(!1),c=B(new Map),p=B(new Set),_=$((g,S)=>{let w=`${g}:${S}`;i.current!==w&&(i.current=w,t.cancelTurn(g,S))},[t]),d=$(g=>{r.current=void 0,o.current=g,a.current=!1,i.current=void 0,s.current=!0,n(!0)},[n]),u=$((g,S)=>{c.current.set(g,{messageId:S})},[]),f=$(g=>{g!==void 0&&(p.current.add(g),p.current.size>fy&&p.current.delete(p.current.values().next().value)),!(g!==void 0&&r.current?.runId!==g)&&(r.current=void 0,o.current=void 0,a.current=!1,s.current=!1,n(!1))},[n]),m=$((g,S)=>o.current!==g?S.runId&&r.current?.runId===S.runId?(r.current={conversationId:S.conversationId,runId:S.runId},a.current&&_(S.conversationId,S.runId),!0):!1:(o.current=void 0,S.runId?(r.current={conversationId:S.conversationId,runId:S.runId},n(!0),a.current&&_(S.conversationId,S.runId),!0):(f(),!0)),[_,n,f]),v=$((g,S)=>{let w=c.current.get(g);return w?(c.current.delete(g),!S.runId||p.current.has(S.runId)?!0:w.runId!==void 0?(w.runId!==S.runId||r.current?.runId===S.runId&&(r.current={conversationId:S.conversationId,runId:S.runId},a.current&&_(S.conversationId,S.runId)),!0):(s.current||o.current||(r.current={conversationId:S.conversationId,runId:S.runId},o.current=void 0,a.current=!1,i.current=void 0,s.current=!0,n(!0)),!0)):!1},[_,n]),P=$(g=>o.current!==g?!1:(f(),!0),[f]),x=$(g=>{let S=c.current.get(g);return S?(c.current.delete(g),S.runId===void 0):!1},[]),k=$((g,S,w,C)=>{let A=S.messageMetadata?.runId;if(S.messageMetadata?.senderRole!==void 0||typeof A!="string"||!A||p.current.has(A))return!1;if(r.current?.runId===A)return s.current;if(s.current)return r.current||!w?!1:(o.current=void 0,r.current={conversationId:g,runId:A},n(!0),a.current&&_(g,A),!0);let N=[...c.current.values()].filter(O=>O.runId===void 0).find(O=>O.messageId===C);return N?(N.runId=A,r.current={conversationId:g,runId:A},o.current=void 0,a.current=!1,i.current=void 0,s.current=!0,n(!0),!0):(o.current=void 0,r.current={conversationId:g,runId:A},n(!0),a.current&&_(g,A),s.current)},[_,n]),T=$(g=>typeof g=="string"&&r.current?.runId===g&&s.current,[]),h=$(()=>{let g=r.current;if(g)return a.current=!0,_(g.conversationId,g.runId),!0;let S=o.current;return S?(a.current=!0,S.then(w=>{w.runId&&_(w.conversationId,w.runId)}).catch(()=>{}),!0):!1},[_]);return ce(()=>({localSendRef:s,begin:d,beginRouted:u,acceptAck:m,acceptRoutedAck:v,reject:P,rejectRouted:x,captureStart:k,ownsLocalRun:T,settle:f,stop:h}),[m,v,d,u,k,T,P,x,f,h])}var my=se.scope("send");function U_(e,t,n,r,o,a=!0){e.publishConversation({...ga(t,n,r,o,a),hasUnread:!1},!0)}function q_(e,t){return e.id===t.id||(e.serverMessageId??e.id)===(t.serverMessageId??t.id)}function H_(e){return e.findLast(t=>!t.ephemeral&&t.role!=="system"&&(t.role==="user"||t.status!=="streaming"||jt(t)))}function _o(e,t,n,r,o){let a=H_(t);a?.role!=="user"||!q_(a,n)||U_(e,t,a,r,o)}function F_(e){return!(e instanceof st)||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 z_(e){let{transport:t,messagesSig:n,conversationIdSig:r,options:o,bus:a,feedback:i,persistence:s,visitorId:c,adoptConversationId:p,applyControlState:_,setCanSend:d,settleSuggestions:u,runCancellation:f}=e,m=$(()=>{let x=r.value??wt();return r.value||(r.value=x,s.saveConversationId(x)),x},[r,s]),v=$(async({continueExisting:x,turn:k})=>{let T=m(),h=n.value.at(-1),g=k?[k]:Zu(n.value,x),S=g[0];S?.role==="user"&&Rt.markSent(S.id);let w=g.map(Ps),C=s.loadUserPrefs(),A=za(o.tools).then(E=>t.sendTurn(hs({messages:w,conversationId:T,visitorId:c,userPrefs:C,clientTools:js(E)}),{keepalive:x}));f.begin(A);try{let E=await A;if(r.value!==T||!f.acceptAck(A,E))return!1;if(p(E.conversationId),E.runId&&S?.role==="user"&&_o(t,n.value,S,E.conversationId,o.strings.newConversation),!E.runId){let N=await t.loadConversation(E.conversationId).catch(()=>null);if(r.value!==E.conversationId)return!0;if(N){N.controlState&&_(N.controlState),d(N.canContinue);let O=gn(N.messages),{messages:j,changed:W}=Kr(n.value,O);W&&(n.value=j);let z=O.findLast(ie=>!ie.ephemeral&&ie.role!=="system"),J=H_(n.value);J&&z&&q_(J,z)&&U_(t,n.value,J,E.conversationId,o.strings.newConversation,N.canContinue);let ue=h?n.value.find(ie=>ie.id===h.id&&ie.role==="assistant"&&ie.status!=="streaming"):void 0;ue&&u(ue,ue.suggestions??[]),!x&&h?.role==="assistant"&&n.value.includes(h)&&h.serverMessageId===void 0&&!jt(h)&&(n.value=n.value.filter(ie=>ie!==h))}else h?.role==="assistant"&&n.value.includes(h)&&(h.status="error",h.errorText=o.strings.errorGeneric,x?h.retryAction={kind:"continue-assistant",messageId:h.serverMessageId??h.id}:h.retryAction=S?.role==="user"?{kind:"resend-user",messageId:S.id}:null,n.value=[...n.value])}return!0}catch(E){if(r.value!==T)return!1;if(!f.reject(A))return S?.role==="user"&&_o(t,n.value,S,T,o.strings.newConversation),!0;let N=Fn(E,o.strings),O=F_(E),j=k?.role==="assistant"?k:n.value.at(-1);if(x&&j?.role==="assistant"&&E instanceof st&&E.status===409){let W=j.serverMessageId??j.id,z=await t.loadConversation(T,{ids:[W]}).catch(()=>null);if(r.value!==T)return!1;if(z){z.controlState&&_(z.controlState),d(z.canContinue);let J=gn(z.messages),ue=J.find(ie=>(ie.serverMessageId??ie.id)===W);if(ue&&rd(j,ue)){let{messages:ie,changed:tt}=Kr(n.value,J),he=ie.find(Te=>(Te.serverMessageId??Te.id)===W);if(tt&&he&&he!==j)return he.awaitingContinuation=!1,he.continuationStreaming=void 0,he.retryAction=null,n.value=ie,he.status!=="streaming"&&u(he,he.suggestions??[]),!0}}if(!n.value.includes(j)||j.status!=="streaming")return!1;j.continuationStreaming=!0}if(x&&j?.role==="assistant")j.status="error",j.errorText=N,j.retryAction=O?{kind:"continue-assistant",messageId:j.serverMessageId??j.id}:null,n.value=[...n.value];else if(h?.role==="assistant"&&n.value.includes(h)){h.status="error",h.errorText=N;let W=g[0];h.retryAction=O&&W?.role==="user"?{kind:"resend-user",messageId:W.id}:null,n.value=[...n.value]}else{let W=rn();W.status="error",W.errorText=N;let z=g[0];W.retryAction=O&&z?.role==="user"?{kind:"resend-user",messageId:z.id}:null,n.value=[...n.value,W]}return i.play("error"),a.emit("error",E),o.onError?.(E),!1}},[t,n,o,a,i,s,c,p,_,d,u,m,f]),P=$(async x=>{let k=m();x.status="pending",x.errorText=void 0,x.retryAction=void 0,n.value.includes(x)&&(n.value=[...n.value]),Rt.markSent(x.id);let T=[Ps(x)],h=s.loadUserPrefs(),g=za(o.tools).then(S=>t.sendTurn(hs({messages:T,conversationId:k,visitorId:c,userPrefs:h,clientTools:js(S)})));f.beginRouted(g,x.id);try{let S=await g;return r.value!==k?(f.rejectRouted(g),!1):f.acceptRoutedAck(g,S)?(p(S.conversationId),_o(t,n.value,x,S.conversationId,o.strings.newConversation),x.status==="pending"&&(x.status="complete",n.value.includes(x)&&(n.value=[...n.value])),!0):!1}catch(S){let w=f.rejectRouted(g);if(r.value!==k)return!1;if(!w)return _o(t,n.value,x,k,o.strings.newConversation),x.status==="pending"&&(x.status="complete",n.value.includes(x)&&(n.value=[...n.value])),!0;if(x.status!=="pending")return _o(t,n.value,x,k,o.strings.newConversation),!0;my.debug("operator-routed send failed",{error:S});let C=S instanceof Error?S:new Error(String(S));return x.status="error",x.errorText=Fn(S,o.strings),x.retryAction=F_(S)?{kind:"resend-user",messageId:x.id}:null,n.value.includes(x)&&(n.value=[...n.value]),i.play("error"),a.emit("error",C),o.onError?.(C),!1}},[t,n,o,a,i,s,c,p,m,f]);return{sendAiTurn:v,sendRoutedTurn:P}}var gy=se.scope("unread");function j_(e){let{transport:t,options:n,conversationIdSig:r,isConversationVisibleRef:o,activated:a,conversationReady:i}=e,s=Et(!1),c=Et(0),p=Et(0),_=B([]),d=B(void 0),u=B(!1),f=$(()=>{let S=r.value,w=o.current()&&d.current===S?S:void 0,C=_.current.filter(A=>A.hasUnread&&A.conversationId!==w).length;c.value=C,s.value=C>0},[r,s,c,o]),m=$(S=>{let w=r.value,C=_.current.find(O=>O.conversationId===w),A=on(_.current,S),E=A.find(O=>O.conversationId===w),N=S.type==="snapshot"&&w!==void 0&&E?.hasUnread===!0&&d.current===w&&C!==void 0&&C.lastMessageAt!==E.lastMessageAt;N&&(d.current=void 0),_.current=A,f(),N&&(p.value+=1)},[r,f,p]),v=$(()=>{if(f(),!o.current())return;let S=r.value;if(!S||d.current!==S)return;let w=_.current.find(C=>C.conversationId===S);w?.hasUnread&&t.markRead(S,w.lastMessageAt)},[r,o,f,t]),P=$(S=>{r.value===S&&(d.current=void 0,f())},[r,f]),x=$(S=>{r.value===S&&(d.current=S,v())},[r,v]),k=$(S=>d.current===S,[]),T=$((S=!1)=>{n.modules.list.some(w=>w.layout==="chat")&&(u.current||(u.current=!0,t.listConversations({limit:50},S).then(w=>{S||m({type:"snapshot",result:w,requestedRevision:0}),v()}).catch(w=>gy.debug("refreshUnread failed (non-fatal)",{err:w})).finally(()=>{u.current=!1})))},[m,v,n.modules,t]),h=$(S=>{let w=S.conversationId,C=o.current()&&r.value===w&&d.current===w,A=_.current.find(N=>N.conversationId===w),E=C&&(A?.lastMessageAt!==S.lastMessageAt||A.hasUnread);t.publishConversation({...S,hasUnread:!C},!0),E&&t.markRead(w,S.lastMessageAt)},[r,o,t]);D(()=>t.subscribeConversationChanges(m),[m,t]);let g=B(!1);return D(()=>{!a||!i||g.current||(g.current=!0,T())},[a,i,T]),D(()=>{if(!a)return;function S(){document.visibilityState==="visible"&&(v(),T(!0))}return document.addEventListener("visibilitychange",S),()=>document.removeEventListener("visibilitychange",S)},[a,v,T]),{hasUnreadSig:s,unreadCountSig:c,transcriptRecoverySig:p,markVisibleConversationRead:v,beginConversationTranscript:P,commitConversationTranscript:x,isConversationTranscriptCommitted:k,recordConversationReply:h}}var fo=se.scope("settings");function V_(e){let{options:t,persistence:n,transport:r,feedback:o,hostElement:a,bus:i}=e,s=n.loadUserPrefs(),[c,p]=q(()=>s.locale??t.locale),[_,d]=q(s.themeMode),u=_??t.themeMode,[f,m]=q(()=>s.textSize??t.textSize),v=$(g=>{n.patchUserPrefs(g),r.saveUserPrefs(n.loadUserPrefs()).catch(S=>fo.warn("saveUserPrefs failed",{err:S}))},[n,r]);D(()=>{s.soundMuted!==void 0&&o.setMuted(s.soundMuted)},[]),D(()=>{if(u!=="host"){a.dataset.theme=u;return}return Ic(g=>{a.dataset.theme=g})},[a,u,t]),D(()=>{a.dataset.textSize=f},[a,f,t]),D(()=>{let g=!0;return o.mutedSig.subscribe(S=>{if(g){g=!1;return}v({soundMuted:S})})},[o,v]);let P=Jn(c,t.availableLocales,t.defaultLocale);D(()=>{r.setLocale(P)},[r,P]),D(()=>{a.dir=Wl(P)?"rtl":"ltr"},[a,P]),D(()=>{P!==c&&p(P)},[P,c]);let x=$(g=>{fo.info("localeChange",{locale:g}),p(g),v({locale:g}),i.emit("localeChange",g)},[v,i]),k=$(g=>{fo.info("themeChange",{mode:g}),d(g),a.dataset.theme=g,v({themeMode:g}),i.emit("themeChange",g)},[a,v,i]),T=$(g=>{fo.info("textSizeChange",{size:g}),m(g),a.dataset.textSize=g,v({textSize:g}),i.emit("textSizeChange",g)},[a,v,i]),h=$(()=>{o.toggleMuted();let g=o.mutedSig.value;fo.info("soundToggle",{muted:g}),i.emit("soundToggle",{muted:g})},[o,i]);return{activeLocale:c,activeThemeMode:u,activeTextSize:f,effectiveLocale:P,setActiveLocale:p,setActiveThemeMode:d,setActiveTextSize:m,patchAndSync:v,handleLocaleChange:x,handleThemeChange:k,handleTextSizeChange:T,handleSoundToggle:h}}var be=se.scope("app"),ni=M.cssPrefix,hy={home:"home",chats:"chat",help:"help",news:"news"};function W_(e,t){return Yu({...e,text:vt(t,e.text)})}function G_({options:e,hostElement:t,bus:n,recentHostEvents:r}){let o=e.aiAgentDeploymentId;if(!o)throw new Error("aiAgentDeploymentId is required");let[a]=q(()=>Yn(e.widgetId,e.storage,e.aiAgentDeploymentId)),[i]=q(()=>a.getVisitorId()),s=a.loadUserPrefs(),c=Et(a.loadConversationId()),p=B(c.value!==void 0),_=Et(c.value??""),d=Et([]),[u,f]=q(!1),m=B(void 0),[v,P]=q([]);function x(){let y=e.modules.list,I=new Set(y.map(V=>V.id)),Q=a.loadActiveModule();return Q&&I.has(Q)?Q:y[0]?.id??""}function k(){return e.modules.list.find(y=>y.layout==="chat")?.id}function T(){let y=k();return y?e.modules.list.length===1?!0:g.sig.value.activeTab===y:!1}let h=B(void 0);if(!h.current){let y=e.modules.list.map(Q=>Q.id),I=a.loadActiveModule()??y[0]??"";h.current=vd(I,I?[...y,I]:y,Q=>a.saveActiveModule(Q))}let g=h.current,S=Tt(()=>g.sig.value.activeTab).value,w=Tt(()=>c.value).value,[C,A]=q(!1),[E,N]=q(null),[O,j]=q(!1),W=e.mode==="standalone"||e.mode==="inline",z=B(Jr(e,ur(),a.loadPanelOpen(),a.loadPanelSize())),[J,ue]=q(z.current.panelOpen),[ie,tt]=q(z.current.panelOpen),he=B(void 0),Te=B(void 0),Je=B(!1),De=B(void 0);D(()=>{J&&tt(!0)},[J]);let mt=B(!1),[Ve,gt]=q(!1),{dismissed:Pt,dismissCallout:ut}=R_({callout:e.launcher.callout,persistence:a}),xt=e.launcher.callout?.persistent??!0,St=$(()=>{be.info("calloutDismiss"),n.emit("calloutDismiss",void 0),ut()},[n,ut]),[Ae,Be]=q(z.current.panelSize),Pe=B(!1),[nt,ye]=q("chat"),ht=B(()=>!1);ht.current=()=>J&&nt==="chat"&&!document.hidden&&T();let[We,Ot]=q(!0),b=B(We);b.current=We;let[U,X]=q(!1),Y=B(U);Y.current=U;let re=B(null),[Re,xe]=q(!1),[ge,pt]=q(null),[pe,rt]=q([]),Fe=B(e.strings),qt=B(e);qt.current=e;let[F,K]=q(void 0),[Z,fe]=q(void 0),[ot,Ht]=q(()=>a.loadSidebarCollapsed()??!1),[Xt,It]=q({}),[le]=q(()=>new Pa({agentApiBaseUrl:e.agentApiBaseUrl,dataApiBaseUrl:e.dataApiBaseUrl,auth:nu({publicKey:e.publicKey,aiAgentDeploymentId:o,publicKeyHeader:"x-public-key"}),endpoints:e.endpoints,recentHostEvents:r})),[At]=q(()=>new Jo(e.sound,e.haptics)),sn=B_({transport:le,setStreaming:X}),{activeLocale:mo,activeThemeMode:ol,activeTextSize:al,effectiveLocale:Hn,setActiveLocale:X_,setActiveThemeMode:J_,setActiveTextSize:Y_,patchAndSync:il,handleLocaleChange:Z_,handleThemeChange:ef,handleTextSizeChange:tf,handleSoundToggle:nf}=V_({options:e,persistence:a,transport:le,feedback:At,hostElement:t,bus:n}),{controlModeSig:Vt,assignedOperatorInitialsSig:rf,operatorAvailableSig:of,applyControlState:vr,adoptControlStateChunk:af,requestOperator:sf,cancelOperatorRequest:lf}=I_({transport:le,conversationIdSig:c}),ln=Et(new Map),cf=$(y=>{if(y.type!=="data-memory-compaction-state")return;let I=c.value;if(!I)return;let Q=Xu(y.data);if(!Q)return;let V=ln.value.get(I);if(V&&(Q.postFinishSequence<V.postFinishSequence||Q.postFinishSequence===V.postFinishSequence&&(V.status==="ready"||V.status===Q.status)))return;let ne=new Map(ln.value);ne.set(I,Q),ln.value=ne},[c,ln]),{hasUnreadSig:uf,unreadCountSig:sl,transcriptRecoverySig:df,markVisibleConversationRead:ll,beginConversationTranscript:oi,commitConversationTranscript:zn,isConversationTranscriptCommitted:cl,recordConversationReply:pf}=j_({transport:le,options:e,conversationIdSig:c,isConversationVisibleRef:ht,activated:ie,conversationReady:C}),_f=J&&e.modules.byId[S]?.layout==="home",ff=T_({transport:le,options:e,persistence:a,enabled:C&&_f});D(()=>{ll()},[S,J,nt,w,ll]),D(()=>{At.update(e.sound,e.haptics)},[At,e.sound,e.haptics]),D(()=>()=>At.destroy(),[At]),D(()=>{Pe.current||!e.size.initialSize||(Pe.current=!0,!a.loadPanelSize()&&Be(Rs(e.mode,e.size,ur())))},[e.mode,e.size,a]),D(()=>{if(!C||mt.current)return;mt.current=!0;let y=Jr(e,ur(),a.loadPanelOpen(),a.loadPanelSize());ue(y.panelOpen),Be(y.panelSize)},[C,e,a]);let jn=B(null);D(()=>{C&&g.reconcile(e.modules.list.map(y=>y.id),x())},[C,e.modules.list,g]);let go=$(y=>{!y||y.length===0||(d.value=y.map(I=>W_(I,Fe.current)))},[d]),ai=B(null),ho=$(async y=>{try{let{formSubmissions:I}=await(y?le.bootstrap(y):ai.current??le.bootstrap()),Q=new Map;return I.forEach((V,ne)=>Q.set(V.formId,ne)),I.filter((V,ne)=>!V.skipped||Q.get(V.formId)===ne).map((V,ne)=>({key:`wire:${V.formId}:${V.createdAt??ne}`,formId:V.formId,outcome:V.skipped?"skipped":"submitted",createdAt:Gu(V.createdAt),values:V.values}))}catch(I){return be.debug("bootstrap failed \u2014 no form markers (non-fatal)",{err:I}),[]}},[le]),br=B(0),Jt=B(0),ii=$(y=>{if(y===c.value)return;let I=c.value;Jt.current++,f(!1),I&&(a.saveDraft(y,a.loadDraft(I)),a.saveDraft(I,""),a.saveMessageQueue(y,a.loadMessageQueue(I)),a.saveMessageQueue(I,[])),c.value=y,a.saveConversationId(y),le.primeIdentity(void 0,y),be.info("conversation rebound",{previous:I,current:y}),I&&n.emit("conversationRebound",{previous:I,current:y})},[n,c,a,le]),vo=$((y,I)=>{let Q=[...y.map(G=>G.createdAt),...I.map(G=>G.createdAt)].filter(G=>G!==void 0),V=(Q.length?Math.min(...Q):Date.now())-1;return[...(De.current?.messages??[]).map(G=>{let oe=W_(G,Fe.current);return oe.createdAt=V,oe}),...y]},[]),ul=$(async y=>{let I=Jt.current;function Q(){return I!==Jt.current||c.value!==y}Te.current===y&&(Te.current=void 0),f(!0);try{let[V,ne]=await Promise.all([le.loadConversation(y),ho()]);if(Q())return!1;let G=gn(V.messages);P(ne);let oe=vo(ks(G,d.value),ne);if(d.value=oe,Te.current=oe.some(we=>we.role==="user")?void 0:y,G.length>0||V.controlState!==void 0){Ot(V.canContinue),V.controlState&&vr(V.controlState);let we=G.findLast(dt=>dt.role==="assistant"&&!dt.ephemeral);rt(we?.suggestions??[])}return!0}catch(V){return Q()||(be.warn("loadThread failed; keeping conversation active",{err:V,conversationId:y}),n.emit("error",V),qt.current.onError?.(V)),!1}finally{Q()||f(!1)}},[le,ho,d,c,vo,n]),mf=$(y=>{if(he.current===y)return he.current=void 0,ul(y)},[ul]),gf=$(()=>{if(m.current)return Promise.resolve(void 0);let y=c.value,I=d.value.find(oe=>oe.serverMessageId!==void 0),Q=I?.serverMessageId,V=I?new Date(I.createdAt).toISOString():void 0;if(!y||!Q||!V)return Promise.resolve(void 0);let ne=Jt.current,G={};return m.current=G,(async()=>{try{let oe=await le.loadConversation(y,{beforeId:Q,beforeCreatedAt:V});if(m.current!==G||Jt.current!==ne||c.value!==y)return;if(oe.messages.length===0)return!1;let Se=oe.messages.map(ys),we=d.value,dt=td(we,Se);if(dt!==we){let Yt=Math.min(...Se.map(kt=>kt.createdAt??1/0),...v.map(kt=>kt.createdAt??1/0));if(Number.isFinite(Yt))for(let kt of we){if(!kt.ephemeral)break;(kt.createdAt??1/0)>=Yt&&(kt.createdAt=Yt-1)}d.value=dt}return!0}catch(oe){if(m.current!==G||Jt.current!==ne||c.value!==y)return;be.warn("load previous messages failed",{err:oe,conversationId:y,beforeId:Q}),n.emit("error",oe),e.onError?.(oe);return}finally{m.current===G&&(m.current=void 0)}})()},[n,c,v,d,e,le]),yr=$(async({newConversation:y})=>{let I=++br.current;function Q(){return I!==br.current}let V=c.value,ne=y||!V?wt():V;ne!==V&&(Jt.current++,f(!1),Dt(()=>{c.value=ne,_.value=ne}),a.saveConversationId(ne)),le.primeIdentity(i,ne);let G;try{G=await le.handshake({visitorId:i,conversationId:ne,userPrefs:a.loadUserPrefs(),locale:mo})}catch(we){if(Q())return;n.emit("error",we),e.onError?.(we),y||A(!0);return}if(Q())return;G.conversationId!==ne&&ii(G.conversationId),pt(G.agent),e.mode==="page"&&(G.site&&fu(G.site)?K(G.site):G.site&&be.warn("invalid site config, using fallback",{site:G.site}),G.blocks&&mu(G.blocks)?fe(G.blocks):G.blocks&&be.warn("invalid blocks config, using fallback",{blocks:G.blocks}));let oe=Bi(G.userPrefs);if(Object.keys(oe).length>0&&!y&&(a.saveUserPrefs(oe),oe.locale&&X_(oe.locale),oe.soundMuted!==void 0&&At.setMuted(oe.soundMuted),oe.themeMode&&J_(oe.themeMode),oe.textSize&&Y_(oe.textSize)),De.current=G.welcome,y||n.emit("handshake",G),G.welcome?.suggestions){let we=Fe.current;rt(G.welcome.suggestions.map(dt=>({...dt,label:vt(we,dt.label),...dt.text===void 0?{}:{text:vt(we,dt.text)}})))}let Se=!y&&V&&G.conversationId===V;p.current=!!Se,Se?Je.current||(he.current=G.conversationId):(Te.current=G.conversationId,go(G.welcome?.messages),zn(G.conversationId)),y||A(!0)},[le,i,a,e,n,c,_,At,go,mo,ii,zn]),Pr=JSON.stringify(e.userContext??null),hf=JSON.stringify(e.pageContext??null),vf=JSON.stringify(Xt);D(()=>{let y=Object.keys(Xt).length?{...Xt,...e.userContext}:e.userContext;le.setContext(y,vy(e.pageContext))},[le,Pr,hf,vf]),D(()=>le.setUserToken(e.userToken),[le,e.userToken]);let dl=$((y,I=[])=>rt(y.suggestions??I),[]);D(()=>(le.primeIdentity(i,c.value),yr({newConversation:!1}),()=>{br.current++,Jt.current++}),[]),D(()=>{!ie||!C||Je.current||(Je.current=!0,ai.current=le.bootstrap(),(async()=>{try{let y=await ai.current;N(Rr((y??{forms:[]}).forms,Hn))}catch(y){be.debug("bootstrap failed \u2014 treating as no forms",{err:y})}finally{j(!0)}})(),he.current===c.value&&f(!0))},[ie,C]);let xr=B(null);D(()=>{if(!ie||!C||(xr.current??(xr.current=Hn),xr.current===Hn))return;xr.current=Hn;let y=!1;return le.bootstrap().then(I=>{y||N(Rr((I??{forms:[]}).forms,Hn))}).catch(I=>be.debug("forms re-localize failed \u2014 keeping current copy",{err:I})),()=>{y=!0}},[ie,C,Hn,le]);let pl=B(Pr);D(()=>{!C||pl.current===Pr||(pl.current=Pr,yr({newConversation:!1}))},[Pr,C,yr]),M_({hostElement:t,mode:e.mode,panelSize:Ae,isOpen:J,surfaceReady:C,setIsOpen:ue});let{sendAiTurn:cn,sendRoutedTurn:Vn}=z_({transport:le,messagesSig:d,conversationIdSig:c,options:e,bus:n,feedback:At,persistence:a,visitorId:i,adoptConversationId:ii,applyControlState:vr,setCanSend:Ot,settleSuggestions:dl,runCancellation:sn}),{toolInteraction:bf,pageToolsRunning:si,stopPageTools:_l}=C_({streaming:U,controlModeSig:Vt,messagesSig:d,sendAiTurn:cn,bus:n,humanInLoop:e.features.humanInLoop,tools:e.tools}),yf=$((y,I)=>{let Q=d.value.find(V=>V.serverMessageId===y);Q&&(Q.feedback=I),be.info("messageFeedback",{messageId:y,value:I}),n.emit("messageFeedback",{messageId:y,value:I}),le.submitFeedback({messageId:y,value:I})},[n,d,le]);function Pf(){return d.value.reduce((y,I)=>y+(I.role==="user"?1:0),0)}let Wn=e.forms.list.length>0?e.forms:E??e.forms,Oe=gd({forms:Wn,persistence:a,userContext:()=>e.userContext,messageCount:Pf,pageArea:()=>e.pageContext?.area?String(e.pageContext.area):void 0,conversationId:()=>c.value,onComplete:(y,I,Q,V)=>{be.info("formSubmit",{formId:y.id,trigger:I,skipped:V}),n.emit("formSubmit",{formId:y.id,values:Q,skipped:V}),P(G=>{let Se=G.find(we=>we.formId===y.id&&we.outcome==="skipped")?.createdAt??Date.now();return[...G.filter(we=>!(we.formId===y.id&&we.outcome==="skipped")),{key:`local:${y.id}:${Se}`,formId:y.id,outcome:V?"skipped":"submitted",createdAt:Se,...V?{}:{values:Q}}]});let ne=c.value??wt();c.value||(c.value=ne,a.saveConversationId(ne),le.primeIdentity(void 0,ne)),!V&&y.mirrorToContext&&It(G=>({...G,...Q})),le.submitForm({formId:y.id,conversationId:ne,trigger:I,values:Q,skipped:V})}}),Sr=Tt(()=>Oe.activeForm.value),xf=$(()=>Oe.fire("after-messages"),[Oe]),Sf=$(()=>p.current||d.value.some(y=>!y.ephemeral&&y.role==="user"),[d]);D_({activated:ie,conversationReady:C,conversationIdSig:c,messagesSig:d,optionsRef:qt,transport:le,visitorId:i,adoptControlStateChunk:af,adoptMemoryCompactionStateChunk:cf,settleSuggestions:dl,recordConversationReply:pf,transcriptRecoverySig:df,beginConversationTranscript:oi,commitConversationTranscript:zn,onReplyLanded:xf,runCancellation:sn,canContinueRef:b,setCanSend:Ot,feedback:At,bus:n,loadInitialThread:mf,shouldReconcileOnConnect:Sf}),D(()=>{Oe.refresh()},[Wn,Oe]);let fl=e.pageContext?.area?String(e.pageContext.area):void 0,kf=Tt(()=>d.value.length);D(()=>{C&&O&&Oe.fire("pre-chat")},[C,O,Oe]),D(()=>{O&&!We&&Oe.fire("conversation-closed")},[O,We,Oe]),D(()=>{C&&O&&fl&&Oe.fire("page-area")},[C,O,fl,Oe]);let li=ce(()=>{let y=Wn.list.flatMap(I=>I.triggers).filter(I=>I.kind==="idle").map(I=>Number(I.param));return y.length?Math.min(...y)*1e3:0},[Wn]);D(()=>{if(!li||!J)return;let y=setTimeout(()=>Oe.fire("idle"),li);return()=>clearTimeout(y)},[li,J,Oe,kf.value]);let Gn=$(async(y,I,Q)=>{if(re.current)return!1;let V=c.value,ne=V?ln.value.get(V):void 0,G=Vt.value!=="ai-agent";if(!G&&ne?.status==="compacting"||(be.info("send",{textLen:y.length,attachments:I.length,streaming:Y.current,routedToOperator:G}),Y.current&&!G))return!1;let oe=new AbortController,Se={conversationId:V,controller:oe};re.current=Se,xe(!0);try{At.unlock();let we=await yy(le,I,oe.signal,un=>{oe.signal.aborted||(be.warn("upload failed",{err:un}),n.emit("error",un),e.onError?.(un))});if(oe.signal.aborted||c.value!==V||!b.current||Oe.activeForm.value)return!1;let dt=V?ln.value.get(V):void 0,Yt=Vt.value!=="ai-agent";if(!Yt&&dt?.status==="compacting"||Y.current&&!Yt||!y&&we.length===0)return!1;n.emit("send",{text:y,attachmentCount:I.length}),pe.length>0&&rt([]),At.play("messageSent");let kt=bs(y,we,Q);return cr(n,e,"user",y),Yt?(d.value=[...d.value,kt],Q?await Vn(kt):(Vn(kt),!0)):(d.value=[...d.value,kt,rn()],Q?await cn({continueExisting:!1}):(cn({continueExisting:!1}),!0))}finally{re.current===Se&&(re.current=null,xe(!1))}},[le,n,e,pe.length,d,c,ln,cn,Vn,Vt]),ml=B(Gn);ml.current=Gn;let gl=c.value,hl=(gl?ln.value.get(gl):void 0)?.status==="compacting",ci=Vt.value==="ai-agent",vl=Tt(()=>{let y=d.value.at(-1);return y?.role==="assistant"&&y.partsSig.value.some(I=>I.kind==="tool"&&I.stateSig.value==="approval-requested")}),bl=Tt(()=>d.value.some(y=>y.retryAction?.kind==="resend-user"||y.retryAction?.kind==="continue-assistant"));Ct(()=>{let y=c.value;return()=>{let I=re.current;!I||I.conversationId!==y||(re.current=null,xe(!1),I.controller.abort())}},[c.value]),D(()=>{We&&!Sr.value||re.current?.controller.abort()},[Sr.value,We]);let wf=$(()=>{if(si){be.info("stop page tools"),n.emit("stop",void 0),_l();return}if(!sn.stop())return;be.info("stop"),n.emit("stop",void 0);let y=d.value.at(-1);y&&y.role!=="user"&&y.status==="streaming"&&(y.canceled=!0,d.value=[...d.value])},[sn,n,d,si,_l]),Cf=$(y=>{if(U)return;let I=d.value,Q=ya(I,y);if(Q)switch(be.info("retry",{kind:Q.kind,messageId:Q.messageId}),Q.kind){case"continue-assistant":{if(Vt.value!=="ai-agent"||y.role!=="assistant"||(y.serverMessageId??y.id)!==Q.messageId)return;y.status="streaming",y.errorText=void 0,y.retryAction=void 0,y.awaitingContinuation=!0,d.value=[...I],cn({continueExisting:!0,turn:y});return}case"resend-user":{let V=I.find(oe=>oe.role==="user"&&oe.id===Q.messageId);if(!V)return;let ne=oe=>{oe&&jn.current?.acceptQueuedMessage(Q.messageId)};if(V.status="complete",V.errorText=void 0,V.retryAction=void 0,Vt.value!=="ai-agent"){d.value=y.role==="assistant"?I.filter(oe=>oe!==y):[...I],Vn(V).then(ne);return}let G=rn();d.value=y.role==="assistant"?I.map(oe=>oe===y?G:oe):[...I,G],cn({continueExisting:!1,turn:V}).then(ne);return}case"repeat-user":{let V=I.find(Se=>Se.role==="user"&&Se.id===Q.messageId);if(!V)return;let ne=bs(ze(V),V.attachments?.map(Se=>({...Se}))??[]),G=new Set(ne.attachments?.flatMap(Se=>Se.url?[Se.url]:[])??[]),oe=V.partsSig.value.flatMap(Se=>Se.kind==="file"&&!G.has(Se.url)?[{...Se}]:[]);if(oe.length>0&&(ne.partsSig.value=[...ne.partsSig.value,...oe]),Vt.value!=="ai-agent"){d.value=[...I,ne],Vn(ne);return}d.value=[...I,ne,rn()],cn({continueExisting:!1,turn:ne});return}default:return Q}},[U,d,Vt,cn,Vn]),kr=$(()=>{if(md(e.mode,Ae)==="exit-fullscreen"){be.info("close \u2192 exit-fullscreen",{mode:e.mode}),Be("normal"),n.emit("fullscreen",!1);return}be.info("close \u2192 panel closed",{mode:e.mode}),Oe.fire("panel-close"),ue(!1),a.savePanelOpen(!1),n.emit("close",void 0),e.onClose?.()},[n,e,a,Ae,Oe]),wr=$(()=>{be.info("open",{mode:e.mode}),At.unlock(),gt(!0),ue(!0),a.savePanelOpen(!0),!Pt&&!xt&&St(),setTimeout(()=>gt(!1),by),n.emit("open",void 0),e.onOpen?.()},[n,e,At,a,Pt,xt,St]),ui=$(()=>{let y=d.value.some(I=>I.role==="user");if(Te.current===c.value&&!y&&We&&c.value){be.info("clear \u2192 reusing empty conversation",{conversationId:c.value}),d.value.length===0&&go(De.current?.messages);return}return be.info("clear \u2192 new conversation",{wasStreaming:U}),n.emit("clear",void 0),sn.settle(),p.current=!1,he.current=void 0,Te.current=void 0,Dt(()=>{d.value=[],c.value=void 0,vr({controlMode:"ai-agent",controlRevision:0})}),a.clearConversation(),Ot(!0),P([]),rt([]),yr({newConversation:!0})},[U,d,c,a,yr,n,We,go,sn,vr]),bo=$(()=>{let y=ui();ye("chat");let I=e.modules.list.find(Q=>Q.layout==="chat")?.id;return I&&g.switchTab(I),y},[ui,g,e]),Tf=$(async y=>{await bo(),await ml.current(y,[])||jn.current?.fill(y)},[bo]),di=$(()=>{let y=Ae==="expanded"?"normal":"expanded";be.info("expand",{from:Ae,expanded:y==="expanded"}),Be(y),a.savePanelSize(y),n.emit("expand",y==="expanded")},[n,Ae,a]),pi=$(()=>{let y=Ae==="fullscreen"?"normal":"fullscreen";be.info("fullscreen",{from:Ae,fullscreen:y==="fullscreen"}),Be(y),a.savePanelSize(y),n.emit("fullscreen",y==="fullscreen")},[n,Ae,a]),Rf=$(()=>{ye(y=>{let I=y==="history"?"chat":"history";return be.info("toggleHistory",{view:I}),n.emit("toggleHistory",{view:I}),I})},[n]),If=$(()=>{Ht(y=>{let I=!y;return be.info("sidebarToggle",{collapsed:I}),a.saveSidebarCollapsed(I),n.emit("sidebarToggle",{collapsed:I}),I})},[a,n]),Af=$(y=>{be.info("resize",y),il({widgetSize:y}),n.emit("resize",y)},[il,n]),Ef=$(async y=>{let I=y.conversationId;if(I===c.value&&cl(I)){be.info("selectConversation",{conversationId:I,cached:!0}),n.emit("selectConversation",{conversationId:I}),le.publishConversation(y),ye("chat");let G=k();G&&g.switchTab(G),zn(I);return}let V=++br.current;Jt.current++,f(!1);function ne(){return V!==br.current}be.info("selectConversation",{conversationId:I,wasStreaming:U}),n.emit("selectConversation",{conversationId:I}),le.publishConversation(y);try{let[G,oe]=await Promise.all([le.loadConversation(I),ho(I)]);if(ne())return;sn.settle(),p.current=!0,he.current=void 0;let Se=gn(G.messages),we=G.conversationId!==c.value,dt=we?Se:ks(Se,d.value);Te.current=dt.some(un=>un.role==="user")?void 0:G.conversationId,Dt(()=>{d.value=vo(dt,oe),we&&(_.value=G.conversationId),c.value=G.conversationId}),P(oe),a.saveConversationId(G.conversationId),le.primeIdentity(i,G.conversationId),Ot(G.canContinue),G.controlState&&vr(G.controlState);let Yt=dt.findLast(un=>un.role==="assistant"&&!un.ephemeral);rt(Yt?.suggestions??[]),we?oi(G.conversationId):zn(G.conversationId),ye("chat");let kt=k();kt&&g.switchTab(kt)}catch(G){if(ne())return;n.emit("error",G),e.onError?.(G)}},[le,d,c,_,n,e,a,ho,vo,U,i,sn,oi,zn,cl,g]),yo=B(null),yl=$(y=>{typeof y=="string"&&(O?Oe.fire("manual",y):yo.current=y)},[O,Oe]);D(()=>{!O||!yo.current||(Oe.fire("manual",yo.current),yo.current=null)},[O,Oe]);let Po=B(void 0),xo=$(y=>{let I=e.modules.list.find(V=>V.layout===hy[y.to]);if(!I){be.warn("open: the widget has no such tab",{to:y.to});return}let Q=y.id&&(I.layout==="help"||I.layout==="news")?{kind:"content",id:y.id,title:""}:void 0;g.open(I.id,Q)},[e.modules,g]),Pl=$(y=>{if(J||wr(),y!==void 0){if(!ru(y)){be.warn("open: unknown target",{detail:y});return}C?xo(y):Po.current=y}},[J,wr,C,xo]);D(()=>{!C||!Po.current||(xo(Po.current),Po.current=void 0)},[C,xo]);let xl=C&&!u&&!Sr.value&&(!ci||!vl.value&&!bl.value),[xn,_i]=q(),Sl=$(y=>{let I=ou(y);if(!I){be.warn("ask: expected { text, send? } with non-empty text",{detail:y});return}J||wr(),_i(I)},[J,wr]),fi=J&&O&&We&&C&&!u&&!Sr.value,kl=fi&&xl&&!Re&&!(ci&&(U||hl));D(()=>{if(xn===void 0||!(xn.send?kl:fi))return;let y=k();if(!y){be.warn("ask: the widget has no chat"),_i(void 0);return}if(nt!=="chat"||!T()){ye("chat"),g.switchTab(y);return}if(_i(void 0),!xn.send){jn.current?.fill(xn.text);return}Gn(xn.text,[]).then(I=>{I||jn.current?.fill(xn.text)})},[xn,fi,kl,nt,S,e.modules,g,Gn]),D(()=>{if(e.widgetId!=="default")return;let y=`data-${M.cssPrefix}-`,I=["ask","open","close","form"].map(V=>y+V);function Q(V){let ne=V.composedPath().find(we=>we instanceof Element&&I.some(dt=>we.hasAttribute(dt)));if(!(ne instanceof Element))return;V.preventDefault();let G=ne.getAttribute(`${y}ask`),oe=ne.getAttribute(`${y}open`),Se=ne.getAttribute(`${y}form`);G!==null?Nt(t,"ask",$r(G||(ne.textContent??""),{send:ne.hasAttribute(`${y}send`)})):oe!==null?Nt(t,"open",Wo(oe)):Se!==null?Nt(t,"openForm",Se):Nt(t,"close")}return document.addEventListener("click",Q),()=>document.removeEventListener("click",Q)},[e.widgetId,t]),D(()=>{if(e.widgetId!=="default")return;let y=su(location.href);y&&(history.replaceState(history.state,"",y.url),y.ask?Nt(t,"ask",$r(y.ask)):Nt(t,"open",y.target))},[e.widgetId,t]);let wl=B(Dr),Cl=e.mode==="page"||e.mode==="inline"||e.mode==="standalone";D(()=>zt(()=>{let y=c.value,I={open:Cl||J,ready:C,unread:sl.value,...y?{conversationId:y}:{}},Q=wl.current;I.open===Q.open&&I.ready===Q.ready&&I.unread===Q.unread&&I.conversationId===Q.conversationId||(wl.current=I,n.emit("state",I),I.unread!==Q.unread&&n.emit("unread",I.unread))}),[n,Cl,J,C,sl,c]);let Sn=B({handleOpenCommand:Pl,handleClose:kr,handleExpand:di,handleFullscreen:pi,openForm:yl,handleAskCommand:Sl});Sn.current={handleOpenCommand:Pl,handleClose:kr,handleExpand:di,handleFullscreen:pi,openForm:yl,handleAskCommand:Sl},Ct(()=>iu(t,{open:y=>Sn.current.handleOpenCommand(y),close:()=>Sn.current.handleClose(),expand:()=>Sn.current.handleExpand(),fullscreen:()=>Sn.current.handleFullscreen(),openForm:y=>Sn.current.openForm(y),ask:y=>Sn.current.handleAskCommand(y)}),[t]);let _t=ce(()=>Li(e,mo,ol,al),[e,mo,ol,al]);Fe.current=_t.strings;let Mf=ce(()=>v.map(y=>{let I=Wn.list.find(Q=>Q.id===y.formId);return{...y,title:I?.title,form:I}}),[v,Wn]);function mi(y){Ef(y)}let Tl={options:_t,transport:le,feedback:At,bus:n,persistence:a,conversationId:c.value??"",composerKey:_.value,composerApiRef:jn,view:nt,canSend:We,isStreaming:U,pageToolRunning:si,isMemoryCompacting:hl,canReleaseQueuedMessages:xl,queueManualMessages:ci&&(vl.value||bl.value),sendPreparing:Re,composerActive:_t.mode==="page"||_t.mode==="inline"||_t.mode==="standalone"||J,controlMode:Vt.value,assignedOperatorInitials:rf.value,operatorAvailable:of.value,operatorRequestEnabled:e.features.operatorRequest,onRequestOperator:sf,onCancelOperatorRequest:lf,loadingMessages:u,onLoadPreviousMessages:gf,messagesSig:d,agent:ge,suggestions:pe,initialWidgetSize:s.widgetSize??null,onClose:kr,onClear:ui,onExpand:di,onFullscreen:pi,onSoundToggle:nf,onToggleHistory:Rf,onSelectHistoryConversation:mi,onNewConversation:bo,onLocaleChange:Z_,onThemeChange:ef,onTextSizeChange:tf,onWidgetSizeChange:Af,onSend:Gn,onStop:wf,onSuggestion:y=>{if(re.current)return;let I=y.text??y.label;be.info("suggestion",{text:I,autoSend:e.autoSendSuggestions}),n.emit("suggestion",{text:I}),e.autoSendSuggestions?Gn(I,[]):jn.current?.fill(I)},activeForm:Sr.value?.form??null,formMarkers:Mf,onFormSubmit:Oe.complete,onFormSkip:Oe.skip,onFormFill:y=>Oe.fire("manual",y),tool:bf,onRetry:Cf,onMessageFeedback:yf};if(!C)return null;let Cr=_t.modules.list;function gi(y){let I=lr("close",_t.mode,y);return Cr.length===0?l(P_,{strings:_t.strings,onClose:I?kr:void 0}):Cr.length===1&&Cr[0]?.layout==="chat"?l(b_,{...Tl,panelSize:y}):l(y_,{panelProps:{...Tl,panelSize:y,onClose:I?kr:void 0},enabledModules:Cr,nav:g,bus:n,hasUnread:uf.value,latestNews:ff,onSelectConversation:mi,onStartNewConversation:Tf,onSetPanelSize:Be})}if(e.mode==="page"){let y=Cr.some(I=>I.layout==="chat");return l("div",{class:`${ni}-anchor`,children:l(k_,{site:F,blocks:Z,transport:le,strings:_t.strings,locale:_t.locale,persistence:a,showConversations:y,onSelectConversation:mi,onNewConversation:bo,sidebarCollapsed:ot,onToggleSidebarCollapsed:If,children:gi("fullscreen")})})}if(W){let y=e.mode==="standalone"?"fullscreen":Ae;return l("div",{class:`${ni}-anchor`,children:gi(y)})}let Rl=e.mode==="drawer",Il=!(e.mode==="modal")&&!e.launcher.hidden&&(!J||Ve),Al=Il&&!Ve&&!Pt&&!Rl?_t.launcher.callout:null;return l("div",{class:`${ni}-anchor`,"data-launcher-size":_t.launcher.size,children:[J||ie?l("div",{class:`${ni}-surface`,hidden:!J,children:gi(Ae)}):null,Il?l(tp,{onToggle:wr,launcher:_t.launcher,strings:_t.strings,leaving:Ve,edgeTab:Rl}):null,Al?l(np,{callout:Al,launcherPosition:_t.position,strings:_t.strings,closeLabel:_t.strings.close,onDismiss:St}):null]})}function vy(e){let t=e?.url??(typeof location<"u"?location.href:void 0);if(!(!e&&!t))return{...e,...t?{url:t}:{}}}var by=120;async function yy(e,t,n,r){return(await Promise.all(t.map(async a=>{try{let{id:i,url:s,originalName:c,mimeType:p,fileSize:_}=await e.uploadFile(a.file,n);return{id:i,name:c,mediaType:p,size:_,url:s}}catch(i){r(i);return}}))).filter(a=>a!==void 0)}var Py=se.scope("error-boundary"),ri=class extends $t{constructor(){super(...arguments);te(this,"state",{crashed:!1})}componentDidCatch(n,r){Py.error("widget render crashed",{error:n,componentStack:r?.componentStack}),this.setState({crashed:!0}),this.props.onError(n,r?.componentStack)}render(){return this.state.crashed?this.props.fallback:this.props.children}};function K_(e){let{bus:t,host:n,appRoot:r,persistence:o,reportError:a}=e,i=e.initialRaw,s,c=Xn(i),p=!0,_=0,d=vc(t);function u(){c=Xn(s?Oi(i,s):i)}function f(){Mc(n,Bo(c.mode));let x=o.loadUserPrefs().themeMode;Lc(n,x?{...c,themeMode:x}:c),p&&(Fo(n,xy(c)),p=!1)}function m(){f(),_n(Kn(ri,{onError:a},Kn(G_,{key:_,bus:t,hostElement:n,options:c,recentHostEvents:d})),r)}t.on("handshake",x=>{x.config&&(x.config.storageVersion&&o.rememberStorageVersion(x.config.storageVersion),s=x.config,u(),m())});let v=Pc(t,{getOptions:()=>c,getVisitorId:()=>o.getVisitorId(),getConversationId:()=>o.loadConversationId()});function P(x={}){o.reset(),i={...i,userContext:void 0,userToken:void 0,...x},d.length=0,_+=1,p=!0,u(),m()}return{getOptions:()=>c,getUserOptions:()=>i,render:m,setUserOptions:x=>{i=x,u(),m()},patchUserOptions:x=>{let k="userToken"in x&&x.userToken!==i.userToken;if(k&&i.userToken){P(x);return}k&&(_+=1),i={...i,...x},u(),m()},reset:()=>P(),destroy:()=>v()}}function xy(e){if(e.mode==="standalone")return"standalone";if(e.mode==="inline")return"inline";let t=Yn(e.widgetId,e.storage,e.aiAgentDeploymentId),{panelOpen:n,panelSize:r}=Jr(e,ur(),t.loadPanelOpen(),t.loadPanelSize());return Sa(e.mode,r,n)}var rl=class extends HTMLElement{constructor(){super(...arguments);te(this,"bus",new Ko);te(this,"widgetState",Dr);te(this,"userToken");te(this,"pageTools",[]);te(this,"markReady",()=>{});te(this,"ready",new Promise(n=>{this.markReady=n}));te(this,"mountResult",null);te(this,"runtime",null)}static get observedAttributes(){return $i}connectedCallback(){if(Object.hasOwn(this,"tools")){let n=Reflect.get(this,"tools");Reflect.deleteProperty(this,"tools"),this.pageTools=Array.isArray(n)?n:[]}this.boot()}disconnectedCallback(){this.mountResult&&(this.runtime?.destroy(),this.runtime=null,_n(null,this.mountResult.appRoot),this.bus.clear(),this.widgetState=Dr)}attributeChangedCallback(){this.isConnected&&this.boot()}open(n){Nt(this,"open",n)}close(){Nt(this,"close")}expand(){Nt(this,"expand")}openForm(n){Nt(this,"openForm",n)}ask(n,r){Nt(this,"ask",$r(n,r))}get state(){return this.widgetState}reset(){this.userToken=void 0,this.runtime?.reset()}login(n){this.userToken=n,this.runtime?.patchUserOptions({userToken:n})}track(n,r){let o=hc(n,r);o&&this.bus.emit("hostEvent",o)}get tools(){return this.pageTools}set tools(n){this.pageTools=n,this.runtime?.patchUserOptions({tools:n})}registerTool(n,r){Jp(n,r)}on(n,r){return this.bus.on(n,r)}boot(){let n={...Di(a=>this.getAttribute(a)),...this.userToken?{userToken:this.userToken}:{},tools:this.pageTools};if(!n.aiAgentDeploymentId)throw new Error("ai-agent-deployment-id is required");if(this.runtime){this.runtime.setUserOptions(n);return}let r=Xn(n);this.mountResult??(this.mountResult=Nc({existingHost:this,position:Bo(r.mode)}));let o=Yn(r.widgetId,r.storage,r.aiAgentDeploymentId);this.bus.on("state",a=>{this.widgetState=a,a.ready&&this.markReady()}),this.runtime=K_({bus:this.bus,host:this.mountResult.hostElement,appRoot:this.mountResult.appRoot,persistence:o,initialRaw:n,reportError:a=>this.bus.emit("error",a)}),this.runtime.render()}},Q_=!1;function Sy(){if(Q_||typeof customElements>"u")return;let e=M.tagName;customElements.get(e)||customElements.define(e,rl),Q_=!0}typeof customElements<"u"&&Sy();export{Sy as registerWebComponent};
60
60
  //# sourceMappingURL=elements-web-component.esm.js.map