@helpai/elements 0.72.0 → 0.72.1

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 Wd=Object.defineProperty;var Gd=(e,t,n)=>t in e?Wd(e,t,{enumerable:!0,config
4
4
  `;var Ii=`.__P__-standalone-page{margin:0;height:100vh;background:var(--__P__-bg, #fff);display:grid;place-items:stretch}
5
5
  `;var Mi=`: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 H_="helpai",z_="#5B5BD6",U_="#FFFFFF",q_="12px",V_="Inter, system-ui, -apple-system, 'Segoe UI', sans-serif",Cr=[Ri,Ei,Ai,Ii,Mi].join(`
7
- `).replace(/__P__/g,H_).replaceAll("__BRAND_ACCENT_TEXT__",U_).replaceAll("__BRAND_ACCENT__",z_).replaceAll("__BRAND_RADIUS__",q_).replaceAll("__BRAND_FONT__",V_);var W_=W.scope("mount"),Li=new WeakMap,Oi={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 Ni(e,t){e.style.cssText=Oi[t]}function Jn(e){return e==="floating"||e==="modal"||e==="drawer"?"floating":e==="standalone"||e==="page"?"viewport":"flow"}function Di(e={}){let t=e.position??"flow";W_.debug("createShadowMount",{position:t,hasTarget:!!e.target,hasHost:!!e.existingHost});let n=`${S.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",S.id),o.style.cssText=Oi[t];let r=o.shadowRoot??o.attachShadow({mode:"open"}),i=o.ownerDocument;if(!G_(r,i)){let s=i.createElement("style");s.textContent=Cr,r.appendChild(s)}let l=document.createElement("div");return l.className=`${S.cssPrefix}-app`,r.appendChild(l),{appRoot:l,destroy:()=>o.remove(),hostElement:o,shadowRoot:r}}function G_(e,t){if(!("adoptedStyleSheets"in e))return!1;let n=t.defaultView;if(!n||typeof n.CSSStyleSheet!="function")return!1;let o=Li.get(t);if(!o)try{o=new n.CSSStyleSheet,o.replaceSync(Cr),Li.set(t,o)}catch{return!1}try{return e.adoptedStyleSheets=[o],!0}catch{return!1}}function K_(e,t){let n=S.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 j_(e,t){e.dataset.theme=t}function X_(e,t){let n=S.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 Y_(e,t){e.dataset.position=t}function Qn(e,t){e.dataset.mode=t}function $i(e,t){j_(e,t.themeMode),K_(e,t.themeOverrides),Y_(e,t.position),X_(e,t.size)}var Dt,ve,Tr,Fi,cn=0,Gi=[],Pe=z,Bi=Pe.__b,Hi=Pe.__r,zi=Pe.diffed,Ui=Pe.__c,qi=Pe.unmount,Vi=Pe.__;function eo(e,t){Pe.__h&&Pe.__h(ve,e,cn||t),cn=0;var n=ve.__H||(ve.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function E(e){return cn=1,Ki(ji,e)}function Ki(e,t,n){var o=eo(Dt++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):ji(void 0,t),function(s){var c=o.__N?o.__N[0]:o.__[0],d=o.t(c,s);c!==d&&(o.__N=[d,o.__[1]],o.__c.setState({}))}],o.__c=ve,!ve.__f)){var r=function(s,c,d){if(!o.__c.__H)return!0;var u=!1,p=o.__c.props!==s;if(o.__c.__H.__.some(function(f){if(f.__N){u=!0;var m=f.__[0];f.__=f.__N,f.__N=void 0,m!==f.__[0]&&(p=!0)}}),i){var _=i.call(this,s,c,d);return u?_||p:_}return!u||p};ve.__f=!0;var i=ve.shouldComponentUpdate,l=ve.componentWillUpdate;ve.componentWillUpdate=function(s,c,d){if(this.__e){var u=i;i=void 0,r(s,c,d),i=u}l&&l.call(this,s,c,d)},ve.shouldComponentUpdate=r}return o.__N||o.__}function R(e,t){var n=eo(Dt++,3);!Pe.__s&&Er(n.__H,t)&&(n.__=e,n.u=t,ve.__H.__h.push(n))}function Xe(e,t){var n=eo(Dt++,4);!Pe.__s&&Er(n.__H,t)&&(n.__=e,n.u=t,ve.__h.push(n))}function B(e){return cn=5,Ae(function(){return{current:e}},[])}function Ae(e,t){var n=eo(Dt++,7);return Er(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function N(e,t){return cn=8,Ae(function(){return e},t)}function J_(){for(var e;e=Gi.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Zn),t.__h.some(Rr),t.__h=[]}catch(n){t.__h=[],Pe.__e(n,e.__v)}}}Pe.__b=function(e){ve=null,Bi&&Bi(e)},Pe.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Vi&&Vi(e,t)},Pe.__r=function(e){Hi&&Hi(e),Dt=0;var t=(ve=e.__c).__H;t&&(Tr===ve?(t.__h=[],ve.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Zn),t.__h.some(Rr),t.__h=[],Dt=0)),Tr=ve},Pe.diffed=function(e){zi&&zi(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Gi.push(t)!==1&&Fi===Pe.requestAnimationFrame||((Fi=Pe.requestAnimationFrame)||Q_)(J_)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Tr=ve=null},Pe.__c=function(e,t){t.some(function(n){try{n.__h.some(Zn),n.__h=n.__h.filter(function(o){return!o.__||Rr(o)})}catch(o){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Pe.__e(o,n.__v)}}),Ui&&Ui(e,t)},Pe.unmount=function(e){qi&&qi(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(o){try{Zn(o)}catch(r){t=r}}),n.__H=void 0,t&&Pe.__e(t,n.__v))};var Wi=typeof requestAnimationFrame=="function";function Q_(e){var t,n=function(){clearTimeout(o),Wi&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);Wi&&(t=requestAnimationFrame(n))}function Zn(e){var t=ve,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),ve=t}function Rr(e){var t=ve;e.__c=e.__(),ve=t}function Er(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function ji(e,t){return typeof t=="function"?t(e):t}var Z_=Symbol.for("preact-signals");function ro(){if(rt>1)rt--;else{var e,t=!1;for((function(){var r=no;for(no=void 0;r!==void 0;){var i=r.S;if(i.v===r.v)for(var l=i.t;l!==void 0;l=l.x)l.i===r.i&&(l.i=i.i);r=r.o}})();_n!==void 0;){var n=_n;for(_n=void 0,to++;n!==void 0;){var o=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Yi(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if(to=0,rt--,t)throw e}}function $t(e){if(rt>0)return e();Ar=++eu,rt++;try{return e()}finally{ro()}}var dn,pe=void 0;function un(e){var t=pe,n=dn;pe=void 0,dn=void 0;try{return e()}finally{pe=t,dn=n}}var _n=void 0,rt=0,to=0,eu=0,Ar=0,no=void 0,oo=0;function Xi(e){if(pe!==void 0){var t=e.n;if(t===void 0||t.t!==pe)return t={i:0,S:e,p:pe.s,n:void 0,t:pe,e:void 0,x:void 0,r:t},pe.s!==void 0&&(pe.s.n=t),pe.s=t,e.n=t,32&pe.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=pe.s,t.n=void 0,pe.s.n=t,pe.s=t),t}}function we(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}we.prototype.brand=Z_;we.prototype.h=function(){return!0};we.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:un(function(){var o;(o=t.W)==null||o.call(t)}))};we.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&&un(function(){var r;(r=t.Z)==null||r.call(t)}))}};we.prototype.subscribe=function(e){var t=this;return at(function(){var n=t.value;un(function(){return e(n)})},{name:"sub"})};we.prototype.valueOf=function(){return this.value};we.prototype.toString=function(){return this.value+""};we.prototype.toJSON=function(){return this.value};we.prototype.peek=function(){var e=this;return un(function(){return e.value})};Object.defineProperty(we.prototype,"value",{get:function(){var e=Xi(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(to>100)throw new Error("Cycle detected");(function(n){rt!==0&&to===0&&n.l!==Ar&&(n.l=Ar,no={S:n,v:n.v,i:n.i,o:no})})(this),this.v=e,this.i++,oo++,rt++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{ro()}}}});function q(e,t){return new we(e,t)}function Yi(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 Ji(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 Qi(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 ht(e,t){we.call(this,void 0,t),this.x=e,this.s=void 0,this.g=oo-1,this.f=4}ht.prototype=new we;ht.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===oo))return!0;if(this.g=oo,this.f|=1,this.i>0&&!Yi(this))return this.f&=-2,!0;var e=pe;try{Ji(this),pe=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 pe=e,Qi(this),this.f&=-2,!0};ht.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)}we.prototype.S.call(this,e)};ht.prototype.U=function(e){if(this.t!==void 0&&(we.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)}};ht.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(ht.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Xi(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function pn(e,t){return new ht(e,t)}function Zi(e){var t=e.m;if(e.m=void 0,typeof t=="function"){rt++;var n=pe;pe=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,Ir(e),o}finally{pe=n,ro()}}}function Ir(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Zi(e)}function tu(e){if(pe!==this)throw new Error("Out-of-order effect");Qi(this),pe=e,this.f&=-2,8&this.f&&Ir(this),ro()}function Ft(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,dn&&dn.push(this)}Ft.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()}};Ft.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Zi(this),Ji(this),rt++;var e=pe;return pe=this,tu.bind(this,e)};Ft.prototype.N=function(){2&this.f||(this.f|=2,this.u=_n,_n=this)};Ft.prototype.d=function(){this.f|=8,1&this.f||Ir(this)};Ft.prototype.dispose=function(){this.d()};function at(e,t){var n=new Ft(e,t);try{n.c()}catch(r){throw n.d(),r}var o=n.d.bind(n);return o[Symbol.dispose]=o,o}var es,so,ao,nu=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var ts=[];at(function(){es=this.N})();function Bt(e,t){z[e]=t.bind(null,z[e]||function(){})}function io(e){if(ao){var t=ao;ao=void 0,t()}ao=e&&e.S()}function ns(e){var t=this,n=e.data,o=Ye(n);o.value=n;var r=Ae(function(){for(var s=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var d=pn(function(){var f=o.value.value;return f===0?0:f===!0?"":f||""}),u=pn(function(){return!Array.isArray(d.value)&&!dr(d.value)}),p=at(function(){if(this.N=os,u.value){var f=d.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=f)}}),_=t.__$u.d;return t.__$u.d=function(){p(),_.call(this)},[u,d]},[]),i=r[0],l=r[1];return i.value?l.peek():l.value}ns.displayName="ReactiveTextNode";Object.defineProperties(we.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:ns},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});Bt("__b",function(e,t){if(typeof t.type=="string"){var n,o=t.props;for(var r in o)if(r!=="children"){var i=o[r];i instanceof we&&(n||(t.__np=n={}),n[r]=i,o[r]=i.peek())}}e(t)});Bt("__r",function(e,t){if(e(t),t.type!==Z){io();var n,o=t.__c;o&&(o.__$f&=-2,(n=o.__$u)===void 0&&(o.__$u=n=(function(r,i){var l;return at(function(){l=this},{name:i}),l.c=r,l})(function(){var r;nu&&((r=n.y)==null||r.call(n)),o.__$f|=1,o.setState({})},typeof t.type=="function"?t.type.displayName||t.type.name:""))),so=o,io(n)}});Bt("__e",function(e,t,n,o){io(),so=void 0,e(t,n,o)});Bt("diffed",function(e,t){io(),so=void 0;var n;if(typeof t.type=="string"&&(n=t.__e)){var o=t.__np,r=t.props,i=n.U;if(i)for(var l in i){var s=i[l];s===void 0||o&&l in o||(s.d(),i[l]=void 0)}if(o){i||(i={},n.U=i);for(var c in o){var d=i[c],u=o[c];d===void 0?(d=ou(n,c,u,r),i[c]=d):d.o(u,r)}}}e(t)});function ou(e,t,n,o){var r=t in e&&e.ownerSVGElement===void 0,i=q(n);return{o:function(l,s){i.value=l,o=s},d:at(function(){this.N=os;var l=i.value.value;o[t]!==l&&(o[t]=l,r?e[t]=l:l!=null&&(l!==!1||t[4]==="-")?e.setAttribute(t,l):e.removeAttribute(t))})}}Bt("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 i=o[r];i&&i.d()}}}var l=t.__np;if(l){var s=t.props;for(var c in l)s[c]=l[c]}t.__np=void 0}else{var d=t.__c;if(d){var u=d.__$u;u&&(d.__$u=void 0,u.d())}}e(t)});Bt("__h",function(e,t,n,o){(o<3||o===9)&&(t.__$f|=2),e(t,n,o)});Oe.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 i=2&this.__$f;if(!(o||i||4&this.__$f)||1&this.__$f)return!0}else if(!(o||4&this.__$f)||3&this.__$f)return!0;for(var l in e)if(l!=="__source"&&e[l]!==this.props[l])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function Ye(e,t){return Ae(function(){return q(e,t)},[])}function ee(e,t){var n=B(e);return n.current=e,so.__$f|=4,Ae(function(){return pn(function(){return n.current()},t)},[])}var ru=function(e){queueMicrotask(function(){queueMicrotask(e)})};function au(){$t(function(){for(var e;e=ts.shift();)es.call(e)})}function os(){ts.push(this)===1&&(z.requestAnimationFrame||ru)(au)}function rs(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function as(e){return rs(e)}function is(e){return!(!rs(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}function iu(e){return`${S.cssPrefix}:${e}`}function ss(e,t){let o=Object.entries(t).map(([r,i])=>{let l=iu(r),s=c=>i(c.detail);return e.addEventListener(l,s),[l,s]});return()=>{for(let[r,i]of o)e.removeEventListener(r,i)}}function lo(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 su=900,lu=640;function Mr(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<lu?"fullscreen":n>=(t.autoSizeBreakpoint??su)?"expanded":"normal"}function mn(e,t,n,o=null){let i=e.mode==="inline"||e.mode==="standalone"||e.mode==="page"||(n??!e.startMinimized),s=e.mode!=="standalone"&&e.mode!=="page"&&e.mode!=="inline"&&o?o:Mr(e.mode,e.size,t);return{panelOpen:i,panelSize:s}}function Ht(){return typeof window>"u"?0:window.innerWidth}var cu="x-public-key",du="x-ai-agent-deployment-id";function ls(e){return{headers(){let t={};return e.aiAgentDeploymentId&&(t[du]=e.aiAgentDeploymentId),e.publicKey&&(t[e.publicKeyHeader??cu]=e.publicKey),t}}}function zt(e,t){return new Promise(n=>{if(t?.aborted)return n();let o=setTimeout(i,e),r=()=>i();t?.addEventListener("abort",r,{once:!0});function i(){clearTimeout(o),t?.removeEventListener("abort",r),n()}})}var co="0.72.0";var Je=class extends Error{constructor(n,o,r,i){super(n);G(this,"code",o);G(this,"status",r);G(this,"cause",i);this.name="StreamError"}};var cs=W.scope("parser");async function*ds(e,t){if(!e.ok){let n=await e.text().catch(()=>"");throw new Je(`server responded ${e.status}: ${n.slice(0,200)}`,"server",e.status)}for await(let n of _u(e,t)){let o=uu(n);if(o==="done")return;o&&(yield o)}}async function*_u(e,t){if(!e.body)throw new Je("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:i}=await n.read();if(r){let s=o.trim();s&&(yield s);return}o+=i;let l;for(;(l=o.indexOf(`
7
+ `).replace(/__P__/g,H_).replaceAll("__BRAND_ACCENT_TEXT__",U_).replaceAll("__BRAND_ACCENT__",z_).replaceAll("__BRAND_RADIUS__",q_).replaceAll("__BRAND_FONT__",V_);var W_=W.scope("mount"),Li=new WeakMap,Oi={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 Ni(e,t){e.style.cssText=Oi[t]}function Jn(e){return e==="floating"||e==="modal"||e==="drawer"?"floating":e==="standalone"||e==="page"?"viewport":"flow"}function Di(e={}){let t=e.position??"flow";W_.debug("createShadowMount",{position:t,hasTarget:!!e.target,hasHost:!!e.existingHost});let n=`${S.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",S.id),o.style.cssText=Oi[t];let r=o.shadowRoot??o.attachShadow({mode:"open"}),i=o.ownerDocument;if(!G_(r,i)){let s=i.createElement("style");s.textContent=Cr,r.appendChild(s)}let l=document.createElement("div");return l.className=`${S.cssPrefix}-app`,r.appendChild(l),{appRoot:l,destroy:()=>o.remove(),hostElement:o,shadowRoot:r}}function G_(e,t){if(!("adoptedStyleSheets"in e))return!1;let n=t.defaultView;if(!n||typeof n.CSSStyleSheet!="function")return!1;let o=Li.get(t);if(!o)try{o=new n.CSSStyleSheet,o.replaceSync(Cr),Li.set(t,o)}catch{return!1}try{return e.adoptedStyleSheets=[o],!0}catch{return!1}}function K_(e,t){let n=S.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 j_(e,t){e.dataset.theme=t}function X_(e,t){let n=S.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 Y_(e,t){e.dataset.position=t}function Qn(e,t){e.dataset.mode=t}function $i(e,t){j_(e,t.themeMode),K_(e,t.themeOverrides),Y_(e,t.position),X_(e,t.size)}var Dt,ve,Tr,Fi,cn=0,Gi=[],Pe=z,Bi=Pe.__b,Hi=Pe.__r,zi=Pe.diffed,Ui=Pe.__c,qi=Pe.unmount,Vi=Pe.__;function eo(e,t){Pe.__h&&Pe.__h(ve,e,cn||t),cn=0;var n=ve.__H||(ve.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function E(e){return cn=1,Ki(ji,e)}function Ki(e,t,n){var o=eo(Dt++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):ji(void 0,t),function(s){var c=o.__N?o.__N[0]:o.__[0],d=o.t(c,s);c!==d&&(o.__N=[d,o.__[1]],o.__c.setState({}))}],o.__c=ve,!ve.__f)){var r=function(s,c,d){if(!o.__c.__H)return!0;var u=!1,p=o.__c.props!==s;if(o.__c.__H.__.some(function(f){if(f.__N){u=!0;var m=f.__[0];f.__=f.__N,f.__N=void 0,m!==f.__[0]&&(p=!0)}}),i){var _=i.call(this,s,c,d);return u?_||p:_}return!u||p};ve.__f=!0;var i=ve.shouldComponentUpdate,l=ve.componentWillUpdate;ve.componentWillUpdate=function(s,c,d){if(this.__e){var u=i;i=void 0,r(s,c,d),i=u}l&&l.call(this,s,c,d)},ve.shouldComponentUpdate=r}return o.__N||o.__}function R(e,t){var n=eo(Dt++,3);!Pe.__s&&Er(n.__H,t)&&(n.__=e,n.u=t,ve.__H.__h.push(n))}function Xe(e,t){var n=eo(Dt++,4);!Pe.__s&&Er(n.__H,t)&&(n.__=e,n.u=t,ve.__h.push(n))}function B(e){return cn=5,Ae(function(){return{current:e}},[])}function Ae(e,t){var n=eo(Dt++,7);return Er(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function N(e,t){return cn=8,Ae(function(){return e},t)}function J_(){for(var e;e=Gi.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Zn),t.__h.some(Rr),t.__h=[]}catch(n){t.__h=[],Pe.__e(n,e.__v)}}}Pe.__b=function(e){ve=null,Bi&&Bi(e)},Pe.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Vi&&Vi(e,t)},Pe.__r=function(e){Hi&&Hi(e),Dt=0;var t=(ve=e.__c).__H;t&&(Tr===ve?(t.__h=[],ve.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Zn),t.__h.some(Rr),t.__h=[],Dt=0)),Tr=ve},Pe.diffed=function(e){zi&&zi(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Gi.push(t)!==1&&Fi===Pe.requestAnimationFrame||((Fi=Pe.requestAnimationFrame)||Q_)(J_)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Tr=ve=null},Pe.__c=function(e,t){t.some(function(n){try{n.__h.some(Zn),n.__h=n.__h.filter(function(o){return!o.__||Rr(o)})}catch(o){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Pe.__e(o,n.__v)}}),Ui&&Ui(e,t)},Pe.unmount=function(e){qi&&qi(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(o){try{Zn(o)}catch(r){t=r}}),n.__H=void 0,t&&Pe.__e(t,n.__v))};var Wi=typeof requestAnimationFrame=="function";function Q_(e){var t,n=function(){clearTimeout(o),Wi&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);Wi&&(t=requestAnimationFrame(n))}function Zn(e){var t=ve,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),ve=t}function Rr(e){var t=ve;e.__c=e.__(),ve=t}function Er(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function ji(e,t){return typeof t=="function"?t(e):t}var Z_=Symbol.for("preact-signals");function ro(){if(rt>1)rt--;else{var e,t=!1;for((function(){var r=no;for(no=void 0;r!==void 0;){var i=r.S;if(i.v===r.v)for(var l=i.t;l!==void 0;l=l.x)l.i===r.i&&(l.i=i.i);r=r.o}})();_n!==void 0;){var n=_n;for(_n=void 0,to++;n!==void 0;){var o=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Yi(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if(to=0,rt--,t)throw e}}function $t(e){if(rt>0)return e();Ar=++eu,rt++;try{return e()}finally{ro()}}var dn,pe=void 0;function un(e){var t=pe,n=dn;pe=void 0,dn=void 0;try{return e()}finally{pe=t,dn=n}}var _n=void 0,rt=0,to=0,eu=0,Ar=0,no=void 0,oo=0;function Xi(e){if(pe!==void 0){var t=e.n;if(t===void 0||t.t!==pe)return t={i:0,S:e,p:pe.s,n:void 0,t:pe,e:void 0,x:void 0,r:t},pe.s!==void 0&&(pe.s.n=t),pe.s=t,e.n=t,32&pe.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=pe.s,t.n=void 0,pe.s.n=t,pe.s=t),t}}function we(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}we.prototype.brand=Z_;we.prototype.h=function(){return!0};we.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:un(function(){var o;(o=t.W)==null||o.call(t)}))};we.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&&un(function(){var r;(r=t.Z)==null||r.call(t)}))}};we.prototype.subscribe=function(e){var t=this;return at(function(){var n=t.value;un(function(){return e(n)})},{name:"sub"})};we.prototype.valueOf=function(){return this.value};we.prototype.toString=function(){return this.value+""};we.prototype.toJSON=function(){return this.value};we.prototype.peek=function(){var e=this;return un(function(){return e.value})};Object.defineProperty(we.prototype,"value",{get:function(){var e=Xi(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(to>100)throw new Error("Cycle detected");(function(n){rt!==0&&to===0&&n.l!==Ar&&(n.l=Ar,no={S:n,v:n.v,i:n.i,o:no})})(this),this.v=e,this.i++,oo++,rt++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{ro()}}}});function q(e,t){return new we(e,t)}function Yi(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 Ji(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 Qi(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 ht(e,t){we.call(this,void 0,t),this.x=e,this.s=void 0,this.g=oo-1,this.f=4}ht.prototype=new we;ht.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===oo))return!0;if(this.g=oo,this.f|=1,this.i>0&&!Yi(this))return this.f&=-2,!0;var e=pe;try{Ji(this),pe=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 pe=e,Qi(this),this.f&=-2,!0};ht.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)}we.prototype.S.call(this,e)};ht.prototype.U=function(e){if(this.t!==void 0&&(we.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)}};ht.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(ht.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Xi(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function pn(e,t){return new ht(e,t)}function Zi(e){var t=e.m;if(e.m=void 0,typeof t=="function"){rt++;var n=pe;pe=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,Ir(e),o}finally{pe=n,ro()}}}function Ir(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Zi(e)}function tu(e){if(pe!==this)throw new Error("Out-of-order effect");Qi(this),pe=e,this.f&=-2,8&this.f&&Ir(this),ro()}function Ft(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,dn&&dn.push(this)}Ft.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()}};Ft.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Zi(this),Ji(this),rt++;var e=pe;return pe=this,tu.bind(this,e)};Ft.prototype.N=function(){2&this.f||(this.f|=2,this.u=_n,_n=this)};Ft.prototype.d=function(){this.f|=8,1&this.f||Ir(this)};Ft.prototype.dispose=function(){this.d()};function at(e,t){var n=new Ft(e,t);try{n.c()}catch(r){throw n.d(),r}var o=n.d.bind(n);return o[Symbol.dispose]=o,o}var es,so,ao,nu=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var ts=[];at(function(){es=this.N})();function Bt(e,t){z[e]=t.bind(null,z[e]||function(){})}function io(e){if(ao){var t=ao;ao=void 0,t()}ao=e&&e.S()}function ns(e){var t=this,n=e.data,o=Ye(n);o.value=n;var r=Ae(function(){for(var s=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var d=pn(function(){var f=o.value.value;return f===0?0:f===!0?"":f||""}),u=pn(function(){return!Array.isArray(d.value)&&!dr(d.value)}),p=at(function(){if(this.N=os,u.value){var f=d.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=f)}}),_=t.__$u.d;return t.__$u.d=function(){p(),_.call(this)},[u,d]},[]),i=r[0],l=r[1];return i.value?l.peek():l.value}ns.displayName="ReactiveTextNode";Object.defineProperties(we.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:ns},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});Bt("__b",function(e,t){if(typeof t.type=="string"){var n,o=t.props;for(var r in o)if(r!=="children"){var i=o[r];i instanceof we&&(n||(t.__np=n={}),n[r]=i,o[r]=i.peek())}}e(t)});Bt("__r",function(e,t){if(e(t),t.type!==Z){io();var n,o=t.__c;o&&(o.__$f&=-2,(n=o.__$u)===void 0&&(o.__$u=n=(function(r,i){var l;return at(function(){l=this},{name:i}),l.c=r,l})(function(){var r;nu&&((r=n.y)==null||r.call(n)),o.__$f|=1,o.setState({})},typeof t.type=="function"?t.type.displayName||t.type.name:""))),so=o,io(n)}});Bt("__e",function(e,t,n,o){io(),so=void 0,e(t,n,o)});Bt("diffed",function(e,t){io(),so=void 0;var n;if(typeof t.type=="string"&&(n=t.__e)){var o=t.__np,r=t.props,i=n.U;if(i)for(var l in i){var s=i[l];s===void 0||o&&l in o||(s.d(),i[l]=void 0)}if(o){i||(i={},n.U=i);for(var c in o){var d=i[c],u=o[c];d===void 0?(d=ou(n,c,u,r),i[c]=d):d.o(u,r)}}}e(t)});function ou(e,t,n,o){var r=t in e&&e.ownerSVGElement===void 0,i=q(n);return{o:function(l,s){i.value=l,o=s},d:at(function(){this.N=os;var l=i.value.value;o[t]!==l&&(o[t]=l,r?e[t]=l:l!=null&&(l!==!1||t[4]==="-")?e.setAttribute(t,l):e.removeAttribute(t))})}}Bt("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 i=o[r];i&&i.d()}}}var l=t.__np;if(l){var s=t.props;for(var c in l)s[c]=l[c]}t.__np=void 0}else{var d=t.__c;if(d){var u=d.__$u;u&&(d.__$u=void 0,u.d())}}e(t)});Bt("__h",function(e,t,n,o){(o<3||o===9)&&(t.__$f|=2),e(t,n,o)});Oe.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 i=2&this.__$f;if(!(o||i||4&this.__$f)||1&this.__$f)return!0}else if(!(o||4&this.__$f)||3&this.__$f)return!0;for(var l in e)if(l!=="__source"&&e[l]!==this.props[l])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function Ye(e,t){return Ae(function(){return q(e,t)},[])}function ee(e,t){var n=B(e);return n.current=e,so.__$f|=4,Ae(function(){return pn(function(){return n.current()},t)},[])}var ru=function(e){queueMicrotask(function(){queueMicrotask(e)})};function au(){$t(function(){for(var e;e=ts.shift();)es.call(e)})}function os(){ts.push(this)===1&&(z.requestAnimationFrame||ru)(au)}function rs(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function as(e){return rs(e)}function is(e){return!(!rs(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}function iu(e){return`${S.cssPrefix}:${e}`}function ss(e,t){let o=Object.entries(t).map(([r,i])=>{let l=iu(r),s=c=>i(c.detail);return e.addEventListener(l,s),[l,s]});return()=>{for(let[r,i]of o)e.removeEventListener(r,i)}}function lo(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 su=900,lu=640;function Mr(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<lu?"fullscreen":n>=(t.autoSizeBreakpoint??su)?"expanded":"normal"}function mn(e,t,n,o=null){let i=e.mode==="inline"||e.mode==="standalone"||e.mode==="page"||(n??!e.startMinimized),s=e.mode!=="standalone"&&e.mode!=="page"&&e.mode!=="inline"&&o?o:Mr(e.mode,e.size,t);return{panelOpen:i,panelSize:s}}function Ht(){return typeof window>"u"?0:window.innerWidth}var cu="x-public-key",du="x-ai-agent-deployment-id";function ls(e){return{headers(){let t={};return e.aiAgentDeploymentId&&(t[du]=e.aiAgentDeploymentId),e.publicKey&&(t[e.publicKeyHeader??cu]=e.publicKey),t}}}function zt(e,t){return new Promise(n=>{if(t?.aborted)return n();let o=setTimeout(i,e),r=()=>i();t?.addEventListener("abort",r,{once:!0});function i(){clearTimeout(o),t?.removeEventListener("abort",r),n()}})}var co="0.72.1";var Je=class extends Error{constructor(n,o,r,i){super(n);G(this,"code",o);G(this,"status",r);G(this,"cause",i);this.name="StreamError"}};var cs=W.scope("parser");async function*ds(e,t){if(!e.ok){let n=await e.text().catch(()=>"");throw new Je(`server responded ${e.status}: ${n.slice(0,200)}`,"server",e.status)}for await(let n of _u(e,t)){let o=uu(n);if(o==="done")return;o&&(yield o)}}async function*_u(e,t){if(!e.body)throw new Je("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:i}=await n.read();if(r){let s=o.trim();s&&(yield s);return}o+=i;let l;for(;(l=o.indexOf(`
8
8
 
9
9
  `))!==-1;){let s=o.slice(0,l);o=o.slice(l+2),yield s}}}finally{n.releaseLock()}}function uu(e){let t="",n;for(let o of e.split(`
10
10
  `))if(!(o===""||o.startsWith(":"))){if(o.startsWith("data:")){let r=o.slice(5).replace(/^ /,"");t=t?`${t}