@helpai/elements 1.3.4 → 1.3.5

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.
@@ -4,7 +4,7 @@ var Qu=Object.defineProperty;var Xu=(e,t,n)=>t in e?Qu(e,t,{enumerable:!0,config
4
4
  `;var Ts=`.__P__-standalone-page{margin:0;height:100vh;background:var(--__P__-bg, #fff);display:grid;place-items:stretch}
5
5
  `;var Is=`:host([data-mode="page"]){min-height:0}:host([data-mode="page"]) .__P__-page-shell{display:grid;grid-template-columns:280px 1fr;width:100%;height:100%;min-height:0;background:var(--__P__-bg);color:var(--__P__-fg);transition:grid-template-columns var(--__P__-dur-base) var(--__P__-ease-in-out)}:host([data-mode="page"]) .__P__-page-shell[data-sidebar-collapsed=true]{grid-template-columns:48px 1fr}:host([data-mode="page"]) .__P__-page-chat{display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden}:host([data-mode="page"]) .__P__-anchor{position:static;inset:auto;padding:0;align-items:stretch;width:100%;height:100%;min-width:0;min-height:0;flex:1 1 0}:host([data-mode="page"]) .__P__-panel{width:100%;height:100%;min-width:0;min-height:0;max-width:none;max-height:none;border-radius:0;border:0;box-shadow:none;animation:none}:host([data-mode="page"]) .__P__-sidebar{border-inline-end:1px solid var(--__P__-border);display:flex;flex-direction:column;overflow:hidden;background:var(--__P__-surface)}:host([data-mode="page"]) .__P__-sidebar-header{padding:var(--__P__-space-4) var(--__P__-space-5);border-bottom:1px solid var(--__P__-border);display:flex;align-items:center;justify-content:space-between;gap:var(--__P__-space-2);min-height:56px;box-sizing:border-box}:host([data-mode="page"]) .__P__-sidebar[data-collapsed=true] .__P__-sidebar-header{padding:var(--__P__-space-4) var(--__P__-space-2);justify-content:center}:host([data-mode="page"]) .__P__-sidebar[data-collapsed=true] .__P__-sidebar-logo,:host([data-mode="page"]) .__P__-sidebar[data-collapsed=true] .__P__-sidebar-title{display:none}:host([data-mode="page"]) .__P__-sidebar-toggle{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:1px solid var(--__P__-border);border-radius:6px;background:transparent;color:var(--__P__-fg);cursor:pointer;transition:background .12s,border-color .12s}:host([data-mode="page"]) .__P__-sidebar-toggle:hover{background:var(--__P__-hover);border-color:var(--__P__-accent)}:host([data-mode="page"]) .__P__-sidebar-toggle:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px}:host([data-mode="page"]) .__P__-sidebar-logo{height:32px;display:block}:host([data-mode="page"]) .__P__-sidebar-title{font-size:var(--__P__-text-md);font-weight:600}:host([data-mode="page"]) .__P__-sidebar-section{padding:var(--__P__-space-3) var(--__P__-space-4);border-bottom:1px solid var(--__P__-border)}:host([data-mode="page"]) .__P__-sidebar-nav{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:2px}:host([data-mode="page"]) .__P__-sidebar-nav-item{display:flex;align-items:center;gap:10px;padding:var(--__P__-space-2) var(--__P__-space-3);border-radius:var(--__P__-radius-sm);color:var(--__P__-fg);text-decoration:none;font-size:calc(14px * var(--__P__-text-scale));transition:background var(--__P__-dur-quick) var(--__P__-ease-out)}:host([data-mode="page"]) .__P__-sidebar-nav-item:hover{background:var(--__P__-hover)}:host([data-mode="page"]) .__P__-sidebar-nav-item:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:-2px}:host([data-mode="page"]) .__P__-sidebar-cards{display:grid;grid-template-columns:1fr;gap:var(--__P__-space-2)}:host([data-mode="page"]) .__P__-sidebar-card{display:block;padding:10px 12px;border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-sm);text-decoration:none;color:var(--__P__-fg);transition:border-color var(--__P__-dur-quick) var(--__P__-ease-out)}:host([data-mode="page"]) .__P__-sidebar-card:hover{border-color:var(--__P__-accent)}:host([data-mode="page"]) .__P__-sidebar-card:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}:host([data-mode="page"]) .__P__-sidebar-card-label{font-weight:600;font-size:calc(14px * var(--__P__-text-scale))}:host([data-mode="page"]) .__P__-sidebar-card-desc{font-size:var(--__P__-text-xs);color:var(--__P__-muted);margin-top:2px}:host([data-mode="page"]) .__P__-sidebar-conversations{flex:1 1 auto;overflow-y:auto;padding:var(--__P__-space-3) var(--__P__-space-4)}:host([data-mode="page"]) .__P__-page-chat{display:flex;flex-direction:column;overflow:hidden}@media(max-width:768px){:host([data-mode="page"]) .__P__-page-shell{grid-template-columns:1fr}:host([data-mode="page"]) .__P__-sidebar{display:none}}
6
6
  `;var G_="helpai",K_="#5B5BD6",j_="#FFFFFF",Q_="12px",X_="Inter, system-ui, -apple-system, 'Segoe UI', sans-serif",Pa=[ws,Cs,Rs,Ts,Is].join(`
