teodor-new-chat-ui 4.1.32 → 4.1.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -2857,11 +2857,7 @@ function ox(e, t) {
2857
2857
  if (a.includes(s) && s.length <= l && !u)
2858
2858
  continue;
2859
2859
  const d = sx(a, s);
2860
- if (d) {
2861
- const f = d.length / Math.max(1, s.length);
2862
- d.length > 0 && f <= 0.6 ? i.text = a + d : i.text = s;
2863
- } else
2864
- i.text = a + s;
2860
+ d ? i.text = a + d : i.text = a + s;
2865
2861
  } else
2866
2862
  n.push({ type: "text", text: s });
2867
2863
  } else
package/dist/index.umd.js CHANGED
@@ -27,7 +27,7 @@ Check the top-level render call using <`+D+">.")}return j}}function oe(b,j){{if(
27
27
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(o=>r.set(o)),r}static accessor(t){const r=(this[dl]=this[dl]={accessors:{}}).accessors,o=this.prototype;function s(i){const a=jr(i);r[a]||(Mm(o,i),r[a]=!0)}return P.isArray(t)?t.forEach(s):s(t),this}};Ct.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),P.reduceDescriptors(Ct.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}}),P.freezeMethods(Ct);function Hs(e,t){const n=this||Ar,r=t||n,o=Ct.from(r.headers);let s=r.data;return P.forEach(e,function(a){s=a.call(n,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function fl(e){return!!(e&&e.__CANCEL__)}function or(e,t,n){Re.call(this,e??"canceled",Re.ERR_CANCELED,t,n),this.name="CanceledError"}P.inherits(or,Re,{__CANCEL__:!0});function hl(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Re("Request failed with status code "+n.status,[Re.ERR_BAD_REQUEST,Re.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Dm(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Lm(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o=0,s=0,i;return t=t!==void 0?t:1e3,function(l){const u=Date.now(),d=r[s];i||(i=u),n[o]=l,r[o]=u;let f=s,h=0;for(;f!==o;)h+=n[f++],f=f%e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),u-i<t)return;const p=d&&u-d;return p?Math.round(h*1e3/p):void 0}}function $m(e,t){let n=0,r=1e3/t,o,s;const i=(u,d=Date.now())=>{n=d,o=null,s&&(clearTimeout(s),s=null),e(...u)};return[(...u)=>{const d=Date.now(),f=d-n;f>=r?i(u,d):(o=u,s||(s=setTimeout(()=>{s=null,i(o)},r-f)))},()=>o&&i(o)]}const uo=(e,t,n=3)=>{let r=0;const o=Lm(50,250);return $m(s=>{const i=s.loaded,a=s.lengthComputable?s.total:void 0,l=i-r,u=o(l),d=i<=a;r=i;const f={loaded:i,total:a,progress:a?i/a:void 0,bytes:l,rate:u||void 0,estimated:u&&a&&d?(a-i)/u:void 0,event:s,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},n)},pl=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},ml=e=>(...t)=>P.asap(()=>e(...t)),Fm=ht.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,ht.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(ht.origin),ht.navigator&&/(msie|trident)/i.test(ht.navigator.userAgent)):()=>!0,zm=ht.hasStandardBrowserEnv?{write(e,t,n,r,o,s){const i=[e+"="+encodeURIComponent(t)];P.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),P.isString(r)&&i.push("path="+r),P.isString(o)&&i.push("domain="+o),s===!0&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Bm(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Hm(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function gl(e,t,n){let r=!Bm(t);return e&&(r||n==!1)?Hm(e,t):t}const xl=e=>e instanceof Ct?{...e}:e;function On(e,t){t=t||{};const n={};function r(u,d,f,h){return P.isPlainObject(u)&&P.isPlainObject(d)?P.merge.call({caseless:h},u,d):P.isPlainObject(d)?P.merge({},d):P.isArray(d)?d.slice():d}function o(u,d,f,h){if(P.isUndefined(d)){if(!P.isUndefined(u))return r(void 0,u,f,h)}else return r(u,d,f,h)}function s(u,d){if(!P.isUndefined(d))return r(void 0,d)}function i(u,d){if(P.isUndefined(d)){if(!P.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function a(u,d,f){if(f in t)return r(u,d);if(f in e)return r(void 0,u)}const l={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(u,d,f)=>o(xl(u),xl(d),f,!0)};return P.forEach(Object.keys({...e,...t}),function(d){const f=l[d]||o,h=f(e[d],t[d],d);P.isUndefined(h)&&f!==a||(n[d]=h)}),n}const vl=e=>{const t=On({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:s,headers:i,auth:a}=t;if(t.headers=i=Ct.from(i),t.url=al(gl(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),P.isFormData(n)){if(ht.hasStandardBrowserEnv||ht.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(P.isFunction(n.getHeaders)){const l=n.getHeaders(),u=["content-type","content-length"];Object.entries(l).forEach(([d,f])=>{u.includes(d.toLowerCase())&&i.set(d,f)})}}if(ht.hasStandardBrowserEnv&&(r&&P.isFunction(r)&&(r=r(t)),r||r!==!1&&Fm(t.url))){const l=o&&s&&zm.read(s);l&&i.set(o,l)}return t},Um=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){const o=vl(e);let s=o.data;const i=Ct.from(o.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:u}=o,d,f,h,p,w;function v(){p&&p(),w&&w(),o.cancelToken&&o.cancelToken.unsubscribe(d),o.signal&&o.signal.removeEventListener("abort",d)}let g=new XMLHttpRequest;g.open(o.method.toUpperCase(),o.url,!0),g.timeout=o.timeout;function x(){if(!g)return;const C=Ct.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),T={data:!a||a==="text"||a==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:C,config:e,request:g};hl(function(I){n(I),v()},function(I){r(I),v()},T),g=null}"onloadend"in g?g.onloadend=x:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(x)},g.onabort=function(){g&&(r(new Re("Request aborted",Re.ECONNABORTED,e,g)),g=null)},g.onerror=function(E){const T=E&&E.message?E.message:"Network Error",k=new Re(T,Re.ERR_NETWORK,e,g);k.event=E||null,r(k),g=null},g.ontimeout=function(){let E=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const T=o.transitional||cl;o.timeoutErrorMessage&&(E=o.timeoutErrorMessage),r(new Re(E,T.clarifyTimeoutError?Re.ETIMEDOUT:Re.ECONNABORTED,e,g)),g=null},s===void 0&&i.setContentType(null),"setRequestHeader"in g&&P.forEach(i.toJSON(),function(E,T){g.setRequestHeader(T,E)}),P.isUndefined(o.withCredentials)||(g.withCredentials=!!o.withCredentials),a&&a!=="json"&&(g.responseType=o.responseType),u&&([h,w]=uo(u,!0),g.addEventListener("progress",h)),l&&g.upload&&([f,p]=uo(l),g.upload.addEventListener("progress",f),g.upload.addEventListener("loadend",p)),(o.cancelToken||o.signal)&&(d=C=>{g&&(r(!C||C.type?new or(null,e,g):C),g.abort(),g=null)},o.cancelToken&&o.cancelToken.subscribe(d),o.signal&&(o.signal.aborted?d():o.signal.addEventListener("abort",d)));const y=Dm(o.url);if(y&&ht.protocols.indexOf(y)===-1){r(new Re("Unsupported protocol "+y+":",Re.ERR_BAD_REQUEST,e));return}g.send(s||null)})},Wm=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,o;const s=function(u){if(!o){o=!0,a();const d=u instanceof Error?u:this.reason;r.abort(d instanceof Re?d:new or(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,s(new Re(`timeout ${t} of ms exceeded`,Re.ETIMEDOUT))},t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),e=null)};e.forEach(u=>u.addEventListener("abort",s));const{signal:l}=r;return l.unsubscribe=()=>P.asap(a),l}},Vm=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,o;for(;r<n;)o=r+t,yield e.slice(r,o),r=o},Km=async function*(e,t){for await(const n of qm(e))yield*Vm(n,t)},qm=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},wl=(e,t,n,r)=>{const o=Km(e,t);let s=0,i,a=l=>{i||(i=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:u,value:d}=await o.next();if(u){a(),l.close();return}let f=d.byteLength;if(n){let h=s+=f;n(h)}l.enqueue(new Uint8Array(d))}catch(u){throw a(u),u}},cancel(l){return a(l),o.return()}},{highWaterMark:2})},bl=64*1024,{isFunction:fo}=P,Gm=(({Request:e,Response:t})=>({Request:e,Response:t}))(P.global),{ReadableStream:yl,TextEncoder:Sl}=P.global,Cl=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Ym=e=>{e=P.merge.call({skipUndefined:!0},Gm,e);const{fetch:t,Request:n,Response:r}=e,o=t?fo(t):typeof fetch=="function",s=fo(n),i=fo(r);if(!o)return!1;const a=o&&fo(yl),l=o&&(typeof Sl=="function"?(w=>v=>w.encode(v))(new Sl):async w=>new Uint8Array(await new n(w).arrayBuffer())),u=s&&a&&Cl(()=>{let w=!1;const v=new n(ht.origin,{body:new yl,method:"POST",get duplex(){return w=!0,"half"}}).headers.has("Content-Type");return w&&!v}),d=i&&a&&Cl(()=>P.isReadableStream(new r("").body)),f={stream:d&&(w=>w.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(w=>{!f[w]&&(f[w]=(v,g)=>{let x=v&&v[w];if(x)return x.call(v);throw new Re(`Response type '${w}' is not supported`,Re.ERR_NOT_SUPPORT,g)})});const h=async w=>{if(w==null)return 0;if(P.isBlob(w))return w.size;if(P.isSpecCompliantForm(w))return(await new n(ht.origin,{method:"POST",body:w}).arrayBuffer()).byteLength;if(P.isArrayBufferView(w)||P.isArrayBuffer(w))return w.byteLength;if(P.isURLSearchParams(w)&&(w=w+""),P.isString(w))return(await l(w)).byteLength},p=async(w,v)=>{const g=P.toFiniteNumber(w.getContentLength());return g??h(v)};return async w=>{let{url:v,method:g,data:x,signal:y,cancelToken:C,timeout:E,onDownloadProgress:T,onUploadProgress:k,responseType:I,headers:A,withCredentials:_="same-origin",fetchOptions:R}=vl(w),L=t||fetch;I=I?(I+"").toLowerCase():"text";let $=Wm([y,C&&C.toAbortSignal()],E),V=null;const O=$&&$.unsubscribe&&(()=>{$.unsubscribe()});let Y;try{if(k&&u&&g!=="get"&&g!=="head"&&(Y=await p(A,x))!==0){let H=new n(v,{method:"POST",body:x,duplex:"half"}),me;if(P.isFormData(x)&&(me=H.headers.get("content-type"))&&A.setContentType(me),H.body){const[de,ee]=pl(Y,uo(ml(k)));x=wl(H.body,bl,de,ee)}}P.isString(_)||(_=_?"include":"omit");const K=s&&"credentials"in n.prototype,J={...R,signal:$,method:g.toUpperCase(),headers:A.normalize().toJSON(),body:x,duplex:"half",credentials:K?_:void 0};V=s&&new n(v,J);let B=await(s?L(V,R):L(v,J));const F=d&&(I==="stream"||I==="response");if(d&&(T||F&&O)){const H={};["status","statusText","headers"].forEach(Ae=>{H[Ae]=B[Ae]});const me=P.toFiniteNumber(B.headers.get("content-length")),[de,ee]=T&&pl(me,uo(ml(T),!0))||[];B=new r(wl(B.body,bl,de,()=>{ee&&ee(),O&&O()}),H)}I=I||"text";let z=await f[P.findKey(f,I)||"text"](B,w);return!F&&O&&O(),await new Promise((H,me)=>{hl(H,me,{data:z,headers:Ct.from(B.headers),status:B.status,statusText:B.statusText,config:w,request:V})})}catch(K){throw O&&O(),K&&K.name==="TypeError"&&/Load failed|fetch/i.test(K.message)?Object.assign(new Re("Network Error",Re.ERR_NETWORK,w,V),{cause:K.cause||K}):Re.from(K,K&&K.code,w,V)}}},Xm=new Map,Tl=e=>{let t=e?e.env:{};const{fetch:n,Request:r,Response:o}=t,s=[r,o,n];let i=s.length,a=i,l,u,d=Xm;for(;a--;)l=s[a],u=d.get(l),u===void 0&&d.set(l,u=a?new Map:Ym(t)),d=u;return u};Tl();const Us={http:vm,xhr:Um,fetch:{get:Tl}};P.forEach(Us,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const kl=e=>`- ${e}`,Jm=e=>P.isFunction(e)||e===null||e===!1,El={getAdapter:(e,t)=>{e=P.isArray(e)?e:[e];const{length:n}=e;let r,o;const s={};for(let i=0;i<n;i++){r=e[i];let a;if(o=r,!Jm(r)&&(o=Us[(a=String(r)).toLowerCase()],o===void 0))throw new Re(`Unknown adapter '${a}'`);if(o&&(P.isFunction(o)||(o=o.get(t))))break;s[a||"#"+i]=o}if(!o){const i=Object.entries(s).map(([l,u])=>`adapter ${l} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=n?i.length>1?`since :
28
28
  `+i.map(kl).join(`
29
29
  `):" "+kl(i[0]):"as no adapter specified";throw new Re("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return o},adapters:Us};function Ws(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new or(null,e)}function Il(e){return Ws(e),e.headers=Ct.from(e.headers),e.data=Hs.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),El.getAdapter(e.adapter||Ar.adapter,e)(e).then(function(r){return Ws(e),r.data=Hs.call(e,e.transformResponse,r),r.headers=Ct.from(r.headers),r},function(r){return fl(r)||(Ws(e),r&&r.response&&(r.response.data=Hs.call(e,e.transformResponse,r.response),r.response.headers=Ct.from(r.response.headers))),Promise.reject(r)})}const Nl="1.12.2",ho={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ho[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Al={};ho.transitional=function(t,n,r){function o(s,i){return"[Axios v"+Nl+"] Transitional option '"+s+"'"+i+(r?". "+r:"")}return(s,i,a)=>{if(t===!1)throw new Re(o(i," has been removed"+(n?" in "+n:"")),Re.ERR_DEPRECATED);return n&&!Al[i]&&(Al[i]=!0,console.warn(o(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(s,i,a):!0}},ho.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function Zm(e,t,n){if(typeof e!="object")throw new Re("options must be an object",Re.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const s=r[o],i=t[s];if(i){const a=e[s],l=a===void 0||i(a,s,e);if(l!==!0)throw new Re("option "+s+" must be "+l,Re.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Re("Unknown option "+s,Re.ERR_BAD_OPTION)}}const po={assertOptions:Zm,validators:ho},Xt=po.validators;let Mn=class{constructor(t){this.defaults=t||{},this.interceptors={request:new ll,response:new ll}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const s=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=`
30
- `+s):r.stack=s}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=On(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:s}=n;r!==void 0&&po.assertOptions(r,{silentJSONParsing:Xt.transitional(Xt.boolean),forcedJSONParsing:Xt.transitional(Xt.boolean),clarifyTimeoutError:Xt.transitional(Xt.boolean)},!1),o!=null&&(P.isFunction(o)?n.paramsSerializer={serialize:o}:po.assertOptions(o,{encode:Xt.function,serialize:Xt.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),po.assertOptions(n,{baseUrl:Xt.spelling("baseURL"),withXsrfToken:Xt.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=s&&P.merge(s.common,s[n.method]);s&&P.forEach(["delete","get","head","post","put","patch","common"],w=>{delete s[w]}),n.headers=Ct.concat(i,s);const a=[];let l=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(n)===!1||(l=l&&v.synchronous,a.unshift(v.fulfilled,v.rejected))});const u=[];this.interceptors.response.forEach(function(v){u.push(v.fulfilled,v.rejected)});let d,f=0,h;if(!l){const w=[Il.bind(this),void 0];for(w.unshift(...a),w.push(...u),h=w.length,d=Promise.resolve(n);f<h;)d=d.then(w[f++],w[f++]);return d}h=a.length;let p=n;for(;f<h;){const w=a[f++],v=a[f++];try{p=w(p)}catch(g){v.call(this,g);break}}try{d=Il.call(this,p)}catch(w){return Promise.reject(w)}for(f=0,h=u.length;f<h;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=On(this.defaults,t);const n=gl(t.baseURL,t.url,t.allowAbsoluteUrls);return al(n,t.params,t.paramsSerializer)}};P.forEach(["delete","get","head","options"],function(t){Mn.prototype[t]=function(n,r){return this.request(On(r||{},{method:t,url:n,data:(r||{}).data}))}}),P.forEach(["post","put","patch"],function(t){function n(r){return function(s,i,a){return this.request(On(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}Mn.prototype[t]=n(),Mn.prototype[t+"Form"]=n(!0)});let Qm=class Ap{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(o=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](o);r._listeners=null}),this.promise.then=o=>{let s;const i=new Promise(a=>{r.subscribe(a),s=a}).then(o);return i.cancel=function(){r.unsubscribe(s)},i},t(function(s,i,a){r.reason||(r.reason=new or(s,i,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Ap(function(o){t=o}),cancel:t}}};function eg(e){return function(n){return e.apply(null,n)}}function tg(e){return P.isObject(e)&&e.isAxiosError===!0}const Vs={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Vs).forEach(([e,t])=>{Vs[t]=e});function jl(e){const t=new Mn(e),n=Ka(Mn.prototype.request,t);return P.extend(n,Mn.prototype,t,{allOwnKeys:!0}),P.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return jl(On(e,o))},n}const it=jl(Ar);it.Axios=Mn,it.CanceledError=or,it.CancelToken=Qm,it.isCancel=fl,it.VERSION=Nl,it.toFormData=lo,it.AxiosError=Re,it.Cancel=it.CanceledError,it.all=function(t){return Promise.all(t)},it.spread=eg,it.isAxiosError=tg,it.mergeConfig=On,it.AxiosHeaders=Ct,it.formToJSON=e=>ul(P.isHTMLForm(e)?new FormData(e):e),it.getAdapter=El.getAdapter,it.HttpStatusCode=Vs,it.default=it;const{Axios:_C,AxiosError:RC,CanceledError:PC,isCancel:OC,CancelToken:MC,VERSION:DC,all:LC,Cancel:$C,isAxiosError:FC,spread:zC,toFormData:BC,AxiosHeaders:HC,HttpStatusCode:UC,formToJSON:WC,getAdapter:VC,mergeConfig:KC}=it,_l=typeof window<"u"?window.__API_BASE_URL__:void 0,Rl=_l?fn(_l):void 0;function fn(e){const n=(e!=null&&e.trim()?e.trim():"/api/chat").replace(/\/+$/,"");return n?n.endsWith("/chat")?n:`${n}/chat`:"/api/chat"}let mo=null;const Ks=new Set;function Pl(){return mo}function qs(e){mo=e,Ks.forEach(t=>t(e))}function Ol(e){return Ks.add(e),()=>Ks.delete(e)}const Pt=it.create({...Rl?{baseURL:Rl}:{},timeout:3e4,withCredentials:!0});Pt.interceptors.request.use(e=>(mo&&(e.headers.Authorization=`Bearer ${mo}`),e)),Pt.interceptors.response.use(e=>e,e=>Promise.reject(e));async function kt(e,t){return Pt.defaults.baseURL?(await Pt.get(e,t)).data:Promise.reject(new Error("API base URL is not configured"))}async function Gs(e,t,n){return Pt.defaults.baseURL?(await Pt.post(e,t,n)).data:Promise.reject(new Error("API base URL is not configured"))}async function Ml(e,t,n){return Pt.defaults.baseURL?(await Pt.put(e,t,n)).data:Promise.reject(new Error("API base URL is not configured"))}async function Dl(e,t){return Pt.defaults.baseURL?(await Pt.delete(e,t)).data:Promise.reject(new Error("API base URL is not configured"))}function Et(e){return e&&typeof e=="object"&&"data"in e?e.data:e}class Ll{get baseUrl(){const t=Pt.defaults.baseURL;return t?fn(String(t)):""}updateConfig(t){t.baseUrl&&(Pt.defaults.baseURL=fn(String(t.baseUrl))),t.authToken!==void 0&&qs(t.authToken)}getAuthToken(){return Pl()}setAuthToken(t){qs(t)}onTokenChange(t){return Ol(t)}async listThreads(){const t=await kt("/threads"),n=Et(t);return(n==null?void 0:n.items)??(t==null?void 0:t.items)??[]}async createThread(t){const r=await Gs("/threads",t?{title:t}:void 0);return Et(r)}async updateThread(t,n){const r=await Ml(`/threads/${t}`,{title:n});return Et(r)}async deleteThread(t){const n=await Dl(`/threads/${t}`);return Et(n)}async threadInfo(t){const n=await kt(`/threads/${t}/info`);return Et(n)}async listAgents(){const t=await kt("/agents"),n=Et(t);return(n==null?void 0:n.items)??[]}async getAgent(t){const n=await kt(`/agents/${t}`);return Et(n)}async getAgentSchema(t){const n=await kt(`/agents/${t}/schema`);return Et(n)}async getMessages(t){const n=await kt(`/threads/${t.threadId}/messages`,{params:{thread_id:t.threadId,checkpoint_id:t.checkpointId,checkpoint_ns:t.checkpointNs,limit:t.limit,before_id:t.beforeId??void 0}});return Et(n)}async getState(t){const n=await kt(`/threads/${t.threadId}/state`,{params:{thread_id:t.threadId,checkpoint_id:t.checkpointId,checkpoint_ns:t.checkpointNs}});return Et(n)}async getStateHistory(t){const n=await kt(`/threads/${t.threadId}/state/history`,{params:{thread_id:t.threadId,checkpoint_id:t.checkpointId,checkpoint_ns:t.checkpointNs}});return Et(n)}async listCheckpoints(t){const n=await kt(`/threads/${t}/checkpoints`,{params:{thread_id:t}});return Et(n)}async resume(t){const n=await Gs("/runs/resume",{thread_id:t.threadId,value:t.value});return Et(n)}}const gn=new Ll,$l=S.createContext(null);function ng({children:e,apiConfig:t}){const n=gn;if(t){const o=n.baseUrl,s=n.getAuthToken();t.baseUrl&&t.baseUrl!==o&&n.updateConfig({baseUrl:t.baseUrl}),t.apiKey!==void 0&&t.apiKey!==s&&n.updateConfig({authToken:t.apiKey})}const r={token:n.getAuthToken(),setToken:o=>n.setAuthToken(o),api:n,baseUrl:n.baseUrl};return c.jsx($l.Provider,{value:r,children:e})}function Ys(){const e=S.useContext($l);if(!e)throw new Error("useApi must be used within ApiProvider");return e}function rg(e,t){const n=e==null?void 0:e.checkpoints,r=Array.isArray(n)?n.slice():n?Object.values(n):[],o=i=>i&&typeof i=="object"&&i!==null&&"checkpointId"in i&&"createdAt"in i&&typeof i.checkpointId=="string"&&typeof i.createdAt=="string",s=r.filter(o).map(i=>{const a=i;return{checkpointId:a.checkpointId,checkpointNs:a.checkpointNs??"",createdAt:a.createdAt,messagesLen:a.messagesLen??0,preview:a.preview??"",role:a.role??null,parentId:a.parentId??null,editedMessageId:a.editedMessageId??null,branchLabel:a.branchLabel??null,lastMessageId:a.lastMessageId??null,hasMessages:typeof a.hasMessages=="boolean"?a.hasMessages:void 0}});return{threadId:(e==null?void 0:e.threadId)??t??null,checkpoints:s}}async function og(e){return await new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{try{const o=r.result,s=new Uint8Array(o);let i="";const a=s.byteLength;for(let l=0;l<a;l++)i+=String.fromCharCode(s[l]);t(btoa(i))}catch(o){n(o)}},r.onerror=o=>n(o),r.readAsArrayBuffer(e)})}async function sg(e,t=[],n,r,o,s){const i=[],a=[];for(const l of t)try{const u=await og(l);a.push({filename:l.name,data:u,mime_type:l.type||"application/octet-stream"})}catch{}return{contentParts:i,filesInfo:a}}function ig(e){return e.type!=="thread_info"&&e.type!=="token"}const ag={messages:[],assemblingId:null,lastCheckpointId:null,lastCheckpointNs:null,toolIndex:{},lastBranch:null};function lg(e,t){var n;switch(t.type){case"reset":{console.log("[MessageReducer] 🔄 RESET action received"),console.log("[MessageReducer] 📊 Before reset - messages count:",e.messages.length);const r={messages:Xs(((n=t.payload)==null?void 0:n.messages)??[]),assemblingId:null,lastCheckpointId:null,lastCheckpointNs:null,toolIndex:{},lastBranch:null};return console.log("[MessageReducer] 📊 After reset - messages count:",r.messages.length),r}case"seed":{const r=Xs(t.payload.messages),o={...e,messages:r,assemblingId:null};return Object.prototype.hasOwnProperty.call(t.payload,"checkpointId")&&(o.lastCheckpointId=t.payload.checkpointId??null),Object.prototype.hasOwnProperty.call(t.payload,"checkpointNs")&&(o.lastCheckpointNs=t.payload.checkpointNs??null),console.log("[MessageReducer] seed action (REPLACE mode):",{incomingCount:t.payload.messages.length,sanitizedCount:r.length,previousCount:e.messages.length,checkpointId:o.lastCheckpointId}),o}case"prepend":{const r=Xs(t.payload.messages);if(!r.length)return console.log("[MessageReducer] No incoming messages after sanitize - skipping"),e;const o=new Set(e.messages.map(i=>i.id)),s=r.filter(i=>!o.has(i.id));return console.log("[MessageReducer] After dedup:",{uniqueCount:s.length,duplicates:r.length-s.length,finalTotal:s.length+e.messages.length}),s.length?{...e,messages:[...s,...e.messages]}:(console.log("[MessageReducer] All messages were duplicates - skipping"),e)}case"user_message":{const r=t.payload.message;return e.messages.some(o=>o.id===r.id)?e:{...e,messages:[...e.messages,r]}}case"event":return zl(e,t.payload.ev);case"batch":{const{events:r}=t.payload;return r.length?r.reduce((o,s)=>zl(o,s),e):e}case"interrupt_response":{const{interruptId:r}=t.payload,o=e.messages.map(s=>({...s,content:s.content.filter(i=>i.type!=="interrupt")}));return{...e,messages:o,pendingInterrupt:null}}default:return e}}function Fl(e=[]){const[t,n]=S.useReducer(lg,{...ag,messages:e}),r=S.useRef([]),o=S.useRef(null),s=S.useRef(null),i=S.useCallback(()=>{o.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(o.current),s.current!==null&&clearTimeout(s.current),o.current=null,s.current=null;const d=r.current;d.length&&(r.current=[],n({type:"batch",payload:{events:d}}))},[]),a=S.useCallback(()=>{typeof window<"u"&&typeof window.requestAnimationFrame=="function"?o.current===null&&(o.current=window.requestAnimationFrame(()=>i())):s.current===null&&(s.current=setTimeout(i,8))},[i]),l=S.useCallback(d=>{r.current.push(d),a()},[a]);S.useEffect(()=>()=>{o.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(o.current),s.current!==null&&clearTimeout(s.current),r.current=[]},[]);const u=S.useMemo(()=>({reset:d=>n({type:"reset",payload:{messages:d}}),seed:(d,f)=>n({type:"seed",payload:{messages:d,...f??{}}}),prepend:d=>n({type:"prepend",payload:{messages:d}}),pushUser:d=>n({type:"user_message",payload:{message:d}}),onEvent:l}),[l]);return{state:t,dispatch:n,...u}}function zl(e,t){var n,r,o,s;if(t.type==="message_start"&&t.role==="assistant"){const i=t.id,a=pg(t.model);if(e.messages.some(d=>d.id===i))return{...e,assemblingId:i};const u={id:i,role:"assistant",name:a||void 0,model:t.model,createdAt:new Date().toISOString(),content:[]};return{...e,assemblingId:i,messages:[...e.messages,u]}}if(t.type==="message_delta"){const i=e.assemblingId??Js(e.messages);return i?{...e,messages:Zs(e.messages,i,t.delta)}:e}if(t.type==="message_end"){const i=e.assemblingId??Js(e.messages);if(!i)return{...e,assemblingId:null};const a=e.messages,l=a.findIndex(u=>u.id===i&&u.role==="assistant");if(l>=0){const u=a[l];if(!((n=u.content)==null?void 0:n.some(f=>{var h;return(f==null?void 0:f.type)==="text"&&((h=f.text)==null?void 0:h.trim())}))){console.debug("[MessageReducer] pruning assistant message with no visible text",{id:u.id,contentTypes:(r=u.content)==null?void 0:r.map(h=>h==null?void 0:h.type),contentPreview:(o=u.content)==null?void 0:o.map(h=>(h==null?void 0:h.type)==="text"?String(h.text).slice(0,100):h==null?void 0:h.type)});const f=[...a.slice(0,l),...a.slice(l+1)];return{...e,assemblingId:null,messages:f}}}return e}if(t.type==="tool_start"){const i=t.id??t.call_id,a=t.name??t.tool??"tool";if(!i)return e;const l=`tool-${i}`,u={type:"tool_call",id:i,name:a,args:t.args};if(e.messages.find(h=>h.id===l))return{...e,toolIndex:{...e.toolIndex,[i]:l}};const f={id:l,role:"tool",name:a,createdAt:new Date().toISOString(),content:[u]};return{...e,messages:[...e.messages,f],toolIndex:{...e.toolIndex,[i]:l}}}if(t.type==="tool_end"){const i=t.id??t.call_id;if(!i)return e;const a=e.toolIndex[i]??`tool-${i}`,l={type:"tool_end",toolCallId:i,output:t.output,error:t.error},u=e.messages.find(h=>h.id===a),d={id:a,role:"tool",name:t.name??((s=e.messages.find(h=>h.id===a))==null?void 0:s.name),content:[l],createdAt:new Date().toISOString()},f=u?Zs(e.messages,a,[l]):[...e.messages,d];return{...e,messages:f,toolIndex:{...e.toolIndex,[i]:a}}}if(t.type==="checkpoint"){const i=t.checkpointNs??e.lastCheckpointNs??null,a=hg(e.messages,t.checkpointId,i);return{...e,lastCheckpointId:t.checkpointId,lastCheckpointNs:i,messages:a}}if(t.type==="branch"){const i=t.checkpointId??e.lastCheckpointId,a=t.checkpointNs??e.lastCheckpointNs;return{...e,lastBranch:t,lastCheckpointId:i??null,lastCheckpointNs:a??null}}if(t.type==="error"){const i={id:`err-${Date.now()}`,role:"system",content:[{type:"text",text:`Error: ${t.message}`}],createdAt:new Date().toISOString()};return{...e,messages:[...e.messages,i]}}if(t.type==="interrupt"){const i=e.assemblingId??Js(e.messages),a={type:"interrupt",value:t.value};if(i)return{...e,assemblingId:null,messages:Zs(e.messages,i,[a]),pendingInterrupt:{id:t.id,value:t.value}};const l={id:`interrupt-${t.id}`,role:"system",createdAt:new Date().toISOString(),content:[a]};return{...e,messages:[...e.messages,l],pendingInterrupt:{id:t.id,value:t.value}}}return e}function Xs(e){return e.filter(t=>{if(t.role!=="assistant")return!0;const n=(t.content||[]).some(o=>{var s;return o&&o.type==="text"&&((s=o.text)==null?void 0:s.trim())}),r=(t.content||[]).some(o=>o&&o.type==="image_url");return!!(n||r)})}function cg(e,t,n){return t<0||t>=e.length?e:[...e.slice(0,t),n,...e.slice(t+1)]}function Js(e){for(let t=e.length-1;t>=0;t--)if(e[t].role==="assistant")return e[t].id;return null}function ug(e,t,n){const r=e.findIndex(i=>i.id===t);if(r===-1)return e;const o=e[r],s=n(o);return s===o?e:[...e.slice(0,r),s,...e.slice(r+1)]}function Zs(e,t,n){return ug(e,t,r=>({...r,content:dg(r.content,n)}))}function dg(e,t){const n=e.slice();for(const r of t)if(r.type==="text"){const o=n[n.length-1],s=r.text??"";if(!s)continue;if((o==null?void 0:o.type)==="text"){const i=o,a=i.text??"";if(!a){i.text=s;continue}if(s.startsWith(a)){i.text=s;continue}const l=3,u=/^[^\w\s]+$/.test(s);if(a.includes(s)&&s.length<=l&&!u)continue;const d=fg(a,s);if(d){const f=d.length/Math.max(1,s.length);d.length>0&&f<=.6?i.text=a+d:i.text=s}else i.text=a+s}else n.push({type:"text",text:s})}else n.push(r);return n}function fg(e,t){if(!t)return"";if(!e)return t;if(e===t)return"";const n=Math.min(e.length,t.length);for(let r=n;r>0;r--)if(e.slice(-r)===t.slice(0,r))return t.slice(r);return t}function hg(e,t,n){for(let r=e.length-1;r>=0;r--)if(e[r].role==="assistant"){const s={...e[r],checkpointId:t,checkpointNs:n??void 0};return cg(e,r,s)}return e}function pg(e){if(!e)return null;const t=e.split("/");return t[t.length-1]||null}function Bl(e={}){const t=S.useMemo(()=>fn(e.baseUrl),[e.baseUrl]),n=e.streamPath??"/runs/stream",[r,o]=S.useState(e.token??null),s=S.useRef(e.headers??{}),i=e.credentials??"include",[a,l]=S.useState(!1),[u,d]=S.useState(null),[f,h]=S.useState(""),[p,w]=S.useState(null),[v,g]=S.useState(0),[x,y]=S.useState(!1),C=S.useRef(null),E=S.useRef(!0),T=S.useRef(0),k=S.useCallback(R=>{o(R)},[]),I=S.useCallback(()=>{var R;(R=C.current)==null||R.abort(),C.current=null,l(!1),y(!1),T.current=0,g(0)},[]),A=S.useCallback(()=>{h(""),w(null),d(null)},[]),_=S.useCallback((R,L,$)=>{C.current&&(C.current.abort(),C.current=null),l(!0),d(null),e.autoAppendAssistant!==!1&&h("");const V=new AbortController;return C.current=V,(async()=>{var Y,K,J,B,F,z,H,me;const O=de=>{var ee;try{const Ae=JSON.parse(JSON.stringify(de));return(ee=Ae==null?void 0:Ae.payload)!=null&&ee.files_info&&Array.isArray(Ae.payload.files_info)&&(Ae.payload.files_info=Ae.payload.files_info.map(Te=>({...Te,data:Te!=null&&Te.data?`<base64 ${String(Te.data).length} chars>`:Te==null?void 0:Te.data}))),Ae}catch{return de}};try{let de={};try{if(r)de={Authorization:`Bearer ${r}`};else if(typeof window<"u"){const Oe=window.__AUTH_TOKEN__,Qe=((Y=window.localStorage)==null?void 0:Y.getItem("authToken"))||null;let ze=null;try{const ut=(K=window.localStorage)==null?void 0:K.getItem("chat-settings");ut&&(ze=((J=JSON.parse(ut))==null?void 0:J.apiKey)||null)}catch{}const st=Oe||Qe||ze||null;st&&(de={Authorization:`Bearer ${st}`})}}catch{}console.debug("[use-chat] POST",t+n,O(R));const ee=await fetch(t+n,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream",...de,...s.current},body:JSON.stringify(R),signal:V.signal,credentials:i});if(!ee.ok||!ee.body){const ke=await ee.text().catch(()=>"");throw console.debug("[use-chat] non-OK response",ee.status,ke==null?void 0:ke.slice(0,500)),new Error(`stream ${ee.status}${ke?": "+ke:""}`)}y(!0);const Ae=ee.body.getReader(),Te=new TextDecoder;let G="",M=[];T.current=0,g(0);let Q=0,q=null;const ue=()=>{if(M.length){const ke=M.join("");M=[],E.current&&h(Oe=>Oe+ke)}q=null},le=()=>{typeof window<"u"&&q==null&&(q=requestAnimationFrame(ue))};let Fe=Date.now();const Ke=setInterval(()=>{var ke;if(Date.now()-Fe>6e4){const Oe="Stream idle timeout";d(Oe),V.abort(),(ke=$==null?void 0:$.onError)==null||ke.call($,Oe)}},5e3),Ve=1024*1024;try{const ke=ee.headers.get("X-Thread-Id")||ee.headers.get("x-thread-id"),Oe=ee.headers.get("X-Thread-Created")||ee.headers.get("x-thread-created"),Qe=ke??null,ze=String(Oe??"").toLowerCase()==="true";for((B=$==null?void 0:$.onOpen)==null||B.call($,{threadId:Qe,created:ze});;){const{value:st,done:ut}=await Ae.read();if(ut)break;G+=Te.decode(st,{stream:!0}),G.length>Ve&&(G="",console.warn("Stream buffer reset: exceeded 1MB"));let re;for(;(re=G.indexOf(`
30
+ `+s):r.stack=s}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=On(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:s}=n;r!==void 0&&po.assertOptions(r,{silentJSONParsing:Xt.transitional(Xt.boolean),forcedJSONParsing:Xt.transitional(Xt.boolean),clarifyTimeoutError:Xt.transitional(Xt.boolean)},!1),o!=null&&(P.isFunction(o)?n.paramsSerializer={serialize:o}:po.assertOptions(o,{encode:Xt.function,serialize:Xt.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),po.assertOptions(n,{baseUrl:Xt.spelling("baseURL"),withXsrfToken:Xt.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=s&&P.merge(s.common,s[n.method]);s&&P.forEach(["delete","get","head","post","put","patch","common"],w=>{delete s[w]}),n.headers=Ct.concat(i,s);const a=[];let l=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(n)===!1||(l=l&&v.synchronous,a.unshift(v.fulfilled,v.rejected))});const u=[];this.interceptors.response.forEach(function(v){u.push(v.fulfilled,v.rejected)});let d,f=0,h;if(!l){const w=[Il.bind(this),void 0];for(w.unshift(...a),w.push(...u),h=w.length,d=Promise.resolve(n);f<h;)d=d.then(w[f++],w[f++]);return d}h=a.length;let p=n;for(;f<h;){const w=a[f++],v=a[f++];try{p=w(p)}catch(g){v.call(this,g);break}}try{d=Il.call(this,p)}catch(w){return Promise.reject(w)}for(f=0,h=u.length;f<h;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=On(this.defaults,t);const n=gl(t.baseURL,t.url,t.allowAbsoluteUrls);return al(n,t.params,t.paramsSerializer)}};P.forEach(["delete","get","head","options"],function(t){Mn.prototype[t]=function(n,r){return this.request(On(r||{},{method:t,url:n,data:(r||{}).data}))}}),P.forEach(["post","put","patch"],function(t){function n(r){return function(s,i,a){return this.request(On(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}Mn.prototype[t]=n(),Mn.prototype[t+"Form"]=n(!0)});let Qm=class Ap{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(o=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](o);r._listeners=null}),this.promise.then=o=>{let s;const i=new Promise(a=>{r.subscribe(a),s=a}).then(o);return i.cancel=function(){r.unsubscribe(s)},i},t(function(s,i,a){r.reason||(r.reason=new or(s,i,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Ap(function(o){t=o}),cancel:t}}};function eg(e){return function(n){return e.apply(null,n)}}function tg(e){return P.isObject(e)&&e.isAxiosError===!0}const Vs={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Vs).forEach(([e,t])=>{Vs[t]=e});function jl(e){const t=new Mn(e),n=Ka(Mn.prototype.request,t);return P.extend(n,Mn.prototype,t,{allOwnKeys:!0}),P.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return jl(On(e,o))},n}const it=jl(Ar);it.Axios=Mn,it.CanceledError=or,it.CancelToken=Qm,it.isCancel=fl,it.VERSION=Nl,it.toFormData=lo,it.AxiosError=Re,it.Cancel=it.CanceledError,it.all=function(t){return Promise.all(t)},it.spread=eg,it.isAxiosError=tg,it.mergeConfig=On,it.AxiosHeaders=Ct,it.formToJSON=e=>ul(P.isHTMLForm(e)?new FormData(e):e),it.getAdapter=El.getAdapter,it.HttpStatusCode=Vs,it.default=it;const{Axios:_C,AxiosError:RC,CanceledError:PC,isCancel:OC,CancelToken:MC,VERSION:DC,all:LC,Cancel:$C,isAxiosError:FC,spread:zC,toFormData:BC,AxiosHeaders:HC,HttpStatusCode:UC,formToJSON:WC,getAdapter:VC,mergeConfig:KC}=it,_l=typeof window<"u"?window.__API_BASE_URL__:void 0,Rl=_l?fn(_l):void 0;function fn(e){const n=(e!=null&&e.trim()?e.trim():"/api/chat").replace(/\/+$/,"");return n?n.endsWith("/chat")?n:`${n}/chat`:"/api/chat"}let mo=null;const Ks=new Set;function Pl(){return mo}function qs(e){mo=e,Ks.forEach(t=>t(e))}function Ol(e){return Ks.add(e),()=>Ks.delete(e)}const Pt=it.create({...Rl?{baseURL:Rl}:{},timeout:3e4,withCredentials:!0});Pt.interceptors.request.use(e=>(mo&&(e.headers.Authorization=`Bearer ${mo}`),e)),Pt.interceptors.response.use(e=>e,e=>Promise.reject(e));async function kt(e,t){return Pt.defaults.baseURL?(await Pt.get(e,t)).data:Promise.reject(new Error("API base URL is not configured"))}async function Gs(e,t,n){return Pt.defaults.baseURL?(await Pt.post(e,t,n)).data:Promise.reject(new Error("API base URL is not configured"))}async function Ml(e,t,n){return Pt.defaults.baseURL?(await Pt.put(e,t,n)).data:Promise.reject(new Error("API base URL is not configured"))}async function Dl(e,t){return Pt.defaults.baseURL?(await Pt.delete(e,t)).data:Promise.reject(new Error("API base URL is not configured"))}function Et(e){return e&&typeof e=="object"&&"data"in e?e.data:e}class Ll{get baseUrl(){const t=Pt.defaults.baseURL;return t?fn(String(t)):""}updateConfig(t){t.baseUrl&&(Pt.defaults.baseURL=fn(String(t.baseUrl))),t.authToken!==void 0&&qs(t.authToken)}getAuthToken(){return Pl()}setAuthToken(t){qs(t)}onTokenChange(t){return Ol(t)}async listThreads(){const t=await kt("/threads"),n=Et(t);return(n==null?void 0:n.items)??(t==null?void 0:t.items)??[]}async createThread(t){const r=await Gs("/threads",t?{title:t}:void 0);return Et(r)}async updateThread(t,n){const r=await Ml(`/threads/${t}`,{title:n});return Et(r)}async deleteThread(t){const n=await Dl(`/threads/${t}`);return Et(n)}async threadInfo(t){const n=await kt(`/threads/${t}/info`);return Et(n)}async listAgents(){const t=await kt("/agents"),n=Et(t);return(n==null?void 0:n.items)??[]}async getAgent(t){const n=await kt(`/agents/${t}`);return Et(n)}async getAgentSchema(t){const n=await kt(`/agents/${t}/schema`);return Et(n)}async getMessages(t){const n=await kt(`/threads/${t.threadId}/messages`,{params:{thread_id:t.threadId,checkpoint_id:t.checkpointId,checkpoint_ns:t.checkpointNs,limit:t.limit,before_id:t.beforeId??void 0}});return Et(n)}async getState(t){const n=await kt(`/threads/${t.threadId}/state`,{params:{thread_id:t.threadId,checkpoint_id:t.checkpointId,checkpoint_ns:t.checkpointNs}});return Et(n)}async getStateHistory(t){const n=await kt(`/threads/${t.threadId}/state/history`,{params:{thread_id:t.threadId,checkpoint_id:t.checkpointId,checkpoint_ns:t.checkpointNs}});return Et(n)}async listCheckpoints(t){const n=await kt(`/threads/${t}/checkpoints`,{params:{thread_id:t}});return Et(n)}async resume(t){const n=await Gs("/runs/resume",{thread_id:t.threadId,value:t.value});return Et(n)}}const gn=new Ll,$l=S.createContext(null);function ng({children:e,apiConfig:t}){const n=gn;if(t){const o=n.baseUrl,s=n.getAuthToken();t.baseUrl&&t.baseUrl!==o&&n.updateConfig({baseUrl:t.baseUrl}),t.apiKey!==void 0&&t.apiKey!==s&&n.updateConfig({authToken:t.apiKey})}const r={token:n.getAuthToken(),setToken:o=>n.setAuthToken(o),api:n,baseUrl:n.baseUrl};return c.jsx($l.Provider,{value:r,children:e})}function Ys(){const e=S.useContext($l);if(!e)throw new Error("useApi must be used within ApiProvider");return e}function rg(e,t){const n=e==null?void 0:e.checkpoints,r=Array.isArray(n)?n.slice():n?Object.values(n):[],o=i=>i&&typeof i=="object"&&i!==null&&"checkpointId"in i&&"createdAt"in i&&typeof i.checkpointId=="string"&&typeof i.createdAt=="string",s=r.filter(o).map(i=>{const a=i;return{checkpointId:a.checkpointId,checkpointNs:a.checkpointNs??"",createdAt:a.createdAt,messagesLen:a.messagesLen??0,preview:a.preview??"",role:a.role??null,parentId:a.parentId??null,editedMessageId:a.editedMessageId??null,branchLabel:a.branchLabel??null,lastMessageId:a.lastMessageId??null,hasMessages:typeof a.hasMessages=="boolean"?a.hasMessages:void 0}});return{threadId:(e==null?void 0:e.threadId)??t??null,checkpoints:s}}async function og(e){return await new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{try{const o=r.result,s=new Uint8Array(o);let i="";const a=s.byteLength;for(let l=0;l<a;l++)i+=String.fromCharCode(s[l]);t(btoa(i))}catch(o){n(o)}},r.onerror=o=>n(o),r.readAsArrayBuffer(e)})}async function sg(e,t=[],n,r,o,s){const i=[],a=[];for(const l of t)try{const u=await og(l);a.push({filename:l.name,data:u,mime_type:l.type||"application/octet-stream"})}catch{}return{contentParts:i,filesInfo:a}}function ig(e){return e.type!=="thread_info"&&e.type!=="token"}const ag={messages:[],assemblingId:null,lastCheckpointId:null,lastCheckpointNs:null,toolIndex:{},lastBranch:null};function lg(e,t){var n;switch(t.type){case"reset":{console.log("[MessageReducer] 🔄 RESET action received"),console.log("[MessageReducer] 📊 Before reset - messages count:",e.messages.length);const r={messages:Xs(((n=t.payload)==null?void 0:n.messages)??[]),assemblingId:null,lastCheckpointId:null,lastCheckpointNs:null,toolIndex:{},lastBranch:null};return console.log("[MessageReducer] 📊 After reset - messages count:",r.messages.length),r}case"seed":{const r=Xs(t.payload.messages),o={...e,messages:r,assemblingId:null};return Object.prototype.hasOwnProperty.call(t.payload,"checkpointId")&&(o.lastCheckpointId=t.payload.checkpointId??null),Object.prototype.hasOwnProperty.call(t.payload,"checkpointNs")&&(o.lastCheckpointNs=t.payload.checkpointNs??null),console.log("[MessageReducer] seed action (REPLACE mode):",{incomingCount:t.payload.messages.length,sanitizedCount:r.length,previousCount:e.messages.length,checkpointId:o.lastCheckpointId}),o}case"prepend":{const r=Xs(t.payload.messages);if(!r.length)return console.log("[MessageReducer] No incoming messages after sanitize - skipping"),e;const o=new Set(e.messages.map(i=>i.id)),s=r.filter(i=>!o.has(i.id));return console.log("[MessageReducer] After dedup:",{uniqueCount:s.length,duplicates:r.length-s.length,finalTotal:s.length+e.messages.length}),s.length?{...e,messages:[...s,...e.messages]}:(console.log("[MessageReducer] All messages were duplicates - skipping"),e)}case"user_message":{const r=t.payload.message;return e.messages.some(o=>o.id===r.id)?e:{...e,messages:[...e.messages,r]}}case"event":return zl(e,t.payload.ev);case"batch":{const{events:r}=t.payload;return r.length?r.reduce((o,s)=>zl(o,s),e):e}case"interrupt_response":{const{interruptId:r}=t.payload,o=e.messages.map(s=>({...s,content:s.content.filter(i=>i.type!=="interrupt")}));return{...e,messages:o,pendingInterrupt:null}}default:return e}}function Fl(e=[]){const[t,n]=S.useReducer(lg,{...ag,messages:e}),r=S.useRef([]),o=S.useRef(null),s=S.useRef(null),i=S.useCallback(()=>{o.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(o.current),s.current!==null&&clearTimeout(s.current),o.current=null,s.current=null;const d=r.current;d.length&&(r.current=[],n({type:"batch",payload:{events:d}}))},[]),a=S.useCallback(()=>{typeof window<"u"&&typeof window.requestAnimationFrame=="function"?o.current===null&&(o.current=window.requestAnimationFrame(()=>i())):s.current===null&&(s.current=setTimeout(i,8))},[i]),l=S.useCallback(d=>{r.current.push(d),a()},[a]);S.useEffect(()=>()=>{o.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(o.current),s.current!==null&&clearTimeout(s.current),r.current=[]},[]);const u=S.useMemo(()=>({reset:d=>n({type:"reset",payload:{messages:d}}),seed:(d,f)=>n({type:"seed",payload:{messages:d,...f??{}}}),prepend:d=>n({type:"prepend",payload:{messages:d}}),pushUser:d=>n({type:"user_message",payload:{message:d}}),onEvent:l}),[l]);return{state:t,dispatch:n,...u}}function zl(e,t){var n,r,o,s;if(t.type==="message_start"&&t.role==="assistant"){const i=t.id,a=pg(t.model);if(e.messages.some(d=>d.id===i))return{...e,assemblingId:i};const u={id:i,role:"assistant",name:a||void 0,model:t.model,createdAt:new Date().toISOString(),content:[]};return{...e,assemblingId:i,messages:[...e.messages,u]}}if(t.type==="message_delta"){const i=e.assemblingId??Js(e.messages);return i?{...e,messages:Zs(e.messages,i,t.delta)}:e}if(t.type==="message_end"){const i=e.assemblingId??Js(e.messages);if(!i)return{...e,assemblingId:null};const a=e.messages,l=a.findIndex(u=>u.id===i&&u.role==="assistant");if(l>=0){const u=a[l];if(!((n=u.content)==null?void 0:n.some(f=>{var h;return(f==null?void 0:f.type)==="text"&&((h=f.text)==null?void 0:h.trim())}))){console.debug("[MessageReducer] pruning assistant message with no visible text",{id:u.id,contentTypes:(r=u.content)==null?void 0:r.map(h=>h==null?void 0:h.type),contentPreview:(o=u.content)==null?void 0:o.map(h=>(h==null?void 0:h.type)==="text"?String(h.text).slice(0,100):h==null?void 0:h.type)});const f=[...a.slice(0,l),...a.slice(l+1)];return{...e,assemblingId:null,messages:f}}}return e}if(t.type==="tool_start"){const i=t.id??t.call_id,a=t.name??t.tool??"tool";if(!i)return e;const l=`tool-${i}`,u={type:"tool_call",id:i,name:a,args:t.args};if(e.messages.find(h=>h.id===l))return{...e,toolIndex:{...e.toolIndex,[i]:l}};const f={id:l,role:"tool",name:a,createdAt:new Date().toISOString(),content:[u]};return{...e,messages:[...e.messages,f],toolIndex:{...e.toolIndex,[i]:l}}}if(t.type==="tool_end"){const i=t.id??t.call_id;if(!i)return e;const a=e.toolIndex[i]??`tool-${i}`,l={type:"tool_end",toolCallId:i,output:t.output,error:t.error},u=e.messages.find(h=>h.id===a),d={id:a,role:"tool",name:t.name??((s=e.messages.find(h=>h.id===a))==null?void 0:s.name),content:[l],createdAt:new Date().toISOString()},f=u?Zs(e.messages,a,[l]):[...e.messages,d];return{...e,messages:f,toolIndex:{...e.toolIndex,[i]:a}}}if(t.type==="checkpoint"){const i=t.checkpointNs??e.lastCheckpointNs??null,a=hg(e.messages,t.checkpointId,i);return{...e,lastCheckpointId:t.checkpointId,lastCheckpointNs:i,messages:a}}if(t.type==="branch"){const i=t.checkpointId??e.lastCheckpointId,a=t.checkpointNs??e.lastCheckpointNs;return{...e,lastBranch:t,lastCheckpointId:i??null,lastCheckpointNs:a??null}}if(t.type==="error"){const i={id:`err-${Date.now()}`,role:"system",content:[{type:"text",text:`Error: ${t.message}`}],createdAt:new Date().toISOString()};return{...e,messages:[...e.messages,i]}}if(t.type==="interrupt"){const i=e.assemblingId??Js(e.messages),a={type:"interrupt",value:t.value};if(i)return{...e,assemblingId:null,messages:Zs(e.messages,i,[a]),pendingInterrupt:{id:t.id,value:t.value}};const l={id:`interrupt-${t.id}`,role:"system",createdAt:new Date().toISOString(),content:[a]};return{...e,messages:[...e.messages,l],pendingInterrupt:{id:t.id,value:t.value}}}return e}function Xs(e){return e.filter(t=>{if(t.role!=="assistant")return!0;const n=(t.content||[]).some(o=>{var s;return o&&o.type==="text"&&((s=o.text)==null?void 0:s.trim())}),r=(t.content||[]).some(o=>o&&o.type==="image_url");return!!(n||r)})}function cg(e,t,n){return t<0||t>=e.length?e:[...e.slice(0,t),n,...e.slice(t+1)]}function Js(e){for(let t=e.length-1;t>=0;t--)if(e[t].role==="assistant")return e[t].id;return null}function ug(e,t,n){const r=e.findIndex(i=>i.id===t);if(r===-1)return e;const o=e[r],s=n(o);return s===o?e:[...e.slice(0,r),s,...e.slice(r+1)]}function Zs(e,t,n){return ug(e,t,r=>({...r,content:dg(r.content,n)}))}function dg(e,t){const n=e.slice();for(const r of t)if(r.type==="text"){const o=n[n.length-1],s=r.text??"";if(!s)continue;if((o==null?void 0:o.type)==="text"){const i=o,a=i.text??"";if(!a){i.text=s;continue}if(s.startsWith(a)){i.text=s;continue}const l=3,u=/^[^\w\s]+$/.test(s);if(a.includes(s)&&s.length<=l&&!u)continue;const d=fg(a,s);d?i.text=a+d:i.text=a+s}else n.push({type:"text",text:s})}else n.push(r);return n}function fg(e,t){if(!t)return"";if(!e)return t;if(e===t)return"";const n=Math.min(e.length,t.length);for(let r=n;r>0;r--)if(e.slice(-r)===t.slice(0,r))return t.slice(r);return t}function hg(e,t,n){for(let r=e.length-1;r>=0;r--)if(e[r].role==="assistant"){const s={...e[r],checkpointId:t,checkpointNs:n??void 0};return cg(e,r,s)}return e}function pg(e){if(!e)return null;const t=e.split("/");return t[t.length-1]||null}function Bl(e={}){const t=S.useMemo(()=>fn(e.baseUrl),[e.baseUrl]),n=e.streamPath??"/runs/stream",[r,o]=S.useState(e.token??null),s=S.useRef(e.headers??{}),i=e.credentials??"include",[a,l]=S.useState(!1),[u,d]=S.useState(null),[f,h]=S.useState(""),[p,w]=S.useState(null),[v,g]=S.useState(0),[x,y]=S.useState(!1),C=S.useRef(null),E=S.useRef(!0),T=S.useRef(0),k=S.useCallback(R=>{o(R)},[]),I=S.useCallback(()=>{var R;(R=C.current)==null||R.abort(),C.current=null,l(!1),y(!1),T.current=0,g(0)},[]),A=S.useCallback(()=>{h(""),w(null),d(null)},[]),_=S.useCallback((R,L,$)=>{C.current&&(C.current.abort(),C.current=null),l(!0),d(null),e.autoAppendAssistant!==!1&&h("");const V=new AbortController;return C.current=V,(async()=>{var Y,K,J,B,F,z,H,me;const O=de=>{var ee;try{const Ae=JSON.parse(JSON.stringify(de));return(ee=Ae==null?void 0:Ae.payload)!=null&&ee.files_info&&Array.isArray(Ae.payload.files_info)&&(Ae.payload.files_info=Ae.payload.files_info.map(Te=>({...Te,data:Te!=null&&Te.data?`<base64 ${String(Te.data).length} chars>`:Te==null?void 0:Te.data}))),Ae}catch{return de}};try{let de={};try{if(r)de={Authorization:`Bearer ${r}`};else if(typeof window<"u"){const Oe=window.__AUTH_TOKEN__,Qe=((Y=window.localStorage)==null?void 0:Y.getItem("authToken"))||null;let ze=null;try{const ut=(K=window.localStorage)==null?void 0:K.getItem("chat-settings");ut&&(ze=((J=JSON.parse(ut))==null?void 0:J.apiKey)||null)}catch{}const st=Oe||Qe||ze||null;st&&(de={Authorization:`Bearer ${st}`})}}catch{}console.debug("[use-chat] POST",t+n,O(R));const ee=await fetch(t+n,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream",...de,...s.current},body:JSON.stringify(R),signal:V.signal,credentials:i});if(!ee.ok||!ee.body){const ke=await ee.text().catch(()=>"");throw console.debug("[use-chat] non-OK response",ee.status,ke==null?void 0:ke.slice(0,500)),new Error(`stream ${ee.status}${ke?": "+ke:""}`)}y(!0);const Ae=ee.body.getReader(),Te=new TextDecoder;let G="",M=[];T.current=0,g(0);let Q=0,q=null;const ue=()=>{if(M.length){const ke=M.join("");M=[],E.current&&h(Oe=>Oe+ke)}q=null},le=()=>{typeof window<"u"&&q==null&&(q=requestAnimationFrame(ue))};let Fe=Date.now();const Ke=setInterval(()=>{var ke;if(Date.now()-Fe>6e4){const Oe="Stream idle timeout";d(Oe),V.abort(),(ke=$==null?void 0:$.onError)==null||ke.call($,Oe)}},5e3),Ve=1024*1024;try{const ke=ee.headers.get("X-Thread-Id")||ee.headers.get("x-thread-id"),Oe=ee.headers.get("X-Thread-Created")||ee.headers.get("x-thread-created"),Qe=ke??null,ze=String(Oe??"").toLowerCase()==="true";for((B=$==null?void 0:$.onOpen)==null||B.call($,{threadId:Qe,created:ze});;){const{value:st,done:ut}=await Ae.read();if(ut)break;G+=Te.decode(st,{stream:!0}),G.length>Ve&&(G="",console.warn("Stream buffer reset: exceeded 1MB"));let re;for(;(re=G.indexOf(`
31
31
 
32
32
  `))>=0;){const ce=G.slice(0,re);G=G.slice(re+2);const fe=gg(ce);if(!fe)continue;let je;try{je=JSON.parse(fe)}catch{console.debug("[use-chat] malformed SSE:",fe.slice(0,200));continue}const pe=mg(je)?je.data:je;Fe=Date.now();const ge=pe.seq;if(ge!==void 0){if(ge<=Q){console.debug("[use-chat] drop duplicate/out-of-order event",{seq:ge,lastProcessedSeq:Q,type:pe.type});continue}Q>0&&ge>Q+1&&((F=$==null?void 0:$.onGap)==null||F.call($,{from:Q,to:ge})),Q=ge,T.current=ge,g(ge)}if(console.debug("[use-chat] received event",{seq:pe.seq,type:pe.type,preview:(()=>{var He;try{return pe.type==="message_delta"?{deltaTypes:(He=pe.delta)==null?void 0:He.map(Me=>Me.type),textLen:(pe.delta||[]).filter(Me=>Me.type==="text").map(Me=>String(Me.text||"").length)}:pe.content||pe.delta?{hasContent:!0}:{}}catch(Me){return{err:String(Me)}}})()}),L==null||L(pe),pe.type==="token"&&e.autoAppendAssistant!==!1)M.push(pe.content),le();else if(pe.type==="message_delta"){const He=pe.delta.filter(Me=>Me.type==="text").map(Me=>Me.text).join("");He&&e.autoAppendAssistant!==!1&&(M.push(He),le())}else pe.type==="heartbeat"?console.debug("[use-chat] heartbeat received"):(q!==null&&cancelAnimationFrame(q),ue(),pe.type==="checkpoint"?w(pe.checkpointId):pe.type==="error"&&d(pe.message))}}ue()}catch(ke){if(ke.name!=="AbortError"){const Oe=ke.message||String(ke);d(Oe),(z=$==null?void 0:$.onError)==null||z.call($,Oe)}}finally{try{await Ae.cancel()}catch{}finally{(H=Ae.releaseLock)==null||H.call(Ae)}q!==null&&typeof window<"u"&&window.cancelAnimationFrame(q),clearInterval(Ke),l(!1),y(!1),C.current=null,T.current=0,g(0)}}catch(de){if(de.name!=="AbortError"){const ee=de.message||String(de);d(ee),(me=$==null?void 0:$.onError)==null||me.call($,ee)}}finally{l(!1),y(!1),C.current=null,T.current=0,g(0)}})(),{close:()=>V.abort()}},[t,n,r,e.autoAppendAssistant]);return S.useEffect(()=>()=>{var R;E.current=!1,(R=C.current)==null||R.abort()},[]),{isStreaming:a,error:u,assistantText:f,lastCheckpointId:p,lastSeq:v,connected:x,stream:_,stop:I,clear:A,setToken:k}}function mg(e){return!!e&&typeof e=="object"&&e.protocolVersion==="v1"&&"data"in e}function gg(e){const t=e.split(/\r?\n/),n=[];for(const r of t)if(r&&!r.startsWith(":")&&r.startsWith("data:")){const o=r.slice(5);n.push(o.startsWith(" ")?o.slice(1):o)}return n.length===0?null:n.join(`
33
33
  `)}function xg({baseUrl:e,onThreadInfo:t,onMessageEvent:n,onUnhandledEvent:r,onSequenceGap:o}){const s=S.useRef(null),i=S.useCallback(p=>{const w=p.seq??null;if(w!==null){const v=s.current;if(v!==null){if(w<=v)return;w>v+1&&(o==null||o({from:v,to:w}))}s.current=w}if(p.type==="thread_info"){console.log("[useChatStreamingService] 🎯 Received thread_info event:",p),t(p);return}if(ig(p)){n(p);return}r==null||r(p)},[n,o,t,r]),{stream:a,stop:l,isStreaming:u,error:d,setToken:f}=Bl({baseUrl:e,token:null}),h=S.useCallback((p,w)=>{s.current=null,a(p,i,{onOpen:w==null?void 0:w.onOpen,onError:v=>{var g;(g=w==null?void 0:w.onError)==null||g.call(w,v)},onGap:(w==null?void 0:w.onGap)??o})},[i,o,a]);return S.useMemo(()=>({startStream:h,stop:l,isStreaming:u,error:d,setAuthToken:f}),[h,l,u,d,f])}const Hl=S.createContext(null),Ul=S.createContext(null),Wl=S.createContext(null),vg=S.createContext(!1),wg=20,bg="cachedThreads",yg="v1",go=300,Qs=200;function Vl(e){if(typeof window<"u"&&"requestIdleCallback"in window)try{window.requestIdleCallback(e,{timeout:1e3});return}catch{}window.setTimeout(e,go)}function sr(){return typeof window<"u"&&typeof window.localStorage<"u"}function ei(e){if(!sr())return null;try{return window.localStorage.getItem(e)}catch{return null}}function Kl(e,t){if(sr())try{window.localStorage.setItem(e,t)}catch{}}function ti(e){if(sr())try{window.localStorage.removeItem(e)}catch{}}function Sg(){const e=ei(bg);if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>{if(!n||typeof n!="object")return!1;const r=n;return typeof r.threadId=="string"&&typeof r.title=="string"}):[]}catch{return[]}}function Cg(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t^e.charCodeAt(n);return(t>>>0).toString(36)}function ni(e,t){return`cachedThreads:v1:${e}:${Cg(t||"anon")}`}function Tg(e){const t=ei(e);if(!t)return[];try{const n=JSON.parse(t);return Array.isArray(n)?n.filter(r=>{if(!r||typeof r!="object")return!1;const o=r;return typeof o.threadId=="string"&&typeof o.title=="string"}):[]}catch{return[]}}function ri(e,t){try{Kl(e,JSON.stringify(t))}catch{}}function ql(e){const t=Tg(e);if(t.length>0)return t;const n=Sg();if(n.length>0)try{ri(e,n.slice(0,Qs))}catch{}return n}function oi(e){const t={},n=[];for(const r of e)!r||typeof r.threadId!="string"||t[r.threadId]||(t[r.threadId]=r,n.push(r.threadId));return{byId:t,order:n}}function si(e){return e.order.map(t=>e.byId[t]).filter(Boolean)}function kg({children:e,initialThreadId:t=null,autoLoadInitial:n=!0,disableAutoRestore:r=!1,enableFileAgentRouting:o=!1,fileAgentId:s="invoice_reader",onError:i,onThreadChange:a}){const{api:l,baseUrl:u}=Ys(),d=S.useMemo(()=>fn(u),[u]),f=S.useMemo(()=>{try{return new URL(u).host}catch{return"unknown"}},[u]),h=S.useMemo(()=>`threadPayload:${yg}:${f}:`,[f]),p=S.useCallback(N=>`${h}${N}`,[h]),w=S.useCallback(N=>{if(!N||typeof N!="object")return null;const b=N;return typeof b.threadId!="string"||!Array.isArray(b.messages)?null:{threadId:b.threadId,messages:b.messages,hasMore:!!b.hasMore,nextCursor:b.nextCursor??null,checkpointId:b.checkpointId??null,checkpointNs:b.checkpointNs??null}},[]),v=S.useCallback(N=>{const b=ei(p(N));if(!b)return null;try{const j=JSON.parse(b);return w(j)}catch{return null}},[p,w]),g=S.useCallback((N,b=100)=>{const j={...N,messages:Array.isArray(N.messages)?N.messages.slice(-b):[]};try{Kl(p(N.threadId),JSON.stringify(j))}catch{}},[p]),x=S.useCallback(N=>{ti(p(N))},[p]),y=S.useCallback(()=>{if(sr())try{const N=h;for(let b=0;b<window.localStorage.length;b++){const j=window.localStorage.key(b);j&&j.startsWith(N)&&window.localStorage.removeItem(j)}}catch{}},[h]),[C,E]=S.useState(()=>{var N;return ni(f,(N=l.getAuthToken)==null?void 0:N.call(l))}),[T,k]=S.useState(()=>{var b;const N=ql(ni(f,(b=l.getAuthToken)==null?void 0:b.call(l)));return oi(N)}),I=S.useMemo(()=>si(T),[T]),[A,_]=S.useState(t),[R,L]=S.useState(!1),[$,V]=S.useState(!1),[O,Y]=S.useState(!1),[K,J]=S.useState(!1),[B,F]=S.useState(null),[z,H]=S.useState(void 0),[me,de]=S.useState(void 0),{state:ee,seed:Ae,prepend:Te,pushUser:G,onEvent:M,reset:Q}=Fl(),q=S.useRef(A);S.useEffect(()=>{q.current=A},[A]);const ue=S.useRef(!1),le=S.useRef([]),Fe=S.useRef(null),Ke=S.useRef(null),Ve=S.useRef(new Map),ke=S.useRef(A),Oe=S.useRef(!1),Qe=S.useRef(null),ze=S.useCallback((N,b)=>new Promise((j,D)=>{const U=async()=>{ue.current=!0;try{await N(),j()}catch(X){D(X)}finally{ue.current=!1;const X=le.current.shift();X&&X().catch(()=>{})}};ue.current?le.current.push(U):U().catch(X=>{D(X)})}),[]),st=S.useRef(I.length),[ut,re]=S.useState(!1),ce=S.useRef(!1);S.useEffect(()=>{st.current=I.length},[I.length]);const fe=S.useCallback(async()=>{const N=st.current>0;N||L(!0);try{const b=await l.listThreads();S.startTransition(()=>{k(j=>{const D=Se=>Se.map(we=>`${we.threadId}:${we.updatedAt??""}:${we.messageCount??""}`).join("|"),U=si(j);return D(U)===D(b)||b.length===0&&U.length>0&&!ce.current?j:oi(b)})}),ce.current||(ce.current=!0,re(!0))}catch(b){i==null||i(String(b)),console.error("[ChatSessionProvider] Failed to refresh threads:",b)}finally{N||L(!1)}},[l,i]),je=S.useRef(!1),pe=S.useRef(null),ge=S.useRef(null),He=S.useRef(""),Me=S.useCallback((N,b)=>{if(!sr())return;ge.current!==null&&(window.clearTimeout(ge.current),ge.current=null);const j=N.map(U=>`${U.threadId}:${U.updatedAt??""}:${U.messageCount??""}`).join("|");if(N.length===0){try{ti(C)}catch{}He.current="";return}if(j===He.current)return;const D=()=>{try{const U=N.slice(0,Qs);ri(C,U),He.current=j}catch{}finally{ge.current=null}};if(b!=null&&b.immediate){D();return}ge.current=window.setTimeout(()=>{Vl(D)},go)},[C]),ot=S.useCallback((N,b,j)=>{const D=Array.isArray(N==null?void 0:N.messages)?N.messages:[],U=j??(N==null?void 0:N.threadId)??q.current;if(b==="replace"){if(U){const X={threadId:U,messages:D.slice(),hasMore:!!(N!=null&&N.hasMore),nextCursor:(N==null?void 0:N.nextCursor)??null,checkpointId:(N==null?void 0:N.checkpointId)??null,checkpointNs:(N==null?void 0:N.checkpointNs)??null};Ve.current.set(U,X),ke.current=U}Ae(D,{checkpointId:(N==null?void 0:N.checkpointId)??null,checkpointNs:(N==null?void 0:N.checkpointNs)??null})}else if(b==="prepend"&&D.length&&U){const X=Ve.current.get(U),Se=(X==null?void 0:X.messages)??[],we=new Set,xe=[...D,...Se].filter(Ze=>{const et=Ze==null?void 0:Ze.id;return et?we.has(et)?!1:(we.add(et),!0):!0}),qe={threadId:U,messages:xe,hasMore:(N==null?void 0:N.hasMore)??(X==null?void 0:X.hasMore)??!1,nextCursor:(N==null?void 0:N.nextCursor)??(X==null?void 0:X.nextCursor)??null,checkpointId:(X==null?void 0:X.checkpointId)??(N==null?void 0:N.checkpointId)??null,checkpointNs:(X==null?void 0:X.checkpointNs)??(N==null?void 0:N.checkpointNs)??null};Ve.current.set(U,qe),Te(D)}else b==="prepend"&&D.length&&Te(D);b==="replace"?(F((N==null?void 0:N.nextCursor)??null),Y(!!(N!=null&&N.hasMore)),H((N==null?void 0:N.checkpointId)??void 0),de((N==null?void 0:N.checkpointNs)??void 0)):(F(X=>(N==null?void 0:N.nextCursor)??X??null),Y(X=>(N==null?void 0:N.hasMore)!==void 0?!!(N!=null&&N.hasMore):X),H(X=>(N==null?void 0:N.checkpointId)??X??void 0),de(X=>(N==null?void 0:N.checkpointNs)??X??void 0))},[Te,Ae]),xt=S.useCallback(N=>{Ae(N.messages,{checkpointId:N.checkpointId,checkpointNs:N.checkpointNs}),F(N.nextCursor),Y(N.hasMore),H(N.checkpointId??void 0),de(N.checkpointNs??void 0),ke.current=N.threadId},[Ae]),Rt=S.useCallback(N=>{N&&(Ve.current.delete(N),x(N),ke.current===N&&(ke.current=null))},[x]),cn=S.useCallback(()=>{const N=q.current;N&&Rt(N),Q([]),Y(!1),J(!1),F(null),H(void 0),de(void 0)},[Rt,Q]),Jn=S.useCallback(({from:N,to:b})=>{const j=q.current;j&&console.warn(`[ChatSessionProvider] Stream sequence gap detected (${N} -> ${b}) for thread ${j}`)},[]),br=S.useCallback(N=>{const b=N.threadId;console.log("[ChatSessionProvider] 📥 Handling thread_info event:",{threadId:b,title:N.title,created:N.created,currentThreads:I.length});const j={threadId:b,title:N.title||`Thread ${b.slice(0,8)}`,createdAt:N.createdAt||new Date().toISOString(),updatedAt:N.updatedAt||new Date().toISOString(),messageCount:N.messageCount||0};q.current!==b&&(!q.current&&ee.messages.length<=1&&(Ke.current=b),_(b)),S.startTransition(()=>{k(D=>{const U=D.byId[b];return U?U.title===j.title&&U.updatedAt===j.updatedAt&&U.messageCount===j.messageCount?D:{byId:{...D.byId,[b]:j},order:D.order}:{byId:{...D.byId,[b]:j},order:[b,...D.order]}})})},[ee.messages.length]),{startStream:An,stop:yr,isStreaming:un,error:Zn,setAuthToken:Ft}=xg({baseUrl:d,onThreadInfo:br,onMessageEvent:M,onUnhandledEvent:N=>{console.warn(`[ChatSessionProvider] Unhandled stream event: ${N.type}`,N)},onSequenceGap:Jn});S.useEffect(()=>{je.current=un},[un]),S.useEffect(()=>{if(!sr())return;ge.current!==null&&(window.clearTimeout(ge.current),ge.current=null);const N=I.map(j=>`${j.threadId}:${j.updatedAt??""}:${j.messageCount??""}`).join("|");if(I.length===0){try{ti(C)}catch{}He.current="";return}if(N===He.current)return;const b=()=>{try{const j=I.slice(0,Qs);ri(C,j),He.current=N}catch{}finally{ge.current=null}};return ge.current=window.setTimeout(()=>{Vl(b),ge.current=null},go),()=>{ge.current!==null&&(window.clearTimeout(ge.current),ge.current=null)}},[I,Me]),S.useEffect(()=>{var D;const N=l.getAuthToken();Ft(N);const b=U=>{const X=ni(f,U);Qe.current!==X&&(Qe.current=X,Oe.current=!1),E(X);const Se=ql(X);S.startTransition(()=>{k(oi(Se))}),Oe.current||(Oe.current=!0,fe().catch(()=>{}))};b(N);const j=(D=l.onTokenChange)==null?void 0:D.call(l,U=>{Ft(U),y(),b(U)});return()=>{j==null||j()}},[l,f,Ft,y,fe]);const jn=S.useCallback(async N=>{const b=`temp-${Date.now()}`,j={threadId:b,title:N||"New Chat",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),messageCount:0};k(D=>({byId:{...D.byId,[b]:j},order:[b,...D.order]})),_(b);try{const D=await l.createThread(N),U=typeof D=="string"?D:D.threadId;return k(X=>{const Se=X.byId[b];if(!Se)return X;const we={...X.byId};delete we[b],we[U]={...Se,threadId:U};const xe=X.order.map(qe=>qe===b?U:qe);return{byId:we,order:xe}}),_(U),setTimeout(()=>fe(),10),U}catch(D){throw k(U=>{if(!U.byId[b])return U;const X={...U.byId};delete X[b];const Se=U.order.filter(we=>we!==b);return{byId:X,order:Se}}),_(null),D}},[l,fe]),_n=S.useCallback(async N=>{await l.deleteThread(N);let b=null;k(j=>{if(!j.byId[N])return j;const D={...j.byId};delete D[N];const U=j.order.filter(Se=>Se!==N),X={byId:D,order:U};return b=si(X),X}),b&&Me(b,{immediate:!0}),Rt(N),q.current===N&&(Ke.current=N,_(null),q.current=null,ke.current=null,cn()),await fe()},[l,cn,Rt,fe,Me]),Qn=S.useCallback(async(N,b)=>{try{await l.updateThread(N,b),k(j=>{const D=j.byId[N];return D?{byId:{...j.byId,[N]:{...D,title:b}},order:j.order}:j})}catch(j){throw await fe(),j}},[l,fe]),zt=S.useCallback(async(N,b,j,D=!1)=>{await ze(async()=>{if(Ke.current===N&&!D){Ke.current=null;return}if(Fe.current===N&&!D)return;_(xe=>xe===N?xe:N),q.current=N;const U=!D&&!b&&!j;let X=!1;if(U){const xe=Ve.current.get(N);if(xe)xt(xe),X=!0;else{const qe=v(N);qe&&(Ve.current.set(N,qe),xt(qe),X=!0)}}const Se=D||!X||!!b||!!j,we=async xe=>{xe&&V(!0),Fe.current=N;try{const qe=await l.getMessages({threadId:N,checkpointId:b,checkpointNs:j});ot(qe,"replace",N)}catch(qe){throw(!X||D||xe)&&(i==null||i(String(qe))),qe}finally{Fe.current=null,xe&&V(!1)}};Se?await we(!0):U&&X&&we(!1).catch(xe=>{console.warn("[ChatSessionProvider] Background refresh failed:",xe)})},`loadThread-${N}`)},[l,xt,ot,ze,i]),er=S.useCallback(async()=>{await ze(async()=>{const N=q.current;N&&Rt(N),Ke.current=null,_(null),q.current=null,ke.current=null,cn(),H(void 0),de(void 0);try{localStorage.removeItem("lastThreadId")}catch(b){console.warn("[ChatSessionProvider] Failed to clear lastThreadId:",b)}},"clearCurrentThread")},[cn,Rt,ze]),Sr=S.useCallback(async N=>{const b=await l.listCheckpoints(N);return rg(b,N)},[l]),oe=S.useCallback(async(N,b)=>{if(!q.current)throw new Error("No active thread");await zt(q.current,N,b??void 0,!0)},[zt]),ve=S.useCallback(async()=>{if(!q.current)throw new Error("No active thread");await zt(q.current,void 0,void 0,!0)},[zt]),Le=S.useCallback(async N=>{if(!q.current)throw new Error("No active thread");if(K||!O)return;const b=B;if(b){J(!0);try{const j=q.current,D=await l.getMessages({threadId:j,checkpointId:z,checkpointNs:me,limit:(N==null?void 0:N.limit)??wg,beforeId:b});ot(D,"prepend",j??void 0)}finally{J(!1)}}},[l,ot,O,z,me,B,K]),Je=S.useCallback(async(N,b)=>{var yt;const j=q.current;!j&&!(b!=null&&b.payloadExtras)&&console.warn("[ChatSessionProvider] No thread ID - message will create new thread");const D=(b==null?void 0:b.attachments)||[],{contentParts:U,filesInfo:X}=await sg(l,D),Se=[...U];N&&N.trim()&&Se.push({type:"text",text:N.trim()});const we={id:((yt=crypto.randomUUID)==null?void 0:yt.call(crypto))||`user-${Date.now()}`,role:"user",content:Se,createdAt:new Date().toISOString(),checkpointId:(b==null?void 0:b.checkpointId)??ee.lastCheckpointId??void 0,checkpointNs:(b==null?void 0:b.checkpointNs)??ee.lastCheckpointNs??void 0};G(we);const xe={...we,content:Se},qe={...(b==null?void 0:b.payloadExtras)??{}},Ze=D.length>0,et={...j?{threadId:j}:{},payload:{messages:[xe],files_info:X,...o&&Ze&&s?{active_agent:s}:{},...qe},checkpointId:(b==null?void 0:b.checkpointId)??ee.lastCheckpointId??void 0,checkpointNs:(b==null?void 0:b.checkpointNs)??ee.lastCheckpointNs??void 0,nodeFilter:b==null?void 0:b.nodeFilter,config:b==null?void 0:b.config};An(et,{onError:Bt=>{console.warn("[ChatSessionProvider] Stream error:",Bt)},onOpen:({threadId:Bt,created:Ha})=>{!q.current&&Bt&&(ee.messages.length<=1&&(Ke.current=Bt),_(Bt))},onGap:Jn})},[l,o,s,Jn,ee.lastCheckpointId,ee.lastCheckpointNs,ee.messages.length,G,An]),vt=S.useCallback(async(N,b,j)=>{const D=q.current;if(!D)throw new Error("No active thread to handle interrupt");try{const U=b?j??!0:!1;await l.resume({threadId:D,value:U})}catch(U){throw console.error(`[ChatSessionProvider] Failed to handle interrupt ${N}:`,U),U}},[l]);S.useEffect(()=>{if(a==null||a(A),A)try{localStorage.setItem("lastThreadId",A)}catch(N){console.warn("[ChatSessionProvider] Failed to persist lastThreadId:",N)}},[A,a]),S.useEffect(()=>((async()=>{try{if(fe().catch(b=>{console.error("[ChatSessionProvider] Failed to refresh threads (background):",b),i==null||i(String(b))}),!r&&!t)try{const b=localStorage.getItem("lastThreadId");b&&(_(b),n&&await zt(b))}catch(b){console.warn("[ChatSessionProvider] Failed to restore last thread:",b)}else t&&n&&await zt(t)}catch(b){console.error("[ChatSessionProvider] Initialization failed:",b),i==null||i(String(b))}})(),()=>{}),[]),S.useEffect(()=>{const N=q.current;if(!N||ke.current!==N)return;const b={threadId:N,messages:ee.messages.slice(),hasMore:O,nextCursor:B,checkpointId:ee.lastCheckpointId??null,checkpointNs:ee.lastCheckpointNs??null},j=Ve.current.get(N);(!j||j.messages.length!==b.messages.length||j.messages.some((U,X)=>{var Se;return(U==null?void 0:U.id)!==((Se=b.messages[X])==null?void 0:Se.id)})||(j==null?void 0:j.hasMore)!==b.hasMore||(j==null?void 0:j.nextCursor)!==b.nextCursor||(j==null?void 0:j.checkpointId)!==b.checkpointId||(j==null?void 0:j.checkpointNs)!==b.checkpointNs)&&(Ve.current.set(N,b),pe.current&&window.clearTimeout(pe.current),pe.current=window.setTimeout(()=>{try{g(b,100)}catch(U){console.warn("[ChatSessionProvider] Failed to persist thread payload:",U)}},go))},[O,B,ee.lastCheckpointId,ee.lastCheckpointNs,ee.messages]);const Yt=S.useMemo(()=>({threads:I,currentThreadId:A,isLoadingThreads:R,isLoadingThread:$,setCurrentThreadId:_,createThread:jn,deleteThread:_n,renameThread:Qn,refreshThreads:fe,loadThread:zt,clearCurrentThread:er,listCheckpoints:Sr,navigateToCheckpoint:oe,returnToLatest:ve}),[er,jn,A,_n,$,R,Sr,zt,oe,fe,Qn,ve,I]),tr=S.useMemo(()=>({messages:ee.messages,assemblingId:ee.assemblingId,lastUserMessage:null,hasMoreHistory:O,isLoadingHistory:K,send:Je,stop:yr,loadOlderMessages:Le,clearMessages:cn,handleInterrupt:vt}),[cn,vt,O,K,Le,ee.assemblingId,ee.messages,Je,yr]),Cr=S.useMemo(()=>({isStreaming:un,error:Zn,streamingAssistantId:ee.assemblingId,lastCheckpointId:ee.lastCheckpointId??null,lastCheckpointNs:ee.lastCheckpointNs??null}),[un,ee.assemblingId,ee.lastCheckpointId,ee.lastCheckpointNs,Zn]);return c.jsx(vg.Provider,{value:!0,children:c.jsx(Wl.Provider,{value:Cr,children:c.jsx(Hl.Provider,{value:Yt,children:c.jsx(Ul.Provider,{value:tr,children:e})})})})}function xo(){const e=S.useContext(Hl);if(!e)throw new Error("useThreads must be used within ChatSessionProvider");return e}function ii(){const e=S.useContext(Ul);if(!e)throw new Error("useMessages must be used within ChatSessionProvider");return e}function Gl(){const e=S.useContext(Wl);if(!e)throw new Error("useStream must be used within ChatSessionProvider");return e}function vo({children:e,apiConfig:t,initialThreadId:n=null,autoLoadInitial:r=!0,disableAutoRestore:o=!1,enableFileAgentRouting:s=!1,fileAgentId:i="invoice_reader",onError:a,onThreadChange:l}){return c.jsx(ng,{apiConfig:t,children:c.jsx(kg,{initialThreadId:n,autoLoadInitial:r,disableAutoRestore:o,enableFileAgentRouting:s,fileAgentId:i,onError:a,onThreadChange:l,children:e})})}function te(...e){return _p.twMerge(jp.clsx(e))}const Eg=no.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Ue=m.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},s)=>{const i=r?Rn.Slot:"button";return c.jsx(i,{className:te(Eg({variant:t,size:n,className:e})),ref:s,...o})});Ue.displayName="Button";const Yl=m.forwardRef(({className:e,...t},n)=>c.jsx("textarea",{className:te("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));Yl.displayName="Textarea";function Ig({initialValue:e="",editingMessageId:t=null,placeholder:n="Type your message...",isStreaming:r=!1,disabled:o=!1,maxLength:s=2e4,onSend:i,onCancelEdit:a,onStop:l,className:u="",textareaClassName:d="",allowEmptySend:f=!1}){const[h,p]=S.useState(e),[w,v]=S.useTransition(),g=S.useRef(null);S.useEffect(()=>{p(e??""),g.current&&(g.current.style.height="auto",g.current.style.height=`${g.current.scrollHeight}px`)},[e,t]);const x=S.useCallback(()=>{const A=g.current;A&&(A.style.height="auto",A.style.height=`${A.scrollHeight}px`)},[]);S.useEffect(()=>{x()},[x]);const y=S.useCallback(async A=>{A&&A.preventDefault();const _=(h??"").trim();!_&&!f||v(()=>{try{const R=i(_);R&&typeof R.then=="function"?R.then(()=>{p(""),g.current&&(g.current.style.height="auto")}).catch(()=>{}):(p(""),g.current&&(g.current.style.height="auto"))}catch{}})},[h,i,f]),C=S.useCallback(A=>{p(A.target.value),g.current&&(g.current.style.height="auto",g.current.style.height=`${g.current.scrollHeight}px`)},[]),E=S.useCallback(A=>{A.key==="Enter"&&!A.shiftKey?(A.preventDefault(),y()):A.key==="Escape"&&t&&(A.preventDefault(),a==null||a())},[y,t,a]),I=`resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${t?"border-[hsl(var(--ring))] bg-[hsl(var(--card))] text-[hsl(var(--card-foreground))] dark:bg-[hsl(var(--card))] dark:text-[hsl(var(--card-foreground))]":""} ${d}`;return c.jsx("form",{onSubmit:A=>void y(A),className:`w-full ${u}`,children:c.jsxs("div",{className:"flex items-end gap-2",children:[c.jsx("div",{className:"flex-1",children:c.jsx(Yl,{ref:g,value:h,onChange:C,onKeyDown:E,placeholder:t?"Edit your message...":n,className:I,disabled:o,maxLength:s,rows:1,spellCheck:!1,autoCorrect:"off"})}),c.jsx("div",{children:r?c.jsx(Ue,{type:"button",onClick:()=>{l==null||l()},size:"icon",variant:"outline",className:"shrink-0",title:"Stop generating",disabled:o||!l,children:c.jsx(ne.Square,{size:16})}):c.jsx(Ue,{type:"submit",size:"icon",className:"shrink-0",title:t?"Save changes":"Send message",disabled:o||!h.trim()&&!f||w,children:c.jsx(ne.Send,{size:16})})})]})})}const Ng=S.memo(Ig),wo=0,xn=1,ir=2,Xl=4;function Jl(e){return()=>e}function Ag(e){e()}function Zl(e,t){return n=>e(t(n))}function Ql(e,t){return()=>e(t)}function jg(e,t){return n=>e(t,n)}function ai(e){return e!==void 0}function _g(...e){return()=>{e.map(Ag)}}function ar(){}function bo(e,t){return t(e),e}function Rg(e,t){return t(e)}function tt(...e){return e}function Ge(e,t){return e(xn,t)}function Pe(e,t){e(wo,t)}function li(e){e(ir)}function at(e){return e(Xl)}function he(e,t){return Ge(e,jg(t,wo))}function Ut(e,t){const n=e(xn,r=>{n(),t(r)});return n}function ec(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function tc(e,t){return e===t}function nt(e=tc){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function Ee(e){return t=>n=>{e(n)&&t(n)}}function se(e){return t=>Zl(t,e)}function Jt(e){return t=>()=>{t(e)}}function W(e,...t){const n=Pg(...t);return(r,o)=>{switch(r){case ir:li(e);return;case xn:return Ge(e,n(o))}}}function Zt(e,t){return n=>r=>{n(t=e(t,r))}}function Dn(e){return t=>n=>{e>0?e--:t(n)}}function hn(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function De(...e){const t=new Array(e.length);let n=0,r=null;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const a=Math.pow(2,i);Ge(s,l=>{const u=n;n=n|a,t[i]=l,u!==o&&n===o&&r&&(r(),r=null)})}),s=>i=>{const a=()=>{s([i].concat(t))};n===o?a():r=a}}function Pg(...e){return t=>e.reduceRight(Rg,t)}function Og(e){let t,n;const r=()=>t==null?void 0:t();return function(o,s){switch(o){case xn:return s?n===s?void 0:(r(),n=s,t=Ge(e,s),t):(r(),ar);case ir:r(),n=null;return}}}function Z(e){let t=e;const n=Be();return(r,o)=>{switch(r){case wo:t=o;break;case xn:{o(t);break}case Xl:return t}return n(r,o)}}function pt(e,t){return bo(Z(t),n=>he(e,n))}function Be(){const e=[];return(t,n)=>{switch(t){case wo:e.slice().forEach(r=>{r(n)});return;case ir:e.splice(0,e.length);return;case xn:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)}}}}function It(e){return bo(Be(),t=>he(e,t))}function We(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:Mg(),singleton:n}}const Mg=()=>Symbol();function Dg(e){const t=new Map,n=({constructor:r,dependencies:o,id:s,singleton:i})=>{if(i&&t.has(s))return t.get(s);const a=r(o.map(l=>n(l)));return i&&t.set(s,a),a};return n(e)}function lt(...e){const t=Be(),n=new Array(e.length);let r=0;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const a=Math.pow(2,i);Ge(s,l=>{n[i]=l,r=r|a,r===o&&Pe(t,n)})}),function(s,i){switch(s){case ir:{li(t);return}case xn:return r===o&&i(n),Ge(t,i)}}}function Ce(e,t=tc){return W(e,nt(t))}function ci(...e){return function(t,n){switch(t){case ir:return;case xn:return _g(...e.map(r=>Ge(r,n)))}}}var Tt=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(Tt||{});const Lg={0:"debug",3:"error",1:"log",2:"warn"},$g=()=>typeof globalThis>"u"?window:globalThis,vn=We(()=>{const e=Z(3);return{log:Z((t,n,r=1)=>{var o;const s=(o=$g().VIRTUOSO_LOG_LEVEL)!=null?o:at(e);r>=s&&console[Lg[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function Ln(e,t,n){return ui(e,t,n).callbackRef}function ui(e,t,n){const r=S.useRef(null);let o=i=>{};const s=S.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(i=>{const a=()=>{const l=i[0].target;l.offsetParent!==null&&e(l)};n?a():requestAnimationFrame(a)}):null,[e,n]);return o=i=>{i&&t?(s==null||s.observe(i),r.current=i):(r.current&&(s==null||s.unobserve(r.current)),r.current=null)},{callbackRef:o,ref:r}}function Fg(e,t,n,r,o,s,i,a,l){const u=S.useCallback(d=>{const f=zg(d.children,t,a?"offsetWidth":"offsetHeight",o);let h=d.parentElement;for(;!h.dataset.virtuosoScroller;)h=h.parentElement;const p=h.lastElementChild.dataset.viewportType==="window";let w;p&&(w=h.ownerDocument.defaultView);const v=i?a?i.scrollLeft:i.scrollTop:p?a?w.scrollX||w.document.documentElement.scrollLeft:w.scrollY||w.document.documentElement.scrollTop:a?h.scrollLeft:h.scrollTop,g=i?a?i.scrollWidth:i.scrollHeight:p?a?w.document.documentElement.scrollWidth:w.document.documentElement.scrollHeight:a?h.scrollWidth:h.scrollHeight,x=i?a?i.offsetWidth:i.offsetHeight:p?a?w.innerWidth:w.innerHeight:a?h.offsetWidth:h.offsetHeight;r({scrollHeight:g,scrollTop:Math.max(v,0),viewportHeight:x}),s==null||s(a?nc("column-gap",getComputedStyle(d).columnGap,o):nc("row-gap",getComputedStyle(d).rowGap,o)),f!==null&&e(f)},[e,t,o,s,i,r,a]);return ui(u,n,l)}function zg(e,t,n,r){const o=e.length;if(o===0)return null;const s=[];for(let i=0;i<o;i++){const a=e.item(i);if(a.dataset.index===void 0)continue;const l=parseInt(a.dataset.index),u=parseFloat(a.dataset.knownSize),d=t(a,n);if(d===0&&r("Zero-sized element, this should not happen",{child:a},Tt.ERROR),d===u)continue;const f=s[s.length-1];s.length===0||f.size!==d||f.endIndex!==l-1?s.push({endIndex:l,size:d,startIndex:l}):s[s.length-1].endIndex++}return s}function nc(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Tt.WARN),t==="normal"?0:parseInt(t??"0",10)}function rc(e,t,n){const r=S.useRef(null),o=S.useCallback(l=>{if(!(l!=null&&l.offsetParent))return;const u=l.getBoundingClientRect(),d=u.width;let f,h;if(t){const p=t.getBoundingClientRect(),w=u.top-p.top;h=p.height-Math.max(0,w),f=w+t.scrollTop}else{const p=i.current.ownerDocument.defaultView;h=p.innerHeight-Math.max(0,u.top),f=u.top+p.scrollY}r.current={offsetTop:f,visibleHeight:h,visibleWidth:d},e(r.current)},[e,t]),{callbackRef:s,ref:i}=ui(o,!0,n),a=S.useCallback(()=>{o(i.current)},[o,i]);return S.useEffect(()=>{var l;if(t){t.addEventListener("scroll",a);const u=new ResizeObserver(()=>{requestAnimationFrame(a)});return u.observe(t),()=>{t.removeEventListener("scroll",a),u.unobserve(t)}}else{const u=(l=i.current)==null?void 0:l.ownerDocument.defaultView;return u==null||u.addEventListener("scroll",a),u==null||u.addEventListener("resize",a),()=>{u==null||u.removeEventListener("scroll",a),u==null||u.removeEventListener("resize",a)}}},[a,t,i]),s}const wt=We(()=>{const e=Be(),t=Be(),n=Z(0),r=Be(),o=Z(0),s=Be(),i=Be(),a=Z(0),l=Z(0),u=Z(0),d=Z(0),f=Be(),h=Be(),p=Z(!1),w=Z(!1),v=Z(!1);return he(W(e,se(({scrollTop:g})=>g)),t),he(W(e,se(({scrollHeight:g})=>g)),i),he(t,o),{deviation:n,fixedFooterHeight:u,fixedHeaderHeight:l,footerHeight:d,headerHeight:a,horizontalDirection:w,scrollBy:h,scrollContainerState:e,scrollHeight:i,scrollingInProgress:p,scrollTo:f,scrollTop:t,skipAnimationFrameInResizeObserver:v,smoothScrollTargetReached:r,statefulScrollTop:o,viewportHeight:s}},[],{singleton:!0}),_r={lvl:0};function oc(e,t){const n=e.length;if(n===0)return[];let{index:r,value:o}=t(e[0]);const s=[];for(let i=1;i<n;i++){const{index:a,value:l}=t(e[i]);s.push({end:a-1,start:r,value:o}),r=a,o=l}return s.push({end:1/0,start:r,value:o}),s}function Ye(e){return e===_r}function Rr(e,t){if(!Ye(e))return t===e.k?e.v:t<e.k?Rr(e.l,t):Rr(e.r,t)}function Wt(e,t,n="k"){if(Ye(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=Wt(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return Wt(e.l,t,n)}function Nt(e,t,n){return Ye(e)?ac(t,n,1):t===e.k?ct(e,{k:t,v:n}):t<e.k?lc(ct(e,{l:Nt(e.l,t,n)})):lc(ct(e,{r:Nt(e.r,t,n)}))}function lr(){return _r}function yo(e,t,n){if(Ye(e))return[];const r=Wt(e,t)[0];return Bg(fi(e,r,n))}function di(e,t){if(Ye(e))return _r;const{k:n,l:r,r:o}=e;if(t===n){if(Ye(r))return o;if(Ye(o))return r;{const[s,i]=ic(r);return So(ct(e,{k:s,l:sc(r),v:i}))}}else return t<n?So(ct(e,{l:di(r,t)})):So(ct(e,{r:di(o,t)}))}function $n(e){return Ye(e)?[]:[...$n(e.l),{k:e.k,v:e.v},...$n(e.r)]}function fi(e,t,n){if(Ye(e))return[];const{k:r,l:o,r:s,v:i}=e;let a=[];return r>t&&(a=a.concat(fi(o,t,n))),r>=t&&r<=n&&a.push({k:r,v:i}),r<=n&&(a=a.concat(fi(s,t,n))),a}function So(e){const{l:t,lvl:n,r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(hi(t))return cc(ct(e,{lvl:n-1}));if(!Ye(t)&&!Ye(t.r))return ct(t.r,{l:ct(t,{r:t.r.l}),lvl:n,r:ct(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}else{if(hi(e))return pi(ct(e,{lvl:n-1}));if(!Ye(r)&&!Ye(r.l)){const o=r.l,s=hi(o)?r.lvl-1:r.lvl;return ct(o,{l:ct(e,{lvl:n-1,r:o.l}),lvl:o.lvl+1,r:pi(ct(r,{l:o.r,lvl:s}))})}else throw new Error("Unexpected empty nodes")}}function ct(e,t){return ac(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function sc(e){return Ye(e.r)?e.l:So(ct(e,{r:sc(e.r)}))}function hi(e){return Ye(e)||e.lvl>e.r.lvl}function ic(e){return Ye(e.r)?[e.k,e.v]:ic(e.r)}function ac(e,t,n,r=_r,o=_r){return{k:e,l:r,lvl:n,r:o,v:t}}function lc(e){return pi(cc(e))}function cc(e){const{l:t}=e;return!Ye(t)&&t.lvl===e.lvl?ct(t,{r:ct(e,{l:t.r})}):e}function pi(e){const{lvl:t,r:n}=e;return!Ye(n)&&!Ye(n.r)&&n.lvl===t&&n.r.lvl===t?ct(n,{l:ct(e,{r:n.l}),lvl:t+1}):e}function Bg(e){return oc(e,({k:t,v:n})=>({index:t,value:n}))}function uc(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function Pr(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const mi=We(()=>({recalcInProgress:Z(!1)}),[],{singleton:!0});function dc(e,t,n){return e[Co(e,t,n)]}function Co(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const s=Math.floor((r+o)/2),i=e[s],a=n(i,t);if(a===0)return s;if(a===-1){if(o-r<2)return s-1;o=s-1}else{if(o===r)return s;r=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function Hg(e,t,n,r){const o=Co(e,t,r),s=Co(e,n,r,o);return e.slice(o,s+1)}function wn(e,t){return Math.round(e.getBoundingClientRect()[t])}function To(e){return!Ye(e.groupOffsetTree)}function gi({index:e},t){return t===e?0:t<e?-1:1}function Ug(){return{groupIndices:[],groupOffsetTree:lr(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:lr()}}function Wg(e,t){let n=Ye(e)?0:1/0;for(const r of t){const{endIndex:o,size:s,startIndex:i}=r;if(n=Math.min(n,i),Ye(e)){e=Nt(e,0,s);continue}const a=yo(e,i-1,o+1);if(a.some(Jg(r)))continue;let l=!1,u=!1;for(const{end:d,start:f,value:h}of a)l?(o>=f||s===h)&&(e=di(e,f)):(u=h!==s,l=!0),d>o&&o>=f&&h!==s&&(e=Nt(e,o+1,h));u&&(e=Nt(e,i,s))}return[e,n]}function Vg(e){return typeof e.groupIndex<"u"}function Kg({offset:e},t){return t===e?0:t<e?-1:1}function Or(e,t,n){if(t.length===0)return 0;const{index:r,offset:o,size:s}=dc(t,e,gi),i=e-r,a=s*i+(i-1)*n+o;return a>0?a+n:a}function fc(e,t){if(!To(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function hc(e,t,n){if(Vg(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=fc(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function qg(e,t,n,r=0){return r>0&&(t=Math.max(t,dc(e,r,gi).offset)),oc(Hg(e,t,n,Kg),Xg)}function Gg(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,Tt.DEBUG);const s=e.sizeTree;let i=s,a=0;if(n.length>0&&Ye(s)&&t.length===2){const h=t[0].size,p=t[1].size;i=n.reduce((w,v)=>Nt(Nt(w,v,h),v+1,p),i)}else[i,a]=Wg(i,t);if(i===s)return e;const{lastIndex:l,lastOffset:u,lastSize:d,offsetTree:f}=xi(e.offsetTree,a,i,o);return{groupIndices:n,groupOffsetTree:n.reduce((h,p)=>Nt(h,p,Or(p,f,o)),lr()),lastIndex:l,lastOffset:u,lastSize:d,offsetTree:f,sizeTree:i}}function Yg(e){return $n(e).map(({k:t,v:n},r,o)=>{const s=o[r+1];return{endIndex:s?s.k-1:1/0,size:n,startIndex:t}})}function pc(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function xi(e,t,n,r){let o=e,s=0,i=0,a=0,l=0;if(t!==0){l=Co(o,t-1,gi),a=o[l].offset;const u=Wt(n,t-1);s=u[0],i=u[1],o.length&&o[l].size===Wt(n,t)[1]&&(l-=1),o=o.slice(0,l+1)}else o=[];for(const{start:u,value:d}of yo(n,t,1/0)){const f=u-s,h=f*i+a+f*r;o.push({index:u,offset:h,size:d}),s=u,a=h,i=d}return{lastIndex:s,lastOffset:a,lastSize:i,offsetTree:o}}function Xg(e){return{index:e.index,value:e}}function Jg(e){const{endIndex:t,size:n,startIndex:r}=e;return o=>o.start===r&&(o.end===t||o.end===1/0)&&o.value===n}const Zg={offsetHeight:"height",offsetWidth:"width"},Qt=We(([{log:e},{recalcInProgress:t}])=>{const n=Be(),r=Be(),o=pt(r,0),s=Be(),i=Be(),a=Z(0),l=Z([]),u=Z(void 0),d=Z(void 0),f=Z((T,k)=>wn(T,Zg[k])),h=Z(void 0),p=Z(0),w=Ug(),v=pt(W(n,De(l,e,p),Zt(Gg,w),nt()),w),g=pt(W(l,nt(),Zt((T,k)=>({current:k,prev:T.current}),{current:[],prev:[]}),se(({prev:T})=>T)),[]);he(W(l,Ee(T=>T.length>0),De(v,p),se(([T,k,I])=>{const A=T.reduce((_,R,L)=>Nt(_,R,Or(R,k.offsetTree,I)||L),lr());return{...k,groupIndices:T,groupOffsetTree:A}})),v),he(W(r,De(v),Ee(([T,{lastIndex:k}])=>T<k),se(([T,{lastIndex:k,lastSize:I}])=>[{endIndex:k,size:I,startIndex:T}])),n),he(u,d);const x=pt(W(u,se(T=>T===void 0)),!0);he(W(d,Ee(T=>T!==void 0&&Ye(at(v).sizeTree)),se(T=>[{endIndex:0,size:T,startIndex:0}])),n);const y=It(W(n,De(v),Zt(({sizes:T},[k,I])=>({changed:I!==T,sizes:I}),{changed:!1,sizes:w}),se(T=>T.changed)));Ge(W(a,Zt((T,k)=>({diff:T.prev-k,prev:k}),{diff:0,prev:0}),se(T=>T.diff)),T=>{const{groupIndices:k}=at(v);if(T>0)Pe(t,!0),Pe(s,T+pc(T,k));else if(T<0){const I=at(g);I.length>0&&(T-=pc(-T,I)),Pe(i,T)}}),Ge(W(a,De(e)),([T,k])=>{T<0&&k("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:a},Tt.ERROR)});const C=It(s);he(W(s,De(v),se(([T,k])=>{const I=k.groupIndices.length>0,A=[],_=k.lastSize;if(I){const R=Rr(k.sizeTree,0);let L=0,$=0;for(;L<T;){const O=k.groupIndices[$],Y=k.groupIndices.length===$+1?1/0:k.groupIndices[$+1]-O-1;A.push({endIndex:O,size:R,startIndex:O}),A.push({endIndex:O+1+Y-1,size:_,startIndex:O+1}),$++,L+=Y+1}const V=$n(k.sizeTree);return L!==T&&V.shift(),V.reduce((O,{k:Y,v:K})=>{let J=O.ranges;return O.prevSize!==0&&(J=[...O.ranges,{endIndex:Y+T-1,size:O.prevSize,startIndex:O.prevIndex}]),{prevIndex:Y+T,prevSize:K,ranges:J}},{prevIndex:T,prevSize:0,ranges:A}).ranges}return $n(k.sizeTree).reduce((R,{k:L,v:$})=>({prevIndex:L+T,prevSize:$,ranges:[...R.ranges,{endIndex:L+T-1,size:R.prevSize,startIndex:R.prevIndex}]}),{prevIndex:0,prevSize:_,ranges:[]}).ranges})),n);const E=It(W(i,De(v,p),se(([T,{offsetTree:k},I])=>{const A=-T;return Or(A,k,I)})));return he(W(i,De(v,p),se(([T,k,I])=>{if(k.groupIndices.length>0){if(Ye(k.sizeTree))return k;let A=lr();const _=at(g);let R=0,L=0,$=0;for(;R<-T;){$=_[L];const V=_[L+1]-$-1;L++,R+=V+1}if(A=$n(k.sizeTree).reduce((V,{k:O,v:Y})=>Nt(V,Math.max(0,O+T),Y),A),R!==-T){const V=Rr(k.sizeTree,$);A=Nt(A,0,V);const O=Wt(k.sizeTree,-T+1)[1];A=Nt(A,1,O)}return{...k,sizeTree:A,...xi(k.offsetTree,0,A,I)}}else{const A=$n(k.sizeTree).reduce((_,{k:R,v:L})=>Nt(_,Math.max(0,R+T),L),lr());return{...k,sizeTree:A,...xi(k.offsetTree,0,A,I)}}})),v),{beforeUnshiftWith:C,data:h,defaultItemSize:d,firstItemIndex:a,fixedItemSize:u,gap:p,groupIndices:l,itemSize:f,listRefresh:y,shiftWith:i,shiftWithOffset:E,sizeRanges:n,sizes:v,statefulTotalCount:o,totalCount:r,trackItemSizes:x,unshiftWith:s}},tt(vn,mi),{singleton:!0});function Qg(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{groupIndices:[],totalCount:0})}const mc=We(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:o}])=>{const s=Be(),i=Be(),a=It(W(s,se(Qg)));return he(W(a,se(l=>l.totalCount)),n),he(W(a,se(l=>l.groupIndices)),e),he(W(lt(o,t,r),Ee(([l,u])=>To(u)),se(([l,u,d])=>Wt(u.groupOffsetTree,Math.max(l-d,0),"v")[0]),nt(),se(l=>[l])),i),{groupCounts:s,topItemsIndexes:i}},tt(Qt,wt)),bn=We(([{log:e}])=>{const t=Z(!1),n=It(W(t,Ee(r=>r),nt()));return Ge(t,r=>{r&&at(e)("props updated",{},Tt.DEBUG)}),{didMount:n,propsReady:t}},tt(vn),{singleton:!0}),ex=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function gc(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!ex)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Mr=We(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:o,fixedHeaderHeight:s,footerHeight:i,headerHeight:a,scrollingInProgress:l,scrollTo:u,smoothScrollTargetReached:d,viewportHeight:f},{log:h}])=>{const p=Be(),w=Be(),v=Z(0);let g=null,x=null,y=null;function C(){g&&(g(),g=null),y&&(y(),y=null),x&&(clearTimeout(x),x=null),Pe(l,!1)}return he(W(p,De(n,f,r,v,a,i,h),De(e,s,o),se(([[E,T,k,I,A,_,R,L],$,V,O])=>{const Y=gc(E),{align:K,behavior:J,offset:B}=Y,F=I-1,z=hc(Y,T,F);let H=Or(z,T.offsetTree,$)+_;K==="end"?(H+=V+Wt(T.sizeTree,z)[1]-k+O,z===F&&(H+=R)):K==="center"?H+=(V+Wt(T.sizeTree,z)[1]-k+O)/2:H-=A,B&&(H+=B);const me=de=>{C(),de?(L("retrying to scroll to",{location:E},Tt.DEBUG),Pe(p,E)):(Pe(w,!0),L("list did not change, scroll successful",{},Tt.DEBUG))};if(C(),J==="smooth"){let de=!1;y=Ge(t,ee=>{de=de||ee}),g=Ut(d,()=>{me(de)})}else g=Ut(W(t,tx(150)),me);return x=setTimeout(()=>{C()},1200),Pe(l,!0),L("scrolling from index to",{behavior:J,index:z,top:H},Tt.DEBUG),{behavior:J,top:H}})),u),{scrollTargetReached:w,scrollToIndex:p,topListHeight:v}},tt(Qt,wt,vn),{singleton:!0});function tx(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}function vi(e,t){e==0?t():requestAnimationFrame(()=>{vi(e-1,t)})}function wi(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const Dr=We(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:o,scrollToIndex:s},{didMount:i}])=>{const a=Z(!0),l=Z(0),u=Z(!0);return he(W(i,De(l),Ee(([d,f])=>!!f),Jt(!1)),a),he(W(i,De(l),Ee(([d,f])=>!!f),Jt(!1)),u),Ge(W(lt(t,i),De(a,n,e,u),Ee(([[,d],f,{sizeTree:h},p,w])=>d&&(!Ye(h)||ai(p))&&!f&&!w),De(l)),([,d])=>{Ut(o,()=>{Pe(u,!0)}),vi(4,()=>{Ut(r,()=>{Pe(a,!0)}),Pe(s,d)})}),{initialItemFinalLocationReached:u,initialTopMostItemIndex:l,scrolledToInitialItem:a}},tt(Qt,wt,Mr,bn),{singleton:!0});function xc(e,t){return Math.abs(e-t)<1.01}const Lr="up",$r="down",nx="none",rx={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},ox=0,Fr=We(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:o,viewportHeight:s}])=>{const i=Z(!1),a=Z(!0),l=Be(),u=Be(),d=Z(4),f=Z(ox),h=pt(W(ci(W(Ce(o),Dn(1),Jt(!0)),W(Ce(o),Dn(1),Jt(!1),ec(100))),nt()),!1),p=pt(W(ci(W(n,Jt(!0)),W(n,Jt(!1),ec(200))),nt()),!1);he(W(lt(Ce(o),Ce(f)),se(([y,C])=>y<=C),nt()),a),he(W(a,hn(50)),u);const w=It(W(lt(r,Ce(s),Ce(t),Ce(e),Ce(d)),Zt((y,[{scrollHeight:C,scrollTop:E},T,k,I,A])=>{const _=E+T-C>-A,R={scrollHeight:C,scrollTop:E,viewportHeight:T};if(_){let $,V;return E>y.state.scrollTop?($="SCROLLED_DOWN",V=y.state.scrollTop-E):($="SIZE_DECREASED",V=y.state.scrollTop-E||y.scrollTopDelta),{atBottom:!0,atBottomBecause:$,scrollTopDelta:V,state:R}}let L;return R.scrollHeight>y.state.scrollHeight?L="SIZE_INCREASED":T<y.state.viewportHeight?L="VIEWPORT_HEIGHT_DECREASING":E<y.state.scrollTop?L="SCROLLING_UPWARDS":L="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:L,state:R}},rx),nt((y,C)=>y&&y.atBottom===C.atBottom))),v=pt(W(r,Zt((y,{scrollHeight:C,scrollTop:E,viewportHeight:T})=>{if(xc(y.scrollHeight,C))return{changed:!1,jump:0,scrollHeight:C,scrollTop:E};{const k=C-(E+T)<1;return y.scrollTop!==E&&k?{changed:!0,jump:y.scrollTop-E,scrollHeight:C,scrollTop:E}:{changed:!0,jump:0,scrollHeight:C,scrollTop:E}}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Ee(y=>y.changed),se(y=>y.jump)),0);he(W(w,se(y=>y.atBottom)),i),he(W(i,hn(50)),l);const g=Z($r);he(W(r,se(({scrollTop:y})=>y),nt(),Zt((y,C)=>at(p)?{direction:y.direction,prevScrollTop:C}:{direction:C<y.prevScrollTop?Lr:$r,prevScrollTop:C},{direction:$r,prevScrollTop:0}),se(y=>y.direction)),g),he(W(r,hn(50),Jt(nx)),g);const x=Z(0);return he(W(h,Ee(y=>!y),Jt(0)),x),he(W(o,hn(100),De(h),Ee(([y,C])=>!!C),Zt(([y,C],[E])=>[C,E],[0,0]),se(([y,C])=>C-y)),x),{atBottomState:w,atBottomStateChange:l,atBottomThreshold:d,atTopStateChange:u,atTopThreshold:f,isAtBottom:i,isAtTop:a,isScrolling:h,lastJumpDueToItemResize:v,scrollDirection:g,scrollVelocity:x}},tt(wt)),ko="top",Eo="bottom",vc="none";function wc(e,t,n){return typeof e=="number"?n===Lr&&t===ko||n===$r&&t===Eo?e:0:n===Lr?t===ko?e.main:e.reverse:t===Eo?e.main:e.reverse}function bc(e,t){var n;return typeof e=="number"?e:(n=e[t])!=null?n:0}const bi=We(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:o}])=>{const s=Be(),i=Z(0),a=Z(0),l=Z(0),u=pt(W(lt(Ce(r),Ce(o),Ce(n),Ce(s,Pr),Ce(l),Ce(i),Ce(t),Ce(e),Ce(a)),se(([d,f,h,[p,w],v,g,x,y,C])=>{const E=d-y,T=g+x,k=Math.max(h-E,0);let I=vc;const A=bc(C,ko),_=bc(C,Eo);return p-=y,p+=h+x,w+=h+x,w-=y,p>d+T-A&&(I=Lr),w<d-k+f+_&&(I=$r),I!==vc?[Math.max(E-h-wc(v,ko,I)-A,0),E-k-x+f+wc(v,Eo,I)+_]:null}),Ee(d=>d!=null),nt(Pr)),[0,0]);return{increaseViewportBy:a,listBoundary:s,overscan:l,topListHeight:i,visibleRange:u}},tt(wt),{singleton:!0});function sx(e,t,n){if(To(t)){const r=fc(e,t);return[{index:Wt(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n==null?void 0:n[0],index:r,offset:0,size:0}]}return[{data:n==null?void 0:n[0],index:e,offset:0,size:0}]}const yi={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Io(e,t,n,r,o,s){const{lastIndex:i,lastOffset:a,lastSize:l}=o;let u=0,d=0;if(e.length>0){u=e[0].offset;const v=e[e.length-1];d=v.offset+v.size}const f=n-i,h=a+f*l+(f-1)*r,p=u,w=h-d;return{bottom:d,firstItemIndex:s,items:Sc(e,o,s),offsetBottom:w,offsetTop:u,top:p,topItems:Sc(t,o,s),topListHeight:t.reduce((v,g)=>g.size+v,0),totalCount:n}}function yc(e,t,n,r,o,s){let i=0;if(n.groupIndices.length>0)for(const d of n.groupIndices){if(d-i>=e)break;i++}const a=e+i,l=wi(t,a),u=Array.from({length:a}).map((d,f)=>({data:s[f+l],index:f+l,offset:0,size:0}));return Io(u,[],a,o,n,r)}function Sc(e,t,n){if(e.length===0)return[];if(!To(t))return e.map(u=>({...u,index:u.index+n,originalIndex:u.index}));const r=e[0].index,o=e[e.length-1].index,s=[],i=yo(t.groupOffsetTree,r,o);let a,l=0;for(const u of e){(!a||a.end<u.index)&&(a=i.shift(),l=t.groupIndices.indexOf(a.start));let d;u.index===a.start?d={index:l,type:"group"}:d={groupIndex:l,index:u.index-(l+1)+n},s.push({...d,data:u.data,offset:u.offset,originalIndex:u.index,size:u.size})}return s}const Fn=We(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:o},s,{listBoundary:i,topListHeight:a,visibleRange:l},{initialTopMostItemIndex:u,scrolledToInitialItem:d},{topListHeight:f},h,{didMount:p},{recalcInProgress:w}])=>{const v=Z([]),g=Z(0),x=Be();he(s.topItemsIndexes,v);const y=pt(W(lt(p,w,Ce(l,Pr),Ce(o),Ce(r),Ce(u),d,Ce(v),Ce(t),Ce(n),e),Ee(([k,I,,A,,,,,,,_])=>{const R=_&&_.length!==A;return k&&!I&&!R}),se(([,,[k,I],A,_,R,L,$,V,O,Y])=>{const K=_,{offsetTree:J,sizeTree:B}=K,F=at(g);if(A===0)return{...yi,totalCount:A};if(k===0&&I===0)return F===0?{...yi,totalCount:A}:yc(F,R,_,V,O,Y||[]);if(Ye(B))return F>0?null:Io(sx(wi(R,A),K,Y),[],A,O,K,V);const z=[];if($.length>0){const Ae=$[0],Te=$[$.length-1];let G=0;for(const M of yo(B,Ae,Te)){const Q=M.value,q=Math.max(M.start,Ae),ue=Math.min(M.end,Te);for(let le=q;le<=ue;le++)z.push({data:Y==null?void 0:Y[le],index:le,offset:G,size:Q}),G+=Q}}if(!L)return Io([],z,A,O,K,V);const H=$.length>0?$[$.length-1]+1:0,me=qg(J,k,I,H);if(me.length===0)return null;const de=A-1,ee=bo([],Ae=>{for(const Te of me){const G=Te.value;let M=G.offset,Q=Te.start;const q=G.size;if(G.offset<k){Q+=Math.floor((k-G.offset+O)/(q+O));const le=Q-Te.start;M+=le*q+le*O}Q<H&&(M+=(H-Q)*q,Q=H);const ue=Math.min(Te.end,de);for(let le=Q;le<=ue&&!(M>=I);le++)Ae.push({data:Y==null?void 0:Y[le],index:le,offset:M,size:q}),M+=q+O}});return Io(ee,z,A,O,K,V)}),Ee(k=>k!==null),nt()),yi);he(W(e,Ee(ai),se(k=>k==null?void 0:k.length)),o),he(W(y,se(k=>k.topListHeight)),f),he(f,a),he(W(y,se(k=>[k.top,k.bottom])),i),he(W(y,se(k=>k.items)),x);const C=It(W(y,Ee(({items:k})=>k.length>0),De(o,e),Ee(([{items:k},I])=>k[k.length-1].originalIndex===I-1),se(([,k,I])=>[k-1,I]),nt(Pr),se(([k])=>k))),E=It(W(y,hn(200),Ee(({items:k,topItems:I})=>k.length>0&&k[0].originalIndex===I.length),se(({items:k})=>k[0].index),nt())),T=It(W(y,Ee(({items:k})=>k.length>0),se(({items:k})=>{let I=0,A=k.length-1;for(;k[I].type==="group"&&I<A;)I++;for(;k[A].type==="group"&&A>I;)A--;return{endIndex:k[A].index,startIndex:k[I].index}}),nt(uc)));return{endReached:C,initialItemCount:g,itemsRendered:x,listState:y,rangeChanged:T,startReached:E,topItemsIndexes:v,...h}},tt(Qt,mc,bi,Dr,Mr,Fr,bn,mi),{singleton:!0}),Cc=We(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:o}])=>{const s=Be(),i=pt(W(lt(n,e,r,t,o),se(([a,l,u,d,f])=>a+l+u+d+f.offsetBottom+f.bottom)),0);return he(Ce(i),s),{totalListHeight:i,totalListHeightChanged:s}},tt(wt,Fn),{singleton:!0}),ix=We(([{viewportHeight:e},{totalListHeight:t}])=>{const n=Z(!1),r=pt(W(lt(n,e,t),Ee(([o])=>o),se(([,o,s])=>Math.max(0,o-s)),hn(0),nt()),0);return{alignToBottom:n,paddingTopAddition:r}},tt(wt,Cc),{singleton:!0}),Tc=We(()=>({context:Z(null)})),ax=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...o},viewportBottom:s,viewportTop:i})=>t<i?{...o,align:n??"start",behavior:r}:e>s?{...o,align:n??"end",behavior:r}:null,kc=We(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:o,headerHeight:s,scrollingInProgress:i,scrollTop:a,viewportHeight:l},{scrollToIndex:u}])=>{const d=Be();return he(W(d,De(t,l,n,s,o,r,a),De(e),se(([[f,h,p,w,v,g,x,y],C])=>{const{align:E,behavior:T,calculateViewLocation:k=ax,done:I,...A}=f,_=hc(f,h,w-1),R=Or(_,h.offsetTree,C)+v+g,L=R+Wt(h.sizeTree,_)[1],$=y+g,V=y+p-x,O=k({itemBottom:L,itemTop:R,locationParams:{align:E,behavior:T,...A},viewportBottom:V,viewportTop:$});return O?I&&Ut(W(i,Ee(Y=>!Y),Dn(at(i)?1:2)),I):I&&I(),O}),Ee(f=>f!==null)),u),{scrollIntoView:d}},tt(Qt,wt,Mr,Fn,vn),{singleton:!0});function Ec(e){return e?e==="smooth"?"smooth":"auto":!1}const lx=(e,t)=>typeof e=="function"?Ec(e(t)):t&&Ec(e),cx=We(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:o,isAtBottom:s},{scrollToIndex:i},{scrolledToInitialItem:a},{didMount:l,propsReady:u},{log:d},{scrollingInProgress:f},{context:h},{scrollIntoView:p}])=>{const w=Z(!1),v=Be();let g=null;function x(T){Pe(i,{align:"end",behavior:T,index:"LAST"})}Ge(W(lt(W(Ce(t),Dn(1)),l),De(Ce(w),s,a,f),se(([[T,k],I,A,_,R])=>{let L=k&&_,$="auto";return L&&($=lx(I,A||R),L=L&&!!$),{followOutputBehavior:$,shouldFollow:L,totalCount:T}}),Ee(({shouldFollow:T})=>T)),({followOutputBehavior:T,totalCount:k})=>{g&&(g(),g=null),at(n)?requestAnimationFrame(()=>{at(d)("following output to ",{totalCount:k},Tt.DEBUG),x(T)}):g=Ut(e,()=>{at(d)("following output to ",{totalCount:k},Tt.DEBUG),x(T),g=null})});function y(T){const k=Ut(o,I=>{T&&!I.atBottom&&I.notAtBottomBecause==="SIZE_INCREASED"&&!g&&(at(d)("scrolling to bottom due to increased size",{},Tt.DEBUG),x("auto"))});setTimeout(k,100)}Ge(W(lt(Ce(w),t,u),Ee(([T,,k])=>T&&k),Zt(({value:T},[,k])=>({refreshed:T===k,value:k}),{refreshed:!1,value:0}),Ee(({refreshed:T})=>T),De(w,t)),([,T])=>{at(a)&&y(T!==!1)}),Ge(v,()=>{y(at(w)!==!1)}),Ge(lt(Ce(w),o),([T,k])=>{T&&!k.atBottom&&k.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&x("auto")});const C=Z(null),E=Be();return he(ci(W(Ce(r),se(T=>{var k;return(k=T==null?void 0:T.length)!=null?k:0})),W(Ce(t))),E),Ge(W(lt(W(E,Dn(1)),l),De(Ce(C),a,f,h),se(([[T,k],I,A,_,R])=>k&&A&&(I==null?void 0:I({context:R,totalCount:T,scrollingInProgress:_}))),Ee(T=>!!T),hn(0)),T=>{g&&(g(),g=null),at(n)?requestAnimationFrame(()=>{at(d)("scrolling into view",{}),Pe(p,T)}):g=Ut(e,()=>{at(d)("scrolling into view",{}),Pe(p,T),g=null})}),{autoscrollToBottom:v,followOutput:w,scrollIntoViewOnChange:C}},tt(Qt,Fr,Mr,Dr,bn,vn,wt,Tc,kc)),ux=We(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:o},{initialItemCount:s,listState:i},{didMount:a}])=>(he(W(a,De(s),Ee(([,l])=>l!==0),De(o,r,t,n,e),se(([[,l],u,d,f,h,p=[]])=>yc(l,u,d,f,h,p))),i),{}),tt(Qt,Dr,Fn,bn),{singleton:!0}),dx=We(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=Z(0);return Ge(W(e,De(r),Ee(([,o])=>o!==0),se(([,o])=>({top:o}))),o=>{Ut(W(n,Dn(1),Ee(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{Pe(t,o)})})}),{initialScrollTop:r}},tt(bn,wt,Fn),{singleton:!0}),Ic=We(([{scrollVelocity:e}])=>{const t=Z(!1),n=Be(),r=Z(!1);return he(W(e,De(r,t,n),Ee(([o,s])=>!!s),se(([o,s,i,a])=>{const{enter:l,exit:u}=s;if(i){if(u(o,a))return!1}else if(l(o,a))return!0;return i}),nt()),t),Ge(W(lt(t,e,n),De(r)),([[o,s,i],a])=>{o&&a&&a.change&&a.change(s,i)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},tt(Fr),{singleton:!0}),Si=We(([{scrollContainerState:e,scrollTo:t}])=>{const n=Be(),r=Be(),o=Be(),s=Z(!1),i=Z(void 0);return he(W(lt(n,r),se(([{scrollHeight:a,scrollTop:l,viewportHeight:u},{offsetTop:d}])=>({scrollHeight:a,scrollTop:Math.max(0,l-d),viewportHeight:u}))),e),he(W(t,De(r),se(([a,{offsetTop:l}])=>({...a,top:a.top+l}))),o),{customScrollParent:i,useWindowScroll:s,windowScrollContainerState:n,windowScrollTo:o,windowViewportRect:r}},tt(wt)),fx=We(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:o},{didMount:s},{useWindowScroll:i,windowScrollContainerState:a,windowViewportRect:l}])=>{const u=Be(),d=Z(void 0),f=Z(null),h=Z(null);return he(a,f),he(l,h),Ge(W(u,De(t,r,i,f,h,n)),([p,w,v,g,x,y,C])=>{const E=Yg(w.sizeTree);g&&x!==null&&y!==null&&(v=x.scrollTop-y.offsetTop),v-=C,p({ranges:E,scrollTop:v})}),he(W(d,Ee(ai),se(hx)),o),he(W(s,De(d),Ee(([,p])=>p!==void 0),nt(),se(([,p])=>p.ranges)),e),{getState:u,restoreStateFrom:d}},tt(Qt,wt,Dr,bn,Si));function hx(e){return{align:"start",index:0,offset:e.scrollTop}}const px=We(([{topItemsIndexes:e}])=>{const t=Z(0);return he(W(t,Ee(n=>n>=0),se(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},tt(Fn));function Nc(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const mx=Nc(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),gx=We(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:o,isScrolling:s,lastJumpDueToItemResize:i,scrollDirection:a},{listState:l},{beforeUnshiftWith:u,gap:d,shiftWithOffset:f,sizes:h},{log:p},{recalcInProgress:w}])=>{const v=It(W(l,De(i),Zt(([,x,y,C],[{bottom:E,items:T,offsetBottom:k,totalCount:I},A])=>{const _=E+k;let R=0;return y===I&&x.length>0&&T.length>0&&(T[0].originalIndex===0&&x[0].originalIndex===0||(R=_-C,R!==0&&(R+=A))),[R,T,I,_]},[0,[],0,0]),Ee(([x])=>x!==0),De(r,a,n,o,p,w),Ee(([,x,y,C,,,E])=>!E&&!C&&x!==0&&y===Lr),se(([[x],,,,,y])=>(y("Upward scrolling compensation",{amount:x},Tt.DEBUG),x))));function g(x){x>0?(Pe(t,{behavior:"auto",top:-x}),Pe(e,0)):(Pe(e,0),Pe(t,{behavior:"auto",top:-x}))}return Ge(W(v,De(e,s)),([x,y,C])=>{C&&mx()?Pe(e,y-x):g(-x)}),Ge(W(lt(pt(s,!1),e,w),Ee(([x,y,C])=>!x&&!C&&y!==0),se(([x,y])=>y),hn(1)),g),he(W(f,se(x=>({top:-x}))),t),Ge(W(u,De(h,d),se(([x,{groupIndices:y,lastSize:C,sizeTree:E},T])=>{function k(I){return I*(C+T)}if(y.length===0)return k(x);{let I=0;const A=Rr(E,0);let _=0,R=0;for(;_<x;){_++,I+=A;let L=y.length===R+1?1/0:y[R+1]-y[R]-1;_+L>x&&(I-=A,L=x-_+1),_+=L,I+=k(L),R++}return I}})),x=>{Pe(e,x),requestAnimationFrame(()=>{Pe(t,{top:x}),requestAnimationFrame(()=>{Pe(e,0),Pe(w,!1)})})}),{deviation:e}},tt(wt,Fr,Fn,Qt,vn,mi)),xx=We(([e,t,n,r,o,s,i,a,l,u,d])=>({...e,...t,...n,...r,...o,...s,...i,...a,...l,...u,...d}),tt(bi,ux,bn,Ic,Cc,dx,ix,Si,kc,vn,Tc)),Ac=We(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,gap:o,groupIndices:s,itemSize:i,sizeRanges:a,sizes:l,statefulTotalCount:u,totalCount:d,trackItemSizes:f},{initialItemFinalLocationReached:h,initialTopMostItemIndex:p,scrolledToInitialItem:w},v,g,x,{listState:y,topItemsIndexes:C,...E},{scrollToIndex:T},k,{topItemCount:I},{groupCounts:A},_])=>(he(E.rangeChanged,_.scrollSeekRangeChanged),he(W(_.windowViewportRect,se(R=>R.visibleHeight)),v.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,gap:o,groupCounts:A,initialItemFinalLocationReached:h,initialTopMostItemIndex:p,scrolledToInitialItem:w,sizeRanges:a,topItemCount:I,topItemsIndexes:C,totalCount:d,...x,groupIndices:s,itemSize:i,listState:y,scrollToIndex:T,statefulTotalCount:u,trackItemSizes:f,...E,..._,...v,sizes:l,...g}),tt(Qt,Dr,wt,fx,cx,Fn,Mr,gx,px,mc,xx));function vx(e,t){const n={},r={};let o=0;const s=e.length;for(;o<s;)r[e[o]]=1,o+=1;for(const i in t)Object.hasOwn(r,i)||(n[i]=t[i]);return n}const No=typeof document<"u"?S.useLayoutEffect:S.useEffect;function jc(e,t,n){const r=Object.keys(t.required||{}),o=Object.keys(t.optional||{}),s=Object.keys(t.methods||{}),i=Object.keys(t.events||{}),a=S.createContext({});function l(g,x){g.propsReady&&Pe(g.propsReady,!1);for(const y of r){const C=g[t.required[y]];Pe(C,x[y])}for(const y of o)if(y in x){const C=g[t.optional[y]];Pe(C,x[y])}g.propsReady&&Pe(g.propsReady,!0)}function u(g){return s.reduce((x,y)=>(x[y]=C=>{const E=g[t.methods[y]];Pe(E,C)},x),{})}function d(g){return i.reduce((x,y)=>(x[y]=Og(g[t.events[y]]),x),{})}const f=S.forwardRef((g,x)=>{const{children:y,...C}=g,[E]=S.useState(()=>bo(Dg(e),I=>{l(I,C)})),[T]=S.useState(Ql(d,E));No(()=>{for(const I of i)I in C&&Ge(T[I],C[I]);return()=>{Object.values(T).map(li)}},[C,T,E]),No(()=>{l(E,C)}),S.useImperativeHandle(x,Jl(u(E)));const k=n;return c.jsx(a.Provider,{value:E,children:n?c.jsx(k,{...vx([...r,...o,...i],C),children:y}):y})}),h=g=>{const x=S.useContext(a);return S.useCallback(y=>{Pe(x[g],y)},[x,g])},p=g=>{const x=S.useContext(a)[g],y=S.useCallback(C=>Ge(x,C),[x]);return S.useSyncExternalStore(y,()=>at(x),()=>at(x))},w=g=>{const x=S.useContext(a)[g],[y,C]=S.useState(Ql(at,x));return No(()=>Ge(x,E=>{E!==y&&C(Jl(E))}),[x,y]),y},v=S.version.startsWith("18")?p:w;return{Component:f,useEmitter:(g,x)=>{const y=S.useContext(a)[g];No(()=>Ge(y,x),[x,y])},useEmitterValue:v,usePublisher:h}}const _c=S.createContext(void 0),Rc=S.createContext(void 0),Pc=typeof document<"u"?S.useLayoutEffect:S.useEffect;function Ci(e){return"self"in e}function wx(e){return"body"in e}function Oc(e,t,n,r=ar,o,s){const i=S.useRef(null),a=S.useRef(null),l=S.useRef(null),u=S.useCallback(h=>{let p,w,v;const g=h.target;if(wx(g)||Ci(g)){const y=Ci(g)?g:g.defaultView;v=s?y.scrollX:y.scrollY,p=s?y.document.documentElement.scrollWidth:y.document.documentElement.scrollHeight,w=s?y.innerWidth:y.innerHeight}else v=s?g.scrollLeft:g.scrollTop,p=s?g.scrollWidth:g.scrollHeight,w=s?g.offsetWidth:g.offsetHeight;const x=()=>{e({scrollHeight:p,scrollTop:Math.max(v,0),viewportHeight:w})};h.suppressFlushSync?x():Ps.flushSync(x),a.current!==null&&(v===a.current||v<=0||v===p-w)&&(a.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t,s]);S.useEffect(()=>{const h=o||i.current;return r(o||i.current),u({suppressFlushSync:!0,target:h}),h.addEventListener("scroll",u,{passive:!0}),()=>{r(null),h.removeEventListener("scroll",u)}},[i,u,n,r,o]);function d(h){const p=i.current;if(!p||(s?"offsetWidth"in p&&p.offsetWidth===0:"offsetHeight"in p&&p.offsetHeight===0))return;const w=h.behavior==="smooth";let v,g,x;Ci(p)?(g=Math.max(wn(p.document.documentElement,s?"width":"height"),s?p.document.documentElement.scrollWidth:p.document.documentElement.scrollHeight),v=s?p.innerWidth:p.innerHeight,x=s?window.scrollX:window.scrollY):(g=p[s?"scrollWidth":"scrollHeight"],v=wn(p,s?"width":"height"),x=p[s?"scrollLeft":"scrollTop"]);const y=g-v;if(h.top=Math.ceil(Math.max(Math.min(y,h.top),0)),xc(v,g)||h.top===x){e({scrollHeight:g,scrollTop:x,viewportHeight:v}),w&&t(!0);return}w?(a.current=h.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,a.current=null,t(!0)},1e3)):a.current=null,s&&(h={behavior:h.behavior,left:h.top}),p.scrollTo(h)}function f(h){s&&(h={behavior:h.behavior,left:h.top}),i.current.scrollBy(h)}return{scrollByCallback:f,scrollerRef:i,scrollToCallback:d}}const Ti="-webkit-sticky",Mc="sticky",ki=Nc(()=>{if(typeof document>"u")return Mc;const e=document.createElement("div");return e.style.position=Ti,e.style.position===Ti?Ti:Mc});function Ei(e){return e}const bx=We(()=>{const e=Z(a=>`Item ${a}`),t=Z(a=>`Group ${a}`),n=Z({}),r=Z(Ei),o=Z("div"),s=Z(ar),i=(a,l=null)=>pt(W(n,se(u=>u[a]),nt()),l);return{components:n,computeItemKey:r,EmptyPlaceholder:i("EmptyPlaceholder"),FooterComponent:i("Footer"),GroupComponent:i("Group","div"),groupContent:t,HeaderComponent:i("Header"),HeaderFooterTag:o,ItemComponent:i("Item","div"),itemContent:e,ListComponent:i("List","div"),ScrollerComponent:i("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:i("ScrollSeekPlaceholder"),TopItemListComponent:i("TopItemList")}}),yx=We(([e,t])=>({...e,...t}),tt(Ac,bx)),Sx=({height:e})=>c.jsx("div",{style:{height:e}}),Cx={overflowAnchor:"none",position:ki(),zIndex:1},Dc={overflowAnchor:"none"},Tx={...Dc,display:"inline-block",height:"100%"},Lc=S.memo(function({showTopList:e=!1}){const t=_e("listState"),n=Ot("sizeRanges"),r=_e("useWindowScroll"),o=_e("customScrollParent"),s=Ot("windowScrollContainerState"),i=Ot("scrollContainerState"),a=o||r?s:i,l=_e("itemContent"),u=_e("context"),d=_e("groupContent"),f=_e("trackItemSizes"),h=_e("itemSize"),p=_e("log"),w=Ot("gap"),v=_e("horizontalDirection"),{callbackRef:g}=Fg(n,h,f,e?ar:a,p,w,o,v,_e("skipAnimationFrameInResizeObserver")),[x,y]=S.useState(0);Ii("deviation",O=>{x!==O&&y(O)});const C=_e("EmptyPlaceholder"),E=_e("ScrollSeekPlaceholder")||Sx,T=_e("ListComponent"),k=_e("ItemComponent"),I=_e("GroupComponent"),A=_e("computeItemKey"),_=_e("isSeeking"),R=_e("groupIndices").length>0,L=_e("alignToBottom"),$=_e("initialItemFinalLocationReached"),V=e?{}:{boxSizing:"border-box",...v?{display:"inline-block",height:"100%",marginLeft:x!==0?x:L?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:x!==0?x:L?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...$?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&C?c.jsx(C,{...mt(C,u)}):c.jsx(T,{...mt(T,u),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:g,style:V,children:(e?t.topItems:t.items).map(O=>{const Y=O.originalIndex,K=A(Y+t.firstItemIndex,O.data,u);return _?S.createElement(E,{...mt(E,u),height:O.size,index:O.index,key:K,type:O.type||"item",...O.type==="group"?{}:{groupIndex:O.groupIndex}}):O.type==="group"?S.createElement(I,{...mt(I,u),"data-index":Y,"data-item-index":O.index,"data-known-size":O.size,key:K,style:Cx},d(O.index,u)):S.createElement(k,{...mt(k,u),...Nx(k,O.data),"data-index":Y,"data-item-group-index":O.groupIndex,"data-item-index":O.index,"data-known-size":O.size,key:K,style:v?Tx:Dc},R?l(O.index,O.groupIndex,O.data,u):l(O.index,O.data,u))})})}),kx={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Ex={outline:"none",overflowX:"auto",position:"relative"},Ao=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),Ix={position:ki(),top:0,width:"100%",zIndex:1};function mt(e,t){if(typeof e!="string")return{context:t}}function Nx(e,t){return{item:typeof e=="string"?void 0:t}}const Ax=S.memo(function(){const e=_e("HeaderComponent"),t=Ot("headerHeight"),n=_e("HeaderFooterTag"),r=Ln(S.useMemo(()=>s=>{t(wn(s,"height"))},[t]),!0,_e("skipAnimationFrameInResizeObserver")),o=_e("context");return e?c.jsx(n,{ref:r,children:c.jsx(e,{...mt(e,o)})}):null}),jx=S.memo(function(){const e=_e("FooterComponent"),t=Ot("footerHeight"),n=_e("HeaderFooterTag"),r=Ln(S.useMemo(()=>s=>{t(wn(s,"height"))},[t]),!0,_e("skipAnimationFrameInResizeObserver")),o=_e("context");return e?c.jsx(n,{ref:r,children:c.jsx(e,{...mt(e,o)})}):null});function $c({useEmitter:e,useEmitterValue:t,usePublisher:n}){return S.memo(function({children:r,style:o,context:s,...i}){const a=n("scrollContainerState"),l=t("ScrollerComponent"),u=n("smoothScrollTargetReached"),d=t("scrollerRef"),f=t("horizontalDirection")||!1,{scrollByCallback:h,scrollerRef:p,scrollToCallback:w}=Oc(a,u,l,d,void 0,f);return e("scrollTo",w),e("scrollBy",h),c.jsx(l,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:p,style:{...f?Ex:kx,...o},tabIndex:0,...i,...mt(l,s),children:r})})}function Fc({useEmitter:e,useEmitterValue:t,usePublisher:n}){return S.memo(function({children:r,style:o,context:s,...i}){const a=n("windowScrollContainerState"),l=t("ScrollerComponent"),u=n("smoothScrollTargetReached"),d=t("totalListHeight"),f=t("deviation"),h=t("customScrollParent"),p=S.useRef(null),w=t("scrollerRef"),{scrollByCallback:v,scrollerRef:g,scrollToCallback:x}=Oc(a,u,l,w,h);return Pc(()=>{var y;return g.current=h||((y=p.current)==null?void 0:y.ownerDocument.defaultView),()=>{g.current=null}},[g,h]),e("windowScrollTo",x),e("scrollBy",v),c.jsx(l,{ref:p,"data-virtuoso-scroller":!0,style:{position:"relative",...o,...d!==0?{height:d+f}:{}},...i,...mt(l,s),children:r})})}const _x=({children:e})=>{const t=S.useContext(_c),n=Ot("viewportHeight"),r=Ot("fixedItemHeight"),o=_e("alignToBottom"),s=_e("horizontalDirection"),i=S.useMemo(()=>Zl(n,l=>wn(l,s?"width":"height")),[n,s]),a=Ln(i,!0,_e("skipAnimationFrameInResizeObserver"));return S.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),c.jsx("div",{"data-viewport-type":"element",ref:a,style:Ao(o),children:e})},Rx=({children:e})=>{const t=S.useContext(_c),n=Ot("windowViewportRect"),r=Ot("fixedItemHeight"),o=_e("customScrollParent"),s=rc(n,o,_e("skipAnimationFrameInResizeObserver")),i=_e("alignToBottom");return S.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),c.jsx("div",{"data-viewport-type":"window",ref:s,style:Ao(i),children:e})},Px=({children:e})=>{const t=_e("TopItemListComponent")||"div",n=_e("headerHeight"),r={...Ix,marginTop:`${n}px`},o=_e("context");return c.jsx(t,{style:r,...mt(t,o),children:e})},Ox=S.memo(function(e){const t=_e("useWindowScroll"),n=_e("topItemsIndexes").length>0,r=_e("customScrollParent"),o=_e("context");return c.jsxs(r||t?Lx:Dx,{...e,context:o,children:[n&&c.jsx(Px,{children:c.jsx(Lc,{showTopList:!0})}),c.jsxs(r||t?Rx:_x,{children:[c.jsx(Ax,{}),c.jsx(Lc,{}),c.jsx(jx,{})]})]})}),{Component:Mx,useEmitter:Ii,useEmitterValue:_e,usePublisher:Ot}=jc(yx,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Ox),Dx=$c({useEmitter:Ii,useEmitterValue:_e,usePublisher:Ot}),Lx=Fc({useEmitter:Ii,useEmitterValue:_e,usePublisher:Ot}),$x=Mx;tt(Ac,We(()=>{const e=Z(u=>c.jsxs("td",{children:["Item $",u]})),t=Z(null),n=Z(u=>c.jsxs("td",{colSpan:1e3,children:["Group ",u]})),r=Z(null),o=Z(null),s=Z({}),i=Z(Ei),a=Z(ar),l=(u,d=null)=>pt(W(s,se(f=>f[u]),nt()),d);return{components:s,computeItemKey:i,context:t,EmptyPlaceholder:l("EmptyPlaceholder"),FillerRow:l("FillerRow"),fixedFooterContent:o,fixedHeaderContent:r,itemContent:e,groupContent:n,ScrollerComponent:l("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TableBodyComponent:l("TableBody","tbody"),TableComponent:l("Table","table"),TableFooterComponent:l("TableFoot","tfoot"),TableHeadComponent:l("TableHead","thead"),TableRowComponent:l("TableRow","tr"),GroupComponent:l("Group","tr")}})),ki();const zc={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},Fx={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Bc,floor:jo,max:zr,min:Ni,round:Hc}=Math;function Uc(e,t,n){return Array.from({length:t-e+1}).map((r,o)=>({data:n===null?null:n[o+e],index:o+e}))}function zx(e){return{...Fx,items:e}}function _o(e,t){return e&&e.width===t.width&&e.height===t.height}function Bx(e,t){return e&&e.column===t.column&&e.row===t.row}const Hx=We(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:o,headerHeight:s,scrollBy:i,scrollContainerState:a,scrollTo:l,scrollTop:u,smoothScrollTargetReached:d,viewportHeight:f},h,p,{didMount:w,propsReady:v},{customScrollParent:g,useWindowScroll:x,windowScrollContainerState:y,windowScrollTo:C,windowViewportRect:E},T])=>{const k=Z(0),I=Z(0),A=Z(zc),_=Z({height:0,width:0}),R=Z({height:0,width:0}),L=Be(),$=Be(),V=Z(0),O=Z(null),Y=Z({column:0,row:0}),K=Be(),J=Be(),B=Z(!1),F=Z(0),z=Z(!0),H=Z(!1),me=Z(!1);Ge(W(w,De(F),Ee(([M,Q])=>!!Q)),()=>{Pe(z,!1)}),Ge(W(lt(w,z,R,_,F,H),Ee(([M,Q,q,ue,,le])=>M&&!Q&&q.height!==0&&ue.height!==0&&!le)),([,,,,M])=>{Pe(H,!0),vi(1,()=>{Pe(L,M)}),Ut(W(u),()=>{Pe(t,[0,0]),Pe(z,!0)})}),he(W(J,Ee(M=>M!=null&&M.scrollTop>0),Jt(0)),I),Ge(W(w,De(J),Ee(([,M])=>M!=null)),([,M])=>{M&&(Pe(_,M.viewport),Pe(R,M.item),Pe(Y,M.gap),M.scrollTop>0&&(Pe(B,!0),Ut(W(u,Dn(1)),Q=>{Pe(B,!1)}),Pe(l,{top:M.scrollTop})))}),he(W(_,se(({height:M})=>M)),f),he(W(lt(Ce(_,_o),Ce(R,_o),Ce(Y,(M,Q)=>M&&M.column===Q.column&&M.row===Q.row),Ce(u)),se(([M,Q,q,ue])=>({gap:q,item:Q,scrollTop:ue,viewport:M}))),K),he(W(lt(Ce(k),r,Ce(Y,Bx),Ce(R,_o),Ce(_,_o),Ce(O),Ce(I),Ce(B),Ce(z),Ce(F)),Ee(([,,,,,,,M])=>!M),se(([M,[Q,q],ue,le,Fe,Ke,Ve,,ke,Oe])=>{const{column:Qe,row:ze}=ue,{height:st,width:ut}=le,{width:re}=Fe;if(Ve===0&&(M===0||re===0))return zc;if(ut===0){const xt=wi(Oe,M),Rt=xt+Math.max(Ve-1,0);return zx(Uc(xt,Rt,Ke))}const ce=Wc(re,ut,Qe);let fe,je;ke?Q===0&&q===0&&Ve>0?(fe=0,je=Ve-1):(fe=ce*jo((Q+ze)/(st+ze)),je=ce*Bc((q+ze)/(st+ze))-1,je=Ni(M-1,zr(je,ce-1)),fe=Ni(je,zr(0,fe))):(fe=0,je=-1);const pe=Uc(fe,je,Ke),{bottom:ge,top:He}=Vc(Fe,ue,le,pe),Me=Bc(M/ce),ot=Me*st+(Me-1)*ze-ge;return{bottom:ge,itemHeight:st,items:pe,itemWidth:ut,offsetBottom:ot,offsetTop:He,top:He}})),A),he(W(O,Ee(M=>M!==null),se(M=>M.length)),k),he(W(lt(_,R,A,Y),Ee(([M,Q,{items:q}])=>q.length>0&&Q.height!==0&&M.height!==0),se(([M,Q,{items:q},ue])=>{const{bottom:le,top:Fe}=Vc(M,ue,Q,q);return[Fe,le]}),nt(Pr)),t);const de=Z(!1);he(W(u,De(de),se(([M,Q])=>Q||M!==0)),de);const ee=It(W(lt(A,k),Ee(([{items:M}])=>M.length>0),De(de),Ee(([[M,Q],q])=>{const ue=M.items[M.items.length-1].index===Q-1;return(q||M.bottom>0&&M.itemHeight>0&&M.offsetBottom===0&&M.items.length===Q)&&ue}),se(([[,M]])=>M-1),nt())),Ae=It(W(Ce(A),Ee(({items:M})=>M.length>0&&M[0].index===0),Jt(0),nt())),Te=It(W(Ce(A),De(B),Ee(([{items:M},Q])=>M.length>0&&!Q),se(([{items:M}])=>({endIndex:M[M.length-1].index,startIndex:M[0].index})),nt(uc),hn(0)));he(Te,p.scrollSeekRangeChanged),he(W(L,De(_,R,k,Y),se(([M,Q,q,ue,le])=>{const Fe=gc(M),{align:Ke,behavior:Ve,offset:ke}=Fe;let Oe=Fe.index;Oe==="LAST"&&(Oe=ue-1),Oe=zr(0,Oe,Ni(ue-1,Oe));let Qe=Ai(Q,le,q,Oe);return Ke==="end"?Qe=Hc(Qe-Q.height+q.height):Ke==="center"&&(Qe=Hc(Qe-Q.height/2+q.height/2)),ke&&(Qe+=ke),{behavior:Ve,top:Qe}})),l);const G=pt(W(A,se(M=>M.offsetBottom+M.bottom)),0);return he(W(E,se(M=>({height:M.visibleHeight,width:M.visibleWidth}))),_),{customScrollParent:g,data:O,deviation:V,footerHeight:o,gap:Y,headerHeight:s,increaseViewportBy:e,initialItemCount:I,itemDimensions:R,overscan:n,restoreStateFrom:J,scrollBy:i,scrollContainerState:a,scrollHeight:$,scrollTo:l,scrollToIndex:L,scrollTop:u,smoothScrollTargetReached:d,totalCount:k,useWindowScroll:x,viewportDimensions:_,windowScrollContainerState:y,windowScrollTo:C,windowViewportRect:E,...p,gridState:A,horizontalDirection:me,initialTopMostItemIndex:F,totalListHeight:G,...h,endReached:ee,propsReady:v,rangeChanged:Te,startReached:Ae,stateChanged:K,stateRestoreInProgress:B,...T}},tt(bi,wt,Fr,Ic,bn,Si,vn));function Wc(e,t,n){return zr(1,jo((e+n)/(jo(t)+n)))}function Vc(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{bottom:0,top:0};const s=Ai(e,t,n,r[0].index);return{bottom:Ai(e,t,n,r[r.length-1].index)+o,top:s}}function Ai(e,t,n,r){const o=Wc(e.width,n.width,t.column),s=jo(r/o),i=s*n.height+zr(0,s-1)*t.row;return i>0?i+t.row:i}const Ux=We(()=>{const e=Z(f=>`Item ${f}`),t=Z({}),n=Z(null),r=Z("virtuoso-grid-item"),o=Z("virtuoso-grid-list"),s=Z(Ei),i=Z("div"),a=Z(ar),l=(f,h=null)=>pt(W(t,se(p=>p[f]),nt()),h),u=Z(!1),d=Z(!1);return he(Ce(d),u),{components:t,computeItemKey:s,context:n,FooterComponent:l("Footer"),HeaderComponent:l("Header"),headerFooterTag:i,itemClassName:r,ItemComponent:l("Item","div"),itemContent:e,listClassName:o,ListComponent:l("List","div"),readyStateChanged:u,reportReadyState:d,ScrollerComponent:l("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),Wx=We(([e,t])=>({...e,...t}),tt(Hx,Ux)),Vx=S.memo(function(){const e=rt("gridState"),t=rt("listClassName"),n=rt("itemClassName"),r=rt("itemContent"),o=rt("computeItemKey"),s=rt("isSeeking"),i=Mt("scrollHeight"),a=rt("ItemComponent"),l=rt("ListComponent"),u=rt("ScrollSeekPlaceholder"),d=rt("context"),f=Mt("itemDimensions"),h=Mt("gap"),p=rt("log"),w=rt("stateRestoreInProgress"),v=Mt("reportReadyState"),g=Ln(S.useMemo(()=>x=>{const y=x.parentElement.parentElement.scrollHeight;i(y);const C=x.firstChild;if(C){const{height:E,width:T}=C.getBoundingClientRect();f({height:E,width:T})}h({column:qc("column-gap",getComputedStyle(x).columnGap,p),row:qc("row-gap",getComputedStyle(x).rowGap,p)})},[i,f,h,p]),!0,!1);return Pc(()=>{e.itemHeight>0&&e.itemWidth>0&&v(!0)},[e]),w?null:c.jsx(l,{className:t,ref:g,...mt(l,d),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(x=>{const y=o(x.index,x.data,d);return s?c.jsx(u,{...mt(u,d),height:e.itemHeight,index:x.index,width:e.itemWidth},y):S.createElement(a,{...mt(a,d),className:n,"data-index":x.index,key:y},r(x.index,x.data,d))})})}),Kx=S.memo(function(){const e=rt("HeaderComponent"),t=Mt("headerHeight"),n=rt("headerFooterTag"),r=Ln(S.useMemo(()=>s=>{t(wn(s,"height"))},[t]),!0,!1),o=rt("context");return e?c.jsx(n,{ref:r,children:c.jsx(e,{...mt(e,o)})}):null}),qx=S.memo(function(){const e=rt("FooterComponent"),t=Mt("footerHeight"),n=rt("headerFooterTag"),r=Ln(S.useMemo(()=>s=>{t(wn(s,"height"))},[t]),!0,!1),o=rt("context");return e?c.jsx(n,{ref:r,children:c.jsx(e,{...mt(e,o)})}):null}),Gx=({children:e})=>{const t=S.useContext(Rc),n=Mt("itemDimensions"),r=Mt("viewportDimensions"),o=Ln(S.useMemo(()=>s=>{r(s.getBoundingClientRect())},[r]),!0,!1);return S.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),c.jsx("div",{ref:o,style:Ao(!1),children:e})},Yx=({children:e})=>{const t=S.useContext(Rc),n=Mt("windowViewportRect"),r=Mt("itemDimensions"),o=rt("customScrollParent"),s=rc(n,o,!1);return S.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),c.jsx("div",{ref:s,style:Ao(!1),children:e})},Xx=S.memo(function({...e}){const t=rt("useWindowScroll"),n=rt("customScrollParent"),r=n||t?Zx:Jx,o=n||t?Yx:Gx,s=rt("context");return c.jsx(r,{...e,...mt(r,s),children:c.jsxs(o,{children:[c.jsx(Kx,{}),c.jsx(Vx,{}),c.jsx(qx,{})]})})}),{useEmitter:Kc,useEmitterValue:rt,usePublisher:Mt}=jc(Wx,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},Xx),Jx=$c({useEmitter:Kc,useEmitterValue:rt,usePublisher:Mt}),Zx=Fc({useEmitter:Kc,useEmitterValue:rt,usePublisher:Mt});function qc(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Tt.WARN),t==="normal"?0:parseInt(t??"0",10)}const Qx=no.cva("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function ji({className:e,variant:t,...n}){return c.jsx("div",{className:te(Qx({variant:t}),e),...n})}function ae(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function ev(e,t){const n=m.createContext(t),r=s=>{const{children:i,...a}=s,l=m.useMemo(()=>a,Object.values(a));return c.jsx(n.Provider,{value:l,children:i})};r.displayName=e+"Provider";function o(s){const i=m.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,o]}function en(e,t=[]){let n=[];function r(s,i){const a=m.createContext(i),l=n.length;n=[...n,i];const u=f=>{var x;const{scope:h,children:p,...w}=f,v=((x=h==null?void 0:h[e])==null?void 0:x[l])||a,g=m.useMemo(()=>w,Object.values(w));return c.jsx(v.Provider,{value:g,children:p})};u.displayName=s+"Provider";function d(f,h){var v;const p=((v=h==null?void 0:h[e])==null?void 0:v[l])||a,w=m.useContext(p);if(w)return w;if(i!==void 0)return i;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,d]}const o=()=>{const s=n.map(i=>m.createContext(i));return function(a){const l=(a==null?void 0:a[e])||s;return m.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,tv(o,...t)]}function tv(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((a,{useScope:l,scopeName:u})=>{const f=l(s)[`__scope${u}`];return{...a,...f}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var dt=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},nv=m[" useInsertionEffect ".trim().toString()]||dt;function zn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=rv({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:o;{const d=m.useRef(e!==void 0);m.useEffect(()=>{const f=d.current;f!==a&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=a},[a,r])}const u=m.useCallback(d=>{var f;if(a){const h=ov(d)?d(e):d;h!==e&&((f=i.current)==null||f.call(i,h))}else s(d)},[a,e,s,i]);return[l,u]}function rv({defaultProp:e,onChange:t}){const[n,r]=m.useState(e),o=m.useRef(n),s=m.useRef(t);return nv(()=>{s.current=t},[t]),m.useEffect(()=>{var i;o.current!==n&&((i=s.current)==null||i.call(s,n),o.current=n)},[n,o]),[n,r,s]}function ov(e){return typeof e=="function"}function Gc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function _i(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Gc(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Gc(e[o],null)}}}}function $e(...e){return m.useCallback(_i(...e),e)}var sv=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ie=sv.reduce((e,t)=>{const n=Rn.createSlot(`Primitive.${t}`),r=m.forwardRef((o,s)=>{const{asChild:i,...a}=o,l=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Yc(e,t){e&&ro.flushSync(()=>e.dispatchEvent(t))}function iv(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}var At=e=>{const{present:t,children:n}=e,r=av(t),o=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),s=$e(r.ref,lv(o));return typeof n=="function"||r.isPresent?m.cloneElement(o,{ref:s}):null};At.displayName="Presence";function av(e){const[t,n]=m.useState(),r=m.useRef(null),o=m.useRef(e),s=m.useRef("none"),i=e?"mounted":"unmounted",[a,l]=iv(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const u=Ro(r.current);s.current=a==="mounted"?u:"none"},[a]),dt(()=>{const u=r.current,d=o.current;if(d!==e){const h=s.current,p=Ro(u);e?l("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),dt(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=p=>{const v=Ro(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&v&&(l("ANIMATION_END"),!o.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},h=p=>{p.target===t&&(s.current=Ro(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:m.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function Ro(e){return(e==null?void 0:e.animationName)||"none"}function lv(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var cv=m[" useId ".trim().toString()]||(()=>{}),uv=0;function tn(e){const[t,n]=m.useState(cv());return dt(()=>{n(r=>r??String(uv++))},[e]),e||(t?`radix-${t}`:"")}var Po="Collapsible",[dv,GC]=en(Po),[fv,Ri]=dv(Po),Xc=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:s,onOpenChange:i,...a}=e,[l,u]=zn({prop:r,defaultProp:o??!1,onChange:i,caller:Po});return c.jsx(fv,{scope:n,disabled:s,contentId:tn(),open:l,onOpenToggle:m.useCallback(()=>u(d=>!d),[u]),children:c.jsx(Ie.div,{"data-state":Oi(l),"data-disabled":s?"":void 0,...a,ref:t})})});Xc.displayName=Po;var Jc="CollapsibleTrigger",Zc=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=Ri(Jc,n);return c.jsx(Ie.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":Oi(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:ae(e.onClick,o.onOpenToggle)})});Zc.displayName=Jc;var Pi="CollapsibleContent",hv=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Ri(Pi,e.__scopeCollapsible);return c.jsx(At,{present:n||o.open,children:({present:s})=>c.jsx(pv,{...r,ref:t,present:s})})});hv.displayName=Pi;var pv=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...s}=e,i=Ri(Pi,n),[a,l]=m.useState(r),u=m.useRef(null),d=$e(t,u),f=m.useRef(0),h=f.current,p=m.useRef(0),w=p.current,v=i.open||a,g=m.useRef(v),x=m.useRef(void 0);return m.useEffect(()=>{const y=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(y)},[]),dt(()=>{const y=u.current;if(y){x.current=x.current||{transitionDuration:y.style.transitionDuration,animationName:y.style.animationName},y.style.transitionDuration="0s",y.style.animationName="none";const C=y.getBoundingClientRect();f.current=C.height,p.current=C.width,g.current||(y.style.transitionDuration=x.current.transitionDuration,y.style.animationName=x.current.animationName),l(r)}},[i.open,r]),c.jsx(Ie.div,{"data-state":Oi(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!v,...s,ref:d,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":w?`${w}px`:void 0,...e.style},children:v&&o})});function Oi(e){return e?"open":"closed"}var mv=Xc;const Qc=mv,eu=Zc,Br=m.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:te("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Br.displayName="Card";const Hr=m.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:te("flex flex-col space-y-1.5 p-6",e),...t}));Hr.displayName="CardHeader";const Ur=m.forwardRef(({className:e,...t},n)=>c.jsx("h3",{ref:n,className:te("text-2xl font-semibold leading-none tracking-tight",e),...t}));Ur.displayName="CardTitle";const tu=m.forwardRef(({className:e,...t},n)=>c.jsx("p",{ref:n,className:te("text-sm text-muted-foreground",e),...t}));tu.displayName="CardDescription";const Oo=m.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:te("p-6 pt-0",e),...t}));Oo.displayName="CardContent";const nu=m.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:te("flex items-center p-6 pt-0",e),...t}));nu.displayName="CardFooter";function ru(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}let Bn=ru();function gv(e){Bn=e}const ou=/[&<>"']/,xv=new RegExp(ou.source,"g"),su=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,vv=new RegExp(su.source,"g"),wv={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},iu=e=>wv[e];function gt(e,t){if(t){if(ou.test(e))return e.replace(xv,iu)}else if(su.test(e))return e.replace(vv,iu);return e}const bv=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function au(e){return e.replace(bv,(t,n)=>(n=n.toLowerCase(),n==="colon"?":":n.charAt(0)==="#"?n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1)):""))}const yv=/(^|[^\[])\^/g;function Xe(e,t){e=typeof e=="string"?e:e.source,t=t||"";const n={replace:(r,o)=>(o=o.source||o,o=o.replace(yv,"$1"),e=e.replace(r,o),n),getRegex:()=>new RegExp(e,t)};return n}const Sv=/[^\w:]/g,Cv=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function lu(e,t,n){if(e){let r;try{r=decodeURIComponent(au(n)).replace(Sv,"").toLowerCase()}catch{return null}if(r.indexOf("javascript:")===0||r.indexOf("vbscript:")===0||r.indexOf("data:")===0)return null}t&&!Cv.test(n)&&(n=Iv(t,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch{return null}return n}const Mo={},Tv=/^[^:]+:\/*[^/]*$/,kv=/^([^:]+:)[\s\S]*$/,Ev=/^([^:]+:\/*[^/]*)[\s\S]*$/;function Iv(e,t){Mo[" "+e]||(Tv.test(e)?Mo[" "+e]=e+"/":Mo[" "+e]=Lo(e,"/",!0)),e=Mo[" "+e];const n=e.indexOf(":")===-1;return t.substring(0,2)==="//"?n?t:e.replace(kv,"$1")+t:t.charAt(0)==="/"?n?t:e.replace(Ev,"$1")+t:e+t}const Do={exec:function(){}};function cu(e,t){const n=e.replace(/\|/g,(s,i,a)=>{let l=!1,u=i;for(;--u>=0&&a[u]==="\\";)l=!l;return l?"|":" |"}),r=n.split(/ \|/);let o=0;if(r[0].trim()||r.shift(),r.length>0&&!r[r.length-1].trim()&&r.pop(),r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;o<r.length;o++)r[o]=r[o].trim().replace(/\\\|/g,"|");return r}function Lo(e,t,n){const r=e.length;if(r===0)return"";let o=0;for(;o<r;){const s=e.charAt(r-o-1);if(s===t&&!n)o++;else if(s!==t&&n)o++;else break}return e.slice(0,r-o)}function Nv(e,t){if(e.indexOf(t[1])===-1)return-1;const n=e.length;let r=0,o=0;for(;o<n;o++)if(e[o]==="\\")o++;else if(e[o]===t[0])r++;else if(e[o]===t[1]&&(r--,r<0))return o;return-1}function Av(e){e&&e.sanitize&&!e.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}function uu(e,t){if(t<1)return"";let n="";for(;t>1;)t&1&&(n+=e),t>>=1,e+=e;return n+e}function du(e,t,n,r){const o=t.href,s=t.title?gt(t.title):null,i=e[1].replace(/\\([\[\]])/g,"$1");if(e[0].charAt(0)!=="!"){r.state.inLink=!0;const a={type:"link",raw:n,href:o,title:s,text:i,tokens:r.inlineTokens(i)};return r.state.inLink=!1,a}return{type:"image",raw:n,href:o,title:s,text:gt(i)}}function jv(e,t){const n=e.match(/^(\s+)(?:```)/);if(n===null)return t;const r=n[1];return t.split(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teodor-new-chat-ui",
3
- "version": "4.1.32",
3
+ "version": "4.1.33",
4
4
  "description": "React chat UI components with streaming support, tool calls, and modern design",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": "dist/index.esm.js",