muryshev commited on
Commit
7ea954a
·
1 Parent(s): a851246
dist/assets/{index-L6yZN20c.js → index-DOrHED0Y.js} RENAMED
@@ -80,6 +80,6 @@ Error generating stack: `+i.message+`
80
  `).map((f,m)=>F.jsxs(An.Fragment,{children:[f,m<a.split(`
81
  `).length-1&&F.jsx("br",{})]},`${m}-after`));i.push(p)}return i.length>0?i:l.split(`
82
  `).map((p,f)=>F.jsxs(An.Fragment,{children:[p,f<l.split(`
83
- `).length-1&&F.jsx("br",{})]},f))};return F.jsx("div",{className:`message ${e}`,children:n?F.jsx("span",{children:"..."}):F.jsx("div",{className:"message-content",children:r(t)})})},lv=({onSend:e,text:t,setText:n})=>{const r=l=>{l.key==="Enter"&&l.ctrlKey&&(l.preventDefault(),t.trim()&&e(t))};return F.jsx("div",{className:"input-wrapper",children:F.jsx("textarea",{value:t,onChange:l=>n(l.target.value),onKeyDown:r,placeholder:"Введите сообщение... (Ctrl+Enter для отправки)"})})};function re(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var iv=typeof Symbol=="function"&&Symbol.observable||"@@observable",Za=iv,Co=()=>Math.random().toString(36).substring(7).split("").join("."),ov={INIT:`@@redux/INIT${Co()}`,REPLACE:`@@redux/REPLACE${Co()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Co()}`},mi=ov;function Ps(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Xd(e,t,n){if(typeof e!="function")throw new Error(re(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(re(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(re(1));return n(Xd)(e,t)}let r=e,l=t,i=new Map,o=i,u=0,s=!1;function a(){o===i&&(o=new Map,i.forEach((E,d)=>{o.set(d,E)}))}function p(){if(s)throw new Error(re(3));return l}function f(E){if(typeof E!="function")throw new Error(re(4));if(s)throw new Error(re(5));let d=!0;a();const c=u++;return o.set(c,E),function(){if(d){if(s)throw new Error(re(6));d=!1,a(),o.delete(c),i=null}}}function m(E){if(!Ps(E))throw new Error(re(7));if(typeof E.type>"u")throw new Error(re(8));if(typeof E.type!="string")throw new Error(re(17));if(s)throw new Error(re(9));try{s=!0,l=r(l,E)}finally{s=!1}return(i=o).forEach(c=>{c()}),E}function w(E){if(typeof E!="function")throw new Error(re(10));r=E,m({type:mi.REPLACE})}function y(){const E=f;return{subscribe(d){if(typeof d!="object"||d===null)throw new Error(re(11));function c(){const v=d;v.next&&v.next(p())}return c(),{unsubscribe:E(c)}},[Za](){return this}}}return m({type:mi.INIT}),{dispatch:m,subscribe:f,getState:p,replaceReducer:w,[Za]:y}}function uv(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:mi.INIT})>"u")throw new Error(re(12));if(typeof n(void 0,{type:mi.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(re(13))})}function sv(e){const t=Object.keys(e),n={};for(let i=0;i<t.length;i++){const o=t[i];typeof e[o]=="function"&&(n[o]=e[o])}const r=Object.keys(n);let l;try{uv(n)}catch(i){l=i}return function(o={},u){if(l)throw l;let s=!1;const a={};for(let p=0;p<r.length;p++){const f=r[p],m=n[f],w=o[f],y=m(w,u);if(typeof y>"u")throw u&&u.type,new Error(re(14));a[f]=y,s=s||y!==w}return s=s||r.length!==Object.keys(o).length,s?a:o}}function yi(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function av(...e){return t=>(n,r)=>{const l=t(n,r);let i=()=>{throw new Error(re(15))};const o={getState:l.getState,dispatch:(s,...a)=>i(s,...a)},u=e.map(s=>s(o));return i=yi(...u)(l.dispatch),{...l,dispatch:i}}}function cv(e){return Ps(e)&&"type"in e&&typeof e.type=="string"}var Yd=Symbol.for("immer-nothing"),Ja=Symbol.for("immer-draftable"),Me=Symbol.for("immer-state");function Xe(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var sr=Object.getPrototypeOf;function Sn(e){return!!e&&!!e[Me]}function Et(e){var t;return e?Zd(e)||Array.isArray(e)||!!e[Ja]||!!((t=e.constructor)!=null&&t[Ja])||Bi(e)||Qi(e):!1}var fv=Object.prototype.constructor.toString();function Zd(e){if(!e||typeof e!="object")return!1;const t=sr(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===fv}function vi(e,t){$i(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function $i(e){const t=e[Me];return t?t.type_:Array.isArray(e)?1:Bi(e)?2:Qi(e)?3:0}function Cu(e,t){return $i(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Jd(e,t,n){const r=$i(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function dv(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Bi(e){return e instanceof Map}function Qi(e){return e instanceof Set}function rn(e){return e.copy_||e.base_}function _u(e,t){if(Bi(e))return new Map(e);if(Qi(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Zd(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Me];let l=Reflect.ownKeys(r);for(let i=0;i<l.length;i++){const o=l[i],u=r[o];u.writable===!1&&(u.writable=!0,u.configurable=!0),(u.get||u.set)&&(r[o]={configurable:!0,writable:!0,enumerable:u.enumerable,value:e[o]})}return Object.create(sr(e),r)}else{const r=sr(e);if(r!==null&&n)return{...e};const l=Object.create(r);return Object.assign(l,e)}}function Rs(e,t=!1){return Hi(e)||Sn(e)||!Et(e)||($i(e)>1&&(e.set=e.add=e.clear=e.delete=pv),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Rs(r,!0))),e}function pv(){Xe(2)}function Hi(e){return Object.isFrozen(e)}var hv={};function En(e){const t=hv[e];return t||Xe(0,e),t}var Zr;function bd(){return Zr}function mv(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function ba(e,t){t&&(En("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function xu(e){Pu(e),e.drafts_.forEach(yv),e.drafts_=null}function Pu(e){e===Zr&&(Zr=e.parent_)}function ec(e){return Zr=mv(Zr,e)}function yv(e){const t=e[Me];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function tc(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Me].modified_&&(xu(t),Xe(4)),Et(e)&&(e=gi(t,e),t.parent_||wi(t,e)),t.patches_&&En("Patches").generateReplacementPatches_(n[Me].base_,e,t.patches_,t.inversePatches_)):e=gi(t,n,[]),xu(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Yd?e:void 0}function gi(e,t,n){if(Hi(t))return t;const r=t[Me];if(!r)return vi(t,(l,i)=>nc(e,r,t,l,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return wi(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const l=r.copy_;let i=l,o=!1;r.type_===3&&(i=new Set(l),l.clear(),o=!0),vi(i,(u,s)=>nc(e,r,l,u,s,n,o)),wi(e,l,!1),n&&e.patches_&&En("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function nc(e,t,n,r,l,i,o){if(Sn(l)){const u=i&&t&&t.type_!==3&&!Cu(t.assigned_,r)?i.concat(r):void 0,s=gi(e,l,u);if(Jd(n,r,s),Sn(s))e.canAutoFreeze_=!1;else return}else o&&n.add(l);if(Et(l)&&!Hi(l)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;gi(e,l),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&wi(e,l)}}function wi(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Rs(t,n)}function vv(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:bd(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let l=r,i=Os;n&&(l=[r],i=Jr);const{revoke:o,proxy:u}=Proxy.revocable(l,i);return r.draft_=u,r.revoke_=o,u}var Os={get(e,t){if(t===Me)return e;const n=rn(e);if(!Cu(n,t))return gv(e,n,t);const r=n[t];return e.finalized_||!Et(r)?r:r===_o(e.base_,t)?(xo(e),e.copy_[t]=Ou(r,e)):r},has(e,t){return t in rn(e)},ownKeys(e){return Reflect.ownKeys(rn(e))},set(e,t,n){const r=ep(rn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const l=_o(rn(e),t),i=l==null?void 0:l[Me];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(dv(n,l)&&(n!==void 0||Cu(e.base_,t)))return!0;xo(e),Ru(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return _o(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,xo(e),Ru(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=rn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Xe(11)},getPrototypeOf(e){return sr(e.base_)},setPrototypeOf(){Xe(12)}},Jr={};vi(Os,(e,t)=>{Jr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Jr.deleteProperty=function(e,t){return Jr.set.call(this,e,t,void 0)};Jr.set=function(e,t,n){return Os.set.call(this,e[0],t,n,e[0])};function _o(e,t){const n=e[Me];return(n?rn(n):e)[t]}function gv(e,t,n){var l;const r=ep(t,n);return r?"value"in r?r.value:(l=r.get)==null?void 0:l.call(e.draft_):void 0}function ep(e,t){if(!(t in e))return;let n=sr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=sr(n)}}function Ru(e){e.modified_||(e.modified_=!0,e.parent_&&Ru(e.parent_))}function xo(e){e.copy_||(e.copy_=_u(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var wv=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const o=this;return function(s=i,...a){return o.produce(s,p=>n.call(this,p,...a))}}typeof n!="function"&&Xe(6),r!==void 0&&typeof r!="function"&&Xe(7);let l;if(Et(t)){const i=ec(this),o=Ou(t,void 0);let u=!0;try{l=n(o),u=!1}finally{u?xu(i):Pu(i)}return ba(i,r),tc(l,i)}else if(!t||typeof t!="object"){if(l=n(t),l===void 0&&(l=t),l===Yd&&(l=void 0),this.autoFreeze_&&Rs(l,!0),r){const i=[],o=[];En("Patches").generateReplacementPatches_(t,l,i,o),r(i,o)}return l}else Xe(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(o,...u)=>this.produceWithPatches(o,s=>t(s,...u));let r,l;return[this.produce(t,n,(o,u)=>{r=o,l=u}),r,l]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Et(e)||Xe(8),Sn(e)&&(e=Sv(e));const t=ec(this),n=Ou(e,void 0);return n[Me].isManual_=!0,Pu(t),n}finishDraft(e,t){const n=e&&e[Me];(!n||!n.isManual_)&&Xe(9);const{scope_:r}=n;return ba(r,t),tc(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const l=t[n];if(l.path.length===0&&l.op==="replace"){e=l.value;break}}n>-1&&(t=t.slice(n+1));const r=En("Patches").applyPatches_;return Sn(e)?r(e,t):this.produce(e,l=>r(l,t))}};function Ou(e,t){const n=Bi(e)?En("MapSet").proxyMap_(e,t):Qi(e)?En("MapSet").proxySet_(e,t):vv(e,t);return(t?t.scope_:bd()).drafts_.push(n),n}function Sv(e){return Sn(e)||Xe(10,e),tp(e)}function tp(e){if(!Et(e)||Hi(e))return e;const t=e[Me];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=_u(e,t.scope_.immer_.useStrictShallowCopy_)}else n=_u(e,!0);return vi(n,(r,l)=>{Jd(n,r,tp(l))}),t&&(t.finalized_=!1),n}var ze=new wv,np=ze.produce;ze.produceWithPatches.bind(ze);ze.setAutoFreeze.bind(ze);ze.setUseStrictShallowCopy.bind(ze);ze.applyPatches.bind(ze);ze.createDraft.bind(ze);ze.finishDraft.bind(ze);function rp(e){return({dispatch:n,getState:r})=>l=>i=>typeof i=="function"?i(n,r,e):l(i)}var Ev=rp(),kv=rp,Cv=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?yi:yi.apply(null,arguments)};function rc(e,t){function n(...r){if(t){let l=t(...r);if(!l)throw new Error(yt(0));return{type:e,payload:l.payload,..."meta"in l&&{meta:l.meta},..."error"in l&&{error:l.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>cv(r)&&r.type===e,n}var lp=class _r extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,_r.prototype)}static get[Symbol.species](){return _r}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new _r(...t[0].concat(this)):new _r(...t.concat(this))}};function lc(e){return Et(e)?np(e,()=>{}):e}function ic(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function _v(e){return typeof e=="boolean"}var xv=()=>function(t){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:l=!0,actionCreatorCheck:i=!0}=t??{};let o=new lp;return n&&(_v(n)?o.push(Ev):o.push(kv(n.extraArgument))),o},Pv="RTK_autoBatch",oc=e=>t=>{setTimeout(t,e)},Rv=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let l=!0,i=!1,o=!1;const u=new Set,s=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:oc(10):e.type==="callback"?e.queueNotification:oc(e.timeout),a=()=>{o=!1,i&&(i=!1,u.forEach(p=>p()))};return Object.assign({},r,{subscribe(p){const f=()=>l&&p(),m=r.subscribe(f);return u.add(p),()=>{m(),u.delete(p)}},dispatch(p){var f;try{return l=!((f=p==null?void 0:p.meta)!=null&&f[Pv]),i=!l,i&&(o||(o=!0,s(a))),r.dispatch(p)}finally{l=!0}}})},Ov=e=>function(n){const{autoBatch:r=!0}=n??{};let l=new lp(e);return r&&l.push(Rv(typeof r=="object"?r:void 0)),l};function Nv(e){const t=xv(),{reducer:n=void 0,middleware:r,devTools:l=!0,preloadedState:i=void 0,enhancers:o=void 0}=e||{};let u;if(typeof n=="function")u=n;else if(Ps(n))u=sv(n);else throw new Error(yt(1));let s;typeof r=="function"?s=r(t):s=t();let a=yi;l&&(a=Cv({trace:!1,...typeof l=="object"&&l}));const p=av(...s),f=Ov(p);let m=typeof o=="function"?o(f):f();const w=a(...m);return Xd(u,i,w)}function ip(e){const t={},n=[];let r;const l={addCase(i,o){const u=typeof i=="string"?i:i.type;if(!u)throw new Error(yt(28));if(u in t)throw new Error(yt(29));return t[u]=o,l},addMatcher(i,o){return n.push({matcher:i,reducer:o}),l},addDefaultCase(i){return r=i,l}};return e(l),[t,n,r]}function Tv(e){return typeof e=="function"}function Mv(e,t){let[n,r,l]=ip(t),i;if(Tv(e))i=()=>lc(e());else{const u=lc(e);i=()=>u}function o(u=i(),s){let a=[n[s.type],...r.filter(({matcher:p})=>p(s)).map(({reducer:p})=>p)];return a.filter(p=>!!p).length===0&&(a=[l]),a.reduce((p,f)=>{if(f)if(Sn(p)){const w=f(p,s);return w===void 0?p:w}else{if(Et(p))return np(p,m=>f(m,s));{const m=f(p,s);if(m===void 0){if(p===null)return p;throw Error("A case reducer on a non-draftable value must not return undefined")}return m}}return p},u)}return o.getInitialState=i,o}var zv=Symbol.for("rtk-slice-createasyncthunk");function Lv(e,t){return`${e}/${t}`}function Dv({creators:e}={}){var n;const t=(n=e==null?void 0:e.asyncThunk)==null?void 0:n[zv];return function(l){const{name:i,reducerPath:o=i}=l;if(!i)throw new Error(yt(11));const u=(typeof l.reducers=="function"?l.reducers(Iv()):l.reducers)||{},s=Object.keys(u),a={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},p={addCase(h,v){const k=typeof h=="string"?h:h.type;if(!k)throw new Error(yt(12));if(k in a.sliceCaseReducersByType)throw new Error(yt(13));return a.sliceCaseReducersByType[k]=v,p},addMatcher(h,v){return a.sliceMatchers.push({matcher:h,reducer:v}),p},exposeAction(h,v){return a.actionCreators[h]=v,p},exposeCaseReducer(h,v){return a.sliceCaseReducersByName[h]=v,p}};s.forEach(h=>{const v=u[h],k={reducerName:h,type:Lv(i,h),createNotation:typeof l.reducers=="function"};Uv(v)?Bv(k,v,p,t):Av(k,v,p)});function f(){const[h={},v=[],k=void 0]=typeof l.extraReducers=="function"?ip(l.extraReducers):[l.extraReducers],x={...h,...a.sliceCaseReducersByType};return Mv(l.initialState,P=>{for(let _ in x)P.addCase(_,x[_]);for(let _ of a.sliceMatchers)P.addMatcher(_.matcher,_.reducer);for(let _ of v)P.addMatcher(_.matcher,_.reducer);k&&P.addDefaultCase(k)})}const m=h=>h,w=new Map;let y;function g(h,v){return y||(y=f()),y(h,v)}function E(){return y||(y=f()),y.getInitialState()}function d(h,v=!1){function k(P){let _=P[h];return typeof _>"u"&&v&&(_=E()),_}function x(P=m){const _=ic(w,v,()=>new WeakMap);return ic(_,P,()=>{const M={};for(const[D,pe]of Object.entries(l.selectors??{}))M[D]=Fv(pe,P,E,v);return M})}return{reducerPath:h,getSelectors:x,get selectors(){return x(k)},selectSlice:k}}const c={name:i,reducer:g,actions:a.actionCreators,caseReducers:a.sliceCaseReducersByName,getInitialState:E,...d(o),injectInto(h,{reducerPath:v,...k}={}){const x=v??o;return h.inject({reducerPath:x,reducer:g},k),{...c,...d(x,!0)}}};return c}}function Fv(e,t,n,r){function l(i,...o){let u=t(i);return typeof u>"u"&&r&&(u=n()),e(u,...o)}return l.unwrapped=e,l}var jv=Dv();function Iv(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function Av({type:e,reducerName:t,createNotation:n},r,l){let i,o;if("reducer"in r){if(n&&!$v(r))throw new Error(yt(17));i=r.reducer,o=r.prepare}else i=r;l.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,o?rc(e,o):rc(e))}function Uv(e){return e._reducerDefinitionType==="asyncThunk"}function $v(e){return e._reducerDefinitionType==="reducerWithPrepare"}function Bv({type:e,reducerName:t},n,r,l){if(!l)throw new Error(yt(18));const{payloadCreator:i,fulfilled:o,pending:u,rejected:s,settled:a,options:p}=n,f=l(e,i,p);r.exposeAction(t,f),o&&r.addCase(f.fulfilled,o),u&&r.addCase(f.pending,u),s&&r.addCase(f.rejected,s),a&&r.addMatcher(f.settled,a),r.exposeCaseReducer(t,{fulfilled:o||Nl,pending:u||Nl,rejected:s||Nl,settled:a||Nl})}function Nl(){}function yt(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}const Qv=()=>{const e=localStorage.getItem("chatHistory");if(e)try{return JSON.parse(e)}catch(t){return console.error("Failed to parse chat history from localStorage:",t),[]}return[]},Hv={history:Qv()},op=jv({name:"chat",initialState:Hv,reducers:{addMessage:(e,t)=>{e.history.push(t.payload),localStorage.setItem("chatHistory",JSON.stringify(e.history))},clearHistory:e=>{e.history=[],localStorage.setItem("chatHistory",JSON.stringify([]))},setHistory:(e,t)=>{e.history=t.payload,localStorage.setItem("chatHistory",JSON.stringify(e.history))}}}),{addMessage:Vv,clearHistory:Wv,setHistory:Po}=op.actions,Kv=op.reducer,Gv=()=>{const[e,t]=O.useState(""),[n,r]=O.useState(null),[l,i]=O.useState(!1),[o,u]=O.useState(!1),s=nv(y=>y.chat.history),a=by(),p=O.useRef(null),f=()=>{const y=document.querySelector(".messages");if(y){const g=y.getBoundingClientRect(),E=window.innerHeight;return g.bottom<=E+10}return!0},m=()=>{p.current&&(p.current.abort(),i(!1),console.log("Generation stopped by user"))},w=async y=>{var d;if(!y.trim()||l)return;const g={role:"user",content:y,searchResults:[]};a(Vv(g)),t(""),i(!0),u(!1),console.log("Start request - isLoading:",l,"hasAssistantStarted:",o);const E="https://muryshev-generic-chatbot-backend.hf.space/llm/chat/stream";try{const c=new AbortController;p.current=c;const h=setTimeout(()=>{c.abort(),r("Сервер временно недоступен")},5e3),v=await fetch(E,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({history:[...s,g]}),signal:c.signal});if(clearTimeout(h),!v.ok)throw new Error(`HTTP error! status: ${v.status}`);const k=(d=v.body)==null?void 0:d.getReader();if(!k)throw new Error("Response body is not readable");const x=new TextDecoder;let P="",_="",M=[...s,g];for(;;){const{done:D,value:pe}=await k.read();if(D)break;P+=x.decode(pe,{stream:!0});const be=P.split(`
84
 
