@helpai/elements 1.13.0 → 1.14.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 qf=Object.defineProperty;var Hf=(e,t,n)=>t in e?qf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var re=(e,t,n)=>Hf(e,typeof t!="symbol"?t+"":t,n);var pe,Bl,Ti,_n,ki,Lo,Ul,No,ql,Ri,wi,zf,Lr=Symbol.for("pv"),Oo={},$o=[],jf=/^m(i|n|o|s|text|space)$/,Do=Array.isArray,Ii=$o.slice,In=Object.assign;function Rn(e){e&&e.parentNode&&e.remove()}function mn(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?Ii.call(arguments,2):n),Nr(e,i,r,o,null)}function Nr(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:Lr,__v:o||++Bl,__i:-1,__u:0};return!o&&pe.vnode&&pe.vnode(a),a}function de(e){return e.children}function Dt(e,t){this.props=e,this.context=t,this.__g=0}function fn(e,t){if(t==null)return e.__&&fn(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:fn(e)}function Hl(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),Hl(e)}function Dl(e){(8&e.__g||(e.__g|=8,_n.push(e),Lo++))&&ki==pe.debounceRendering||((ki=pe.debounceRendering)||queueMicrotask)(zl)}function zl(){var e,t,n,r,o,a,i,s,c;try{for(t=1;_n.length;)_n.length>t&&_n.sort(Ul),e=_n.shift(),t=_n.length,8&e.__g&&(r=void 0,o=void 0,a=(o=(n=e).__v).__e,i=[],s=[],(c=n.__P)&&((r=In({constructor:Lr},o)).__v=o.__v+1,pe.vnode&&pe.vnode(r),Ei(c,r,o,n.__n,c.namespaceURI,32&o.__u?[a]:null,i,a||fn(o),32&o.__u,s),r.__v=o.__v,r.__.__k[r.__i]=r,Gl(i,r,s),o.__=o.__e=null,r.__e!=a&&Hl(r)))}finally{(Lo=_n.length)&&(ki||queueMicrotask)(zl)}}function jl(e,t,n,r,o,a,i,s,c,p,_){var d,u,f,m,v,x,P=r.__k||$o,k=t.length;for(c=Vf(n,t,P,c,k),d=0;d<k;d++)(f=n.__k[d])!=null&&(u=~f.__i&&P[f.__i]||Oo,f.__i=d,x=Ei(e,f,u,o,a,i,s,c,p,_),m=f.__e,(u.ref!=f.ref||8&u.__u)&&(u.ref&&Ai(u.ref,null,f,u),f.ref&&_.push(f.ref,f.__c||m,f)),v=v||m,4&f.__u?(c=Vl(f,c,e,!u.__v),u.__e&&(u.__e=null)):typeof f.type=="function"&&x!==void 0?c=x:m&&(c=m.nextSibling),f.__u&=-21);return n.__e=v,c}function Vf(e,t,n,r,o){var a,i,s,c,p,_,d,u,f,m=n.length,v=m,x=0,P=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]=Nr(null,i):Do(i)?i=k[a]=Nr(de,{children:i}):i.constructor===Lr&&i.__b?i=k[a]=Nr(i.type,i.props,i.key,i.ref,i.__v):k[a]=i,c=a+x,i.__=e,i.__b=e.__b+1,s=null,~(p=i.__i=Wf(i,n,c,v))&&(v--,(s=n[p])&&(s.__u|=2)),s&&s.__v?(i.__u|=16,p==c-1?x--:p==c+1?x++:p!=c&&(p>c?x--:x++,P=1)):(~p||(o>m?x--:o<m&&x++),typeof i.type!="function"&&(i.__u|=4))):k[a]=null;if(P){for(_=[],d=[],a=0;a<o;a++)if((i=k[a])&&16&i.__u){for(x=0,u=_.length;x<u;)_[f=x+u>>1]<i.__i?x=f+1:u=f;_[x]=i.__i,d[a]=x+1}for(x=_.length;a--;)d[a]&&(d[a]==x?x--:k[a].__u|=4)}if(v)for(a=0;a<m;a++)!(s=n[a])||2&s.__u||(s.__e==r&&(r=fn(s)),Mi(s,s));return r}function Vl(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=Vl(o[a],t,n,!1));return t}for(t&&!t.parentNode&&(t=fn(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 Fo(e,t){return t=t||[],e!=null&&typeof e!="boolean"&&(Do(e)?e.some(function(n){Fo(n,t)}):t.push(e)),t}function Wf(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 Fl(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||Fl(e.style,t);if(n)for(t in n)r&&n[t]==r[t]||Fl(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")(e.__e||(e.__e={}))[t]=n,n&&r||(i=wi[t]||(wi[t]=Gf(t)),(e.__a||(e.__a={}))[t]=Ri,a=t!=(t=t.replace(ql,"$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 Gf(e){return function(t){var n=this.__e;if(n){if(n=n[e],t[No]==null)t[No]=Ri++;else if(t[No]<this.__a[e])return;return n(pe.event?pe.event(t):t)}}}function Ei(e,t,n,r,o,a,i,s,c,p){var _,d,u,f,m,v,x,P,k,T,h,g,S,w,C,E,A,L,O=t.type;if(t.constructor!==Lr)return null;128&n.__u&&(c=32&n.__u,_=n.__c.__z)&&(t.__u|=c,d=a=[],_.nodeType==8?s=Ci(_,a):a.push(_),s=a[0]||s),(_=pe.__b)&&_(t);e:if(typeof O=="function"){u=i.length;try{if(P=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(P,h):(t.__c=f=new Dt(P,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=In({},f.__s)),In(f.__s,O.getDerivedStateFromProps(P,f.__s)))),m=f.props,v=f.state,f.__v=t,n.__c){if(P!==m&&k&&!O.getDerivedStateFromProps&&f.componentWillReceiveProps&&f.componentWillReceiveProps(P,h),t.__v==n.__v&&!(8&f.__g)||!(4&f.__g)&&f.shouldComponentUpdate&&f.shouldComponentUpdate(P,f.__s,h)===!1){t.__v!=n.__v&&(f.props=P,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(z){z&&(z.__=t)}),$o.push.apply(f.__h,f.__k),f.__k=[],f.__h.length&&i.push(f),s=fn(n);break e}f.componentWillUpdate&&f.componentWillUpdate(P,f.__s,h),k&&f.componentDidUpdate&&f.__h.push(function(){f.componentDidUpdate(m,v,x)})}else k&&!O.getDerivedStateFromProps&&f.componentWillMount&&f.componentWillMount(),k&&f.componentDidMount&&f.__h.push(f.componentDidMount);if(f.context=h,f.props=P,f.__P=e,f.__g&=-5,g=pe.__r,S=0,k)f.state=f.__s,f.__g&=-9,g&&g(t),_=f.render(f.props,f.state,f.context),$o.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=In({},r,f.getChildContext())),k&&n.__c&&f.getSnapshotBeforeUpdate&&(x=f.getSnapshotBeforeUpdate(m,v)),w=_&&_.type===de&&_.key==null?_.props.children:_,P.__P&&(_=s,o=(e=P.__P).namespaceURI,c=a=null,n.props&&n.props.__P!=e&&(n.__k.some(function(z){z&&Mi(z,z)}),n.__k=null),s=n.__k?fn(n,0):null),s=jl(e,Do(w)?w:[w],t,n,r,o,a,i,s,c,p),P.__P&&(t.__e=null,s=_),t.__u&=-161,d&&d.some(Rn),f.__h.length&&i.push(f),1&f.__g&&(f.__g&=-4)}catch(z){if(i.length=u,t.__v=null,c||a)if(z.then){if(C=0,t.__u|=128|c,a){for(~(A=a.indexOf(s||void 0))||(A=a.length);(L=a[A-1])&&L.nodeType==8;)A--;for(;A<a.length;A++)if(L=a[A]){if(a[A]=null,L.nodeType==8){if(L.data.startsWith("$s"))C++||(E=L);else if(C&&L.data.startsWith("/$s")&&!--C)break}else if(!C)break}}if(!E){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;E=s}(_=Ci(E=t.__c.__z||(t.__c.__z=E)))?(t.__e=E,s=_):t.__e=s,s=s&&s.nextSibling}else a&&a.some(Rn);else t.__e=n.__e;t.__k||(t.__k=n.__k||[]),z.then||Wl(t),pe.__e(z,t,n)}}else s=t.__e=Kf(n.__e,t,n,r,o,a,i,c,p,e);return(_=pe.diffed)&&_(t),s}function Ci(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 Wl(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(Wl))}function Gl(e,t,n){for(var r=0;r<n.length;)Ai(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 Kf(e,t,n,r,o,a,i,s,c,p){var _,d,u,f,m,v,x,P,k,T=n.props||Oo,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(P=p.ownerDocument||document,!g)return P.createTextNode(h);e=P.createElementNS(o,g,h.is&&h),s&&(pe.__m&&pe.__m(t,a),s=!1),a=null}if(g){if(p=g=="template"?e.content:e,a=g=="textarea"&&h.defaultValue!=null?null:a&&Ii.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||Mo(e,_,null,m,o);for(_ in k=1&n.__u,h)m=h[_],_=="children"?f=m:_=="dangerouslySetInnerHTML"?d=m:_=="value"?v=m:_=="checked"?x=m:s&&typeof m!="function"||!(T[_]!==m||k&&m!=null)||Mo(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"&&jf.test(g))&&(o="http://www.w3.org/1999/xhtml"),jl(p,Do(f)?f:[f],t,n,r,o,a,i,a?a[0]:n.__k&&fn(n,0),s,c),a&&a.some(Rn)),s&&g!="textarea"||(_="value",g=="progress"&&v==null?e.removeAttribute(_):v==null||v===e[_]&&(g!="progress"||v)||Mo(e,_,v,T[_],o),_="checked",x!=null&&x!=e[_]&&Mo(e,_,x,T[_],o))}else T===h||s&&e.data==h||(e.data=h);return e}function Ai(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 Mi(e,t,n){var r,o,a,i;if(pe.unmount&&pe.unmount(e),!(r=e.ref)||r.current&&r.current!=e.__e||Ai(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]&&Mi(r[i],t,typeof e.type!="function"||n&&!e.props.__P);!n&&(r=e.__c)&&(r=r.__z)&&(o=Ci(r,a=[]))&&(r==e.__e&&a.some(Rn),Rn(o),Rn(r)),(r=e.__e)&&(n||Rn(r),r.__e&&(r.__e=null)),e.__e=e.__c=e.__=null}function Qf(e,t,n){return this.constructor(e,n)}function gn(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=Nr(de,{children:[e]}),o=[],a=[],Ei(t,t.__k,r||Oo,Oo,t.namespaceURI,r?null:t.firstChild?Ii.call(t.childNodes):null,o,r?r.__e:t.firstChild,n,a),Gl(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 Lo=0,e}},Bl=0,Ti=function(e){return e!=null&&e.constructor===Lr},Dt.prototype.setState=function(e,t){var n=this.__s;n&&n!=this.state||(n=this.__s=In({},this.state)),typeof e=="function"&&(e=e(In({},n),this.props)),e&&(In(n,e),this.__v&&(t&&this.__k.push(t),Dl(this)))},Dt.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),Dl(this))},Dt.prototype.render=de,_n=[],Lo=0,Ul=function(e,t){return e.__v.__b-t.__v.__b},No=Symbol(),ql=/(PointerCapture)$|Capture$/i,Ri=0,wi={},zf=0;function Ni(e,t){if(!(!e?.length||!t))return e.find(n=>n.locale===t)}function Kl(e,t){let{translations:n,defaultLocale:r,...o}=e,a=Ni(n,t);return a?{...o,title:a.title??o.title,description:a.description??o.description,content:a.content??o.content}:o}function Ql(e,t){let{translations:n,defaultLocale:r,...o}=e,a=Ni(n,t);return a?{...o,title:a.title??o.title,description:a.description??o.description}:o}function Xl(e,t){let{translations:n,defaultLocale:r,...o}=e,a=Ni(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 Bo={attach:"Attach files",file:"File",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",toolStepsFailed:"{count} failed"},Xf={attach:"Joindre des fichiers",file:"Fichier",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",toolStepsFailed:"{count} en \xE9chec"},Jf={attach:"\u0625\u0631\u0641\u0627\u0642 \u0645\u0644\u0641\u0627\u062A",file:"\u0645\u0644\u0641",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",toolStepsFailed:"\u0641\u0634\u0644 {count}"},Yf={attach:"Adjuntar archivos",file:"Archivo",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",toolStepsFailed:"{count} con error"},Zf={attach:"\u05E6\u05D9\u05E8\u05D5\u05E3 \u05E7\u05D1\u05E6\u05D9\u05DD",file:"\u05E7\u05D5\u05D1\u05E5",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",toolStepsFailed:"{count} \u05E0\u05DB\u05E9\u05DC\u05D5"},em={en:Bo,fr:Xf,ar:Jf,es:Yf,he:Zf};function Uo(e,t){let n=Jl(e),r=qo(t),o=n==="en"?{}:em[n]??{},a=r?t[n]??{}:t??{},i=r?t.en??{}:{};return{...Bo,...o,...i,...a}}function Jl(e){return(e.split("-")[0]??"en").toLowerCase()}var tm=new Set(["ar","he","iw","fa","ur","ps","sd","ug","yi","dv","ckb","ks","nqo","prs","syr"]);function Yl(e){return tm.has(Jl(e))}function bt(e,t){return e[t]??t}function qo(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 Li=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{}}},Ho=new Li;var zo={maxBytes:10485760,maxCount:10,accept:"*/*"},Zl={voice:"local"},ec={list:[],byTrigger:{}},Oi={enabled:!0,sampleRate:1},jo={upload:"/pai/upload-file",transcribe:"/pai/transcribe-audio",submitForm:"/pai/submit-form"},Yn={variant:"circle",size:"md",label:void 0,icon:"chat",hidden:!1},tc={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"]},$i={enabled:!0,volume:.3,events:void 0},nc={enabled:!0,events:void 0},rc=[{label:"tabConversations",layout:"chat"}];var nm=["off","error","warn","info","debug","trace"],Di=M.cssPrefix,rm=`${Di}.debug`,om=`__${M.global}_DEBUG__`,am=`${Di}-debug`,ic=2,oc=null;function im(){if(typeof window>"u")return 2;try{let e=new URLSearchParams(window.location.search).get(am);if(e!==null){let t=ac(e);if(t>=0)return t}}catch{}try{let e=window.localStorage?.getItem(rm);if(e){let t=ac(e);if(t>=0)return t}}catch{}return Reflect.get(window,om)?4:2}function ac(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=nm.findIndex(n=>n===e);if(t>=0)return t}return-1}ic=im();function sc(e){let t=`[${Di}:${e}]`;function n(r,o,a){return(i,s)=>{if(!(ic<r)&&(s===void 0?console[o](t,i):console[o](t,i,s),oc))try{oc({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=>sc(`${e}:${r}`)}}var le=sc("core");var En=le.scope("context"),sm=new Set(["visitorId","conversationId","jwt","token","authorization","password"]),lc=50,Fi=1024,lm=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function Bi(e){return cc(e,"userContext",!0)}function Ui(e){return cc(e,"pageContext",!1)}function cc(e,t,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){En.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(sm.has(a)){En.warn(`dropped reserved ${t} key "${a}" \u2014 managed by the widget, not host-settable`);continue}if(i==null)continue;if(o>=lc){En.warn(`${t} truncated at ${lc} keys \u2014 dropped "${a}"`);continue}let s=cm(t,a,i);s!==void 0&&(r[a]=s,o++)}return n&&typeof r.email=="string"&&!lm.test(r.email)&&(En.warn("dropped malformed context field",{field:`${t}.email`,reason:"invalid format"}),delete r.email),Object.keys(r).length>0?r:void 0}function cm(e,t,n){if(typeof n=="boolean")return n;if(typeof n=="number"){if(!Number.isFinite(n)){En.warn(`dropped non-finite ${e}.${t}`);return}return n}if(typeof n=="string"){let r=n.trim();return r===""?void 0:r.length>Fi?(En.warn(`truncated ${e}.${t} to ${Fi} chars`),r.slice(0,Fi)):r}En.warn(`dropped ${e}.${t} \u2014 only string/number/boolean values are allowed`,{type:typeof n})}function Zn(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??{},c={enabled:t.history?.enabled??!0},{themeMode:p,themeOverrides:_}=um(t.theme),d=n.mode??"floating",u=dm(o.defaultLocale),f=o.availableLocales??[o.locale??u],m=er(o.locale??u,f,u),v=(t.baseUrl??M.defaultBaseUrl).replace(/\/$/,""),x=(t.agentApiBaseUrl??`${v}/api/agent`).replace(/\/$/,""),P=(t.dataApiBaseUrl??`${v}/api/data`).replace(/\/$/,"");return{widgetId:t.widgetId??"default",publicKey:t.publicKey,aiAgentDeploymentId:t.aiAgentDeploymentId,baseUrl:v,agentApiBaseUrl:x,dataApiBaseUrl:P,userContext:Bi(t.userContext),pageContext:Ui(t.pageContext),position:n.position??"bottom-right",themeMode:p,textSize:"normal",themeOverrides:_,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??Zl.voice,fileUpload:!(t.features?.disableFileUpload??!1),humanInLoop:!(t.features?.disableHumanInLoop??!1),operatorRequest:t.features?.enableOperatorRequest===!0},forms:Or(t.forms,m),endpoints:{upload:t.endpoints?.upload??jo.upload,transcribe:t.endpoints?.transcribe??jo.transcribe,submitForm:t.endpoints?.submitForm??jo.submitForm},attachments:{accept:t.composer?.attachments?.accept??zo.accept,maxBytes:t.composer?.attachments?.maxBytes??zo.maxBytes,maxCount:t.composer?.attachments?.maxCount??zo.maxCount},locale:m,defaultLocale:u,availableLocales:f,startMinimized:r.startMinimized??!0,actions:pm(d,s.actions,c.enabled),size:n.size??{},launcher:ym(t.launcher),sound:_m(a.sound),haptics:fm(a.haptics),strings:Uo(m,o.strings),stringsOverride:o.strings,composerDisclaimer:i.composerDisclaimer??"",poweredBy:gm(i.poweredBy),composer:hm(t.composer),modules:vm(t.modules,c.enabled),tracking:mm(t.tracking,P),history:c,storage:t.storage??Ho,userToken:t.userToken,tools:t.tools,onMessage:t.onMessage,onOpen:t.onOpen,onClose:t.onClose,onError:t.onError}}function um(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 dm(e){return e&&e!=="auto"?e:globalThis.navigator?.language||"en"}function er(e,t,n){return t.length<=1||t.includes(e)?e:t.includes(n)?n:t[0]??e}function pm(e,t,n){let r=t??tc[e];return n?r:r.filter(o=>o!=="history")}function _m(e){return{enabled:e?.enabled??$i.enabled,volume:e?.volume??$i.volume,events:e?.events}}function fm(e){return{enabled:e?.enabled??nc.enabled,events:e?.events}}function mm(e,t){let n=e?.sampleRate??Oi.sampleRate;return{enabled:e?.enabled??Oi.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 gm(e){let n={...{text:`Powered by ${M.displayName}`,href:M.siteUrl},...e};return!!(n.text||n.logoUrl)?n:null}function hm(e){let t=e?.sendButton;return{sendButton:{shape:t?.shape??"circle",icon:t?.icon??"arrowUp",variant:t?.variant??"filled"}}}function vm(e,t){let n=e??rc,r=new Set,o=[];for(let i of n.slice(0,4)){if(!i?.label||!i?.layout)continue;let s=i.contentCollectionIds?.filter(Boolean),c=i.id??s?.[0]??i.layout;for(;r.has(c);)c=`${c}-${o.length}`;r.add(c);let p={id:c,label:i.label,layout:i.layout};s?.length&&(p.contentCollectionIds=s),i.layout==="home"&&(p.brandName=i.brandName,p.greetingText=i.greetingText,p.showGreeting=!(i.hideGreeting??!1),p.showSearchBar=!(i.hideSearchBar??!1),p.showRecentConversations=t&&!(i.hideRecentConversations??!1),i.userAvatars?.length&&(p.userAvatars=i.userAvatars),i.status&&(p.status=i.status),p.contentBlockTitle=i.contentBlockTitle),o.push(p)}let a=Object.fromEntries(o.map(i=>[i.id,i]));return{list:o,byId:a}}function Or(e,t){var a;if(!e?.length)return ec;let n=[],r=new Set;for(let i of e){if(!i?.id||r.has(i.id))continue;let s=Xl(i,t),c=(s.fields??[]).filter(_=>!!(_?.name&&_.label&&_.type)),p=(Array.isArray(s.on)?s.on:[s.on]).map(bm).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,blocking:s.blocking??!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 bm(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 ym(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??Yn.variant,size:e?.size??Yn.size,label:e?.label??Yn.label,icon:e?.icon??Yn.icon,hidden:e?.hidden??Yn.hidden,callout:t}}function qi(e,t,n,r){let o=er(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=Uo(o,e.stringsOverride)),n!==e.themeMode&&(a.themeMode=n),r!==e.textSize&&(a.textSize=r),a}var Pm=["presentation","behavior","theme","launcher","header","composer","feedback","i18n","footer","features","tracking","endpoints","history"];function Hi(e,t){if(!t)return e;let n={...e};for(let a of Pm){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]=uc(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=uc(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=xm(s,i)),n.i18n=a}return n}function uc(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 xm(e,t){if(!e)return t;if(!t)return e;let n=qo(e),r=qo(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 Sm=["clear","expand","fullscreen","popOut","sound","history","language","theme","textSize","close"];function tn(e){return e!=="false"}function km(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}var pc=[["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]],_c=[["mode","mode",e=>e],["position","position",e=>e],["iframe","iframe",tn]],fc=[["width","width"],["height","height"]],mc=[["response-mode","responseMode",e=>e],["start-minimized","startMinimized",tn],["show-reasoning","showReasoning",tn],["show-tool-calls","showToolCalls",tn],["show-sources","showSources",tn],["disable-message-feedback","disableMessageFeedback",tn],["auto-send-suggestions","autoSendSuggestions",tn],["pop-out-url","popOutUrl"]],gc=[["locale","locale"]],wm=new Set(Sm);function Cm(e){return km(e).filter(t=>wm.has(t))}var hc=[["launcher-variant","variant",e=>e],["launcher-size","size",e=>e],["launcher-icon","icon"],["launcher-hidden","hidden",tn]],vc=[["features-disable-file-upload","disableFileUpload",tn],["features-voice","voice",e=>e]],bc=[["endpoint-upload","upload"],["endpoint-transcribe","transcribe"]],yc=[["user-id","id"],["user-email","email"],["user-name","name"]],Pc=[["page-area","area"],["page-url","url"],["page-path","path"],["page-title","title"]],Tm=["launcher-label","callout-text","callout-delay","actions","user-context","page-context"],Rm=[pc,_c,fc,mc,gc,hc,vc,bc,yc,Pc],Im=new Set(["iframe","start-minimized"]),zi=[...Rm.flatMap(e=>e.map(([t])=>t).filter(t=>!Im.has(t))),...Tm];function ji(e){let t={};function n(f){let m=e(f);return m===null||m===""?void 0:m}for(let[f,m,v]of pc){let x=n(f);x!==void 0&&(t[m]=v?v(x):x)}let r=An(n,_c),o=An(n,fc);(r||o)&&(t.presentation={...r,...o?{size:o}:{}});let a=An(n,mc);a&&(t.behavior=a);let i=An(n,gc);i&&(t.i18n=i);let s=Em(e,n);s&&(t.launcher=s);let c=An(n,vc);c&&(t.features=c);let p=An(n,bc);p&&(t.endpoints=p);let _=dc(n,yc,"user-context");_&&(t.userContext=_);let d=dc(n,Pc,"page-context");d&&(t.pageContext=d);let u=n("actions");return u!==void 0&&(t.header={actions:Cm(u)}),t}function An(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 dc(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 Em(e,t){let n=An(t,hc)??{},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 xc=le.scope("track"),Am=64,Mm=256,Nm=10;function Sc(e,t){let n=typeof e=="string"?e.trim():"";if(!n||n.length>Am){xc.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>Mm?(xc.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 kc(e){let t=[];return e.on("hostEvent",n=>{t.push({...n,at:Date.now()}),t.length>Nm&&t.shift()}),t}function Ct(){let e=Date.now(),t=new Uint8Array(16);t[0]=Math.floor(e/2**40)&255,t[1]=Math.floor(e/2**32)&255,t[2]=e>>>24&255,t[3]=e>>>16&255,t[4]=e>>>8&255,t[5]=e&255,Lm(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 Lm(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 nn=le.scope("persistence");function tr(e,t=Ho,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`,x=`${s}.seenNewsId`,P=`${s}.historyCount`,k=`${s}.formsDone`,T={getVisitorId(){let h=t.get(c);if(h)return h;let g=Ct();return t.set(c,g),g},loadConversationId(){return t.get(p)??void 0},saveConversationId(h){nn.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(Om)?[]:S}catch(S){return nn.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){nn.warn("saveMessageQueue serialise failed",{error:w})}},loadUserPrefs(){let h=t.get(_);if(!h)return{};try{return Vi(JSON.parse(h))}catch(g){return nn.warn("loadUserPrefs parse failed",{error:g}),{}}},saveUserPrefs(h){try{t.set(_,JSON.stringify(h))}catch(g){nn.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(x)||null},saveSeenNewsId(h){t.set(x,h)},loadHistoryCount(){let h=t.get(P);if(!h)return null;let g=Number.parseInt(h,10);return Number.isFinite(g)&&g>=0?g:null},saveHistoryCount(h){t.set(P,String(h))},loadFormsDone(){let h=t.get(k);if(!h)return{};try{let g=JSON.parse(h);return Vo(g)?Object.fromEntries(Object.entries(g).filter(S=>typeof S[1]=="number")):{}}catch(g){return nn.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){nn.warn("saveFormDone serialise failed",{error:g})}},rememberStorageVersion(h){h&&h!==t.get(o)&&(nn.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,x,P,k])t.remove(g);nn.info("reset: forgot the visitor",{scope:r})}};return T}function Vo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Om(e){return Vo(e)&&typeof e.id=="string"&&e.id.length>0&&typeof e.text=="string"}function Vi(e){if(!Vo(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),Vo(e.widgetSize)&&typeof e.widgetSize.width=="number"&&typeof e.widgetSize.height=="number"&&(t.widgetSize={width:e.widgetSize.width,height:e.widgetSize.height}),t}var Wo="1.13.0";var $m="1",wc=60,Dm=2e3,Cc={open:()=>{},close:()=>{},expand:e=>({on:e}),fullscreen:e=>({on:e}),send:e=>({attachments:e.attachmentCount}),message:e=>({role:e.role}),stop:()=>{},clear:()=>{},suggestion:()=>{},toggleHistory:e=>({view:e.view}),handshake:()=>{},formSubmit:e=>({formId:e.formId,skipped:e.skipped}),toolResult:()=>{},toolDecision:e=>({approved:e.approved}),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 Fm(){let e=navigator;return e.globalPrivacyControl===!0||e.doNotTrack==="1"}function Bm(){return location.origin+location.pathname}function Um(){try{return document.referrer?new URL(document.referrer).origin:""}catch{return""}}function Tc(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:x}=t.getOptions();if(!u.enabled||Fm()||n>=u.sampleRate)return;let P=performance.now();if(P-r>6e4&&(r=P,o=0),++o>wc)return;let k=new URLSearchParams;k.set("v",$m),k.set("_ev",Wo),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",Bm());let h=Um();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",x),d)for(let[C,E]of Object.entries(d))E!==void 0&&k.set(C,String(E));k.set("ts",String(Date.now()));let g=`${u.endpoint}?${k}`;if(g.length>Dm)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<wc&&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(Cc).map(_=>e.on(_,d=>c(_,Cc[_]?.(d))));return()=>{for(let _ of p)_();a.clear()}}var Rc=`.__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 Ic=`: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;border-radius:var(--__P__-radius-md)}: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:var(--__P__-radius-md);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);flex-shrink:0}.__P__-agent-avatar img{width:100%;height:100%;border-radius:inherit;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__-file-image,.__P__-file-chip{margin-block:var(--__P__-space-1);border-radius:var(--__P__-radius-sm);color:inherit;text-decoration:none}.__P__-file-image{display:block;width:fit-content;max-width:min(100%,240px);overflow:hidden}.__P__-file-image img{max-height:240px;object-fit:cover}.__P__-file-chip{display:flex;align-items:center;gap:var(--__P__-space-2);max-width:min(100%,280px);padding:var(--__P__-space-2);border:1px solid color-mix(in srgb,currentColor 18%,transparent);background:color-mix(in srgb,currentColor 5%,transparent);transition:background var(--__P__-dur-base) var(--__P__-ease)}.__P__-file-chip:hover{background:color-mix(in srgb,currentColor 10%,transparent)}.__P__-file-image:focus-visible,.__P__-file-chip:focus-visible{outline:2px solid currentColor;outline-offset:2px}.__P__-file-chip-icon{flex:none;display:grid;place-items:center;width:32px;height:32px;border-radius:var(--__P__-radius-sm);background:color-mix(in srgb,currentColor 10%,transparent)}.__P__-file-chip-text{display:grid;min-width:0;line-height:1.35}.__P__-file-chip-name{font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.__P__-file-chip-meta{font-size:var(--__P__-text-xs);opacity:.75}.__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__-steps{margin:var(--__P__-space-1) 0 var(--__P__-space-2);font-size:var(--__P__-text-sm)}.__P__-steps-head,.__P__-steps-row-head{display:flex;align-items:center;gap:var(--__P__-space-2);width:100%;min-width:0;padding:var(--__P__-space-1) 0;border:0;background:none;color:var(--__P__-fg-muted);font:inherit;text-align:start;cursor:pointer;-webkit-tap-highlight-color:transparent}.__P__-steps-head:hover,.__P__-steps-row-head:hover{color:var(--__P__-fg)}.__P__-steps-head:focus-visible,.__P__-steps-row-head:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;border-radius:var(--__P__-radius-sm)}.__P__-steps-icon,.__P__-steps-row-icon{display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;width:16px;height:16px}.__P__-steps-icon svg,.__P__-steps-row-icon svg{width:14px;height:14px}.__P__-steps-label{display:flex;flex:1;align-items:center;gap:var(--__P__-space-1);min-width:0;overflow:hidden;white-space:nowrap}.__P__-steps-name{display:inline-flex;align-items:center;gap:var(--__P__-space-1);min-width:0}.__P__-steps-name-text,.__P__-steps-row-summary{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-steps-count,.__P__-steps-failed{flex-shrink:0;font-variant-numeric:tabular-nums}.__P__-steps-failed{color:var(--__P__-danger-text)}.__P__-steps-head .__P__-toolui-chevron[data-open=true]{transform:rotate(180deg)}.__P__-steps-list{display:flex;flex-direction:column;gap:var(--__P__-space-1);margin:var(--__P__-space-1) 0 0;padding:0;padding-inline-start:var(--__P__-space-2);border-inline-start:2px solid var(--__P__-border);list-style:none}.__P__-steps-row[data-status=error] .__P__-steps-row-icon{color:var(--__P__-danger-text)}.__P__-steps-row-name{flex-shrink:0;color:var(--__P__-fg);font-weight:500}.__P__-steps-row-body{display:flex;flex-direction:column;gap:var(--__P__-space-2);margin:var(--__P__-space-1) 0 var(--__P__-space-2)}.__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:var(--__P__-radius-md);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:var(--__P__-radius-md)}.__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:var(--__P__-radius-md);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:var(--__P__-radius-md);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 Ac=`*,*: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 Mc=`: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 Wm="helpai",Gm="#5B5BD6",Km="#FFFFFF",Qm="12px",Xm="Inter, system-ui, -apple-system, 'Segoe UI', sans-serif",Gi=[Mc,Ac,Ec,Rc,Ic].join(`
7
- `).replace(/__P__/g,Wm).replaceAll("__BRAND_ACCENT_TEXT__",Km).replaceAll("__BRAND_ACCENT__",Gm).replaceAll("__BRAND_RADIUS__",Qm).replaceAll("__BRAND_FONT__",Xm);var Lc=["data-theme","data-color-scheme","data-mode","data-bs-theme"];function Nc(e){if(e){if(e.classList.contains("dark"))return"dark";if(e.classList.contains("light"))return"light";for(let t of Lc){let n=e.getAttribute(t);if(n==="dark"||n==="light")return n}}}function nr(e=document){let t=Nc(e.documentElement)??Nc(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 Oc(e,t=document){let n=nr(t);e(n);function r(){let s=nr(t);s!==n&&(n=s,e(s))}let o=new MutationObserver(r),a={attributes:!0,attributeFilter:["class","style",...Lc]};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 Jm=le.scope("mount"),$c=new WeakMap,Dc={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 Fc(e,t){e.style.cssText=Dc[t]}function Go(e){return e==="floating"||e==="modal"||e==="drawer"?"floating":e==="standalone"||e==="page"?"viewport":"flow"}function Bc(e={}){let t=e.position??"flow";Jm.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=Dc[t];let o=r.shadowRoot??r.attachShadow({mode:"open"});for(let s of["keydown","keypress","keyup"])o.addEventListener(s,Ym);let a=r.ownerDocument;if(!Zm(o,a)){let s=a.createElement("style");s.textContent=Gi,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 Ym(e){let t=e.composedPath()[0];t instanceof HTMLElement&&(t.isContentEditable||t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT")&&e.stopPropagation()}function Zm(e,t){if(!("adoptedStyleSheets"in e))return!1;let n=t.defaultView;if(!n||typeof n.CSSStyleSheet!="function")return!1;let r=$c.get(t);if(!r)try{r=new n.CSSStyleSheet,r.replaceSync(Gi),$c.set(t,r)}catch{return!1}try{return e.adoptedStyleSheets=[r],!0}catch{return!1}}function eg(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 tg(e,t){e.dataset.theme=t==="host"?nr():t}function ng(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 rg(e,t){e.dataset.position=t}function Ko(e,t){e.dataset.mode=t}function Uc(e,t){tg(e,t.themeMode),eg(e,t.themeOverrides),rg(e,t.position),ng(e,t.size)}var rr,tt,Ki,qc,Qi=Object.is,Dr=0,Xc=[],Xi=[],Qe=pe,Hc=Qe.__b,zc=Qe.__r,jc=Qe.diffed,Vc=Qe.__c,Wc=Qe.unmount,Gc=Qe.__;function Qo(e,t){Qe.__h&&Qe.__h(tt,e,Dr||t),Dr=0;var n=tt.__H||(tt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function q(e){return Dr=1,Jc(Yc,e)}function Jc(e,t,n){var r=Qo(rr++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Yc(void 0,t),function(a){var i=r.__N?r.__N[0]:r.__[0],s=r.t(i,a);Qi(i,s)||(r.__N=[s,r.__[1]],r.__c.setState({}))}],r.__c=tt,!tt.__f)){tt.__f=!0;var o=tt.shouldComponentUpdate;tt.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,Qi(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=Qo(rr++,3);!Qe.__s&&Yi(n.__H,t)&&(n.__P=!0,n.__=e,n.u=t,tt.__H.__h.push(n))}function Tt(e,t){var n=Qo(rr++,4);!Qe.__s&&Yi(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,tt.__h.push(n))}function F(e){return Dr=5,ue(function(){return{current:e}},[])}function ue(e,t){var n=Qo(rr++,7);return Yi(n.__H,t)&&(n.__=e(),n.__H=t),n.__}function $(e,t){return Dr=8,ue(function(){return e},t)}function og(){var e;do{for(;e=Xi.shift();)try{$r(e)}catch(n){Qe.__e(n,{__:(e=e.__P)&&e.__v})}for(;e=Xc.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some($r),t.__h.some(Ji),t.__h=[]}catch(n){t.__h=[],Qe.__e(n,e.__v)}}}while(Xi.length)}Qe.__b=function(e){tt=null,Hc&&Hc(e)},Qe.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Gc&&Gc(e,t)},Qe.__r=function(e){zc&&zc(e),rr=0;var t=(tt=e.__c).__H;t&&(Ki==tt?tt.__h=[]:(t.__h.some($r),t.__h.some(Ji),rr=0),t.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})),Ki=tt},Qe.diffed=function(e){jc&&jc(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&Qc(Xc.push(t)),t.__H.__.some(function(n){n.u&&(n.__H=n.u)})),Ki=tt=null},Qe.__c=function(e,t){t.some(function(n){try{n.__h.some($r),n.__h=n.__h.filter(function(r){return!r.__||Ji(r)})}catch(r){n.__h=[function(){throw r}]}}),Vc&&Vc(e,t)},Qe.unmount=function(e){Wc&&Wc(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,Qc(Xi.push(o))}else $r(o)}catch(a){t=a}}),r.__H=void 0,t&&Qe.__e(t,r.__v))};var Kc=typeof requestAnimationFrame=="function";function ag(e){var t,n=function(){clearTimeout(r),Kc&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Kc&&(t=requestAnimationFrame(n))}function Qc(e){e!=1&&qc==Qe.requestAnimationFrame||((qc=Qe.requestAnimationFrame)||ag)(og)}function $r(e){var t=tt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),tt=t}function Ji(e){var t=tt;e.__c=e.__(),tt=t}function Yi(e,t){return!e||e.length!=t.length||t.some(function(n,r){return!Qi(n,e[r])})}function Yc(e,t){return typeof t=="function"?t(e):t}var ig=Symbol.for("preact-signals");function Zo(){if(rn>1)rn--;else{var e,t=!1;for((function(){var o=Jo;for(Jo=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}})();Br!==void 0;){var n=Br;for(Br=void 0,Xo++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&eu(n))try{n.c()}catch(o){t||(e=o,t=!0)}n=r}}if(Xo=0,rn--,t)throw e}}function Ft(e){if(rn>0)return e();Zi=++sg,rn++;try{return e()}finally{Zo()}}var Fr,$e=void 0;function Ur(e){var t=$e,n=Fr;$e=void 0,Fr=void 0;try{return e()}finally{$e=t,Fr=n}}var Br=void 0,rn=0,Xo=0,sg=0,Zi=0,Jo=void 0,Yo=0;function Zc(e){if($e!==void 0){var t=e.n;if(t===void 0||t.t!==$e)return t={i:0,S:e,p:$e.s,n:void 0,t:$e,e:void 0,x:void 0,r:t},$e.s!==void 0&&($e.s.n=t),$e.s=t,e.n=t,32&$e.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=$e.s,t.n=void 0,$e.s.n=t,$e.s=t),t}}function st(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}st.prototype.brand=ig;st.prototype.h=function(){return!0};st.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:Ur(function(){var r;(r=t.W)==null||r.call(t)}))};st.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&&Ur(function(){var o;(o=t.Z)==null||o.call(t)}))}};st.prototype.subscribe=function(e){var t=this;return jt(function(){var n=t.value;Ur(function(){return e(n)})},{name:"sub"})};st.prototype.valueOf=function(){return this.value};st.prototype.toString=function(){return this.value+""};st.prototype.toJSON=function(){return this.value};st.prototype.peek=function(){var e=this;return Ur(function(){return e.value})};Object.defineProperty(st.prototype,"value",{get:function(){var e=Zc(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Xo>100)throw new Error("Cycle detected");(function(n){rn!==0&&Xo===0&&n.l!==Zi&&(n.l=Zi,Jo={S:n,v:n.v,i:n.i,o:Jo})})(this),this.v=e,this.i++,Yo++,rn++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Zo()}}}});function se(e,t){return new st(e,t)}function eu(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 tu(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 nu(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 Mn(e,t){st.call(this,void 0,t),this.x=e,this.s=void 0,this.g=Yo-1,this.f=4}Mn.prototype=new st;Mn.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Yo))return!0;if(this.g=Yo,this.f|=1,this.i>0&&!eu(this))return this.f&=-2,!0;var e=$e;try{tu(this),$e=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 $e=e,nu(this),this.f&=-2,!0};Mn.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)}st.prototype.S.call(this,e)};Mn.prototype.U=function(e){if(this.t!==void 0&&(st.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)}};Mn.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(Mn.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Zc(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Se(e,t){return new Mn(e,t)}function ru(e){var t=e.j;if(e.j=void 0,typeof t=="function"){rn++;var n=$e;$e=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,es(e),r}finally{$e=n,Zo()}}}function es(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,ru(e)}function lg(e){if($e!==this)throw new Error("Out-of-order effect");nu(this),$e=e,this.f&=-2;try{8&this.f&&es(this)}finally{Zo()}}function or(e,t){this.x=e,this.j=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,Fr&&Fr.push(this)}or.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.j=t)}finally{e()}};or.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,ru(this),tu(this),rn++;var e=$e;return $e=this,lg.bind(this,e)};or.prototype.N=function(){2&this.f||(this.f|=2,this.u=Br,Br=this)};or.prototype.d=function(){this.f|=8,1&this.f||es(this)};or.prototype.dispose=function(){this.d()};function jt(e,t){var n=new or(e,t);try{n.c()}catch(o){throw n.d(),o}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var ou,Hr,ea,cg=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var au=[];jt(function(){ou=this.N})();function ar(e,t){pe[e]=t.bind(null,pe[e]||function(){})}function qr(e){if(ea){var t=ea;ea=void 0,t()}ea=e&&e.S()}function iu(e){var t=this,n=e.data,r=Mt(n);r.name="ReactiveDom",r.value=n;var o=ue(function(){for(var s=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var p=Se(function(){var f=r.value.value;return f===0?0:f===!0?"":f||""}),_=Se(function(){return!Array.isArray(p.value)&&!Ti(p.value)}),d=jt(function(){if(this.N=su,_.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}iu.displayName="ReactiveTextNode";Object.defineProperties(st.prototype,{constructor:{configurable:!0,value:mn(de,null).constructor},type:{configurable:!0,value:iu},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});ar("__b",function(e,t){if(qr(),Hr=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 st&&(n||(t.__np=n={}),n[o]=a,r[o]=a.peek())}}e(t)});ar("__r",function(e,t){if(e(t),t.type!==de){qr();var n,r=t.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=(function(o,a){var i;return jt(function(){i=this},{name:a}),i.c=o,i})((function(o){return function(){var a;cg&&((a=this.y)==null||a.call(this)),o.__$f|=1,o.setState({})}})(r),typeof t.type=="function"?t.type.displayName||t.type.name:""))),Hr=r,qr(n)}});ar("__e",function(e,t,n,r){qr(),Hr=void 0,e(t,n,r)});ar("diffed",function(e,t){qr(),Hr=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=ug(n,c,_,o),a[c]=p):p.o(_,o)}}}e(t)});function ug(e,t,n,r){var o=t in e&&e.ownerSVGElement===void 0,a=se(n);return{o:function(i,s){a.value=i,r=s},d:jt(function(){this.N=su;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))})}}ar("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)});ar("__h",function(e,t,n,r){r<3&&(t.__$f|=2),e(t,n,r)});Dt.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 Mt(e,t){return ue(function(){return se(e,t)},[])}function Rt(e,t){var n=F(e);return n.current=e,Hr.__$f|=4,ue(function(){return Se(function(){return n.current()},t)},[])}var dg=function(e){queueMicrotask(function(){queueMicrotask(e)})};function pg(){Ft(function(){for(var e;e=au.shift();)ou.call(e)})}function su(){au.push(this)===1&&(pe.requestAnimationFrame||dg)(pg)}var _g="x-public-key",fg="x-ai-agent-deployment-id";function lu(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");return{headers(){let t={[fg]:e.aiAgentDeploymentId};return e.publicKey&&(t[e.publicKeyHeader??_g]=e.publicKey),t}}}var mg=new Set(["home","chats","help","news"]);function cu(e){return typeof e!="object"||e===null||!("to"in e)||typeof e.to!="string"||!mg.has(e.to)?!1:!("id"in e)||e.id===void 0||typeof e.id=="string"}function ta(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 zr(e,t){return{text:e,send:typeof t=="object"&&t!==null&&"send"in t&&t.send===!0}}function uu(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 du(e){return`${M.cssPrefix}:${e}`}function Lt(e,t,n){e.dispatchEvent(new CustomEvent(du(t),{detail:n}))}function pu(e,t){let r=Object.entries(t).map(([o,a])=>{let i=du(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 na(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 _u(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=na(o,n),s=na(i.rest,r),c=na(a,n),p=na(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:ta(_),...d?{ask:d}:{},url:t.toString()}}var jr={open:!1,ready:!1,unread:0},ra=class{constructor(){re(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 fu=le.scope("feedback:audio"),oa=class{constructor(){re(this,"ctx",null);re(this,"master",null);re(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){fu.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=>(fu.warn("audio fetch/decode failed",{url:t,err:a}),this.buffers.delete(t),null));return this.buffers.set(t,o),o}};var mu={messageReceived:10,messageSent:0,error:[20,40,20],voiceStart:10,voiceStop:0},gu={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 hn=null,aa=0;function gg(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}function hg(){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 hu(e){if(!(e===0||Array.isArray(e)&&e.every(t=>t===0))){if(gg())try{navigator.vibrate(e);return}catch{}if(hn??(hn=hg()),!!hn)try{hn.label.click()}catch{}}}function vu(){aa++;let e=!1;return()=>{e||(e=!0,aa=Math.max(0,aa-1),aa===0&&hn&&(hn.input.remove(),hn.label.remove(),hn=null))}}var vg=le.scope("feedback"),bg=100,ia=class{constructor(t,n){re(this,"mutedSig",se(!1));re(this,"audio",new oa);re(this,"releaseHaptics");re(this,"sound");re(this,"haptics");re(this,"lastPlayed",new Map);re(this,"reducedMotionMq",null);this.sound=t,this.haptics=n,this.releaseHaptics=vu(),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<bg}playSound(t){let n=this.sound.events?.[t];if(n===!1)return;if(typeof n=="string"){this.audio.playUrl(n).catch(o=>vg.warn("audio play failed",{err:o,url:n}));return}let r=gu[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?mu[t]:n;hu(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 bu(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function yu(e){return bu(e)}function Pu(e){return!(!bu(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}var yg=Symbol.for("pv"),Pg=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:yg,__v:--Pg,__i:-1,__u:0};return(o||a)&&(p.__source=o,p.__self=a),pe.vnode&&pe.vnode(p),p}var rs=1,Su=2,Vr=4,ku=8,wu=16;function xg(e){switch(e){case rs:return"href";case Su:return"src";case Vr:return"class";case ku:return"checked";case wu:return"start"}}var Sg=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}},kg=Sg;var xu=24;function ir(e){let t=new Uint32Array(xu);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(xu),indent:"",indent_len:0,table_state:0}}function Wr(e){e.pending.length>0&&Xe(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 ze(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&&ze(e),e.len+=1,e.tokens[e.len]=t,e.token=t,e.renderer.add_token(e.renderer.data,t)}function wg(e,t,n){for(;n<=e.len;){if(e.tokens[n]===t)return n;n+=1}return-1}function Nn(e,t){for(e.fence_start=0;e.len>t;)ze(e)}function sa(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;)ze(e);return t}function ts(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?(Nn(e,e.blockquote_idx),Ce(e,t),!0):(Nn(e,n),!1):(Nn(e,r),Ce(e,t),!0)}function ns(e,t){Ce(e,25),e.spaces[e.len]=e.indent_len+t,on(e),e.token=103}function on(e){e.indent="",e.indent_len=0,e.pending=""}function os(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 Cg(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 Tg(e){return os(e)||Cg(e)}function Xe(e,t){for(let n of t){if(e.token===101){switch(n){case" ":e.indent_len+=1;continue;case" ":e.indent_len+=4;continue}let o=sa(e,e.indent_len);e.indent_len=0,e.token=e.tokens[e.len],o>0&&Xe(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){ze(e),on(e),e.pending=n;continue}Nn(e,e.blockquote_idx),on(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" ":sa(e,e.indent_len),Ce(e,kg(e.pending.length)),on(e);continue}break;case">":{let a=wg(e,20,e.blockquote_idx+1);a===-1?(Nn(e,e.blockquote_idx),e.blockquote_idx+=1,e.fence_start=0,Ce(e,20)):e.blockquote_idx=a,on(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;sa(e,e.indent_len),e.renderer.add_token(e.renderer.data,22),e.renderer.end_token(e.renderer.data),on(e),e.hr_chars=0;continue}e.hr_chars=0}if(e.pending[0]!=="_"&&e.pending[1]===" "){ts(e,23),ns(e,2),Xe(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),on(e),e.fence_start=0,Xe(e,r));continue;case`
11
- `:{sa(e,e.indent_len),Ce(e,10),e.pending.length>e.fence_start&&e.renderer.set_attr(e.renderer.data,Vr,e.pending.slice(e.fence_start)),on(e),e.token=101;continue}default:e.pending=r;continue}case"+":if(n!==" ")break;ts(e,23),ns(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;ts(e,24)&&e.pending!=="1."&&e.renderer.set_attr(e.renderer.data,wu,e.pending.slice(0,-1)),ns(e,e.pending.length+1);continue}else{let a=n.charCodeAt(0);if(a===46||os(a)){e.pending=r;continue}}break;case"|":Nn(e,e.blockquote_idx),Ce(e,27),Ce(e,28),e.pending="",Xe(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);on(e),Xe(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:ze(e),e.table_state=0;break}else switch(e.pending){case"|":Ce(e,28),e.pending="",Xe(e,n);continue;case`
13
- `:ze(e),e.pending="",e.table_state=0,Xe(e,n);continue}break;case 28:switch(e.pending){case"":break;case"|":Ce(e,29),ze(e),e.pending="",Xe(e,n);continue;case`
14
- `:ze(e),e.table_state=Math.min(e.table_state+1,2),e.pending="",Xe(e,n);continue;default:Ce(e,29),Xe(e,n);continue}break;case 29:if(e.pending==="|"){ke(e),ze(e),e.pending="",Xe(e,n);continue}break;case 9:switch(r){case`
1
+ var Jf=Object.defineProperty;var Yf=(e,t,n)=>t in e?Jf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ee=(e,t,n)=>Yf(e,typeof t!="symbol"?t+"":t,n);var me,Vl,Ei,mn,Ri,Do,Wl,$o,Gl,Mi,Ii,Zf,Lr=Symbol.for("pv"),Fo={},Bo=[],em=/^m(i|n|o|s|text|space)$/,Uo=Array.isArray,Ni=Bo.slice,Mn=Object.assign;function En(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?Ni.call(arguments,2):n),Nr(e,i,r,o,null)}function Nr(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:Lr,__v:o||++Vl,__i:-1,__u:0};return!o&&me.vnode&&me.vnode(a),a}function ue(e){return e.children}function Bt(e,t){this.props=e,this.context=t,this.__g=0}function gn(e,t){if(t==null)return e.__&&gn(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:gn(e)}function Kl(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),Kl(e)}function zl(e){(8&e.__g||(e.__g|=8,mn.push(e),Do++))&&Ri==me.debounceRendering||((Ri=me.debounceRendering)||queueMicrotask)(Ql)}function Ql(){var e,t,n,r,o,a,i,s,c;try{for(t=1;mn.length;)mn.length>t&&mn.sort(Wl),e=mn.shift(),t=mn.length,8&e.__g&&(r=void 0,o=void 0,a=(o=(n=e).__v).__e,i=[],s=[],(c=n.__P)&&((r=Mn({constructor:Lr},o)).__v=o.__v+1,me.vnode&&me.vnode(r),Li(c,r,o,n.__n,c.namespaceURI,32&o.__u?[a]:null,i,a||gn(o),32&o.__u,s),r.__v=o.__v,r.__.__k[r.__i]=r,Zl(i,r,s),o.__=o.__e=null,r.__e!=a&&Kl(r)))}finally{(Do=mn.length)&&(Ri||queueMicrotask)(Ql)}}function Xl(e,t,n,r,o,a,i,s,c,p,_){var d,u,f,m,v,y,x=r.__k||Bo,S=t.length;for(c=tm(n,t,x,c,S),d=0;d<S;d++)(f=n.__k[d])!=null&&(u=~f.__i&&x[f.__i]||Fo,f.__i=d,y=Li(e,f,u,o,a,i,s,c,p,_),m=f.__e,(u.ref!=f.ref||8&u.__u)&&(u.ref&&Oi(u.ref,null,f,u),f.ref&&_.push(f.ref,f.__c||m,f)),v=v||m,4&f.__u?(c=Jl(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=v,c}function tm(e,t,n,r,o){var a,i,s,c,p,_,d,u,f,m=n.length,v=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]=Nr(null,i):Uo(i)?i=S[a]=Nr(ue,{children:i}):i.constructor===Lr&&i.__b?i=S[a]=Nr(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=nm(i,n,c,v))&&(v--,(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=_.length;y<u;)_[f=y+u>>1]<i.__i?y=f+1:u=f;_[y]=i.__i,d[a]=y+1}for(y=_.length;a--;)d[a]&&(d[a]==y?y--:S[a].__u|=4)}if(v)for(a=0;a<m;a++)!(s=n[a])||2&s.__u||(s.__e==r&&(r=gn(s)),$i(s,s));return r}function Jl(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=Jl(o[a],t,n,!1));return t}for(t&&!t.parentNode&&(t=gn(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 qo(e,t){return t=t||[],e!=null&&typeof e!="boolean"&&(Uo(e)?e.some(function(n){qo(n,t)}):t.push(e)),t}function nm(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 jl(e,t,n){n==null&&(n=""),t[0]=="-"?e.setProperty(t,n):e[t]=n}function Oo(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||jl(e.style,t);if(n)for(t in n)r&&n[t]==r[t]||jl(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")(e.__e||(e.__e={}))[t]=n,n&&r||(i=Ii[t]||(Ii[t]=rm(t)),(e.__a||(e.__a={}))[t]=Mi,a=t!=(t=t.replace(Gl,"$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 rm(e){return function(t){var n=this.__e;if(n){if(n=n[e],t[$o]==null)t[$o]=Mi++;else if(t[$o]<this.__a[e])return;return n(me.event?me.event(t):t)}}}function Li(e,t,n,r,o,a,i,s,c,p){var _,d,u,f,m,v,y,x,S,w,h,g,b,k,E,R,A,L,j=t.type;if(t.constructor!==Lr)return null;128&n.__u&&(c=32&n.__u,_=n.__c.__z)&&(t.__u|=c,d=a=[],_.nodeType==8?s=Ai(_,a):a.push(_),s=a[0]||s),(_=me.__b)&&_(t);e:if(typeof j=="function"){u=i.length;try{if(x=t.props,S=(_=j.prototype)&&_.render,w=(_=j.contextType)&&r[_.__c],h=_?w?w.props.value:_.__:r,(f=n.__c)?(t.__c=f,2&f.__g&&(f.__g|=1)):(S?t.__c=f=new j(x,h):(t.__c=f=new Bt(x,h),f.constructor=j,f.render=am),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),j.getDerivedStateFromProps&&(f.__s==f.state&&(f.__s=Mn({},f.__s)),Mn(f.__s,j.getDerivedStateFromProps(x,f.__s)))),m=f.props,v=f.state,f.__v=t,n.__c){if(x!==m&&S&&!j.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(B){B&&(B.__=t)}),Bo.push.apply(f.__h,f.__k),f.__k=[],f.__h.length&&i.push(f),s=gn(n);break e}f.componentWillUpdate&&f.componentWillUpdate(x,f.__s,h),S&&f.componentDidUpdate&&f.__h.push(function(){f.componentDidUpdate(m,v,y)})}else S&&!j.getDerivedStateFromProps&&f.componentWillMount&&f.componentWillMount(),S&&f.componentDidMount&&f.__h.push(f.componentDidMount);if(f.context=h,f.props=x,f.__P=e,f.__g&=-5,g=me.__r,b=0,S)f.state=f.__s,f.__g&=-9,g&&g(t),_=f.render(f.props,f.state,f.context),Bo.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&&++b<25);f.state=f.__s,f.getChildContext&&(r=Mn({},r,f.getChildContext())),S&&n.__c&&f.getSnapshotBeforeUpdate&&(y=f.getSnapshotBeforeUpdate(m,v)),k=_&&_.type===ue&&_.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(B){B&&$i(B,B)}),n.__k=null),s=n.__k?gn(n,0):null),s=Xl(e,Uo(k)?k:[k],t,n,r,o,a,i,s,c,p),x.__P&&(t.__e=null,s=_),t.__u&=-161,d&&d.some(En),f.__h.length&&i.push(f),1&f.__g&&(f.__g&=-4)}catch(B){if(i.length=u,t.__v=null,c||a)if(B.then){if(E=0,t.__u|=128|c,a){for(~(A=a.indexOf(s||void 0))||(A=a.length);(L=a[A-1])&&L.nodeType==8;)A--;for(;A<a.length;A++)if(L=a[A]){if(a[A]=null,L.nodeType==8){if(L.data.startsWith("$s"))E++||(R=L);else if(E&&L.data.startsWith("/$s")&&!--E)break}else if(!E)break}}if(!R){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;R=s}(_=Ai(R=t.__c.__z||(t.__c.__z=R)))?(t.__e=R,s=_):t.__e=s,s=s&&s.nextSibling}else a&&a.some(En);else t.__e=n.__e;t.__k||(t.__k=n.__k||[]),B.then||Yl(t),me.__e(B,t,n)}}else s=t.__e=om(n.__e,t,n,r,o,a,i,c,p,e);return(_=me.diffed)&&_(t),s}function Ai(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 Yl(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(Yl))}function Zl(e,t,n){for(var r=0;r<n.length;)Oi(n[r++],n[r++],n[r++]);me.__c&&me.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(a){a.call(o)})}catch(a){me.__e(a,o.__v)}})}function om(e,t,n,r,o,a,i,s,c,p){var _,d,u,f,m,v,y,x,S,w=n.props||Fo,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&&(me.__m&&me.__m(t,a),s=!1),a=null}if(g){if(p=g=="template"?e.content:e,a=g=="textarea"&&h.defaultValue!=null?null:a&&Ni.call(p.childNodes),!s&&a)for(w={},_=0;_<e.attributes.length;_++)w[(m=e.attributes[_]).name]=m.value;for(_ in w)m=w[_],_=="dangerouslySetInnerHTML"?u=m:_=="children"||_ in h||_=="value"&&"defaultValue"in h||_=="checked"&&"defaultChecked"in h||Oo(e,_,null,m,o);for(_ in S=1&n.__u,h)m=h[_],_=="children"?f=m:_=="dangerouslySetInnerHTML"?d=m:_=="value"?v=m:_=="checked"?y=m:s&&typeof m!="function"||!(w[_]!==m||S&&m!=null)||Oo(e,_,m,w[_],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"&&em.test(g))&&(o="http://www.w3.org/1999/xhtml"),Xl(p,Uo(f)?f:[f],t,n,r,o,a,i,a?a[0]:n.__k&&gn(n,0),s,c),a&&a.some(En)),s&&g!="textarea"||(_="value",g=="progress"&&v==null?e.removeAttribute(_):v==null||v===e[_]&&(g!="progress"||v)||Oo(e,_,v,w[_],o),_="checked",y!=null&&y!=e[_]&&Oo(e,_,y,w[_],o))}else w===h||s&&e.data==h||(e.data=h);return e}function Oi(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){me.__e(o,n)}}function $i(e,t,n){var r,o,a,i;if(me.unmount&&me.unmount(e),!(r=e.ref)||r.current&&r.current!=e.__e||Oi(r,null,t,e),r=e.__c){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(s){me.__e(s,t)}r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&$i(r[i],t,typeof e.type!="function"||n&&!e.props.__P);!n&&(r=e.__c)&&(r=r.__z)&&(o=Ai(r,a=[]))&&(r==e.__e&&a.some(En),En(o),En(r)),(r=e.__e)&&(n||En(r),r.__e&&(r.__e=null)),e.__e=e.__c=e.__=null}function am(e,t,n){return this.constructor(e,n)}function vn(e,t){var n,r,o,a;me.__&&me.__(e,t),t.nodeType==9&&(t=t.documentElement),r=(n=e&&32&e.__u)?null:t.__k,t.__k=Nr(ue,{children:[e]}),o=[],a=[],Li(t,t.__k,r||Fo,Fo,t.namespaceURI,r?null:t.firstChild?Ni.call(t.childNodes):null,o,r?r.__e:t.firstChild,n,a),Zl(o,t.__k,a),t.__k.props.children=null}me={__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 Do=0,e}},Vl=0,Ei=function(e){return e!=null&&e.constructor===Lr},Bt.prototype.setState=function(e,t){var n=this.__s;n&&n!=this.state||(n=this.__s=Mn({},this.state)),typeof e=="function"&&(e=e(Mn({},n),this.props)),e&&(Mn(n,e),this.__v&&(t&&this.__k.push(t),zl(this)))},Bt.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),zl(this))},Bt.prototype.render=ue,mn=[],Do=0,Wl=function(e,t){return e.__v.__b-t.__v.__b},$o=Symbol(),Gl=/(PointerCapture)$|Capture$/i,Mi=0,Ii={},Zf=0;function Di(e,t){if(!(!e?.length||!t))return e.find(n=>n.locale===t)}function ec(e,t){let{translations:n,defaultLocale:r,...o}=e,a=Di(n,t);return a?{...o,title:a.title??o.title,description:a.description??o.description,content:a.content??o.content}:o}function tc(e,t){let{translations:n,defaultLocale:r,...o}=e,a=Di(n,t);return a?{...o,title:a.title??o.title,description:a.description??o.description}:o}function nc(e,t){let{translations:n,defaultLocale:r,...o}=e,a=Di(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 Ho={attach:"Attach files",file:"File",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.",errorRateLimitedIn:"Too many requests \u2014 please try again in {seconds} s.",errorOffline:"Can't reach the server. Check your connection and try again.",errorServer:"Something went wrong on our side. Please try again.",errorReconnecting:"Connection lost. Reconnecting\u2026",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",thought:"Thought",thoughtFor:"Thought for {time}",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",toolStepsFailed:"{count} failed",statusStopped:"Stopped",toolStepsStopped:"Stopped after {count} steps",toolStepsStoppedOne:"Stopped after 1 step",thoughtsShowMore:"Show more",thoughtsShowLess:"Show less"},im={attach:"Joindre des fichiers",file:"Fichier",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.",errorRateLimitedIn:"Trop de requ\xEAtes \u2014 veuillez r\xE9essayer dans {seconds} s.",errorOffline:"Impossible de joindre le serveur. V\xE9rifiez votre connexion et r\xE9essayez.",errorServer:"Un probl\xE8me est survenu de notre c\xF4t\xE9. Veuillez r\xE9essayer.",errorReconnecting:"Connexion perdue. Reconnexion\u2026",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",thought:"R\xE9flexion",thoughtFor:"R\xE9flexion : {time}",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",toolStepsFailed:"{count} en \xE9chec",statusStopped:"Arr\xEAt\xE9",toolStepsStopped:"Arr\xEAt\xE9 apr\xE8s {count} \xE9tapes",toolStepsStoppedOne:"Arr\xEAt\xE9 apr\xE8s 1 \xE9tape",thoughtsShowMore:"Afficher plus",thoughtsShowLess:"Afficher moins"},sm={attach:"\u0625\u0631\u0641\u0627\u0642 \u0645\u0644\u0641\u0627\u062A",file:"\u0645\u0644\u0641",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.",errorRateLimitedIn:"\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 {seconds} \u062B.",errorOffline:"\u062A\u0639\u0630\u0651\u0631 \u0627\u0644\u0648\u0635\u0648\u0644 \u0625\u0644\u0649 \u0627\u0644\u062E\u0627\u062F\u0645. \u062A\u062D\u0642\u0651\u0642 \u0645\u0646 \u0627\u062A\u0635\u0627\u0644\u0643 \u0648\u062D\u0627\u0648\u0644 \u0645\u0631\u0629 \u0623\u062E\u0631\u0649.",errorServer:"\u062D\u062F\u062B \u062E\u0637\u0623 \u0645\u0646 \u062C\u0647\u062A\u0646\u0627. \u064A\u0631\u062C\u0649 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629 \u0645\u0631\u0629 \u0623\u062E\u0631\u0649.",errorReconnecting:"\u0627\u0646\u0642\u0637\u0639 \u0627\u0644\u0627\u062A\u0635\u0627\u0644. \u062C\u0627\u0631\u064D \u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u0627\u062A\u0635\u0627\u0644\u2026",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",thought:"\u062A\u0641\u0643\u064A\u0631",thoughtFor:"\u0641\u0643\u0651\u0631 \u0644\u0645\u062F\u0629 {time}",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",toolStepsFailed:"\u0641\u0634\u0644 {count}",statusStopped:"\u0623\u064F\u0648\u0642\u0641",toolStepsStopped:"\u0623\u064F\u0648\u0642\u0641 \u0628\u0639\u062F {count} \u062E\u0637\u0648\u0627\u062A",toolStepsStoppedOne:"\u0623\u064F\u0648\u0642\u0641 \u0628\u0639\u062F \u062E\u0637\u0648\u0629 \u0648\u0627\u062D\u062F\u0629",thoughtsShowMore:"\u0639\u0631\u0636 \u0627\u0644\u0645\u0632\u064A\u062F",thoughtsShowLess:"\u0639\u0631\u0636 \u0623\u0642\u0644"},lm={attach:"Adjuntar archivos",file:"Archivo",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.",errorRateLimitedIn:"Demasiadas solicitudes: int\xE9ntalo de nuevo en {seconds} s.",errorOffline:"No se puede conectar con el servidor. Revisa tu conexi\xF3n e int\xE9ntalo de nuevo.",errorServer:"Algo sali\xF3 mal por nuestra parte. Int\xE9ntalo de nuevo.",errorReconnecting:"Se perdi\xF3 la conexi\xF3n. Reconectando\u2026",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",thought:"Razonamiento",thoughtFor:"Razon\xF3 durante {time}",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",toolStepsFailed:"{count} con error",statusStopped:"Detenido",toolStepsStopped:"Detenido tras {count} pasos",toolStepsStoppedOne:"Detenido tras 1 paso",thoughtsShowMore:"Mostrar m\xE1s",thoughtsShowLess:"Mostrar menos"},cm={attach:"\u05E6\u05D9\u05E8\u05D5\u05E3 \u05E7\u05D1\u05E6\u05D9\u05DD",file:"\u05E7\u05D5\u05D1\u05E5",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.",errorRateLimitedIn:"\u05D9\u05D5\u05EA\u05E8 \u05DE\u05D3\u05D9 \u05D1\u05E7\u05E9\u05D5\u05EA \u2014 \u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1 \u05D1\u05E2\u05D5\u05D3 {seconds} \u05E9\u05E0\u05F3.",errorOffline:"\u05D0\u05D9\u05DF \u05D7\u05D9\u05D1\u05D5\u05E8 \u05DC\u05E9\u05E8\u05EA. \u05D1\u05D3\u05D5\u05E7 \u05D0\u05EA \u05D4\u05D7\u05D9\u05D1\u05D5\u05E8 \u05D5\u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1.",errorServer:"\u05DE\u05E9\u05D4\u05D5 \u05D4\u05E9\u05EA\u05D1\u05E9 \u05D0\u05E6\u05DC\u05E0\u05D5. \u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1.",errorReconnecting:"\u05D4\u05D7\u05D9\u05D1\u05D5\u05E8 \u05D0\u05D1\u05D3. \u05DE\u05EA\u05D7\u05D1\u05E8 \u05DE\u05D7\u05D3\u05E9\u2026",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",thought:"\u05DE\u05D7\u05E9\u05D1\u05D4",thoughtFor:"\u05D7\u05E9\u05D1 \u05D1\u05DE\u05E9\u05DA {time}",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",toolStepsFailed:"{count} \u05E0\u05DB\u05E9\u05DC\u05D5",statusStopped:"\u05E0\u05E2\u05E6\u05E8",toolStepsStopped:"\u05E0\u05E2\u05E6\u05E8 \u05D0\u05D7\u05E8\u05D9 {count} \u05E9\u05DC\u05D1\u05D9\u05DD",toolStepsStoppedOne:"\u05E0\u05E2\u05E6\u05E8 \u05D0\u05D7\u05E8\u05D9 \u05E9\u05DC\u05D1 \u05D0\u05D7\u05D3",thoughtsShowMore:"\u05D4\u05E6\u05D2\u05EA \u05E2\u05D5\u05D3",thoughtsShowLess:"\u05D4\u05E6\u05D2\u05EA \u05E4\u05D7\u05D5\u05EA"},um={en:Ho,fr:im,ar:sm,es:lm,he:cm};function zo(e,t){let n=rc(e),r=jo(t),o=n==="en"?{}:um[n]??{},a=r?t[n]??{}:t??{},i=r?t.en??{}:{};return{...Ho,...o,...i,...a}}function rc(e){return(e.split("-")[0]??"en").toLowerCase()}var dm=new Set(["ar","he","iw","fa","ur","ps","sd","ug","yi","dv","ckb","ks","nqo","prs","syr"]);function oc(e){return dm.has(rc(e))}function xt(e,t){return e[t]??t}function jo(e){if(!e)return!1;for(let t of Object.values(e))if(t&&typeof t=="object")return!0;return!1}var N={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{}}},Vo=new Fi;var Wo={maxBytes:10485760,maxCount:10,accept:"*/*"},ac={voice:"local"},ic={list:[],byTrigger:{}},Bi={enabled:!0,sampleRate:1},Go={upload:"/pai/upload-file",transcribe:"/pai/transcribe-audio",submitForm:"/pai/submit-form"},tr={variant:"circle",size:"md",label:void 0,icon:"chat",hidden:!1},sc={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"]},Ui={enabled:!0,volume:.3,events:void 0},lc={enabled:!0,events:void 0},cc=[{label:"tabConversations",layout:"chat"}];var pm=["off","error","warn","info","debug","trace"],qi=N.cssPrefix,_m=`${qi}.debug`,fm=`__${N.global}_DEBUG__`,mm=`${qi}-debug`,pc=2,uc=null;function gm(){if(typeof window>"u")return 2;try{let e=new URLSearchParams(window.location.search).get(mm);if(e!==null){let t=dc(e);if(t>=0)return t}}catch{}try{let e=window.localStorage?.getItem(_m);if(e){let t=dc(e);if(t>=0)return t}}catch{}return Reflect.get(window,fm)?4:2}function dc(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=pm.findIndex(n=>n===e);if(t>=0)return t}return-1}pc=gm();function _c(e){let t=`[${qi}:${e}]`;function n(r,o,a){return(i,s)=>{if(!(pc<r)&&(s===void 0?console[o](t,i):console[o](t,i,s),uc))try{uc({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=>_c(`${e}:${r}`)}}var ce=_c("core");var Nn=ce.scope("context"),hm=new Set(["visitorId","conversationId","jwt","token","authorization","password"]),fc=50,Hi=1024,vm=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function zi(e){return mc(e,"userContext",!0)}function ji(e){return mc(e,"pageContext",!1)}function mc(e,t,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){Nn.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(hm.has(a)){Nn.warn(`dropped reserved ${t} key "${a}" \u2014 managed by the widget, not host-settable`);continue}if(i==null)continue;if(o>=fc){Nn.warn(`${t} truncated at ${fc} keys \u2014 dropped "${a}"`);continue}let s=bm(t,a,i);s!==void 0&&(r[a]=s,o++)}return n&&typeof r.email=="string"&&!vm.test(r.email)&&(Nn.warn("dropped malformed context field",{field:`${t}.email`,reason:"invalid format"}),delete r.email),Object.keys(r).length>0?r:void 0}function bm(e,t,n){if(typeof n=="boolean")return n;if(typeof n=="number"){if(!Number.isFinite(n)){Nn.warn(`dropped non-finite ${e}.${t}`);return}return n}if(typeof n=="string"){let r=n.trim();return r===""?void 0:r.length>Hi?(Nn.warn(`truncated ${e}.${t} to ${Hi} chars`),r.slice(0,Hi)):r}Nn.warn(`dropped ${e}.${t} \u2014 only string/number/boolean values are allowed`,{type:typeof n})}function nr(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??{},c={enabled:t.history?.enabled??!0},{themeMode:p,themeOverrides:_}=ym(t.theme),d=n.mode??"floating",u=Pm(o.defaultLocale),f=o.availableLocales??[o.locale??u],m=rr(o.locale??u,f,u),v=(t.baseUrl??N.defaultBaseUrl).replace(/\/$/,""),y=(t.agentApiBaseUrl??`${v}/api/agent`).replace(/\/$/,""),x=(t.dataApiBaseUrl??`${v}/api/data`).replace(/\/$/,"");return{widgetId:t.widgetId??"default",publicKey:t.publicKey,aiAgentDeploymentId:t.aiAgentDeploymentId,baseUrl:v,agentApiBaseUrl:y,dataApiBaseUrl:x,userContext:zi(t.userContext),pageContext:ji(t.pageContext),position:n.position??"bottom-right",themeMode:p,textSize:"normal",themeOverrides:_,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??ac.voice,fileUpload:!(t.features?.disableFileUpload??!1),humanInLoop:!(t.features?.disableHumanInLoop??!1),operatorRequest:t.features?.enableOperatorRequest===!0},forms:Or(t.forms,m),endpoints:{upload:t.endpoints?.upload??Go.upload,transcribe:t.endpoints?.transcribe??Go.transcribe,submitForm:t.endpoints?.submitForm??Go.submitForm},attachments:{accept:t.composer?.attachments?.accept??Wo.accept,maxBytes:t.composer?.attachments?.maxBytes??Wo.maxBytes,maxCount:t.composer?.attachments?.maxCount??Wo.maxCount},locale:m,defaultLocale:u,availableLocales:f,startMinimized:r.startMinimized??!0,actions:xm(d,s.actions,c.enabled),size:n.size??{},launcher:Am(t.launcher),sound:Sm(a.sound),haptics:km(a.haptics),strings:zo(m,o.strings),stringsOverride:o.strings,composerDisclaimer:i.composerDisclaimer??"",poweredBy:Cm(i.poweredBy),composer:Tm(t.composer),modules:Rm(t.modules,c.enabled),tracking:wm(t.tracking,x),history:c,storage:t.storage??Vo,userToken:t.userToken,tools:t.tools,onMessage:t.onMessage,onOpen:t.onOpen,onClose:t.onClose,onError:t.onError}}function ym(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 Pm(e){return e&&e!=="auto"?e:globalThis.navigator?.language||"en"}function rr(e,t,n){return t.length<=1||t.includes(e)?e:t.includes(n)?n:t[0]??e}function xm(e,t,n){let r=t??sc[e];return n?r:r.filter(o=>o!=="history")}function Sm(e){return{enabled:e?.enabled??Ui.enabled,volume:e?.volume??Ui.volume,events:e?.events}}function km(e){return{enabled:e?.enabled??lc.enabled,events:e?.events}}function wm(e,t){let n=e?.sampleRate??Bi.sampleRate;return{enabled:e?.enabled??Bi.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 Cm(e){let n={...{text:`Powered by ${N.displayName}`,href:N.siteUrl},...e};return!!(n.text||n.logoUrl)?n:null}function Tm(e){let t=e?.sendButton;return{sendButton:{shape:t?.shape??"circle",icon:t?.icon??"arrowUp",variant:t?.variant??"filled"}}}function Rm(e,t){let n=e??cc,r=new Set,o=[];for(let i of n.slice(0,4)){if(!i?.label||!i?.layout)continue;let s=i.contentCollectionIds?.filter(Boolean),c=i.id??s?.[0]??i.layout;for(;r.has(c);)c=`${c}-${o.length}`;r.add(c);let p={id:c,label:i.label,layout:i.layout};s?.length&&(p.contentCollectionIds=s),i.layout==="home"&&(p.brandName=i.brandName,p.greetingText=i.greetingText,p.showGreeting=!(i.hideGreeting??!1),p.showSearchBar=!(i.hideSearchBar??!1),p.showRecentConversations=t&&!(i.hideRecentConversations??!1),i.userAvatars?.length&&(p.userAvatars=i.userAvatars),i.status&&(p.status=i.status),p.contentBlockTitle=i.contentBlockTitle),o.push(p)}let a=Object.fromEntries(o.map(i=>[i.id,i]));return{list:o,byId:a}}function Or(e,t){var a;if(!e?.length)return ic;let n=[],r=new Set;for(let i of e){if(!i?.id||r.has(i.id))continue;let s=nc(i,t),c=(s.fields??[]).filter(_=>!!(_?.name&&_.label&&_.type)),p=(Array.isArray(s.on)?s.on:[s.on]).map(Im).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,blocking:s.blocking??!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 Im(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 Am(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??tr.variant,size:e?.size??tr.size,label:e?.label??tr.label,icon:e?.icon??tr.icon,hidden:e?.hidden??tr.hidden,callout:t}}function Vi(e,t,n,r){let o=rr(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=zo(o,e.stringsOverride)),n!==e.themeMode&&(a.themeMode=n),r!==e.textSize&&(a.textSize=r),a}var Em=["presentation","behavior","theme","launcher","header","composer","feedback","i18n","footer","features","tracking","endpoints","history"];function Wi(e,t){if(!t)return e;let n={...e};for(let a of Em){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]=gc(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=gc(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=Mm(s,i)),n.i18n=a}return n}function gc(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 Mm(e,t){if(!e)return t;if(!t)return e;let n=jo(e),r=jo(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 Nm=["clear","expand","fullscreen","popOut","sound","history","language","theme","textSize","close"];function tn(e){return e!=="false"}function Lm(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}var vc=[["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]],bc=[["mode","mode",e=>e],["position","position",e=>e],["iframe","iframe",tn]],yc=[["width","width"],["height","height"]],Pc=[["response-mode","responseMode",e=>e],["start-minimized","startMinimized",tn],["show-reasoning","showReasoning",tn],["show-tool-calls","showToolCalls",tn],["show-sources","showSources",tn],["disable-message-feedback","disableMessageFeedback",tn],["auto-send-suggestions","autoSendSuggestions",tn],["pop-out-url","popOutUrl"]],xc=[["locale","locale"]],Om=new Set(Nm);function $m(e){return Lm(e).filter(t=>Om.has(t))}var Sc=[["launcher-variant","variant",e=>e],["launcher-size","size",e=>e],["launcher-icon","icon"],["launcher-hidden","hidden",tn]],kc=[["features-disable-file-upload","disableFileUpload",tn],["features-voice","voice",e=>e]],wc=[["endpoint-upload","upload"],["endpoint-transcribe","transcribe"]],Cc=[["user-id","id"],["user-email","email"],["user-name","name"]],Tc=[["page-area","area"],["page-url","url"],["page-path","path"],["page-title","title"]],Dm=["launcher-label","callout-text","callout-delay","actions","user-context","page-context"],Fm=[vc,bc,yc,Pc,xc,Sc,kc,wc,Cc,Tc],Bm=new Set(["iframe","start-minimized"]),Gi=[...Fm.flatMap(e=>e.map(([t])=>t).filter(t=>!Bm.has(t))),...Dm];function Ki(e){let t={};function n(f){let m=e(f);return m===null||m===""?void 0:m}for(let[f,m,v]of vc){let y=n(f);y!==void 0&&(t[m]=v?v(y):y)}let r=Ln(n,bc),o=Ln(n,yc);(r||o)&&(t.presentation={...r,...o?{size:o}:{}});let a=Ln(n,Pc);a&&(t.behavior=a);let i=Ln(n,xc);i&&(t.i18n=i);let s=Um(e,n);s&&(t.launcher=s);let c=Ln(n,kc);c&&(t.features=c);let p=Ln(n,wc);p&&(t.endpoints=p);let _=hc(n,Cc,"user-context");_&&(t.userContext=_);let d=hc(n,Tc,"page-context");d&&(t.pageContext=d);let u=n("actions");return u!==void 0&&(t.header={actions:$m(u)}),t}function Ln(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 hc(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 Um(e,t){let n=Ln(t,Sc)??{},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 Rc=ce.scope("track"),qm=64,Hm=256,zm=10;function Ic(e,t){let n=typeof e=="string"?e.trim():"";if(!n||n.length>qm){Rc.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>Hm?(Rc.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 Ac(e){let t=[];return e.on("hostEvent",n=>{t.push({...n,at:Date.now()}),t.length>zm&&t.shift()}),t}function Ct(){let e=Date.now(),t=new Uint8Array(16);t[0]=Math.floor(e/2**40)&255,t[1]=Math.floor(e/2**32)&255,t[2]=e>>>24&255,t[3]=e>>>16&255,t[4]=e>>>8&255,t[5]=e&255,jm(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 jm(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 nn=ce.scope("persistence");function or(e,t=Vo,n){let r=n?`${e}.${n}`:e,o=`${N.cssPrefix}.storageVersion`,a=t.get(o)??void 0,i=a?`.v${a}`:"",s=`${N.cssPrefix}.${r}${i}`,c=`${N.cssPrefix}${i}.visitorId`,p=`${s}.conversationId`,_=`${s}.userPrefs`,d=`${s}.panelOpen`,u=`${s}.panelSize`,f=`${s}.calloutDismissed`,m=`${s}.sidebarCollapsed`,v=`${s}.activeModule`,y=`${s}.seenNewsId`,x=`${s}.historyCount`,S=`${s}.formsDone`,w={getVisitorId(){let h=t.get(c);if(h)return h;let g=Ct();return t.set(c,g),g},loadConversationId(){return t.get(p)??void 0},saveConversationId(h){nn.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 b=`${s}.draft.${h}`;g?t.set(b,g):t.remove(b)},loadMessageQueue(h){let g=t.get(`${s}.messageQueue.${h}`);if(!g)return[];try{let b=JSON.parse(g);return!Array.isArray(b)||!b.every(Vm)?[]:b}catch(b){return nn.warn("loadMessageQueue parse failed",{error:b}),[]}},saveMessageQueue(h,g){let b=`${s}.messageQueue.${h}`;if(g.length===0){t.remove(b);return}try{t.set(b,JSON.stringify(g))}catch(k){nn.warn("saveMessageQueue serialise failed",{error:k})}},loadUserPrefs(){let h=t.get(_);if(!h)return{};try{return Qi(JSON.parse(h))}catch(g){return nn.warn("loadUserPrefs parse failed",{error:g}),{}}},saveUserPrefs(h){try{t.set(_,JSON.stringify(h))}catch(g){nn.warn("saveUserPrefs serialise failed",{error:g})}},patchUserPrefs(h){let g=w.loadUserPrefs();w.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(y)||null},saveSeenNewsId(h){t.set(y,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(S);if(!h)return{};try{let g=JSON.parse(h);return Ko(g)?Object.fromEntries(Object.entries(g).filter(b=>typeof b[1]=="number")):{}}catch(g){return nn.warn("loadFormsDone parse failed",{error:g}),{}}},saveFormDone(h){try{let g=w.loadFormsDone();g[h]=Date.now(),t.set(S,JSON.stringify(g))}catch(g){nn.warn("saveFormDone serialise failed",{error:g})}},rememberStorageVersion(h){h&&h!==t.get(o)&&(nn.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,y,x,S])t.remove(g);nn.info("reset: forgot the visitor",{scope:r})}};return w}function Ko(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Vm(e){return Ko(e)&&typeof e.id=="string"&&e.id.length>0&&typeof e.text=="string"}function Qi(e){if(!Ko(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),Ko(e.widgetSize)&&typeof e.widgetSize.width=="number"&&typeof e.widgetSize.height=="number"&&(t.widgetSize={width:e.widgetSize.width,height:e.widgetSize.height}),t}var Qo="1.14.0";var Wm="1",Ec=60,Gm=2e3,Mc={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 Km(){let e=navigator;return e.globalPrivacyControl===!0||e.doNotTrack==="1"}function Qm(){return location.origin+location.pathname}function Xm(){try{return document.referrer?new URL(document.referrer).origin:""}catch{return""}}function Nc(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:y}=t.getOptions();if(!u.enabled||Km()||n>=u.sampleRate)return;let x=performance.now();if(x-r>6e4&&(r=x,o=0),++o>Ec)return;let S=new URLSearchParams;S.set("v",Wm),S.set("_ev",Qo),S.set("e",_),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",Qm());let h=Xm();h&&S.set("ref",h),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",v),S.set("th",y),d)for(let[E,R]of Object.entries(d))R!==void 0&&S.set(E,String(R));S.set("ts",String(Date.now()));let g=`${u.endpoint}?${S}`;if(g.length>Gm)return;let b=new Image(1,1);a.add(b);function k(){return a.delete(b)}b.addEventListener("load",k,{once:!0}),b.addEventListener("error",k,{once:!0}),b.src=g}let s=[];function c(_,d){if(s&&_!=="handshake"){s.length<Ec&&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(Mc).map(_=>e.on(_,d=>c(_,Mc[_]?.(d))));return()=>{for(let _ of p)_();a.clear()}}var Lc=`.__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 Oc=`: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;border-radius:var(--__P__-radius-md)}: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 $c=`.__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:var(--__P__-radius-md);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);flex-shrink:0}.__P__-agent-avatar img{width:100%;height:100%;border-radius:inherit;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[data-cut-end=true]{mask-image:linear-gradient(to right,#000 calc(100% - 32px),transparent)}.__P__-suggestions[data-cut-start=true]{mask-image:linear-gradient(to right,transparent,#000 32px)}.__P__-suggestions[data-cut-start=true][data-cut-end=true]{mask-image:linear-gradient(to right,transparent,#000 32px,#000 calc(100% - 32px),transparent)}:host([dir="rtl"]) .__P__-suggestions[data-cut-end=true]{mask-image:linear-gradient(to left,#000 calc(100% - 32px),transparent)}:host([dir="rtl"]) .__P__-suggestions[data-cut-start=true]{mask-image:linear-gradient(to left,transparent,#000 32px)}:host([dir="rtl"]) .__P__-suggestions[data-cut-start=true][data-cut-end=true]{mask-image:linear-gradient(to left,transparent,#000 32px,#000 calc(100% - 32px),transparent)}.__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-strip{display:flex;flex:none;justify-content:center;padding:var(--__P__-space-1) 0}.__P__-jump{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-body{display:flex;flex-wrap:wrap;align-items:flex-start;gap:var(--__P__-space-3) 6px;min-width:0}.__P__-bubble-body>*{flex:1 0 100%;min-width:0}.__P__-bubble-body>.__P__-source,.__P__-bubble-body>.__P__-typing{flex:0 1 auto}.__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,.__P__-steps){width:100%}.__P__-bubble-row[data-role=assistant] .__P__-bubble-col:has(.__P__-toolui,.__P__-steps) .__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__-file-image,.__P__-file-chip{border-radius:var(--__P__-radius-sm);color:inherit;text-decoration:none}.__P__-file-image{display:block;width:fit-content;max-width:min(100%,240px);overflow:hidden}.__P__-file-image img{max-height:240px;object-fit:cover}.__P__-file-chip{display:flex;align-items:center;gap:var(--__P__-space-2);max-width:min(100%,280px);padding:var(--__P__-space-2);border:1px solid color-mix(in srgb,currentColor 18%,transparent);background:color-mix(in srgb,currentColor 5%,transparent);transition:background var(--__P__-dur-base) var(--__P__-ease)}.__P__-file-chip:hover{background:color-mix(in srgb,currentColor 10%,transparent)}.__P__-file-image:focus-visible,.__P__-file-chip:focus-visible{outline:2px solid currentColor;outline-offset:2px}.__P__-file-chip-icon{flex:none;display:grid;place-items:center;width:32px;height:32px;border-radius:var(--__P__-radius-sm);background:color-mix(in srgb,currentColor 10%,transparent)}.__P__-file-chip-text{display:grid;min-width:0;line-height:1.35}.__P__-file-chip-name{font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.__P__-file-chip-meta{font-size:var(--__P__-text-xs);opacity:.75}.__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__-steps{min-width:0;font-size:var(--__P__-text-sm)}.__P__-steps-head,.__P__-steps-row-head,.__P__-steps-thought-more{display:inline-flex;align-items:center;gap:var(--__P__-space-2);max-width:100%;min-width:0;min-height:28px;padding:0;border:0;background:none;color:var(--__P__-fg-muted);font:inherit;text-align:start;cursor:pointer;-webkit-tap-highlight-color:transparent}.__P__-steps-head:hover,.__P__-steps-row-head:hover,.__P__-steps-thought-more:hover{color:var(--__P__-fg)}.__P__-steps-head:focus-visible,.__P__-steps-row-head:focus-visible,.__P__-steps-thought-more:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;border-radius:var(--__P__-radius-sm)}.__P__-steps-icon,.__P__-steps-row-icon{display:inline-flex;flex:none;align-items:center;justify-content:center;width:16px;height:16px}.__P__-steps-icon svg,.__P__-steps-row-icon svg{width:14px;height:14px}.__P__-steps-label,.__P__-steps-row-label{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-steps-sep{margin-inline:var(--__P__-space-1)}.__P__-steps-name .__P__-steps-count{margin-inline-start:var(--__P__-space-1)}.__P__-steps-count,.__P__-steps-failed,.__P__-steps-denied,.__P__-steps-time{flex:none;font-variant-numeric:tabular-nums}.__P__-steps-failed{color:var(--__P__-danger-text)}.__P__-steps-denied{color:var(--__P__-fg-muted)}.__P__-steps-chevron{display:inline-flex;flex:none;width:16px;height:16px;transition:transform var(--__P__-dur-quick) var(--__P__-ease)}.__P__-steps-chevron svg{width:16px;height:16px}.__P__-steps-chevron[data-open=true]{transform:rotate(180deg)}.__P__-steps-list{position:relative;display:flex;flex-direction:column;gap:var(--__P__-space-1);margin:var(--__P__-space-1) 0 0;padding:0;list-style:none}.__P__-steps-list:before{content:"";position:absolute;inset-block:0;inset-inline-start:7px;width:2px;border-radius:1px;background:var(--__P__-border)}.__P__-steps-row{position:relative;display:grid;grid-template-columns:16px minmax(0,1fr);column-gap:var(--__P__-space-2);align-items:start}.__P__-steps-row .__P__-steps-row-icon{margin-block:6px;border-radius:999px;background:var(--__P__-bubble-assistant);color:var(--__P__-fg-muted)}.__P__-steps-row[data-status=error] .__P__-steps-row-icon{color:var(--__P__-danger-text)}.__P__-steps-row-main{display:flex;flex-direction:column;align-items:flex-start;min-width:0}.__P__-steps-row-name{color:var(--__P__-fg);font-weight:500}.__P__-steps-row-summary{margin-inline-start:var(--__P__-space-2);color:var(--__P__-fg-muted)}.__P__-steps-row-body{display:flex;flex-direction:column;gap:var(--__P__-space-2);width:100%;margin:var(--__P__-space-1) 0 var(--__P__-space-2)}.__P__-steps-body{display:grid;grid-template-rows:0fr;transition:grid-template-rows .2s ease-out}.__P__-steps-body[data-open=true]{grid-template-rows:1fr}.__P__-steps-body-inner{min-height:0;overflow:hidden}.__P__-steps-live{min-width:0;overflow:hidden;text-overflow:ellipsis;background:linear-gradient(90deg,var(--__P__-fg-muted) 0%,var(--__P__-fg) 50%,var(--__P__-fg-muted) 100%) 0 0 / 200% 100%;background-clip:text;-webkit-background-clip:text;color:transparent;animation:__P__-steps-shimmer 2s linear infinite}@keyframes __P__-steps-shimmer{to{background-position:-200% 0}}@media(prefers-reduced-motion:reduce){.__P__-steps-body,.__P__-steps-chevron{transition:none}.__P__-steps-live{background:none;color:var(--__P__-fg-muted);animation:none}}.__P__-steps-thought-label,.__P__-steps-stopped-label{display:inline-flex;align-items:center;min-height:28px;color:var(--__P__-fg-muted)}.__P__-steps-thought-text{width:100%;color:var(--__P__-fg-muted)}.__P__-steps-thought-text[data-clamped=true]{max-height:calc(3 * 1.6em);overflow:hidden;mask-image:linear-gradient(to bottom,#000 60%,transparent)}.__P__-steps-thought-more{min-height:24px;font-size:var(--__P__-text-xs)}.__P__-reasoning-body{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%;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{display:flex;align-items:center;gap:var(--__P__-space-2);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)}.__P__-error-icon{display:inline-flex;flex:none;width:16px;height:16px;color:var(--__P__-danger-text)}.__P__-error-icon svg{width:16px;height:16px}.__P__-error-text{min-width:0}.__P__-error-retry{flex:none;margin-inline-start:auto;min-height:28px;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__-error-retry:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;border-radius:var(--__P__-radius-sm)}.__P__-history{flex:1;overflow-y:auto;padding:var(--__P__-space-2) var(--__P__-space-1) var(--__P__-space-3)}.__P__-history-footer{flex:none;padding:var(--__P__-space-2) var(--__P__-space-3) var(--__P__-space-3);border-top:1px solid var(--__P__-border);background:var(--__P__-surface)}.__P__-history-new{width:100%;display:flex;align-items:center;justify-content:center;gap:var(--__P__-space-2);padding:var(--__P__-space-2) var(--__P__-space-3);border:none;border-radius:var(--__P__-radius-md);background:var(--__P__-accent);color:var(--__P__-on-accent);cursor:pointer;font-size:var(--__P__-text-sm);font-weight:600;transition:filter var(--__P__-dur-quick) var(--__P__-ease-out),transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-history-new svg{width:16px;height:16px}.__P__-history-new:hover{filter:brightness(1.08)}.__P__-history-new:active{transform:translateY(1px)}.__P__-history-new:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-history-empty{flex:1;display:flex;align-items:center;justify-content:center;padding:40px 16px;color:var(--__P__-fg-muted);font-size:calc(14px * var(--__P__-text-scale));text-align:center}.__P__-history-group{display:flex;flex-direction:column;padding:0 var(--__P__-space-3)}.__P__-history-heading{font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted);padding:14px 4px 8px;text-transform:uppercase;letter-spacing:.04em}.__P__-history-card{display:flex;flex-direction:column;background:var(--__P__-surface);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-lg, 14px);overflow:hidden}.__P__-history-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:var(--__P__-radius-md);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:var(--__P__-radius-md)}.__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:var(--__P__-radius-md);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:var(--__P__-radius-md);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{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)}.__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__-toolui-status[data-status=stopped]{--__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-fields{display:grid;grid-template-columns:auto minmax(0,1fr);gap:2px var(--__P__-space-2);margin:0;font-size:var(--__P__-text-xs);line-height:1.5}.__P__-toolui-fields>div{display:contents}.__P__-toolui-fields dt{color:var(--__P__-fg-muted)}.__P__-toolui-fields dd{margin:0;min-width:0;overflow:hidden;color:var(--__P__-fg);font-family:var(--__P__-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);text-overflow:ellipsis;white-space:nowrap}.__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 Dc=`*,*: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 Fc=`: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 ng="helpai",rg="#5B5BD6",og="#FFFFFF",ag="12px",ig="Inter, system-ui, -apple-system, 'Segoe UI', sans-serif",Ji=[Fc,Dc,$c,Lc,Oc].join(`
7
+ `).replace(/__P__/g,ng).replaceAll("__BRAND_ACCENT_TEXT__",og).replaceAll("__BRAND_ACCENT__",rg).replaceAll("__BRAND_RADIUS__",ag).replaceAll("__BRAND_FONT__",ig);var Uc=["data-theme","data-color-scheme","data-mode","data-bs-theme"];function Bc(e){if(e){if(e.classList.contains("dark"))return"dark";if(e.classList.contains("light"))return"light";for(let t of Uc){let n=e.getAttribute(t);if(n==="dark"||n==="light")return n}}}function ar(e=document){let t=Bc(e.documentElement)??Bc(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 qc(e,t=document){let n=ar(t);e(n);function r(){let s=ar(t);s!==n&&(n=s,e(s))}let o=new MutationObserver(r),a={attributes:!0,attributeFilter:["class","style",...Uc]};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 sg=ce.scope("mount"),Hc=new WeakMap,zc={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 jc(e,t){e.style.cssText=zc[t]}function Xo(e){return e==="floating"||e==="modal"||e==="drawer"?"floating":e==="standalone"||e==="page"?"viewport":"flow"}function Vc(e={}){let t=e.position??"flow";sg.debug("createShadowMount",{position:t,hasTarget:!!e.target,hasHost:!!e.existingHost});let n=`${N.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",N.id),r.style.cssText=zc[t];let o=r.shadowRoot??r.attachShadow({mode:"open"});for(let s of["keydown","keypress","keyup"])o.addEventListener(s,lg);let a=r.ownerDocument;if(!cg(o,a)){let s=a.createElement("style");s.textContent=Ji,o.appendChild(s)}let i=document.createElement("div");return i.className=`${N.cssPrefix}-app`,o.appendChild(i),{appRoot:i,destroy:()=>r.remove(),hostElement:r,shadowRoot:o}}function lg(e){if(e instanceof KeyboardEvent&&(e.metaKey||e.ctrlKey))return;let t=e.composedPath()[0];t instanceof HTMLElement&&(t.isContentEditable||t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT")&&e.stopPropagation()}function cg(e,t){if(!("adoptedStyleSheets"in e))return!1;let n=t.defaultView;if(!n||typeof n.CSSStyleSheet!="function")return!1;let r=Hc.get(t);if(!r)try{r=new n.CSSStyleSheet,r.replaceSync(Ji),Hc.set(t,r)}catch{return!1}try{return e.adoptedStyleSheets=[r],!0}catch{return!1}}function ug(e,t){let n=N.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 dg(e,t){e.dataset.theme=t==="host"?ar():t}function pg(e,t){let n=N.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 _g(e,t){e.dataset.position=t}function Jo(e,t){e.dataset.mode=t}function Wc(e,t){dg(e,t.themeMode),ug(e,t.themeOverrides),_g(e,t.position),pg(e,t.size)}var ir,at,Yi,Gc,Zi=Object.is,Dr=0,nu=[],es=[],Ze=me,Kc=Ze.__b,Qc=Ze.__r,Xc=Ze.diffed,Jc=Ze.__c,Yc=Ze.unmount,Zc=Ze.__;function Yo(e,t){Ze.__h&&Ze.__h(at,e,Dr||t),Dr=0;var n=at.__H||(at.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function U(e){return Dr=1,ru(ou,e)}function ru(e,t,n){var r=Yo(ir++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):ou(void 0,t),function(a){var i=r.__N?r.__N[0]:r.__[0],s=r.t(i,a);Zi(i,s)||(r.__N=[s,r.__[1]],r.__c.setState({}))}],r.__c=at,!at.__f)){at.__f=!0;var o=at.shouldComponentUpdate;at.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,Zi(u.__[0],u.__N[0])||(_=!0))}),o){var d=o.call(this,a,i,s);return p?d||_:d}return!p||_}}return r.__}function $(e,t){var n=Yo(ir++,3);!Ze.__s&&ns(n.__H,t)&&(n.__P=!0,n.__=e,n.u=t,at.__H.__h.push(n))}function Tt(e,t){var n=Yo(ir++,4);!Ze.__s&&ns(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,at.__h.push(n))}function D(e){return Dr=5,se(function(){return{current:e}},[])}function se(e,t){var n=Yo(ir++,7);return ns(n.__H,t)&&(n.__=e(),n.__H=t),n.__}function F(e,t){return Dr=8,se(function(){return e},t)}function fg(){var e;do{for(;e=es.shift();)try{$r(e)}catch(n){Ze.__e(n,{__:(e=e.__P)&&e.__v})}for(;e=nu.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some($r),t.__h.some(ts),t.__h=[]}catch(n){t.__h=[],Ze.__e(n,e.__v)}}}while(es.length)}Ze.__b=function(e){at=null,Kc&&Kc(e)},Ze.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Zc&&Zc(e,t)},Ze.__r=function(e){Qc&&Qc(e),ir=0;var t=(at=e.__c).__H;t&&(Yi==at?at.__h=[]:(t.__h.some($r),t.__h.some(ts),ir=0),t.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})),Yi=at},Ze.diffed=function(e){Xc&&Xc(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&tu(nu.push(t)),t.__H.__.some(function(n){n.u&&(n.__H=n.u)})),Yi=at=null},Ze.__c=function(e,t){t.some(function(n){try{n.__h.some($r),n.__h=n.__h.filter(function(r){return!r.__||ts(r)})}catch(r){n.__h=[function(){throw r}]}}),Jc&&Jc(e,t)},Ze.unmount=function(e){Yc&&Yc(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,tu(es.push(o))}else $r(o)}catch(a){t=a}}),r.__H=void 0,t&&Ze.__e(t,r.__v))};var eu=typeof requestAnimationFrame=="function";function mg(e){var t,n=function(){clearTimeout(r),eu&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);eu&&(t=requestAnimationFrame(n))}function tu(e){e!=1&&Gc==Ze.requestAnimationFrame||((Gc=Ze.requestAnimationFrame)||mg)(fg)}function $r(e){var t=at,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),at=t}function ts(e){var t=at;e.__c=e.__(),at=t}function ns(e,t){return!e||e.length!=t.length||t.some(function(n,r){return!Zi(n,e[r])})}function ou(e,t){return typeof t=="function"?t(e):t}var gg=Symbol.for("preact-signals");function na(){if(rn>1)rn--;else{var e,t=!1;for((function(){var o=ea;for(ea=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}})();Br!==void 0;){var n=Br;for(Br=void 0,Zo++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&iu(n))try{n.c()}catch(o){t||(e=o,t=!0)}n=r}}if(Zo=0,rn--,t)throw e}}function Ut(e){if(rn>0)return e();rs=++hg,rn++;try{return e()}finally{na()}}var Fr,je=void 0;function Ur(e){var t=je,n=Fr;je=void 0,Fr=void 0;try{return e()}finally{je=t,Fr=n}}var Br=void 0,rn=0,Zo=0,hg=0,rs=0,ea=void 0,ta=0;function au(e){if(je!==void 0){var t=e.n;if(t===void 0||t.t!==je)return t={i:0,S:e,p:je.s,n:void 0,t:je,e:void 0,x:void 0,r:t},je.s!==void 0&&(je.s.n=t),je.s=t,e.n=t,32&je.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=je.s,t.n=void 0,je.s.n=t,je.s=t),t}}function ut(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}ut.prototype.brand=gg;ut.prototype.h=function(){return!0};ut.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:Ur(function(){var r;(r=t.W)==null||r.call(t)}))};ut.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&&Ur(function(){var o;(o=t.Z)==null||o.call(t)}))}};ut.prototype.subscribe=function(e){var t=this;return jt(function(){var n=t.value;Ur(function(){return e(n)})},{name:"sub"})};ut.prototype.valueOf=function(){return this.value};ut.prototype.toString=function(){return this.value+""};ut.prototype.toJSON=function(){return this.value};ut.prototype.peek=function(){var e=this;return Ur(function(){return e.value})};Object.defineProperty(ut.prototype,"value",{get:function(){var e=au(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Zo>100)throw new Error("Cycle detected");(function(n){rn!==0&&Zo===0&&n.l!==rs&&(n.l=rs,ea={S:n,v:n.v,i:n.i,o:ea})})(this),this.v=e,this.i++,ta++,rn++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{na()}}}});function ie(e,t){return new ut(e,t)}function iu(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 su(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 lu(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 On(e,t){ut.call(this,void 0,t),this.x=e,this.s=void 0,this.g=ta-1,this.f=4}On.prototype=new ut;On.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===ta))return!0;if(this.g=ta,this.f|=1,this.i>0&&!iu(this))return this.f&=-2,!0;var e=je;try{su(this),je=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 je=e,lu(this),this.f&=-2,!0};On.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)}ut.prototype.S.call(this,e)};On.prototype.U=function(e){if(this.t!==void 0&&(ut.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)}};On.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(On.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=au(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 On(e,t)}function cu(e){var t=e.j;if(e.j=void 0,typeof t=="function"){rn++;var n=je;je=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,os(e),r}finally{je=n,na()}}}function os(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,cu(e)}function vg(e){if(je!==this)throw new Error("Out-of-order effect");lu(this),je=e,this.f&=-2;try{8&this.f&&os(this)}finally{na()}}function sr(e,t){this.x=e,this.j=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,Fr&&Fr.push(this)}sr.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.j=t)}finally{e()}};sr.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,cu(this),su(this),rn++;var e=je;return je=this,vg.bind(this,e)};sr.prototype.N=function(){2&this.f||(this.f|=2,this.u=Br,Br=this)};sr.prototype.d=function(){this.f|=8,1&this.f||os(this)};sr.prototype.dispose=function(){this.d()};function jt(e,t){var n=new sr(e,t);try{n.c()}catch(o){throw n.d(),o}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var uu,Hr,ra,bg=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var du=[];jt(function(){uu=this.N})();function lr(e,t){me[e]=t.bind(null,me[e]||function(){})}function qr(e){if(ra){var t=ra;ra=void 0,t()}ra=e&&e.S()}function pu(e){var t=this,n=e.data,r=Rt(n);r.name="ReactiveDom",r.value=n;var o=se(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||""}),_=he(function(){return!Array.isArray(p.value)&&!Ei(p.value)}),d=jt(function(){if(this.N=_u,_.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}pu.displayName="ReactiveTextNode";Object.defineProperties(ut.prototype,{constructor:{configurable:!0,value:hn(ue,null).constructor},type:{configurable:!0,value:pu},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});lr("__b",function(e,t){if(qr(),Hr=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 ut&&(n||(t.__np=n={}),n[o]=a,r[o]=a.peek())}}e(t)});lr("__r",function(e,t){if(e(t),t.type!==ue){qr();var n,r=t.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=(function(o,a){var i;return jt(function(){i=this},{name:a}),i.c=o,i})((function(o){return function(){var a;bg&&((a=this.y)==null||a.call(this)),o.__$f|=1,o.setState({})}})(r),typeof t.type=="function"?t.type.displayName||t.type.name:""))),Hr=r,qr(n)}});lr("__e",function(e,t,n,r){qr(),Hr=void 0,e(t,n,r)});lr("diffed",function(e,t){qr(),Hr=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=yg(n,c,_,o),a[c]=p):p.o(_,o)}}}e(t)});function yg(e,t,n,r){var o=t in e&&e.ownerSVGElement===void 0,a=ie(n);return{o:function(i,s){a.value=i,r=s},d:jt(function(){this.N=_u;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))})}}lr("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)});lr("__h",function(e,t,n,r){r<3&&(t.__$f|=2),e(t,n,r)});Bt.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 Rt(e,t){return se(function(){return ie(e,t)},[])}function It(e,t){var n=D(e);return n.current=e,Hr.__$f|=4,se(function(){return he(function(){return n.current()},t)},[])}var Pg=function(e){queueMicrotask(function(){queueMicrotask(e)})};function xg(){Ut(function(){for(var e;e=du.shift();)uu.call(e)})}function _u(){du.push(this)===1&&(me.requestAnimationFrame||Pg)(xg)}var Sg="x-public-key",kg="x-ai-agent-deployment-id";function fu(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");return{headers(){let t={[kg]:e.aiAgentDeploymentId};return e.publicKey&&(t[e.publicKeyHeader??Sg]=e.publicKey),t}}}var wg=new Set(["home","chats","help","news"]);function mu(e){return typeof e!="object"||e===null||!("to"in e)||typeof e.to!="string"||!wg.has(e.to)?!1:!("id"in e)||e.id===void 0||typeof e.id=="string"}function oa(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 zr(e,t){return{text:e,send:typeof t=="object"&&t!==null&&"send"in t&&t.send===!0}}function gu(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 hu(e){return`${N.cssPrefix}:${e}`}function $t(e,t,n){e.dispatchEvent(new CustomEvent(hu(t),{detail:n}))}function vu(e,t){let r=Object.entries(t).map(([o,a])=>{let i=hu(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 aa(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 bu(e){let t=new URL(e),n=N.cssPrefix,r=`${N.cssPrefix}-ask`,o=t.search.slice(1).split("&").filter(Boolean),a=t.hash.slice(1).split("&").filter(Boolean),i=aa(o,n),s=aa(i.rest,r),c=aa(a,n),p=aa(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:oa(_),...d?{ask:d}:{},url:t.toString()}}var jr={open:!1,ready:!1,unread:0},ia=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 yu=ce.scope("feedback:audio"),sa=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){yu.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=>(yu.warn("audio fetch/decode failed",{url:t,err:a}),this.buffers.delete(t),null));return this.buffers.set(t,o),o}};var Pu={messageReceived:10,messageSent:0,error:[20,40,20],voiceStart:10,voiceStop:0},xu={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 bn=null,la=0;function Cg(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}function Tg(){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=`__${N.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 Su(e){if(!(e===0||Array.isArray(e)&&e.every(t=>t===0))){if(Cg())try{navigator.vibrate(e);return}catch{}if(bn??(bn=Tg()),!!bn)try{bn.label.click()}catch{}}}function ku(){la++;let e=!1;return()=>{e||(e=!0,la=Math.max(0,la-1),la===0&&bn&&(bn.input.remove(),bn.label.remove(),bn=null))}}var Rg=ce.scope("feedback"),Ig=100,ca=class{constructor(t,n){ee(this,"mutedSig",ie(!1));ee(this,"audio",new sa);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=ku(),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<Ig}playSound(t){let n=this.sound.events?.[t];if(n===!1)return;if(typeof n=="string"){this.audio.playUrl(n).catch(o=>Rg.warn("audio play failed",{err:o,url:n}));return}let r=xu[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?Pu[t]:n;Su(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 wu(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Cu(e){return wu(e)}function Tu(e){return!(!wu(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}var Ag=Symbol.for("pv"),Eg=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:Ag,__v:--Eg,__i:-1,__u:0};return(o||a)&&(p.__source=o,p.__self=a),me.vnode&&me.vnode(p),p}var ss=1,Iu=2,Vr=4,Au=8,Eu=16;function Mg(e){switch(e){case ss:return"href";case Iu:return"src";case Vr:return"class";case Au:return"checked";case Eu:return"start"}}var Ng=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}},Lg=Ng;var Ru=24;function cr(e){let t=new Uint32Array(Ru);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(Ru),indent:"",indent_len:0,table_state:0}}function Wr(e){e.pending.length>0&&et(e,`
8
+ `)}function Ce(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 Ee(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 Og(e,t,n){for(;n<=e.len;){if(e.tokens[n]===t)return n;n+=1}return-1}function $n(e,t){for(e.fence_start=0;e.len>t;)Qe(e)}function ua(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 as(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?($n(e,e.blockquote_idx),Ee(e,t),!0):($n(e,n),!1):($n(e,r),Ee(e,t),!0)}function is(e,t){Ee(e,25),e.spaces[e.len]=e.indent_len+t,on(e),e.token=103}function on(e){e.indent="",e.indent_len=0,e.pending=""}function ls(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 $g(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 Dg(e){return ls(e)||$g(e)}function et(e,t){for(let n of t){if(e.token===101){switch(n){case" ":e.indent_len+=1;continue;case" ":e.indent_len+=4;continue}let o=ua(e,e.indent_len);e.indent_len=0,e.token=e.tokens[e.len],o>0&&et(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),on(e),e.pending=n;continue}$n(e,e.blockquote_idx),on(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" ":ua(e,e.indent_len),Ee(e,Lg(e.pending.length)),on(e);continue}break;case">":{let a=Og(e,20,e.blockquote_idx+1);a===-1?($n(e,e.blockquote_idx),e.blockquote_idx+=1,e.fence_start=0,Ee(e,20)):e.blockquote_idx=a,on(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;ua(e,e.indent_len),e.renderer.add_token(e.renderer.data,22),e.renderer.end_token(e.renderer.data),on(e),e.hr_chars=0;continue}e.hr_chars=0}if(e.pending[0]!=="_"&&e.pending[1]===" "){as(e,23),is(e,2),et(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):(Ee(e,2),on(e),e.fence_start=0,et(e,r));continue;case`
11
+ `:{ua(e,e.indent_len),Ee(e,10),e.pending.length>e.fence_start&&e.renderer.set_attr(e.renderer.data,Vr,e.pending.slice(e.fence_start)),on(e),e.token=101;continue}default:e.pending=r;continue}case"+":if(n!==" ")break;as(e,23),is(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;as(e,24)&&e.pending!=="1."&&e.renderer.set_attr(e.renderer.data,Eu,e.pending.slice(0,-1)),is(e,e.pending.length+1);continue}else{let a=n.charCodeAt(0);if(a===46||ls(a)){e.pending=r;continue}}break;case"|":$n(e,e.blockquote_idx),Ee(e,27),Ee(e,28),e.pending="",et(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,Ee(e,9)}else Ee(e,2);on(e),et(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"|":Ee(e,28),e.pending="",et(e,n);continue;case`
13
+ `:Qe(e),e.pending="",e.table_state=0,et(e,n);continue}break;case 28:switch(e.pending){case"":break;case"|":Ee(e,29),Qe(e),e.pending="",et(e,n);continue;case`
14
+ `:Qe(e),e.table_state=Math.min(e.table_state+1,2),e.pending="",et(e,n);continue;default:Ee(e,29),et(e,n);continue}break;case 29:if(e.pending==="|"){Ce(e),Qe(e),e.pending="",et(e,n);continue}break;case 9:switch(r){case`
15
15
  `:case`
16
16
  `:case`
17
17
  `:case`
@@ -21,44 +21,45 @@ var qf=Object.defineProperty;var Hf=(e,t,n)=>t in e?qf(e,t,{enumerable:!0,config
21
21
  `:case`
22
22
  `:case`
23
23
  `:case`
24
- `:e.pending=r;continue;default:e.pending.length!==0?(ke(e),ze(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),ze(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),ze(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,ku,""),e.renderer.end_token(e.renderer.data),e.pending=" ";continue}e.token=e.tokens[e.len],e.pending="",Xe(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){ze(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),ze(e),e.pending=n);continue;case a+a:let s=e.token;ke(e),ze(e),ze(e),a!==n?(Ce(e,s),e.pending=n):e.pending="";continue}break}case 16:if(r==="~~"){ke(e),ze(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="",Xe(e,n));continue;case 30:if(r==="\\]"||r==="$$"){ke(e),ze(e),e.pending="";continue}break;case 31:if(r==="\\)"||e.pending[0]==="$"){ke(e),ze(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],Xe(e,n));continue;case 17:case 19:if(e.pending==="]"){ke(e),n==="("?e.pending=r:(ze(e),e.pending=n);continue}if(e.pending[0]==="]"&&e.pending[1]==="("){if(n===")"){let a=e.token===17?rs:Su,i=e.pending.slice(2);e.renderer.set_attr(e.renderer.data,a,i),ze(e),e.pending=""}else e.pending+=n;continue}break;case 18:n===" "||n===`
29
- `||n==="\\"?(e.renderer.set_attr(e.renderer.data,rs,e.pending),ke(e),ze(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),Xe(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+=os(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),Nn(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===`
24
+ `:e.pending=r;continue;default:e.pending.length!==0?(Ce(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){Ce(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]===" ")?(Ce(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,Ce(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,Au,""),e.renderer.end_token(e.renderer.data),e.pending=" ";continue}e.token=e.tokens[e.len],e.pending="",et(e,r);continue;case 14:case 15:{let a="*",i=12;if(e.token===15&&(a="_",i=13),a===e.pending){if(Ce(e),a===n){Qe(e),e.pending="";continue}Ee(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:(Ce(e),Ee(e,i),e.pending=""):(Ce(e),Qe(e),e.pending=n);continue;case a+a:let s=e.token;Ce(e),Qe(e),Qe(e),a!==n?(Ee(e,s),e.pending=n):e.pending="";continue}break}case 16:if(r==="~~"){Ce(e),Qe(e),e.pending="";continue}break;case 105:n===`
28
+ `?(Ce(e),Ee(e,30),e.pending=""):(e.token=e.tokens[e.len],e.pending[0]==="\\"?e.text+="[":e.text+="$$",e.pending="",et(e,n));continue;case 30:if(r==="\\]"||r==="$$"){Ce(e),Qe(e),e.pending="";continue}break;case 31:if(r==="\\)"||e.pending[0]==="$"){Ce(e),Qe(e),n===")"?e.pending="":e.pending=n;continue}break;case 102:r==="http://"||r==="https://"?(Ce(e),Ee(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],et(e,n));continue;case 17:case 19:if(e.pending==="]"){Ce(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?ss:Iu,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,ss,e.pending),Ce(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===">"){Ce(e),e.token=e.tokens[e.len],e.renderer.add_token(e.renderer.data,21),e.renderer.end_token(e.renderer.data),e.pending="";continue}}e.token=e.tokens[e.len],e.text+="<",e.pending=e.pending.slice(1),et(e,n);continue}switch(e.pending[0]){case"\\":if(e.token===19||e.token===30||e.token===31)break;switch(n){case"(":Ce(e),Ee(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+=ls(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:Ce(e),$n(e,e.blockquote_idx),e.blockquote_idx=0,e.pending=n;continue;default:Ce(e),e.pending=n,e.token=21,e.blockquote_idx=0;continue}break;case"<":if(e.token!==19&&e.token!==30&&e.token!==31){Ce(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,Ce(e),Ee(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
- `){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(Tg(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 Gr(e){return{add_token:Rg,end_token:as,add_text:is,set_attr:ss,data:{nodes:[e,,,,,],index:0}}}function Rg(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 as(e){e.index-=1}function is(e,t){e.nodes[e.index].appendChild(document.createTextNode(t))}function ss(e,t,n){e.nodes[e.index].setAttribute(xg(t),n)}var sr={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 Tu=Kr;var Ig={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"]},Eg={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 rt(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=rt.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 rt.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:_}}],!1;if(e.typeName!==void 0){let d=s;if(e.typeName!=="Text")return rt.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 rt.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 rt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:m}}],!1;{let v=s;for(let x in d)if(x!=="text"){return rt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:x}}],!1;break}if(v===s&&d.text!==void 0&&typeof d.text!="string")return rt.errors=[{instancePath:t+"/props/text",schemaPath:"#/properties/props/properties/text/type",keyword:"type",params:{type:"string"}}],!1}}else return rt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=u===s}else var p=!0}}else return rt.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return rt.errors=i,s===0}rt.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};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 u=s;if(e.typeName!=="Card")return Je.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 Je.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 Je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:v}}],!1;{let x=s;for(let P in u)if(!(P==="title"||P==="body")){return Je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:P}}],!1;break}if(x===s){if(u.title!==void 0){let P=s;if(typeof u.title!="string")return Je.errors=[{instancePath:t+"/props/title",schemaPath:"#/properties/props/properties/title/type",keyword:"type",params:{type:"string"}}],!1;var _=P===s}else var _=!0;if(_)if(u.body!==void 0){let P=s;if(typeof u.body!="string")return Je.errors=[{instancePath:t+"/props/body",schemaPath:"#/properties/props/properties/body/type",keyword:"type",params:{type:"string"}}],!1;var _=P===s}else var _=!0}}}else return Je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=f===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 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 u=s;if(e.typeName!=="Metric")return je.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 je.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 je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:v}}],!1;{let x=s;for(let P in u)if(!(P==="label"||P==="value"||P==="detail")){return je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:P}}],!1;break}if(x===s){if(u.label!==void 0){let P=s;if(typeof u.label!="string")return je.errors=[{instancePath:t+"/props/label",schemaPath:"#/properties/props/properties/label/type",keyword:"type",params:{type:"string"}}],!1;var _=P===s}else var _=!0;if(_){if(u.value!==void 0){let P=s;if(typeof u.value!="string")return je.errors=[{instancePath:t+"/props/value",schemaPath:"#/properties/props/properties/value/type",keyword:"type",params:{type:"string"}}],!1;var _=P===s}else var _=!0;if(_)if(u.detail!==void 0){let P=s;if(typeof u.detail!="string")return je.errors=[{instancePath:t+"/props/detail",schemaPath:"#/properties/props/properties/detail/type",keyword:"type",params:{type:"string"}}],!1;var _=P===s}else var _=!0}}}}else return je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=f===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 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,x=s;if(s===x)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 E=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=E===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 E=h[C],A=s;if(s===A)if(Array.isArray(E)){var f=!0;let O=E.length;for(let z=0;z<O;z++){let V=s;if(typeof E[z]!="string")return Me.errors=[{instancePath:t+"/props/rows/"+C+"/"+z,schemaPath:"#/properties/props/properties/rows/items/items/type",keyword:"type",params:{type:"string"}}],!1;var f=V===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=A===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=x===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 Ag={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 P;if(m.title===void 0&&(P="title")||m.type===void 0&&(P="type")||m.data===void 0&&(P="data"))return Ie.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:P}}],!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:Ag.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],E=s;if(s===E)if(C&&typeof C=="object"&&!Array.isArray(C)){let L;if(C.label===void 0&&(L="label")||C.value===void 0&&(L="value"))return Ie.errors=[{instancePath:t+"/props/data/"+w,schemaPath:"#/properties/props/properties/data/items/required",keyword:"required",params:{missingProperty:L}}],!1;{let O=s;for(let z in C)if(!(z==="label"||z==="value")){return Ie.errors=[{instancePath:t+"/props/data/"+w,schemaPath:"#/properties/props/properties/data/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:z}}],!1;break}if(O===s){if(C.label!==void 0){let z=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=z===s}else var u=!0;if(u)if(C.value!==void 0){let z=C.value,V=s;if(!(typeof z=="number"&&isFinite(z)))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=V===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=E===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 nt(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=nt.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 nt.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:m}}],!1;if(e.typeName!==void 0){let v=s;if(e.typeName!=="Cell")return nt.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 nt.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,x=s;if(s===x)if(v&&typeof v=="object"&&!Array.isArray(v)){let k;if(v.children===void 0&&(k="children"))return nt.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 nt.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],E=s,A=s,L=!1,O=s;rt(C,{instancePath:t+"/props/children/"+w,parentData:h,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?rt.errors:i.concat(rt.errors),s=i.length);var u=O===s;if(L=L||u,u){var d={};d.typeName=!0,d.statementId=!0,d.props=!0}let z=s;Je(C,{instancePath:t+"/props/children/"+w,parentData:h,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?Je.errors:i.concat(Je.errors),s=i.length);var u=z===s;L=L||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0);let V=s;je(C,{instancePath:t+"/props/children/"+w,parentData:h,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?je.errors:i.concat(je.errors),s=i.length);var u=V===s;L=L||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0);let K=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=K===s;L=L||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0);let te=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=te===s;if(L=L||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0),L)s=A,i!==null&&(A?i.length=A:i=null);else{let Y={instancePath:t+"/props/children/"+w,schemaPath:"#/properties/props/properties/children/items/anyOf",keyword:"anyOf",params:{}};return i===null?i=[Y]:i.push(Y),s++,nt.errors=i,!1}var _=E===s;if(!_)break}}else return nt.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 nt.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 nt.errors=[{instancePath:t+"/props/span",schemaPath:"#/properties/props/properties/span/enum",keyword:"enum",params:{allowedValues:Eg.properties.props.properties.span.enum}}],!1;var f=g===s}else var f=!0}}}else return nt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=x===s}else var p=!0}}else return nt.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return nt.errors=i,s===0}nt.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function mt(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=mt.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 mt.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:m}}],!1;if(e.typeName!==void 0){let v=s;if(e.typeName!=="Grid")return mt.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 mt.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,x=s;if(s===x)if(v&&typeof v=="object"&&!Array.isArray(v)){let k;if(v.columns===void 0&&(k="columns")||v.children===void 0&&(k="children"))return mt.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 mt.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 mt.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 mt.errors=[{instancePath:t+"/props/columns",schemaPath:"#/properties/props/properties/columns/enum",keyword:"enum",params:{allowedValues:Ig.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 E=h[C],A=s,L=s,O=!1,z=s;nt(E,{instancePath:t+"/props/children/"+C,parentData:h,parentDataProperty:C,rootData:o,dynamicAnchors:a})||(i=i===null?nt.errors:i.concat(nt.errors),s=i.length);var f=z===s;if(O=O||f,f){var u={};u.typeName=!0,u.statementId=!0,u.props=!0}let V=s;rt(E,{instancePath:t+"/props/children/"+C,parentData:h,parentDataProperty:C,rootData:o,dynamicAnchors:a})||(i=i===null?rt.errors:i.concat(rt.errors),s=i.length);var f=V===s;O=O||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let K=s;Je(E,{instancePath:t+"/props/children/"+C,parentData:h,parentDataProperty:C,rootData:o,dynamicAnchors:a})||(i=i===null?Je.errors:i.concat(Je.errors),s=i.length);var f=K===s;O=O||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let te=s;je(E,{instancePath:t+"/props/children/"+C,parentData:h,parentDataProperty:C,rootData:o,dynamicAnchors:a})||(i=i===null?je.errors:i.concat(je.errors),s=i.length);var f=te===s;O=O||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let G=s;Me(E,{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=G===s;O=O||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let Y=s;Ie(E,{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=Y===s;if(O=O||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0),O)s=L,i!==null&&(L?i.length=L:i=null);else{let _e={instancePath:t+"/props/children/"+C,schemaPath:"#/properties/props/properties/children/items/anyOf",keyword:"anyOf",params:{}};return i===null?i=[_e]:i.push(_e),s++,mt.errors=i,!1}var d=A===s;if(!d)break}}else return mt.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 mt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=x===s}else var p=!0}}else return mt.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return mt.errors=i,s===0}mt.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function Kr(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=Kr.evaluated;c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0);let p=s,_=!1,d=s;mt(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?mt.errors:i.concat(mt.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;nt(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?nt.errors:i.concat(nt.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;rt(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?rt.errors:i.concat(rt.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;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 T=v===s;_=_||T,T&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let x=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 T=x===s;_=_||T,T&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let P=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=P===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++,Kr.errors=i,!1}return Kr.errors=i,c.props=u,s===0}Kr.evaluated={dynamicProps:!0,dynamicItems:!1};function Ru(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 Mg=new Set(["Comp","Ref","StateRef","RuntimeRef","BinOp","UnaryOp","Ternary","Member","Index","Assign","Str","Num","Bool","Null","Arr","Obj","Ph"]);function Ln(e){return!e||typeof e!="object"||Array.isArray(e)?!1:Mg.has(e.k)}function Qr(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 la(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(la)}:typeof e=="object"?{k:"Obj",entries:Object.entries(e).map(([t,n])=>[t,la(n)])}:{k:"Null"}}function ca(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=ca(n);if(!r)return;t.push(r.v)}return{v:t}}case"Obj":{let t={};for(let[n,r]of e.entries){let o=ca(r);if(!o)return;t[n]=o.v}return{v:t}}default:return}}var ua=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}]]),Iu={ActionExpression:!0,OpenUrl:!0,ToAssistant:!0},vn={Query:"Query",Mutation:"Mutation"};function Xr(e){return e?.callDefs??ua}function Jr(e){return ua.has(e)}function lr(e){return e in vn}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 Ng=1,Eu=2,Au=3,ls=4,Yr=5,cs=6,da=7,Mu=8,Lg=9;function pa(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 Ng;case R.Or:return Eu;case R.And:return Au;case R.EqEq:case R.NotEq:return ls;case R.Greater:case R.Less:case R.GreaterEq:case R.LessEq:return Yr;case R.Plus:case R.Minus:return cs;case R.Star:case R.Slash:case R.Percent:return da;case R.Dot:case R.LBrack:return Lg;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(Mu)};if(u.t===R.Minus)return r(),{k:"UnaryOp",op:"-",operand:i(Mu)};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(cs)};if(f.t===R.Minus)return r(),{k:"BinOp",op:"-",left:u,right:i(cs)};if(f.t===R.Star)return r(),{k:"BinOp",op:"*",left:u,right:i(da)};if(f.t===R.Slash)return r(),{k:"BinOp",op:"/",left:u,right:i(da)};if(f.t===R.Percent)return r(),{k:"BinOp",op:"%",left:u,right:i(da)};if(f.t===R.EqEq)return r(),{k:"BinOp",op:"==",left:u,right:i(ls)};if(f.t===R.NotEq)return r(),{k:"BinOp",op:"!=",left:u,right:i(ls)};if(f.t===R.Greater)return r(),{k:"BinOp",op:">",left:u,right:i(Yr)};if(f.t===R.Less)return r(),{k:"BinOp",op:"<",left:u,right:i(Yr)};if(f.t===R.GreaterEq)return r(),{k:"BinOp",op:">=",left:u,right:i(Yr)};if(f.t===R.LessEq)return r(),{k:"BinOp",op:"<=",left:u,right:i(Yr)};if(f.t===R.And)return r(),{k:"BinOp",op:"&&",left:u,right:i(Au)};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 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 _a(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 Kt(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 Nu;(function(e){e.ContinueConversation="continue_conversation",e.OpenUrl="open_url"})(Nu||(Nu={}));var Og={},$g=[];function fa(e){return Array.isArray(e)?"array":typeof e}function Lu(e){return typeof e.$ref=="string"?e.$ref.split("/").pop():void 0}function Ou(e){return"$ref"in e||"anyOf"in e||"oneOf"in e||"allOf"in e}function $u(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 ma(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e.default}function us(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e,n=Lu(t);if(n)return n;let r=$u(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 ds(e,t){let n=t.map(r=>{let o=us(r.schema),a=r.required?`${r.name}*`:r.name;return o?`${a}: ${o}`:a}).join(", ");return`${e}(${n})`}function Dg(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:fa(e)}:t.expectedType&&t.expectedType!==n?{expected:t.expectedType,actual:fa(e)}:null}function Fg(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 Be(e,t,n,r){e.errors.push({code:r.code,component:t,path:n,message:Fg(t,n,r),statementId:e.currentStatementId,...r.code==="no-root"&&r.reason==="fallback"&&{severity:"warning"}})}var yt=Symbol("invalid");function ga(e,t){return t!==void 0?t:e?yt:void 0}function Bg(e,t,n,r,o){return Ou(t)?!1:typeof t.type=="string"||Array.isArray(t.enum)||"const"in t?(Be(o,n,r,{code:"type-mismatch",expected:typeof t.type=="string"?t.type:"a literal value",actual:`component "${e.typeName}"`}),!0):!1}function Du(e){return(e.anyOf??e.oneOf??[e]).map(Lu)}function Ug(e,t){let n=Du(e);return n.length>0&&n.every(r=>r!==void 0&&t.cat?.has(r))}function qg(e,t,n,r,o){if(typeof e!="object"||Array.isArray(e))return Be(o,n,r,{code:"type-mismatch",expected:"object",actual:fa(e)}),yt;let a=e,i,s=t.properties&&typeof t.properties=="object"?t.properties:Og,c=Array.isArray(t.required)?t.required:$g,p=!1;if(!o.partial)for(let _ of c){let d=_ in a;if(!d||a[_]==null){let u=ma(s[_]);if(u!==void 0){(i??(i={...a}))[_]=u;continue}Be(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=Zr(a[_],d,n,`${r}/${_}`,o);if(u===yt&&(u=ga(c.includes(_),ma(d)),u===yt)){p=!0;continue}u!==a[_]&&(i??(i={...a}),u===void 0?delete i[_]:i[_]=u)}return p?yt:i??a}function Hg(e,t,n,r,o){if(!Array.isArray(e))return Be(o,n,r,{code:"type-mismatch",expected:"array",actual:fa(e)}),yt;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=Zr(e[s],a,n,`${r}/${s}`,o);c!==e[s]&&!i&&(i=e.slice(0,s)),i&&c!==yt&&i.push(c)}return i??e}function zg(e,t,n,r,o){let a=$u(t);if(a.expectedType==null&&a.enumValues==null||a.enumValues&&o.partial)return!1;let i=Dg(e,a);return i?(Be(o,n,r,{code:"type-mismatch",...i}),!0):!1}function Zr(e,t,n,r,o){if(!t||typeof t!="object"||Array.isArray(t))return e;let a=t;if(e==null||Ln(e))return e;if(Kt(e))return Bg(e,a,n,r,o)?yt:e;if(Ou(a))return Ug(a,o)?(Be(o,n,r,{code:"type-mismatch",expected:Du(a).join(" | "),actual:Array.isArray(e)?"array":typeof e=="object"?"plain object":typeof e}),yt):e;let i=a.type;return i==="object"?qg(e,a,n,r,o):i==="array"?Hg(e,a,n,r,o):zg(e,a,n,r,o)?yt:e}function ha(e){if(e==null||typeof e!="object")return!1;if(Ln(e))return!0;if(Array.isArray(e))return e.some(ha);if(Kt(e))return Object.values(e.props).some(ha);let t=e;return Array.isArray(t.steps)?!0:Object.values(t).some(ha)}function Fu(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"&&lr(r.name)){let a=r.name===vn.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"?On(r,t):ps(r,t);return n==="value"&&Kt(a)&&(a.statementId=e),a}finally{t.currentStatementId=o,t.visited.delete(e)}}function va(e,t){return Xr(t.cat).has(e)||lr(e)}function _s(e,t){let n={};for(let r=0;r<t.length&&r<e.length;r++)n[t[r].name]=e[r];return n}function Bu(e,t,n,r){let{params:o}=n;t.length>o.length&&Be(r,e,"",{code:"excess-args",declared:o.length,got:t.length});let a=_s(t,o),i=!1,s=r.errors.length;for(let c of o){let p=a[c.name],_=p?ca(p):{v:void 0};if(!_)continue;if(_.v==null){if(!c.required||c.defaultValue!==void 0)continue;Be(r,e,`/${c.name}`,{code:p?"null-required":"missing-required",signature:ds(e,o)}),i=!0;continue}let d=Zr(_.v,c.schema,e,`/${c.name}`,r);d===yt&&(d=ga(c.required,c.defaultValue)),d===yt?i=!0:d===void 0?delete a[c.name]:d!==_.v&&(a[c.name]=la(d))}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=Xr(t.cat).get(e.name);if(!o||o.lazy)return{...e,args:r};let a=o.builtin?_s(r,o.params):Bu(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 fs(e,t,n){let r=t.currentStatementId;t.currentStatementId=n;let o=new Set;for(let a of e)Qr(a,i=>{if(i.k!=="Comp"||o.has(i))return;o.add(i);let s=Xr(t.cat).get(i.name);if(!s||s.lazy)return;let c=s.builtin?null:Bu(i.name,i.args,s,t);i.mappedProps=c??_s(i.args,s.params)});t.currentStatementId=r}function qu(e,t,n){let r=Xr(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:Pt(c,t,i));return{...e,args:s}}function Pt(e,t,n){switch(e.k){case"Ref":return n.has(e.n)?e:Fu(e.n,t,"expr");case"Ph":return e;case"Comp":{if(e.fn&&!va(e.name,t))return Be(t,e.name,"",{code:"unknown-function"}),{k:"Null"};let r=qu(e,t,n);if(r)return r;if(va(e.name,t))return Uu(e,t,i=>Pt(i,t,n));let o=e.args.map(i=>Pt(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 Be(t,e.name,"",{code:"unknown-component",available:t.cat&&[...t.cat.keys()]}),{...e,args:o}}case"Arr":return{...e,els:e.els.map(r=>Pt(r,t,n))};case"Obj":return{...e,entries:e.entries.map(([r,o])=>[r,Pt(o,t,n)])};case"BinOp":return{...e,left:Pt(e.left,t,n),right:Pt(e.right,t,n)};case"UnaryOp":return{...e,operand:Pt(e.operand,t,n)};case"Ternary":return{...e,cond:Pt(e.cond,t,n),then:Pt(e.then,t,n),else:Pt(e.else,t,n)};case"Member":return{...e,obj:Pt(e.obj,t,n)};case"Index":return{...e,obj:Pt(e.obj,t,n),index:Pt(e.index,t,n)};case"Assign":return{...e,value:Pt(e.value,t,n)};default:return e}}function ps(e,t){return Pt(e,t,new Set)}function On(e,t){switch(e.k){case"Ref":return Fu(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=On(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]=On(o,t);return n}case"Comp":{let{name:n,args:r}=e;if(e.fn&&!va(n,t))return Be(t,n,"",{code:"unknown-function"}),null;if(lr(n))return Be(t,n,"",{code:"inline-reserved"}),null;if(va(n,t)){let s=qu(e,t,new Set);return s||Uu(e,t,c=>ps(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=On(r[p],t);if(t.prunedValues>d&&Be(t,n,`/${_.name}`,{code:"pruned-value"}),a[_.name]=u,_.schema===void 0)continue;if(u==null&&_.defaultValue!==void 0){Be(t,n,`/${_.name}`,{code:"type-mismatch",expected:us(_.schema)??"a defined value",actual:u===null?"null":"undefined"}),a[_.name]=_.defaultValue,t.prunedValues=d;continue}let f=Zr(u,_.schema,n,`/${_.name}`,t);f===yt&&(f=ga(_.required,_.defaultValue),_.defaultValue!==void 0&&(t.prunedValues=d),f===yt?s=!0:f===void 0&&delete a[_.name]),f!==yt&&f!==void 0&&(a[_.name]=f)}r.length>o.params.length&&Be(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?(Be(t,n,`/${_.name}`,{code:_.name in a?"null-required":"missing-required"}),a[_.name]=_.defaultValue,!1):!0);if(p.length){for(let _ of p)Be(t,n,`/${_.name}`,{code:_.name in a?"null-required":"missing-required",signature:ds(n,o.params)});return null}}if(s)return null}else return Be(t,n,"",{code:"unknown-component",available:t.cat&&[...t.cat.keys()]}),null;let i=Object.values(a).some(s=>ha(s));return{type:"element",typeName:n,props:a,partial:t.partial,hasDynamicProps:i}}default:return Ru(e)?ps(e,t):e}}function ms(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 ba(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 ju(e){if(!Ln(e))return[];let t=new Set;return Qr(e,n=>{n.k==="StateRef"&&t.add(n.n)}),[...t]}function hs(e,t){if(t.k==="Comp"&&t.name===vn.Query){let n=ju(t.args[1]);return{kind:"query",id:e.id,call:{callee:vn.Query,args:t.args},expr:t,deps:n.length>0?n:void 0}}return t.k==="Comp"&&t.name===vn.Mutation?{kind:"mutation",id:e.id,call:{callee:vn.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 jg(e,t,n){let r={},o=[],a=[];for(let i of e)switch(i.kind){case"state":r[i.id]=On(i.init,t);break;case"query":fs(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":fs(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 ju(c))p===n?.name&&n.stmts.has(i)||p in r||(r[p]=null)}return{stateDeclarations:r,queryStatements:o,mutationStatements:a}}var Hu="root";function bs(e){return e?.k==="Comp"&&!e.fn&&!Jr(e.name)&&!lr(e.name)}function Vg(e,t){if(e.has(Hu))return{id:Hu,fallback:!1};for(let n of e.values())if(n.kind==="value"&&bs(n.expr)&&n.expr.name===t)return{id:n.id,fallback:!0};return null}function Wg(e,t){let n=new Set;for(;e?.k==="Ref"&&!n.has(e.n);)n.add(e.n),e=t.get(e.n);return bs(e)}function Gg(e){let t=!1;return Qr(e,n=>{bs(n)&&(t=!0)}),t}function ya(e,t,n,r,o,a,i){let s=Vg(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=On(c.get(s.id),u);Kt(h)?(f=h,f.statementId=s.id):Ln(h)&&Gg(h)&&(m=h)}let{stateDeclarations:v,queryStatements:x,mutationStatements:P}=jg(t,u,i);u.currentStatementId=s?.id;let k=a??"";s?!f&&!m&&!Wg(c.get(s.id),c)?Be(u,k,"",{code:"no-root",reason:"not-component"}):s.fallback&&Be(u,k,"",{code:"no-root",reason:f?"fallback":"missing"}):Be(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:x,mutationStatements:P}}function zu(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 Kg(e){let t=[],n=0;for(;n<e.length;){let r=-1;for(;n<e.length;){let s=zu(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=zu(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
+ `){Ce(e),Ee(e,o),e.pending=n;continue}}else{if(i===n){Ce(e),Ee(e,a),Ee(e,o),e.pending="";continue}if(n!==" "&&n!==`
34
+ `){Ce(e),Ee(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
+ `){Ce(e),Ee(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(Dg(n.charCodeAt(0)))break;Ce(e),Ee(e,31),e.pending=n;continue}break;case"[":if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n!=="]"){Ce(e),Ee(e,17),e.pending=n;continue}break;case"!":if(e.token!==19&&n==="["){Ce(e),Ee(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}Ce(e)}function Gr(e){return{add_token:Fg,end_token:cs,add_text:us,set_attr:ds,data:{nodes:[e,,,,,],index:0}}}function Fg(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 cs(e){e.index-=1}function us(e,t){e.nodes[e.index].appendChild(document.createTextNode(t))}function ds(e,t,n){e.nodes[e.index].setAttribute(Mg(t),n)}var ur={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 Nu=Kr;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"]},Ug={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 st(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=st.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 st.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:_}}],!1;if(e.typeName!==void 0){let d=s;if(e.typeName!=="Text")return st.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 st.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 st.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:m}}],!1;{let v=s;for(let y in d)if(y!=="text"){return st.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:y}}],!1;break}if(v===s&&d.text!==void 0&&typeof d.text!="string")return st.errors=[{instancePath:t+"/props/text",schemaPath:"#/properties/props/properties/text/type",keyword:"type",params:{type:"string"}}],!1}}else return st.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=u===s}else var p=!0}}else return st.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return st.errors=i,s===0}st.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function tt(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=tt.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 tt.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:d}}],!1;if(e.typeName!==void 0){let u=s;if(e.typeName!=="Card")return tt.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 tt.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 tt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:v}}],!1;{let y=s;for(let x in u)if(!(x==="title"||x==="body")){return tt.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 tt.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 tt.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 tt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=f===s}else var p=!0}}else return tt.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return tt.errors=i,s===0}tt.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 d;if(e.typeName===void 0&&(d="typeName")||e.statementId===void 0&&(d="statementId")||e.props===void 0&&(d="props"))return Xe.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:d}}],!1;if(e.typeName!==void 0){let u=s;if(e.typeName!=="Metric")return Xe.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 Xe.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 Xe.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:v}}],!1;{let y=s;for(let x in u)if(!(x==="label"||x==="value"||x==="detail")){return Xe.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 Xe.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 Xe.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 Xe.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 Xe.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=f===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 Ue(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=Ue.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 Ue.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:m}}],!1;if(e.typeName!==void 0){let v=s;if(e.typeName!=="Table")return Ue.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 Ue.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,y=s;if(s===y)if(v&&typeof v=="object"&&!Array.isArray(v)){let S;if(v.title===void 0&&(S="title")||v.columns===void 0&&(S="columns")||v.rows===void 0&&(S="rows"))return Ue.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:S}}],!1;{let w=s;for(let h in v)if(!(h==="title"||h==="columns"||h==="rows")){return Ue.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:h}}],!1;break}if(w===s){if(v.title!==void 0){let h=s;if(typeof v.title!="string")return Ue.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 k=h.length;for(let E=0;E<k;E++){let R=s;if(typeof h[E]!="string")return Ue.errors=[{instancePath:t+"/props/columns/"+E,schemaPath:"#/properties/props/properties/columns/items/type",keyword:"type",params:{type:"string"}}],!1;var d=R===s;if(!d)break}}else return Ue.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 k=h.length;for(let E=0;E<k;E++){let R=h[E],A=s;if(s===A)if(Array.isArray(R)){var f=!0;let j=R.length;for(let B=0;B<j;B++){let V=s;if(typeof R[B]!="string")return Ue.errors=[{instancePath:t+"/props/rows/"+E+"/"+B,schemaPath:"#/properties/props/properties/rows/items/items/type",keyword:"type",params:{type:"string"}}],!1;var f=V===s;if(!f)break}}else return Ue.errors=[{instancePath:t+"/props/rows/"+E,schemaPath:"#/properties/props/properties/rows/items/type",keyword:"type",params:{type:"array"}}],!1;var u=A===s;if(!u)break}}else return Ue.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 Ue.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=y===s}else var p=!0}}else return Ue.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return Ue.errors=i,s===0}Ue.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};var qg={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 Ne(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=Ne.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 Ne.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:f}}],!1;if(e.typeName!==void 0){let m=s;if(e.typeName!=="Chart")return Ne.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 Ne.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 Ne.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 Ne.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 Ne.errors=[{instancePath:t+"/props/title",schemaPath:"#/properties/props/properties/title/type",keyword:"type",params:{type:"string"}}],!1;var _=w===s}else var _=!0;if(_){if(m.type!==void 0){let w=m.type,h=s;if(typeof w!="string")return Ne.errors=[{instancePath:t+"/props/type",schemaPath:"#/properties/props/properties/type/type",keyword:"type",params:{type:"string"}}],!1;if(!(w==="bar"||w==="line"))return Ne.errors=[{instancePath:t+"/props/type",schemaPath:"#/properties/props/properties/type/enum",keyword:"enum",params:{allowedValues:qg.properties.props.properties.type.enum}}],!1;var _=h===s}else var _=!0;if(_)if(m.data!==void 0){let w=m.data,h=s;if(s===h)if(Array.isArray(w)){var d=!0;let b=w.length;for(let k=0;k<b;k++){let E=w[k],R=s;if(s===R)if(E&&typeof E=="object"&&!Array.isArray(E)){let L;if(E.label===void 0&&(L="label")||E.value===void 0&&(L="value"))return Ne.errors=[{instancePath:t+"/props/data/"+k,schemaPath:"#/properties/props/properties/data/items/required",keyword:"required",params:{missingProperty:L}}],!1;{let j=s;for(let B in E)if(!(B==="label"||B==="value")){return Ne.errors=[{instancePath:t+"/props/data/"+k,schemaPath:"#/properties/props/properties/data/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:B}}],!1;break}if(j===s){if(E.label!==void 0){let B=s;if(typeof E.label!="string")return Ne.errors=[{instancePath:t+"/props/data/"+k+"/label",schemaPath:"#/properties/props/properties/data/items/properties/label/type",keyword:"type",params:{type:"string"}}],!1;var u=B===s}else var u=!0;if(u)if(E.value!==void 0){let B=E.value,V=s;if(!(typeof B=="number"&&isFinite(B)))return Ne.errors=[{instancePath:t+"/props/data/"+k+"/value",schemaPath:"#/properties/props/properties/data/items/properties/value/type",keyword:"type",params:{type:"number"}}],!1;var u=V===s}else var u=!0}}}else return Ne.errors=[{instancePath:t+"/props/data/"+k,schemaPath:"#/properties/props/properties/data/items/type",keyword:"type",params:{type:"object"}}],!1;var d=R===s;if(!d)break}}else return Ne.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 Ne.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=v===s}else var p=!0}}else return Ne.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return Ne.errors=i,s===0}Ne.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function it(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=it.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 it.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:m}}],!1;if(e.typeName!==void 0){let v=s;if(e.typeName!=="Cell")return it.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 it.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,y=s;if(s===y)if(v&&typeof v=="object"&&!Array.isArray(v)){let S;if(v.children===void 0&&(S="children"))return it.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:S}}],!1;{let w=s;for(let h in v)if(!(h==="children"||h==="span")){return it.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:h}}],!1;break}if(w===s){if(v.children!==void 0){let h=v.children,g=s;if(s===g)if(Array.isArray(h)){var _=!0;let b=h.length;for(let k=0;k<b;k++){let E=h[k],R=s,A=s,L=!1,j=s;st(E,{instancePath:t+"/props/children/"+k,parentData:h,parentDataProperty:k,rootData:o,dynamicAnchors:a})||(i=i===null?st.errors:i.concat(st.errors),s=i.length);var u=j===s;if(L=L||u,u){var d={};d.typeName=!0,d.statementId=!0,d.props=!0}let B=s;tt(E,{instancePath:t+"/props/children/"+k,parentData:h,parentDataProperty:k,rootData:o,dynamicAnchors:a})||(i=i===null?tt.errors:i.concat(tt.errors),s=i.length);var u=B===s;L=L||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0);let V=s;Xe(E,{instancePath:t+"/props/children/"+k,parentData:h,parentDataProperty:k,rootData:o,dynamicAnchors:a})||(i=i===null?Xe.errors:i.concat(Xe.errors),s=i.length);var u=V===s;L=L||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0);let X=s;Ue(E,{instancePath:t+"/props/children/"+k,parentData:h,parentDataProperty:k,rootData:o,dynamicAnchors:a})||(i=i===null?Ue.errors:i.concat(Ue.errors),s=i.length);var u=X===s;L=L||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0);let pe=s;Ne(E,{instancePath:t+"/props/children/"+k,parentData:h,parentDataProperty:k,rootData:o,dynamicAnchors:a})||(i=i===null?Ne.errors:i.concat(Ne.errors),s=i.length);var u=pe===s;if(L=L||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0),L)s=A,i!==null&&(A?i.length=A:i=null);else{let le={instancePath:t+"/props/children/"+k,schemaPath:"#/properties/props/properties/children/items/anyOf",keyword:"anyOf",params:{}};return i===null?i=[le]:i.push(le),s++,it.errors=i,!1}var _=R===s;if(!_)break}}else return it.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 it.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 it.errors=[{instancePath:t+"/props/span",schemaPath:"#/properties/props/properties/span/enum",keyword:"enum",params:{allowedValues:Ug.properties.props.properties.span.enum}}],!1;var f=g===s}else var f=!0}}}else return it.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=y===s}else var p=!0}}else return it.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return it.errors=i,s===0}it.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function bt(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=bt.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 bt.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:m}}],!1;if(e.typeName!==void 0){let v=s;if(e.typeName!=="Grid")return bt.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 bt.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,y=s;if(s===y)if(v&&typeof v=="object"&&!Array.isArray(v)){let S;if(v.columns===void 0&&(S="columns")||v.children===void 0&&(S="children"))return bt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:S}}],!1;{let w=s;for(let h in v)if(!(h==="columns"||h==="children")){return bt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:h}}],!1;break}if(w===s){if(v.columns!==void 0){let h=v.columns,g=s;if(!(typeof h=="number"&&!(h%1)&&!isNaN(h)&&isFinite(h)))return bt.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 bt.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 k=h.length;for(let E=0;E<k;E++){let R=h[E],A=s,L=s,j=!1,B=s;it(R,{instancePath:t+"/props/children/"+E,parentData:h,parentDataProperty:E,rootData:o,dynamicAnchors:a})||(i=i===null?it.errors:i.concat(it.errors),s=i.length);var f=B===s;if(j=j||f,f){var u={};u.typeName=!0,u.statementId=!0,u.props=!0}let V=s;st(R,{instancePath:t+"/props/children/"+E,parentData:h,parentDataProperty:E,rootData:o,dynamicAnchors:a})||(i=i===null?st.errors:i.concat(st.errors),s=i.length);var f=V===s;j=j||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let X=s;tt(R,{instancePath:t+"/props/children/"+E,parentData:h,parentDataProperty:E,rootData:o,dynamicAnchors:a})||(i=i===null?tt.errors:i.concat(tt.errors),s=i.length);var f=X===s;j=j||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let pe=s;Xe(R,{instancePath:t+"/props/children/"+E,parentData:h,parentDataProperty:E,rootData:o,dynamicAnchors:a})||(i=i===null?Xe.errors:i.concat(Xe.errors),s=i.length);var f=pe===s;j=j||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let J=s;Ue(R,{instancePath:t+"/props/children/"+E,parentData:h,parentDataProperty:E,rootData:o,dynamicAnchors:a})||(i=i===null?Ue.errors:i.concat(Ue.errors),s=i.length);var f=J===s;j=j||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let le=s;Ne(R,{instancePath:t+"/props/children/"+E,parentData:h,parentDataProperty:E,rootData:o,dynamicAnchors:a})||(i=i===null?Ne.errors:i.concat(Ne.errors),s=i.length);var f=le===s;if(j=j||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0),j)s=L,i!==null&&(L?i.length=L:i=null);else{let be={instancePath:t+"/props/children/"+E,schemaPath:"#/properties/props/properties/children/items/anyOf",keyword:"anyOf",params:{}};return i===null?i=[be]:i.push(be),s++,bt.errors=i,!1}var d=A===s;if(!d)break}}else return bt.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 bt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=y===s}else var p=!0}}else return bt.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return bt.errors=i,s===0}bt.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function Kr(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=Kr.evaluated;c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0);let p=s,_=!1,d=s;bt(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?bt.errors:i.concat(bt.errors),s=i.length);var w=d===s;if(_=_||w,w){var u={};u.typeName=!0,u.statementId=!0,u.props=!0}let f=s;it(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?it.errors:i.concat(it.errors),s=i.length);var w=f===s;_=_||w,w&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let m=s;st(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?st.errors:i.concat(st.errors),s=i.length);var w=m===s;_=_||w,w&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let v=s;tt(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?tt.errors:i.concat(tt.errors),s=i.length);var w=v===s;_=_||w,w&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let y=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=y===s;_=_||w,w&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let x=s;Ue(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?Ue.errors:i.concat(Ue.errors),s=i.length);var w=x===s;_=_||w,w&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let S=s;Ne(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?Ne.errors:i.concat(Ne.errors),s=i.length);var w=S===s;if(_=_||w,w&&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++,Kr.errors=i,!1}return Kr.errors=i,c.props=u,s===0}Kr.evaluated={dynamicProps:!0,dynamicItems:!1};function Lu(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 Hg=new Set(["Comp","Ref","StateRef","RuntimeRef","BinOp","UnaryOp","Ternary","Member","Index","Assign","Str","Num","Bool","Null","Arr","Obj","Ph"]);function Dn(e){return!e||typeof e!="object"||Array.isArray(e)?!1:Hg.has(e.k)}function Qr(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 da(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(da)}:typeof e=="object"?{k:"Obj",entries:Object.entries(e).map(([t,n])=>[t,da(n)])}:{k:"Null"}}function pa(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=pa(n);if(!r)return;t.push(r.v)}return{v:t}}case"Obj":{let t={};for(let[n,r]of e.entries){let o=pa(r);if(!o)return;t[n]=o.v}return{v:t}}default:return}}var _a=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}]]),Ou={ActionExpression:!0,OpenUrl:!0,ToAssistant:!0},yn={Query:"Query",Mutation:"Mutation"};function Xr(e){return e?.callDefs??_a}function Jr(e){return _a.has(e)}function dr(e){return e in yn}var T;(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"})(T||(T={}));var zg=1,$u=2,Du=3,ps=4,Yr=5,_s=6,fa=7,Fu=8,jg=9;function ma(e){let t=0,n=()=>e[t]??{t:T.EOF},r=()=>{let u=n();return t++,u},o=u=>{n().t===u&&t++};function a(u){switch(u.t){case T.Question:return zg;case T.Or:return $u;case T.And:return Du;case T.EqEq:case T.NotEq:return ps;case T.Greater:case T.Less:case T.GreaterEq:case T.LessEq:return Yr;case T.Plus:case T.Minus:return _s;case T.Star:case T.Slash:case T.Percent:return fa;case T.Dot:case T.LBrack:return jg;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===T.Str)return r(),{k:"Str",v:u.v};if(u.t===T.Num)return r(),{k:"Num",v:u.v};if(u.t===T.True)return r(),{k:"Bool",v:!0};if(u.t===T.False)return r(),{k:"Bool",v:!1};if(u.t===T.Null)return r(),{k:"Null"};if(u.t===T.LBrack)return _();if(u.t===T.LBrace)return d();if(u.t===T.StateVar){let f=u.v;if(r(),n().t===T.Equals){r();let m=i(0);return{k:"Assign",target:f,value:m}}return{k:"StateRef",n:f}}if(u.t===T.Type){let f=u.v;return e[t+1]?.t===T.LParen&&(!Jr(f)||f==="Action")?p():(r(),{k:"Ref",n:f})}if(u.t===T.BuiltinCall){if(e[t+1]?.t===T.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===T.Ident)return r(),{k:"Ref",n:u.v};if(u.t===T.Not)return r(),{k:"UnaryOp",op:"!",operand:i(Fu)};if(u.t===T.Minus)return r(),{k:"UnaryOp",op:"-",operand:i(Fu)};if(u.t===T.LParen){r();let f=i(0);return o(T.RParen),f}return r(),{k:"Null"}}function c(u){let f=n();if(f.t===T.Plus)return r(),{k:"BinOp",op:"+",left:u,right:i(_s)};if(f.t===T.Minus)return r(),{k:"BinOp",op:"-",left:u,right:i(_s)};if(f.t===T.Star)return r(),{k:"BinOp",op:"*",left:u,right:i(fa)};if(f.t===T.Slash)return r(),{k:"BinOp",op:"/",left:u,right:i(fa)};if(f.t===T.Percent)return r(),{k:"BinOp",op:"%",left:u,right:i(fa)};if(f.t===T.EqEq)return r(),{k:"BinOp",op:"==",left:u,right:i(ps)};if(f.t===T.NotEq)return r(),{k:"BinOp",op:"!=",left:u,right:i(ps)};if(f.t===T.Greater)return r(),{k:"BinOp",op:">",left:u,right:i(Yr)};if(f.t===T.Less)return r(),{k:"BinOp",op:"<",left:u,right:i(Yr)};if(f.t===T.GreaterEq)return r(),{k:"BinOp",op:">=",left:u,right:i(Yr)};if(f.t===T.LessEq)return r(),{k:"BinOp",op:"<=",left:u,right:i(Yr)};if(f.t===T.And)return r(),{k:"BinOp",op:"&&",left:u,right:i(Du)};if(f.t===T.Or)return r(),{k:"BinOp",op:"||",left:u,right:i($u)};if(f.t===T.Question){r();let m=i(0);o(T.Colon);let v=i(0);return{k:"Ternary",cond:u,then:m,else:v}}if(f.t===T.Dot){r();let m=n(),v=m.t===T.Ident||m.t===T.Type||m.t===T.Str||m.t===T.Num?(r(),String(m.v)):m.t===T.StateVar?(r(),m.v.replace(/^\$/,"")):(r(),"?");return{k:"Member",obj:u,field:v}}if(f.t===T.LBrack){r();let m=i(0);return o(T.RBrack),{k:"Index",obj:u,index:m}}return u}function p(){let u=n().v;r(),o(T.LParen);let f=[];for(;n().t!==T.RParen&&n().t!==T.EOF;)f.push(i(0)),n().t===T.Comma&&r();return o(T.RParen),{k:"Comp",name:u,args:f}}function _(){r();let u=[];for(;n().t!==T.RBrack&&n().t!==T.EOF;)u.push(i(0)),n().t===T.Comma&&r();return o(T.RBrack),{k:"Arr",els:u}}function d(){r();let u=[];for(;n().t!==T.RBrace&&n().t!==T.EOF;){let f=n(),m=f.t===T.Ident||f.t===T.Str||f.t===T.Type||f.t===T.Num?(r(),String(f.v)):f.t===T.StateVar?(r(),f.v.replace(/^\$/,"")):(r(),"?");o(T.Colon),u.push([m,i(0)]),n().t===T.Comma&&r()}return o(T.RBrace),{k:"Obj",entries:u}}return i(0)}function ga(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:T.Newline}),n++;continue}if(o==="("){t.push({t:T.LParen}),n++;continue}if(o===")"){t.push({t:T.RParen}),n++;continue}if(o==="["){t.push({t:T.LBrack}),n++;continue}if(o==="]"){t.push({t:T.RBrack}),n++;continue}if(o==="{"){t.push({t:T.LBrace}),n++;continue}if(o==="}"){t.push({t:T.RBrace}),n++;continue}if(o===","){t.push({t:T.Comma}),n++;continue}if(o===":"){t.push({t:T.Colon}),n++;continue}if(o==="="){n+1<r&&e[n+1]==="="?(t.push({t:T.EqEq}),n+=2):(t.push({t:T.Equals}),n++);continue}if(o==="!"){n+1<r&&e[n+1]==="="?(t.push({t:T.NotEq}),n+=2):(t.push({t:T.Not}),n++);continue}if(o===">"){n+1<r&&e[n+1]==="="?(t.push({t:T.GreaterEq}),n+=2):(t.push({t:T.Greater}),n++);continue}if(o==="<"){n+1<r&&e[n+1]==="="?(t.push({t:T.LessEq}),n+=2):(t.push({t:T.Less}),n++);continue}if(o==="&"){n+1<r&&e[n+1]==="&"?(t.push({t:T.And}),n+=2):(t.push({t:T.And}),n++);continue}if(o==="|"){n+1<r&&e[n+1]==="|"?(t.push({t:T.Or}),n+=2):(t.push({t:T.Or}),n++);continue}if(o==="."){t.push({t:T.Dot}),n++;continue}if(o==="?"){t.push({t:T.Question}),n++;continue}if(o==="+"){t.push({t:T.Plus}),n++;continue}if(o==="*"){t.push({t:T.Star}),n++;continue}if(o==="/"){t.push({t:T.Slash}),n++;continue}if(o==="%"){t.push({t:T.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:T.Str,v:JSON.parse(d)})}catch{let d=_.replace(/^"|"$/g,"");t.push({t:T.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:T.Str,v:c});continue}if(o==="-"){let c=t.length>0?t[t.length-1]:null;if(!(!(c!=null&&(c.t===T.Num||c.t===T.Str||c.t===T.Ident||c.t===T.Type||c.t===T.RParen||c.t===T.RBrack||c.t===T.True||c.t===T.False||c.t===T.Null||c.t===T.StateVar||c.t===T.BuiltinCall))&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9")){t.push({t:T.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:T.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:T.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:T.True});continue}if(p==="false"){t.push({t:T.False});continue}if(p==="null"){t.push({t:T.Null});continue}let _=o>="A"&&o<="Z"?T.Type:T.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:T.BuiltinCall,v:e.slice(c,n)});continue}n++}return t.push({t:T.EOF}),t}function Qt(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 Bu;(function(e){e.ContinueConversation="continue_conversation",e.OpenUrl="open_url"})(Bu||(Bu={}));var Vg={},Wg=[];function ha(e){return Array.isArray(e)?"array":typeof e}function Uu(e){return typeof e.$ref=="string"?e.$ref.split("/").pop():void 0}function qu(e){return"$ref"in e||"anyOf"in e||"oneOf"in e||"allOf"in e}function Hu(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 va(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e.default}function fs(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e,n=Uu(t);if(n)return n;let r=Hu(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 ms(e,t){let n=t.map(r=>{let o=fs(r.schema),a=r.required?`${r.name}*`:r.name;return o?`${a}: ${o}`:a}).join(", ");return`${e}(${n})`}function Gg(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:ha(e)}:t.expectedType&&t.expectedType!==n?{expected:t.expectedType,actual:ha(e)}:null}function Kg(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 Ge(e,t,n,r){e.errors.push({code:r.code,component:t,path:n,message:Kg(t,n,r),statementId:e.currentStatementId,...r.code==="no-root"&&r.reason==="fallback"&&{severity:"warning"}})}var St=Symbol("invalid");function ba(e,t){return t!==void 0?t:e?St:void 0}function Qg(e,t,n,r,o){return qu(t)?!1:typeof t.type=="string"||Array.isArray(t.enum)||"const"in t?(Ge(o,n,r,{code:"type-mismatch",expected:typeof t.type=="string"?t.type:"a literal value",actual:`component "${e.typeName}"`}),!0):!1}function zu(e){return(e.anyOf??e.oneOf??[e]).map(Uu)}function Xg(e,t){let n=zu(e);return n.length>0&&n.every(r=>r!==void 0&&t.cat?.has(r))}function Jg(e,t,n,r,o){if(typeof e!="object"||Array.isArray(e))return Ge(o,n,r,{code:"type-mismatch",expected:"object",actual:ha(e)}),St;let a=e,i,s=t.properties&&typeof t.properties=="object"?t.properties:Vg,c=Array.isArray(t.required)?t.required:Wg,p=!1;if(!o.partial)for(let _ of c){let d=_ in a;if(!d||a[_]==null){let u=va(s[_]);if(u!==void 0){(i??(i={...a}))[_]=u;continue}Ge(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=Zr(a[_],d,n,`${r}/${_}`,o);if(u===St&&(u=ba(c.includes(_),va(d)),u===St)){p=!0;continue}u!==a[_]&&(i??(i={...a}),u===void 0?delete i[_]:i[_]=u)}return p?St:i??a}function Yg(e,t,n,r,o){if(!Array.isArray(e))return Ge(o,n,r,{code:"type-mismatch",expected:"array",actual:ha(e)}),St;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=Zr(e[s],a,n,`${r}/${s}`,o);c!==e[s]&&!i&&(i=e.slice(0,s)),i&&c!==St&&i.push(c)}return i??e}function Zg(e,t,n,r,o){let a=Hu(t);if(a.expectedType==null&&a.enumValues==null||a.enumValues&&o.partial)return!1;let i=Gg(e,a);return i?(Ge(o,n,r,{code:"type-mismatch",...i}),!0):!1}function Zr(e,t,n,r,o){if(!t||typeof t!="object"||Array.isArray(t))return e;let a=t;if(e==null||Dn(e))return e;if(Qt(e))return Qg(e,a,n,r,o)?St:e;if(qu(a))return Xg(a,o)?(Ge(o,n,r,{code:"type-mismatch",expected:zu(a).join(" | "),actual:Array.isArray(e)?"array":typeof e=="object"?"plain object":typeof e}),St):e;let i=a.type;return i==="object"?Jg(e,a,n,r,o):i==="array"?Yg(e,a,n,r,o):Zg(e,a,n,r,o)?St:e}function ya(e){if(e==null||typeof e!="object")return!1;if(Dn(e))return!0;if(Array.isArray(e))return e.some(ya);if(Qt(e))return Object.values(e.props).some(ya);let t=e;return Array.isArray(t.steps)?!0:Object.values(t).some(ya)}function ju(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"&&dr(r.name)){let a=r.name===yn.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"?Fn(r,t):gs(r,t);return n==="value"&&Qt(a)&&(a.statementId=e),a}finally{t.currentStatementId=o,t.visited.delete(e)}}function Pa(e,t){return Xr(t.cat).has(e)||dr(e)}function hs(e,t){let n={};for(let r=0;r<t.length&&r<e.length;r++)n[t[r].name]=e[r];return n}function Vu(e,t,n,r){let{params:o}=n;t.length>o.length&&Ge(r,e,"",{code:"excess-args",declared:o.length,got:t.length});let a=hs(t,o),i=!1,s=r.errors.length;for(let c of o){let p=a[c.name],_=p?pa(p):{v:void 0};if(!_)continue;if(_.v==null){if(!c.required||c.defaultValue!==void 0)continue;Ge(r,e,`/${c.name}`,{code:p?"null-required":"missing-required",signature:ms(e,o)}),i=!0;continue}let d=Zr(_.v,c.schema,e,`/${c.name}`,r);d===St&&(d=ba(c.required,c.defaultValue)),d===St?i=!0:d===void 0?delete a[c.name]:d!==_.v&&(a[c.name]=da(d))}return n.kind==="action"&&r.errors.length>s&&(i=!0),i?null:a}function Wu(e,t,n){let r=e.args.map(n),o=Xr(t.cat).get(e.name);if(!o||o.lazy)return{...e,args:r};let a=o.builtin?hs(r,o.params):Vu(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 vs(e,t,n){let r=t.currentStatementId;t.currentStatementId=n;let o=new Set;for(let a of e)Qr(a,i=>{if(i.k!=="Comp"||o.has(i))return;o.add(i);let s=Xr(t.cat).get(i.name);if(!s||s.lazy)return;let c=s.builtin?null:Vu(i.name,i.args,s,t);i.mappedProps=c??hs(i.args,s.params)});t.currentStatementId=r}function Gu(e,t,n){let r=Xr(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:kt(c,t,i));return{...e,args:s}}function kt(e,t,n){switch(e.k){case"Ref":return n.has(e.n)?e:ju(e.n,t,"expr");case"Ph":return e;case"Comp":{if(e.fn&&!Pa(e.name,t))return Ge(t,e.name,"",{code:"unknown-function"}),{k:"Null"};let r=Gu(e,t,n);if(r)return r;if(Pa(e.name,t))return Wu(e,t,i=>kt(i,t,n));let o=e.args.map(i=>kt(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 Ge(t,e.name,"",{code:"unknown-component",available:t.cat&&[...t.cat.keys()]}),{...e,args:o}}case"Arr":return{...e,els:e.els.map(r=>kt(r,t,n))};case"Obj":return{...e,entries:e.entries.map(([r,o])=>[r,kt(o,t,n)])};case"BinOp":return{...e,left:kt(e.left,t,n),right:kt(e.right,t,n)};case"UnaryOp":return{...e,operand:kt(e.operand,t,n)};case"Ternary":return{...e,cond:kt(e.cond,t,n),then:kt(e.then,t,n),else:kt(e.else,t,n)};case"Member":return{...e,obj:kt(e.obj,t,n)};case"Index":return{...e,obj:kt(e.obj,t,n),index:kt(e.index,t,n)};case"Assign":return{...e,value:kt(e.value,t,n)};default:return e}}function gs(e,t){return kt(e,t,new Set)}function Fn(e,t){switch(e.k){case"Ref":return ju(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=Fn(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]=Fn(o,t);return n}case"Comp":{let{name:n,args:r}=e;if(e.fn&&!Pa(n,t))return Ge(t,n,"",{code:"unknown-function"}),null;if(dr(n))return Ge(t,n,"",{code:"inline-reserved"}),null;if(Pa(n,t)){let s=Gu(e,t,new Set);return s||Wu(e,t,c=>gs(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=Fn(r[p],t);if(t.prunedValues>d&&Ge(t,n,`/${_.name}`,{code:"pruned-value"}),a[_.name]=u,_.schema===void 0)continue;if(u==null&&_.defaultValue!==void 0){Ge(t,n,`/${_.name}`,{code:"type-mismatch",expected:fs(_.schema)??"a defined value",actual:u===null?"null":"undefined"}),a[_.name]=_.defaultValue,t.prunedValues=d;continue}let f=Zr(u,_.schema,n,`/${_.name}`,t);f===St&&(f=ba(_.required,_.defaultValue),_.defaultValue!==void 0&&(t.prunedValues=d),f===St?s=!0:f===void 0&&delete a[_.name]),f!==St&&f!==void 0&&(a[_.name]=f)}r.length>o.params.length&&Ge(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?(Ge(t,n,`/${_.name}`,{code:_.name in a?"null-required":"missing-required"}),a[_.name]=_.defaultValue,!1):!0);if(p.length){for(let _ of p)Ge(t,n,`/${_.name}`,{code:_.name in a?"null-required":"missing-required",signature:ms(n,o.params)});return null}}if(s)return null}else return Ge(t,n,"",{code:"unknown-component",available:t.cat&&[...t.cat.keys()]}),null;let i=Object.values(a).some(s=>ya(s));return{type:"element",typeName:n,props:a,partial:t.partial,hasDynamicProps:i}}default:return Lu(e)?gs(e,t):e}}function bs(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 xa(e){let t=[],n=0;for(;n<e.length;){for(;n<e.length&&e[n].t===T.Newline;)n++;if(n>=e.length||e[n].t===T.EOF)break;let r=e[n];if(r.t!==T.Ident&&r.t!==T.Type&&r.t!==T.StateVar){for(;n<e.length&&e[n].t!==T.Newline&&e[n].t!==T.EOF;)n++;continue}let o=r.v,a=r.t;if(n++,n>=e.length||e[n].t!==T.Equals){for(;n<e.length&&e[n].t!==T.Newline&&e[n].t!==T.EOF;)n++;continue}n++;let i=[],s=0,c=0;for(;n<e.length&&e[n].t!==T.EOF;){let p=e[n].t;if(p===T.Newline&&s<=0&&c<=0){let _=n+1;for(;_<e.length&&e[_].t===T.Newline;)_++;let d=_<e.length?e[_].t:T.EOF;if(d===T.Question||d===T.Colon&&c>0){n++;continue}break}if(p===T.Newline){n++;continue}p===T.LParen||p===T.LBrack||p===T.LBrace?s++:(p===T.RParen||p===T.RBrack||p===T.RBrace)&&s>0?s--:p===T.Question&&s===0?c++:p===T.Colon&&s===0&&c>0&&c--,i.push(e[n++])}i.length&&t.push({id:o,idTokenType:a,tokens:i})}return t}function ka(e=!0){return{root:null,meta:{incomplete:e,unresolved:[],orphaned:[],statementCount:0,errors:[]},stateDeclarations:{},queryStatements:[],mutationStatements:[]}}function Xu(e){if(!Dn(e))return[];let t=new Set;return Qr(e,n=>{n.k==="StateRef"&&t.add(n.n)}),[...t]}function Ps(e,t){if(t.k==="Comp"&&t.name===yn.Query){let n=Xu(t.args[1]);return{kind:"query",id:e.id,call:{callee:yn.Query,args:t.args},expr:t,deps:n.length>0?n:void 0}}return t.k==="Comp"&&t.name===yn.Mutation?{kind:"mutation",id:e.id,call:{callee:yn.Mutation,args:t.args},expr:t}:e.idTokenType===T.StateVar?{kind:"state",id:e.id,init:t}:{kind:"value",id:e.id,expr:t}}function eh(e,t,n){let r={},o=[],a=[];for(let i of e)switch(i.kind){case"state":r[i.id]=Fn(i.init,t);break;case"query":vs(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":vs(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 Xu(c))p===n?.name&&n.stmts.has(i)||p in r||(r[p]=null)}return{stateDeclarations:r,queryStatements:o,mutationStatements:a}}var Ku="root";function Ss(e){return e?.k==="Comp"&&!e.fn&&!Jr(e.name)&&!dr(e.name)}function th(e,t){if(e.has(Ku))return{id:Ku,fallback:!1};for(let n of e.values())if(n.kind==="value"&&Ss(n.expr)&&n.expr.name===t)return{id:n.id,fallback:!0};return null}function nh(e,t){let n=new Set;for(;e?.k==="Ref"&&!n.has(e.n);)n.add(e.n),e=t.get(e.n);return Ss(e)}function rh(e){let t=!1;return Qr(e,n=>{Ss(n)&&(t=!0)}),t}function Sa(e,t,n,r,o,a,i){let s=th(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=Fn(c.get(s.id),u);Qt(h)?(f=h,f.statementId=s.id):Dn(h)&&rh(h)&&(m=h)}let{stateDeclarations:v,queryStatements:y,mutationStatements:x}=eh(t,u,i);u.currentStatementId=s?.id;let S=a??"";s?!f&&!m&&!nh(c.get(s.id),c)?Ge(u,S,"",{code:"no-root",reason:"not-component"}):s.fallback&&Ge(u,S,"",{code:"no-root",reason:f?"fallback":"missing"}):Ge(u,S,"",{code:"no-root",reason:"missing"});let w=s?[...d]:[];return{root:f,...m?{rootExpression:m}:{},meta:{incomplete:n,unresolved:p,orphaned:w,statementCount:r,errors:_},stateDeclarations:v,queryStatements:y,mutationStatements:x}}function Qu(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 oh(e){let t=[],n=0;for(;n<e.length;){let r=-1;for(;n<e.length;){let s=Qu(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=Qu(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 Qg(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 ah(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 Vu(e){return Qg(Kg(e.trim())).trim()}function Wu(e,t,n){let r=Vu(e);if(!r)return Pa();let{text:o,wasIncomplete:a}=ms(r),i=ba(_a(o));if(!i.length)return Pa(a);let s=new Map;for(let p of i){let _=pa(p.tokens),d=hs(p,_);s.set(p.id,d)}let c=[...s.values()];return ya(s,c,a,s.size,t,n)}function Gu(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 ba(_a(f))){let v=pa(m.tokens),x=hs(m,v);a.set(m.id,x),i++}}function c(){let u=Vu(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,x=o;for(let P=o;P<r.length;P++){let k=r[P];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=P+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(x,P).trim();h&&s(h),x=P+1,o=P+1}}return x}function _(u=!1){c();let f=p(),m=r.slice(f).trim();if(!m)return i===0?Pa():ya(a,[...a.values()],!1,i,e,t);let{text:v,wasIncomplete:x}=ms(m),P=ba(_a(v));if(!P.length)return i===0?Pa(x):ya(a,[...a.values()],x,i,e,t);let k=new Map(a),T=new Set;for(let w of P){if(a.has(w.id)&&x)continue;let C=pa(w.tokens),E=hs(w,C);k.set(w.id,E),T.add(E)}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 ya(k,S,x,i+P.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 vs(e,t){if(!e||typeof e!="object")return e;let n=e.$ref;if(typeof n=="string")return t.has(n)?vs(t.get(n),t):e;let r=Array.isArray(e)?[...e]:{...e},o=!1;for(let[a,i]of Object.entries(r))r[a]=vs(i,t),o||(o=r[a]!==i);return o?r:e}function gs(e,t){let n=e.properties??{},r=e.required??[];return Object.keys(n).map(o=>({name:o,required:r.includes(o),defaultValue:ma(n[o]),schema:t.size?vs(n[o],t):n[o]}))}function Ku(e){let t=new Map,n=e.properties&&new Set(Object.keys(e.properties)),r=new Map;for(let o of[...Object.keys(Iu),...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:gs(a,r)});t.callDefs=new Map(ua);for(let[o,a]of Object.entries(e.functions??{}))t.callDefs.set(o,{kind:"function",params:gs(a.params,r)});for(let[o,a]of Object.entries(e.actions??{}))t.callDefs.set(o,{kind:"action",params:gs(a.params,r)});return t}var Qu=Ku(sr.schema),Xg={parse(e){return Wu(e,Qu,sr.root)}};function Xu(){return Gu(Qu,sr.root)}function ys(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(!Kt(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 x=(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,P=x?{...f,props:{...f.props,children:x}}:f;if(!Tu(P)){i(f,"","Component does not match the catalog");return}if(P.typeName==="Table"&&P.props.rows.some(k=>k.length!==P.props.columns.length)){i(f,"/rows","Every table row must contain one value per column");return}if(x?.length!==0&&!((P.typeName==="Chart"||P.typeName==="Table")&&(t||e.meta.incomplete)))return P}let c=e.root,p=c&&Array.isArray(n)?n.flatMap((f,m)=>{if(Kt(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!==sr.root&&i(c,"","The block must use the catalog root component");let d=_||c!==null&&c.typeName!==sr.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 Ju(e){return ys(Xg.parse(e),!1).elements.flatMap(Yu).join(`
42
+ `)}function Ju(e){return ah(oh(e.trim())).trim()}function Yu(e,t,n){let r=Ju(e);if(!r)return ka();let{text:o,wasIncomplete:a}=bs(r),i=xa(ga(o));if(!i.length)return ka(a);let s=new Map;for(let p of i){let _=ma(p.tokens),d=Ps(p,_);s.set(p.id,d)}let c=[...s.values()];return Sa(s,c,a,s.size,t,n)}function Zu(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 xa(ga(f))){let v=ma(m.tokens),y=Ps(m,v);a.set(m.id,y),i++}}function c(){let u=Ju(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,y=o;for(let x=o;x<r.length;x++){let S=r[x];if(v){v=!1;continue}if(S==="\\"&&m){v=!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 h=r.slice(y,x).trim();h&&s(h),y=x+1,o=x+1}}return y}function _(u=!1){c();let f=p(),m=r.slice(f).trim();if(!m)return i===0?ka():Sa(a,[...a.values()],!1,i,e,t);let{text:v,wasIncomplete:y}=bs(m),x=xa(ga(v));if(!x.length)return i===0?ka(y):Sa(a,[...a.values()],y,i,e,t);let S=new Map(a),w=new Set;for(let k of x){if(a.has(k.id)&&y)continue;let E=ma(k.tokens),R=Ps(k,E);S.set(k.id,R),w.add(R)}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,b=[...S.values()];return Sa(S,b,y,i+x.length,e,t,g?{name:g,stmts:w}: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 xs(e,t){if(!e||typeof e!="object")return e;let n=e.$ref;if(typeof n=="string")return t.has(n)?xs(t.get(n),t):e;let r=Array.isArray(e)?[...e]:{...e},o=!1;for(let[a,i]of Object.entries(r))r[a]=xs(i,t),o||(o=r[a]!==i);return o?r:e}function ys(e,t){let n=e.properties??{},r=e.required??[];return Object.keys(n).map(o=>({name:o,required:r.includes(o),defaultValue:va(n[o]),schema:t.size?xs(n[o],t):n[o]}))}function ed(e){let t=new Map,n=e.properties&&new Set(Object.keys(e.properties)),r=new Map;for(let o of[...Object.keys(Ou),...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:ys(a,r)});t.callDefs=new Map(_a);for(let[o,a]of Object.entries(e.functions??{}))t.callDefs.set(o,{kind:"function",params:ys(a.params,r)});for(let[o,a]of Object.entries(e.actions??{}))t.callDefs.set(o,{kind:"action",params:ys(a.params,r)});return t}var td=ed(ur.schema),ih={parse(e){return Yu(e,td,ur.root)}};function nd(){return Zu(td,ur.root)}function ks(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(!Qt(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(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 h=s(S,f,w);return h?[h]:[]}):void 0,x=y?{...f,props:{...f.props,children:y}}:f;if(!Nu(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(Qt(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!==ur.root&&i(c,"","The block must use the catalog root component");let d=_||c!==null&&c.typeName!==ur.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 rd(e){return ks(ih.parse(e),!1).elements.flatMap(od).join(`
45
45
 
46
- `)}function Yu(e){return e.typeName==="Grid"||e.typeName==="Cell"?e.props.children.flatMap(Yu):e.typeName==="Text"?[e.props.text]:e.typeName==="Card"?[`${e.props.title}
46
+ `)}function od(e){return e.typeName==="Grid"||e.typeName==="Cell"?e.props.children.flatMap(od):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 xs(e,{cssPrefix:t,strings:n}){let r=[],o;return{...Gr(e),set_attr(a,i,s){if(i!==Vr||s!=="openui"||a.index!==1)return ss(a,i,s);let c=document.createElement("div");a.nodes[a.index]?.parentElement?.replaceWith(c),o={textSig:se(""),doneSig:se(!1)},r.push(c),gn(l(Yg,{cssPrefix:t,textSig:o.textSig,doneSig:o.doneSig,strings:n}),c)},add_text(a,i){o?o.textSig.value=o.textSig.peek()+i:is(a,i)},end_token(a){o&&(o.doneSig.value=!0,o=void 0),as(a)},finish(){o&&(o.doneSig.value=!0)},dispose(){for(let a of r)gn(null,a);r.length=0,o=void 0}}}function Yg({textSig:e,doneSig:t,cssPrefix:n,strings:r}){let o=ue(()=>{let a=Xu();return Se(()=>ys(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(Ps,{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 Ps({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(Ps,{element:r,cssPrefix:t},r.statementId)):l(Ps,{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 xa(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)+Ju(i.source)+(e[p-1]===`
50
+ `)]}function Cs(e,{cssPrefix:t,strings:n}){let r=[],o;return{...Gr(e),set_attr(a,i,s){if(i!==Vr||s!=="openui"||a.index!==1)return ds(a,i,s);let c=document.createElement("div");a.nodes[a.index]?.parentElement?.replaceWith(c),o={textSig:ie(""),doneSig:ie(!1)},r.push(c),vn(l(lh,{cssPrefix:t,textSig:o.textSig,doneSig:o.doneSig,strings:n}),c)},add_text(a,i){o?o.textSig.value=o.textSig.peek()+i:us(a,i)},end_token(a){o&&(o.doneSig.value=!0,o=void 0),cs(a)},finish(){o&&(o.doneSig.value=!0)},dispose(){for(let a of r)vn(null,a);r.length=0,o=void 0}}}function lh({textSig:e,doneSig:t,cssPrefix:n,strings:r}){let o=se(()=>{let a=nd();return he(()=>ks(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(ws,{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 ws({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(ws,{element:r,cssPrefix:t},r.statementId)):l(ws,{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(ch,{element:e,cssPrefix:t})}}function ch({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 wa(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)+rd(i.source)+(e[p-1]===`
51
51
  `?`
52
- `:""),n=p),i=void 0}let c=ir({data:void 0,add_token(p,_){a+=1,_===10&&a===1&&(i={start:o,source:"",language:""})},set_attr(p,_,d){i&&_===Vr&&(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++)Xe(c,e.charAt(r)),e[r]===`
53
- `&&(o=r+1);return Wr(c),i&&s(e.length),t+e.slice(n)}function Zu(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function eh(e){return`tool-${e.startsWith("tool:")?e.slice(5):e}`}function ed(e){return e.startsWith("tool-")?e.slice(5):e}var lt={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"},Ss="context";function Sa(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function td(e){if(!Sa(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 nd(e){if(!Sa(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 ka(e){let t=Sa(e)?e.suggestions:void 0;if(!Array.isArray(t))return[];let n=[];for(let r of t){if(!Sa(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 ks(e){let n={messages:e.messages.map(r=>({id:r.serverMessageId??r.id,parts:nh(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 th(e){return e.state==="output-available"||e.state==="output-error"||e.state==="output-denied"||e.approval?.approved!==void 0}function nh(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,filename:n.filename,fileId:n.fileId,fileSize:n.fileSize}),n.kind==="tool"&&th(n)){let r=n.dynamic?{type:"dynamic-tool",toolName:n.toolName,toolCallId:n.toolCallId,state:n.state}:{type:eh(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 Cs(e,t,n=Ct()){let r=e?[{kind:"text",id:"t0",textSig:se(e),doneSig:se(!0)}]:[];return{id:n,role:"user",createdAt:Date.now(),status:"complete",attachments:t,partsSig:se(r)}}function an(){return{id:Ct(),role:"assistant",createdAt:Date.now(),status:"streaming",partsSig:se([])}}function od(e){let t=Ct();return rh({id:t,role:e.role,createdAt:Date.now(),status:"complete",ephemeral:!0,parts:[{kind:"text",id:`${t}-t0`,text:e.text,done:!0}]})}function rh(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:se(e.parts.map(uh))}}function oh(e){return e.status==="failed"?"error":e.role==="assistant"&&e.status==="streaming"?"streaming":"complete"}function Ts(e){let t=new Set,n=e.parts.map((o,a)=>o.type==="text"?{kind:"text",id:`${e.id}-t${a}`,textSig:se(o.text),doneSig:se(!0)}:o.type==="reasoning"?{kind:"reasoning",id:`${e.id}-r${a}`,textSig:se(o.text),doneSig:se(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,filename:o.filename,fileId:o.fileId,fileSize:o.fileSize}: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:ed(o.type),dynamic:o.type==="dynamic-tool"?!0:void 0,toolMetadata:o.toolMetadata,inputPartialSig:se(""),inputSig:se(o.input),outputSig:se(o.output),errorSig:se(o.errorText),stateSig:se(o.state),approvalSig:se(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"?ka(r.data):void 0,serverMessageId:e.id,createdAt:Date.parse(e.createdAt),status:oh(e),canceled:e.status==="canceled",feedback:e.feedback??null,partsSig:se(n)}}function ah(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 ih(e){return e.role==="assistant"&&e.status==="streaming"&&ah(e)}function bn(e){let t=e.length-1;return e.filter((n,r)=>r===t||!ih(n)).map(Ts)}function ad(e,t){let n=!t&&e.at(-1)?.role==="assistant"?-2:-1,r=e.at(n);return!r||r.ephemeral?[]:[r]}function Rs(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(dh)}}function Ve(e){let t="";for(let n of e.partsSig.value)n.kind==="text"&&(t+=n.textSig.value);return t}function wa(e,t,n,r,o,a=t.createdAt){let i=e.find(_=>_.role==="user"&&!_.ephemeral);function s(_,d){return(_.role==="assistant"?xa(Ve(_)):Ve(_)).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 Vt(e){return Ve(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file"||t.kind==="source")}function sh(e){return Ve(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file")}function Is(e){return e==="approval-responded"||e==="output-available"||e==="output-denied"||e==="output-error"}function cr(e){return e.kind==="tool"}function id(e){return e.kind==="text"&&e.textSig.value.trim()!==""||e.kind==="file"}function eo(e){let t=e.partsSig.value,n=t.findLastIndex(r=>r.kind==="tool");return t.slice(n+1).some(id)}function Fn(e){if(e.role!=="assistant")return!1;let t=e.partsSig.value.filter(cr);return t.length>0&&t.every(n=>Is(n.stateSig.value))}function Bn(e){return e.role!=="assistant"?!1:e.partsSig.value.some(t=>t.kind==="tool")&&!eo(e)}function Ca(e,t){return!e.partsSig.value.slice(t+1).some(n=>n.kind==="step-start"||id(n))}function Ta(e){return e.partsSig.value.some(t=>cr(t)&&!Is(t.stateSig.value))}function sd(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 $n(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 ld(e,t,n,r){if(!Es(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&&Ve(s).length>=Ve(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&&Ve(i).length>=Ve(e).length)}function Es(e){return e?.role==="assistant"&&e.status==="streaming"&&e.serverMessageId===void 0}function lh(e,t){let n=new Map(t.partsSig.value.filter(cr).filter(a=>Is(a.stateSig.value)).map(a=>[a.toolCallId,a]));if(n.size===0)return;let r=!1,o=e.partsSig.value.map(a=>{if(!cr(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,f=a.toolMetadata??i.toolMetadata;return p===a.approvalSig&&_===a.inputSig&&d===a.toolName&&u===a.dynamic&&f===a.toolMetadata?a:(r=!0,{...a,toolName:d,dynamic:u,toolMetadata:f,inputSig:_,approvalSig:p})});r&&(e.partsSig.value=o)}function As(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||Vt(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")?$n(u,d):u.status==="streaming"||Ve(u).length>=Ve(d).length?(lh(u,d),u.suggestions??(u.suggestions=d.suggestions),u.feedback===void 0&&(u.feedback=d.feedback),d.canceled&&(u.canceled=!0),u):$n(u,d))}),s=n.filter(d=>!o.has(d)),c=s.findLast(Es),p=new Map;e.forEach((d,u)=>{p.set(d.id,u),d.serverMessageId!==void 0&&p.set(d.serverMessageId,u)});let _=ld(c,c?n.slice(0,n.indexOf(c)):[],a,p);if(c&&_){let d=i.indexOf(_);d>=0&&(i[d]=$n(c,_)),s=s.filter(u=>u!==c)}return[...i,...s]}function to(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,$n(d,u);if(d.serverMessageId===void 0)return d;let f=Ve(u),m=Ve(d),v=u.status!=="streaming"&&f.length>=m.length&&ws(d,u);if(f.length>m.length||f===m&&u.partsSig.value.length>d.partsSig.value.length||v)return a=!0,$n(d,u);if(d.status==="streaming"&&u.status!=="streaming"&&ch(d,u)){if(d.continuationStreaming&&Ta(u))return d;if(!ws(u,d))return a=!0,$n(d,u)}return d}),s=[...n.values()].filter(d=>!o.has(d.serverMessageId)),c=i.findLastIndex(Es),p=i[c],_=ld(p,i.slice(0,c),s,r);if(p!==void 0&&_!==void 0&&Ve(_).length>=Ve(p).length&&($n(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 x=r.get(v.serverMessageId??v.id);return u===void 0?!1:x===void 0?f:x>u?!0:(f=!0,!1)});m===-1?i.push(d):i.splice(m,0,d)}return{messages:i,changed:!0}}function cd(e,t){if(e.role!==t.role)return!1;let n=Ve(t),r=Ve(e);return n.length>r.length||t.partsSig.value.length>e.partsSig.value.length||ws(e,t)}function ch(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&&Ra(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 Ra(e,t){let n=e.startsWith("tool:")?e.slice(5):e,r=t.startsWith("tool:")?t.slice(5):t;return n===r}var rd={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function ws(e,t){let n=new Map(e.partsSig.value.filter(cr).map(r=>[r.toolCallId,r]));return t.partsSig.value.filter(cr).some(r=>{let o=n.get(r.toolCallId);if(!o||rd[r.stateSig.value]>rd[o.stateSig.value])return!0;let a=r.approvalSig.value?.approved;return a!==void 0&&a!==o.approvalSig.value?.approved})}function Dn(e){return e.role==="assistant"&&e.status!=="streaming"&&!Vt(e)}function Ia(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"&&!Dn(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 ud(e){return e.canceled===!0&&e.role==="assistant"&&e.status!=="streaming"&&!sh(e)}function dd(e,t){return e.operatorRoutedTurn?Dn(e)?"drop":"complete-operator-routed":t||Dn(e)?"error":"complete"}function uh(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,textSig:se(e.text),doneSig:se(e.done)}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,dynamic:e.dynamic,toolMetadata:e.toolMetadata,inputPartialSig:se(e.inputPartial),inputSig:se(e.input),outputSig:se(e.output),errorSig:se(e.error),stateSig:se(e.state),approvalSig:se(e.approval)}:e}function dh(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 Un(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 ph(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 pd(e){return e&&Object.keys(e).length>0?e:void 0}function Ms(e,t,n=[]){let r=pd(e),o=pd(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=ph(JSON.stringify({...r&&{user:r},...c&&{page:c}}));if(p.length<=8192||i===0)return p}}var ct=class extends Error{constructor(n,r,o,a){super(n);re(this,"code",r);re(this,"status",o);re(this,"cause",a);this.name="StreamError"}};var _d=le.scope("parser");async function*fd(e,t,n){if(!e.ok){let r=await e.text().catch(()=>"");throw new ct(`server responded ${e.status}: ${r.slice(0,200)}`,"server",e.status)}for await(let r of _h(e,t)){let o=fh(r,n);if(o==="done")return;o&&(yield o)}}async function*_h(e,t){if(!e.body)throw new ct("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=cr({data:void 0,add_token(p,_){a+=1,_===10&&a===1&&(i={start:o,source:"",language:""})},set_attr(p,_,d){i&&_===Vr&&(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++)et(c,e.charAt(r)),e[r]===`
53
+ `&&(o=r+1);return Wr(c),i&&s(e.length),t+e.slice(n)}function ad(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function uh(e){return`tool-${e.startsWith("tool:")?e.slice(5):e}`}function id(e){return e.startsWith("tool-")?e.slice(5):e}var dt={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"},Ts="context";function Ca(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function sd(e){if(!Ca(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 ld(e){if(!Ca(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 Ta(e){let t=Ca(e)?e.suggestions:void 0;if(!Array.isArray(t))return[];let n=[];for(let r of t){if(!Ca(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:ph(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 dh(e){return e.state==="output-available"||e.state==="output-error"||e.state==="output-denied"||e.approval?.approved!==void 0}function ph(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,filename:n.filename,fileId:n.fileId,fileSize:n.fileSize}),n.kind==="tool"&&dh(n)){let r=n.dynamic?{type:"dynamic-tool",toolName:n.toolName,toolCallId:n.toolCallId,state:n.state}:{type:uh(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 As(e,t,n=Ct()){let r=e?[{kind:"text",id:"t0",textSig:ie(e),doneSig:ie(!0)}]:[];return{id:n,role:"user",createdAt:Date.now(),status:"complete",attachments:t,partsSig:ie(r)}}function sn(){return{id:Ct(),role:"assistant",createdAt:Date.now(),status:"streaming",partsSig:ie([])}}function dd(e){let t=Ct();return _h({id:t,role:e.role,createdAt:Date.now(),status:"complete",ephemeral:!0,parts:[{kind:"text",id:`${t}-t0`,text:e.text,done:!0}]})}function _h(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:ie(e.parts.map(yh))}}function fh(e){return e.status==="failed"?"error":e.role==="assistant"&&e.status==="streaming"?"streaming":"complete"}function Es(e){let t=new Set,n=e.parts.map((o,a)=>o.type==="text"?{kind:"text",id:`${e.id}-t${a}`,textSig:ie(o.text),doneSig:ie(!0)}:o.type==="reasoning"?{kind:"reasoning",id:`${e.id}-r${a}`,textSig:ie(o.text),doneSig:ie(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,filename:o.filename,fileId:o.fileId,fileSize:o.fileSize}: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:id(o.type),dynamic:o.type==="dynamic-tool"?!0:void 0,toolMetadata:o.toolMetadata,inputPartialSig:ie(""),inputSig:ie(o.input),outputSig:ie(o.output),errorSig:ie(o.errorText),stateSig:ie(o.state),approvalSig:ie(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"?Ta(r.data):void 0,serverMessageId:e.id,createdAt:Date.parse(e.createdAt),status:fh(e),canceled:e.status==="canceled",feedback:e.feedback??null,stepTimings:Ra(e.metadata?.steps),partsSig:ie(n)}}function Ra(e){if(!(!e?.length||!e.every(t=>cd(t.durationMs))))return e.map(({durationMs:t,reasoningMs:n})=>({durationMs:Number(t),...cd(n)?{reasoningMs:n}:{}}))}function cd(e){return typeof e=="number"&&Number.isFinite(e)}function mh(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 gh(e){return e.role==="assistant"&&e.status==="streaming"&&mh(e)}function Pn(e){let t=e.length-1;return e.filter((n,r)=>r===t||!gh(n)).map(Es)}function pd(e,t){let n=!t&&e.at(-1)?.role==="assistant"?-2:-1,r=e.at(n);return!r||r.ephemeral?[]:[r]}function Ms(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(Ph)}}function Je(e){let t="";for(let n of e.partsSig.value)n.kind==="text"&&(t+=n.textSig.value);return t}function Ia(e,t,n,r,o,a=t.createdAt){let i=e.find(_=>_.role==="user"&&!_.ephemeral);function s(_,d){return(_.role==="assistant"?wa(Je(_)):Je(_)).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 Vt(e){return Je(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file"||t.kind==="source")}function Ns(e){return Je(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 an(e){return e.kind==="tool"}function _d(e){return e.kind==="text"&&e.textSig.value.trim()!==""||e.kind==="file"}function eo(e){let t=e.partsSig.value,n=t.findLastIndex(r=>r.kind==="tool");return t.slice(n+1).some(_d)}function qn(e){if(e.role!=="assistant")return!1;let t=e.partsSig.value.filter(an);return t.length>0&&t.every(n=>Ls(n.stateSig.value))}function Hn(e){return e.role!=="assistant"?!1:e.partsSig.value.some(t=>t.kind==="tool")&&!eo(e)}function Aa(e,t){return!e.partsSig.value.slice(t+1).some(n=>n.kind==="step-start"||_d(n))}function Ea(e){return e.partsSig.value.some(t=>an(t)&&!Ls(t.stateSig.value))}function fd(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 Bn(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 md(e,t,n,r){if(!Os(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&&Je(s).length>=Je(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&&Je(i).length>=Je(e).length)}function Os(e){return e?.role==="assistant"&&e.status==="streaming"&&e.serverMessageId===void 0}function hh(e,t){let n=e.partsSig.value,r=t.partsSig.value,o=new Map(r.flatMap((c,p)=>an(c)?[[c.toolCallId,p]]:[])),a=n.findIndex(c=>an(c)&&o.has(c.toolCallId)),i=n[a];if(i===void 0||!an(i))return;let s=(o.get(i.toolCallId)??0)-a;s>0&&(e.partsSig.value=[...r.slice(0,s),...n])}function vh(e,t){let n=new Map(t.partsSig.value.filter(an).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(!an(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,f=a.toolMetadata??i.toolMetadata;return p===a.approvalSig&&_===a.inputSig&&d===a.toolName&&u===a.dynamic&&f===a.toolMetadata?a:(r=!0,{...a,toolName:d,dynamic:u,toolMetadata:f,inputSig:_,approvalSig:p})});r&&(e.partsSig.value=o)}function $s(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||Vt(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")?Bn(u,d):u.status==="streaming"||Je(u).length>=Je(d).length?(hh(u,d),vh(u,d),d.stepTimings&&(u.stepTimings=d.stepTimings),u.suggestions??(u.suggestions=d.suggestions),u.feedback===void 0&&(u.feedback=d.feedback),d.canceled&&(u.canceled=!0),u):Bn(u,d))}),s=n.filter(d=>!o.has(d)),c=s.findLast(Os),p=new Map;e.forEach((d,u)=>{p.set(d.id,u),d.serverMessageId!==void 0&&p.set(d.serverMessageId,u)});let _=md(c,c?n.slice(0,n.indexOf(c)):[],a,p);if(c&&_){let d=i.indexOf(_);d>=0&&(i[d]=Bn(c,_)),s=s.filter(u=>u!==c)}return[...i,...s]}function to(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,Bn(d,u);if(d.serverMessageId===void 0)return d;let f=Je(u),m=Je(d),v=u.status!=="streaming"&&f.length>=m.length&&Is(d,u);if(f.length>m.length||f===m&&u.partsSig.value.length>d.partsSig.value.length||v)return a=!0,Bn(d,u);if((u.stepTimings?.length??0)>(d.stepTimings?.length??0)&&(d.stepTimings=u.stepTimings,a=!0),d.status==="streaming"&&u.status!=="streaming"&&bh(d,u)){if(d.continuationStreaming&&Ea(u))return d;if(!Is(u,d))return a=!0,Bn(d,u)}return d}),s=[...n.values()].filter(d=>!o.has(d.serverMessageId)),c=i.findLastIndex(Os),p=i[c],_=md(p,i.slice(0,c),s,r);if(p!==void 0&&_!==void 0&&Je(_).length>=Je(p).length&&(Bn(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 y=r.get(v.serverMessageId??v.id);return u===void 0?!1:y===void 0?f:y>u?!0:(f=!0,!1)});m===-1?i.push(d):i.splice(m,0,d)}return{messages:i,changed:!0}}function gd(e,t){if(e.role!==t.role)return!1;let n=Je(t),r=Je(e);return n.length>r.length||t.partsSig.value.length>e.partsSig.value.length||Is(e,t)}function bh(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&&Ma(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 Ma(e,t){let n=e.startsWith("tool:")?e.slice(5):e,r=t.startsWith("tool:")?t.slice(5):t;return n===r}var ud={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function Is(e,t){let n=new Map(e.partsSig.value.filter(an).map(r=>[r.toolCallId,r]));return t.partsSig.value.filter(an).some(r=>{let o=n.get(r.toolCallId);if(!o||ud[r.stateSig.value]>ud[o.stateSig.value])return!0;let a=r.approvalSig.value?.approved;return a!==void 0&&a!==o.approvalSig.value?.approved})}function Un(e){return e.role==="assistant"&&e.status!=="streaming"&&e.canceled!==!0&&!Vt(e)}function Na(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"&&!Un(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 hd(e,t){return e.canceled===!0&&e.role==="assistant"&&e.status!=="streaming"&&!Ns(e)&&!t}function vd(e,t){return e.operatorRoutedTurn?Un(e)?"drop":"complete-operator-routed":t||Un(e)?"error":"complete"}function yh(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,textSig:ie(e.text),doneSig:ie(e.done)}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,dynamic:e.dynamic,toolMetadata:e.toolMetadata,inputPartialSig:ie(e.inputPartial),inputSig:ie(e.input),outputSig:ie(e.output),errorSig:ie(e.error),stateSig:ie(e.state),approvalSig:ie(e.approval)}:e}function Ph(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 zn(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 xh(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 bd(e){return e&&Object.keys(e).length>0?e:void 0}function Ds(e,t,n=[]){let r=bd(e),o=bd(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=xh(JSON.stringify({...r&&{user:r},...c&&{page:c}}));if(p.length<=8192||i===0)return p}}var pt=class extends Error{constructor(n,r,o,a,i){super(n);ee(this,"code",r);ee(this,"status",o);ee(this,"cause",a);ee(this,"retryAfterSeconds",i);this.name="StreamError"}};var yd=ce.scope("parser");async function*Pd(e,t,n){if(!e.ok){let r=await e.text().catch(()=>"");throw new pt(`server responded ${e.status}: ${r.slice(0,200)}`,"server",e.status)}for await(let r of Sh(e,t)){let o=kh(r,n);if(o==="done")return;o&&(yield o)}}async function*Sh(e,t){if(!e.body)throw new pt("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 fh(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 kh(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 _d.trace("chunk",{type:o.type,eventId:r}),{chunk:o,eventId:r}}catch(o){throw _d.trace("frame parse failed",{errorType:o instanceof Error?o.name:typeof o,payloadLength:n.length}),new ct("invalid SSE frame","network",void 0,o)}}var Ae=le.scope("transport"),mh="x-user-token",md=6e4,gh=1e4,Ns=50,yd=new WeakMap;function ur(e){return yd.get(e)}function no(e,t){return yd.set(e,t),e}function gd(e){return Math.max(e?.upsertRevision??0,e?.read?.revision??0)}function hh(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 sn(e,t,n=!0){switch(t.type){case"snapshot":{let r=new Map(e.map(i=>[i.conversationId,i])),o=e.filter(i=>(ur(i)?.activityRevision??0)>t.requestedRevision).toSorted((i,s)=>ur(s).activityRevision-ur(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=ur(s);return(c?.upsertRevision??0)>t.requestedRevision?s:c?.read&&!s.hasUnread&&c.read.lastMessageAt===i.lastMessageAt?no({...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=ur(o);if(gd(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?no({...c,hasUnread:!1},s):c):(no(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?ur(o):void 0;if(gd(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&&hh(o,c)?(no(o,s),e):(no(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 hd=3,vh=400,bh=3e4,yh=6e4,Ph=1e4,xh=6e4,Sh=15e3,kh=1024*1024,vd=new Set([408,425,429,500,502,503,504]);function bd(e){return vh*2**e+Math.floor(Math.random()*250)}function wh(e){return xh+Math.ceil(e/kh)*Sh}function Ch(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 ro=class{constructor(t){re(this,"ttlMs",t);re(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)}},Ea=class{constructor(t){re(this,"opts",t);re(this,"conversationListeners",new Set);re(this,"conversationRevision",0);re(this,"visitorId");re(this,"conversationId");re(this,"userContext");re(this,"pageContext");re(this,"locale");re(this,"userTokenSource");re(this,"userToken");re(this,"userTokenRequest");re(this,"conversationsCache",new ro(gh));re(this,"contentCache",new ro(md));re(this,"contentCollectionsCache",new ro(md))}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:Wo};this.visitorId&&(t.visitorId=this.visitorId),this.conversationId&&(t.conversationId=this.conversationId),this.locale&&(t.locale=this.locale);let n=Ms(this.userContext,this.pageContext);return n&&(t[Ss]=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){Ae.debug("handshake \u2192",{visitorId:t.visitorId,conversationId:t.conversationId,locale:t.locale}),this.userTokenRequest&&await this.userTokenRequest;let n=await this.postJson(lt.handshake,t,"handshake");return Ae.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){Ae.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,wh(t.size));return Ae.debug("uploadFile \u2190",{id:o.id,url:o.url}),o}async transcribe(t,n="audio/webm"){Ae.debug("transcribe \u2192",{size:t.size,mimeType:n});let r=new FormData;r.append("audio",t,`voice.${Th(n)}`),r.append("mimeType",n);let o=await this.postForm(this.transcribePath,r,"transcribe");return Ae.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=sn(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(lt.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(lt.listMessages));a.searchParams.set("conversationId",t),a.searchParams.set("limit",String(Ns)),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=sn(o.conversations,r);return a===o.conversations?o:{...o,conversations:a}});for(let o of this.conversationListeners)o(r);try{await this.postJson(lt.markRead,{conversationId:t},"markRead",!0)}catch(o){Ae.debug("markRead failed (non-fatal)",{err:o})}}async requestOperator(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(lt.requestOperator,{},"requestOperator")).controlState}catch(t){Ae.debug("requestOperator failed (non-fatal)",{err:t});return}}async cancelOperatorRequest(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(lt.cancelOperatorRequest,{},"cancelOperatorRequest")).controlState}catch(t){Ae.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(lt.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=>Kl(a,this.locale))??[];return{...r,items:o}}async setContentVote(t){try{await this.postJson(this.dataUrl(lt.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(lt.contentCollections));return t.length&&n.searchParams.set("ids",t.join(",")),{items:(await this.getJson(n.toString(),"listContentCollections")).items?.map(o=>Ql(o,this.locale))??[]}}async bootstrap(t){let n=new URL(this.dataUrl(lt.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(lt.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??lt.submitForm}async submitForm(t){Ae.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){Ae.debug("submitForm failed (non-fatal)",{err:n})}}async submitFeedback(t){Ae.debug("submitFeedback \u2192",{messageId:t.messageId,value:t.value});try{await this.postJson(lt.messageFeedback,{messageId:t.messageId,set:{feedback:t.value}},"submitFeedback")}catch(n){Ae.debug("submitFeedback failed (non-fatal)",{err:n})}}async sendTurn(t,n={}){Ae.debug("message \u2192",{conversationId:t.conversationId,visitorId:t.visitorId,messageCount:t.messages.length});let r=JSON.stringify({...this.withEnvelope(t),[Ss]:Ms(this.userContext,this.pageContext,this.opts.recentHostEvents)}),o=n.keepalive===!0&&new Blob([r]).size<yh;try{return await this.runWithAbort(async a=>{let i=await this.withFreshUserToken(()=>this.fetchImpl(this.url(lt.streamMessage),{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json",...this.headersFor(this.url(lt.streamMessage))},body:r,keepalive:o,signal:a}));if(i.status!==202)throw new ct(`sendTurn failed: expected 202, received ${i.status}`,"server",i.status);let s;try{s=await i.json()}catch(c){throw a?.aborted?c:new ct("sendTurn failed: invalid acknowledgement","server",i.status,c)}if(!Rh(s))throw new ct("sendTurn failed: invalid acknowledgement","server",i.status);return s},void 0,bh)}catch(a){throw a instanceof ct?a:new ct("sendTurn failed: network error","network",void 0,a)}}cancelTurn(t,n){!this.visitorId||!t||!n||(Ae.debug("cancel stream",{conversationId:t,runId:n,visitorId:this.visitorId}),this.fetchImpl(this.url(lt.cancelStream),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.headersFor(this.url(lt.cancelStream))},body:JSON.stringify(this.withEnvelope({conversationId:t,runId:n})),keepalive:!0}).catch(r=>Ae.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(),Ph);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||Ae.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||vd.has(i.status)?(Ae.debug("resume-stream \u2192 transient response; reconnecting",{status:i.status}),"held"):(Ae.debug("resume-stream \u2192 endpoint unavailable",{status:i.status}),"unavailable");if(!i.body)return a(),Ae.debug("resume-stream \u2192 bodyless response; stopping",{status:i.status}),"unavailable";if(!(i.headers.get("content-type")??"").includes("text/event-stream"))return a(),Ae.debug("resume-stream \u2192 non-SSE response; stopping"),"unavailable";let s=!1;try{for await(let{chunk:c}of fd(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";Ae.debug("resume-stream segment dropped \u2014 reconnecting",{err:c})}finally{a()}return"held"}resumeUrl(){return this.withEnvelopeQuery(lt.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>=hd)throw new ct(`${n} failed: network error`,"network",void 0,i);Ae.debug("request network error \u2014 retrying",{label:n,attempt:r}),await Un(bd(r));continue}if(o.ok||!vd.has(o.status)||r>=hd)return o;let a=Ch(o.headers)??bd(r);Ae.debug("request retryable status \u2014 retrying",{label:n,status:o.status,attempt:r,wait:a}),await Un(a)}}async assertOk(t,n){if(!t.ok)throw new ct(`${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=>{Ae.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?{[mh]:this.userToken}:{}}}async withFreshUserToken(t){let n=await t();return n.status!==401||!this.userTokenSource?n:typeof this.userTokenSource!="function"?(Ae.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 Th(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 Rh(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 dr(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 Aa(e,t,n){return dr("close",e,t)?n.includes("close"):!1}function Pd(e,t){return e==="inline"&&t==="fullscreen"?"exit-fullscreen":"close"}function pr(e,t,n,r){let o={role:n,text:r};e.emit("message",o),t.onMessage?.(o)}function xd(e){let t=F(e);t.current=e;let n=F(null);return n.current??(n.current=Ih(t)),n.current}function Ih(e){let t=se(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||!Eh(u,_)||o(d)||!Ah(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 Eh(e,t){return e.kind==="after-messages"?t.messageCount()>=Number(e.param??0):e.kind==="page-area"?t.pageArea()===e.param:!0}function Ah(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 Sd(e){return Object.fromEntries(e.map(t=>[t,[]]))}function Ls(e,t,n){return e.includes(t)?t:e.includes(n)?n:e[0]??""}function kd(e,t,n){let r=[...new Set(t)],o=Ls(r,e,""),a=se({activeTab:o,stacks:Sd(r)});return{sig:a,reconcile(i,s){let c=[...new Set(i)],p=a.value,_=Ls(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:Ls(r,i,""),stacks:Sd(r)}}}}function wd(e){return e.stacks[e.activeTab]??[]}function Cd(e){return wd(e).at(-1)}function Td(e){return wd(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 Mh=900,Nh=640;function Os(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<Nh?"fullscreen":n>=(t.autoSizeBreakpoint??Mh)?"expanded":"normal"}function oo(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:Os(e.mode,e.size,t);return{panelOpen:a,panelSize:s}}function _r(){return typeof window>"u"?0:window.innerWidth}var ne={fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24"},ao=`${M.cssPrefix}-icon-dir`;function $s(){return l("svg",{...ne,"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",{...ne,"aria-hidden":"true",children:l("path",{d:"M18 6 6 18M6 6l12 12"})})}function Rd(){return l("svg",{...ne,"aria-hidden":"true",children:l("path",{d:"M12 5v14M5 12h14"})})}function Id(){return l("svg",{...ne,class:ao,"aria-hidden":"true",children:[l("path",{d:"m22 2-7 20-4-9-9-4Z"}),l("path",{d:"M22 2 11 13"})]})}function Ed(){return l("svg",{...ne,"aria-hidden":"true",children:l("path",{d:"M12 19V5M5 12l7-7 7 7"})})}function Ad(){return l("svg",{...ne,class:ao,"aria-hidden":"true",children:l("path",{d:"M3 20V4l18 8-18 8Z"})})}function fr(){return l("svg",{...ne,class:ao,"aria-hidden":"true",children:l("path",{d:"m9 18 6-6-6-6"})})}function Md(){return l("svg",{...ne,"aria-hidden":"true",children:l("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}function Nd(){return l("svg",{...ne,"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 Ld(){return l("svg",{...ne,"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 Od(){return l("svg",{...ne,"aria-hidden":"true",children:l("path",{d:"M3 8V3h5M21 8V3h-5M3 16v5h5M21 16v5h-5"})})}function $d(){return l("svg",{...ne,"aria-hidden":"true",children:l("path",{d:"M8 3v5H3M16 3v5h5M8 21v-5H3M16 21v-5h5"})})}function Dd(){return l("svg",{...ne,"aria-hidden":"true",children:l("path",{d:"M3 3h7v2H5v5H3zM21 3h-7v2h5v5h2zM3 21h7v-2H5v-5H3zM21 21h-7v-2h5v-5h2z"})})}function Fd(){return l("svg",{...ne,"aria-hidden":"true",children:l("path",{d:"M10 3v5H3M14 3v5h7M10 21v-5H3M14 21v-5h7"})})}function Bd(){return l("svg",{...ne,"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 Ud(){return l("svg",{...ne,"aria-hidden":"true",viewBox:"0 0 10 10",children:l("path",{d:"M9 1L1 9M9 5L5 9M9 9H9",strokeWidth:"1.5"})})}function qd(){return l("svg",{...ne,"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 Hd(){return l("svg",{...ne,"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 zd(){return l("svg",{...ne,"aria-hidden":"true",children:l("path",{d:"M11 5 6 9H2v6h4l5 4zM22 9l-6 6M16 9l6 6"})})}function jd(){return l("svg",{...ne,"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",{...ne,class:ao,"aria-hidden":"true",children:l("path",{d:"m5 6 6 6-6 6M13 6l6 6-6 6"})})}function qn(){return l("svg",{...ne,"aria-hidden":"true",children:l("path",{d:"M20 6 9 17l-5-5"})})}function Wd(){return l("svg",{...ne,"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 Gd(){return l("svg",{...ne,"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 io(){return l("svg",{...ne,class:ao,"aria-hidden":"true",children:l("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}function Kd(){return l("svg",{...ne,"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 ln(){return l("svg",{...ne,"aria-hidden":"true",children:l("path",{d:"m6 9 6 6 6-6"})})}function Na(){return l("svg",{...ne,"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 Lh(){return l("svg",{...ne,"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 Ds(){return l("svg",{...ne,"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 so(){return l("svg",{...ne,"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 Oh(){return l("svg",{...ne,"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 $h(){return l("svg",{...ne,"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 Fs(){return l("svg",{...ne,"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 Dh(){return l("svg",{...ne,"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 Bs(){return l("svg",{...ne,"aria-hidden":"true",children:[l("circle",{cx:"11",cy:"11",r:"7"}),l("path",{d:"m21 21-4.3-4.3"})]})}function Qd(){return l("svg",{...ne,"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 Xd(){return l("svg",{...ne,"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 La(){return l("svg",{...ne,"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 lo(){return l("svg",{...ne,"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 Jd(){return l("svg",{...ne,"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 Yd(){return l("svg",{...ne,"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 Zd(){return l("svg",{...ne,"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 Fh(){return l("svg",{...ne,"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 Bh(){return l("svg",{...ne,"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 Uh(){return l("svg",{...ne,"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 qh(){return l("svg",{...ne,"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 ep(){return l("svg",{...ne,"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 tp(){return l("svg",{...ne,"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 np(){return l("svg",{...ne,"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 Oa(){return l("svg",{...ne,"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 rp(){return l("svg",{...ne,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"M12 7v5l3 2"})]})}function mr(){return l("svg",{...ne,"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 gr(){return l("svg",{...ne,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"m15 9-6 6M9 9l6 6"})]})}var op={chat:$s,message:Ds,bubbles:lo,spark:Lh,wand:Oh,bot:$h,help:so,lifebuoy:Dh,headset:Fs,search:Fh,sparkles:Bh,concierge:Uh,wave:qh};var H=M.cssPrefix,N={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`,messageFile:`${H}-message-file`,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`,toolSteps:`${H}-tool-steps`,toolStep:`${H}-tool-step`,source:`${H}-source`,operatorRequest:`${H}-operator-request`,operatorBanner:`${H}-operator-banner`,cancelOperatorRequest:`${H}-cancel-operator-request`};function ut(e,t){return`${e}-${t}`}var $a=M.cssPrefix;function ap({onToggle:e,launcher:t,strings:n,leaving:r,edgeTab:o}){let a=t.variant!=="circle"&&!!t.label;return l("button",{type:"button",class:`${$a}-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":N.launcher,onClick:e,"aria-label":n.launcherOpen,children:[Hh(t.icon),a?l("span",{class:`${$a}-fab-label`,children:bt(n,t.label??"")}):null]})}function Hh(e){let t=op[e];return t?l(t,{}):l(zh,{source:e})}function zh({source:e}){return l("span",{ref:t=>{t&&jh(t,e)},"aria-hidden":"true"})}function jh(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 ip({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:`${$a}-callout`,role:"status","data-shape":e.shape,"data-position":Vh(e.position,t),"data-animated":e.animated?"true":void 0,"data-testid":N.callout,children:[l("span",{children:bt(n,e.text)}),l("button",{type:"button",class:`${$a}-callout-close`,onClick:o,"aria-label":r,title:r,"data-testid":N.calloutDismiss,children:l(Bt,{})})]}):null}function Vh(e,t){let n=t.endsWith("-right"),r=t.startsWith("bottom-");return e==="vertical"?r?"top":"bottom":n?"left":"right"}var Wh='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function Da(e){function t(n){if(n.key!=="Tab")return;let r=[...e.querySelectorAll(Wh)].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 yn=M.cssPrefix;function Fa({title:e,actions:t}){return l("header",{class:`${yn}-back-header`,part:"header","data-variant":"title",children:[l("span",{class:`${yn}-back-spacer`,"aria-hidden":"true"}),l("h1",{class:`${yn}-back-title`,children:e}),t??l("span",{class:`${yn}-back-spacer`,"aria-hidden":"true"})]})}function Ba({title:e,backLabel:t,onBack:n,actions:r,testid:o}){return l("header",{class:`${yn}-back-header`,part:"header","data-testid":o,children:[l("button",{type:"button",class:`${yn}-icon-btn`,onClick:n,"aria-label":t,title:t,children:l(io,{})}),l("h1",{class:`${yn}-back-title`,children:e}),r??l("span",{class:`${yn}-back-spacer`,"aria-hidden":"true"})]})}function hr({textSig:e,doneSig:t,generativeUi:n=!1,strings:r=Bo}){let o=F(null);return Tt(()=>{let a=o.current;if(!a)return;a.classList.add(`${M.cssPrefix}-md`),a.replaceChildren();let i=n?xs(a,{cssPrefix:M.cssPrefix,strings:r}):void 0,s=ir(i??Gr(a)),c=0,p=jt(()=>{let u=e.value,f=t.value;u.length<c&&(i?.dispose(),a.replaceChildren(),i=n?xs(a,{cssPrefix:M.cssPrefix,strings:r}):void 0,s=ir(i??Gr(a)),c=0);let m=u.slice(c);m&&Xe(s,m),c=u.length,f&&(Wr(s),i?.finish())}),_=new MutationObserver(()=>sp(a));_.observe(a,{childList:!0,subtree:!0}),sp(a);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 cp({text:e}){let t=ue(()=>se(e),[e]),n=ue(()=>se(!0),[]);return l(hr,{textSig:t,doneSig:n})}var rv=/<(\/?)(?:(Note|Info|Tip|Warning|Danger|Check|Callout)|Tabs?|Steps?|AccordionGroup|Accordion|Expandable|Columns|CardGroup|Card|Frame|CodeGroup|Badge|Icon|Video|Embed|ParamField|ResponseField)\b((?:"[^"]*"|'[^']*'|[^>"'])*?)(\/?)>|(^|\n)([ \t]*)(```[^]*?(?:\n[ \t]*```|$))?/g;function up(e){let t=0,n="";return e.replace(rv,(r,o,a,i,s,c,p,_)=>{if(o===void 0)return t?c+(_?.split(`
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 yd.trace("chunk",{type:o.type,eventId:r}),{chunk:o,eventId:r}}catch(o){throw yd.trace("frame parse failed",{errorType:o instanceof Error?o.name:typeof o,payloadLength:n.length}),new pt("invalid SSE frame","network",void 0,o)}}var De=ce.scope("transport"),wh="x-user-token",xd=6e4,Ch=1e4,Fs=50,Td=new WeakMap;function pr(e){return Td.get(e)}function no(e,t){return Td.set(e,t),e}function Sd(e){return Math.max(e?.upsertRevision??0,e?.read?.revision??0)}function Th(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 ln(e,t,n=!0){switch(t.type){case"snapshot":{let r=new Map(e.map(i=>[i.conversationId,i])),o=e.filter(i=>(pr(i)?.activityRevision??0)>t.requestedRevision).toSorted((i,s)=>pr(s).activityRevision-pr(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=pr(s);return(c?.upsertRevision??0)>t.requestedRevision?s:c?.read&&!s.hasUnread&&c.read.lastMessageAt===i.lastMessageAt?no({...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=pr(o);if(Sd(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?no({...c,hasUnread:!1},s):c):(no(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?pr(o):void 0;if(Sd(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&&Th(o,c)?(no(o,s),e):(no(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 kd=3,Rh=400,Ih=3e4,Ah=6e4,Eh=1e4,Mh=6e4,Nh=15e3,Lh=1024*1024,wd=new Set([408,425,429,500,502,503,504]);function Cd(e){return Rh*2**e+Math.floor(Math.random()*250)}function Oh(e){return Mh+Math.ceil(e/Lh)*Nh}function $h(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 ro=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)}},La=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 ro(Ch));ee(this,"contentCache",new ro(xd));ee(this,"contentCollectionsCache",new ro(xd))}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:Qo};this.visitorId&&(t.visitorId=this.visitorId),this.conversationId&&(t.conversationId=this.conversationId),this.locale&&(t.locale=this.locale);let n=Ds(this.userContext,this.pageContext);return n&&(t[Ts]=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){De.debug("handshake \u2192",{visitorId:t.visitorId,conversationId:t.conversationId,locale:t.locale}),this.userTokenRequest&&await this.userTokenRequest;let n=await this.postJson(dt.handshake,t,"handshake");return De.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){De.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,Oh(t.size));return De.debug("uploadFile \u2190",{id:o.id,url:o.url}),o}async transcribe(t,n="audio/webm"){De.debug("transcribe \u2192",{size:t.size,mimeType:n});let r=new FormData;r.append("audio",t,`voice.${Dh(n)}`),r.append("mimeType",n);let o=await this.postForm(this.transcribePath,r,"transcribe");return De.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=ln(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(dt.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(dt.listMessages));a.searchParams.set("conversationId",t),a.searchParams.set("limit",String(Fs)),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=ln(o.conversations,r);return a===o.conversations?o:{...o,conversations:a}});for(let o of this.conversationListeners)o(r);try{await this.postJson(dt.markRead,{conversationId:t},"markRead",!0)}catch(o){De.debug("markRead failed (non-fatal)",{err:o})}}async requestOperator(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(dt.requestOperator,{},"requestOperator")).controlState}catch(t){De.debug("requestOperator failed (non-fatal)",{err:t});return}}async cancelOperatorRequest(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(dt.cancelOperatorRequest,{},"cancelOperatorRequest")).controlState}catch(t){De.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(dt.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=>ec(a,this.locale))??[];return{...r,items:o}}async setContentVote(t){try{await this.postJson(this.dataUrl(dt.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(dt.contentCollections));return t.length&&n.searchParams.set("ids",t.join(",")),{items:(await this.getJson(n.toString(),"listContentCollections")).items?.map(o=>tc(o,this.locale))??[]}}async bootstrap(t){let n=new URL(this.dataUrl(dt.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(dt.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??dt.submitForm}async submitForm(t){De.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){De.debug("submitForm failed (non-fatal)",{err:n})}}async submitFeedback(t){De.debug("submitFeedback \u2192",{messageId:t.messageId,value:t.value});try{await this.postJson(dt.messageFeedback,{messageId:t.messageId,set:{feedback:t.value}},"submitFeedback")}catch(n){De.debug("submitFeedback failed (non-fatal)",{err:n})}}async sendTurn(t,n={}){De.debug("message \u2192",{conversationId:t.conversationId,visitorId:t.visitorId,messageCount:t.messages.length});let r=JSON.stringify({...this.withEnvelope(t),[Ts]:Ds(this.userContext,this.pageContext,this.opts.recentHostEvents)}),o=n.keepalive===!0&&new Blob([r]).size<Ah;try{return await this.runWithAbort(async a=>{let i=await this.withFreshUserToken(()=>this.fetchImpl(this.url(dt.streamMessage),{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json",...this.headersFor(this.url(dt.streamMessage))},body:r,keepalive:o,signal:a}));if(i.status!==202)throw new pt(`sendTurn failed: expected 202, received ${i.status}`,"server",i.status,void 0,Bh(i));let s;try{s=await i.json()}catch(c){throw a?.aborted?c:new pt("sendTurn failed: invalid acknowledgement","server",i.status,c)}if(!Fh(s))throw new pt("sendTurn failed: invalid acknowledgement","server",i.status);return s},void 0,Ih)}catch(a){throw a instanceof pt?a:new pt("sendTurn failed: network error","network",void 0,a)}}cancelTurn(t,n){!this.visitorId||!t||!n||(De.debug("cancel stream",{conversationId:t,runId:n,visitorId:this.visitorId}),this.fetchImpl(this.url(dt.cancelStream),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.headersFor(this.url(dt.cancelStream))},body:JSON.stringify(this.withEnvelope({conversationId:t,runId:n})),keepalive:!0}).catch(r=>De.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(),Eh);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||De.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||wd.has(i.status)?(De.debug("resume-stream \u2192 transient response; reconnecting",{status:i.status}),"held"):(De.debug("resume-stream \u2192 endpoint unavailable",{status:i.status}),"unavailable");if(!i.body)return a(),De.debug("resume-stream \u2192 bodyless response; stopping",{status:i.status}),"unavailable";if(!(i.headers.get("content-type")??"").includes("text/event-stream"))return a(),De.debug("resume-stream \u2192 non-SSE response; stopping"),"unavailable";let s=!1;try{for await(let{chunk:c}of Pd(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";De.debug("resume-stream segment dropped \u2014 reconnecting",{err:c})}finally{a()}return"held"}resumeUrl(){return this.withEnvelopeQuery(dt.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>=kd)throw new pt(`${n} failed: network error`,"network",void 0,i);De.debug("request network error \u2014 retrying",{label:n,attempt:r}),await zn(Cd(r));continue}if(o.ok||!wd.has(o.status)||r>=kd)return o;let a=$h(o.headers)??Cd(r);De.debug("request retryable status \u2014 retrying",{label:n,status:o.status,attempt:r,wait:a}),await zn(a)}}async assertOk(t,n){if(!t.ok)throw new pt(`${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=>{De.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?{[wh]:this.userToken}:{}}}async withFreshUserToken(t){let n=await t();return n.status!==401||!this.userTokenSource?n:typeof this.userTokenSource!="function"?(De.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 Dh(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 Fh(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 Bh(e){let t=Number(e.headers.get("retry-after"));return Number.isInteger(t)&&t>0?t:void 0}function _r(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 Oa(e,t,n){return _r("close",e,t)?n.includes("close"):!1}function Rd(e,t){return e==="inline"&&t==="fullscreen"?"exit-fullscreen":"close"}function fr(e,t,n,r){let o={role:n,text:r};e.emit("message",o),t.onMessage?.(o)}function Id(e){let t=D(e);t.current=e;let n=D(null);return n.current??(n.current=Uh(t)),n.current}function Uh(e){let t=ie(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||!qh(u,_)||o(d)||!Hh(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 qh(e,t){return e.kind==="after-messages"?t.messageCount()>=Number(e.param??0):e.kind==="page-area"?t.pageArea()===e.param:!0}function Hh(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 Ad(e){return Object.fromEntries(e.map(t=>[t,[]]))}function Bs(e,t,n){return e.includes(t)?t:e.includes(n)?n:e[0]??""}function Ed(e,t,n){let r=[...new Set(t)],o=Bs(r,e,""),a=ie({activeTab:o,stacks:Ad(r)});return{sig:a,reconcile(i,s){let c=[...new Set(i)],p=a.value,_=Bs(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:Bs(r,i,""),stacks:Ad(r)}}}}function Md(e){return e.stacks[e.activeTab]??[]}function Nd(e){return Md(e).at(-1)}function Ld(e){return Md(e).length===0}function $a(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 zh=900,jh=640;function Us(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<jh?"fullscreen":n>=(t.autoSizeBreakpoint??zh)?"expanded":"normal"}function oo(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:Us(e.mode,e.size,t);return{panelOpen:a,panelSize:s}}function mr(){return typeof window>"u"?0:window.innerWidth}var Z={fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24"},ao=`${N.cssPrefix}-icon-dir`;function qs(){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 qt(){return l("svg",{...Z,"aria-hidden":"true",children:l("path",{d:"M18 6 6 18M6 6l12 12"})})}function Od(){return l("svg",{...Z,"aria-hidden":"true",children:l("path",{d:"M12 5v14M5 12h14"})})}function $d(){return l("svg",{...Z,class:ao,"aria-hidden":"true",children:[l("path",{d:"m22 2-7 20-4-9-9-4Z"}),l("path",{d:"M22 2 11 13"})]})}function Dd(){return l("svg",{...Z,"aria-hidden":"true",children:l("path",{d:"M12 19V5M5 12l7-7 7 7"})})}function Fd(){return l("svg",{...Z,class:ao,"aria-hidden":"true",children:l("path",{d:"M3 20V4l18 8-18 8Z"})})}function gr(){return l("svg",{...Z,class:ao,"aria-hidden":"true",children:l("path",{d:"m9 18 6-6-6-6"})})}function cn(){return l("svg",{...Z,"aria-hidden":"true",children:l("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}function Bd(){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 Ud(){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 qd(){return l("svg",{...Z,"aria-hidden":"true",children:l("path",{d:"M3 8V3h5M21 8V3h-5M3 16v5h5M21 16v5h-5"})})}function Hd(){return l("svg",{...Z,"aria-hidden":"true",children:l("path",{d:"M8 3v5H3M16 3v5h5M8 21v-5H3M16 21v-5h5"})})}function zd(){return l("svg",{...Z,"aria-hidden":"true",children:l("path",{d:"M3 3h7v2H5v5H3zM21 3h-7v2h5v5h2zM3 21h7v-2H5v-5H3zM21 21h-7v-2h5v-5h2z"})})}function jd(){return l("svg",{...Z,"aria-hidden":"true",children:l("path",{d:"M10 3v5H3M14 3v5h7M10 21v-5H3M14 21v-5h7"})})}function Vd(){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 Wd(){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 Gd(){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 Kd(){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 Qd(){return l("svg",{...Z,"aria-hidden":"true",children:l("path",{d:"M11 5 6 9H2v6h4l5 4zM22 9l-6 6M16 9l6 6"})})}function Xd(){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 Jd(){return l("svg",{...Z,class:ao,"aria-hidden":"true",children:l("path",{d:"m5 6 6 6-6 6M13 6l6 6-6 6"})})}function jn(){return l("svg",{...Z,"aria-hidden":"true",children:l("path",{d:"M20 6 9 17l-5-5"})})}function Yd(){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 Zd(){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 io(){return l("svg",{...Z,class:ao,"aria-hidden":"true",children:l("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}function ep(){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 Wt(){return l("svg",{...Z,"aria-hidden":"true",children:l("path",{d:"m6 9 6 6 6-6"})})}function Da(){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 Vh(){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 Hs(){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 so(){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 Wh(){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 Gh(){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 zs(){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 Kh(){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 js(){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 tp(){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 np(){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 Fa(){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 lo(){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 rp(){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 op(){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 ap(){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 Qh(){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 Xh(){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 Jh(){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 Yh(){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 ip(){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 sp(){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 lp(){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 Ba(){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 cp(){return l("svg",{...Z,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"M12 7v5l3 2"})]})}function hr(){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 vr(){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"})]})}function up(){return l("svg",{...Z,"aria-hidden":"true",children:l("path",{d:"M12 18V5M15 13a4.17 4.17 0 01-3-4 4.17 4.17 0 01-3 4M17.707 6.294A3 3 0 1012 5a3 3 0 10-5.707 1.294M17.996 5.125a4 4 0 012.526 5.77M18 18a4 4 0 002-7.465M19.967 17.482a4 4 0 11-7.967.517 4 4 0 11-7.967-.517M6 18a4 4 0 01-2-7.465M6.004 5.125a4 4 0 00-2.526 5.77"})})}function dp(){return l("svg",{...Z,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"10"}),l("path",{d:"M12 8v4M12 16h.01"})]})}var pp={chat:qs,message:Hs,bubbles:lo,spark:Vh,wand:Wh,bot:Gh,help:so,lifebuoy:Kh,headset:zs,search:Qh,sparkles:Xh,concierge:Jh,wave:Yh};var z=N.cssPrefix,M={launcher:`${z}-launcher`,callout:`${z}-callout`,calloutDismiss:`${z}-callout-dismiss`,panel:`${z}-panel`,panelHeader:`${z}-panel-header`,resizeGrip:`${z}-resize-grip`,scrollToBottom:`${z}-scroll-to-bottom`,loadPreviousMessages:`${z}-load-previous-messages`,actionHistory:`${z}-action-history`,actionClose:`${z}-action-close`,langSegment:`${z}-lang-segment`,composer:`${z}-composer`,composerInput:`${z}-composer-input`,composerSend:`${z}-composer-send`,composerStop:`${z}-composer-stop`,compactionStatus:`${z}-compaction-status`,messageQueue:`${z}-message-queue`,queuedMessage:`${z}-queued-message`,queuedMessageRemove:`${z}-queued-message-remove`,composerAttach:`${z}-composer-attach`,composerFileInput:`${z}-composer-file-input`,composerVoice:`${z}-composer-voice`,attachmentChip:`${z}-attachment-chip`,attachmentRemove:`${z}-attachment-remove`,suggestion:`${z}-suggestion`,messageBubble:`${z}-message`,messageRetry:`${z}-message-retry`,messageFile:`${z}-message-file`,messageFeedback:`${z}-message-feedback`,feedbackUp:`${z}-feedback-up`,feedbackDown:`${z}-feedback-down`,messageCopy:`${z}-message-copy`,historyPane:`${z}-history-pane`,historyBack:`${z}-history-back`,historyItem:`${z}-history-item`,historyLoadMore:`${z}-history-load-more`,sidebar:`${z}-sidebar`,sidebarToggle:`${z}-sidebar-toggle`,sidebarNewConversation:`${z}-sidebar-new-conversation`,sidebarItem:`${z}-sidebar-item`,messengerHome:`${z}-messenger-home`,modulesEmpty:`${z}-modules-empty`,tab:`${z}-tab`,tabBadge:`${z}-tab-badge`,homeView:`${z}-home-view`,homeGreeting:`${z}-home-greeting`,homeBrand:`${z}-home-brand`,backHeader:`${z}-back-header`,contentView:`${z}-content-view`,contentScroll:`${z}-content-scroll`,homeSearch:`${z}-home-search`,helpSearch:`${z}-help-search`,homeRecent:`${z}-home-recent`,homeAsk:`${z}-home-ask`,homeWhatsNew:`${z}-home-whats-new`,homeContentRow:`${z}-home-content-row`,helpArticle:`${z}-help-article`,newsItem:`${z}-news-item`,newsMore:`${z}-news-more`,formGate:`${z}-form-gate`,formDone:`${z}-form-done`,formDoneToggle:`${z}-form-done-toggle`,formAnswers:`${z}-form-answers`,formFill:`${z}-form-fill`,formSubmit:`${z}-form-submit`,formSkip:`${z}-form-skip`,formField:`${z}-form-field`,toolAskQuestions:`${z}-tool-ask-questions`,toolInputSubmit:`${z}-tool-input-submit`,toolInputSkip:`${z}-tool-input-skip`,toolApproval:`${z}-tool-approval`,toolApprovalFields:`${z}-tool-approval-fields`,toolApprove:`${z}-tool-approve`,toolReject:`${z}-tool-reject`,toolEdit:`${z}-tool-edit`,toolDecision:`${z}-tool-decision`,typingDots:`${z}-typing-dots`,reasoning:`${z}-reasoning`,replyStopped:`${z}-reply-stopped`,toolAskSummary:`${z}-ask-questions-summary`,toolAskOptions:`${z}-ask-questions-options-toggle`,toolCall:`${z}-tool-call`,toolSteps:`${z}-tool-steps`,toolStep:`${z}-tool-step`,source:`${z}-source`,operatorRequest:`${z}-operator-request`,operatorBanner:`${z}-operator-banner`,cancelOperatorRequest:`${z}-cancel-operator-request`};function _t(e,t){return`${e}-${t}`}var Ua=N.cssPrefix;function _p({onToggle:e,launcher:t,strings:n,leaving:r,edgeTab:o}){let a=t.variant!=="circle"&&!!t.label;return l("button",{type:"button",class:`${Ua}-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":M.launcher,onClick:e,"aria-label":n.launcherOpen,children:[Zh(t.icon),a?l("span",{class:`${Ua}-fab-label`,children:xt(n,t.label??"")}):null]})}function Zh(e){let t=pp[e];return t?l(t,{}):l(ev,{source:e})}function ev({source:e}){return l("span",{ref:t=>{t&&tv(t,e)},"aria-hidden":"true"})}function tv(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 fp({callout:e,launcherPosition:t,strings:n,closeLabel:r,onDismiss:o}){let[a,i]=U(!1);return $(()=>{let s=setTimeout(()=>i(!0),e.delayMs);return()=>clearTimeout(s)},[e.delayMs]),$(()=>{if(!a||e.autoDismissMs<=0)return;let s=setTimeout(o,e.autoDismissMs);return()=>clearTimeout(s)},[a,e.autoDismissMs,o]),a?l("div",{class:`${Ua}-callout`,role:"status","data-shape":e.shape,"data-position":nv(e.position,t),"data-animated":e.animated?"true":void 0,"data-testid":M.callout,children:[l("span",{children:xt(n,e.text)}),l("button",{type:"button",class:`${Ua}-callout-close`,onClick:o,"aria-label":r,title:r,"data-testid":M.calloutDismiss,children:l(qt,{})})]}):null}function nv(e,t){let n=t.endsWith("-right"),r=t.startsWith("bottom-");return e==="vertical"?r?"top":"bottom":n?"left":"right"}var rv='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function qa(e){function t(n){if(n.key!=="Tab")return;let r=[...e.querySelectorAll(rv)].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 xn=N.cssPrefix;function Ha({title:e,actions:t}){return l("header",{class:`${xn}-back-header`,part:"header","data-variant":"title",children:[l("span",{class:`${xn}-back-spacer`,"aria-hidden":"true"}),l("h1",{class:`${xn}-back-title`,children:e}),t??l("span",{class:`${xn}-back-spacer`,"aria-hidden":"true"})]})}function za({title:e,backLabel:t,onBack:n,actions:r,testid:o}){return l("header",{class:`${xn}-back-header`,part:"header","data-testid":o,children:[l("button",{type:"button",class:`${xn}-icon-btn`,onClick:n,"aria-label":t,title:t,children:l(io,{})}),l("h1",{class:`${xn}-back-title`,children:e}),r??l("span",{class:`${xn}-back-spacer`,"aria-hidden":"true"})]})}function co({textSig:e,doneSig:t,generativeUi:n=!1,strings:r=Ho}){let o=D(null);return Tt(()=>{let a=o.current;if(!a)return;a.classList.add(`${N.cssPrefix}-md`),a.replaceChildren();let i=n?Cs(a,{cssPrefix:N.cssPrefix,strings:r}):void 0,s=cr(i??Gr(a)),c=0,p=jt(()=>{let u=e.value,f=t.value;u.length<c&&(i?.dispose(),a.replaceChildren(),i=n?Cs(a,{cssPrefix:N.cssPrefix,strings:r}):void 0,s=cr(i??Gr(a)),c=0);let m=u.slice(c);m&&et(s,m),c=u.length,f&&(Wr(s),i?.finish())}),_=new MutationObserver(()=>mp(a));_.observe(a,{childList:!0,subtree:!0}),mp(a);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 hp({text:e}){let t=se(()=>ie(e),[e]),n=se(()=>ie(!0),[]);return l(co,{textSig:t,doneSig:n})}var fv=/<(\/?)(?:(Note|Info|Tip|Warning|Danger|Check|Callout)|Tabs?|Steps?|AccordionGroup|Accordion|Expandable|Columns|CardGroup|Card|Frame|CodeGroup|Badge|Icon|Video|Embed|ParamField|ResponseField)\b((?:"[^"]*"|'[^']*'|[^>"'])*?)(\/?)>|(^|\n)([ \t]*)(```[^]*?(?:\n[ \t]*```|$))?/g;function vp(e){let t=0,n="";return e.replace(fv,(r,o,a,i,s,c,p,_)=>{if(o===void 0)return t?c+(_?.split(`
58
58
  ${p}`).join(`
59
59
  `)??n):r;if(o)return t--,a&&(n=n.slice(2)),a?`
60
- ${n}`:"";s||(t++,a&&(n+="> "));let d={};i.replace(/(\w+)=(["'])(.*?)\2/g,(m,v,x,P)=>d[v]=P);let u=d.href??d.src,f=d.title??d.path??d.query??d.body??d.header??d.name??u;return(a?"> ":"")+(f?`**${u?`[${f}](${u})`:f}**${d.type?` \`${d.type}\``:""}
61
- ${n}`:"")})}function sp(e){for(let t of e.querySelectorAll("a")){let n=t.getAttribute("href")??"";!n||n.startsWith("#")||(t.target="_blank",t.rel="noopener noreferrer")}}var lp=new Set([11,12,13,14,15,16,17,18,19,31]);function Ua(e){let t="",n=[],r=ir({data:void 0,add_token:(o,a)=>{n.push(a),lp.has(a)||(t+=" ")},end_token:()=>{let o=n.pop();o!==void 0&&!lp.has(o)&&(t+=" ")},add_text:(o,a)=>{t+=a},set_attr:()=>{}});return Xe(r,e),Wr(r),t.replace(/\s+/g," ").trim()}var dp=M.cssPrefix;function Ot({tone:e="info",message:t,onRetry:n,strings:r}){return l("div",{class:`${dp}-module-empty`,role:e==="error"?"alert":"status","aria-live":"polite",children:[l("span",{children:t}),n?l("button",{type:"button",class:`${dp}-module-retry`,onClick:n,children:r.errorRetry}):null]})}var Pn=M.cssPrefix,ov=le.scope("content"),av=5e3;function pp({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,x]=q(null),P=$(()=>{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 E=w.items[0];E?(c(E),_(C?.items.find(A=>A.id===E.contentCollectionId)?.settings?.voteAccess==="portal"),o.emit("contentOpen",{contentId:e,contentCollectionId:E.contentCollectionId})):u(!0)}).catch(w=>{g||(ov.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}),av);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){x(e),n.setContentVote({contentId:e,value:g})}function h(){return d?l(Ot,{tone:"error",message:r.errorGeneric,onRetry:P,strings:r}):s===null?l(Ot,{message:r.contentLoading,strings:r}):l("article",{class:`${Pn}-content`,"data-testid":N.contentView,onClick:k,children:[s.image?l("img",{class:`${Pn}-content-hero`,src:s.image,alt:"",loading:"lazy"}):null,s.description?l("p",{class:`${Pn}-content-subtitle`,children:s.description}):null,l(cp,{text:up(s.content??"")}),p?l("div",{class:`${Pn}-content-vote`,"aria-live":"polite",children:v===e?r.feedbackThanks:l(de,{children:[l("span",{children:r.contentHelpful}),l("button",{type:"button",class:`${Pn}-module-retry`,onClick:()=>T(1),children:r.confirmYes}),l("button",{type:"button",class:`${Pn}-module-retry`,onClick:()=>T(0),children:r.confirmNo})]})}):null]})}return l("div",{class:`${Pn}-module`,children:[l(Ba,{title:s?.title||t||r.moduleBack,backLabel:r.moduleBack,onBack:a,actions:i,testid:N.backHeader}),l("div",{class:`${Pn}-module-scroll`,"data-testid":N.contentScroll,children:h()})]})}function _p({itemCount:e,initialFocusIndex:t}){let[n,r]=q(!1),o=F(null),a=F(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 x=f.composedPath();x.includes(m)||x.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 fp({items:e,triggerLabel:t}){let n=M.cssPrefix,r=_p({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(qd,{})}),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":`${N.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(qn,{})}):null]},s.id))}):null]})}var Us=M.cssPrefix;function iv(e){let t=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)").matches:!0;return e==="host"?nr()==="dark"?"light":"dark":e==="auto"?t?"light":"dark":t?e==="light"?"dark":"auto":e==="dark"?"light":"auto"}var sv={normal:"large",large:"small",small:"normal"};function lv(e){return e==="light"?l(Jd,{}):e==="dark"?l(Yd,{}):l(Zd,{})}function cv(e){return(e.split("-")[0]??e).toUpperCase()}function uv(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 Qt({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,x=t==="chat",P=Rt(()=>o.mutedSig.value).value,k=new Set(n.actions);function T(K){return k.has(K)}let h=typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches;function g(K){return h?!1:dr(K,v,r)}let S=n.themeMode,w={auto:m.themeAuto,light:m.themeLight,dark:m.themeDark,host:m.themeAuto},C=n.textSize,E={small:m.textSizeSmall,normal:m.textSizeNormal,large:m.textSizeLarge},A=[];if(x&&T("clear")&&A.push({id:"clear",icon:l(Kd,{}),label:m.newConversation,onSelect:i}),T("expand")&&g("expand")){let K=r==="expanded";A.push({id:"expand",icon:K?l($d,{}):l(Od,{}),label:K?m.collapse:m.expand,type:"switch",on:K,onSelect:s})}if(T("fullscreen")&&g("fullscreen")){let K=r==="fullscreen";A.push({id:"fullscreen",icon:K?l(Fd,{}):l(Dd,{}),label:K?m.exitFullscreen:m.fullscreen,type:"switch",on:K,onSelect:c})}let L=n.popOutUrl,O=n.aiAgentDeploymentId;T("popOut")&&L&&O&&dr("popOut",v,r)&&A.push({id:"popOut",icon:l(Bd,{}),label:m.popOut,onSelect:()=>{let K=uv(L,{conversationId:e.conversationId,widgetId:n.widgetId,publicKey:n.publicKey,aiAgentDeploymentId:O});K&&window.open(K,"_blank","noopener,noreferrer")}}),x&&T("sound")&&A.push({id:"sound",icon:P?l(zd,{}):l(Hd,{}),label:P?m.soundOff:m.soundOn,type:"switch",on:!P,onSelect:p}),T("theme")&&A.push({id:"theme",icon:lv(S),label:`${m.theme}: ${w[S]}`,onSelect:()=>u(iv(S)),keepOpen:!0}),T("textSize")&&A.push({id:"textSize",icon:l(jd,{}),label:`${m.textSize}: ${E[C]}`,onSelect:()=>f(sv[C]),keepOpen:!0}),T("language")&&n.availableLocales.length>1&&A.push({id:"language",icon:l(Gd,{}),label:m.language,segments:n.availableLocales.map(K=>({value:K,label:cv(K),lang:K})),value:n.locale,onSelectValue:d});let z=!!a&&Aa(v,r,n.actions),V=x&&T("history");return l("div",{class:`${Us}-header-actions`,children:[V?l("button",{type:"button",class:`${Us}-icon-btn`,onClick:_,"aria-label":m.history,title:m.history,"data-testid":N.actionHistory,children:l(Wd,{})}):null,A.length>0?l(fp,{items:A,triggerLabel:m.moreActions}):null,z?l("button",{type:"button",class:`${Us}-icon-btn`,onClick:a,"aria-label":m.close,title:m.close,"data-testid":N.actionClose,children:l(Bt,{})}):null]})}var mp={Icon:lo};function Hn(e,t){return e instanceof ct&&e.status===429?t.errorRateLimited:t.errorGeneric}var vr=M.cssPrefix;function gp({placeholder:e,onActivate:t}){return l("button",{type:"button",class:`${vr}-home-search`,onClick:t,"data-testid":N.homeSearch,children:[l("span",{class:`${vr}-home-search-text`,children:e}),l("span",{class:`${vr}-home-search-icon`,"aria-hidden":"true",children:l(Bs,{})})]})}function hp({placeholder:e,value:t,onInput:n}){return l("div",{class:`${vr}-home-search`,"data-input":"true",children:[l("input",{type:"search",class:`${vr}-home-search-input`,placeholder:e,value:t,maxLength:200,onInput:r=>n(r.currentTarget.value),"data-testid":N.helpSearch}),l("span",{class:`${vr}-home-search-icon`,"aria-hidden":"true",children:l(Bs,{})})]})}var co=M.cssPrefix;function qa({title:e,subtitle:t,onClick:n,testid:r}){return l("button",{type:"button",class:`${co}-list-row`,onClick:n,"data-testid":r,children:[l("span",{class:`${co}-list-row-body`,children:[l("span",{class:`${co}-list-row-title`,children:e}),t?l("span",{class:`${co}-list-row-sub`,children:t}):null]}),l("span",{class:`${co}-list-row-chevron`,"aria-hidden":"true",children:l(fr,{})})]})}var Xt=M.cssPrefix,dv=le.scope("help"),pv=20,_v=300;function fv(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 vp({transport:e,strings:t,bus:n},r,o){let[a,i]=q(),s=F(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:pv,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===_&&(dv.warn("listContent (help) failed",{err:d,page:p}),i(u=>u&&{...u,loading:!1,error:Hn(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 mv(e){let{strings:t,config:n,nav:r,panelProps:o}=e,a=n.contentCollectionIds,[i,s]=q(""),[c,p]=q(""),_=vp(e,a),d=vp(e,c?a:void 0,c),[u,f]=i.trim()?d:_;D(()=>{let v=setTimeout(()=>p(i.trim()),_v);return()=>clearTimeout(v)},[i]);function m(){if(!a?.length)return l(Ot,{message:t.helpEmpty,strings:t});let v=u?.error?l(Ot,{tone:"error",message:u.error,onRetry:f,strings:t}):null;return v&&!u?.pagination?v:!u||!u.pagination&&!u.items.length?l(Ot,{message:t.helpLoading,strings:t}):u.items.length?l(de,{children:[fv(u.items,a,u.collections).map(x=>l("section",{class:`${Xt}-help-group`,children:[x.title?l("h2",{class:`${Xt}-help-section-title`,children:x.title}):null,l("div",{class:`${Xt}-help-card`,children:x.rows.map(P=>l(qa,{title:P.title,subtitle:P.description,onClick:()=>r.push(P.url?{kind:"iframe",url:P.url,title:P.title}:{kind:"content",id:P.id,title:P.title}),testid:ut(N.helpArticle,P.id)},P.id))})]},x.id)),v,u.pagination?.hasNext&&!v?l("div",{children:l("div",{class:`${Xt}-help-card`,children:l("button",{type:"button",class:`${Xt}-list-row ${Xt}-help-more`,onClick:f,"aria-busy":u.loading,children:[u.loading?l("span",{class:`${Xt}-loading-spinner`,"aria-hidden":"true"}):null,t.helpShowMore]})})}):null]}):l(Ot,{message:u.search?t.helpSearchEmpty.replace("{query}",u.search):t.helpEmpty,strings:t})}return l("div",{class:`${Xt}-module`,children:[l(Fa,{title:t.helpTitle,actions:l(Qt,{panelProps:o,variant:"plain"})}),l("div",{class:`${Xt}-module-pad`,children:l(hp,{placeholder:t.helpSearchPlaceholder,value:i,onInput:s})}),l("div",{class:`${Xt}-help-list`,children:m()})]})}var bp={Icon:so,Root:e=>l(mv,{...e})};var yp=le.scope("attachments");function Ha(e,t,n){let r=hv(e),o=[],a=[],i=yv(n.accept),s=t.reduce((p,_)=>p+_.size,0),c=t.length;for(let p of r){let _=gv(p,c,s,n,i);if(_){a.push({file:p,reason:_});continue}o.push(bv(p)),s+=p.size,c+=1}return(o.length||a.length)&&yp.debug("ingest",{accepted:o.length,rejected:a.map(p=>({name:p.file.name,reason:p.reason}))}),{accepted:o,rejected:a}}function br(e){try{URL.revokeObjectURL(e.previewUrl)}catch(t){yp.debug("revokeObjectURL failed",{error:t})}}function gv(e,t,n,r,o){return t>=r.maxCount?"count":n+e.size>r.maxBytes?"bytes":Pv(e,o)?null:"mime"}function hv(e){return e?Array.isArray(e)?e.filter(t=>t instanceof File):[...e].map(t=>t instanceof File?t:vv(t)).filter(t=>t!==null):[]}function vv(e){let t=e;return!t?.getAsFile||t.kind!=="file"?null:t.getAsFile()}function bv(e){return{file:e,id:Ct(),mediaType:e.type||"application/octet-stream",name:e.name||"pasted-file",previewUrl:URL.createObjectURL(e),size:e.size}}function yv(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 Pv(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 uo=M.cssPrefix;function Pp({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:`${uo}-attachment-chip`,title:e.name,"data-testid":ut(N.attachmentChip,e.id),children:[r?l("img",{class:`${uo}-attachment-thumb`,src:e.previewUrl,alt:""}):l("span",{class:`${uo}-attachment-thumb`,"aria-hidden":"true",children:l(Na,{})}),l("span",{class:`${uo}-attachment-name`,children:e.name}),l("button",{type:"button",class:`${uo}-attachment-remove`,onClick:t,disabled:n,"aria-label":`Remove ${e.name}`,"data-testid":ut(N.attachmentRemove,e.id),children:l(Bt,{})})]})}var qs={isSupported:!1,start:()=>{},stop:()=>{},cancel:()=>{}};function Hs(e,t,n){return e==="disabled"?qs:e==="server"?wv(n):xv(t)}function xv(e){let t=Sv();if(!t)return qs;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 x=u.results[v];x&&(f+=x[0].transcript,x.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 Sv(){return window.SpeechRecognition??window.webkitSpeechRecognition}var kv=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];function wv(e){if(typeof MediaRecorder>"u"||!navigator?.mediaDevices?.getUserMedia)return qs;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 _=Cv(),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 Cv(){for(let e of kv)if(MediaRecorder.isTypeSupported(e))return e}var Ye=M.cssPrefix,yr=le.scope("composer");function Pr(e){return e.reduce((t,n)=>t+n.size,0)}var zs={arrowUp:Ed,paperPlane:Id,send:Ad,chevron:fr};function xp(e){return"activeElement"in e}function Tv(e){return"host"in e&&"activeElement"in e}function Sp({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:x,onSend:P,onStop:k,apiRef:T}){let h=e.strings,[g,S]=q(()=>o.loadDraft(a)),[w,C]=q([]),[E,A]=q(()=>o.loadMessageQueue(a).map(B=>({id:B.id,text:B.text,attachments:[]}))),L=F(E),O=F(!1),[z,V]=q(!1),[K,te]=q(!1),G=F(!1),Y=F(null),De=F(null),_e=F(null),Te=F(0),et=F(a);et.current=a;let Ue=F(d);Ue.current=d;let gt=F(u);gt.current=u;let Ge=K||u||!d,ht=i&&v==="ai-agent",dt=ht||c&&v==="ai-agent",St=v==="ai-agent"&&(dt||_||E.length>0),kt=$(B=>{A(Q=>{let ee=B(Q);return o.saveMessageQueue(et.current,ee.filter(me=>me.attachments.length===0).map(({id:me,text:it})=>({id:me,text:it}))),L.current=ee,ee})},[o]),Ee=$(B=>{kt(Q=>(Q.find(ee=>ee.id===B)?.attachments.forEach(br),Q.filter(ee=>ee.id!==B)))},[kt]),qe=$(B=>{S(Q=>{let ee=typeof B=="function"?B(Q):B;return ee===Q?Q:(o.saveDraft(et.current,ee),ee)})},[o]),ye=e.features.fileUpload,ot=e.features.voice,[ve,vt]=q(()=>Hs(ot,e.locale,(B,Q)=>t.transcribe(B,Q))),Ke=F(ve);Ke.current=ve;let $t=F({mode:ot,locale:e.locale,transport:t});D(()=>{let B=$t.current;B.mode===ot&&B.locale===e.locale&&B.transport===t||($t.current={mode:ot,locale:e.locale,transport:t},Te.current++,Ke.current.cancel(),_e.current=null,V(!1),vt(Hs(ot,e.locale,(Q,ee)=>t.transcribe(Q,ee))))},[e.locale,ot,t]),Tt(()=>()=>{Te.current++,ve.cancel()},[ve]);let b=$(B=>{let Q=_e.current;if(Q===null)return!1;let ee=Math.round(performance.now()-Q);return yr[B]("voiceStop",{durationMs:ee}),r.emit("voiceStop",{durationMs:ee}),_e.current=null,!0},[r]),U=$(()=>{_e.current!==null&&(ve.stop(),V(!1),b("info")&&n.play("voiceStop"))},[b,n,ve]),J=$(()=>{Te.current++,ve.cancel(),V(!1),b("info")&&n.play("voiceStop")},[b,n,ve]);D(()=>{(u||!d)&&J()},[d,J,u]),D(()=>{let B=Y.current;if(!B)return;let Q=B.getRootNode(),ee=xp(Q)?Q.activeElement:null;ee&&B.closest(`.${Ye}-panel`)?.contains(ee)||B.focus({preventScroll:!0})},[]),D(()=>{let B=Y.current;if(!B)return;if(g.length===0){B.style.height="";return}B.style.height="auto";let Q=getComputedStyle(B),ee=Number.parseFloat(Q.getPropertyValue(`--${Ye}-textarea-base-height`)),me=Number.parseFloat(Q.borderTopWidth)+Number.parseFloat(Q.borderBottomWidth),it=Math.min(B.scrollHeight+me,Number.parseFloat(Q.maxHeight)),zt=Number.parseFloat(Q.fontSize)*.7;B.style.height=`${it<ee+zt?ee:it}px`},[g]);let Z=F(w);Z.current=w,D(()=>()=>{Z.current.forEach(br);for(let B of L.current)B.attachments.forEach(br)},[]),Tt(()=>{if(T)return T.current={attachFromDrop:B=>{if(!ye||!Ue.current||G.current||gt.current)return;let Q=Ha(B,Z.current,e.attachments);Q.accepted.length!==0&&(yr.info("attach (drop)",{count:Q.accepted.length,totalBytes:Pr(Q.accepted)}),r.emit("attach",{count:Q.accepted.length,totalBytes:Pr(Q.accepted)}),C(ee=>[...ee,...Q.accepted]))},fill:B=>{if(!Ue.current||G.current||gt.current)return;qe(B);let Q=Y.current;Q&&(Q.focus({preventScroll:!0}),requestAnimationFrame(()=>Q.setSelectionRange(Q.value.length,Q.value.length)))},acceptQueuedMessage:Ee},()=>{T.current&&(T.current=null)}},[T,ye,u,e.attachments,Ee,qe]),D(()=>{let B=Y.current;if(!B)return;let Q=B.closest(`.${Ye}-panel`);if(!Q)return;let ee=me=>{if(!Ue.current||G.current||gt.current)return;let it=me.clipboardData;if(!it)return;let zt=me.target?.closest?.("input, textarea, [contenteditable]:not([contenteditable='false'])");if(zt&&zt!==B)return;if(ye){let Et=Ha(it.items,Z.current,e.attachments);if(Et.accepted.length>0){me.preventDefault(),yr.info("attach (paste)",{count:Et.accepted.length,totalBytes:Pr(Et.accepted)}),r.emit("attach",{count:Et.accepted.length,totalBytes:Pr(Et.accepted)}),C(ce=>[...ce,...Et.accepted]);return}}if(zt===B)return;let Yt=it.getData("text/plain");Yt&&(me.preventDefault(),qe(Et=>Et+Yt),B.focus())};return Q.addEventListener("paste",ee),()=>Q.removeEventListener("paste",ee)},[ye,e.attachments,qe]);async function ae(){let B=g.trim();if(!B&&w.length===0||!d||ht||G.current||u)return;J(),G.current=!0,te(!0);let Q=g,ee=w;try{await P(B,ee)&&(qe(me=>me===Q?"":me),C(me=>me!==ee?me:(ee.forEach(br),Z.current=[],[])))}finally{G.current=!1,te(!1),requestAnimationFrame(()=>{let me=Y.current;if(!me||me.disabled||!Ue.current)return;let it=me.getRootNode(),zt=xp(it)?it.activeElement:null,Yt=zt?.getAttribute("data-testid");if(!(zt&&zt!==me&&Yt!==N.composerSend&&Yt!==N.composerStop)){if(Tv(it)){let Et=it.host.ownerDocument;if(!Et.hasFocus())return;let ce=Et.activeElement;if(ce&&ce!==it.host&&ce!==Et.body)return}me.focus({preventScroll:!0})}})}}function Re(){let B=g.trim();if(!B&&w.length===0||!d||!St||G.current||u)return;J();let Q=w;kt(ee=>[...ee,{id:Ct(),text:B,attachments:Q}]),qe(""),C(ee=>ee!==Q?ee:(Z.current=[],[])),Y.current?.focus({preventScroll:!0})}D(()=>{dt&&(O.current=!1)},[dt]),D(()=>{let B=E[0];if(!B||!p||dt||O.current||K||u||!d)return;let Q=setTimeout(()=>{O.current=!0,P(B.text,B.attachments,B.id).then(ee=>{if(ee){Ee(B.id);return}O.current=!1})},300);return()=>clearTimeout(Q)},[d,p,u,P,dt,E,Ee,K]);function Pe(B){B.key!=="Enter"||B.shiftKey||B.isComposing||(B.preventDefault(),St&&(g.trim()||w.length>0)?Re():ht?k():ae())}function he(B){let Q=B.target;if(!d||G.current||u){Q.value="";return}let ee=Ha(Q.files,w,e.attachments);ee.accepted.length>0&&(yr.info("attach (file picker)",{count:ee.accepted.length,totalBytes:Pr(ee.accepted)}),r.emit("attach",{count:ee.accepted.length,totalBytes:Pr(ee.accepted)}),C(me=>[...me,...ee.accepted])),Q.value=""}function _t(B){!d||G.current||u||(yr.info("removeAttachment",{id:B}),r.emit("removeAttachment",{id:B}),C(Q=>{let ee=Q.find(me=>me.id===B);return ee&&br(ee),Q.filter(me=>me.id!==B)}))}function fe(){if(z){U();return}if(!d||!ve.isSupported||G.current||u)return;let B=++Te.current;_e.current=performance.now(),yr.info("voiceStart"),r.emit("voiceStart",void 0),V(!0),n.play("voiceStart"),ve.start((Q,ee)=>{Te.current!==B||!Ue.current||gt.current||G.current||!ee||qe(me=>`${me}${Q} `)},()=>{Te.current!==B||!Ue.current||(V(!1),b("debug"))})}let at=zs[e.composer.sendButton.icon],He=!!(g.trim()||w.length>0),Ht=ht||s&&!He;return l("div",{class:`${Ye}-composer`,part:"composer","data-testid":N.composer,children:[E.length>0?l("div",{class:`${Ye}-message-queue`,"aria-label":h.queueMessage,"data-testid":N.messageQueue,children:E.map(B=>l("div",{class:`${Ye}-attachment-chip ${Ye}-queued-message`,"data-testid":`${N.queuedMessage}-${B.id}`,children:[l("span",{class:`${Ye}-attachment-name ${Ye}-queued-text`,children:B.text||B.attachments.map(Q=>Q.name).join(", ")}),l("button",{type:"button",class:`${Ye}-attachment-remove`,onClick:()=>Ee(B.id),"aria-label":h.removeQueuedMessage,title:h.removeQueuedMessage,"data-testid":`${N.queuedMessageRemove}-${B.id}`,children:l(Bt,{})})]},B.id))}):null,w.length>0?l("div",{class:`${Ye}-attachments`,children:w.map(B=>l(Pp,{attachment:B,onRemove:()=>_t(B.id),disabled:Ge},B.id))}):null,l("div",{class:`${Ye}-composer-row`,children:[l("div",{class:`${Ye}-composer-actions`,children:[ye?l("button",{type:"button",class:`${Ye}-icon-btn`,onClick:()=>De.current?.click(),disabled:Ge,"aria-label":h.attach,"data-testid":N.composerAttach,children:l(Nd,{})}):null,ve.isSupported?l("button",{type:"button",class:`${Ye}-icon-btn`,onClick:fe,disabled:Ge,"aria-label":z?h.micStop:h.micStart,"aria-pressed":z,"data-recording":z?"true":void 0,"data-testid":N.composerVoice,children:l(Ld,{})}):null]}),l("textarea",{ref:Y,name:"message",class:`${Ye}-textarea`,rows:1,value:g,placeholder:h.composerPlaceholder,onInput:B=>qe(B.currentTarget.value),onKeyDown:Pe,disabled:Ge,"aria-label":h.composerPlaceholder,"data-testid":N.composerInput}),St&&He?l("button",{type:"button",class:`${Ye}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:Re,disabled:Ge,"aria-label":h.queueMessage,title:h.queueMessage,"data-testid":N.composerSend,children:l(at,{})}):null,Ht?l("button",{type:"button",class:`${Ye}-send`,onClick:k,disabled:Ge,"aria-label":h.stop,"data-testid":N.composerStop,children:l(Md,{})}):null,!Ht&&(!St||!He)?l("button",{type:"button",class:`${Ye}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:()=>{ae()},disabled:Ge||!g.trim()&&w.length===0,"aria-label":h.send,"data-testid":N.composerSend,children:l(at,{})}):null,f&&v==="ai-agent"&&x?l("button",{type:"button",class:`${Ye}-icon-btn`,onClick:x,disabled:Ge||!m,"aria-label":h.talkToOperator,title:h.talkToOperator,"data-testid":N.operatorRequest,children:l(Fs,{})}):null]}),l("input",{ref:De,name:"attachments",type:"file",multiple:!0,accept:e.attachments.accept,onChange:he,disabled:Ge,class:`${Ye}-sr-only`,"data-testid":N.composerFileInput})]})}var kp=M.cssPrefix;function za({onClick:e,children:t,testid:n}){return e?l("button",{type:"button",class:`${kp}-home-card`,"data-interactive":"true",onClick:e,"data-testid":n,children:t}):l("div",{class:`${kp}-home-card`,"data-testid":n,children:t})}function ja(e){return e.trim().split(/\s+/).slice(0,2).map(t=>t.charAt(0).toUpperCase()).join("")}var Ut=M.cssPrefix,Rv=le.scope("news"),Iv=10;function js(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 Ev({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=F(void 0);function u(x){if(!c?.length)return;let P={};d.current=P,_(k=>({...k,loading:!0,error:void 0})),t.listContent({contentCollectionIds:c,sortBy:"publishedAt",sortOrder:"desc",page:x,limit:Iv}).then(k=>{if(d.current!==P||(_(h=>({items:x>1?[...h.items,...k.items]:k.items,pagination:k.pagination,loading:!1})),x>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===P&&(Rv.warn("listContent (news) failed",{err:k,page:x}),_(T=>({...T,loading:!1,error:Hn(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(x){let P=js(x.publishedAt,e.locale);return l("button",{type:"button",class:`${Ut}-news-card`,onClick:()=>o.push({kind:"content",id:x.id,title:x.title}),"data-testid":ut(N.newsItem,x.id),children:[x.image?l("img",{class:`${Ut}-news-hero`,src:x.image,alt:"",loading:"lazy"}):null,l("span",{class:`${Ut}-news-body`,children:[l("span",{class:`${Ut}-news-title`,children:x.title}),P||x.tags?.length?l("span",{class:`${Ut}-news-meta`,children:[P?l("time",{dateTime:x.publishedAt,children:P}):null,x.tags?.map(k=>l("span",{class:`${Ut}-news-tag`,children:k},k))]}):null,x.description?l("span",{class:`${Ut}-news-summary`,children:x.description}):null]})]},x.id)}function v(){if(!c?.length)return l(Ot,{message:n.newsEmpty,strings:n});let x=p.error?l(Ot,{tone:"error",message:p.error,onRetry:f,strings:n}):null;return x&&!p.pagination?x:p.pagination?p.items.length?l("div",{class:`${Ut}-news-list`,children:[p.items.map(m),x,p.pagination.hasNext&&!x?l("button",{type:"button",class:`${Ut}-news-more`,onClick:f,"aria-busy":p.loading,"data-testid":N.newsMore,children:[p.loading?l("span",{class:`${Ut}-loading-spinner`,"aria-hidden":"true"}):null,n.newsShowMore]}):null]}):l(Ot,{message:n.newsEmpty,strings:n}):l(Ot,{message:n.newsLoading,strings:n})}return l("div",{class:`${Ut}-module`,children:[l(Fa,{title:n.newsTitle,actions:l(Qt,{panelProps:i,variant:"plain"})}),l("div",{class:`${Ut}-module-scroll`,children:v()})]})}var wp={Icon:La,Root:e=>l(Ev,{...e})};var ge=M.cssPrefix,Cp=le.scope("home");function Av(e){let t=e.options.userContext?.name,n=e.config.greetingText?bt(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 Mv(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 Nv({options:e,onAsk:t}){let[n,r]=q(""),{sendButton:o}=e.composer,a=zs[o.icon];function i(s){s.preventDefault();let c=n.trim();c&&(r(""),t(c))}return l("form",{class:`${ge}-home-search ${ge}-home-ask`,"data-input":"true",onSubmit:i,"data-testid":N.homeAsk,children:[l("input",{type:"text",class:`${ge}-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:`${ge}-send`,"data-shape":o.shape,"data-variant":o.variant,disabled:!n.trim(),"aria-label":e.strings.send,children:l(a,{})})]})}function Tp(e,t){return sn(e,t,t.type!=="upsert"||t.activity===!0)}function Lv(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(E=>{S&&w.push(E),p(A=>Tp(A?[A]:[],E)[0]??null)});return t.listConversations({limit:f?50:1}).then(E=>{if(g)return;let A=w.reduce(Tp,E.conversations);w=[],S=!1,p(A[0]??null)}).catch(E=>{g||(w=[],S=!1,Cp.warn("listConversations (home) failed",{err:E}))}),()=>{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&&Cp.warn("listContent (home) failed",{err:S})),()=>{g=!0}},[t,u,a]);let m=Av(e),v=r.userAvatars??[],x=r.status,P=x?.text?bt(n,x.text):n.homeStatus,k=r.contentBlockTitle?bt(n,r.contentBlockTitle):n.homeContentTitle,T=s.item,h=js(T?.publishedAt,e.options.locale);return l("div",{class:`${ge}-module ${ge}-home`,"data-testid":N.homeView,children:l("div",{class:`${ge}-home-scroll`,children:[l("div",{class:`${ge}-home-hero`,children:[l("div",{class:`${ge}-home-hero-top`,children:[r.brandName?l("span",{class:`${ge}-home-brand`,"data-testid":N.homeBrand,children:r.brandName}):l("span",{class:`${ge}-home-brand-spacer`,"aria-hidden":"true"}),l("div",{class:`${ge}-home-hero-actions`,children:[v.length>0?l("div",{class:`${ge}-home-avatars`,children:v.map(g=>l("span",{class:`${ge}-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:ja(g.name)})},g.name))}):null,l(Qt,{panelProps:i,variant:"plain"})]})]}),r.showGreeting!==!1?l(de,{children:[l("h1",{class:`${ge}-home-greeting`,"data-testid":N.homeGreeting,children:m.title}),m.subtitle?l("p",{class:`${ge}-home-lead`,children:m.subtitle}):null]}):null]}),l("div",{class:`${ge}-home-cards`,children:[f?l(Nv,{options:e.options,onAsk:g=>o.startNewConversation(g)}):null,r.showSearchBar!==!1?l(gp,{placeholder:n.homeSearchPlaceholder,onActivate:()=>o.switchToLayout("help")}):null,T?l(za,{onClick:()=>{s.markSeen(T.id),o.push({kind:"content",id:T.id,title:T.title})},testid:N.homeWhatsNew,children:l("div",{class:`${ge}-home-recent-row`,"data-unread":s.unseen?"true":void 0,children:[l("span",{class:`${ge}-home-recent-avatar`,"aria-hidden":"true",children:l(La,{})}),l("span",{class:`${ge}-home-recent-body`,children:[l("span",{class:`${ge}-home-recent-title`,children:n.homeWhatsNew}),l("span",{class:`${ge}-home-recent-preview`,children:h?`${T.title} \xB7 ${h}`:T.title})]}),s.unseen?l("span",{class:`${ge}-home-recent-dot`,role:"img","aria-label":n.newsUnseen}):null]})}):null,c?l(za,{onClick:()=>o.selectConversation(c),testid:N.homeRecent,children:l("div",{class:`${ge}-home-recent-row`,"data-unread":c.hasUnread?"true":void 0,children:[l("span",{class:`${ge}-home-recent-avatar`,"aria-hidden":"true",children:l(lo,{})}),l("span",{class:`${ge}-home-recent-body`,children:[l("span",{class:`${ge}-home-recent-title`,children:c.title}),c.preview?l("span",{class:`${ge}-home-recent-preview`,children:Ua(c.preview)}):null]}),c.hasUnread?l("span",{class:`${ge}-home-recent-dot`,"aria-label":"Unread"}):null]})}):null,x?l(za,{onClick:x.url?()=>o.push({kind:"iframe",url:x.url,title:P}):void 0,children:l("div",{class:`${ge}-home-status`,"data-level":x.level??"operational",children:[l("span",{class:`${ge}-home-status-icon`,"aria-hidden":"true",children:l(Qd,{})}),l("span",{class:`${ge}-home-status-text`,children:P})]})}):null,_.length>0?l("section",{class:`${ge}-home-content`,children:[l("div",{class:`${ge}-home-content-title`,children:k}),l("div",{class:`${ge}-home-content-list`,children:_.map(g=>l(qa,{title:g.title,subtitle:g.description,onClick:()=>Mv(o,g),testid:ut(N.homeContentRow,g.id)},g.id))})]}):null]})]})})}var Rp={Icon:Xd,Root:e=>l(Lv,{...e})};var Va={chat:mp,home:Rp,help:bp,news:wp};var po=M.cssPrefix;function Ip({modules:e,activeTab:t,strings:n,hasUnread:r,onSelect:o}){return l("nav",{class:`${po}-tabbar`,role:"tablist","aria-label":n.panelTitle,children:e.map(a=>{let i=Va[a.layout].Icon,s=a.id===t,c=a.layout==="chat"&&r;return l("button",{type:"button",role:"tab","aria-selected":s,class:`${po}-tab`,onClick:()=>o(a.id),"data-testid":ut(N.tab,a.id),children:[l("span",{class:`${po}-tab-icon`,"aria-hidden":"true",children:[l(i,{}),c?l("span",{class:`${po}-tab-badge`,"data-testid":N.tabBadge,"aria-label":"Unread"}):null]}),l("span",{class:`${po}-tab-label`,children:bt(n,a.label)})]},a.id)})})}var Ep=M.cssPrefix,Ov="allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads";function Ap({url:e,title:t,strings:n,onBack:r,actions:o}){return l("div",{class:`${Ep}-module`,children:[l(Ba,{title:t||n.moduleBack,backLabel:n.moduleBack,onBack:r,actions:o}),l("iframe",{class:`${Ep}-content-frame`,src:e,title:t||"content",sandbox:Ov,referrerpolicy:"no-referrer",loading:"lazy",allow:"fullscreen"})]})}var Vs=M.cssPrefix;function Mp({agent:e,strings:t}){let n=e.status??"online",r=bt(t,e.name),o=e.title?bt(t,e.title):null;return l("div",{class:`${Vs}-agent`,children:[l("div",{class:`${Vs}-agent-avatar`,"data-status":n,children:e.avatar?l("img",{src:e.avatar,alt:""}):l("span",{children:ja(r)})}),l("div",{class:`${Vs}-agent-meta`,children:[l("strong",{children:r}),o?l("span",{children:o}):null]})]})}var $v=["today","yesterday","lastWeek","older"];function Dv(e,t){let n=Date.parse(t);if(!Number.isFinite(n))return"older";let r=Math.floor((Np(e)-Np(n))/(1440*60*1e3));return r<=0?"today":r===1?"yesterday":r<7?"lastWeek":"older"}function Lp(e,t){let n=new Map;for(let r of t){let o=Dv(e,r.lastMessageAt),a=n.get(o);a?a.push(r):n.set(o,[r])}return $v.filter(r=>n.has(r)).map(r=>({bucket:r,conversations:n.get(r)}))}function Np(e){let t=new Date(e);return t.setUTCHours(0,0,0,0),t.getTime()}var Op=le.scope("history"),Fv=3,Bv=6,Uv={today:"dateToday",yesterday:"dateYesterday",lastWeek:"dateLastWeek",older:"dateOlder"};function $p(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=sn(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=sn(e.conversations,t,n);return r===e.conversations?e:{...t.type==="snapshot"?t.result:e,conversations:r}}function qv(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 Wa({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=F(void 0),v=_?.conversations??[],x=_?.pagination;D(()=>{let g=!1,S=!0,w=[],C=e.subscribeConversationChanges(A=>{S&&w.push(A),d(L=>L&&$p(L,A))});m.current=void 0,f(!1);let E=e.peekConversations({limit:50});return d(E),p(E?"loaded":"loading"),e.listConversations({limit:50}).then(A=>{if(g)return;let L=A;for(let O of w)L=$p(L,O);w=[],S=!1,d(L),p("loaded"),r.saveHistoryCount(L.conversations.length)}).catch(A=>{g||(w=[],S=!1,Op.warn("listConversations failed",{err:A}),p("error"))}),()=>{g=!0,C(),m.current=void 0}},[e,r,n]);async function P(){if(m.current||!x?.hasNext)return;let g={};m.current=g,f(!0);try{let S=await e.listConversations({page:x.page+1,limit:x.limit});if(m.current!==g)return;d(w=>{if(!w)return w;let C=new Set(w.conversations.map(L=>L.conversationId)),E=S.conversations.filter(L=>C.has(L.conversationId)?!1:(C.add(L.conversationId),!0)),A={conversations:[...w.conversations,...E],pagination:S.pagination};return r.saveHistoryCount(A.conversations.length),A})}catch(S){if(m.current!==g)return;Op.warn("listConversations page failed",{err:S,page:x.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":N.sidebarNewConversation,children:[l(Rd,{}),t.newConversation]})}):null;if(c==="loading"){let g=Math.min(r.loadHistoryCount()??Fv,Bv);return l(de,{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(de,{children:[l("div",{class:`${i}-history-empty`,children:t.historyEmpty}),k]});let T=Date.now(),h=Lp(T,v);return l(de,{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[Uv[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":ut(N.historyItem,S.conversationId),children:[l("span",{class:`${i}-history-avatar`,"aria-hidden":"true",children:l(Ds,{})}),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:qv(S.lastMessageAt,T,n)})]}),l("span",{class:`${i}-history-row`,children:[l("span",{class:`${i}-history-preview`,children:S.preview&&Ua(S.preview)||(S.canContinue?t.historyContinue:t.conversationClosed)}),S.hasUnread?l("span",{class:`${i}-history-dot`}):null]})]})]})},S.conversationId))})]},g.bucket)),x?.hasNext?l("div",{class:`${i}-history-more`,children:l("button",{type:"button",onClick:P,disabled:u,"aria-busy":u,"data-testid":N.historyLoadMore,children:t.loadMoreConversations})}):null]}),k]})}var Hv=M.cssPrefix;function Dp({visible:e,strings:t}){return e?l("div",{class:`${Hv}-dropzone`,role:"status","aria-live":"polite",children:t.dropZone}):null}var zv=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,jv=/^https?:\/\/[^\s.]+\.[^\s]+$/i,Vv=/^[+]?[\d\s().-]{6,}$/;function xr(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>String(t[r]??`{${r}}`))}function Wv(e){return Array.isArray(e)?e.length:e?.trim()?1:0}function Gv(e,t,n){let r=e.required??!0,o=e.validation;if(e.type==="multiselect"){let i=Wv(t);return r&&i===0?n.formRequired:i===0?void 0:o?.minSelections!=null&&i<o.minSelections?xr(n.formChooseAtLeast,{min:o.minSelections}):o?.maxSelections!=null&&i>o.maxSelections?xr(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(!zv.test(a))return n.formInvalidEmail;break;case"url":if(!jv.test(a))return n.formInvalidUrl;break;case"tel":if(!Vv.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 xr(n.formNumberTooSmall,{min:o.min});if(o?.max!=null&&i>o.max)return xr(n.formNumberTooLarge,{max:o.max});break}default:break}if(o?.minLength!=null&&a.length<o.minLength)return xr(n.formTooShort,{min:o.minLength});if(o?.maxLength!=null&&a.length>o.maxLength)return xr(n.formTooLong,{max:o.maxLength});if(o?.pattern)try{if(!new RegExp(o.pattern).test(a))return n.formPatternMismatch}catch{}}function Fp(e,t,n){let r={};for(let o of e){let a=Gv(o,t[o.name],n);a&&(r[o.name]=a)}return r}function Bp(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,_o="__other__";function fo({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,x]=q(()=>({...Jv(e),...p})),[P,k]=q({}),[T,h]=q({});function g(A){T[A]&&h(L=>({...L,[A]:""}))}function S(A,L){x(O=>({...O,[A]:L})),g(A)}function w(A,L){k(O=>({...O,[A]:L})),g(A)}function C(A){if(A.preventDefault(),c)return;let L=Yv(e,v,P),O=Fp(e,L,t);if(Object.keys(O).length>0){h(O);return}r(Bp(L))}function E(A){!s||A.key!=="Enter"||A.shiftKey||A.isComposing||!A.target||!("tagName"in A.target)||A.target.tagName!=="TEXTAREA"||C(A)}return l("form",{class:`${Ne}-form`,onSubmit:C,onKeyDown:E,"data-testid":u,noValidate:!0,children:[e.map(A=>l(Kv,{field:A,value:v[A.name],otherText:P[A.name]??"",error:T[A.name],disabled:c,typeLabel:d?.[A.name],strings:t,onChange:L=>S(A.name,L),onOtherChange:L=>w(A.name,L)},A.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 Kv({field:e,value:t,otherText:n,error:r,disabled:o,typeLabel:a,strings:i,onChange:s,onOtherChange:c}){let p=ut(N.formField,e.name),_=Qv({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 Qv(e){let{field:t,value:n,otherText:r,disabled:o,strings:a,onChange:i,onOtherChange:s,fieldTid:c}=e,p=typeof n=="string"?n:"",_=t.type==="select"?a.formOtherPlaceholder:t.placeholder??a.formOtherPlaceholder,d=t.allowOther&&p===_o?l("input",{class:`${Ne}-field-input`,value:r,placeholder:_,disabled:o,onInput:f=>s(f.currentTarget.value)}):null;switch(t.type){case"textarea":return l("textarea",{class:`${Ne}-field-input`,rows:3,value:p,placeholder:t.placeholder,disabled:o,onInput:f=>i(f.currentTarget.value),"data-testid":c});case"select":return l(de,{children:[l("select",{class:`${Ne}-field-input`,value:p,disabled:o,onChange:f=>i(f.currentTarget.value),"data-testid":c,children:[l("option",{value:"",children:t.placeholder??"\u2014"}),(t.options??[]).map(f=>l("option",{value:f.value,children:f.label??f.value},f.value)),t.allowOther?l("option",{value:_o,children:a.formOther}):null]}),d]});case"radio":return l("div",{class:`${Ne}-field-choices`,role:"radiogroup","data-testid":c,children:[(t.options??[]).map(f=>l("label",{class:`${Ne}-choice`,children:[l("input",{type:"radio",name:`${Ne}-${t.name}`,checked:p===f.value,disabled:o,onChange:()=>i(f.value)}),l("span",{children:f.label??f.value})]},f.value)),t.allowOther?l("label",{class:`${Ne}-choice`,children:[l("input",{type:"radio",name:`${Ne}-${t.name}`,checked:p===_o,disabled:o,onChange:()=>i(_o)}),l("span",{children:a.formOther})]}):null,d]});case"checkbox":return l("label",{class:`${Ne}-choice`,children:[l("input",{type:"checkbox",checked:p==="true",disabled:o,onChange:f=>i(f.currentTarget.checked?"true":""),"data-testid":c}),l("span",{children:t.placeholder??t.label})]});case"multiselect":{let m=function(v,x){return i(x?[...f,v]:f.filter(P=>P!==v))};var u=m;let f=Array.isArray(n)?n:[];return l("div",{class:`${Ne}-field-choices`,"data-testid":c,children:[(t.options??[]).map(v=>l("label",{class:`${Ne}-choice`,children:[l("input",{type:"checkbox",checked:f.includes(v.value),disabled:o,onChange:x=>m(v.value,x.currentTarget.checked)}),l("span",{children:v.label??v.value})]},v.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:v=>s(v.currentTarget.value)}):null]})}default:return l("input",{...Xv(t.type),class:`${Ne}-field-input`,value:p,placeholder:t.placeholder,disabled:o,onInput:f=>i(f.currentTarget.value),"data-testid":c})}}function Xv(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 Jv(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 Yv(e,t,n){let r={...t};for(let o of e){let a=n[o.name]?.trim();if((o.type==="radio"||o.type==="select")&&o.allowOther&&t[o.name]===_o)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 Jt=M.cssPrefix;function Ws({form:e,strings:t,onSubmit:n,onSkip:r}){return l("div",{class:`${Jt}-form-gate`,"data-testid":N.formGate,children:[e.title?l("h3",{class:`${Jt}-form-gate-title`,children:e.title}):null,e.description?l("p",{class:`${Jt}-form-gate-desc`,children:e.description}):null,l(fo,{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:N.formSubmit,skipTestId:N.formSkip})]})}function Up({marker:e,strings:t,onFill:n}){let r=e.outcome==="skipped",o=r?t.formSkipped:t.formSubmitted,a=e.title?l(de,{children:[l("span",{children:e.title}),l("span",{class:`${Jt}-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:`${Jt}-form-done`,"data-outcome":e.outcome,"data-testid":N.formDone,children:[l("summary",{class:`${Jt}-form-done-summary`,"data-testid":N.formDoneToggle,children:[l(qn,{}),a,l(fr,{})]}),l("dl",{class:`${Jt}-form-answers`,"data-testid":N.formAnswers,children:Object.entries(s).map(([_,d])=>l("div",{class:`${Jt}-form-answer`,children:[l("dt",{children:p(_)}),l("dd",{children:d})]},_))})]})}return l("div",{class:`${Jt}-form-done`,"data-outcome":e.outcome,"data-testid":N.formDone,role:"status",children:[r?l(Vd,{}):l(qn,{}),a,r&&e.form?.reopenable&&n?l("button",{type:"button",class:`${Jt}-form-done-fill`,"data-testid":N.formFill,onClick:n,children:t.formFillOut}):null]})}var qp=Object.assign;function tb(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 nb=/^(-|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|asp|fill|st)/;function jp(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:tb(this.props,o)}function r(o){return this.shouldComponentUpdate=n,mn(e,o)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.type=e,r}var rb=Symbol.for("react.element"),ob=/^(?: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]/,ab=/[A-Z0-9]/g,ib=typeof document<"u";var sb=function(e){return/fil|che|rad/.test(e)};Dt.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Dt.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Hp=pe.event;pe.event=function(e){return Hp&&(e=Hp(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var lb={configurable:!0,get:function(){return this.class}},zp=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||ib&&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"||nb.test(d)||(_||(_=p=qp({},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"||sb(o.type)?u=="onfocus"?c="onfocusin":u=="onblur"&&(c="onfocusout"):u=c="oninput",u=="oninput"&&i[c=u]&&(c="oninputCapture")}else s&&ob.test(c)?c=c.replace(ab,"-$&").toLowerCase():p===null&&(p=void 0);i[c]=p}}a=="select"&&(i.multiple&&Array.isArray(i.value)&&(i.value=Fo(o.children).forEach(function(f){f.props.selected=i.value.indexOf(f.props.value)!=-1})),i.defaultValue!=null&&(i.value=Fo(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",lb)):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=qp({},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=rb,zp&&zp(e)};var Ga=M.cssPrefix;function Vp({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:`${Ga}-feedback`,role:"group","data-testid":N.messageFeedback,children:[l("button",{type:"button",class:`${Ga}-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":N.feedbackUp,children:l(tp,{})}),l("button",{type:"button",class:`${Ga}-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":N.feedbackDown,children:l(np,{})}),l("span",{class:`${Ga}-sr-only`,role:"status","aria-live":"polite",children:o?n.feedbackThanks:""})]})}var cb=new Set(["hidden","submit","button","reset","image","file","password"]);function Gp(e){return e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement}function ub(e){return!Gp(e)||e.name===""||e.disabled?!1:!(e instanceof HTMLInputElement&&cb.has(e.type))}function db(e){let t=e.labels?.[0]?.textContent?.trim();return e.getAttribute("toolparamdescription")??(t||e.getAttribute("aria-description"))??void 0}function pb(e,t){let n=db(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 _b(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 Wp(e){return e==null?"":typeof e=="string"?e:JSON.stringify(e)}function fb(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===Wp(t)&&!e.checked&&e.click();return}_b(e,Wp(t))}function mb(e,t,n){var i;let r=[...e.elements].filter(ub),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]=pb(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===_&&fb(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(_=>Gp(_)&&_.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 Kp(){return[...document.querySelectorAll("form[toolname][tooldescription]")].flatMap(e=>{let t=e.getAttribute("toolname")?.trim()??"",n=e.getAttribute("tooldescription")?.trim()??"";return t&&n?[mb(e,t,n)]:[]})}var Qp=`${M.cssPrefix}.page-tools`,gb=20,hb=50;function Ka(e){return typeof e=="object"&&e!==null}function vb(e){return Ka(e)&&(e.state==="running"||e.state==="stopped"||e.state==="finished"&&Ka(e.outcome))}function bb(e){let t=e?JSON.parse(e):void 0;if(!Ka(t))return{sent:[],calls:{}};let n=Array.isArray(t.sent)?t.sent.filter(o=>typeof o=="string"):[],r=Object.fromEntries(Object.entries(Ka(t.calls)?t.calls:{}).filter(o=>vb(o[1])));return{sent:n,calls:r}}var Ks={sent:[],calls:{}};function mo(){try{Ks=bb(sessionStorage.getItem(Qp))}catch{}return Ks}function Gs(e){Ks=e;try{sessionStorage.setItem(Qp,JSON.stringify(e))}catch{}}var It={markSent(e){let t=mo();Gs({...t,sent:[...t.sent.filter(n=>n!==e),e].slice(-gb)})},sentHere(e){return mo().sent.includes(e)},get(e){return mo().calls[e]},set(e,t){let n=mo(),r=Object.entries(n.calls).filter(([o])=>o!==e);Gs({...n,calls:Object.fromEntries([...r,[e,t]].slice(-hb))})},clear(e){let t=mo();e.some(n=>n in t.calls)&&Gs({...t,calls:Object.fromEntries(Object.entries(t.calls).filter(([n])=>!e.includes(n)))})}};var e_=le.scope("page-tools"),Xp="site__",Jp=3e4,yb=1e3,Yp=Symbol.for(`${M.cssPrefix}.page-tools`),Xs={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."},t_="The visitor stopped this before it finished.";function xn(e){return typeof e=="object"&&e!==null}function Pb(e){return xn(e)&&Array.isArray(e.registered)&&e.runs instanceof Map}function go(){let e=Reflect.get(globalThis,Yp);if(Pb(e))return e;let t={registered:[],runs:new Map};return Reflect.set(globalThis,Yp,t),t}function n_(e,t){let n=xn(t)&&t.signal instanceof AbortSignal?t.signal:void 0;if(n?.aborted)return;let r=go().registered;r.push(e);function o(){let a=r.indexOf(e);a>=0&&r.splice(a,1)}n?.addEventListener("abort",o,{once:!0})}function Zp(e){return e.replace(/[^A-Za-z0-9_-]/g,"_").slice(0,58)}function r_(e){if(!xn(e)||typeof e.name!="string"||!Zp(e.name))return;let t=[e.description,e.title].find(n=>typeof n=="string"&&n.trim()!=="")??e.name;return{name:Zp(e.name),description:t.trim().slice(0,1024),inputSchema:{properties:{},...xn(e.inputSchema)?e.inputSchema:{},type:"object"},consequential:xn(e.annotations)&&e.annotations.consequentialHint===!0}}function Qs(e){return e.flatMap(t=>{let n=r_(t),r=xn(t)?t.execute:void 0;return!n||typeof r!="function"?(e_.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 xb(){let e=Reflect.get(document,"modelContext")??Reflect.get(navigator,"modelContext");if(!xn(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,[])),Un(yb).then(()=>[])]).catch(()=>[]);return(Array.isArray(r)?r:[]).flatMap(o=>{let a=r_(o);return a?[{...a,run:(i,s)=>Reflect.apply(n,e,[o,i,{signal:s}])}]:[]})}async function Qa(e=[]){let t=Qs(Kp()),n=new Set(t.map(a=>a.name)),o=[...(await xb()).filter(a=>!n.has(a.name)),...t,...Qs(e),...Qs(go().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 Wt(e){return e?.execution==="client"}function ho(e){return e.startsWith(Xp)?e.slice(Xp.length):e}function Sb(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()}]`:xn(o)?t.has(o)?"[circular]":(t.add(o),o):o});return n.length>Jp?{truncated:!0,preview:n.slice(0,Jp)}:JSON.parse(n)}async function kb(e){let t=ho(e.toolName),n=(await Qa(e.optionTools)).get(t);return n?Promise.resolve().then(()=>n.run(e.input,e.signal)).then(r=>({state:"output-available",output:Sb(r)})).catch(r=>(e_.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 o_(e){let{toolCallId:t}=e,n=It.get(t);if(n?.state==="finished")return Promise.resolve(n.outcome);let{runs:r}=go(),o=r.get(t);if(o)return o.outcome;if(n?.state==="running")return It.set(t,{state:"finished",outcome:Xs}),e.onSettled("interrupted",0),Promise.resolve(Xs);let a=new AbortController,i=performance.now();It.set(t,{state:"running"});let s=kb({...e,signal:a.signal}).then(c=>(r.delete(t),It.get(t)?.state!=="running"||(It.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 Xa(e){return e===Xs.errorText||e===t_}function Ys(e){return It.set(e,{state:"stopped"}),go().runs.get(e)?.controller.abort(),t_}function a_(e){It.clear([e]),go().runs.get(e)?.controller.abort()}var qt=M.cssPrefix;function Zs(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 Sr(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?`${Zs(e.slice(0,t))} \xB7 ${Zs(n)}`:e}function Ja(e){let t=e.indexOf("__"),n=e.slice(t+2);return t>0&&n?Zs(n):Sr(e)}function Ya(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 tl({status:e,icon:t,label:n}){return l("span",{class:`${qt}-toolui-badge ${qt}-toolui-status`,"data-status":e,children:[l("span",{class:`${qt}-toolui-status-icon`,children:t}),n]})}function wb(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 kr(e,t,n={}){return n.submitted?"responded":n.incomplete?"incomplete":Rb(wb(e,t),n.superseded,n.live??!0)}function Cb({status:e}){return e==="denied"||e==="error"||e==="superseded"||e==="incomplete"?l(gr,{}):e==="completed"||e==="responded"?l(mr,{}):l(rp,{})}function Tb(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 Rb(e,t,n){return t&&(e==="awaiting"||e==="running")?"superseded":!n&&e==="running"?"error":e}function Ib({state:e,approval:t,strings:n,superseded:r,live:o=!0,submitted:a=!1,incomplete:i=!1}){let s=kr(e,t,{superseded:r,live:o,submitted:a,incomplete:i});return l(tl,{status:s,icon:l(Cb,{status:s}),label:Tb(s,n)})}function Eb({name:e,state:t,approval:n,strings:r,superseded:o,live:a,submitted:i,incomplete:s}){return l(de,{children:[l("span",{class:`${qt}-toolui-name-pill`,children:[l(Oa,{}),l("span",{class:`${qt}-toolui-name-text`,children:e})]}),l(Ib,{state:t,approval:n,strings:r,superseded:o,live:a,submitted:i,incomplete:s}),l("span",{class:`${qt}-toolui-chevron`,children:l(ln,{})})]})}function Za({part:e,strings:t,testid:n,superseded:r,live:o,submitted:a,incomplete:i}){let s=ue(()=>Se(()=>e.inputSig.value),[e]),c=ue(()=>Se(()=>e.outputSig.value),[e]),p=ue(()=>Se(()=>e.errorSig.value),[e]),_=ue(()=>Se(()=>e.stateSig.value),[e]),d=ue(()=>Se(()=>e.approvalSig.value),[e]),u=ue(()=>Se(()=>Wt(e.toolMetadata)&&Xa(e.errorSig.value)),[e]),f=i===!0||u.value;return l("details",{class:`${qt}-toolui ${qt}-toolui-collapsible`,"data-testid":n,children:[l("summary",{class:`${qt}-toolui-head`,children:l(Eb,{name:Sr(e.toolName),state:_.value,approval:d.value,strings:t,superseded:r,live:o,submitted:a,incomplete:f})}),l(zn,{label:t.toolParameters,value:s.value}),c.value!==void 0?l(zn,{label:t.toolResult,value:c.value}):null,p.value&&!f?l(zn,{label:t.statusError,value:p.value,error:!0}):null]})}function zn({label:e,value:t,error:n}){let r=n?typeof t=="string"?t:"":el(i_(t));return r?l("div",{class:`${qt}-toolui-section`,children:[l("span",{class:`${qt}-toolui-label`,children:e}),l("pre",{class:`${qt}-toolui-code`,"data-error":n?"true":void 0,children:r})]}):null}function ei(e){return!!el(e.inputSig.value)||!!e.errorSig.value||!!el(i_(e.outputSig.value))}function i_(e){if(e&&typeof e=="object"){let t=e;if(t.storage==="tool-result-ref"&&"summary"in t)return t.summary}return e}function el(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 s_(e){return e.partsSig.value.some(t=>t.kind==="text"&&t.textSig.value.length>0)}function l_(e){return e.partsSig.value.some(t=>t.kind==="reasoning")}function Ab(e){return e.streaming&&!e.bufferedHold&&!(e.reasoningVisible&&e.working)}function c_(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:Ab({streaming:t,bufferedHold:a,reasoningVisible:n,working:i}),emptyReply:r,hidden:o}}function u_(e,t){let n=e.stateSig.value,r=e.approvalSig.value,{terminal:o,responded:a,decided:i}=Ya(n,r),s=t.continuationStreaming===!0&&!i,c=t.superseded&&!i&&!s;return{pill:kr(n,r,{superseded:c,live:t.live,submitted:s,incomplete:Wt(e.toolMetadata)&&Xa(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 wr=M.cssPrefix;function d_({part:e,strings:t}){let n=e.title||e.filename||e.url||t.sources;return e.url?l("a",{class:`${wr}-source`,href:e.url,target:"_blank",rel:"noreferrer noopener","data-testid":N.source,children:[l("span",{class:`${wr}-source-icon`,"aria-hidden":"true",children:"\u{1F517}"}),l("span",{class:`${wr}-source-label`,children:n})]}):l("span",{class:`${wr}-source`,"data-testid":N.source,children:[l("span",{class:`${wr}-source-icon`,"aria-hidden":"true",children:"\u{1F4C4}"}),l("span",{class:`${wr}-source-label`,children:n})]})}var Nt=M.cssPrefix;function p_({part:e,strings:t,active:n,superseded:r=!1,continuationStreaming:o=!1,onDecision:a,onEdit:i}){let s=ue(()=>Se(()=>e.approvalSig.value),[e]),c=ue(()=>Se(()=>u_(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=Sr(e.toolName),x=c.answeredApproved,P=e.toolCallId,k=l(de,{children:[l("p",{class:`${Nt}-toolui-prompt`,children:t.approvalPrompt.replace("{tool}",v)}),l("p",{class:`${Nt}-toolui-subtle`,children:t.approvalBody})]});u?k=l("p",{class:`${Nt}-toolui-subtle`,children:t.approvalSubmitting}):d&&x!==!1?k=l(de,{children:[l("p",{class:`${Nt}-toolui-prompt`,children:[t.approvalYourResponse.replace("{decision}",x?t.approve:t.reject),s.value?.reason?` \u2014 ${s.value.reason}`:""]}),f?l("p",{class:`${Nt}-toolui-subtle`,children:t.approvalEditHint}):null,f?null:l("p",{class:`${Nt}-toolui-subtle`,children:t.approvalSubmitting})]}):d&&(k=l(de,{}));let T=_||u||f||d&&x!==!1;return l("div",{class:`${Nt}-toolui-group`,"data-testid":c.decided?N.toolDecision:N.toolApproval,children:[l(Za,{part:e,strings:t,superseded:m,submitted:u}),m||p||!T?null:l("div",{class:`${Nt}-toolui ${Nt}-toolui-body`,children:[k,_?l("div",{class:`${Nt}-toolui-actions`,children:[l("button",{type:"button",class:`${Nt}-form-skip`,disabled:!n,onClick:()=>a(P,!1),"data-testid":N.toolReject,children:t.reject}),l("button",{type:"button",class:`${Nt}-form-submit`,disabled:!n,onClick:()=>a(P,!0),"data-testid":N.toolApprove,children:t.approve})]}):null,f?l("div",{class:`${Nt}-toolui-actions`,children:l("button",{type:"button",class:`${Nt}-form-skip`,onClick:()=>i(P),"data-testid":N.toolEdit,children:t.edit})}):null]})]})}var Mb=["text","email","phone","number","date","single-select","multi-select","boolean"];function __(e){return e!==null&&typeof e=="object"}function f_(e){let t=__(e)?e:{},r=(Array.isArray(t.questions)?t.questions:[]).map(Nb).filter(o=>o!==null);return{intro:ti(t.intro),questions:r}}function Nb(e,t){if(!__(e))return null;let n=Mb.find(r=>r===e.type)??"text";return{key:ti(e.key)??`q${t+1}`,question:ti(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:ti(e.helpText)}}function Lb(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 nl(e,t,n){return e.questions.map(r=>{let o=Lb(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 ti(e){return typeof e=="string"&&e.trim()?e.trim():void 0}var Ze=M.cssPrefix;function Ob({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 $b={text:"qtypeText",email:"qtypeEmail",phone:"qtypePhone",number:"qtypeNumber",date:"qtypeDate","single-select":"qtypeChooseOne","multi-select":"qtypeChooseAny",boolean:"qtypeBoolean"};function m_(e,t){let n={};for(let r of e)n[r.key]=t[$b[r.type]];return n}function g_({part:e,strings:t,active:n,superseded:r=!1,continuationStreaming:o=!1,onDecision:a,onEdit:i}){let s=ue(()=>Se(()=>e.stateSig.value),[e]).value,c=ue(()=>Se(()=>e.approvalSig.value),[e]).value,p=ue(()=>Se(()=>f_(e.inputSig.value)),[e]).value,{terminal:_,decided:d}=Ya(s,c),u=d&&c?.approved===!0,f=o&&!d,m=!d&&!r&&!f,v=!m&&!u&&!f,x=u&&n&&!_,P=p.questions,[k,T]=q(null),g=k??(m||u||f),[S,w]=q(!1),C=P.length>1?$s:so,E=m?t.inputRequired:t.inputBadge,A=f?l("p",{class:`${Ze}-toolui-subtle`,children:t.approvalSubmitting}):m?l(Db,{req:p,strings:t,active:n,resolve:(z,V)=>a(e.toolCallId,V,z)}):S?l(fo,{fields:nl(p,t.confirmYes,t.confirmNo),strings:t,submitLabel:t.inputSubmit,onSubmit:()=>{},disabled:!0,hideActions:!0,fieldTypeLabels:m_(P,t),initialValues:u?Hb(P,c?.reason):void 0}):l(Fb,{questions:P,answers:u?qb(c?.reason):{},strings:t}),{status:L,statusLabel:O}=Ob({skipped:v,submitted:f,strings:t});return l("details",{class:`${Ze}-toolui ${Ze}-toolui-collapsible${r?` ${Ze}-toolui-stale`:""}`,open:g,onToggle:z=>{let V=z.currentTarget.open;V!==g&&T(V)},"data-testid":m?N.toolAskQuestions:N.toolDecision,children:[l("summary",{class:`${Ze}-toolui-head`,children:[l("span",{class:`${Ze}-toolui-q-pill`,children:[l(C,{}),E]}),l("span",{class:`${Ze}-toolui-head-end`,children:[m?null:l(tl,{status:L,icon:v?l(gr,{}):l(mr,{}),label:O}),l("span",{class:`${Ze}-toolui-chevron`,children:l(ln,{})})]})]}),l("div",{class:`${Ze}-toolui-collapse-body`,children:[p.intro?l("div",{class:`${Ze}-toolui-desc`,children:p.intro}):null,A,m||f?null:l("div",{class:`${Ze}-toolui-footer`,children:[l("button",{type:"button",class:`${Ze}-toolui-options-toggle`,onClick:()=>w(z=>!z),"data-testid":N.toolAskOptions,children:[l("span",{class:`${Ze}-toolui-options-chevron${S?` ${Ze}-open`:""}`,children:l(ln,{})}),S?t.hideOptions:t.showOptions]}),x?l("button",{type:"button",class:`${Ze}-form-skip`,onClick:()=>i(e.toolCallId),"data-testid":N.toolEdit,children:t.edit}):null]})]})]})}function Db({req:e,strings:t,active:n,resolve:r}){let o=nl(e,t.confirmYes,t.confirmNo),a=e.questions.length===1&&e.questions[0]?.type==="text";return l(fo,{fields:o,strings:t,disabled:!n,submitLabel:t.inputSubmit,footerHint:a?t.inputSubmitHint:void 0,onSubmit:i=>r(Ub(e.questions,i),!0),skipLabel:t.inputSkip,onSkip:()=>r(void 0,!1),submitOnEnter:a,fieldTypeLabels:m_(e.questions,t),submitTestId:N.toolInputSubmit,skipTestId:N.toolInputSkip})}function Fb({questions:e,answers:t,strings:n}){return l("div",{class:`${Ze}-toolui-summary`,"data-testid":N.toolAskSummary,children:e.map(r=>l("div",{class:`${Ze}-field`,children:[l("span",{class:`${Ze}-field-head`,children:l("span",{class:`${Ze}-field-label`,children:[r.question,r.required?l("span",{class:`${Ze}-field-req`,"aria-hidden":"true",children:" *"}):null]})}),l("p",{class:`${Ze}-toolui-answer`,children:Bb(r,t[r.key],n)||"\u2014"})]},r.key))})}function Bb(e,t,n){return e.type!=="boolean"?t??"":t==="yes"?n.confirmYes:t==="no"?n.confirmNo:t??""}function Ub(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 h_(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 qb(e){let t=h_(e),n={};for(let[r,o]of Object.entries(t))n[r]=Array.isArray(o)?o.join(", "):o;return n}function Hb(e,t){let n=h_(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 v_({part:e,strings:t,live:n,superseded:r}){let o=Wt(e.toolMetadata);if(!ue(()=>Se(()=>ei(e)),[e]).value&&!o)return null;let i=e.outputSig.value===void 0&&!e.errorSig.value;return l(Za,{part:e,strings:t,testid:N.toolCall,live:n||o&&!r,incomplete:o&&r&&i})}var Le=M.cssPrefix;function b_(e){return e.kind==="tool"&&e.approvalSig.value===void 0&&!e.toolMetadata?.card&&!Wt(e.toolMetadata)}function y_(e,t){let n=[];for(let[r,o]of e.entries()){let a=n.at(-1);if(o.kind==="reasoning"&&t.showReasoning||b_(o)&&ei(o)){a?.kind==="steps"?(a.parts.push(o),a.indices.push(r)):n.push({kind:"steps",parts:[o],indices:[r]});continue}o.kind==="step-start"||o.kind==="reasoning"||o.kind==="source"&&!t.showSources||b_(o)||n.push({kind:"part",part:o,index:r})}return n}function zb(e){if(!(!e||typeof e!="object"))return Object.values(e).find(t=>typeof t=="string"&&t.trim().length>0)?.trim()}function P_({parts:e,strings:t,live:n,running:r}){let[o,a]=q(!1),i=e.filter(d=>d.kind==="tool"),s=i.filter(d=>kr(d.stateSig.value,d.approvalSig.value,{live:n})==="error").length,c=new Map;for(let d of i)c.set(Ja(d.toolName),(c.get(Ja(d.toolName))??0)+1);let p=e.at(-1),_=p?.kind==="tool"?`${Ja(p.toolName)}\u2026`:t.thinking;return l("div",{class:`${Le}-steps`,"data-testid":N.toolSteps,"data-running":r?"true":void 0,children:[l("button",{type:"button",class:`${Le}-steps-head`,"aria-expanded":o,onClick:()=>a(!o),children:[l("span",{class:`${Le}-steps-icon`,"aria-hidden":"true",children:r?l("span",{class:`${Le}-loading-spinner`}):l(Oa,{})}),l("span",{class:`${Le}-steps-label`,children:r?_:[...c].map(([d,u],f)=>l("span",{class:`${Le}-steps-name`,children:[f>0?l("span",{"aria-hidden":"true",children:"\xB7"}):null,l("span",{class:`${Le}-steps-name-text`,children:d}),u>1?l("span",{class:`${Le}-steps-count`,children:["\xD7",u]}):null]},d))}),!r&&s>0?l("span",{class:`${Le}-steps-failed`,children:t.toolStepsFailed.replace("{count}",String(s))}):null,l("span",{class:`${Le}-toolui-chevron`,"data-open":o?"true":void 0,children:l(ln,{})})]}),l("span",{class:`${Le}-sr-only`,role:"status",children:r?_:""}),o?l("ol",{class:`${Le}-steps-list`,children:e.map((d,u)=>d.kind==="tool"?l(jb,{part:d,strings:t,live:n},d.toolCallId):l(Wb,{part:d,strings:t},`${d.id}#${u}`))}):null]})}function jb({part:e,strings:t,live:n}){let[r,o]=q(!1),a=kr(e.stateSig.value,e.approvalSig.value,{live:n}),i=zb(e.inputSig.value);return l("li",{class:`${Le}-steps-row`,"data-testid":N.toolStep,"data-status":a,children:[l("button",{type:"button",class:`${Le}-steps-row-head`,"aria-expanded":r,onClick:()=>o(!r),children:[l("span",{class:`${Le}-steps-row-icon`,"aria-hidden":"true",children:l(Vb,{status:a})}),l("span",{class:`${Le}-steps-row-name`,children:Sr(e.toolName)}),i?l("span",{class:`${Le}-steps-row-summary`,children:i}):null,a==="error"?l("span",{class:`${Le}-steps-failed`,children:t.statusError}):null]}),r?l("div",{class:`${Le}-steps-row-body`,children:[l(zn,{label:t.toolParameters,value:e.inputSig.value}),e.outputSig.value!==void 0?l(zn,{label:t.toolResult,value:e.outputSig.value}):null,e.errorSig.value?l(zn,{label:t.statusError,value:e.errorSig.value,error:!0}):null]}):null]})}function Vb({status:e}){return e==="running"?l("span",{class:`${Le}-loading-spinner`}):e==="error"?l(gr,{}):l(mr,{})}function Wb({part:e,strings:t}){let[n,r]=q(!1);return l("li",{class:`${Le}-steps-row`,"data-status":"thought",children:[l("button",{type:"button",class:`${Le}-steps-row-head`,"aria-expanded":n,onClick:()=>r(!n),children:l("span",{class:`${Le}-steps-row-name`,children:t.thoughts})}),n?l("div",{class:`${Le}-steps-row-body ${Le}-reasoning-body`,children:l(hr,{textSig:e.textSig,doneSig:e.doneSig})}):null]})}var Oe=M.cssPrefix,x_=jp(Gb);function Gb({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=[...ue(()=>Se(()=>e.partsSig.value),[e]).value];for(let G of e.attachments??[])!G.url||m.some(Y=>Y.kind==="file"&&Y.url===G.url)||m.push({kind:"file",url:G.url,mediaType:G.mediaType,filename:G.name,fileId:G.id,fileSize:G.size});let v=ue(()=>Se(()=>Dn(e)),[e]),x=ue(()=>Se(()=>ud(e)),[e]),P=ue(()=>Se(()=>s_(e)),[e]),k=ue(()=>Se(()=>o&&l_(e)),[e,o]),T=t==="streaming",h=e.role==="assistant"&&T,g=c_({streaming:h,responseMode:r,reasoningVisible:k.value,hasAnswerText:P.value,emptyReply:v.value,hidden:x.value}),{bufferedHold:S,working:w,showStreamDots:C}=g;if(g.hidden)return null;let E=Qb(e.createdAt),A=e.role==="assistant"||e.role==="operator",L=d&&!!u&&!!e.serverMessageId&&A&&!T&&t!=="error"&&!v.value,O=T?"":m.filter(G=>G.kind==="text").map(G=>e.role==="assistant"?xa(G.textSig.peek()):G.textSig.peek()).join(`
60
+ ${n}`:"";s||(t++,a&&(n+="> "));let d={};i.replace(/(\w+)=(["'])(.*?)\2/g,(m,v,y,x)=>d[v]=x);let u=d.href??d.src,f=d.title??d.path??d.query??d.body??d.header??d.name??u;return(a?"> ":"")+(f?`**${u?`[${f}](${u})`:f}**${d.type?` \`${d.type}\``:""}
61
+ ${n}`:"")})}function mp(e){for(let t of e.querySelectorAll("a")){let n=t.getAttribute("href")??"";!n||n.startsWith("#")||(t.target="_blank",t.rel="noopener noreferrer")}}var gp=new Set([11,12,13,14,15,16,17,18,19,31]);function ja(e){let t="",n=[],r=cr({data:void 0,add_token:(o,a)=>{n.push(a),gp.has(a)||(t+=" ")},end_token:()=>{let o=n.pop();o!==void 0&&!gp.has(o)&&(t+=" ")},add_text:(o,a)=>{t+=a},set_attr:()=>{}});return et(r,e),Wr(r),t.replace(/\s+/g," ").trim()}var bp=N.cssPrefix;function Dt({tone:e="info",message:t,onRetry:n,strings:r}){return l("div",{class:`${bp}-module-empty`,role:e==="error"?"alert":"status","aria-live":"polite",children:[l("span",{children:t}),n?l("button",{type:"button",class:`${bp}-module-retry`,onClick:n,children:r.errorRetry}):null]})}var Sn=N.cssPrefix,mv=ce.scope("content"),gv=5e3;function yp({id:e,title:t,transport:n,strings:r,bus:o,onBack:a,actions:i}){let[s,c]=U(null),[p,_]=U(!1),[d,u]=U(!1),[f,m]=U(0),[v,y]=U(null),x=F(()=>{u(!1),c(null),m(g=>g+1)},[]);$(()=>{let g=!1,b=n.listContentCollections([]).catch(()=>{});return Promise.all([n.listContent({ids:[e],limit:1}),b]).then(([k,E])=>{if(g)return;let R=k.items[0];R?(c(R),_(E?.items.find(A=>A.id===R.contentCollectionId)?.settings?.voteAccess==="portal"),o.emit("contentOpen",{contentId:e,contentCollectionId:R.contentCollectionId})):u(!0)}).catch(k=>{g||(mv.warn("listContent (reader) failed",{err:k}),u(!0))}),()=>{g=!0}},[n,e,f,o]),$(()=>{if(!s)return;let g=setTimeout(()=>o.emit("contentRead",{contentId:e}),gv);return()=>clearTimeout(g)},[s,e,o]);let S=F(g=>{let k=g.target?.closest?.("a")?.getAttribute("href")??"";k&&!k.startsWith("#")&&o.emit("contentLinkClick",{contentId:e})},[o,e]);function w(g){y(e),n.setContentVote({contentId:e,value:g})}function h(){return d?l(Dt,{tone:"error",message:r.errorGeneric,onRetry:x,strings:r}):s===null?l(Dt,{message:r.contentLoading,strings:r}):l("article",{class:`${Sn}-content`,"data-testid":M.contentView,onClick:S,children:[s.image?l("img",{class:`${Sn}-content-hero`,src:s.image,alt:"",loading:"lazy"}):null,s.description?l("p",{class:`${Sn}-content-subtitle`,children:s.description}):null,l(hp,{text:vp(s.content??"")}),p?l("div",{class:`${Sn}-content-vote`,"aria-live":"polite",children:v===e?r.feedbackThanks:l(ue,{children:[l("span",{children:r.contentHelpful}),l("button",{type:"button",class:`${Sn}-module-retry`,onClick:()=>w(1),children:r.confirmYes}),l("button",{type:"button",class:`${Sn}-module-retry`,onClick:()=>w(0),children:r.confirmNo})]})}):null]})}return l("div",{class:`${Sn}-module`,children:[l(za,{title:s?.title||t||r.moduleBack,backLabel:r.moduleBack,onBack:a,actions:i,testid:M.backHeader}),l("div",{class:`${Sn}-module-scroll`,"data-testid":M.contentScroll,children:h()})]})}function Pp({itemCount:e,initialFocusIndex:t}){let[n,r]=U(!1),o=D(null),a=D(null),[i,s]=U(-1),c=F(()=>{r(!1),s(-1),o.current?.focus()},[]),p=F(()=>r(u=>!u),[]);$(()=>{if(!n)return;function u(f){let m=a.current,v=o.current;if(!m||!v)return;let y=f.composedPath();y.includes(m)||y.includes(v)||(r(!1),s(-1))}return document.addEventListener("click",u,!0),()=>document.removeEventListener("click",u,!0)},[n]),$(()=>{if(!n||e===0)return;let u=t?.()??0,f=u<0||u>=e?0:u;s(f)},[n,e,t]),$(()=>{if(!n||i<0)return;a.current?.querySelectorAll("[role='menuitem']")?.[i]?.focus()},[n,i]);let _=F(u=>{(u.key==="ArrowDown"||u.key==="Enter"||u.key===" ")&&(u.preventDefault(),r(!0))},[]),d=F(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 xp({items:e,triggerLabel:t}){let n=N.cssPrefix,r=Pp({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(Gd,{})}),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":`${M.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(jn,{})}):null]},s.id))}):null]})}var Vs=N.cssPrefix;function hv(e){let t=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)").matches:!0;return e==="host"?ar()==="dark"?"light":"dark":e==="auto"?t?"light":"dark":t?e==="light"?"dark":"auto":e==="dark"?"light":"auto"}var vv={normal:"large",large:"small",small:"normal"};function bv(e){return e==="light"?l(rp,{}):e==="dark"?l(op,{}):l(ap,{})}function yv(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 Xt({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,y=t==="chat",x=It(()=>o.mutedSig.value).value,S=new Set(n.actions);function w(X){return S.has(X)}let h=typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches;function g(X){return h?!1:_r(X,v,r)}let b=n.themeMode,k={auto:m.themeAuto,light:m.themeLight,dark:m.themeDark,host:m.themeAuto},E=n.textSize,R={small:m.textSizeSmall,normal:m.textSizeNormal,large:m.textSizeLarge},A=[];if(y&&w("clear")&&A.push({id:"clear",icon:l(ep,{}),label:m.newConversation,onSelect:i}),w("expand")&&g("expand")){let X=r==="expanded";A.push({id:"expand",icon:X?l(Hd,{}):l(qd,{}),label:X?m.collapse:m.expand,type:"switch",on:X,onSelect:s})}if(w("fullscreen")&&g("fullscreen")){let X=r==="fullscreen";A.push({id:"fullscreen",icon:X?l(jd,{}):l(zd,{}),label:X?m.exitFullscreen:m.fullscreen,type:"switch",on:X,onSelect:c})}let L=n.popOutUrl,j=n.aiAgentDeploymentId;w("popOut")&&L&&j&&_r("popOut",v,r)&&A.push({id:"popOut",icon:l(Vd,{}),label:m.popOut,onSelect:()=>{let X=Pv(L,{conversationId:e.conversationId,widgetId:n.widgetId,publicKey:n.publicKey,aiAgentDeploymentId:j});X&&window.open(X,"_blank","noopener,noreferrer")}}),y&&w("sound")&&A.push({id:"sound",icon:x?l(Qd,{}):l(Kd,{}),label:x?m.soundOff:m.soundOn,type:"switch",on:!x,onSelect:p}),w("theme")&&A.push({id:"theme",icon:bv(b),label:`${m.theme}: ${k[b]}`,onSelect:()=>u(hv(b)),keepOpen:!0}),w("textSize")&&A.push({id:"textSize",icon:l(Xd,{}),label:`${m.textSize}: ${R[E]}`,onSelect:()=>f(vv[E]),keepOpen:!0}),w("language")&&n.availableLocales.length>1&&A.push({id:"language",icon:l(Zd,{}),label:m.language,segments:n.availableLocales.map(X=>({value:X,label:yv(X),lang:X})),value:n.locale,onSelectValue:d});let B=!!a&&Oa(v,r,n.actions),V=y&&w("history");return l("div",{class:`${Vs}-header-actions`,children:[V?l("button",{type:"button",class:`${Vs}-icon-btn`,onClick:_,"aria-label":m.history,title:m.history,"data-testid":M.actionHistory,children:l(Yd,{})}):null,A.length>0?l(xp,{items:A,triggerLabel:m.moreActions}):null,B?l("button",{type:"button",class:`${Vs}-icon-btn`,onClick:a,"aria-label":m.close,title:m.close,"data-testid":M.actionClose,children:l(qt,{})}):null]})}var Sp={Icon:lo};function Vn(e,t){return e instanceof pt?e.status===429?e.retryAfterSeconds?t.errorRateLimitedIn.replace("{seconds}",String(e.retryAfterSeconds)):t.errorRateLimited:e.code==="network"?t.errorOffline:e.status!==void 0&&e.status>=500?t.errorServer:t.errorGeneric:t.errorGeneric}var br=N.cssPrefix;function kp({placeholder:e,onActivate:t}){return l("button",{type:"button",class:`${br}-home-search`,onClick:t,"data-testid":M.homeSearch,children:[l("span",{class:`${br}-home-search-text`,children:e}),l("span",{class:`${br}-home-search-icon`,"aria-hidden":"true",children:l(js,{})})]})}function wp({placeholder:e,value:t,onInput:n}){return l("div",{class:`${br}-home-search`,"data-input":"true",children:[l("input",{type:"search",class:`${br}-home-search-input`,placeholder:e,value:t,maxLength:200,onInput:r=>n(r.currentTarget.value),"data-testid":M.helpSearch}),l("span",{class:`${br}-home-search-icon`,"aria-hidden":"true",children:l(js,{})})]})}var uo=N.cssPrefix;function Va({title:e,subtitle:t,onClick:n,testid:r}){return l("button",{type:"button",class:`${uo}-list-row`,onClick:n,"data-testid":r,children:[l("span",{class:`${uo}-list-row-body`,children:[l("span",{class:`${uo}-list-row-title`,children:e}),t?l("span",{class:`${uo}-list-row-sub`,children:t}):null]}),l("span",{class:`${uo}-list-row-chevron`,"aria-hidden":"true",children:l(gr,{})})]})}var Jt=N.cssPrefix,xv=ce.scope("help"),Sv=20,kv=300;function wv(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 Cp({transport:e,strings:t,bus:n},r,o){let[a,i]=U(),s=D(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:Sv,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===_&&(xv.warn("listContent (help) failed",{err:d,page:p}),i(u=>u&&{...u,loading:!1,error:Vn(d,t)}))})}return $(()=>{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 Cv(e){let{strings:t,config:n,nav:r,panelProps:o}=e,a=n.contentCollectionIds,[i,s]=U(""),[c,p]=U(""),_=Cp(e,a),d=Cp(e,c?a:void 0,c),[u,f]=i.trim()?d:_;$(()=>{let v=setTimeout(()=>p(i.trim()),kv);return()=>clearTimeout(v)},[i]);function m(){if(!a?.length)return l(Dt,{message:t.helpEmpty,strings:t});let v=u?.error?l(Dt,{tone:"error",message:u.error,onRetry:f,strings:t}):null;return v&&!u?.pagination?v:!u||!u.pagination&&!u.items.length?l(Dt,{message:t.helpLoading,strings:t}):u.items.length?l(ue,{children:[wv(u.items,a,u.collections).map(y=>l("section",{class:`${Jt}-help-group`,children:[y.title?l("h2",{class:`${Jt}-help-section-title`,children:y.title}):null,l("div",{class:`${Jt}-help-card`,children:y.rows.map(x=>l(Va,{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:_t(M.helpArticle,x.id)},x.id))})]},y.id)),v,u.pagination?.hasNext&&!v?l("div",{children:l("div",{class:`${Jt}-help-card`,children:l("button",{type:"button",class:`${Jt}-list-row ${Jt}-help-more`,onClick:f,"aria-busy":u.loading,children:[u.loading?l("span",{class:`${Jt}-loading-spinner`,"aria-hidden":"true"}):null,t.helpShowMore]})})}):null]}):l(Dt,{message:u.search?t.helpSearchEmpty.replace("{query}",u.search):t.helpEmpty,strings:t})}return l("div",{class:`${Jt}-module`,children:[l(Ha,{title:t.helpTitle,actions:l(Xt,{panelProps:o,variant:"plain"})}),l("div",{class:`${Jt}-module-pad`,children:l(wp,{placeholder:t.helpSearchPlaceholder,value:i,onInput:s})}),l("div",{class:`${Jt}-help-list`,children:m()})]})}var Tp={Icon:so,Root:e=>l(Cv,{...e})};var Rp=ce.scope("attachments");function Wa(e,t,n){let r=Rv(e),o=[],a=[],i=Ev(n.accept),s=t.reduce((p,_)=>p+_.size,0),c=t.length;for(let p of r){let _=Tv(p,c,s,n,i);if(_){a.push({file:p,reason:_});continue}o.push(Av(p)),s+=p.size,c+=1}return(o.length||a.length)&&Rp.debug("ingest",{accepted:o.length,rejected:a.map(p=>({name:p.file.name,reason:p.reason}))}),{accepted:o,rejected:a}}function yr(e){try{URL.revokeObjectURL(e.previewUrl)}catch(t){Rp.debug("revokeObjectURL failed",{error:t})}}function Tv(e,t,n,r,o){return t>=r.maxCount?"count":n+e.size>r.maxBytes?"bytes":Mv(e,o)?null:"mime"}function Rv(e){return e?Array.isArray(e)?e.filter(t=>t instanceof File):[...e].map(t=>t instanceof File?t:Iv(t)).filter(t=>t!==null):[]}function Iv(e){let t=e;return!t?.getAsFile||t.kind!=="file"?null:t.getAsFile()}function Av(e){return{file:e,id:Ct(),mediaType:e.type||"application/octet-stream",name:e.name||"pasted-file",previewUrl:URL.createObjectURL(e),size:e.size}}function Ev(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 Mv(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 po=N.cssPrefix;function Ip({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:`${po}-attachment-chip`,title:e.name,"data-testid":_t(M.attachmentChip,e.id),children:[r?l("img",{class:`${po}-attachment-thumb`,src:e.previewUrl,alt:""}):l("span",{class:`${po}-attachment-thumb`,"aria-hidden":"true",children:l(Da,{})}),l("span",{class:`${po}-attachment-name`,children:e.name}),l("button",{type:"button",class:`${po}-attachment-remove`,onClick:t,disabled:n,"aria-label":`Remove ${e.name}`,"data-testid":_t(M.attachmentRemove,e.id),children:l(qt,{})})]})}var Ws={isSupported:!1,start:()=>{},stop:()=>{},cancel:()=>{}};function Gs(e,t,n){return e==="disabled"?Ws:e==="server"?$v(n):Nv(t)}function Nv(e){let t=Lv();if(!t)return Ws;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 y=u.results[v];y&&(f+=y[0].transcript,y.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 Lv(){return window.SpeechRecognition??window.webkitSpeechRecognition}var Ov=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];function $v(e){if(typeof MediaRecorder>"u"||!navigator?.mediaDevices?.getUserMedia)return Ws;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 _=Dv(),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 Dv(){for(let e of Ov)if(MediaRecorder.isTypeSupported(e))return e}var nt=N.cssPrefix,Pr=ce.scope("composer");function xr(e){return e.reduce((t,n)=>t+n.size,0)}var Ks={arrowUp:Dd,paperPlane:$d,send:Fd,chevron:gr};function Ap(e){return"activeElement"in e}function Fv(e){return"host"in e&&"activeElement"in e}function Ep({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:y,onSend:x,onStop:S,apiRef:w}){let h=e.strings,[g,b]=U(()=>o.loadDraft(a)),[k,E]=U([]),[R,A]=U(()=>o.loadMessageQueue(a).map(q=>({id:q.id,text:q.text,attachments:[]}))),L=D(R),j=D(!1),[B,V]=U(!1),[X,pe]=U(!1),J=D(!1),le=D(null),ke=D(null),be=D(null),Me=D(0),Fe=D(a);Fe.current=a;let te=D(d);te.current=d;let Pe=D(u);Pe.current=u;let Oe=X||u||!d,lt=i&&v==="ai-agent",ot=lt||c&&v==="ai-agent",gt=v==="ai-agent"&&(ot||_||R.length>0),Mt=F(q=>{A(K=>{let Y=q(K);return o.saveMessageQueue(Fe.current,Y.filter(ge=>ge.attachments.length===0).map(({id:ge,text:ft})=>({id:ge,text:ft}))),L.current=Y,Y})},[o]),ht=F(q=>{Mt(K=>(K.find(Y=>Y.id===q)?.attachments.forEach(yr),K.filter(Y=>Y.id!==q)))},[Mt]),Te=F(q=>{b(K=>{let Y=typeof q=="function"?q(K):q;return Y===K?K:(o.saveDraft(Fe.current,Y),Y)})},[o]),ct=e.features.fileUpload,Se=e.features.voice,[He,ze]=U(()=>Gs(Se,e.locale,(q,K)=>t.transcribe(q,K))),Nt=D(He);Nt.current=He;let Ve=D({mode:Se,locale:e.locale,transport:t});$(()=>{let q=Ve.current;q.mode===Se&&q.locale===e.locale&&q.transport===t||(Ve.current={mode:Se,locale:e.locale,transport:t},Me.current++,Nt.current.cancel(),be.current=null,V(!1),ze(Gs(Se,e.locale,(K,Y)=>t.transcribe(K,Y))))},[e.locale,Se,t]),Tt(()=>()=>{Me.current++,He.cancel()},[He]);let yt=F(q=>{let K=be.current;if(K===null)return!1;let Y=Math.round(performance.now()-K);return Pr[q]("voiceStop",{durationMs:Y}),r.emit("voiceStop",{durationMs:Y}),be.current=null,!0},[r]),O=F(()=>{be.current!==null&&(He.stop(),V(!1),yt("info")&&n.play("voiceStop"))},[yt,n,He]),C=F(()=>{Me.current++,He.cancel(),V(!1),yt("info")&&n.play("voiceStop")},[yt,n,He]);$(()=>{(u||!d)&&C()},[d,C,u]),$(()=>{let q=le.current;if(!q)return;let K=q.getRootNode(),Y=Ap(K)?K.activeElement:null;Y&&q.closest(`.${nt}-panel`)?.contains(Y)||q.focus({preventScroll:!0})},[]),$(()=>{let q=le.current;if(!q)return;if(g.length===0){q.style.height="";return}q.style.height="auto";let K=getComputedStyle(q),Y=Number.parseFloat(K.getPropertyValue(`--${nt}-textarea-base-height`)),ge=Number.parseFloat(K.borderTopWidth)+Number.parseFloat(K.borderBottomWidth),ft=Math.min(q.scrollHeight+ge,Number.parseFloat(K.maxHeight)),Lt=Number.parseFloat(K.fontSize)*.7;q.style.height=`${ft<Y+Lt?Y:ft}px`},[g]);let H=D(k);H.current=k,$(()=>()=>{H.current.forEach(yr);for(let q of L.current)q.attachments.forEach(yr)},[]),Tt(()=>{if(w)return w.current={attachFromDrop:q=>{if(!ct||!te.current||J.current||Pe.current)return;let K=Wa(q,H.current,e.attachments);K.accepted.length!==0&&(Pr.info("attach (drop)",{count:K.accepted.length,totalBytes:xr(K.accepted)}),r.emit("attach",{count:K.accepted.length,totalBytes:xr(K.accepted)}),E(Y=>[...Y,...K.accepted]))},fill:q=>{if(!te.current||J.current||Pe.current)return;Te(q);let K=le.current;K&&(K.focus({preventScroll:!0}),requestAnimationFrame(()=>K.setSelectionRange(K.value.length,K.value.length)))},acceptQueuedMessage:ht},()=>{w.current&&(w.current=null)}},[w,ct,u,e.attachments,ht,Te]),$(()=>{let q=le.current;if(!q)return;let K=q.closest(`.${nt}-panel`);if(!K)return;let Y=ge=>{if(!te.current||J.current||Pe.current)return;let ft=ge.clipboardData;if(!ft)return;let Lt=ge.target?.closest?.("input, textarea, [contenteditable]:not([contenteditable='false'])");if(Lt&&Lt!==q)return;if(ct){let Pt=Wa(ft.items,H.current,e.attachments);if(Pt.accepted.length>0){ge.preventDefault(),Pr.info("attach (paste)",{count:Pt.accepted.length,totalBytes:xr(Pt.accepted)}),r.emit("attach",{count:Pt.accepted.length,totalBytes:xr(Pt.accepted)}),E(Tn=>[...Tn,...Pt.accepted]);return}}if(Lt===q)return;let Cn=ft.getData("text/plain");Cn&&(ge.preventDefault(),Te(Pt=>Pt+Cn),q.focus())};return K.addEventListener("paste",Y),()=>K.removeEventListener("paste",Y)},[ct,e.attachments,Te]);async function oe(){let q=g.trim();if(!q&&k.length===0||!d||lt||J.current||u)return;C(),J.current=!0,pe(!0);let K=g,Y=k;try{await x(q,Y)&&(Te(ge=>ge===K?"":ge),E(ge=>ge!==Y?ge:(Y.forEach(yr),H.current=[],[])))}finally{J.current=!1,pe(!1),requestAnimationFrame(()=>{let ge=le.current;if(!ge||ge.disabled||!te.current)return;let ft=ge.getRootNode(),Lt=Ap(ft)?ft.activeElement:null,Cn=Lt?.getAttribute("data-testid");if(!(Lt&&Lt!==ge&&Cn!==M.composerSend&&Cn!==M.composerStop)){if(Fv(ft)){let Pt=ft.host.ownerDocument;if(!Pt.hasFocus())return;let Tn=Pt.activeElement;if(Tn&&Tn!==ft.host&&Tn!==Pt.body)return}ge.focus({preventScroll:!0})}})}}function ne(){let q=g.trim();if(!q&&k.length===0||!d||!gt||J.current||u)return;C();let K=k;Mt(Y=>[...Y,{id:Ct(),text:q,attachments:K}]),Te(""),E(Y=>Y!==K?Y:(H.current=[],[])),le.current?.focus({preventScroll:!0})}$(()=>{ot&&(j.current=!1)},[ot]),$(()=>{let q=R[0];if(!q||!p||ot||j.current||X||u||!d)return;let K=setTimeout(()=>{j.current=!0,x(q.text,q.attachments,q.id).then(Y=>{if(Y){ht(q.id);return}j.current=!1})},300);return()=>clearTimeout(K)},[d,p,u,x,ot,R,ht,X]);function _e(q){q.key!=="Enter"||q.shiftKey||q.isComposing||(q.preventDefault(),gt&&(g.trim()||k.length>0)?ne():lt?S():oe())}function Re(q){let K=q.target;if(!d||J.current||u){K.value="";return}let Y=Wa(K.files,k,e.attachments);Y.accepted.length>0&&(Pr.info("attach (file picker)",{count:Y.accepted.length,totalBytes:xr(Y.accepted)}),r.emit("attach",{count:Y.accepted.length,totalBytes:xr(Y.accepted)}),E(ge=>[...ge,...Y.accepted])),K.value=""}function Ie(q){!d||J.current||u||(Pr.info("removeAttachment",{id:q}),r.emit("removeAttachment",{id:q}),E(K=>{let Y=K.find(ge=>ge.id===q);return Y&&yr(Y),K.filter(ge=>ge.id!==q)}))}function $e(){if(B){O();return}if(!d||!He.isSupported||J.current||u)return;let q=++Me.current;be.current=performance.now(),Pr.info("voiceStart"),r.emit("voiceStart",void 0),V(!0),n.play("voiceStart"),He.start((K,Y)=>{Me.current!==q||!te.current||Pe.current||J.current||!Y||Te(ge=>`${ge}${K} `)},()=>{Me.current!==q||!te.current||(V(!1),yt("debug"))})}let ye=Ks[e.composer.sendButton.icon],Be=!!(g.trim()||k.length>0),Ke=lt||s&&!Be;return l("div",{class:`${nt}-composer`,part:"composer","data-testid":M.composer,children:[R.length>0?l("div",{class:`${nt}-message-queue`,"aria-label":h.queueMessage,"data-testid":M.messageQueue,children:R.map(q=>l("div",{class:`${nt}-attachment-chip ${nt}-queued-message`,"data-testid":`${M.queuedMessage}-${q.id}`,children:[l("span",{class:`${nt}-attachment-name ${nt}-queued-text`,children:q.text||q.attachments.map(K=>K.name).join(", ")}),l("button",{type:"button",class:`${nt}-attachment-remove`,onClick:()=>ht(q.id),"aria-label":h.removeQueuedMessage,title:h.removeQueuedMessage,"data-testid":`${M.queuedMessageRemove}-${q.id}`,children:l(qt,{})})]},q.id))}):null,k.length>0?l("div",{class:`${nt}-attachments`,children:k.map(q=>l(Ip,{attachment:q,onRemove:()=>Ie(q.id),disabled:Oe},q.id))}):null,l("div",{class:`${nt}-composer-row`,children:[l("div",{class:`${nt}-composer-actions`,children:[ct?l("button",{type:"button",class:`${nt}-icon-btn`,onClick:()=>ke.current?.click(),disabled:Oe,"aria-label":h.attach,"data-testid":M.composerAttach,children:l(Bd,{})}):null,He.isSupported?l("button",{type:"button",class:`${nt}-icon-btn`,onClick:$e,disabled:Oe,"aria-label":B?h.micStop:h.micStart,"aria-pressed":B,"data-recording":B?"true":void 0,"data-testid":M.composerVoice,children:l(Ud,{})}):null]}),l("textarea",{ref:le,name:"message",class:`${nt}-textarea`,rows:1,value:g,placeholder:h.composerPlaceholder,onInput:q=>Te(q.currentTarget.value),onKeyDown:_e,disabled:Oe,"aria-label":h.composerPlaceholder,"data-testid":M.composerInput}),gt&&Be?l("button",{type:"button",class:`${nt}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:ne,disabled:Oe,"aria-label":h.queueMessage,title:h.queueMessage,"data-testid":M.composerSend,children:l(ye,{})}):null,Ke?l("button",{type:"button",class:`${nt}-send`,onClick:S,disabled:Oe,"aria-label":h.stop,"data-testid":M.composerStop,children:l(cn,{})}):null,!Ke&&(!gt||!Be)?l("button",{type:"button",class:`${nt}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:()=>{oe()},disabled:Oe||!g.trim()&&k.length===0,"aria-label":h.send,"data-testid":M.composerSend,children:l(ye,{})}):null,f&&v==="ai-agent"&&y?l("button",{type:"button",class:`${nt}-icon-btn`,onClick:y,disabled:Oe||!m,"aria-label":h.talkToOperator,title:h.talkToOperator,"data-testid":M.operatorRequest,children:l(zs,{})}):null]}),l("input",{ref:ke,name:"attachments",type:"file",multiple:!0,accept:e.attachments.accept,onChange:Re,disabled:Oe,class:`${nt}-sr-only`,"data-testid":M.composerFileInput})]})}var Mp=N.cssPrefix;function Ga({onClick:e,children:t,testid:n}){return e?l("button",{type:"button",class:`${Mp}-home-card`,"data-interactive":"true",onClick:e,"data-testid":n,children:t}):l("div",{class:`${Mp}-home-card`,"data-testid":n,children:t})}function Ka(e){return e.trim().split(/\s+/).slice(0,2).map(t=>t.charAt(0).toUpperCase()).join("")}var Ht=N.cssPrefix,Bv=ce.scope("news"),Uv=10;function Qs(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 qv({options:e,transport:t,strings:n,config:r,nav:o,bus:a,panelProps:i,latestNews:s}){let c=r.contentCollectionIds,[p,_]=U({items:[],loading:!0}),d=D(void 0);function u(y){if(!c?.length)return;let x={};d.current=x,_(S=>({...S,loading:!0,error:void 0})),t.listContent({contentCollectionIds:c,sortBy:"publishedAt",sortOrder:"desc",page:y,limit:Uv}).then(S=>{if(d.current!==x||(_(h=>({items:y>1?[...h.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=>{d.current===x&&(Bv.warn("listContent (news) failed",{err:S,page:y}),_(w=>({...w,loading:!1,error:Vn(S,n)})))})}function f(){p.loading||u((p.pagination?.page??0)+1)}$(()=>(_({items:[],loading:!0}),u(1),()=>{d.current=void 0}),[t,c]);function m(y){let x=Qs(y.publishedAt,e.locale);return l("button",{type:"button",class:`${Ht}-news-card`,onClick:()=>o.push({kind:"content",id:y.id,title:y.title}),"data-testid":_t(M.newsItem,y.id),children:[y.image?l("img",{class:`${Ht}-news-hero`,src:y.image,alt:"",loading:"lazy"}):null,l("span",{class:`${Ht}-news-body`,children:[l("span",{class:`${Ht}-news-title`,children:y.title}),x||y.tags?.length?l("span",{class:`${Ht}-news-meta`,children:[x?l("time",{dateTime:y.publishedAt,children:x}):null,y.tags?.map(S=>l("span",{class:`${Ht}-news-tag`,children:S},S))]}):null,y.description?l("span",{class:`${Ht}-news-summary`,children:y.description}):null]})]},y.id)}function v(){if(!c?.length)return l(Dt,{message:n.newsEmpty,strings:n});let y=p.error?l(Dt,{tone:"error",message:p.error,onRetry:f,strings:n}):null;return y&&!p.pagination?y:p.pagination?p.items.length?l("div",{class:`${Ht}-news-list`,children:[p.items.map(m),y,p.pagination.hasNext&&!y?l("button",{type:"button",class:`${Ht}-news-more`,onClick:f,"aria-busy":p.loading,"data-testid":M.newsMore,children:[p.loading?l("span",{class:`${Ht}-loading-spinner`,"aria-hidden":"true"}):null,n.newsShowMore]}):null]}):l(Dt,{message:n.newsEmpty,strings:n}):l(Dt,{message:n.newsLoading,strings:n})}return l("div",{class:`${Ht}-module`,children:[l(Ha,{title:n.newsTitle,actions:l(Xt,{panelProps:i,variant:"plain"})}),l("div",{class:`${Ht}-module-scroll`,children:v()})]})}var Np={Icon:Fa,Root:e=>l(qv,{...e})};var ve=N.cssPrefix,Lp=ce.scope("home");function Hv(e){let t=e.options.userContext?.name,n=e.config.greetingText?xt(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 zv(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 jv({options:e,onAsk:t}){let[n,r]=U(""),{sendButton:o}=e.composer,a=Ks[o.icon];function i(s){s.preventDefault();let c=n.trim();c&&(r(""),t(c))}return l("form",{class:`${ve}-home-search ${ve}-home-ask`,"data-input":"true",onSubmit:i,"data-testid":M.homeAsk,children:[l("input",{type:"text",class:`${ve}-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:`${ve}-send`,"data-shape":o.shape,"data-variant":o.variant,disabled:!n.trim(),"aria-label":e.strings.send,children:l(a,{})})]})}function Op(e,t){return ln(e,t,t.type!=="upsert"||t.activity===!0)}function Vv(e){let{transport:t,strings:n,config:r,nav:o,bus:a,panelProps:i,latestNews:s}=e,[c,p]=U(null),[_,d]=U([]),u=r.contentCollectionIds?.join(","),f=e.options.modules.list.some(g=>g.layout==="chat");$(()=>{if(r.showRecentConversations===!1)return;let g=!1,b=!0,k=[],E=t.subscribeConversationChanges(R=>{b&&k.push(R),p(A=>Op(A?[A]:[],R)[0]??null)});return t.listConversations({limit:f?50:1}).then(R=>{if(g)return;let A=k.reduce(Op,R.conversations);k=[],b=!1,p(A[0]??null)}).catch(R=>{g||(k=[],b=!1,Lp.warn("listConversations (home) failed",{err:R}))}),()=>{g=!0,E()}},[t,r.showRecentConversations,f]),$(()=>{if(!r.contentCollectionIds?.length)return;let g=!1;return t.listContent({contentCollectionIds:r.contentCollectionIds,pinned:!0,limit:6}).then(b=>{g||(d(b.items),a.emit("contentView",{section:"home",count:b.items.length}))}).catch(b=>!g&&Lp.warn("listContent (home) failed",{err:b})),()=>{g=!0}},[t,u,a]);let m=Hv(e),v=r.userAvatars??[],y=r.status,x=y?.text?xt(n,y.text):n.homeStatus,S=r.contentBlockTitle?xt(n,r.contentBlockTitle):n.homeContentTitle,w=s.item,h=Qs(w?.publishedAt,e.options.locale);return l("div",{class:`${ve}-module ${ve}-home`,"data-testid":M.homeView,children:l("div",{class:`${ve}-home-scroll`,children:[l("div",{class:`${ve}-home-hero`,children:[l("div",{class:`${ve}-home-hero-top`,children:[r.brandName?l("span",{class:`${ve}-home-brand`,"data-testid":M.homeBrand,children:r.brandName}):l("span",{class:`${ve}-home-brand-spacer`,"aria-hidden":"true"}),l("div",{class:`${ve}-home-hero-actions`,children:[v.length>0?l("div",{class:`${ve}-home-avatars`,children:v.map(g=>l("span",{class:`${ve}-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:Ka(g.name)})},g.name))}):null,l(Xt,{panelProps:i,variant:"plain"})]})]}),r.showGreeting!==!1?l(ue,{children:[l("h1",{class:`${ve}-home-greeting`,"data-testid":M.homeGreeting,children:m.title}),m.subtitle?l("p",{class:`${ve}-home-lead`,children:m.subtitle}):null]}):null]}),l("div",{class:`${ve}-home-cards`,children:[f?l(jv,{options:e.options,onAsk:g=>o.startNewConversation(g)}):null,r.showSearchBar!==!1?l(kp,{placeholder:n.homeSearchPlaceholder,onActivate:()=>o.switchToLayout("help")}):null,w?l(Ga,{onClick:()=>{s.markSeen(w.id),o.push({kind:"content",id:w.id,title:w.title})},testid:M.homeWhatsNew,children:l("div",{class:`${ve}-home-recent-row`,"data-unread":s.unseen?"true":void 0,children:[l("span",{class:`${ve}-home-recent-avatar`,"aria-hidden":"true",children:l(Fa,{})}),l("span",{class:`${ve}-home-recent-body`,children:[l("span",{class:`${ve}-home-recent-title`,children:n.homeWhatsNew}),l("span",{class:`${ve}-home-recent-preview`,children:h?`${w.title} \xB7 ${h}`:w.title})]}),s.unseen?l("span",{class:`${ve}-home-recent-dot`,role:"img","aria-label":n.newsUnseen}):null]})}):null,c?l(Ga,{onClick:()=>o.selectConversation(c),testid:M.homeRecent,children:l("div",{class:`${ve}-home-recent-row`,"data-unread":c.hasUnread?"true":void 0,children:[l("span",{class:`${ve}-home-recent-avatar`,"aria-hidden":"true",children:l(lo,{})}),l("span",{class:`${ve}-home-recent-body`,children:[l("span",{class:`${ve}-home-recent-title`,children:c.title}),c.preview?l("span",{class:`${ve}-home-recent-preview`,children:ja(c.preview)}):null]}),c.hasUnread?l("span",{class:`${ve}-home-recent-dot`,"aria-label":"Unread"}):null]})}):null,y?l(Ga,{onClick:y.url?()=>o.push({kind:"iframe",url:y.url,title:x}):void 0,children:l("div",{class:`${ve}-home-status`,"data-level":y.level??"operational",children:[l("span",{class:`${ve}-home-status-icon`,"aria-hidden":"true",children:l(tp,{})}),l("span",{class:`${ve}-home-status-text`,children:x})]})}):null,_.length>0?l("section",{class:`${ve}-home-content`,children:[l("div",{class:`${ve}-home-content-title`,children:S}),l("div",{class:`${ve}-home-content-list`,children:_.map(g=>l(Va,{title:g.title,subtitle:g.description,onClick:()=>zv(o,g),testid:_t(M.homeContentRow,g.id)},g.id))})]}):null]})]})})}var $p={Icon:np,Root:e=>l(Vv,{...e})};var Qa={chat:Sp,home:$p,help:Tp,news:Np};var _o=N.cssPrefix;function Dp({modules:e,activeTab:t,strings:n,hasUnread:r,onSelect:o}){return l("nav",{class:`${_o}-tabbar`,role:"tablist","aria-label":n.panelTitle,children:e.map(a=>{let i=Qa[a.layout].Icon,s=a.id===t,c=a.layout==="chat"&&r;return l("button",{type:"button",role:"tab","aria-selected":s,class:`${_o}-tab`,onClick:()=>o(a.id),"data-testid":_t(M.tab,a.id),children:[l("span",{class:`${_o}-tab-icon`,"aria-hidden":"true",children:[l(i,{}),c?l("span",{class:`${_o}-tab-badge`,"data-testid":M.tabBadge,"aria-label":"Unread"}):null]}),l("span",{class:`${_o}-tab-label`,children:xt(n,a.label)})]},a.id)})})}var Fp=N.cssPrefix,Wv="allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads";function Bp({url:e,title:t,strings:n,onBack:r,actions:o}){return l("div",{class:`${Fp}-module`,children:[l(za,{title:t||n.moduleBack,backLabel:n.moduleBack,onBack:r,actions:o}),l("iframe",{class:`${Fp}-content-frame`,src:e,title:t||"content",sandbox:Wv,referrerpolicy:"no-referrer",loading:"lazy",allow:"fullscreen"})]})}var Xs=N.cssPrefix;function Up({agent:e,strings:t}){let n=e.status??"online",r=xt(t,e.name),o=e.title?xt(t,e.title):null;return l("div",{class:`${Xs}-agent`,children:[l("div",{class:`${Xs}-agent-avatar`,"data-status":n,children:e.avatar?l("img",{src:e.avatar,alt:""}):l("span",{children:Ka(r)})}),l("div",{class:`${Xs}-agent-meta`,children:[l("strong",{children:r}),o?l("span",{children:o}):null]})]})}var Gv=["today","yesterday","lastWeek","older"];function Kv(e,t){let n=Date.parse(t);if(!Number.isFinite(n))return"older";let r=Math.floor((qp(e)-qp(n))/(1440*60*1e3));return r<=0?"today":r===1?"yesterday":r<7?"lastWeek":"older"}function Hp(e,t){let n=new Map;for(let r of t){let o=Kv(e,r.lastMessageAt),a=n.get(o);a?a.push(r):n.set(o,[r])}return Gv.filter(r=>n.has(r)).map(r=>({bucket:r,conversations:n.get(r)}))}function qp(e){let t=new Date(e);return t.setUTCHours(0,0,0,0),t.getTime()}var zp=ce.scope("history"),Qv=3,Xv=6,Jv={today:"dateToday",yesterday:"dateYesterday",lastWeek:"dateLastWeek",older:"dateOlder"};function jp(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=ln(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=ln(e.conversations,t,n);return r===e.conversations?e:{...t.type==="snapshot"?t.result:e,conversations:r}}function Yv(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 Xa({transport:e,strings:t,locale:n,persistence:r,onSelect:o,onNewConversation:a}){let i=N.cssPrefix,s=e.peekConversations({limit:50}),[c,p]=U(s?"loaded":"loading"),[_,d]=U(s),[u,f]=U(!1),m=D(void 0),v=_?.conversations??[],y=_?.pagination;$(()=>{let g=!1,b=!0,k=[],E=e.subscribeConversationChanges(A=>{b&&k.push(A),d(L=>L&&jp(L,A))});m.current=void 0,f(!1);let R=e.peekConversations({limit:50});return d(R),p(R?"loaded":"loading"),e.listConversations({limit:50}).then(A=>{if(g)return;let L=A;for(let j of k)L=jp(L,j);k=[],b=!1,d(L),p("loaded"),r.saveHistoryCount(L.conversations.length)}).catch(A=>{g||(k=[],b=!1,zp.warn("listConversations failed",{err:A}),p("error"))}),()=>{g=!0,E(),m.current=void 0}},[e,r,n]);async function x(){if(m.current||!y?.hasNext)return;let g={};m.current=g,f(!0);try{let b=await e.listConversations({page:y.page+1,limit:y.limit});if(m.current!==g)return;d(k=>{if(!k)return k;let E=new Set(k.conversations.map(L=>L.conversationId)),R=b.conversations.filter(L=>E.has(L.conversationId)?!1:(E.add(L.conversationId),!0)),A={conversations:[...k.conversations,...R],pagination:b.pagination};return r.saveHistoryCount(A.conversations.length),A})}catch(b){if(m.current!==g)return;zp.warn("listConversations page failed",{err:b,page:y.page+1})}finally{m.current===g&&(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":M.sidebarNewConversation,children:[l(Od,{}),t.newConversation]})}):null;if(c==="loading"){let g=Math.min(r.loadHistoryCount()??Qv,Xv);return l(ue,{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)},(b,k)=>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`})})})]})]},k))})]})}),S]})}if(c==="error"||v.length===0)return l(ue,{children:[l("div",{class:`${i}-history-empty`,children:t.historyEmpty}),S]});let w=Date.now(),h=Hp(w,v);return l(ue,{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[Jv[g.bucket]]}),l("div",{class:`${i}-history-card`,children:g.conversations.map(b=>l("div",{role:"listitem",children:l("button",{type:"button",class:`${i}-history-item`,onClick:()=>o(b),"data-closed":b.canContinue?void 0:"true","data-unread":b.hasUnread?"true":void 0,"data-testid":_t(M.historyItem,b.conversationId),children:[l("span",{class:`${i}-history-avatar`,"aria-hidden":"true",children:l(Hs,{})}),l("span",{class:`${i}-history-body`,children:[l("span",{class:`${i}-history-row`,children:[l("span",{class:`${i}-history-title`,children:b.title}),l("span",{class:`${i}-history-time`,children:Yv(b.lastMessageAt,w,n)})]}),l("span",{class:`${i}-history-row`,children:[l("span",{class:`${i}-history-preview`,children:b.preview&&ja(b.preview)||(b.canContinue?t.historyContinue:t.conversationClosed)}),b.hasUnread?l("span",{class:`${i}-history-dot`}):null]})]})]})},b.conversationId))})]},g.bucket)),y?.hasNext?l("div",{class:`${i}-history-more`,children:l("button",{type:"button",onClick:x,disabled:u,"aria-busy":u,"data-testid":M.historyLoadMore,children:t.loadMoreConversations})}):null]}),S]})}var Zv=N.cssPrefix;function Vp({visible:e,strings:t}){return e?l("div",{class:`${Zv}-dropzone`,role:"status","aria-live":"polite",children:t.dropZone}):null}var eb=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,tb=/^https?:\/\/[^\s.]+\.[^\s]+$/i,nb=/^[+]?[\d\s().-]{6,}$/;function Sr(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>String(t[r]??`{${r}}`))}function rb(e){return Array.isArray(e)?e.length:e?.trim()?1:0}function ob(e,t,n){let r=e.required??!0,o=e.validation;if(e.type==="multiselect"){let i=rb(t);return r&&i===0?n.formRequired:i===0?void 0:o?.minSelections!=null&&i<o.minSelections?Sr(n.formChooseAtLeast,{min:o.minSelections}):o?.maxSelections!=null&&i>o.maxSelections?Sr(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(!eb.test(a))return n.formInvalidEmail;break;case"url":if(!tb.test(a))return n.formInvalidUrl;break;case"tel":if(!nb.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 Sr(n.formNumberTooSmall,{min:o.min});if(o?.max!=null&&i>o.max)return Sr(n.formNumberTooLarge,{max:o.max});break}default:break}if(o?.minLength!=null&&a.length<o.minLength)return Sr(n.formTooShort,{min:o.minLength});if(o?.maxLength!=null&&a.length>o.maxLength)return Sr(n.formTooLong,{max:o.maxLength});if(o?.pattern)try{if(!new RegExp(o.pattern).test(a))return n.formPatternMismatch}catch{}}function Wp(e,t,n){let r={};for(let o of e){let a=ob(o,t[o.name],n);a&&(r[o.name]=a)}return r}function Gp(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 qe=N.cssPrefix,fo="__other__";function mo({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,y]=U(()=>({...lb(e),...p})),[x,S]=U({}),[w,h]=U({});function g(A){w[A]&&h(L=>({...L,[A]:""}))}function b(A,L){y(j=>({...j,[A]:L})),g(A)}function k(A,L){S(j=>({...j,[A]:L})),g(A)}function E(A){if(A.preventDefault(),c)return;let L=cb(e,v,x),j=Wp(e,L,t);if(Object.keys(j).length>0){h(j);return}r(Gp(L))}function R(A){!s||A.key!=="Enter"||A.shiftKey||A.isComposing||!A.target||!("tagName"in A.target)||A.target.tagName!=="TEXTAREA"||E(A)}return l("form",{class:`${qe}-form`,onSubmit:E,onKeyDown:R,"data-testid":u,noValidate:!0,children:[e.map(A=>l(ab,{field:A,value:v[A.name],otherText:x[A.name]??"",error:w[A.name],disabled:c,typeLabel:d?.[A.name],strings:t,onChange:L=>b(A.name,L),onOtherChange:L=>k(A.name,L)},A.name)),_?null:l("div",{class:`${qe}-form-actions`,children:[i?l("span",{class:`${qe}-form-hint`,children:i}):null,o&&a?l("button",{type:"button",class:`${qe}-form-skip`,onClick:a,disabled:c,"data-testid":m,children:o}):null,l("button",{type:"submit",class:`${qe}-form-submit`,disabled:c,"data-testid":f,children:n})]})]})}function ab({field:e,value:t,otherText:n,error:r,disabled:o,typeLabel:a,strings:i,onChange:s,onOtherChange:c}){let p=_t(M.formField,e.name),_=ib({field:e,value:t,otherText:n,disabled:o,strings:i,onChange:s,onOtherChange:c,fieldTid:p});return l("label",{class:`${qe}-field`,"data-field":e.name,"data-invalid":r?"true":void 0,children:[l("span",{class:`${qe}-field-head`,children:[l("span",{class:`${qe}-field-label`,children:[e.label,e.required??!0?l("span",{class:`${qe}-field-req`,"aria-hidden":"true",children:" *"}):null]}),a?l("span",{class:`${qe}-field-type`,children:a}):null]}),_,e.validationHint&&!r?l("span",{class:`${qe}-field-hint`,children:e.validationHint}):null,r?l("span",{class:`${qe}-field-error`,role:"alert",children:r}):null]})}function ib(e){let{field:t,value:n,otherText:r,disabled:o,strings:a,onChange:i,onOtherChange:s,fieldTid:c}=e,p=typeof n=="string"?n:"",_=t.type==="select"?a.formOtherPlaceholder:t.placeholder??a.formOtherPlaceholder,d=t.allowOther&&p===fo?l("input",{class:`${qe}-field-input`,value:r,placeholder:_,disabled:o,onInput:f=>s(f.currentTarget.value)}):null;switch(t.type){case"textarea":return l("textarea",{class:`${qe}-field-input`,rows:3,value:p,placeholder:t.placeholder,disabled:o,onInput:f=>i(f.currentTarget.value),"data-testid":c});case"select":return l(ue,{children:[l("select",{class:`${qe}-field-input`,value:p,disabled:o,onChange:f=>i(f.currentTarget.value),"data-testid":c,children:[l("option",{value:"",children:t.placeholder??"\u2014"}),(t.options??[]).map(f=>l("option",{value:f.value,children:f.label??f.value},f.value)),t.allowOther?l("option",{value:fo,children:a.formOther}):null]}),d]});case"radio":return l("div",{class:`${qe}-field-choices`,role:"radiogroup","data-testid":c,children:[(t.options??[]).map(f=>l("label",{class:`${qe}-choice`,children:[l("input",{type:"radio",name:`${qe}-${t.name}`,checked:p===f.value,disabled:o,onChange:()=>i(f.value)}),l("span",{children:f.label??f.value})]},f.value)),t.allowOther?l("label",{class:`${qe}-choice`,children:[l("input",{type:"radio",name:`${qe}-${t.name}`,checked:p===fo,disabled:o,onChange:()=>i(fo)}),l("span",{children:a.formOther})]}):null,d]});case"checkbox":return l("label",{class:`${qe}-choice`,children:[l("input",{type:"checkbox",checked:p==="true",disabled:o,onChange:f=>i(f.currentTarget.checked?"true":""),"data-testid":c}),l("span",{children:t.placeholder??t.label})]});case"multiselect":{let m=function(v,y){return i(y?[...f,v]:f.filter(x=>x!==v))};var u=m;let f=Array.isArray(n)?n:[];return l("div",{class:`${qe}-field-choices`,"data-testid":c,children:[(t.options??[]).map(v=>l("label",{class:`${qe}-choice`,children:[l("input",{type:"checkbox",checked:f.includes(v.value),disabled:o,onChange:y=>m(v.value,y.currentTarget.checked)}),l("span",{children:v.label??v.value})]},v.value)),t.allowOther||(t.options??[]).length===0?l("textarea",{class:`${qe}-field-input`,rows:2,value:r,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:o,onInput:v=>s(v.currentTarget.value)}):null]})}default:return l("input",{...sb(t.type),class:`${qe}-field-input`,value:p,placeholder:t.placeholder,disabled:o,onInput:f=>i(f.currentTarget.value),"data-testid":c})}}function sb(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 lb(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 cb(e,t,n){let r={...t};for(let o of e){let a=n[o.name]?.trim();if((o.type==="radio"||o.type==="select")&&o.allowOther&&t[o.name]===fo)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 Yt=N.cssPrefix;function Js({form:e,strings:t,onSubmit:n,onSkip:r}){return l("div",{class:`${Yt}-form-gate`,"data-testid":M.formGate,children:[e.title?l("h3",{class:`${Yt}-form-gate-title`,children:e.title}):null,e.description?l("p",{class:`${Yt}-form-gate-desc`,children:e.description}):null,l(mo,{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:M.formSubmit,skipTestId:M.formSkip})]})}function Kp({marker:e,strings:t,onFill:n}){let r=e.outcome==="skipped",o=r?t.formSkipped:t.formSubmitted,a=e.title?l(ue,{children:[l("span",{children:e.title}),l("span",{class:`${Yt}-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:`${Yt}-form-done`,"data-outcome":e.outcome,"data-testid":M.formDone,children:[l("summary",{class:`${Yt}-form-done-summary`,"data-testid":M.formDoneToggle,children:[l(jn,{}),a,l(gr,{})]}),l("dl",{class:`${Yt}-form-answers`,"data-testid":M.formAnswers,children:Object.entries(s).map(([_,d])=>l("div",{class:`${Yt}-form-answer`,children:[l("dt",{children:p(_)}),l("dd",{children:d})]},_))})]})}return l("div",{class:`${Yt}-form-done`,"data-outcome":e.outcome,"data-testid":M.formDone,role:"status",children:[r?l(Jd,{}):l(jn,{}),a,r&&e.form?.reopenable&&n?l("button",{type:"button",class:`${Yt}-form-done-fill`,"data-testid":M.formFill,onClick:n,children:t.formFillOut}):null]})}var Qp=Object.assign;function pb(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 _b=/^(-|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|asp|fill|st)/;function Yp(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:pb(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 fb=Symbol.for("react.element"),mb=/^(?: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]/,gb=/[A-Z0-9]/g,hb=typeof document<"u";var vb=function(e){return/fil|che|rad/.test(e)};Bt.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Bt.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Xp=me.event;me.event=function(e){return Xp&&(e=Xp(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var bb={configurable:!0,get:function(){return this.class}},Jp=me.vnode;me.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||hb&&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"||_b.test(d)||(_||(_=p=Qp({},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"||vb(o.type)?u=="onfocus"?c="onfocusin":u=="onblur"&&(c="onfocusout"):u=c="oninput",u=="oninput"&&i[c=u]&&(c="oninputCapture")}else s&&mb.test(c)?c=c.replace(gb,"-$&").toLowerCase():p===null&&(p=void 0);i[c]=p}}a=="select"&&(i.multiple&&Array.isArray(i.value)&&(i.value=qo(o.children).forEach(function(f){f.props.selected=i.value.indexOf(f.props.value)!=-1})),i.defaultValue!=null&&(i.value=qo(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",bb)):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=Qp({},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=fb,Jp&&Jp(e)};var Ja=N.cssPrefix;function Zp({messageId:e,initial:t,strings:n,onFeedback:r}){let[o,a]=U(t);$(()=>a(t),[e,t]);function i(s){let c=o===s?null:s;a(c),r(e,c)}return l("div",{class:`${Ja}-feedback`,role:"group","data-testid":M.messageFeedback,children:[l("button",{type:"button",class:`${Ja}-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":M.feedbackUp,children:l(sp,{})}),l("button",{type:"button",class:`${Ja}-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":M.feedbackDown,children:l(lp,{})}),l("span",{class:`${Ja}-sr-only`,role:"status","aria-live":"polite",children:o?n.feedbackThanks:""})]})}var yb=new Set(["hidden","submit","button","reset","image","file","password"]);function t_(e){return e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement}function Pb(e){return!t_(e)||e.name===""||e.disabled?!1:!(e instanceof HTMLInputElement&&yb.has(e.type))}function xb(e){let t=e.labels?.[0]?.textContent?.trim();return e.getAttribute("toolparamdescription")??(t||e.getAttribute("aria-description"))??void 0}function Sb(e,t){let n=xb(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 kb(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 e_(e){return e==null?"":typeof e=="string"?e:JSON.stringify(e)}function wb(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===e_(t)&&!e.checked&&e.click();return}kb(e,e_(t))}function Cb(e,t,n){var i;let r=[...e.elements].filter(Pb),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]=Sb(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===_&&wb(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(_=>t_(_)&&_.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 n_(){return[...document.querySelectorAll("form[toolname][tooldescription]")].flatMap(e=>{let t=e.getAttribute("toolname")?.trim()??"",n=e.getAttribute("tooldescription")?.trim()??"";return t&&n?[Cb(e,t,n)]:[]})}var r_=`${N.cssPrefix}.page-tools`,Tb=20,Rb=50;function Ya(e){return typeof e=="object"&&e!==null}function Ib(e){return Ya(e)&&(e.state==="running"||e.state==="stopped"||e.state==="finished"&&Ya(e.outcome))}function Ab(e){let t=e?JSON.parse(e):void 0;if(!Ya(t))return{sent:[],calls:{}};let n=Array.isArray(t.sent)?t.sent.filter(o=>typeof o=="string"):[],r=Object.fromEntries(Object.entries(Ya(t.calls)?t.calls:{}).filter(o=>Ib(o[1])));return{sent:n,calls:r}}var Zs={sent:[],calls:{}};function go(){try{Zs=Ab(sessionStorage.getItem(r_))}catch{}return Zs}function Ys(e){Zs=e;try{sessionStorage.setItem(r_,JSON.stringify(e))}catch{}}var At={markSent(e){let t=go();Ys({...t,sent:[...t.sent.filter(n=>n!==e),e].slice(-Tb)})},sentHere(e){return go().sent.includes(e)},get(e){return go().calls[e]},set(e,t){let n=go(),r=Object.entries(n.calls).filter(([o])=>o!==e);Ys({...n,calls:Object.fromEntries([...r,[e,t]].slice(-Rb))})},clear(e){let t=go();e.some(n=>n in t.calls)&&Ys({...t,calls:Object.fromEntries(Object.entries(t.calls).filter(([n])=>!e.includes(n)))})}};var l_=ce.scope("page-tools"),o_="site__",a_=3e4,Eb=1e3,i_=Symbol.for(`${N.cssPrefix}.page-tools`),tl={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."},c_="The visitor stopped this before it finished.";function kn(e){return typeof e=="object"&&e!==null}function Mb(e){return kn(e)&&Array.isArray(e.registered)&&e.runs instanceof Map}function ho(){let e=Reflect.get(globalThis,i_);if(Mb(e))return e;let t={registered:[],runs:new Map};return Reflect.set(globalThis,i_,t),t}function u_(e,t){let n=kn(t)&&t.signal instanceof AbortSignal?t.signal:void 0;if(n?.aborted)return;let r=ho().registered;r.push(e);function o(){let a=r.indexOf(e);a>=0&&r.splice(a,1)}n?.addEventListener("abort",o,{once:!0})}function s_(e){return e.replace(/[^A-Za-z0-9_-]/g,"_").slice(0,58)}function d_(e){if(!kn(e)||typeof e.name!="string"||!s_(e.name))return;let t=[e.description,e.title].find(n=>typeof n=="string"&&n.trim()!=="")??e.name;return{name:s_(e.name),description:t.trim().slice(0,1024),inputSchema:{properties:{},...kn(e.inputSchema)?e.inputSchema:{},type:"object"},consequential:kn(e.annotations)&&e.annotations.consequentialHint===!0}}function el(e){return e.flatMap(t=>{let n=d_(t),r=kn(t)?t.execute:void 0;return!n||typeof r!="function"?(l_.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 Nb(){let e=Reflect.get(document,"modelContext")??Reflect.get(navigator,"modelContext");if(!kn(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,[])),zn(Eb).then(()=>[])]).catch(()=>[]);return(Array.isArray(r)?r:[]).flatMap(o=>{let a=d_(o);return a?[{...a,run:(i,s)=>Reflect.apply(n,e,[o,i,{signal:s}])}]:[]})}async function Za(e=[]){let t=el(n_()),n=new Set(t.map(a=>a.name)),o=[...(await Nb()).filter(a=>!n.has(a.name)),...t,...el(e),...el(ho().registered)];return new Map(o.map(a=>[a.name,a]))}function nl(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 Gt(e){return e?.execution==="client"}function vo(e){return e.startsWith(o_)?e.slice(o_.length):e}function Lb(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()}]`:kn(o)?t.has(o)?"[circular]":(t.add(o),o):o});return n.length>a_?{truncated:!0,preview:n.slice(0,a_)}:JSON.parse(n)}async function Ob(e){let t=vo(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:Lb(r)})).catch(r=>(l_.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 p_(e){let{toolCallId:t}=e,n=At.get(t);if(n?.state==="finished")return Promise.resolve(n.outcome);let{runs:r}=ho(),o=r.get(t);if(o)return o.outcome;if(n?.state==="running")return At.set(t,{state:"finished",outcome:tl}),e.onSettled("interrupted",0),Promise.resolve(tl);let a=new AbortController,i=performance.now();At.set(t,{state:"running"});let s=Ob({...e,signal:a.signal}).then(c=>(r.delete(t),At.get(t)?.state!=="running"||(At.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 ei(e){return e===tl.errorText||e===c_}function rl(e){return At.set(e,{state:"stopped"}),ho().runs.get(e)?.controller.abort(),c_}function __(e){At.clear([e]),ho().runs.get(e)?.controller.abort()}var zt=N.cssPrefix;function ol(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 kr(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?`${ol(e.slice(0,t))} \xB7 ${ol(n)}`:e}function bo(e){let t=e.indexOf("__"),n=e.slice(t+2);return t>0&&n?ol(n):kr(e)}function ti(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 il({status:e,icon:t,label:n}){return l("span",{class:`${zt}-toolui-badge ${zt}-toolui-status`,"data-status":e,children:[l("span",{class:`${zt}-toolui-status-icon`,children:t}),n]})}function $b(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 yo(e,t,n={}){return n.submitted?"responded":n.incomplete?"incomplete":Bb($b(e,t),n.superseded,n.live??!0,n.stopped??!1)}function Db({status:e}){return e==="stopped"?l(cn,{}):e==="denied"||e==="error"||e==="superseded"||e==="incomplete"?l(vr,{}):e==="completed"||e==="responded"?l(hr,{}):l(cp,{})}function Fb(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;case"stopped":return t.statusStopped;default:return t.statusRunning}}function Bb(e,t,n,r){return t&&(e==="awaiting"||e==="running")?"superseded":r&&(e==="running"||e==="responded")?"stopped":!n&&e==="running"?"error":e}function Ub({state:e,approval:t,strings:n,superseded:r,live:o=!0,submitted:a=!1,incomplete:i=!1,stopped:s=!1}){let c=yo(e,t,{superseded:r,live:o,submitted:a,incomplete:i,stopped:s});return l(il,{status:c,icon:l(Db,{status:c}),label:Fb(c,n)})}function qb({name:e,state:t,approval:n,strings:r,superseded:o,live:a,submitted:i,incomplete:s,stopped:c}){return l(ue,{children:[l("span",{class:`${zt}-toolui-name-pill`,children:[l(Ba,{}),l("span",{class:`${zt}-toolui-name-text`,children:e})]}),l(Ub,{state:t,approval:n,strings:r,superseded:o,live:a,submitted:i,incomplete:s,stopped:c}),l("span",{class:`${zt}-toolui-chevron`,children:l(Wt,{})})]})}function ni({part:e,strings:t,testid:n,superseded:r,live:o,submitted:a,incomplete:i,stopped:s,open:c}){let p=se(()=>he(()=>e.inputSig.value),[e]),_=se(()=>he(()=>e.outputSig.value),[e]),d=se(()=>he(()=>e.errorSig.value),[e]),u=se(()=>he(()=>e.stateSig.value),[e]),f=se(()=>he(()=>e.approvalSig.value),[e]),m=se(()=>he(()=>Gt(e.toolMetadata)&&ei(e.errorSig.value)),[e]),v=i===!0||m.value;return l("details",{class:`${zt}-toolui ${zt}-toolui-collapsible`,"data-testid":n,open:c||void 0,children:[l("summary",{class:`${zt}-toolui-head`,children:l(qb,{name:kr(e.toolName),state:u.value,approval:f.value,strings:t,superseded:r,live:o,submitted:a,incomplete:v,stopped:s})}),l(Wn,{label:t.toolParameters,value:p.value}),_.value!==void 0?l(Wn,{label:t.toolResult,value:_.value}):null,d.value&&!v?l(Wn,{label:t.statusError,value:d.value,error:!0}):null]})}function Wn({label:e,value:t,error:n}){let r=n?typeof t=="string"?t:"":al(f_(t));return r?l("div",{class:`${zt}-toolui-section`,children:[l("span",{class:`${zt}-toolui-label`,children:e}),l("pre",{class:`${zt}-toolui-code`,"data-error":n?"true":void 0,children:r})]}):null}function ri(e){return!!al(e.inputSig.value)||!!e.errorSig.value||!!al(f_(e.outputSig.value))}function f_(e){if(e&&typeof e=="object"){let t=e;if(t.storage==="tool-result-ref"&&"summary"in t)return t.summary}return e}function al(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 m_(e){return e.partsSig.value.some(t=>t.kind==="text"&&t.textSig.value.length>0)}function g_(e){return e.partsSig.value.some(t=>t.kind==="reasoning")}function Hb(e){return e.streaming&&!e.bufferedHold&&!(e.reasoningVisible&&e.working)}function h_(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:Hb({streaming:t,bufferedHold:a,reasoningVisible:n,working:i}),emptyReply:r,hidden:o}}function v_(e,t){let n=e.stateSig.value,r=e.approvalSig.value,{terminal:o,responded:a,decided:i}=ti(n,r),s=t.continuationStreaming===!0&&!i,c=t.superseded&&!i&&!s;return{pill:yo(n,r,{superseded:c,live:t.live,submitted:s,incomplete:Gt(e.toolMetadata)&&ei(e.errorSig.value),stopped:t.stopped}),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 wr=N.cssPrefix;function b_({part:e,strings:t}){let n=e.title||e.filename||e.url||t.sources;return e.url?l("a",{class:`${wr}-source`,href:e.url,target:"_blank",rel:"noreferrer noopener","data-testid":M.source,children:[l("span",{class:`${wr}-source-icon`,"aria-hidden":"true",children:"\u{1F517}"}),l("span",{class:`${wr}-source-label`,children:n})]}):l("span",{class:`${wr}-source`,"data-testid":M.source,children:[l("span",{class:`${wr}-source-icon`,"aria-hidden":"true",children:"\u{1F4C4}"}),l("span",{class:`${wr}-source-label`,children:n})]})}var Et=N.cssPrefix,zb=4;function jb(e){return!e||typeof e!="object"||Array.isArray(e)?[]:Object.entries(e).flatMap(([t,n])=>typeof n=="string"?n.trim()?[{key:t,value:n.trim()}]:[]:typeof n=="number"||typeof n=="boolean"?[{key:t,value:String(n)}]:[]).slice(0,zb)}function y_({part:e,strings:t,active:n,superseded:r=!1,continuationStreaming:o=!1,stopped:a=!1,onDecision:i,onEdit:s}){let c=se(()=>he(()=>e.approvalSig.value),[e]),p=se(()=>he(()=>v_(e,{active:n,superseded:r,continuationStreaming:o,stopped:a})),[e,n,r,o,a]).value,{terminal:_,showApproveReject:d,showAnswered:u,showSubmitted:f,showEdit:m,skipped:v}=p,y=kr(e.toolName),x=p.answeredApproved,S=e.toolCallId,w=jb(e.inputSig.value),h=l(ue,{children:[l("p",{class:`${Et}-toolui-prompt`,children:t.approvalPrompt.replace("{tool}",y)}),w.length>0?l("dl",{class:`${Et}-toolui-fields`,"data-testid":M.toolApprovalFields,children:w.map(({key:b,value:k})=>l("div",{children:[l("dt",{children:b}),l("dd",{title:k,children:k})]},b))}):null,l("p",{class:`${Et}-toolui-subtle`,children:t.approvalBody})]});f?h=l("p",{class:`${Et}-toolui-subtle`,children:t.approvalSubmitting}):u&&x!==!1?h=l(ue,{children:[l("p",{class:`${Et}-toolui-prompt`,children:[t.approvalYourResponse.replace("{decision}",x?t.approve:t.reject),c.value?.reason?` \u2014 ${c.value.reason}`:""]}),m?l("p",{class:`${Et}-toolui-subtle`,children:t.approvalEditHint}):null,m?null:l("p",{class:`${Et}-toolui-subtle`,children:t.approvalSubmitting})]}):u&&(h=l(ue,{}));let g=d||f||m||u&&x!==!1;return l("div",{class:`${Et}-toolui-group`,"data-testid":p.decided?M.toolDecision:M.toolApproval,children:[l(ni,{part:e,strings:t,superseded:v,submitted:f,stopped:a,open:d}),v||_||!g?null:l("div",{class:`${Et}-toolui ${Et}-toolui-body`,children:[h,d?l("div",{class:`${Et}-toolui-actions`,children:[l("button",{type:"button",class:`${Et}-form-skip`,disabled:!n,onClick:()=>i(S,!1),"data-testid":M.toolReject,children:t.reject}),l("button",{type:"button",class:`${Et}-form-submit`,disabled:!n,onClick:()=>i(S,!0),"data-testid":M.toolApprove,children:t.approve})]}):null,m?l("div",{class:`${Et}-toolui-actions`,children:l("button",{type:"button",class:`${Et}-form-skip`,onClick:()=>s(S),"data-testid":M.toolEdit,children:t.edit})}):null]})]})}var Vb=["text","email","phone","number","date","single-select","multi-select","boolean"];function P_(e){return e!==null&&typeof e=="object"}function x_(e){let t=P_(e)?e:{},r=(Array.isArray(t.questions)?t.questions:[]).map(Wb).filter(o=>o!==null);return{intro:oi(t.intro),questions:r}}function Wb(e,t){if(!P_(e))return null;let n=Vb.find(r=>r===e.type)??"text";return{key:oi(e.key)??`q${t+1}`,question:oi(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:oi(e.helpText)}}function Gb(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 sl(e,t,n){return e.questions.map(r=>{let o=Gb(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 oi(e){return typeof e=="string"&&e.trim()?e.trim():void 0}var rt=N.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 Qb={text:"qtypeText",email:"qtypeEmail",phone:"qtypePhone",number:"qtypeNumber",date:"qtypeDate","single-select":"qtypeChooseOne","multi-select":"qtypeChooseAny",boolean:"qtypeBoolean"};function S_(e,t){let n={};for(let r of e)n[r.key]=t[Qb[r.type]];return n}function k_({part:e,strings:t,active:n,superseded:r=!1,continuationStreaming:o=!1,onDecision:a,onEdit:i}){let s=se(()=>he(()=>e.stateSig.value),[e]).value,c=se(()=>he(()=>e.approvalSig.value),[e]).value,p=se(()=>he(()=>x_(e.inputSig.value)),[e]).value,{terminal:_,decided:d}=ti(s,c),u=d&&c?.approved===!0,f=o&&!d,m=!d&&!r&&!f,v=!m&&!u&&!f,y=u&&n&&!_,x=p.questions,[S,w]=U(null),g=S??(m||u||f),[b,k]=U(!1),E=x.length>1?qs:so,R=m?t.inputRequired:t.inputBadge,A=f?l("p",{class:`${rt}-toolui-subtle`,children:t.approvalSubmitting}):m?l(Xb,{req:p,strings:t,active:n,resolve:(B,V)=>a(e.toolCallId,V,B)}):b?l(mo,{fields:sl(p,t.confirmYes,t.confirmNo),strings:t,submitLabel:t.inputSubmit,onSubmit:()=>{},disabled:!0,hideActions:!0,fieldTypeLabels:S_(x,t),initialValues:u?ty(x,c?.reason):void 0}):l(Jb,{questions:x,answers:u?ey(c?.reason):{},strings:t}),{status:L,statusLabel:j}=Kb({skipped:v,submitted:f,strings:t});return l("details",{class:`${rt}-toolui ${rt}-toolui-collapsible${r?` ${rt}-toolui-stale`:""}`,open:g,onToggle:B=>{let V=B.currentTarget.open;V!==g&&w(V)},"data-testid":m?M.toolAskQuestions:M.toolDecision,children:[l("summary",{class:`${rt}-toolui-head`,children:[l("span",{class:`${rt}-toolui-q-pill`,children:[l(E,{}),R]}),l("span",{class:`${rt}-toolui-head-end`,children:[m?null:l(il,{status:L,icon:v?l(vr,{}):l(hr,{}),label:j}),l("span",{class:`${rt}-toolui-chevron`,children:l(Wt,{})})]})]}),l("div",{class:`${rt}-toolui-collapse-body`,children:[p.intro?l("div",{class:`${rt}-toolui-desc`,children:p.intro}):null,A,m||f?null:l("div",{class:`${rt}-toolui-footer`,children:[l("button",{type:"button",class:`${rt}-toolui-options-toggle`,onClick:()=>k(B=>!B),"data-testid":M.toolAskOptions,children:[l("span",{class:`${rt}-toolui-options-chevron${b?` ${rt}-open`:""}`,children:l(Wt,{})}),b?t.hideOptions:t.showOptions]}),y?l("button",{type:"button",class:`${rt}-form-skip`,onClick:()=>i(e.toolCallId),"data-testid":M.toolEdit,children:t.edit}):null]})]})]})}function Xb({req:e,strings:t,active:n,resolve:r}){let o=sl(e,t.confirmYes,t.confirmNo),a=e.questions.length===1&&e.questions[0]?.type==="text";return l(mo,{fields:o,strings:t,disabled:!n,submitLabel:t.inputSubmit,footerHint:a?t.inputSubmitHint:void 0,onSubmit:i=>r(Zb(e.questions,i),!0),skipLabel:t.inputSkip,onSkip:()=>r(void 0,!1),submitOnEnter:a,fieldTypeLabels:S_(e.questions,t),submitTestId:M.toolInputSubmit,skipTestId:M.toolInputSkip})}function Jb({questions:e,answers:t,strings:n}){return l("div",{class:`${rt}-toolui-summary`,"data-testid":M.toolAskSummary,children:e.map(r=>l("div",{class:`${rt}-field`,children:[l("span",{class:`${rt}-field-head`,children:l("span",{class:`${rt}-field-label`,children:[r.question,r.required?l("span",{class:`${rt}-field-req`,"aria-hidden":"true",children:" *"}):null]})}),l("p",{class:`${rt}-toolui-answer`,children:Yb(r,t[r.key],n)||"\u2014"})]},r.key))})}function Yb(e,t,n){return e.type!=="boolean"?t??"":t==="yes"?n.confirmYes:t==="no"?n.confirmNo:t??""}function Zb(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 w_(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 ey(e){let t=w_(e),n={};for(let[r,o]of Object.entries(t))n[r]=Array.isArray(o)?o.join(", "):o;return n}function ty(e,t){let n=w_(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 C_({part:e,strings:t,live:n,superseded:r,stopped:o=!1}){let a=Gt(e.toolMetadata);if(!se(()=>he(()=>ri(e)),[e]).value&&!a)return null;let s=e.outputSig.value===void 0&&!e.errorSig.value;return l(ni,{part:e,strings:t,testid:M.toolCall,live:n||a&&!r,incomplete:a&&r&&s,stopped:o})}var de=N.cssPrefix,ny=200;function ai(e){if(e.kind!=="tool")return!1;let t=e.stateSig.value;return t!=="approval-requested"&&t!=="approval-responded"&&!e.toolMetadata?.card&&!Gt(e.toolMetadata)}function T_(e,t){let n=[];for(let[r,o]of e.entries()){let a=n.at(-1);if(o.kind==="reasoning"&&t.showReasoning||ai(o)&&ri(o)){a?.kind==="steps"?(a.parts.push(o),a.indices.push(r)):n.push({kind:"steps",parts:[o],indices:[r]});continue}o.kind==="step-start"||o.kind==="reasoning"||o.kind==="source"&&!t.showSources||ai(o)||n.push({kind:"part",part:o,index:r})}return n}function ry(e){if(!(!e||typeof e!="object"))return Object.values(e).find(t=>typeof t=="string"&&t.trim().length>0)?.trim()}function oy(e,t){let n=[...new Set(t)];if(!(!e||n.length===0||n.some(r=>r<0||r>=e.length)))return n.reduce((r,o)=>r+(e[o]?.durationMs??0),0)}function R_(e){let t=[];for(let n of e)t.push((t.at(-1)??-1)+(n.kind==="step-start"?1:0));return t}function ay(e,t){return e.streaming?t.thinking:e.reasoningMs===void 0?t.thought:t.thoughtFor.replace("{time}",I_(e.reasoningMs))}function I_(e){if(e<1e4)return`${Number((e/1e3).toFixed(1))} s`;let t=Math.round(e/1e3);return t<60?`${t} s`:`${Math.floor(t/60)} m ${t%60} s`}function iy(e){return e.split(`
62
+ `).map(t=>t.trim()).findLast(t=>/^\*\*[^*].*\*\*$/.test(t))?.slice(2,-2).trim()}function sy(e,t){return e?.kind==="tool"?`${bo(e.toolName)}\u2026`:(e&&iy(e.textSig.value))??t.thinking}function ly(e,t){let n=e.map(s=>s.kind==="tool"?{kind:"tool",part:s,name:kr(s.toolName),summary:ry(s.inputSig.value),status:yo(s.stateSig.value,s.approvalSig.value,{live:t.live,stopped:t.stopped})}:{kind:"thought",part:s}),r=n.flatMap(s=>s.kind==="tool"?[s]:[]),o=new Map;for(let s of r)o.set(bo(s.part.toolName),(o.get(bo(s.part.toolName))??0)+1);let a=r.some(s=>s.status==="stopped"),[i]=r;return{tools:[...o].map(([s,c])=>({name:s,count:c})),...r.length===1&&i?{single:{name:bo(i.part.toolName),...i.summary?{summary:i.summary}:{}}}:{},failed:r.filter(s=>s.status==="error").length,...t.stopped&&a?{stopped:{finished:r.filter(s=>s.status!=="stopped").length}}:{},rows:n}}function A_({parts:e,steps:t=[],stepTimings:n,timed:r=!0,strings:o,live:a,running:i,stopped:s=!1,runStartedAt:c}){let[p,_]=U(!1),[d,u]=U(!1),f=ly(e,{live:a,stopped:s}),m=e.at(-1),v=se(()=>he(()=>sy(m,o)),[m,o]).value,y=r?oy(n,t):void 0;function x(){_(!p),u(!0)}return l("div",{class:`${de}-steps`,"data-testid":M.toolSteps,"data-running":i?"true":void 0,"data-stopped":f.stopped?"true":void 0,children:[l("button",{type:"button",class:`${de}-steps-head`,"aria-expanded":p,onClick:x,children:[l("span",{class:`${de}-steps-icon`,"aria-hidden":"true",children:l(uy,{running:i,stopped:f.stopped!==void 0})}),l("span",{class:`${de}-steps-label`,children:i?l("span",{class:`${de}-steps-live`,children:v}):l(py,{view:f,strings:o})}),!i&&f.failed>0?l("span",{class:`${de}-steps-failed`,children:o.toolStepsFailed.replace("{count}",String(f.failed))}):null,i&&c?l(cy,{since:c}):null,!i&&y!==void 0?l("span",{class:`${de}-steps-time`,children:I_(y)}):null,l("span",{class:`${de}-steps-chevron`,"data-open":p?"true":void 0,children:l(Wt,{})})]}),l("span",{class:`${de}-sr-only`,role:"status",children:i?v:""}),l("div",{class:`${de}-steps-body`,"data-open":p?"true":void 0,inert:!p,children:l("div",{class:`${de}-steps-body-inner`,children:d?l("ol",{class:`${de}-steps-list`,children:f.rows.map((S,w)=>S.kind==="tool"?l(_y,{row:S,strings:o},S.part.toolCallId):l(ll,{part:S.part,current:i&&w===f.rows.length-1,reasoningMs:n?.[t[w]??-1]?.reasoningMs,strings:o},`${S.part.id}#${w}`))}):null})})]})}function cy({since:e}){let[t,n]=U(()=>Date.now());$(()=>{let o=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(o)},[]);let r=Math.max(0,Math.floor((t-Date.parse(e))/1e3));return l("span",{class:`${de}-steps-time`,children:r<60?`${r} s`:`${Math.floor(r/60)} m ${r%60} s`})}function uy({running:e,stopped:t}){return e?l("span",{class:`${de}-loading-spinner`}):t?l(cn,{}):l(Ba,{})}function dy(e,t){return e===0?t.statusStopped:e===1?t.toolStepsStoppedOne:t.toolStepsStopped.replace("{count}",String(e))}function py({view:e,strings:t}){return e.stopped?l(ue,{children:dy(e.stopped.finished,t)}):e.single?l(ue,{children:[e.single.name,e.single.summary?l(ue,{children:[l("span",{class:`${de}-steps-sep`,"aria-hidden":"true",children:"\xB7"}),l("span",{class:`${de}-steps-summary`,children:e.single.summary})]}):null]}):l(ue,{children:e.tools.map(({name:n,count:r},o)=>l("span",{class:`${de}-steps-name`,children:[o>0?l("span",{class:`${de}-steps-sep`,"aria-hidden":"true",children:"\xB7"}):null,n,r>1?l("span",{class:`${de}-steps-count`,children:["\xD7",r]}):null]},n))})}function _y({row:e,strings:t}){let[n,r]=U(!1),{part:o,name:a,summary:i,status:s}=e;return l("li",{class:`${de}-steps-row`,"data-testid":M.toolStep,"data-status":s,children:[l("span",{class:`${de}-steps-row-icon`,"aria-hidden":"true",children:l(fy,{status:s})}),l("div",{class:`${de}-steps-row-main`,children:[l("button",{type:"button",class:`${de}-steps-row-head`,"aria-expanded":n,onClick:()=>r(!n),children:[l("span",{class:`${de}-steps-row-label`,children:[l("span",{class:`${de}-steps-row-name`,children:a}),i?l("span",{class:`${de}-steps-row-summary`,children:i}):null]}),s==="error"?l("span",{class:`${de}-steps-failed`,children:t.statusError}):null,s==="denied"?l("span",{class:`${de}-steps-denied`,children:t.statusDenied}):null,s==="stopped"?l("span",{class:`${de}-steps-denied`,children:t.statusStopped}):null,l("span",{class:`${de}-steps-chevron`,"data-open":n?"true":void 0,children:l(Wt,{})})]}),n?l("div",{class:`${de}-steps-row-body`,children:[l(Wn,{label:t.toolParameters,value:o.inputSig.value}),o.outputSig.value!==void 0?l(Wn,{label:t.toolResult,value:o.outputSig.value}):null,o.errorSig.value?l(Wn,{label:t.statusError,value:o.errorSig.value,error:!0}):null]}):null]})]})}function fy({status:e}){return e==="running"?l("span",{class:`${de}-loading-spinner`}):e==="stopped"?l(cn,{}):e==="error"||e==="denied"?l(vr,{}):l(hr,{})}function ll({part:e,current:t,reasoningMs:n,strings:r,standalone:o=!1}){let[a,i]=U(!1),s=se(()=>he(()=>e.textSig.value.trim()===""),[e]).value,c=se(()=>he(()=>e.textSig.value.length>ny),[e]).value,p=ay({streaming:t,reasoningMs:n},r);return l(o?"div":"li",{class:`${de}-steps-row ${de}-steps-thought`,"data-status":"thought","data-testid":o?M.reasoning:void 0,children:[l("span",{class:`${de}-steps-row-icon`,"aria-hidden":"true",children:l(up,{})}),l("div",{class:`${de}-steps-row-main`,children:[l("span",{class:t?`${de}-steps-thought-label ${de}-steps-live`:`${de}-steps-thought-label`,children:p}),s?null:l("div",{class:`${de}-steps-thought-text ${de}-reasoning-body`,"data-clamped":c&&!a?"true":void 0,children:l(co,{textSig:e.textSig,doneSig:e.doneSig})}),c&&!s?l("button",{type:"button",class:`${de}-steps-thought-more`,"aria-expanded":a,onClick:()=>i(!a),children:[a?r.thoughtsShowLess:r.thoughtsShowMore,l("span",{class:`${de}-steps-chevron`,"data-open":a?"true":void 0,children:l(Wt,{})})]}):null]})]})}var Le=N.cssPrefix,M_=Yp(my);function my({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,reconnecting:f=!1}){let v=[...se(()=>he(()=>e.partsSig.value),[e]).value];for(let te of e.attachments??[])!te.url||v.some(Pe=>Pe.kind==="file"&&Pe.url===te.url)||v.push({kind:"file",url:te.url,mediaType:te.mediaType,filename:te.name,fileId:te.id,fileSize:te.size});let y=se(()=>he(()=>Un(e)),[e]),x=se(()=>he(()=>m_(e)),[e]),S=se(()=>he(()=>o&&g_(e)),[e,o]),w=se(()=>he(()=>hd(e,S.value)),[e,S]),h=se(()=>he(()=>!Ns(e)),[e]),g=t==="streaming",b=e.role==="assistant"&&g,k=h_({streaming:b,responseMode:r,reasoningVisible:S.value,hasAnswerText:x.value,emptyReply:y.value,hidden:w.value}),{bufferedHold:E,showStreamDots:R}=k;if(k.hidden)return null;let A=hy(e.createdAt),L=e.role==="assistant"||e.role==="operator",j=d&&!!u&&!!e.serverMessageId&&L&&!g&&t!=="error"&&!y.value,B=g?"":v.filter(te=>te.kind==="text").map(te=>e.role==="assistant"?wa(te.textSig.peek()):te.textSig.peek()).join(`
62
63
 
63
- `).trim(),z=!T&&t!=="error"&&!v.value&&O.length>0,V=a?y_(m,{showReasoning:o,showSources:i}):m.map((G,Y)=>({kind:"part",part:G,index:Y}));function K(G,Y){return l(Xb,{part:G,generativeUi:e.role==="assistant",active:w,live:h,strings:n,showReasoning:o,showToolCalls:a,showSources:i,interactive:s&&t==="complete"&&(G.kind!=="tool"||Ca(e,Y)),superseded:c,continuationStreaming:e.continuationStreaming===!0,tool:p},`${ty(G)}#${Y}`)}let te=L||z;return l("div",{class:`${Oe}-bubble-row`,"data-role":e.role,"data-testid":ut(N.messageBubble,e.serverMessageId??e.id),children:l("div",{class:`${Oe}-bubble-col`,children:[l("div",{class:`${Oe}-bubble`,children:[e.role==="operator"&&e.operatorInitials?l("span",{class:`${Oe}-bubble-author`,children:e.operatorInitials}):null,l("div",{class:`${Oe}-bubble-body`,children:[S?l(ry,{label:n.loading}):V.flatMap((G,Y)=>G.kind==="part"?[K(G.part,G.index)]:G.parts.some(De=>De.kind==="tool")?[l(P_,{parts:G.parts,strings:n,live:h,running:h&&Y===V.length-1},`steps#${G.indices[0]}`)]:G.parts.map((De,_e)=>K(De,G.indices[_e]??_e))),C&&l(ny,{}),t==="error"||v.value?l("div",{class:`${Oe}-error`,role:"alert",children:[l("span",{children:e.errorText??n.errorGeneric}),_?l("button",{type:"button",class:`${Oe}-error-retry`,onClick:()=>_(e),"data-testid":N.messageRetry,children:n.errorRetry}):null]}):null]})]}),E||te?l("div",{class:`${Oe}-bubble-meta`,children:[E?l("time",{class:`${Oe}-bubble-time`,dateTime:E.iso,title:E.full,children:E.short}):null,te?l("div",{class:`${Oe}-bubble-actions`,children:[L&&e.serverMessageId?l(Vp,{messageId:e.serverMessageId,initial:e.feedback??null,strings:n,onFeedback:u}):null,z?l(Kb,{text:O,strings:n}):null]}):null]}):null]})})}function Kb({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:`${Oe}-msg-action`,"data-active":n?"true":void 0,"aria-label":a,title:a,onClick:o,"data-testid":N.messageCopy,children:n?l(qn,{}):l(ep,{})})}function Qb(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 Xb({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(hr,{textSig:e.textSig,doneSig:e.doneSig,generativeUi:t,strings:o});case"reasoning":return a?l(ey,{part:e,active:n,strings:o}):null;case"tool":return l(Zb,{part:e,strings:o,showToolCalls:i,interactive:c,superseded:p,continuationStreaming:_,live:r,tool:d});case"file":return l(Jb,{part:e,strings:o});case"source":return s?l(d_,{part:e,strings:o}):null}}function Jb({part:e,strings:t}){let n=e.filename??t.file;if(e.mediaType.startsWith("image/"))return l("a",{class:`${Oe}-file-image`,href:e.url,target:"_blank",rel:"noreferrer noopener",title:n,"data-testid":N.messageFile,children:l("img",{src:e.url,alt:n,loading:"lazy"})});let r=(n.includes(".")?n.split(".").pop():e.mediaType.split("/").pop())?.toUpperCase(),o=e.fileSize===void 0?void 0:Yb(e.fileSize);return l("a",{class:`${Oe}-file-chip`,href:e.url,target:"_blank",rel:"noreferrer noopener",title:n,"data-testid":N.messageFile,children:[l("span",{class:`${Oe}-file-chip-icon`,"aria-hidden":"true",children:l(Na,{})}),l("span",{class:`${Oe}-file-chip-text`,children:[l("span",{class:`${Oe}-file-chip-name`,children:n}),l("span",{class:`${Oe}-file-chip-meta`,children:[r,o].filter(Boolean).join(" \xB7 ")})]})]})}function Yb(e){let t=Math.min(Math.floor(Math.log10(Math.max(e,1))/3),2);return new Intl.NumberFormat(void 0,{style:"unit",unit:["byte","kilobyte","megabyte"][t],unitDisplay:"narrow",maximumFractionDigits:1}).format(e/1e3**t)}function Zb({part:e,strings:t,showToolCalls:n,interactive:r,superseded:o,continuationStreaming:a,live:i,tool:s}){let c=ue(()=>Se(()=>e.approvalSig.value!==void 0),[e]);return s?.humanInLoop&&c.value?e.toolMetadata?.card==="questions"?l(g_,{part:e,strings:t,active:r,superseded:o,continuationStreaming:a,onDecision:s.onDecision,onEdit:s.onEdit}):l(p_,{part:e,strings:t,active:r,superseded:o,continuationStreaming:a,onDecision:s.onDecision,onEdit:s.onEdit}):n?l(v_,{part:e,strings:t,live:i,superseded:o}):null}function ey({part:e,active:t,strings:n}){return l("details",{class:`${Oe}-reasoning`,"data-testid":N.reasoning,open:t,"data-active":t?"true":void 0,children:[l("summary",{class:`${Oe}-reasoning-summary`,children:l("span",{class:`${Oe}-reasoning-label`,children:t?n.thinking:n.thoughts})}),l("div",{class:`${Oe}-reasoning-body`,children:l(hr,{textSig:e.textSig,doneSig:e.doneSig})})]})}function ty(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 ny(){return l("span",{class:`${Oe}-typing`,"data-testid":N.typingDots,"aria-hidden":"true",children:[l("span",{}),l("span",{}),l("span",{})]})}function ry({label:e}){return l("span",{class:`${Oe}-loading`,role:"status",children:[l("span",{class:`${Oe}-loading-spinner`,"aria-hidden":"true"}),l("span",{class:`${Oe}-loading-label`,children:e})]})}var Sn=M.cssPrefix,rl=120,oy=350;function S_({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:x}){let P=F(null),k=Rt(()=>e.value),[T,h]=q(!1),[g,S]=q(!1),w=F(!1),C=F(!1),[E,A]=q(),L=F(!1),O=F(!1),z=F(!1),V=F(0);function K(){return z.current||performance.now()-V.current<oy}let te=F(0);function G(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 Y(b){return h(b.scrollHeight-b.scrollTop-b.clientHeight>rl*2)}function De(b){te.current=performance.now(),b.scrollTop=b.scrollHeight,G(b)}function _e(b,U){De(b);let J=U,Z=0;function ae(){O.current||K()||(De(b),--J>0&&(Z=requestAnimationFrame(ae)))}return U>0&&(Z=requestAnimationFrame(ae)),()=>cancelAnimationFrame(Z)}function Te(b,U){let J,Z,ae,Re=-1;function Pe(){J.disconnect(),Z.disconnect(),clearTimeout(ae)}function he(){if(O.current||K()||Re>=0&&b.scrollTop<Re-4)return Pe();De(b),Re=b.scrollTop}return J=new ResizeObserver(he),Z=new MutationObserver(he),he(),J.observe(b),Z.observe(b,{childList:!0,subtree:!0,characterData:!0}),ae=setTimeout(Pe,U),Pe}let et=k.value[0]?.id;Tt(()=>{let b=P.current;if(b&&k.value.length!==0&&!C.current&&(L.current=!0,!!k.value.some(U=>U.role==="user")))return Te(b,300)},[et]);let Ue=F(0);D(()=>{let b=P.current,U=k.value,J=Ue.current;if(Ue.current=U.length,!b||!L.current||C.current)return;if(U.slice(J).some(ae=>ae.role==="user"))return O.current=!1,_e(b,3);if(!U.some(ae=>ae.role==="user")||O.current||K())return;b.scrollHeight-b.scrollTop-b.clientHeight<rl&&De(b)},[k.value.length]);let gt=F(null);D(()=>{let b=P.current,U=k.value.at(-1),J=gt.current;if(gt.current=U?{id:U.id,streaming:U.status==="streaming"}:null,!!b&&L.current&&!(!U||U.id!==J?.id||J.streaming||U.status!=="streaming"))return O.current=!1,_e(b,3)},[k.value]),D(()=>{let b=P.current;if(!b)return;let U=k.value.at(-1);if(!U||U.status!=="streaming"&&!k.value.some(ae=>ae.role==="user"))return;let J=()=>{if(O.current||K())return;b.scrollHeight-b.scrollTop-b.clientHeight<rl*2&&De(b)};if(U.status!=="streaming")return Te(b,300);J();let Z=new MutationObserver(J);return Z.observe(b,{childList:!0,subtree:!0,characterData:!0}),()=>Z.disconnect()},[k.value]);let Ge=m?.form.id,ht=!!m&&(v??[]).some(b=>b.formId===m.form.id);Tt(()=>{let b=P.current;!b||!Ge||O.current||k.value.some(U=>U.role==="user")&&(ht?b.querySelector(`[data-testid="${N.formGate}"]`)?.scrollIntoView({block:"nearest"}):De(b))},[Ge,ht]),D(()=>{let b=P.current;if(!b)return;let U=()=>{Y(b),G(b),performance.now()-te.current>150&&(O.current=b.scrollHeight-b.scrollTop-b.clientHeight>8)};function J(){O.current=!0}function Z(fe){fe.deltaY<0&&J()}let ae=0;function Re(fe){ae=fe.touches[0]?.clientY??0,z.current=!0}function Pe(fe){(fe.touches[0]?.clientY??0)>ae+4&&J()}function he(){z.current=!1,V.current=performance.now()}function _t(){z.current=!0}return b.addEventListener("scroll",U,{passive:!0}),b.addEventListener("wheel",Z,{passive:!0}),b.addEventListener("touchstart",Re,{passive:!0}),b.addEventListener("touchmove",Pe,{passive:!0}),b.addEventListener("touchend",he,{passive:!0}),b.addEventListener("touchcancel",he,{passive:!0}),b.addEventListener("pointerdown",_t,{passive:!0}),window.addEventListener("pointerup",he,{passive:!0}),window.addEventListener("pointercancel",he,{passive:!0}),Y(b),()=>{b.removeEventListener("scroll",U),b.removeEventListener("wheel",Z),b.removeEventListener("touchstart",Re),b.removeEventListener("touchmove",Pe),b.removeEventListener("touchend",he),b.removeEventListener("touchcancel",he),b.removeEventListener("pointerdown",_t),window.removeEventListener("pointerup",he),window.removeEventListener("pointercancel",he)}},[]);function xt(){let b=P.current;b&&(O.current=!1,De(b))}let dt=k.value.filter(b=>!b.ephemeral),St=dt[0],kt=St?.serverMessageId??St?.id,Ee=!!(p&&dt.length>=Ns&&kt!==E);async function qe(){if(!p||w.current)return;let b=P.current,U=b?.scrollHeight??0,J=b?.scrollTop??0;w.current=!0,C.current=!0,S(!0);try{let Z=await p();Z===!1&&kt&&A(kt),Z&&b&&(await new Promise(ae=>requestAnimationFrame(()=>requestAnimationFrame(()=>ae()))),b.scrollTop=J+b.scrollHeight-U,G(b),Y(b))}finally{C.current=!1,w.current=!1,S(!1)}}let ye=[],ot="",ve=k.value.at(-1)?.id,vt=[...v??[]].toSorted((b,U)=>(b.createdAt??1/0)-(U.createdAt??1/0));function Ke(b){return m&&b.formId===m.form.id?l(Ws,{form:m.form,strings:t,onSubmit:m.onSubmit,onSkip:m.onSkip},`gate:${b.formId}`):l(Up,{marker:b,strings:t,onFill:!m&&x?()=>x(b.formId):void 0},b.key)}function $t(b){for(let U=vt[0];U?.createdAt!==void 0&&!(b!==void 0&&U.createdAt>b);U=vt[0])vt.shift(),ye.push(Ke(U))}for(let b of k.value){if(b.role==="assistant"&&b.id!==ve&&Dn(b))continue;$t(b.createdAt);let U=ay(b.createdAt);U&&U!==ot&&(ye.push(l("div",{class:`${Sn}-date-divider`,children:l("span",{class:`${Sn}-date-pill`,title:iy(b.createdAt),children:sy(b.createdAt,t)})},`day:${U}`)),ot=U);let Z=b.retryAction!==void 0||b.role==="assistant"&&b.id===ve?Ia(k.value,b):void 0,ae=Z!==void 0&&(Z.kind!=="continue-assistant"||d==="ai-agent");ye.push(l(x_,{message:b,status:b.status,strings:t,responseMode:n,showReasoning:r,showToolCalls:o,showSources:a,interactive:!!_&&d==="ai-agent"&&b.id===ve,superseded:b.id!==ve,tool:u,onRetry:_&&ae&&(b.role==="user"||b.id===ve)?f:void 0,enableMessageFeedback:i,onFeedback:s},b.id))}for(let b of vt)ye.push(Ke(b));return l("div",{class:`${Sn}-list-wrap`,children:[l("div",{ref:P,class:`${Sn}-list ${Sn}-list--fade`,part:"messages",role:"log","aria-live":"polite","aria-relevant":"additions text",children:[c&&k.value.length===0?l("div",{class:`${Sn}-list-loading`,role:"status",children:t.conversationLoading}):null,Ee?l("div",{class:`${Sn}-load-previous`,children:l("button",{type:"button",onClick:qe,disabled:g,"aria-busy":g,"data-testid":N.loadPreviousMessages,children:t.loadPreviousMessages})}):null,ye,m&&!ht?l(Ws,{form:m.form,strings:t,onSubmit:m.onSubmit,onSkip:m.onSkip}):null]}),T?l("button",{type:"button",class:`${Sn}-jump`,onClick:xt,"aria-label":t.scrollToBottom,title:t.scrollToBottom,"data-testid":N.scrollToBottom,children:l(ln,{})}):null]})}function ay(e){if(typeof e!="number"||!Number.isFinite(e))return"";let t=new Date(e);return`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`}function iy(e){if(typeof e!="number"||!Number.isFinite(e))return"";try{return new Date(e).toLocaleDateString(void 0,{dateStyle:"full"})}catch{return""}}function sy(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 ni({panelEl:e,resize:t,position:n,initialSize:r,onSizeChange:o,strings:a}){let i=M.cssPrefix,s=F(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,x=e.getBoundingClientRect();s.current={pointerId:m.pointerId,startX:m.clientX,startY:m.clientY,startW:x.width,startH:x.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 x=(m.clientX-v.startX)*v.dirX,P=(m.clientY-v.startY)*v.dirY;e.style.setProperty(`--${i}-widget-w`,`${v.startW+x}px`),e.style.setProperty(`--${i}-widget-h`,`${v.startH+P}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 x=e.getBoundingClientRect();o({width:Math.round(x.width),height:Math.round(x.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":N.resizeGrip,children:l(Ud,{})})}var k_=M.cssPrefix;function w_({suggestions:e,onPick:t,disabled:n=!1}){return e.length===0?null:l("div",{class:`${k_}-suggestions`,role:"group","aria-label":"Suggested replies",children:e.map((r,o)=>l("button",{type:"button",class:`${k_}-suggestion`,onClick:()=>t(r),disabled:n,"data-testid":ut(N.suggestion,o),children:r.label},r.id))})}var jn=M.cssPrefix,ly=`.${jn}-header, .${jn}-back-header, .${jn}-home-hero`,cy='button, a, input, textarea, select, [role="tab"], [contenteditable]',C_=56;function ri(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(ly)||p.closest(cy))return;let _=e.getBoundingClientRect();o={id:c.pointerId,x:c.clientX,y:c.clientY,dx:n(e.style.getPropertyValue(`--${jn}-modal-dx`)),dy:n(e.style.getPropertyValue(`--${jn}-modal-dy`)),maxX:(window.innerWidth+_.width)/2-C_,maxY:(window.innerHeight+_.height)/2-C_},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(`--${jn}-modal-dx`,`${p}px`),e.style.setProperty(`--${jn}-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 oi({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 We=M.cssPrefix;function T_(e){let{options:t,onClose:n}=e,r=t.strings,o=F(null);D(()=>{let p=o.current;if(!p)return;let _=Da(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?.blocking&&!e.sendPreparing&&e.options.features.fileUpload,s=$(p=>{i&&a.current?.attachFromDrop(p)},[a,i]),{visible:c}=oi({containerRef:o,onDrop:s,disabled:!i});return ri(o.current,t.mode==="modal"),l("div",{ref:o,class:`${We}-panel`,part:"panel",role:"dialog","aria-modal":"false","aria-label":r.panelTitle,style:{position:"relative"},"data-testid":N.panel,children:[l(ol,{...e,containerEl:o.current,dragOver:c}),l(al,{poweredBy:e.options.poweredBy})]})}function ol(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:x,assignedOperatorInitials:P,operatorAvailable:k,operatorRequestEnabled:T,onRequestOperator:h,onCancelOperatorRequest:g,loadingMessages:S,onLoadPreviousMessages:w,messagesSig:C,agent:E,suggestions:A,initialWidgetSize:L,onClose:O,onBack:z,onClear:V,onToggleHistory:K,onSelectHistoryConversation:te,onNewConversation:G,onWidgetSizeChange:Y,onSend:De,onStop:_e,onSuggestion:Te,activeForm:et,formMarkers:Ue,onFormSubmit:gt,onFormSkip:Ge,onFormFill:ht,tool:xt,onRetry:dt,onMessageFeedback:St,containerEl:kt,dragOver:Ee,composerApiRef:qe}=e,ye=t.strings,ot=Rt(()=>C.value.some(vt=>!vt.ephemeral&&vt.role!=="system")).value,ve;return et?.blocking?ve=null:_?ve=l(de,{children:[x&&x!=="ai-agent"?l(py,{controlMode:x,operatorInitials:P,operatorAvailable:k,onCancelOperatorRequest:g,strings:ye}):null,u&&x==="ai-agent"?l("div",{class:`${We}-loading ${We}-compaction-status`,role:"status","data-testid":N.compactionStatus,children:[l("span",{class:`${We}-loading-spinner`,"aria-hidden":"true"}),ye.compactingContext]}):null,!d&&!u&&x==="ai-agent"&&l(w_,{suggestions:A,onPick:Te,disabled:v}),l(Sp,{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:ot,controlMode:x,onRequestOperator:h,onSend:De,onStop:_e,apiRef:qe},s)]}):ve=l(dy,{label:ye.conversationClosed,ctaLabel:ye.startNewConversation,onNewConversation:V}),l(de,{children:[p==="history"?l(uy,{strings:ye,onBack:K,onClose:O,showClose:Aa(t.mode,c,t.actions)}):l("header",{class:`${We}-header`,part:"header","data-testid":N.panelHeader,children:[z?l("button",{type:"button",class:`${We}-icon-btn`,onClick:z,"aria-label":ye.moduleBack,title:ye.moduleBack,children:l(io,{})}):null,E?l(Mp,{agent:E,strings:ye}):l("h1",{children:ye.panelTitle}),l(Qt,{panelProps:e,variant:"chat"})]}),p==="history"?l(Wa,{transport:n,strings:ye,locale:t.locale,persistence:a,onSelect:te,onNewConversation:G}):l(de,{children:[l(Dp,{visible:Ee,strings:ye}),l(S_,{messagesSig:C,strings:ye,responseMode:t.responseMode,showReasoning:t.showReasoning,showToolCalls:t.showToolCalls,showSources:t.showSources,enableMessageFeedback:t.enableMessageFeedback,onFeedback:St,loading:S,onLoadPreviousMessages:w,idle:!d&&!v&&_&&!et?.blocking,controlMode:x,tool:xt,onRetry:dt,form:et?{form:et,onSubmit:gt,onSkip:Ge}:null,formMarkers:Ue,onFillForm:ht}),ve,l(fy,{disclaimer:t.composerDisclaimer})]}),t.size.resize?.enabled?l(ni,{panelEl:kt,resize:t.size.resize,position:t.position,initialSize:L,onSizeChange:Y,strings:ye}):null]})}function uy({strings:e,onBack:t,onClose:n,showClose:r}){return l("header",{class:`${We}-header`,part:"header",children:[l("button",{type:"button",class:`${We}-icon-btn`,onClick:t,"aria-label":e.historyBack,title:e.historyBack,children:l(io,{})}),l("h1",{children:e.historyTitle}),r?l("button",{type:"button",class:`${We}-icon-btn`,onClick:n,"aria-label":e.close,title:e.close,children:l(Bt,{})}):null]})}function dy({label:e,ctaLabel:t,onNewConversation:n}){return l("div",{class:`${We}-readonly-banner`,role:"note",children:[l("span",{class:`${We}-readonly-label`,children:e}),l("button",{type:"button",class:`${We}-readonly-cta`,onClick:n,children:t})]})}function py({controlMode:e,operatorInitials:t,operatorAvailable:n,onCancelOperatorRequest:r,strings:o}){let a=_y(e,t,n,o);return l("div",{class:`${We}-operator-banner`,role:"status","data-mode":e,"data-testid":N.operatorBanner,children:[l("span",{class:`${We}-operator-pulse`,"aria-hidden":"true"}),l("span",{class:`${We}-operator-label`,children:a}),e==="awaiting-operator"&&r?l("button",{type:"button",class:`${We}-cancel-operator-request`,"data-testid":N.cancelOperatorRequest,onClick:r,children:o.cancelOperatorRequest}):null]})}function _y(e,t,n,r){return e==="operator"?r.chattingWithOperator.replace("{operator}",t??""):n===!1?r.noOperatorAvailable:r.connectingOperator}function fy({disclaimer:e}){return e?l("div",{class:`${We}-composer-footer`,children:l("div",{class:`${We}-disclaimer`,children:e})}):null}function al({poweredBy:e}){return e?l("div",{class:`${We}-poweredby-bar`,children:l(my,{logoUrl:e.logoUrl,text:e.text,href:e.href})}):null}function my({logoUrl:e,text:t,href:n}){let r=l(de,{children:[e?l("img",{class:`${We}-poweredby-logo`,src:e,alt:"",loading:"lazy"}):null,t?l("span",{children:t}):null]});return n?l("a",{class:`${We}-poweredby`,href:n,target:"_blank",rel:"noopener noreferrer",children:r}):l("span",{class:`${We}-poweredby`,children:r})}var ai=M.cssPrefix;function R_({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=F(null),u=F(new Set);D(()=>{let V=d.current;if(!V)return;let K=Da(V);function te(G){G.key==="Escape"&&e.onClose?.()}return V.addEventListener("keydown",te),()=>{K(),V.removeEventListener("keydown",te)}},[e.onClose]);let f=Rt(()=>n.sig.value).value,m=Cd(f),v=p.modules.byId[f.activeTab],x=e.composerActive&&v?.layout==="chat"&&m===void 0,P=e.composerApiRef,k=x&&e.view==="chat"&&e.canSend&&!e.activeForm?.blocking&&!e.sendPreparing&&e.options.features.fileUpload,T=$(V=>{k&&P.current?.attachFromDrop(V)},[P,k]),{visible:h}=oi({containerRef:d,onDrop:T,disabled:!k});ri(d.current,p.mode==="modal");let g=m?.kind==="iframe"||m?.kind==="content",S=t.length>1&&(Td(f)||!g),w=F(null);D(()=>{if(g&&w.current===null)w.current=e.panelSize,e.panelSize==="normal"&&c("expanded");else if(!g&&w.current!==null){let V=w.current;w.current=null,c(V)}},[g]);let C={push:V=>n.push(V),pop:()=>n.pop(),switchTab:V=>n.switchTab(V),switchToLayout:V=>{let K=t.find(te=>te.layout===V);K&&n.switchTab(K.id)},selectConversation:i,startNewConversation:s};function E(V){return{options:p,transport:e.transport,strings:_,config:V,nav:C,bus:r,panelProps:e,latestNews:a}}let A=l(Qt,{panelProps:e,variant:"plain"});v&&u.current.add(v.id);let L=t.filter(V=>u.current.has(V.id));function O(V){if(V.layout==="chat")return l(ol,{...e,composerActive:x,containerEl:d.current,dragOver:h});let K=Va[V.layout].Root;return K?l(K,{...E(V)}):null}function z(){return m?.kind==="iframe"?l(Ap,{url:m.url,title:m.title,strings:_,onBack:()=>n.pop(),actions:A}):m?.kind==="content"?l(pp,{id:m.id,title:m.title,transport:e.transport,strings:_,bus:r,onBack:()=>n.pop(),actions:A}):null}return l("div",{ref:d,class:`${ai}-panel ${ai}-messenger`,part:"panel",role:"dialog","aria-modal":"false","aria-label":_.panelTitle,style:{position:"relative"},"data-testid":N.messengerHome,children:[l("div",{class:`${ai}-messenger-body`,children:[L.map(V=>l("div",{class:`${ai}-messenger-pane`,hidden:g||V.id!==v?.id,children:O(V)},V.id)),z()]}),S?l(Ip,{modules:t,activeTab:f.activeTab,strings:_,hasUnread:o,onSelect:V=>n.switchTab(V)}):null,l(al,{poweredBy:p.poweredBy}),p.size.resize?.enabled&&!(v?.layout==="chat"&&!m)?l(ni,{panelEl:d.current,resize:p.size.resize,position:p.position,initialSize:e.initialWidgetSize,onSizeChange:e.onWidgetSizeChange,strings:_}):null]})}var vo=M.cssPrefix;function I_({strings:e,onClose:t}){return l("div",{class:`${vo}-panel ${vo}-modules-empty`,part:"panel",role:"dialog","aria-label":e.panelTitle,"data-testid":N.modulesEmpty,children:[t?l("button",{type:"button",class:`${vo}-icon-btn ${vo}-modules-empty-close`,onClick:t,"aria-label":e.close,title:e.close,children:l(Bt,{})}):null,l("p",{class:`${vo}-modules-empty-text`,children:e.modulesEmpty})]})}function E_(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":N.sidebar,children:[l("div",{class:`${t}-sidebar-header`,children:[l(gy,{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":N.sidebarToggle,children:l(hy,{collapsed:a})})]}),a?null:l(de,{children:[i.length>0?l("nav",{class:`${t}-sidebar-section`,"data-section":"navigation",children:l(vy,{items:i})}):null,s.length>0?l("div",{class:`${t}-sidebar-section`,"data-section":"link-cards",children:l(by,{items:s})}):null,e.showConversations?l("div",{class:`${t}-sidebar-conversations`,children:l(Wa,{transport:e.transport,strings:e.strings,locale:e.locale,persistence:e.persistence,onSelect:e.onSelectConversation,onNewConversation:e.onNewConversation})}):null]})]})}function gy({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 hy({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 vy({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 by({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 A_=M.cssPrefix;function M_(e){return l("main",{class:`${A_}-page-shell`,"data-sidebar-collapsed":e.sidebarCollapsed?"true":"false",children:[l(E_,{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:`${A_}-page-chat`,"aria-label":e.strings.panelTitle,children:e.children})]})}var bo=le.scope("hitl");function ii(e){return e.kind==="tool"&&Wt(e.toolMetadata)&&(e.stateSig.value==="input-available"||e.stateSig.value==="approval-responded"&&e.approvalSig.value?.approved===!0)}function N_(e,t){t.errorSig.value=Ys(t.toolCallId),t.stateSig.value="output-error",e.partsSig.value=[...e.partsSig.value]}function yy(e,t){let n=e.slice(0,e.indexOf(t)).findLast(r=>r.role==="user");return n!==void 0&&It.sentHere(n.id)}function L_(e){let{streaming:t,controlModeSig:n,messagesSig:r,sendAiTurn:o,bus:a,humanInLoop:i,tools:s}=e,c=F(t);c.current=t;let p=F(s);p.current=s;let _=F(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(L=>L.kind==="tool"&&L.toolCallId===h)??-1,E=w?.partsSig.value[C];if(!w||E?.kind!=="tool")return bo.warn("decideTool: tool part not found",{toolCallId:h}),!1;if(w.status!=="complete"||!Ca(w,C)||!g(E))return!1;if(S(E),w.partsSig.value=[...w.partsSig.value],!Fn(w)||w.partsSig.value.some(ii))return!0;w.status="streaming",w.retryAction={kind:"continue-assistant",messageId:w.serverMessageId??w.id},w.awaitingContinuation=!0,r.value=[...r.value];let A=w.partsSig.value.flatMap(L=>L.kind==="tool"?[L.toolCallId]:[]);return o({continueExisting:!0}).then(L=>L&&It.clear(A)),!0},[n,r,o]),m=$((h,g)=>{let{toolCallId:S,toolName:w}=g;_.current.has(S)||(_.current.set(S,h),u(!0),o_({toolCallId:S,toolName:w,input:g.inputSig.value,optionTools:p.current??[],onSettled:(C,E)=>{bo.info("toolResult",{toolCallId:S,status:C}),a.emit("toolResult",{toolCallId:S,name:ho(w),status:C,durationMs:E})}}).then(C=>{_.current.delete(S)&&(u(_.current.size>0),f(S,ii,E=>{C.state==="output-available"?E.outputSig.value=C.output:E.errorSig.value=C.errorText,E.stateSig.value=C.state}))}))},[a,f]),v=$(()=>{let h=r.value;for(let[w,C]of _.current){let E=h.findIndex(A=>A.id===C);E<0||E===h.length-1||(_.current.delete(w),a_(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=>ii(w)&&w.stateSig.value==="input-available");if(!(S.length===0||!yy(h,g)))for(let w of S)It.get(w.toolCallId)?.state==="stopped"?N_(g,w):m(g.id,w)},[r,m]);D(()=>v(),[t,v]),D(()=>r.subscribe(()=>v()),[r,v]);let x=$((h,g,S)=>{let w=!1,C;if(!f(h,L=>L.stateSig.value==="approval-requested",L=>{Wt(L.toolMetadata)&&(C=L),w=L.toolMetadata?.card==="questions";let O=L.approvalSig.value?.id??h;L.approvalSig.value={id:O,approved:g,reason:S},L.stateSig.value="approval-responded"}))return;let A=r.value.at(-1);if(C&&g&&A&&m(A.id,C),C&&!g&&a.emit("toolResult",{toolCallId:h,name:ho(C.toolName),status:"declined",durationMs:0}),w){bo.info("toolResult",{toolCallId:h}),a.emit("toolResult",{toolCallId:h});return}bo.info("toolDecision",{toolCallId:h,approved:g}),a.emit("toolDecision",{toolCallId:h,approved:g})},[a,f,r,m]),P=$(h=>{f(h,g=>g.stateSig.value==="approval-responded"&&g.approvalSig.value?.approved!==void 0&&!ii(g),g=>{let S=g.approvalSig.value?.id??h;g.approvalSig.value={id:S},g.stateSig.value="approval-requested"})},[f]),k=ue(()=>({humanInLoop:i,onDecision:x,onEdit:P}),[i,x,P]),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?N_(h,S):Ys(g),bo.info("toolResult",{toolCallId:g,status:"stopped"}),a.emit("toolResult",{toolCallId:g,name:S?ho(S.toolName):void 0,status:"stopped",durationMs:0})}_.current.clear(),u(!1)},[a,r]);return{toolInteraction:k,pageToolsRunning:d,stopPageTools:T}}var Py=le.scope("latest-news");function O_({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=>Py.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 $_({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 D_(e){let{transport:t,conversationIdSig:n}=e,r=Mt("ai-agent"),o=Mt(void 0),a=Mt(void 0),i=F(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=td(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 si=M.cssPrefix,F_=`--${si}-visual-viewport-height`,B_=`--${si}-visual-viewport-top`;function U_(e){let{hostElement:t,mode:n,panelSize:r,isOpen:o,surfaceReady:a,setIsOpen:i}=e;Tt(()=>{Ko(t,Ma(n,r,o))},[t,o,r,n]),Tt(()=>{if(!o||!a)return;let s=t.ownerDocument.defaultView,c=s?.visualViewport,p=t.shadowRoot?.querySelector(`.${si}-anchor`);if(!s||!c||!p)return;let _=()=>{p.style.setProperty(F_,`${c.height}px`),p.style.setProperty(B_,`${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(F_),p.style.removeProperty(B_)}},[t,o,a]),D(()=>{if(n!=="modal"||!o)return;function s(c){c.composedPath().some(_=>_ instanceof HTMLElement&&_.classList.contains(`${si}-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 il=le.scope("reducer"),li=class{constructor(t,n){re(this,"messagesSig",t);re(this,"onReconcileNeeded",n);re(this,"active",null);re(this,"openTextParts",new Map);re(this,"partSeq",0);re(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=an();r.id=t.id;let o=Vn(t)||Bn(t)&&(t.status!=="streaming"||Fn(t)),a=t.status==="streaming"&&Fn(t)&&eo(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,q_(i,a),t.liveCatchUp&&Vn(t.shadow)&&(a.status==="streaming"||Bn(a))?(t.probeContinuation=!1,t.continuationTailReplay=!1,t):(t.probeContinuation=Vn(a)||Bn(a)&&(a.status!=="streaming"||Fn(a)),t.continuationTailReplay=a.status==="streaming"&&Fn(a)&&eo(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;q_(t,a);let i=Vn(t)&&Bn(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 Ft(()=>{t.role=n.role,t.serverMessageId=n.serverMessageId,t.operatorInitials=n.operatorInitials,t.status=n.status,n.canceled&&(t.canceled=!0),t.finishReason=n.finishReason,t.errorText=n.errorText,t.suggestions=n.suggestions??t.suggestions,t.partsSig.value=n.partsSig.value,this.messagesSig.value=[...this.messagesSig.value]}),this.replay=null,this.active=t,t}promoteContinuation(t=!1){let{baseline:n,chunks:r}=this.replay,o=Ta(n);return this.replay=null,Ft(()=>{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=Ta(n);return this.replay=null,Ft(()=>{n.awaitingContinuation=!1,n.status="streaming",n.finishReason=void 0,n.errorText=void 0,n.suggestions=void 0,this.attach(n),this.apply(t),n.continuationStreaming=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&&!Vt(c))return this.attach(c),this.apply(t),null;let p=an();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(!ky(o,a,t))return p&&(Ry(o,a)&&(o.continuationStreaming=!0,this.messagesSig.value=[...this.messagesSig.value],this.onReconcileNeeded?.({messageId:o.serverMessageId??o.id})),this.detach()),null;let d=Vn(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&&Sy(o,a)){let d=this.promoteContinuation(!0);return p?(this.detach(),d):null}if(!c)return p&&this.detach(),null;if(p&&!Vt(o)&&Vt(a)){let d=this.promoteReplay();return this.detach(),d}if(!xy(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:se(""),doneSig:se(!1)};return this.openTextParts.set(o,i),yo(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":yo(n,{kind:"step-start",id:`ss-${this.partSeq++}`});return;case"finish":il.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":il.warn("stream error chunk",{errorText:t.errorText}),n.status="error",n.errorText=t.errorText,this.bumpDone(n);return;case"abort":il.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":Iy(n,t);return;case"file":yo(n,{kind:"file",url:t.url,mediaType:t.mediaType});return;case"source-url":H_(n,{kind:"source",sourceId:t.sourceId,url:t.url,title:t.title});return;case"source-document":H_(n,{kind:"source",sourceId:t.sourceId,title:t.title,filename:t.filename,mediaType:t.mediaType});return;case"data-suggestions":n.suggestions=ka(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){Ft(()=>{t.partsSig.value=[...t.partsSig.value],this.messagesSig.value.includes(t)&&(this.messagesSig.value=[...this.messagesSig.value])})}},sl={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function Vn(e){return e.awaitingContinuation===!0||e.continuationStreaming===!0||e.retryAction?.kind==="continue-assistant"}function q_(e,t){e.canceled&&(t.canceled=!0),!(!Vn(e)||t.status!=="streaming"&&!Bn(t))&&(t.awaitingContinuation??(t.awaitingContinuation=e.awaitingContinuation),t.continuationStreaming??(t.continuationStreaming=e.continuationStreaming),t.retryAction===void 0&&(t.retryAction=e.retryAction))}function xy(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)=>z_(o,r[a]))}function Sy(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)=>z_(s,a[c]))}function z_(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||!Ra(t.toolName,e.toolName)||sl[t.stateSig.value]<sl[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 ky(e,t,n){return wy(e,n)||!Cy(e,t)?!0:n.type!=="finish"&&n.type!=="error"&&n.type!=="abort"?!1:eo(t)||e.awaitingContinuation===!0&&n.type!=="finish"?!0:e.awaitingContinuation===!0&&t.partsSig.value.every(r=>r.kind==="step-start")}function wy(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&&sl[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)=>Ty(r[a+s],i)))}function Ty(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"||Ra(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 Ry(e,t){if(Vn(e)||!Bn(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 kn(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:se(""),inputSig:se(void 0),outputSig:se(void 0),errorSig:se(void 0),stateSig:se("input-streaming"),approvalSig:se(void 0)};return yo(e,i),i}function yo(e,t){e.partsSig.value=[...e.partsSig.value,t]}function H_(e,t){e.partsSig.value.some(n=>n.kind==="source"&&n.sourceId===t.sourceId)||yo(e,t)}function Iy(e,t){switch(t.type){case"tool-input-start":kn(e,t.toolCallId,t.toolName,t.dynamic,t.toolMetadata);return;case"tool-input-delta":{let n=kn(e,t.toolCallId);n.inputPartialSig.value+=t.inputTextDelta;return}case"tool-input-available":{let n=kn(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=kn(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=kn(e,t.toolCallId,t.toolName);n.approvalSig.value={id:t.approvalId},n.stateSig.value="approval-requested";return}case"tool-output-available":{let n=kn(e,t.toolCallId,void 0,t.dynamic);n.outputSig.value=t.output,n.stateSig.value="output-available";return}case"tool-output-error":{let n=kn(e,t.toolCallId,void 0,t.dynamic);n.errorSig.value=t.errorText,n.stateSig.value="output-error";return}case"tool-output-denied":{let n=kn(e,t.toolCallId);n.stateSig.value="output-denied";return}default:return}}async function j_(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 Ey=120;function V_(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:x,canContinueRef:P,setCanSend:k,feedback:T,bus:h,loadInitialThread:g,shouldReconcileOnConnect:S}=e,w=F(0);D(()=>{if(!t||!n||!r.value)return;let C=r.value,E=new AbortController,A=b=>{},L=new li(o,b=>A(b));i.primeIdentity(s,C);let O=!1,z=!1,V,K=!1,te,G=0,Y=P.current,De,_e,Te=Date.now(),et,Ue=!1,gt=!1;function Ge(b,U,J){if(!Vt(b))return;let Z=o.value.findLast(Re=>!Re.ephemeral),ae=b.serverMessageId??b.id;if(!(Z&&(Z.serverMessageId??Z.id)!==ae))return wa(o.value,b,C,a.current.strings.newConversation,U,J)}function ht(b,U,J,Z){let ae=Ge(b,U,Z);if(!ae)return;let Pe=`${b.serverMessageId??b.id}:${J}:${ae.preview??""}`;Pe!==_e&&(_e=Pe,i.publishConversation({...ae,hasUnread:!0},!0))}let xt;function dt(){xt&&(clearTimeout(xt.timer),xt=void 0)}function St(){let b=xt;if(!b)return;clearTimeout(b.timer),xt=void 0;let U=o.value.find(J=>(J.serverMessageId??J.id)===b.replyId);U?.role!=="assistant"&&U?.role!=="operator"||ht(U,b.canContinue,b.generation,b.activityAt)}function kt(b,U,J,Z){dt(),xt={replyId:b.serverMessageId??b.id,canContinue:U,generation:J,activityAt:Z,timer:setTimeout(St,Ey)}}function Ee(b,U,J,Z=Date.now(),ae=!0){dt();let Re=Ge(b,U,Z);if(!Re)return;let he=`${b.serverMessageId??b.id}:${J}`;he!==De&&(De=he,d(Re),ae&&et&&(Ue=!0))}function qe(b,U){(b||!x.localSendRef.current)&&x.settle(U),b&&v()}function ye(b,U=[],J=!1,Z,ae=Y,Re=G,Pe=Date.now(),he=!0){let _t=a.current;if(b.canceled){Ee(b,ae,Re,Pe,he),qe(J,Z);return}let fe=!0,at=b.status==="error";switch(dd(b,at)){case"drop":o.value=o.value.filter(He=>He!==b),fe=!1;break;case"complete-operator-routed":b.status="complete",J&&(T.play("messageReceived"),pr(h,_t,"assistant",Ve(b)));break;case"error":{if(b.status="error",b.errorText=_t.strings.errorGeneric,J){T.play("error");let He=new Error(at?"stream error chunk":"empty reply");h.emit("error",He),_t.onError?.(He)}break}case"complete":b.status="complete",J&&(T.play("messageReceived"),pr(h,_t,"assistant",Ve(b))),_(b,U);break}fe&&Ee(b,ae,Re,Pe,he),qe(J,Z)}function ot(b){if(E.signal.aborted||r.value!==C)return;if(c(b),p?.(b),b.type==="start"){St();let He=b.messageId===void 0?void 0:o.value.find(B=>B.serverMessageId===b.messageId||B.id===b.messageId);K=He!==void 0&&He.status!=="streaming";let Ht=te?.senderRole==="visitor"?te.messageId:void 0;if(te={messageId:b.messageId,senderRole:b.messageMetadata?.senderRole},G+=1,Te=Date.now(),_e=void 0,O=b.messageMetadata?.senderRole===void 0,z=!1,V=O?b.messageMetadata?.runId:void 0,O){let B=b.messageId!==void 0&&o.value.some(it=>it.serverMessageId===b.messageId||it.id===b.messageId),Q=o.value.at(-1),ee=b.messageId!==void 0&&(Q?.serverMessageId===b.messageId||Q?.id===b.messageId),me=x.localSendRef.current&&(!B||ee)&&Q?.role==="assistant"&&Q.status==="streaming"&&(ee||Q.serverMessageId===void 0&&Q.partsSig.value.length===0);z=x.captureStart(C,b,me,Ht)}}let U=O&&(b.type==="finish"||b.type==="error"||b.type==="abort"),J=U?V:void 0,Z=U&&(z||x.ownsLocalRun(J)),ae=G,Re=K;b.type==="finish"&&b.canContinue!==void 0&&(Y=b.canContinue);let Pe=Y;U&&(O=!1,z=!1,V=void 0);let he=L.applyResume(b),_t=te?.messageId,fe=_t===void 0?void 0:o.value.find(He=>He.serverMessageId===_t||He.id===_t);K&&te?.senderRole!=="visitor"&&(he!==null||fe?.status==="streaming")&&(K=!1,Re=!1);let at=!K&&(fe?.role==="assistant"||fe?.role==="operator");if(b.type==="text-delta"&&at&&kt(fe,Y,G,Te),b.type==="text-end"&&(dt(),at&&ht(fe,Y,G,Te)),b.type==="finish"&&b.canContinue===!1&&k(!1),!he){U&&(Z||!x.localSendRef.current)&&x.settle(J);return}if(he.role==="operator"){Re||(T.play("messageReceived"),pr(h,a.current,"operator",Ve(he))),Ee(he,Pe,ae,Te),K=!1,U&&(Z||!x.localSendRef.current)&&x.settle(J);return}he.role==="assistant"&&(ye(he,[],Z,J,Pe,ae,Te),K=!1)}async function ve(b){let U=G,J=await i.loadConversation(C,b?{ids:[b]}:void 0).catch(()=>null);if(E.signal.aborted||r.value!==C||!J)return!1;J.controlState&&c({type:"data-control-state",data:J.controlState});let Z=o.value.at(-1),ae=U===G&&(b===void 0||Z!==void 0&&(Z.serverMessageId===b||Z.id===b));if(J.messages.length===0)return!0;ae&&(Y=J.canContinue,k(Y));let Re=o.value,Pe=b===void 0?Re.at(-1):Re.find(B=>B.serverMessageId===b||B.id===b),{messages:he,changed:_t}=to(Re,bn(J.messages));if(!_t)return!0;o.value=he;let fe=b===void 0?he.at(-1):he.find(B=>B.serverMessageId===b||B.id===b),at=Pe!==void 0&&fe!==void 0&&(Pe.id===fe.id||Pe.serverMessageId!==void 0&&Pe.serverMessageId===fe.serverMessageId),He=fe!==void 0&&fe.status!=="streaming"&&(!at||Pe?.status==="streaming"),Ht=at&&Pe?.status==="streaming"?Date.now():fe?.createdAt;return ae&&He&&fe.role==="assistant"?ye(fe,fe.suggestions??[],x.localSendRef.current,void 0,J.canContinue,U,Ht,!1):ae&&He&&fe.role==="operator"?Ee(fe,J.canContinue,U,Ht,!1):ae&&fe?.role==="assistant"&&fe.status!=="streaming"&&_(fe,fe.suggestions??[]),!0}let vt=new Set;A=({messageId:b})=>{if(vt.has(b)||!o.value.some(J=>J.serverMessageId===b||J.id===b))return;vt.add(b);function U(){return vt.delete(b)}ve(b).then(U,U)};function Ke(b=!1){if(E.signal.aborted||r.value!==C){Ue=!1;return}if(et){Ue=!0;return}let U=b?g(C)??(S()?ve():void 0):ve();if(!U)return;f(C),et=U;function J(Z=!1){if(et===U){if(et=void 0,Ue){Ue=!1,Ke();return}Z&&m(C)}}U.then(J,()=>J(!1))}let $t=u.subscribe(b=>{b<=w.current||(w.current=b,gt&&Ke())});return j_({signal:E.signal,now:()=>performance.now(),sleep:b=>Un(b,E.signal),connect:b=>i.connectResumeStream({signal:E.signal,onChunk:ot,onConnected:b}),onInitialBoundaryReady:()=>{gt=!0,Ke(!0)},backfill:()=>Ke()}),()=>{E.abort(),dt(),$t(),L.detach()}},[t,n,r,r.value,s,i,c,p,_,d,u,f,m,v,x,P,k,o,h,T,g,S])}var Ay=32;function W_(e){let{transport:t,setStreaming:n}=e,r=F(void 0),o=F(void 0),a=F(!1),i=F(void 0),s=F(!1),c=F(new Map),p=F(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>Ay&&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]),x=$(g=>o.current!==g?!1:(f(),!0),[f]),P=$(g=>{let S=c.current.get(g);return S?(c.current.delete(g),S.runId===void 0):!1},[]),k=$((g,S,w,C)=>{let E=S.messageMetadata?.runId;if(S.messageMetadata?.senderRole!==void 0||typeof E!="string"||!E||p.current.has(E))return!1;if(r.current?.runId===E)return s.current;if(s.current)return r.current||!w?!1:(o.current=void 0,r.current={conversationId:g,runId:E},n(!0),a.current&&_(g,E),!0);let L=[...c.current.values()].filter(O=>O.runId===void 0).find(O=>O.messageId===C);return L?(L.runId=E,r.current={conversationId:g,runId:E},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:E},n(!0),a.current&&_(g,E),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 ue(()=>({localSendRef:s,begin:d,beginRouted:u,acceptAck:m,acceptRoutedAck:v,reject:x,rejectRouted:P,captureStart:k,ownsLocalRun:T,settle:f,stop:h}),[m,v,d,u,k,T,x,P,f,h])}var My=le.scope("send");function K_(e,t,n,r,o,a=!0){e.publishConversation({...wa(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 X_(e){return e.findLast(t=>!t.ephemeral&&t.role!=="system"&&(t.role==="user"||t.status!=="streaming"||Vt(t)))}function Po(e,t,n,r,o){let a=X_(t);a?.role!=="user"||!Q_(a,n)||K_(e,t,a,r,o)}function G_(e){return!(e instanceof ct)||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 J_(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 P=r.value??Ct();return r.value||(r.value=P,s.saveConversationId(P)),P},[r,s]),v=$(async({continueExisting:P,turn:k})=>{let T=m(),h=n.value.at(-1),g=k?[k]:ad(n.value,P),S=g[0];S?.role==="user"&&It.markSent(S.id);let w=g.map(Rs),C=s.loadUserPrefs(),E=Qa(o.tools).then(A=>t.sendTurn(ks({messages:w,conversationId:T,visitorId:c,userPrefs:C,clientTools:Js(A)}),{keepalive:P}));f.begin(E);try{let A=await E;if(r.value!==T||!f.acceptAck(E,A))return!1;if(p(A.conversationId),A.runId&&S?.role==="user"&&Po(t,n.value,S,A.conversationId,o.strings.newConversation),!A.runId){let L=await t.loadConversation(A.conversationId).catch(()=>null);if(r.value!==A.conversationId)return!0;if(L){L.controlState&&_(L.controlState),d(L.canContinue);let O=bn(L.messages),{messages:z,changed:V}=to(n.value,O);V&&(n.value=z);let K=O.findLast(Y=>!Y.ephemeral&&Y.role!=="system"),te=X_(n.value);te&&K&&Q_(te,K)&&K_(t,n.value,te,A.conversationId,o.strings.newConversation,L.canContinue);let G=h?n.value.find(Y=>Y.id===h.id&&Y.role==="assistant"&&Y.status!=="streaming"):void 0;G&&u(G,G.suggestions??[]),!P&&h?.role==="assistant"&&n.value.includes(h)&&h.serverMessageId===void 0&&!Vt(h)&&(n.value=n.value.filter(Y=>Y!==h))}else h?.role==="assistant"&&n.value.includes(h)&&(h.status="error",h.errorText=o.strings.errorGeneric,P?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(A){if(r.value!==T)return!1;if(!f.reject(E))return S?.role==="user"&&Po(t,n.value,S,T,o.strings.newConversation),!0;let L=Hn(A,o.strings),O=G_(A),z=k?.role==="assistant"?k:n.value.at(-1);if(P&&z?.role==="assistant"&&A instanceof ct&&A.status===409){let V=z.serverMessageId??z.id,K=await t.loadConversation(T,{ids:[V]}).catch(()=>null);if(r.value!==T)return!1;if(K){K.controlState&&_(K.controlState),d(K.canContinue);let te=bn(K.messages),G=te.find(Y=>(Y.serverMessageId??Y.id)===V);if(G&&cd(z,G)){let{messages:Y,changed:De}=to(n.value,te),_e=Y.find(Te=>(Te.serverMessageId??Te.id)===V);if(De&&_e&&_e!==z)return _e.awaitingContinuation=!1,_e.continuationStreaming=void 0,_e.retryAction=null,n.value=Y,_e.status!=="streaming"&&u(_e,_e.suggestions??[]),!0}}if(!n.value.includes(z)||z.status!=="streaming")return!1;z.continuationStreaming=!0}if(P&&z?.role==="assistant")z.status="error",z.errorText=L,z.retryAction=O?{kind:"continue-assistant",messageId:z.serverMessageId??z.id}:null,n.value=[...n.value];else if(h?.role==="assistant"&&n.value.includes(h)){h.status="error",h.errorText=L;let V=g[0];h.retryAction=O&&V?.role==="user"?{kind:"resend-user",messageId:V.id}:null,n.value=[...n.value]}else{let V=an();V.status="error",V.errorText=L;let K=g[0];V.retryAction=O&&K?.role==="user"?{kind:"resend-user",messageId:K.id}:null,n.value=[...n.value,V]}return i.play("error"),a.emit("error",A),o.onError?.(A),!1}},[t,n,o,a,i,s,c,p,_,d,u,m,f]),x=$(async P=>{let k=m();P.status="pending",P.errorText=void 0,P.retryAction=void 0,n.value.includes(P)&&(n.value=[...n.value]),It.markSent(P.id);let T=[Rs(P)],h=s.loadUserPrefs(),g=Qa(o.tools).then(S=>t.sendTurn(ks({messages:T,conversationId:k,visitorId:c,userPrefs:h,clientTools:Js(S)})));f.beginRouted(g,P.id);try{let S=await g;return r.value!==k?(f.rejectRouted(g),!1):f.acceptRoutedAck(g,S)?(p(S.conversationId),Po(t,n.value,P,S.conversationId,o.strings.newConversation),P.status==="pending"&&(P.status="complete",n.value.includes(P)&&(n.value=[...n.value])),!0):!1}catch(S){let w=f.rejectRouted(g);if(r.value!==k)return!1;if(!w)return Po(t,n.value,P,k,o.strings.newConversation),P.status==="pending"&&(P.status="complete",n.value.includes(P)&&(n.value=[...n.value])),!0;if(P.status!=="pending")return Po(t,n.value,P,k,o.strings.newConversation),!0;My.debug("operator-routed send failed",{error:S});let C=S instanceof Error?S:new Error(String(S));return P.status="error",P.errorText=Hn(S,o.strings),P.retryAction=G_(S)?{kind:"resend-user",messageId:P.id}:null,n.value.includes(P)&&(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:x}}var Ny=le.scope("unread");function Y_(e){let{transport:t,options:n,conversationIdSig:r,isConversationVisibleRef:o,activated:a,conversationReady:i}=e,s=Mt(!1),c=Mt(0),p=Mt(0),_=F([]),d=F(void 0),u=F(!1),f=$(()=>{let S=r.value,w=o.current()&&d.current===S?S:void 0,C=_.current.filter(E=>E.hasUnread&&E.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),E=sn(_.current,S),A=E.find(O=>O.conversationId===w),L=S.type==="snapshot"&&w!==void 0&&A?.hasUnread===!0&&d.current===w&&C!==void 0&&C.lastMessageAt!==A.lastMessageAt;L&&(d.current=void 0),_.current=E,f(),L&&(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]),x=$(S=>{r.value===S&&(d.current=void 0,f())},[r,f]),P=$(S=>{r.value===S&&(d.current=S,v())},[r,v]),k=$(S=>d.current===S,[]),T=$((S=!1)=>{!n.history.enabled||!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=>Ny.debug("refreshUnread failed (non-fatal)",{err:w})).finally(()=>{u.current=!1}))},[m,v,n.history.enabled,n.modules,t]),h=$(S=>{let w=S.conversationId,C=o.current()&&r.value===w&&d.current===w,E=_.current.find(L=>L.conversationId===w),A=C&&(E?.lastMessageAt!==S.lastMessageAt||E.hasUnread);t.publishConversation({...S,hasUnread:!C},!0),A&&t.markRead(w,S.lastMessageAt)},[r,o,t]);D(()=>t.subscribeConversationChanges(m),[m,t]);let g=F(!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:x,commitConversationTranscript:P,isConversationTranscriptCommitted:k,recordConversationReply:h}}var xo=le.scope("settings");function Z_(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=>xo.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 Oc(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 x=er(c,t.availableLocales,t.defaultLocale);D(()=>{r.setLocale(x)},[r,x]),D(()=>{a.dir=Yl(x)?"rtl":"ltr"},[a,x]),D(()=>{x!==c&&p(x)},[x,c]);let P=$(g=>{xo.info("localeChange",{locale:g}),p(g),v({locale:g}),i.emit("localeChange",g)},[v,i]),k=$(g=>{xo.info("themeChange",{mode:g}),d(g),a.dataset.theme=g,v({themeMode:g}),i.emit("themeChange",g)},[a,v,i]),T=$(g=>{xo.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;xo.info("soundToggle",{muted:g}),i.emit("soundToggle",{muted:g})},[o,i]);return{activeLocale:c,activeThemeMode:u,activeTextSize:f,effectiveLocale:x,setActiveLocale:p,setActiveThemeMode:d,setActiveTextSize:m,patchAndSync:v,handleLocaleChange:P,handleThemeChange:k,handleTextSizeChange:T,handleSoundToggle:h}}var be=le.scope("app"),ci=M.cssPrefix,Ly={home:"home",chats:"chat",help:"help",news:"news"};function ef(e,t){return od({...e,text:bt(t,e.text)})}function tf({options:e,hostElement:t,bus:n,recentHostEvents:r}){let o=e.aiAgentDeploymentId;if(!o)throw new Error("aiAgentDeploymentId is required");let[a]=q(()=>tr(e.widgetId,e.storage,e.aiAgentDeploymentId)),[i]=q(()=>a.getVisitorId()),s=a.loadUserPrefs(),c=Mt(a.loadConversationId()),p=F(c.value!==void 0),_=Mt(c.value??""),d=Mt([]),[u,f]=q(!1),m=F(void 0),[v,x]=q([]);function P(){let y=e.modules.list,I=new Set(y.map(j=>j.id)),X=a.loadActiveModule();return X&&I.has(X)?X: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=F(void 0);if(!h.current){let y=e.modules.list.map(X=>X.id),I=a.loadActiveModule()??y[0]??"";h.current=kd(I,I?[...y,I]:y,X=>a.saveActiveModule(X))}let g=h.current,S=Rt(()=>g.sig.value.activeTab).value,w=Rt(()=>c.value).value,[C,E]=q(!1),[A,L]=q(null),[O,z]=q(!1),V=e.mode==="standalone"||e.mode==="inline",K=F(oo(e,_r(),a.loadPanelOpen(),a.loadPanelSize())),[te,G]=q(K.current.panelOpen),[Y,De]=q(K.current.panelOpen),_e=F(void 0),Te=F(void 0),et=F(!1),Ue=F(void 0);D(()=>{te&&De(!0)},[te]);let gt=F(!1),[Ge,ht]=q(!1),{dismissed:xt,dismissCallout:dt}=$_({callout:e.launcher.callout,persistence:a}),St=e.launcher.callout?.persistent??!0,kt=$(()=>{be.info("calloutDismiss"),n.emit("calloutDismiss",void 0),dt()},[n,dt]),[Ee,qe]=q(K.current.panelSize),ye=F(!1),[ot,ve]=q("chat"),vt=F(()=>!1);vt.current=()=>te&&ot==="chat"&&!document.hidden&&T();let[Ke,$t]=q(!0),b=F(Ke);b.current=Ke;let[U,J]=q(!1),Z=F(U);Z.current=U;let ae=F(null),[Re,Pe]=q(!1),[he,_t]=q(null),[fe,at]=q([]),He=F(e.strings),Ht=F(e);Ht.current=e;let[B,Q]=q(void 0),[ee,me]=q(void 0),[it,zt]=q(()=>a.loadSidebarCollapsed()??!1),[Yt,Et]=q({}),[ce]=q(()=>new Ea({agentApiBaseUrl:e.agentApiBaseUrl,dataApiBaseUrl:e.dataApiBaseUrl,auth:lu({publicKey:e.publicKey,aiAgentDeploymentId:o,publicKeyHeader:"x-public-key"}),endpoints:e.endpoints,recentHostEvents:r})),[At]=q(()=>new ia(e.sound,e.haptics)),cn=W_({transport:ce,setStreaming:J}),{activeLocale:So,activeThemeMode:cl,activeTextSize:ul,effectiveLocale:Wn,setActiveLocale:of,setActiveThemeMode:af,setActiveTextSize:sf,patchAndSync:dl,handleLocaleChange:lf,handleThemeChange:cf,handleTextSizeChange:uf,handleSoundToggle:df}=Z_({options:e,persistence:a,transport:ce,feedback:At,hostElement:t,bus:n}),{controlModeSig:Gt,assignedOperatorInitialsSig:pf,operatorAvailableSig:_f,applyControlState:Cr,adoptControlStateChunk:ff,requestOperator:mf,cancelOperatorRequest:gf}=D_({transport:ce,conversationIdSig:c}),un=Mt(new Map),hf=$(y=>{if(y.type!=="data-memory-compaction-state")return;let I=c.value;if(!I)return;let X=nd(y.data);if(!X)return;let j=un.value.get(I);if(j&&(X.postFinishSequence<j.postFinishSequence||X.postFinishSequence===j.postFinishSequence&&(j.status==="ready"||j.status===X.status)))return;let oe=new Map(un.value);oe.set(I,X),un.value=oe},[c,un]),{hasUnreadSig:vf,unreadCountSig:pl,transcriptRecoverySig:bf,markVisibleConversationRead:_l,beginConversationTranscript:di,commitConversationTranscript:Gn,isConversationTranscriptCommitted:fl,recordConversationReply:yf}=Y_({transport:ce,options:e,conversationIdSig:c,isConversationVisibleRef:vt,activated:Y,conversationReady:C}),Pf=te&&e.modules.byId[S]?.layout==="home",xf=O_({transport:ce,options:e,persistence:a,enabled:C&&Pf});D(()=>{_l()},[S,te,ot,w,_l]),D(()=>{At.update(e.sound,e.haptics)},[At,e.sound,e.haptics]),D(()=>()=>At.destroy(),[At]),D(()=>{ye.current||!e.size.initialSize||(ye.current=!0,!a.loadPanelSize()&&qe(Os(e.mode,e.size,_r())))},[e.mode,e.size,a]),D(()=>{if(!C||gt.current)return;gt.current=!0;let y=oo(e,_r(),a.loadPanelOpen(),a.loadPanelSize());G(y.panelOpen),qe(y.panelSize)},[C,e,a]);let Kn=F(null);D(()=>{C&&g.reconcile(e.modules.list.map(y=>y.id),P())},[C,e.modules.list,g]);let ko=$(y=>{!y||y.length===0||(d.value=y.map(I=>ef(I,He.current)))},[d]),pi=F(null),wo=$(async y=>{try{let{formSubmissions:I}=await(y?ce.bootstrap(y):pi.current??ce.bootstrap()),X=new Map;return I.forEach((j,oe)=>X.set(j.formId,oe)),I.filter((j,oe)=>!j.skipped||X.get(j.formId)===oe).map((j,oe)=>({key:`wire:${j.formId}:${j.createdAt??oe}`,formId:j.formId,outcome:j.skipped?"skipped":"submitted",createdAt:Zu(j.createdAt),values:j.values}))}catch(I){return be.debug("bootstrap failed \u2014 no form markers (non-fatal)",{err:I}),[]}},[ce]),Tr=F(0),Zt=F(0),_i=$(y=>{if(y===c.value)return;let I=c.value;Zt.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),ce.primeIdentity(void 0,y),be.info("conversation rebound",{previous:I,current:y}),I&&n.emit("conversationRebound",{previous:I,current:y})},[n,c,a,ce]),Co=$((y,I)=>{let X=[...y.map(W=>W.createdAt),...I.map(W=>W.createdAt)].filter(W=>W!==void 0),j=(X.length?Math.min(...X):Date.now())-1;return[...(Ue.current?.messages??[]).map(W=>{let ie=ef(W,He.current);return ie.createdAt=j,ie}),...y]},[]),ml=$(async y=>{let I=Zt.current;function X(){return I!==Zt.current||c.value!==y}Te.current===y&&(Te.current=void 0),f(!0);try{let[j,oe]=await Promise.all([ce.loadConversation(y),wo()]);if(X())return!1;let W=bn(j.messages);x(oe);let ie=Co(As(W,d.value),oe);if(d.value=ie,Te.current=ie.some(we=>we.role==="user")?void 0:y,W.length>0||j.controlState!==void 0){$t(j.canContinue),j.controlState&&Cr(j.controlState);let we=W.findLast(pt=>pt.role==="assistant"&&!pt.ephemeral);at(we?.suggestions??[])}return!0}catch(j){return X()||(be.warn("loadThread failed; keeping conversation active",{err:j,conversationId:y}),n.emit("error",j),Ht.current.onError?.(j)),!1}finally{X()||f(!1)}},[ce,wo,d,c,Co,n]),Sf=$(y=>{if(_e.current===y)return _e.current=void 0,ml(y)},[ml]),kf=$(()=>{if(m.current)return Promise.resolve(void 0);let y=c.value,I=d.value.find(ie=>ie.serverMessageId!==void 0),X=I?.serverMessageId,j=I?new Date(I.createdAt).toISOString():void 0;if(!y||!X||!j)return Promise.resolve(void 0);let oe=Zt.current,W={};return m.current=W,(async()=>{try{let ie=await ce.loadConversation(y,{beforeId:X,beforeCreatedAt:j});if(m.current!==W||Zt.current!==oe||c.value!==y)return;if(ie.messages.length===0)return!1;let xe=ie.messages.map(Ts),we=d.value,pt=sd(we,xe);if(pt!==we){let en=Math.min(...xe.map(wt=>wt.createdAt??1/0),...v.map(wt=>wt.createdAt??1/0));if(Number.isFinite(en))for(let wt of we){if(!wt.ephemeral)break;(wt.createdAt??1/0)>=en&&(wt.createdAt=en-1)}d.value=pt}return!0}catch(ie){if(m.current!==W||Zt.current!==oe||c.value!==y)return;be.warn("load previous messages failed",{err:ie,conversationId:y,beforeId:X}),n.emit("error",ie),e.onError?.(ie);return}finally{m.current===W&&(m.current=void 0)}})()},[n,c,v,d,e,ce]),Rr=$(async({newConversation:y})=>{let I=++Tr.current;function X(){return I!==Tr.current}let j=c.value,oe=y||!j?Ct():j;oe!==j&&(Zt.current++,f(!1),Ft(()=>{c.value=oe,_.value=oe}),a.saveConversationId(oe)),ce.primeIdentity(i,oe);let W;try{W=await ce.handshake({visitorId:i,conversationId:oe,userPrefs:a.loadUserPrefs(),locale:So})}catch(we){if(X())return;n.emit("error",we),e.onError?.(we),y||E(!0);return}if(X())return;W.conversationId!==oe&&_i(W.conversationId),_t(W.agent),W.site&&yu(W.site)?Q(W.site):W.site&&be.warn("invalid site config, using fallback",{site:W.site}),W.blocks&&Pu(W.blocks)?me(W.blocks):W.blocks&&be.warn("invalid blocks config, using fallback",{blocks:W.blocks});let ie=Vi(W.userPrefs);if(Object.keys(ie).length>0&&!y&&(a.saveUserPrefs(ie),ie.locale&&of(ie.locale),ie.soundMuted!==void 0&&At.setMuted(ie.soundMuted),ie.themeMode&&af(ie.themeMode),ie.textSize&&sf(ie.textSize)),Ue.current=W.welcome,y||n.emit("handshake",W),W.welcome?.suggestions){let we=He.current;at(W.welcome.suggestions.map(pt=>({...pt,label:bt(we,pt.label),...pt.text===void 0?{}:{text:bt(we,pt.text)}})))}let xe=!y&&j&&W.conversationId===j;p.current=!!xe,xe?et.current||(_e.current=W.conversationId):(Te.current=W.conversationId,ko(W.welcome?.messages),Gn(W.conversationId)),y||E(!0)},[ce,i,a,e,n,c,_,At,ko,So,_i,Gn]),Ir=JSON.stringify(e.userContext??null),wf=JSON.stringify(e.pageContext??null),Cf=JSON.stringify(Yt);D(()=>{let y=Object.keys(Yt).length?{...Yt,...e.userContext}:e.userContext;ce.setContext(y,Oy(e.pageContext))},[ce,Ir,wf,Cf]),D(()=>ce.setUserToken(e.userToken),[ce,e.userToken]);let gl=$((y,I=[])=>at(y.suggestions??I),[]);D(()=>(ce.primeIdentity(i,c.value),Rr({newConversation:!1}),()=>{Tr.current++,Zt.current++}),[]),D(()=>{!Y||!C||et.current||(et.current=!0,pi.current=ce.bootstrap(),(async()=>{try{let y=await pi.current;L(Or((y??{forms:[]}).forms,Wn))}catch(y){be.debug("bootstrap failed \u2014 treating as no forms",{err:y})}finally{z(!0)}})(),_e.current===c.value&&f(!0))},[Y,C]);let Er=F(null);D(()=>{if(!Y||!C||(Er.current??(Er.current=Wn),Er.current===Wn))return;Er.current=Wn;let y=!1;return ce.bootstrap().then(I=>{y||L(Or((I??{forms:[]}).forms,Wn))}).catch(I=>be.debug("forms re-localize failed \u2014 keeping current copy",{err:I})),()=>{y=!0}},[Y,C,Wn,ce]);let hl=F(Ir);D(()=>{!C||hl.current===Ir||(hl.current=Ir,Rr({newConversation:!1}))},[Ir,C,Rr]),U_({hostElement:t,mode:e.mode,panelSize:Ee,isOpen:te,surfaceReady:C,setIsOpen:G});let{sendAiTurn:dn,sendRoutedTurn:Qn}=J_({transport:ce,messagesSig:d,conversationIdSig:c,options:e,bus:n,feedback:At,persistence:a,visitorId:i,adoptConversationId:_i,applyControlState:Cr,setCanSend:$t,settleSuggestions:gl,runCancellation:cn}),{toolInteraction:Tf,pageToolsRunning:fi,stopPageTools:vl}=L_({streaming:U,controlModeSig:Gt,messagesSig:d,sendAiTurn:dn,bus:n,humanInLoop:e.features.humanInLoop,tools:e.tools}),Rf=$((y,I)=>{let X=d.value.find(j=>j.serverMessageId===y);X&&(X.feedback=I),be.info("messageFeedback",{messageId:y,value:I}),n.emit("messageFeedback",{messageId:y,value:I}),ce.submitFeedback({messageId:y,value:I})},[n,d,ce]);function If(){return d.value.reduce((y,I)=>y+(I.role==="user"?1:0),0)}let Xn=e.forms.list.length>0?e.forms:A??e.forms,Fe=xd({forms:Xn,persistence:a,userContext:()=>e.userContext,messageCount:If,pageArea:()=>e.pageContext?.area?String(e.pageContext.area):void 0,conversationId:()=>c.value,onComplete:(y,I,X,j)=>{be.info("formSubmit",{formId:y.id,trigger:I,skipped:j}),n.emit("formSubmit",{formId:y.id,values:X,skipped:j}),x(W=>{let xe=W.find(we=>we.formId===y.id&&we.outcome==="skipped")?.createdAt??Date.now();return[...W.filter(we=>!(we.formId===y.id&&we.outcome==="skipped")),{key:`local:${y.id}:${xe}`,formId:y.id,outcome:j?"skipped":"submitted",createdAt:xe,...j?{}:{values:X}}]});let oe=c.value??Ct();c.value||(c.value=oe,a.saveConversationId(oe),ce.primeIdentity(void 0,oe)),!j&&y.mirrorToContext&&Et(W=>({...W,...X})),ce.submitForm({formId:y.id,conversationId:oe,trigger:I,values:X,skipped:j})}}),bl=Rt(()=>Fe.activeForm.value),To=bl.value?.form.blocking??!1,Ef=$(()=>Fe.fire("after-messages"),[Fe]),Af=$(()=>p.current||d.value.some(y=>!y.ephemeral&&y.role==="user"),[d]);V_({activated:Y,conversationReady:C,conversationIdSig:c,messagesSig:d,optionsRef:Ht,transport:ce,visitorId:i,adoptControlStateChunk:ff,adoptMemoryCompactionStateChunk:hf,settleSuggestions:gl,recordConversationReply:yf,transcriptRecoverySig:bf,beginConversationTranscript:di,commitConversationTranscript:Gn,onReplyLanded:Ef,runCancellation:cn,canContinueRef:b,setCanSend:$t,feedback:At,bus:n,loadInitialThread:Sf,shouldReconcileOnConnect:Af}),D(()=>{Fe.refresh()},[Xn,Fe]);let yl=e.pageContext?.area?String(e.pageContext.area):void 0,Mf=Rt(()=>d.value.length),Ro=F(null);D(()=>{!O||!Ro.current||(Fe.fire("manual",Ro.current),Ro.current=null)},[O,Fe]),D(()=>{C&&O&&Fe.fire("pre-chat")},[C,O,Fe]),D(()=>{O&&!Ke&&Fe.fire("conversation-closed")},[O,Ke,Fe]),D(()=>{C&&O&&yl&&Fe.fire("page-area")},[C,O,yl,Fe]);let mi=ue(()=>{let y=Xn.list.flatMap(I=>I.triggers).filter(I=>I.kind==="idle").map(I=>Number(I.param));return y.length?Math.min(...y)*1e3:0},[Xn]);D(()=>{if(!mi||!te)return;let y=setTimeout(()=>Fe.fire("idle"),mi);return()=>clearTimeout(y)},[mi,te,Fe,Mf.value]);let Jn=$(async(y,I,X)=>{if(ae.current)return!1;let j=c.value,oe=j?un.value.get(j):void 0,W=Gt.value!=="ai-agent";if(!W&&oe?.status==="compacting"||(be.info("send",{textLen:y.length,attachments:I.length,streaming:Z.current,routedToOperator:W}),Z.current&&!W))return!1;let ie=new AbortController,xe={conversationId:j,controller:ie};ae.current=xe,Pe(!0);try{At.unlock();let we=await Dy(ce,I,ie.signal,pn=>{ie.signal.aborted||(be.warn("upload failed",{err:pn}),n.emit("error",pn),e.onError?.(pn))});if(ie.signal.aborted||c.value!==j||!b.current||Fe.activeForm.value?.form.blocking)return!1;let pt=j?un.value.get(j):void 0,en=Gt.value!=="ai-agent";if(!en&&pt?.status==="compacting"||Z.current&&!en||!y&&we.length===0)return!1;n.emit("send",{text:y,attachmentCount:I.length}),fe.length>0&&at([]),At.play("messageSent");let wt=Cs(y,we,X);return pr(n,e,"user",y),en?(d.value=[...d.value,wt],X?await Qn(wt):(Qn(wt),!0)):(d.value=[...d.value,wt,an()],X?await dn({continueExisting:!1}):(dn({continueExisting:!1}),!0))}finally{ae.current===xe&&(ae.current=null,Pe(!1))}},[ce,n,e,fe.length,d,c,un,dn,Qn,Gt]),Pl=F(Jn);Pl.current=Jn;let xl=c.value,Sl=(xl?un.value.get(xl):void 0)?.status==="compacting",gi=Gt.value==="ai-agent",kl=Rt(()=>{let y=d.value.at(-1);return y?.role==="assistant"&&y.partsSig.value.some(I=>I.kind==="tool"&&I.stateSig.value==="approval-requested")}),wl=Rt(()=>d.value.some(y=>y.retryAction?.kind==="resend-user"||y.retryAction?.kind==="continue-assistant"));Tt(()=>{let y=c.value;return()=>{let I=ae.current;!I||I.conversationId!==y||(ae.current=null,Pe(!1),I.controller.abort())}},[c.value]),D(()=>{Ke&&!To||ae.current?.controller.abort()},[To,Ke]);let Nf=$(()=>{if(fi){be.info("stop page tools"),n.emit("stop",void 0),vl();return}if(!cn.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])},[cn,n,d,fi,vl]),Lf=$(y=>{if(U)return;let I=d.value,X=Ia(I,y);if(X)switch(be.info("retry",{kind:X.kind,messageId:X.messageId}),X.kind){case"continue-assistant":{if(Gt.value!=="ai-agent"||y.role!=="assistant"||(y.serverMessageId??y.id)!==X.messageId)return;y.status="streaming",y.errorText=void 0,y.retryAction=void 0,y.awaitingContinuation=!0,d.value=[...I],dn({continueExisting:!0,turn:y});return}case"resend-user":{let j=I.find(ie=>ie.role==="user"&&ie.id===X.messageId);if(!j)return;let oe=ie=>{ie&&Kn.current?.acceptQueuedMessage(X.messageId)};if(j.status="complete",j.errorText=void 0,j.retryAction=void 0,Gt.value!=="ai-agent"){d.value=y.role==="assistant"?I.filter(ie=>ie!==y):[...I],Qn(j).then(oe);return}let W=an();d.value=y.role==="assistant"?I.map(ie=>ie===y?W:ie):[...I,W],dn({continueExisting:!1,turn:j}).then(oe);return}case"repeat-user":{let j=I.find(xe=>xe.role==="user"&&xe.id===X.messageId);if(!j)return;let oe=Cs(Ve(j),j.attachments?.map(xe=>({...xe}))??[]),W=new Set(oe.attachments?.flatMap(xe=>xe.url?[xe.url]:[])??[]),ie=j.partsSig.value.flatMap(xe=>xe.kind==="file"&&!W.has(xe.url)?[{...xe}]:[]);if(ie.length>0&&(oe.partsSig.value=[...oe.partsSig.value,...ie]),Gt.value!=="ai-agent"){d.value=[...I,oe],Qn(oe);return}d.value=[...I,oe,an()],dn({continueExisting:!1,turn:oe});return}default:return X}},[U,d,Gt,dn,Qn]),Ar=$(()=>{if(Pd(e.mode,Ee)==="exit-fullscreen"){be.info("close \u2192 exit-fullscreen",{mode:e.mode}),qe("normal"),n.emit("fullscreen",!1);return}be.info("close \u2192 panel closed",{mode:e.mode}),Fe.fire("panel-close"),G(!1),a.savePanelOpen(!1),n.emit("close",void 0),e.onClose?.()},[n,e,a,Ee,Fe]),wn=$(()=>{be.info("open",{mode:e.mode}),At.unlock(),ht(!0),G(!0),a.savePanelOpen(!0),!xt&&!St&&kt(),setTimeout(()=>ht(!1),$y),n.emit("open",void 0),e.onOpen?.()},[n,e,At,a,xt,St,kt]),hi=$(()=>{let y=d.value.some(I=>I.role==="user");if(Te.current===c.value&&!y&&Ke&&c.value){be.info("clear \u2192 reusing empty conversation",{conversationId:c.value}),d.value.length===0&&ko(Ue.current?.messages);return}return be.info("clear \u2192 new conversation",{wasStreaming:U}),n.emit("clear",void 0),cn.settle(),p.current=!1,_e.current=void 0,Te.current=void 0,Ft(()=>{d.value=[],c.value=void 0,Cr({controlMode:"ai-agent",controlRevision:0})}),a.clearConversation(),$t(!0),x([]),at([]),Rr({newConversation:!0})},[U,d,c,a,Rr,n,Ke,ko,cn,Cr]),Io=$(()=>{let y=hi();ve("chat");let I=e.modules.list.find(X=>X.layout==="chat")?.id;return I&&g.switchTab(I),y},[hi,g,e]),Of=$(async y=>{await Io(),await Pl.current(y,[])||Kn.current?.fill(y)},[Io]),vi=$(()=>{let y=Ee==="expanded"?"normal":"expanded";be.info("expand",{from:Ee,expanded:y==="expanded"}),qe(y),a.savePanelSize(y),n.emit("expand",y==="expanded")},[n,Ee,a]),bi=$(()=>{let y=Ee==="fullscreen"?"normal":"fullscreen";be.info("fullscreen",{from:Ee,fullscreen:y==="fullscreen"}),qe(y),a.savePanelSize(y),n.emit("fullscreen",y==="fullscreen")},[n,Ee,a]),$f=$(()=>{ve(y=>{let I=y==="history"?"chat":"history";return be.info("toggleHistory",{view:I}),n.emit("toggleHistory",{view:I}),I})},[n]),Df=$(()=>{zt(y=>{let I=!y;return be.info("sidebarToggle",{collapsed:I}),a.saveSidebarCollapsed(I),n.emit("sidebarToggle",{collapsed:I}),I})},[a,n]),Ff=$(y=>{be.info("resize",y),dl({widgetSize:y}),n.emit("resize",y)},[dl,n]),Bf=$(async y=>{let I=y.conversationId;if(I===c.value&&fl(I)){be.info("selectConversation",{conversationId:I,cached:!0}),n.emit("selectConversation",{conversationId:I}),ce.publishConversation(y),ve("chat");let W=k();W&&g.switchTab(W),Gn(I);return}let j=++Tr.current;Zt.current++,f(!1);function oe(){return j!==Tr.current}be.info("selectConversation",{conversationId:I,wasStreaming:U}),n.emit("selectConversation",{conversationId:I}),ce.publishConversation(y);try{let[W,ie]=await Promise.all([ce.loadConversation(I),wo(I)]);if(oe())return;cn.settle(),p.current=!0,_e.current=void 0;let xe=bn(W.messages),we=W.conversationId!==c.value,pt=we?xe:As(xe,d.value);Te.current=pt.some(pn=>pn.role==="user")?void 0:W.conversationId,Ft(()=>{d.value=Co(pt,ie),we&&(_.value=W.conversationId),c.value=W.conversationId}),x(ie),a.saveConversationId(W.conversationId),ce.primeIdentity(i,W.conversationId),$t(W.canContinue),W.controlState&&Cr(W.controlState);let en=pt.findLast(pn=>pn.role==="assistant"&&!pn.ephemeral);at(en?.suggestions??[]),we?di(W.conversationId):Gn(W.conversationId),ve("chat");let wt=k();wt&&g.switchTab(wt)}catch(W){if(oe())return;n.emit("error",W),e.onError?.(W)}},[ce,d,c,_,n,e,a,wo,Co,U,i,cn,di,Gn,fl,g]),Cl=$(y=>{if(typeof y!="string")return;te||wn(),ve("chat");let I=k();I&&g.switchTab(I),O?Fe.fire("manual",y):Ro.current=y},[te,wn,e.modules,g,O,Fe]),Eo=F(void 0),Ao=$(y=>{let I=e.modules.list.find(j=>j.layout===Ly[y.to]);if(!I){be.warn("open: the widget has no such tab",{to:y.to});return}let X=y.id&&(I.layout==="help"||I.layout==="news")?{kind:"content",id:y.id,title:""}:void 0;g.open(I.id,X)},[e.modules,g]),Tl=$(y=>{if(te||wn(),y!==void 0){if(!cu(y)){be.warn("open: unknown target",{detail:y});return}C?Ao(y):Eo.current=y}},[te,wn,C,Ao]);D(()=>{!C||!Eo.current||(Ao(Eo.current),Eo.current=void 0)},[C,Ao]);let Rl=C&&!u&&!To&&(!gi||!kl.value&&!wl.value),[Cn,yi]=q(),Il=$(y=>{let I=uu(y);if(!I){be.warn("ask: expected { text, send? } with non-empty text",{detail:y});return}te||wn(),yi(I)},[te,wn]),Pi=te&&O&&Ke&&C&&!u&&!To,El=Pi&&Rl&&!Re&&!(gi&&(U||Sl));D(()=>{if(Cn===void 0||!(Cn.send?El:Pi))return;let y=k();if(!y){be.warn("ask: the widget has no chat"),yi(void 0);return}if(ot!=="chat"||!T()){ve("chat"),g.switchTab(y);return}if(yi(void 0),!Cn.send){Kn.current?.fill(Cn.text);return}Jn(Cn.text,[]).then(I=>{I||Kn.current?.fill(Cn.text)})},[Cn,Pi,El,ot,S,e.modules,g,Jn]),D(()=>{if(e.widgetId!=="default")return;let y=`data-${M.cssPrefix}-`,I=["ask","open","close","form"].map(j=>y+j);function X(j){let oe=j.composedPath().find(we=>we instanceof Element&&I.some(pt=>we.hasAttribute(pt)));if(!(oe instanceof Element))return;j.preventDefault();let W=oe.getAttribute(`${y}ask`),ie=oe.getAttribute(`${y}open`),xe=oe.getAttribute(`${y}form`);W!==null?Lt(t,"ask",zr(W||(oe.textContent??""),{send:oe.hasAttribute(`${y}send`)})):ie!==null?Lt(t,"open",ta(ie)):xe!==null?Lt(t,"openForm",xe):Lt(t,"close")}return document.addEventListener("click",X),()=>document.removeEventListener("click",X)},[e.widgetId,t]),D(()=>{if(e.widgetId!=="default")return;let y=_u(location.href);y&&(history.replaceState(history.state,"",y.url),y.ask?Lt(t,"ask",zr(y.ask)):Lt(t,"open",y.target))},[e.widgetId,t]);let Al=F(jr),Ml=e.mode==="page"||e.mode==="inline"||e.mode==="standalone";D(()=>jt(()=>{let y=c.value,I={open:Ml||te,ready:C,unread:pl.value,...y?{conversationId:y}:{}},X=Al.current;I.open===X.open&&I.ready===X.ready&&I.unread===X.unread&&I.conversationId===X.conversationId||(Al.current=I,n.emit("state",I),I.unread!==X.unread&&n.emit("unread",I.unread))}),[n,Ml,te,C,pl,c]);let Tn=F({handleOpenCommand:Tl,handleClose:Ar,handleExpand:vi,handleFullscreen:bi,openForm:Cl,handleAskCommand:Il});Tn.current={handleOpenCommand:Tl,handleClose:Ar,handleExpand:vi,handleFullscreen:bi,openForm:Cl,handleAskCommand:Il},Tt(()=>pu(t,{open:y=>Tn.current.handleOpenCommand(y),close:()=>Tn.current.handleClose(),expand:()=>Tn.current.handleExpand(),fullscreen:()=>Tn.current.handleFullscreen(),openForm:y=>Tn.current.openForm(y),ask:y=>Tn.current.handleAskCommand(y)}),[t]);let ft=ue(()=>qi(e,So,cl,ul),[e,So,cl,ul]);He.current=ft.strings;let Uf=ue(()=>v.map(y=>{let I=Xn.list.find(X=>X.id===y.formId);return{...y,title:I?.title,form:I}}),[v,Xn]);function xi(y){Bf(y)}let Nl={options:ft,transport:ce,feedback:At,bus:n,persistence:a,conversationId:c.value??"",composerKey:_.value,composerApiRef:Kn,view:ot,canSend:Ke,isStreaming:U,pageToolRunning:fi,isMemoryCompacting:Sl,canReleaseQueuedMessages:Rl,queueManualMessages:gi&&(kl.value||wl.value),sendPreparing:Re,composerActive:ft.mode==="page"||ft.mode==="inline"||ft.mode==="standalone"||te,controlMode:Gt.value,assignedOperatorInitials:pf.value,operatorAvailable:_f.value,operatorRequestEnabled:e.features.operatorRequest,onRequestOperator:mf,onCancelOperatorRequest:gf,loadingMessages:u,onLoadPreviousMessages:kf,messagesSig:d,agent:he,suggestions:fe,initialWidgetSize:s.widgetSize??null,onClose:Ar,onClear:hi,onExpand:vi,onFullscreen:bi,onSoundToggle:df,onToggleHistory:$f,onSelectHistoryConversation:xi,onNewConversation:Io,onLocaleChange:lf,onThemeChange:cf,onTextSizeChange:uf,onWidgetSizeChange:Ff,onSend:Jn,onStop:Nf,onSuggestion:y=>{if(ae.current)return;let I=y.text??y.label;be.info("suggestion",{text:I,autoSend:e.autoSendSuggestions}),n.emit("suggestion",{text:I}),e.autoSendSuggestions?Jn(I,[]):Kn.current?.fill(I)},activeForm:bl.value?.form??null,formMarkers:Uf,onFormSubmit:Fe.complete,onFormSkip:Fe.skip,onFormFill:y=>Fe.fire("manual",y),tool:Tf,onRetry:Lf,onMessageFeedback:Rf};if(!C)return null;let Mr=ft.modules.list;function Si(y){let I=dr("close",ft.mode,y);return Mr.length===0?l(I_,{strings:ft.strings,onClose:I?Ar:void 0}):Mr.length===1&&Mr[0]?.layout==="chat"?l(T_,{...Nl,panelSize:y}):l(R_,{panelProps:{...Nl,panelSize:y,onClose:I?Ar:void 0},enabledModules:Mr,nav:g,bus:n,hasUnread:vf.value,latestNews:xf,onSelectConversation:xi,onStartNewConversation:Of,onSetPanelSize:qe})}if(e.mode==="page"){let y=e.history.enabled&&Mr.some(I=>I.layout==="chat");return l("div",{class:`${ci}-anchor`,children:l(M_,{site:B,blocks:ee,transport:ce,strings:ft.strings,locale:ft.locale,persistence:a,showConversations:y,onSelectConversation:xi,onNewConversation:Io,sidebarCollapsed:it,onToggleSidebarCollapsed:Df,children:Si("fullscreen")})})}if(V){let y=e.mode==="standalone"?"fullscreen":Ee;return l("div",{class:`${ci}-anchor`,children:Si(y)})}let Ll=e.mode==="drawer",Ol=!(e.mode==="modal")&&!e.launcher.hidden&&(!te||Ge),$l=Ol&&!Ge&&!xt&&!Ll?ft.launcher.callout:null;return l("div",{class:`${ci}-anchor`,"data-launcher-size":ft.launcher.size,children:[te||Y?l("div",{class:`${ci}-surface`,hidden:!te,children:Si(Ee)}):null,Ol?l(ap,{onToggle:wn,launcher:ft.launcher,strings:ft.strings,leaving:Ge,edgeTab:Ll}):null,$l?l(ip,{callout:$l,launcherPosition:ft.position,strings:ft.strings,closeLabel:ft.strings.close,onDismiss:kt}):null]})}function Oy(e){let t=e?.url??(typeof location<"u"?location.href:void 0);if(!(!e&&!t))return{...e,...t?{url:t}:{}}}var $y=120;async function Dy(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 Fy=le.scope("error-boundary"),ui=class extends Dt{constructor(){super(...arguments);re(this,"state",{crashed:!1})}componentDidCatch(n,r){Fy.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 nf(e){let{bus:t,host:n,appRoot:r,persistence:o,reportError:a}=e,i=e.initialRaw,s,c=Zn(i),p=!0,_=0,d=kc(t);function u(){c=Zn(s?Hi(i,s):i)}function f(){Fc(n,Go(c.mode));let P=o.loadUserPrefs().themeMode;Uc(n,P?{...c,themeMode:P}:c),p&&(Ko(n,By(c)),p=!1)}function m(){f(),gn(mn(ui,{onError:a},mn(tf,{key:_,bus:t,hostElement:n,options:c,recentHostEvents:d})),r)}t.on("handshake",P=>{P.config&&(P.config.storageVersion&&o.rememberStorageVersion(P.config.storageVersion),s=P.config,u(),m())});let v=Tc(t,{getOptions:()=>c,getVisitorId:()=>o.getVisitorId(),getConversationId:()=>o.loadConversationId()});function x(P={}){o.reset(),i={...i,userContext:void 0,userToken:void 0,...P},d.length=0,_+=1,p=!0,u(),m()}return{getOptions:()=>c,getUserOptions:()=>i,render:m,setUserOptions:P=>{i=P,u(),m()},patchUserOptions:P=>{let k="userToken"in P&&P.userToken!==i.userToken;if(k&&i.userToken){x(P);return}k&&(_+=1),i={...i,...P},u(),m()},reset:()=>x(),destroy:()=>v()}}function By(e){if(e.mode==="standalone")return"standalone";if(e.mode==="inline")return"inline";let t=tr(e.widgetId,e.storage,e.aiAgentDeploymentId),{panelOpen:n,panelSize:r}=oo(e,_r(),t.loadPanelOpen(),t.loadPanelSize());return Ma(e.mode,r,n)}var ll=class extends HTMLElement{constructor(){super(...arguments);re(this,"bus",new ra);re(this,"widgetState",jr);re(this,"userToken");re(this,"pageTools",[]);re(this,"markReady",()=>{});re(this,"ready",new Promise(n=>{this.markReady=n}));re(this,"mountResult",null);re(this,"runtime",null)}static get observedAttributes(){return zi}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,gn(null,this.mountResult.appRoot),this.bus.clear(),this.widgetState=jr)}attributeChangedCallback(){this.isConnected&&this.boot()}open(n){Lt(this,"open",n)}close(){Lt(this,"close")}expand(){Lt(this,"expand")}openForm(n){Lt(this,"openForm",n)}ask(n,r){Lt(this,"ask",zr(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=Sc(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){n_(n,r)}on(n,r){return this.bus.on(n,r)}boot(){let n={...ji(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=Zn(n);this.mountResult??(this.mountResult=Bc({existingHost:this,position:Go(r.mode)}));let o=tr(r.widgetId,r.storage,r.aiAgentDeploymentId);this.bus.on("state",a=>{this.widgetState=a,a.ready&&this.markReady()}),this.runtime=nf({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()}},rf=!1;function Uy(){if(rf||typeof customElements>"u")return;let e=M.tagName;customElements.get(e)||customElements.define(e,ll),rf=!0}typeof customElements<"u"&&Uy();export{Uy as registerWebComponent};
64
+ `).trim(),V=!g&&t!=="error"&&!y.value&&B.length>0,X=a?T_(v,{showReasoning:o,showSources:i}):v.map((te,Pe)=>({kind:"part",part:te,index:Pe})),pe=R_(v),J=e.canceled===!0||t==="error",le=e.canceled===!0&&!g&&h.value&&S.value,ke=X.at(-1),be=ke?.kind==="steps"?ke.indices.at(-1):ke?.index;function Me(te,Pe){return l(vy,{part:te,generativeUi:e.role==="assistant",live:b,current:b&&Pe===be,reasoningMs:e.stepTimings?.[pe[Pe]??-1]?.reasoningMs,strings:n,showReasoning:o,showToolCalls:a,showSources:i,interactive:s&&t==="complete"&&(te.kind!=="tool"||Aa(e,Pe)),superseded:c,continuationStreaming:e.continuationStreaming===!0,stopped:J,tool:p},`${Sy(te)}#${Pe}`)}let Fe=j||V;return l("div",{class:`${Le}-bubble-row`,"data-role":e.role,"data-testid":_t(M.messageBubble,e.serverMessageId??e.id),children:l("div",{class:`${Le}-bubble-col`,children:[l("div",{class:`${Le}-bubble`,children:[e.role==="operator"&&e.operatorInitials?l("span",{class:`${Le}-bubble-author`,children:e.operatorInitials}):null,l("div",{class:`${Le}-bubble-body`,children:[E?l(wy,{label:n.loading}):X.flatMap((te,Pe)=>te.kind==="part"?[Me(te.part,te.index)]:te.parts.some(Oe=>Oe.kind==="tool")?[l(A_,{parts:te.parts,steps:te.indices.map(Oe=>pe[Oe]??-1),stepTimings:e.stepTimings,timed:!J,strings:n,live:b,running:b&&Pe===X.length-1,stopped:J&&Pe===X.length-1,runStartedAt:e.runStartedAt},`steps#${te.indices[0]}`)]:te.parts.map((Oe,lt)=>Me(Oe,te.indices[lt]??lt))),le?l("div",{class:`${Le}-steps-row`,"data-status":"stopped","data-testid":M.replyStopped,children:[l("span",{class:`${Le}-steps-row-icon`,"aria-hidden":"true",children:l(cn,{})}),l("div",{class:`${Le}-steps-row-main`,children:l("span",{class:`${Le}-steps-stopped-label`,children:n.statusStopped})})]}):null,R&&!f&&l(ky,{}),t==="error"||y.value?l(E_,{text:xy(e,t,n),retryLabel:n.errorRetry,onRetry:_?()=>_(e):void 0}):null,f&&b?l(E_,{text:n.errorReconnecting}):null]})]}),A||Fe?l("div",{class:`${Le}-bubble-meta`,children:[A?l("time",{class:`${Le}-bubble-time`,dateTime:A.iso,title:A.full,children:A.short}):null,Fe?l("div",{class:`${Le}-bubble-actions`,children:[j&&e.serverMessageId?l(Zp,{messageId:e.serverMessageId,initial:e.feedback??null,strings:n,onFeedback:u}):null,V?l(gy,{text:B,strings:n}):null]}):null]}):null]})})}function gy({text:e,strings:t}){let[n,r]=U(!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:`${Le}-msg-action`,"data-active":n?"true":void 0,"aria-label":a,title:a,onClick:o,"data-testid":M.messageCopy,children:n?l(jn,{}):l(ip,{})})}function hy(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 vy({part:e,generativeUi:t,live:n,current:r,reasoningMs:o,strings:a,showReasoning:i,showToolCalls:s,showSources:c,interactive:p,superseded:_,continuationStreaming:d,stopped:u,tool:f}){switch(e.kind){case"step-start":return null;case"text":return l(co,{textSig:e.textSig,doneSig:e.doneSig,generativeUi:t,strings:a});case"reasoning":return i?l(ll,{part:e,current:r,reasoningMs:o,strings:a,standalone:!0}):null;case"tool":return l(Py,{part:e,strings:a,showToolCalls:s,interactive:p,superseded:_,continuationStreaming:d,live:n,stopped:u,tool:f});case"file":return l(by,{part:e,strings:a});case"source":return c?l(b_,{part:e,strings:a}):null}}function by({part:e,strings:t}){let n=e.filename??t.file;if(e.mediaType.startsWith("image/"))return l("a",{class:`${Le}-file-image`,href:e.url,target:"_blank",rel:"noreferrer noopener",title:n,"data-testid":M.messageFile,children:l("img",{src:e.url,alt:n,loading:"lazy"})});let r=(n.includes(".")?n.split(".").pop():e.mediaType.split("/").pop())?.toUpperCase(),o=e.fileSize===void 0?void 0:yy(e.fileSize);return l("a",{class:`${Le}-file-chip`,href:e.url,target:"_blank",rel:"noreferrer noopener",title:n,"data-testid":M.messageFile,children:[l("span",{class:`${Le}-file-chip-icon`,"aria-hidden":"true",children:l(Da,{})}),l("span",{class:`${Le}-file-chip-text`,children:[l("span",{class:`${Le}-file-chip-name`,children:n}),l("span",{class:`${Le}-file-chip-meta`,children:[r,o].filter(Boolean).join(" \xB7 ")})]})]})}function yy(e){let t=Math.min(Math.floor(Math.log10(Math.max(e,1))/3),2);return new Intl.NumberFormat(void 0,{style:"unit",unit:["byte","kilobyte","megabyte"][t],unitDisplay:"narrow",maximumFractionDigits:1}).format(e/1e3**t)}function Py({part:e,strings:t,showToolCalls:n,interactive:r,superseded:o,continuationStreaming:a,live:i,stopped:s,tool:c}){let p=se(()=>he(()=>e.approvalSig.value!==void 0),[e]),_=se(()=>he(()=>!ai(e)),[e]);return!n&&!_.value?null:c?.humanInLoop&&p.value?e.toolMetadata?.card==="questions"?l(k_,{part:e,strings:t,active:r,superseded:o,continuationStreaming:a,onDecision:c.onDecision,onEdit:c.onEdit}):l(y_,{part:e,strings:t,active:r,superseded:o,continuationStreaming:a,stopped:s,onDecision:c.onDecision,onEdit:c.onEdit}):n?l(C_,{part:e,strings:t,live:i,superseded:o,stopped:s}):null}function xy(e,t,n){return e.errorText?e.errorText:t==="error"&&e.role==="assistant"?n.errorServer:n.errorGeneric}function E_({text:e,retryLabel:t,onRetry:n}){return l("div",{class:`${Le}-error`,role:"alert",children:[l("span",{class:`${Le}-error-icon`,"aria-hidden":"true",children:l(dp,{})}),l("span",{class:`${Le}-error-text`,children:e}),n&&t?l("button",{type:"button",class:`${Le}-error-retry`,onClick:n,"data-testid":M.messageRetry,children:t}):null]})}function Sy(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 ky(){return l("span",{class:`${Le}-typing`,"data-testid":M.typingDots,"aria-hidden":"true",children:[l("span",{}),l("span",{}),l("span",{})]})}function wy({label:e}){return l("span",{class:`${Le}-loading`,role:"status",children:[l("span",{class:`${Le}-loading-spinner`,"aria-hidden":"true"}),l("span",{class:`${Le}-loading-label`,children:e})]})}var un=N.cssPrefix,cl=120,Cy=350;function N_({messagesSig:e,reconnectingSig:t,strings:n,responseMode:r,showReasoning:o,showToolCalls:a,showSources:i,enableMessageFeedback:s,onFeedback:c,loading:p,onLoadPreviousMessages:_,idle:d,controlMode:u="ai-agent",tool:f,onRetry:m,form:v,formMarkers:y,onFillForm:x}){let S=D(null),w=It(()=>e.value),[h,g]=U(!1),[b,k]=U(!1),E=D(!1),R=D(!1),[A,L]=U(),j=D(!1),B=D(!1),V=D(!1),X=D(0);function pe(){return V.current||performance.now()-X.current<Cy}let J=D(0);function le(C){let H=C.scrollHeight-C.clientHeight>1;C.dataset.fadeTop=H&&C.scrollTop>1?"true":"false",C.dataset.fadeBottom=H&&C.scrollHeight-C.scrollTop-C.clientHeight>1?"true":"false"}function ke(C){return g(C.scrollHeight-C.scrollTop-C.clientHeight>cl*2)}function be(C){J.current=performance.now(),C.scrollTop=C.scrollHeight,le(C)}function Me(C,H){be(C);let oe=H,ne=0;function _e(){B.current||pe()||(be(C),--oe>0&&(ne=requestAnimationFrame(_e)))}return H>0&&(ne=requestAnimationFrame(_e)),()=>cancelAnimationFrame(ne)}function Fe(C,H){let oe,ne,_e,Re=-1;function Ie(){oe.disconnect(),ne.disconnect(),clearTimeout(_e)}function $e(){if(B.current||pe()||Re>=0&&C.scrollTop<Re-4)return Ie();be(C),Re=C.scrollTop}return oe=new ResizeObserver($e),ne=new MutationObserver($e),$e(),oe.observe(C),ne.observe(C,{childList:!0,subtree:!0,characterData:!0}),_e=setTimeout(Ie,H),Ie}let te=w.value[0]?.id;Tt(()=>{let C=S.current;if(C&&w.value.length!==0&&!R.current&&(j.current=!0,!!w.value.some(H=>H.role==="user")))return Fe(C,300)},[te]);let Pe=D(0);$(()=>{let C=S.current,H=w.value,oe=Pe.current;if(Pe.current=H.length,!C||!j.current||R.current)return;if(H.slice(oe).some(_e=>_e.role==="user"))return B.current=!1,Me(C,3);if(!H.some(_e=>_e.role==="user")||B.current||pe())return;C.scrollHeight-C.scrollTop-C.clientHeight<cl&&be(C)},[w.value.length]);let Oe=D(null);$(()=>{let C=S.current,H=w.value.at(-1),oe=Oe.current;if(Oe.current=H?{id:H.id,streaming:H.status==="streaming"}:null,!!C&&j.current&&!(!H||H.id!==oe?.id||oe.streaming||H.status!=="streaming"))return B.current=!1,Me(C,3)},[w.value]),$(()=>{let C=S.current;if(!C)return;let H=w.value.at(-1);if(!H||H.status!=="streaming"&&!w.value.some(_e=>_e.role==="user"))return;let oe=()=>{if(B.current||pe())return;C.scrollHeight-C.scrollTop-C.clientHeight<cl*2&&be(C)};if(H.status!=="streaming")return Fe(C,300);oe();let ne=new MutationObserver(oe);return ne.observe(C,{childList:!0,subtree:!0,characterData:!0}),()=>ne.disconnect()},[w.value]);let lt=v?.form.id,Ft=!!v&&(y??[]).some(C=>C.formId===v.form.id);Tt(()=>{let C=S.current;!C||!lt||B.current||w.value.some(H=>H.role==="user")&&(Ft?C.querySelector(`[data-testid="${M.formGate}"]`)?.scrollIntoView({block:"nearest"}):be(C))},[lt,Ft]),$(()=>{let C=S.current;if(!C)return;let H=()=>{ke(C),le(C),performance.now()-J.current>150&&(B.current=C.scrollHeight-C.scrollTop-C.clientHeight>8)};function oe(){B.current=!0}function ne(Be){Be.deltaY<0&&oe()}let _e=0;function Re(Be){_e=Be.touches[0]?.clientY??0,V.current=!0}function Ie(Be){(Be.touches[0]?.clientY??0)>_e+4&&oe()}function $e(){V.current=!1,X.current=performance.now()}function ye(){V.current=!0}return C.addEventListener("scroll",H,{passive:!0}),C.addEventListener("wheel",ne,{passive:!0}),C.addEventListener("touchstart",Re,{passive:!0}),C.addEventListener("touchmove",Ie,{passive:!0}),C.addEventListener("touchend",$e,{passive:!0}),C.addEventListener("touchcancel",$e,{passive:!0}),C.addEventListener("pointerdown",ye,{passive:!0}),window.addEventListener("pointerup",$e,{passive:!0}),window.addEventListener("pointercancel",$e,{passive:!0}),ke(C),()=>{C.removeEventListener("scroll",H),C.removeEventListener("wheel",ne),C.removeEventListener("touchstart",Re),C.removeEventListener("touchmove",Ie),C.removeEventListener("touchend",$e),C.removeEventListener("touchcancel",$e),C.removeEventListener("pointerdown",ye),window.removeEventListener("pointerup",$e),window.removeEventListener("pointercancel",$e)}},[]);function ot(){let C=S.current;C&&(B.current=!1,be(C))}let gt=w.value.filter(C=>!C.ephemeral),Mt=gt[0],ht=Mt?.serverMessageId??Mt?.id,Te=!!(_&&gt.length>=Fs&&ht!==A);async function ct(){if(!_||E.current)return;let C=S.current,H=C?.scrollHeight??0,oe=C?.scrollTop??0;E.current=!0,R.current=!0,k(!0);try{let ne=await _();ne===!1&&ht&&L(ht),ne&&C&&(await new Promise(_e=>requestAnimationFrame(()=>requestAnimationFrame(()=>_e()))),C.scrollTop=oe+C.scrollHeight-H,le(C),ke(C))}finally{R.current=!1,E.current=!1,k(!1)}}let Se=[],He="",ze=w.value.at(-1)?.id,Nt=t?.value===!0,Ve=[...y??[]].toSorted((C,H)=>(C.createdAt??1/0)-(H.createdAt??1/0));function yt(C){return v&&C.formId===v.form.id?l(Js,{form:v.form,strings:n,onSubmit:v.onSubmit,onSkip:v.onSkip},`gate:${C.formId}`):l(Kp,{marker:C,strings:n,onFill:!v&&x?()=>x(C.formId):void 0},C.key)}function O(C){for(let H=Ve[0];H?.createdAt!==void 0&&!(C!==void 0&&H.createdAt>C);H=Ve[0])Ve.shift(),Se.push(yt(H))}for(let C of w.value){if(C.role==="assistant"&&C.id!==ze&&Un(C))continue;O(C.createdAt);let H=Ty(C.createdAt);H&&H!==He&&(Se.push(l("div",{class:`${un}-date-divider`,children:l("span",{class:`${un}-date-pill`,title:Ry(C.createdAt),children:Iy(C.createdAt,n)})},`day:${H}`)),He=H);let ne=C.retryAction!==void 0||C.role==="assistant"&&C.id===ze?Na(w.value,C):void 0,_e=ne!==void 0&&(ne.kind!=="continue-assistant"||u==="ai-agent");Se.push(l(M_,{message:C,status:C.status,strings:n,responseMode:r,showReasoning:o,showToolCalls:a,showSources:i,interactive:!!d&&u==="ai-agent"&&C.id===ze,superseded:C.id!==ze,tool:f,onRetry:d&&_e&&(C.role==="user"||C.id===ze)?m:void 0,enableMessageFeedback:s,onFeedback:c,reconnecting:Nt&&C.id===ze},C.id))}for(let C of Ve)Se.push(yt(C));return l("div",{class:`${un}-list-wrap`,children:[l("div",{ref:S,class:`${un}-list ${un}-list--fade`,part:"messages",role:"log","aria-live":"polite","aria-relevant":"additions text",children:[p&&w.value.length===0?l("div",{class:`${un}-list-loading`,role:"status",children:n.conversationLoading}):null,Te?l("div",{class:`${un}-load-previous`,children:l("button",{type:"button",onClick:ct,disabled:b,"aria-busy":b,"data-testid":M.loadPreviousMessages,children:n.loadPreviousMessages})}):null,Se,v&&!Ft?l(Js,{form:v.form,strings:n,onSubmit:v.onSubmit,onSkip:v.onSkip}):null]}),h?l("div",{class:`${un}-jump-strip`,children:l("button",{type:"button",class:`${un}-jump`,onClick:ot,"aria-label":n.scrollToBottom,title:n.scrollToBottom,"data-testid":M.scrollToBottom,children:l(Wt,{})})}):null]})}function Ty(e){if(typeof e!="number"||!Number.isFinite(e))return"";let t=new Date(e);return`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`}function Ry(e){if(typeof e!="number"||!Number.isFinite(e))return"";try{return new Date(e).toLocaleDateString(void 0,{dateStyle:"full"})}catch{return""}}function Iy(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 ii({panelEl:e,resize:t,position:n,initialSize:r,onSizeChange:o,strings:a}){let i=N.cssPrefix,s=D(null);if($(()=>{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,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},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 y=(m.clientX-v.startX)*v.dirX,x=(m.clientY-v.startY)*v.dirY;e.style.setProperty(`--${i}-widget-w`,`${v.startW+y}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 y=e.getBoundingClientRect();o({width:Math.round(y.width),height:Math.round(y.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":M.resizeGrip,children:l(Wd,{})})}var L_=N.cssPrefix;function O_({suggestions:e,onPick:t,disabled:n=!1}){let r=D(null),[o,a]=U({start:!1,end:!1});return $(()=>{let i=r.current;if(!i)return;function s(){if(!i)return;let p=Math.abs(i.scrollLeft),_=p>1,d=p<i.scrollWidth-i.clientWidth-1;a(u=>u.start===_&&u.end===d?u:{start:_,end:d})}s(),i.addEventListener("scroll",s,{passive:!0});let c=typeof ResizeObserver>"u"?void 0:new ResizeObserver(s);return c?.observe(i),()=>{i.removeEventListener("scroll",s),c?.disconnect()}},[e]),e.length===0?null:l("div",{ref:r,class:`${L_}-suggestions`,role:"group","aria-label":"Suggested replies","data-cut-start":o.start?"true":void 0,"data-cut-end":o.end?"true":void 0,children:e.map((i,s)=>l("button",{type:"button",class:`${L_}-suggestion`,onClick:()=>t(i),disabled:n,"data-testid":_t(M.suggestion,s),children:i.label},i.id))})}var Gn=N.cssPrefix,Ay=`.${Gn}-header, .${Gn}-back-header, .${Gn}-home-hero`,Ey='button, a, input, textarea, select, [role="tab"], [contenteditable]',$_=56;function si(e,t){$(()=>{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(Ay)||p.closest(Ey))return;let _=e.getBoundingClientRect();o={id:c.pointerId,x:c.clientX,y:c.clientY,dx:n(e.style.getPropertyValue(`--${Gn}-modal-dx`)),dy:n(e.style.getPropertyValue(`--${Gn}-modal-dy`)),maxX:(window.innerWidth+_.width)/2-$_,maxY:(window.innerHeight+_.height)/2-$_},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(`--${Gn}-modal-dx`,`${p}px`),e.style.setProperty(`--${Gn}-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 li({containerRef:e,onDrop:t,disabled:n=!1}){let[r,o]=U(!1);return $(()=>{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 Ye=N.cssPrefix;function D_(e){let{options:t,onClose:n}=e,r=t.strings,o=D(null);$(()=>{let p=o.current;if(!p)return;let _=qa(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?.blocking&&!e.sendPreparing&&e.options.features.fileUpload,s=F(p=>{i&&a.current?.attachFromDrop(p)},[a,i]),{visible:c}=li({containerRef:o,onDrop:s,disabled:!i});return si(o.current,t.mode==="modal"),l("div",{ref:o,class:`${Ye}-panel`,part:"panel",role:"dialog","aria-modal":"false","aria-label":r.panelTitle,style:{position:"relative"},"data-testid":M.panel,children:[l(ul,{...e,containerEl:o.current,dragOver:c}),l(dl,{poweredBy:e.options.poweredBy})]})}function ul(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:y,assignedOperatorInitials:x,operatorAvailable:S,operatorRequestEnabled:w,onRequestOperator:h,onCancelOperatorRequest:g,loadingMessages:b,onLoadPreviousMessages:k,messagesSig:E,reconnectingSig:R,agent:A,suggestions:L,initialWidgetSize:j,onClose:B,onBack:V,onClear:X,onToggleHistory:pe,onSelectHistoryConversation:J,onNewConversation:le,onWidgetSizeChange:ke,onSend:be,onStop:Me,onSuggestion:Fe,activeForm:te,formMarkers:Pe,onFormSubmit:Oe,onFormSkip:lt,onFormFill:Ft,tool:ot,onRetry:gt,onMessageFeedback:Mt,containerEl:ht,dragOver:Te,composerApiRef:ct}=e,Se=t.strings,He=It(()=>E.value.some(Nt=>!Nt.ephemeral&&Nt.role!=="system")).value,ze;return te?.blocking?ze=null:_?ze=l(ue,{children:[y&&y!=="ai-agent"?l(Ly,{controlMode:y,operatorInitials:x,operatorAvailable:S,onCancelOperatorRequest:g,strings:Se}):null,u&&y==="ai-agent"?l("div",{class:`${Ye}-loading ${Ye}-compaction-status`,role:"status","data-testid":M.compactionStatus,children:[l("span",{class:`${Ye}-loading-spinner`,"aria-hidden":"true"}),Se.compactingContext]}):null,!d&&!u&&y==="ai-agent"&&l(O_,{suggestions:L,onPick:Fe,disabled:v}),l(Ep,{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:w,canRequestOperator:He,controlMode:y,onRequestOperator:h,onSend:be,onStop:Me,apiRef:ct},s)]}):ze=l(Ny,{label:Se.conversationClosed,ctaLabel:Se.startNewConversation,onNewConversation:X}),l(ue,{children:[p==="history"?l(My,{strings:Se,onBack:pe,onClose:B,showClose:Oa(t.mode,c,t.actions)}):l("header",{class:`${Ye}-header`,part:"header","data-testid":M.panelHeader,children:[V?l("button",{type:"button",class:`${Ye}-icon-btn`,onClick:V,"aria-label":Se.moduleBack,title:Se.moduleBack,children:l(io,{})}):null,A?l(Up,{agent:A,strings:Se}):l("h1",{children:Se.panelTitle}),l(Xt,{panelProps:e,variant:"chat"})]}),p==="history"?l(Xa,{transport:n,strings:Se,locale:t.locale,persistence:a,onSelect:J,onNewConversation:le}):l(ue,{children:[l(Vp,{visible:Te,strings:Se}),l(N_,{messagesSig:E,reconnectingSig:R,strings:Se,responseMode:t.responseMode,showReasoning:t.showReasoning,showToolCalls:t.showToolCalls,showSources:t.showSources,enableMessageFeedback:t.enableMessageFeedback,onFeedback:Mt,loading:b,onLoadPreviousMessages:k,idle:!d&&!v&&_&&!te?.blocking,controlMode:y,tool:ot,onRetry:gt,form:te?{form:te,onSubmit:Oe,onSkip:lt}:null,formMarkers:Pe,onFillForm:Ft}),ze,l($y,{disclaimer:t.composerDisclaimer})]}),t.size.resize?.enabled?l(ii,{panelEl:ht,resize:t.size.resize,position:t.position,initialSize:j,onSizeChange:ke,strings:Se}):null]})}function My({strings:e,onBack:t,onClose:n,showClose:r}){return l("header",{class:`${Ye}-header`,part:"header",children:[l("button",{type:"button",class:`${Ye}-icon-btn`,onClick:t,"aria-label":e.historyBack,title:e.historyBack,children:l(io,{})}),l("h1",{children:e.historyTitle}),r?l("button",{type:"button",class:`${Ye}-icon-btn`,onClick:n,"aria-label":e.close,title:e.close,children:l(qt,{})}):null]})}function Ny({label:e,ctaLabel:t,onNewConversation:n}){return l("div",{class:`${Ye}-readonly-banner`,role:"note",children:[l("span",{class:`${Ye}-readonly-label`,children:e}),l("button",{type:"button",class:`${Ye}-readonly-cta`,onClick:n,children:t})]})}function Ly({controlMode:e,operatorInitials:t,operatorAvailable:n,onCancelOperatorRequest:r,strings:o}){let a=Oy(e,t,n,o);return l("div",{class:`${Ye}-operator-banner`,role:"status","data-mode":e,"data-testid":M.operatorBanner,children:[l("span",{class:`${Ye}-operator-pulse`,"aria-hidden":"true"}),l("span",{class:`${Ye}-operator-label`,children:a}),e==="awaiting-operator"&&r?l("button",{type:"button",class:`${Ye}-cancel-operator-request`,"data-testid":M.cancelOperatorRequest,onClick:r,children:o.cancelOperatorRequest}):null]})}function Oy(e,t,n,r){return e==="operator"?r.chattingWithOperator.replace("{operator}",t??""):n===!1?r.noOperatorAvailable:r.connectingOperator}function $y({disclaimer:e}){return e?l("div",{class:`${Ye}-composer-footer`,children:l("div",{class:`${Ye}-disclaimer`,children:e})}):null}function dl({poweredBy:e}){return e?l("div",{class:`${Ye}-poweredby-bar`,children:l(Dy,{logoUrl:e.logoUrl,text:e.text,href:e.href})}):null}function Dy({logoUrl:e,text:t,href:n}){let r=l(ue,{children:[e?l("img",{class:`${Ye}-poweredby-logo`,src:e,alt:"",loading:"lazy"}):null,t?l("span",{children:t}):null]});return n?l("a",{class:`${Ye}-poweredby`,href:n,target:"_blank",rel:"noopener noreferrer",children:r}):l("span",{class:`${Ye}-poweredby`,children:r})}var ci=N.cssPrefix;function F_({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=D(null),u=D(new Set);$(()=>{let V=d.current;if(!V)return;let X=qa(V);function pe(J){J.key==="Escape"&&e.onClose?.()}return V.addEventListener("keydown",pe),()=>{X(),V.removeEventListener("keydown",pe)}},[e.onClose]);let f=It(()=>n.sig.value).value,m=Nd(f),v=p.modules.byId[f.activeTab],y=e.composerActive&&v?.layout==="chat"&&m===void 0,x=e.composerApiRef,S=y&&e.view==="chat"&&e.canSend&&!e.activeForm?.blocking&&!e.sendPreparing&&e.options.features.fileUpload,w=F(V=>{S&&x.current?.attachFromDrop(V)},[x,S]),{visible:h}=li({containerRef:d,onDrop:w,disabled:!S});si(d.current,p.mode==="modal");let g=m?.kind==="iframe"||m?.kind==="content",b=t.length>1&&(Ld(f)||!g),k=D(null);$(()=>{if(g&&k.current===null)k.current=e.panelSize,e.panelSize==="normal"&&c("expanded");else if(!g&&k.current!==null){let V=k.current;k.current=null,c(V)}},[g]);let E={push:V=>n.push(V),pop:()=>n.pop(),switchTab:V=>n.switchTab(V),switchToLayout:V=>{let X=t.find(pe=>pe.layout===V);X&&n.switchTab(X.id)},selectConversation:i,startNewConversation:s};function R(V){return{options:p,transport:e.transport,strings:_,config:V,nav:E,bus:r,panelProps:e,latestNews:a}}let A=l(Xt,{panelProps:e,variant:"plain"});v&&u.current.add(v.id);let L=t.filter(V=>u.current.has(V.id));function j(V){if(V.layout==="chat")return l(ul,{...e,composerActive:y,containerEl:d.current,dragOver:h});let X=Qa[V.layout].Root;return X?l(X,{...R(V)}):null}function B(){return m?.kind==="iframe"?l(Bp,{url:m.url,title:m.title,strings:_,onBack:()=>n.pop(),actions:A}):m?.kind==="content"?l(yp,{id:m.id,title:m.title,transport:e.transport,strings:_,bus:r,onBack:()=>n.pop(),actions:A}):null}return l("div",{ref:d,class:`${ci}-panel ${ci}-messenger`,part:"panel",role:"dialog","aria-modal":"false","aria-label":_.panelTitle,style:{position:"relative"},"data-testid":M.messengerHome,children:[l("div",{class:`${ci}-messenger-body`,children:[L.map(V=>l("div",{class:`${ci}-messenger-pane`,hidden:g||V.id!==v?.id,children:j(V)},V.id)),B()]}),b?l(Dp,{modules:t,activeTab:f.activeTab,strings:_,hasUnread:o,onSelect:V=>n.switchTab(V)}):null,l(dl,{poweredBy:p.poweredBy}),p.size.resize?.enabled&&!(v?.layout==="chat"&&!m)?l(ii,{panelEl:d.current,resize:p.size.resize,position:p.position,initialSize:e.initialWidgetSize,onSizeChange:e.onWidgetSizeChange,strings:_}):null]})}var Po=N.cssPrefix;function B_({strings:e,onClose:t}){return l("div",{class:`${Po}-panel ${Po}-modules-empty`,part:"panel",role:"dialog","aria-label":e.panelTitle,"data-testid":M.modulesEmpty,children:[t?l("button",{type:"button",class:`${Po}-icon-btn ${Po}-modules-empty-close`,onClick:t,"aria-label":e.close,title:e.close,children:l(qt,{})}):null,l("p",{class:`${Po}-modules-empty-text`,children:e.modulesEmpty})]})}function U_(e){let t=N.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":M.sidebar,children:[l("div",{class:`${t}-sidebar-header`,children:[l(Fy,{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":M.sidebarToggle,children:l(By,{collapsed:a})})]}),a?null:l(ue,{children:[i.length>0?l("nav",{class:`${t}-sidebar-section`,"data-section":"navigation",children:l(Uy,{items:i})}):null,s.length>0?l("div",{class:`${t}-sidebar-section`,"data-section":"link-cards",children:l(qy,{items:s})}):null,e.showConversations?l("div",{class:`${t}-sidebar-conversations`,children:l(Xa,{transport:e.transport,strings:e.strings,locale:e.locale,persistence:e.persistence,onSelect:e.onSelectConversation,onNewConversation:e.onNewConversation})}):null]})]})}function Fy({site:e}){let t=N.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??N.name})}function By({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 Uy({items:e}){let t=N.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 qy({items:e}){let t=N.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 q_=N.cssPrefix;function H_(e){return l("main",{class:`${q_}-page-shell`,"data-sidebar-collapsed":e.sidebarCollapsed?"true":"false",children:[l(U_,{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:`${q_}-page-chat`,"aria-label":e.strings.panelTitle,children:e.children})]})}var xo=ce.scope("hitl");function ui(e){return e.kind==="tool"&&Gt(e.toolMetadata)&&(e.stateSig.value==="input-available"||e.stateSig.value==="approval-responded"&&e.approvalSig.value?.approved===!0)}function z_(e,t){t.errorSig.value=rl(t.toolCallId),t.stateSig.value="output-error",e.partsSig.value=[...e.partsSig.value]}function Hy(e,t){let n=e.slice(0,e.indexOf(t)).findLast(r=>r.role==="user");return n!==void 0&&At.sentHere(n.id)}function j_(e){let{streaming:t,controlModeSig:n,messagesSig:r,sendAiTurn:o,bus:a,humanInLoop:i,tools:s}=e,c=D(t);c.current=t;let p=D(s);p.current=s;let _=D(new Map),[d,u]=U(!1),f=F((h,g,b)=>{if(c.current||n.value!=="ai-agent")return!1;let k=r.value.at(-1),E=k?.partsSig.value.findIndex(L=>L.kind==="tool"&&L.toolCallId===h)??-1,R=k?.partsSig.value[E];if(!k||R?.kind!=="tool")return xo.warn("decideTool: tool part not found",{toolCallId:h}),!1;if(k.status!=="complete"||!Aa(k,E)||!g(R))return!1;if(b(R),k.partsSig.value=[...k.partsSig.value],!qn(k)||k.partsSig.value.some(ui))return!0;k.status="streaming",k.retryAction={kind:"continue-assistant",messageId:k.serverMessageId??k.id},k.awaitingContinuation=!0,r.value=[...r.value];let A=k.partsSig.value.flatMap(L=>L.kind==="tool"?[L.toolCallId]:[]);return o({continueExisting:!0}).then(L=>L&&At.clear(A)),!0},[n,r,o]),m=F((h,g)=>{let{toolCallId:b,toolName:k}=g;_.current.has(b)||(_.current.set(b,h),u(!0),p_({toolCallId:b,toolName:k,input:g.inputSig.value,optionTools:p.current??[],onSettled:(E,R)=>{xo.info("toolResult",{toolCallId:b,status:E}),a.emit("toolResult",{toolCallId:b,name:vo(k),status:E,durationMs:R})}}).then(E=>{_.current.delete(b)&&(u(_.current.size>0),f(b,ui,R=>{E.state==="output-available"?R.outputSig.value=E.output:R.errorSig.value=E.errorText,R.stateSig.value=E.state}))}))},[a,f]),v=F(()=>{let h=r.value;for(let[k,E]of _.current){let R=h.findIndex(A=>A.id===E);R<0||R===h.length-1||(_.current.delete(k),__(k),u(_.current.size>0))}let g=h.at(-1);if(c.current||g?.role!=="assistant"||g.status!=="complete")return;let b=g.partsSig.value.filter(k=>ui(k)&&k.stateSig.value==="input-available");if(!(b.length===0||!Hy(h,g)))for(let k of b)At.get(k.toolCallId)?.state==="stopped"?z_(g,k):m(g.id,k)},[r,m]);$(()=>v(),[t,v]),$(()=>r.subscribe(()=>v()),[r,v]);let y=F((h,g,b)=>{let k=!1,E;if(!f(h,L=>L.stateSig.value==="approval-requested",L=>{Gt(L.toolMetadata)&&(E=L),k=L.toolMetadata?.card==="questions";let j=L.approvalSig.value?.id??h;L.approvalSig.value={id:j,approved:g,reason:b},L.stateSig.value="approval-responded"}))return;let A=r.value.at(-1);if(E&&g&&A&&m(A.id,E),E&&!g&&a.emit("toolResult",{toolCallId:h,name:vo(E.toolName),status:"declined",durationMs:0}),k){xo.info("toolResult",{toolCallId:h}),a.emit("toolResult",{toolCallId:h});return}xo.info("toolDecision",{toolCallId:h,approved:g}),a.emit("toolDecision",{toolCallId:h,approved:g})},[a,f,r,m]),x=F(h=>{f(h,g=>g.stateSig.value==="approval-responded"&&g.approvalSig.value?.approved!==void 0&&!ui(g),g=>{let b=g.approvalSig.value?.id??h;g.approvalSig.value={id:b},g.stateSig.value="approval-requested"})},[f]),S=se(()=>({humanInLoop:i,onDecision:y,onEdit:x}),[i,y,x]),w=F(()=>{let h=r.value.at(-1);for(let g of _.current.keys()){let b=h?.partsSig.value.find(k=>k.kind==="tool"&&k.toolCallId===g);h&&b?z_(h,b):rl(g),xo.info("toolResult",{toolCallId:g,status:"stopped"}),a.emit("toolResult",{toolCallId:g,name:b?vo(b.toolName):void 0,status:"stopped",durationMs:0})}_.current.clear(),u(!1)},[a,r]);return{toolInteraction:S,pageToolsRunning:d,stopPageTools:w}}var zy=ce.scope("latest-news");function V_({transport:e,options:t,persistence:n,enabled:r}){let o=t.modules.list.find(d=>d.layout==="news")?.contentCollectionIds,a=o?.join(","),[i,s]=U(),[c,p]=U(()=>n.loadSeenNewsId());$(()=>{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=>zy.debug("listContent (latest news) failed (non-fatal)",{err:u})),()=>{d=!0}},[e,r,a]);let _=F(d=>{n.saveSeenNewsId(d),p(d)},[n]);return{item:i,unseen:i!==void 0&&i.id!==c,markSeen:_}}function W_({callout:e,persistence:t}){let n=e?.text??"",r=e?.persistent??!0,[o,a]=U(()=>r?!1:t.loadCalloutDismissed(n));$(()=>{a(r?!1:t.loadCalloutDismissed(n))},[n,r,t]);let i=F(()=>{a(!0),r||t.saveCalloutDismissed(n)},[t,n,r]);return{dismissed:o,dismissCallout:i}}function G_(e){let{transport:t,conversationIdSig:n}=e,r=Rt("ai-agent"),o=Rt(void 0),a=Rt(void 0),i=D(void 0),s=F(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=F(d=>{if(d.type!=="data-control-state")return;let u=sd(d.data);u&&s(u)},[s]),p=F(async()=>{let d=n.value,u=await t.requestOperator();u&&n.value===d&&s(u)},[t,n,s]),_=F(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 di=N.cssPrefix,K_=`--${di}-visual-viewport-height`,Q_=`--${di}-visual-viewport-top`;function X_(e){let{hostElement:t,mode:n,panelSize:r,isOpen:o,surfaceReady:a,setIsOpen:i}=e;Tt(()=>{Jo(t,$a(n,r,o))},[t,o,r,n]),Tt(()=>{if(!o||!a)return;let s=t.ownerDocument.defaultView,c=s?.visualViewport,p=t.shadowRoot?.querySelector(`.${di}-anchor`);if(!s||!c||!p)return;let _=()=>{p.style.setProperty(K_,`${c.height}px`),p.style.setProperty(Q_,`${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(K_),p.style.removeProperty(Q_)}},[t,o,a]),$(()=>{if(n!=="modal"||!o)return;function s(c){c.composedPath().some(_=>_ instanceof HTMLElement&&_.classList.contains(`${di}-panel`))||i(!1)}return t.addEventListener("click",s),()=>t.removeEventListener("click",s)},[t,o,n,i]),$(()=>{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 pl=ce.scope("reducer"),pi=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=sn();r.id=t.id;let o=Kn(t)||Hn(t)&&(t.status!=="streaming"||qn(t)),a=t.status==="streaming"&&qn(t)&&eo(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,J_(i,a),t.liveCatchUp&&Kn(t.shadow)&&(a.status==="streaming"||Hn(a))?(t.probeContinuation=!1,t.continuationTailReplay=!1,t):(t.probeContinuation=Kn(a)||Hn(a)&&(a.status!=="streaming"||qn(a)),t.continuationTailReplay=a.status==="streaming"&&qn(a)&&eo(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;J_(t,a);let i=Kn(t)&&Hn(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 Ut(()=>{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.runStartedAt=n.runStartedAt??t.runStartedAt,t.stepTimings=n.stepTimings??t.stepTimings,t.partsSig.value=n.partsSig.value,this.messagesSig.value=[...this.messagesSig.value]}),this.replay=null,this.active=t,t}promoteContinuation(){let{baseline:t,chunks:n}=this.replay,r=Ea(t);return this.replay=null,Ut(()=>{t.partsSig.value=t.partsSig.value.slice(0,jy(t,n)+1),t.awaitingContinuation=!1,t.status="streaming",t.finishReason=void 0,t.errorText=void 0,t.suggestions=void 0,this.attach(t);for(let o of n)this.apply(o);t.continuationStreaming=r||void 0,this.messagesSig.value=[...this.messagesSig.value]}),t}settleOwnedContinuation(t){let{baseline:n}=this.replay,r=Ea(n);return this.replay=null,Ut(()=>{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&&!Vt(c))return this.attach(c),this.apply(t),null;let p=sn();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(!Gy(o,a,t)){if(p){if(o.status==="streaming"&&o.awaitingContinuation!==!0){let u=this.settleOwnedContinuation(t);return this.detach(),u}Jy(o,a)&&(o.continuationStreaming=!0,this.messagesSig.value=[...this.messagesSig.value],this.onReconcileNeeded?.({messageId:o.serverMessageId??o.id})),this.detach()}return null}let d=Kn(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&&Wy(o,a)){let d=this.promoteContinuation();return p?(this.detach(),d):null}if(!c)return p&&this.detach(),null;if(p&&!Vt(o)&&Vt(a)){let d=this.promoteReplay();return this.detach(),d}if(!Vy(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:ie(""),doneSig:ie(!1)};return this.openTextParts.set(o,i),So(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?.runStartedAt&&(n.runStartedAt=r.runStartedAt),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":So(n,{kind:"step-start",id:`ss-${this.partSeq++}`});return;case"message-metadata":n.stepTimings=Ra(t.messageMetadata?.steps)??n.stepTimings;return;case"finish":pl.debug("finish",{reason:t.finishReason,canContinue:t.canContinue}),n.stepTimings=Ra(t.messageMetadata?.steps)??n.stepTimings,n.status="complete",n.retryAction=void 0,t.finishReason&&(n.finishReason=t.finishReason),this.bumpDone(n);return;case"error":pl.warn("stream error chunk",{errorText:t.errorText}),n.status="error",n.errorText=void 0,this.bumpDone(n);return;case"abort":pl.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":Yy(n,t);return;case"file":So(n,{kind:"file",url:t.url,mediaType:t.mediaType});return;case"source-url":Y_(n,{kind:"source",sourceId:t.sourceId,url:t.url,title:t.title});return;case"source-document":Y_(n,{kind:"source",sourceId:t.sourceId,title:t.title,filename:t.filename,mediaType:t.mediaType});return;case"data-suggestions":n.suggestions=Ta(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){Ut(()=>{t.partsSig.value=[...t.partsSig.value],this.messagesSig.value.includes(t)&&(this.messagesSig.value=[...this.messagesSig.value])})}},_l={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function Kn(e){return e.awaitingContinuation===!0||e.continuationStreaming===!0||e.retryAction?.kind==="continue-assistant"}function J_(e,t){e.canceled&&(t.canceled=!0),!(!Kn(e)||t.status!=="streaming"&&!Hn(t))&&(t.awaitingContinuation??(t.awaitingContinuation=e.awaitingContinuation),t.continuationStreaming??(t.continuationStreaming=e.continuationStreaming),t.retryAction===void 0&&(t.retryAction=e.retryAction))}function jy(e,t){let n=e.partsSig.value,r=t.findIndex(s=>s.type==="start-step"),o=new Set(t.slice(0,r<0?t.length:r).flatMap(s=>"toolCallId"in s&&s.type.startsWith("tool-output")?[s.toolCallId]:[])),a=n.findLastIndex(s=>s.kind==="tool"&&(s.stateSig.value==="approval-requested"||s.stateSig.value==="approval-responded"||o.has(s.toolCallId)));if(a>=0)return a;let i=new Set(t.flatMap(s=>s.type==="tool-input-start"||s.type==="tool-input-available"?[s.toolCallId]:[]));return n.some(s=>s.kind==="tool"&&i.has(s.toolCallId))?-1:n.findLastIndex(s=>s.kind==="tool")}function Vy(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)=>Z_(o,r[a]))}function Wy(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)=>Z_(s,a[c]))}function Z_(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||!Ma(t.toolName,e.toolName)||_l[t.stateSig.value]<_l[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 Gy(e,t,n){return Ky(e,n)||!Qy(e,t)?!0:n.type!=="finish"&&n.type!=="error"&&n.type!=="abort"?!1:eo(t)||e.awaitingContinuation===!0&&n.type!=="finish"?!0:e.awaitingContinuation===!0&&t.partsSig.value.every(r=>r.kind==="step-start")}function Ky(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&&_l[n.stateSig.value]<4}function Qy(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)=>Xy(r[a+s],i)))}function Xy(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"||Ma(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 Jy(e,t){if(Kn(e)||!Hn(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 wn(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:ie(""),inputSig:ie(void 0),outputSig:ie(void 0),errorSig:ie(void 0),stateSig:ie("input-streaming"),approvalSig:ie(void 0)};return So(e,i),i}function So(e,t){e.partsSig.value=[...e.partsSig.value,t]}function Y_(e,t){e.partsSig.value.some(n=>n.kind==="source"&&n.sourceId===t.sourceId)||So(e,t)}function Yy(e,t){switch(t.type){case"tool-input-start":wn(e,t.toolCallId,t.toolName,t.dynamic,t.toolMetadata);return;case"tool-input-delta":{let n=wn(e,t.toolCallId);n.inputPartialSig.value+=t.inputTextDelta;return}case"tool-input-available":{let n=wn(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=wn(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=wn(e,t.toolCallId,t.toolName);n.approvalSig.value={id:t.approvalId},n.stateSig.value="approval-requested";return}case"tool-output-available":{let n=wn(e,t.toolCallId,void 0,t.dynamic);n.outputSig.value=t.output,n.stateSig.value="output-available";return}case"tool-output-error":{let n=wn(e,t.toolCallId,void 0,t.dynamic);n.errorSig.value=t.errorText,n.stateSig.value="output-error";return}case"tool-output-denied":{let n=wn(e,t.toolCallId);n.stateSig.value="output-denied";return}default:return}}async function ef(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;e.onDropped?.(),i!==void 0&&e.now()-i>=1e3&&(t=1e3),await e.sleep(t),t=Math.min(t*2,15e3)}}var Zy=120;function tf(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:y,canContinueRef:x,setCanSend:S,feedback:w,bus:h,loadInitialThread:g,shouldReconcileOnConnect:b,reconnectingSig:k}=e,E=D(0);$(()=>{if(!t||!n||!r.value)return;let R=r.value,A=new AbortController,L=O=>{},j=new pi(o,O=>L(O));i.primeIdentity(s,R);let B=!1,V=!1,X,pe=!1,J,le=0,ke=x.current,be,Me,Fe=Date.now(),te,Pe=!1,Oe=!1;function lt(O,C,H){if(!Vt(O))return;let oe=o.value.findLast(_e=>!_e.ephemeral),ne=O.serverMessageId??O.id;if(!(oe&&(oe.serverMessageId??oe.id)!==ne))return Ia(o.value,O,R,a.current.strings.newConversation,C,H)}function Ft(O,C,H,oe){let ne=lt(O,C,oe);if(!ne)return;let Re=`${O.serverMessageId??O.id}:${H}:${ne.preview??""}`;Re!==Me&&(Me=Re,i.publishConversation({...ne,hasUnread:!0},!0))}let ot;function gt(){ot&&(clearTimeout(ot.timer),ot=void 0)}function Mt(){let O=ot;if(!O)return;clearTimeout(O.timer),ot=void 0;let C=o.value.find(H=>(H.serverMessageId??H.id)===O.replyId);C?.role!=="assistant"&&C?.role!=="operator"||Ft(C,O.canContinue,O.generation,O.activityAt)}function ht(O,C,H,oe){gt(),ot={replyId:O.serverMessageId??O.id,canContinue:C,generation:H,activityAt:oe,timer:setTimeout(Mt,Zy)}}function Te(O,C,H,oe=Date.now(),ne=!0){gt();let _e=lt(O,C,oe);if(!_e)return;let Ie=`${O.serverMessageId??O.id}:${H}`;Ie!==be&&(be=Ie,d(_e),ne&&te&&(Pe=!0))}function ct(O,C){(O||!y.localSendRef.current)&&y.settle(C),O&&v()}function Se(O,C=[],H=!1,oe,ne=ke,_e=le,Re=Date.now(),Ie=!0){let $e=a.current;if(O.canceled){Te(O,ne,_e,Re,Ie),ct(H,oe);return}let ye=!0,Be=O.status==="error";switch(vd(O,Be)){case"drop":o.value=o.value.filter(Ke=>Ke!==O),ye=!1;break;case"complete-operator-routed":O.status="complete",H&&(w.play("messageReceived"),fr(h,$e,"assistant",Je(O)));break;case"error":{if(O.status="error",H){w.play("error");let Ke=new Error(Be?"stream error chunk":"empty reply");h.emit("error",Ke),$e.onError?.(Ke)}break}case"complete":O.status="complete",H&&(w.play("messageReceived"),fr(h,$e,"assistant",Je(O))),_(O,C);break}ye&&Te(O,ne,_e,Re,Ie),ct(H,oe)}function He(O){if(A.signal.aborted||r.value!==R)return;if(c(O),p?.(O),O.type==="start"){Mt();let Ke=O.messageId===void 0?void 0:o.value.find(K=>K.serverMessageId===O.messageId||K.id===O.messageId);pe=Ke!==void 0&&Ke.status!=="streaming";let q=J?.senderRole==="visitor"?J.messageId:void 0;if(J={messageId:O.messageId,senderRole:O.messageMetadata?.senderRole},le+=1,Fe=Date.now(),Me=void 0,B=O.messageMetadata?.senderRole===void 0,V=!1,X=B?O.messageMetadata?.runId:void 0,B){let K=O.messageId!==void 0&&o.value.some(Lt=>Lt.serverMessageId===O.messageId||Lt.id===O.messageId),Y=o.value.at(-1),ge=O.messageId!==void 0&&(Y?.serverMessageId===O.messageId||Y?.id===O.messageId),ft=y.localSendRef.current&&(!K||ge)&&Y?.role==="assistant"&&Y.status==="streaming"&&(ge||Y.serverMessageId===void 0&&Y.partsSig.value.length===0);V=y.captureStart(R,O,ft,q)}}let C=B&&(O.type==="finish"||O.type==="error"||O.type==="abort"),H=C?X:void 0,oe=C&&(V||y.ownsLocalRun(H)),ne=le,_e=pe;O.type==="finish"&&O.canContinue!==void 0&&(ke=O.canContinue);let Re=ke;C&&(B=!1,V=!1,X=void 0);let Ie=j.applyResume(O),$e=J?.messageId,ye=$e===void 0?void 0:o.value.find(Ke=>Ke.serverMessageId===$e||Ke.id===$e);pe&&J?.senderRole!=="visitor"&&(Ie!==null||ye?.status==="streaming")&&(pe=!1,_e=!1);let Be=!pe&&(ye?.role==="assistant"||ye?.role==="operator");if(O.type==="text-delta"&&Be&&ht(ye,ke,le,Fe),O.type==="text-end"&&(gt(),Be&&Ft(ye,ke,le,Fe)),O.type==="finish"&&O.canContinue===!1&&S(!1),!Ie){C&&(oe||!y.localSendRef.current)&&y.settle(H);return}if(Ie.role==="operator"){_e||(w.play("messageReceived"),fr(h,a.current,"operator",Je(Ie))),Te(Ie,Re,ne,Fe),pe=!1,C&&(oe||!y.localSendRef.current)&&y.settle(H);return}Ie.role==="assistant"&&(Se(Ie,[],oe,H,Re,ne,Fe),pe=!1)}async function ze(O){let C=le,H=await i.loadConversation(R,O?{ids:[O]}:void 0).catch(()=>null);if(A.signal.aborted||r.value!==R||!H)return!1;H.controlState&&c({type:"data-control-state",data:H.controlState});let oe=o.value.at(-1),ne=C===le&&(O===void 0||oe!==void 0&&(oe.serverMessageId===O||oe.id===O));if(H.messages.length===0)return!0;ne&&(ke=H.canContinue,S(ke));let _e=o.value,Re=O===void 0?_e.at(-1):_e.find(K=>K.serverMessageId===O||K.id===O),{messages:Ie,changed:$e}=to(_e,Pn(H.messages));if(!$e)return!0;o.value=Ie;let ye=O===void 0?Ie.at(-1):Ie.find(K=>K.serverMessageId===O||K.id===O),Be=Re!==void 0&&ye!==void 0&&(Re.id===ye.id||Re.serverMessageId!==void 0&&Re.serverMessageId===ye.serverMessageId),Ke=ye!==void 0&&ye.status!=="streaming"&&(!Be||Re?.status==="streaming"),q=Be&&Re?.status==="streaming"?Date.now():ye?.createdAt;return ne&&Ke&&ye.role==="assistant"?Se(ye,ye.suggestions??[],y.localSendRef.current,void 0,H.canContinue,C,q,!1):ne&&Ke&&ye.role==="operator"?Te(ye,H.canContinue,C,q,!1):ne&&ye?.role==="assistant"&&ye.status!=="streaming"&&_(ye,ye.suggestions??[]),!0}let Nt=new Set;L=({messageId:O})=>{if(Nt.has(O)||!o.value.some(H=>H.serverMessageId===O||H.id===O))return;Nt.add(O);function C(){return Nt.delete(O)}ze(O).then(C,C)};function Ve(O=!1){if(A.signal.aborted||r.value!==R){Pe=!1;return}if(te){Pe=!0;return}let C=O?g(R)??(b()?ze():void 0):ze();if(!C)return;f(R),te=C;function H(oe=!1){if(te===C){if(te=void 0,Pe){Pe=!1,Ve();return}oe&&m(R)}}C.then(H,()=>H(!1))}let yt=u.subscribe(O=>{O<=E.current||(E.current=O,Oe&&Ve())});return ef({signal:A.signal,now:()=>performance.now(),sleep:O=>zn(O,A.signal),connect:O=>i.connectResumeStream({signal:A.signal,onChunk:He,onConnected:()=>{k.value=!1,O()}}),onDropped:()=>{k.value=!0},onInitialBoundaryReady:()=>{Oe=!0,Ve(!0)},backfill:()=>Ve()}),()=>{A.abort(),k.value=!1,gt(),yt(),j.detach()}},[t,n,r,r.value,s,i,c,p,_,d,u,f,m,v,y,x,S,o,h,w,g,b,k])}var eP=32;function nf(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),_=F((g,b)=>{let k=`${g}:${b}`;i.current!==k&&(i.current=k,t.cancelTurn(g,b))},[t]),d=F(g=>{r.current=void 0,o.current=g,a.current=!1,i.current=void 0,s.current=!0,n(!0)},[n]),u=F((g,b)=>{c.current.set(g,{messageId:b})},[]),f=F(g=>{g!==void 0&&(p.current.add(g),p.current.size>eP&&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=F((g,b)=>o.current!==g?b.runId&&r.current?.runId===b.runId?(r.current={conversationId:b.conversationId,runId:b.runId},a.current&&_(b.conversationId,b.runId),!0):!1:(o.current=void 0,b.runId?(r.current={conversationId:b.conversationId,runId:b.runId},n(!0),a.current&&_(b.conversationId,b.runId),!0):(f(),!0)),[_,n,f]),v=F((g,b)=>{let k=c.current.get(g);return k?(c.current.delete(g),!b.runId||p.current.has(b.runId)?!0:k.runId!==void 0?(k.runId!==b.runId||r.current?.runId===b.runId&&(r.current={conversationId:b.conversationId,runId:b.runId},a.current&&_(b.conversationId,b.runId)),!0):(s.current||o.current||(r.current={conversationId:b.conversationId,runId:b.runId},o.current=void 0,a.current=!1,i.current=void 0,s.current=!0,n(!0)),!0)):!1},[_,n]),y=F(g=>o.current!==g?!1:(f(),!0),[f]),x=F(g=>{let b=c.current.get(g);return b?(c.current.delete(g),b.runId===void 0):!1},[]),S=F((g,b,k,E)=>{let R=b.messageMetadata?.runId;if(b.messageMetadata?.senderRole!==void 0||typeof R!="string"||!R||p.current.has(R))return!1;if(r.current?.runId===R)return s.current;if(s.current)return r.current||!k?!1:(o.current=void 0,r.current={conversationId:g,runId:R},n(!0),a.current&&_(g,R),!0);let L=[...c.current.values()].filter(j=>j.runId===void 0).find(j=>j.messageId===E);return L?(L.runId=R,r.current={conversationId:g,runId:R},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:R},n(!0),a.current&&_(g,R),s.current)},[_,n]),w=F(g=>typeof g=="string"&&r.current?.runId===g&&s.current,[]),h=F(()=>{let g=r.current;if(g)return a.current=!0,_(g.conversationId,g.runId),!0;let b=o.current;return b?(a.current=!0,b.then(k=>{k.runId&&_(k.conversationId,k.runId)}).catch(()=>{}),!0):!1},[_]);return se(()=>({localSendRef:s,begin:d,beginRouted:u,acceptAck:m,acceptRoutedAck:v,reject:y,rejectRouted:x,captureStart:S,ownsLocalRun:w,settle:f,stop:h}),[m,v,d,u,S,w,y,x,f,h])}var tP=ce.scope("send");function of(e,t,n,r,o,a=!0){e.publishConversation({...Ia(t,n,r,o,a),hasUnread:!1},!0)}function af(e,t){return e.id===t.id||(e.serverMessageId??e.id)===(t.serverMessageId??t.id)}function sf(e){return e.findLast(t=>!t.ephemeral&&t.role!=="system"&&(t.role==="user"||t.status!=="streaming"||Vt(t)))}function ko(e,t,n,r,o){let a=sf(t);a?.role!=="user"||!af(a,n)||of(e,t,a,r,o)}function rf(e){return!(e instanceof pt)||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 lf(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=F(()=>{let x=r.value??Ct();return r.value||(r.value=x,s.saveConversationId(x)),x},[r,s]),v=F(async({continueExisting:x,turn:S})=>{let w=m(),h=n.value.at(-1),g=S?[S]:pd(n.value,x),b=g[0];b?.role==="user"&&At.markSent(b.id);let k=g.map(Ms),E=s.loadUserPrefs(),R=Za(o.tools).then(A=>t.sendTurn(Rs({messages:k,conversationId:w,visitorId:c,userPrefs:E,clientTools:nl(A)}),{keepalive:x}));f.begin(R);try{let A=await R;if(r.value!==w||!f.acceptAck(R,A))return!1;if(p(A.conversationId),A.runId&&b?.role==="user"&&ko(t,n.value,b,A.conversationId,o.strings.newConversation),!A.runId){let L=await t.loadConversation(A.conversationId).catch(()=>null);if(r.value!==A.conversationId)return!0;if(L){L.controlState&&_(L.controlState),d(L.canContinue);let j=Pn(L.messages),{messages:B,changed:V}=to(n.value,j);V&&(n.value=B);let X=j.findLast(le=>!le.ephemeral&&le.role!=="system"),pe=sf(n.value);pe&&X&&af(pe,X)&&of(t,n.value,pe,A.conversationId,o.strings.newConversation,L.canContinue);let J=h?n.value.find(le=>le.id===h.id&&le.role==="assistant"&&le.status!=="streaming"):void 0;J&&u(J,J.suggestions??[]),!x&&h?.role==="assistant"&&n.value.includes(h)&&h.serverMessageId===void 0&&!Vt(h)&&(n.value=n.value.filter(le=>le!==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=b?.role==="user"?{kind:"resend-user",messageId:b.id}:null,n.value=[...n.value])}return!0}catch(A){if(r.value!==w)return!1;if(!f.reject(R))return b?.role==="user"&&ko(t,n.value,b,w,o.strings.newConversation),!0;let L=Vn(A,o.strings),j=rf(A),B=S?.role==="assistant"?S:n.value.at(-1);if(x&&B?.role==="assistant"&&A instanceof pt&&A.status===409){let V=B.serverMessageId??B.id,X=await t.loadConversation(w,{ids:[V]}).catch(()=>null);if(r.value!==w)return!1;if(X){X.controlState&&_(X.controlState),d(X.canContinue);let pe=Pn(X.messages),J=pe.find(le=>(le.serverMessageId??le.id)===V);if(J&&gd(B,J)){let{messages:le,changed:ke}=to(n.value,pe),be=le.find(Me=>(Me.serverMessageId??Me.id)===V);if(ke&&be&&be!==B)return be.awaitingContinuation=!1,be.continuationStreaming=void 0,be.retryAction=null,n.value=le,be.status!=="streaming"&&u(be,be.suggestions??[]),!0}}if(!n.value.includes(B)||B.status!=="streaming")return!1;B.continuationStreaming=!0}if(x&&B?.role==="assistant")B.status="error",B.errorText=L,B.retryAction=j?{kind:"continue-assistant",messageId:B.serverMessageId??B.id}:null,n.value=[...n.value];else if(h?.role==="assistant"&&n.value.includes(h)){h.status="error",h.errorText=L;let V=g[0];h.retryAction=j&&V?.role==="user"?{kind:"resend-user",messageId:V.id}:null,n.value=[...n.value]}else{let V=sn();V.status="error",V.errorText=L;let X=g[0];V.retryAction=j&&X?.role==="user"?{kind:"resend-user",messageId:X.id}:null,n.value=[...n.value,V]}return i.play("error"),a.emit("error",A),o.onError?.(A),!1}},[t,n,o,a,i,s,c,p,_,d,u,m,f]),y=F(async x=>{let S=m();x.status="pending",x.errorText=void 0,x.retryAction=void 0,n.value.includes(x)&&(n.value=[...n.value]),At.markSent(x.id);let w=[Ms(x)],h=s.loadUserPrefs(),g=Za(o.tools).then(b=>t.sendTurn(Rs({messages:w,conversationId:S,visitorId:c,userPrefs:h,clientTools:nl(b)})));f.beginRouted(g,x.id);try{let b=await g;return r.value!==S?(f.rejectRouted(g),!1):f.acceptRoutedAck(g,b)?(p(b.conversationId),ko(t,n.value,x,b.conversationId,o.strings.newConversation),x.status==="pending"&&(x.status="complete",n.value.includes(x)&&(n.value=[...n.value])),!0):!1}catch(b){let k=f.rejectRouted(g);if(r.value!==S)return!1;if(!k)return ko(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 ko(t,n.value,x,S,o.strings.newConversation),!0;tP.debug("operator-routed send failed",{error:b});let E=b instanceof Error?b:new Error(String(b));return x.status="error",x.errorText=Vn(b,o.strings),x.retryAction=rf(b)?{kind:"resend-user",messageId:x.id}:null,n.value.includes(x)&&(n.value=[...n.value]),i.play("error"),a.emit("error",E),o.onError?.(E),!1}},[t,n,o,a,i,s,c,p,m,f]);return{sendAiTurn:v,sendRoutedTurn:y}}var nP=ce.scope("unread");function cf(e){let{transport:t,options:n,conversationIdSig:r,isConversationVisibleRef:o,activated:a,conversationReady:i}=e,s=Rt(!1),c=Rt(0),p=Rt(0),_=D([]),d=D(void 0),u=D(!1),f=F(()=>{let b=r.value,k=o.current()&&d.current===b?b:void 0,E=_.current.filter(R=>R.hasUnread&&R.conversationId!==k).length;c.value=E,s.value=E>0},[r,s,c,o]),m=F(b=>{let k=r.value,E=_.current.find(j=>j.conversationId===k),R=ln(_.current,b),A=R.find(j=>j.conversationId===k),L=b.type==="snapshot"&&k!==void 0&&A?.hasUnread===!0&&d.current===k&&E!==void 0&&E.lastMessageAt!==A.lastMessageAt;L&&(d.current=void 0),_.current=R,f(),L&&(p.value+=1)},[r,f,p]),v=F(()=>{if(f(),!o.current())return;let b=r.value;if(!b||d.current!==b)return;let k=_.current.find(E=>E.conversationId===b);k?.hasUnread&&t.markRead(b,k.lastMessageAt)},[r,o,f,t]),y=F(b=>{r.value===b&&(d.current=void 0,f())},[r,f]),x=F(b=>{r.value===b&&(d.current=b,v())},[r,v]),S=F(b=>d.current===b,[]),w=F((b=!1)=>{!n.history.enabled||!n.modules.list.some(k=>k.layout==="chat")||u.current||(u.current=!0,t.listConversations({limit:50},b).then(k=>{b||m({type:"snapshot",result:k,requestedRevision:0}),v()}).catch(k=>nP.debug("refreshUnread failed (non-fatal)",{err:k})).finally(()=>{u.current=!1}))},[m,v,n.history.enabled,n.modules,t]),h=F(b=>{let k=b.conversationId,E=o.current()&&r.value===k&&d.current===k,R=_.current.find(L=>L.conversationId===k),A=E&&(R?.lastMessageAt!==b.lastMessageAt||R.hasUnread);t.publishConversation({...b,hasUnread:!E},!0),A&&t.markRead(k,b.lastMessageAt)},[r,o,t]);$(()=>t.subscribeConversationChanges(m),[m,t]);let g=D(!1);return $(()=>{!a||!i||g.current||(g.current=!0,w())},[a,i,w]),$(()=>{if(!a)return;function b(){document.visibilityState==="visible"&&(v(),w(!0))}return document.addEventListener("visibilitychange",b),()=>document.removeEventListener("visibilitychange",b)},[a,v,w]),{hasUnreadSig:s,unreadCountSig:c,transcriptRecoverySig:p,markVisibleConversationRead:v,beginConversationTranscript:y,commitConversationTranscript:x,isConversationTranscriptCommitted:S,recordConversationReply:h}}var wo=ce.scope("settings");function uf(e){let{options:t,persistence:n,transport:r,feedback:o,hostElement:a,bus:i}=e,s=n.loadUserPrefs(),[c,p]=U(()=>s.locale??t.locale),[_,d]=U(s.themeMode),u=_??t.themeMode,[f,m]=U(()=>s.textSize??t.textSize),v=F(g=>{n.patchUserPrefs(g),r.saveUserPrefs(n.loadUserPrefs()).catch(b=>wo.warn("saveUserPrefs failed",{err:b}))},[n,r]);$(()=>{s.soundMuted!==void 0&&o.setMuted(s.soundMuted)},[]),$(()=>{if(u!=="host"){a.dataset.theme=u;return}return qc(g=>{a.dataset.theme=g})},[a,u,t]),$(()=>{a.dataset.textSize=f},[a,f,t]),$(()=>{let g=!0;return o.mutedSig.subscribe(b=>{if(g){g=!1;return}v({soundMuted:b})})},[o,v]);let y=rr(c,t.availableLocales,t.defaultLocale);$(()=>{r.setLocale(y)},[r,y]),$(()=>{a.dir=oc(y)?"rtl":"ltr"},[a,y]),$(()=>{y!==c&&p(y)},[y,c]);let x=F(g=>{wo.info("localeChange",{locale:g}),p(g),v({locale:g}),i.emit("localeChange",g)},[v,i]),S=F(g=>{wo.info("themeChange",{mode:g}),d(g),a.dataset.theme=g,v({themeMode:g}),i.emit("themeChange",g)},[a,v,i]),w=F(g=>{wo.info("textSizeChange",{size:g}),m(g),a.dataset.textSize=g,v({textSize:g}),i.emit("textSizeChange",g)},[a,v,i]),h=F(()=>{o.toggleMuted();let g=o.mutedSig.value;wo.info("soundToggle",{muted:g}),i.emit("soundToggle",{muted:g})},[o,i]);return{activeLocale:c,activeThemeMode:u,activeTextSize:f,effectiveLocale:y,setActiveLocale:p,setActiveThemeMode:d,setActiveTextSize:m,patchAndSync:v,handleLocaleChange:x,handleThemeChange:S,handleTextSizeChange:w,handleSoundToggle:h}}var xe=ce.scope("app"),_i=N.cssPrefix,rP={home:"home",chats:"chat",help:"help",news:"news"};function df(e,t){return dd({...e,text:xt(t,e.text)})}function pf({options:e,hostElement:t,bus:n,recentHostEvents:r}){let o=e.aiAgentDeploymentId;if(!o)throw new Error("aiAgentDeploymentId is required");let[a]=U(()=>or(e.widgetId,e.storage,e.aiAgentDeploymentId)),[i]=U(()=>a.getVisitorId()),s=a.loadUserPrefs(),c=Rt(a.loadConversationId()),p=D(c.value!==void 0),_=Rt(c.value??""),d=Rt([]),u=Rt(!1),[f,m]=U(!1),v=D(void 0),[y,x]=U([]);function S(){let P=e.modules.list,I=new Set(P.map(W=>W.id)),Q=a.loadActiveModule();return Q&&I.has(Q)?Q:P[0]?.id??""}function w(){return e.modules.list.find(P=>P.layout==="chat")?.id}function h(){let P=w();return P?e.modules.list.length===1?!0:b.sig.value.activeTab===P:!1}let g=D(void 0);if(!g.current){let P=e.modules.list.map(Q=>Q.id),I=a.loadActiveModule()??P[0]??"";g.current=Ed(I,I?[...P,I]:P,Q=>a.saveActiveModule(Q))}let b=g.current,k=It(()=>b.sig.value.activeTab).value,E=It(()=>c.value).value,[R,A]=U(!1),[L,j]=U(null),[B,V]=U(!1),X=e.mode==="standalone"||e.mode==="inline",pe=D(oo(e,mr(),a.loadPanelOpen(),a.loadPanelSize())),[J,le]=U(pe.current.panelOpen),[ke,be]=U(pe.current.panelOpen),Me=D(void 0),Fe=D(void 0),te=D(!1),Pe=D(void 0);$(()=>{J&&be(!0)},[J]);let Oe=D(!1),[lt,Ft]=U(!1),{dismissed:ot,dismissCallout:gt}=W_({callout:e.launcher.callout,persistence:a}),Mt=e.launcher.callout?.persistent??!0,ht=F(()=>{xe.info("calloutDismiss"),n.emit("calloutDismiss",void 0),gt()},[n,gt]),[Te,ct]=U(pe.current.panelSize),Se=D(!1),[He,ze]=U("chat"),Nt=D(()=>!1);Nt.current=()=>J&&He==="chat"&&!document.hidden&&h();let[Ve,yt]=U(!0),O=D(Ve);O.current=Ve;let[C,H]=U(!1),oe=D(C);oe.current=C;let ne=D(null),[_e,Re]=U(!1),[Ie,$e]=U(null),[ye,Be]=U([]),Ke=D(e.strings),q=D(e);q.current=e;let[K,Y]=U(void 0),[ge,ft]=U(void 0),[Lt,Cn]=U(()=>a.loadSidebarCollapsed()??!1),[Pt,Tn]=U({}),[fe]=U(()=>new La({agentApiBaseUrl:e.agentApiBaseUrl,dataApiBaseUrl:e.dataApiBaseUrl,auth:fu({publicKey:e.publicKey,aiAgentDeploymentId:o,publicKeyHeader:"x-public-key"}),endpoints:e.endpoints,recentHostEvents:r})),[Ot]=U(()=>new ca(e.sound,e.haptics)),dn=nf({transport:fe,setStreaming:H}),{activeLocale:Co,activeThemeMode:ml,activeTextSize:gl,effectiveLocale:Qn,setActiveLocale:mf,setActiveThemeMode:gf,setActiveTextSize:hf,patchAndSync:hl,handleLocaleChange:vf,handleThemeChange:bf,handleTextSizeChange:yf,handleSoundToggle:Pf}=uf({options:e,persistence:a,transport:fe,feedback:Ot,hostElement:t,bus:n}),{controlModeSig:Kt,assignedOperatorInitialsSig:xf,operatorAvailableSig:Sf,applyControlState:Cr,adoptControlStateChunk:kf,requestOperator:wf,cancelOperatorRequest:Cf}=G_({transport:fe,conversationIdSig:c}),pn=Rt(new Map),Tf=F(P=>{if(P.type!=="data-memory-compaction-state")return;let I=c.value;if(!I)return;let Q=ld(P.data);if(!Q)return;let W=pn.value.get(I);if(W&&(Q.postFinishSequence<W.postFinishSequence||Q.postFinishSequence===W.postFinishSequence&&(W.status==="ready"||W.status===Q.status)))return;let re=new Map(pn.value);re.set(I,Q),pn.value=re},[c,pn]),{hasUnreadSig:Rf,unreadCountSig:vl,transcriptRecoverySig:If,markVisibleConversationRead:bl,beginConversationTranscript:mi,commitConversationTranscript:Xn,isConversationTranscriptCommitted:yl,recordConversationReply:Af}=cf({transport:fe,options:e,conversationIdSig:c,isConversationVisibleRef:Nt,activated:ke,conversationReady:R}),Ef=J&&e.modules.byId[k]?.layout==="home",Mf=V_({transport:fe,options:e,persistence:a,enabled:R&&Ef});$(()=>{bl()},[k,J,He,E,bl]),$(()=>{Ot.update(e.sound,e.haptics)},[Ot,e.sound,e.haptics]),$(()=>()=>Ot.destroy(),[Ot]),$(()=>{Se.current||!e.size.initialSize||(Se.current=!0,!a.loadPanelSize()&&ct(Us(e.mode,e.size,mr())))},[e.mode,e.size,a]),$(()=>{if(!R||Oe.current)return;Oe.current=!0;let P=oo(e,mr(),a.loadPanelOpen(),a.loadPanelSize());le(P.panelOpen),ct(P.panelSize)},[R,e,a]);let Jn=D(null);$(()=>{R&&b.reconcile(e.modules.list.map(P=>P.id),S())},[R,e.modules.list,b]);let To=F(P=>{!P||P.length===0||(d.value=P.map(I=>df(I,Ke.current)))},[d]),gi=D(null),Ro=F(async P=>{try{let{formSubmissions:I}=await(P?fe.bootstrap(P):gi.current??fe.bootstrap()),Q=new Map;return I.forEach((W,re)=>Q.set(W.formId,re)),I.filter((W,re)=>!W.skipped||Q.get(W.formId)===re).map((W,re)=>({key:`wire:${W.formId}:${W.createdAt??re}`,formId:W.formId,outcome:W.skipped?"skipped":"submitted",createdAt:ad(W.createdAt),values:W.values}))}catch(I){return xe.debug("bootstrap failed \u2014 no form markers (non-fatal)",{err:I}),[]}},[fe]),Tr=D(0),Zt=D(0),hi=F(P=>{if(P===c.value)return;let I=c.value;Zt.current++,m(!1),I&&(a.saveDraft(P,a.loadDraft(I)),a.saveDraft(I,""),a.saveMessageQueue(P,a.loadMessageQueue(I)),a.saveMessageQueue(I,[])),c.value=P,a.saveConversationId(P),fe.primeIdentity(void 0,P),xe.info("conversation rebound",{previous:I,current:P}),I&&n.emit("conversationRebound",{previous:I,current:P})},[n,c,a,fe]),Io=F((P,I)=>{let Q=[...P.map(G=>G.createdAt),...I.map(G=>G.createdAt)].filter(G=>G!==void 0),W=(Q.length?Math.min(...Q):Date.now())-1;return[...(Pe.current?.messages??[]).map(G=>{let ae=df(G,Ke.current);return ae.createdAt=W,ae}),...P]},[]),Pl=F(async P=>{let I=Zt.current;function Q(){return I!==Zt.current||c.value!==P}Fe.current===P&&(Fe.current=void 0),m(!0);try{let[W,re]=await Promise.all([fe.loadConversation(P),Ro()]);if(Q())return!1;let G=Pn(W.messages);x(re);let ae=Io($s(G,d.value),re);if(d.value=ae,Fe.current=ae.some(Ae=>Ae.role==="user")?void 0:P,G.length>0||W.controlState!==void 0){yt(W.canContinue),W.controlState&&Cr(W.controlState);let Ae=G.findLast(mt=>mt.role==="assistant"&&!mt.ephemeral);Be(Ae?.suggestions??[])}return!0}catch(W){return Q()||(xe.warn("loadThread failed; keeping conversation active",{err:W,conversationId:P}),n.emit("error",W),q.current.onError?.(W)),!1}finally{Q()||m(!1)}},[fe,Ro,d,c,Io,n]),Nf=F(P=>{if(Me.current===P)return Me.current=void 0,Pl(P)},[Pl]),Lf=F(()=>{if(v.current)return Promise.resolve(void 0);let P=c.value,I=d.value.find(ae=>ae.serverMessageId!==void 0),Q=I?.serverMessageId,W=I?new Date(I.createdAt).toISOString():void 0;if(!P||!Q||!W)return Promise.resolve(void 0);let re=Zt.current,G={};return v.current=G,(async()=>{try{let ae=await fe.loadConversation(P,{beforeId:Q,beforeCreatedAt:W});if(v.current!==G||Zt.current!==re||c.value!==P)return;if(ae.messages.length===0)return!1;let we=ae.messages.map(Es),Ae=d.value,mt=fd(Ae,we);if(mt!==Ae){let en=Math.min(...we.map(wt=>wt.createdAt??1/0),...y.map(wt=>wt.createdAt??1/0));if(Number.isFinite(en))for(let wt of Ae){if(!wt.ephemeral)break;(wt.createdAt??1/0)>=en&&(wt.createdAt=en-1)}d.value=mt}return!0}catch(ae){if(v.current!==G||Zt.current!==re||c.value!==P)return;xe.warn("load previous messages failed",{err:ae,conversationId:P,beforeId:Q}),n.emit("error",ae),e.onError?.(ae);return}finally{v.current===G&&(v.current=void 0)}})()},[n,c,y,d,e,fe]),Rr=F(async({newConversation:P})=>{let I=++Tr.current;function Q(){return I!==Tr.current}let W=c.value,re=P||!W?Ct():W;re!==W&&(Zt.current++,m(!1),Ut(()=>{c.value=re,_.value=re}),a.saveConversationId(re)),fe.primeIdentity(i,re);let G;try{G=await fe.handshake({visitorId:i,conversationId:re,userPrefs:a.loadUserPrefs(),locale:Co})}catch(Ae){if(Q())return;n.emit("error",Ae),e.onError?.(Ae),P||A(!0);return}if(Q())return;G.conversationId!==re&&hi(G.conversationId),$e(G.agent),G.site&&Cu(G.site)?Y(G.site):G.site&&xe.warn("invalid site config, using fallback",{site:G.site}),G.blocks&&Tu(G.blocks)?ft(G.blocks):G.blocks&&xe.warn("invalid blocks config, using fallback",{blocks:G.blocks});let ae=Qi(G.userPrefs);if(Object.keys(ae).length>0&&!P&&(a.saveUserPrefs(ae),ae.locale&&mf(ae.locale),ae.soundMuted!==void 0&&Ot.setMuted(ae.soundMuted),ae.themeMode&&gf(ae.themeMode),ae.textSize&&hf(ae.textSize)),Pe.current=G.welcome,P||n.emit("handshake",G),G.welcome?.suggestions){let Ae=Ke.current;Be(G.welcome.suggestions.map(mt=>({...mt,label:xt(Ae,mt.label),...mt.text===void 0?{}:{text:xt(Ae,mt.text)}})))}let we=!P&&W&&G.conversationId===W;p.current=!!we,we?te.current||(Me.current=G.conversationId):(Fe.current=G.conversationId,To(G.welcome?.messages),Xn(G.conversationId)),P||A(!0)},[fe,i,a,e,n,c,_,Ot,To,Co,hi,Xn]),Ir=JSON.stringify(e.userContext??null),Of=JSON.stringify(e.pageContext??null),$f=JSON.stringify(Pt);$(()=>{let P=Object.keys(Pt).length?{...Pt,...e.userContext}:e.userContext;fe.setContext(P,oP(e.pageContext))},[fe,Ir,Of,$f]),$(()=>fe.setUserToken(e.userToken),[fe,e.userToken]);let xl=F((P,I=[])=>Be(P.suggestions??I),[]);$(()=>(fe.primeIdentity(i,c.value),Rr({newConversation:!1}),()=>{Tr.current++,Zt.current++}),[]),$(()=>{!ke||!R||te.current||(te.current=!0,gi.current=fe.bootstrap(),(async()=>{try{let P=await gi.current;j(Or((P??{forms:[]}).forms,Qn))}catch(P){xe.debug("bootstrap failed \u2014 treating as no forms",{err:P})}finally{V(!0)}})(),Me.current===c.value&&m(!0))},[ke,R]);let Ar=D(null);$(()=>{if(!ke||!R||(Ar.current??(Ar.current=Qn),Ar.current===Qn))return;Ar.current=Qn;let P=!1;return fe.bootstrap().then(I=>{P||j(Or((I??{forms:[]}).forms,Qn))}).catch(I=>xe.debug("forms re-localize failed \u2014 keeping current copy",{err:I})),()=>{P=!0}},[ke,R,Qn,fe]);let Sl=D(Ir);$(()=>{!R||Sl.current===Ir||(Sl.current=Ir,Rr({newConversation:!1}))},[Ir,R,Rr]),X_({hostElement:t,mode:e.mode,panelSize:Te,isOpen:J,surfaceReady:R,setIsOpen:le});let{sendAiTurn:_n,sendRoutedTurn:Yn}=lf({transport:fe,messagesSig:d,conversationIdSig:c,options:e,bus:n,feedback:Ot,persistence:a,visitorId:i,adoptConversationId:hi,applyControlState:Cr,setCanSend:yt,settleSuggestions:xl,runCancellation:dn}),{toolInteraction:Df,pageToolsRunning:vi,stopPageTools:kl}=j_({streaming:C,controlModeSig:Kt,messagesSig:d,sendAiTurn:_n,bus:n,humanInLoop:e.features.humanInLoop,tools:e.tools}),Ff=F((P,I)=>{let Q=d.value.find(W=>W.serverMessageId===P);Q&&(Q.feedback=I),xe.info("messageFeedback",{messageId:P,value:I}),n.emit("messageFeedback",{messageId:P,value:I}),fe.submitFeedback({messageId:P,value:I})},[n,d,fe]);function Bf(){return d.value.reduce((P,I)=>P+(I.role==="user"?1:0),0)}let Zn=e.forms.list.length>0?e.forms:L??e.forms,We=Id({forms:Zn,persistence:a,userContext:()=>e.userContext,messageCount:Bf,pageArea:()=>e.pageContext?.area?String(e.pageContext.area):void 0,conversationId:()=>c.value,onComplete:(P,I,Q,W)=>{xe.info("formSubmit",{formId:P.id,trigger:I,skipped:W}),n.emit("formSubmit",{formId:P.id,values:Q,skipped:W}),x(G=>{let we=G.find(Ae=>Ae.formId===P.id&&Ae.outcome==="skipped")?.createdAt??Date.now();return[...G.filter(Ae=>!(Ae.formId===P.id&&Ae.outcome==="skipped")),{key:`local:${P.id}:${we}`,formId:P.id,outcome:W?"skipped":"submitted",createdAt:we,...W?{}:{values:Q}}]});let re=c.value??Ct();c.value||(c.value=re,a.saveConversationId(re),fe.primeIdentity(void 0,re)),!W&&P.mirrorToContext&&Tn(G=>({...G,...Q})),fe.submitForm({formId:P.id,conversationId:re,trigger:I,values:Q,skipped:W})}}),wl=It(()=>We.activeForm.value),Ao=wl.value?.form.blocking??!1,Uf=F(()=>We.fire("after-messages"),[We]),qf=F(()=>p.current||d.value.some(P=>!P.ephemeral&&P.role==="user"),[d]);tf({activated:ke,conversationReady:R,conversationIdSig:c,messagesSig:d,optionsRef:q,transport:fe,visitorId:i,adoptControlStateChunk:kf,adoptMemoryCompactionStateChunk:Tf,settleSuggestions:xl,recordConversationReply:Af,transcriptRecoverySig:If,beginConversationTranscript:mi,commitConversationTranscript:Xn,onReplyLanded:Uf,runCancellation:dn,canContinueRef:O,setCanSend:yt,feedback:Ot,bus:n,loadInitialThread:Nf,shouldReconcileOnConnect:qf,reconnectingSig:u}),$(()=>{We.refresh()},[Zn,We]);let Cl=e.pageContext?.area?String(e.pageContext.area):void 0,Hf=It(()=>d.value.length),Eo=D(null);$(()=>{!B||!Eo.current||(We.fire("manual",Eo.current),Eo.current=null)},[B,We]),$(()=>{R&&B&&We.fire("pre-chat")},[R,B,We]),$(()=>{B&&!Ve&&We.fire("conversation-closed")},[B,Ve,We]),$(()=>{R&&B&&Cl&&We.fire("page-area")},[R,B,Cl,We]);let bi=se(()=>{let P=Zn.list.flatMap(I=>I.triggers).filter(I=>I.kind==="idle").map(I=>Number(I.param));return P.length?Math.min(...P)*1e3:0},[Zn]);$(()=>{if(!bi||!J)return;let P=setTimeout(()=>We.fire("idle"),bi);return()=>clearTimeout(P)},[bi,J,We,Hf.value]);let er=F(async(P,I,Q)=>{if(ne.current)return!1;let W=c.value,re=W?pn.value.get(W):void 0,G=Kt.value!=="ai-agent";if(!G&&re?.status==="compacting"||(xe.info("send",{textLen:P.length,attachments:I.length,streaming:oe.current,routedToOperator:G}),oe.current&&!G))return!1;let ae=new AbortController,we={conversationId:W,controller:ae};ne.current=we,Re(!0);try{Ot.unlock();let Ae=await iP(fe,I,ae.signal,fn=>{ae.signal.aborted||(xe.warn("upload failed",{err:fn}),n.emit("error",fn),e.onError?.(fn))});if(ae.signal.aborted||c.value!==W||!O.current||We.activeForm.value?.form.blocking)return!1;let mt=W?pn.value.get(W):void 0,en=Kt.value!=="ai-agent";if(!en&&mt?.status==="compacting"||oe.current&&!en||!P&&Ae.length===0)return!1;n.emit("send",{text:P,attachmentCount:I.length}),ye.length>0&&Be([]),Ot.play("messageSent");let wt=As(P,Ae,Q);return fr(n,e,"user",P),en?(d.value=[...d.value,wt],Q?await Yn(wt):(Yn(wt),!0)):(d.value=[...d.value,wt,sn()],Q?await _n({continueExisting:!1}):(_n({continueExisting:!1}),!0))}finally{ne.current===we&&(ne.current=null,Re(!1))}},[fe,n,e,ye.length,d,c,pn,_n,Yn,Kt]),Tl=D(er);Tl.current=er;let Rl=c.value,Il=(Rl?pn.value.get(Rl):void 0)?.status==="compacting",yi=Kt.value==="ai-agent",Al=It(()=>{let P=d.value.at(-1);return P?.role==="assistant"&&P.partsSig.value.some(I=>I.kind==="tool"&&I.stateSig.value==="approval-requested")}),El=It(()=>d.value.some(P=>P.retryAction?.kind==="resend-user"||P.retryAction?.kind==="continue-assistant"));Tt(()=>{let P=c.value;return()=>{let I=ne.current;!I||I.conversationId!==P||(ne.current=null,Re(!1),I.controller.abort())}},[c.value]),$(()=>{Ve&&!Ao||ne.current?.controller.abort()},[Ao,Ve]);let zf=F(()=>{if(vi){xe.info("stop page tools"),n.emit("stop",void 0),kl();return}if(!dn.stop())return;xe.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])},[dn,n,d,vi,kl]),jf=F(P=>{if(C)return;let I=d.value,Q=Na(I,P);if(Q)switch(xe.info("retry",{kind:Q.kind,messageId:Q.messageId}),Q.kind){case"continue-assistant":{if(Kt.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],_n({continueExisting:!0,turn:P});return}case"resend-user":{let W=I.find(ae=>ae.role==="user"&&ae.id===Q.messageId);if(!W)return;let re=ae=>{ae&&Jn.current?.acceptQueuedMessage(Q.messageId)};if(W.status="complete",W.errorText=void 0,W.retryAction=void 0,Kt.value!=="ai-agent"){d.value=P.role==="assistant"?I.filter(ae=>ae!==P):[...I],Yn(W).then(re);return}let G=sn();d.value=P.role==="assistant"?I.map(ae=>ae===P?G:ae):[...I,G],_n({continueExisting:!1,turn:W}).then(re);return}case"repeat-user":{let W=I.find(we=>we.role==="user"&&we.id===Q.messageId);if(!W)return;let re=As(Je(W),W.attachments?.map(we=>({...we}))??[]),G=new Set(re.attachments?.flatMap(we=>we.url?[we.url]:[])??[]),ae=W.partsSig.value.flatMap(we=>we.kind==="file"&&!G.has(we.url)?[{...we}]:[]);if(ae.length>0&&(re.partsSig.value=[...re.partsSig.value,...ae]),Kt.value!=="ai-agent"){d.value=[...I,re],Yn(re);return}d.value=[...I,re,sn()],_n({continueExisting:!1,turn:re});return}default:return Q}},[C,d,Kt,_n,Yn]),Er=F(()=>{if(Rd(e.mode,Te)==="exit-fullscreen"){xe.info("close \u2192 exit-fullscreen",{mode:e.mode}),ct("normal"),n.emit("fullscreen",!1);return}xe.info("close \u2192 panel closed",{mode:e.mode}),We.fire("panel-close"),le(!1),a.savePanelOpen(!1),n.emit("close",void 0),e.onClose?.()},[n,e,a,Te,We]),Rn=F(()=>{xe.info("open",{mode:e.mode}),Ot.unlock(),Ft(!0),le(!0),a.savePanelOpen(!0),!ot&&!Mt&&ht(),setTimeout(()=>Ft(!1),aP),n.emit("open",void 0),e.onOpen?.()},[n,e,Ot,a,ot,Mt,ht]),Pi=F(()=>{let P=d.value.some(I=>I.role==="user");if(Fe.current===c.value&&!P&&Ve&&c.value){xe.info("clear \u2192 reusing empty conversation",{conversationId:c.value}),d.value.length===0&&To(Pe.current?.messages);return}return xe.info("clear \u2192 new conversation",{wasStreaming:C}),n.emit("clear",void 0),dn.settle(),p.current=!1,Me.current=void 0,Fe.current=void 0,Ut(()=>{d.value=[],c.value=void 0,Cr({controlMode:"ai-agent",controlRevision:0})}),a.clearConversation(),yt(!0),x([]),Be([]),Rr({newConversation:!0})},[C,d,c,a,Rr,n,Ve,To,dn,Cr]),Mo=F(()=>{let P=Pi();ze("chat");let I=e.modules.list.find(Q=>Q.layout==="chat")?.id;return I&&b.switchTab(I),P},[Pi,b,e]),Vf=F(async P=>{await Mo(),await Tl.current(P,[])||Jn.current?.fill(P)},[Mo]),xi=F(()=>{let P=Te==="expanded"?"normal":"expanded";xe.info("expand",{from:Te,expanded:P==="expanded"}),ct(P),a.savePanelSize(P),n.emit("expand",P==="expanded")},[n,Te,a]),Si=F(()=>{let P=Te==="fullscreen"?"normal":"fullscreen";xe.info("fullscreen",{from:Te,fullscreen:P==="fullscreen"}),ct(P),a.savePanelSize(P),n.emit("fullscreen",P==="fullscreen")},[n,Te,a]),Wf=F(()=>{ze(P=>{let I=P==="history"?"chat":"history";return xe.info("toggleHistory",{view:I}),n.emit("toggleHistory",{view:I}),I})},[n]),Gf=F(()=>{Cn(P=>{let I=!P;return xe.info("sidebarToggle",{collapsed:I}),a.saveSidebarCollapsed(I),n.emit("sidebarToggle",{collapsed:I}),I})},[a,n]),Kf=F(P=>{xe.info("resize",P),hl({widgetSize:P}),n.emit("resize",P)},[hl,n]),Qf=F(async P=>{let I=P.conversationId;if(I===c.value&&yl(I)){xe.info("selectConversation",{conversationId:I,cached:!0}),n.emit("selectConversation",{conversationId:I}),fe.publishConversation(P),ze("chat");let G=w();G&&b.switchTab(G),Xn(I);return}let W=++Tr.current;Zt.current++,m(!1);function re(){return W!==Tr.current}xe.info("selectConversation",{conversationId:I,wasStreaming:C}),n.emit("selectConversation",{conversationId:I}),fe.publishConversation(P);try{let[G,ae]=await Promise.all([fe.loadConversation(I),Ro(I)]);if(re())return;dn.settle(),p.current=!0,Me.current=void 0;let we=Pn(G.messages),Ae=G.conversationId!==c.value,mt=Ae?we:$s(we,d.value);Fe.current=mt.some(fn=>fn.role==="user")?void 0:G.conversationId,Ut(()=>{d.value=Io(mt,ae),Ae&&(_.value=G.conversationId),c.value=G.conversationId}),x(ae),a.saveConversationId(G.conversationId),fe.primeIdentity(i,G.conversationId),yt(G.canContinue),G.controlState&&Cr(G.controlState);let en=mt.findLast(fn=>fn.role==="assistant"&&!fn.ephemeral);Be(en?.suggestions??[]),Ae?mi(G.conversationId):Xn(G.conversationId),ze("chat");let wt=w();wt&&b.switchTab(wt)}catch(G){if(re())return;n.emit("error",G),e.onError?.(G)}},[fe,d,c,_,n,e,a,Ro,Io,C,i,dn,mi,Xn,yl,b]),Ml=F(P=>{if(typeof P!="string")return;J||Rn(),ze("chat");let I=w();I&&b.switchTab(I),B?We.fire("manual",P):Eo.current=P},[J,Rn,e.modules,b,B,We]),No=D(void 0),Lo=F(P=>{let I=e.modules.list.find(W=>W.layout===rP[P.to]);if(!I){xe.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;b.open(I.id,Q)},[e.modules,b]),Nl=F(P=>{if(J||Rn(),P!==void 0){if(!mu(P)){xe.warn("open: unknown target",{detail:P});return}R?Lo(P):No.current=P}},[J,Rn,R,Lo]);$(()=>{!R||!No.current||(Lo(No.current),No.current=void 0)},[R,Lo]);let Ll=R&&!f&&!Ao&&(!yi||!Al.value&&!El.value),[In,ki]=U(),Ol=F(P=>{let I=gu(P);if(!I){xe.warn("ask: expected { text, send? } with non-empty text",{detail:P});return}J||Rn(),ki(I)},[J,Rn]),wi=J&&B&&Ve&&R&&!f&&!Ao,$l=wi&&Ll&&!_e&&!(yi&&(C||Il));$(()=>{if(In===void 0||!(In.send?$l:wi))return;let P=w();if(!P){xe.warn("ask: the widget has no chat"),ki(void 0);return}if(He!=="chat"||!h()){ze("chat"),b.switchTab(P);return}if(ki(void 0),!In.send){Jn.current?.fill(In.text);return}er(In.text,[]).then(I=>{I||Jn.current?.fill(In.text)})},[In,wi,$l,He,k,e.modules,b,er]),$(()=>{if(e.widgetId!=="default")return;let P=`data-${N.cssPrefix}-`,I=["ask","open","close","form"].map(W=>P+W);function Q(W){let re=W.composedPath().find(Ae=>Ae instanceof Element&&I.some(mt=>Ae.hasAttribute(mt)));if(!(re instanceof Element))return;W.preventDefault();let G=re.getAttribute(`${P}ask`),ae=re.getAttribute(`${P}open`),we=re.getAttribute(`${P}form`);G!==null?$t(t,"ask",zr(G||(re.textContent??""),{send:re.hasAttribute(`${P}send`)})):ae!==null?$t(t,"open",oa(ae)):we!==null?$t(t,"openForm",we):$t(t,"close")}return document.addEventListener("click",Q),()=>document.removeEventListener("click",Q)},[e.widgetId,t]),$(()=>{if(e.widgetId!=="default")return;let P=bu(location.href);P&&(history.replaceState(history.state,"",P.url),P.ask?$t(t,"ask",zr(P.ask)):$t(t,"open",P.target))},[e.widgetId,t]);let Dl=D(jr),Fl=e.mode==="page"||e.mode==="inline"||e.mode==="standalone";$(()=>jt(()=>{let P=c.value,I={open:Fl||J,ready:R,unread:vl.value,...P?{conversationId:P}:{}},Q=Dl.current;I.open===Q.open&&I.ready===Q.ready&&I.unread===Q.unread&&I.conversationId===Q.conversationId||(Dl.current=I,n.emit("state",I),I.unread!==Q.unread&&n.emit("unread",I.unread))}),[n,Fl,J,R,vl,c]);let An=D({handleOpenCommand:Nl,handleClose:Er,handleExpand:xi,handleFullscreen:Si,openForm:Ml,handleAskCommand:Ol});An.current={handleOpenCommand:Nl,handleClose:Er,handleExpand:xi,handleFullscreen:Si,openForm:Ml,handleAskCommand:Ol},Tt(()=>vu(t,{open:P=>An.current.handleOpenCommand(P),close:()=>An.current.handleClose(),expand:()=>An.current.handleExpand(),fullscreen:()=>An.current.handleFullscreen(),openForm:P=>An.current.openForm(P),ask:P=>An.current.handleAskCommand(P)}),[t]);let vt=se(()=>Vi(e,Co,ml,gl),[e,Co,ml,gl]);Ke.current=vt.strings;let Xf=se(()=>y.map(P=>{let I=Zn.list.find(Q=>Q.id===P.formId);return{...P,title:I?.title,form:I}}),[y,Zn]);function Ci(P){Qf(P)}let Bl={options:vt,transport:fe,feedback:Ot,bus:n,persistence:a,conversationId:c.value??"",composerKey:_.value,composerApiRef:Jn,view:He,canSend:Ve,isStreaming:C,pageToolRunning:vi,isMemoryCompacting:Il,canReleaseQueuedMessages:Ll,queueManualMessages:yi&&(Al.value||El.value),sendPreparing:_e,composerActive:vt.mode==="page"||vt.mode==="inline"||vt.mode==="standalone"||J,controlMode:Kt.value,assignedOperatorInitials:xf.value,operatorAvailable:Sf.value,operatorRequestEnabled:e.features.operatorRequest,onRequestOperator:wf,onCancelOperatorRequest:Cf,loadingMessages:f,onLoadPreviousMessages:Lf,messagesSig:d,reconnectingSig:u,agent:Ie,suggestions:ye,initialWidgetSize:s.widgetSize??null,onClose:Er,onClear:Pi,onExpand:xi,onFullscreen:Si,onSoundToggle:Pf,onToggleHistory:Wf,onSelectHistoryConversation:Ci,onNewConversation:Mo,onLocaleChange:vf,onThemeChange:bf,onTextSizeChange:yf,onWidgetSizeChange:Kf,onSend:er,onStop:zf,onSuggestion:P=>{if(ne.current)return;let I=P.text??P.label;xe.info("suggestion",{text:I,autoSend:e.autoSendSuggestions}),n.emit("suggestion",{text:I}),e.autoSendSuggestions?er(I,[]):Jn.current?.fill(I)},activeForm:wl.value?.form??null,formMarkers:Xf,onFormSubmit:We.complete,onFormSkip:We.skip,onFormFill:P=>We.fire("manual",P),tool:Df,onRetry:jf,onMessageFeedback:Ff};if(!R)return null;let Mr=vt.modules.list;function Ti(P){let I=_r("close",vt.mode,P);return Mr.length===0?l(B_,{strings:vt.strings,onClose:I?Er:void 0}):Mr.length===1&&Mr[0]?.layout==="chat"?l(D_,{...Bl,panelSize:P}):l(F_,{panelProps:{...Bl,panelSize:P,onClose:I?Er:void 0},enabledModules:Mr,nav:b,bus:n,hasUnread:Rf.value,latestNews:Mf,onSelectConversation:Ci,onStartNewConversation:Vf,onSetPanelSize:ct})}if(e.mode==="page"){let P=e.history.enabled&&Mr.some(I=>I.layout==="chat");return l("div",{class:`${_i}-anchor`,children:l(H_,{site:K,blocks:ge,transport:fe,strings:vt.strings,locale:vt.locale,persistence:a,showConversations:P,onSelectConversation:Ci,onNewConversation:Mo,sidebarCollapsed:Lt,onToggleSidebarCollapsed:Gf,children:Ti("fullscreen")})})}if(X){let P=e.mode==="standalone"?"fullscreen":Te;return l("div",{class:`${_i}-anchor`,children:Ti(P)})}let Ul=e.mode==="drawer",ql=!(e.mode==="modal")&&!e.launcher.hidden&&(!J||lt),Hl=ql&&!lt&&!ot&&!Ul?vt.launcher.callout:null;return l("div",{class:`${_i}-anchor`,"data-launcher-size":vt.launcher.size,children:[J||ke?l("div",{class:`${_i}-surface`,hidden:!J,children:Ti(Te)}):null,ql?l(_p,{onToggle:Rn,launcher:vt.launcher,strings:vt.strings,leaving:lt,edgeTab:Ul}):null,Hl?l(fp,{callout:Hl,launcherPosition:vt.position,strings:vt.strings,closeLabel:vt.strings.close,onDismiss:ht}):null]})}function oP(e){let t=e?.url??(typeof location<"u"?location.href:void 0);if(!(!e&&!t))return{...e,...t?{url:t}:{}}}var aP=120;async function iP(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 sP=ce.scope("error-boundary"),fi=class extends Bt{constructor(){super(...arguments);ee(this,"state",{crashed:!1})}componentDidCatch(n,r){sP.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 _f(e){let{bus:t,host:n,appRoot:r,persistence:o,reportError:a}=e,i=e.initialRaw,s,c=nr(i),p=!0,_=0,d=Ac(t);function u(){c=nr(s?Wi(i,s):i)}function f(){jc(n,Xo(c.mode));let x=o.loadUserPrefs().themeMode;Wc(n,x?{...c,themeMode:x}:c),p&&(Jo(n,lP(c)),p=!1)}function m(){f(),vn(hn(fi,{onError:a},hn(pf,{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=Nc(t,{getOptions:()=>c,getVisitorId:()=>o.getVisitorId(),getConversationId:()=>o.loadConversationId()});function y(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 S="userToken"in x&&x.userToken!==i.userToken;if(S&&i.userToken){y(x);return}S&&(_+=1),i={...i,...x},u(),m()},reset:()=>y(),destroy:()=>v()}}function lP(e){if(e.mode==="standalone")return"standalone";if(e.mode==="inline")return"inline";let t=or(e.widgetId,e.storage,e.aiAgentDeploymentId),{panelOpen:n,panelSize:r}=oo(e,mr(),t.loadPanelOpen(),t.loadPanelSize());return $a(e.mode,r,n)}var fl=class extends HTMLElement{constructor(){super(...arguments);ee(this,"bus",new ia);ee(this,"widgetState",jr);ee(this,"userToken");ee(this,"pageTools",[]);ee(this,"markReady",()=>{});ee(this,"ready",new Promise(n=>{this.markReady=n}));ee(this,"mountResult",null);ee(this,"runtime",null)}static get observedAttributes(){return Gi}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,vn(null,this.mountResult.appRoot),this.bus.clear(),this.widgetState=jr)}attributeChangedCallback(){this.isConnected&&this.boot()}open(n){$t(this,"open",n)}close(){$t(this,"close")}expand(){$t(this,"expand")}openForm(n){$t(this,"openForm",n)}ask(n,r){$t(this,"ask",zr(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=Ic(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){u_(n,r)}on(n,r){return this.bus.on(n,r)}boot(){let n={...Ki(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=nr(n);this.mountResult??(this.mountResult=Vc({existingHost:this,position:Xo(r.mode)}));let o=or(r.widgetId,r.storage,r.aiAgentDeploymentId);this.bus.on("state",a=>{this.widgetState=a,a.ready&&this.markReady()}),this.runtime=_f({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()}},ff=!1;function cP(){if(ff||typeof customElements>"u")return;let e=N.tagName;customElements.get(e)||customElements.define(e,fl),ff=!0}typeof customElements<"u"&&cP();export{cP as registerWebComponent};
64
65
  //# sourceMappingURL=elements-web-component.esm.js.map