libre-webui 0.14.0 → 0.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/backend/dist/services/pluginService.d.ts +1 -2
- package/backend/dist/services/pluginService.d.ts.map +1 -1
- package/backend/dist/services/pluginService.js +31 -52
- package/backend/dist/services/pluginService.js.map +1 -1
- package/backend/dist/utils/pluginChatAdapter.d.ts.map +1 -1
- package/backend/dist/utils/pluginChatAdapter.js +23 -2
- package/backend/dist/utils/pluginChatAdapter.js.map +1 -1
- package/backend/dist/utils/pluginStreamAdapter.d.ts +1 -0
- package/backend/dist/utils/pluginStreamAdapter.d.ts.map +1 -1
- package/backend/dist/utils/pluginStreamAdapter.js +119 -0
- package/backend/dist/utils/pluginStreamAdapter.js.map +1 -1
- package/backend/dist/utils/pluginValidation.d.ts +2 -0
- package/backend/dist/utils/pluginValidation.d.ts.map +1 -1
- package/backend/dist/utils/pluginValidation.js +39 -0
- package/backend/dist/utils/pluginValidation.js.map +1 -1
- package/backend/package.json +1 -1
- package/frontend/dist/assets/{index-Cp8PdlFo.js → index-CDvTfv-t.js} +3 -3
- package/frontend/dist/index.html +2 -2
- package/frontend/dist/js/{ArtifactContainer-Blx2e3aj.js → ArtifactContainer-RPQq1DRo.js} +1 -1
- package/frontend/dist/js/{ArtifactDemoPage-ChIM17kG.js → ArtifactDemoPage-Dd0Rbl3N.js} +1 -1
- package/frontend/dist/js/{ArtifactSlideOutPanel-BypEW58A.js → ArtifactSlideOutPanel-oA5Iy8Nc.js} +1 -1
- package/frontend/dist/js/{ChatPage-gNqQdhRe.js → ChatPage-DdLe5r1n.js} +1 -1
- package/frontend/dist/js/{FirstTimeSetup-DS5-kf4m.js → FirstTimeSetup-DL_WZABT.js} +1 -1
- package/frontend/dist/js/{GalleryPage-vdXO-QSc.js → GalleryPage-BTA5LAmZ.js} +1 -1
- package/frontend/dist/js/{LibreClawPage-CA7LgGj7.js → LibreClawPage-CuQ8tJUW.js} +1 -1
- package/frontend/dist/js/{ModelsPage-Bxig1vZN.js → ModelsPage-BVfl9FU_.js} +1 -1
- package/frontend/dist/js/{PersonasPage-BMm3MuVw.js → PersonasPage-wP36Pd7I.js} +1 -1
- package/frontend/dist/js/{RichMessageContent-COEmecOd.js → RichMessageContent-CdgQHk6Q.js} +1 -1
- package/frontend/dist/js/{SettingsModal-DvFcpdVU.js → SettingsModal-CLdxDdQV.js} +1 -1
- package/frontend/dist/js/{UserManagementPage-C6ZvMO_V.js → UserManagementPage-BwnBtNj1.js} +1 -1
- package/frontend/dist/js/{api-BNnUZaFX.js → api-BRz6cQiD.js} +2 -2
- package/frontend/dist/js/{useBaseQuery-EKJwyGqK.js → useBaseQuery-C8AWX-Cq.js} +1 -1
- package/frontend/dist/js/useQuery-CbYbdhch.js +1 -0
- package/package.json +8 -5
- package/plugins/anthropic.json +6 -24
- package/plugins/kimi-code.json +73 -0
- package/frontend/dist/js/useQuery-CCuhLVjf.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/api-
|
|
2
|
-
import{n as e,r as t}from"../js/rolldown-runtime-QTnfLwEv.js";import{d as n,f as r}from"../js/markdown-core-fkbHPd-g.js";import{n as i,t as a}from"../js/react-vendor-Co1u1rWb.js";import{r as o,t as s}from"../js/logger-BmpKNkls.js";import{r as c,t as l}from"../js/useTranslation-CP6Cg-EI.js";import{At as u,B as d,Bt as f,D as p,Ft as m,H as h,L as g,M as _,Mt as v,Nt as y,Ot as b,P as x,R as S,Rt as ee,St as C,T as w,Vt as T,Z as te,at as ne,c as re,ct as E,g as ie,gt as ae,ht as oe,it as se,n as ce,o as le,ot as ue,p as de,s as fe,u as pe,ut as me,v as he,vt as ge,yt as _e,zt as ve}from"../js/ui-vendor-njo77ljx.js";import{a as ye,o as be,t as xe}from"../js/utils-vendor-BX3ZwoIK.js";import{n as Se,t as Ce}from"../js/demoMode-BhEpMVh5.js";import{_ as we,b as Te,c as Ee,d as De,o as Oe,s as D,v as ke,y as Ae}from"../js/api-BNnUZaFX.js";import{a as je,n as Me,r as Ne,t as O}from"../js/utils-D0l9J3P-.js";import{t as k}from"../js/Button-BZBnLKRn.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function Pe(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function A(e,t,n){Pe(e,t),t.set(e,n)}function j(e,t,n){if(typeof e==`function`?e===t:e.has(t))return arguments.length<3?t:n;throw TypeError(`Private element is not present on this object`)}function M(e,t){return e.get(j(e,t))}function N(e,t,n){return e.set(j(e,t),n),n}var Fe,Ie,Le={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Re=new(Fe=new WeakMap,Ie=new WeakMap,class{constructor(){A(this,Fe,Le),A(this,Ie,!1)}setTimeoutProvider(e){N(Fe,this,e)}setTimeout(e,t){return M(Fe,this).setTimeout(e,t)}clearTimeout(e){M(Fe,this).clearTimeout(e)}setInterval(e,t){return M(Fe,this).setInterval(e,t)}clearInterval(e){M(Fe,this).clearInterval(e)}});function ze(e){setTimeout(e,0)}var Be=typeof window>`u`||`Deno`in globalThis;function P(){}function Ve(e,t){return typeof e==`function`?e(t):e}function He(e){return typeof e==`number`&&e>=0&&e!==1/0}function Ue(e,t){return Math.max(e+(t||0)-Date.now(),0)}function We(e,t){return typeof e==`function`?e(t):e}function Ge(e,t){return typeof e==`function`?e(t):e}function Ke(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Je(o,t.options))return!1}else if(!Xe(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function qe(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Ye(t.options.mutationKey)!==Ye(a))return!1}else if(!Xe(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Je(e,t){return(t?.queryKeyHashFn||Ye)(e)}function Ye(e){return JSON.stringify(e,(e,t)=>tt(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Xe(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>Xe(e[n],t[n])):!1}var Ze=Object.prototype.hasOwnProperty;function Qe(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=et(e)&&et(t);if(!r&&!(tt(e)&&tt(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:Ze.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Qe(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function $e(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function et(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function tt(e){if(!nt(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!nt(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function nt(e){return Object.prototype.toString.call(e)===`[object Object]`}function rt(e){return new Promise(t=>{Re.setTimeout(t,e)})}function it(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Qe(e,t)}function at(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ot(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var st=Symbol();function ct(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===st?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function lt(e,t){return typeof e==`function`?e(...t):!!e}function ut(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??(i=t()),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var dt=(()=>{let e=()=>Be;return{isServer(){return e()},setIsServer(t){e=t}}})(),ft=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(){}},pt,mt,ht,gt=new(pt=new WeakMap,mt=new WeakMap,ht=new WeakMap,class extends ft{constructor(){super(),A(this,pt,void 0),A(this,mt,void 0),A(this,ht,void 0),N(ht,this,e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}})}onSubscribe(){M(mt,this)||this.setEventListener(M(ht,this))}onUnsubscribe(){this.hasListeners()||(M(mt,this)?.call(this),N(mt,this,void 0))}setEventListener(e){N(ht,this,e),M(mt,this)?.call(this),N(mt,this,e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()}))}setFocused(e){M(pt,this)!==e&&(N(pt,this,e),this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof M(pt,this)==`boolean`?M(pt,this):globalThis.document?.visibilityState!==`hidden`}}),_t=ze;function vt(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=_t,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var F=vt(),yt,bt,xt,St=new(yt=new WeakMap,bt=new WeakMap,xt=new WeakMap,class extends ft{constructor(){super(),A(this,yt,!0),A(this,bt,void 0),A(this,xt,void 0),N(xt,this,e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}})}onSubscribe(){M(bt,this)||this.setEventListener(M(xt,this))}onUnsubscribe(){this.hasListeners()||(M(bt,this)?.call(this),N(bt,this,void 0))}setEventListener(e){N(xt,this,e),M(bt,this)?.call(this),N(bt,this,e(this.setOnline.bind(this)))}setOnline(e){M(yt,this)!==e&&(N(yt,this,e),this.listeners.forEach(t=>{t(e)}))}isOnline(){return M(yt,this)}});function Ct(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}function wt(e){return Math.min(1e3*2**e,3e4)}function Tt(e){return(e??`online`)===`online`?St.isOnline():!0}var Et=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Dt(e){let t=!1,n=0,r,i=Ct(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Et(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>gt.isFocused()&&(e.networkMode===`always`||St.isOnline())&&e.canRun(),u=()=>Tt(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(dt.isServer()?0:3),o=e.retryDelay??wt,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),rt(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var Ot,kt=(Ot=new WeakMap,class{constructor(){A(this,Ot,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),He(this.gcTime)&&N(Ot,this,Re.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(dt.isServer()?1/0:300*1e3))}clearGcTimeout(){M(Ot,this)!==void 0&&(Re.clearTimeout(M(Ot,this)),N(Ot,this,void 0))}});function At(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ut(e,()=>t.signal,()=>n=!0)},u=ct(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?ot:at;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Mt:jt,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:jt(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function jt(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Mt(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Nt(e,t){return t?jt(e,t)!=null:!1}function Pt(e,t){return!t||!e.getPreviousPageParam?!1:Mt(e,t)!=null}function Ft(e,t){Pe(e,t),t.add(e)}var It,Lt,Rt,I,zt,L,Bt,Vt,R,Ht=(It=new WeakMap,Lt=new WeakMap,Rt=new WeakMap,I=new WeakMap,zt=new WeakMap,L=new WeakMap,Bt=new WeakMap,Vt=new WeakMap,R=new WeakSet,class extends kt{constructor(e){super(),Ft(this,R),A(this,It,void 0),A(this,Lt,void 0),A(this,Rt,void 0),A(this,I,void 0),A(this,zt,void 0),A(this,L,void 0),A(this,Bt,void 0),A(this,Vt,void 0),N(Vt,this,!1),N(Bt,this,e.defaultOptions),this.setOptions(e.options),this.observers=[],N(zt,this,e.client),N(I,this,M(zt,this).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,N(Lt,this,qt(this.options)),this.state=e.state??M(Lt,this),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return M(It,this)}get promise(){return M(L,this)?.promise}setOptions(e){if(this.options={...M(Bt,this),...e},e?._type&&N(It,this,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=qt(this.options);e.data!==void 0&&(this.setState(Kt(e.data,e.dataUpdatedAt)),N(Lt,this,e))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&M(I,this).remove(this)}setData(e,t){let n=it(this.state.data,e,this.options);return j(R,this,Wt).call(this,{data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){j(R,this,Wt).call(this,{type:`setState`,state:e})}cancel(e){let t=M(L,this)?.promise;return M(L,this)?.cancel(e),t?t.then(P).catch(P):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return M(Lt,this)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Ge(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===st||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>We(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Ue(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),M(L,this)?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),M(L,this)?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),M(I,this).notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(M(L,this)&&(M(Vt,this)||j(R,this,Ut).call(this)?M(L,this).cancel({revert:!0}):M(L,this).cancelRetry()),this.scheduleGc()),M(I,this).notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||j(R,this,Wt).call(this,{type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&M(L,this)?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(M(L,this))return M(L,this).continueRetry(),M(L,this).promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(N(Vt,this,!0),n.signal)})},i=()=>{let e=ct(this.options,t),n=(()=>{let e={client:M(zt,this),queryKey:this.queryKey,meta:this.meta};return r(e),e})();return N(Vt,this,!1),this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:M(zt,this),state:this.state,fetchFn:i};return r(e),e})();(M(It,this)===`infinite`?At(this.options.pages):this.options.behavior)?.onFetch(a,this),N(Rt,this,this.state),(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&j(R,this,Wt).call(this,{type:`fetch`,meta:a.fetchOptions?.meta}),N(L,this,Dt({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Et&&e.revert&&this.setState({...M(Rt,this),fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{j(R,this,Wt).call(this,{type:`failed`,failureCount:e,error:t})},onPause:()=>{j(R,this,Wt).call(this,{type:`pause`})},onContinue:()=>{j(R,this,Wt).call(this,{type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{let e=await M(L,this).start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),M(I,this).config.onSuccess?.(e,this),M(I,this).config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Et){if(e.silent)return M(L,this).promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw j(R,this,Wt).call(this,{type:`error`,error:e}),M(I,this).config.onError?.(e,this),M(I,this).config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}});function Ut(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}function Wt(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Gt(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Kt(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return N(Rt,this,e.manual?n:void 0),n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),F.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),M(I,this).notify({query:this,type:`updated`,action:e})})}function Gt(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Tt(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Kt(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function qt(e){let 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 Jt,Yt=(Jt=new WeakMap,class extends ft{constructor(e={}){super(),A(this,Jt,void 0),this.config=e,N(Jt,this,new Map)}build(e,t,n){let r=t.queryKey,i=t.queryHash??Je(r,t),a=this.get(i);return a||(a=new Ht({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){M(Jt,this).has(e.queryHash)||(M(Jt,this).set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=M(Jt,this).get(e.queryHash);t&&(e.destroy(),t===e&&M(Jt,this).delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){F.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return M(Jt,this).get(e)}getAll(){return[...M(Jt,this).values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Ke(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Ke(e,t)):t}notify(e){F.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){F.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){F.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}}),Xt,Zt,z,Qt,$t,en=(Xt=new WeakMap,Zt=new WeakMap,z=new WeakMap,Qt=new WeakMap,$t=new WeakSet,class extends kt{constructor(e){super(),Ft(this,$t),A(this,Xt,void 0),A(this,Zt,void 0),A(this,z,void 0),A(this,Qt,void 0),N(Xt,this,e.client),this.mutationId=e.mutationId,N(z,this,e.mutationCache),N(Zt,this,[]),this.state=e.state||nn(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){M(Zt,this).includes(e)||(M(Zt,this).push(e),this.clearGcTimeout(),M(z,this).notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){N(Zt,this,M(Zt,this).filter(t=>t!==e)),this.scheduleGc(),M(z,this).notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){M(Zt,this).length||(this.state.status===`pending`?this.scheduleGc():M(z,this).remove(this))}continue(){return M(Qt,this)?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{j($t,this,tn).call(this,{type:`continue`})},n={client:M(Xt,this),meta:this.options.meta,mutationKey:this.options.mutationKey};N(Qt,this,Dt({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{j($t,this,tn).call(this,{type:`failed`,failureCount:e,error:t})},onPause:()=>{j($t,this,tn).call(this,{type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>M(z,this).canRun(this)}));let r=this.state.status===`pending`,i=!M(Qt,this).canStart();try{if(r)t();else{j($t,this,tn).call(this,{type:`pending`,variables:e,isPaused:i}),M(z,this).config.onMutate&&await M(z,this).config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&j($t,this,tn).call(this,{type:`pending`,context:t,variables:e,isPaused:i})}let a=await M(Qt,this).start();return await M(z,this).config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await M(z,this).config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),j($t,this,tn).call(this,{type:`success`,data:a}),a}catch(t){try{await M(z,this).config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await M(z,this).config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw j($t,this,tn).call(this,{type:`error`,error:t}),t}finally{M(z,this).runNext(this)}}});function tn(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),F.batch(()=>{M(Zt,this).forEach(t=>{t.onMutationUpdate(e)}),M(z,this).notify({mutation:this,type:`updated`,action:e})})}function nn(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var rn,an,on,sn=(rn=new WeakMap,an=new WeakMap,on=new WeakMap,class extends ft{constructor(e={}){super(),A(this,rn,void 0),A(this,an,void 0),A(this,on,void 0),this.config=e,N(rn,this,new Set),N(an,this,new Map),N(on,this,0)}build(e,t,n){var r;let i=new en({client:e,mutationCache:this,mutationId:N(on,this,(r=M(on,this),++r)),options:e.defaultMutationOptions(t),state:n});return this.add(i),i}add(e){M(rn,this).add(e);let t=cn(e);if(typeof t==`string`){let n=M(an,this).get(t);n?n.push(e):M(an,this).set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(M(rn,this).delete(e)){let t=cn(e);if(typeof t==`string`){let n=M(an,this).get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&M(an,this).delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=cn(e);if(typeof t==`string`){let n=M(an,this).get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=cn(e);return typeof t==`string`?(M(an,this).get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){F.batch(()=>{M(rn,this).forEach(e=>{this.notify({type:`removed`,mutation:e})}),M(rn,this).clear(),M(an,this).clear()})}getAll(){return Array.from(M(rn,this))}find(e){let t={exact:!0,...e};return this.getAll().find(e=>qe(t,e))}findAll(e={}){return this.getAll().filter(t=>qe(e,t))}notify(e){F.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return F.batch(()=>Promise.all(e.map(e=>e.continue().catch(P))))}});function cn(e){return e.options.scope?.id}var B,ln,un,dn,fn,pn,mn,hn,gn=(B=new WeakMap,ln=new WeakMap,un=new WeakMap,dn=new WeakMap,fn=new WeakMap,pn=new WeakMap,mn=new WeakMap,hn=new WeakMap,class{constructor(e={}){A(this,B,void 0),A(this,ln,void 0),A(this,un,void 0),A(this,dn,void 0),A(this,fn,void 0),A(this,pn,void 0),A(this,mn,void 0),A(this,hn,void 0),N(B,this,e.queryCache||new Yt),N(ln,this,e.mutationCache||new sn),N(un,this,e.defaultOptions||{}),N(dn,this,new Map),N(fn,this,new Map),N(pn,this,0)}mount(){var e;N(pn,this,(e=M(pn,this),e++,e)),M(pn,this)===1&&(N(mn,this,gt.subscribe(async e=>{e&&(await this.resumePausedMutations(),M(B,this).onFocus())})),N(hn,this,St.subscribe(async e=>{e&&(await this.resumePausedMutations(),M(B,this).onOnline())})))}unmount(){var e;N(pn,this,(e=M(pn,this),e--,e)),M(pn,this)===0&&(M(mn,this)?.call(this),N(mn,this,void 0),M(hn,this)?.call(this),N(hn,this,void 0))}isFetching(e){return M(B,this).findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return M(ln,this).findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return M(B,this).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=M(B,this).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(We(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return M(B,this).findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=M(B,this).get(r.queryHash)?.state.data,a=Ve(t,i);if(a!==void 0)return M(B,this).build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return F.batch(()=>M(B,this).findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return M(B,this).get(t.queryHash)?.state}removeQueries(e){let t=M(B,this);F.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=M(B,this);return F.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=F.batch(()=>M(B,this).findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(P).catch(P)}invalidateQueries(e,t={}){return F.batch(()=>(M(B,this).findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=F.batch(()=>M(B,this).findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(P)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(P)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=M(B,this).build(this,t);return n.isStaleByTime(We(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(P).catch(P)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(P).catch(P)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return St.isOnline()?M(ln,this).resumePausedMutations():Promise.resolve()}getQueryCache(){return M(B,this)}getMutationCache(){return M(ln,this)}getDefaultOptions(){return M(un,this)}setDefaultOptions(e){N(un,this,e)}setQueryDefaults(e,t){M(dn,this).set(Ye(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...M(dn,this).values()],n={};return t.forEach(t=>{Xe(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){M(fn,this).set(Ye(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...M(fn,this).values()],n={};return t.forEach(t=>{Xe(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...M(un,this).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Je(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===st&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...M(un,this).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){M(B,this).clear(),M(ln,this).clear()}}),V=t(r(),1),H=n(),_n=V.createContext(void 0),vn=e=>{let t=V.useContext(_n);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},yn=({client:e,children:t})=>(V.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,H.jsx)(_n.Provider,{value:e,children:t})),bn=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,xn=/^[\\/]{2}/;function Sn(e,t){return t+e.replace(/\\/g,`/`)}var Cn=`popstate`;function wn(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function Tn(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return kn(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:An(t)}return Mn(t,n,null,e)}function En(e={}){function t(e,t){let{pathname:n=`/`,search:r=``,hash:i=``}=jn(e.location.hash.substring(1));return!n.startsWith(`/`)&&!n.startsWith(`.`)&&(n=`/`+n),kn(``,{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||`default`)}function n(e,t){let n=e.document.querySelector(`base`),r=``;if(n&&n.getAttribute(`href`)){let t=e.location.href,n=t.indexOf(`#`);r=n===-1?t:t.slice(0,n)}return r+`#`+(typeof t==`string`?t:An(t))}function r(e,t){W(e.pathname.charAt(0)===`/`,`relative pathnames are not supported in hash history.push(${JSON.stringify(t)})`)}return Mn(t,n,r,e)}function U(e,t){if(e===!1||e==null)throw Error(t)}function W(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function Dn(){return Math.random().toString(36).substring(2,10)}function On(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function kn(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?jn(t):t,state:n,key:t&&t.key||r||Dn(),mask:i}}function An({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function jn(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function Mn(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=wn(e)?e:kn(h.location,e,t);n&&n(r,e),l=u()+1;let d=On(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=wn(e)?e:kn(h.location,e,t);n&&n(r,e),l=u();let i=On(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return Nn(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(Cn,d),c=e,()=>{i.removeEventListener(Cn,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function Nn(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),U(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:An(t);return i=i.replace(/ $/,`%20`),!n&&xn.test(i)&&(i=r+i),new URL(i,r)}function Pn(e,t,n=`/`){return Fn(e,t,n,!1)}function Fn(e,t,n,r,i){let a=tr((typeof t==`string`?jn(t):t).pathname||`/`,n);if(a==null)return null;let o=i??Ln(e),s=null,c=er(a);for(let e=0;s==null&&e<o.length;++e)s=Xn(o[e],c,r);return s}function In(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function Ln(e){let t=Rn(e);return Bn(t),t}function Rn(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;U(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=lr([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(U(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),Rn(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:Jn(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=$n(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of zn(e.path))a(e,t,!0,n)}),t}function zn(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=zn(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function Bn(e){e.sort((e,t)=>e.score===t.score?Yn(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var Vn=/^:[\w-]+$/,Hn=3,Un=2,Wn=1,Gn=10,Kn=-2,qn=e=>e===`*`;function Jn(e,t){let n=e.split(`/`),r=n.length;return n.some(qn)&&(r+=Kn),t&&(r+=Un),n.filter(e=>!qn(e)).reduce((e,t)=>e+(Vn.test(t)?Hn:t===``?Wn:Gn),r)}function Yn(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function Xn(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?Qn(u,l,s.matcher,s.compiledParams):Zn(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=Zn({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:lr([a,d.pathname]),pathnameBase:dr(lr([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=lr([a,d.pathnameBase]))}return o}function Zn(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=$n(e.path,e.caseSensitive,e.end);return Qn(e,t,n,r)}function Qn(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function $n(e,t=!1,n=!0){W(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function er(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return W(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function tr(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function nr(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?jn(e):e,a;return n?(n=cr(n),a=n.startsWith(`/`)?rr(n.substring(1),`/`):rr(n,t)):a=t,{pathname:a,search:fr(r),hash:pr(i)}}function rr(e,t){let n=ur(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function ir(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function ar(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function or(e){let t=ar(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function sr(e,t,n,r=!1){let i;typeof e==`string`?i=jn(e):(i={...e},U(!i.pathname||!i.pathname.includes(`?`),ir(`?`,`pathname`,`search`,i)),U(!i.pathname||!i.pathname.includes(`#`),ir(`#`,`pathname`,`hash`,i)),U(!i.search||!i.search.includes(`#`),ir(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=nr(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var cr=e=>e.replace(/[\\/]{2,}/g,`/`),lr=e=>cr(e.join(`/`)),ur=e=>e.replace(/\/+$/,``),dr=e=>ur(e).replace(/^\/*/,`/`),fr=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,pr=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,mr=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function hr(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function gr(e){return lr(e.map(e=>e.route.path).filter(Boolean))||`/`}var _r=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function vr(e,t){let n=e;if(typeof n!=`string`||!bn.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(_r)try{let e=new URL(window.location.href),r=xn.test(n)?new URL(Sn(n,e.protocol)):new URL(n),a=tr(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{W(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var yr=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(yr);var br=[`GET`,...yr];new Set(br);var xr=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Sr(e){try{return xr.includes(new URL(e).protocol)}catch{return!1}}var Cr=V.createContext(null);Cr.displayName=`DataRouter`;var wr=V.createContext(null);wr.displayName=`DataRouterState`;var Tr=V.createContext(!1);function Er(){return V.useContext(Tr)}var Dr=V.createContext({isTransitioning:!1});Dr.displayName=`ViewTransition`;var Or=V.createContext(new Map);Or.displayName=`Fetchers`;var kr=V.createContext(null);kr.displayName=`Await`;var G=V.createContext(null);G.displayName=`Navigation`;var Ar=V.createContext(null);Ar.displayName=`Location`;var jr=V.createContext({outlet:null,matches:[],isDataRoute:!1});jr.displayName=`Route`;var Mr=V.createContext(null);Mr.displayName=`RouteError`;var Nr=`REACT_ROUTER_ERROR`,Pr=`REDIRECT`,Fr=`ROUTE_ERROR_RESPONSE`;function Ir(e){if(e.startsWith(`${Nr}:${Pr}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Lr(e){if(e.startsWith(`${Nr}:${Fr}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new mr(t.status,t.statusText,t.data)}catch{}}function Rr(e,{relative:t}={}){U(zr(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=V.useContext(G),{hash:i,pathname:a,search:o}=Gr(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:lr([n,a])),r.createHref({pathname:s,search:o,hash:i})}function zr(){return V.useContext(Ar)!=null}function K(){return U(zr(),`useLocation() may be used only in the context of a <Router> component.`),V.useContext(Ar).location}var Br=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Vr(e){V.useContext(G).static||V.useLayoutEffect(e)}function Hr(){let{isDataRoute:e}=V.useContext(jr);return e?ui():Ur()}function Ur(){U(zr(),`useNavigate() may be used only in the context of a <Router> component.`);let e=V.useContext(Cr),{basename:t,navigator:n}=V.useContext(G),{matches:r}=V.useContext(jr),{pathname:i}=K(),a=JSON.stringify(or(r)),o=V.useRef(!1);return Vr(()=>{o.current=!0}),V.useCallback((r,s={})=>{if(W(o.current,Br),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=sr(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:lr([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}V.createContext(null);function Wr(){let{matches:e}=V.useContext(jr);return e[e.length-1]?.params??{}}function Gr(e,{relative:t}={}){let{matches:n}=V.useContext(jr),{pathname:r}=K(),i=JSON.stringify(or(n));return V.useMemo(()=>sr(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Kr(e,t){return qr(e,t)}function qr(e,t,n){U(zr(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=V.useContext(G),{matches:i}=V.useContext(jr),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;fi(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/api-BRz6cQiD.js","js/rolldown-runtime-QTnfLwEv.js","js/logger-BmpKNkls.js","js/demoMode-BhEpMVh5.js","js/utils-vendor-BX3ZwoIK.js","js/markdown-core-fkbHPd-g.js","js/RichMessageContent-CdgQHk6Q.js","js/utils-D0l9J3P-.js","js/markdown-math-Ci4QOsf-.js","assets/markdown-math-CYlHEDRF.css","js/SettingsModal-CLdxDdQV.js","js/useQuery-CbYbdhch.js","js/useBaseQuery-C8AWX-Cq.js","js/useTranslation-CP6Cg-EI.js","js/ui-vendor-njo77ljx.js","js/Button-BZBnLKRn.js","js/ChatPage-DdLe5r1n.js","js/react-vendor-Co1u1rWb.js","js/artifactHtml-B7Oy2e__.js","js/ArtifactContainer-RPQq1DRo.js","js/OptimizedSyntaxHighlighter-BR97Z7hi.js","js/syntax-highlight-B8OiKBhG.js","js/ModelsPage-BVfl9FU_.js","js/PersonasPage-wP36Pd7I.js","js/GalleryPage-BTA5LAmZ.js","js/LibreClawPage-CuQ8tJUW.js","js/UserManagementPage-BwnBtNj1.js","js/ArtifactDemoPage-Dd0Rbl3N.js","js/ArtifactSlideOutPanel-oA5Iy8Nc.js","js/FirstTimeSetup-DL_WZABT.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e,r as t}from"../js/rolldown-runtime-QTnfLwEv.js";import{d as n,f as r}from"../js/markdown-core-fkbHPd-g.js";import{n as i,t as a}from"../js/react-vendor-Co1u1rWb.js";import{r as o,t as s}from"../js/logger-BmpKNkls.js";import{r as c,t as l}from"../js/useTranslation-CP6Cg-EI.js";import{At as u,B as d,Bt as f,D as p,Ft as m,H as h,L as g,M as _,Mt as v,Nt as y,Ot as b,P as x,R as S,Rt as ee,St as C,T as w,Vt as T,Z as te,at as ne,c as re,ct as E,g as ie,gt as ae,ht as oe,it as se,n as ce,o as le,ot as ue,p as de,s as fe,u as pe,ut as me,v as he,vt as ge,yt as _e,zt as ve}from"../js/ui-vendor-njo77ljx.js";import{a as ye,o as be,t as xe}from"../js/utils-vendor-BX3ZwoIK.js";import{n as Se,t as Ce}from"../js/demoMode-BhEpMVh5.js";import{_ as we,b as Te,c as Ee,d as De,o as Oe,s as D,v as ke,y as Ae}from"../js/api-BRz6cQiD.js";import{a as je,n as Me,r as Ne,t as O}from"../js/utils-D0l9J3P-.js";import{t as k}from"../js/Button-BZBnLKRn.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function Pe(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function A(e,t,n){Pe(e,t),t.set(e,n)}function j(e,t,n){if(typeof e==`function`?e===t:e.has(t))return arguments.length<3?t:n;throw TypeError(`Private element is not present on this object`)}function M(e,t){return e.get(j(e,t))}function N(e,t,n){return e.set(j(e,t),n),n}var Fe,Ie,Le={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Re=new(Fe=new WeakMap,Ie=new WeakMap,class{constructor(){A(this,Fe,Le),A(this,Ie,!1)}setTimeoutProvider(e){N(Fe,this,e)}setTimeout(e,t){return M(Fe,this).setTimeout(e,t)}clearTimeout(e){M(Fe,this).clearTimeout(e)}setInterval(e,t){return M(Fe,this).setInterval(e,t)}clearInterval(e){M(Fe,this).clearInterval(e)}});function ze(e){setTimeout(e,0)}var Be=typeof window>`u`||`Deno`in globalThis;function P(){}function Ve(e,t){return typeof e==`function`?e(t):e}function He(e){return typeof e==`number`&&e>=0&&e!==1/0}function Ue(e,t){return Math.max(e+(t||0)-Date.now(),0)}function We(e,t){return typeof e==`function`?e(t):e}function Ge(e,t){return typeof e==`function`?e(t):e}function Ke(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Je(o,t.options))return!1}else if(!Xe(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function qe(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Ye(t.options.mutationKey)!==Ye(a))return!1}else if(!Xe(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Je(e,t){return(t?.queryKeyHashFn||Ye)(e)}function Ye(e){return JSON.stringify(e,(e,t)=>tt(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Xe(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>Xe(e[n],t[n])):!1}var Ze=Object.prototype.hasOwnProperty;function Qe(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=et(e)&&et(t);if(!r&&!(tt(e)&&tt(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:Ze.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Qe(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function $e(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function et(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function tt(e){if(!nt(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!nt(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function nt(e){return Object.prototype.toString.call(e)===`[object Object]`}function rt(e){return new Promise(t=>{Re.setTimeout(t,e)})}function it(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Qe(e,t)}function at(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ot(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var st=Symbol();function ct(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===st?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function lt(e,t){return typeof e==`function`?e(...t):!!e}function ut(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??(i=t()),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var dt=(()=>{let e=()=>Be;return{isServer(){return e()},setIsServer(t){e=t}}})(),ft=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(){}},pt,mt,ht,gt=new(pt=new WeakMap,mt=new WeakMap,ht=new WeakMap,class extends ft{constructor(){super(),A(this,pt,void 0),A(this,mt,void 0),A(this,ht,void 0),N(ht,this,e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}})}onSubscribe(){M(mt,this)||this.setEventListener(M(ht,this))}onUnsubscribe(){this.hasListeners()||(M(mt,this)?.call(this),N(mt,this,void 0))}setEventListener(e){N(ht,this,e),M(mt,this)?.call(this),N(mt,this,e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()}))}setFocused(e){M(pt,this)!==e&&(N(pt,this,e),this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof M(pt,this)==`boolean`?M(pt,this):globalThis.document?.visibilityState!==`hidden`}}),_t=ze;function vt(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=_t,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var F=vt(),yt,bt,xt,St=new(yt=new WeakMap,bt=new WeakMap,xt=new WeakMap,class extends ft{constructor(){super(),A(this,yt,!0),A(this,bt,void 0),A(this,xt,void 0),N(xt,this,e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}})}onSubscribe(){M(bt,this)||this.setEventListener(M(xt,this))}onUnsubscribe(){this.hasListeners()||(M(bt,this)?.call(this),N(bt,this,void 0))}setEventListener(e){N(xt,this,e),M(bt,this)?.call(this),N(bt,this,e(this.setOnline.bind(this)))}setOnline(e){M(yt,this)!==e&&(N(yt,this,e),this.listeners.forEach(t=>{t(e)}))}isOnline(){return M(yt,this)}});function Ct(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}function wt(e){return Math.min(1e3*2**e,3e4)}function Tt(e){return(e??`online`)===`online`?St.isOnline():!0}var Et=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Dt(e){let t=!1,n=0,r,i=Ct(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Et(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>gt.isFocused()&&(e.networkMode===`always`||St.isOnline())&&e.canRun(),u=()=>Tt(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(dt.isServer()?0:3),o=e.retryDelay??wt,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),rt(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var Ot,kt=(Ot=new WeakMap,class{constructor(){A(this,Ot,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),He(this.gcTime)&&N(Ot,this,Re.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(dt.isServer()?1/0:300*1e3))}clearGcTimeout(){M(Ot,this)!==void 0&&(Re.clearTimeout(M(Ot,this)),N(Ot,this,void 0))}});function At(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ut(e,()=>t.signal,()=>n=!0)},u=ct(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?ot:at;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Mt:jt,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:jt(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function jt(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Mt(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Nt(e,t){return t?jt(e,t)!=null:!1}function Pt(e,t){return!t||!e.getPreviousPageParam?!1:Mt(e,t)!=null}function Ft(e,t){Pe(e,t),t.add(e)}var It,Lt,Rt,I,zt,L,Bt,Vt,R,Ht=(It=new WeakMap,Lt=new WeakMap,Rt=new WeakMap,I=new WeakMap,zt=new WeakMap,L=new WeakMap,Bt=new WeakMap,Vt=new WeakMap,R=new WeakSet,class extends kt{constructor(e){super(),Ft(this,R),A(this,It,void 0),A(this,Lt,void 0),A(this,Rt,void 0),A(this,I,void 0),A(this,zt,void 0),A(this,L,void 0),A(this,Bt,void 0),A(this,Vt,void 0),N(Vt,this,!1),N(Bt,this,e.defaultOptions),this.setOptions(e.options),this.observers=[],N(zt,this,e.client),N(I,this,M(zt,this).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,N(Lt,this,qt(this.options)),this.state=e.state??M(Lt,this),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return M(It,this)}get promise(){return M(L,this)?.promise}setOptions(e){if(this.options={...M(Bt,this),...e},e?._type&&N(It,this,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=qt(this.options);e.data!==void 0&&(this.setState(Kt(e.data,e.dataUpdatedAt)),N(Lt,this,e))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&M(I,this).remove(this)}setData(e,t){let n=it(this.state.data,e,this.options);return j(R,this,Wt).call(this,{data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){j(R,this,Wt).call(this,{type:`setState`,state:e})}cancel(e){let t=M(L,this)?.promise;return M(L,this)?.cancel(e),t?t.then(P).catch(P):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return M(Lt,this)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Ge(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===st||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>We(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Ue(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),M(L,this)?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),M(L,this)?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),M(I,this).notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(M(L,this)&&(M(Vt,this)||j(R,this,Ut).call(this)?M(L,this).cancel({revert:!0}):M(L,this).cancelRetry()),this.scheduleGc()),M(I,this).notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||j(R,this,Wt).call(this,{type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&M(L,this)?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(M(L,this))return M(L,this).continueRetry(),M(L,this).promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(N(Vt,this,!0),n.signal)})},i=()=>{let e=ct(this.options,t),n=(()=>{let e={client:M(zt,this),queryKey:this.queryKey,meta:this.meta};return r(e),e})();return N(Vt,this,!1),this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:M(zt,this),state:this.state,fetchFn:i};return r(e),e})();(M(It,this)===`infinite`?At(this.options.pages):this.options.behavior)?.onFetch(a,this),N(Rt,this,this.state),(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&j(R,this,Wt).call(this,{type:`fetch`,meta:a.fetchOptions?.meta}),N(L,this,Dt({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Et&&e.revert&&this.setState({...M(Rt,this),fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{j(R,this,Wt).call(this,{type:`failed`,failureCount:e,error:t})},onPause:()=>{j(R,this,Wt).call(this,{type:`pause`})},onContinue:()=>{j(R,this,Wt).call(this,{type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{let e=await M(L,this).start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),M(I,this).config.onSuccess?.(e,this),M(I,this).config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Et){if(e.silent)return M(L,this).promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw j(R,this,Wt).call(this,{type:`error`,error:e}),M(I,this).config.onError?.(e,this),M(I,this).config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}});function Ut(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}function Wt(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Gt(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Kt(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return N(Rt,this,e.manual?n:void 0),n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),F.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),M(I,this).notify({query:this,type:`updated`,action:e})})}function Gt(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Tt(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Kt(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function qt(e){let 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 Jt,Yt=(Jt=new WeakMap,class extends ft{constructor(e={}){super(),A(this,Jt,void 0),this.config=e,N(Jt,this,new Map)}build(e,t,n){let r=t.queryKey,i=t.queryHash??Je(r,t),a=this.get(i);return a||(a=new Ht({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){M(Jt,this).has(e.queryHash)||(M(Jt,this).set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=M(Jt,this).get(e.queryHash);t&&(e.destroy(),t===e&&M(Jt,this).delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){F.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return M(Jt,this).get(e)}getAll(){return[...M(Jt,this).values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Ke(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Ke(e,t)):t}notify(e){F.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){F.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){F.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}}),Xt,Zt,z,Qt,$t,en=(Xt=new WeakMap,Zt=new WeakMap,z=new WeakMap,Qt=new WeakMap,$t=new WeakSet,class extends kt{constructor(e){super(),Ft(this,$t),A(this,Xt,void 0),A(this,Zt,void 0),A(this,z,void 0),A(this,Qt,void 0),N(Xt,this,e.client),this.mutationId=e.mutationId,N(z,this,e.mutationCache),N(Zt,this,[]),this.state=e.state||nn(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){M(Zt,this).includes(e)||(M(Zt,this).push(e),this.clearGcTimeout(),M(z,this).notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){N(Zt,this,M(Zt,this).filter(t=>t!==e)),this.scheduleGc(),M(z,this).notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){M(Zt,this).length||(this.state.status===`pending`?this.scheduleGc():M(z,this).remove(this))}continue(){return M(Qt,this)?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{j($t,this,tn).call(this,{type:`continue`})},n={client:M(Xt,this),meta:this.options.meta,mutationKey:this.options.mutationKey};N(Qt,this,Dt({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{j($t,this,tn).call(this,{type:`failed`,failureCount:e,error:t})},onPause:()=>{j($t,this,tn).call(this,{type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>M(z,this).canRun(this)}));let r=this.state.status===`pending`,i=!M(Qt,this).canStart();try{if(r)t();else{j($t,this,tn).call(this,{type:`pending`,variables:e,isPaused:i}),M(z,this).config.onMutate&&await M(z,this).config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&j($t,this,tn).call(this,{type:`pending`,context:t,variables:e,isPaused:i})}let a=await M(Qt,this).start();return await M(z,this).config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await M(z,this).config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),j($t,this,tn).call(this,{type:`success`,data:a}),a}catch(t){try{await M(z,this).config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await M(z,this).config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw j($t,this,tn).call(this,{type:`error`,error:t}),t}finally{M(z,this).runNext(this)}}});function tn(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),F.batch(()=>{M(Zt,this).forEach(t=>{t.onMutationUpdate(e)}),M(z,this).notify({mutation:this,type:`updated`,action:e})})}function nn(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var rn,an,on,sn=(rn=new WeakMap,an=new WeakMap,on=new WeakMap,class extends ft{constructor(e={}){super(),A(this,rn,void 0),A(this,an,void 0),A(this,on,void 0),this.config=e,N(rn,this,new Set),N(an,this,new Map),N(on,this,0)}build(e,t,n){var r;let i=new en({client:e,mutationCache:this,mutationId:N(on,this,(r=M(on,this),++r)),options:e.defaultMutationOptions(t),state:n});return this.add(i),i}add(e){M(rn,this).add(e);let t=cn(e);if(typeof t==`string`){let n=M(an,this).get(t);n?n.push(e):M(an,this).set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(M(rn,this).delete(e)){let t=cn(e);if(typeof t==`string`){let n=M(an,this).get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&M(an,this).delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=cn(e);if(typeof t==`string`){let n=M(an,this).get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=cn(e);return typeof t==`string`?(M(an,this).get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){F.batch(()=>{M(rn,this).forEach(e=>{this.notify({type:`removed`,mutation:e})}),M(rn,this).clear(),M(an,this).clear()})}getAll(){return Array.from(M(rn,this))}find(e){let t={exact:!0,...e};return this.getAll().find(e=>qe(t,e))}findAll(e={}){return this.getAll().filter(t=>qe(e,t))}notify(e){F.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return F.batch(()=>Promise.all(e.map(e=>e.continue().catch(P))))}});function cn(e){return e.options.scope?.id}var B,ln,un,dn,fn,pn,mn,hn,gn=(B=new WeakMap,ln=new WeakMap,un=new WeakMap,dn=new WeakMap,fn=new WeakMap,pn=new WeakMap,mn=new WeakMap,hn=new WeakMap,class{constructor(e={}){A(this,B,void 0),A(this,ln,void 0),A(this,un,void 0),A(this,dn,void 0),A(this,fn,void 0),A(this,pn,void 0),A(this,mn,void 0),A(this,hn,void 0),N(B,this,e.queryCache||new Yt),N(ln,this,e.mutationCache||new sn),N(un,this,e.defaultOptions||{}),N(dn,this,new Map),N(fn,this,new Map),N(pn,this,0)}mount(){var e;N(pn,this,(e=M(pn,this),e++,e)),M(pn,this)===1&&(N(mn,this,gt.subscribe(async e=>{e&&(await this.resumePausedMutations(),M(B,this).onFocus())})),N(hn,this,St.subscribe(async e=>{e&&(await this.resumePausedMutations(),M(B,this).onOnline())})))}unmount(){var e;N(pn,this,(e=M(pn,this),e--,e)),M(pn,this)===0&&(M(mn,this)?.call(this),N(mn,this,void 0),M(hn,this)?.call(this),N(hn,this,void 0))}isFetching(e){return M(B,this).findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return M(ln,this).findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return M(B,this).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=M(B,this).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(We(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return M(B,this).findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=M(B,this).get(r.queryHash)?.state.data,a=Ve(t,i);if(a!==void 0)return M(B,this).build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return F.batch(()=>M(B,this).findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return M(B,this).get(t.queryHash)?.state}removeQueries(e){let t=M(B,this);F.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=M(B,this);return F.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=F.batch(()=>M(B,this).findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(P).catch(P)}invalidateQueries(e,t={}){return F.batch(()=>(M(B,this).findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=F.batch(()=>M(B,this).findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(P)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(P)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=M(B,this).build(this,t);return n.isStaleByTime(We(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(P).catch(P)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(P).catch(P)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return St.isOnline()?M(ln,this).resumePausedMutations():Promise.resolve()}getQueryCache(){return M(B,this)}getMutationCache(){return M(ln,this)}getDefaultOptions(){return M(un,this)}setDefaultOptions(e){N(un,this,e)}setQueryDefaults(e,t){M(dn,this).set(Ye(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...M(dn,this).values()],n={};return t.forEach(t=>{Xe(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){M(fn,this).set(Ye(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...M(fn,this).values()],n={};return t.forEach(t=>{Xe(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...M(un,this).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Je(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===st&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...M(un,this).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){M(B,this).clear(),M(ln,this).clear()}}),V=t(r(),1),H=n(),_n=V.createContext(void 0),vn=e=>{let t=V.useContext(_n);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},yn=({client:e,children:t})=>(V.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,H.jsx)(_n.Provider,{value:e,children:t})),bn=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,xn=/^[\\/]{2}/;function Sn(e,t){return t+e.replace(/\\/g,`/`)}var Cn=`popstate`;function wn(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function Tn(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return kn(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:An(t)}return Mn(t,n,null,e)}function En(e={}){function t(e,t){let{pathname:n=`/`,search:r=``,hash:i=``}=jn(e.location.hash.substring(1));return!n.startsWith(`/`)&&!n.startsWith(`.`)&&(n=`/`+n),kn(``,{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||`default`)}function n(e,t){let n=e.document.querySelector(`base`),r=``;if(n&&n.getAttribute(`href`)){let t=e.location.href,n=t.indexOf(`#`);r=n===-1?t:t.slice(0,n)}return r+`#`+(typeof t==`string`?t:An(t))}function r(e,t){W(e.pathname.charAt(0)===`/`,`relative pathnames are not supported in hash history.push(${JSON.stringify(t)})`)}return Mn(t,n,r,e)}function U(e,t){if(e===!1||e==null)throw Error(t)}function W(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function Dn(){return Math.random().toString(36).substring(2,10)}function On(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function kn(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?jn(t):t,state:n,key:t&&t.key||r||Dn(),mask:i}}function An({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function jn(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function Mn(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=wn(e)?e:kn(h.location,e,t);n&&n(r,e),l=u()+1;let d=On(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=wn(e)?e:kn(h.location,e,t);n&&n(r,e),l=u();let i=On(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return Nn(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(Cn,d),c=e,()=>{i.removeEventListener(Cn,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function Nn(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),U(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:An(t);return i=i.replace(/ $/,`%20`),!n&&xn.test(i)&&(i=r+i),new URL(i,r)}function Pn(e,t,n=`/`){return Fn(e,t,n,!1)}function Fn(e,t,n,r,i){let a=tr((typeof t==`string`?jn(t):t).pathname||`/`,n);if(a==null)return null;let o=i??Ln(e),s=null,c=er(a);for(let e=0;s==null&&e<o.length;++e)s=Xn(o[e],c,r);return s}function In(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function Ln(e){let t=Rn(e);return Bn(t),t}function Rn(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;U(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=lr([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(U(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),Rn(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:Jn(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=$n(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of zn(e.path))a(e,t,!0,n)}),t}function zn(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=zn(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function Bn(e){e.sort((e,t)=>e.score===t.score?Yn(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var Vn=/^:[\w-]+$/,Hn=3,Un=2,Wn=1,Gn=10,Kn=-2,qn=e=>e===`*`;function Jn(e,t){let n=e.split(`/`),r=n.length;return n.some(qn)&&(r+=Kn),t&&(r+=Un),n.filter(e=>!qn(e)).reduce((e,t)=>e+(Vn.test(t)?Hn:t===``?Wn:Gn),r)}function Yn(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function Xn(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?Qn(u,l,s.matcher,s.compiledParams):Zn(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=Zn({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:lr([a,d.pathname]),pathnameBase:dr(lr([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=lr([a,d.pathnameBase]))}return o}function Zn(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=$n(e.path,e.caseSensitive,e.end);return Qn(e,t,n,r)}function Qn(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function $n(e,t=!1,n=!0){W(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function er(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return W(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function tr(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function nr(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?jn(e):e,a;return n?(n=cr(n),a=n.startsWith(`/`)?rr(n.substring(1),`/`):rr(n,t)):a=t,{pathname:a,search:fr(r),hash:pr(i)}}function rr(e,t){let n=ur(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function ir(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function ar(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function or(e){let t=ar(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function sr(e,t,n,r=!1){let i;typeof e==`string`?i=jn(e):(i={...e},U(!i.pathname||!i.pathname.includes(`?`),ir(`?`,`pathname`,`search`,i)),U(!i.pathname||!i.pathname.includes(`#`),ir(`#`,`pathname`,`hash`,i)),U(!i.search||!i.search.includes(`#`),ir(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=nr(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var cr=e=>e.replace(/[\\/]{2,}/g,`/`),lr=e=>cr(e.join(`/`)),ur=e=>e.replace(/\/+$/,``),dr=e=>ur(e).replace(/^\/*/,`/`),fr=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,pr=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,mr=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function hr(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function gr(e){return lr(e.map(e=>e.route.path).filter(Boolean))||`/`}var _r=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function vr(e,t){let n=e;if(typeof n!=`string`||!bn.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(_r)try{let e=new URL(window.location.href),r=xn.test(n)?new URL(Sn(n,e.protocol)):new URL(n),a=tr(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{W(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var yr=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(yr);var br=[`GET`,...yr];new Set(br);var xr=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Sr(e){try{return xr.includes(new URL(e).protocol)}catch{return!1}}var Cr=V.createContext(null);Cr.displayName=`DataRouter`;var wr=V.createContext(null);wr.displayName=`DataRouterState`;var Tr=V.createContext(!1);function Er(){return V.useContext(Tr)}var Dr=V.createContext({isTransitioning:!1});Dr.displayName=`ViewTransition`;var Or=V.createContext(new Map);Or.displayName=`Fetchers`;var kr=V.createContext(null);kr.displayName=`Await`;var G=V.createContext(null);G.displayName=`Navigation`;var Ar=V.createContext(null);Ar.displayName=`Location`;var jr=V.createContext({outlet:null,matches:[],isDataRoute:!1});jr.displayName=`Route`;var Mr=V.createContext(null);Mr.displayName=`RouteError`;var Nr=`REACT_ROUTER_ERROR`,Pr=`REDIRECT`,Fr=`ROUTE_ERROR_RESPONSE`;function Ir(e){if(e.startsWith(`${Nr}:${Pr}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Lr(e){if(e.startsWith(`${Nr}:${Fr}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new mr(t.status,t.statusText,t.data)}catch{}}function Rr(e,{relative:t}={}){U(zr(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=V.useContext(G),{hash:i,pathname:a,search:o}=Gr(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:lr([n,a])),r.createHref({pathname:s,search:o,hash:i})}function zr(){return V.useContext(Ar)!=null}function K(){return U(zr(),`useLocation() may be used only in the context of a <Router> component.`),V.useContext(Ar).location}var Br=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Vr(e){V.useContext(G).static||V.useLayoutEffect(e)}function Hr(){let{isDataRoute:e}=V.useContext(jr);return e?ui():Ur()}function Ur(){U(zr(),`useNavigate() may be used only in the context of a <Router> component.`);let e=V.useContext(Cr),{basename:t,navigator:n}=V.useContext(G),{matches:r}=V.useContext(jr),{pathname:i}=K(),a=JSON.stringify(or(r)),o=V.useRef(!1);return Vr(()=>{o.current=!0}),V.useCallback((r,s={})=>{if(W(o.current,Br),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=sr(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:lr([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}V.createContext(null);function Wr(){let{matches:e}=V.useContext(jr);return e[e.length-1]?.params??{}}function Gr(e,{relative:t}={}){let{matches:n}=V.useContext(jr),{pathname:r}=K(),i=JSON.stringify(or(n));return V.useMemo(()=>sr(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Kr(e,t){return qr(e,t)}function qr(e,t,n){U(zr(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=V.useContext(G),{matches:i}=V.useContext(jr),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;fi(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
3
3
|
|
|
4
4
|
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=K(),d;if(t){let e=typeof t==`string`?jn(t):t;U(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):Pn(e,{pathname:p});W(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),W(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=ei(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:lr([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:lr([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?V.createElement(Ar.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function Jr(){let e=li(),t=hr(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=V.createElement(V.Fragment,null,V.createElement(`p`,null,`💿 Hey developer 👋`),V.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,V.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,V.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),V.createElement(V.Fragment,null,V.createElement(`h2`,null,`Unexpected Application Error!`),V.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?V.createElement(`pre`,{style:i},n):null,o)}var Yr=V.createElement(Jr,null),Xr=class extends V.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Lr(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:V.createElement(jr.Provider,{value:this.props.routeContext},V.createElement(Mr.Provider,{value:e,children:this.props.component}));return this.context?V.createElement(Qr,{error:e},t):t}};Xr.contextType=Tr;var Zr=new WeakMap;function Qr({children:e,error:t}){let{basename:n}=V.useContext(G);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Ir(t.digest);if(e){let r=Zr.get(t);if(r)throw r;let i=vr(e.location,n),a=i.absoluteURL||i.to;if(Sr(a))throw Error(`Invalid redirect location`);if(_r&&!Zr.get(t))if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw Zr.set(t,n),n}return V.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function $r({routeContext:e,match:t,children:n}){let r=V.useContext(Cr);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),V.createElement(jr.Provider,{value:e},n)}function ei(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);U(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:gr(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||Yr,o&&(s<0&&c===0?(fi(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?V.createElement(n.route.Component,null):n.route.element?n.route.element:e,V.createElement($r,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?V.createElement(Xr,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function ti(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ni(e){let t=V.useContext(Cr);return U(t,ti(e)),t}function ri(e){let t=V.useContext(wr);return U(t,ti(e)),t}function ii(e){let t=V.useContext(jr);return U(t,ti(e)),t}function ai(e){let t=ii(e),n=t.matches[t.matches.length-1];return U(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function oi(){return ai(`useRouteId`)}function si(){let e=ri(`useNavigation`);return V.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function ci(){let{matches:e,loaderData:t}=ri(`useMatches`);return V.useMemo(()=>e.map(e=>In(e,t)),[e,t])}function li(){let e=V.useContext(Mr),t=ri(`useRouteError`),n=ai(`useRouteError`);return e===void 0?t.errors?.[n]:e}function ui(){let{router:e}=ni(`useNavigate`),t=ai(`useNavigate`),n=V.useRef(!1);return Vr(()=>{n.current=!0}),V.useCallback(async(r,i={})=>{W(n.current,Br),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var di={};function fi(e,t,n){!t&&!di[e]&&(di[e]=!0,W(!1,n))}V.memo(pi);function pi({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return qr(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function mi({to:e,replace:t,state:n,relative:r}){U(zr(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=V.useContext(G);W(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=V.useContext(jr),{pathname:o}=K(),s=Hr(),c=sr(e,or(a),o,r===`path`),l=JSON.stringify(c);return V.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function q(e){U(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function hi({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){U(!zr(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=V.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=jn(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=V.useMemo(()=>{let e=tr(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return W(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:V.createElement(G.Provider,{value:c},V.createElement(Ar.Provider,{children:t,value:h}))}function gi({children:e,location:t}){return Kr(_i(e),t)}V.Component;function _i(e,t=[]){let n=[];return V.Children.forEach(e,(e,r)=>{if(!V.isValidElement(e))return;let i=[...t,r];if(e.type===V.Fragment){n.push.apply(n,_i(e.props.children,i));return}U(e.type===q,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),U(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=_i(e.props.children,i)),n.push(a)}),n}var vi=`get`,yi=`application/x-www-form-urlencoded`;function bi(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function xi(e){return bi(e)&&e.tagName.toLowerCase()===`button`}function Si(e){return bi(e)&&e.tagName.toLowerCase()===`form`}function Ci(e){return bi(e)&&e.tagName.toLowerCase()===`input`}function wi(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ti(e,t){return e.button===0&&(!t||t===`_self`)&&!wi(e)}var Ei=null;function Di(){if(Ei===null)try{new FormData(document.createElement(`form`),0),Ei=!1}catch{Ei=!0}return Ei}var Oi=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function ki(e){return e!=null&&!Oi.has(e)?(W(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${yi}"`),null):e}function Ai(e,t){let n,r,i,a,o;if(Si(e)){let o=e.getAttribute(`action`);r=o?tr(o,t):null,n=e.getAttribute(`method`)||vi,i=ki(e.getAttribute(`enctype`))||yi,a=new FormData(e)}else if(xi(e)||Ci(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?tr(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||vi,i=ki(e.getAttribute(`formenctype`))||ki(o.getAttribute(`enctype`))||yi,a=new FormData(o,e),!Di()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(bi(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=vi,r=null,i=yi,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var ji={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Mi=/[&><\u2028\u2029]/g;function Ni(e){return e.replace(Mi,e=>ji[e])}function Pi(e,t){if(e===!1||e==null)throw Error(t)}function Fi(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&tr(i.pathname,t)===`/`?i.pathname=`${ur(t)}/_root.${r}`:i.pathname=`${ur(i.pathname)}.${r}`,i}async function Ii(e,t){if(e.id in t)return t[e.id];try{let n=await o(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Li(e){return e!=null&&typeof e.page==`string`}function Ri(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function zi(e,t,n){return Wi((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Ii(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Ri).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Bi(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Vi(e,t,{includeHydrateFallback:n}={}){return Hi(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Hi(e){return[...new Set(e)]}function Ui(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Wi(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Li(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Ui(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Gi(){let e=V.useContext(Cr);return Pi(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Ki(){let e=V.useContext(wr);return Pi(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var qi=V.createContext(void 0);qi.displayName=`FrameworkContext`;function Ji(){let e=V.useContext(qi);return Pi(e,`You must render this element inside a <HydratedRouter> element`),e}function Yi(e,t){let n=V.useContext(qi),[r,i]=V.useState(!1),[a,o]=V.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=V.useRef(null);V.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),V.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:Xi(s,p),onBlur:Xi(c,m),onMouseEnter:Xi(l,p),onMouseLeave:Xi(u,m),onTouchStart:Xi(d,p)}]:[a,f,{}]:[!1,f,{}]}function Xi(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Zi({page:e,...t}){let n=Er(),{nonce:r}=Ji(),{router:i}=Gi(),a=V.useMemo(()=>Pn(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?V.createElement($i,{page:e,matches:a,...t}):V.createElement(ea,{page:e,matches:a,...t})):null}function Qi(e){let{manifest:t,routeModules:n}=Ji(),[r,i]=V.useState([]);return V.useEffect(()=>{let r=!1;return zi(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function $i({page:e,matches:t,...n}){let r=K(),{future:i}=Ji(),{basename:a}=Gi(),o=V.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Fi(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return V.createElement(V.Fragment,null,o.map(e=>V.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function ea({page:e,matches:t,...n}){let r=K(),{future:i,manifest:a,routeModules:o}=Ji(),{basename:s}=Gi(),{loaderData:c,matches:l}=Ki(),u=V.useMemo(()=>Bi(e,t,l,a,r,`data`),[e,t,l,a,r]),d=V.useMemo(()=>Bi(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=V.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=Fi(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=V.useMemo(()=>Vi(d,a),[d,a]),m=Qi(d);return V.createElement(V.Fragment,null,f.map(e=>V.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>V.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>V.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function ta(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}V.Component;var na=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{na&&(window.__reactRouterVersion=`7.18.1`)}catch{}function ra({basename:e,children:t,useTransitions:n,window:r}){let i=V.useRef();i.current??(i.current=Tn({window:r,v5Compat:!0}));let a=i.current,[o,s]=V.useState({action:a.action,location:a.location}),c=V.useCallback(e=>{n===!1?s(e):V.startTransition(()=>s(e))},[n]);return V.useLayoutEffect(()=>a.listen(c),[a,c]),V.createElement(hi,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}function ia({basename:e,children:t,useTransitions:n,window:r}){let i=V.useRef();i.current??(i.current=En({window:r,v5Compat:!0}));let a=i.current,[o,s]=V.useState({action:a.action,location:a.location}),c=V.useCallback(e=>{n===!1?s(e):V.startTransition(()=>s(e))},[n]);return V.useLayoutEffect(()=>a.listen(c),[a,c]),V.createElement(hi,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}function aa({basename:e,children:t,history:n,useTransitions:r}){let[i,a]=V.useState({action:n.action,location:n.location}),o=V.useCallback(e=>{r===!1?a(e):V.startTransition(()=>a(e))},[r]);return V.useLayoutEffect(()=>n.listen(o),[n,o]),V.createElement(hi,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}aa.displayName=`unstable_HistoryRouter`;var oa=V.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=V.useContext(G),v=typeof l==`string`&&bn.test(l),y=vr(l,h);l=y.to;let b=Rr(l,{relative:r}),x=K(),S=null;if(o){let e=sr(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:lr([h,e.pathname])),S=g.createHref(e)}let[ee,C,w]=Yi(n,p),T=pa(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function te(t){e&&e(t),t.defaultPrevented||T(t)}let ne=!(y.isExternal||i),re=V.createElement(`a`,{...p,...w,href:(ne?S:void 0)||y.absoluteURL||b,onClick:ne?te:e,ref:ta(m,C),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return ee&&!v?V.createElement(V.Fragment,null,re,V.createElement(Zi,{page:b})):re});oa.displayName=`Link`;var sa=V.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=Gr(a,{relative:c.relative}),d=K(),f=V.useContext(wr),{navigator:p,basename:m}=V.useContext(G),h=f!=null&&Ca(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=tr(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),S={isActive:b,isPending:x,isTransitioning:h},ee=b?e:void 0,C;C=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let w=typeof i==`function`?i(S):i;return V.createElement(oa,{...c,"aria-current":ee,className:C,ref:l,style:w,to:a,viewTransition:o},typeof s==`function`?s(S):s)});sa.displayName=`NavLink`;var ca=V.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=vi,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=V.useContext(G),g=ga(),_=_a(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&bn.test(s);return V.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?V.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});ca.displayName=`Form`;function la({getKey:e,storageKey:t,...n}){let r=V.useContext(qi),{basename:i}=V.useContext(G),a=K(),o=ci();xa({getKey:e,storageKey:t});let s=V.useMemo(()=>{if(!r||!e)return null;let t=ba(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return n.nonce==null&&r?.nonce&&(n.nonce=r.nonce),V.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${Ni(JSON.stringify(t||va))}, ${Ni(JSON.stringify(s))})`}})}la.displayName=`ScrollRestoration`;function ua(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function da(e){let t=V.useContext(Cr);return U(t,ua(e)),t}function fa(e){let t=V.useContext(wr);return U(t,ua(e)),t}function pa(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=Hr(),d=K(),f=Gr(e,{relative:o});return V.useCallback(p=>{if(Ti(p,t)){p.preventDefault();let t=n===void 0?An(d)===An(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?V.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}var ma=0,ha=()=>`__${String(++ma)}__`;function ga(){let{router:e}=da(`useSubmit`),{basename:t}=V.useContext(G),n=oi(),r=e.fetch,i=e.navigate;return V.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Ai(e,t);a.navigate===!1?await r(a.fetcherKey||ha(),n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function _a(e,{relative:t}={}){let{basename:n}=V.useContext(G),r=V.useContext(jr);U(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Gr(e||`.`,{relative:t})},o=K();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:lr([n,a.pathname])),An(a)}var va=`react-router-scroll-positions`,ya={};function ba(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:tr(e.pathname,n)||e.pathname},t)),i??(i=e.key),i}function xa({getKey:e,storageKey:t}={}){let{router:n}=da(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=fa(`useScrollRestoration`),{basename:a}=V.useContext(G),o=K(),s=ci(),c=si();V.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Sa(V.useCallback(()=>{if(c.state===`idle`){let t=ba(o,s,a,e);ya[t]=window.scrollY}try{sessionStorage.setItem(t||va,JSON.stringify(ya))}catch(e){W(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(V.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||va);e&&(ya=JSON.parse(e))}catch{}},[t]),V.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(ya,()=>window.scrollY,e?(t,n)=>ba(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),V.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{W(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function Sa(e,t){let{capture:n}=t||{};V.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Ca(e,{relative:t}={}){let n=V.useContext(Dr);U(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=da(`useViewTransitionState`),i=Gr(e,{relative:t});if(!n.isTransitioning)return!1;let a=tr(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=tr(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Zn(i.pathname,o)!=null||Zn(i.pathname,a)!=null}var wa=t(a(),1),J=e=>typeof e==`string`,Ta=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},Ea=e=>e==null?``:String(e),Da=(e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})},Oa=/###/g,ka=e=>e&&e.includes(`###`)?e.replace(Oa,`.`):e,Aa=e=>!e||J(e),ja=(e,t,n)=>{let r=J(t)?t.split(`.`):t,i=0;for(;i<r.length-1;){if(Aa(e))return{};let t=ka(r[i]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++i}return Aa(e)?{}:{obj:e,k:ka(r[i])}},Ma=(e,t,n)=>{let{obj:r,k:i}=ja(e,t,Object);if(r!==void 0||t.length===1){r[i]=n;return}let a=t[t.length-1],o=t.slice(0,t.length-1),s=ja(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=ja(e,o,Object),s?.obj&&s.obj[`${s.k}.${a}`]!==void 0&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},Na=(e,t,n,r)=>{let{obj:i,k:a}=ja(e,t,Object);i[a]=i[a]||[],i[a].push(n)},Pa=(e,t)=>{let{obj:n,k:r}=ja(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},Fa=(e,t,n)=>{let r=Pa(e,n);return r===void 0?Pa(t,n):r},Ia=(e,t,n)=>{for(let r in t)r!==`__proto__`&&r!==`constructor`&&(Object.prototype.hasOwnProperty.call(e,r)?J(e[r])||e[r]instanceof String||J(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):Ia(e[r],t[r],n):e[r]=t[r]);return e},La=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`),Ra={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`,"/":`/`},za=e=>J(e)?e.replace(/[&<>"'\/]/g,e=>Ra[e]):e,Ba=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(t!==void 0)return t;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}},Va=[` `,`,`,`?`,`!`,`;`],Ha=new Ba(20),Ua=(e,t,n)=>{t=t||``,n=n||``;let r=Va.filter(e=>!t.includes(e)&&!n.includes(e));if(r.length===0)return!0;let i=Ha.getRegExp(`(${r.map(e=>e===`?`?`\\?`:e).join(`|`)})`),a=!i.test(e);if(!a){let t=e.indexOf(n);t>0&&!i.test(e.substring(0,t))&&(a=!0)}return a},Wa=(e,t,n=`.`)=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let r=t.split(n),i=e;for(let e=0;e<r.length;){if(!i||typeof i!=`object`)return;let t,a=``;for(let o=e;o<r.length;++o)if(o!==e&&(a+=n),a+=r[o],t=i[a],t!==void 0){if([`string`,`number`,`boolean`].includes(typeof t)&&o<r.length-1)continue;e+=o-e+1;break}i=t}return i},Ga=e=>e?.replace(/_/g,`-`),Ka={type:`logger`,log(e){this.output(`log`,e)},warn(e){this.output(`warn`,e)},error(e){this.output(`error`,e)},output(e,t){console?.[e]?.apply?.(console,t)}},qa=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||Ka,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,`log`,``,!0)}warn(...e){return this.forward(e,`warn`,``,!0)}error(...e){return this.forward(e,`error`,``)}deprecate(...e){return this.forward(e,`warn`,`WARNING DEPRECATED: `,!0)}forward(e,t,n,r){return r&&!this.debug?null:(e=e.map(e=>J(e)?e.replace(/[\r\n\x00-\x1F\x7F]/g,` `):e),J(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},Ja=class{constructor(){this.observers={}}on(e,t){return e.split(` `).forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}once(e,t){let n=(...r)=>{t(...r),this.off(e,n)};return this.on(e,n),this}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r<n;r++)e(...t)}),this.observers[`*`]&&Array.from(this.observers[`*`].entries()).forEach(([n,r])=>{for(let i=0;i<r;i++)n(e,...t)})}},Ya=class extends Ja{constructor(e,t={ns:[`translation`],defaultNS:`translation`}){super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.includes(e)||this.options.ns.push(e)}removeNamespaces(e){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n,r={}){let i=r.keySeparator===void 0?this.options.keySeparator:r.keySeparator,a=r.ignoreJSONStructure===void 0?this.options.ignoreJSONStructure:r.ignoreJSONStructure,o;e.includes(`.`)?o=e.split(`.`):(o=[e,t],n&&(Array.isArray(n)?o.push(...n):J(n)&&i?o.push(...n.split(i)):o.push(n)));let s=Pa(this.data,o);return!s&&!t&&!n&&e.includes(`.`)&&(e=o[0],t=o[1],n=o.slice(2).join(`.`)),s||!a||!J(n)?s:Wa(this.data?.[e]?.[t],n,i)}addResource(e,t,n,r,i={silent:!1}){let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=[e,t];n&&(o=o.concat(a?n.split(a):n)),e.includes(`.`)&&(o=e.split(`.`),r=t,t=o[1]),this.addNamespaces(t),Ma(this.data,o,r),i.silent||this.emit(`added`,e,t,n,r)}addResources(e,t,n,r={silent:!1}){for(let r in n)(J(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit(`added`,e,t,n)}addResourceBundle(e,t,n,r,i,a={silent:!1,skipCopy:!1}){let o=[e,t];e.includes(`.`)&&(o=e.split(`.`),r=n,n=t,t=o[1]),this.addNamespaces(t);let s=Pa(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?Ia(s,n,i):s={...s,...n},Ma(this.data,o,s),a.silent||this.emit(`added`,e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit(`removed`,e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}},Xa={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(e=>{t=this.processors[e]?.process(t,n,r,i)??t}),t}},Za=Symbol(`i18next/PATH_KEY`);function Qa(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===Za?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function $a(e,t){let{[Za]:n}=e(Qa()),r=t?.keySeparator??`.`,i=t?.nsSeparator??`:`,a=t?.enableSelector===`strict`;if(n.length>1&&i){let e=t?.ns,o=a?Array.isArray(e)?e:e?[e]:null:Array.isArray(e)?e:null;if(o&&(a?o:o.length>1?o.slice(1):[]).includes(n[0]))return`${n[0]}${i}${n.slice(1).join(r)}`}return n.join(r)}var eo=e=>!J(e)&&typeof e!=`boolean`&&typeof e!=`number`,to=class e extends Ja{constructor(e,t={}){super(),Da([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=qa.create(`translator`),this.checkedLoadedFor={}}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let n={...t};if(e==null)return!1;let r=this.resolve(e,n);if(r?.res===void 0)return!1;let i=eo(r.res);return!(n.returnObjects===!1&&i)}extractFromKey(e,t){let n=t.nsSeparator===void 0?this.options.nsSeparator:t.nsSeparator;n===void 0&&(n=`:`);let r=t.keySeparator===void 0?this.options.keySeparator:t.keySeparator,i=t.ns||this.options.defaultNS||[],a=n&&e.includes(n),o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!Ua(e,n,r);if(a&&!o){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:J(i)?[i]:i};let a=e.split(n);(n!==r||n===r&&this.options.ns.includes(a[0]))&&(i=a.shift()),e=a.join(r)}return{key:e,namespaces:J(i)?[i]:i}}translate(t,n,r){let i=typeof n==`object`?{...n}:n;if(typeof i!=`object`&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i==`object`&&(i={...i}),i||(i={}),t==null)return``;typeof t==`function`&&(t=$a(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]),t=t.map(e=>typeof e==`function`?$a(e,{...this.options,...i}):String(e));let a=i.returnDetails===void 0?this.options.returnDetails:i.returnDetails,o=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,{key:s,namespaces:c}=this.extractFromKey(t[t.length-1],i),l=c[c.length-1],u=i.nsSeparator===void 0?this.options.nsSeparator:i.nsSeparator;u===void 0&&(u=`:`);let d=i.lng||this.language,f=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()===`cimode`)return f?a?{res:`${l}${u}${s}`,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:`${l}${u}${s}`:a?{res:s,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:s;let p=this.resolve(t,i),m=p?.res,h=p?.usedKey||s,g=p?.exactUsedKey||s,_=[`[object Number]`,`[object Function]`,`[object RegExp]`],v=i.joinArrays===void 0?this.options.joinArrays:i.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,b=i.count!==void 0&&!J(i.count),x=e.hasDefaultValue(i),S=b?this.pluralResolver.getSuffix(d,i.count,i):``,ee=i.ordinal&&b?this.pluralResolver.getSuffix(d,i.count,{ordinal:!1}):``,C=b&&!i.ordinal&&i.count===0,w=C&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${S}`]||i[`defaultValue${ee}`]||i.defaultValue,T=m;y&&!m&&x&&(T=w);let te=eo(T),ne=Object.prototype.toString.apply(T);if(y&&T&&te&&!_.includes(ne)&&!(J(v)&&Array.isArray(T))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,T,{...i,ns:c}):`key '${s} (${this.language})' returned an object instead of string.`;return a?(p.res=e,p.usedParams=this.getUsedParamsDetails(i),p):e}if(o){let e=Array.isArray(T),t=e?[]:{},n=e?g:h;for(let e in T)if(Object.prototype.hasOwnProperty.call(T,e)){let r=`${n}${o}${e}`;x&&!m?t[e]=this.translate(r,{...i,defaultValue:eo(w)?w[e]:void 0,joinArrays:!1,ns:c}):t[e]=this.translate(r,{...i,joinArrays:!1,ns:c}),t[e]===r&&(t[e]=T[e])}m=t}}else if(y&&J(v)&&Array.isArray(m))m=m.join(v),m&&(m=this.extendTranslation(m,t,i,r));else{let e=!1,n=!1;!this.isValidLookup(m)&&x&&(e=!0,m=w),this.isValidLookup(m)||(n=!0,m=s);let a=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&n?void 0:m,c=x&&w!==m&&this.options.updateMissing;if(n||e||c){if(this.logger.log(c?`updateKey`:`missingKey`,d,l,b&&!c?`${s}${this.pluralResolver.getSuffix(d,i.count,i)}`:s,c?w:m),o){let e=this.resolve(s,{...i,keySeparator:!1});e&&e.res&&this.logger.warn(`Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.`)}let e=[],t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo===`fallback`&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else this.options.saveMissingTo===`all`?e=this.languageUtils.toResolveHierarchy(i.lng||this.language):e.push(i.lng||this.language);let n=(e,t,n)=>{let r=x&&n!==m?n:a;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,r,c,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,t,r,c,i),this.emit(`missingKey`,e,l,t,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&b?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,i);C&&i[`defaultValue${this.options.pluralSeparator}zero`]&&!t.includes(`${this.options.pluralSeparator}zero`)&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],s+t,i[`defaultValue${t}`]||w)})}):n(e,s,w))}m=this.extendTranslation(m,t,i,p,r),n&&m===s&&this.options.appendNamespaceToMissingKey&&(m=`${l}${u}${s}`),(n||e)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${u}${s}`:s,e?m:void 0,i))}return a?(p.res=m,p.usedParams=this.getUsedParamsDetails(i),p):m}extendTranslation(e,t,n,r,i){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let a=J(e)&&(n?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:n.interpolation.skipOnVariables),o;if(a){let t=e.match(this.interpolator.nestingRegexp);o=t&&t.length}let s=n.replace&&!J(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),e=this.interpolator.interpolate(e,s,n.lng||this.language||r.usedLng,n),a){let t=e.match(this.interpolator.nestingRegexp),r=t&&t.length;o<r&&(n.nest=!1)}!n.lng&&r&&r.res&&(n.lng=this.language||r.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...e)=>i?.[0]===e[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null):this.translate(...e,t),n)),n.interpolation&&this.interpolator.reset()}let a=n.postProcess||this.options.postProcess,o=J(a)?[a]:a;return e!=null&&o?.length&&n.applyPostProcessor!==!1&&(e=Xa.handle(o,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,r,i,a,o;return J(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>typeof e==`function`?$a(e,{...this.options,...t}):e)),e.forEach(e=>{if(this.isValidLookup(n))return;let s=this.extractFromKey(e,t),c=s.key;r=c;let l=s.namespaces;this.options.fallbackNS&&(l=l.concat(this.options.fallbackNS));let u=t.count!==void 0&&!J(t.count),d=u&&!t.ordinal&&t.count===0,f=t.context!==void 0&&(J(t.context)||typeof t.context==`number`)&&t.context!==``,p=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);l.forEach(e=>{this.isValidLookup(n)||(o=e,!this.checkedLoadedFor[`${p[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(o)&&(this.checkedLoadedFor[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${p.join(`, `)}" won't get resolved as namespace "${o}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`)),p.forEach(r=>{if(this.isValidLookup(n))return;a=r;let o=[c];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(o,c,r,e,t);else{let e;u&&(e=this.pluralResolver.getSuffix(r,t.count,t));let n=`${this.options.pluralSeparator}zero`,i=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(t.ordinal&&e.startsWith(i)&&o.push(c+e.replace(i,this.options.pluralSeparator)),o.push(c+e),d&&o.push(c+n)),f){let r=`${c}${this.options.contextSeparator||`_`}${t.context}`;o.push(r),u&&(t.ordinal&&e.startsWith(i)&&o.push(r+e.replace(i,this.options.pluralSeparator)),o.push(r+e),d&&o.push(r+n))}}let s;for(;s=o.pop();)this.isValidLookup(n)||(i=s,n=this.getResource(r,e,s,t))}))})}),{res:n,usedKey:r,exactUsedKey:i,usedLng:a,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e===``)}getResource(e,t,n,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){let t=[`defaultValue`,`ordinal`,`context`,`replace`,`lng`,`lngs`,`fallbackLng`,`ns`,`keySeparator`,`nsSeparator`,`returnObjects`,`returnDetails`,`joinArrays`,`postProcess`,`interpolation`],n=e.replace&&!J(e.replace),r=n?e.replace:e;if(n&&e.count!==void 0&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(let e of t)delete r[e]}return r}static hasDefaultValue(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&t.startsWith(`defaultValue`)&&e[t]!==void 0)return!0;return!1}},no=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=qa.create(`languageUtils`)}getScriptPartFromCode(e){if(e=Ga(e),!e||!e.includes(`-`))return null;let t=e.split(`-`);return t.length===2||(t.pop(),t[t.length-1].toLowerCase()===`x`)?null:this.formatLanguageCode(t.join(`-`))}getLanguagePartFromCode(e){if(e=Ga(e),!e||!e.includes(`-`))return e;let t=e.split(`-`);return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(J(e)&&e.includes(`-`)){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load===`languageOnly`||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(e)}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;let n=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>e===r?!0:!e.includes(`-`)&&!r.includes(`-`)?!1:!!(e.includes(`-`)&&!r.includes(`-`)&&e.slice(0,e.indexOf(`-`))===r||e.startsWith(r)&&r.length>1))}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e==`function`&&(e=e(t)),J(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}toResolveHierarchy(e,t){let n=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),r=[],i=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return J(e)&&(e.includes(`-`)||e.includes(`_`))?(this.options.load!==`languageOnly`&&i(this.formatLanguageCode(e)),this.options.load!==`languageOnly`&&this.options.load!==`currentOnly`&&i(this.getScriptPartFromCode(e)),this.options.load!==`currentOnly`&&i(this.getLanguagePartFromCode(e))):J(e)&&i(this.formatLanguageCode(e)),n.forEach(e=>{r.includes(e)||i(this.formatLanguageCode(e))}),r}},ro={zero:0,one:1,two:2,few:3,many:4,other:5},io={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})},ao=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=qa.create(`pluralResolver`),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n=Ga(e===`dev`?`en`:e),r=t.ordinal?`ordinal`:`cardinal`,i=JSON.stringify({cleanedCode:n,type:r});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(n,{type:r})}catch{if(typeof Intl>`u`)return this.logger.error(`No Intl support, please use an Intl polyfill!`),io;if(!e.match(/-|_/))return io;let n=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(n,t)}return this.pluralRulesCache[i]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||(n=this.getRule(`dev`,t)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||(n=this.getRule(`dev`,t)),n?n.resolvedOptions().pluralCategories.sort((e,t)=>ro[e]-ro[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:``}${e}`):[]}getSuffix(e,t,n={}){let r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:``}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix(`dev`,t,n))}},oo=(e,t,n,r=`.`,i=!0)=>{let a=Fa(e,t,n);return!a&&i&&J(n)&&(a=Wa(e,n,r),a===void 0&&(a=Wa(t,n,r))),a},so=e=>e.replace(/\$/g,`$$$$`),co=class{constructor(e={}){this.logger=qa.create(`interpolator`),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});let{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:i,prefixEscaped:a,suffix:o,suffixEscaped:s,formatSeparator:c,unescapeSuffix:l,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:p,nestingSuffixEscaped:m,nestingOptionsSeparator:h,maxReplaces:g,alwaysFormat:_}=e.interpolation;this.escape=t===void 0?za:t,this.escapeValue=n===void 0?!0:n,this.useRawValueToEscape=r===void 0?!1:r,this.prefix=i?La(i):a||`{{`,this.suffix=o?La(o):s||`}}`,this.formatSeparator=c||`,`,this.unescapePrefix=l?``:u?La(u):`-`,this.unescapeSuffix=this.unescapePrefix?``:l?La(l):``,this.nestingPrefix=d?La(d):f||La(`$t(`),this.nestingSuffix=p?La(p):m||La(`)`),this.nestingOptionsSeparator=h||`,`,this.maxReplaces=g||1e3,this.alwaysFormat=_===void 0?!1:_,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,`g`);this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,r){let i,a,o,s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=e=>{if(!e.includes(this.formatSeparator)){let i=oo(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(i,void 0,n,{...r,...t,interpolationkey:e}):i}let i=e.split(this.formatSeparator),a=i.shift().trim(),o=i.join(this.formatSeparator).trim();return this.format(oo(t,s,a,this.options.keySeparator,this.options.ignoreJSONStructure),o,n,{...r,...t,interpolationkey:a})};this.resetRegExp(),!this.escapeValue&&typeof e==`string`&&/\$t\([^)]*\{[^}]*\{\{/.test(e)&&this.logger.warn(`nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.`);let l=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,u=r?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:r.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>so(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?so(this.escape(e)):so(e)}].forEach(t=>{for(o=0;i=t.regex.exec(e);){let n=i[1].trim();if(a=c(n),a===void 0)if(typeof l==`function`){let t=l(e,i,r);a=J(t)?t:``}else if(r&&Object.prototype.hasOwnProperty.call(r,n))a=``;else if(u){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),a=``;else!J(a)&&!this.useRawValueToEscape&&(a=Ea(a));let s=t.safeValue(a);if(e=e.replace(i[0],s),u?(t.regex.lastIndex+=a.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t,n={}){let r,i,a,o=(e,t)=>{let n=this.nestingOptionsSeparator;if(!e.includes(n))return e;let r=e.split(RegExp(`${La(n)}[ ]*{`)),i=`{${r[1]}`;e=r[0],i=this.interpolate(i,a);let o=i.match(/'/g),s=i.match(/"/g);((o?.length??0)%2==0&&!s||(s?.length??0)%2!=0)&&(i=i.replace(/'/g,`"`));try{a=JSON.parse(i),t&&(a={...t,...a})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return a.defaultValue&&a.defaultValue.includes(this.prefix)&&delete a.defaultValue,e};for(;r=this.nestingRegexp.exec(e);){let s=[];a={...n},a=a.replace&&!J(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let c=/{.*}/.test(r[1])?r[1].lastIndexOf(`}`)+1:r[1].indexOf(this.formatSeparator);if(c!==-1&&(s=r[1].slice(c).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,c)),i=t(o.call(this,r[1].trim(),a),a),i&&r[0]===e&&!J(i))return i;J(i)||(i=Ea(i)),i||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),i=``),s.length&&(i=s.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:r[1].trim()}),i.trim())),e=e.replace(r[0],i),this.regexp.lastIndex=0}return e}},lo=e=>{let t=e.toLowerCase().trim(),n={};if(e.includes(`(`)){let r=e.split(`(`);t=r[0].toLowerCase().trim();let i=r[1].slice(0,-1);t===`currency`&&!i.includes(`:`)?n.currency||(n.currency=i.trim()):t===`relativetime`&&!i.includes(`:`)?n.range||(n.range=i.trim()):i.split(`;`).forEach(e=>{if(e){let[t,...r]=e.split(`:`),i=r.join(`:`).trim().replace(/^'+|'+$/g,``),a=t.trim();n[a]||(n[a]=i),i===`false`&&(n[a]=!1),i===`true`&&(n[a]=!0),isNaN(i)||(n[a]=parseInt(i,10))}})}return{formatName:t,formatOptions:n}},uo=e=>{let t={};return(n,r,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});let o=r+JSON.stringify(a),s=t[o];return s||(s=e(Ga(r),i),t[o]=s),s(n)}},fo=e=>(t,n,r)=>e(Ga(n),r)(t),po=class{constructor(e={}){this.logger=qa.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?uo:fo;this.formats={number:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t,style:`currency`});return e=>n.format(e)}),datetime:n((e,t)=>{let n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{let n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||`day`)}),list:n((e,t)=>{let n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=uo(t)}format(e,t,n,r={}){if(!t||e==null)return e;let i=t.split(this.formatSeparator),a=[];for(let e=0;e<i.length;e++){let t=i[e];for(;t.indexOf(`(`)>-1&&!t.includes(`)`)&&e+1<i.length;)t=`${t}${this.formatSeparator}${i[++e]}`;a.push(t)}return a.reduce((e,t)=>{let{formatName:i,formatOptions:a}=lo(t);if(this.formats[i]){let t=e;try{let o=r?.formatParams?.[r.interpolationkey]||{},s=o.locale||o.lng||r.locale||r.lng||n;t=this.formats[i](e,s,{...a,...r,...o})}catch(e){this.logger.warn(e)}return t}else this.logger.warn(`there was no format function for ${i}`);return e},e)}},mo=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},ho=class extends Ja{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=qa.create(`backendConnector`),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,r.backend,r)}queueLoad(e,t,n,r){let i={},a={},o={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{let o=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(this.state[o]===1?a[o]===void 0&&(a[o]=!0):(this.state[o]=1,r=!1,a[o]===void 0&&(a[o]=!0),i[o]===void 0&&(i[o]=!0),s[t]===void 0&&(s[t]=!0)))}),r||(o[e]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){let r=e.split(`|`),i=r[0],a=r[1];t&&this.emit(`failedLoading`,i,a,t),!t&&n&&this.store.addResourceBundle(i,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);let o={};this.queue.forEach(n=>{Na(n.loaded,[i],a),mo(n,e),t&&n.errors.push(t),n.pendingCount===0&&!n.done&&(Object.keys(n.loaded).forEach(e=>{o[e]||(o[e]={});let t=n.loaded[e];t.length&&t.forEach(t=>{o[e][t]===void 0&&(o[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit(`loaded`,o),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,i=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:i,callback:a});return}this.readingCalls++;let o=(o,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}if(o&&s&&r<this.maxRetries){setTimeout(()=>{this.read(e,t,n,r+1,i*2,a)},i);return}a(o,s)},s=this.backend[n].bind(this.backend);if(s.length===2){try{let n=s(e,t);n&&typeof n.then==`function`?n.then(e=>o(null,e)).catch(o):o(null,n)}catch(e){o(e)}return}return s(e,t,o)}prepareLoading(e,t,n={},r){if(!this.backend)return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`),r&&r();J(e)&&(e=this.languageUtils.toResolveHierarchy(e)),J(t)&&(t=[t]);let i=this.queueLoad(e,t,n,r);if(!i.toLoad.length)return i.pending.length||r(),null;i.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=``){let n=e.split(`|`),r=n[0],i=n[1];this.read(r,i,`read`,void 0,void 0,(n,a)=>{n&&this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`,n),!n&&a&&this.logger.log(`${t}loaded namespace ${i} for language ${r}`,a),this.loaded(e,n,a)})}saveMissing(e,t,n,r,i,a={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`);return}if(!(n==null||n===``)){if(this.backend?.create){let s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let i;i=c.length===5?c(e,t,n,r,s):c(e,t,n,r),i&&typeof i.then==`function`?i.then(e=>o(null,e)).catch(o):o(null,i)}catch(e){o(e)}else c(e,t,n,r,o,s)}!e||!e[0]||this.store.addResource(e[0],t,n,r)}}},go=()=>({debug:!1,initAsync:!0,ns:[`translation`],defaultNS:[`translation`],fallbackLng:[`dev`],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:`all`,preload:!1,keySeparator:`.`,nsSeparator:`:`,pluralSeparator:`_`,contextSeparator:`_`,enableSelector:!1,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:`fallback`,saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]==`object`&&(t=e[1]),J(e[1])&&(t.defaultValue=e[1]),J(e[2])&&(t.tDescription=e[2]),typeof e[2]==`object`||typeof e[3]==`object`){let n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,prefix:`{{`,suffix:`}}`,formatSeparator:`,`,unescapePrefix:`-`,nestingPrefix:`$t(`,nestingSuffix:`)`,nestingOptionsSeparator:`,`,maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),_o=e=>(J(e.ns)&&(e.ns=[e.ns]),J(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),J(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes(`cimode`)&&(e.supportedLngs=e.supportedLngs.concat([`cimode`])),e),vo=()=>{},yo=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},Y=class e extends Ja{constructor(e={},t){if(super(),this.options=_o(e),this.services={},this.logger=qa,this.modules={external:[]},yo(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e==`function`&&(t=e,e={}),e.defaultNS==null&&e.ns&&(J(e.ns)?e.defaultNS=e.ns:e.ns.includes(`translation`)||(e.defaultNS=e.ns[0]));let n=go();this.options={...n,...this.options,..._o(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!=`function`&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler);let r=e=>e?typeof e==`function`?new e:e:null;if(!this.options.isClone){this.modules.logger?qa.init(r(this.modules.logger),this.options):qa.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:po;let t=new no(this.options);this.store=new Ya(this.options.resources,this.options);let n=this.services;n.logger=qa,n.resourceStore=this.store,n.languageUtils=t,n.pluralResolver=new ao(t,{prepend:this.options.pluralSeparator}),e&&(n.formatter=r(e),n.formatter.init&&n.formatter.init(n,this.options),this.options.interpolation.format=n.formatter.format.bind(n.formatter)),n.interpolator=new co(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new ho(r(this.modules.backend),n.resourceStore,n,this.options),n.backendConnector.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(n.languageDetector=r(this.modules.languageDetector),n.languageDetector.init&&n.languageDetector.init(n,this.options.detection,this.options)),this.modules.i18nFormat&&(n.i18nFormat=r(this.modules.i18nFormat),n.i18nFormat.init&&n.i18nFormat.init(this)),this.translator=new to(this.services,this.options),this.translator.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||(t=vo),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&e[0]!==`dev`&&(this.options.lng=e[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn(`init: no languageDetector is used and no lng is defined`),[`getResource`,`hasResourceBundle`,`getResourceBundle`,`getDataByLanguage`].forEach(e=>{this[e]=(...t)=>this.store[e](...t)}),[`addResource`,`addResources`,`addResourceBundle`,`removeResourceBundle`].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});let i=Ta(),a=()=>{let e=(e,n)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn(`init: i18next is already initialized. You should call init just once!`),this.isInitialized=!0,this.options.isClone||this.logger.log(`initialized`,this.options),this.emit(`initialized`,this.options),i.resolve(n),t(e,n)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?a():setTimeout(a,0),i}loadResources(e,t=vo){let n=t,r=J(e)?e:this.language;if(typeof e==`function`&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()===`cimode`&&(!this.options.preload||this.options.preload.length===0))return n();let e=[],t=t=>{t&&t!==`cimode`&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{t!==`cimode`&&(e.includes(t)||e.push(t))})};r?t(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{!e&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(e)})}else n(null)}reloadResources(e,t,n){let r=Ta();return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),n||(n=vo),this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);if(!e.type)throw Error(`You are passing a wrong module! Please check the object you are passing to i18next.use()`);return e.type===`backend`&&(this.modules.backend=e),(e.type===`logger`||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type===`languageDetector`&&(this.modules.languageDetector=e),e.type===`i18nFormat`&&(this.modules.i18nFormat=e),e.type===`postProcessor`&&Xa.addPostProcessor(e),e.type===`formatter`&&(this.modules.formatter=e),e.type===`3rdParty`&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&![`cimode`,`dev`].includes(e)){for(let e=0;e<this.languages.length;e++){let t=this.languages[e];if(![`cimode`,`dev`].includes(t)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&!this.languages.includes(e)&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;let n=Ta();this.emit(`languageChanging`,e);let r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(i,a)=>{a?this.isLanguageChangingTo===e&&(r(a),this.translator.changeLanguage(a),this.isLanguageChangingTo=void 0,this.emit(`languageChanged`,a),this.logger.log(`languageChanged`,a)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(i,(...e)=>this.t(...e))},a=t=>{!e&&!t&&this.services.languageDetector&&(t=[]);let n=J(t)?t:t&&t[0],a=this.store.hasLanguageSomeTranslations(n)?n:this.services.languageUtils.getBestMatchFromCodes(J(t)?[t]:t);a&&(this.language||r(a),this.translator.language||this.translator.changeLanguage(a),this.services.languageDetector?.cacheUserLanguage?.(a)),this.loadResources(a,e=>{i(e,a)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),n}getFixedT(e,t,n,r){let i=r?.scopeNs,a=(e,t,...r)=>{let o;o=typeof t==`object`?{...t}:this.options.overloadTranslationOptionHandler([e,t].concat(r)),o.lng=o.lng||a.lng,o.lngs=o.lngs||a.lngs;let s=o.ns!==void 0&&o.ns!==null;o.ns=o.ns||a.ns,o.keyPrefix!==``&&(o.keyPrefix=o.keyPrefix||n||a.keyPrefix);let c={...this.options,...o};Array.isArray(i)&&!s&&(c.ns=i),typeof o.keyPrefix==`function`&&(o.keyPrefix=$a(o.keyPrefix,c));let l=this.options.keySeparator||`.`,u;return o.keyPrefix&&Array.isArray(e)?u=e.map(e=>(typeof e==`function`&&(e=$a(e,c)),`${o.keyPrefix}${l}${e}`)):(typeof e==`function`&&(e=$a(e,c)),u=o.keyPrefix?`${o.keyPrefix}${l}${e}`:e),this.t(u,o)};return J(e)?a.lng=e:a.lngs=e,a.ns=t,a.keyPrefix=n,a}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn(`hasLoadedNamespace: i18next was not initialized`,this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn(`hasLoadedNamespace: i18n.languages were undefined or empty`,this.languages),!1;let n=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(n.toLowerCase()===`cimode`)return!0;let a=(e,t)=>{let n=this.services.backendConnector.state[`${e}|${t}`];return n===-1||n===0||n===2};if(t.precheck){let e=t.precheck(this,a);if(e!==void 0)return e}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(n,e)&&(!r||a(i,e)))}loadNamespaces(e,t){let n=Ta();return this.options.ns?(J(e)&&(e=[e]),e.forEach(e=>{this.options.ns.includes(e)||this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){let n=Ta();J(e)&&(e=[e]);let r=this.options.preload||[],i=e.filter(e=>!r.includes(e)&&this.services.languageUtils.isSupportedCode(e));return i.length?(this.options.preload=r.concat(i),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return`rtl`;try{let t=new Intl.Locale(e);if(t&&t.getTextInfo){let e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch{}let t=`ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb`.split(`.`),n=this.services?.languageUtils||new no(go());return e.toLowerCase().indexOf(`-latn`)>1?`ltr`:t.includes(n.getLanguagePartFromCode(e))||e.toLowerCase().indexOf(`-arab`)>1?`rtl`:`ltr`}static createInstance(t={},n){let r=new e(t,n);return r.createInstance=e.createInstance,r}cloneInstance(t={},n=vo){let r=t.forkResourceStore;r&&delete t.forkResourceStore;let i={...this.options,...t,isClone:!0},a=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(a.logger=a.logger.clone(t)),[`store`,`services`,`language`].forEach(e=>{a[e]=this[e]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},r&&(a.store=new Ya(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{}),i),a.services.resourceStore=a.store),t.interpolation){let e={...go().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new co(n)}return a.translator=new to(a.services,i),a.translator.on(`*`,(e,...t)=>{a.emit(e,...t)}),a.init(i,n),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}.createInstance();Y.createInstance,Y.dir,Y.init,Y.loadResources,Y.reloadResources,Y.use,Y.changeLanguage,Y.getFixedT,Y.t,Y.exists,Y.setDefaultNamespace,Y.hasLoadedNamespace,Y.loadNamespaces,Y.loadLanguages;var{slice:bo,forEach:xo}=[];function So(e){return xo.call(bo.call(arguments,1),t=>{if(t)for(let n in t)e[n]===void 0&&(e[n]=t[n])}),e}function Co(e){return typeof e==`string`?[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(t=>t.test(e)):!1}var wo=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,To=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:`/`},r=`${e}=${encodeURIComponent(t)}`;if(n.maxAge>0){let e=n.maxAge-0;if(Number.isNaN(e))throw Error(`maxAge should be a Number`);r+=`; Max-Age=${Math.floor(e)}`}if(n.domain){if(!wo.test(n.domain))throw TypeError(`option domain is invalid`);r+=`; Domain=${n.domain}`}if(n.path){if(!wo.test(n.path))throw TypeError(`option path is invalid`);r+=`; Path=${n.path}`}if(n.expires){if(typeof n.expires.toUTCString!=`function`)throw TypeError(`option expires is invalid`);r+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(r+=`; HttpOnly`),n.secure&&(r+=`; Secure`),n.sameSite)switch(typeof n.sameSite==`string`?n.sameSite.toLowerCase():n.sameSite){case!0:r+=`; SameSite=Strict`;break;case`lax`:r+=`; SameSite=Lax`;break;case`strict`:r+=`; SameSite=Strict`;break;case`none`:r+=`; SameSite=None`;break;default:throw TypeError(`option sameSite is invalid`)}return n.partitioned&&(r+=`; Partitioned`),r},Eo={create(e,t,n,r){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:`/`,sameSite:`strict`};n&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+n*60*1e3)),r&&(i.domain=r),document.cookie=To(e,t,i)},read(e){let t=`${e}=`,n=document.cookie.split(`;`);for(let e=0;e<n.length;e++){let r=n[e];for(;r.charAt(0)===` `;)r=r.substring(1,r.length);if(r.indexOf(t)===0)return r.substring(t.length,r.length)}return null},remove(e,t){this.create(e,``,-1,t)}},Do={name:`cookie`,lookup(e){let{lookupCookie:t}=e;if(t&&typeof document<`u`)return Eo.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:n,cookieMinutes:r,cookieDomain:i,cookieOptions:a}=t;n&&typeof document<`u`&&Eo.create(n,e,r,i,a)}},Oo={name:`querystring`,lookup(e){let{lookupQuerystring:t}=e,n;if(typeof window<`u`){let{search:e}=window.location;!window.location.search&&window.location.hash?.indexOf(`?`)>-1&&(e=window.location.hash.substring(window.location.hash.indexOf(`?`)));let r=e.substring(1).split(`&`);for(let e=0;e<r.length;e++){let i=r[e].indexOf(`=`);i>0&&r[e].substring(0,i)===t&&(n=r[e].substring(i+1))}}return n}},ko={name:`hash`,lookup(e){let{lookupHash:t,lookupFromHashIndex:n}=e,r;if(typeof window<`u`){let{hash:e}=window.location;if(e&&e.length>2){let i=e.substring(1);if(t){let e=i.split(`&`);for(let n=0;n<e.length;n++){let i=e[n].indexOf(`=`);i>0&&e[n].substring(0,i)===t&&(r=e[n].substring(i+1))}}if(r)return r;if(!r&&n>-1){let t=e.match(/\/([a-zA-Z-]*)/g);return Array.isArray(t)?t[typeof n==`number`?n:0]?.replace(`/`,``):void 0}}}return r}},Ao=null,jo=()=>{if(Ao!==null)return Ao;try{if(Ao=typeof window<`u`&&window.localStorage!==null,!Ao)return!1;let e=`i18next.translate.boo`;window.localStorage.setItem(e,`foo`),window.localStorage.removeItem(e)}catch{Ao=!1}return Ao},Mo={name:`localStorage`,lookup(e){let{lookupLocalStorage:t}=e;if(t&&jo())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:n}=t;n&&jo()&&window.localStorage.setItem(n,e)}},No=null,Po=()=>{if(No!==null)return No;try{if(No=typeof window<`u`&&window.sessionStorage!==null,!No)return!1;let e=`i18next.translate.boo`;window.sessionStorage.setItem(e,`foo`),window.sessionStorage.removeItem(e)}catch{No=!1}return No},Fo={name:`sessionStorage`,lookup(e){let{lookupSessionStorage:t}=e;if(t&&Po())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:n}=t;n&&Po()&&window.sessionStorage.setItem(n,e)}},Io={name:`navigator`,lookup(e){let t=[];if(typeof navigator<`u`){let{languages:e,userLanguage:n,language:r}=navigator;if(e)for(let n=0;n<e.length;n++)t.push(e[n]);n&&t.push(n),r&&t.push(r)}return t.length>0?t:void 0}},Lo={name:`htmlTag`,lookup(e){let{htmlTag:t}=e,n,r=t||(typeof document<`u`?document.documentElement:null);return r&&typeof r.getAttribute==`function`&&(n=r.getAttribute(`lang`)),n}},Ro={name:`path`,lookup(e){let{lookupFromPathIndex:t}=e;if(typeof window>`u`)return;let n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(Array.isArray(n))return n[typeof t==`number`?t:0]?.replace(`/`,``)}},zo={name:`subdomain`,lookup(e){let{lookupFromSubdomainIndex:t}=e,n=typeof t==`number`?t+1:1,r=typeof window<`u`&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[n]}},Bo=!1;try{document.cookie,Bo=!0}catch{}var Vo=[`querystring`,`cookie`,`localStorage`,`sessionStorage`,`navigator`,`htmlTag`];Bo||Vo.splice(1,1);var Ho=()=>({order:Vo,lookupQuerystring:`lng`,lookupCookie:`i18next`,lookupLocalStorage:`i18nextLng`,lookupSessionStorage:`i18nextLng`,caches:[`localStorage`],excludeCacheFor:[`cimode`],convertDetectedLanguage:e=>e}),Uo=class{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type=`languageDetector`,this.detectors={},this.init(e,t)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e,this.options=So(t,this.options||{},Ho()),typeof this.options.convertDetectedLanguage==`string`&&this.options.convertDetectedLanguage.indexOf(`15897`)>-1&&(this.options.convertDetectedLanguage=e=>e.replace(`-`,`_`)),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(Do),this.addDetector(Oo),this.addDetector(Mo),this.addDetector(Fo),this.addDetector(Io),this.addDetector(Lo),this.addDetector(Ro),this.addDetector(zo),this.addDetector(ko)}addDetector(e){return this.detectors[e.name]=e,this}detect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,t=[];return e.forEach(e=>{if(this.detectors[e]){let n=this.detectors[e].lookup(this.options);n&&typeof n==`string`&&(n=[n]),n&&(t=t.concat(n))}}),t=t.filter(e=>e!=null&&!Co(e)).map(e=>this.options.convertDetectedLanguage(e)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?t:t.length>0?t[0]:null}cacheUserLanguage(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||t.forEach(t=>{this.detectors[t]&&this.detectors[t].cacheUserLanguage(e,this.options)}))}};Uo.type=`languageDetector`;var Wo={common:{loading:`Loading...`,save:`Save`,saving:`Saving...`,cancel:`Cancel`,delete:`Delete`,edit:`Edit`,close:`Close`,back:`Back`,next:`Next`,confirm:`Confirm`,error:`Error`,success:`Success`,warning:`Warning`,or:`or`,optional:`optional`,enabled:`Enabled`,disabled:`Disabled`,on:`On`,off:`Off`,yes:`Yes`,no:`No`,search:`Search`,noResults:`No results found`,retry:`Retry`,refresh:`Refresh`,download:`Download`,upload:`Upload`,export:`Export`,import:`Import`,reset:`Reset`,apply:`Apply`,clear:`Clear`,all:`All`,none:`None`,default:`Default`,custom:`Custom`,remove:`Remove`},brand:{name:`Libre WebUI`,shortName:`Libre`},auth:{login:{title:`Welcome Back`,subtitle:`Sign in to your account to continue`,username:`Username`,usernamePlaceholder:`Enter your username`,password:`Password`,passwordPlaceholder:`Enter your password`,signIn:`Sign In`,signingIn:`Signing in...`,noAccount:`Don't have an account?`,signUpHere:`Sign up here`,loginSuccess:`Login successful!`,loginFailed:`Login failed`,checkCredentials:`Login failed. Please check your credentials.`,enterBoth:`Please enter both username and password`,githubSuccess:`GitHub login successful!`,githubFailed:`GitHub authentication failed`,githubVerifyFailed:`Failed to verify GitHub authentication`},signup:{title:`Create Account`,subtitle:`Sign up for your new account`,username:`Username`,usernamePlaceholder:`Choose a username`,email:`Email`,emailPlaceholder:`your@email.com`,password:`Password`,passwordPlaceholder:`Choose a password`,confirmPassword:`Confirm Password`,confirmPasswordPlaceholder:`Confirm your password`,createAccount:`Create Account`,creatingAccount:`Creating account...`,hasAccount:`Already have an account?`,signInHere:`Sign in here`,signupSuccess:`Account created successfully!`,signupFailed:`Signup failed`,tryAgain:`Signup failed. Please try again.`,usernameRequired:`Username and password are required`,passwordMismatch:`Passwords do not match`,passwordTooShort:`Password must be at least 6 characters long`},logout:{button:`Log out`,success:`Logged out successfully`},oauth:{continueWith:`Continue with {{provider}}`,connectingTo:`Connecting to {{provider}}...`,github:`GitHub`,huggingFace:`Hugging Face`},checkingAuth:`Checking authentication...`,welcome:`Welcome`,noEmail:`No email provided`,role:`Role`,id:`ID`,userId:`User ID`,signInDescription:`Sign in with your GitHub account to continue`,signInWithGitHub:`Sign in with GitHub`,jwtActive:`JWT Authentication Active`,jwtDescription:`JWT-based authentication with GitHub OAuth`,github:`GitHub`,provider:`Provider`},setup:{welcome:{title:`Welcome to Libre WebUI`,subtitle:`Let's Get Started`,description:`Set up your Libre WebUI instance in just a few steps`,createAdmin:`Create Admin Account`,features:{secure:{title:`Secure & Private`,description:`Your conversations stay on your device`},fast:{title:`Fast & Responsive`,description:`Optimized for speed and performance`},openSource:{title:`Open Source`,description:`Free and open source software`}}},admin:{title:`Create Admin Account`,subtitle:`Administrator Setup`,description:`Create the first admin account for your Libre WebUI instance`,usernamePlaceholder:`Enter admin username`,passwordPlaceholder:`Enter password (min 6 characters)`,confirmPlaceholder:`Confirm your password`,creating:`Creating...`,createAdmin:`Create Admin`,success:`Admin account created successfully!`,failed:`Failed to create admin account`,fillAllFields:`Please fill in all fields`,note:`This will be the primary administrator account for your Libre WebUI instance`},encryptionKey:{title:`Save Your Encryption Key`,subtitle:`Important: Save This Key`,description:`This encryption key protects your sensitive data. Store it securely - you'll need it if you ever need to restore your database.`,warning:`Warning`,warningText:`If you lose this key and need to restore your database, your encrypted data (API keys, preferences) will be unrecoverable.`,label:`Your Encryption Key`,loading:`Loading...`,copyToClipboard:`Copy to clipboard`,copied:`Encryption key copied to clipboard!`,copyFailed:`Failed to copy key to clipboard`,envNote:`This key is also saved in your backend/.env file as ENCRYPTION_KEY`,acknowledgment:`I have saved my encryption key in a secure location and understand that losing it may result in data loss.`,confirmRequired:`Please confirm that you have saved the encryption key`,continue:`Continue to Libre WebUI`}},chat:{greeting:{morning:`Good morning`,afternoon:`Good afternoon`,evening:`Good evening`,night:`Good night`},welcome:{helpToday:`What can I help with today?`,helpTonight:`What can I help with tonight?`,variety:{create:{title:`What should we make?`,subtitle:`Start with a thought, a sketch, or a stubborn problem.`},explore:{title:`Where should we begin?`,subtitle:`Bring the question you keep returning to.`},imagine:{title:`What are you imagining?`,subtitle:`We can shape it together.`},focus:{title:`What deserves your attention?`,subtitle:`Let's make the next step clear.`},untangle:{title:`What's tangled?`,subtitle:`Give me the messy version first.`},momentum:{title:`Ready when you are.`,subtitle:`Pick up an idea, plan, or unfinished thread.`},open:{title:`What's on your mind?`,subtitle:`Small thought or ambitious project. Both work.`},challenge:{title:`What are we solving?`,subtitle:`Tell me what isn't working yet.`},draft:{title:`Let's start somewhere.`,subtitle:`It doesn't have to be polished.`},possibility:{title:`What could this become?`,subtitle:`Show me the raw material.`},unexpected:{title:`Make something unexpected.`,subtitle:`Give me a constraint, a mood, or a half-formed idea.`}}},input:{placeholder:`Send a message`,messagePlaceholder:`Message...`,attachImages:`Attach images`,attachments:`Attachments and advanced features`,sendMessage:`Send message`,stopGeneration:`Stop generation`},session:{new:`New Chat`,private:`Private`,privateMode:`Private Mode`,privateDescription:`This conversation won't be saved`,privateTooltip:`Start a private conversation that won't be saved`,deleteConfirm:`Are you sure you want to delete this chat?`,generatingTitle:`Generating title`,noChats:`No chats yet`,createFirst:`Create your first chat above`,chats:`Chats`,renameChat:`Rename chat`,deleteChat:`Delete chat`},persona:{applied:`Persona applied`,label:`Persona`},model:{updated:`Model updated`,noModels:`No models available`,noModelsDescription:`No models available. Make sure Ollama is running and has models installed.`,pullCommand:`ollama pull llama3.2:3b`,noModelsTooltip:`No models available. Please ensure Ollama is running and models are installed.`},footer:{disclaimer:`LLM can make mistakes - verify important information`,images:`{{count}} image`,images_plural:`{{count}} images`,structuredOutput:`Structured output`},mediaUpload:{dropImagesHere:`Drop images here or`,supportedFormats:`Supports: JPG, PNG, GIF, WebP (max 10MB each)`,browse:`browse`},structuredOutput:{title:`Response Format`,none:`None (Natural Language)`,noneDescription:`Default natural language response`,json:`JSON`,jsonDescription:`Structured JSON format`,list:`List`,listDescription:`Array of items`,summary:`Summary`,summaryDescription:`Document summary with key points`,analysis:`Analysis`,analysisDescription:`Structured analysis with pros/cons`,custom:`Custom Schema`,customDescription:`Define your own JSON schema`,customSchema:`Custom JSON schema`,schemaPreview:`Schema Preview`,applySchema:`Apply Schema`,cancel:`Cancel`,enabled:`Structured output enabled`}},sidebar:{navigation:{chat:`Chat`,models:`Models`,personas:`Personas`,imagine:`Imagine`,agents:`Libre Claw`,settings:`Settings`,userManagement:`User Management`,signOut:`Sign Out`},toggleSize:`Toggle sidebar size`,expandSidebar:`Expand sidebar`},user:{menu:{changePicture:`Change Picture`,settings:`Settings`,userManagement:`User Management`,logout:`Log out`},avatar:{title:`Change Profile Picture`,updated:`Profile picture updated`,updateFailed:`Failed to update profile picture`,saving:`Saving...`,label:`Avatar`,uploadAvatarImage:`Upload avatar image`,dragAndDrop:`Drag and drop an image or click to browse`,chooseImage:`Choose Image`,uploading:`Uploading...`,enterImageUrl:`Or enter image URL`,supportedFormats:`Supports: JPG, PNG, GIF, WebP (max 2MB). Square images work best.`,customAvatar:`Custom avatar image`,clickToChange:`Click to change or remove`,removed:`Avatar removed`,uploaded:`Avatar uploaded successfully`,invalidFile:`Please select a valid image file`,fileTooLarge:`Avatar image size must be less than 2MB`,readFailed:`Failed to read image file`,uploadFailed:`Failed to upload avatar image`},profile:{noEmail:`No email provided`}},settings:JSON.parse(`{"title":"Settings","tabs":{"appearance":"Appearance","model":"Model","systemMessage":"System Message","plugins":"Plugins","generation":"Generation","documents":"Documents","tts":"Text-to-Speech","imageGen":"Image Generation","data":"Data","about":"About"},"appearance":{"title":"Appearance","language":{"title":"Language","description":"Select your preferred language"},"theme":{"title":"Theme","light":"Light","dark":"Dark","amoled":"Pure Black","system":"System"},"accent":{"title":"Accent color","custom":"Custom color","useColor":"Use {{color}} accent","behaviorTitle":"Interface palette","behaviorDescription":"Choose whether the accent stays on controls or adapts the entire light or dark interface.","defaultStyle":"Default","defaultStyleDescription":"Keep the neutral light and dark surfaces.","adaptedStyle":"Adapt to accent","adaptedStyleDescription":"Tint surfaces, borders, and text with your accent."},"chatInterface":{"title":"Chat Interface","showUsername":"Show Username","showUsernameDescription":"Display username in chat messages"},"background":{"title":"Background Image","enable":"Enable background image","enableDescription":"Show custom background with blur effect","blur":"Blur","opacity":"Opacity","upload":"Upload background image","dragDrop":"Drag and drop an image or click to browse","chooseImage":"Choose Image"}},"saveSettings":"Save Settings","model":{"title":"Model Settings","defaultModel":"Default Model","defaultModelDescription":"This model will be used by default for new conversations","selectModel":"Select a model","persona":"Persona","updateAll":"Update All Models","updateAllDescription":"Check for updates and pull latest versions of all installed models","updateAllButton":"Update All","updating":"Updating models...","currentModelInfo":"Current Model Info","name":"Name","size":"Size","family":"Family","format":"Format","status":"Status","statusStarting":"Starting...","statusComplete":"Complete","statusError":"Error","bulkOperations":"Bulk Operations","autoTitle":{"title":"Auto Title Generation","enable":"Enable Auto Title","enableDescription":"Automatically generate titles for new conversations","taskModel":"Task Model","selectTaskModel":"Select task model","taskModelDescription":"Model used for generating conversation titles"},"updatingModel":"Updating {{name}} ({{current}}/{{total}})","modelsProgress":"{{current}} of {{total}} models","modelPullAccess":"Model Install Access","modelPullAccessDescription":"Allow non-admin users to pull and install new models.","modelPullAccessSaved":"Model install permissions updated","modelPullAccessSaveFailed":"Failed to update model install permissions"},"systemMessage":{"title":"System Message","description":"Set a custom system message that will be used for all new conversations.","placeholder":"Enter a system message...","saved":"System message saved","saveFailed":"Failed to save system message"},"plugins":{"title":"Plugins","description":"Manage your installed plugins","addNew":"Add New Plugin","upload":"Upload Plugin","addJson":"Add JSON","uploading":"Uploading...","jsonPlaceholder":"Paste plugin JSON configuration...","install":"Install Plugin","noPlugins":"No plugins installed","noPluginsDescription":"Add a plugin to extend functionality","loading":"Loading plugins...","installed":"Installed Plugins","active":"Active Plugins","activeLabel":"Active","inactive":"Inactive","activate":"Activate","deactivate":"Deactivate","models":"models","apiKeySet":"API Key Set","apiKeyConfiguration":"API Key Configuration","apiKeyEnvAlternative":"Alternatively, set the","environmentVariable":"environment variable","apiKeyConfigured":"API key configured","apiKeyPlaceholder":"Enter your API key...","saveApiKey":"Save API Key","apiKey":{"title":"API Key","placeholder":"Enter API key","save":"Save Key","remove":"Remove Key","configured":"API Key Configured","notConfigured":"API Key Required","saved":"API key saved successfully","removed":"API key removed","saveFailed":"Failed to save API key","removeFailed":"Failed to remove API key","enterKey":"Please enter an API key"},"variables":"Variables"},"generation":{"title":"Generation Options","description":"Configure how the AI generates responses","coreParameters":"Core Parameters","temperature":"Temperature","temperatureDescription":"Controls randomness. Lower values are more focused, higher values more creative.","topP":"Top P","topPDescription":"Controls diversity via nucleus sampling. Lower values focus on likely tokens.","topK":"Top K","topKDescription":"Limits token selection to top K most likely. Set to 0 to disable.","minP":"Min P","minPDescription":"Minimum probability threshold for token selection.","generationControl":"Generation Control","maxTokens":"Max Tokens","maxTokensDescription":"Maximum number of tokens to generate in the response.","repeatPenalty":"Repeat Penalty","repeatPenaltyDescription":"Penalizes repeated tokens. Higher values reduce repetition.","contextLength":"Context Length","contextLengthDescription":"Maximum context window size for conversations.","seed":"Seed","optional":"optional","random":"Random","seedDescription":"Set a specific seed for reproducible outputs.","advancedOptions":"Advanced Options","presencePenalty":"Presence Penalty","presencePenaltyDescription":"Penalizes tokens that appear in the context.","frequencyPenalty":"Frequency Penalty","frequencyPenaltyDescription":"Penalizes frequently used tokens.","stopSequences":"Stop Sequences","commaSeparated":"comma separated","stopSequencesDescription":"Custom tokens that will stop generation when encountered.","resetDefaults":"Reset to Defaults","saveOptions":"Save Options","embeddingSettings":"Embedding Settings","enableEmbeddings":"Enable Document Embeddings"},"documents":{"title":"Document Settings","embeddings":{"title":"Embeddings","enable":"Enable document embeddings","model":"Embedding Model","modelDescription":"Select the model used for document embedding","chunkSize":"Chunk Size","chunkSizeInTokens":"(in tokens)","chunkSizeDescription":"Size of text chunks for embedding","chunkOverlap":"Chunk Overlap","chunkOverlapInTokens":"(in tokens)","chunkOverlapDescription":"Overlap between consecutive chunks","similarityThreshold":"Similarity Threshold","similarityDescription":"Minimum similarity score to include results","status":"Embedding Status","statusLabel":"Status","available":"Available","unavailable":"Unavailable","chunksWithEmbeddings":"Chunks with embeddings","coverage":"Coverage","regenerate":"Regenerate Embeddings","regenerating":"Regenerating..."}},"tts":{"title":"Text-to-Speech","description":"Configure text-to-speech settings for reading messages aloud","loadingProviders":"Loading TTS providers...","noProviders":"No TTS Providers","noProvidersDescription":"Configure a plugin with TTS support to enable text-to-speech","enable":"Enable TTS","enableDescription":"Allow text-to-speech for assistant messages","autoPlay":"Auto-play Responses","autoPlayDescription":"Automatically read new assistant messages aloud","streamSentences":"Stream Sentences","streamSentencesDescription":"Play audio sentence by sentence instead of waiting for the full message. Recommended for local TTS to avoid timeouts on long messages.","voiceConfiguration":"Voice Configuration","model":"TTS Model","modelDescription":"Select the model for text-to-speech generation","voice":"Voice","selectVoice":"Select a voice","voiceDescription":"Choose the voice for text-to-speech","speed":"Speed","speedSlow":"0.5x","speedNormal":"1.0x","speedFast":"2.0x","availableProviders":"Available Providers","models":"models","test":"Test","testing":"Testing...","stop":"Stop"},"imageGen":{"title":"Image Generation","description":"Configure image generation settings and providers","loadingProviders":"Loading image generation providers...","noProviders":"No Image Generation Providers","noProvidersDescription":"Configure a plugin with image generation support","enable":"Enable Image Generation","enableDescription":"Allow AI image generation in conversations","configuration":"Configuration","model":"Model","modelDescription":"Select the model for image generation","size":"Size","sizeDescription":"Resolution of generated images","quality":"Quality","qualityDescription":"Quality level of generated images","style":"Style","styleDescription":"Style preset for generated images","availableProviders":"Available Providers","models":"models"},"data":{"title":"Data Management","export":"Export Data","exportDescription":"Download all your data including preferences, sessions, and documents.","exportAll":"Export All Data","import":"Import Data","importDescription":"Import data from a previous export.","importData":"Import Data","importing":"Importing...","clearSessions":"Clear Sessions","clearSessionsDescription":"Delete all chat sessions. This action cannot be undone.","clearAll":"Clear All","clearing":"Clearing...","importOptions":"Import Options","importOptionsDescription":"Choose how to handle existing data","skipDuplicates":"Skip duplicates","overwrite":"Overwrite existing","importResults":"Import Results","preferences":"Preferences","imported":"Imported","failed":"Failed","sessions":"Sessions","importedLabel":"imported","skipped":"skipped","documents":"Documents","errors":"Errors"},"about":{"title":"About","versionLabel":"Version","ollama":{"title":"Ollama Status","version":"Version","healthy":"Healthy","unhealthy":"Unhealthy"},"stats":{"models":"Models","sessions":"Sessions"},"features":{"privacy":{"title":"Privacy First","description":"Your data stays on your device"},"openSource":{"title":"Open Source","description":"Free and open source software"},"localInference":{"title":"Local Inference","description":"Run AI models locally with Ollama"}},"openSourceBy":"Open source by {{company}}","links":{"title":"Links","github":"GitHub","githubDescription":"View source code and contribute","website":"Website","websiteDescription":"Visit our website","ollama":"Ollama","ollamaDescription":"Learn more about Ollama","documentation":"Documentation","reportIssue":"Report Issues","reportIssueDescription":"Bug reports & feature requests","gitlab":"GitLab Mirror","gitlabDescription":"Self-hosted GitLab repository","documentationDescription":"Guides, tutorials and API reference"},"version":"Version {{version}}"}}`),models:{title:`Models`,subtitle:`Pull, manage, and monitor your Ollama models`,installed:`Installed Models`,available:`Available Models`,pull:`Pull Model`,pulling:`Pulling...`,delete:`Delete Model`,deleting:`Deleting...`,size:`Size`,modified:`Modified`,family:`Family`,parameters:`Parameters`,quantization:`Quantization`,noModels:`No models installed`,pullFirst:`Pull a model to get started`,noModelsFound:`No models found`},personas:{title:`Personas`,create:`Create Persona`,edit:`Edit Persona`,delete:`Delete Persona`,name:`Name`,description:`Description`,systemPrompt:`System Prompt`,model:`Model`,avatar:`Avatar`,background:`Background`,noPersonas:`No personas created`,createFirst:`Create your first persona to customize your chat experience`},gallery:{title:`Gallery`,subtitle:`Your AI-generated image gallery`,imageCount:`{{count}} images`,generate:`Generate Image`,generateDescription:`Create images with AI`,generating:`Generating...`,prompt:`Prompt`,promptPlaceholder:`Describe the image you want to generate...`,noImages:`No images generated yet`,download:`Download`,delete:`Delete`,regenerate:`Regenerate`,model:`Model`,size:`Size`,quality:`Quality`,created:`Created`},errors:{generic:`An error occurred`,network:`Network error. Please check your connection.`,unauthorized:`You are not authorized to perform this action.`,notFound:`The requested resource was not found.`,serverError:`Server error. Please try again later.`,validation:`Please check your input and try again.`},keyboard:{title:`Keyboard Shortcuts`,toggleSidebar:`Toggle sidebar`,openSettings:`Open settings`,toggleDarkMode:`Toggle dark mode`,showShortcuts:`Show keyboard shortcuts`,closeModals:`Close modals`,groups:{navigation:`Navigation`,settings:`Settings`,general:`General`,chat:`Chat`},actions:{sendMessage:`Send message`,newLine:`New line in message`},footer:`Press {{key1}} or {{key2}} to show this help`,tooltip:`Keyboard shortcuts`},modelManager:{title:`Models`,loading:`Loading models...`,systemStatus:{online:`Ollama Online`,offline:`Ollama Offline`,models:`model`,models_plural:`models`,running:`running`,vram:`VRAM`},sections:{pull:`Pull New Model`,library:`Browse Library`,huggingface:`HuggingFace Hub`,running:`Running Models`,local:`Local Models`,advanced:`Advanced Actions`},pull:{placeholder:`Enter model name (e.g., llama3.2:3b, deepseek-r1:14b)`,button:`Pull`,cancel:`Cancel`,popular:`Popular models:`,browseAll:`Browse all models on ollama.com`,success:`Model {{name}} pulled successfully`,cancelled:`Model pull cancelled`,failed:`Failed to pull model`,enterName:`Please enter a model name`,restricted:`Model installation is restricted to administrators on this instance.`},progress:{starting:`Initializing...`,pulling:`Downloading model...`,pullingLayer:`pulling`,verifying:`Verifying integrity...`,verifyingDigest:`verifying sha256 digest`,writing:`Writing manifest...`,cleaning:`Cleaning up...`},library:{available:`available`,search:`Search models...`,noResults:`No models found matching your criteria`,installed:`Installed`,more:`+{{count}} more`,refresh:`Refresh Library`},huggingface:{browseAll:`Browse all on HuggingFace`,checkingGguf:`Checking for GGUF files...`,noGgufAvailable:`No GGUF files available for direct Ollama pull`,ggufFilesCount:`GGUF Files ({{count}}) - Pull directly to Ollama`,noModelsFound:`No models found`,noResults:`No models found. Try adjusting your search or filters.`,browseAllLink:`Browse all`,search:`Search HuggingFace models...`,by:`by`,gated:`Gated`,viewOnHF:`View on HuggingFace`,sortDownloads:`Downloads`,sortLikes:`Likes`,sortRecent:`Recent`,taskTextGeneration:`Text Generation`,taskTextToSpeech:`Text to Speech`,taskTextToImage:`Text to Image`,taskSpeechRecognition:`Speech Recognition`,tasks:{textGen:`Text Generation`,tts:`Text to Speech`,image:`Text to Image`,stt:`Speech Recognition`},sort:{downloads:`Most Downloads`,likes:`Most Liked`,recent:`Recently Updated`}},local:{noModels:`No models installed yet`,pullToStart:`Pull a model above to get started`,installed:`installed`,running:`Running`,info:`Info`,copy:`Copy`,delete:`Delete`,deleteConfirm:`Are you sure you want to delete model "{{name}}"?`,deleteSuccess:`Model {{name}} deleted successfully`,deleteFailed:`Failed to delete model`},advanced:{createModel:`Create Model`,fromModelfile:`From Modelfile`,copyModel:`Copy Model`,duplicateExisting:`Duplicate existing`,testEmbeddings:`Test Embeddings`,generateVectors:`Generate vectors`,healthCheck:`Health Check`,testConnection:`Test connection`,healthy:`Ollama is healthy!`},modals:{details:{title:`Model Details`,info:`Model Information`,family:`Family`,parameters:`Parameters`,quantization:`Quantization`,format:`Format`,systemPrompt:`System Prompt`,template:`Template`,license:`License`,modelfile:`Modelfile`,noDetails:`No details available`},copy:{title:`Copy Model`,source:`Source Model`,selectModel:`Select a model...`,newName:`New Model Name`,placeholder:`e.g., my-custom-model`,copying:`Copying...`,button:`Copy Model`,success:`Model copied to {{name}}`,failed:`Failed to copy model`,enterBoth:`Please enter both source and destination names`},create:{title:`Create Custom Model`,name:`Model Name`,namePlaceholder:`e.g., my-assistant`,modelfile:`Modelfile`,modelfilePlaceholder:`FROM llama3.2
|
|
5
|
-
SYSTEM You are a helpful assistant.`,see:`See`,docs:`Modelfile docs`,docsLink:`for syntax reference`,creating:`Creating...`,button:`Create Model`,success:`Model {{name}} created successfully`,failed:`Failed to create model`,enterBoth:`Please enter model name and Modelfile content`},embeddings:{title:`Test Embeddings`,model:`Embedding Model`,selectModel:`Select a model...`,recommended:`Recommended: nomic-embed-text, mxbai-embed-large`,input:`Input Text`,placeholder:`Enter text to generate embeddings for...`,generating:`Generating...`,button:`Generate Embeddings`,result:`Result ({{count}} dimensions)`,success:`Generated {{count}}-dimensional embedding vector`,failed:`Failed to generate embeddings`,enterBoth:`Please select a model and enter text`}}},personaManager:{title:`Personas`,subtitle:`Create and manage AI personas with custom personalities, memories, and behaviors`,loading:`Loading personas...`,createButton:`Create Persona`,importExport:`Import/Export`,stats:{title:`Your Personas`,count:`{{count}} persona created`,count_plural:`{{count}} personas created`},empty:{title:`No personas yet`,description:`Create your first persona to get started with personalized AI interactions`,button:`Create Your First Persona`},deleteConfirm:`Are you sure you want to delete "{{name}}"?`,deleteSuccess:`Persona "{{name}}" deleted successfully`,downloadSuccess:`Persona "{{name}}" downloaded successfully`,failed:`Failed to {{action}} persona`},personaForm:{title:{create:`Create New Persona`,edit:`Edit Persona`},subtitle:{create:`Create a new AI persona with custom personality, memory systems, and adaptive learning capabilities`,edit:`Customize your AI persona with advanced memory, adaptive learning, and intelligent parameters`},loading:`Loading form...`,saved:`Saved`,tabs:{basic:`Basic`,parameters:`Parameters`,memory:`Memory & Learning`,advanced:`Advanced`},basic:{name:`Name`,namePlaceholder:`Enter persona name`,model:`Model`,selectModel:`Select a model`,description:`Description`,descriptionPlaceholder:`Describe your persona...`,systemPrompt:`System Prompt`,systemPromptPlaceholder:`Enter the system prompt that defines your persona behavior...`,systemPromptHint:`The system prompt defines how your persona will behave and respond.`},parameters:{temperature:`Temperature`,temperatureHint:`Controls creativity vs consistency`,topP:`Top-P`,topPHint:`Controls response diversity`,topK:`Top-K`,topKHint:`Limits vocabulary to top-k tokens`,contextWindow:`Context Window`,contextWindowHint:`Maximum conversation history length`,maxTokens:`Max Tokens`,maxTokensHint:`Maximum response length`,repeatPenalty:`Repeat Penalty`,repeatPenaltyHint:`Reduces repetitive responses`},memory:{title:`Memory System`,subtitle:`Persona remembers conversations over time`,enableHint:`Enable the memory system to let your persona remember conversations and build context over time.`,loading:`Loading memory status...`,noData:`No memory data yet`,memories:`Memories`,mbUsed:`MB Used`,lastBackup:`Last Backup`,never:`Never`,maxMemories:`Maximum Memories`,maxMemoriesHint:`How many memories this persona can store`,retention:`Memory Retention`,retentionHint:`Days to keep memories before cleanup`,autoCleanup:`Auto-cleanup old memories`,wipeAll:`Wipe All Memories`,wipeCannot:`This cannot be undone`,wipeButton:`Wipe`,wiping:`Wiping...`,wipeConfirm:`Are you sure you want to wipe all memories? This cannot be undone.`,wipeSuccess:`Wiped {{count}} memories`},learning:{title:`Adaptive Learning`,subtitle:`Persona evolves based on interactions`,enableHint:`Enable adaptive learning to let your persona evolve and personalize responses based on your interactions.`,speed:`Learning Speed`,slow:`Slow`,slowDesc:`Gradual changes`,balanced:`Balanced`,balancedDesc:`Moderate pace`,fast:`Fast`,fastDesc:`Quick adaptation`,autoAdapt:`Auto-adapt to user preferences`,whatLearns:`What the persona learns:`,conversationTone:`Conversation tone`,responseStyle:`Response style`,userPreferences:`User preferences`,topicInterests:`Topic interests`},advanced:{embeddingModel:`Embedding Model`,embeddingHint:`Select the model used for memory encoding and semantic search. Embedding models are shown first, followed by other available models.`,noModels:`No models found`,embeddingModels:`Embedding Models`,otherModels:`Other Models`,installHint:`Install an embedding model:`,recommended:`Recommended: nomic-embed-text, mxbai-embed-large, bge-m3, snowflake-arctic-embed`,aboutTitle:`About Advanced Settings`,aboutDescription:`The embedding model is used by the memory system to understand semantic meaning and find relevant memories during conversations. Choose a model that matches your use case and available resources.`},actions:{cancel:`Cancel`,save:`Save`,saving:`Saving...`,saveClose:`Save & Close`,create:`Create`},success:{created:`Persona created`,updated:`Persona updated`},error:{saveFailed:`Failed to save`}},personaCard:{enhanced:`Enhanced`,systemPrompt:`System Prompt`,memories:`memories`,use:`Use`,editTooltip:`Edit persona`,downloadTooltip:`Download persona`,backup:`Backup`,exportDNA:`Export DNA`,wipeMemories:`Wipe Memories`,wipeConfirm:`Are you sure you want to wipe all memories for this persona? This action cannot be undone.`,wipeSuccess:`Wiped {{count}} memories`,backupSuccess:`Persona backup downloaded successfully`,dnaSuccess:`Persona DNA exported successfully`,failed:`Failed to {{action}}`},userManager:{title:`User Management`,subtitle:`Manage user accounts and permissions`,pageDescription:`Manage user accounts, permissions, and access controls for your Libre WebUI instance.`,loading:`Loading users...`,createUser:`Create User`,search:`Search users...`,noUsers:`No users found`,noUsersMatching:`No users matching your search`,columns:{user:`User`,email:`Email`,role:`Role`,created:`Created`,actions:`Actions`},roles:{admin:`Admin`,user:`User`},noEmail:`No email`,deleteConfirm:`Are you sure you want to delete user "{{name}}"?`,deleteSuccess:`User deleted successfully`,deleteFailed:`Failed to delete user`,cannotDeleteSelf:`You cannot delete your own account`,form:{title:{create:`Create User`,edit:`Edit User`},username:`Username`,usernamePlaceholder:`Enter username`,email:`Email`,emailPlaceholder:`Enter email (optional)`,password:`Password`,passwordPlaceholder:`Enter password`,passwordHint:`Leave blank to keep current password`,role:`Role`,creating:`Creating...`,updating:`Updating...`,createButton:`Create User`,updateButton:`Update User`,createSuccess:`User created successfully`,updateSuccess:`User updated successfully`,createFailed:`Failed to create user`,updateFailed:`Failed to update user`}},chatHistory:{label:`Conversation history`,jumpToTurn:`Jump to turn {{index}} of {{total}}`},chatMessage:{you:`You`,assistant:`Assistant`,system:`System`,copy:`Copy`,copyMessage:`Copy message`,copied:`Copied!`,regenerate:`Regenerate`,regenerateResponse:`Regenerate response`,edit:`Edit`,editSystemMessage:`Edit system message`,saveChanges:`Save changes`,cancelEditing:`Cancel editing`,delete:`Delete`,deleteConfirm:`Delete this message?`,branch:`Branch`,speaking:`Speaking...`,speakMessage:`Speak message`,stopSpeaking:`Stop speaking`,showMore:`Show more`,showLess:`Show less`,thinking:`Thinking`,systemMessagePlaceholder:`Enter your system message...`,fullSizeImage:`Full size image`,startConversation:`Start a conversation`,startConversationDescription:`Send a message to begin chatting with your AI assistant. Ask questions, get help with code, or have a natural conversation.`,scrollToBottom:`Scroll to bottom`,newMessages:`New messages`},imageGallery:{title:`Image Gallery`,noImages:`No images yet`,noImagesHint:`Generate your first image using the panel on the right`,delete:`Delete`,download:`Download`,deleteConfirm:`Are you sure you want to delete this image?`,deleteSuccess:`Image deleted`,deleteFailed:`Failed to delete image`,downloadFailed:`Failed to download image`,loadMore:`Load More ({{current}} of {{total}})`,loadFailed:`Failed to load gallery`},imageGeneration:{title:`Generate Image`,prompt:`Prompt`,promptPlaceholder:`Describe the image you want to create...`,model:`Model`,selectModel:`Select model`,noModels:`No image generation models available`,configurePlugin:`Configure a plugin with image generation support`,size:`Size`,quality:`Quality`,style:`Style`,generate:`Generate`,generating:`Generating...`,success:`Image generated successfully`,failed:`Failed to generate image`,enterPrompt:`Please enter a prompt`,promptTooLong:`Prompt exceeds maximum length of {{max}} characters`},errorBoundary:{title:`Something went wrong`,description:`We encountered an unexpected error. Please try refreshing the page.`,tryAgain:`Refresh Page`,goHome:`Go to Home`,errorDetails:`Error Details (Development)`},documents:{title:`Documents`,upload:`Upload Document`,uploading:`Uploading...`,noDocuments:`No documents uploaded`,uploadHint:`Upload documents to use in your conversations`,delete:`Delete`,deleteConfirm:`Are you sure you want to delete this document?`,deleteSuccess:`Document deleted`,deleteFailed:`Failed to delete document`,uploadSuccess:`Document uploaded successfully`,uploadFailed:`Failed to upload document`,types:`Supported: PDF, TXT, MD, DOCX`,unsupportedFileType:`Only PDF and TXT files are supported`,fileSizeTooLarge:`File size must be less than 10MB`,uploadSuccessWithName:`Document "{{name}}" uploaded successfully`,removeSuccess:`Document removed successfully`,removeFailed:`Failed to remove document`,removeError:`An error occurred while removing the document`,clickToUpload:`Click to upload`,orDragAndDrop:`or drag and drop`,fileTypesAndSize:`PDF or TXT files up to 10MB`,uploadedDocuments:`Uploaded Documents`,removeDocument:`Remove document`},ttsButton:{speak:`Speak`,stop:`Stop`,speaking:`Speaking...`,generateFailed:`Failed to generate speech`,playbackFailed:`Audio playback failed`,stopSpeaking:`Stop speaking`,generatingSpeech:`Generating speech...`,readAloud:`Read aloud`},artifacts:{title:`Artifacts`,code:`Code`,preview:`Preview`,copy:`Copy code`,copied:`Copied!`,download:`Download`,expand:`Expand`,collapse:`Collapse`,openInNewTab:`Open in new tab`,invalidSvg:`Invalid SVG content`,invalidJson:`Invalid JSON content`,previewMode:`Preview mode`,codeMode:`Code mode`,copyContent:`Copy content`,openInPanel:`Open in panel`,openInNewWindow:`Open in new window`,created:`Created`,closePanelEsc:`Close panel (Esc)`,copyButton:`Copy`,open:`Open`,dragEdgeToResize:`Drag edge to resize`,previewUnavailable:`Preview unavailable`,previewUnavailableDescription:`This artifact does not contain renderable preview content. Switch to code view to inspect the source.`},personaImportExport:{title:`Import & Export Personas`,description:`Export your personas to share them or import personas from others`,exportPersonas:`Export Personas`,importPersonas:`Import Personas`,noPersonasToExport:`No personas to export`,personasAvailable:`{{count}} persona available`,personasAvailable_plural:`{{count}} personas available`,exportAll:`Export All`,uploadJsonFile:`Upload JSON File`,pasteJsonLabel:`Paste JSON Data`,pasteJsonPlaceholder:`Paste persona JSON data here...`,importing:`Importing...`,importButton:`Import Persona(s)`,expectedFormat:`Expected JSON Format:`,exportSuccess:`Persona "{{name}}" exported successfully`,exportFailed:`Failed to export persona`,exportAllSuccess:`All {{count}} personas exported successfully`,exportAllFailed:`Failed to export personas`,pasteJsonData:`Please paste the persona JSON data`,importMultipleSuccess:`Successfully imported {{count}} personas`,importMultipleFailed:`Failed to import {{count}} personas`,importNoneFailed:`Failed to import any personas`,importSuccess:`Persona imported successfully`,importFailed:`Failed to import persona`},generationStats:{details:`Details`,promptTokens:`Prompt tokens:`,generatedTokens:`Generated tokens:`,totalTokens:`Total tokens:`,speed:`Speed:`,promptEval:`Prompt eval:`,generation:`Generation:`,modelLoad:`Model load:`,totalTime:`Total time:`,generatedAt:`Generated at:`},userMenu:{loggedOut:`Logged out successfully`,pictureUpdated:`Profile picture updated`,failedUpdateAvatar:`Failed to update avatar`,failedUpdatePicture:`Failed to update profile picture`,noEmail:`No email provided`,changePicture:`Change Picture`,settings:`Settings`,userManagement:`User Management`,signOut:`Sign Out`,changeProfilePicture:`Change Profile Picture`},pluginManager:{title:`Plugin Manager`,upload:`Upload`,addJson:`Add JSON`,browseHF:`Browse HF Hub`,confirmDelete:`Are you sure you want to delete this plugin?`,uploading:`Uploading plugin...`,pasteJson:`Paste plugin JSON here...`,installPlugin:`Install Plugin`,loading:`Loading plugins...`,noPlugins:`No Plugins Installed`,noPluginsDescription:`Upload a plugin file or add a plugin from JSON to get started.`,active:`Active`,id:`ID`,endpoint:`Endpoint`,activate:`Activate`,deactivate:`Deactivate`,activePlugin:`Active Plugin`,activePluginDescription:`All chat requests will be routed through this plugin`,variables:{title:`Variables`,save:`Save`,saving:`Saving...`,saved:`Variables saved`,saveFailed:`Failed to save variables`,resetDefaults:`Reset to Defaults`,reset:`Variables reset to defaults`,sensitiveSet:`Value is set (enter new value to change)`}},huggingface:{title:`HuggingFace Model Browser`,subtitle:`Browse and select models from the Hub`,searchPlaceholder:`Search models...`,filters:`Filters`,task:`Task`,sortBy:`Sort By`,noModels:`No models found`,adjustSearch:`Try adjusting your search or filters`,gated:`Gated`,selected:`Selected`,select:`Select`,refresh:`Refresh`,modelsFound:`models found`},demoMode:{title:`Demo Mode`,github:`GitHub`},libreClaw:{title:`Libre Claw`,subtitle:`Local agent runs, approvals, schedules, memory, tools, and usage.`,dashboard:`Dashboard`,connection:{disconnectedTitle:`Libre Claw daemon is not connected`,disconnectedDescription:`Start it locally with <command>libre-claw start</command> or set <env>LIBRE_CLAW_BASE_URL</env> in the backend environment.`},status:{connected:`Connected`,disconnected:`Disconnected`,activeRuns:`{{count}} active`,activeRuns_plural:`{{count}} active`},states:{queued:`Queued`,running:`Running`,blocked:`Blocked`,done:`Done`,failed:`Failed`,cancelled:`Cancelled`},startRun:{title:`Start Agent Run`,placeholder:`Ask Libre Claw to inspect a repo, fix a bug, run a review, schedule a report...`,chatRun:`Chat run`,goalMode:`Goal mode`,providerOverride:`Provider override`,modelOverride:`Model override`,run:`Run`},modelRoute:{title:`Model Route`,providerPlaceholder:`provider`,modelPlaceholder:`model`,persistGlobal:`Persist to Libre Claw global config`,saveModel:`Save model`,theme:`Libre Claw theme`,saveTheme:`Save theme`},runs:{title:`Runs`,empty:`No Libre Claw runs yet.`},timeline:{title:`Run Timeline`,empty:`Select a run to inspect its events.`,streaming:`Streaming...`,assistantResponse:`Assistant response`,resultOk:`ok`,resultError:`error`,labels:{userMessage:`User message`,toolCall:`Tool call`,toolResult:`Tool result`,approvalRequest:`Approval request`,approvalResponse:`Approval response`,runStarted:`Run started`,runFinished:`Run finished`,usage:`Usage`,error:`Error`}},approvals:{needed:`Approval needed`,allowOnce:`Allow once`,alwaysAllowTool:`Always allow tool`,deny:`Deny`,toolApprovalRequested:`Tool approval requested`},automations:{title:`Automations`,namePlaceholder:`Name`,schedulePlaceholder:`daily 09:00`,promptPlaceholder:`Automation prompt`,create:`Create`,empty:`No scheduled Libre Claw automations.`,runNow:`Run now`,pause:`Pause`,resume:`Resume`,routes:{report:`Report`,telegram:`Telegram`},status:{active:`Active`,paused:`Paused`}},usageFallback:{title:`Usage And Fallback`,usage:`Usage`,fallbackRoute:`Fallback Route`,noUsage:`No usage records yet.`},metrics:{provider:`Provider`,model:`Model`,input:`Input`,output:`Output`,cached:`Cached`,reasoning:`Reasoning`,cost:`Cost`,tool:`Tool`,resolution:`Resolution`,state:`State`,stopReason:`Stop reason`,tokens:`{{formatted}} token`,tokens_plural:`{{formatted}} tokens`},fallbacks:{tool:`tool`,unknown:`unknown`,resolved:`resolved`,unknownError:`Unknown error`},toasts:{loadStatusFailed:`Could not load Libre Claw status`,enterTask:`Enter a task for Libre Claw`,runStarted:`Libre Claw run started`,startRunFailed:`Could not start Libre Claw run`,runCancelled:`Run cancelled`,cancelRunFailed:`Could not cancel run`,approved:`Approved`,denied:`Denied`,resolvePermissionFailed:`Could not resolve permission`,providerModelRequired:`Provider and model are required`,modelUpdated:`Libre Claw model updated`,updateModelFailed:`Could not update model`,themeUpdated:`Libre Claw theme updated`,updateThemeFailed:`Could not update theme`,automationRequired:`Automation name, schedule, and prompt are required`,automationCreated:`Automation created`,createAutomationFailed:`Could not create automation`,automationUpdated:`Automation updated`,updateAutomationFailed:`Could not update automation`}},personaBackground:{label:`Background Image`,uploadBackgroundImage:`Upload background image`,dragAndDrop:`Drag and drop an image or click to browse`,chooseImage:`Choose Image`,uploading:`Uploading...`,enterImageUrl:`Or enter image URL`,supportedFormats:`Supports: JPG, PNG, GIF, WebP (max 5MB). Wide landscape images work best.`,customBackground:`Custom background image`,clickToChange:`Click to change or remove`,removed:`Background removed`,uploaded:`Background uploaded successfully`,invalidFile:`Please select a valid image file`,fileTooLarge:`Background image size must be less than 5MB`,readFailed:`Failed to read image file`,uploadFailed:`Failed to upload background image`},modelSelector:{searchInstalled:`Search installed models...`,searchOllama:`Search Ollama library...`,searchHuggingFace:`Search HuggingFace...`,selectModel:`Select Model`,personas:`Personas`,ollamaModels:`Ollama Models`,pluginModels:`Plugin Models`,actions:`Actions`,installed:`Installed`,use:`Use`,pull:`Pull`,pullRestricted:`Model installation is restricted to administrators on this instance.`,adminOnlyPull:`Admins only`}},Go={en:{translation:Wo}},Ko=[{code:`en`,name:`English`,nativeName:`English`,dir:`ltr`},{code:`ar`,name:`Arabic`,nativeName:`العربية`,dir:`rtl`},{code:`bn`,name:`Bengali`,nativeName:`বাংলা`,dir:`ltr`},{code:`cs`,name:`Czech`,nativeName:`Čeština`,dir:`ltr`},{code:`da`,name:`Danish`,nativeName:`Dansk`,dir:`ltr`},{code:`de`,name:`German`,nativeName:`Deutsch`,dir:`ltr`},{code:`es`,name:`Spanish`,nativeName:`Español`,dir:`ltr`},{code:`fr`,name:`French`,nativeName:`Français`,dir:`ltr`},{code:`hi`,name:`Hindi`,nativeName:`हिन्दी`,dir:`ltr`},{code:`id`,name:`Indonesian`,nativeName:`Bahasa Indonesia`,dir:`ltr`},{code:`is`,name:`Icelandic`,nativeName:`Íslenska`,dir:`ltr`},{code:`it`,name:`Italian`,nativeName:`Italiano`,dir:`ltr`},{code:`ja`,name:`Japanese`,nativeName:`日本語`,dir:`ltr`},{code:`ko`,name:`Korean`,nativeName:`한국어`,dir:`ltr`},{code:`ms`,name:`Malay`,nativeName:`Bahasa Melayu`,dir:`ltr`},{code:`nl`,name:`Dutch`,nativeName:`Nederlands`,dir:`ltr`},{code:`pl`,name:`Polish`,nativeName:`Polski`,dir:`ltr`},{code:`pt`,name:`Portuguese`,nativeName:`Português`,dir:`ltr`},{code:`ru`,name:`Russian`,nativeName:`Русский`,dir:`ltr`},{code:`sv`,name:`Swedish`,nativeName:`Svenska`,dir:`ltr`},{code:`th`,name:`Thai`,nativeName:`ไทย`,dir:`ltr`},{code:`tr`,name:`Turkish`,nativeName:`Türkçe`,dir:`ltr`},{code:`uk`,name:`Ukrainian`,nativeName:`Українська`,dir:`ltr`},{code:`vi`,name:`Vietnamese`,nativeName:`Tiếng Việt`,dir:`ltr`},{code:`zh`,name:`Chinese`,nativeName:`中文`,dir:`ltr`}],qo=[`ar`,`he`,`fa`,`ur`],Jo=Ko.map(e=>e.code),Yo={en:()=>Promise.resolve(Wo),ar:()=>o(()=>import(`../js/ar-UnnZB1Qy.js`).then(e=>e.default),[]),bn:()=>o(()=>import(`../js/bn-uZXaDyeV.js`).then(e=>e.default),[]),cs:()=>o(()=>import(`../js/cs-CCXlnUEB.js`).then(e=>e.default),[]),da:()=>o(()=>import(`../js/da--BpVVGPp.js`).then(e=>e.default),[]),de:()=>o(()=>import(`../js/de-DZd9lsBc.js`).then(e=>e.default),[]),es:()=>o(()=>import(`../js/es-Bm968oUX.js`).then(e=>e.default),[]),fr:()=>o(()=>import(`../js/fr-RlC0rD8I.js`).then(e=>e.default),[]),hi:()=>o(()=>import(`../js/hi-C6kwkL7d.js`).then(e=>e.default),[]),id:()=>o(()=>import(`../js/id-CDfqnnXS.js`).then(e=>e.default),[]),is:()=>o(()=>import(`../js/is-Dnd_7Jqv.js`).then(e=>e.default),[]),it:()=>o(()=>import(`../js/it-BM0j6_Sz.js`).then(e=>e.default),[]),ja:()=>o(()=>import(`../js/ja-xGblKDDf.js`).then(e=>e.default),[]),ko:()=>o(()=>import(`../js/ko-CQ2d_Oj0.js`).then(e=>e.default),[]),ms:()=>o(()=>import(`../js/ms-CFpRuv_a.js`).then(e=>e.default),[]),nl:()=>o(()=>import(`../js/nl-D6oTztmP.js`).then(e=>e.default),[]),pl:()=>o(()=>import(`../js/pl-ByuvABul.js`).then(e=>e.default),[]),pt:()=>o(()=>import(`../js/pt-CNFV21T7.js`).then(e=>e.default),[]),ru:()=>o(()=>import(`../js/ru-CRsSOntz.js`).then(e=>e.default),[]),sv:()=>o(()=>import(`../js/sv-BRkwjyS5.js`).then(e=>e.default),[]),th:()=>o(()=>import(`../js/th-DigqsQEB.js`).then(e=>e.default),[]),tr:()=>o(()=>import(`../js/tr-B5aMUMJE.js`).then(e=>e.default),[]),uk:()=>o(()=>import(`../js/uk-BUYi3llT.js`).then(e=>e.default),[]),vi:()=>o(()=>import(`../js/vi-hQIcXi3m.js`).then(e=>e.default),[]),zh:()=>o(()=>import(`../js/zh-CUDZ3JDv.js`).then(e=>e.default),[])},Xo=e=>{let t=e?.toLowerCase().split(`-`)[0];return Jo.includes(t)?t:`en`},Zo=e=>qo.includes(Xo(e)),Qo=e=>{if(typeof document>`u`)return;let t=Xo(e);document.documentElement.lang=t,document.documentElement.dir=Zo(t)?`rtl`:`ltr`},$o=async e=>{let t=Xo(e);if(!Y.hasResourceBundle(t,`translation`)){let e=await Yo[t]();Y.addResourceBundle(t,`translation`,e,!0,!0)}return t},es=async e=>{let t=await $o(e);return await Y.changeLanguage(t),t};if(typeof window<`u`){let e=navigator.language;try{e=window.localStorage.getItem(`i18nextLng`)||e}catch{}Qo(e),Y.on(`languageChanged`,Qo)}var ts=(async()=>{Y.isInitialized||await Y.use(Uo).use(c).init({resources:Go,fallbackLng:`en`,supportedLngs:Jo,nonExplicitSupportedLngs:!0,load:`languageOnly`,debug:!1,interpolation:{escapeValue:!1},detection:{order:[`localStorage`,`navigator`,`htmlTag`],caches:[`localStorage`],lookupLocalStorage:`i18nextLng`}});let e=Xo(Y.language||Y.resolvedLanguage);if(e!==`en`)try{await $o(e),Xo(Y.language)===e&&await Y.changeLanguage(e)}catch{await Y.changeLanguage(`en`)}Qo(Y.resolvedLanguage||Y.language||`en`)})(),ns=(e,t)=>{if(e&&typeof e==`object`&&`response`in e){let t=e;if(t.response?.data?.error)return t.response.data.error}return e instanceof Error?e.message:t};function rs(e){return{...e,id:e.id||Ne(),timestamp:Date.now()}}function is(e,t){return e.currentSession?.isPrivate&&e.currentSession?.id===t}function as(e,t){return e.sessions.some(e=>e.id===t)}function os(e,t){return!!e.currentSession&&(is(e,t)||as(e,e.currentSession.id))}function ss(e,t,n){if(is(e,t))return e.currentSession.messages.find(e=>e.id===n.id)?e:{currentSession:{...e.currentSession,messages:[...e.currentSession.messages,n],updatedAt:Date.now()},sessions:e.sessions};if(e.sessions.find(e=>e.id===t)?.messages.some(e=>e.id===n.id))return e;let r=e.sessions.map(e=>{if(e.id!==t)return e;let r=[...e.messages];if(n.parentId){let e=n.parentId;r=r.map(t=>t.id===e||t.parentId===e?{...t,isActive:!1,branchIndex:t.branchIndex??0,siblingCount:(n.branchIndex||0)+1}:t)}return{...e,messages:[...r,n],updatedAt:Date.now()}});return{sessions:r,currentSession:e.currentSession?.id===t&&r.find(e=>e.id===t)||e.currentSession}}function cs(e,t,n,r){if(e.currentSession?.id!==t)return e;if(e.currentSession?.isPrivate){let t=e.currentSession.messages.find(e=>e.id===n);return!t||t.content===r?e:{sessions:e.sessions,currentSession:{...e.currentSession,messages:e.currentSession.messages.map(e=>e.id===n?{...e,content:r}:e),updatedAt:Date.now()}}}let i=e.sessions.find(e=>e.id===t),a=i?.messages.find(e=>e.id===n);if(!i||!a||a.content===r)return e;let o=e.sessions.map(e=>e.id===t?{...e,messages:e.messages.map(e=>e.id===n?{...e,content:r}:e),updatedAt:Date.now()}:e);return{sessions:o,currentSession:e.currentSession?.id===t&&o.find(e=>e.id===t)||e.currentSession}}function ls(e,t,n,r,i){if(e.currentSession?.id!==t)return e;if(e.currentSession?.isPrivate)return{sessions:e.sessions,currentSession:{...e.currentSession,messages:e.currentSession.messages.map(e=>e.id===n?{...e,content:r,statistics:i}:e),updatedAt:Date.now()}};let a=e.sessions.map(e=>e.id===t?{...e,messages:e.messages.map(e=>e.id===n?{...e,content:r,statistics:i}:e),updatedAt:Date.now()}:e);return{sessions:a,currentSession:e.currentSession?.id===t&&a.find(e=>e.id===t)||e.currentSession}}function us(e){return e.reduce((e,t)=>(e[t.id]=t,e),{})}function ds(e){return e.map(e=>({name:`persona:${e.id}`,model:e.model,size:0,digest:``,details:{parent_model:e.model,format:`persona`,family:`persona`,families:[`persona`],parameter_size:``,quantization_level:``},modified_at:new Date(e.updated_at).toISOString(),expires_at:new Date().toISOString(),size_vram:0,isPersona:!0,personaName:e.name,personaDescription:e.description}))}function fs(e){return e.filter(e=>e.active&&e.type!==`tts`&&e.type!==`image`).flatMap(e=>(e.model_map||[]).map(t=>({name:t,model:t,size:0,digest:``,details:{parent_model:``,format:``,family:``,families:[],parameter_size:``,quantization_level:``},modified_at:new Date().toISOString(),expires_at:new Date().toISOString(),size_vram:0,isPlugin:!0,pluginName:e.name})))}var X=s(`chat-store`),ps=be((e,t)=>({sessions:[],currentSession:null,setCurrentSession:t=>{e({currentSession:t})},createSession:async(t,n,r)=>{try{e({loading:!0,error:null});let i=await we.createSession(t,n,r);if(i.success&&i.data){let t=i.data;return e(e=>({sessions:[t,...e.sessions],currentSession:t,loading:!1})),T.success(`New chat created`),t}}catch(t){let n=ns(t,`Failed to create session`);e({error:n,loading:!1}),T.error(n)}},loadSessions:async()=>{try{e({loading:!0,error:null});let t=await we.getSessions();t.success&&t.data&&e(e=>{let n=t.data||[],r=n.map(e=>e.id),i=null;return e.currentSession&&r.includes(e.currentSession.id)?i=n.find(t=>t.id===e.currentSession.id)||null:n.length>0&&(i=n[0],e.currentSession&&X.warn(`Previous currentSession not found in backend sessions:`,e.currentSession.id)),{sessions:n,currentSession:i,loading:!1}})}catch(t){let n=ns(t,`Failed to load sessions`);e({error:n,loading:!1}),T.error(n)}},deleteSession:async t=>{try{let n=await we.deleteSession(t);n.success?(e(e=>{let n=e.sessions.filter(e=>e.id!==t),r=e.currentSession?.id===t?n[0]||null:e.currentSession;return X.debug(`Store: Updating state, sessions count:`,n.length),{sessions:n,currentSession:r}}),T.success(`Chat deleted`)):(X.error(`Store: deleteSession failed:`,n),T.error(`Failed to delete chat`))}catch(e){X.error(`Store: deleteSession error:`,e);let t=ns(e,`Failed to delete session`);T.error(t)}},clearAllSessions:async()=>{try{e({loading:!0,error:null});let t=await we.clearAllSessions();t.success?(e({sessions:[],currentSession:null,loading:!1}),T.success(`All chat history cleared`)):(X.error(`Store: clearAllSessions failed:`,t),T.error(`Failed to clear chat history`),e({loading:!1}))}catch(t){X.error(`Store: clearAllSessions error:`,t);let n=ns(t,`Failed to clear chat history`);T.error(n),e({loading:!1})}},clearAllState:()=>{e({sessions:[],currentSession:null,models:[],selectedModel:``,systemMessage:``,loading:!1,error:null})},applySessionTitle:(t,n,r=Date.now())=>{e(e=>({sessions:e.sessions.map(e=>e.id===t?{...e,title:n,updatedAt:r}:e),currentSession:e.currentSession?.id===t?{...e.currentSession,title:n,updatedAt:r}:e.currentSession}))},updateSessionTitle:async(e,n)=>{try{let r=await we.updateSession(e,{title:n});if(r.success&&r.data){let n=r.data.title,i=r.data.updatedAt??Date.now();t().applySessionTitle(e,n,i),T.success(`Chat title updated`)}}catch(e){let t=ns(e,`Failed to update session`);T.error(t)}},addMessage:(n,r)=>{let i=t(),a=is(i,n);if(!os(i,n)){T.error(`No valid chat session. Please create or select a chat.`),X.error(`addMessage blocked: currentSession is not valid`,i.currentSession?.id);return}if(!a&&!as(i,n)){T.error(`Session not found or invalid. Please select or create a valid chat session.`),X.error(`addMessage blocked: sessionId not found in sessions`,n);return}let o=rs(r);e(e=>ss(e,n,o))},updateMessage:(t,n,r)=>{e(e=>cs(e,t,n,r))},updateMessageWithStatistics:(t,n,r,i)=>{e(e=>ls(e,t,n,r,i))},models:[],loadModels:async()=>{try{e({loading:!0,error:null}),X.debug(`Loading models from API...`);let n=await De.getModels(),r=[];n.success&&n.data&&(r=[...n.data],X.debug(`Ollama models loaded:`,n.data.length));try{let e=await D.getAllPlugins();if(e.success&&e.data){let t=e.data.filter(e=>e.active&&e.type!==`tts`&&e.type!==`image`);X.debug(`🔌 Active plugins found:`,t.map(e=>e.name));let n=fs(t);r.push(...n),X.debug(`Plugin models added:`,n.length)}}catch(e){X.error(`❌ Failed to load plugin models:`,e),e instanceof Error&&X.error(`❌ Plugin error details:`,{message:e.message,response:e.response?.data,status:e.response?.status,url:e.config?.url})}try{let{personaApi:t}=await o(async()=>{let{personaApi:e}=await import(`../js/api-BNnUZaFX.js`).then(e=>e.t);return{personaApi:e}},__vite__mapDeps([0,1,2,3,4,5])),n=await t.getPersonas();if(n.success&&n.data){let t=us(n.data),i=ds(n.data);r.push(...i),e(e=>({...e,personas:t}))}}catch(e){X.error(`❌ Failed to load personas:`,e)}X.debug(`Total models loaded:`,r.length);let i=t().selectedModel,a=r.some(e=>e.name===i);if(i&&!a&&r.length>0){let t=r[0].name;X.debug(`⚠️ Selected model "${i}" no longer available, falling back to "${t}"`),e({models:r,loading:!1,selectedModel:t}),T.success(`Switched to ${t} (previous model no longer available)`)}else e({models:r,loading:!1})}catch(t){X.error(`Error loading models:`,t);let n=ns(t,`Failed to load models`);e({error:n,loading:!1}),T.error(n)}},loadPreferences:async()=>{try{let t=await Oe.getPreferences();if(t.success&&t.data){let{defaultModel:n,systemMessage:r}=t.data;n&&(e({selectedModel:n}),X.debug(`✅ Loaded default model from backend:`,n)),r!==void 0&&(e({systemMessage:r}),X.debug(`✅ Loaded system message from backend`))}}catch(e){X.warn(`❌ Failed to load preferences from backend:`,e)}},selectedModel:``,setSelectedModel:t=>{e({selectedModel:t}),Oe.setDefaultModel(t).catch(e=>{X.warn(`Failed to save default model to backend:`,e)})},updateCurrentSessionModel:async n=>{let r=t();if(!r.currentSession)throw Error(`No current session to update`);try{let t=await we.updateSession(r.currentSession.id,{model:n});t.success&&t.data&&(e(e=>({sessions:e.sessions.map(n=>n.id===e.currentSession?.id?t.data:n),currentSession:t.data,selectedModel:n})),T.success(`Model updated for current chat`))}catch(e){let t=ns(e,`Failed to update session model`);throw T.error(t),e}},personas:{},loadPersonas:async()=>{try{e({loading:!0,error:null});let t=await Ee.getPersonas();if(t.success&&t.data){let n=t.data;e({personas:us(n),loading:!1}),X.debug(`✅ Personas loaded:`,n.length)}}catch(t){let n=ns(t,`Failed to load personas`);e({error:n,loading:!1}),X.error(`❌ Failed to load personas:`,n)}},getCurrentPersona:()=>{let e=t();if(!e.currentSession||!e.currentSession.model?.startsWith(`persona:`))return null;let n=e.currentSession.model.replace(`persona:`,``);return e.personas[n]||null},systemMessage:``,setSystemMessage:n=>{let r=t();if(e({systemMessage:n}),Oe.setSystemMessage(n).catch(e=>{X.warn(`Failed to save system message to backend:`,e)}),r.currentSession){let t=r.currentSession.messages.findIndex(e=>e.role===`system`);if(t!==-1){e(e=>{let r=e.sessions.map(r=>{if(r.id===e.currentSession?.id){let e=r.messages.map((e,r)=>r===t&&e.role===`system`?{...e,content:n,timestamp:Date.now()}:e);return{...r,messages:e,updatedAt:Date.now()}}return r});return{sessions:r,currentSession:e.currentSession?r.find(t=>t.id===e.currentSession.id)||e.currentSession:null}});let i=r.currentSession.messages[t];we.updateMessage(r.currentSession.id,i.id,{content:n}).catch(e=>{X.warn(`Failed to sync system message update to backend:`,e)}),X.debug(`✅ Updated system message in current session`)}}},loading:!1,error:null,setError:t=>e({error:t}),generatingTitleForSession:null,setGeneratingTitleForSession:t=>e({generatingTitleForSession:t}),...typeof window<`u`&&{testPluginApi:async()=>{try{X.debug(`🧪 Testing plugin API...`);let e=await D.getAllPlugins();return X.debug(`✅ Plugin API test result:`,e),e}catch(e){return X.error(`❌ Plugin API test failed:`,e),{error:e}}}}})),ms=`blue`,hs=`#2563eb`,gs=[{id:`violet`,label:`Violet`,color:`#7c3aed`},{id:`blue`,label:`Blue`,color:`#2563eb`},{id:`cyan`,label:`Cyan`,color:`#0e7490`},{id:`teal`,label:`Teal`,color:`#0f766e`},{id:`emerald`,label:`Emerald`,color:`#15803d`},{id:`amber`,label:`Amber`,color:`#b45309`},{id:`rose`,label:`Rose`,color:`#e11d48`},{id:`slate`,label:`Slate`,color:`#475569`}],_s=[`50`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`,`950`],vs=[`25`,..._s],ys=[`canvas`,`surface`,`surface-subtle`,`surface-raised`,`surface-overlay`,`surface-inverse`,`ink`,`ink-muted`,`ink-subtle`,`ink-inverse`,`line`,`line-strong`],bs={multiplier:.24,minimum:6,maximum:24},xs={multiplier:.36,minimum:6,maximum:32},Ss={25:99,50:97,100:94,200:88,300:80,400:66,500:48,600:36,700:27,800:18,900:11,950:6},Cs={25:13,50:4,100:7,200:10,300:16,400:27,500:46,600:65,700:82,800:89,900:95,950:99},ws={canvas:{lightness:96,saturationFactor:1},surface:{lightness:98,saturationFactor:.9},"surface-subtle":{lightness:93,saturationFactor:1},"surface-raised":{lightness:99,saturationFactor:.8},"surface-overlay":{lightness:100,saturationFactor:0},"surface-inverse":{lightness:10,saturationFactor:.7},ink:{lightness:10,saturationFactor:.45},"ink-muted":{lightness:38,saturationFactor:.35},"ink-subtle":{lightness:54,saturationFactor:.4},"ink-inverse":{lightness:98,saturationFactor:.4},line:{lightness:86,saturationFactor:.8},"line-strong":{lightness:75,saturationFactor:.65}},Ts={canvas:{lightness:5,saturationFactor:.9},surface:{lightness:7,saturationFactor:.9},"surface-subtle":{lightness:9,saturationFactor:1},"surface-raised":{lightness:11,saturationFactor:1},"surface-overlay":{lightness:13,saturationFactor:1},"surface-inverse":{lightness:96,saturationFactor:.35},ink:{lightness:96,saturationFactor:.3},"ink-muted":{lightness:67,saturationFactor:.35},"ink-subtle":{lightness:48,saturationFactor:.4},"ink-inverse":{lightness:7,saturationFactor:.45},line:{lightness:18,saturationFactor:.8},"line-strong":{lightness:28,saturationFactor:.65}},Es={violet:{50:`#f5f3ff`,100:`#ede9fe`,200:`#ddd6fe`,300:`#c4b5fd`,400:`#a78bfa`,500:`#7c3aed`,600:`#6d28d9`,700:`#5b21b6`,800:`#4c1d95`,900:`#3b0764`,950:`#2e1065`},blue:{50:`#eff6ff`,100:`#dbeafe`,200:`#bfdbfe`,300:`#93c5fd`,400:`#60a5fa`,500:`#2563eb`,600:`#1d4ed8`,700:`#1e40af`,800:`#1e3a8a`,900:`#172554`,950:`#0f172a`},cyan:{50:`#ecfeff`,100:`#cffafe`,200:`#a5f3fc`,300:`#67e8f9`,400:`#22d3ee`,500:`#0e7490`,600:`#155e75`,700:`#164e63`,800:`#083344`,900:`#092f3f`,950:`#062634`},teal:{50:`#f0fdfa`,100:`#ccfbf1`,200:`#99f6e4`,300:`#5eead4`,400:`#2dd4bf`,500:`#0f766e`,600:`#0f625d`,700:`#115e59`,800:`#134e4a`,900:`#042f2e`,950:`#022c22`},emerald:{50:`#ecfdf5`,100:`#d1fae5`,200:`#a7f3d0`,300:`#6ee7b7`,400:`#34d399`,500:`#15803d`,600:`#166534`,700:`#14532d`,800:`#064e3b`,900:`#052e16`,950:`#022c22`},amber:{50:`#fffbeb`,100:`#fef3c7`,200:`#fde68a`,300:`#fcd34d`,400:`#f59e0b`,500:`#b45309`,600:`#92400e`,700:`#78350f`,800:`#5f2c0b`,900:`#451a03`,950:`#2f1200`},rose:{50:`#fff1f2`,100:`#ffe4e6`,200:`#fecdd3`,300:`#fda4af`,400:`#fb7185`,500:`#e11d48`,600:`#be123c`,700:`#9f1239`,800:`#881337`,900:`#4c0519`,950:`#2d0714`},slate:{50:`#f8fafc`,100:`#f1f5f9`,200:`#e2e8f0`,300:`#cbd5e1`,400:`#94a3b8`,500:`#475569`,600:`#334155`,700:`#1e293b`,800:`#0f172a`,900:`#020617`,950:`#010313`}},Ds={50:97,100:94,200:88,300:76,400:64,500:42,600:34,700:27,800:21,900:16,950:10},Os=(e,t,n)=>Math.min(Math.max(e,t),n),ks=e=>{if(!e)return null;let t=e.trim().match(/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i);if(!t)return null;let n=t[1];return`#${(n.length===3?n.split(``).map(e=>`${e}${e}`).join(``):n).toLowerCase()}`},As=e=>{let t=ks(e)||`#2563eb`,n=parseInt(t.slice(1),16);return{r:n>>16&255,g:n>>8&255,b:n&255}},js=(e,t,n)=>`#${[e,t,n].map(e=>Os(Math.round(e),0,255).toString(16).padStart(2,`0`)).join(``)}`,Ms=(e,t,n)=>{let r=e/255,i=t/255,a=n/255,o=Math.max(r,i,a),s=Math.min(r,i,a),c=(o+s)/2;if(o===s)return{h:0,s:0,l:c*100};let l=o-s,u=c>.5?l/(2-o-s):l/(o+s),d=0;return d=o===r?(i-a)/l+(i<a?6:0):o===i?(a-r)/l+2:(r-i)/l+4,{h:d*60,s:u*100,l:c*100}},Ns=(e,t,n)=>{let r=Os(t,0,100)/100,i=Os(n,0,100)/100,a=(1-Math.abs(2*i-1))*r,o=(e%360+360)%360,s=a*(1-Math.abs(o/60%2-1)),c=i-a/2,l=0,u=0,d=0;return o<60?(l=a,u=s):o<120?(l=s,u=a):o<180?(u=a,d=s):o<240?(u=s,d=a):o<300?(l=s,d=a):(l=a,d=s),js((l+c)*255,(u+c)*255,(d+c)*255)},Ps=e=>{let{r:t,g:n,b:r}=As(e),i=[t,n,r].map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return i[0]*.2126+i[1]*.7152+i[2]*.0722},Fs=(e,t)=>{let n=Ps(e),r=Ps(t),i=Math.max(n,r),a=Math.min(n,r);return(i+.05)/(a+.05)},Is=(e,t,n)=>{let r=n,i=Ns(e,t,r);for(;Fs(`#ffffff`,i)<4.5&&r>12;)r-=2,i=Ns(e,t,r);return i},Ls=e=>{let{r:t,g:n,b:r}=As(ks(e)||`#2563eb`),{h:i,s:a}=Ms(t,n,r),o=a<8?a:Os(a,42,88);return _s.reduce((e,t)=>{let n=Ds[t],r=Number(t)<300?o*.72:o;return e[t]=t===`500`||t===`600`?Is(i,r,n):Ns(i,r,n),e},{})},Z=e=>{let t=e?.mode===`dark`?`dark`:`light`,n=e?.accent===`custom`?`custom`:e?.accent,r=gs.some(e=>e.id===n)?n:ms,i=ks(e?.customAccent)||`#2563eb`;return{mode:t,adaptToAccent:e?.adaptToAccent===!0,accent:n===`custom`?`custom`:r,customAccent:i}},Rs=e=>{let t=Z(e);return t.accent===`custom`?Ls(t.customAccent):Es[t.accent||`blue`]},zs=e=>{let t=Z(e);return t.accent===`custom`?t.customAccent||`#2563eb`:gs.find(e=>e.id===t.accent)?.color||`#2563eb`},Bs=(e,t,n)=>t===0||e<8?e*t:Os(e*n.multiplier*t,n.minimum*t,n.maximum*t),Vs=(e,t,n,r)=>vs.reduce((i,a)=>(i[a]=Ns(e,Bs(t,1,r),n[a]),i),{}),Hs=(e,t,n,r)=>ys.reduce((i,a)=>{let o=n[a];return i[a]=Ns(e,Bs(t,o.saturationFactor,r),o.lightness),i},{}),Us=(e,t,n)=>{let{r,g:i,b:a}=As(n);e.style.setProperty(t,`${r} ${i} ${a}`)},Ws=e=>{for(let t of vs)e.style.removeProperty(`--color-gray-${t}`),e.style.removeProperty(`--color-dark-${t}`);for(let t of ys)e.style.removeProperty(`--color-${t}`)},Gs=(e,t)=>{let{r:n,g:r,b:i}=As(zs(t)),{h:a,s:o}=Ms(n,r,i),s=t.mode===`light`?xs:bs,c=Vs(a,o,Ss,s),l=Vs(a,o,Cs,bs),u=Hs(a,o,t.mode===`dark`?Ts:ws,s);for(let t of vs)Us(e,`--color-gray-${t}`,c[t]),Us(e,`--color-dark-${t}`,l[t]);for(let t of ys)Us(e,`--color-${t}`,u[t])},Ks=e=>{if(typeof document>`u`)return;let t=Z(e),n=document.documentElement,r=Rs(t);n.classList.remove(`dark`,`ophelia`),t.mode===`dark`&&n.classList.add(`dark`),n.style.colorScheme=t.mode,n.dataset.accent=t.accent||`blue`,n.dataset.themeStyle=t.adaptToAccent?`accent`:`default`;for(let e of _s){let{r:t,g:i,b:a}=As(r[e]),o=`${t} ${i} ${a}`;n.style.setProperty(`--color-primary-${e}`,o),n.style.setProperty(`--color-accent-${e}`,o)}t.adaptToAccent?Gs(n,t):Ws(n)},qs=s(`store:app-store`),Js=250,Ys=null,Xs=be()(xe((e,t)=>({theme:{mode:`light`,adaptToAccent:!1,accent:ms,customAccent:hs},themeSyncPending:!1,syncThemePreference:async n=>{if(Ys&&(clearTimeout(Ys),Ys=null),!(!Se()&&!localStorage.getItem(`auth-token`)))try{let{preferencesApi:r}=await o(async()=>{let{preferencesApi:e}=await import(`../js/api-BNnUZaFX.js`).then(e=>e.t);return{preferencesApi:e}},__vite__mapDeps([0,1,2,3,4,5]));if(!(await r.updatePreferences({theme:n})).success){qs.warn(`Failed to save theme preference to backend`);return}let i=Z(t().theme),a=Z(n);i.mode===a.mode&&i.adaptToAccent===a.adaptToAccent&&i.accent===a.accent&&i.customAccent===a.customAccent?e({themeSyncPending:!1}):(e({themeSyncPending:!0}),t().scheduleThemePreferenceSync())}catch(e){qs.warn(`Failed to save theme preference to backend:`,e)}},scheduleThemePreferenceSync:()=>{Ys&&clearTimeout(Ys),Ys=setTimeout(()=>{Ys=null,t().syncThemePreference(Z(t().theme))},Js)},setTheme:t=>{let n=Z(t);e(e=>({theme:n,preferences:{...e.preferences,theme:n}})),Ks(n)},updateTheme:n=>{let r=Z(n);t().setTheme(r),e({themeSyncPending:!0}),t().scheduleThemePreferenceSync()},toggleTheme:()=>{let e=t().theme,n=e.mode===`dark`?`light`:`dark`;t().updateTheme({...e,mode:n})},sidebarOpen:!0,sidebarCompact:!1,setSidebarOpen:t=>e({sidebarOpen:t}),setSidebarCompact:t=>e({sidebarCompact:t}),toggleSidebar:()=>e(e=>({sidebarOpen:!e.sidebarOpen})),toggleSidebarCompact:()=>e(e=>({sidebarCompact:!e.sidebarCompact})),artifactPanelOpen:!1,artifactPanelArtifact:null,openArtifactPanel:t=>e({artifactPanelOpen:!0,artifactPanelArtifact:t}),closeArtifactPanel:()=>e({artifactPanelOpen:!1,artifactPanelArtifact:null}),preferences:{theme:{mode:`light`,adaptToAccent:!1,accent:ms,customAccent:hs},defaultModel:``,systemMessage:``,generationOptions:{temperature:.7,top_p:.9,top_k:40,num_predict:1024},embeddingSettings:{enabled:!1,model:`nomic-embed-text`,chunkSize:1e3,chunkOverlap:200,similarityThreshold:.3},titleSettings:{autoTitle:!1,taskModel:``},showUsername:!1,backgroundSettings:{enabled:!1,imageUrl:``,blurAmount:10,opacity:.6}},setPreferences:t=>{let n=t.theme?Z(t.theme):null;e(e=>({...n&&{theme:n},preferences:{...e.preferences,...t,...n&&{theme:n}}})),n&&Ks(n)},loadPreferences:async()=>{try{let{preferencesApi:n}=await o(async()=>{let{preferencesApi:e}=await import(`../js/api-BNnUZaFX.js`).then(e=>e.t);return{preferencesApi:e}},__vite__mapDeps([0,1,2,3,4,5])),r=await n.getPreferences();if(r.success&&r.data){let n=r.data,i=t().themeSyncPending?Z(t().theme):null;t().setPreferences(i?{...n,theme:i}:n),e({backgroundImage:n.backgroundSettings?.imageUrl||null}),i&&t().syncThemePreference(i)}}catch(e){qs.warn(`Failed to load preferences from backend:`,e)}},isGenerating:!1,setIsGenerating:t=>e({isGenerating:t}),hasSeenSettingsNotification:!1,markSettingsNotificationAsSeen:()=>e({hasSeenSettingsNotification:!0}),isDemoMode:Se(),demoConfig:Ce(),setDemoMode:t=>{e({isDemoMode:t,demoConfig:Ce()})},backgroundImage:null,setBackgroundImage:async n=>{if(e({backgroundImage:n}),n){let e=t(),r={...e.preferences,backgroundSettings:{enabled:!0,imageUrl:n,blurAmount:e.preferences.backgroundSettings?.blurAmount||10,opacity:e.preferences.backgroundSettings?.opacity||.6}};e.setPreferences(r);try{let{preferencesApi:e}=await o(async()=>{let{preferencesApi:e}=await import(`../js/api-BNnUZaFX.js`).then(e=>e.t);return{preferencesApi:e}},__vite__mapDeps([0,1,2,3,4,5]));await e.updatePreferences({backgroundSettings:r.backgroundSettings})}catch(e){qs.warn(`Failed to save background settings to backend:`,e)}}},uploadBackgroundImage:async e=>{try{let n=new FileReader;return new Promise((r,i)=>{n.onload=async e=>{try{let n=e.target?.result;await t().setBackgroundImage(n),r()}catch(e){i(e)}},n.onerror=i,n.readAsDataURL(e)})}catch(e){throw qs.error(`Failed to upload background image:`,e),e}},removeBackgroundImage:async()=>{e({backgroundImage:null});let n=t(),r={enabled:!1,imageUrl:``,blurAmount:n.preferences.backgroundSettings?.blurAmount||10,opacity:n.preferences.backgroundSettings?.opacity||.6};n.setPreferences({backgroundSettings:r});try{let{preferencesApi:e}=await o(async()=>{let{preferencesApi:e}=await import(`../js/api-BNnUZaFX.js`).then(e=>e.t);return{preferencesApi:e}},__vite__mapDeps([0,1,2,3,4,5]));await e.updatePreferences({backgroundSettings:r})}catch(e){qs.warn(`Failed to save background removal to backend:`,e)}},clearUserState:()=>{let t=Z({mode:`light`,adaptToAccent:!1,accent:ms,customAccent:hs});Ys&&(clearTimeout(Ys),Ys=null),e({theme:t,themeSyncPending:!1,backgroundImage:null,preferences:{theme:t,defaultModel:``,systemMessage:``,generationOptions:{temperature:.7,top_p:.9,top_k:40,num_predict:1024},embeddingSettings:{enabled:!1,model:`nomic-embed-text`,chunkSize:1e3,chunkOverlap:200,similarityThreshold:.3},titleSettings:{autoTitle:!1,taskModel:``},showUsername:!1,backgroundSettings:{enabled:!1,imageUrl:``,blurAmount:10,opacity:.6}}}),Ks(t)}}),{name:`libre-webui-app-state`,onRehydrateStorage:()=>e=>{e&&e.setTheme(Z(e.theme))},partialize:e=>{let{backgroundSettings:t,...n}=e.preferences;return{theme:e.theme,themeSyncPending:e.themeSyncPending,sidebarOpen:e.sidebarOpen,sidebarCompact:e.sidebarCompact,preferences:n,hasSeenSettingsNotification:e.hasSeenSettingsNotification}}}));typeof window<`u`&&(()=>{let{theme:e,setTheme:t}=Xs.getState();t(e)})();var Zs=s(`store:plugin-store`),Qs=be((e,t)=>({plugins:[],pluginStatus:[],pluginVariables:{},isLoading:!1,isUploading:!1,error:null,loadPlugins:async()=>{e({isLoading:!0,error:null});try{let t=await D.getAllPlugins();t.success&&t.data?e({plugins:t.data}):e({error:t.error||`Failed to load plugins`})}catch(t){e({error:t instanceof Error?t.message:`Failed to load plugins`})}finally{e({isLoading:!1})}},uploadPlugin:async n=>{e({isUploading:!0,error:null});try{let r=await D.uploadPlugin(n);r.success&&r.data?await t().loadPlugins():e({error:r.error||`Failed to upload plugin`})}catch(t){e({error:t instanceof Error?t.message:`Failed to upload plugin`})}finally{e({isUploading:!1})}},installPlugin:async n=>{e({isLoading:!0,error:null});try{let r=await D.installPlugin(n);r.success&&r.data?await t().loadPlugins():e({error:r.error||`Failed to install plugin`})}catch(t){e({error:t instanceof Error?t.message:`Failed to install plugin`})}finally{e({isLoading:!1})}},updatePlugin:async(n,r)=>{e({isLoading:!0,error:null});try{let i=await D.updatePlugin(n,r);i.success&&i.data?await t().loadPlugins():e({error:i.error||`Failed to update plugin`})}catch(t){e({error:t instanceof Error?t.message:`Failed to update plugin`})}finally{e({isLoading:!1})}},deletePlugin:async n=>{e({isLoading:!0,error:null});try{let r=await D.deletePlugin(n);r.success?await t().loadPlugins():e({error:r.error||`Failed to delete plugin`})}catch(t){e({error:t instanceof Error?t.message:`Failed to delete plugin`})}finally{e({isLoading:!1})}},activatePlugin:async n=>{e({isLoading:!0,error:null});try{let r=await D.activatePlugin(n);r.success?await t().loadPlugins():e({error:r.error||`Failed to activate plugin`})}catch(t){e({error:t instanceof Error?t.message:`Failed to activate plugin`})}finally{e({isLoading:!1})}},deactivatePlugin:async n=>{e({isLoading:!0,error:null});try{let r=await D.deactivatePlugin(n);r.success?await t().loadPlugins():e({error:r.error||`Failed to deactivate plugin`})}catch(t){e({error:t instanceof Error?t.message:`Failed to deactivate plugin`})}finally{e({isLoading:!1})}},loadPluginStatus:async()=>{try{let t=await D.getPluginStatus();t.success&&t.data&&e({pluginStatus:t.data})}catch(e){Zs.error(`Failed to load plugin status:`,e)}},exportPlugin:async t=>{e({isLoading:!0,error:null});try{let e=await D.exportPlugin(t),n=window.URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=`${t}.json`,document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(n)}catch(t){e({error:t instanceof Error?t.message:`Failed to export plugin`})}finally{e({isLoading:!1})}},fetchPluginVariables:async t=>{try{let n=await D.getVariables(t);n.success&&n.data&&e(e=>({pluginVariables:{...e.pluginVariables,[t]:n.data}}))}catch(e){Zs.error(`Failed to fetch plugin variables:`,e)}},updatePluginVariables:async(e,n)=>{try{return(await D.setVariables(e,n)).success?(await t().fetchPluginVariables(e),!0):!1}catch(e){return Zs.error(`Failed to update plugin variables:`,e),!1}},resetPluginVariables:async t=>{try{(await D.resetVariables(t)).success&&e(e=>{let n={...e.pluginVariables};return delete n[t],{pluginVariables:n}})}catch(e){Zs.error(`Failed to reset plugin variables:`,e)}},clearError:()=>e({error:null}),setError:t=>e({error:t})}));function $s(e){"@babel/helpers - typeof";return $s=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},$s(e)}function ec(e,t){if($s(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if($s(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function tc(e){var t=ec(e,`string`);return $s(t)==`symbol`?t:t+``}function nc(e,t,n){return(t=tc(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Q=s(`websocket`),rc=new class{constructor(){nc(this,`ws`,null),nc(this,`url`,void 0),nc(this,`reconnectAttempts`,0),nc(this,`maxReconnectAttempts`,5),nc(this,`reconnectDelay`,1e3),nc(this,`messageHandlers`,new Map);let e;e=window.location.protocol===`file:`?`ws://localhost:3001`:`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}`,this.url=`${e}/ws`,Q.debug(`WebSocket URL constructed:`,this.url)}connect(){return Se()?(Q.debug(`Demo mode active: skipping WebSocket connection.`),Promise.resolve()):(Q.debug(`WebSocket: Attempting to connect to:`,this.url),new Promise((e,t)=>{try{let n=localStorage.getItem(`auth-token`),r=n?`${this.url}?token=${encodeURIComponent(n)}`:this.url;Q.debug(`WebSocket: Connecting to:`,r.replace(/token=[^&]+/,`token=***`)),this.ws=new WebSocket(r),this.ws.onopen=()=>{Q.debug(`WebSocket connected successfully`),this.reconnectAttempts=0,e()},this.ws.onmessage=e=>{try{let t=JSON.parse(e.data),n=this.messageHandlers.get(t.type);n?n(t.data):t.type===`connected`?Q.debug(`WebSocket: Server confirmed connection`):Q.warn(`WebSocket: No handler for message type:`,t.type)}catch(e){Q.error(`Failed to parse WebSocket message:`,e)}},this.ws.onclose=()=>{Q.debug(`WebSocket disconnected`),this.ws=null,this.attemptReconnect()},this.ws.onerror=e=>{Q.error(`WebSocket error:`,e),t(e)}}catch(e){t(e)}}))}disconnect(){this.ws&&(this.ws.close(),this.ws=null)}send(e){this.ws&&this.ws.readyState===WebSocket.OPEN?(Q.debug(`WebSocket: Sending message:`,e),this.ws.send(JSON.stringify(e))):Q.warn(`WebSocket is not connected. ReadyState:`,this.ws?.readyState)}onMessage(e,t){this.messageHandlers.delete(e),this.messageHandlers.set(e,t)}offMessage(e){this.messageHandlers.delete(e)}attemptReconnect(){if(Se()){Q.debug(`Demo mode active: skipping WebSocket reconnection.`);return}this.reconnectAttempts<this.maxReconnectAttempts?(this.reconnectAttempts++,Q.debug(`Attempting to reconnect... (${this.reconnectAttempts}/${this.maxReconnectAttempts})`),setTimeout(()=>{this.connect().catch(()=>{})},this.reconnectDelay*this.reconnectAttempts)):Q.error(`Max reconnection attempts reached`)}get isConnected(){return this.ws?.readyState===WebSocket.OPEN}},ic=e({useAuthStore:()=>$}),ac=s(`auth-store`),$=be()(xe((e,t)=>({user:null,token:null,systemInfo:null,isAuthenticated:!1,isLoading:!1,login:(n,r,i)=>{let a=t().user?.id===n.id;localStorage.setItem(`auth-token`,r);let o=ps.getState();o.clearAllState&&o.clearAllState(),a||Xs.getState().clearUserState(),e({user:n,token:r,systemInfo:i,isAuthenticated:!0,isLoading:!1}),setTimeout(async()=>{try{let e=Qs.getState();ac.debug(`Reinitializing app after login...`),ac.debug(`Reconnecting WebSocket with auth token...`),rc.disconnect(),await rc.connect(),!(await De.checkHealth()).success&&!Se()&&ac.warn(`Ollama service not available after login`);let t=Xs.getState();await Promise.all([o.loadModels(),o.loadSessions(),o.loadPreferences(),t.loadPreferences(),e.loadPlugins()]),ac.debug(`Reinitialized app after login`)}catch(e){ac.error(`Failed to reinitialize app after login:`,e)}},100)},logout:()=>{localStorage.removeItem(`auth-token`),ac.debug(`Disconnecting WebSocket on logout...`),rc.disconnect();let t=ps.getState();t.clearAllState&&t.clearAllState(),Xs.getState().clearUserState(),e({user:null,token:null,isAuthenticated:!1,isLoading:!1})},setUser:t=>{e({user:t})},setSystemInfo:t=>{e({systemInfo:t})},setLoading:t=>{e({isLoading:t})},isAdmin:()=>{let{user:e}=t();return e?.role===`admin`},requiresAuth:()=>{let{systemInfo:e}=t();return e?.requiresAuth??!1}}),{name:`auth-store`,partialize:e=>({user:e.user,token:e.token,systemInfo:e.systemInfo,isAuthenticated:e.isAuthenticated})})),oc=`welcomePromptIndex`,sc=`libre:welcome-prompt-change`,cc=[`time`,`create`,`explore`,`imagine`,`focus`,`untangle`,`momentum`,`open`,`challenge`,`draft`,`possibility`,`unexpected`],lc=0,uc=e=>Number.isInteger(e)&&e>=0&&e<cc.length,dc=()=>{if(typeof window>`u`)return lc;try{let e=window.sessionStorage.getItem(oc),t=Number(e);e!==null&&uc(t)&&(lc=t)}catch{}return lc},fc=()=>{let e=(dc()+1)%cc.length;if(lc=e,typeof window<`u`){try{window.sessionStorage.setItem(oc,String(e))}catch{}window.dispatchEvent(new Event(sc))}return e},pc=e=>cc[e]??`time`,mc=i(),hc=({label:e,error:t,helper:n,className:r,id:i,...a})=>{let o=(0,V.useId)(),s=i||`input-${o}`;return(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[e&&(0,H.jsx)(`label`,{htmlFor:s,className:`block text-sm font-medium tracking-[-0.005em] text-ink-muted`,children:e}),(0,H.jsx)(`input`,{id:s,className:O(`block w-full rounded-xl border border-line bg-surface-raised px-3.5 py-2.5 text-base text-ink shadow-none`,`placeholder:text-ink-subtle transition-[background-color,border-color,box-shadow,color] duration-150 ease-out`,`focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus-visible:outline-none dark:focus:border-primary-400 dark:focus:ring-primary-400/20`,`disabled:cursor-not-allowed disabled:bg-surface-subtle disabled:text-ink-subtle disabled:opacity-70`,t&&`border-error-500 focus:border-error-500 focus:ring-error-500/20`,r),...a}),t&&(0,H.jsx)(`p`,{className:`text-xs leading-relaxed text-error-600 dark:text-error-400`,children:t}),n&&!t&&(0,H.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-muted`,children:n})]})},gc=V.forwardRef(({label:e,error:t,helper:n,className:r,id:i,...a},o)=>{let s=(0,V.useId)(),c=i||`textarea-${s}`;return(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[e&&(0,H.jsx)(`label`,{htmlFor:c,className:`block text-sm font-medium tracking-[-0.005em] text-ink-muted`,children:e}),(0,H.jsx)(`textarea`,{ref:o,id:c,className:O(`block w-full resize-none rounded-xl border border-line bg-surface-raised px-3.5 py-2.5 text-base text-ink shadow-none`,`placeholder:text-ink-subtle transition-[background-color,border-color,box-shadow,color] duration-150 ease-out`,`focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus-visible:outline-none dark:focus:border-primary-400 dark:focus:ring-primary-400/20`,`disabled:cursor-not-allowed disabled:bg-surface-subtle disabled:text-ink-subtle disabled:opacity-70`,t&&`border-error-500 focus:border-error-500 focus:ring-error-500/20`,r),...a}),t&&(0,H.jsx)(`p`,{className:`text-xs leading-relaxed text-error-600 dark:text-error-400`,children:t}),n&&!t&&(0,H.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-muted`,children:n})]})});gc.displayName=`Textarea`;var _c=({label:e,error:t,helper:n,options:r,className:i,id:a,...o})=>{let s=(0,V.useId)(),c=a||`select-${s}`;return(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[e&&(0,H.jsx)(`label`,{htmlFor:c,className:`block text-sm font-medium tracking-[-0.005em] text-ink-muted`,children:e}),(0,H.jsx)(`select`,{id:c,className:O(`block w-full rounded-xl border border-line bg-surface-raised px-3.5 py-2.5 text-base text-ink shadow-none`,`transition-[background-color,border-color,box-shadow,color] duration-150 ease-out`,`focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus-visible:outline-none dark:focus:border-primary-400 dark:focus:ring-primary-400/20`,`disabled:cursor-not-allowed disabled:bg-surface-subtle disabled:text-ink-subtle disabled:opacity-70`,t&&`border-error-500 focus:border-error-500 focus:ring-error-500/20`,i),...o,children:r.map((e,t)=>(0,H.jsx)(`option`,{value:e.value,children:e.label},e.key??`${e.value}-${t}`))}),t&&(0,H.jsx)(`p`,{className:`text-xs leading-relaxed text-error-600 dark:text-error-400`,children:t}),n&&!t&&(0,H.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-muted`,children:n})]})},vc=[/^ {0,3}(?:`{3,}|~{3,})/m,/`[^`\n]+`/,/^\s{0,3}#{1,6}\s/m,/^\s{0,3}[-*+]\s/m,/^\s{0,3}\d+\.\s/m,/^\s{0,3}>\s/m,/\[[^\]]+\]\([^)]+\)/,/!\[[^\]]*]\([^)]+\)/,/\|.*\|/,/\*\*[^*]+\*\*/,/__[^_]+__/,/~~[^~]+~~/,/\\\[[\s\S]*?\\\]/,/\\\([\s\S]*?\\\)/,/\$\$[\s\S]*?\$\$/,/(^|[^$])\$[^$\n]+\$/],yc=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);function bc(e){let t=[],n=/^( {0,3})(`{3,}|~{3,})([^\n\r]*)(?:\r?\n|$)/gm,r;for(;r=n.exec(e);){let i=r[1].length,a=r[2],o=a[0],s=r[3].trim();if(o==="`"&&s.includes("`"))continue;let c=n.lastIndex,l=RegExp(`^ {0,3}${yc(o)}{${a.length},}[ \\t]*(?:\\r?\\n|$)`,`gm`);l.lastIndex=c;let u=l.exec(e),d=s.split(/\s+/)[0]||null;if(!u){t.push({start:r.index,end:e.length,codeStart:c,codeEnd:e.length,indent:i,language:d,complete:!1});break}t.push({start:r.index,end:l.lastIndex,codeStart:c,codeEnd:u.index,indent:i,language:d,complete:!0}),n.lastIndex=l.lastIndex}return t}function xc(e){return/<(?:html|head|body)(?:\s|>)|<\/(?:head|body|html)\s*>/i.test(e)}function Sc(e,t){return e.start<t.end&&t.start<e.end}function Cc(e,t){let n=/^( {0,3})(<!doctype\s+html(?:\s|>|$)|<html(?:\s[^>\n\r]*)?>)/gim,r;for(;r=n.exec(e);){let n=r.index+r[1].length;if(t.some(e=>n>=e.start&&n<e.end))continue;let i=e.slice(n);if(!xc(i.slice(r[2].length)))continue;let a=/<\/html\s*>/i.exec(i),o=a?n+a.index+a[0].length:e.length;return{start:r.index,end:o,codeStart:n,codeEnd:o,indent:0,language:`html`,complete:!!a}}return null}function wc(e){let t=bc(e),n=Cc(e,t);return n?[...t.filter(e=>!Sc(e,n)),n].sort((e,t)=>e.start-t.start):t}function Tc(e,t){return t===0?e:e.replace(RegExp(`^ {1,${t}}`,`gm`),``)}function Ec(e){return vc.some(t=>t.test(e))}function Dc(e){let t=[],n=wc(e),r=0;for(let i of n){let n=e.slice(r,i.start);n&&t.push({type:`text`,content:n}),t.push({type:`code`,language:i.language,content:Tc(e.slice(i.codeStart,i.codeEnd),i.indent),complete:i.complete}),r=i.end}let i=e.slice(r);return(i||t.length===0)&&t.push({type:`text`,content:i}),t}function Oc(e){let t=e=>e.replace(/\\\[([\s\S]*?)\\\]/g,(e,t)=>`$$${t}$$`).replace(/\\\(([\s\S]*?)\\\)/g,(e,t)=>`$${t}$`),n=e=>{let n=/`[^`\n]+`/g,r=``,i=0,a;for(;a=n.exec(e);)r+=t(e.slice(i,a.index)),r+=a[0],i=n.lastIndex;return r+t(e.slice(i))},r=bc(e),i=``,a=0;for(let t of r)i+=n(e.slice(a,t.start)),i+=e.slice(t.start,t.end),a=t.end;return i+=n(e.slice(a)),i}var kc=s(`components:ui:message-code-block`);function Ac({code:e,language:t,state:n,children:r}){let{t:i}=l(),[a,o]=V.useState(null),s=V.useRef(null),c=a===e,u=t||`text`,d=i(c?`artifacts.copied`:`artifacts.copy`),f=`${d}: ${u}`;return V.useEffect(()=>()=>{s.current!==null&&window.clearTimeout(s.current)},[]),(0,H.jsxs)(`div`,{dir:`ltr`,"data-testid":`code-block`,"data-state":n,"data-language":u,className:`group relative my-4 overflow-hidden rounded-xl border border-white/10 bg-[#0D1117] text-left text-[#E6EDF3] shadow-[0_12px_32px_rgba(13,17,23,0.16)]`,children:[(0,H.jsxs)(`div`,{className:`flex h-10 items-center justify-between border-b border-white/10 bg-white/[0.035] px-3.5`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(ee,{className:`h-3.5 w-3.5 shrink-0 text-[#8B949E]`}),(0,H.jsx)(`span`,{className:`truncate font-mono text-[11px] font-medium lowercase tracking-[-0.01em] text-[#B1BAC4]`,children:u})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[n===`streaming`&&(0,H.jsx)(`span`,{role:`status`,"aria-label":i(`common.loading`),className:`flex h-7 w-7 items-center justify-center`,children:(0,H.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-primary-400`})}),(0,H.jsx)(`button`,{type:`button`,onClick:async()=>{if(e)try{await navigator.clipboard.writeText(e),o(e),s.current!==null&&window.clearTimeout(s.current),s.current=window.setTimeout(()=>{o(null),s.current=null},2e3)}catch(e){kc.error(`Failed to copy code:`,e)}},disabled:!e,className:`flex h-7 w-7 items-center justify-center rounded-md text-[#8B949E] transition-colors hover:bg-white/[0.08] hover:text-[#E6EDF3] focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-400/70 disabled:cursor-default disabled:opacity-35`,title:d,"aria-label":f,children:c?(0,H.jsx)(ge,{className:`h-3.5 w-3.5 text-green-400`}):(0,H.jsx)(me,{className:`h-3.5 w-3.5`})}),(0,H.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:c?f:``})]})]}),r]})}var jc=`#0D1117`,Mc=`max-h-[60vh] min-h-12 overflow-auto bg-[#0D1117] p-4 text-left font-mono text-[14px] leading-6 text-[#E6EDF3] whitespace-pre tabular-nums`,Nc={maxHeight:`60vh`,minHeight:`3rem`,overflow:`auto`,padding:`1rem`,fontSize:`14px`,lineHeight:`1.5rem`,fontFamily:`"JetBrains Mono", ui-monospace, SFMono-Regular, monospace`,whiteSpace:`pre`};function Pc({content:e}){return e?(0,H.jsx)(`div`,{dir:`auto`,className:`whitespace-pre-wrap break-words leading-relaxed`,children:e}):null}function Fc({content:e,language:t,complete:n}){let r=n?e.replace(/\r?\n$/,``):e,i=V.useRef(null),a=V.useRef(!0);return V.useLayoutEffect(()=>{let e=i.current;e&&a.current&&(e.scrollTop=e.scrollHeight)},[r]),(0,H.jsx)(Ac,{code:r,language:t,state:n?`complete`:`streaming`,children:(0,H.jsx)(`pre`,{ref:i,onScroll:()=>{let e=i.current;e&&(a.current=e.scrollHeight-e.scrollTop-e.clientHeight<24)},className:Mc,children:(0,H.jsx)(`code`,{children:r})})})}var Ic=({content:e,className:t,segments:n,isStreaming:r=!0})=>{let i=V.useMemo(()=>n??Dc(e),[e,n]),a=i[i.length-1],o=a?.type===`code`&&!a.complete;return(0,H.jsxs)(`div`,{className:O(`text-sm leading-relaxed text-gray-700 dark:text-dark-700`,t),children:[i.map((e,t)=>e.type===`code`?(0,H.jsx)(Fc,{...e},`${e.type}-${t}`):(0,H.jsx)(Pc,{content:e.content},`${e.type}-${t}`)),r&&!o&&(0,H.jsx)(`span`,{"data-testid":`message-streaming-cursor`,"aria-hidden":`true`,className:`ms-1 inline-block h-5 w-1 animate-pulse rounded-full bg-primary-500 align-text-bottom`})]})},Lc=V.lazy(()=>o(()=>import(`../js/RichMessageContent-COEmecOd.js`),__vite__mapDeps([6,1,5,2,3,7,4,8,9])));function Rc({content:e,className:t}){return(0,H.jsx)(`div`,{dir:`auto`,className:O(`text-sm leading-relaxed text-gray-700 dark:text-dark-700 whitespace-pre-wrap break-words`,t),children:e})}var zc=({content:e,className:t,isStreaming:n=!1})=>{let r=V.useMemo(()=>n?Dc(e):[],[e,n]),i=r.some(e=>e.type===`code`);if(n&&i)return(0,H.jsx)(Ic,{content:e,className:t,segments:r});let a;return a=Ec(e)?(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(Ic,{content:e,className:t,isStreaming:!1}),children:(0,H.jsx)(Lc,{content:e,className:t})}):(0,H.jsx)(Rc,{content:e,className:t}),(0,H.jsxs)(H.Fragment,{children:[a,n&&(0,H.jsx)(`span`,{"data-testid":`message-streaming-cursor`,"aria-hidden":`true`,className:`ms-1 inline-block h-5 w-1 animate-pulse rounded-full bg-primary-500 align-text-bottom`})]})},Bc=({children:e,htmlFor:t,className:n=``})=>(0,H.jsx)(`label`,{htmlFor:t,className:O(`text-sm font-medium tracking-[-0.005em] text-ink-muted`,n),children:e}),Vc=({children:e,className:t=``})=>(0,H.jsx)(`div`,{className:O(`rounded-2xl border border-line bg-surface-raised shadow-card`,t),children:e}),Hc=({children:e,className:t=``})=>(0,H.jsx)(`div`,{className:O(`flex flex-col space-y-1.5 p-6`,t),children:e}),Uc=({children:e,className:t=``})=>(0,H.jsx)(`h3`,{className:O(`text-lg font-semibold leading-tight tracking-[-0.02em] text-ink`,t),children:e}),Wc=({children:e,className:t=``})=>(0,H.jsx)(`p`,{className:O(`text-sm leading-relaxed text-ink-muted`,t),children:e}),Gc=({children:e,className:t=``})=>(0,H.jsx)(`div`,{className:O(`p-6 pt-0`,t),children:e}),Kc={narrow:`max-w-4xl`,default:`max-w-6xl`,wide:`max-w-7xl`},qc=({children:e,width:t=`default`,className:n,contentClassName:r,...i})=>(0,H.jsx)(`div`,{"data-testid":`page-scroll-region`,className:O(`scroll-region h-full min-h-0 scrollbar-thin`,n),...i,children:(0,H.jsx)(`div`,{className:O(`mx-auto w-full px-4 pb-16 pt-7 sm:px-6 sm:pb-20 sm:pt-10 lg:px-8`,Kc[t],r),children:e})}),Jc=({title:e,description:t,eyebrow:n,actions:r,meta:i,className:a,...o})=>(0,H.jsxs)(`header`,{className:O(`mb-8 flex flex-col gap-6 border-b border-gray-200/70 pb-7 text-start dark:border-white/[0.08] sm:mb-10 sm:pb-9 md:flex-row md:items-end md:justify-between`,a),...o,children:[(0,H.jsxs)(`div`,{className:`min-w-0 max-w-3xl`,children:[n&&(0,H.jsx)(`div`,{className:`mb-3 text-[11px] font-medium uppercase tracking-[0.18em] text-gray-500 dark:text-dark-500 rtl:tracking-normal`,children:n}),(0,H.jsx)(`h1`,{className:`text-balance text-3xl font-normal leading-[1.02] tracking-[-0.04em] text-gray-950 dark:text-dark-950 sm:text-5xl rtl:leading-[1.15] rtl:tracking-normal`,children:e}),t&&(0,H.jsx)(`p`,{className:`mt-4 max-w-2xl text-sm leading-6 text-gray-600 dark:text-dark-600 sm:text-base sm:leading-7`,children:t}),i&&(0,H.jsx)(`div`,{className:`mt-4`,children:i})]}),r&&(0,H.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 md:justify-end`,children:r})]}),Yc=s(`components:avatar-upload`),Xc=({value:e,onChange:t,className:n=``})=>{let{t:r}=l(),i=(0,V.useRef)(null),[a,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)(!1),u=async e=>{if(!e.type.startsWith(`image/`)){T.error(r(`user.avatar.invalidFile`));return}if(e.size>2*1024*1024){T.error(r(`user.avatar.fileTooLarge`));return}o(!0);try{let n=new FileReader;n.onload=e=>{let n=e.target?.result;t(n),T.success(r(`user.avatar.uploaded`))},n.onerror=()=>{T.error(r(`user.avatar.readFailed`))},n.readAsDataURL(e)}catch(e){Yc.error(`Failed to upload avatar:`,e),T.error(r(`user.avatar.uploadFailed`))}finally{o(!1)}},d=e=>{let t=e.target.files?.[0];t&&u(t)},f=e=>{e.preventDefault(),c(!0)},p=e=>{e.preventDefault(),c(!1)},m=e=>{e.preventDefault(),c(!1);let t=e.dataTransfer.files?.[0];t&&u(t)},h=()=>{t(``),T.success(r(`user.avatar.removed`))},g=()=>e||null;return(0,H.jsx)(`div`,{className:`space-y-4 ${n}`,children:(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-dark-600 mb-2`,children:r(`user.avatar.label`)}),(0,H.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,H.jsx)(`div`,{className:`flex-shrink-0`,children:(0,H.jsx)(`div`,{className:`w-20 h-20 rounded-full overflow-hidden bg-gray-100 dark:bg-dark-200 border-2 border-gray-300 dark:border-dark-300 flex items-center justify-center`,children:g()?(0,H.jsx)(`img`,{src:g(),alt:`Avatar preview`,className:`w-full h-full object-cover`}):(0,H.jsx)(le,{className:`h-8 w-8 text-gray-400 dark:text-gray-500`})})}),(0,H.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[e?(0,H.jsxs)(`div`,{className:`flex items-center gap-3 p-3 bg-gray-50 dark:bg-dark-200 rounded-lg`,children:[(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 truncate`,children:r(`user.avatar.customAvatar`)}),(0,H.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:r(`user.avatar.clickToChange`)})]}),(0,H.jsx)(k,{variant:`ghost`,size:`sm`,onClick:h,className:`text-red-600 hover:text-red-700 hover:bg-red-50 dark:text-red-400 dark:hover:text-red-300 dark:hover:bg-red-900/20`,children:(0,H.jsx)(ce,{className:`h-4 w-4`})})]}):(0,H.jsxs)(`div`,{className:`border-2 border-dashed rounded-lg p-4 text-center cursor-pointer transition-colors ${s?`border-primary-500 bg-primary-50 dark:bg-primary-900/20`:`border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500`}`,onDragOver:f,onDragLeave:p,onDrop:m,onClick:()=>i.current?.click(),children:[(0,H.jsx)(re,{className:`h-8 w-8 mx-auto text-gray-400 dark:text-gray-500 mb-2`}),(0,H.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 mb-2`,children:r(`user.avatar.uploadAvatarImage`)}),(0,H.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mb-2`,children:r(`user.avatar.dragAndDrop`)}),(0,H.jsxs)(k,{variant:`outline`,size:`sm`,disabled:a,className:`mx-auto`,children:[(0,H.jsx)(re,{className:`h-4 w-4 mr-2`}),r(a?`user.avatar.uploading`:`user.avatar.chooseImage`)]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{className:`block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1`,children:r(`user.avatar.enterImageUrl`)}),(0,H.jsx)(`input`,{type:`url`,value:e,onChange:e=>t(e.target.value),className:`w-full px-3 py-2 text-sm border border-gray-300 dark:border-dark-300 rounded-md bg-white dark:bg-dark-50 text-gray-900 dark:text-dark-800`,placeholder:`https://example.com/avatar.jpg`})]})]})]}),(0,H.jsx)(`input`,{ref:i,type:`file`,accept:`image/*`,onChange:d,className:`hidden`}),(0,H.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-2`,children:r(`user.avatar.supportedFormats`)})]})})};function Zc({open:e,value:t,saving:n,onChange:r,onClose:i,onSave:a}){let{t:o}=l();return e?(0,mc.createPortal)((0,H.jsx)(`div`,{className:`fixed inset-0 z-[2147483647] flex items-center justify-center bg-gray-950/55 p-4 backdrop-blur-md`,onClick:i,children:(0,H.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`avatar-modal-title`,className:`bg-white dark:bg-dark-25 rounded-3xl shadow-[0_24px_80px_rgba(0,0,0,0.24)] p-6 w-full max-w-md border border-black/[0.07] dark:border-white/[0.08] animate-scale-in`,onClick:e=>e.stopPropagation(),children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,H.jsx)(`h3`,{id:`avatar-modal-title`,className:`text-lg font-medium tracking-[-0.02em] text-gray-950 dark:text-dark-950`,children:o(`user.avatar.title`)}),(0,H.jsx)(`button`,{onClick:i,className:`p-2 hover:bg-gray-100 dark:hover:bg-dark-200 rounded-xl transition-colors`,children:(0,H.jsx)(ce,{size:20,className:`text-gray-500`})})]}),(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsx)(Xc,{value:t,onChange:r}),(0,H.jsxs)(`div`,{className:`flex justify-end gap-3 pt-4 border-t border-gray-200 dark:border-dark-300`,children:[(0,H.jsx)(`button`,{onClick:i,className:`px-4 py-2 text-sm font-medium text-gray-700 dark:text-dark-700 hover:bg-gray-100 dark:hover:bg-dark-200 rounded-xl transition-colors`,children:o(`common.cancel`)}),(0,H.jsx)(`button`,{onClick:a,disabled:n,className:`px-4 py-2 text-sm font-medium text-white bg-gray-950 hover:bg-gray-800 dark:bg-white dark:text-gray-950 dark:hover:bg-gray-100 disabled:opacity-50 disabled:cursor-not-allowed rounded-xl transition-colors`,children:o(n?`common.saving`:`common.save`)})]})]})]})}),document.body):null}var Qc={sm:`text-[1.0625rem] leading-none`,md:`text-[1.625rem] leading-none`,lg:`text-[2.5rem] leading-none`},$c=({className:e,size:t=`md`,wordmark:n=!0})=>(0,H.jsxs)(`span`,{dir:`ltr`,className:O(`libre-brand inline-flex items-baseline whitespace-nowrap`,Qc[t],e),children:[`Libre`,n&&(0,H.jsx)(`span`,{className:`ms-1 font-normal tracking-[-0.035em]`,children:`WebUI`})]}),el=()=>{let{theme:e,toggleTheme:t}=Xs(),n=e.mode===`light`?`dark`:`light`,r=e.mode===`light`?(0,H.jsx)(_,{className:`h-4 w-4 text-ink-muted transition-colors duration-150 group-hover:text-ink motion-reduce:transition-none`,strokeWidth:1.75,"aria-hidden":`true`}):(0,H.jsx)(de,{className:`h-4 w-4 text-ink-muted transition-colors duration-150 group-hover:text-ink motion-reduce:transition-none`,strokeWidth:1.75,"aria-hidden":`true`}),i=`Switch to ${n} mode`;return(0,H.jsx)(k,{variant:`ghost`,size:`sm`,onClick:t,className:`h-9 w-9 rounded-full p-0`,"aria-label":i,title:`${i} (⌘D)`,children:r})};function tl({sidebarCompact:e,isElectron:t,selectedModel:n,modelCount:r,onToggleCompact:i,onCreateSession:a}){let{t:o}=l(),s=!n||r===0,c=s?o(`chat.model.noModelsTooltip`):``;return(0,H.jsxs)(`div`,{className:O(e?`px-2 pb-3 pt-3`:`px-4 pb-4 pt-4`,t&&`pt-10`),children:[(0,H.jsx)(`div`,{className:O(`flex items-center`,e?`justify-center mb-3`:`justify-between mb-4`),children:e?(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,H.jsx)($c,{size:`sm`,wordmark:!1,className:`text-gray-950 dark:text-dark-950 text-base tracking-[-0.035em]`}),(0,H.jsx)(k,{variant:`ghost`,size:`sm`,onClick:i,className:`h-9 w-9 p-0 rounded-xl text-gray-500 dark:text-dark-600 hover:bg-white/80 dark:hover:bg-dark-200 hover:text-gray-950 dark:hover:text-dark-950 touch-manipulation`,title:o(`sidebar.expandSidebar`),"aria-label":o(`sidebar.expandSidebar`),children:(0,H.jsx)(oe,{className:`h-4 w-4 rtl:rotate-180`})}),(0,H.jsx)(el,{})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)($c,{size:`sm`,className:`text-gray-950 dark:text-dark-950 tracking-[-0.035em]`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,H.jsx)(el,{}),(0,H.jsx)(k,{variant:`ghost`,size:`sm`,onClick:i,className:`h-9 w-9 p-0 rounded-xl text-gray-500 dark:text-dark-600 hover:bg-white/80 dark:hover:bg-dark-200 hover:text-gray-950 dark:hover:text-dark-950 touch-manipulation`,title:o(`sidebar.toggleSize`),"aria-label":o(`sidebar.toggleSize`),children:(0,H.jsx)(ae,{className:`h-4 w-4 rtl:rotate-180`})})]})]})}),e?(0,H.jsx)(k,{onClick:a,disabled:s,className:`w-full h-10 rounded-xl bg-gray-950 hover:bg-gray-800 active:bg-gray-900 text-white dark:bg-white dark:text-gray-950 dark:hover:bg-gray-100 dark:active:bg-gray-200 shadow-none transition-colors duration-150 border-0 touch-manipulation p-0`,title:s?c:o(`chat.session.new`),"aria-label":o(`chat.session.new`),children:(0,H.jsx)(p,{className:`h-4 w-4`})}):(0,H.jsxs)(k,{onClick:a,disabled:s,className:`w-full h-10 rounded-xl bg-gray-950 hover:bg-gray-800 active:bg-gray-900 text-white dark:bg-white dark:text-gray-950 dark:hover:bg-gray-100 dark:active:bg-gray-200 shadow-none transition-colors duration-150 border-0 touch-manipulation`,size:`sm`,title:c,children:[(0,H.jsx)(p,{className:`h-4 w-4 me-2`}),o(`chat.session.new`)]})]})}function nl({sidebarCompact:e,activePath:t,onChatClick:n,onMobileNavigate:r}){let{t:i}=l(),a=t=>O(`flex items-center gap-3 rounded-xl text-[13px] font-medium transition-colors duration-150 touch-manipulation outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30`,e?`w-11 h-11 justify-center p-0`:`w-full px-3 py-2.5`,t?`bg-white text-gray-950 ring-1 ring-black/[0.04] dark:bg-dark-200 dark:text-dark-950 dark:ring-white/[0.06]`:`text-gray-600 dark:text-dark-600 hover:bg-white/60 dark:hover:bg-dark-200/60 hover:text-gray-950 dark:hover:text-dark-950 active:bg-white dark:active:bg-dark-200`),o=t===`/chat`||t===`/`||t.startsWith(`/c/`);return(0,H.jsx)(`div`,{className:O(`pb-3`,e?`px-2`:`px-3`),children:(0,H.jsxs)(`nav`,{className:O(`space-y-0.5`,e&&`flex flex-col items-center`),children:[(0,H.jsxs)(`button`,{onClick:n,className:O(a(o),`text-start`),title:e?i(`sidebar.navigation.chat`):void 0,"aria-current":o?`page`:void 0,children:[(0,H.jsx)(x,{className:`h-[18px] w-[18px] shrink-0`}),!e&&i(`sidebar.navigation.chat`)]}),(0,H.jsxs)(oa,{to:`/models`,onClick:r,className:a(t===`/models`),title:e?i(`sidebar.navigation.models`):void 0,"aria-current":t===`/models`?`page`:void 0,children:[(0,H.jsx)(E,{className:`h-[18px] w-[18px] shrink-0`}),!e&&i(`sidebar.navigation.models`)]}),(0,H.jsxs)(oa,{to:`/personas`,onClick:r,className:a(t===`/personas`),title:e?i(`sidebar.navigation.personas`):void 0,"aria-current":t===`/personas`?`page`:void 0,children:[(0,H.jsx)(le,{className:`h-[18px] w-[18px] shrink-0`}),!e&&i(`sidebar.navigation.personas`)]}),(0,H.jsxs)(oa,{to:`/gallery`,onClick:r,className:a(t===`/gallery`),title:e?i(`sidebar.navigation.imagine`):void 0,"aria-current":t===`/gallery`?`page`:void 0,children:[(0,H.jsx)(u,{className:`h-[18px] w-[18px] shrink-0`}),!e&&i(`sidebar.navigation.imagine`)]}),(0,H.jsxs)(oa,{to:`/agents`,onClick:r,className:a(t===`/agents`),title:e?i(`sidebar.navigation.agents`):void 0,"aria-current":t===`/agents`?`page`:void 0,children:[(0,H.jsx)(C,{className:`h-[18px] w-[18px] shrink-0`}),!e&&i(`sidebar.navigation.agents`)]})]})})}function rl({sessions:e,personas:t,currentSessionId:n,generatingTitleForSession:r,sidebarCompact:i,editingSessionId:a,editingTitle:o,onEditingTitleChange:s,onSelectSession:c,onStartEditing:u,onSaveEdit:d,onCancelEdit:f,onDeleteSession:p}){let{t:m,i18n:h}=l();return(0,H.jsx)(`div`,{"data-testid":`sidebar-session-scroll-region`,className:`scroll-region min-h-0 flex-1 scrollbar-thin border-t border-black/[0.05] dark:border-white/[0.05]`,style:{willChange:`scroll-position`},children:(0,H.jsxs)(`div`,{className:O(`px-3 py-3`,i&&`px-2`),children:[!i&&e.length>0&&(0,H.jsxs)(`div`,{className:`flex items-center justify-between mb-2 px-1`,children:[(0,H.jsx)(`h3`,{className:`text-[10px] font-semibold text-gray-500 dark:text-dark-500 uppercase tracking-[0.16em] rtl:tracking-normal`,children:m(`chat.session.chats`)}),(0,H.jsx)(`span`,{className:`text-[10px] tabular-nums text-gray-400 dark:text-dark-500 font-medium`,children:e.length})]}),e.length===0?(0,H.jsxs)(`div`,{className:O(`text-center py-8`,i?`px-1`:`px-2`),children:[(0,H.jsx)(`div`,{className:O(`mx-auto mb-3 bg-white/70 dark:bg-dark-200 rounded-xl flex items-center justify-center ring-1 ring-black/[0.04] dark:ring-white/[0.05]`,i?`w-8 h-8`:`w-12 h-12`),children:(0,H.jsx)(x,{className:O(`text-gray-400 dark:text-gray-500`,i?`h-4 w-4`:`h-5 w-5`)})}),!i&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-gray-600 dark:text-dark-600`,children:m(`chat.session.noChats`)}),(0,H.jsx)(`p`,{className:`text-xs mt-1 text-gray-400 dark:text-dark-500`,children:m(`chat.session.createFirst`)})]})]}):(0,H.jsx)(`div`,{className:O(`space-y-0.5`,i&&`space-y-1`),children:e.map(e=>{let l=n===e.id,g=e.personaId?t[e.personaId]:null;return(0,H.jsx)(`div`,{className:O(`group relative cursor-pointer transition-colors duration-150 touch-manipulation outline-none`,i?`rounded-xl p-1 flex items-center justify-center`:`rounded-xl px-3 py-2.5`,l?`bg-white ring-1 ring-black/[0.04] dark:bg-dark-200 dark:ring-white/[0.05]`:`hover:bg-white/60 dark:hover:bg-dark-200/60`),onClick:()=>c(e),title:i?`${e.title} - ${e.model}`:void 0,children:i?(0,H.jsx)(`div`,{className:`flex items-center justify-center w-full h-10`,children:(0,H.jsx)(`div`,{className:O(`flex h-9 w-9 items-center justify-center rounded-xl text-[11px] font-semibold uppercase transition-colors`,r===e.id?`bg-white text-primary-600 animate-pulse dark:bg-dark-200 dark:text-primary-400`:l?`bg-gray-950 text-white dark:bg-white dark:text-gray-950`:`bg-white/70 text-gray-500 ring-1 ring-black/[0.04] dark:bg-dark-200/70 dark:text-dark-600 dark:ring-white/[0.05]`),children:e.title.trim().charAt(0)||`•`})}):a===e.id?(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,onClick:e=>e.stopPropagation(),children:[(0,H.jsx)(hc,{value:o,onChange:e=>s(e.target.value),onKeyDown:t=>{t.key===`Enter`?d(e.id):t.key===`Escape`&&f()},className:`text-sm h-8`,autoFocus:!0}),(0,H.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>d(e.id),className:`h-8 w-8 p-0 shrink-0 hover:bg-gray-100 dark:hover:bg-dark-300 active:bg-gray-200 dark:active:bg-dark-400 touch-manipulation`,children:(0,H.jsx)(ge,{className:`h-3 w-3`})}),(0,H.jsx)(k,{variant:`ghost`,size:`sm`,onClick:f,className:`h-8 w-8 p-0 shrink-0 hover:bg-gray-100 dark:hover:bg-dark-300 active:bg-gray-200 dark:active:bg-dark-400 touch-manipulation`,children:(0,H.jsx)(ce,{className:`h-3 w-3`})})]}):(0,H.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,H.jsxs)(`div`,{className:`flex-1 min-w-0 me-2`,children:[(0,H.jsx)(`h3`,{className:`text-[13px] font-medium truncate leading-tight text-gray-900 dark:text-dark-900`,children:r===e.id?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,H.jsx)(`span`,{className:`animate-pulse`,children:m(`chat.session.generatingTitle`)}),(0,H.jsxs)(`span`,{className:`inline-flex`,children:[(0,H.jsx)(`span`,{className:`animate-bounce`,style:{animationDelay:`0ms`},children:`.`}),(0,H.jsx)(`span`,{className:`animate-bounce`,style:{animationDelay:`150ms`},children:`.`}),(0,H.jsx)(`span`,{className:`animate-bounce`,style:{animationDelay:`300ms`},children:`.`})]})]}):je(e.title,32)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-0.5`,children:[(0,H.jsx)(`span`,{dir:`auto`,className:O(`text-[11px] tabular-nums`,l?`text-gray-500 dark:text-dark-600`:`text-gray-400 dark:text-dark-500`),children:Me(e.updatedAt,h.language)}),(0,H.jsx)(`span`,{className:`text-gray-300 dark:text-dark-400`,children:`•`}),e.personaId?g?(0,H.jsxs)(`span`,{className:O(`flex items-center gap-1 text-[11px] font-medium`,l?`text-primary-600 dark:text-primary-400`:`text-primary-500 dark:text-primary-500`),title:g.description||g.name,children:[g.avatar&&!g.avatar.startsWith(`data:`)&&(0,H.jsx)(`span`,{className:`text-[10px]`,children:g.avatar}),(0,H.jsx)(`span`,{className:`truncate max-w-[100px]`,children:g.name})]}):(0,H.jsx)(`span`,{className:O(`text-[11px] font-medium italic`,l?`text-gray-500 dark:text-gray-500`:`text-gray-400 dark:text-gray-600`),children:`Persona`}):(0,H.jsx)(`span`,{dir:`ltr`,className:O(`text-[11px] font-medium truncate max-w-[108px]`,l?`text-gray-700 dark:text-gray-300`:`text-gray-600 dark:text-gray-400`),title:e.model,children:e.model})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100 transition-opacity duration-150 shrink-0`,children:[(0,H.jsx)(k,{variant:`ghost`,size:`sm`,onClick:t=>u(e,t),className:`h-7 w-7 sm:h-7 sm:w-7 p-0 hover:bg-gray-100 dark:hover:bg-dark-300 rounded-lg touch-manipulation`,title:m(`chat.session.renameChat`),children:(0,H.jsx)(v,{className:`h-3 w-3`})}),(0,H.jsx)(k,{variant:`ghost`,size:`sm`,onClick:t=>p(e.id,t),className:`h-7 w-7 sm:h-7 sm:w-7 p-0 text-red-500 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg touch-manipulation`,title:m(`chat.session.deleteChat`),children:(0,H.jsx)(pe,{className:`h-3 w-3`})})]})]})},e.id)})})]})})}function il({user:e,size:t}){let n=t===`sm`?`w-7 h-7`:`w-8 h-8`,r=t===`sm`?`text-xs`:`text-sm`;return e.avatar?(0,H.jsx)(`img`,{src:e.avatar,alt:e.username,className:`${n} rounded-full object-cover ring-1 ring-black/10 dark:ring-white/10`,title:`${e.username} (${e.role})`}):(0,H.jsx)(`div`,{className:`${n} bg-gray-950 dark:bg-white rounded-full flex items-center justify-center`,title:`${e.username} (${e.role})`,children:(0,H.jsx)(`span`,{className:`text-white dark:text-gray-950 ${r} font-medium`,children:e.username.charAt(0).toUpperCase()})})}function al({requiresAuth:e,user:t,isAdmin:n,sidebarCompact:r,userMenuOpen:i,userMenuRef:a,onToggleUserMenu:o,onOpenSettings:s,onOpenAvatar:c,onLogout:u,onMobileNavigate:d,onCloseUserMenu:f}){let{t:p}=l();return!e||!t?null:(0,H.jsx)(`div`,{className:O(`border-t border-black/[0.05] dark:border-white/[0.05]`,r?`p-2`:`p-3`),children:r?(0,H.jsxs)(`div`,{className:`flex flex-col items-center space-y-2`,children:[(0,H.jsx)(il,{user:t,size:`sm`}),(0,H.jsx)(`button`,{onClick:s,className:`w-10 h-10 flex items-center justify-center rounded-xl text-gray-600 dark:text-dark-600 hover:bg-white/70 dark:hover:bg-dark-200 hover:text-gray-950 dark:hover:text-dark-950 touch-manipulation transition-colors duration-150`,title:p(`sidebar.navigation.settings`),children:(0,H.jsx)(he,{className:`h-4 w-4`})}),n&&(0,H.jsx)(oa,{to:`/users`,onClick:d,className:`w-10 h-10 flex items-center justify-center rounded-xl text-gray-600 dark:text-dark-600 hover:bg-white/70 dark:hover:bg-dark-200 hover:text-gray-950 dark:hover:text-dark-950 touch-manipulation transition-colors duration-150`,title:p(`sidebar.navigation.userManagement`),children:(0,H.jsx)(le,{className:`h-4 w-4`})}),(0,H.jsx)(`button`,{onClick:u,className:`w-10 h-10 flex items-center justify-center rounded-xl text-gray-500 dark:text-dark-500 hover:bg-red-50 dark:hover:bg-red-900/20 hover:text-red-600 dark:hover:text-red-400 touch-manipulation transition-colors duration-150`,title:p(`sidebar.navigation.signOut`),children:(0,H.jsx)(g,{className:`h-4 w-4`})})]}):(0,H.jsxs)(`div`,{className:`relative`,ref:a,children:[(0,H.jsx)(`button`,{onClick:o,className:`w-full p-2.5 rounded-xl hover:bg-white/70 dark:hover:bg-dark-200 transition-colors duration-150 text-start touch-manipulation outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,H.jsx)(il,{user:t,size:`sm`}),(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 truncate`,children:t.username}),(0,H.jsxs)(`div`,{className:`flex items-center mt-0.5`,children:[t.role===`admin`&&(0,H.jsx)(ie,{size:10,className:`text-primary-500 me-1`}),(0,H.jsx)(`span`,{className:`text-[11px] text-gray-500 dark:text-dark-500 capitalize`,children:t.role})]})]}),(0,H.jsx)(oe,{className:O(`h-4 w-4 text-gray-400 dark:text-dark-500 transition-transform duration-150 rtl:rotate-180`,i&&`rotate-90 rtl:rotate-90`)})]})}),i&&(0,H.jsxs)(`div`,{className:`scroll-region absolute bottom-full left-0 right-0 z-50 mb-2 max-h-[calc(100dvh-1rem)] rounded-2xl border border-black/[0.07] bg-white/95 py-2 shadow-[0_18px_60px_rgba(15,23,42,0.16)] backdrop-blur-xl animate-scale-in scrollbar-thin dark:border-white/[0.08] dark:bg-dark-25/95`,children:[(0,H.jsx)(`div`,{className:`px-3 py-2 border-b border-gray-100 dark:border-dark-200/50`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,H.jsx)(il,{user:t,size:`md`}),(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 truncate`,children:t.username}),(0,H.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 truncate`,children:t.email||p(`user.profile.noEmail`)})]})]})}),(0,H.jsxs)(`div`,{className:`py-1`,children:[(0,H.jsxs)(`button`,{onClick:()=>{c(t.avatar||``),f()},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[13px] text-gray-700 dark:text-dark-700 hover:bg-gray-100/70 dark:hover:bg-dark-200/70 transition-colors duration-150 text-start`,children:[(0,H.jsx)(_e,{className:`h-4 w-4 shrink-0`}),p(`user.menu.changePicture`)]}),(0,H.jsxs)(`button`,{onClick:()=>{s(),f()},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[13px] text-gray-700 dark:text-dark-700 hover:bg-gray-100/70 dark:hover:bg-dark-200/70 transition-colors duration-150 text-start`,children:[(0,H.jsx)(he,{className:`h-4 w-4 shrink-0`}),p(`user.menu.settings`)]}),n&&(0,H.jsxs)(oa,{to:`/users`,onClick:()=>{f(),d()},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[13px] text-gray-700 dark:text-dark-700 hover:bg-gray-100/70 dark:hover:bg-dark-200/70 transition-colors duration-150`,children:[(0,H.jsx)(le,{className:`h-4 w-4 shrink-0`}),p(`user.menu.userManagement`)]}),(0,H.jsx)(`div`,{className:`border-t border-gray-100 dark:border-dark-200/50 my-1`}),(0,H.jsxs)(`button`,{onClick:()=>{u(),f()},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[13px] text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors duration-150 text-start`,children:[(0,H.jsx)(g,{className:`h-4 w-4 shrink-0`}),p(`user.menu.logout`)]})]})]})]})})}var ol=s(`components:sidebar`),sl=V.lazy(()=>o(()=>import(`../js/SettingsModal-DvFcpdVU.js`).then(e=>({default:e.SettingsModal})),__vite__mapDeps([10,1,5,11,12,2,3,13,14,0,4,7,15]))),cl=({isOpen:e,onClose:t,className:n})=>{let{t:r}=l(),i=K(),a=Hr(),{sessions:o,deleteSession:s,updateSessionTitle:c,selectedModel:u,models:d,currentSession:p,generatingTitleForSession:m,personas:h}=ps(),{user:g,isAdmin:_,systemInfo:v,setUser:y}=$(),{backgroundImage:b,sidebarCompact:x,toggleSidebarCompact:S}=Xs(),[ee,C]=(0,V.useState)(null),[w,T]=(0,V.useState)(``),[te,ne]=(0,V.useState)(!1),[re,E]=(0,V.useState)(!1),[ie,ae]=(0,V.useState)(!1),[oe,se]=(0,V.useState)(``),[ce,le]=(0,V.useState)(!1),ue=(0,V.useRef)(null),de=(0,V.useRef)(null),{sessionId:fe}=Wr(),pe=fe||null,me=p?.id||pe,he=()=>{window.innerWidth<768&&!x&&S()},ge=()=>{let{setCurrentSession:e}=ps.getState();fc(),e(null),sessionStorage.setItem(`forceWelcomeScreen`,`true`)};(0,V.useEffect)(()=>{let e=e=>{ue.current&&!ue.current.contains(e.target)&&E(!1)};if(re)return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[re]),(0,V.useEffect)(()=>{let t=t=>{de.current&&!de.current.contains(t.target)&&window.innerWidth<768&&e&&!x&&S()};if(e&&!x&&window.innerWidth<768)return document.addEventListener(`mousedown`,t),()=>document.removeEventListener(`mousedown`,t)},[e,x,S]);let _e=async()=>{le(!0);try{let e=await Ae.updateMyAvatar(oe||null);e.success&&e.data?(y(e.data),f.success(r(`user.avatar.updated`)),ae(!1)):f.error(e.message||r(`user.avatar.updateFailed`))}catch(e){ol.error(`Failed to update avatar:`,e),f.error(r(`user.avatar.updateFailed`))}finally{le(!1)}},ve=()=>{ge(),a(`/chat`,{replace:!0}),he()},ye=()=>{ge(),a(`/chat`,{replace:!0}),he()},be=e=>{a(`/c/${e.id}`,{replace:!0}),he()},xe=async(e,t)=>{if(t.stopPropagation(),ol.debug(`Delete session clicked:`,e),window.confirm(r(`chat.session.deleteConfirm`)))try{ol.debug(`Attempting to delete session:`,e);let t=me===e;if(await s(e),ol.debug(`Session deleted successfully`),t){let t=o.filter(t=>t.id!==e);t.length>0?a(`/c/${t[0].id}`,{replace:!0}):a(`/`,{replace:!0})}}catch(e){ol.error(`Error deleting session:`,e)}},Se=(e,t)=>{t.stopPropagation(),C(e.id),T(e.title)},Ce=async e=>{w.trim()&&await c(e,w.trim()),C(null),T(``)},we=()=>{C(null),T(``)},Te=async()=>{try{await ke.logout();let{logout:e}=$.getState();e(),a(`/login`),f.success(r(`auth.logout.success`))}catch(e){ol.error(`Logout error:`,e);let{logout:t}=$.getState();t(),a(`/login`)}},Ee=()=>{ne(!0),he()},De=e=>{se(e),ae(!0)},Oe=window.location.protocol===`file:`;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{ref:de,"data-testid":`sidebar`,className:O(`fixed inset-y-0 start-0 z-50 border-e border-black/[0.06] dark:border-white/[0.06] transform transition-[width,transform,background-color] duration-200 ease-out shadow-[0_24px_80px_rgba(15,23,42,0.12)]`,x?`w-18`:`w-72 max-sm:w-64`,e?`translate-x-0`:`ltr:-translate-x-full rtl:translate-x-full`,`lg:shadow-none`,b?`bg-gray-100/75 dark:bg-dark-50/75 backdrop-blur-xl`:`bg-gray-100 dark:bg-dark-50`,`overscroll-behavior-contain`,n),style:{WebkitOverflowScrolling:`touch`},children:[Oe&&(0,H.jsx)(`div`,{className:`absolute top-0 start-16 end-0 h-8 z-[60]`,style:{WebkitAppRegion:`drag`}}),(0,H.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,H.jsx)(tl,{sidebarCompact:x,isElectron:Oe,selectedModel:u,modelCount:d.length,onToggleCompact:S,onCreateSession:ve}),(0,H.jsx)(nl,{sidebarCompact:x,activePath:i.pathname,onChatClick:ye,onMobileNavigate:he}),(0,H.jsx)(rl,{sessions:o,personas:h,currentSessionId:me,generatingTitleForSession:m,sidebarCompact:x,editingSessionId:ee,editingTitle:w,onEditingTitleChange:T,onSelectSession:be,onStartEditing:Se,onSaveEdit:Ce,onCancelEdit:we,onDeleteSession:xe}),(0,H.jsx)(al,{requiresAuth:v?.requiresAuth,user:g,isAdmin:_(),sidebarCompact:x,userMenuOpen:re,userMenuRef:ue,onToggleUserMenu:()=>E(e=>!e),onOpenSettings:Ee,onOpenAvatar:De,onLogout:Te,onMobileNavigate:he,onCloseUserMenu:()=>E(!1)})]})]}),te&&(0,H.jsx)(V.Suspense,{fallback:null,children:(0,H.jsx)(sl,{isOpen:te,onClose:()=>ne(!1)})}),(0,H.jsx)(Zc,{open:ie,value:oe,saving:ce,onChange:se,onClose:()=>ae(!1),onSave:_e})]})},ll=({children:e,requireAuth:t=!0,requireAdmin:n=!1})=>{let{isAuthenticated:r,user:i,systemInfo:a,isLoading:o}=$();return K(),o?(0,H.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-gray-50 dark:bg-dark-50`,children:(0,H.jsx)(`div`,{className:`w-8 h-8 border-4 border-gray-200 dark:border-dark-300 border-t-primary-500 dark:border-t-primary-400 rounded-full animate-spin`})}):a&&!a.requiresAuth?(0,H.jsx)(H.Fragment,{children:e}):t&&!r?(0,H.jsx)(mi,{to:`/login`,replace:!0}):n&&(!i||i.role!==`admin`)?(0,H.jsx)(mi,{to:`/`,replace:!0}):(0,H.jsx)(H.Fragment,{children:e})},ul=s(`components:error-boundary`),dl=({error:e})=>{let{t}=l();return(0,H.jsx)(`div`,{className:`min-h-screen bg-gray-50 dark:bg-dark-50 flex items-center justify-center p-4 text-gray-900 dark:text-dark-800`,children:(0,H.jsx)(`div`,{className:`w-full max-w-md rounded-2xl border border-gray-200 dark:border-dark-300 bg-white/95 dark:bg-dark-100/95 shadow-card backdrop-blur-sm`,children:(0,H.jsxs)(`div`,{className:`p-6 text-center`,children:[(0,H.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-2xl bg-primary-100 text-primary-700 dark:bg-primary-900/35 dark:text-primary-300 ring-1 ring-primary-200 dark:ring-primary-800/60`,children:(0,H.jsx)(b,{className:`h-6 w-6`})}),(0,H.jsx)(`h1`,{className:`mb-2 text-xl font-semibold text-gray-950 dark:text-dark-950`,children:t(`errorBoundary.title`)}),(0,H.jsx)(`p`,{className:`mb-5 text-sm leading-6 text-gray-600 dark:text-dark-600`,children:t(`errorBoundary.description`)}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:justify-center`,children:[(0,H.jsxs)(`button`,{onClick:()=>window.location.reload(),className:`inline-flex items-center justify-center gap-2 rounded-xl bg-primary-600 px-4 py-2.5 text-sm font-medium text-white shadow-sm transition-all hover:bg-primary-700 hover:shadow-md focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 dark:focus:ring-offset-dark-100`,children:[(0,H.jsx)(w,{className:`h-4 w-4`}),t(`errorBoundary.tryAgain`)]}),(0,H.jsxs)(`button`,{onClick:()=>{window.location.assign(`/`)},className:`inline-flex items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white px-4 py-2.5 text-sm font-medium text-gray-700 shadow-sm transition-all hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 dark:border-dark-300 dark:bg-dark-50 dark:text-dark-700 dark:hover:bg-dark-200 dark:focus:ring-offset-dark-100`,children:[(0,H.jsx)(m,{className:`h-4 w-4`}),t(`common.home`,`Home`)]})]}),!1]})})})},fl=class extends V.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){ul.error(`ErrorBoundary caught an error:`,e,t)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,H.jsx)(dl,{error:this.state.error}):this.props.children}},pl=(e,t=!0)=>{let n=(0,V.useCallback)(n=>{if(!t)return;let r=n.target;if(r.tagName===`INPUT`||r.tagName===`TEXTAREA`||r.contentEditable===`true`||r.isContentEditable)return;if(n.key===`?`||n.key===`/`&&n.shiftKey){let t=e.find(e=>e.key===`?`||e.key===`h`);if(t){n.preventDefault(),n.stopPropagation(),t.action();return}}let i=e.find(e=>{let t=e.key.toLowerCase()===n.key.toLowerCase(),r=!!e.metaKey,i=n.metaKey||n.ctrlKey,a=r?i:!0,o=e.ctrlKey?n.ctrlKey:!0,s=!!e.shiftKey===n.shiftKey,c=!!e.altKey===n.altKey;return t&&a&&o&&s&&c});i&&(n.preventDefault(),n.stopPropagation(),i.action())},[e,t]);(0,V.useEffect)(()=>{if(t)return document.addEventListener(`keydown`,n),()=>{document.removeEventListener(`keydown`,n)}},[n,t])},ml=e=>{let t=[];e.metaKey&&t.push(navigator.platform.includes(`Mac`)?`⌘`:`Ctrl`),e.ctrlKey&&t.push(`Ctrl`),e.shiftKey&&t.push(`⇧`),e.altKey&&t.push(navigator.platform.includes(`Mac`)?`⌥`:`Alt`);let n=e.key.toUpperCase();return e.key===`,`&&(n=`,`),e.key===` `&&(n=`Space`),e.key===`Enter`&&(n=`↩`),e.key===`Escape`&&(n=`Esc`),t.push(n),t.join(`+`)},hl=({isOpen:e,onClose:t,shortcuts:n})=>{let{t:r}=l();if(!e)return null;let i={navigation:n.filter(e=>e.description.includes(`sidebar`)||e.description.includes(`Toggle`)),settings:n.filter(e=>e.description.includes(`settings`)||e.description.includes(`dark mode`)),general:n.filter(e=>!e.description.includes(`sidebar`)&&!e.description.includes(`settings`)&&!e.description.includes(`dark mode`)&&!e.description.includes(`Toggle`))};return(0,H.jsx)(`div`,{className:`fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4`,children:(0,H.jsxs)(`div`,{className:`flex max-h-[calc(100dvh-2rem)] min-h-0 w-full max-w-md flex-col overflow-hidden rounded-xl bg-white shadow-2xl dark:bg-dark-100 sm:max-h-[80dvh]`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between p-6 border-b border-gray-200 dark:border-dark-300`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(d,{className:`h-5 w-5 text-gray-700 dark:text-dark-600`}),(0,H.jsx)(`h2`,{className:`text-lg font-semibold text-gray-900 dark:text-dark-800`,children:r(`keyboard.title`)})]}),(0,H.jsx)(k,{variant:`ghost`,size:`sm`,onClick:t,className:`h-8 w-8 p-0 hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,H.jsx)(ce,{className:`h-4 w-4`})})]}),(0,H.jsxs)(`div`,{className:`scroll-region min-h-0 flex-1 space-y-6 p-6 scrollbar-thin`,children:[Object.entries(i).map(([e,t])=>t.length===0?null:(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-medium text-gray-700 dark:text-dark-600 mb-3`,children:r(`keyboard.groups.${e}`)}),(0,H.jsx)(`div`,{className:`space-y-2`,children:t.map((e,t)=>(0,H.jsxs)(`div`,{className:`flex items-center justify-between py-2`,children:[(0,H.jsx)(`span`,{className:`text-sm text-gray-600 dark:text-dark-500`,children:e.description}),(0,H.jsx)(`kbd`,{className:`px-2 py-1 text-xs font-mono bg-gray-100 dark:bg-dark-200 text-gray-700 dark:text-dark-600 rounded border border-gray-300 dark:border-dark-400`,children:ml(e)})]},t))})]},e)),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-medium text-gray-700 dark:text-dark-600 mb-3`,children:r(`keyboard.groups.chat`)}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between py-2`,children:[(0,H.jsx)(`span`,{className:`text-sm text-gray-600 dark:text-dark-500`,children:r(`keyboard.actions.sendMessage`)}),(0,H.jsx)(`kbd`,{className:`px-2 py-1 text-xs font-mono bg-gray-100 dark:bg-dark-200 text-gray-700 dark:text-dark-600 rounded border border-gray-300 dark:border-dark-400`,children:`Enter`})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between py-2`,children:[(0,H.jsx)(`span`,{className:`text-sm text-gray-600 dark:text-dark-500`,children:r(`keyboard.actions.newLine`)}),(0,H.jsx)(`kbd`,{className:`px-2 py-1 text-xs font-mono bg-gray-100 dark:bg-dark-200 text-gray-700 dark:text-dark-600 rounded border border-gray-300 dark:border-dark-400`,children:`Shift+Enter`})]})]})]})]}),(0,H.jsx)(`div`,{className:`px-6 py-4 bg-gray-50 dark:bg-dark-200 border-t border-gray-200 dark:border-dark-300`,children:(0,H.jsxs)(`p`,{className:`text-xs text-gray-500 dark:text-dark-400 text-center`,children:[r(`keyboard.footer`,{key1:`?`,key2:`H`}).split(`?`)[0],(0,H.jsx)(`kbd`,{className:`px-1 py-0.5 text-xs font-mono bg-gray-200 dark:bg-dark-300 rounded`,children:`?`}),r(`keyboard.footer`,{key1:`?`,key2:`H`}).split(`?`)[1].split(`H`)[0],(0,H.jsx)(`kbd`,{className:`px-1 py-0.5 text-xs font-mono bg-gray-200 dark:bg-dark-300 rounded`,children:`H`}),r(`keyboard.footer`,{key1:`?`,key2:`H`}).split(`H`)[1]]})})]})})},gl=({onClick:e,className:t})=>{let{t:n}=l(),[r,i]=(0,V.useState)(!1);return(0,H.jsxs)(k,{variant:`ghost`,size:`sm`,onClick:e,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),className:O(`fixed bottom-4 end-4 h-10 w-10 p-0 bg-white/80 dark:bg-dark-100/80 backdrop-blur-sm border border-gray-200 dark:border-dark-300 shadow-lg hover:shadow-xl transition-all duration-200 z-50`,`hover:bg-white dark:hover:bg-dark-100`,t),title:n(`keyboard.tooltip`),children:[(0,H.jsx)(d,{className:`h-4 w-4`}),r&&(0,H.jsx)(`div`,{className:`absolute bottom-full mb-2 end-0 px-2 py-1 text-xs bg-gray-900 text-white rounded whitespace-nowrap`,children:n(`keyboard.tooltip`)})]})},_l=({message:e=`This is a demo version for presentation purposes only. The Ollama backend is not connected.`,onDismiss:t,className:n})=>{let[r,i]=(0,V.useState)(!1),{t:a}=l();return r?null:(0,H.jsx)(`div`,{className:O(`bg-gray-950 text-white dark:bg-white dark:text-gray-950`,`border-b border-black/10 dark:border-white/10`,`px-4 py-2`,n),children:(0,H.jsxs)(`div`,{className:`flex items-center justify-between max-w-6xl mx-auto gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[(0,H.jsx)(`div`,{className:`flex-shrink-0`,children:(0,H.jsx)(h,{className:`h-4 w-4 text-white/65 dark:text-gray-950/60`})}),(0,H.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,H.jsx)(`p`,{className:`shrink-0 text-xs font-semibold tracking-wide`,children:a(`demoMode.title`)}),(0,H.jsx)(`p`,{className:`hidden truncate text-xs text-white/60 dark:text-gray-950/60 sm:block`,children:e})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 ml-4`,children:[(0,H.jsxs)(k,{variant:`ghost`,size:`sm`,className:`h-8 px-2 text-white/70 hover:bg-white/10 hover:text-white dark:text-gray-950/70 dark:hover:bg-black/[0.06] dark:hover:text-gray-950`,onClick:()=>window.open(`https://github.com/libre-webui/libre-webui`,`_blank`),title:`View on GitHub`,children:[(0,H.jsx)(ue,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`ml-1 hidden sm:inline`,children:a(`demoMode.github`)})]}),(0,H.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>{i(!0),t?.()},className:`h-8 w-8 p-0 text-white/70 hover:bg-white/10 hover:text-white dark:text-gray-950/70 dark:hover:bg-black/[0.06] dark:hover:text-gray-950`,title:`Dismiss`,children:(0,H.jsx)(ce,{className:`h-4 w-4`})})]})]})})},vl=()=>{let{preferences:e,backgroundImage:t}=Xs(),n=e.backgroundSettings||{enabled:!1,imageUrl:``,blurAmount:10,opacity:.6},r=t||n.imageUrl;return!n.enabled||!r?null:(0,H.jsx)(`div`,{className:`fixed inset-0 pointer-events-none z-0`,style:{backgroundImage:`url(${r})`,backgroundSize:`cover`,backgroundPosition:`center`,backgroundRepeat:`no-repeat`,filter:`blur(${n.blurAmount}px)`,opacity:n.opacity,transform:`scale(1.1)`}})},yl=s(`user-service`),bl=class{static async initializeAuth(){let{setLoading:e,setSystemInfo:t,login:n}=$.getState();try{e(!0),yl.debug(`Starting auth initialization...`),yl.debug(`Fetching system info...`);let r=await ke.getSystemInfo();yl.debug(`System info response:`,r),r.success&&r.data?(yl.debug(`Setting system info:`,r.data),t(r.data)):yl.error(`System info response failed:`,r);let i=localStorage.getItem(`auth-token`);if(i)try{let e=(await o(async()=>{let{default:e}=await import(`../js/utils-vendor-BX3ZwoIK.js`).then(e=>e.i);return{default:e}},__vite__mapDeps([4,1,5]))).default,t=e.defaults.headers.common;e.defaults.headers.common.Authorization=`Bearer ${i}`;let r=await ke.verifyToken();if(r.success&&r.data){let e=$.getState().systemInfo;e&&n(r.data,i,e)}e.defaults.headers.common=t}catch(e){yl.error(`Token verification failed:`,e),localStorage.removeItem(`auth-token`)}}catch(e){yl.error(`Auth initialization error:`,e)}finally{e(!1)}}};ye.interceptors.request.use(e=>{let t=localStorage.getItem(`auth-token`);return t&&(e.headers.Authorization=`Bearer ${t}`),e},e=>Promise.reject(e)),ye.interceptors.response.use(e=>e,e=>{if(e.response?.status===401){localStorage.removeItem(`auth-token`);let{logout:e}=$.getState();e();let t=window.location.protocol===`file:`;window.location.href=t?`#/login`:`/login`}return Promise.reject(e)});var xl=s(`initialize`),Sl=()=>{let e=(0,V.useRef)(!1),{loadSessions:t,loadModels:n,loadPreferences:r,setSelectedModel:i,models:a}=ps(),{loadPreferences:o}=Xs(),{loadPlugins:s,plugins:c}=Qs();(0,V.useEffect)(()=>{e.current||(async()=>{try{if(xl.debug(`Initializing Libre WebUI...`),e.current=!0,await bl.initializeAuth(),!(await De.checkHealth()).success)if(Se()){await Promise.all([o(),r()]),await Promise.all([n(),t(),s()]);return}else{T.error(`Ollama service is not available. Please make sure it's running.`);return}await Promise.all([o(),r()]),await Promise.all([n(),t(),s()]),xl.debug(`Libre WebUI initialized successfully`)}catch(e){Se()?(await Promise.all([o(),r()]),await Promise.all([n(),t(),s()])):(xl.error(`Failed to initialize app:`,e),T.error(`Failed to connect to the backend service`))}})()},[o,r,n,t,s]),(0,V.useEffect)(()=>{if(a.length>0){let e=a.filter(e=>!e.name.includes(`embed`))[0]||a[0],{selectedModel:t}=ps.getState();t?a.map(e=>e.name).includes(t)||(xl.debug(`Selected model not available, falling back to:`,e.name),i(e.name)):(xl.debug(`No model selected, using first available:`,e.name),i(e.name))}},[a,i]),(0,V.useEffect)(()=>{c.filter(e=>e.active).length>0&&(xl.debug(`Active plugins changed, reloading models...`),n())},[c,n])},Cl=s(`components:git-hub-auth-button`),wl=()=>{let{t:e}=l(),[t,n]=(0,V.useState)(!1),[r,i]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{(async()=>{try{let e=await fetch(`${Te}/auth/oauth/github/status`,{method:`GET`,credentials:`include`});if(e.ok){let t=await e.json();i(t.configured||!1),Cl.debug(`GitHub OAuth configured:`,t.configured)}else Cl.debug(`GitHub OAuth status check failed`),i(!1)}catch(e){Cl.debug(`GitHub OAuth not configured:`,e),i(!1)}})()},[]),r?(0,H.jsx)(`button`,{type:`button`,onClick:()=>{if(!r||t)return;n(!0);let e=`${Te}/auth/oauth/github`;window.location.href=e},disabled:t,className:`flex h-11 w-full items-center justify-center rounded-xl border border-line bg-surface-raised px-4 text-sm font-medium text-ink shadow-subtle transition-colors hover:border-line-strong hover:bg-surface-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:t?(0,H.jsxs)(`div`,{className:`flex items-center`,children:[(0,H.jsx)(y,{size:16,className:`me-2 animate-spin`}),e(`auth.oauth.connectingTo`,{provider:e(`auth.oauth.github`)})]}):(0,H.jsxs)(`div`,{className:`flex items-center`,children:[(0,H.jsx)(te,{size:16,className:`me-2`}),e(`auth.oauth.continueWith`,{provider:e(`auth.oauth.github`)})]})}):null},Tl=s(`components:hugging-face-auth-button`),El=()=>{let{t:e}=l(),[t,n]=(0,V.useState)(!1),[r,i]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{(async()=>{try{let e=await fetch(`${Te}/auth/oauth/huggingface/status`,{method:`GET`,credentials:`include`});if(e.ok){let t=await e.json();i(t.configured||!1),Tl.debug(`Hugging Face OAuth configured:`,t.configured)}else Tl.debug(`Hugging Face OAuth status check failed`),i(!1)}catch(e){Tl.debug(`Hugging Face OAuth not configured:`,e),i(!1)}})()},[]),r?(0,H.jsx)(`button`,{type:`button`,onClick:()=>{if(!r||t)return;n(!0);let e=`${Te}/auth/oauth/huggingface`;window.location.href=e},disabled:t,className:`flex h-11 w-full items-center justify-center rounded-xl border border-line bg-surface-raised px-4 text-sm font-medium text-ink shadow-subtle transition-colors hover:border-line-strong hover:bg-surface-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:t?(0,H.jsxs)(`div`,{className:`flex items-center`,children:[(0,H.jsx)(y,{size:16,className:`me-2 animate-spin`}),e(`auth.oauth.connectingTo`,{provider:e(`auth.oauth.huggingFace`)})]}):(0,H.jsxs)(`div`,{className:`flex items-center`,children:[(0,H.jsx)(`span`,{className:`me-2 text-base`,children:`🤗`}),e(`auth.oauth.continueWith`,{provider:e(`auth.oauth.huggingFace`)})]})}):null},Dl=s(`components:login-form`),Ol={username:`demo`,password:`demo`},kl=({onLogin:e,onShowSignup:t})=>{let{t:n}=l(),r=Se(),[i,a]=(0,V.useState)(r?Ol.username:``),[o,s]=(0,V.useState)(r?Ol.password:``),[c,u]=(0,V.useState)(!1),[d,p]=(0,V.useState)(!1),m=Hr(),{login:h}=$(),g=async t=>{t.preventDefault();let a=r?Ol.username:i.trim(),s=r?Ol.password:o.trim();if(!a||!s){f.error(n(`auth.login.enterBoth`));return}p(!0);try{localStorage.removeItem(`auth-token`);let t=await ke.login({username:a,password:s});t.success&&t.data?(h(t.data.user,t.data.token,t.data.systemInfo),f.success(n(`auth.login.loginSuccess`)),e?.(),m(`/`)):f.error(t.message||n(`auth.login.loginFailed`))}catch(e){Dl.error(`Login error:`,e),f.error(n(`auth.login.checkCredentials`))}finally{p(!1)}},_=e=>{if(e.key===`Enter`){let t=e.currentTarget.form;t&&t.requestSubmit()}};return(0,H.jsxs)(`div`,{className:`mx-auto w-full max-w-md rounded-3xl border border-line bg-surface-raised p-6 shadow-card sm:p-8`,children:[(0,H.jsxs)(`div`,{className:`mb-8 text-center`,children:[(0,H.jsx)(`h1`,{className:`mb-2 text-3xl font-light tracking-[-0.04em] text-ink`,children:n(`auth.login.title`)}),(0,H.jsx)(`p`,{className:`text-sm leading-6 text-ink-muted`,children:n(`auth.login.subtitle`)})]}),(0,H.jsxs)(`form`,{onSubmit:g,className:`space-y-5`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{htmlFor:`username`,className:`mb-2 block text-sm font-medium text-ink`,children:n(`auth.login.username`)}),(0,H.jsx)(`input`,{id:`username`,type:`text`,value:i,onChange:e=>a(e.target.value),onKeyDown:_,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:bg-surface-subtle disabled:text-ink-muted motion-reduce:transition-none`,placeholder:n(`auth.login.usernamePlaceholder`),required:!0,disabled:d||r})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{htmlFor:`password`,className:`mb-2 block text-sm font-medium text-ink`,children:n(`auth.login.password`)}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`input`,{id:`password`,type:c?`text`:`password`,value:o,onChange:e=>s(e.target.value),onKeyDown:_,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 pe-11 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:bg-surface-subtle disabled:text-ink-muted motion-reduce:transition-none`,placeholder:n(`auth.login.passwordPlaceholder`),required:!0,disabled:d||r}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>u(!c),className:`absolute inset-y-0 end-0 flex items-center pe-3 text-ink-muted transition-colors hover:text-ink disabled:cursor-not-allowed disabled:opacity-50`,disabled:d||r,"aria-label":c?`Hide characters`:`Reveal characters`,children:c?(0,H.jsx)(se,{size:20}):(0,H.jsx)(ne,{size:20})})]})]}),(0,H.jsx)(`button`,{type:`submit`,disabled:d,className:`flex h-11 w-full items-center justify-center rounded-xl border border-transparent bg-ink px-4 text-sm font-medium text-ink-inverse shadow-subtle transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:d?(0,H.jsxs)(`div`,{className:`flex items-center`,children:[(0,H.jsx)(`div`,{className:`me-2 h-4 w-4 animate-spin rounded-full border-b-2 border-current`}),n(`auth.login.signingIn`)]}):(0,H.jsxs)(`div`,{className:`flex items-center`,children:[(0,H.jsx)(S,{size:16,className:`me-2`}),n(`auth.login.signIn`)]})})]}),!r&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`mt-6`,children:[(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,H.jsx)(`div`,{className:`w-full border-t border-line`})}),(0,H.jsx)(`div`,{className:`relative flex justify-center text-sm`,children:(0,H.jsx)(`span`,{className:`bg-surface-raised px-2 text-ink-muted`,children:n(`common.or`)})})]}),(0,H.jsxs)(`div`,{className:`mt-6 space-y-3`,children:[(0,H.jsx)(wl,{}),(0,H.jsx)(El,{})]})]}),(0,H.jsx)(`div`,{className:`mt-6 text-center`,children:(0,H.jsxs)(`p`,{className:`text-sm text-ink-muted`,children:[n(`auth.login.noAccount`),` `,(0,H.jsx)(`button`,{onClick:()=>t?.(),className:`font-medium text-primary-600 transition-colors hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-300`,children:n(`auth.login.signUpHere`)})]})})]})]})},Al=s(`components:turnstile-widget`),jl=`https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit`,Ml=null,Nl=()=>window.turnstile?Promise.resolve():Ml||(Ml=new Promise((e,t)=>{let n=document.querySelector(`script[src="${jl}"]`);if(n){n.addEventListener(`load`,()=>e(),{once:!0}),n.addEventListener(`error`,t,{once:!0});return}let r=document.createElement(`script`);r.src=jl,r.async=!0,r.defer=!0,r.onload=()=>e(),r.onerror=t,document.head.appendChild(r)}),Ml),Pl=({siteKey:e,disabled:t=!1,errorMessage:n,onTokenChange:r})=>{let i=(0,V.useRef)(null),a=(0,V.useRef)(null),[o,s]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{let t=!1,n=i.current;return r(``),Nl().then(()=>{t||!n||!window.turnstile||(n.innerHTML=``,a.current=window.turnstile.render(n,{sitekey:e,theme:`auto`,callback:e=>r(e),"expired-callback":()=>r(``),"error-callback":()=>r(``)}))}).catch(e=>{Al.error(`Turnstile script failed to load:`,e),t||s(!0)}),()=>{t=!0,r(``),a.current&&window.turnstile?.remove?window.turnstile.remove(a.current):n&&(n.innerHTML=``),a.current=null}},[r,e]),(0,V.useEffect)(()=>{t&&a.current&&(window.turnstile?.reset(a.current),r(``))},[t,r]),o?(0,H.jsx)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-300`,children:n}):(0,H.jsx)(`div`,{className:`rounded-lg border border-accent-200 bg-accent-50/40 p-3 transition-opacity dark:border-accent-800/70 dark:bg-accent-950/20 ${t?`pointer-events-none opacity-60`:``}`,"aria-label":`Security verification`,children:(0,H.jsx)(`div`,{ref:i,className:`min-h-[65px]`})})},Fl=s(`components:signup-form`),Il=({onSignup:e,onBackToLogin:t})=>{let{t:n}=l(),[r,i]=(0,V.useState)(``),[a,o]=(0,V.useState)(``),[s,c]=(0,V.useState)(``),[u,d]=(0,V.useState)(``),[p,m]=(0,V.useState)(!1),[h,g]=(0,V.useState)(!1),[_,v]=(0,V.useState)(!1),[y,b]=(0,V.useState)(``),x=Hr(),{login:S,systemInfo:ee}=$(),C=ee?.turnstile?.siteKey,w=!!(ee?.turnstile?.enabled&&C),T=(0,V.useCallback)(e=>{b(e)},[]),te=(0,V.useMemo)(()=>_||w&&!y,[_,w,y]),re=async t=>{if(t.preventDefault(),!r.trim()||!s.trim()){f.error(n(`auth.signup.usernameRequired`));return}if(s!==u){f.error(n(`auth.signup.passwordMismatch`));return}if(s.length<6){f.error(n(`auth.signup.passwordTooShort`));return}if(w&&!y){f.error(n(`auth.signup.tryAgain`));return}v(!0);try{let t=await ke.signup({username:r,password:s,email:a,turnstileToken:y});t.success&&t.data?(S(t.data.user,t.data.token,t.data.systemInfo),f.success(n(`auth.signup.signupSuccess`)),e?.(),x(`/`)):f.error(t.message||n(`auth.signup.signupFailed`))}catch(e){Fl.error(`Signup error:`,e),f.error(n(`auth.signup.tryAgain`))}finally{b(``),v(!1)}},E=e=>{if(e.key===`Enter`){let t=e.currentTarget.form;t&&t.requestSubmit()}};return(0,H.jsxs)(`div`,{className:`mx-auto w-full max-w-md rounded-3xl border border-line bg-surface-raised p-6 shadow-card sm:p-8`,children:[(0,H.jsxs)(`div`,{className:`mb-8 text-center`,children:[(0,H.jsx)(`h1`,{className:`mb-2 text-3xl font-light tracking-[-0.04em] text-ink`,children:n(`auth.signup.title`)}),(0,H.jsx)(`p`,{className:`text-sm leading-6 text-ink-muted`,children:n(`auth.signup.subtitle`)})]}),(0,H.jsxs)(`form`,{onSubmit:re,className:`space-y-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{htmlFor:`username`,className:`mb-2 block text-sm font-medium text-ink`,children:n(`auth.signup.username`)}),(0,H.jsx)(`input`,{id:`username`,type:`text`,value:r,onChange:e=>i(e.target.value),onKeyDown:E,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none`,placeholder:n(`auth.signup.usernamePlaceholder`),required:!0,disabled:_})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`label`,{htmlFor:`email`,className:`mb-2 block text-sm font-medium text-ink`,children:[n(`auth.signup.email`),` `,(0,H.jsxs)(`span`,{className:`text-ink-muted`,children:[`(`,n(`common.optional`),`)`]})]}),(0,H.jsx)(`input`,{id:`email`,type:`email`,value:a,onChange:e=>o(e.target.value),onKeyDown:E,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none`,placeholder:n(`auth.signup.emailPlaceholder`),disabled:_})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{htmlFor:`password`,className:`mb-2 block text-sm font-medium text-ink`,children:n(`auth.signup.password`)}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`input`,{id:`password`,type:p?`text`:`password`,value:s,onChange:e=>c(e.target.value),onKeyDown:E,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 pe-11 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none`,placeholder:n(`auth.signup.passwordPlaceholder`),required:!0,disabled:_}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>m(!p),className:`absolute inset-y-0 end-0 flex items-center pe-3 text-ink-muted transition-colors hover:text-ink disabled:cursor-not-allowed disabled:opacity-50`,disabled:_,"aria-label":p?`Hide characters`:`Reveal characters`,children:p?(0,H.jsx)(se,{size:20}):(0,H.jsx)(ne,{size:20})})]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{htmlFor:`confirmPassword`,className:`mb-2 block text-sm font-medium text-ink`,children:n(`auth.signup.confirmPassword`)}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`input`,{id:`confirmPassword`,type:h?`text`:`password`,value:u,onChange:e=>d(e.target.value),onKeyDown:E,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 pe-11 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none`,placeholder:n(`auth.signup.confirmPasswordPlaceholder`),required:!0,disabled:_}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>g(!h),className:`absolute inset-y-0 end-0 flex items-center pe-3 text-ink-muted transition-colors hover:text-ink disabled:cursor-not-allowed disabled:opacity-50`,disabled:_,"aria-label":h?`Hide confirmation`:`Reveal confirmation`,children:h?(0,H.jsx)(se,{size:20}):(0,H.jsx)(ne,{size:20})})]})]}),w&&C&&(0,H.jsx)(Pl,{siteKey:C,disabled:_,errorMessage:n(`auth.signup.tryAgain`),onTokenChange:T}),(0,H.jsx)(`button`,{type:`submit`,disabled:te,className:`flex h-11 w-full items-center justify-center rounded-xl border border-transparent bg-ink px-4 text-sm font-medium text-ink-inverse shadow-subtle transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:_?(0,H.jsxs)(`div`,{className:`flex items-center`,children:[(0,H.jsx)(`div`,{className:`me-2 h-4 w-4 animate-spin rounded-full border-b-2 border-current`}),n(`auth.signup.creatingAccount`)]}):(0,H.jsxs)(`div`,{className:`flex items-center`,children:[(0,H.jsx)(fe,{size:16,className:`me-2`}),n(`auth.signup.createAccount`)]})})]}),(0,H.jsx)(wl,{}),(0,H.jsx)(`div`,{className:`mt-6 text-center`,children:(0,H.jsxs)(`p`,{className:`text-sm text-ink-muted`,children:[n(`auth.signup.hasAccount`),` `,(0,H.jsx)(`button`,{onClick:t,className:`font-medium text-primary-600 transition-colors hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-300`,children:n(`auth.signup.signInHere`)})]})})]})},Ll=()=>{let{t:e}=l(),t=Hr(),{isAuthenticated:n,requiresAuth:r}=$(),[i,a]=(0,V.useState)(!1),o=r();return(0,V.useEffect)(()=>{(n||!o)&&t(`/`)},[o,n,t]),n||!o?null:(0,H.jsxs)(`div`,{className:`relative min-h-screen overflow-y-auto bg-gray-50 text-gray-950 dark:bg-dark-50 dark:text-dark-950`,children:[(0,H.jsxs)(`header`,{className:`absolute inset-x-0 top-0 z-10 flex h-16 items-center justify-between border-b border-gray-200/70 px-5 dark:border-white/[0.08] sm:px-8`,children:[(0,H.jsx)($c,{size:`sm`,className:`text-gray-950 dark:text-dark-950 lg:invisible`}),(0,H.jsx)(el,{})]}),(0,H.jsxs)(`main`,{className:`grid min-h-screen pt-16 lg:grid-cols-[minmax(20rem,0.9fr)_minmax(32rem,1.1fr)]`,children:[(0,H.jsxs)(`section`,{className:`relative hidden overflow-hidden border-e border-gray-200/70 p-10 dark:border-white/[0.08] lg:flex lg:flex-col lg:justify-between xl:p-16`,children:[(0,H.jsx)($c,{size:`lg`,className:`relative z-10 text-gray-950 dark:text-dark-950`}),(0,H.jsx)(`div`,{className:`relative z-10 max-w-xl border-s border-gray-300 ps-6 dark:border-white/15`,children:(0,H.jsx)(`p`,{className:`text-4xl font-light leading-[1.08] tracking-[-0.04em] text-gray-900 dark:text-dark-900 xl:text-5xl`,children:e(`setup.welcome.features.secure.description`)})})]}),(0,H.jsx)(`section`,{className:`flex items-center justify-center px-4 py-12 sm:px-8 lg:py-16`,children:(0,H.jsx)(`div`,{className:`w-full max-w-md [&>div]:!max-w-none [&>div]:!rounded-none [&>div]:!border-0 [&>div]:!bg-transparent [&>div]:!p-0 [&>div]:!shadow-none`,children:i?(0,H.jsx)(Il,{onBackToLogin:()=>a(!1),onSignup:()=>a(!1)}):(0,H.jsx)(kl,{onShowSignup:()=>a(!0)})})})]})]})},Rl=window.location.protocol===`file:`?ia:ra,zl=window.location.protocol===`file:`,Bl=()=>zl?(0,H.jsx)(`div`,{className:`absolute top-0 left-0 right-0 h-8 z-50`,style:{WebkitAppRegion:`drag`}}):null,Vl=s(`app`),Hl=V.lazy(()=>o(()=>import(`../js/ChatPage-gNqQdhRe.js`),__vite__mapDeps([16,1,5,17,11,12,2,3,13,14,0,4,7,15,18,19,20,21]))),Ul=V.lazy(()=>o(()=>import(`../js/ModelsPage-Bxig1vZN.js`),__vite__mapDeps([22,1,5,11,12,2,3,13,14,0,4,7,15]))),Wl=V.lazy(()=>o(()=>import(`../js/PersonasPage-BMm3MuVw.js`),__vite__mapDeps([23,1,5,11,12,2,3,13,14,0,4,7,15]))),Gl=V.lazy(()=>o(()=>import(`../js/GalleryPage-vdXO-QSc.js`),__vite__mapDeps([24,1,5,17,12,2,3,13,14,0,4,7,15]))),Kl=V.lazy(()=>o(()=>import(`../js/LibreClawPage-CA7LgGj7.js`),__vite__mapDeps([25,1,5,2,3,13,14,0,4,7,15]))),ql=V.lazy(()=>o(()=>import(`../js/UserManagementPage-C6ZvMO_V.js`),__vite__mapDeps([26,1,5,11,12,2,3,13,14,0,4,15,7]))),Jl=V.lazy(()=>o(()=>import(`../js/ArtifactDemoPage-ChIM17kG.js`),__vite__mapDeps([27,1,5,15,7,4,19,2,3,13,14,20,21,18]))),Yl=V.lazy(()=>o(()=>import(`../js/SettingsModal-DvFcpdVU.js`).then(e=>({default:e.SettingsModal})),__vite__mapDeps([10,1,5,11,12,2,3,13,14,0,4,7,15]))),Xl=V.lazy(()=>o(()=>import(`../js/ArtifactSlideOutPanel-BypEW58A.js`).then(e=>({default:e.ArtifactSlideOutPanel})),__vite__mapDeps([28,1,5,17,2,3,13,14,7,4,15,20,21,18]))),Zl=V.lazy(()=>o(()=>import(`../js/FirstTimeSetup-DS5-kf4m.js`).then(e=>({default:e.FirstTimeSetup})),__vite__mapDeps([29,1,5,2,3,13,14,0,4]))),Ql=()=>{let{t:e}=l();return(0,H.jsx)(`div`,{className:`flex h-full min-h-screen items-center justify-center bg-gray-50 dark:bg-dark-100`,children:(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,H.jsx)(`div`,{className:`h-8 w-8 rounded-full border-4 border-gray-200 border-t-primary-500 animate-spin dark:border-dark-300 dark:border-t-primary-400`}),(0,H.jsx)(`div`,{className:`text-gray-600 dark:text-dark-600`,children:e(`common.loading`)})]})})},$l=({isOpen:e,compact:t})=>(0,H.jsx)(`div`,{"aria-hidden":`true`,className:O(`hidden lg:block flex-shrink-0 transition-[width] duration-200 ease-out`,e?t?`w-18`:`w-72`:`w-0`)}),eu=({onClick:e})=>{let t=K();return t.pathname===`/`||t.pathname===`/chat`||t.pathname.startsWith(`/c/`)?(0,H.jsx)(`div`,{className:`hidden lg:block`,children:(0,H.jsx)(gl,{onClick:e})}):null},tu=()=>{let{t:e,i18n:t}=l(),[n,r]=(0,V.useState)(!1),[i,a]=(0,V.useState)(!1),[o,s]=(0,V.useState)(0),[c,u]=(0,V.useState)(!1),{sidebarOpen:d,sidebarCompact:f,setSidebarOpen:p,setSidebarCompact:m,toggleSidebar:h,toggleSidebarCompact:g,toggleTheme:_,backgroundImage:v,preferences:y,artifactPanelOpen:b}=Xs(),{systemInfo:x,isLoading:S,user:ee,isAuthenticated:C}=$(),{isDemoMode:w,demoConfig:te}=Xs(),[ne,re]=V.useState(!1),E=V.useRef(!1);V.useEffect(()=>{(async()=>{if(E.current){Vl.debug(`OAuth already processing, skipping...`);return}Vl.debug(`Starting OAuth callback processing...`),E.current=!0;let e=new URLSearchParams(window.location.search),t=e.get(`token`),n=e.get(`auth`);if(t&&n===`success`){try{let e=await fetch(`${Te}/auth/me`,{headers:{Authorization:`Bearer ${t}`},credentials:`include`});if(e.ok){let n=await e.json();if(n.success&&n.data){let{login:e,systemInfo:r}=$.getState();e(n.data,t,r||{requiresAuth:!0,hasUsers:!0,userCount:1,version:`0.1.6`}),Vl.debug(`OAuth login successful, showing toast`),T.success(`GitHub login successful!`)}else T.error(`Failed to verify GitHub authentication`)}else T.error(`GitHub authentication verification failed`)}catch(e){Vl.error(`OAuth processing error:`,e),T.error(`GitHub authentication failed`)}window.history.replaceState({},document.title,window.location.pathname)}Vl.debug(`OAuth processing completed`),re(!0),E.current=!1})()},[]),Sl();let ie=()=>{if(v)return!0;let e=y.backgroundSettings;return e?.enabled&&e?.imageUrl},ae=[{key:`b`,metaKey:!0,action:()=>{window.innerWidth>=1024?d?g():(m(!1),h()):(!d&&f&&m(!1),h())},description:e(`keyboard.toggleSidebar`)},{key:`,`,metaKey:!0,action:()=>r(!0),description:e(`keyboard.openSettings`)},{key:`d`,metaKey:!0,action:_,description:e(`keyboard.toggleDarkMode`)},{key:`h`,action:()=>a(!0),description:e(`keyboard.showShortcuts`)},{key:`Escape`,action:()=>{r(!1),a(!1)},description:e(`keyboard.closeModals`)}];pl(ae),V.useEffect(()=>(rc.connect().catch(Vl.error),()=>{rc.disconnect()}),[]),V.useEffect(()=>{if(!x&&!S&&o<15){let e=setTimeout(async()=>{s(e=>e+1);try{await bl.initializeAuth()}catch{}},2e3);return()=>clearTimeout(e)}},[x,S,o]);let oe=!c&&x?.requiresAuth===!0&&x?.hasUsers===!1;return S?(0,H.jsxs)(`div`,{className:`min-h-screen bg-gray-50 dark:bg-dark-50 flex flex-col justify-center py-12 sm:px-6 lg:px-8`,children:[(0,H.jsx)(`div`,{className:`sm:mx-auto sm:w-full sm:max-w-md`,children:(0,H.jsx)(`div`,{className:`flex flex-col items-center`,children:(0,H.jsx)($c,{className:`text-gray-900 dark:text-gray-100`})})}),(0,H.jsx)(`div`,{className:`mt-8 flex flex-col items-center gap-4`,children:(0,H.jsx)(`div`,{className:`w-8 h-8 border-4 border-gray-300 dark:border-gray-600 border-t-primary-500 dark:border-t-primary-400 rounded-full animate-spin`})})]}):x?oe&&!c?(0,H.jsx)(fl,{children:(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(Ql,{}),children:(0,H.jsx)(Zl,{onComplete:()=>{u(!0)}})})}):ne?(0,H.jsx)(fl,{children:(0,H.jsxs)(Rl,{children:[x&&!x.requiresAuth?(0,H.jsxs)(`div`,{className:O(`flex h-dvh min-h-0 text-gray-950 dark:text-dark-900 relative overflow-hidden`,ie()?`bg-gray-100/60 dark:bg-dark-50/60`:`bg-gray-100 dark:bg-dark-50`),children:[(0,H.jsx)(Bl,{}),(0,H.jsx)(vl,{}),(0,H.jsx)(cl,{isOpen:d,onClose:()=>p(!1)}),(0,H.jsx)($l,{isOpen:d,compact:f}),(0,H.jsxs)(`div`,{"data-testid":`app-shell-content`,className:O(`flex-1 basis-0 flex min-h-0 flex-col min-w-0 transition-[margin,background-color] duration-200 ease-out relative z-10 lg:py-2 lg:pe-2`,d&&f?`max-lg:ms-18`:`max-lg:ms-0`,ie()?`bg-white/10 dark:bg-dark-50/10`:`bg-transparent`),children:[w&&te.showBanner&&(0,H.jsx)(_l,{message:te.message}),(0,H.jsx)(`main`,{className:O(`min-h-0 flex-1 overflow-hidden lg:rounded-[1.5rem] lg:border lg:border-black/[0.06] dark:lg:border-white/[0.07] lg:shadow-[0_1px_2px_rgba(0,0,0,0.03),0_18px_60px_rgba(15,23,42,0.04)]`,ie()?`bg-white/30 dark:bg-dark-100/35 backdrop-blur-sm`:`bg-gray-50 dark:bg-dark-100`),children:(0,H.jsx)(fl,{children:(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(Ql,{}),children:(0,H.jsxs)(gi,{children:[(0,H.jsx)(q,{path:`/`,element:(0,H.jsx)(Hl,{})}),(0,H.jsx)(q,{path:`/chat`,element:(0,H.jsx)(Hl,{})}),(0,H.jsx)(q,{path:`/c/:sessionId`,element:(0,H.jsx)(Hl,{})}),(0,H.jsx)(q,{path:`/models`,element:(0,H.jsx)(Ul,{})}),(0,H.jsx)(q,{path:`/personas`,element:(0,H.jsx)(Wl,{})}),(0,H.jsx)(q,{path:`/login`,element:(0,H.jsx)(Ll,{})})]})})})})]})]}):(0,H.jsxs)(gi,{children:[(0,H.jsx)(q,{path:`/login`,element:(0,H.jsx)(Ll,{})}),(0,H.jsx)(q,{path:`/*`,element:(0,H.jsx)(ll,{children:(0,H.jsxs)(`div`,{className:O(`flex h-dvh min-h-0 text-gray-950 dark:text-dark-900 relative overflow-hidden`,ie()?`bg-gray-100/60 dark:bg-dark-50/60`:`bg-gray-100 dark:bg-dark-50`),children:[(0,H.jsx)(Bl,{}),(0,H.jsx)(vl,{}),(0,H.jsx)(cl,{isOpen:d,onClose:()=>p(!1)}),(0,H.jsx)($l,{isOpen:d,compact:f}),(0,H.jsxs)(`div`,{"data-testid":`app-shell-content`,className:O(`flex-1 basis-0 flex min-h-0 flex-col min-w-0 transition-[margin,background-color] duration-200 ease-out relative z-10 lg:py-2 lg:pe-2`,d&&f?`max-lg:ms-18`:`max-lg:ms-0`,ie()?`bg-white/10 dark:bg-dark-50/10`:`bg-transparent`),children:[w&&te.showBanner&&(0,H.jsx)(_l,{message:te.message}),(0,H.jsx)(`main`,{className:O(`min-h-0 flex-1 overflow-hidden lg:rounded-[1.5rem] lg:border lg:border-black/[0.06] dark:lg:border-white/[0.07] lg:shadow-[0_1px_2px_rgba(0,0,0,0.03),0_18px_60px_rgba(15,23,42,0.04)]`,ie()?`bg-white/30 dark:bg-dark-100/35 backdrop-blur-sm`:`bg-gray-50 dark:bg-dark-100`),children:(0,H.jsx)(fl,{children:(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(Ql,{}),children:(0,H.jsxs)(gi,{children:[(0,H.jsx)(q,{path:`/`,element:(0,H.jsx)(Hl,{})}),(0,H.jsx)(q,{path:`/chat`,element:(0,H.jsx)(Hl,{})}),(0,H.jsx)(q,{path:`/c/:sessionId`,element:(0,H.jsx)(Hl,{})}),(0,H.jsx)(q,{path:`/models`,element:(0,H.jsx)(Ul,{})}),(0,H.jsx)(q,{path:`/personas`,element:(0,H.jsx)(Wl,{})}),(0,H.jsx)(q,{path:`/gallery`,element:(0,H.jsx)(Gl,{})}),(0,H.jsx)(q,{path:`/agents`,element:(0,H.jsx)(Kl,{})}),(0,H.jsx)(q,{path:`/artifacts`,element:(0,H.jsx)(Jl,{})}),(0,H.jsx)(q,{path:`/users`,element:(0,H.jsx)(ll,{requireAdmin:!0,children:(0,H.jsx)(ql,{})})})]})})})})]})]})})})]}),n&&(0,H.jsx)(V.Suspense,{fallback:null,children:(0,H.jsx)(Yl,{isOpen:n,onClose:()=>r(!1)})}),(0,H.jsx)(hl,{isOpen:i,onClose:()=>a(!1),shortcuts:ae}),(0,H.jsx)(eu,{onClick:()=>a(!0)}),b&&(0,H.jsx)(V.Suspense,{fallback:null,children:(0,H.jsx)(Xl,{})}),(0,H.jsx)(ve,{position:Zo(t.language)?`top-left`:`top-right`,toastOptions:{duration:4e3,className:`animate-slide-up`,style:{background:`var(--toast-bg)`,color:`var(--toast-color)`,border:`1px solid var(--toast-border)`,borderRadius:`0.75rem`,boxShadow:`0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)`,cursor:`pointer`},success:{iconTheme:{primary:`rgb(var(--color-primary-600))`,secondary:`#ffffff`}},error:{iconTheme:{primary:`rgb(var(--color-primary-600))`,secondary:`#ffffff`}}},containerStyle:{top:80,insetInlineEnd:20}})]})}):(0,H.jsx)(`div`,{className:`min-h-screen bg-gray-50 dark:bg-dark-50 flex items-center justify-center`,children:(0,H.jsx)(`div`,{className:`w-8 h-8 border-4 border-gray-300 dark:border-gray-600 border-t-primary-500 dark:border-t-primary-400 rounded-full animate-spin`})}):(0,H.jsx)(`div`,{className:`min-h-screen bg-gray-50 dark:bg-dark-50 flex items-center justify-center p-4`,children:(0,H.jsxs)(`div`,{className:`text-center`,children:[(0,H.jsx)(`div`,{className:`mb-8`,children:(0,H.jsx)($c,{className:`text-gray-900 dark:text-white`})}),(0,H.jsx)(`div`,{className:`flex justify-center mb-4`,children:(0,H.jsx)(`div`,{className:`w-8 h-8 border-4 border-gray-300 dark:border-dark-300 border-t-primary-500 dark:border-t-primary-400 rounded-full animate-spin`})}),(0,H.jsx)(`p`,{className:`text-gray-600 dark:text-dark-600 text-sm`,children:o>0?`Connecting to backend... (${o}/15)`:`Starting up...`})]})})},nu=new gn({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1,retry:1}}});ts.catch(()=>{Qo(`en`)}).then(()=>{wa.createRoot(document.getElementById(`root`)).render((0,H.jsx)(V.StrictMode,{children:(0,H.jsx)(yn,{client:nu,children:(0,H.jsx)(tu,{})})}))});export{He as $,ms as A,K as B,dc as C,Qs as D,rc as E,es as F,Ft as G,Wr as H,Zo as I,Ct as J,Nt as K,Xo as L,zs as M,Z as N,Xs as O,ps as P,dt as Q,Ko as R,pc as S,$ as T,vn as U,Hr as V,Gt as W,gt as X,F as Y,ft as Z,Oc as _,qc as a,lt as at,hc as b,Wc as c,N as ct,Bc as d,A as dt,P as et,zc as f,Ac as g,Nc as h,Jc as i,$e as it,hs as j,gs as k,Hc as l,M as lt,Mc as m,$c as n,Ge as nt,Vc as o,Ue as ot,jc as p,Pt as q,Xc as r,We as rt,Gc as s,Re as st,Pl as t,it as tt,Uc as u,j as ut,_c as v,ic as w,sc as x,gc as y,$a as z};
|
|
5
|
+
SYSTEM You are a helpful assistant.`,see:`See`,docs:`Modelfile docs`,docsLink:`for syntax reference`,creating:`Creating...`,button:`Create Model`,success:`Model {{name}} created successfully`,failed:`Failed to create model`,enterBoth:`Please enter model name and Modelfile content`},embeddings:{title:`Test Embeddings`,model:`Embedding Model`,selectModel:`Select a model...`,recommended:`Recommended: nomic-embed-text, mxbai-embed-large`,input:`Input Text`,placeholder:`Enter text to generate embeddings for...`,generating:`Generating...`,button:`Generate Embeddings`,result:`Result ({{count}} dimensions)`,success:`Generated {{count}}-dimensional embedding vector`,failed:`Failed to generate embeddings`,enterBoth:`Please select a model and enter text`}}},personaManager:{title:`Personas`,subtitle:`Create and manage AI personas with custom personalities, memories, and behaviors`,loading:`Loading personas...`,createButton:`Create Persona`,importExport:`Import/Export`,stats:{title:`Your Personas`,count:`{{count}} persona created`,count_plural:`{{count}} personas created`},empty:{title:`No personas yet`,description:`Create your first persona to get started with personalized AI interactions`,button:`Create Your First Persona`},deleteConfirm:`Are you sure you want to delete "{{name}}"?`,deleteSuccess:`Persona "{{name}}" deleted successfully`,downloadSuccess:`Persona "{{name}}" downloaded successfully`,failed:`Failed to {{action}} persona`},personaForm:{title:{create:`Create New Persona`,edit:`Edit Persona`},subtitle:{create:`Create a new AI persona with custom personality, memory systems, and adaptive learning capabilities`,edit:`Customize your AI persona with advanced memory, adaptive learning, and intelligent parameters`},loading:`Loading form...`,saved:`Saved`,tabs:{basic:`Basic`,parameters:`Parameters`,memory:`Memory & Learning`,advanced:`Advanced`},basic:{name:`Name`,namePlaceholder:`Enter persona name`,model:`Model`,selectModel:`Select a model`,description:`Description`,descriptionPlaceholder:`Describe your persona...`,systemPrompt:`System Prompt`,systemPromptPlaceholder:`Enter the system prompt that defines your persona behavior...`,systemPromptHint:`The system prompt defines how your persona will behave and respond.`},parameters:{temperature:`Temperature`,temperatureHint:`Controls creativity vs consistency`,topP:`Top-P`,topPHint:`Controls response diversity`,topK:`Top-K`,topKHint:`Limits vocabulary to top-k tokens`,contextWindow:`Context Window`,contextWindowHint:`Maximum conversation history length`,maxTokens:`Max Tokens`,maxTokensHint:`Maximum response length`,repeatPenalty:`Repeat Penalty`,repeatPenaltyHint:`Reduces repetitive responses`},memory:{title:`Memory System`,subtitle:`Persona remembers conversations over time`,enableHint:`Enable the memory system to let your persona remember conversations and build context over time.`,loading:`Loading memory status...`,noData:`No memory data yet`,memories:`Memories`,mbUsed:`MB Used`,lastBackup:`Last Backup`,never:`Never`,maxMemories:`Maximum Memories`,maxMemoriesHint:`How many memories this persona can store`,retention:`Memory Retention`,retentionHint:`Days to keep memories before cleanup`,autoCleanup:`Auto-cleanup old memories`,wipeAll:`Wipe All Memories`,wipeCannot:`This cannot be undone`,wipeButton:`Wipe`,wiping:`Wiping...`,wipeConfirm:`Are you sure you want to wipe all memories? This cannot be undone.`,wipeSuccess:`Wiped {{count}} memories`},learning:{title:`Adaptive Learning`,subtitle:`Persona evolves based on interactions`,enableHint:`Enable adaptive learning to let your persona evolve and personalize responses based on your interactions.`,speed:`Learning Speed`,slow:`Slow`,slowDesc:`Gradual changes`,balanced:`Balanced`,balancedDesc:`Moderate pace`,fast:`Fast`,fastDesc:`Quick adaptation`,autoAdapt:`Auto-adapt to user preferences`,whatLearns:`What the persona learns:`,conversationTone:`Conversation tone`,responseStyle:`Response style`,userPreferences:`User preferences`,topicInterests:`Topic interests`},advanced:{embeddingModel:`Embedding Model`,embeddingHint:`Select the model used for memory encoding and semantic search. Embedding models are shown first, followed by other available models.`,noModels:`No models found`,embeddingModels:`Embedding Models`,otherModels:`Other Models`,installHint:`Install an embedding model:`,recommended:`Recommended: nomic-embed-text, mxbai-embed-large, bge-m3, snowflake-arctic-embed`,aboutTitle:`About Advanced Settings`,aboutDescription:`The embedding model is used by the memory system to understand semantic meaning and find relevant memories during conversations. Choose a model that matches your use case and available resources.`},actions:{cancel:`Cancel`,save:`Save`,saving:`Saving...`,saveClose:`Save & Close`,create:`Create`},success:{created:`Persona created`,updated:`Persona updated`},error:{saveFailed:`Failed to save`}},personaCard:{enhanced:`Enhanced`,systemPrompt:`System Prompt`,memories:`memories`,use:`Use`,editTooltip:`Edit persona`,downloadTooltip:`Download persona`,backup:`Backup`,exportDNA:`Export DNA`,wipeMemories:`Wipe Memories`,wipeConfirm:`Are you sure you want to wipe all memories for this persona? This action cannot be undone.`,wipeSuccess:`Wiped {{count}} memories`,backupSuccess:`Persona backup downloaded successfully`,dnaSuccess:`Persona DNA exported successfully`,failed:`Failed to {{action}}`},userManager:{title:`User Management`,subtitle:`Manage user accounts and permissions`,pageDescription:`Manage user accounts, permissions, and access controls for your Libre WebUI instance.`,loading:`Loading users...`,createUser:`Create User`,search:`Search users...`,noUsers:`No users found`,noUsersMatching:`No users matching your search`,columns:{user:`User`,email:`Email`,role:`Role`,created:`Created`,actions:`Actions`},roles:{admin:`Admin`,user:`User`},noEmail:`No email`,deleteConfirm:`Are you sure you want to delete user "{{name}}"?`,deleteSuccess:`User deleted successfully`,deleteFailed:`Failed to delete user`,cannotDeleteSelf:`You cannot delete your own account`,form:{title:{create:`Create User`,edit:`Edit User`},username:`Username`,usernamePlaceholder:`Enter username`,email:`Email`,emailPlaceholder:`Enter email (optional)`,password:`Password`,passwordPlaceholder:`Enter password`,passwordHint:`Leave blank to keep current password`,role:`Role`,creating:`Creating...`,updating:`Updating...`,createButton:`Create User`,updateButton:`Update User`,createSuccess:`User created successfully`,updateSuccess:`User updated successfully`,createFailed:`Failed to create user`,updateFailed:`Failed to update user`}},chatHistory:{label:`Conversation history`,jumpToTurn:`Jump to turn {{index}} of {{total}}`},chatMessage:{you:`You`,assistant:`Assistant`,system:`System`,copy:`Copy`,copyMessage:`Copy message`,copied:`Copied!`,regenerate:`Regenerate`,regenerateResponse:`Regenerate response`,edit:`Edit`,editSystemMessage:`Edit system message`,saveChanges:`Save changes`,cancelEditing:`Cancel editing`,delete:`Delete`,deleteConfirm:`Delete this message?`,branch:`Branch`,speaking:`Speaking...`,speakMessage:`Speak message`,stopSpeaking:`Stop speaking`,showMore:`Show more`,showLess:`Show less`,thinking:`Thinking`,systemMessagePlaceholder:`Enter your system message...`,fullSizeImage:`Full size image`,startConversation:`Start a conversation`,startConversationDescription:`Send a message to begin chatting with your AI assistant. Ask questions, get help with code, or have a natural conversation.`,scrollToBottom:`Scroll to bottom`,newMessages:`New messages`},imageGallery:{title:`Image Gallery`,noImages:`No images yet`,noImagesHint:`Generate your first image using the panel on the right`,delete:`Delete`,download:`Download`,deleteConfirm:`Are you sure you want to delete this image?`,deleteSuccess:`Image deleted`,deleteFailed:`Failed to delete image`,downloadFailed:`Failed to download image`,loadMore:`Load More ({{current}} of {{total}})`,loadFailed:`Failed to load gallery`},imageGeneration:{title:`Generate Image`,prompt:`Prompt`,promptPlaceholder:`Describe the image you want to create...`,model:`Model`,selectModel:`Select model`,noModels:`No image generation models available`,configurePlugin:`Configure a plugin with image generation support`,size:`Size`,quality:`Quality`,style:`Style`,generate:`Generate`,generating:`Generating...`,success:`Image generated successfully`,failed:`Failed to generate image`,enterPrompt:`Please enter a prompt`,promptTooLong:`Prompt exceeds maximum length of {{max}} characters`},errorBoundary:{title:`Something went wrong`,description:`We encountered an unexpected error. Please try refreshing the page.`,tryAgain:`Refresh Page`,goHome:`Go to Home`,errorDetails:`Error Details (Development)`},documents:{title:`Documents`,upload:`Upload Document`,uploading:`Uploading...`,noDocuments:`No documents uploaded`,uploadHint:`Upload documents to use in your conversations`,delete:`Delete`,deleteConfirm:`Are you sure you want to delete this document?`,deleteSuccess:`Document deleted`,deleteFailed:`Failed to delete document`,uploadSuccess:`Document uploaded successfully`,uploadFailed:`Failed to upload document`,types:`Supported: PDF, TXT, MD, DOCX`,unsupportedFileType:`Only PDF and TXT files are supported`,fileSizeTooLarge:`File size must be less than 10MB`,uploadSuccessWithName:`Document "{{name}}" uploaded successfully`,removeSuccess:`Document removed successfully`,removeFailed:`Failed to remove document`,removeError:`An error occurred while removing the document`,clickToUpload:`Click to upload`,orDragAndDrop:`or drag and drop`,fileTypesAndSize:`PDF or TXT files up to 10MB`,uploadedDocuments:`Uploaded Documents`,removeDocument:`Remove document`},ttsButton:{speak:`Speak`,stop:`Stop`,speaking:`Speaking...`,generateFailed:`Failed to generate speech`,playbackFailed:`Audio playback failed`,stopSpeaking:`Stop speaking`,generatingSpeech:`Generating speech...`,readAloud:`Read aloud`},artifacts:{title:`Artifacts`,code:`Code`,preview:`Preview`,copy:`Copy code`,copied:`Copied!`,download:`Download`,expand:`Expand`,collapse:`Collapse`,openInNewTab:`Open in new tab`,invalidSvg:`Invalid SVG content`,invalidJson:`Invalid JSON content`,previewMode:`Preview mode`,codeMode:`Code mode`,copyContent:`Copy content`,openInPanel:`Open in panel`,openInNewWindow:`Open in new window`,created:`Created`,closePanelEsc:`Close panel (Esc)`,copyButton:`Copy`,open:`Open`,dragEdgeToResize:`Drag edge to resize`,previewUnavailable:`Preview unavailable`,previewUnavailableDescription:`This artifact does not contain renderable preview content. Switch to code view to inspect the source.`},personaImportExport:{title:`Import & Export Personas`,description:`Export your personas to share them or import personas from others`,exportPersonas:`Export Personas`,importPersonas:`Import Personas`,noPersonasToExport:`No personas to export`,personasAvailable:`{{count}} persona available`,personasAvailable_plural:`{{count}} personas available`,exportAll:`Export All`,uploadJsonFile:`Upload JSON File`,pasteJsonLabel:`Paste JSON Data`,pasteJsonPlaceholder:`Paste persona JSON data here...`,importing:`Importing...`,importButton:`Import Persona(s)`,expectedFormat:`Expected JSON Format:`,exportSuccess:`Persona "{{name}}" exported successfully`,exportFailed:`Failed to export persona`,exportAllSuccess:`All {{count}} personas exported successfully`,exportAllFailed:`Failed to export personas`,pasteJsonData:`Please paste the persona JSON data`,importMultipleSuccess:`Successfully imported {{count}} personas`,importMultipleFailed:`Failed to import {{count}} personas`,importNoneFailed:`Failed to import any personas`,importSuccess:`Persona imported successfully`,importFailed:`Failed to import persona`},generationStats:{details:`Details`,promptTokens:`Prompt tokens:`,generatedTokens:`Generated tokens:`,totalTokens:`Total tokens:`,speed:`Speed:`,promptEval:`Prompt eval:`,generation:`Generation:`,modelLoad:`Model load:`,totalTime:`Total time:`,generatedAt:`Generated at:`},userMenu:{loggedOut:`Logged out successfully`,pictureUpdated:`Profile picture updated`,failedUpdateAvatar:`Failed to update avatar`,failedUpdatePicture:`Failed to update profile picture`,noEmail:`No email provided`,changePicture:`Change Picture`,settings:`Settings`,userManagement:`User Management`,signOut:`Sign Out`,changeProfilePicture:`Change Profile Picture`},pluginManager:{title:`Plugin Manager`,upload:`Upload`,addJson:`Add JSON`,browseHF:`Browse HF Hub`,confirmDelete:`Are you sure you want to delete this plugin?`,uploading:`Uploading plugin...`,pasteJson:`Paste plugin JSON here...`,installPlugin:`Install Plugin`,loading:`Loading plugins...`,noPlugins:`No Plugins Installed`,noPluginsDescription:`Upload a plugin file or add a plugin from JSON to get started.`,active:`Active`,id:`ID`,endpoint:`Endpoint`,activate:`Activate`,deactivate:`Deactivate`,activePlugin:`Active Plugin`,activePluginDescription:`All chat requests will be routed through this plugin`,variables:{title:`Variables`,save:`Save`,saving:`Saving...`,saved:`Variables saved`,saveFailed:`Failed to save variables`,resetDefaults:`Reset to Defaults`,reset:`Variables reset to defaults`,sensitiveSet:`Value is set (enter new value to change)`}},huggingface:{title:`HuggingFace Model Browser`,subtitle:`Browse and select models from the Hub`,searchPlaceholder:`Search models...`,filters:`Filters`,task:`Task`,sortBy:`Sort By`,noModels:`No models found`,adjustSearch:`Try adjusting your search or filters`,gated:`Gated`,selected:`Selected`,select:`Select`,refresh:`Refresh`,modelsFound:`models found`},demoMode:{title:`Demo Mode`,github:`GitHub`},libreClaw:{title:`Libre Claw`,subtitle:`Local agent runs, approvals, schedules, memory, tools, and usage.`,dashboard:`Dashboard`,connection:{disconnectedTitle:`Libre Claw daemon is not connected`,disconnectedDescription:`Start it locally with <command>libre-claw start</command> or set <env>LIBRE_CLAW_BASE_URL</env> in the backend environment.`},status:{connected:`Connected`,disconnected:`Disconnected`,activeRuns:`{{count}} active`,activeRuns_plural:`{{count}} active`},states:{queued:`Queued`,running:`Running`,blocked:`Blocked`,done:`Done`,failed:`Failed`,cancelled:`Cancelled`},startRun:{title:`Start Agent Run`,placeholder:`Ask Libre Claw to inspect a repo, fix a bug, run a review, schedule a report...`,chatRun:`Chat run`,goalMode:`Goal mode`,providerOverride:`Provider override`,modelOverride:`Model override`,run:`Run`},modelRoute:{title:`Model Route`,providerPlaceholder:`provider`,modelPlaceholder:`model`,persistGlobal:`Persist to Libre Claw global config`,saveModel:`Save model`,theme:`Libre Claw theme`,saveTheme:`Save theme`},runs:{title:`Runs`,empty:`No Libre Claw runs yet.`},timeline:{title:`Run Timeline`,empty:`Select a run to inspect its events.`,streaming:`Streaming...`,assistantResponse:`Assistant response`,resultOk:`ok`,resultError:`error`,labels:{userMessage:`User message`,toolCall:`Tool call`,toolResult:`Tool result`,approvalRequest:`Approval request`,approvalResponse:`Approval response`,runStarted:`Run started`,runFinished:`Run finished`,usage:`Usage`,error:`Error`}},approvals:{needed:`Approval needed`,allowOnce:`Allow once`,alwaysAllowTool:`Always allow tool`,deny:`Deny`,toolApprovalRequested:`Tool approval requested`},automations:{title:`Automations`,namePlaceholder:`Name`,schedulePlaceholder:`daily 09:00`,promptPlaceholder:`Automation prompt`,create:`Create`,empty:`No scheduled Libre Claw automations.`,runNow:`Run now`,pause:`Pause`,resume:`Resume`,routes:{report:`Report`,telegram:`Telegram`},status:{active:`Active`,paused:`Paused`}},usageFallback:{title:`Usage And Fallback`,usage:`Usage`,fallbackRoute:`Fallback Route`,noUsage:`No usage records yet.`},metrics:{provider:`Provider`,model:`Model`,input:`Input`,output:`Output`,cached:`Cached`,reasoning:`Reasoning`,cost:`Cost`,tool:`Tool`,resolution:`Resolution`,state:`State`,stopReason:`Stop reason`,tokens:`{{formatted}} token`,tokens_plural:`{{formatted}} tokens`},fallbacks:{tool:`tool`,unknown:`unknown`,resolved:`resolved`,unknownError:`Unknown error`},toasts:{loadStatusFailed:`Could not load Libre Claw status`,enterTask:`Enter a task for Libre Claw`,runStarted:`Libre Claw run started`,startRunFailed:`Could not start Libre Claw run`,runCancelled:`Run cancelled`,cancelRunFailed:`Could not cancel run`,approved:`Approved`,denied:`Denied`,resolvePermissionFailed:`Could not resolve permission`,providerModelRequired:`Provider and model are required`,modelUpdated:`Libre Claw model updated`,updateModelFailed:`Could not update model`,themeUpdated:`Libre Claw theme updated`,updateThemeFailed:`Could not update theme`,automationRequired:`Automation name, schedule, and prompt are required`,automationCreated:`Automation created`,createAutomationFailed:`Could not create automation`,automationUpdated:`Automation updated`,updateAutomationFailed:`Could not update automation`}},personaBackground:{label:`Background Image`,uploadBackgroundImage:`Upload background image`,dragAndDrop:`Drag and drop an image or click to browse`,chooseImage:`Choose Image`,uploading:`Uploading...`,enterImageUrl:`Or enter image URL`,supportedFormats:`Supports: JPG, PNG, GIF, WebP (max 5MB). Wide landscape images work best.`,customBackground:`Custom background image`,clickToChange:`Click to change or remove`,removed:`Background removed`,uploaded:`Background uploaded successfully`,invalidFile:`Please select a valid image file`,fileTooLarge:`Background image size must be less than 5MB`,readFailed:`Failed to read image file`,uploadFailed:`Failed to upload background image`},modelSelector:{searchInstalled:`Search installed models...`,searchOllama:`Search Ollama library...`,searchHuggingFace:`Search HuggingFace...`,selectModel:`Select Model`,personas:`Personas`,ollamaModels:`Ollama Models`,pluginModels:`Plugin Models`,actions:`Actions`,installed:`Installed`,use:`Use`,pull:`Pull`,pullRestricted:`Model installation is restricted to administrators on this instance.`,adminOnlyPull:`Admins only`}},Go={en:{translation:Wo}},Ko=[{code:`en`,name:`English`,nativeName:`English`,dir:`ltr`},{code:`ar`,name:`Arabic`,nativeName:`العربية`,dir:`rtl`},{code:`bn`,name:`Bengali`,nativeName:`বাংলা`,dir:`ltr`},{code:`cs`,name:`Czech`,nativeName:`Čeština`,dir:`ltr`},{code:`da`,name:`Danish`,nativeName:`Dansk`,dir:`ltr`},{code:`de`,name:`German`,nativeName:`Deutsch`,dir:`ltr`},{code:`es`,name:`Spanish`,nativeName:`Español`,dir:`ltr`},{code:`fr`,name:`French`,nativeName:`Français`,dir:`ltr`},{code:`hi`,name:`Hindi`,nativeName:`हिन्दी`,dir:`ltr`},{code:`id`,name:`Indonesian`,nativeName:`Bahasa Indonesia`,dir:`ltr`},{code:`is`,name:`Icelandic`,nativeName:`Íslenska`,dir:`ltr`},{code:`it`,name:`Italian`,nativeName:`Italiano`,dir:`ltr`},{code:`ja`,name:`Japanese`,nativeName:`日本語`,dir:`ltr`},{code:`ko`,name:`Korean`,nativeName:`한국어`,dir:`ltr`},{code:`ms`,name:`Malay`,nativeName:`Bahasa Melayu`,dir:`ltr`},{code:`nl`,name:`Dutch`,nativeName:`Nederlands`,dir:`ltr`},{code:`pl`,name:`Polish`,nativeName:`Polski`,dir:`ltr`},{code:`pt`,name:`Portuguese`,nativeName:`Português`,dir:`ltr`},{code:`ru`,name:`Russian`,nativeName:`Русский`,dir:`ltr`},{code:`sv`,name:`Swedish`,nativeName:`Svenska`,dir:`ltr`},{code:`th`,name:`Thai`,nativeName:`ไทย`,dir:`ltr`},{code:`tr`,name:`Turkish`,nativeName:`Türkçe`,dir:`ltr`},{code:`uk`,name:`Ukrainian`,nativeName:`Українська`,dir:`ltr`},{code:`vi`,name:`Vietnamese`,nativeName:`Tiếng Việt`,dir:`ltr`},{code:`zh`,name:`Chinese`,nativeName:`中文`,dir:`ltr`}],qo=[`ar`,`he`,`fa`,`ur`],Jo=Ko.map(e=>e.code),Yo={en:()=>Promise.resolve(Wo),ar:()=>o(()=>import(`../js/ar-UnnZB1Qy.js`).then(e=>e.default),[]),bn:()=>o(()=>import(`../js/bn-uZXaDyeV.js`).then(e=>e.default),[]),cs:()=>o(()=>import(`../js/cs-CCXlnUEB.js`).then(e=>e.default),[]),da:()=>o(()=>import(`../js/da--BpVVGPp.js`).then(e=>e.default),[]),de:()=>o(()=>import(`../js/de-DZd9lsBc.js`).then(e=>e.default),[]),es:()=>o(()=>import(`../js/es-Bm968oUX.js`).then(e=>e.default),[]),fr:()=>o(()=>import(`../js/fr-RlC0rD8I.js`).then(e=>e.default),[]),hi:()=>o(()=>import(`../js/hi-C6kwkL7d.js`).then(e=>e.default),[]),id:()=>o(()=>import(`../js/id-CDfqnnXS.js`).then(e=>e.default),[]),is:()=>o(()=>import(`../js/is-Dnd_7Jqv.js`).then(e=>e.default),[]),it:()=>o(()=>import(`../js/it-BM0j6_Sz.js`).then(e=>e.default),[]),ja:()=>o(()=>import(`../js/ja-xGblKDDf.js`).then(e=>e.default),[]),ko:()=>o(()=>import(`../js/ko-CQ2d_Oj0.js`).then(e=>e.default),[]),ms:()=>o(()=>import(`../js/ms-CFpRuv_a.js`).then(e=>e.default),[]),nl:()=>o(()=>import(`../js/nl-D6oTztmP.js`).then(e=>e.default),[]),pl:()=>o(()=>import(`../js/pl-ByuvABul.js`).then(e=>e.default),[]),pt:()=>o(()=>import(`../js/pt-CNFV21T7.js`).then(e=>e.default),[]),ru:()=>o(()=>import(`../js/ru-CRsSOntz.js`).then(e=>e.default),[]),sv:()=>o(()=>import(`../js/sv-BRkwjyS5.js`).then(e=>e.default),[]),th:()=>o(()=>import(`../js/th-DigqsQEB.js`).then(e=>e.default),[]),tr:()=>o(()=>import(`../js/tr-B5aMUMJE.js`).then(e=>e.default),[]),uk:()=>o(()=>import(`../js/uk-BUYi3llT.js`).then(e=>e.default),[]),vi:()=>o(()=>import(`../js/vi-hQIcXi3m.js`).then(e=>e.default),[]),zh:()=>o(()=>import(`../js/zh-CUDZ3JDv.js`).then(e=>e.default),[])},Xo=e=>{let t=e?.toLowerCase().split(`-`)[0];return Jo.includes(t)?t:`en`},Zo=e=>qo.includes(Xo(e)),Qo=e=>{if(typeof document>`u`)return;let t=Xo(e);document.documentElement.lang=t,document.documentElement.dir=Zo(t)?`rtl`:`ltr`},$o=async e=>{let t=Xo(e);if(!Y.hasResourceBundle(t,`translation`)){let e=await Yo[t]();Y.addResourceBundle(t,`translation`,e,!0,!0)}return t},es=async e=>{let t=await $o(e);return await Y.changeLanguage(t),t};if(typeof window<`u`){let e=navigator.language;try{e=window.localStorage.getItem(`i18nextLng`)||e}catch{}Qo(e),Y.on(`languageChanged`,Qo)}var ts=(async()=>{Y.isInitialized||await Y.use(Uo).use(c).init({resources:Go,fallbackLng:`en`,supportedLngs:Jo,nonExplicitSupportedLngs:!0,load:`languageOnly`,debug:!1,interpolation:{escapeValue:!1},detection:{order:[`localStorage`,`navigator`,`htmlTag`],caches:[`localStorage`],lookupLocalStorage:`i18nextLng`}});let e=Xo(Y.language||Y.resolvedLanguage);if(e!==`en`)try{await $o(e),Xo(Y.language)===e&&await Y.changeLanguage(e)}catch{await Y.changeLanguage(`en`)}Qo(Y.resolvedLanguage||Y.language||`en`)})(),ns=(e,t)=>{if(e&&typeof e==`object`&&`response`in e){let t=e;if(t.response?.data?.error)return t.response.data.error}return e instanceof Error?e.message:t};function rs(e){return{...e,id:e.id||Ne(),timestamp:Date.now()}}function is(e,t){return e.currentSession?.isPrivate&&e.currentSession?.id===t}function as(e,t){return e.sessions.some(e=>e.id===t)}function os(e,t){return!!e.currentSession&&(is(e,t)||as(e,e.currentSession.id))}function ss(e,t,n){if(is(e,t))return e.currentSession.messages.find(e=>e.id===n.id)?e:{currentSession:{...e.currentSession,messages:[...e.currentSession.messages,n],updatedAt:Date.now()},sessions:e.sessions};if(e.sessions.find(e=>e.id===t)?.messages.some(e=>e.id===n.id))return e;let r=e.sessions.map(e=>{if(e.id!==t)return e;let r=[...e.messages];if(n.parentId){let e=n.parentId;r=r.map(t=>t.id===e||t.parentId===e?{...t,isActive:!1,branchIndex:t.branchIndex??0,siblingCount:(n.branchIndex||0)+1}:t)}return{...e,messages:[...r,n],updatedAt:Date.now()}});return{sessions:r,currentSession:e.currentSession?.id===t&&r.find(e=>e.id===t)||e.currentSession}}function cs(e,t,n,r){if(e.currentSession?.id!==t)return e;if(e.currentSession?.isPrivate){let t=e.currentSession.messages.find(e=>e.id===n);return!t||t.content===r?e:{sessions:e.sessions,currentSession:{...e.currentSession,messages:e.currentSession.messages.map(e=>e.id===n?{...e,content:r}:e),updatedAt:Date.now()}}}let i=e.sessions.find(e=>e.id===t),a=i?.messages.find(e=>e.id===n);if(!i||!a||a.content===r)return e;let o=e.sessions.map(e=>e.id===t?{...e,messages:e.messages.map(e=>e.id===n?{...e,content:r}:e),updatedAt:Date.now()}:e);return{sessions:o,currentSession:e.currentSession?.id===t&&o.find(e=>e.id===t)||e.currentSession}}function ls(e,t,n,r,i){if(e.currentSession?.id!==t)return e;if(e.currentSession?.isPrivate)return{sessions:e.sessions,currentSession:{...e.currentSession,messages:e.currentSession.messages.map(e=>e.id===n?{...e,content:r,statistics:i}:e),updatedAt:Date.now()}};let a=e.sessions.map(e=>e.id===t?{...e,messages:e.messages.map(e=>e.id===n?{...e,content:r,statistics:i}:e),updatedAt:Date.now()}:e);return{sessions:a,currentSession:e.currentSession?.id===t&&a.find(e=>e.id===t)||e.currentSession}}function us(e){return e.reduce((e,t)=>(e[t.id]=t,e),{})}function ds(e){return e.map(e=>({name:`persona:${e.id}`,model:e.model,size:0,digest:``,details:{parent_model:e.model,format:`persona`,family:`persona`,families:[`persona`],parameter_size:``,quantization_level:``},modified_at:new Date(e.updated_at).toISOString(),expires_at:new Date().toISOString(),size_vram:0,isPersona:!0,personaName:e.name,personaDescription:e.description}))}function fs(e){return e.filter(e=>e.active&&e.type!==`tts`&&e.type!==`image`).flatMap(e=>(e.model_map||[]).map(t=>({name:t,model:t,size:0,digest:``,details:{parent_model:``,format:``,family:``,families:[],parameter_size:``,quantization_level:``},modified_at:new Date().toISOString(),expires_at:new Date().toISOString(),size_vram:0,isPlugin:!0,pluginName:e.name})))}var X=s(`chat-store`),ps=be((e,t)=>({sessions:[],currentSession:null,setCurrentSession:t=>{e({currentSession:t})},createSession:async(t,n,r)=>{try{e({loading:!0,error:null});let i=await we.createSession(t,n,r);if(i.success&&i.data){let t=i.data;return e(e=>({sessions:[t,...e.sessions],currentSession:t,loading:!1})),T.success(`New chat created`),t}}catch(t){let n=ns(t,`Failed to create session`);e({error:n,loading:!1}),T.error(n)}},loadSessions:async()=>{try{e({loading:!0,error:null});let t=await we.getSessions();t.success&&t.data&&e(e=>{let n=t.data||[],r=n.map(e=>e.id),i=null;return e.currentSession&&r.includes(e.currentSession.id)?i=n.find(t=>t.id===e.currentSession.id)||null:n.length>0&&(i=n[0],e.currentSession&&X.warn(`Previous currentSession not found in backend sessions:`,e.currentSession.id)),{sessions:n,currentSession:i,loading:!1}})}catch(t){let n=ns(t,`Failed to load sessions`);e({error:n,loading:!1}),T.error(n)}},deleteSession:async t=>{try{let n=await we.deleteSession(t);n.success?(e(e=>{let n=e.sessions.filter(e=>e.id!==t),r=e.currentSession?.id===t?n[0]||null:e.currentSession;return X.debug(`Store: Updating state, sessions count:`,n.length),{sessions:n,currentSession:r}}),T.success(`Chat deleted`)):(X.error(`Store: deleteSession failed:`,n),T.error(`Failed to delete chat`))}catch(e){X.error(`Store: deleteSession error:`,e);let t=ns(e,`Failed to delete session`);T.error(t)}},clearAllSessions:async()=>{try{e({loading:!0,error:null});let t=await we.clearAllSessions();t.success?(e({sessions:[],currentSession:null,loading:!1}),T.success(`All chat history cleared`)):(X.error(`Store: clearAllSessions failed:`,t),T.error(`Failed to clear chat history`),e({loading:!1}))}catch(t){X.error(`Store: clearAllSessions error:`,t);let n=ns(t,`Failed to clear chat history`);T.error(n),e({loading:!1})}},clearAllState:()=>{e({sessions:[],currentSession:null,models:[],selectedModel:``,systemMessage:``,loading:!1,error:null})},applySessionTitle:(t,n,r=Date.now())=>{e(e=>({sessions:e.sessions.map(e=>e.id===t?{...e,title:n,updatedAt:r}:e),currentSession:e.currentSession?.id===t?{...e.currentSession,title:n,updatedAt:r}:e.currentSession}))},updateSessionTitle:async(e,n)=>{try{let r=await we.updateSession(e,{title:n});if(r.success&&r.data){let n=r.data.title,i=r.data.updatedAt??Date.now();t().applySessionTitle(e,n,i),T.success(`Chat title updated`)}}catch(e){let t=ns(e,`Failed to update session`);T.error(t)}},addMessage:(n,r)=>{let i=t(),a=is(i,n);if(!os(i,n)){T.error(`No valid chat session. Please create or select a chat.`),X.error(`addMessage blocked: currentSession is not valid`,i.currentSession?.id);return}if(!a&&!as(i,n)){T.error(`Session not found or invalid. Please select or create a valid chat session.`),X.error(`addMessage blocked: sessionId not found in sessions`,n);return}let o=rs(r);e(e=>ss(e,n,o))},updateMessage:(t,n,r)=>{e(e=>cs(e,t,n,r))},updateMessageWithStatistics:(t,n,r,i)=>{e(e=>ls(e,t,n,r,i))},models:[],loadModels:async()=>{try{e({loading:!0,error:null}),X.debug(`Loading models from API...`);let n=await De.getModels(),r=[];n.success&&n.data&&(r=[...n.data],X.debug(`Ollama models loaded:`,n.data.length));try{let e=await D.getAllPlugins();if(e.success&&e.data){let t=e.data.filter(e=>e.active&&e.type!==`tts`&&e.type!==`image`);X.debug(`🔌 Active plugins found:`,t.map(e=>e.name));let n=fs(t);r.push(...n),X.debug(`Plugin models added:`,n.length)}}catch(e){X.error(`❌ Failed to load plugin models:`,e),e instanceof Error&&X.error(`❌ Plugin error details:`,{message:e.message,response:e.response?.data,status:e.response?.status,url:e.config?.url})}try{let{personaApi:t}=await o(async()=>{let{personaApi:e}=await import(`../js/api-BRz6cQiD.js`).then(e=>e.t);return{personaApi:e}},__vite__mapDeps([0,1,2,3,4,5])),n=await t.getPersonas();if(n.success&&n.data){let t=us(n.data),i=ds(n.data);r.push(...i),e(e=>({...e,personas:t}))}}catch(e){X.error(`❌ Failed to load personas:`,e)}X.debug(`Total models loaded:`,r.length);let i=t().selectedModel,a=r.some(e=>e.name===i);if(i&&!a&&r.length>0){let t=r[0].name;X.debug(`⚠️ Selected model "${i}" no longer available, falling back to "${t}"`),e({models:r,loading:!1,selectedModel:t}),T.success(`Switched to ${t} (previous model no longer available)`)}else e({models:r,loading:!1})}catch(t){X.error(`Error loading models:`,t);let n=ns(t,`Failed to load models`);e({error:n,loading:!1}),T.error(n)}},loadPreferences:async()=>{try{let t=await Oe.getPreferences();if(t.success&&t.data){let{defaultModel:n,systemMessage:r}=t.data;n&&(e({selectedModel:n}),X.debug(`✅ Loaded default model from backend:`,n)),r!==void 0&&(e({systemMessage:r}),X.debug(`✅ Loaded system message from backend`))}}catch(e){X.warn(`❌ Failed to load preferences from backend:`,e)}},selectedModel:``,setSelectedModel:t=>{e({selectedModel:t}),Oe.setDefaultModel(t).catch(e=>{X.warn(`Failed to save default model to backend:`,e)})},updateCurrentSessionModel:async n=>{let r=t();if(!r.currentSession)throw Error(`No current session to update`);try{let t=await we.updateSession(r.currentSession.id,{model:n});t.success&&t.data&&(e(e=>({sessions:e.sessions.map(n=>n.id===e.currentSession?.id?t.data:n),currentSession:t.data,selectedModel:n})),T.success(`Model updated for current chat`))}catch(e){let t=ns(e,`Failed to update session model`);throw T.error(t),e}},personas:{},loadPersonas:async()=>{try{e({loading:!0,error:null});let t=await Ee.getPersonas();if(t.success&&t.data){let n=t.data;e({personas:us(n),loading:!1}),X.debug(`✅ Personas loaded:`,n.length)}}catch(t){let n=ns(t,`Failed to load personas`);e({error:n,loading:!1}),X.error(`❌ Failed to load personas:`,n)}},getCurrentPersona:()=>{let e=t();if(!e.currentSession||!e.currentSession.model?.startsWith(`persona:`))return null;let n=e.currentSession.model.replace(`persona:`,``);return e.personas[n]||null},systemMessage:``,setSystemMessage:n=>{let r=t();if(e({systemMessage:n}),Oe.setSystemMessage(n).catch(e=>{X.warn(`Failed to save system message to backend:`,e)}),r.currentSession){let t=r.currentSession.messages.findIndex(e=>e.role===`system`);if(t!==-1){e(e=>{let r=e.sessions.map(r=>{if(r.id===e.currentSession?.id){let e=r.messages.map((e,r)=>r===t&&e.role===`system`?{...e,content:n,timestamp:Date.now()}:e);return{...r,messages:e,updatedAt:Date.now()}}return r});return{sessions:r,currentSession:e.currentSession?r.find(t=>t.id===e.currentSession.id)||e.currentSession:null}});let i=r.currentSession.messages[t];we.updateMessage(r.currentSession.id,i.id,{content:n}).catch(e=>{X.warn(`Failed to sync system message update to backend:`,e)}),X.debug(`✅ Updated system message in current session`)}}},loading:!1,error:null,setError:t=>e({error:t}),generatingTitleForSession:null,setGeneratingTitleForSession:t=>e({generatingTitleForSession:t}),...typeof window<`u`&&{testPluginApi:async()=>{try{X.debug(`🧪 Testing plugin API...`);let e=await D.getAllPlugins();return X.debug(`✅ Plugin API test result:`,e),e}catch(e){return X.error(`❌ Plugin API test failed:`,e),{error:e}}}}})),ms=`blue`,hs=`#2563eb`,gs=[{id:`violet`,label:`Violet`,color:`#7c3aed`},{id:`blue`,label:`Blue`,color:`#2563eb`},{id:`cyan`,label:`Cyan`,color:`#0e7490`},{id:`teal`,label:`Teal`,color:`#0f766e`},{id:`emerald`,label:`Emerald`,color:`#15803d`},{id:`amber`,label:`Amber`,color:`#b45309`},{id:`rose`,label:`Rose`,color:`#e11d48`},{id:`slate`,label:`Slate`,color:`#475569`}],_s=[`50`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`,`950`],vs=[`25`,..._s],ys=[`canvas`,`surface`,`surface-subtle`,`surface-raised`,`surface-overlay`,`surface-inverse`,`ink`,`ink-muted`,`ink-subtle`,`ink-inverse`,`line`,`line-strong`],bs={multiplier:.24,minimum:6,maximum:24},xs={multiplier:.36,minimum:6,maximum:32},Ss={25:99,50:97,100:94,200:88,300:80,400:66,500:48,600:36,700:27,800:18,900:11,950:6},Cs={25:13,50:4,100:7,200:10,300:16,400:27,500:46,600:65,700:82,800:89,900:95,950:99},ws={canvas:{lightness:96,saturationFactor:1},surface:{lightness:98,saturationFactor:.9},"surface-subtle":{lightness:93,saturationFactor:1},"surface-raised":{lightness:99,saturationFactor:.8},"surface-overlay":{lightness:100,saturationFactor:0},"surface-inverse":{lightness:10,saturationFactor:.7},ink:{lightness:10,saturationFactor:.45},"ink-muted":{lightness:38,saturationFactor:.35},"ink-subtle":{lightness:54,saturationFactor:.4},"ink-inverse":{lightness:98,saturationFactor:.4},line:{lightness:86,saturationFactor:.8},"line-strong":{lightness:75,saturationFactor:.65}},Ts={canvas:{lightness:5,saturationFactor:.9},surface:{lightness:7,saturationFactor:.9},"surface-subtle":{lightness:9,saturationFactor:1},"surface-raised":{lightness:11,saturationFactor:1},"surface-overlay":{lightness:13,saturationFactor:1},"surface-inverse":{lightness:96,saturationFactor:.35},ink:{lightness:96,saturationFactor:.3},"ink-muted":{lightness:67,saturationFactor:.35},"ink-subtle":{lightness:48,saturationFactor:.4},"ink-inverse":{lightness:7,saturationFactor:.45},line:{lightness:18,saturationFactor:.8},"line-strong":{lightness:28,saturationFactor:.65}},Es={violet:{50:`#f5f3ff`,100:`#ede9fe`,200:`#ddd6fe`,300:`#c4b5fd`,400:`#a78bfa`,500:`#7c3aed`,600:`#6d28d9`,700:`#5b21b6`,800:`#4c1d95`,900:`#3b0764`,950:`#2e1065`},blue:{50:`#eff6ff`,100:`#dbeafe`,200:`#bfdbfe`,300:`#93c5fd`,400:`#60a5fa`,500:`#2563eb`,600:`#1d4ed8`,700:`#1e40af`,800:`#1e3a8a`,900:`#172554`,950:`#0f172a`},cyan:{50:`#ecfeff`,100:`#cffafe`,200:`#a5f3fc`,300:`#67e8f9`,400:`#22d3ee`,500:`#0e7490`,600:`#155e75`,700:`#164e63`,800:`#083344`,900:`#092f3f`,950:`#062634`},teal:{50:`#f0fdfa`,100:`#ccfbf1`,200:`#99f6e4`,300:`#5eead4`,400:`#2dd4bf`,500:`#0f766e`,600:`#0f625d`,700:`#115e59`,800:`#134e4a`,900:`#042f2e`,950:`#022c22`},emerald:{50:`#ecfdf5`,100:`#d1fae5`,200:`#a7f3d0`,300:`#6ee7b7`,400:`#34d399`,500:`#15803d`,600:`#166534`,700:`#14532d`,800:`#064e3b`,900:`#052e16`,950:`#022c22`},amber:{50:`#fffbeb`,100:`#fef3c7`,200:`#fde68a`,300:`#fcd34d`,400:`#f59e0b`,500:`#b45309`,600:`#92400e`,700:`#78350f`,800:`#5f2c0b`,900:`#451a03`,950:`#2f1200`},rose:{50:`#fff1f2`,100:`#ffe4e6`,200:`#fecdd3`,300:`#fda4af`,400:`#fb7185`,500:`#e11d48`,600:`#be123c`,700:`#9f1239`,800:`#881337`,900:`#4c0519`,950:`#2d0714`},slate:{50:`#f8fafc`,100:`#f1f5f9`,200:`#e2e8f0`,300:`#cbd5e1`,400:`#94a3b8`,500:`#475569`,600:`#334155`,700:`#1e293b`,800:`#0f172a`,900:`#020617`,950:`#010313`}},Ds={50:97,100:94,200:88,300:76,400:64,500:42,600:34,700:27,800:21,900:16,950:10},Os=(e,t,n)=>Math.min(Math.max(e,t),n),ks=e=>{if(!e)return null;let t=e.trim().match(/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i);if(!t)return null;let n=t[1];return`#${(n.length===3?n.split(``).map(e=>`${e}${e}`).join(``):n).toLowerCase()}`},As=e=>{let t=ks(e)||`#2563eb`,n=parseInt(t.slice(1),16);return{r:n>>16&255,g:n>>8&255,b:n&255}},js=(e,t,n)=>`#${[e,t,n].map(e=>Os(Math.round(e),0,255).toString(16).padStart(2,`0`)).join(``)}`,Ms=(e,t,n)=>{let r=e/255,i=t/255,a=n/255,o=Math.max(r,i,a),s=Math.min(r,i,a),c=(o+s)/2;if(o===s)return{h:0,s:0,l:c*100};let l=o-s,u=c>.5?l/(2-o-s):l/(o+s),d=0;return d=o===r?(i-a)/l+(i<a?6:0):o===i?(a-r)/l+2:(r-i)/l+4,{h:d*60,s:u*100,l:c*100}},Ns=(e,t,n)=>{let r=Os(t,0,100)/100,i=Os(n,0,100)/100,a=(1-Math.abs(2*i-1))*r,o=(e%360+360)%360,s=a*(1-Math.abs(o/60%2-1)),c=i-a/2,l=0,u=0,d=0;return o<60?(l=a,u=s):o<120?(l=s,u=a):o<180?(u=a,d=s):o<240?(u=s,d=a):o<300?(l=s,d=a):(l=a,d=s),js((l+c)*255,(u+c)*255,(d+c)*255)},Ps=e=>{let{r:t,g:n,b:r}=As(e),i=[t,n,r].map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return i[0]*.2126+i[1]*.7152+i[2]*.0722},Fs=(e,t)=>{let n=Ps(e),r=Ps(t),i=Math.max(n,r),a=Math.min(n,r);return(i+.05)/(a+.05)},Is=(e,t,n)=>{let r=n,i=Ns(e,t,r);for(;Fs(`#ffffff`,i)<4.5&&r>12;)r-=2,i=Ns(e,t,r);return i},Ls=e=>{let{r:t,g:n,b:r}=As(ks(e)||`#2563eb`),{h:i,s:a}=Ms(t,n,r),o=a<8?a:Os(a,42,88);return _s.reduce((e,t)=>{let n=Ds[t],r=Number(t)<300?o*.72:o;return e[t]=t===`500`||t===`600`?Is(i,r,n):Ns(i,r,n),e},{})},Z=e=>{let t=e?.mode===`dark`?`dark`:`light`,n=e?.accent===`custom`?`custom`:e?.accent,r=gs.some(e=>e.id===n)?n:ms,i=ks(e?.customAccent)||`#2563eb`;return{mode:t,adaptToAccent:e?.adaptToAccent===!0,accent:n===`custom`?`custom`:r,customAccent:i}},Rs=e=>{let t=Z(e);return t.accent===`custom`?Ls(t.customAccent):Es[t.accent||`blue`]},zs=e=>{let t=Z(e);return t.accent===`custom`?t.customAccent||`#2563eb`:gs.find(e=>e.id===t.accent)?.color||`#2563eb`},Bs=(e,t,n)=>t===0||e<8?e*t:Os(e*n.multiplier*t,n.minimum*t,n.maximum*t),Vs=(e,t,n,r)=>vs.reduce((i,a)=>(i[a]=Ns(e,Bs(t,1,r),n[a]),i),{}),Hs=(e,t,n,r)=>ys.reduce((i,a)=>{let o=n[a];return i[a]=Ns(e,Bs(t,o.saturationFactor,r),o.lightness),i},{}),Us=(e,t,n)=>{let{r,g:i,b:a}=As(n);e.style.setProperty(t,`${r} ${i} ${a}`)},Ws=e=>{for(let t of vs)e.style.removeProperty(`--color-gray-${t}`),e.style.removeProperty(`--color-dark-${t}`);for(let t of ys)e.style.removeProperty(`--color-${t}`)},Gs=(e,t)=>{let{r:n,g:r,b:i}=As(zs(t)),{h:a,s:o}=Ms(n,r,i),s=t.mode===`light`?xs:bs,c=Vs(a,o,Ss,s),l=Vs(a,o,Cs,bs),u=Hs(a,o,t.mode===`dark`?Ts:ws,s);for(let t of vs)Us(e,`--color-gray-${t}`,c[t]),Us(e,`--color-dark-${t}`,l[t]);for(let t of ys)Us(e,`--color-${t}`,u[t])},Ks=e=>{if(typeof document>`u`)return;let t=Z(e),n=document.documentElement,r=Rs(t);n.classList.remove(`dark`,`ophelia`),t.mode===`dark`&&n.classList.add(`dark`),n.style.colorScheme=t.mode,n.dataset.accent=t.accent||`blue`,n.dataset.themeStyle=t.adaptToAccent?`accent`:`default`;for(let e of _s){let{r:t,g:i,b:a}=As(r[e]),o=`${t} ${i} ${a}`;n.style.setProperty(`--color-primary-${e}`,o),n.style.setProperty(`--color-accent-${e}`,o)}t.adaptToAccent?Gs(n,t):Ws(n)},qs=s(`store:app-store`),Js=250,Ys=null,Xs=be()(xe((e,t)=>({theme:{mode:`light`,adaptToAccent:!1,accent:ms,customAccent:hs},themeSyncPending:!1,syncThemePreference:async n=>{if(Ys&&(clearTimeout(Ys),Ys=null),!(!Se()&&!localStorage.getItem(`auth-token`)))try{let{preferencesApi:r}=await o(async()=>{let{preferencesApi:e}=await import(`../js/api-BRz6cQiD.js`).then(e=>e.t);return{preferencesApi:e}},__vite__mapDeps([0,1,2,3,4,5]));if(!(await r.updatePreferences({theme:n})).success){qs.warn(`Failed to save theme preference to backend`);return}let i=Z(t().theme),a=Z(n);i.mode===a.mode&&i.adaptToAccent===a.adaptToAccent&&i.accent===a.accent&&i.customAccent===a.customAccent?e({themeSyncPending:!1}):(e({themeSyncPending:!0}),t().scheduleThemePreferenceSync())}catch(e){qs.warn(`Failed to save theme preference to backend:`,e)}},scheduleThemePreferenceSync:()=>{Ys&&clearTimeout(Ys),Ys=setTimeout(()=>{Ys=null,t().syncThemePreference(Z(t().theme))},Js)},setTheme:t=>{let n=Z(t);e(e=>({theme:n,preferences:{...e.preferences,theme:n}})),Ks(n)},updateTheme:n=>{let r=Z(n);t().setTheme(r),e({themeSyncPending:!0}),t().scheduleThemePreferenceSync()},toggleTheme:()=>{let e=t().theme,n=e.mode===`dark`?`light`:`dark`;t().updateTheme({...e,mode:n})},sidebarOpen:!0,sidebarCompact:!1,setSidebarOpen:t=>e({sidebarOpen:t}),setSidebarCompact:t=>e({sidebarCompact:t}),toggleSidebar:()=>e(e=>({sidebarOpen:!e.sidebarOpen})),toggleSidebarCompact:()=>e(e=>({sidebarCompact:!e.sidebarCompact})),artifactPanelOpen:!1,artifactPanelArtifact:null,openArtifactPanel:t=>e({artifactPanelOpen:!0,artifactPanelArtifact:t}),closeArtifactPanel:()=>e({artifactPanelOpen:!1,artifactPanelArtifact:null}),preferences:{theme:{mode:`light`,adaptToAccent:!1,accent:ms,customAccent:hs},defaultModel:``,systemMessage:``,generationOptions:{temperature:.7,top_p:.9,top_k:40,num_predict:1024},embeddingSettings:{enabled:!1,model:`nomic-embed-text`,chunkSize:1e3,chunkOverlap:200,similarityThreshold:.3},titleSettings:{autoTitle:!1,taskModel:``},showUsername:!1,backgroundSettings:{enabled:!1,imageUrl:``,blurAmount:10,opacity:.6}},setPreferences:t=>{let n=t.theme?Z(t.theme):null;e(e=>({...n&&{theme:n},preferences:{...e.preferences,...t,...n&&{theme:n}}})),n&&Ks(n)},loadPreferences:async()=>{try{let{preferencesApi:n}=await o(async()=>{let{preferencesApi:e}=await import(`../js/api-BRz6cQiD.js`).then(e=>e.t);return{preferencesApi:e}},__vite__mapDeps([0,1,2,3,4,5])),r=await n.getPreferences();if(r.success&&r.data){let n=r.data,i=t().themeSyncPending?Z(t().theme):null;t().setPreferences(i?{...n,theme:i}:n),e({backgroundImage:n.backgroundSettings?.imageUrl||null}),i&&t().syncThemePreference(i)}}catch(e){qs.warn(`Failed to load preferences from backend:`,e)}},isGenerating:!1,setIsGenerating:t=>e({isGenerating:t}),hasSeenSettingsNotification:!1,markSettingsNotificationAsSeen:()=>e({hasSeenSettingsNotification:!0}),isDemoMode:Se(),demoConfig:Ce(),setDemoMode:t=>{e({isDemoMode:t,demoConfig:Ce()})},backgroundImage:null,setBackgroundImage:async n=>{if(e({backgroundImage:n}),n){let e=t(),r={...e.preferences,backgroundSettings:{enabled:!0,imageUrl:n,blurAmount:e.preferences.backgroundSettings?.blurAmount||10,opacity:e.preferences.backgroundSettings?.opacity||.6}};e.setPreferences(r);try{let{preferencesApi:e}=await o(async()=>{let{preferencesApi:e}=await import(`../js/api-BRz6cQiD.js`).then(e=>e.t);return{preferencesApi:e}},__vite__mapDeps([0,1,2,3,4,5]));await e.updatePreferences({backgroundSettings:r.backgroundSettings})}catch(e){qs.warn(`Failed to save background settings to backend:`,e)}}},uploadBackgroundImage:async e=>{try{let n=new FileReader;return new Promise((r,i)=>{n.onload=async e=>{try{let n=e.target?.result;await t().setBackgroundImage(n),r()}catch(e){i(e)}},n.onerror=i,n.readAsDataURL(e)})}catch(e){throw qs.error(`Failed to upload background image:`,e),e}},removeBackgroundImage:async()=>{e({backgroundImage:null});let n=t(),r={enabled:!1,imageUrl:``,blurAmount:n.preferences.backgroundSettings?.blurAmount||10,opacity:n.preferences.backgroundSettings?.opacity||.6};n.setPreferences({backgroundSettings:r});try{let{preferencesApi:e}=await o(async()=>{let{preferencesApi:e}=await import(`../js/api-BRz6cQiD.js`).then(e=>e.t);return{preferencesApi:e}},__vite__mapDeps([0,1,2,3,4,5]));await e.updatePreferences({backgroundSettings:r})}catch(e){qs.warn(`Failed to save background removal to backend:`,e)}},clearUserState:()=>{let t=Z({mode:`light`,adaptToAccent:!1,accent:ms,customAccent:hs});Ys&&(clearTimeout(Ys),Ys=null),e({theme:t,themeSyncPending:!1,backgroundImage:null,preferences:{theme:t,defaultModel:``,systemMessage:``,generationOptions:{temperature:.7,top_p:.9,top_k:40,num_predict:1024},embeddingSettings:{enabled:!1,model:`nomic-embed-text`,chunkSize:1e3,chunkOverlap:200,similarityThreshold:.3},titleSettings:{autoTitle:!1,taskModel:``},showUsername:!1,backgroundSettings:{enabled:!1,imageUrl:``,blurAmount:10,opacity:.6}}}),Ks(t)}}),{name:`libre-webui-app-state`,onRehydrateStorage:()=>e=>{e&&e.setTheme(Z(e.theme))},partialize:e=>{let{backgroundSettings:t,...n}=e.preferences;return{theme:e.theme,themeSyncPending:e.themeSyncPending,sidebarOpen:e.sidebarOpen,sidebarCompact:e.sidebarCompact,preferences:n,hasSeenSettingsNotification:e.hasSeenSettingsNotification}}}));typeof window<`u`&&(()=>{let{theme:e,setTheme:t}=Xs.getState();t(e)})();var Zs=s(`store:plugin-store`),Qs=be((e,t)=>({plugins:[],pluginStatus:[],pluginVariables:{},isLoading:!1,isUploading:!1,error:null,loadPlugins:async()=>{e({isLoading:!0,error:null});try{let t=await D.getAllPlugins();t.success&&t.data?e({plugins:t.data}):e({error:t.error||`Failed to load plugins`})}catch(t){e({error:t instanceof Error?t.message:`Failed to load plugins`})}finally{e({isLoading:!1})}},uploadPlugin:async n=>{e({isUploading:!0,error:null});try{let r=await D.uploadPlugin(n);r.success&&r.data?await t().loadPlugins():e({error:r.error||`Failed to upload plugin`})}catch(t){e({error:t instanceof Error?t.message:`Failed to upload plugin`})}finally{e({isUploading:!1})}},installPlugin:async n=>{e({isLoading:!0,error:null});try{let r=await D.installPlugin(n);r.success&&r.data?await t().loadPlugins():e({error:r.error||`Failed to install plugin`})}catch(t){e({error:t instanceof Error?t.message:`Failed to install plugin`})}finally{e({isLoading:!1})}},updatePlugin:async(n,r)=>{e({isLoading:!0,error:null});try{let i=await D.updatePlugin(n,r);i.success&&i.data?await t().loadPlugins():e({error:i.error||`Failed to update plugin`})}catch(t){e({error:t instanceof Error?t.message:`Failed to update plugin`})}finally{e({isLoading:!1})}},deletePlugin:async n=>{e({isLoading:!0,error:null});try{let r=await D.deletePlugin(n);r.success?await t().loadPlugins():e({error:r.error||`Failed to delete plugin`})}catch(t){e({error:t instanceof Error?t.message:`Failed to delete plugin`})}finally{e({isLoading:!1})}},activatePlugin:async n=>{e({isLoading:!0,error:null});try{let r=await D.activatePlugin(n);r.success?await t().loadPlugins():e({error:r.error||`Failed to activate plugin`})}catch(t){e({error:t instanceof Error?t.message:`Failed to activate plugin`})}finally{e({isLoading:!1})}},deactivatePlugin:async n=>{e({isLoading:!0,error:null});try{let r=await D.deactivatePlugin(n);r.success?await t().loadPlugins():e({error:r.error||`Failed to deactivate plugin`})}catch(t){e({error:t instanceof Error?t.message:`Failed to deactivate plugin`})}finally{e({isLoading:!1})}},loadPluginStatus:async()=>{try{let t=await D.getPluginStatus();t.success&&t.data&&e({pluginStatus:t.data})}catch(e){Zs.error(`Failed to load plugin status:`,e)}},exportPlugin:async t=>{e({isLoading:!0,error:null});try{let e=await D.exportPlugin(t),n=window.URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=`${t}.json`,document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(n)}catch(t){e({error:t instanceof Error?t.message:`Failed to export plugin`})}finally{e({isLoading:!1})}},fetchPluginVariables:async t=>{try{let n=await D.getVariables(t);n.success&&n.data&&e(e=>({pluginVariables:{...e.pluginVariables,[t]:n.data}}))}catch(e){Zs.error(`Failed to fetch plugin variables:`,e)}},updatePluginVariables:async(e,n)=>{try{return(await D.setVariables(e,n)).success?(await t().fetchPluginVariables(e),!0):!1}catch(e){return Zs.error(`Failed to update plugin variables:`,e),!1}},resetPluginVariables:async t=>{try{(await D.resetVariables(t)).success&&e(e=>{let n={...e.pluginVariables};return delete n[t],{pluginVariables:n}})}catch(e){Zs.error(`Failed to reset plugin variables:`,e)}},clearError:()=>e({error:null}),setError:t=>e({error:t})}));function $s(e){"@babel/helpers - typeof";return $s=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},$s(e)}function ec(e,t){if($s(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if($s(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function tc(e){var t=ec(e,`string`);return $s(t)==`symbol`?t:t+``}function nc(e,t,n){return(t=tc(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Q=s(`websocket`),rc=new class{constructor(){nc(this,`ws`,null),nc(this,`url`,void 0),nc(this,`reconnectAttempts`,0),nc(this,`maxReconnectAttempts`,5),nc(this,`reconnectDelay`,1e3),nc(this,`messageHandlers`,new Map);let e;e=window.location.protocol===`file:`?`ws://localhost:3001`:`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}`,this.url=`${e}/ws`,Q.debug(`WebSocket URL constructed:`,this.url)}connect(){return Se()?(Q.debug(`Demo mode active: skipping WebSocket connection.`),Promise.resolve()):(Q.debug(`WebSocket: Attempting to connect to:`,this.url),new Promise((e,t)=>{try{let n=localStorage.getItem(`auth-token`),r=n?`${this.url}?token=${encodeURIComponent(n)}`:this.url;Q.debug(`WebSocket: Connecting to:`,r.replace(/token=[^&]+/,`token=***`)),this.ws=new WebSocket(r),this.ws.onopen=()=>{Q.debug(`WebSocket connected successfully`),this.reconnectAttempts=0,e()},this.ws.onmessage=e=>{try{let t=JSON.parse(e.data),n=this.messageHandlers.get(t.type);n?n(t.data):t.type===`connected`?Q.debug(`WebSocket: Server confirmed connection`):Q.warn(`WebSocket: No handler for message type:`,t.type)}catch(e){Q.error(`Failed to parse WebSocket message:`,e)}},this.ws.onclose=()=>{Q.debug(`WebSocket disconnected`),this.ws=null,this.attemptReconnect()},this.ws.onerror=e=>{Q.error(`WebSocket error:`,e),t(e)}}catch(e){t(e)}}))}disconnect(){this.ws&&(this.ws.close(),this.ws=null)}send(e){this.ws&&this.ws.readyState===WebSocket.OPEN?(Q.debug(`WebSocket: Sending message:`,e),this.ws.send(JSON.stringify(e))):Q.warn(`WebSocket is not connected. ReadyState:`,this.ws?.readyState)}onMessage(e,t){this.messageHandlers.delete(e),this.messageHandlers.set(e,t)}offMessage(e){this.messageHandlers.delete(e)}attemptReconnect(){if(Se()){Q.debug(`Demo mode active: skipping WebSocket reconnection.`);return}this.reconnectAttempts<this.maxReconnectAttempts?(this.reconnectAttempts++,Q.debug(`Attempting to reconnect... (${this.reconnectAttempts}/${this.maxReconnectAttempts})`),setTimeout(()=>{this.connect().catch(()=>{})},this.reconnectDelay*this.reconnectAttempts)):Q.error(`Max reconnection attempts reached`)}get isConnected(){return this.ws?.readyState===WebSocket.OPEN}},ic=e({useAuthStore:()=>$}),ac=s(`auth-store`),$=be()(xe((e,t)=>({user:null,token:null,systemInfo:null,isAuthenticated:!1,isLoading:!1,login:(n,r,i)=>{let a=t().user?.id===n.id;localStorage.setItem(`auth-token`,r);let o=ps.getState();o.clearAllState&&o.clearAllState(),a||Xs.getState().clearUserState(),e({user:n,token:r,systemInfo:i,isAuthenticated:!0,isLoading:!1}),setTimeout(async()=>{try{let e=Qs.getState();ac.debug(`Reinitializing app after login...`),ac.debug(`Reconnecting WebSocket with auth token...`),rc.disconnect(),await rc.connect(),!(await De.checkHealth()).success&&!Se()&&ac.warn(`Ollama service not available after login`);let t=Xs.getState();await Promise.all([o.loadModels(),o.loadSessions(),o.loadPreferences(),t.loadPreferences(),e.loadPlugins()]),ac.debug(`Reinitialized app after login`)}catch(e){ac.error(`Failed to reinitialize app after login:`,e)}},100)},logout:()=>{localStorage.removeItem(`auth-token`),ac.debug(`Disconnecting WebSocket on logout...`),rc.disconnect();let t=ps.getState();t.clearAllState&&t.clearAllState(),Xs.getState().clearUserState(),e({user:null,token:null,isAuthenticated:!1,isLoading:!1})},setUser:t=>{e({user:t})},setSystemInfo:t=>{e({systemInfo:t})},setLoading:t=>{e({isLoading:t})},isAdmin:()=>{let{user:e}=t();return e?.role===`admin`},requiresAuth:()=>{let{systemInfo:e}=t();return e?.requiresAuth??!1}}),{name:`auth-store`,partialize:e=>({user:e.user,token:e.token,systemInfo:e.systemInfo,isAuthenticated:e.isAuthenticated})})),oc=`welcomePromptIndex`,sc=`libre:welcome-prompt-change`,cc=[`time`,`create`,`explore`,`imagine`,`focus`,`untangle`,`momentum`,`open`,`challenge`,`draft`,`possibility`,`unexpected`],lc=0,uc=e=>Number.isInteger(e)&&e>=0&&e<cc.length,dc=()=>{if(typeof window>`u`)return lc;try{let e=window.sessionStorage.getItem(oc),t=Number(e);e!==null&&uc(t)&&(lc=t)}catch{}return lc},fc=()=>{let e=(dc()+1)%cc.length;if(lc=e,typeof window<`u`){try{window.sessionStorage.setItem(oc,String(e))}catch{}window.dispatchEvent(new Event(sc))}return e},pc=e=>cc[e]??`time`,mc=i(),hc=({label:e,error:t,helper:n,className:r,id:i,...a})=>{let o=(0,V.useId)(),s=i||`input-${o}`;return(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[e&&(0,H.jsx)(`label`,{htmlFor:s,className:`block text-sm font-medium tracking-[-0.005em] text-ink-muted`,children:e}),(0,H.jsx)(`input`,{id:s,className:O(`block w-full rounded-xl border border-line bg-surface-raised px-3.5 py-2.5 text-base text-ink shadow-none`,`placeholder:text-ink-subtle transition-[background-color,border-color,box-shadow,color] duration-150 ease-out`,`focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus-visible:outline-none dark:focus:border-primary-400 dark:focus:ring-primary-400/20`,`disabled:cursor-not-allowed disabled:bg-surface-subtle disabled:text-ink-subtle disabled:opacity-70`,t&&`border-error-500 focus:border-error-500 focus:ring-error-500/20`,r),...a}),t&&(0,H.jsx)(`p`,{className:`text-xs leading-relaxed text-error-600 dark:text-error-400`,children:t}),n&&!t&&(0,H.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-muted`,children:n})]})},gc=V.forwardRef(({label:e,error:t,helper:n,className:r,id:i,...a},o)=>{let s=(0,V.useId)(),c=i||`textarea-${s}`;return(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[e&&(0,H.jsx)(`label`,{htmlFor:c,className:`block text-sm font-medium tracking-[-0.005em] text-ink-muted`,children:e}),(0,H.jsx)(`textarea`,{ref:o,id:c,className:O(`block w-full resize-none rounded-xl border border-line bg-surface-raised px-3.5 py-2.5 text-base text-ink shadow-none`,`placeholder:text-ink-subtle transition-[background-color,border-color,box-shadow,color] duration-150 ease-out`,`focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus-visible:outline-none dark:focus:border-primary-400 dark:focus:ring-primary-400/20`,`disabled:cursor-not-allowed disabled:bg-surface-subtle disabled:text-ink-subtle disabled:opacity-70`,t&&`border-error-500 focus:border-error-500 focus:ring-error-500/20`,r),...a}),t&&(0,H.jsx)(`p`,{className:`text-xs leading-relaxed text-error-600 dark:text-error-400`,children:t}),n&&!t&&(0,H.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-muted`,children:n})]})});gc.displayName=`Textarea`;var _c=({label:e,error:t,helper:n,options:r,className:i,id:a,...o})=>{let s=(0,V.useId)(),c=a||`select-${s}`;return(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[e&&(0,H.jsx)(`label`,{htmlFor:c,className:`block text-sm font-medium tracking-[-0.005em] text-ink-muted`,children:e}),(0,H.jsx)(`select`,{id:c,className:O(`block w-full rounded-xl border border-line bg-surface-raised px-3.5 py-2.5 text-base text-ink shadow-none`,`transition-[background-color,border-color,box-shadow,color] duration-150 ease-out`,`focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus-visible:outline-none dark:focus:border-primary-400 dark:focus:ring-primary-400/20`,`disabled:cursor-not-allowed disabled:bg-surface-subtle disabled:text-ink-subtle disabled:opacity-70`,t&&`border-error-500 focus:border-error-500 focus:ring-error-500/20`,i),...o,children:r.map((e,t)=>(0,H.jsx)(`option`,{value:e.value,children:e.label},e.key??`${e.value}-${t}`))}),t&&(0,H.jsx)(`p`,{className:`text-xs leading-relaxed text-error-600 dark:text-error-400`,children:t}),n&&!t&&(0,H.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-muted`,children:n})]})},vc=[/^ {0,3}(?:`{3,}|~{3,})/m,/`[^`\n]+`/,/^\s{0,3}#{1,6}\s/m,/^\s{0,3}[-*+]\s/m,/^\s{0,3}\d+\.\s/m,/^\s{0,3}>\s/m,/\[[^\]]+\]\([^)]+\)/,/!\[[^\]]*]\([^)]+\)/,/\|.*\|/,/\*\*[^*]+\*\*/,/__[^_]+__/,/~~[^~]+~~/,/\\\[[\s\S]*?\\\]/,/\\\([\s\S]*?\\\)/,/\$\$[\s\S]*?\$\$/,/(^|[^$])\$[^$\n]+\$/],yc=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);function bc(e){let t=[],n=/^( {0,3})(`{3,}|~{3,})([^\n\r]*)(?:\r?\n|$)/gm,r;for(;r=n.exec(e);){let i=r[1].length,a=r[2],o=a[0],s=r[3].trim();if(o==="`"&&s.includes("`"))continue;let c=n.lastIndex,l=RegExp(`^ {0,3}${yc(o)}{${a.length},}[ \\t]*(?:\\r?\\n|$)`,`gm`);l.lastIndex=c;let u=l.exec(e),d=s.split(/\s+/)[0]||null;if(!u){t.push({start:r.index,end:e.length,codeStart:c,codeEnd:e.length,indent:i,language:d,complete:!1});break}t.push({start:r.index,end:l.lastIndex,codeStart:c,codeEnd:u.index,indent:i,language:d,complete:!0}),n.lastIndex=l.lastIndex}return t}function xc(e){return/<(?:html|head|body)(?:\s|>)|<\/(?:head|body|html)\s*>/i.test(e)}function Sc(e,t){return e.start<t.end&&t.start<e.end}function Cc(e,t){let n=/^( {0,3})(<!doctype\s+html(?:\s|>|$)|<html(?:\s[^>\n\r]*)?>)/gim,r;for(;r=n.exec(e);){let n=r.index+r[1].length;if(t.some(e=>n>=e.start&&n<e.end))continue;let i=e.slice(n);if(!xc(i.slice(r[2].length)))continue;let a=/<\/html\s*>/i.exec(i),o=a?n+a.index+a[0].length:e.length;return{start:r.index,end:o,codeStart:n,codeEnd:o,indent:0,language:`html`,complete:!!a}}return null}function wc(e){let t=bc(e),n=Cc(e,t);return n?[...t.filter(e=>!Sc(e,n)),n].sort((e,t)=>e.start-t.start):t}function Tc(e,t){return t===0?e:e.replace(RegExp(`^ {1,${t}}`,`gm`),``)}function Ec(e){return vc.some(t=>t.test(e))}function Dc(e){let t=[],n=wc(e),r=0;for(let i of n){let n=e.slice(r,i.start);n&&t.push({type:`text`,content:n}),t.push({type:`code`,language:i.language,content:Tc(e.slice(i.codeStart,i.codeEnd),i.indent),complete:i.complete}),r=i.end}let i=e.slice(r);return(i||t.length===0)&&t.push({type:`text`,content:i}),t}function Oc(e){let t=e=>e.replace(/\\\[([\s\S]*?)\\\]/g,(e,t)=>`$$${t}$$`).replace(/\\\(([\s\S]*?)\\\)/g,(e,t)=>`$${t}$`),n=e=>{let n=/`[^`\n]+`/g,r=``,i=0,a;for(;a=n.exec(e);)r+=t(e.slice(i,a.index)),r+=a[0],i=n.lastIndex;return r+t(e.slice(i))},r=bc(e),i=``,a=0;for(let t of r)i+=n(e.slice(a,t.start)),i+=e.slice(t.start,t.end),a=t.end;return i+=n(e.slice(a)),i}var kc=s(`components:ui:message-code-block`);function Ac({code:e,language:t,state:n,children:r}){let{t:i}=l(),[a,o]=V.useState(null),s=V.useRef(null),c=a===e,u=t||`text`,d=i(c?`artifacts.copied`:`artifacts.copy`),f=`${d}: ${u}`;return V.useEffect(()=>()=>{s.current!==null&&window.clearTimeout(s.current)},[]),(0,H.jsxs)(`div`,{dir:`ltr`,"data-testid":`code-block`,"data-state":n,"data-language":u,className:`group relative my-4 overflow-hidden rounded-xl border border-white/10 bg-[#0D1117] text-left text-[#E6EDF3] shadow-[0_12px_32px_rgba(13,17,23,0.16)]`,children:[(0,H.jsxs)(`div`,{className:`flex h-10 items-center justify-between border-b border-white/10 bg-white/[0.035] px-3.5`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(ee,{className:`h-3.5 w-3.5 shrink-0 text-[#8B949E]`}),(0,H.jsx)(`span`,{className:`truncate font-mono text-[11px] font-medium lowercase tracking-[-0.01em] text-[#B1BAC4]`,children:u})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[n===`streaming`&&(0,H.jsx)(`span`,{role:`status`,"aria-label":i(`common.loading`),className:`flex h-7 w-7 items-center justify-center`,children:(0,H.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-primary-400`})}),(0,H.jsx)(`button`,{type:`button`,onClick:async()=>{if(e)try{await navigator.clipboard.writeText(e),o(e),s.current!==null&&window.clearTimeout(s.current),s.current=window.setTimeout(()=>{o(null),s.current=null},2e3)}catch(e){kc.error(`Failed to copy code:`,e)}},disabled:!e,className:`flex h-7 w-7 items-center justify-center rounded-md text-[#8B949E] transition-colors hover:bg-white/[0.08] hover:text-[#E6EDF3] focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-400/70 disabled:cursor-default disabled:opacity-35`,title:d,"aria-label":f,children:c?(0,H.jsx)(ge,{className:`h-3.5 w-3.5 text-green-400`}):(0,H.jsx)(me,{className:`h-3.5 w-3.5`})}),(0,H.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:c?f:``})]})]}),r]})}var jc=`#0D1117`,Mc=`max-h-[60vh] min-h-12 overflow-auto bg-[#0D1117] p-4 text-left font-mono text-[14px] leading-6 text-[#E6EDF3] whitespace-pre tabular-nums`,Nc={maxHeight:`60vh`,minHeight:`3rem`,overflow:`auto`,padding:`1rem`,fontSize:`14px`,lineHeight:`1.5rem`,fontFamily:`"JetBrains Mono", ui-monospace, SFMono-Regular, monospace`,whiteSpace:`pre`};function Pc({content:e}){return e?(0,H.jsx)(`div`,{dir:`auto`,className:`whitespace-pre-wrap break-words leading-relaxed`,children:e}):null}function Fc({content:e,language:t,complete:n}){let r=n?e.replace(/\r?\n$/,``):e,i=V.useRef(null),a=V.useRef(!0);return V.useLayoutEffect(()=>{let e=i.current;e&&a.current&&(e.scrollTop=e.scrollHeight)},[r]),(0,H.jsx)(Ac,{code:r,language:t,state:n?`complete`:`streaming`,children:(0,H.jsx)(`pre`,{ref:i,onScroll:()=>{let e=i.current;e&&(a.current=e.scrollHeight-e.scrollTop-e.clientHeight<24)},className:Mc,children:(0,H.jsx)(`code`,{children:r})})})}var Ic=({content:e,className:t,segments:n,isStreaming:r=!0})=>{let i=V.useMemo(()=>n??Dc(e),[e,n]),a=i[i.length-1],o=a?.type===`code`&&!a.complete;return(0,H.jsxs)(`div`,{className:O(`text-sm leading-relaxed text-gray-700 dark:text-dark-700`,t),children:[i.map((e,t)=>e.type===`code`?(0,H.jsx)(Fc,{...e},`${e.type}-${t}`):(0,H.jsx)(Pc,{content:e.content},`${e.type}-${t}`)),r&&!o&&(0,H.jsx)(`span`,{"data-testid":`message-streaming-cursor`,"aria-hidden":`true`,className:`ms-1 inline-block h-5 w-1 animate-pulse rounded-full bg-primary-500 align-text-bottom`})]})},Lc=V.lazy(()=>o(()=>import(`../js/RichMessageContent-CdgQHk6Q.js`),__vite__mapDeps([6,1,5,2,3,7,4,8,9])));function Rc({content:e,className:t}){return(0,H.jsx)(`div`,{dir:`auto`,className:O(`text-sm leading-relaxed text-gray-700 dark:text-dark-700 whitespace-pre-wrap break-words`,t),children:e})}var zc=({content:e,className:t,isStreaming:n=!1})=>{let r=V.useMemo(()=>n?Dc(e):[],[e,n]),i=r.some(e=>e.type===`code`);if(n&&i)return(0,H.jsx)(Ic,{content:e,className:t,segments:r});let a;return a=Ec(e)?(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(Ic,{content:e,className:t,isStreaming:!1}),children:(0,H.jsx)(Lc,{content:e,className:t})}):(0,H.jsx)(Rc,{content:e,className:t}),(0,H.jsxs)(H.Fragment,{children:[a,n&&(0,H.jsx)(`span`,{"data-testid":`message-streaming-cursor`,"aria-hidden":`true`,className:`ms-1 inline-block h-5 w-1 animate-pulse rounded-full bg-primary-500 align-text-bottom`})]})},Bc=({children:e,htmlFor:t,className:n=``})=>(0,H.jsx)(`label`,{htmlFor:t,className:O(`text-sm font-medium tracking-[-0.005em] text-ink-muted`,n),children:e}),Vc=({children:e,className:t=``})=>(0,H.jsx)(`div`,{className:O(`rounded-2xl border border-line bg-surface-raised shadow-card`,t),children:e}),Hc=({children:e,className:t=``})=>(0,H.jsx)(`div`,{className:O(`flex flex-col space-y-1.5 p-6`,t),children:e}),Uc=({children:e,className:t=``})=>(0,H.jsx)(`h3`,{className:O(`text-lg font-semibold leading-tight tracking-[-0.02em] text-ink`,t),children:e}),Wc=({children:e,className:t=``})=>(0,H.jsx)(`p`,{className:O(`text-sm leading-relaxed text-ink-muted`,t),children:e}),Gc=({children:e,className:t=``})=>(0,H.jsx)(`div`,{className:O(`p-6 pt-0`,t),children:e}),Kc={narrow:`max-w-4xl`,default:`max-w-6xl`,wide:`max-w-7xl`},qc=({children:e,width:t=`default`,className:n,contentClassName:r,...i})=>(0,H.jsx)(`div`,{"data-testid":`page-scroll-region`,className:O(`scroll-region h-full min-h-0 scrollbar-thin`,n),...i,children:(0,H.jsx)(`div`,{className:O(`mx-auto w-full px-4 pb-16 pt-7 sm:px-6 sm:pb-20 sm:pt-10 lg:px-8`,Kc[t],r),children:e})}),Jc=({title:e,description:t,eyebrow:n,actions:r,meta:i,className:a,...o})=>(0,H.jsxs)(`header`,{className:O(`mb-8 flex flex-col gap-6 border-b border-gray-200/70 pb-7 text-start dark:border-white/[0.08] sm:mb-10 sm:pb-9 md:flex-row md:items-end md:justify-between`,a),...o,children:[(0,H.jsxs)(`div`,{className:`min-w-0 max-w-3xl`,children:[n&&(0,H.jsx)(`div`,{className:`mb-3 text-[11px] font-medium uppercase tracking-[0.18em] text-gray-500 dark:text-dark-500 rtl:tracking-normal`,children:n}),(0,H.jsx)(`h1`,{className:`text-balance text-3xl font-normal leading-[1.02] tracking-[-0.04em] text-gray-950 dark:text-dark-950 sm:text-5xl rtl:leading-[1.15] rtl:tracking-normal`,children:e}),t&&(0,H.jsx)(`p`,{className:`mt-4 max-w-2xl text-sm leading-6 text-gray-600 dark:text-dark-600 sm:text-base sm:leading-7`,children:t}),i&&(0,H.jsx)(`div`,{className:`mt-4`,children:i})]}),r&&(0,H.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 md:justify-end`,children:r})]}),Yc=s(`components:avatar-upload`),Xc=({value:e,onChange:t,className:n=``})=>{let{t:r}=l(),i=(0,V.useRef)(null),[a,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)(!1),u=async e=>{if(!e.type.startsWith(`image/`)){T.error(r(`user.avatar.invalidFile`));return}if(e.size>2*1024*1024){T.error(r(`user.avatar.fileTooLarge`));return}o(!0);try{let n=new FileReader;n.onload=e=>{let n=e.target?.result;t(n),T.success(r(`user.avatar.uploaded`))},n.onerror=()=>{T.error(r(`user.avatar.readFailed`))},n.readAsDataURL(e)}catch(e){Yc.error(`Failed to upload avatar:`,e),T.error(r(`user.avatar.uploadFailed`))}finally{o(!1)}},d=e=>{let t=e.target.files?.[0];t&&u(t)},f=e=>{e.preventDefault(),c(!0)},p=e=>{e.preventDefault(),c(!1)},m=e=>{e.preventDefault(),c(!1);let t=e.dataTransfer.files?.[0];t&&u(t)},h=()=>{t(``),T.success(r(`user.avatar.removed`))},g=()=>e||null;return(0,H.jsx)(`div`,{className:`space-y-4 ${n}`,children:(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-dark-600 mb-2`,children:r(`user.avatar.label`)}),(0,H.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,H.jsx)(`div`,{className:`flex-shrink-0`,children:(0,H.jsx)(`div`,{className:`w-20 h-20 rounded-full overflow-hidden bg-gray-100 dark:bg-dark-200 border-2 border-gray-300 dark:border-dark-300 flex items-center justify-center`,children:g()?(0,H.jsx)(`img`,{src:g(),alt:`Avatar preview`,className:`w-full h-full object-cover`}):(0,H.jsx)(le,{className:`h-8 w-8 text-gray-400 dark:text-gray-500`})})}),(0,H.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[e?(0,H.jsxs)(`div`,{className:`flex items-center gap-3 p-3 bg-gray-50 dark:bg-dark-200 rounded-lg`,children:[(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 truncate`,children:r(`user.avatar.customAvatar`)}),(0,H.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:r(`user.avatar.clickToChange`)})]}),(0,H.jsx)(k,{variant:`ghost`,size:`sm`,onClick:h,className:`text-red-600 hover:text-red-700 hover:bg-red-50 dark:text-red-400 dark:hover:text-red-300 dark:hover:bg-red-900/20`,children:(0,H.jsx)(ce,{className:`h-4 w-4`})})]}):(0,H.jsxs)(`div`,{className:`border-2 border-dashed rounded-lg p-4 text-center cursor-pointer transition-colors ${s?`border-primary-500 bg-primary-50 dark:bg-primary-900/20`:`border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500`}`,onDragOver:f,onDragLeave:p,onDrop:m,onClick:()=>i.current?.click(),children:[(0,H.jsx)(re,{className:`h-8 w-8 mx-auto text-gray-400 dark:text-gray-500 mb-2`}),(0,H.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 mb-2`,children:r(`user.avatar.uploadAvatarImage`)}),(0,H.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mb-2`,children:r(`user.avatar.dragAndDrop`)}),(0,H.jsxs)(k,{variant:`outline`,size:`sm`,disabled:a,className:`mx-auto`,children:[(0,H.jsx)(re,{className:`h-4 w-4 mr-2`}),r(a?`user.avatar.uploading`:`user.avatar.chooseImage`)]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{className:`block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1`,children:r(`user.avatar.enterImageUrl`)}),(0,H.jsx)(`input`,{type:`url`,value:e,onChange:e=>t(e.target.value),className:`w-full px-3 py-2 text-sm border border-gray-300 dark:border-dark-300 rounded-md bg-white dark:bg-dark-50 text-gray-900 dark:text-dark-800`,placeholder:`https://example.com/avatar.jpg`})]})]})]}),(0,H.jsx)(`input`,{ref:i,type:`file`,accept:`image/*`,onChange:d,className:`hidden`}),(0,H.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-2`,children:r(`user.avatar.supportedFormats`)})]})})};function Zc({open:e,value:t,saving:n,onChange:r,onClose:i,onSave:a}){let{t:o}=l();return e?(0,mc.createPortal)((0,H.jsx)(`div`,{className:`fixed inset-0 z-[2147483647] flex items-center justify-center bg-gray-950/55 p-4 backdrop-blur-md`,onClick:i,children:(0,H.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`avatar-modal-title`,className:`bg-white dark:bg-dark-25 rounded-3xl shadow-[0_24px_80px_rgba(0,0,0,0.24)] p-6 w-full max-w-md border border-black/[0.07] dark:border-white/[0.08] animate-scale-in`,onClick:e=>e.stopPropagation(),children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,H.jsx)(`h3`,{id:`avatar-modal-title`,className:`text-lg font-medium tracking-[-0.02em] text-gray-950 dark:text-dark-950`,children:o(`user.avatar.title`)}),(0,H.jsx)(`button`,{onClick:i,className:`p-2 hover:bg-gray-100 dark:hover:bg-dark-200 rounded-xl transition-colors`,children:(0,H.jsx)(ce,{size:20,className:`text-gray-500`})})]}),(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsx)(Xc,{value:t,onChange:r}),(0,H.jsxs)(`div`,{className:`flex justify-end gap-3 pt-4 border-t border-gray-200 dark:border-dark-300`,children:[(0,H.jsx)(`button`,{onClick:i,className:`px-4 py-2 text-sm font-medium text-gray-700 dark:text-dark-700 hover:bg-gray-100 dark:hover:bg-dark-200 rounded-xl transition-colors`,children:o(`common.cancel`)}),(0,H.jsx)(`button`,{onClick:a,disabled:n,className:`px-4 py-2 text-sm font-medium text-white bg-gray-950 hover:bg-gray-800 dark:bg-white dark:text-gray-950 dark:hover:bg-gray-100 disabled:opacity-50 disabled:cursor-not-allowed rounded-xl transition-colors`,children:o(n?`common.saving`:`common.save`)})]})]})]})}),document.body):null}var Qc={sm:`text-[1.0625rem] leading-none`,md:`text-[1.625rem] leading-none`,lg:`text-[2.5rem] leading-none`},$c=({className:e,size:t=`md`,wordmark:n=!0})=>(0,H.jsxs)(`span`,{dir:`ltr`,className:O(`libre-brand inline-flex items-baseline whitespace-nowrap`,Qc[t],e),children:[`Libre`,n&&(0,H.jsx)(`span`,{className:`ms-1 font-normal tracking-[-0.035em]`,children:`WebUI`})]}),el=()=>{let{theme:e,toggleTheme:t}=Xs(),n=e.mode===`light`?`dark`:`light`,r=e.mode===`light`?(0,H.jsx)(_,{className:`h-4 w-4 text-ink-muted transition-colors duration-150 group-hover:text-ink motion-reduce:transition-none`,strokeWidth:1.75,"aria-hidden":`true`}):(0,H.jsx)(de,{className:`h-4 w-4 text-ink-muted transition-colors duration-150 group-hover:text-ink motion-reduce:transition-none`,strokeWidth:1.75,"aria-hidden":`true`}),i=`Switch to ${n} mode`;return(0,H.jsx)(k,{variant:`ghost`,size:`sm`,onClick:t,className:`h-9 w-9 rounded-full p-0`,"aria-label":i,title:`${i} (⌘D)`,children:r})};function tl({sidebarCompact:e,isElectron:t,selectedModel:n,modelCount:r,onToggleCompact:i,onCreateSession:a}){let{t:o}=l(),s=!n||r===0,c=s?o(`chat.model.noModelsTooltip`):``;return(0,H.jsxs)(`div`,{className:O(e?`px-2 pb-3 pt-3`:`px-4 pb-4 pt-4`,t&&`pt-10`),children:[(0,H.jsx)(`div`,{className:O(`flex items-center`,e?`justify-center mb-3`:`justify-between mb-4`),children:e?(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,H.jsx)($c,{size:`sm`,wordmark:!1,className:`text-gray-950 dark:text-dark-950 text-base tracking-[-0.035em]`}),(0,H.jsx)(k,{variant:`ghost`,size:`sm`,onClick:i,className:`h-9 w-9 p-0 rounded-xl text-gray-500 dark:text-dark-600 hover:bg-white/80 dark:hover:bg-dark-200 hover:text-gray-950 dark:hover:text-dark-950 touch-manipulation`,title:o(`sidebar.expandSidebar`),"aria-label":o(`sidebar.expandSidebar`),children:(0,H.jsx)(oe,{className:`h-4 w-4 rtl:rotate-180`})}),(0,H.jsx)(el,{})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)($c,{size:`sm`,className:`text-gray-950 dark:text-dark-950 tracking-[-0.035em]`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,H.jsx)(el,{}),(0,H.jsx)(k,{variant:`ghost`,size:`sm`,onClick:i,className:`h-9 w-9 p-0 rounded-xl text-gray-500 dark:text-dark-600 hover:bg-white/80 dark:hover:bg-dark-200 hover:text-gray-950 dark:hover:text-dark-950 touch-manipulation`,title:o(`sidebar.toggleSize`),"aria-label":o(`sidebar.toggleSize`),children:(0,H.jsx)(ae,{className:`h-4 w-4 rtl:rotate-180`})})]})]})}),e?(0,H.jsx)(k,{onClick:a,disabled:s,className:`w-full h-10 rounded-xl bg-gray-950 hover:bg-gray-800 active:bg-gray-900 text-white dark:bg-white dark:text-gray-950 dark:hover:bg-gray-100 dark:active:bg-gray-200 shadow-none transition-colors duration-150 border-0 touch-manipulation p-0`,title:s?c:o(`chat.session.new`),"aria-label":o(`chat.session.new`),children:(0,H.jsx)(p,{className:`h-4 w-4`})}):(0,H.jsxs)(k,{onClick:a,disabled:s,className:`w-full h-10 rounded-xl bg-gray-950 hover:bg-gray-800 active:bg-gray-900 text-white dark:bg-white dark:text-gray-950 dark:hover:bg-gray-100 dark:active:bg-gray-200 shadow-none transition-colors duration-150 border-0 touch-manipulation`,size:`sm`,title:c,children:[(0,H.jsx)(p,{className:`h-4 w-4 me-2`}),o(`chat.session.new`)]})]})}function nl({sidebarCompact:e,activePath:t,onChatClick:n,onMobileNavigate:r}){let{t:i}=l(),a=t=>O(`flex items-center gap-3 rounded-xl text-[13px] font-medium transition-colors duration-150 touch-manipulation outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30`,e?`w-11 h-11 justify-center p-0`:`w-full px-3 py-2.5`,t?`bg-white text-gray-950 ring-1 ring-black/[0.04] dark:bg-dark-200 dark:text-dark-950 dark:ring-white/[0.06]`:`text-gray-600 dark:text-dark-600 hover:bg-white/60 dark:hover:bg-dark-200/60 hover:text-gray-950 dark:hover:text-dark-950 active:bg-white dark:active:bg-dark-200`),o=t===`/chat`||t===`/`||t.startsWith(`/c/`);return(0,H.jsx)(`div`,{className:O(`pb-3`,e?`px-2`:`px-3`),children:(0,H.jsxs)(`nav`,{className:O(`space-y-0.5`,e&&`flex flex-col items-center`),children:[(0,H.jsxs)(`button`,{onClick:n,className:O(a(o),`text-start`),title:e?i(`sidebar.navigation.chat`):void 0,"aria-current":o?`page`:void 0,children:[(0,H.jsx)(x,{className:`h-[18px] w-[18px] shrink-0`}),!e&&i(`sidebar.navigation.chat`)]}),(0,H.jsxs)(oa,{to:`/models`,onClick:r,className:a(t===`/models`),title:e?i(`sidebar.navigation.models`):void 0,"aria-current":t===`/models`?`page`:void 0,children:[(0,H.jsx)(E,{className:`h-[18px] w-[18px] shrink-0`}),!e&&i(`sidebar.navigation.models`)]}),(0,H.jsxs)(oa,{to:`/personas`,onClick:r,className:a(t===`/personas`),title:e?i(`sidebar.navigation.personas`):void 0,"aria-current":t===`/personas`?`page`:void 0,children:[(0,H.jsx)(le,{className:`h-[18px] w-[18px] shrink-0`}),!e&&i(`sidebar.navigation.personas`)]}),(0,H.jsxs)(oa,{to:`/gallery`,onClick:r,className:a(t===`/gallery`),title:e?i(`sidebar.navigation.imagine`):void 0,"aria-current":t===`/gallery`?`page`:void 0,children:[(0,H.jsx)(u,{className:`h-[18px] w-[18px] shrink-0`}),!e&&i(`sidebar.navigation.imagine`)]}),(0,H.jsxs)(oa,{to:`/agents`,onClick:r,className:a(t===`/agents`),title:e?i(`sidebar.navigation.agents`):void 0,"aria-current":t===`/agents`?`page`:void 0,children:[(0,H.jsx)(C,{className:`h-[18px] w-[18px] shrink-0`}),!e&&i(`sidebar.navigation.agents`)]})]})})}function rl({sessions:e,personas:t,currentSessionId:n,generatingTitleForSession:r,sidebarCompact:i,editingSessionId:a,editingTitle:o,onEditingTitleChange:s,onSelectSession:c,onStartEditing:u,onSaveEdit:d,onCancelEdit:f,onDeleteSession:p}){let{t:m,i18n:h}=l();return(0,H.jsx)(`div`,{"data-testid":`sidebar-session-scroll-region`,className:`scroll-region min-h-0 flex-1 scrollbar-thin border-t border-black/[0.05] dark:border-white/[0.05]`,style:{willChange:`scroll-position`},children:(0,H.jsxs)(`div`,{className:O(`px-3 py-3`,i&&`px-2`),children:[!i&&e.length>0&&(0,H.jsxs)(`div`,{className:`flex items-center justify-between mb-2 px-1`,children:[(0,H.jsx)(`h3`,{className:`text-[10px] font-semibold text-gray-500 dark:text-dark-500 uppercase tracking-[0.16em] rtl:tracking-normal`,children:m(`chat.session.chats`)}),(0,H.jsx)(`span`,{className:`text-[10px] tabular-nums text-gray-400 dark:text-dark-500 font-medium`,children:e.length})]}),e.length===0?(0,H.jsxs)(`div`,{className:O(`text-center py-8`,i?`px-1`:`px-2`),children:[(0,H.jsx)(`div`,{className:O(`mx-auto mb-3 bg-white/70 dark:bg-dark-200 rounded-xl flex items-center justify-center ring-1 ring-black/[0.04] dark:ring-white/[0.05]`,i?`w-8 h-8`:`w-12 h-12`),children:(0,H.jsx)(x,{className:O(`text-gray-400 dark:text-gray-500`,i?`h-4 w-4`:`h-5 w-5`)})}),!i&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-gray-600 dark:text-dark-600`,children:m(`chat.session.noChats`)}),(0,H.jsx)(`p`,{className:`text-xs mt-1 text-gray-400 dark:text-dark-500`,children:m(`chat.session.createFirst`)})]})]}):(0,H.jsx)(`div`,{className:O(`space-y-0.5`,i&&`space-y-1`),children:e.map(e=>{let l=n===e.id,g=e.personaId?t[e.personaId]:null;return(0,H.jsx)(`div`,{className:O(`group relative cursor-pointer transition-colors duration-150 touch-manipulation outline-none`,i?`rounded-xl p-1 flex items-center justify-center`:`rounded-xl px-3 py-2.5`,l?`bg-white ring-1 ring-black/[0.04] dark:bg-dark-200 dark:ring-white/[0.05]`:`hover:bg-white/60 dark:hover:bg-dark-200/60`),onClick:()=>c(e),title:i?`${e.title} - ${e.model}`:void 0,children:i?(0,H.jsx)(`div`,{className:`flex items-center justify-center w-full h-10`,children:(0,H.jsx)(`div`,{className:O(`flex h-9 w-9 items-center justify-center rounded-xl text-[11px] font-semibold uppercase transition-colors`,r===e.id?`bg-white text-primary-600 animate-pulse dark:bg-dark-200 dark:text-primary-400`:l?`bg-gray-950 text-white dark:bg-white dark:text-gray-950`:`bg-white/70 text-gray-500 ring-1 ring-black/[0.04] dark:bg-dark-200/70 dark:text-dark-600 dark:ring-white/[0.05]`),children:e.title.trim().charAt(0)||`•`})}):a===e.id?(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,onClick:e=>e.stopPropagation(),children:[(0,H.jsx)(hc,{value:o,onChange:e=>s(e.target.value),onKeyDown:t=>{t.key===`Enter`?d(e.id):t.key===`Escape`&&f()},className:`text-sm h-8`,autoFocus:!0}),(0,H.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>d(e.id),className:`h-8 w-8 p-0 shrink-0 hover:bg-gray-100 dark:hover:bg-dark-300 active:bg-gray-200 dark:active:bg-dark-400 touch-manipulation`,children:(0,H.jsx)(ge,{className:`h-3 w-3`})}),(0,H.jsx)(k,{variant:`ghost`,size:`sm`,onClick:f,className:`h-8 w-8 p-0 shrink-0 hover:bg-gray-100 dark:hover:bg-dark-300 active:bg-gray-200 dark:active:bg-dark-400 touch-manipulation`,children:(0,H.jsx)(ce,{className:`h-3 w-3`})})]}):(0,H.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,H.jsxs)(`div`,{className:`flex-1 min-w-0 me-2`,children:[(0,H.jsx)(`h3`,{className:`text-[13px] font-medium truncate leading-tight text-gray-900 dark:text-dark-900`,children:r===e.id?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,H.jsx)(`span`,{className:`animate-pulse`,children:m(`chat.session.generatingTitle`)}),(0,H.jsxs)(`span`,{className:`inline-flex`,children:[(0,H.jsx)(`span`,{className:`animate-bounce`,style:{animationDelay:`0ms`},children:`.`}),(0,H.jsx)(`span`,{className:`animate-bounce`,style:{animationDelay:`150ms`},children:`.`}),(0,H.jsx)(`span`,{className:`animate-bounce`,style:{animationDelay:`300ms`},children:`.`})]})]}):je(e.title,32)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-0.5`,children:[(0,H.jsx)(`span`,{dir:`auto`,className:O(`text-[11px] tabular-nums`,l?`text-gray-500 dark:text-dark-600`:`text-gray-400 dark:text-dark-500`),children:Me(e.updatedAt,h.language)}),(0,H.jsx)(`span`,{className:`text-gray-300 dark:text-dark-400`,children:`•`}),e.personaId?g?(0,H.jsxs)(`span`,{className:O(`flex items-center gap-1 text-[11px] font-medium`,l?`text-primary-600 dark:text-primary-400`:`text-primary-500 dark:text-primary-500`),title:g.description||g.name,children:[g.avatar&&!g.avatar.startsWith(`data:`)&&(0,H.jsx)(`span`,{className:`text-[10px]`,children:g.avatar}),(0,H.jsx)(`span`,{className:`truncate max-w-[100px]`,children:g.name})]}):(0,H.jsx)(`span`,{className:O(`text-[11px] font-medium italic`,l?`text-gray-500 dark:text-gray-500`:`text-gray-400 dark:text-gray-600`),children:`Persona`}):(0,H.jsx)(`span`,{dir:`ltr`,className:O(`text-[11px] font-medium truncate max-w-[108px]`,l?`text-gray-700 dark:text-gray-300`:`text-gray-600 dark:text-gray-400`),title:e.model,children:e.model})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100 transition-opacity duration-150 shrink-0`,children:[(0,H.jsx)(k,{variant:`ghost`,size:`sm`,onClick:t=>u(e,t),className:`h-7 w-7 sm:h-7 sm:w-7 p-0 hover:bg-gray-100 dark:hover:bg-dark-300 rounded-lg touch-manipulation`,title:m(`chat.session.renameChat`),children:(0,H.jsx)(v,{className:`h-3 w-3`})}),(0,H.jsx)(k,{variant:`ghost`,size:`sm`,onClick:t=>p(e.id,t),className:`h-7 w-7 sm:h-7 sm:w-7 p-0 text-red-500 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg touch-manipulation`,title:m(`chat.session.deleteChat`),children:(0,H.jsx)(pe,{className:`h-3 w-3`})})]})]})},e.id)})})]})})}function il({user:e,size:t}){let n=t===`sm`?`w-7 h-7`:`w-8 h-8`,r=t===`sm`?`text-xs`:`text-sm`;return e.avatar?(0,H.jsx)(`img`,{src:e.avatar,alt:e.username,className:`${n} rounded-full object-cover ring-1 ring-black/10 dark:ring-white/10`,title:`${e.username} (${e.role})`}):(0,H.jsx)(`div`,{className:`${n} bg-gray-950 dark:bg-white rounded-full flex items-center justify-center`,title:`${e.username} (${e.role})`,children:(0,H.jsx)(`span`,{className:`text-white dark:text-gray-950 ${r} font-medium`,children:e.username.charAt(0).toUpperCase()})})}function al({requiresAuth:e,user:t,isAdmin:n,sidebarCompact:r,userMenuOpen:i,userMenuRef:a,onToggleUserMenu:o,onOpenSettings:s,onOpenAvatar:c,onLogout:u,onMobileNavigate:d,onCloseUserMenu:f}){let{t:p}=l();return!e||!t?null:(0,H.jsx)(`div`,{className:O(`border-t border-black/[0.05] dark:border-white/[0.05]`,r?`p-2`:`p-3`),children:r?(0,H.jsxs)(`div`,{className:`flex flex-col items-center space-y-2`,children:[(0,H.jsx)(il,{user:t,size:`sm`}),(0,H.jsx)(`button`,{onClick:s,className:`w-10 h-10 flex items-center justify-center rounded-xl text-gray-600 dark:text-dark-600 hover:bg-white/70 dark:hover:bg-dark-200 hover:text-gray-950 dark:hover:text-dark-950 touch-manipulation transition-colors duration-150`,title:p(`sidebar.navigation.settings`),children:(0,H.jsx)(he,{className:`h-4 w-4`})}),n&&(0,H.jsx)(oa,{to:`/users`,onClick:d,className:`w-10 h-10 flex items-center justify-center rounded-xl text-gray-600 dark:text-dark-600 hover:bg-white/70 dark:hover:bg-dark-200 hover:text-gray-950 dark:hover:text-dark-950 touch-manipulation transition-colors duration-150`,title:p(`sidebar.navigation.userManagement`),children:(0,H.jsx)(le,{className:`h-4 w-4`})}),(0,H.jsx)(`button`,{onClick:u,className:`w-10 h-10 flex items-center justify-center rounded-xl text-gray-500 dark:text-dark-500 hover:bg-red-50 dark:hover:bg-red-900/20 hover:text-red-600 dark:hover:text-red-400 touch-manipulation transition-colors duration-150`,title:p(`sidebar.navigation.signOut`),children:(0,H.jsx)(g,{className:`h-4 w-4`})})]}):(0,H.jsxs)(`div`,{className:`relative`,ref:a,children:[(0,H.jsx)(`button`,{onClick:o,className:`w-full p-2.5 rounded-xl hover:bg-white/70 dark:hover:bg-dark-200 transition-colors duration-150 text-start touch-manipulation outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,H.jsx)(il,{user:t,size:`sm`}),(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 truncate`,children:t.username}),(0,H.jsxs)(`div`,{className:`flex items-center mt-0.5`,children:[t.role===`admin`&&(0,H.jsx)(ie,{size:10,className:`text-primary-500 me-1`}),(0,H.jsx)(`span`,{className:`text-[11px] text-gray-500 dark:text-dark-500 capitalize`,children:t.role})]})]}),(0,H.jsx)(oe,{className:O(`h-4 w-4 text-gray-400 dark:text-dark-500 transition-transform duration-150 rtl:rotate-180`,i&&`rotate-90 rtl:rotate-90`)})]})}),i&&(0,H.jsxs)(`div`,{className:`scroll-region absolute bottom-full left-0 right-0 z-50 mb-2 max-h-[calc(100dvh-1rem)] rounded-2xl border border-black/[0.07] bg-white/95 py-2 shadow-[0_18px_60px_rgba(15,23,42,0.16)] backdrop-blur-xl animate-scale-in scrollbar-thin dark:border-white/[0.08] dark:bg-dark-25/95`,children:[(0,H.jsx)(`div`,{className:`px-3 py-2 border-b border-gray-100 dark:border-dark-200/50`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,H.jsx)(il,{user:t,size:`md`}),(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 truncate`,children:t.username}),(0,H.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 truncate`,children:t.email||p(`user.profile.noEmail`)})]})]})}),(0,H.jsxs)(`div`,{className:`py-1`,children:[(0,H.jsxs)(`button`,{onClick:()=>{c(t.avatar||``),f()},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[13px] text-gray-700 dark:text-dark-700 hover:bg-gray-100/70 dark:hover:bg-dark-200/70 transition-colors duration-150 text-start`,children:[(0,H.jsx)(_e,{className:`h-4 w-4 shrink-0`}),p(`user.menu.changePicture`)]}),(0,H.jsxs)(`button`,{onClick:()=>{s(),f()},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[13px] text-gray-700 dark:text-dark-700 hover:bg-gray-100/70 dark:hover:bg-dark-200/70 transition-colors duration-150 text-start`,children:[(0,H.jsx)(he,{className:`h-4 w-4 shrink-0`}),p(`user.menu.settings`)]}),n&&(0,H.jsxs)(oa,{to:`/users`,onClick:()=>{f(),d()},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[13px] text-gray-700 dark:text-dark-700 hover:bg-gray-100/70 dark:hover:bg-dark-200/70 transition-colors duration-150`,children:[(0,H.jsx)(le,{className:`h-4 w-4 shrink-0`}),p(`user.menu.userManagement`)]}),(0,H.jsx)(`div`,{className:`border-t border-gray-100 dark:border-dark-200/50 my-1`}),(0,H.jsxs)(`button`,{onClick:()=>{u(),f()},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[13px] text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors duration-150 text-start`,children:[(0,H.jsx)(g,{className:`h-4 w-4 shrink-0`}),p(`user.menu.logout`)]})]})]})]})})}var ol=s(`components:sidebar`),sl=V.lazy(()=>o(()=>import(`../js/SettingsModal-CLdxDdQV.js`).then(e=>({default:e.SettingsModal})),__vite__mapDeps([10,1,5,11,12,2,3,13,14,0,4,7,15]))),cl=({isOpen:e,onClose:t,className:n})=>{let{t:r}=l(),i=K(),a=Hr(),{sessions:o,deleteSession:s,updateSessionTitle:c,selectedModel:u,models:d,currentSession:p,generatingTitleForSession:m,personas:h}=ps(),{user:g,isAdmin:_,systemInfo:v,setUser:y}=$(),{backgroundImage:b,sidebarCompact:x,toggleSidebarCompact:S}=Xs(),[ee,C]=(0,V.useState)(null),[w,T]=(0,V.useState)(``),[te,ne]=(0,V.useState)(!1),[re,E]=(0,V.useState)(!1),[ie,ae]=(0,V.useState)(!1),[oe,se]=(0,V.useState)(``),[ce,le]=(0,V.useState)(!1),ue=(0,V.useRef)(null),de=(0,V.useRef)(null),{sessionId:fe}=Wr(),pe=fe||null,me=p?.id||pe,he=()=>{window.innerWidth<768&&!x&&S()},ge=()=>{let{setCurrentSession:e}=ps.getState();fc(),e(null),sessionStorage.setItem(`forceWelcomeScreen`,`true`)};(0,V.useEffect)(()=>{let e=e=>{ue.current&&!ue.current.contains(e.target)&&E(!1)};if(re)return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[re]),(0,V.useEffect)(()=>{let t=t=>{de.current&&!de.current.contains(t.target)&&window.innerWidth<768&&e&&!x&&S()};if(e&&!x&&window.innerWidth<768)return document.addEventListener(`mousedown`,t),()=>document.removeEventListener(`mousedown`,t)},[e,x,S]);let _e=async()=>{le(!0);try{let e=await Ae.updateMyAvatar(oe||null);e.success&&e.data?(y(e.data),f.success(r(`user.avatar.updated`)),ae(!1)):f.error(e.message||r(`user.avatar.updateFailed`))}catch(e){ol.error(`Failed to update avatar:`,e),f.error(r(`user.avatar.updateFailed`))}finally{le(!1)}},ve=()=>{ge(),a(`/chat`,{replace:!0}),he()},ye=()=>{ge(),a(`/chat`,{replace:!0}),he()},be=e=>{a(`/c/${e.id}`,{replace:!0}),he()},xe=async(e,t)=>{if(t.stopPropagation(),ol.debug(`Delete session clicked:`,e),window.confirm(r(`chat.session.deleteConfirm`)))try{ol.debug(`Attempting to delete session:`,e);let t=me===e;if(await s(e),ol.debug(`Session deleted successfully`),t){let t=o.filter(t=>t.id!==e);t.length>0?a(`/c/${t[0].id}`,{replace:!0}):a(`/`,{replace:!0})}}catch(e){ol.error(`Error deleting session:`,e)}},Se=(e,t)=>{t.stopPropagation(),C(e.id),T(e.title)},Ce=async e=>{w.trim()&&await c(e,w.trim()),C(null),T(``)},we=()=>{C(null),T(``)},Te=async()=>{try{await ke.logout();let{logout:e}=$.getState();e(),a(`/login`),f.success(r(`auth.logout.success`))}catch(e){ol.error(`Logout error:`,e);let{logout:t}=$.getState();t(),a(`/login`)}},Ee=()=>{ne(!0),he()},De=e=>{se(e),ae(!0)},Oe=window.location.protocol===`file:`;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{ref:de,"data-testid":`sidebar`,className:O(`fixed inset-y-0 start-0 z-50 border-e border-black/[0.06] dark:border-white/[0.06] transform transition-[width,transform,background-color] duration-200 ease-out shadow-[0_24px_80px_rgba(15,23,42,0.12)]`,x?`w-18`:`w-72 max-sm:w-64`,e?`translate-x-0`:`ltr:-translate-x-full rtl:translate-x-full`,`lg:shadow-none`,b?`bg-gray-100/75 dark:bg-dark-50/75 backdrop-blur-xl`:`bg-gray-100 dark:bg-dark-50`,`overscroll-behavior-contain`,n),style:{WebkitOverflowScrolling:`touch`},children:[Oe&&(0,H.jsx)(`div`,{className:`absolute top-0 start-16 end-0 h-8 z-[60]`,style:{WebkitAppRegion:`drag`}}),(0,H.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,H.jsx)(tl,{sidebarCompact:x,isElectron:Oe,selectedModel:u,modelCount:d.length,onToggleCompact:S,onCreateSession:ve}),(0,H.jsx)(nl,{sidebarCompact:x,activePath:i.pathname,onChatClick:ye,onMobileNavigate:he}),(0,H.jsx)(rl,{sessions:o,personas:h,currentSessionId:me,generatingTitleForSession:m,sidebarCompact:x,editingSessionId:ee,editingTitle:w,onEditingTitleChange:T,onSelectSession:be,onStartEditing:Se,onSaveEdit:Ce,onCancelEdit:we,onDeleteSession:xe}),(0,H.jsx)(al,{requiresAuth:v?.requiresAuth,user:g,isAdmin:_(),sidebarCompact:x,userMenuOpen:re,userMenuRef:ue,onToggleUserMenu:()=>E(e=>!e),onOpenSettings:Ee,onOpenAvatar:De,onLogout:Te,onMobileNavigate:he,onCloseUserMenu:()=>E(!1)})]})]}),te&&(0,H.jsx)(V.Suspense,{fallback:null,children:(0,H.jsx)(sl,{isOpen:te,onClose:()=>ne(!1)})}),(0,H.jsx)(Zc,{open:ie,value:oe,saving:ce,onChange:se,onClose:()=>ae(!1),onSave:_e})]})},ll=({children:e,requireAuth:t=!0,requireAdmin:n=!1})=>{let{isAuthenticated:r,user:i,systemInfo:a,isLoading:o}=$();return K(),o?(0,H.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-gray-50 dark:bg-dark-50`,children:(0,H.jsx)(`div`,{className:`w-8 h-8 border-4 border-gray-200 dark:border-dark-300 border-t-primary-500 dark:border-t-primary-400 rounded-full animate-spin`})}):a&&!a.requiresAuth?(0,H.jsx)(H.Fragment,{children:e}):t&&!r?(0,H.jsx)(mi,{to:`/login`,replace:!0}):n&&(!i||i.role!==`admin`)?(0,H.jsx)(mi,{to:`/`,replace:!0}):(0,H.jsx)(H.Fragment,{children:e})},ul=s(`components:error-boundary`),dl=({error:e})=>{let{t}=l();return(0,H.jsx)(`div`,{className:`min-h-screen bg-gray-50 dark:bg-dark-50 flex items-center justify-center p-4 text-gray-900 dark:text-dark-800`,children:(0,H.jsx)(`div`,{className:`w-full max-w-md rounded-2xl border border-gray-200 dark:border-dark-300 bg-white/95 dark:bg-dark-100/95 shadow-card backdrop-blur-sm`,children:(0,H.jsxs)(`div`,{className:`p-6 text-center`,children:[(0,H.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-2xl bg-primary-100 text-primary-700 dark:bg-primary-900/35 dark:text-primary-300 ring-1 ring-primary-200 dark:ring-primary-800/60`,children:(0,H.jsx)(b,{className:`h-6 w-6`})}),(0,H.jsx)(`h1`,{className:`mb-2 text-xl font-semibold text-gray-950 dark:text-dark-950`,children:t(`errorBoundary.title`)}),(0,H.jsx)(`p`,{className:`mb-5 text-sm leading-6 text-gray-600 dark:text-dark-600`,children:t(`errorBoundary.description`)}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:justify-center`,children:[(0,H.jsxs)(`button`,{onClick:()=>window.location.reload(),className:`inline-flex items-center justify-center gap-2 rounded-xl bg-primary-600 px-4 py-2.5 text-sm font-medium text-white shadow-sm transition-all hover:bg-primary-700 hover:shadow-md focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 dark:focus:ring-offset-dark-100`,children:[(0,H.jsx)(w,{className:`h-4 w-4`}),t(`errorBoundary.tryAgain`)]}),(0,H.jsxs)(`button`,{onClick:()=>{window.location.assign(`/`)},className:`inline-flex items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white px-4 py-2.5 text-sm font-medium text-gray-700 shadow-sm transition-all hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 dark:border-dark-300 dark:bg-dark-50 dark:text-dark-700 dark:hover:bg-dark-200 dark:focus:ring-offset-dark-100`,children:[(0,H.jsx)(m,{className:`h-4 w-4`}),t(`common.home`,`Home`)]})]}),!1]})})})},fl=class extends V.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){ul.error(`ErrorBoundary caught an error:`,e,t)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,H.jsx)(dl,{error:this.state.error}):this.props.children}},pl=(e,t=!0)=>{let n=(0,V.useCallback)(n=>{if(!t)return;let r=n.target;if(r.tagName===`INPUT`||r.tagName===`TEXTAREA`||r.contentEditable===`true`||r.isContentEditable)return;if(n.key===`?`||n.key===`/`&&n.shiftKey){let t=e.find(e=>e.key===`?`||e.key===`h`);if(t){n.preventDefault(),n.stopPropagation(),t.action();return}}let i=e.find(e=>{let t=e.key.toLowerCase()===n.key.toLowerCase(),r=!!e.metaKey,i=n.metaKey||n.ctrlKey,a=r?i:!0,o=e.ctrlKey?n.ctrlKey:!0,s=!!e.shiftKey===n.shiftKey,c=!!e.altKey===n.altKey;return t&&a&&o&&s&&c});i&&(n.preventDefault(),n.stopPropagation(),i.action())},[e,t]);(0,V.useEffect)(()=>{if(t)return document.addEventListener(`keydown`,n),()=>{document.removeEventListener(`keydown`,n)}},[n,t])},ml=e=>{let t=[];e.metaKey&&t.push(navigator.platform.includes(`Mac`)?`⌘`:`Ctrl`),e.ctrlKey&&t.push(`Ctrl`),e.shiftKey&&t.push(`⇧`),e.altKey&&t.push(navigator.platform.includes(`Mac`)?`⌥`:`Alt`);let n=e.key.toUpperCase();return e.key===`,`&&(n=`,`),e.key===` `&&(n=`Space`),e.key===`Enter`&&(n=`↩`),e.key===`Escape`&&(n=`Esc`),t.push(n),t.join(`+`)},hl=({isOpen:e,onClose:t,shortcuts:n})=>{let{t:r}=l();if(!e)return null;let i={navigation:n.filter(e=>e.description.includes(`sidebar`)||e.description.includes(`Toggle`)),settings:n.filter(e=>e.description.includes(`settings`)||e.description.includes(`dark mode`)),general:n.filter(e=>!e.description.includes(`sidebar`)&&!e.description.includes(`settings`)&&!e.description.includes(`dark mode`)&&!e.description.includes(`Toggle`))};return(0,H.jsx)(`div`,{className:`fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4`,children:(0,H.jsxs)(`div`,{className:`flex max-h-[calc(100dvh-2rem)] min-h-0 w-full max-w-md flex-col overflow-hidden rounded-xl bg-white shadow-2xl dark:bg-dark-100 sm:max-h-[80dvh]`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between p-6 border-b border-gray-200 dark:border-dark-300`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(d,{className:`h-5 w-5 text-gray-700 dark:text-dark-600`}),(0,H.jsx)(`h2`,{className:`text-lg font-semibold text-gray-900 dark:text-dark-800`,children:r(`keyboard.title`)})]}),(0,H.jsx)(k,{variant:`ghost`,size:`sm`,onClick:t,className:`h-8 w-8 p-0 hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,H.jsx)(ce,{className:`h-4 w-4`})})]}),(0,H.jsxs)(`div`,{className:`scroll-region min-h-0 flex-1 space-y-6 p-6 scrollbar-thin`,children:[Object.entries(i).map(([e,t])=>t.length===0?null:(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-medium text-gray-700 dark:text-dark-600 mb-3`,children:r(`keyboard.groups.${e}`)}),(0,H.jsx)(`div`,{className:`space-y-2`,children:t.map((e,t)=>(0,H.jsxs)(`div`,{className:`flex items-center justify-between py-2`,children:[(0,H.jsx)(`span`,{className:`text-sm text-gray-600 dark:text-dark-500`,children:e.description}),(0,H.jsx)(`kbd`,{className:`px-2 py-1 text-xs font-mono bg-gray-100 dark:bg-dark-200 text-gray-700 dark:text-dark-600 rounded border border-gray-300 dark:border-dark-400`,children:ml(e)})]},t))})]},e)),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-medium text-gray-700 dark:text-dark-600 mb-3`,children:r(`keyboard.groups.chat`)}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between py-2`,children:[(0,H.jsx)(`span`,{className:`text-sm text-gray-600 dark:text-dark-500`,children:r(`keyboard.actions.sendMessage`)}),(0,H.jsx)(`kbd`,{className:`px-2 py-1 text-xs font-mono bg-gray-100 dark:bg-dark-200 text-gray-700 dark:text-dark-600 rounded border border-gray-300 dark:border-dark-400`,children:`Enter`})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between py-2`,children:[(0,H.jsx)(`span`,{className:`text-sm text-gray-600 dark:text-dark-500`,children:r(`keyboard.actions.newLine`)}),(0,H.jsx)(`kbd`,{className:`px-2 py-1 text-xs font-mono bg-gray-100 dark:bg-dark-200 text-gray-700 dark:text-dark-600 rounded border border-gray-300 dark:border-dark-400`,children:`Shift+Enter`})]})]})]})]}),(0,H.jsx)(`div`,{className:`px-6 py-4 bg-gray-50 dark:bg-dark-200 border-t border-gray-200 dark:border-dark-300`,children:(0,H.jsxs)(`p`,{className:`text-xs text-gray-500 dark:text-dark-400 text-center`,children:[r(`keyboard.footer`,{key1:`?`,key2:`H`}).split(`?`)[0],(0,H.jsx)(`kbd`,{className:`px-1 py-0.5 text-xs font-mono bg-gray-200 dark:bg-dark-300 rounded`,children:`?`}),r(`keyboard.footer`,{key1:`?`,key2:`H`}).split(`?`)[1].split(`H`)[0],(0,H.jsx)(`kbd`,{className:`px-1 py-0.5 text-xs font-mono bg-gray-200 dark:bg-dark-300 rounded`,children:`H`}),r(`keyboard.footer`,{key1:`?`,key2:`H`}).split(`H`)[1]]})})]})})},gl=({onClick:e,className:t})=>{let{t:n}=l(),[r,i]=(0,V.useState)(!1);return(0,H.jsxs)(k,{variant:`ghost`,size:`sm`,onClick:e,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),className:O(`fixed bottom-4 end-4 h-10 w-10 p-0 bg-white/80 dark:bg-dark-100/80 backdrop-blur-sm border border-gray-200 dark:border-dark-300 shadow-lg hover:shadow-xl transition-all duration-200 z-50`,`hover:bg-white dark:hover:bg-dark-100`,t),title:n(`keyboard.tooltip`),children:[(0,H.jsx)(d,{className:`h-4 w-4`}),r&&(0,H.jsx)(`div`,{className:`absolute bottom-full mb-2 end-0 px-2 py-1 text-xs bg-gray-900 text-white rounded whitespace-nowrap`,children:n(`keyboard.tooltip`)})]})},_l=({message:e=`This is a demo version for presentation purposes only. The Ollama backend is not connected.`,onDismiss:t,className:n})=>{let[r,i]=(0,V.useState)(!1),{t:a}=l();return r?null:(0,H.jsx)(`div`,{className:O(`bg-gray-950 text-white dark:bg-white dark:text-gray-950`,`border-b border-black/10 dark:border-white/10`,`px-4 py-2`,n),children:(0,H.jsxs)(`div`,{className:`flex items-center justify-between max-w-6xl mx-auto gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[(0,H.jsx)(`div`,{className:`flex-shrink-0`,children:(0,H.jsx)(h,{className:`h-4 w-4 text-white/65 dark:text-gray-950/60`})}),(0,H.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,H.jsx)(`p`,{className:`shrink-0 text-xs font-semibold tracking-wide`,children:a(`demoMode.title`)}),(0,H.jsx)(`p`,{className:`hidden truncate text-xs text-white/60 dark:text-gray-950/60 sm:block`,children:e})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 ml-4`,children:[(0,H.jsxs)(k,{variant:`ghost`,size:`sm`,className:`h-8 px-2 text-white/70 hover:bg-white/10 hover:text-white dark:text-gray-950/70 dark:hover:bg-black/[0.06] dark:hover:text-gray-950`,onClick:()=>window.open(`https://github.com/libre-webui/libre-webui`,`_blank`),title:`View on GitHub`,children:[(0,H.jsx)(ue,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`ml-1 hidden sm:inline`,children:a(`demoMode.github`)})]}),(0,H.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>{i(!0),t?.()},className:`h-8 w-8 p-0 text-white/70 hover:bg-white/10 hover:text-white dark:text-gray-950/70 dark:hover:bg-black/[0.06] dark:hover:text-gray-950`,title:`Dismiss`,children:(0,H.jsx)(ce,{className:`h-4 w-4`})})]})]})})},vl=()=>{let{preferences:e,backgroundImage:t}=Xs(),n=e.backgroundSettings||{enabled:!1,imageUrl:``,blurAmount:10,opacity:.6},r=t||n.imageUrl;return!n.enabled||!r?null:(0,H.jsx)(`div`,{className:`fixed inset-0 pointer-events-none z-0`,style:{backgroundImage:`url(${r})`,backgroundSize:`cover`,backgroundPosition:`center`,backgroundRepeat:`no-repeat`,filter:`blur(${n.blurAmount}px)`,opacity:n.opacity,transform:`scale(1.1)`}})},yl=s(`user-service`),bl=class{static async initializeAuth(){let{setLoading:e,setSystemInfo:t,login:n}=$.getState();try{e(!0),yl.debug(`Starting auth initialization...`),yl.debug(`Fetching system info...`);let r=await ke.getSystemInfo();yl.debug(`System info response:`,r),r.success&&r.data?(yl.debug(`Setting system info:`,r.data),t(r.data)):yl.error(`System info response failed:`,r);let i=localStorage.getItem(`auth-token`);if(i)try{let e=(await o(async()=>{let{default:e}=await import(`../js/utils-vendor-BX3ZwoIK.js`).then(e=>e.i);return{default:e}},__vite__mapDeps([4,1,5]))).default,t=e.defaults.headers.common;e.defaults.headers.common.Authorization=`Bearer ${i}`;let r=await ke.verifyToken();if(r.success&&r.data){let e=$.getState().systemInfo;e&&n(r.data,i,e)}e.defaults.headers.common=t}catch(e){yl.error(`Token verification failed:`,e),localStorage.removeItem(`auth-token`)}}catch(e){yl.error(`Auth initialization error:`,e)}finally{e(!1)}}};ye.interceptors.request.use(e=>{let t=localStorage.getItem(`auth-token`);return t&&(e.headers.Authorization=`Bearer ${t}`),e},e=>Promise.reject(e)),ye.interceptors.response.use(e=>e,e=>{if(e.response?.status===401){localStorage.removeItem(`auth-token`);let{logout:e}=$.getState();e();let t=window.location.protocol===`file:`;window.location.href=t?`#/login`:`/login`}return Promise.reject(e)});var xl=s(`initialize`),Sl=()=>{let e=(0,V.useRef)(!1),{loadSessions:t,loadModels:n,loadPreferences:r,setSelectedModel:i,models:a}=ps(),{loadPreferences:o}=Xs(),{loadPlugins:s,plugins:c}=Qs();(0,V.useEffect)(()=>{e.current||(async()=>{try{if(xl.debug(`Initializing Libre WebUI...`),e.current=!0,await bl.initializeAuth(),!(await De.checkHealth()).success)if(Se()){await Promise.all([o(),r()]),await Promise.all([n(),t(),s()]);return}else{T.error(`Ollama service is not available. Please make sure it's running.`);return}await Promise.all([o(),r()]),await Promise.all([n(),t(),s()]),xl.debug(`Libre WebUI initialized successfully`)}catch(e){Se()?(await Promise.all([o(),r()]),await Promise.all([n(),t(),s()])):(xl.error(`Failed to initialize app:`,e),T.error(`Failed to connect to the backend service`))}})()},[o,r,n,t,s]),(0,V.useEffect)(()=>{if(a.length>0){let e=a.filter(e=>!e.name.includes(`embed`))[0]||a[0],{selectedModel:t}=ps.getState();t?a.map(e=>e.name).includes(t)||(xl.debug(`Selected model not available, falling back to:`,e.name),i(e.name)):(xl.debug(`No model selected, using first available:`,e.name),i(e.name))}},[a,i]),(0,V.useEffect)(()=>{c.filter(e=>e.active).length>0&&(xl.debug(`Active plugins changed, reloading models...`),n())},[c,n])},Cl=s(`components:git-hub-auth-button`),wl=()=>{let{t:e}=l(),[t,n]=(0,V.useState)(!1),[r,i]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{(async()=>{try{let e=await fetch(`${Te}/auth/oauth/github/status`,{method:`GET`,credentials:`include`});if(e.ok){let t=await e.json();i(t.configured||!1),Cl.debug(`GitHub OAuth configured:`,t.configured)}else Cl.debug(`GitHub OAuth status check failed`),i(!1)}catch(e){Cl.debug(`GitHub OAuth not configured:`,e),i(!1)}})()},[]),r?(0,H.jsx)(`button`,{type:`button`,onClick:()=>{if(!r||t)return;n(!0);let e=`${Te}/auth/oauth/github`;window.location.href=e},disabled:t,className:`flex h-11 w-full items-center justify-center rounded-xl border border-line bg-surface-raised px-4 text-sm font-medium text-ink shadow-subtle transition-colors hover:border-line-strong hover:bg-surface-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:t?(0,H.jsxs)(`div`,{className:`flex items-center`,children:[(0,H.jsx)(y,{size:16,className:`me-2 animate-spin`}),e(`auth.oauth.connectingTo`,{provider:e(`auth.oauth.github`)})]}):(0,H.jsxs)(`div`,{className:`flex items-center`,children:[(0,H.jsx)(te,{size:16,className:`me-2`}),e(`auth.oauth.continueWith`,{provider:e(`auth.oauth.github`)})]})}):null},Tl=s(`components:hugging-face-auth-button`),El=()=>{let{t:e}=l(),[t,n]=(0,V.useState)(!1),[r,i]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{(async()=>{try{let e=await fetch(`${Te}/auth/oauth/huggingface/status`,{method:`GET`,credentials:`include`});if(e.ok){let t=await e.json();i(t.configured||!1),Tl.debug(`Hugging Face OAuth configured:`,t.configured)}else Tl.debug(`Hugging Face OAuth status check failed`),i(!1)}catch(e){Tl.debug(`Hugging Face OAuth not configured:`,e),i(!1)}})()},[]),r?(0,H.jsx)(`button`,{type:`button`,onClick:()=>{if(!r||t)return;n(!0);let e=`${Te}/auth/oauth/huggingface`;window.location.href=e},disabled:t,className:`flex h-11 w-full items-center justify-center rounded-xl border border-line bg-surface-raised px-4 text-sm font-medium text-ink shadow-subtle transition-colors hover:border-line-strong hover:bg-surface-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:t?(0,H.jsxs)(`div`,{className:`flex items-center`,children:[(0,H.jsx)(y,{size:16,className:`me-2 animate-spin`}),e(`auth.oauth.connectingTo`,{provider:e(`auth.oauth.huggingFace`)})]}):(0,H.jsxs)(`div`,{className:`flex items-center`,children:[(0,H.jsx)(`span`,{className:`me-2 text-base`,children:`🤗`}),e(`auth.oauth.continueWith`,{provider:e(`auth.oauth.huggingFace`)})]})}):null},Dl=s(`components:login-form`),Ol={username:`demo`,password:`demo`},kl=({onLogin:e,onShowSignup:t})=>{let{t:n}=l(),r=Se(),[i,a]=(0,V.useState)(r?Ol.username:``),[o,s]=(0,V.useState)(r?Ol.password:``),[c,u]=(0,V.useState)(!1),[d,p]=(0,V.useState)(!1),m=Hr(),{login:h}=$(),g=async t=>{t.preventDefault();let a=r?Ol.username:i.trim(),s=r?Ol.password:o.trim();if(!a||!s){f.error(n(`auth.login.enterBoth`));return}p(!0);try{localStorage.removeItem(`auth-token`);let t=await ke.login({username:a,password:s});t.success&&t.data?(h(t.data.user,t.data.token,t.data.systemInfo),f.success(n(`auth.login.loginSuccess`)),e?.(),m(`/`)):f.error(t.message||n(`auth.login.loginFailed`))}catch(e){Dl.error(`Login error:`,e),f.error(n(`auth.login.checkCredentials`))}finally{p(!1)}},_=e=>{if(e.key===`Enter`){let t=e.currentTarget.form;t&&t.requestSubmit()}};return(0,H.jsxs)(`div`,{className:`mx-auto w-full max-w-md rounded-3xl border border-line bg-surface-raised p-6 shadow-card sm:p-8`,children:[(0,H.jsxs)(`div`,{className:`mb-8 text-center`,children:[(0,H.jsx)(`h1`,{className:`mb-2 text-3xl font-light tracking-[-0.04em] text-ink`,children:n(`auth.login.title`)}),(0,H.jsx)(`p`,{className:`text-sm leading-6 text-ink-muted`,children:n(`auth.login.subtitle`)})]}),(0,H.jsxs)(`form`,{onSubmit:g,className:`space-y-5`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{htmlFor:`username`,className:`mb-2 block text-sm font-medium text-ink`,children:n(`auth.login.username`)}),(0,H.jsx)(`input`,{id:`username`,type:`text`,value:i,onChange:e=>a(e.target.value),onKeyDown:_,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:bg-surface-subtle disabled:text-ink-muted motion-reduce:transition-none`,placeholder:n(`auth.login.usernamePlaceholder`),required:!0,disabled:d||r})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{htmlFor:`password`,className:`mb-2 block text-sm font-medium text-ink`,children:n(`auth.login.password`)}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`input`,{id:`password`,type:c?`text`:`password`,value:o,onChange:e=>s(e.target.value),onKeyDown:_,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 pe-11 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:bg-surface-subtle disabled:text-ink-muted motion-reduce:transition-none`,placeholder:n(`auth.login.passwordPlaceholder`),required:!0,disabled:d||r}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>u(!c),className:`absolute inset-y-0 end-0 flex items-center pe-3 text-ink-muted transition-colors hover:text-ink disabled:cursor-not-allowed disabled:opacity-50`,disabled:d||r,"aria-label":c?`Hide characters`:`Reveal characters`,children:c?(0,H.jsx)(se,{size:20}):(0,H.jsx)(ne,{size:20})})]})]}),(0,H.jsx)(`button`,{type:`submit`,disabled:d,className:`flex h-11 w-full items-center justify-center rounded-xl border border-transparent bg-ink px-4 text-sm font-medium text-ink-inverse shadow-subtle transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:d?(0,H.jsxs)(`div`,{className:`flex items-center`,children:[(0,H.jsx)(`div`,{className:`me-2 h-4 w-4 animate-spin rounded-full border-b-2 border-current`}),n(`auth.login.signingIn`)]}):(0,H.jsxs)(`div`,{className:`flex items-center`,children:[(0,H.jsx)(S,{size:16,className:`me-2`}),n(`auth.login.signIn`)]})})]}),!r&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`mt-6`,children:[(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,H.jsx)(`div`,{className:`w-full border-t border-line`})}),(0,H.jsx)(`div`,{className:`relative flex justify-center text-sm`,children:(0,H.jsx)(`span`,{className:`bg-surface-raised px-2 text-ink-muted`,children:n(`common.or`)})})]}),(0,H.jsxs)(`div`,{className:`mt-6 space-y-3`,children:[(0,H.jsx)(wl,{}),(0,H.jsx)(El,{})]})]}),(0,H.jsx)(`div`,{className:`mt-6 text-center`,children:(0,H.jsxs)(`p`,{className:`text-sm text-ink-muted`,children:[n(`auth.login.noAccount`),` `,(0,H.jsx)(`button`,{onClick:()=>t?.(),className:`font-medium text-primary-600 transition-colors hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-300`,children:n(`auth.login.signUpHere`)})]})})]})]})},Al=s(`components:turnstile-widget`),jl=`https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit`,Ml=null,Nl=()=>window.turnstile?Promise.resolve():Ml||(Ml=new Promise((e,t)=>{let n=document.querySelector(`script[src="${jl}"]`);if(n){n.addEventListener(`load`,()=>e(),{once:!0}),n.addEventListener(`error`,t,{once:!0});return}let r=document.createElement(`script`);r.src=jl,r.async=!0,r.defer=!0,r.onload=()=>e(),r.onerror=t,document.head.appendChild(r)}),Ml),Pl=({siteKey:e,disabled:t=!1,errorMessage:n,onTokenChange:r})=>{let i=(0,V.useRef)(null),a=(0,V.useRef)(null),[o,s]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{let t=!1,n=i.current;return r(``),Nl().then(()=>{t||!n||!window.turnstile||(n.innerHTML=``,a.current=window.turnstile.render(n,{sitekey:e,theme:`auto`,callback:e=>r(e),"expired-callback":()=>r(``),"error-callback":()=>r(``)}))}).catch(e=>{Al.error(`Turnstile script failed to load:`,e),t||s(!0)}),()=>{t=!0,r(``),a.current&&window.turnstile?.remove?window.turnstile.remove(a.current):n&&(n.innerHTML=``),a.current=null}},[r,e]),(0,V.useEffect)(()=>{t&&a.current&&(window.turnstile?.reset(a.current),r(``))},[t,r]),o?(0,H.jsx)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-300`,children:n}):(0,H.jsx)(`div`,{className:`rounded-lg border border-accent-200 bg-accent-50/40 p-3 transition-opacity dark:border-accent-800/70 dark:bg-accent-950/20 ${t?`pointer-events-none opacity-60`:``}`,"aria-label":`Security verification`,children:(0,H.jsx)(`div`,{ref:i,className:`min-h-[65px]`})})},Fl=s(`components:signup-form`),Il=({onSignup:e,onBackToLogin:t})=>{let{t:n}=l(),[r,i]=(0,V.useState)(``),[a,o]=(0,V.useState)(``),[s,c]=(0,V.useState)(``),[u,d]=(0,V.useState)(``),[p,m]=(0,V.useState)(!1),[h,g]=(0,V.useState)(!1),[_,v]=(0,V.useState)(!1),[y,b]=(0,V.useState)(``),x=Hr(),{login:S,systemInfo:ee}=$(),C=ee?.turnstile?.siteKey,w=!!(ee?.turnstile?.enabled&&C),T=(0,V.useCallback)(e=>{b(e)},[]),te=(0,V.useMemo)(()=>_||w&&!y,[_,w,y]),re=async t=>{if(t.preventDefault(),!r.trim()||!s.trim()){f.error(n(`auth.signup.usernameRequired`));return}if(s!==u){f.error(n(`auth.signup.passwordMismatch`));return}if(s.length<6){f.error(n(`auth.signup.passwordTooShort`));return}if(w&&!y){f.error(n(`auth.signup.tryAgain`));return}v(!0);try{let t=await ke.signup({username:r,password:s,email:a,turnstileToken:y});t.success&&t.data?(S(t.data.user,t.data.token,t.data.systemInfo),f.success(n(`auth.signup.signupSuccess`)),e?.(),x(`/`)):f.error(t.message||n(`auth.signup.signupFailed`))}catch(e){Fl.error(`Signup error:`,e),f.error(n(`auth.signup.tryAgain`))}finally{b(``),v(!1)}},E=e=>{if(e.key===`Enter`){let t=e.currentTarget.form;t&&t.requestSubmit()}};return(0,H.jsxs)(`div`,{className:`mx-auto w-full max-w-md rounded-3xl border border-line bg-surface-raised p-6 shadow-card sm:p-8`,children:[(0,H.jsxs)(`div`,{className:`mb-8 text-center`,children:[(0,H.jsx)(`h1`,{className:`mb-2 text-3xl font-light tracking-[-0.04em] text-ink`,children:n(`auth.signup.title`)}),(0,H.jsx)(`p`,{className:`text-sm leading-6 text-ink-muted`,children:n(`auth.signup.subtitle`)})]}),(0,H.jsxs)(`form`,{onSubmit:re,className:`space-y-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{htmlFor:`username`,className:`mb-2 block text-sm font-medium text-ink`,children:n(`auth.signup.username`)}),(0,H.jsx)(`input`,{id:`username`,type:`text`,value:r,onChange:e=>i(e.target.value),onKeyDown:E,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none`,placeholder:n(`auth.signup.usernamePlaceholder`),required:!0,disabled:_})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`label`,{htmlFor:`email`,className:`mb-2 block text-sm font-medium text-ink`,children:[n(`auth.signup.email`),` `,(0,H.jsxs)(`span`,{className:`text-ink-muted`,children:[`(`,n(`common.optional`),`)`]})]}),(0,H.jsx)(`input`,{id:`email`,type:`email`,value:a,onChange:e=>o(e.target.value),onKeyDown:E,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none`,placeholder:n(`auth.signup.emailPlaceholder`),disabled:_})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{htmlFor:`password`,className:`mb-2 block text-sm font-medium text-ink`,children:n(`auth.signup.password`)}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`input`,{id:`password`,type:p?`text`:`password`,value:s,onChange:e=>c(e.target.value),onKeyDown:E,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 pe-11 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none`,placeholder:n(`auth.signup.passwordPlaceholder`),required:!0,disabled:_}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>m(!p),className:`absolute inset-y-0 end-0 flex items-center pe-3 text-ink-muted transition-colors hover:text-ink disabled:cursor-not-allowed disabled:opacity-50`,disabled:_,"aria-label":p?`Hide characters`:`Reveal characters`,children:p?(0,H.jsx)(se,{size:20}):(0,H.jsx)(ne,{size:20})})]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{htmlFor:`confirmPassword`,className:`mb-2 block text-sm font-medium text-ink`,children:n(`auth.signup.confirmPassword`)}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`input`,{id:`confirmPassword`,type:h?`text`:`password`,value:u,onChange:e=>d(e.target.value),onKeyDown:E,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 pe-11 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none`,placeholder:n(`auth.signup.confirmPasswordPlaceholder`),required:!0,disabled:_}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>g(!h),className:`absolute inset-y-0 end-0 flex items-center pe-3 text-ink-muted transition-colors hover:text-ink disabled:cursor-not-allowed disabled:opacity-50`,disabled:_,"aria-label":h?`Hide confirmation`:`Reveal confirmation`,children:h?(0,H.jsx)(se,{size:20}):(0,H.jsx)(ne,{size:20})})]})]}),w&&C&&(0,H.jsx)(Pl,{siteKey:C,disabled:_,errorMessage:n(`auth.signup.tryAgain`),onTokenChange:T}),(0,H.jsx)(`button`,{type:`submit`,disabled:te,className:`flex h-11 w-full items-center justify-center rounded-xl border border-transparent bg-ink px-4 text-sm font-medium text-ink-inverse shadow-subtle transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:_?(0,H.jsxs)(`div`,{className:`flex items-center`,children:[(0,H.jsx)(`div`,{className:`me-2 h-4 w-4 animate-spin rounded-full border-b-2 border-current`}),n(`auth.signup.creatingAccount`)]}):(0,H.jsxs)(`div`,{className:`flex items-center`,children:[(0,H.jsx)(fe,{size:16,className:`me-2`}),n(`auth.signup.createAccount`)]})})]}),(0,H.jsx)(wl,{}),(0,H.jsx)(`div`,{className:`mt-6 text-center`,children:(0,H.jsxs)(`p`,{className:`text-sm text-ink-muted`,children:[n(`auth.signup.hasAccount`),` `,(0,H.jsx)(`button`,{onClick:t,className:`font-medium text-primary-600 transition-colors hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-300`,children:n(`auth.signup.signInHere`)})]})})]})},Ll=()=>{let{t:e}=l(),t=Hr(),{isAuthenticated:n,requiresAuth:r}=$(),[i,a]=(0,V.useState)(!1),o=r();return(0,V.useEffect)(()=>{(n||!o)&&t(`/`)},[o,n,t]),n||!o?null:(0,H.jsxs)(`div`,{className:`relative min-h-screen overflow-y-auto bg-gray-50 text-gray-950 dark:bg-dark-50 dark:text-dark-950`,children:[(0,H.jsxs)(`header`,{className:`absolute inset-x-0 top-0 z-10 flex h-16 items-center justify-between border-b border-gray-200/70 px-5 dark:border-white/[0.08] sm:px-8`,children:[(0,H.jsx)($c,{size:`sm`,className:`text-gray-950 dark:text-dark-950 lg:invisible`}),(0,H.jsx)(el,{})]}),(0,H.jsxs)(`main`,{className:`grid min-h-screen pt-16 lg:grid-cols-[minmax(20rem,0.9fr)_minmax(32rem,1.1fr)]`,children:[(0,H.jsxs)(`section`,{className:`relative hidden overflow-hidden border-e border-gray-200/70 p-10 dark:border-white/[0.08] lg:flex lg:flex-col lg:justify-between xl:p-16`,children:[(0,H.jsx)($c,{size:`lg`,className:`relative z-10 text-gray-950 dark:text-dark-950`}),(0,H.jsx)(`div`,{className:`relative z-10 max-w-xl border-s border-gray-300 ps-6 dark:border-white/15`,children:(0,H.jsx)(`p`,{className:`text-4xl font-light leading-[1.08] tracking-[-0.04em] text-gray-900 dark:text-dark-900 xl:text-5xl`,children:e(`setup.welcome.features.secure.description`)})})]}),(0,H.jsx)(`section`,{className:`flex items-center justify-center px-4 py-12 sm:px-8 lg:py-16`,children:(0,H.jsx)(`div`,{className:`w-full max-w-md [&>div]:!max-w-none [&>div]:!rounded-none [&>div]:!border-0 [&>div]:!bg-transparent [&>div]:!p-0 [&>div]:!shadow-none`,children:i?(0,H.jsx)(Il,{onBackToLogin:()=>a(!1),onSignup:()=>a(!1)}):(0,H.jsx)(kl,{onShowSignup:()=>a(!0)})})})]})]})},Rl=window.location.protocol===`file:`?ia:ra,zl=window.location.protocol===`file:`,Bl=()=>zl?(0,H.jsx)(`div`,{className:`absolute top-0 left-0 right-0 h-8 z-50`,style:{WebkitAppRegion:`drag`}}):null,Vl=s(`app`),Hl=V.lazy(()=>o(()=>import(`../js/ChatPage-DdLe5r1n.js`),__vite__mapDeps([16,1,5,17,11,12,2,3,13,14,0,4,7,15,18,19,20,21]))),Ul=V.lazy(()=>o(()=>import(`../js/ModelsPage-BVfl9FU_.js`),__vite__mapDeps([22,1,5,11,12,2,3,13,14,0,4,7,15]))),Wl=V.lazy(()=>o(()=>import(`../js/PersonasPage-wP36Pd7I.js`),__vite__mapDeps([23,1,5,11,12,2,3,13,14,0,4,7,15]))),Gl=V.lazy(()=>o(()=>import(`../js/GalleryPage-BTA5LAmZ.js`),__vite__mapDeps([24,1,5,17,12,2,3,13,14,0,4,7,15]))),Kl=V.lazy(()=>o(()=>import(`../js/LibreClawPage-CuQ8tJUW.js`),__vite__mapDeps([25,1,5,2,3,13,14,0,4,7,15]))),ql=V.lazy(()=>o(()=>import(`../js/UserManagementPage-BwnBtNj1.js`),__vite__mapDeps([26,1,5,11,12,2,3,13,14,0,4,15,7]))),Jl=V.lazy(()=>o(()=>import(`../js/ArtifactDemoPage-Dd0Rbl3N.js`),__vite__mapDeps([27,1,5,15,7,4,19,2,3,13,14,20,21,18]))),Yl=V.lazy(()=>o(()=>import(`../js/SettingsModal-CLdxDdQV.js`).then(e=>({default:e.SettingsModal})),__vite__mapDeps([10,1,5,11,12,2,3,13,14,0,4,7,15]))),Xl=V.lazy(()=>o(()=>import(`../js/ArtifactSlideOutPanel-oA5Iy8Nc.js`).then(e=>({default:e.ArtifactSlideOutPanel})),__vite__mapDeps([28,1,5,17,2,3,13,14,7,4,15,20,21,18]))),Zl=V.lazy(()=>o(()=>import(`../js/FirstTimeSetup-DL_WZABT.js`).then(e=>({default:e.FirstTimeSetup})),__vite__mapDeps([29,1,5,2,3,13,14,0,4]))),Ql=()=>{let{t:e}=l();return(0,H.jsx)(`div`,{className:`flex h-full min-h-screen items-center justify-center bg-gray-50 dark:bg-dark-100`,children:(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,H.jsx)(`div`,{className:`h-8 w-8 rounded-full border-4 border-gray-200 border-t-primary-500 animate-spin dark:border-dark-300 dark:border-t-primary-400`}),(0,H.jsx)(`div`,{className:`text-gray-600 dark:text-dark-600`,children:e(`common.loading`)})]})})},$l=({isOpen:e,compact:t})=>(0,H.jsx)(`div`,{"aria-hidden":`true`,className:O(`hidden lg:block flex-shrink-0 transition-[width] duration-200 ease-out`,e?t?`w-18`:`w-72`:`w-0`)}),eu=({onClick:e})=>{let t=K();return t.pathname===`/`||t.pathname===`/chat`||t.pathname.startsWith(`/c/`)?(0,H.jsx)(`div`,{className:`hidden lg:block`,children:(0,H.jsx)(gl,{onClick:e})}):null},tu=()=>{let{t:e,i18n:t}=l(),[n,r]=(0,V.useState)(!1),[i,a]=(0,V.useState)(!1),[o,s]=(0,V.useState)(0),[c,u]=(0,V.useState)(!1),{sidebarOpen:d,sidebarCompact:f,setSidebarOpen:p,setSidebarCompact:m,toggleSidebar:h,toggleSidebarCompact:g,toggleTheme:_,backgroundImage:v,preferences:y,artifactPanelOpen:b}=Xs(),{systemInfo:x,isLoading:S,user:ee,isAuthenticated:C}=$(),{isDemoMode:w,demoConfig:te}=Xs(),[ne,re]=V.useState(!1),E=V.useRef(!1);V.useEffect(()=>{(async()=>{if(E.current){Vl.debug(`OAuth already processing, skipping...`);return}Vl.debug(`Starting OAuth callback processing...`),E.current=!0;let e=new URLSearchParams(window.location.search),t=e.get(`token`),n=e.get(`auth`);if(t&&n===`success`){try{let e=await fetch(`${Te}/auth/me`,{headers:{Authorization:`Bearer ${t}`},credentials:`include`});if(e.ok){let n=await e.json();if(n.success&&n.data){let{login:e,systemInfo:r}=$.getState();e(n.data,t,r||{requiresAuth:!0,hasUsers:!0,userCount:1,version:`0.1.6`}),Vl.debug(`OAuth login successful, showing toast`),T.success(`GitHub login successful!`)}else T.error(`Failed to verify GitHub authentication`)}else T.error(`GitHub authentication verification failed`)}catch(e){Vl.error(`OAuth processing error:`,e),T.error(`GitHub authentication failed`)}window.history.replaceState({},document.title,window.location.pathname)}Vl.debug(`OAuth processing completed`),re(!0),E.current=!1})()},[]),Sl();let ie=()=>{if(v)return!0;let e=y.backgroundSettings;return e?.enabled&&e?.imageUrl},ae=[{key:`b`,metaKey:!0,action:()=>{window.innerWidth>=1024?d?g():(m(!1),h()):(!d&&f&&m(!1),h())},description:e(`keyboard.toggleSidebar`)},{key:`,`,metaKey:!0,action:()=>r(!0),description:e(`keyboard.openSettings`)},{key:`d`,metaKey:!0,action:_,description:e(`keyboard.toggleDarkMode`)},{key:`h`,action:()=>a(!0),description:e(`keyboard.showShortcuts`)},{key:`Escape`,action:()=>{r(!1),a(!1)},description:e(`keyboard.closeModals`)}];pl(ae),V.useEffect(()=>(rc.connect().catch(Vl.error),()=>{rc.disconnect()}),[]),V.useEffect(()=>{if(!x&&!S&&o<15){let e=setTimeout(async()=>{s(e=>e+1);try{await bl.initializeAuth()}catch{}},2e3);return()=>clearTimeout(e)}},[x,S,o]);let oe=!c&&x?.requiresAuth===!0&&x?.hasUsers===!1;return S?(0,H.jsxs)(`div`,{className:`min-h-screen bg-gray-50 dark:bg-dark-50 flex flex-col justify-center py-12 sm:px-6 lg:px-8`,children:[(0,H.jsx)(`div`,{className:`sm:mx-auto sm:w-full sm:max-w-md`,children:(0,H.jsx)(`div`,{className:`flex flex-col items-center`,children:(0,H.jsx)($c,{className:`text-gray-900 dark:text-gray-100`})})}),(0,H.jsx)(`div`,{className:`mt-8 flex flex-col items-center gap-4`,children:(0,H.jsx)(`div`,{className:`w-8 h-8 border-4 border-gray-300 dark:border-gray-600 border-t-primary-500 dark:border-t-primary-400 rounded-full animate-spin`})})]}):x?oe&&!c?(0,H.jsx)(fl,{children:(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(Ql,{}),children:(0,H.jsx)(Zl,{onComplete:()=>{u(!0)}})})}):ne?(0,H.jsx)(fl,{children:(0,H.jsxs)(Rl,{children:[x&&!x.requiresAuth?(0,H.jsxs)(`div`,{className:O(`flex h-dvh min-h-0 text-gray-950 dark:text-dark-900 relative overflow-hidden`,ie()?`bg-gray-100/60 dark:bg-dark-50/60`:`bg-gray-100 dark:bg-dark-50`),children:[(0,H.jsx)(Bl,{}),(0,H.jsx)(vl,{}),(0,H.jsx)(cl,{isOpen:d,onClose:()=>p(!1)}),(0,H.jsx)($l,{isOpen:d,compact:f}),(0,H.jsxs)(`div`,{"data-testid":`app-shell-content`,className:O(`flex-1 basis-0 flex min-h-0 flex-col min-w-0 transition-[margin,background-color] duration-200 ease-out relative z-10 lg:py-2 lg:pe-2`,d&&f?`max-lg:ms-18`:`max-lg:ms-0`,ie()?`bg-white/10 dark:bg-dark-50/10`:`bg-transparent`),children:[w&&te.showBanner&&(0,H.jsx)(_l,{message:te.message}),(0,H.jsx)(`main`,{className:O(`min-h-0 flex-1 overflow-hidden lg:rounded-[1.5rem] lg:border lg:border-black/[0.06] dark:lg:border-white/[0.07] lg:shadow-[0_1px_2px_rgba(0,0,0,0.03),0_18px_60px_rgba(15,23,42,0.04)]`,ie()?`bg-white/30 dark:bg-dark-100/35 backdrop-blur-sm`:`bg-gray-50 dark:bg-dark-100`),children:(0,H.jsx)(fl,{children:(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(Ql,{}),children:(0,H.jsxs)(gi,{children:[(0,H.jsx)(q,{path:`/`,element:(0,H.jsx)(Hl,{})}),(0,H.jsx)(q,{path:`/chat`,element:(0,H.jsx)(Hl,{})}),(0,H.jsx)(q,{path:`/c/:sessionId`,element:(0,H.jsx)(Hl,{})}),(0,H.jsx)(q,{path:`/models`,element:(0,H.jsx)(Ul,{})}),(0,H.jsx)(q,{path:`/personas`,element:(0,H.jsx)(Wl,{})}),(0,H.jsx)(q,{path:`/login`,element:(0,H.jsx)(Ll,{})})]})})})})]})]}):(0,H.jsxs)(gi,{children:[(0,H.jsx)(q,{path:`/login`,element:(0,H.jsx)(Ll,{})}),(0,H.jsx)(q,{path:`/*`,element:(0,H.jsx)(ll,{children:(0,H.jsxs)(`div`,{className:O(`flex h-dvh min-h-0 text-gray-950 dark:text-dark-900 relative overflow-hidden`,ie()?`bg-gray-100/60 dark:bg-dark-50/60`:`bg-gray-100 dark:bg-dark-50`),children:[(0,H.jsx)(Bl,{}),(0,H.jsx)(vl,{}),(0,H.jsx)(cl,{isOpen:d,onClose:()=>p(!1)}),(0,H.jsx)($l,{isOpen:d,compact:f}),(0,H.jsxs)(`div`,{"data-testid":`app-shell-content`,className:O(`flex-1 basis-0 flex min-h-0 flex-col min-w-0 transition-[margin,background-color] duration-200 ease-out relative z-10 lg:py-2 lg:pe-2`,d&&f?`max-lg:ms-18`:`max-lg:ms-0`,ie()?`bg-white/10 dark:bg-dark-50/10`:`bg-transparent`),children:[w&&te.showBanner&&(0,H.jsx)(_l,{message:te.message}),(0,H.jsx)(`main`,{className:O(`min-h-0 flex-1 overflow-hidden lg:rounded-[1.5rem] lg:border lg:border-black/[0.06] dark:lg:border-white/[0.07] lg:shadow-[0_1px_2px_rgba(0,0,0,0.03),0_18px_60px_rgba(15,23,42,0.04)]`,ie()?`bg-white/30 dark:bg-dark-100/35 backdrop-blur-sm`:`bg-gray-50 dark:bg-dark-100`),children:(0,H.jsx)(fl,{children:(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(Ql,{}),children:(0,H.jsxs)(gi,{children:[(0,H.jsx)(q,{path:`/`,element:(0,H.jsx)(Hl,{})}),(0,H.jsx)(q,{path:`/chat`,element:(0,H.jsx)(Hl,{})}),(0,H.jsx)(q,{path:`/c/:sessionId`,element:(0,H.jsx)(Hl,{})}),(0,H.jsx)(q,{path:`/models`,element:(0,H.jsx)(Ul,{})}),(0,H.jsx)(q,{path:`/personas`,element:(0,H.jsx)(Wl,{})}),(0,H.jsx)(q,{path:`/gallery`,element:(0,H.jsx)(Gl,{})}),(0,H.jsx)(q,{path:`/agents`,element:(0,H.jsx)(Kl,{})}),(0,H.jsx)(q,{path:`/artifacts`,element:(0,H.jsx)(Jl,{})}),(0,H.jsx)(q,{path:`/users`,element:(0,H.jsx)(ll,{requireAdmin:!0,children:(0,H.jsx)(ql,{})})})]})})})})]})]})})})]}),n&&(0,H.jsx)(V.Suspense,{fallback:null,children:(0,H.jsx)(Yl,{isOpen:n,onClose:()=>r(!1)})}),(0,H.jsx)(hl,{isOpen:i,onClose:()=>a(!1),shortcuts:ae}),(0,H.jsx)(eu,{onClick:()=>a(!0)}),b&&(0,H.jsx)(V.Suspense,{fallback:null,children:(0,H.jsx)(Xl,{})}),(0,H.jsx)(ve,{position:Zo(t.language)?`top-left`:`top-right`,toastOptions:{duration:4e3,className:`animate-slide-up`,style:{background:`var(--toast-bg)`,color:`var(--toast-color)`,border:`1px solid var(--toast-border)`,borderRadius:`0.75rem`,boxShadow:`0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)`,cursor:`pointer`},success:{iconTheme:{primary:`rgb(var(--color-primary-600))`,secondary:`#ffffff`}},error:{iconTheme:{primary:`rgb(var(--color-primary-600))`,secondary:`#ffffff`}}},containerStyle:{top:80,insetInlineEnd:20}})]})}):(0,H.jsx)(`div`,{className:`min-h-screen bg-gray-50 dark:bg-dark-50 flex items-center justify-center`,children:(0,H.jsx)(`div`,{className:`w-8 h-8 border-4 border-gray-300 dark:border-gray-600 border-t-primary-500 dark:border-t-primary-400 rounded-full animate-spin`})}):(0,H.jsx)(`div`,{className:`min-h-screen bg-gray-50 dark:bg-dark-50 flex items-center justify-center p-4`,children:(0,H.jsxs)(`div`,{className:`text-center`,children:[(0,H.jsx)(`div`,{className:`mb-8`,children:(0,H.jsx)($c,{className:`text-gray-900 dark:text-white`})}),(0,H.jsx)(`div`,{className:`flex justify-center mb-4`,children:(0,H.jsx)(`div`,{className:`w-8 h-8 border-4 border-gray-300 dark:border-dark-300 border-t-primary-500 dark:border-t-primary-400 rounded-full animate-spin`})}),(0,H.jsx)(`p`,{className:`text-gray-600 dark:text-dark-600 text-sm`,children:o>0?`Connecting to backend... (${o}/15)`:`Starting up...`})]})})},nu=new gn({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1,retry:1}}});ts.catch(()=>{Qo(`en`)}).then(()=>{wa.createRoot(document.getElementById(`root`)).render((0,H.jsx)(V.StrictMode,{children:(0,H.jsx)(yn,{client:nu,children:(0,H.jsx)(tu,{})})}))});export{He as $,ms as A,K as B,dc as C,Qs as D,rc as E,es as F,Ft as G,Wr as H,Zo as I,Ct as J,Nt as K,Xo as L,zs as M,Z as N,Xs as O,ps as P,dt as Q,Ko as R,pc as S,$ as T,vn as U,Hr as V,Gt as W,gt as X,F as Y,ft as Z,Oc as _,qc as a,lt as at,hc as b,Wc as c,N as ct,Bc as d,A as dt,P as et,zc as f,Ac as g,Nc as h,Jc as i,$e as it,hs as j,gs as k,Hc as l,M as lt,Mc as m,$c as n,Ge as nt,Vc as o,Ue as ot,jc as p,Pt as q,Xc as r,We as rt,Gc as s,Re as st,Pl as t,it as tt,Uc as u,j as ut,_c as v,ic as w,sc as x,gc as y,$a as z};
|