85
  `);for(let st=0;st<be.length-1;st++){const Jt=be[st].trim();if(Jt.startsWith("data: ")){const _n=Jt.slice(6);console.log("Received SSE event:",_n);try{const Pe=JSON.parse(_n);if(Pe.event==="done"){a(Po(M)),i(!1),console.log("Done - isLoading:",l,"hasAssistantStarted:",o);break}else if(Pe.event==="error"){r(Pe.data),i(!1),console.log("Error - isLoading:",l,"hasAssistantStarted:",o);break}else if(Pe.event==="search_results")M=M.map((R,T)=>T===M.length-1&&R.role==="user"?{...R,content:R.content+Pe.data}:R),a(Po(M)),console.log("After search_results - isLoading:",l,"hasAssistantStarted:",o);else if(Pe.event==="token"){o||(u(!0),console.log("Before first token - isLoading:",l,"hasAssistantStarted:",o)),_+=Pe.data;const R=M.findLastIndex(z=>z.role==="user"),T=M.findIndex((z,B)=>z.role==="assistant"&&B>R);T>=0?M=M.map((z,B)=>B===T?{...z,content:_}:z):M=[...M,{role:"assistant",content:_,searchResults:[]}],a(Po(M))}}catch(Pe){console.error("Failed to parse SSE data:",Pe),r("Ошибка обработки данных от сервера")}}}P=be[be.length-1];const Ct=document.querySelector(".messages");if(Ct){const st=Ct.querySelectorAll("div"),Jt=st[st.length-1];Jt&&f()&&setTimeout(()=>{Jt.scrollIntoView({behavior:"smooth",block:"start"}),console.log("Autoscroll triggered, isAtBottom:",f())},0)}}}catch(c){console.error("Stream error:",c),i(!1),console.log("Catch - isLoading:",l,"hasAssistantStarted:",o),c instanceof DOMException&&c.name==="AbortError"&&!p.current?r("Сервер временно недоступен"):c instanceof DOMException&&c.name==="AbortError"||r("Произошла ошибка при запросе")}finally{p.current=null}};return O.useEffect(()=>{if(console.log("State update - isLoading:",l,"hasAssistantStarted:",o),n){const y=setTimeout(()=>r(null),5e3);return()=>clearTimeout(y)}},[l,o,n]),F.jsxs("div",{className:"chat",children:[n&&F.jsx("div",{className:"error-toast",children:n}),F.jsxs("div",{className:"messages",children:[s.map((y,g)=>F.jsx("div",{children:F.jsx(Ya,{role:y.role,content:y.content})},g)),l&&!o&&F.jsx("div",{children:F.jsx(Ya,{role:"assistant",content:"",isLoading:!0})})]}),F.jsxs("div",{className:"input-area",children:[F.jsx(lv,{onSend:w,text:e,setText:t}),F.jsxs("div",{className:"buttons",children:[l?F.jsx("button",{className:"stop-button",onClick:m,children:"Остановить"}):F.jsx("button",{className:"send-button",onClick:()=>w(e),children:"Отправить"}),F.jsx("a",{href:"#",className:"clear-link",onClick:y=>{y.preventDefault(),a(Wv())},children:"Очистить"})]})]})]})},qv=Nv({reducer:{chat:Kv}}),Xv=()=>F.jsx(Yy,{store:qv,children:F.jsx(Gv,{})});var Vi=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Wi=typeof window>"u"||"Deno"in globalThis;function Ve(){}function Yv(e,t){return typeof e=="function"?e(t):e}function Zv(e){return typeof e=="number"&&e>=0&&e!==1/0}function Jv(e,t){return Math.max(e+(t||0)-Date.now(),0)}function uc(e,t){return typeof e=="function"?e(t):e}function bv(e,t){return typeof e=="function"?e(t):e}function sc(e,t){const{type:n="all",exact:r,fetchStatus:l,predicate:i,queryKey:o,stale:u}=e;if(o){if(r){if(t.queryHash!==Ns(o,t.options))return!1}else if(!el(t.queryKey,o))return!1}if(n!=="all"){const s=t.isActive();if(n==="active"&&!s||n==="inactive"&&s)return!1}return!(typeof u=="boolean"&&t.isStale()!==u||l&&l!==t.state.fetchStatus||i&&!i(t))}function ac(e,t){const{exact:n,status:r,predicate:l,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(br(t.options.mutationKey)!==br(i))return!1}else if(!el(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||l&&!l(t))}function Ns(e,t){return((t==null?void 0:t.queryKeyHashFn)||br)(e)}function br(e){return JSON.stringify(e,(t,n)=>Nu(n)?Object.keys(n).sort().reduce((r,l)=>(r[l]=n[l],r),{}):n)}function el(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!el(e[n],t[n])):!1}function up(e,t){if(e===t)return e;const n=cc(e)&&cc(t);if(n||Nu(e)&&Nu(t)){const r=n?e:Object.keys(e),l=r.length,i=n?t:Object.keys(t),o=i.length,u=n?[]:{};let s=0;for(let a=0;a<o;a++){const p=n?a:i[a];(!n&&r.includes(p)||n)&&e[p]===void 0&&t[p]===void 0?(u[p]=void 0,s++):(u[p]=up(e[p],t[p]),u[p]===e[p]&&e[p]!==void 0&&s++)}return l===o&&s===l?e:u}return t}function cc(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Nu(e){if(!fc(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!fc(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function fc(e){return Object.prototype.toString.call(e)==="[object Object]"}function eg(e){return new Promise(t=>{setTimeout(t,e)})}function tg(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?up(e,t):t}function ng(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function rg(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Ts=Symbol();function sp(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Ts?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var sn,Tt,Kn,hc,lg=(hc=class extends Vi{constructor(){super();A(this,sn);A(this,Tt);A(this,Kn);L(this,Kn,t=>{if(!Wi&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){S(this,Tt)||this.setEventListener(S(this,Kn))}onUnsubscribe(){var t;this.hasListeners()||((t=S(this,Tt))==null||t.call(this),L(this,Tt,void 0))}setEventListener(t){var n;L(this,Kn,t),(n=S(this,Tt))==null||n.call(this),L(this,Tt,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){S(this,sn)!==t&&(L(this,sn,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof S(this,sn)=="boolean"?S(this,sn):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},sn=new WeakMap,Tt=new WeakMap,Kn=new WeakMap,hc),ap=new lg,Gn,Mt,qn,mc,ig=(mc=class extends Vi{constructor(){super();A(this,Gn,!0);A(this,Mt);A(this,qn);L(this,qn,t=>{if(!Wi&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){S(this,Mt)||this.setEventListener(S(this,qn))}onUnsubscribe(){var t;this.hasListeners()||((t=S(this,Mt))==null||t.call(this),L(this,Mt,void 0))}setEventListener(t){var n;L(this,qn,t),(n=S(this,Mt))==null||n.call(this),L(this,Mt,t(this.setOnline.bind(this)))}setOnline(t){S(this,Gn)!==t&&(L(this,Gn,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return S(this,Gn)}},Gn=new WeakMap,Mt=new WeakMap,qn=new WeakMap,mc),Si=new ig;function og(){let e,t;const n=new Promise((l,i)=>{e=l,t=i});n.status="pending",n.catch(()=>{});function r(l){Object.assign(n,l),delete n.resolve,delete n.reject}return n.resolve=l=>{r({status:"fulfilled",value:l}),e(l)},n.reject=l=>{r({status:"rejected",reason:l}),t(l)},n}function ug(e){return Math.min(1e3*2**e,3e4)}function cp(e){return(e??"online")==="online"?Si.isOnline():!0}var fp=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Ro(e){return e instanceof fp}function dp(e){let t=!1,n=0,r=!1,l;const i=og(),o=g=>{var E;r||(m(new fp(g)),(E=e.abort)==null||E.call(e))},u=()=>{t=!0},s=()=>{t=!1},a=()=>ap.isFocused()&&(e.networkMode==="always"||Si.isOnline())&&e.canRun(),p=()=>cp(e.networkMode)&&e.canRun(),f=g=>{var E;r||(r=!0,(E=e.onSuccess)==null||E.call(e,g),l==null||l(),i.resolve(g))},m=g=>{var E;r||(r=!0,(E=e.onError)==null||E.call(e,g),l==null||l(),i.reject(g))},w=()=>new Promise(g=>{var E;l=d=>{(r||a())&&g(d)},(E=e.onPause)==null||E.call(e)}).then(()=>{var g;l=void 0,r||(g=e.onContinue)==null||g.call(e)}),y=()=>{if(r)return;let g;const E=n===0?e.initialPromise:void 0;try{g=E??e.fn()}catch(d){g=Promise.reject(d)}Promise.resolve(g).then(f).catch(d=>{var x;if(r)return;const c=e.retry??(Wi?0:3),h=e.retryDelay??ug,v=typeof h=="function"?h(n,d):h,k=c===!0||typeof c=="number"&&n<c||typeof c=="function"&&c(n,d);if(t||!k){m(d);return}n++,(x=e.onFail)==null||x.call(e,n,d),eg(v).then(()=>a()?void 0:w()).then(()=>{t?m(d):y()})})};return{promise:i,cancel:o,continue:()=>(l==null||l(),i),cancelRetry:u,continueRetry:s,canStart:p,start:()=>(p()?y():w().then(y),i)}}function sg(){let e=[],t=0,n=u=>{u()},r=u=>{u()},l=u=>setTimeout(u,0);const i=u=>{t?e.push(u):l(()=>{n(u)})},o=()=>{const u=e;e=[],u.length&&l(()=>{r(()=>{u.forEach(s=>{n(s)})})})};return{batch:u=>{let s;t++;try{s=u()}finally{t--,t||o()}return s},batchCalls:u=>(...s)=>{i(()=>{u(...s)})},schedule:i,setNotifyFunction:u=>{n=u},setBatchNotifyFunction:u=>{r=u},setScheduler:u=>{l=u}}}var ye=sg(),an,yc,pp=(yc=class{constructor(){A(this,an)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Zv(this.gcTime)&&L(this,an,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Wi?1/0:5*60*1e3))}clearGcTimeout(){S(this,an)&&(clearTimeout(S(this,an)),L(this,an,void 0))}},an=new WeakMap,yc),Xn,Yn,Fe,cn,ce,tl,fn,We,at,vc,ag=(vc=class extends pp{constructor(t){super();A(this,We);A(this,Xn);A(this,Yn);A(this,Fe);A(this,cn);A(this,ce);A(this,tl);A(this,fn);L(this,fn,!1),L(this,tl,t.defaultOptions),this.setOptions(t.options),this.observers=[],L(this,cn,t.client),L(this,Fe,S(this,cn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,L(this,Xn,fg(this.options)),this.state=t.state??S(this,Xn),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=S(this,ce))==null?void 0:t.promise}setOptions(t){this.options={...S(this,tl),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&S(this,Fe).remove(this)}setData(t,n){const r=tg(this.state.data,t,this.options);return ue(this,We,at).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){ue(this,We,at).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,l;const n=(r=S(this,ce))==null?void 0:r.promise;return(l=S(this,ce))==null||l.cancel(t),n?n.then(Ve).catch(Ve):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(S(this,Xn))}isActive(){return this.observers.some(t=>bv(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ts||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!Jv(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=S(this,ce))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=S(this,ce))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),S(this,Fe).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(S(this,ce)&&(S(this,fn)?S(this,ce).cancel({revert:!0}):S(this,ce).cancelRetry()),this.scheduleGc()),S(this,Fe).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ue(this,We,at).call(this,{type:"invalidate"})}fetch(t,n){var s,a,p;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(S(this,ce))return S(this,ce).continueRetry(),S(this,ce).promise}if(t&&this.setOptions(t),!this.options.queryFn){const f=this.observers.find(m=>m.options.queryFn);f&&this.setOptions(f.options)}const r=new AbortController,l=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(L(this,fn,!0),r.signal)})},i=()=>{const f=sp(this.options,n),m={client:S(this,cn),queryKey:this.queryKey,meta:this.meta};return l(m),L(this,fn,!1),this.options.persister?this.options.persister(f,m,this):f(m)},o={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:S(this,cn),state:this.state,fetchFn:i};l(o),(s=this.options.behavior)==null||s.onFetch(o,this),L(this,Yn,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((a=o.fetchOptions)==null?void 0:a.meta))&&ue(this,We,at).call(this,{type:"fetch",meta:(p=o.fetchOptions)==null?void 0:p.meta});const u=f=>{var m,w,y,g;Ro(f)&&f.silent||ue(this,We,at).call(this,{type:"error",error:f}),Ro(f)||((w=(m=S(this,Fe).config).onError)==null||w.call(m,f,this),(g=(y=S(this,Fe).config).onSettled)==null||g.call(y,this.state.data,f,this)),this.scheduleGc()};return L(this,ce,dp({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var m,w,y,g;if(f===void 0){u(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(E){u(E);return}(w=(m=S(this,Fe).config).onSuccess)==null||w.call(m,f,this),(g=(y=S(this,Fe).config).onSettled)==null||g.call(y,f,this.state.error,this),this.scheduleGc()},onError:u,onFail:(f,m)=>{ue(this,We,at).call(this,{type:"failed",failureCount:f,error:m})},onPause:()=>{ue(this,We,at).call(this,{type:"pause"})},onContinue:()=>{ue(this,We,at).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),S(this,ce).start()}},Xn=new WeakMap,Yn=new WeakMap,Fe=new WeakMap,cn=new WeakMap,ce=new WeakMap,tl=new WeakMap,fn=new WeakMap,We=new WeakSet,at=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...cg(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const l=t.error;return Ro(l)&&l.revert&&S(this,Yn)?{...S(this,Yn),fetchStatus:"idle"}:{...r,error:l,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:l,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),ye.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),S(this,Fe).notify({query:this,type:"updated",action:t})})},vc);function cg(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:cp(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function fg(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var nt,gc,dg=(gc=class extends Vi{constructor(t={}){super();A(this,nt);this.config=t,L(this,nt,new Map)}build(t,n,r){const l=n.queryKey,i=n.queryHash??Ns(l,n);let o=this.get(i);return o||(o=new ag({client:t,queryKey:l,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(l)}),this.add(o)),o}add(t){S(this,nt).has(t.queryHash)||(S(this,nt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=S(this,nt).get(t.queryHash);n&&(t.destroy(),n===t&&S(this,nt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ye.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return S(this,nt).get(t)}getAll(){return[...S(this,nt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>sc(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>sc(t,r)):n}notify(t){ye.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){ye.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ye.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},nt=new WeakMap,gc),rt,he,dn,lt,xt,wc,pg=(wc=class extends pp{constructor(t){super();A(this,lt);A(this,rt);A(this,he);A(this,dn);this.mutationId=t.mutationId,L(this,he,t.mutationCache),L(this,rt,[]),this.state=t.state||hg(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){S(this,rt).includes(t)||(S(this,rt).push(t),this.clearGcTimeout(),S(this,he).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){L(this,rt,S(this,rt).filter(n=>n!==t)),this.scheduleGc(),S(this,he).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){S(this,rt).length||(this.state.status==="pending"?this.scheduleGc():S(this,he).remove(this))}continue(){var t;return((t=S(this,dn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var l,i,o,u,s,a,p,f,m,w,y,g,E,d,c,h,v,k,x,P;L(this,dn,dp({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(_,M)=>{ue(this,lt,xt).call(this,{type:"failed",failureCount:_,error:M})},onPause:()=>{ue(this,lt,xt).call(this,{type:"pause"})},onContinue:()=>{ue(this,lt,xt).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>S(this,he).canRun(this)}));const n=this.state.status==="pending",r=!S(this,dn).canStart();try{if(!n){ue(this,lt,xt).call(this,{type:"pending",variables:t,isPaused:r}),await((i=(l=S(this,he).config).onMutate)==null?void 0:i.call(l,t,this));const M=await((u=(o=this.options).onMutate)==null?void 0:u.call(o,t));M!==this.state.context&&ue(this,lt,xt).call(this,{type:"pending",context:M,variables:t,isPaused:r})}const _=await S(this,dn).start();return await((a=(s=S(this,he).config).onSuccess)==null?void 0:a.call(s,_,t,this.state.context,this)),await((f=(p=this.options).onSuccess)==null?void 0:f.call(p,_,t,this.state.context)),await((w=(m=S(this,he).config).onSettled)==null?void 0:w.call(m,_,null,this.state.variables,this.state.context,this)),await((g=(y=this.options).onSettled)==null?void 0:g.call(y,_,null,t,this.state.context)),ue(this,lt,xt).call(this,{type:"success",data:_}),_}catch(_){try{throw await((d=(E=S(this,he).config).onError)==null?void 0:d.call(E,_,t,this.state.context,this)),await((h=(c=this.options).onError)==null?void 0:h.call(c,_,t,this.state.context)),await((k=(v=S(this,he).config).onSettled)==null?void 0:k.call(v,void 0,_,this.state.variables,this.state.context,this)),await((P=(x=this.options).onSettled)==null?void 0:P.call(x,void 0,_,t,this.state.context)),_}finally{ue(this,lt,xt).call(this,{type:"error",error:_})}}finally{S(this,he).runNext(this)}}},rt=new WeakMap,he=new WeakMap,dn=new WeakMap,lt=new WeakSet,xt=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),ye.batch(()=>{S(this,rt).forEach(r=>{r.onMutationUpdate(t)}),S(this,he).notify({mutation:this,type:"updated",action:t})})},wc);function hg(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var dt,Ke,nl,Sc,mg=(Sc=class extends Vi{constructor(t={}){super();A(this,dt);A(this,Ke);A(this,nl);this.config=t,L(this,dt,new Set),L(this,Ke,new Map),L(this,nl,0)}build(t,n,r){const l=new pg({mutationCache:this,mutationId:++fl(this,nl)._,options:t.defaultMutationOptions(n),state:r});return this.add(l),l}add(t){S(this,dt).add(t);const n=Tl(t);if(typeof n=="string"){const r=S(this,Ke).get(n);r?r.push(t):S(this,Ke).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(S(this,dt).delete(t)){const n=Tl(t);if(typeof n=="string"){const r=S(this,Ke).get(n);if(r)if(r.length>1){const l=r.indexOf(t);l!==-1&&r.splice(l,1)}else r[0]===t&&S(this,Ke).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Tl(t);if(typeof n=="string"){const r=S(this,Ke).get(n),l=r==null?void 0:r.find(i=>i.state.status==="pending");return!l||l===t}else return!0}runNext(t){var r;const n=Tl(t);if(typeof n=="string"){const l=(r=S(this,Ke).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(l==null?void 0:l.continue())??Promise.resolve()}else return Promise.resolve()}clear(){ye.batch(()=>{S(this,dt).forEach(t=>{this.notify({type:"removed",mutation:t})}),S(this,dt).clear(),S(this,Ke).clear()})}getAll(){return Array.from(S(this,dt))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>ac(n,r))}findAll(t={}){return this.getAll().filter(n=>ac(t,n))}notify(t){ye.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return ye.batch(()=>Promise.all(t.map(n=>n.continue().catch(Ve))))}},dt=new WeakMap,Ke=new WeakMap,nl=new WeakMap,Sc);function Tl(e){var t;return(t=e.options.scope)==null?void 0:t.id}function dc(e){return{onFetch:(t,n)=>{var p,f,m,w,y;const r=t.options,l=(m=(f=(p=t.fetchOptions)==null?void 0:p.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,i=((w=t.state.data)==null?void 0:w.pages)||[],o=((y=t.state.data)==null?void 0:y.pageParams)||[];let u={pages:[],pageParams:[]},s=0;const a=async()=>{let g=!1;const E=h=>{Object.defineProperty(h,"signal",{enumerable:!0,get:()=>(t.signal.aborted?g=!0:t.signal.addEventListener("abort",()=>{g=!0}),t.signal)})},d=sp(t.options,t.fetchOptions),c=async(h,v,k)=>{if(g)return Promise.reject();if(v==null&&h.pages.length)return Promise.resolve(h);const x={client:t.client,queryKey:t.queryKey,pageParam:v,direction:k?"backward":"forward",meta:t.options.meta};E(x);const P=await d(x),{maxPages:_}=t.options,M=k?rg:ng;return{pages:M(h.pages,P,_),pageParams:M(h.pageParams,v,_)}};if(l&&i.length){const h=l==="backward",v=h?yg:pc,k={pages:i,pageParams:o},x=v(r,k);u=await c(k,x,h)}else{const h=e??i.length;do{const v=s===0?o[0]??r.initialPageParam:pc(r,u);if(s>0&&v==null)break;u=await c(u,v),s++}while(s<h)}return u};t.options.persister?t.fetchFn=()=>{var g,E;return(E=(g=t.options).persister)==null?void 0:E.call(g,a,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=a}}}function pc(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function yg(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var q,zt,Lt,Zn,Jn,Dt,bn,er,Ec,vg=(Ec=class{constructor(e={}){A(this,q);A(this,zt);A(this,Lt);A(this,Zn);A(this,Jn);A(this,Dt);A(this,bn);A(this,er);L(this,q,e.queryCache||new dg),L(this,zt,e.mutationCache||new mg),L(this,Lt,e.defaultOptions||{}),L(this,Zn,new Map),L(this,Jn,new Map),L(this,Dt,0)}mount(){fl(this,Dt)._++,S(this,Dt)===1&&(L(this,bn,ap.subscribe(async e=>{e&&(await this.resumePausedMutations(),S(this,q).onFocus())})),L(this,er,Si.subscribe(async e=>{e&&(await this.resumePausedMutations(),S(this,q).onOnline())})))}unmount(){var e,t;fl(this,Dt)._--,S(this,Dt)===0&&((e=S(this,bn))==null||e.call(this),L(this,bn,void 0),(t=S(this,er))==null||t.call(this),L(this,er,void 0))}isFetching(e){return S(this,q).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return S(this,zt).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=S(this,q).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=S(this,q).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(uc(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return S(this,q).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),l=S(this,q).get(r.queryHash),i=l==null?void 0:l.state.data,o=Yv(t,i);if(o!==void 0)return S(this,q).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return ye.batch(()=>S(this,q).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=S(this,q).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=S(this,q);ye.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=S(this,q);return ye.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=ye.batch(()=>S(this,q).findAll(e).map(l=>l.cancel(n)));return Promise.all(r).then(Ve).catch(Ve)}invalidateQueries(e,t={}){return ye.batch(()=>(S(this,q).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=ye.batch(()=>S(this,q).findAll(e).filter(l=>!l.isDisabled()).map(l=>{let i=l.fetch(void 0,n);return n.throwOnError||(i=i.catch(Ve)),l.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Ve)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=S(this,q).build(this,t);return n.isStaleByTime(uc(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ve).catch(Ve)}fetchInfiniteQuery(e){return e.behavior=dc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ve).catch(Ve)}ensureInfiniteQueryData(e){return e.behavior=dc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Si.isOnline()?S(this,zt).resumePausedMutations():Promise.resolve()}getQueryCache(){return S(this,q)}getMutationCache(){return S(this,zt)}getDefaultOptions(){return S(this,Lt)}setDefaultOptions(e){L(this,Lt,e)}setQueryDefaults(e,t){S(this,Zn).set(br(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...S(this,Zn).values()],n={};return t.forEach(r=>{el(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){S(this,Jn).set(br(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...S(this,Jn).values()],n={};return t.forEach(r=>{el(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...S(this,Lt).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ns(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Ts&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...S(this,Lt).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){S(this,q).clear(),S(this,zt).clear()}},q=new WeakMap,zt=new WeakMap,Lt=new WeakMap,Zn=new WeakMap,Jn=new WeakMap,Dt=new WeakMap,bn=new WeakMap,er=new WeakMap,Ec),gg=O.createContext(void 0),wg=({client:e,children:t})=>(O.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),F.jsx(gg.Provider,{value:e,children:t}));const Sg=new vg;Oo.createRoot(document.getElementById("root")).render(F.jsx(An.StrictMode,{children:F.jsx(wg,{client:Sg,children:F.jsx(Ty,{children:F.jsx(Ry,{children:F.jsx(Vd,{path:"/",element:F.jsx(Xv,{})})})})})}));
 
80
  `).map((f,m)=>F.jsxs(An.Fragment,{children:[f,m<a.split(`
81
  `).length-1&&F.jsx("br",{})]},`${m}-after`));i.push(p)}return i.length>0?i:l.split(`
82
  `).map((p,f)=>F.jsxs(An.Fragment,{children:[p,f<l.split(`
83
+ `).length-1&&F.jsx("br",{})]},f))};return F.jsx("div",{className:`message ${e}`,children:n?F.jsx("span",{children:"..."}):F.jsx("div",{className:"message-content",children:r(t)})})},lv=({onSend:e,text:t,setText:n})=>{const r=l=>{l.key==="Enter"&&l.ctrlKey&&(l.preventDefault(),t.trim()&&e(t))};return F.jsx("div",{className:"input-wrapper",children:F.jsx("textarea",{value:t,onChange:l=>n(l.target.value),onKeyDown:r,placeholder:"Введите сообщение... (Ctrl+Enter для отправки)"})})};function re(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var iv=typeof Symbol=="function"&&Symbol.observable||"@@observable",Za=iv,Co=()=>Math.random().toString(36).substring(7).split("").join("."),ov={INIT:`@@redux/INIT${Co()}`,REPLACE:`@@redux/REPLACE${Co()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Co()}`},mi=ov;function Ps(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Xd(e,t,n){if(typeof e!="function")throw new Error(re(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(re(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(re(1));return n(Xd)(e,t)}let r=e,l=t,i=new Map,o=i,u=0,s=!1;function a(){o===i&&(o=new Map,i.forEach((E,d)=>{o.set(d,E)}))}function p(){if(s)throw new Error(re(3));return l}function f(E){if(typeof E!="function")throw new Error(re(4));if(s)throw new Error(re(5));let d=!0;a();const c=u++;return o.set(c,E),function(){if(d){if(s)throw new Error(re(6));d=!1,a(),o.delete(c),i=null}}}function m(E){if(!Ps(E))throw new Error(re(7));if(typeof E.type>"u")throw new Error(re(8));if(typeof E.type!="string")throw new Error(re(17));if(s)throw new Error(re(9));try{s=!0,l=r(l,E)}finally{s=!1}return(i=o).forEach(c=>{c()}),E}function w(E){if(typeof E!="function")throw new Error(re(10));r=E,m({type:mi.REPLACE})}function y(){const E=f;return{subscribe(d){if(typeof d!="object"||d===null)throw new Error(re(11));function c(){const v=d;v.next&&v.next(p())}return c(),{unsubscribe:E(c)}},[Za](){return this}}}return m({type:mi.INIT}),{dispatch:m,subscribe:f,getState:p,replaceReducer:w,[Za]:y}}function uv(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:mi.INIT})>"u")throw new Error(re(12));if(typeof n(void 0,{type:mi.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(re(13))})}function sv(e){const t=Object.keys(e),n={};for(let i=0;i<t.length;i++){const o=t[i];typeof e[o]=="function"&&(n[o]=e[o])}const r=Object.keys(n);let l;try{uv(n)}catch(i){l=i}return function(o={},u){if(l)throw l;let s=!1;const a={};for(let p=0;p<r.length;p++){const f=r[p],m=n[f],w=o[f],y=m(w,u);if(typeof y>"u")throw u&&u.type,new Error(re(14));a[f]=y,s=s||y!==w}return s=s||r.length!==Object.keys(o).length,s?a:o}}function yi(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function av(...e){return t=>(n,r)=>{const l=t(n,r);let i=()=>{throw new Error(re(15))};const o={getState:l.getState,dispatch:(s,...a)=>i(s,...a)},u=e.map(s=>s(o));return i=yi(...u)(l.dispatch),{...l,dispatch:i}}}function cv(e){return Ps(e)&&"type"in e&&typeof e.type=="string"}var Yd=Symbol.for("immer-nothing"),Ja=Symbol.for("immer-draftable"),Me=Symbol.for("immer-state");function Xe(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var sr=Object.getPrototypeOf;function Sn(e){return!!e&&!!e[Me]}function Et(e){var t;return e?Zd(e)||Array.isArray(e)||!!e[Ja]||!!((t=e.constructor)!=null&&t[Ja])||Bi(e)||Qi(e):!1}var fv=Object.prototype.constructor.toString();function Zd(e){if(!e||typeof e!="object")return!1;const t=sr(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===fv}function vi(e,t){$i(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function $i(e){const t=e[Me];return t?t.type_:Array.isArray(e)?1:Bi(e)?2:Qi(e)?3:0}function Cu(e,t){return $i(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Jd(e,t,n){const r=$i(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function dv(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Bi(e){return e instanceof Map}function Qi(e){return e instanceof Set}function rn(e){return e.copy_||e.base_}function _u(e,t){if(Bi(e))return new Map(e);if(Qi(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Zd(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Me];let l=Reflect.ownKeys(r);for(let i=0;i<l.length;i++){const o=l[i],u=r[o];u.writable===!1&&(u.writable=!0,u.configurable=!0),(u.get||u.set)&&(r[o]={configurable:!0,writable:!0,enumerable:u.enumerable,value:e[o]})}return Object.create(sr(e),r)}else{const r=sr(e);if(r!==null&&n)return{...e};const l=Object.create(r);return Object.assign(l,e)}}function Rs(e,t=!1){return Hi(e)||Sn(e)||!Et(e)||($i(e)>1&&(e.set=e.add=e.clear=e.delete=pv),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Rs(r,!0))),e}function pv(){Xe(2)}function Hi(e){return Object.isFrozen(e)}var hv={};function En(e){const t=hv[e];return t||Xe(0,e),t}var Zr;function bd(){return Zr}function mv(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function ba(e,t){t&&(En("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function xu(e){Pu(e),e.drafts_.forEach(yv),e.drafts_=null}function Pu(e){e===Zr&&(Zr=e.parent_)}function ec(e){return Zr=mv(Zr,e)}function yv(e){const t=e[Me];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function tc(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Me].modified_&&(xu(t),Xe(4)),Et(e)&&(e=gi(t,e),t.parent_||wi(t,e)),t.patches_&&En("Patches").generateReplacementPatches_(n[Me].base_,e,t.patches_,t.inversePatches_)):e=gi(t,n,[]),xu(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Yd?e:void 0}function gi(e,t,n){if(Hi(t))return t;const r=t[Me];if(!r)return vi(t,(l,i)=>nc(e,r,t,l,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return wi(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const l=r.copy_;let i=l,o=!1;r.type_===3&&(i=new Set(l),l.clear(),o=!0),vi(i,(u,s)=>nc(e,r,l,u,s,n,o)),wi(e,l,!1),n&&e.patches_&&En("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function nc(e,t,n,r,l,i,o){if(Sn(l)){const u=i&&t&&t.type_!==3&&!Cu(t.assigned_,r)?i.concat(r):void 0,s=gi(e,l,u);if(Jd(n,r,s),Sn(s))e.canAutoFreeze_=!1;else return}else o&&n.add(l);if(Et(l)&&!Hi(l)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;gi(e,l),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&wi(e,l)}}function wi(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Rs(t,n)}function vv(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:bd(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let l=r,i=Os;n&&(l=[r],i=Jr);const{revoke:o,proxy:u}=Proxy.revocable(l,i);return r.draft_=u,r.revoke_=o,u}var Os={get(e,t){if(t===Me)return e;const n=rn(e);if(!Cu(n,t))return gv(e,n,t);const r=n[t];return e.finalized_||!Et(r)?r:r===_o(e.base_,t)?(xo(e),e.copy_[t]=Ou(r,e)):r},has(e,t){return t in rn(e)},ownKeys(e){return Reflect.ownKeys(rn(e))},set(e,t,n){const r=ep(rn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const l=_o(rn(e),t),i=l==null?void 0:l[Me];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(dv(n,l)&&(n!==void 0||Cu(e.base_,t)))return!0;xo(e),Ru(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return _o(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,xo(e),Ru(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=rn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Xe(11)},getPrototypeOf(e){return sr(e.base_)},setPrototypeOf(){Xe(12)}},Jr={};vi(Os,(e,t)=>{Jr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Jr.deleteProperty=function(e,t){return Jr.set.call(this,e,t,void 0)};Jr.set=function(e,t,n){return Os.set.call(this,e[0],t,n,e[0])};function _o(e,t){const n=e[Me];return(n?rn(n):e)[t]}function gv(e,t,n){var l;const r=ep(t,n);return r?"value"in r?r.value:(l=r.get)==null?void 0:l.call(e.draft_):void 0}function ep(e,t){if(!(t in e))return;let n=sr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=sr(n)}}function Ru(e){e.modified_||(e.modified_=!0,e.parent_&&Ru(e.parent_))}function xo(e){e.copy_||(e.copy_=_u(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var wv=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const o=this;return function(s=i,...a){return o.produce(s,p=>n.call(this,p,...a))}}typeof n!="function"&&Xe(6),r!==void 0&&typeof r!="function"&&Xe(7);let l;if(Et(t)){const i=ec(this),o=Ou(t,void 0);let u=!0;try{l=n(o),u=!1}finally{u?xu(i):Pu(i)}return ba(i,r),tc(l,i)}else if(!t||typeof t!="object"){if(l=n(t),l===void 0&&(l=t),l===Yd&&(l=void 0),this.autoFreeze_&&Rs(l,!0),r){const i=[],o=[];En("Patches").generateReplacementPatches_(t,l,i,o),r(i,o)}return l}else Xe(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(o,...u)=>this.produceWithPatches(o,s=>t(s,...u));let r,l;return[this.produce(t,n,(o,u)=>{r=o,l=u}),r,l]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Et(e)||Xe(8),Sn(e)&&(e=Sv(e));const t=ec(this),n=Ou(e,void 0);return n[Me].isManual_=!0,Pu(t),n}finishDraft(e,t){const n=e&&e[Me];(!n||!n.isManual_)&&Xe(9);const{scope_:r}=n;return ba(r,t),tc(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const l=t[n];if(l.path.length===0&&l.op==="replace"){e=l.value;break}}n>-1&&(t=t.slice(n+1));const r=En("Patches").applyPatches_;return Sn(e)?r(e,t):this.produce(e,l=>r(l,t))}};function Ou(e,t){const n=Bi(e)?En("MapSet").proxyMap_(e,t):Qi(e)?En("MapSet").proxySet_(e,t):vv(e,t);return(t?t.scope_:bd()).drafts_.push(n),n}function Sv(e){return Sn(e)||Xe(10,e),tp(e)}function tp(e){if(!Et(e)||Hi(e))return e;const t=e[Me];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=_u(e,t.scope_.immer_.useStrictShallowCopy_)}else n=_u(e,!0);return vi(n,(r,l)=>{Jd(n,r,tp(l))}),t&&(t.finalized_=!1),n}var ze=new wv,np=ze.produce;ze.produceWithPatches.bind(ze);ze.setAutoFreeze.bind(ze);ze.setUseStrictShallowCopy.bind(ze);ze.applyPatches.bind(ze);ze.createDraft.bind(ze);ze.finishDraft.bind(ze);function rp(e){return({dispatch:n,getState:r})=>l=>i=>typeof i=="function"?i(n,r,e):l(i)}var Ev=rp(),kv=rp,Cv=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?yi:yi.apply(null,arguments)};function rc(e,t){function n(...r){if(t){let l=t(...r);if(!l)throw new Error(yt(0));return{type:e,payload:l.payload,..."meta"in l&&{meta:l.meta},..."error"in l&&{error:l.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>cv(r)&&r.type===e,n}var lp=class _r extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,_r.prototype)}static get[Symbol.species](){return _r}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new _r(...t[0].concat(this)):new _r(...t.concat(this))}};function lc(e){return Et(e)?np(e,()=>{}):e}function ic(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function _v(e){return typeof e=="boolean"}var xv=()=>function(t){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:l=!0,actionCreatorCheck:i=!0}=t??{};let o=new lp;return n&&(_v(n)?o.push(Ev):o.push(kv(n.extraArgument))),o},Pv="RTK_autoBatch",oc=e=>t=>{setTimeout(t,e)},Rv=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let l=!0,i=!1,o=!1;const u=new Set,s=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:oc(10):e.type==="callback"?e.queueNotification:oc(e.timeout),a=()=>{o=!1,i&&(i=!1,u.forEach(p=>p()))};return Object.assign({},r,{subscribe(p){const f=()=>l&&p(),m=r.subscribe(f);return u.add(p),()=>{m(),u.delete(p)}},dispatch(p){var f;try{return l=!((f=p==null?void 0:p.meta)!=null&&f[Pv]),i=!l,i&&(o||(o=!0,s(a))),r.dispatch(p)}finally{l=!0}}})},Ov=e=>function(n){const{autoBatch:r=!0}=n??{};let l=new lp(e);return r&&l.push(Rv(typeof r=="object"?r:void 0)),l};function Nv(e){const t=xv(),{reducer:n=void 0,middleware:r,devTools:l=!0,preloadedState:i=void 0,enhancers:o=void 0}=e||{};let u;if(typeof n=="function")u=n;else if(Ps(n))u=sv(n);else throw new Error(yt(1));let s;typeof r=="function"?s=r(t):s=t();let a=yi;l&&(a=Cv({trace:!1,...typeof l=="object"&&l}));const p=av(...s),f=Ov(p);let m=typeof o=="function"?o(f):f();const w=a(...m);return Xd(u,i,w)}function ip(e){const t={},n=[];let r;const l={addCase(i,o){const u=typeof i=="string"?i:i.type;if(!u)throw new Error(yt(28));if(u in t)throw new Error(yt(29));return t[u]=o,l},addMatcher(i,o){return n.push({matcher:i,reducer:o}),l},addDefaultCase(i){return r=i,l}};return e(l),[t,n,r]}function Tv(e){return typeof e=="function"}function Mv(e,t){let[n,r,l]=ip(t),i;if(Tv(e))i=()=>lc(e());else{const u=lc(e);i=()=>u}function o(u=i(),s){let a=[n[s.type],...r.filter(({matcher:p})=>p(s)).map(({reducer:p})=>p)];return a.filter(p=>!!p).length===0&&(a=[l]),a.reduce((p,f)=>{if(f)if(Sn(p)){const w=f(p,s);return w===void 0?p:w}else{if(Et(p))return np(p,m=>f(m,s));{const m=f(p,s);if(m===void 0){if(p===null)return p;throw Error("A case reducer on a non-draftable value must not return undefined")}return m}}return p},u)}return o.getInitialState=i,o}var zv=Symbol.for("rtk-slice-createasyncthunk");function Lv(e,t){return`${e}/${t}`}function Dv({creators:e}={}){var n;const t=(n=e==null?void 0:e.asyncThunk)==null?void 0:n[zv];return function(l){const{name:i,reducerPath:o=i}=l;if(!i)throw new Error(yt(11));const u=(typeof l.reducers=="function"?l.reducers(Iv()):l.reducers)||{},s=Object.keys(u),a={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},p={addCase(h,v){const k=typeof h=="string"?h:h.type;if(!k)throw new Error(yt(12));if(k in a.sliceCaseReducersByType)throw new Error(yt(13));return a.sliceCaseReducersByType[k]=v,p},addMatcher(h,v){return a.sliceMatchers.push({matcher:h,reducer:v}),p},exposeAction(h,v){return a.actionCreators[h]=v,p},exposeCaseReducer(h,v){return a.sliceCaseReducersByName[h]=v,p}};s.forEach(h=>{const v=u[h],k={reducerName:h,type:Lv(i,h),createNotation:typeof l.reducers=="function"};Uv(v)?Bv(k,v,p,t):Av(k,v,p)});function f(){const[h={},v=[],k=void 0]=typeof l.extraReducers=="function"?ip(l.extraReducers):[l.extraReducers],x={...h,...a.sliceCaseReducersByType};return Mv(l.initialState,P=>{for(let _ in x)P.addCase(_,x[_]);for(let _ of a.sliceMatchers)P.addMatcher(_.matcher,_.reducer);for(let _ of v)P.addMatcher(_.matcher,_.reducer);k&&P.addDefaultCase(k)})}const m=h=>h,w=new Map;let y;function g(h,v){return y||(y=f()),y(h,v)}function E(){return y||(y=f()),y.getInitialState()}function d(h,v=!1){function k(P){let _=P[h];return typeof _>"u"&&v&&(_=E()),_}function x(P=m){const _=ic(w,v,()=>new WeakMap);return ic(_,P,()=>{const M={};for(const[D,pe]of Object.entries(l.selectors??{}))M[D]=Fv(pe,P,E,v);return M})}return{reducerPath:h,getSelectors:x,get selectors(){return x(k)},selectSlice:k}}const c={name:i,reducer:g,actions:a.actionCreators,caseReducers:a.sliceCaseReducersByName,getInitialState:E,...d(o),injectInto(h,{reducerPath:v,...k}={}){const x=v??o;return h.inject({reducerPath:x,reducer:g},k),{...c,...d(x,!0)}}};return c}}function Fv(e,t,n,r){function l(i,...o){let u=t(i);return typeof u>"u"&&r&&(u=n()),e(u,...o)}return l.unwrapped=e,l}var jv=Dv();function Iv(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function Av({type:e,reducerName:t,createNotation:n},r,l){let i,o;if("reducer"in r){if(n&&!$v(r))throw new Error(yt(17));i=r.reducer,o=r.prepare}else i=r;l.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,o?rc(e,o):rc(e))}function Uv(e){return e._reducerDefinitionType==="asyncThunk"}function $v(e){return e._reducerDefinitionType==="reducerWithPrepare"}function Bv({type:e,reducerName:t},n,r,l){if(!l)throw new Error(yt(18));const{payloadCreator:i,fulfilled:o,pending:u,rejected:s,settled:a,options:p}=n,f=l(e,i,p);r.exposeAction(t,f),o&&r.addCase(f.fulfilled,o),u&&r.addCase(f.pending,u),s&&r.addCase(f.rejected,s),a&&r.addMatcher(f.settled,a),r.exposeCaseReducer(t,{fulfilled:o||Nl,pending:u||Nl,rejected:s||Nl,settled:a||Nl})}function Nl(){}function yt(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}const Qv=()=>{const e=localStorage.getItem("chatHistory");if(e)try{return JSON.parse(e)}catch(t){return console.error("Failed to parse chat history from localStorage:",t),[]}return[]},Hv={history:Qv()},op=jv({name:"chat",initialState:Hv,reducers:{addMessage:(e,t)=>{e.history.push(t.payload),localStorage.setItem("chatHistory",JSON.stringify(e.history))},clearHistory:e=>{e.history=[],localStorage.setItem("chatHistory",JSON.stringify([]))},setHistory:(e,t)=>{e.history=t.payload,localStorage.setItem("chatHistory",JSON.stringify(e.history))}}}),{addMessage:Vv,clearHistory:Wv,setHistory:Po}=op.actions,Kv=op.reducer,Gv=()=>{const[e,t]=O.useState(""),[n,r]=O.useState(null),[l,i]=O.useState(!1),[o,u]=O.useState(!1),s=nv(y=>y.chat.history),a=by(),p=O.useRef(null),f=()=>{const y=document.querySelector(".messages");if(y){const g=y.getBoundingClientRect(),E=window.innerHeight;return g.bottom<=E+10}return!0},m=()=>{p.current&&(p.current.abort(),i(!1),console.log("Generation stopped by user"))},w=async y=>{var d;if(!y.trim()||l)return;const g={role:"user",content:y,searchResults:[]};a(Vv(g)),t(""),i(!0),u(!1),console.log("Start request - isLoading:",l,"hasAssistantStarted:",o);const E="https://muryshev-generic-chatbot-backend.hf.space/llm/chat/stream";try{const c=new AbortController;p.current=c;const h=setTimeout(()=>{c.abort(),r("Сервер временно недоступен")},6e4),v=await fetch(E,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({history:[...s,g]}),signal:c.signal});if(clearTimeout(h),!v.ok)throw new Error(`HTTP error! status: ${v.status}`);const k=(d=v.body)==null?void 0:d.getReader();if(!k)throw new Error("Response body is not readable");const x=new TextDecoder;let P="",_="",M=[...s,g];for(;;){const{done:D,value:pe}=await k.read();if(D)break;P+=x.decode(pe,{stream:!0});const be=P.split(`
84
 
85
  `);for(let st=0;st<be.length-1;st++){const Jt=be[st].trim();if(Jt.startsWith("data: ")){const _n=Jt.slice(6);console.log("Received SSE event:",_n);try{const Pe=JSON.parse(_n);if(Pe.event==="done"){a(Po(M)),i(!1),console.log("Done - isLoading:",l,"hasAssistantStarted:",o);break}else if(Pe.event==="error"){r(Pe.data),i(!1),console.log("Error - isLoading:",l,"hasAssistantStarted:",o);break}else if(Pe.event==="search_results")M=M.map((R,T)=>T===M.length-1&&R.role==="user"?{...R,content:R.content+Pe.data}:R),a(Po(M)),console.log("After search_results - isLoading:",l,"hasAssistantStarted:",o);else if(Pe.event==="token"){o||(u(!0),console.log("Before first token - isLoading:",l,"hasAssistantStarted:",o)),_+=Pe.data;const R=M.findLastIndex(z=>z.role==="user"),T=M.findIndex((z,B)=>z.role==="assistant"&&B>R);T>=0?M=M.map((z,B)=>B===T?{...z,content:_}:z):M=[...M,{role:"assistant",content:_,searchResults:[]}],a(Po(M))}}catch(Pe){console.error("Failed to parse SSE data:",Pe),r("Ошибка обработки данных от сервера")}}}P=be[be.length-1];const Ct=document.querySelector(".messages");if(Ct){const st=Ct.querySelectorAll("div"),Jt=st[st.length-1];Jt&&f()&&setTimeout(()=>{Jt.scrollIntoView({behavior:"smooth",block:"start"}),console.log("Autoscroll triggered, isAtBottom:",f())},0)}}}catch(c){console.error("Stream error:",c),i(!1),console.log("Catch - isLoading:",l,"hasAssistantStarted:",o),c instanceof DOMException&&c.name==="AbortError"&&!p.current?r("Сервер временно недоступен"):c instanceof DOMException&&c.name==="AbortError"||r("Произошла ошибка при запросе")}finally{p.current=null}};return O.useEffect(()=>{if(console.log("State update - isLoading:",l,"hasAssistantStarted:",o),n){const y=setTimeout(()=>r(null),5e3);return()=>clearTimeout(y)}},[l,o,n]),F.jsxs("div",{className:"chat",children:[n&&F.jsx("div",{className:"error-toast",children:n}),F.jsxs("div",{className:"messages",children:[s.map((y,g)=>F.jsx("div",{children:F.jsx(Ya,{role:y.role,content:y.content})},g)),l&&!o&&F.jsx("div",{children:F.jsx(Ya,{role:"assistant",content:"",isLoading:!0})})]}),F.jsxs("div",{className:"input-area",children:[F.jsx(lv,{onSend:w,text:e,setText:t}),F.jsxs("div",{className:"buttons",children:[l?F.jsx("button",{className:"stop-button",onClick:m,children:"Остановить"}):F.jsx("button",{className:"send-button",onClick:()=>w(e),children:"Отправить"}),F.jsx("a",{href:"#",className:"clear-link",onClick:y=>{y.preventDefault(),a(Wv())},children:"Очистить"})]})]})]})},qv=Nv({reducer:{chat:Kv}}),Xv=()=>F.jsx(Yy,{store:qv,children:F.jsx(Gv,{})});var Vi=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Wi=typeof window>"u"||"Deno"in globalThis;function Ve(){}function Yv(e,t){return typeof e=="function"?e(t):e}function Zv(e){return typeof e=="number"&&e>=0&&e!==1/0}function Jv(e,t){return Math.max(e+(t||0)-Date.now(),0)}function uc(e,t){return typeof e=="function"?e(t):e}function bv(e,t){return typeof e=="function"?e(t):e}function sc(e,t){const{type:n="all",exact:r,fetchStatus:l,predicate:i,queryKey:o,stale:u}=e;if(o){if(r){if(t.queryHash!==Ns(o,t.options))return!1}else if(!el(t.queryKey,o))return!1}if(n!=="all"){const s=t.isActive();if(n==="active"&&!s||n==="inactive"&&s)return!1}return!(typeof u=="boolean"&&t.isStale()!==u||l&&l!==t.state.fetchStatus||i&&!i(t))}function ac(e,t){const{exact:n,status:r,predicate:l,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(br(t.options.mutationKey)!==br(i))return!1}else if(!el(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||l&&!l(t))}function Ns(e,t){return((t==null?void 0:t.queryKeyHashFn)||br)(e)}function br(e){return JSON.stringify(e,(t,n)=>Nu(n)?Object.keys(n).sort().reduce((r,l)=>(r[l]=n[l],r),{}):n)}function el(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!el(e[n],t[n])):!1}function up(e,t){if(e===t)return e;const n=cc(e)&&cc(t);if(n||Nu(e)&&Nu(t)){const r=n?e:Object.keys(e),l=r.length,i=n?t:Object.keys(t),o=i.length,u=n?[]:{};let s=0;for(let a=0;a<o;a++){const p=n?a:i[a];(!n&&r.includes(p)||n)&&e[p]===void 0&&t[p]===void 0?(u[p]=void 0,s++):(u[p]=up(e[p],t[p]),u[p]===e[p]&&e[p]!==void 0&&s++)}return l===o&&s===l?e:u}return t}function cc(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Nu(e){if(!fc(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!fc(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function fc(e){return Object.prototype.toString.call(e)==="[object Object]"}function eg(e){return new Promise(t=>{setTimeout(t,e)})}function tg(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?up(e,t):t}function ng(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function rg(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Ts=Symbol();function sp(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Ts?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var sn,Tt,Kn,hc,lg=(hc=class extends Vi{constructor(){super();A(this,sn);A(this,Tt);A(this,Kn);L(this,Kn,t=>{if(!Wi&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){S(this,Tt)||this.setEventListener(S(this,Kn))}onUnsubscribe(){var t;this.hasListeners()||((t=S(this,Tt))==null||t.call(this),L(this,Tt,void 0))}setEventListener(t){var n;L(this,Kn,t),(n=S(this,Tt))==null||n.call(this),L(this,Tt,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){S(this,sn)!==t&&(L(this,sn,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof S(this,sn)=="boolean"?S(this,sn):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},sn=new WeakMap,Tt=new WeakMap,Kn=new WeakMap,hc),ap=new lg,Gn,Mt,qn,mc,ig=(mc=class extends Vi{constructor(){super();A(this,Gn,!0);A(this,Mt);A(this,qn);L(this,qn,t=>{if(!Wi&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){S(this,Mt)||this.setEventListener(S(this,qn))}onUnsubscribe(){var t;this.hasListeners()||((t=S(this,Mt))==null||t.call(this),L(this,Mt,void 0))}setEventListener(t){var n;L(this,qn,t),(n=S(this,Mt))==null||n.call(this),L(this,Mt,t(this.setOnline.bind(this)))}setOnline(t){S(this,Gn)!==t&&(L(this,Gn,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return S(this,Gn)}},Gn=new WeakMap,Mt=new WeakMap,qn=new WeakMap,mc),Si=new ig;function og(){let e,t;const n=new Promise((l,i)=>{e=l,t=i});n.status="pending",n.catch(()=>{});function r(l){Object.assign(n,l),delete n.resolve,delete n.reject}return n.resolve=l=>{r({status:"fulfilled",value:l}),e(l)},n.reject=l=>{r({status:"rejected",reason:l}),t(l)},n}function ug(e){return Math.min(1e3*2**e,3e4)}function cp(e){return(e??"online")==="online"?Si.isOnline():!0}var fp=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Ro(e){return e instanceof fp}function dp(e){let t=!1,n=0,r=!1,l;const i=og(),o=g=>{var E;r||(m(new fp(g)),(E=e.abort)==null||E.call(e))},u=()=>{t=!0},s=()=>{t=!1},a=()=>ap.isFocused()&&(e.networkMode==="always"||Si.isOnline())&&e.canRun(),p=()=>cp(e.networkMode)&&e.canRun(),f=g=>{var E;r||(r=!0,(E=e.onSuccess)==null||E.call(e,g),l==null||l(),i.resolve(g))},m=g=>{var E;r||(r=!0,(E=e.onError)==null||E.call(e,g),l==null||l(),i.reject(g))},w=()=>new Promise(g=>{var E;l=d=>{(r||a())&&g(d)},(E=e.onPause)==null||E.call(e)}).then(()=>{var g;l=void 0,r||(g=e.onContinue)==null||g.call(e)}),y=()=>{if(r)return;let g;const E=n===0?e.initialPromise:void 0;try{g=E??e.fn()}catch(d){g=Promise.reject(d)}Promise.resolve(g).then(f).catch(d=>{var x;if(r)return;const c=e.retry??(Wi?0:3),h=e.retryDelay??ug,v=typeof h=="function"?h(n,d):h,k=c===!0||typeof c=="number"&&n<c||typeof c=="function"&&c(n,d);if(t||!k){m(d);return}n++,(x=e.onFail)==null||x.call(e,n,d),eg(v).then(()=>a()?void 0:w()).then(()=>{t?m(d):y()})})};return{promise:i,cancel:o,continue:()=>(l==null||l(),i),cancelRetry:u,continueRetry:s,canStart:p,start:()=>(p()?y():w().then(y),i)}}function sg(){let e=[],t=0,n=u=>{u()},r=u=>{u()},l=u=>setTimeout(u,0);const i=u=>{t?e.push(u):l(()=>{n(u)})},o=()=>{const u=e;e=[],u.length&&l(()=>{r(()=>{u.forEach(s=>{n(s)})})})};return{batch:u=>{let s;t++;try{s=u()}finally{t--,t||o()}return s},batchCalls:u=>(...s)=>{i(()=>{u(...s)})},schedule:i,setNotifyFunction:u=>{n=u},setBatchNotifyFunction:u=>{r=u},setScheduler:u=>{l=u}}}var ye=sg(),an,yc,pp=(yc=class{constructor(){A(this,an)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Zv(this.gcTime)&&L(this,an,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Wi?1/0:5*60*1e3))}clearGcTimeout(){S(this,an)&&(clearTimeout(S(this,an)),L(this,an,void 0))}},an=new WeakMap,yc),Xn,Yn,Fe,cn,ce,tl,fn,We,at,vc,ag=(vc=class extends pp{constructor(t){super();A(this,We);A(this,Xn);A(this,Yn);A(this,Fe);A(this,cn);A(this,ce);A(this,tl);A(this,fn);L(this,fn,!1),L(this,tl,t.defaultOptions),this.setOptions(t.options),this.observers=[],L(this,cn,t.client),L(this,Fe,S(this,cn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,L(this,Xn,fg(this.options)),this.state=t.state??S(this,Xn),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=S(this,ce))==null?void 0:t.promise}setOptions(t){this.options={...S(this,tl),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&S(this,Fe).remove(this)}setData(t,n){const r=tg(this.state.data,t,this.options);return ue(this,We,at).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){ue(this,We,at).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,l;const n=(r=S(this,ce))==null?void 0:r.promise;return(l=S(this,ce))==null||l.cancel(t),n?n.then(Ve).catch(Ve):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(S(this,Xn))}isActive(){return this.observers.some(t=>bv(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ts||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!Jv(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=S(this,ce))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=S(this,ce))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),S(this,Fe).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(S(this,ce)&&(S(this,fn)?S(this,ce).cancel({revert:!0}):S(this,ce).cancelRetry()),this.scheduleGc()),S(this,Fe).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ue(this,We,at).call(this,{type:"invalidate"})}fetch(t,n){var s,a,p;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(S(this,ce))return S(this,ce).continueRetry(),S(this,ce).promise}if(t&&this.setOptions(t),!this.options.queryFn){const f=this.observers.find(m=>m.options.queryFn);f&&this.setOptions(f.options)}const r=new AbortController,l=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(L(this,fn,!0),r.signal)})},i=()=>{const f=sp(this.options,n),m={client:S(this,cn),queryKey:this.queryKey,meta:this.meta};return l(m),L(this,fn,!1),this.options.persister?this.options.persister(f,m,this):f(m)},o={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:S(this,cn),state:this.state,fetchFn:i};l(o),(s=this.options.behavior)==null||s.onFetch(o,this),L(this,Yn,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((a=o.fetchOptions)==null?void 0:a.meta))&&ue(this,We,at).call(this,{type:"fetch",meta:(p=o.fetchOptions)==null?void 0:p.meta});const u=f=>{var m,w,y,g;Ro(f)&&f.silent||ue(this,We,at).call(this,{type:"error",error:f}),Ro(f)||((w=(m=S(this,Fe).config).onError)==null||w.call(m,f,this),(g=(y=S(this,Fe).config).onSettled)==null||g.call(y,this.state.data,f,this)),this.scheduleGc()};return L(this,ce,dp({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var m,w,y,g;if(f===void 0){u(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(E){u(E);return}(w=(m=S(this,Fe).config).onSuccess)==null||w.call(m,f,this),(g=(y=S(this,Fe).config).onSettled)==null||g.call(y,f,this.state.error,this),this.scheduleGc()},onError:u,onFail:(f,m)=>{ue(this,We,at).call(this,{type:"failed",failureCount:f,error:m})},onPause:()=>{ue(this,We,at).call(this,{type:"pause"})},onContinue:()=>{ue(this,We,at).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),S(this,ce).start()}},Xn=new WeakMap,Yn=new WeakMap,Fe=new WeakMap,cn=new WeakMap,ce=new WeakMap,tl=new WeakMap,fn=new WeakMap,We=new WeakSet,at=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...cg(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const l=t.error;return Ro(l)&&l.revert&&S(this,Yn)?{...S(this,Yn),fetchStatus:"idle"}:{...r,error:l,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:l,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),ye.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),S(this,Fe).notify({query:this,type:"updated",action:t})})},vc);function cg(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:cp(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function fg(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var nt,gc,dg=(gc=class extends Vi{constructor(t={}){super();A(this,nt);this.config=t,L(this,nt,new Map)}build(t,n,r){const l=n.queryKey,i=n.queryHash??Ns(l,n);let o=this.get(i);return o||(o=new ag({client:t,queryKey:l,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(l)}),this.add(o)),o}add(t){S(this,nt).has(t.queryHash)||(S(this,nt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=S(this,nt).get(t.queryHash);n&&(t.destroy(),n===t&&S(this,nt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ye.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return S(this,nt).get(t)}getAll(){return[...S(this,nt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>sc(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>sc(t,r)):n}notify(t){ye.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){ye.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ye.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},nt=new WeakMap,gc),rt,he,dn,lt,xt,wc,pg=(wc=class extends pp{constructor(t){super();A(this,lt);A(this,rt);A(this,he);A(this,dn);this.mutationId=t.mutationId,L(this,he,t.mutationCache),L(this,rt,[]),this.state=t.state||hg(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){S(this,rt).includes(t)||(S(this,rt).push(t),this.clearGcTimeout(),S(this,he).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){L(this,rt,S(this,rt).filter(n=>n!==t)),this.scheduleGc(),S(this,he).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){S(this,rt).length||(this.state.status==="pending"?this.scheduleGc():S(this,he).remove(this))}continue(){var t;return((t=S(this,dn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var l,i,o,u,s,a,p,f,m,w,y,g,E,d,c,h,v,k,x,P;L(this,dn,dp({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(_,M)=>{ue(this,lt,xt).call(this,{type:"failed",failureCount:_,error:M})},onPause:()=>{ue(this,lt,xt).call(this,{type:"pause"})},onContinue:()=>{ue(this,lt,xt).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>S(this,he).canRun(this)}));const n=this.state.status==="pending",r=!S(this,dn).canStart();try{if(!n){ue(this,lt,xt).call(this,{type:"pending",variables:t,isPaused:r}),await((i=(l=S(this,he).config).onMutate)==null?void 0:i.call(l,t,this));const M=await((u=(o=this.options).onMutate)==null?void 0:u.call(o,t));M!==this.state.context&&ue(this,lt,xt).call(this,{type:"pending",context:M,variables:t,isPaused:r})}const _=await S(this,dn).start();return await((a=(s=S(this,he).config).onSuccess)==null?void 0:a.call(s,_,t,this.state.context,this)),await((f=(p=this.options).onSuccess)==null?void 0:f.call(p,_,t,this.state.context)),await((w=(m=S(this,he).config).onSettled)==null?void 0:w.call(m,_,null,this.state.variables,this.state.context,this)),await((g=(y=this.options).onSettled)==null?void 0:g.call(y,_,null,t,this.state.context)),ue(this,lt,xt).call(this,{type:"success",data:_}),_}catch(_){try{throw await((d=(E=S(this,he).config).onError)==null?void 0:d.call(E,_,t,this.state.context,this)),await((h=(c=this.options).onError)==null?void 0:h.call(c,_,t,this.state.context)),await((k=(v=S(this,he).config).onSettled)==null?void 0:k.call(v,void 0,_,this.state.variables,this.state.context,this)),await((P=(x=this.options).onSettled)==null?void 0:P.call(x,void 0,_,t,this.state.context)),_}finally{ue(this,lt,xt).call(this,{type:"error",error:_})}}finally{S(this,he).runNext(this)}}},rt=new WeakMap,he=new WeakMap,dn=new WeakMap,lt=new WeakSet,xt=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),ye.batch(()=>{S(this,rt).forEach(r=>{r.onMutationUpdate(t)}),S(this,he).notify({mutation:this,type:"updated",action:t})})},wc);function hg(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var dt,Ke,nl,Sc,mg=(Sc=class extends Vi{constructor(t={}){super();A(this,dt);A(this,Ke);A(this,nl);this.config=t,L(this,dt,new Set),L(this,Ke,new Map),L(this,nl,0)}build(t,n,r){const l=new pg({mutationCache:this,mutationId:++fl(this,nl)._,options:t.defaultMutationOptions(n),state:r});return this.add(l),l}add(t){S(this,dt).add(t);const n=Tl(t);if(typeof n=="string"){const r=S(this,Ke).get(n);r?r.push(t):S(this,Ke).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(S(this,dt).delete(t)){const n=Tl(t);if(typeof n=="string"){const r=S(this,Ke).get(n);if(r)if(r.length>1){const l=r.indexOf(t);l!==-1&&r.splice(l,1)}else r[0]===t&&S(this,Ke).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Tl(t);if(typeof n=="string"){const r=S(this,Ke).get(n),l=r==null?void 0:r.find(i=>i.state.status==="pending");return!l||l===t}else return!0}runNext(t){var r;const n=Tl(t);if(typeof n=="string"){const l=(r=S(this,Ke).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(l==null?void 0:l.continue())??Promise.resolve()}else return Promise.resolve()}clear(){ye.batch(()=>{S(this,dt).forEach(t=>{this.notify({type:"removed",mutation:t})}),S(this,dt).clear(),S(this,Ke).clear()})}getAll(){return Array.from(S(this,dt))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>ac(n,r))}findAll(t={}){return this.getAll().filter(n=>ac(t,n))}notify(t){ye.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return ye.batch(()=>Promise.all(t.map(n=>n.continue().catch(Ve))))}},dt=new WeakMap,Ke=new WeakMap,nl=new WeakMap,Sc);function Tl(e){var t;return(t=e.options.scope)==null?void 0:t.id}function dc(e){return{onFetch:(t,n)=>{var p,f,m,w,y;const r=t.options,l=(m=(f=(p=t.fetchOptions)==null?void 0:p.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,i=((w=t.state.data)==null?void 0:w.pages)||[],o=((y=t.state.data)==null?void 0:y.pageParams)||[];let u={pages:[],pageParams:[]},s=0;const a=async()=>{let g=!1;const E=h=>{Object.defineProperty(h,"signal",{enumerable:!0,get:()=>(t.signal.aborted?g=!0:t.signal.addEventListener("abort",()=>{g=!0}),t.signal)})},d=sp(t.options,t.fetchOptions),c=async(h,v,k)=>{if(g)return Promise.reject();if(v==null&&h.pages.length)return Promise.resolve(h);const x={client:t.client,queryKey:t.queryKey,pageParam:v,direction:k?"backward":"forward",meta:t.options.meta};E(x);const P=await d(x),{maxPages:_}=t.options,M=k?rg:ng;return{pages:M(h.pages,P,_),pageParams:M(h.pageParams,v,_)}};if(l&&i.length){const h=l==="backward",v=h?yg:pc,k={pages:i,pageParams:o},x=v(r,k);u=await c(k,x,h)}else{const h=e??i.length;do{const v=s===0?o[0]??r.initialPageParam:pc(r,u);if(s>0&&v==null)break;u=await c(u,v),s++}while(s<h)}return u};t.options.persister?t.fetchFn=()=>{var g,E;return(E=(g=t.options).persister)==null?void 0:E.call(g,a,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=a}}}function pc(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function yg(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var q,zt,Lt,Zn,Jn,Dt,bn,er,Ec,vg=(Ec=class{constructor(e={}){A(this,q);A(this,zt);A(this,Lt);A(this,Zn);A(this,Jn);A(this,Dt);A(this,bn);A(this,er);L(this,q,e.queryCache||new dg),L(this,zt,e.mutationCache||new mg),L(this,Lt,e.defaultOptions||{}),L(this,Zn,new Map),L(this,Jn,new Map),L(this,Dt,0)}mount(){fl(this,Dt)._++,S(this,Dt)===1&&(L(this,bn,ap.subscribe(async e=>{e&&(await this.resumePausedMutations(),S(this,q).onFocus())})),L(this,er,Si.subscribe(async e=>{e&&(await this.resumePausedMutations(),S(this,q).onOnline())})))}unmount(){var e,t;fl(this,Dt)._--,S(this,Dt)===0&&((e=S(this,bn))==null||e.call(this),L(this,bn,void 0),(t=S(this,er))==null||t.call(this),L(this,er,void 0))}isFetching(e){return S(this,q).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return S(this,zt).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=S(this,q).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=S(this,q).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(uc(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return S(this,q).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),l=S(this,q).get(r.queryHash),i=l==null?void 0:l.state.data,o=Yv(t,i);if(o!==void 0)return S(this,q).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return ye.batch(()=>S(this,q).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=S(this,q).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=S(this,q);ye.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=S(this,q);return ye.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=ye.batch(()=>S(this,q).findAll(e).map(l=>l.cancel(n)));return Promise.all(r).then(Ve).catch(Ve)}invalidateQueries(e,t={}){return ye.batch(()=>(S(this,q).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=ye.batch(()=>S(this,q).findAll(e).filter(l=>!l.isDisabled()).map(l=>{let i=l.fetch(void 0,n);return n.throwOnError||(i=i.catch(Ve)),l.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Ve)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=S(this,q).build(this,t);return n.isStaleByTime(uc(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ve).catch(Ve)}fetchInfiniteQuery(e){return e.behavior=dc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ve).catch(Ve)}ensureInfiniteQueryData(e){return e.behavior=dc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Si.isOnline()?S(this,zt).resumePausedMutations():Promise.resolve()}getQueryCache(){return S(this,q)}getMutationCache(){return S(this,zt)}getDefaultOptions(){return S(this,Lt)}setDefaultOptions(e){L(this,Lt,e)}setQueryDefaults(e,t){S(this,Zn).set(br(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...S(this,Zn).values()],n={};return t.forEach(r=>{el(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){S(this,Jn).set(br(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...S(this,Jn).values()],n={};return t.forEach(r=>{el(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...S(this,Lt).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ns(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Ts&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...S(this,Lt).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){S(this,q).clear(),S(this,zt).clear()}},q=new WeakMap,zt=new WeakMap,Lt=new WeakMap,Zn=new WeakMap,Jn=new WeakMap,Dt=new WeakMap,bn=new WeakMap,er=new WeakMap,Ec),gg=O.createContext(void 0),wg=({client:e,children:t})=>(O.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),F.jsx(gg.Provider,{value:e,children:t}));const Sg=new vg;Oo.createRoot(document.getElementById("root")).render(F.jsx(An.StrictMode,{children:F.jsx(wg,{client:Sg,children:F.jsx(Ty,{children:F.jsx(Ry,{children:F.jsx(Vd,{path:"/",element:F.jsx(Xv,{})})})})})}));
dist/index.html CHANGED
@@ -4,7 +4,7 @@
4
  <meta charset="UTF-8" />
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
  <title>Чат бот</title>
7
- <script type="module" crossorigin src="/assets/index-L6yZN20c.js"></script>
8
  <link rel="stylesheet" crossorigin href="/assets/index-CkRcohXN.css">
9
  </head>
10
  <body>
 
4
  <meta charset="UTF-8" />
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
  <title>Чат бот</title>
7
+ <script type="module" crossorigin src="/assets/index-DOrHED0Y.js"></script>
8
  <link rel="stylesheet" crossorigin href="/assets/index-CkRcohXN.css">
9
  </head>
10
  <body>