7
- `).replace(/__P__/g,G_).replaceAll("__BRAND_ACCENT_TEXT__",j_).replaceAll("__BRAND_ACCENT__",K_).replaceAll("__BRAND_RADIUS__",Q_).replaceAll("__BRAND_FONT__",X_);var Y_=se.scope("mount"),Es=new WeakMap,As={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 Ms(e,t){e.style.cssText=As[t]}function Ho(e){return e==="floating"||e==="modal"||e==="drawer"?"floating":e==="standalone"||e==="page"?"viewport":"flow"}function Ls(e={}){let t=e.position??"flow";Y_.debug("createShadowMount",{position:t,hasTarget:!!e.target,hasHost:!!e.existingHost});let n=`${T.cssPrefix}-chat-host`;typeof customElements<"u"&&!customElements.get(n)&&customElements.define(n,class extends HTMLElement{});let o;e.existingHost?o=e.existingHost:(o=document.createElement(n),(e.target??document.body).appendChild(o)),o.setAttribute("data-brand",T.id),o.style.cssText=As[t];let r=o.shadowRoot??o.attachShadow({mode:"open"}),a=o.ownerDocument;if(!J_(r,a)){let l=a.createElement("style");l.textContent=Pa,r.appendChild(l)}let s=document.createElement("div");return s.className=`${T.cssPrefix}-app`,r.appendChild(s),{appRoot:s,destroy:()=>o.remove(),hostElement:o,shadowRoot:r}}function J_(e,t){if(!("adoptedStyleSheets"in e))return!1;let n=t.defaultView;if(!n||typeof n.CSSStyleSheet!="function")return!1;let o=Es.get(t);if(!o)try{o=new n.CSSStyleSheet,o.replaceSync(Pa),Es.set(t,o)}catch{return!1}try{return e.adoptedStyleSheets=[o],!0}catch{return!1}}function Z_(e,t){let n=T.cssPrefix;t.accent&&e.style.setProperty(`--${n}-accent-user`,t.accent),t.accentText&&e.style.setProperty(`--${n}-accent-text-user`,t.accentText),t.radius&&e.style.setProperty(`--${n}-radius`,t.radius),t.fontFamily&&e.style.setProperty(`--${n}-font`,t.fontFamily),t.contentMaxWidth&&e.style.setProperty(`--${n}-conversation-max`,t.contentMaxWidth)}function ep(e,t){e.dataset.theme=t}function tp(e,t){let n=T.cssPrefix;t.width!==void 0&&e.style.setProperty(`--${n}-panel-w`,t.width),t.height!==void 0&&e.style.setProperty(`--${n}-panel-h`,t.height),t.expanded?.width!==void 0&&e.style.setProperty(`--${n}-expanded-w`,t.expanded.width),t.expanded?.height!==void 0&&e.style.setProperty(`--${n}-expanded-h`,t.expanded.height),t.inset!==void 0&&e.style.setProperty(`--${n}-panel-inset`,t.inset)}function np(e,t){e.dataset.position=t}function zo(e,t){e.dataset.mode=t}function Os(e,t){ep(e,t.themeMode),Z_(e,t.themeOverrides),np(e,t.position),tp(e,t.size)}var Cn,Ne,xa,Ns,Jn=0,qs=[],Be=J,Ds=Be.__b,$s=Be.__r,Fs=Be.diffed,Bs=Be.__c,Us=Be.unmount,Hs=Be.__;function Vo(e,t){Be.__h&&Be.__h(Ne,e,Jn||t),Jn=0;var n=Ne.__H||(Ne.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function $(e){return Jn=1,Vs(Ws,e)}function Vs(e,t,n){var o=Vo(Cn++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):Ws(void 0,t),function(l){var c=o.__N?o.__N[0]:o.__[0],d=o.t(c,l);c!==d&&(o.__N=[d,o.__[1]],o.__c.setState({}))}],o.__c=Ne,!Ne.__f)){var r=function(l,c,d){if(!o.__c.__H)return!0;var _=!1,p=o.__c.props!==l;if(o.__c.__H.__.some(function(g){if(g.__N){_=!0;var m=g.__[0];g.__=g.__N,g.__N=void 0,m!==g.__[0]&&(p=!0)}}),a){var u=a.call(this,l,c,d);return _?u||p:u}return!_||p};Ne.__f=!0;var a=Ne.shouldComponentUpdate,s=Ne.componentWillUpdate;Ne.componentWillUpdate=function(l,c,d){if(this.__e){var _=a;a=void 0,r(l,c,d),a=_}s&&s.call(this,l,c,d)},Ne.shouldComponentUpdate=r}return o.__N||o.__}function M(e,t){var n=Vo(Cn++,3);!Be.__s&&ka(n.__H,t)&&(n.__=e,n.u=t,Ne.__H.__h.push(n))}function Ct(e,t){var n=Vo(Cn++,4);!Be.__s&&ka(n.__H,t)&&(n.__=e,n.u=t,Ne.__h.push(n))}function O(e){return Jn=5,ne(function(){return{current:e}},[])}function ne(e,t){var n=Vo(Cn++,7);return ka(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function L(e,t){return Jn=8,ne(function(){return e},t)}function op(){for(var e;e=qs.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(qo),t.__h.some(Sa),t.__h=[]}catch(n){t.__h=[],Be.__e(n,e.__v)}}}Be.__b=function(e){Ne=null,Ds&&Ds(e)},Be.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Hs&&Hs(e,t)},Be.__r=function(e){$s&&$s(e),Cn=0;var t=(Ne=e.__c).__H;t&&(xa===Ne?(t.__h=[],Ne.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(qo),t.__h.some(Sa),t.__h=[],Cn=0)),xa=Ne},Be.diffed=function(e){Fs&&Fs(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(qs.push(t)!==1&&Ns===Be.requestAnimationFrame||((Ns=Be.requestAnimationFrame)||rp)(op)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),xa=Ne=null},Be.__c=function(e,t){t.some(function(n){try{n.__h.some(qo),n.__h=n.__h.filter(function(o){return!o.__||Sa(o)})}catch(o){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Be.__e(o,n.__v)}}),Bs&&Bs(e,t)},Be.unmount=function(e){Us&&Us(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(o){try{qo(o)}catch(r){t=r}}),n.__H=void 0,t&&Be.__e(t,n.__v))};var zs=typeof requestAnimationFrame=="function";function rp(e){var t,n=function(){clearTimeout(o),zs&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);zs&&(t=requestAnimationFrame(n))}function qo(e){var t=Ne,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Ne=t}function Sa(e){var t=Ne;e.__c=e.__(),Ne=t}function ka(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function Ws(e,t){return typeof t=="function"?t(e):t}var ap=Symbol.for("preact-signals");function jo(){if($t>1)$t--;else{var e,t=!1;for((function(){var r=Go;for(Go=void 0;r!==void 0;){var a=r.S;if(a.v===r.v)for(var s=a.t;s!==void 0;s=s.x)s.i===r.i&&(s.i=a.i);r=r.o}})();eo!==void 0;){var n=eo;for(eo=void 0,Wo++;n!==void 0;){var o=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Ks(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if(Wo=0,$t--,t)throw e}}function xt(e){if($t>0)return e();wa=++ip,$t++;try{return e()}finally{jo()}}var Zn,Ae=void 0;function to(e){var t=Ae,n=Zn;Ae=void 0,Zn=void 0;try{return e()}finally{Ae=t,Zn=n}}var eo=void 0,$t=0,Wo=0,ip=0,wa=0,Go=void 0,Ko=0;function Gs(e){if(Ae!==void 0){var t=e.n;if(t===void 0||t.t!==Ae)return t={i:0,S:e,p:Ae.s,n:void 0,t:Ae,e:void 0,x:void 0,r:t},Ae.s!==void 0&&(Ae.s.n=t),Ae.s=t,e.n=t,32&Ae.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=Ae.s,t.n=void 0,Ae.s.n=t,Ae.s=t),t}}function Qe(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}Qe.prototype.brand=ap;Qe.prototype.h=function(){return!0};Qe.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:to(function(){var o;(o=t.W)==null||o.call(t)}))};Qe.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,o=e.x;n!==void 0&&(n.x=o,e.e=void 0),o!==void 0&&(o.e=n,e.x=void 0),e===this.t&&(this.t=o,o===void 0&&to(function(){var r;(r=t.Z)==null||r.call(t)}))}};Qe.prototype.subscribe=function(e){var t=this;return Ft(function(){var n=t.value;to(function(){return e(n)})},{name:"sub"})};Qe.prototype.valueOf=function(){return this.value};Qe.prototype.toString=function(){return this.value+""};Qe.prototype.toJSON=function(){return this.value};Qe.prototype.peek=function(){var e=this;return to(function(){return e.value})};Object.defineProperty(Qe.prototype,"value",{get:function(){var e=Gs(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Wo>100)throw new Error("Cycle detected");(function(n){$t!==0&&Wo===0&&n.l!==wa&&(n.l=wa,Go={S:n,v:n.v,i:n.i,o:Go})})(this),this.v=e,this.i++,Ko++,$t++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{jo()}}}});function ee(e,t){return new Qe(e,t)}function Ks(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 js(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 Qs(e){for(var t=e.s,n=void 0;t!==void 0;){var o=t.p;t.i===-1?(t.S.U(t),o!==void 0&&(o.n=t.n),t.n!==void 0&&(t.n.p=o)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=o}e.s=n}function on(e,t){Qe.call(this,void 0,t),this.x=e,this.s=void 0,this.g=Ko-1,this.f=4}on.prototype=new Qe;on.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Ko))return!0;if(this.g=Ko,this.f|=1,this.i>0&&!Ks(this))return this.f&=-2,!0;var e=Ae;try{js(this),Ae=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 Ae=e,Qs(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)}Qe.prototype.S.call(this,e)};on.prototype.U=function(e){if(this.t!==void 0&&(Qe.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=Gs(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function ge(e,t){return new on(e,t)}function Xs(e){var t=e.m;if(e.m=void 0,typeof t=="function"){$t++;var n=Ae;Ae=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,Ca(e),o}finally{Ae=n,jo()}}}function Ca(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Xs(e)}function sp(e){if(Ae!==this)throw new Error("Out-of-order effect");Qs(this),Ae=e,this.f&=-2,8&this.f&&Ca(this),jo()}function Rn(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,Zn&&Zn.push(this)}Rn.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.m=t)}finally{e()}};Rn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Xs(this),js(this),$t++;var e=Ae;return Ae=this,sp.bind(this,e)};Rn.prototype.N=function(){2&this.f||(this.f|=2,this.u=eo,eo=this)};Rn.prototype.d=function(){this.f|=8,1&this.f||Ca(this)};Rn.prototype.dispose=function(){this.d()};function Ft(e,t){var n=new Rn(e,t);try{n.c()}catch(r){throw n.d(),r}var o=n.d.bind(n);return o[Symbol.dispose]=o,o}var Ys,Yo,Qo,lp=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var Js=[];Ft(function(){Ys=this.N})();function Tn(e,t){J[e]=t.bind(null,J[e]||function(){})}function Xo(e){if(Qo){var t=Qo;Qo=void 0,t()}Qo=e&&e.S()}function Zs(e){var t=this,n=e.data,o=Pt(n);o.value=n;var r=ne(function(){for(var l=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var d=ge(function(){var g=o.value.value;return g===0?0:g===!0?"":g||""}),_=ge(function(){return!Array.isArray(d.value)&&!ra(d.value)}),p=Ft(function(){if(this.N=el,_.value){var g=d.value;l.__v&&l.__v.__e&&l.__v.__e.nodeType===3&&(l.__v.__e.data=g)}}),u=t.__$u.d;return t.__$u.d=function(){p(),u.call(this)},[_,d]},[]),a=r[0],s=r[1];return a.value?s.peek():s.value}Zs.displayName="ReactiveTextNode";Object.defineProperties(Qe.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Zs},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});Tn("__b",function(e,t){if(typeof t.type=="string"){var n,o=t.props;for(var r in o)if(r!=="children"){var a=o[r];a instanceof Qe&&(n||(t.__np=n={}),n[r]=a,o[r]=a.peek())}}e(t)});Tn("__r",function(e,t){if(e(t),t.type!==fe){Xo();var n,o=t.__c;o&&(o.__$f&=-2,(n=o.__$u)===void 0&&(o.__$u=n=(function(r,a){var s;return Ft(function(){s=this},{name:a}),s.c=r,s})(function(){var r;lp&&((r=n.y)==null||r.call(n)),o.__$f|=1,o.setState({})},typeof t.type=="function"?t.type.displayName||t.type.name:""))),Yo=o,Xo(n)}});Tn("__e",function(e,t,n,o){Xo(),Yo=void 0,e(t,n,o)});Tn("diffed",function(e,t){Xo(),Yo=void 0;var n;if(typeof t.type=="string"&&(n=t.__e)){var o=t.__np,r=t.props,a=n.U;if(a)for(var s in a){var l=a[s];l===void 0||o&&s in o||(l.d(),a[s]=void 0)}if(o){a||(a={},n.U=a);for(var c in o){var d=a[c],_=o[c];d===void 0?(d=cp(n,c,_,r),a[c]=d):d.o(_,r)}}}e(t)});function cp(e,t,n,o){var r=t in e&&e.ownerSVGElement===void 0,a=ee(n);return{o:function(s,l){a.value=s,o=l},d:Ft(function(){this.N=el;var s=a.value.value;o[t]!==s&&(o[t]=s,r?e[t]=s:s!=null&&(s!==!1||t[4]==="-")?e.setAttribute(t,s):e.removeAttribute(t))})}}Tn("unmount",function(e,t){if(typeof t.type=="string"){var n=t.__e;if(n){var o=n.U;if(o){n.U=void 0;for(var r in o){var a=o[r];a&&a.d()}}}var s=t.__np;if(s){var l=t.props;for(var c in s)l[c]=s[c]}t.__np=void 0}else{var d=t.__c;if(d){var _=d.__$u;_&&(d.__$u=void 0,_.d())}}e(t)});Tn("__h",function(e,t,n,o){o<3&&(t.__$f|=2),e(t,n,o)});_t.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,o=n&&n.s!==void 0;for(var r in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var a=2&this.__$f;if(!(o||a||4&this.__$f)||1&this.__$f)return!0}else if(!(o||4&this.__$f)||3&this.__$f)return!0;for(var s in e)if(s!=="__source"&&e[s]!==this.props[s])return!0;for(var l in this.props)if(!(l in e))return!0;return!1};function Pt(e,t){return ne(function(){return ee(e,t)},[])}function ft(e,t){var n=O(e);return n.current=e,Yo.__$f|=4,ne(function(){return ge(function(){return n.current()},t)},[])}var dp=function(e){queueMicrotask(function(){queueMicrotask(e)})};function up(){xt(function(){for(var e;e=Js.shift();)Ys.call(e)})}function el(){Js.push(this)===1&&(J.requestAnimationFrame||dp)(up)}function tl(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function nl(e){return tl(e)}function ol(e){return!(!tl(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}function _p(e){return`${T.cssPrefix}:${e}`}function rl(e,t){let o=Object.entries(t).map(([r,a])=>{let s=_p(r),l=c=>a(c.detail);return e.addEventListener(s,l),[s,l]});return()=>{for(let[r,a]of o)e.removeEventListener(r,a)}}function Jo(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 pp=900,fp=640;function Ra(e,t,n){if(e==="standalone"||e==="page")return"fullscreen";let o=t.initialSize;return o==="expanded"||o==="fullscreen"||o==="normal"?o:n>0&&n<fp?"fullscreen":n>=(t.autoSizeBreakpoint??pp)?"expanded":"normal"}function no(e,t,n,o=null){let a=e.mode==="inline"||e.mode==="standalone"||e.mode==="page"||(n??!e.startMinimized),l=e.mode!=="standalone"&&e.mode!=="page"&&e.mode!=="inline"&&o?o:Ra(e.mode,e.size,t);return{panelOpen:a,panelSize:l}}function In(){return typeof window>"u"?0:window.innerWidth}var mp="x-public-key",gp="x-ai-agent-deployment-id";function al(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");return{headers(){let t={[gp]:e.aiAgentDeploymentId};return e.publicKey&&(t[e.publicKeyHeader??mp]=e.publicKey),t}}}function oo(e,t){return new Promise(n=>{if(t?.aborted)return n();let o=setTimeout(a,e),r=()=>a();t?.addEventListener("abort",r,{once:!0});function a(){clearTimeout(o),t?.removeEventListener("abort",r),n()}})}var Zo="1.3.4";var Xe=class extends Error{constructor(n,o,r,a){super(n);ae(this,"code",o);ae(this,"status",r);ae(this,"cause",a);this.name="StreamError"}};var il=se.scope("parser");async function*sl(e,t,n){if(!e.ok){let o=await e.text().catch(()=>"");throw new Xe(`server responded ${e.status}: ${o.slice(0,200)}`,"server",e.status)}for await(let o of vp(e,t)){let r=hp(o,n);if(r==="done")return;r&&(yield r)}}async function*vp(e,t){if(!e.body)throw new Xe("response has no body","no-body");let n=e.body.pipeThrough(new TextDecoderStream).getReader(),o="";try{for(;;){if(t.aborted)throw new DOMException("aborted","AbortError");let{done:r,value:a}=await n.read();if(r){let l=o.trim();l&&(yield l);return}o+=a;let s;for(;(s=o.indexOf(`
7
+ `).replace(/__P__/g,G_).replaceAll("__BRAND_ACCENT_TEXT__",j_).replaceAll("__BRAND_ACCENT__",K_).replaceAll("__BRAND_RADIUS__",Q_).replaceAll("__BRAND_FONT__",X_);var Y_=se.scope("mount"),Es=new WeakMap,As={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 Ms(e,t){e.style.cssText=As[t]}function Ho(e){return e==="floating"||e==="modal"||e==="drawer"?"floating":e==="standalone"||e==="page"?"viewport":"flow"}function Ls(e={}){let t=e.position??"flow";Y_.debug("createShadowMount",{position:t,hasTarget:!!e.target,hasHost:!!e.existingHost});let n=`${T.cssPrefix}-chat-host`;typeof customElements<"u"&&!customElements.get(n)&&customElements.define(n,class extends HTMLElement{});let o;e.existingHost?o=e.existingHost:(o=document.createElement(n),(e.target??document.body).appendChild(o)),o.setAttribute("data-brand",T.id),o.style.cssText=As[t];let r=o.shadowRoot??o.attachShadow({mode:"open"}),a=o.ownerDocument;if(!J_(r,a)){let l=a.createElement("style");l.textContent=Pa,r.appendChild(l)}let s=document.createElement("div");return s.className=`${T.cssPrefix}-app`,r.appendChild(s),{appRoot:s,destroy:()=>o.remove(),hostElement:o,shadowRoot:r}}function J_(e,t){if(!("adoptedStyleSheets"in e))return!1;let n=t.defaultView;if(!n||typeof n.CSSStyleSheet!="function")return!1;let o=Es.get(t);if(!o)try{o=new n.CSSStyleSheet,o.replaceSync(Pa),Es.set(t,o)}catch{return!1}try{return e.adoptedStyleSheets=[o],!0}catch{return!1}}function Z_(e,t){let n=T.cssPrefix;t.accent&&e.style.setProperty(`--${n}-accent-user`,t.accent),t.accentText&&e.style.setProperty(`--${n}-accent-text-user`,t.accentText),t.radius&&e.style.setProperty(`--${n}-radius`,t.radius),t.fontFamily&&e.style.setProperty(`--${n}-font`,t.fontFamily),t.contentMaxWidth&&e.style.setProperty(`--${n}-conversation-max`,t.contentMaxWidth)}function ep(e,t){e.dataset.theme=t}function tp(e,t){let n=T.cssPrefix;t.width!==void 0&&e.style.setProperty(`--${n}-panel-w`,t.width),t.height!==void 0&&e.style.setProperty(`--${n}-panel-h`,t.height),t.expanded?.width!==void 0&&e.style.setProperty(`--${n}-expanded-w`,t.expanded.width),t.expanded?.height!==void 0&&e.style.setProperty(`--${n}-expanded-h`,t.expanded.height),t.inset!==void 0&&e.style.setProperty(`--${n}-panel-inset`,t.inset)}function np(e,t){e.dataset.position=t}function zo(e,t){e.dataset.mode=t}function Os(e,t){ep(e,t.themeMode),Z_(e,t.themeOverrides),np(e,t.position),tp(e,t.size)}var Cn,Ne,xa,Ns,Jn=0,qs=[],Be=J,Ds=Be.__b,$s=Be.__r,Fs=Be.diffed,Bs=Be.__c,Us=Be.unmount,Hs=Be.__;function Vo(e,t){Be.__h&&Be.__h(Ne,e,Jn||t),Jn=0;var n=Ne.__H||(Ne.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function $(e){return Jn=1,Vs(Ws,e)}function Vs(e,t,n){var o=Vo(Cn++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):Ws(void 0,t),function(l){var c=o.__N?o.__N[0]:o.__[0],d=o.t(c,l);c!==d&&(o.__N=[d,o.__[1]],o.__c.setState({}))}],o.__c=Ne,!Ne.__f)){var r=function(l,c,d){if(!o.__c.__H)return!0;var _=!1,p=o.__c.props!==l;if(o.__c.__H.__.some(function(g){if(g.__N){_=!0;var m=g.__[0];g.__=g.__N,g.__N=void 0,m!==g.__[0]&&(p=!0)}}),a){var u=a.call(this,l,c,d);return _?u||p:u}return!_||p};Ne.__f=!0;var a=Ne.shouldComponentUpdate,s=Ne.componentWillUpdate;Ne.componentWillUpdate=function(l,c,d){if(this.__e){var _=a;a=void 0,r(l,c,d),a=_}s&&s.call(this,l,c,d)},Ne.shouldComponentUpdate=r}return o.__N||o.__}function M(e,t){var n=Vo(Cn++,3);!Be.__s&&ka(n.__H,t)&&(n.__=e,n.u=t,Ne.__H.__h.push(n))}function Ct(e,t){var n=Vo(Cn++,4);!Be.__s&&ka(n.__H,t)&&(n.__=e,n.u=t,Ne.__h.push(n))}function O(e){return Jn=5,ne(function(){return{current:e}},[])}function ne(e,t){var n=Vo(Cn++,7);return ka(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function L(e,t){return Jn=8,ne(function(){return e},t)}function op(){for(var e;e=qs.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(qo),t.__h.some(Sa),t.__h=[]}catch(n){t.__h=[],Be.__e(n,e.__v)}}}Be.__b=function(e){Ne=null,Ds&&Ds(e)},Be.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Hs&&Hs(e,t)},Be.__r=function(e){$s&&$s(e),Cn=0;var t=(Ne=e.__c).__H;t&&(xa===Ne?(t.__h=[],Ne.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(qo),t.__h.some(Sa),t.__h=[],Cn=0)),xa=Ne},Be.diffed=function(e){Fs&&Fs(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(qs.push(t)!==1&&Ns===Be.requestAnimationFrame||((Ns=Be.requestAnimationFrame)||rp)(op)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),xa=Ne=null},Be.__c=function(e,t){t.some(function(n){try{n.__h.some(qo),n.__h=n.__h.filter(function(o){return!o.__||Sa(o)})}catch(o){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Be.__e(o,n.__v)}}),Bs&&Bs(e,t)},Be.unmount=function(e){Us&&Us(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(o){try{qo(o)}catch(r){t=r}}),n.__H=void 0,t&&Be.__e(t,n.__v))};var zs=typeof requestAnimationFrame=="function";function rp(e){var t,n=function(){clearTimeout(o),zs&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);zs&&(t=requestAnimationFrame(n))}function qo(e){var t=Ne,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Ne=t}function Sa(e){var t=Ne;e.__c=e.__(),Ne=t}function ka(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function Ws(e,t){return typeof t=="function"?t(e):t}var ap=Symbol.for("preact-signals");function jo(){if($t>1)$t--;else{var e,t=!1;for((function(){var r=Go;for(Go=void 0;r!==void 0;){var a=r.S;if(a.v===r.v)for(var s=a.t;s!==void 0;s=s.x)s.i===r.i&&(s.i=a.i);r=r.o}})();eo!==void 0;){var n=eo;for(eo=void 0,Wo++;n!==void 0;){var o=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Ks(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if(Wo=0,$t--,t)throw e}}function xt(e){if($t>0)return e();wa=++ip,$t++;try{return e()}finally{jo()}}var Zn,Ae=void 0;function to(e){var t=Ae,n=Zn;Ae=void 0,Zn=void 0;try{return e()}finally{Ae=t,Zn=n}}var eo=void 0,$t=0,Wo=0,ip=0,wa=0,Go=void 0,Ko=0;function Gs(e){if(Ae!==void 0){var t=e.n;if(t===void 0||t.t!==Ae)return t={i:0,S:e,p:Ae.s,n:void 0,t:Ae,e:void 0,x:void 0,r:t},Ae.s!==void 0&&(Ae.s.n=t),Ae.s=t,e.n=t,32&Ae.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=Ae.s,t.n=void 0,Ae.s.n=t,Ae.s=t),t}}function Qe(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}Qe.prototype.brand=ap;Qe.prototype.h=function(){return!0};Qe.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:to(function(){var o;(o=t.W)==null||o.call(t)}))};Qe.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,o=e.x;n!==void 0&&(n.x=o,e.e=void 0),o!==void 0&&(o.e=n,e.x=void 0),e===this.t&&(this.t=o,o===void 0&&to(function(){var r;(r=t.Z)==null||r.call(t)}))}};Qe.prototype.subscribe=function(e){var t=this;return Ft(function(){var n=t.value;to(function(){return e(n)})},{name:"sub"})};Qe.prototype.valueOf=function(){return this.value};Qe.prototype.toString=function(){return this.value+""};Qe.prototype.toJSON=function(){return this.value};Qe.prototype.peek=function(){var e=this;return to(function(){return e.value})};Object.defineProperty(Qe.prototype,"value",{get:function(){var e=Gs(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Wo>100)throw new Error("Cycle detected");(function(n){$t!==0&&Wo===0&&n.l!==wa&&(n.l=wa,Go={S:n,v:n.v,i:n.i,o:Go})})(this),this.v=e,this.i++,Ko++,$t++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{jo()}}}});function ee(e,t){return new Qe(e,t)}function Ks(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 js(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 Qs(e){for(var t=e.s,n=void 0;t!==void 0;){var o=t.p;t.i===-1?(t.S.U(t),o!==void 0&&(o.n=t.n),t.n!==void 0&&(t.n.p=o)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=o}e.s=n}function on(e,t){Qe.call(this,void 0,t),this.x=e,this.s=void 0,this.g=Ko-1,this.f=4}on.prototype=new Qe;on.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Ko))return!0;if(this.g=Ko,this.f|=1,this.i>0&&!Ks(this))return this.f&=-2,!0;var e=Ae;try{js(this),Ae=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 Ae=e,Qs(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)}Qe.prototype.S.call(this,e)};on.prototype.U=function(e){if(this.t!==void 0&&(Qe.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=Gs(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function ge(e,t){return new on(e,t)}function Xs(e){var t=e.m;if(e.m=void 0,typeof t=="function"){$t++;var n=Ae;Ae=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,Ca(e),o}finally{Ae=n,jo()}}}function Ca(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Xs(e)}function sp(e){if(Ae!==this)throw new Error("Out-of-order effect");Qs(this),Ae=e,this.f&=-2,8&this.f&&Ca(this),jo()}function Rn(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,Zn&&Zn.push(this)}Rn.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.m=t)}finally{e()}};Rn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Xs(this),js(this),$t++;var e=Ae;return Ae=this,sp.bind(this,e)};Rn.prototype.N=function(){2&this.f||(this.f|=2,this.u=eo,eo=this)};Rn.prototype.d=function(){this.f|=8,1&this.f||Ca(this)};Rn.prototype.dispose=function(){this.d()};function Ft(e,t){var n=new Rn(e,t);try{n.c()}catch(r){throw n.d(),r}var o=n.d.bind(n);return o[Symbol.dispose]=o,o}var Ys,Yo,Qo,lp=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var Js=[];Ft(function(){Ys=this.N})();function Tn(e,t){J[e]=t.bind(null,J[e]||function(){})}function Xo(e){if(Qo){var t=Qo;Qo=void 0,t()}Qo=e&&e.S()}function Zs(e){var t=this,n=e.data,o=Pt(n);o.name="ReactiveDom",o.value=n;var r=ne(function(){for(var l=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var d=ge(function(){var g=o.value.value;return g===0?0:g===!0?"":g||""}),_=ge(function(){return!Array.isArray(d.value)&&!ra(d.value)}),p=Ft(function(){if(this.N=el,_.value){var g=d.value;l.__v&&l.__v.__e&&l.__v.__e.nodeType===3&&(l.__v.__e.data=g)}}),u=t.__$u.d;return t.__$u.d=function(){p(),u.call(this)},[_,d]},[]),a=r[0],s=r[1];return a.value?s.peek():s.value}Zs.displayName="ReactiveTextNode";Object.defineProperties(Qe.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Zs},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});Tn("__b",function(e,t){if(typeof t.type=="string"){var n,o=t.props;for(var r in o)if(r!=="children"){var a=o[r];a instanceof Qe&&(n||(t.__np=n={}),n[r]=a,o[r]=a.peek())}}e(t)});Tn("__r",function(e,t){if(e(t),t.type!==fe){Xo();var n,o=t.__c;o&&(o.__$f&=-2,(n=o.__$u)===void 0&&(o.__$u=n=(function(r,a){var s;return Ft(function(){s=this},{name:a}),s.c=r,s})(function(){var r;lp&&((r=n.y)==null||r.call(n)),o.__$f|=1,o.setState({})},typeof t.type=="function"?t.type.displayName||t.type.name:""))),Yo=o,Xo(n)}});Tn("__e",function(e,t,n,o){Xo(),Yo=void 0,e(t,n,o)});Tn("diffed",function(e,t){Xo(),Yo=void 0;var n;if(typeof t.type=="string"&&(n=t.__e)){var o=t.__np,r=t.props,a=n.U;if(a)for(var s in a){var l=a[s];l===void 0||o&&s in o||(l.d(),a[s]=void 0)}if(o){a||(a={},n.U=a);for(var c in o){var d=a[c],_=o[c];d===void 0?(d=cp(n,c,_,r),a[c]=d):d.o(_,r)}}}e(t)});function cp(e,t,n,o){var r=t in e&&e.ownerSVGElement===void 0,a=ee(n);return{o:function(s,l){a.value=s,o=l},d:Ft(function(){this.N=el;var s=a.value.value;o[t]!==s&&(o[t]=s,r?e[t]=s:s!=null&&(s!==!1||t[4]==="-")?e.setAttribute(t,s):e.removeAttribute(t))})}}Tn("unmount",function(e,t){if(typeof t.type=="string"){var n=t.__e;if(n){var o=n.U;if(o){n.U=void 0;for(var r in o){var a=o[r];a&&a.d()}}}var s=t.__np;if(s){var l=t.props;for(var c in s)l[c]=s[c]}t.__np=void 0}else{var d=t.__c;if(d){var _=d.__$u;_&&(d.__$u=void 0,_.d())}}e(t)});Tn("__h",function(e,t,n,o){o<3&&(t.__$f|=2),e(t,n,o)});_t.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,o=n&&n.s!==void 0;for(var r in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var a=2&this.__$f;if(!(o||a||4&this.__$f)||1&this.__$f)return!0}else if(!(o||4&this.__$f)||3&this.__$f)return!0;for(var s in e)if(s!=="__source"&&e[s]!==this.props[s])return!0;for(var l in this.props)if(!(l in e))return!0;return!1};function Pt(e,t){return ne(function(){return ee(e,t)},[])}function ft(e,t){var n=O(e);return n.current=e,Yo.__$f|=4,ne(function(){return ge(function(){return n.current()},t)},[])}var dp=function(e){queueMicrotask(function(){queueMicrotask(e)})};function up(){xt(function(){for(var e;e=Js.shift();)Ys.call(e)})}function el(){Js.push(this)===1&&(J.requestAnimationFrame||dp)(up)}function tl(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function nl(e){return tl(e)}function ol(e){return!(!tl(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}function _p(e){return`${T.cssPrefix}:${e}`}function rl(e,t){let o=Object.entries(t).map(([r,a])=>{let s=_p(r),l=c=>a(c.detail);return e.addEventListener(s,l),[s,l]});return()=>{for(let[r,a]of o)e.removeEventListener(r,a)}}function Jo(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 pp=900,fp=640;function Ra(e,t,n){if(e==="standalone"||e==="page")return"fullscreen";let o=t.initialSize;return o==="expanded"||o==="fullscreen"||o==="normal"?o:n>0&&n<fp?"fullscreen":n>=(t.autoSizeBreakpoint??pp)?"expanded":"normal"}function no(e,t,n,o=null){let a=e.mode==="inline"||e.mode==="standalone"||e.mode==="page"||(n??!e.startMinimized),l=e.mode!=="standalone"&&e.mode!=="page"&&e.mode!=="inline"&&o?o:Ra(e.mode,e.size,t);return{panelOpen:a,panelSize:l}}function In(){return typeof window>"u"?0:window.innerWidth}var mp="x-public-key",gp="x-ai-agent-deployment-id";function al(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");return{headers(){let t={[gp]:e.aiAgentDeploymentId};return e.publicKey&&(t[e.publicKeyHeader??mp]=e.publicKey),t}}}function oo(e,t){return new Promise(n=>{if(t?.aborted)return n();let o=setTimeout(a,e),r=()=>a();t?.addEventListener("abort",r,{once:!0});function a(){clearTimeout(o),t?.removeEventListener("abort",r),n()}})}var Zo="1.3.5";var Xe=class extends Error{constructor(n,o,r,a){super(n);ae(this,"code",o);ae(this,"status",r);ae(this,"cause",a);this.name="StreamError"}};var il=se.scope("parser");async function*sl(e,t,n){if(!e.ok){let o=await e.text().catch(()=>"");throw new Xe(`server responded ${e.status}: ${o.slice(0,200)}`,"server",e.status)}for await(let o of vp(e,t)){let r=hp(o,n);if(r==="done")return;r&&(yield r)}}async function*vp(e,t){if(!e.body)throw new Xe("response has no body","no-body");let n=e.body.pipeThrough(new TextDecoderStream).getReader(),o="";try{for(;;){if(t.aborted)throw new DOMException("aborted","AbortError");let{done:r,value:a}=await n.read();if(r){let l=o.trim();l&&(yield l);return}o+=a;let s;for(;(s=o.indexOf(`
8
8
 
9
9
  `))!==-1;){let l=o.slice(0,s);o=o.slice(s+2),yield l}}}finally{n.releaseLock()}}function hp(e,t){let n="",o;for(let r of e.split(`
10
10
  `))if(r!==""){if(r.startsWith(":")){t?.(r.slice(1).trim());continue}if(r.startsWith("data:")){let a=r.slice(5).replace(/^ /,"");n=n?`${n}