threadshelf 1.2.0
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/CHANGELOG.md +185 -0
- package/LICENSE +21 -0
- package/README.md +763 -0
- package/SECURITY.md +75 -0
- package/bin/threadshelf-mcp.js +12 -0
- package/bin/threadshelf.js +87 -0
- package/dist/mcp/server.js +388 -0
- package/dist/src/chunking.js +72 -0
- package/dist/src/cli.js +24 -0
- package/dist/src/embedding.js +59 -0
- package/dist/src/env.js +2 -0
- package/dist/src/generation/config.js +344 -0
- package/dist/src/generation/downloader.js +172 -0
- package/dist/src/generation/error-log.js +34 -0
- package/dist/src/generation/filesystem-browser.js +83 -0
- package/dist/src/generation/gguf-metadata.js +179 -0
- package/dist/src/generation/hardware.js +87 -0
- package/dist/src/generation/llama-install.js +563 -0
- package/dist/src/generation/llama-process.js +576 -0
- package/dist/src/generation/llama-profile.js +136 -0
- package/dist/src/generation/master-prompts.js +155 -0
- package/dist/src/generation/model-catalog.js +276 -0
- package/dist/src/generation/model-discovery.js +60 -0
- package/dist/src/generation/model-download.js +151 -0
- package/dist/src/generation/openai-compatible.js +231 -0
- package/dist/src/generation/providers/llama-cpp.js +97 -0
- package/dist/src/generation/providers/openrouter.js +106 -0
- package/dist/src/generation/quick-setup.js +215 -0
- package/dist/src/generation/registry.js +23 -0
- package/dist/src/generation/service.js +100 -0
- package/dist/src/generation/threads.js +311 -0
- package/dist/src/generation/types.js +1 -0
- package/dist/src/ingest-cli.js +95 -0
- package/dist/src/ingest.js +257 -0
- package/dist/src/load-env.js +17 -0
- package/dist/src/model-label.js +15 -0
- package/dist/src/parser.js +811 -0
- package/dist/src/paths.js +79 -0
- package/dist/src/routes/collections.js +97 -0
- package/dist/src/routes/files.js +136 -0
- package/dist/src/routes/generation.js +536 -0
- package/dist/src/routes/health.js +6 -0
- package/dist/src/routes/index.js +21 -0
- package/dist/src/routes/ingest.js +300 -0
- package/dist/src/routes/insights.js +24 -0
- package/dist/src/routes/loopback.js +15 -0
- package/dist/src/routes/model-catalog.js +178 -0
- package/dist/src/routes/search.js +57 -0
- package/dist/src/routes/stream-abort.js +23 -0
- package/dist/src/routes/thread.js +43 -0
- package/dist/src/search-cli.js +93 -0
- package/dist/src/server.js +78 -0
- package/dist/src/services/collections.js +58 -0
- package/dist/src/services/insights.js +111 -0
- package/dist/src/services/search.js +68 -0
- package/dist/src/services/stats.js +35 -0
- package/dist/src/services/thread.js +140 -0
- package/dist/src/store.js +1138 -0
- package/dist/src/validation.js +250 -0
- package/dist/src/watch.js +83 -0
- package/package.json +103 -0
- package/public/assets/index-CIm_Idqi.js +38 -0
- package/public/assets/index-Dv09K2vS.css +1 -0
- package/public/favicon.svg +6 -0
- package/public/index.html +28 -0
- package/scripts/openrouter-export-all.js +228 -0
- package/scripts/openrouter-export-browser.js +153 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(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),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ee(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var te=/\/+/g;function k(e,t){return typeof e==`object`&&e&&e.key!=null?ee(``+e.key):t.toString(36)}function ne(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function re(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,re(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+k(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(te,`$&/`)+`/`),re(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(te,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+k(a,u),c+=re(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+k(a,u++),c+=re(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return re(ne(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function ie(e,t,n){if(e==null)return e;var r=[],i=0;return re(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function A(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var j=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},M={map:ie,forEach:function(e,t,n){ie(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ie(e,function(){t++}),t},toArray:function(e){return ie(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=M,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:A}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,j)}catch(e){j(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.8`})),u=o(((e,t)=>{t.exports=l()})),d=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&k(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&k(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var ee=new MessageChannel,te=ee.port2;ee.port1.onmessage=D,O=function(){te.postMessage(null)}}else O=function(){_(D,0)};function k(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,k(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),f=o(((e,t)=>{t.exports=d()})),p=o((e=>{var t=u();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.8`})),m=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=o((e=>{var t=f(),n=u(),r=m();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function d(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),ee=Symbol.for(`react.activity`),te=Symbol.for(`react.memo_cache_sentinel`),k=Symbol.iterator;function ne(e){return typeof e!=`object`||!e?null:(e=k&&e[k]||e[`@@iterator`],typeof e==`function`?e:null)}var re=Symbol.for(`react.client.reference`);function ie(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===re?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case ee:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?ie(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return ie(e(t))}catch{}}return null}var A=Array.isArray,j=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae={pending:!1,data:null,method:null,action:null},oe=[],se=-1;function N(e){return{current:e}}function P(e){0>se||(e.current=oe[se],oe[se]=null,se--)}function F(e,t){se++,oe[se]=e.current,e.current=t}var ce=N(null),le=N(null),ue=N(null),de=N(null);function fe(e,t){switch(F(ue,t),F(le,e),F(ce,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}P(ce),F(ce,e)}function pe(){P(ce),P(le),P(ue)}function me(e){e.memoizedState!==null&&F(de,e);var t=ce.current,n=Hd(t,e.type);t!==n&&(F(le,e),F(ce,n))}function he(e){le.current===e&&(P(ce),P(le)),de.current===e&&(P(de),Qf._currentValue=ae)}var I,ge;function _e(e){if(I===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);I=t&&t[1]||``,ge=-1<e.stack.indexOf(`
|
|
2
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
3
|
+
`+I+e+ge}var ve=!1;function ye(e,t){if(!e||ve)return``;ve=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
4
|
+
`),l=s.split(`
|
|
5
|
+
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
6
|
+
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{ve=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?_e(n):``}function be(e,t){switch(e.tag){case 26:case 27:case 5:return _e(e.type);case 16:return _e(`Lazy`);case 13:return e.child!==t&&t!==null?_e(`Suspense Fallback`):_e(`Suspense`);case 19:return _e(`SuspenseList`);case 0:case 15:return ye(e.type,!1);case 11:return ye(e.type.render,!1);case 1:return ye(e.type,!0);case 31:return _e(`Activity`);default:return``}}function xe(e){try{var t=``,n=null;do t+=be(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
7
|
+
Error generating stack: `+e.message+`
|
|
8
|
+
`+e.stack}}var Se=Object.prototype.hasOwnProperty,Ce=t.unstable_scheduleCallback,we=t.unstable_cancelCallback,Te=t.unstable_shouldYield,Ee=t.unstable_requestPaint,De=t.unstable_now,Oe=t.unstable_getCurrentPriorityLevel,ke=t.unstable_ImmediatePriority,Ae=t.unstable_UserBlockingPriority,je=t.unstable_NormalPriority,Me=t.unstable_LowPriority,Ne=t.unstable_IdlePriority,Pe=t.log,Fe=t.unstable_setDisableYieldValue,Ie=null,Le=null;function Re(e){if(typeof Pe==`function`&&Fe(e),Le&&typeof Le.setStrictMode==`function`)try{Le.setStrictMode(Ie,e)}catch{}}var ze=Math.clz32?Math.clz32:He,Be=Math.log,Ve=Math.LN2;function He(e){return e>>>=0,e===0?32:31-(Be(e)/Ve|0)|0}var Ue=256,We=262144,L=4194304;function R(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ge(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=R(n))):i=R(o):i=R(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=R(n))):i=R(o)):i=R(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Ke(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function qe(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Je(){var e=L;return L<<=1,!(L&62914560)&&(L=4194304),e}function Ye(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Xe(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ze(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-ze(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Qe(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Qe(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-ze(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function $e(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-ze(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function et(e,t){var n=t&-t;return n=n&42?1:tt(n),(n&(e.suspendedLanes|t))===0?n:0}function tt(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function nt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function rt(){var e=M.p;return e===0?(e=window.event,e===void 0?32:mp(e.type)):e}function it(e,t){var n=M.p;try{return M.p=e,t()}finally{M.p=n}}var at=Math.random().toString(36).slice(2),ot=`__reactFiber$`+at,st=`__reactProps$`+at,ct=`__reactContainer$`+at,lt=`__reactEvents$`+at,ut=`__reactListeners$`+at,dt=`__reactHandles$`+at,ft=`__reactResources$`+at,pt=`__reactMarker$`+at;function mt(e){delete e[ot],delete e[st],delete e[lt],delete e[ut],delete e[dt]}function ht(e){var t=e[ot];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ct]||n[ot]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=df(e);e!==null;){if(n=e[ot])return n;e=df(e)}return t}e=n,n=e.parentNode}return null}function gt(e){if(e=e[ot]||e[ct]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function _t(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function vt(e){var t=e[ft];return t||=e[ft]={hoistableStyles:new Map,hoistableScripts:new Map},t}function yt(e){e[pt]=!0}var bt=new Set,xt={};function St(e,t){Ct(e,t),Ct(e+`Capture`,t)}function Ct(e,t){for(xt[e]=t,e=0;e<t.length;e++)bt.add(t[e])}var wt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),Tt={},Et={};function Dt(e){return Se.call(Et,e)?!0:Se.call(Tt,e)?!1:wt.test(e)?Et[e]=!0:(Tt[e]=!0,!1)}function Ot(e,t,n){if(Dt(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function kt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function At(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function jt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Mt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Nt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Pt(e){if(!e._valueTracker){var t=Mt(e)?`checked`:`value`;e._valueTracker=Nt(e,t,``+e[t])}}function Ft(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Mt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function It(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Lt=/[\n"\\]/g;function Rt(e){return e.replace(Lt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function zt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+jt(t)):e.value!==``+jt(t)&&(e.value=``+jt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Vt(e,o,jt(n)):Vt(e,o,jt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+jt(s):e.removeAttribute(`name`)}function Bt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Pt(e);return}n=n==null?``:``+jt(n),t=t==null?n:``+jt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Pt(e)}function Vt(e,t,n){t===`number`&&It(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Ht(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+jt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Ut(e,t,n){if(t!=null&&(t=``+jt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+jt(n)}function Wt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(A(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=jt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Pt(e)}function Gt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Kt=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function qt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Kt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Jt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&qt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&qt(e,o,t[o])}function Yt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Xt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Zt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Qt(e){return Zt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function $t(){}var en=null;function tn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var nn=null,rn=null;function an(e){var t=gt(e);if(t&&(e=t.stateNode)){var n=e[st]||null;a:switch(e=t.stateNode,t.type){case`input`:if(zt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Rt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[st]||null;if(!a)throw Error(i(90));zt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Ft(r)}break a;case`textarea`:Ut(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Ht(e,!!n.multiple,t,!1)}}}var on=!1;function sn(e,t,n){if(on)return e(t,n);on=!0;try{return e(t)}finally{if(on=!1,(nn!==null||rn!==null)&&(yu(),nn&&(t=nn,e=rn,rn=nn=null,an(t),e)))for(t=0;t<e.length;t++)an(e[t])}}function cn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[st]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var ln=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),un=!1;if(ln)try{var dn={};Object.defineProperty(dn,"passive",{get:function(){un=!0}}),window.addEventListener(`test`,dn,dn),window.removeEventListener(`test`,dn,dn)}catch{un=!1}var fn=null,pn=null,mn=null;function hn(){if(mn)return mn;var e,t=pn,n=t.length,r,i=`value`in fn?fn.value:fn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return mn=i.slice(e,1<r?1-r:void 0)}function gn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function _n(){return!0}function vn(){return!1}function yn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?_n:vn,this.isPropagationStopped=vn,this}return h(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=_n)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=_n)},persist:function(){},isPersistent:_n}),t}var bn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},xn=yn(bn),Sn=h({},bn,{view:0,detail:0}),Cn=yn(Sn),wn,Tn,En,Dn=h({},Sn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Rn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==En&&(En&&e.type===`mousemove`?(wn=e.screenX-En.screenX,Tn=e.screenY-En.screenY):Tn=wn=0,En=e),wn)},movementY:function(e){return`movementY`in e?e.movementY:Tn}}),On=yn(Dn),kn=yn(h({},Dn,{dataTransfer:0})),An=yn(h({},Sn,{relatedTarget:0})),jn=yn(h({},bn,{animationName:0,elapsedTime:0,pseudoElement:0})),Mn=yn(h({},bn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Nn=yn(h({},bn,{data:0})),Pn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Fn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},In={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Ln(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=In[e])?!!t[e]:!1}function Rn(){return Ln}var zn=yn(h({},Sn,{key:function(e){if(e.key){var t=Pn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=gn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Fn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Rn,charCode:function(e){return e.type===`keypress`?gn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?gn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Bn=yn(h({},Dn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Vn=yn(h({},Sn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Rn})),Hn=yn(h({},bn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Un=yn(h({},Dn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Wn=yn(h({},bn,{newState:0,oldState:0})),Gn=[9,13,27,32],Kn=ln&&`CompositionEvent`in window,qn=null;ln&&`documentMode`in document&&(qn=document.documentMode);var Jn=ln&&`TextEvent`in window&&!qn,Yn=ln&&(!Kn||qn&&8<qn&&11>=qn),Xn=` `,Zn=!1;function Qn(e,t){switch(e){case`keyup`:return Gn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function $n(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var er=!1;function tr(e,t){switch(e){case`compositionend`:return $n(t);case`keypress`:return t.which===32?(Zn=!0,Xn):null;case`textInput`:return e=t.data,e===Xn&&Zn?null:e;default:return null}}function nr(e,t){if(er)return e===`compositionend`||!Kn&&Qn(e,t)?(e=hn(),mn=pn=fn=null,er=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Yn&&t.locale!==`ko`?null:t.data;default:return null}}var rr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function ir(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!rr[e.type]:t===`textarea`}function ar(e,t,n,r){nn?rn?rn.push(r):rn=[r]:nn=r,t=Td(t,`onChange`),0<t.length&&(n=new xn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var or=null,sr=null;function cr(e){vd(e,0)}function lr(e){if(Ft(_t(e)))return e}function ur(e,t){if(e===`change`)return t}var dr=!1;if(ln){var fr;if(ln){var pr=`oninput`in document;if(!pr){var mr=document.createElement(`div`);mr.setAttribute(`oninput`,`return;`),pr=typeof mr.oninput==`function`}fr=pr}else fr=!1;dr=fr&&(!document.documentMode||9<document.documentMode)}function hr(){or&&(or.detachEvent(`onpropertychange`,gr),sr=or=null)}function gr(e){if(e.propertyName===`value`&&lr(sr)){var t=[];ar(t,sr,e,tn(e)),sn(cr,t)}}function _r(e,t,n){e===`focusin`?(hr(),or=t,sr=n,or.attachEvent(`onpropertychange`,gr)):e===`focusout`&&hr()}function vr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return lr(sr)}function yr(e,t){if(e===`click`)return lr(t)}function br(e,t){if(e===`input`||e===`change`)return lr(t)}function xr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Sr=typeof Object.is==`function`?Object.is:xr;function Cr(e,t){if(Sr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Se.call(t,i)||!Sr(e[i],t[i]))return!1}return!0}function wr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Tr(e,t){var n=wr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=wr(n)}}function Er(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Er(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Dr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=It(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=It(e.document)}return t}function Or(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var kr=ln&&`documentMode`in document&&11>=document.documentMode,Ar=null,jr=null,Mr=null,Nr=!1;function Pr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Nr||Ar==null||Ar!==It(r)||(r=Ar,`selectionStart`in r&&Or(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Mr&&Cr(Mr,r)||(Mr=r,r=Td(jr,`onSelect`),0<r.length&&(t=new xn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Ar)))}function Fr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Ir={animationend:Fr(`Animation`,`AnimationEnd`),animationiteration:Fr(`Animation`,`AnimationIteration`),animationstart:Fr(`Animation`,`AnimationStart`),transitionrun:Fr(`Transition`,`TransitionRun`),transitionstart:Fr(`Transition`,`TransitionStart`),transitioncancel:Fr(`Transition`,`TransitionCancel`),transitionend:Fr(`Transition`,`TransitionEnd`)},Lr={},Rr={};ln&&(Rr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Ir.animationend.animation,delete Ir.animationiteration.animation,delete Ir.animationstart.animation),`TransitionEvent`in window||delete Ir.transitionend.transition);function zr(e){if(Lr[e])return Lr[e];if(!Ir[e])return e;var t=Ir[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Rr)return Lr[e]=t[n];return e}var Br=zr(`animationend`),Vr=zr(`animationiteration`),Hr=zr(`animationstart`),Ur=zr(`transitionrun`),Wr=zr(`transitionstart`),Gr=zr(`transitioncancel`),Kr=zr(`transitionend`),qr=new Map,Jr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);Jr.push(`scrollEnd`);function Yr(e,t){qr.set(e,t),St(t,[e])}var Xr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Zr=[],Qr=0,$r=0;function ei(){for(var e=Qr,t=$r=Qr=0;t<e;){var n=Zr[t];Zr[t++]=null;var r=Zr[t];Zr[t++]=null;var i=Zr[t];Zr[t++]=null;var a=Zr[t];if(Zr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&ii(n,i,a)}}function ti(e,t,n,r){Zr[Qr++]=e,Zr[Qr++]=t,Zr[Qr++]=n,Zr[Qr++]=r,$r|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ni(e,t,n,r){return ti(e,t,n,r),ai(e)}function ri(e,t){return ti(e,null,null,t),ai(e)}function ii(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-ze(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ai(e){if(50<uu)throw uu=0,du=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var oi={};function si(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ci(e,t,n,r){return new si(e,t,n,r)}function li(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ui(e,t){var n=e.alternate;return n===null?(n=ci(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function di(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function fi(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)li(e)&&(s=1);else if(typeof e==`string`)s=Uf(e,n,ce.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case ee:return e=ci(31,n,t,a),e.elementType=ee,e.lanes=o,e;case y:return pi(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=ci(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=ci(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=ci(19,n,t,a),e.elementType=E,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case D:s=14;break a;case O:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=ci(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function pi(e,t,n,r){return e=ci(7,e,r,t),e.lanes=n,e}function mi(e,t,n){return e=ci(6,e,null,t),e.lanes=n,e}function hi(e){var t=ci(18,null,null,0);return t.stateNode=e,t}function gi(e,t,n){return t=ci(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var _i=new WeakMap;function vi(e,t){if(typeof e==`object`&&e){var n=_i.get(e);return n===void 0?(t={value:e,source:t,stack:xe(t)},_i.set(e,t),t):n}return{value:e,source:t,stack:xe(t)}}var yi=[],bi=0,xi=null,Si=0,Ci=[],wi=0,Ti=null,Ei=1,Di=``;function Oi(e,t){yi[bi++]=Si,yi[bi++]=xi,xi=e,Si=t}function ki(e,t,n){Ci[wi++]=Ei,Ci[wi++]=Di,Ci[wi++]=Ti,Ti=e;var r=Ei;e=Di;var i=32-ze(r)-1;r&=~(1<<i),n+=1;var a=32-ze(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ei=1<<32-ze(t)+i|n<<i|r,Di=a+e}else Ei=1<<a|n<<i|r,Di=e}function Ai(e){e.return!==null&&(Oi(e,1),ki(e,1,0))}function ji(e){for(;e===xi;)xi=yi[--bi],yi[bi]=null,Si=yi[--bi],yi[bi]=null;for(;e===Ti;)Ti=Ci[--wi],Ci[wi]=null,Di=Ci[--wi],Ci[wi]=null,Ei=Ci[--wi],Ci[wi]=null}function Mi(e,t){Ci[wi++]=Ei,Ci[wi++]=Di,Ci[wi++]=Ti,Ei=t.id,Di=t.overflow,Ti=e}var Ni=null,Pi=null,z=!1,Fi=null,Ii=!1,Li=Error(i(519));function Ri(e){throw Wi(vi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Li}function zi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[ot]=e,t[st]=r,n){case`dialog`:$(`cancel`,t),$(`close`,t);break;case`iframe`:case`object`:case`embed`:$(`load`,t);break;case`video`:case`audio`:for(n=0;n<gd.length;n++)$(gd[n],t);break;case`source`:$(`error`,t);break;case`img`:case`image`:case`link`:$(`error`,t),$(`load`,t);break;case`details`:$(`toggle`,t);break;case`input`:$(`invalid`,t),Bt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:$(`invalid`,t);break;case`textarea`:$(`invalid`,t),Wt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||jd(t.textContent,n)?(r.popover!=null&&($(`beforetoggle`,t),$(`toggle`,t)),r.onScroll!=null&&$(`scroll`,t),r.onScrollEnd!=null&&$(`scrollend`,t),r.onClick!=null&&(t.onclick=$t),t=!0):t=!1,t||Ri(e,!0)}function Bi(e){for(Ni=e.return;Ni;)switch(Ni.tag){case 5:case 31:case 13:Ii=!1;return;case 27:case 3:Ii=!0;return;default:Ni=Ni.return}}function Vi(e){if(e!==Ni)return!1;if(!z)return Bi(e),z=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||Ud(e.type,e.memoizedProps)),n=!n),n&&Pi&&Ri(e),Bi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Pi=uf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Pi=uf(e)}else t===27?(t=Pi,Zd(e.type)?(e=lf,lf=null,Pi=e):Pi=t):Pi=Ni?cf(e.stateNode.nextSibling):null;return!0}function Hi(){Pi=Ni=null,z=!1}function Ui(){var e=Fi;return e!==null&&(Xl===null?Xl=e:Xl.push.apply(Xl,e),Fi=null),e}function Wi(e){Fi===null?Fi=[e]:Fi.push(e)}var Gi=N(null),Ki=null,qi=null;function Ji(e,t,n){F(Gi,t._currentValue),t._currentValue=n}function Yi(e){e._currentValue=Gi.current,P(Gi)}function Xi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Zi(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Xi(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Xi(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Qi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;Sr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===de.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[Qf]:e.push(Qf))}a=a.return}e!==null&&Zi(t,e,n,r),t.flags|=262144}function $i(e){for(e=e.firstContext;e!==null;){if(!Sr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ea(e){Ki=e,qi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ta(e){return ra(Ki,e)}function na(e,t){return Ki===null&&ea(e),ra(e,t)}function ra(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},qi===null){if(e===null)throw Error(i(308));qi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else qi=qi.next=t;return n}var ia=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},aa=t.unstable_scheduleCallback,oa=t.unstable_NormalPriority,sa={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ca(){return{controller:new ia,data:new Map,refCount:0}}function la(e){e.refCount--,e.refCount===0&&aa(oa,function(){e.controller.abort()})}var ua=null,da=0,fa=0,pa=null;function ma(e,t){if(ua===null){var n=ua=[];da=0,fa=ud(),pa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return da++,t.then(ha,ha),t}function ha(){if(--da===0&&ua!==null){pa!==null&&(pa.status=`fulfilled`);var e=ua;ua=null,fa=0,pa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ga(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var _a=j.S;j.S=function(e,t){$l=De(),typeof t==`object`&&t&&typeof t.then==`function`&&ma(e,t),_a!==null&&_a(e,t)};var va=N(null);function ya(){var e=va.current;return e===null?Ll.pooledCache:e}function ba(e,t){t===null?F(va,va.current):F(va,t.pool)}function xa(){var e=ya();return e===null?null:{parent:sa._currentValue,pool:e}}var Sa=Error(i(460)),Ca=Error(i(474)),wa=Error(i(542)),Ta={then:function(){}};function Ea(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Da(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then($t,$t),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ja(e),e;default:if(typeof t.status==`string`)t.then($t,$t);else{if(e=Ll,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ja(e),e}throw ka=t,Sa}}function Oa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(ka=e,Sa):e}}var ka=null;function Aa(){if(ka===null)throw Error(i(459));var e=ka;return ka=null,e}function ja(e){if(e===Sa||e===wa)throw Error(i(483))}var B=null,Ma=0;function Na(e){var t=Ma;return Ma+=1,B===null&&(B=[]),Da(B,e,t)}function V(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Pa(e,t){throw t.$$typeof===g?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Fa(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=ui(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=mi(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===O&&Oa(i)===t.type)?(t=a(t,n.props),V(t,n),t.return=e,t):(t=fi(n.type,n.key,n.props,null,e.mode,r),V(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=gi(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=pi(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=mi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=fi(t.type,t.key,t.props,null,e.mode,n),V(n,t),n.return=e,n;case v:return t=gi(t,e.mode,n),t.return=e,t;case O:return t=Oa(t),f(e,t,n)}if(A(t)||ne(t))return t=pi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Na(t),n);if(t.$$typeof===C)return f(e,na(e,t),n);Pa(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=Oa(n),p(e,t,n,r)}if(A(n)||ne(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Na(n),r);if(n.$$typeof===C)return p(e,t,na(e,n),r);Pa(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=Oa(r),m(e,t,n,r,i)}if(A(r)||ne(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Na(r),i);if(r.$$typeof===C)return m(e,t,n,na(t,r),i);Pa(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),z&&Oi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return z&&Oi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),z&&Oi(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),z&&Oi(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return z&&Oi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),z&&Oi(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&Oa(l)===r.type){n(e,r.sibling),c=a(r,o.props),V(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===y?(c=pi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=fi(o.type,o.key,o.props,null,e.mode,c),V(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}t(e,r),r=r.sibling}c=gi(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=Oa(o),b(e,r,o,c)}if(A(o))return h(e,r,o,c);if(ne(o)){if(l=ne(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Na(o),c);if(o.$$typeof===C)return b(e,r,na(e,o),c);Pa(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=mi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Ma=0;var i=b(e,t,n,r);return B=null,i}catch(t){if(t===Sa||t===wa)throw t;var a=ci(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ia=Fa(!0),H=Fa(!1),La=!1;function Ra(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function za(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ba(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Va(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,J&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ai(e),ii(e,null,n),t}return ti(e,r,t,n),ai(e)}function Ha(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$e(e,n)}}function Ua(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Wa=!1;function Ga(){if(Wa){var e=pa;if(e!==null)throw e}}function Ka(e,t,n,r){Wa=!1;var i=e.updateQueue;La=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(X&f)===f:(r&f)===f){f!==0&&f===fa&&(Wa=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:La=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Wl|=o,e.lanes=o,e.memoizedState=d}}function qa(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Ja(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)qa(n[e],t)}var Ya=N(null),U=N(0);function W(e,t){e=Hl,F(U,e),F(Ya,t),Hl=e|t.baseLanes}function Xa(){F(U,Hl),F(Ya,Ya.current)}function Za(){Hl=U.current,P(Ya),P(U)}var Qa=N(null),$a=null;function eo(e){var t=e.alternate;F(ao,ao.current&1),F(Qa,e),$a===null&&(t===null||Ya.current!==null||t.memoizedState!==null)&&($a=e)}function to(e){F(ao,ao.current),F(Qa,e),$a===null&&($a=e)}function no(e){e.tag===22?(F(ao,ao.current),F(Qa,e),$a===null&&($a=e)):ro(e)}function ro(){F(ao,ao.current),F(Qa,Qa.current)}function io(e){P(Qa),$a===e&&($a=null),P(ao)}var ao=N(0);function oo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||af(n)||of(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var so=0,G=null,K=null,co=null,lo=!1,uo=!1,fo=!1,po=0,mo=0,ho=null,go=0;function _o(){throw Error(i(321))}function vo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Sr(e[n],t[n]))return!1;return!0}function yo(e,t,n,r,i,a){return so=a,G=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,j.H=e===null||e.memoizedState===null?Fs:Is,fo=!1,a=n(r,i),fo=!1,uo&&(a=xo(t,n,r,i)),bo(e),a}function bo(e){j.H=Ps;var t=K!==null&&K.next!==null;if(so=0,co=K=G=null,lo=!1,mo=0,ho=null,t)throw Error(i(300));e===null||$s||(e=e.dependencies,e!==null&&$i(e)&&($s=!0))}function xo(e,t,n,r){G=e;var a=0;do{if(uo&&(ho=null),mo=0,uo=!1,25<=a)throw Error(i(301));if(a+=1,co=K=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}j.H=Ls,o=t(n,r)}while(uo);return o}function So(){var e=j.H,t=e.useState()[0];return t=typeof t.then==`function`?Oo(t):t,e=e.useState()[0],(K===null?null:K.memoizedState)!==e&&(G.flags|=1024),t}function Co(){var e=po!==0;return po=0,e}function wo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function q(e){if(lo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}lo=!1}so=0,co=K=G=null,uo=!1,mo=po=0,ho=null}function To(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return co===null?G.memoizedState=co=e:co=co.next=e,co}function Eo(){if(K===null){var e=G.alternate;e=e===null?null:e.memoizedState}else e=K.next;var t=co===null?G.memoizedState:co.next;if(t!==null)co=t,K=e;else{if(e===null)throw G.alternate===null?Error(i(467)):Error(i(310));K=e,e={memoizedState:K.memoizedState,baseState:K.baseState,baseQueue:K.baseQueue,queue:K.queue,next:null},co===null?G.memoizedState=co=e:co=co.next=e}return co}function Do(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Oo(e){var t=mo;return mo+=1,ho===null&&(ho=[]),e=Da(ho,e,t),t=G,(co===null?t.memoizedState:co.next)===null&&(t=t.alternate,j.H=t===null||t.memoizedState===null?Fs:Is),e}function ko(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Oo(e);if(e.$$typeof===C)return ta(e)}throw Error(i(438,String(e)))}function Ao(e){var t=null,n=G.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=G.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Do(),G.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=te;return t.index++,n}function jo(e,t){return typeof t==`function`?t(e):t}function Mo(e){return No(Eo(),K,e)}function No(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(so&f)===f:(X&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===fa&&(d=!0);else if((so&p)===p){u=u.next,p===fa&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,G.lanes|=p,Wl|=p;f=u.action,fo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,G.lanes|=f,Wl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Sr(o,e.memoizedState)&&($s=!0,d&&(n=pa,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Po(e){var t=Eo(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Sr(o,t.memoizedState)||($s=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Fo(e,t,n){var r=G,a=Eo(),o=z;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Sr((K||a).memoizedState,n);if(s&&(a.memoizedState=n,$s=!0),a=a.queue,os(Ro.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||co!==null&&co.memoizedState.tag&1){if(r.flags|=2048,ts(9,{destroy:void 0},Lo.bind(null,r,a,n,t),null),Ll===null)throw Error(i(349));o||so&127||Io(r,t,n)}return n}function Io(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=G.updateQueue,t===null?(t=Do(),G.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Lo(e,t,n,r){t.value=n,t.getSnapshot=r,zo(t)&&Bo(e)}function Ro(e,t,n){return n(function(){zo(t)&&Bo(e)})}function zo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Sr(e,n)}catch{return!0}}function Bo(e){var t=ri(e,2);t!==null&&mu(t,e,2)}function Vo(e){var t=To();if(typeof e==`function`){var n=e;if(e=n(),fo){Re(!0);try{n()}finally{Re(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:e},t}function Ho(e,t,n,r){return e.baseState=n,No(e,K,typeof r==`function`?r:jo)}function Uo(e,t,n,r,a){if(js(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};j.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Wo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Wo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=j.T,o={};j.T=o;try{var s=n(i,r),c=j.S;c!==null&&c(o,s),Go(e,t,s)}catch(n){qo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),j.T=a}}else try{a=n(i,r),Go(e,t,a)}catch(n){qo(e,t,n)}}function Go(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Ko(e,t,n)},function(n){return qo(e,t,n)}):Ko(e,t,n)}function Ko(e,t,n){t.status=`fulfilled`,t.value=n,Jo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Wo(e,n)))}function qo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Jo(t),t=t.next;while(t!==r)}e.action=null}function Jo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Yo(e,t){return t}function Xo(e,t){if(z){var n=Ll.formState;if(n!==null){a:{var r=G;if(z){if(Pi){b:{for(var i=Pi,a=Ii;i.nodeType!==8;){if(!a){i=null;break b}if(i=cf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Pi=cf(i.nextSibling),r=i.data===`F!`;break a}}Ri(r)}r=!1}r&&(t=n[0])}}return n=To(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yo,lastRenderedState:t},n.queue=r,n=Os.bind(null,G,r),r.dispatch=n,r=Vo(!1),a=As.bind(null,G,!1,r.queue),r=To(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Uo.bind(null,G,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Zo(e){return Qo(Eo(),K,e)}function Qo(e,t,n){if(t=No(e,t,Yo)[0],e=Mo(jo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Oo(t)}catch(e){throw e===Sa?wa:e}else r=t;t=Eo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(G.flags|=2048,ts(9,{destroy:void 0},$o.bind(null,i,n),null)),[r,a,e]}function $o(e,t){e.action=t}function es(e){var t=Eo(),n=K;if(n!==null)return Qo(t,n,e);Eo(),t=t.memoizedState,n=Eo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ts(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=G.updateQueue,t===null&&(t=Do(),G.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ns(){return Eo().memoizedState}function rs(e,t,n,r){var i=To();G.flags|=e,i.memoizedState=ts(1|t,{destroy:void 0},n,r===void 0?null:r)}function is(e,t,n,r){var i=Eo();r=r===void 0?null:r;var a=i.memoizedState.inst;K!==null&&r!==null&&vo(r,K.memoizedState.deps)?i.memoizedState=ts(t,a,n,r):(G.flags|=e,i.memoizedState=ts(1|t,a,n,r))}function as(e,t){rs(8390656,8,e,t)}function os(e,t){is(2048,8,e,t)}function ss(e){G.flags|=4;var t=G.updateQueue;if(t===null)t=Do(),G.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function cs(e){var t=Eo().memoizedState;return ss({ref:t,nextImpl:e}),function(){if(J&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function ls(e,t){return is(4,2,e,t)}function us(e,t){return is(4,4,e,t)}function ds(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function fs(e,t,n){n=n==null?null:n.concat([e]),is(4,4,ds.bind(null,t,e),n)}function ps(){}function ms(e,t){var n=Eo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&vo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function hs(e,t){var n=Eo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&vo(t,r[1]))return r[0];if(r=e(),fo){Re(!0);try{e()}finally{Re(!1)}}return n.memoizedState=[r,t],r}function gs(e,t,n){return n===void 0||so&1073741824&&!(X&261930)?e.memoizedState=t:(e.memoizedState=n,e=pu(),G.lanes|=e,Wl|=e,n)}function _s(e,t,n,r){return Sr(n,t)?n:Ya.current===null?!(so&42)||so&1073741824&&!(X&261930)?($s=!0,e.memoizedState=n):(e=pu(),G.lanes|=e,Wl|=e,t):(e=gs(e,n,r),Sr(e,t)||($s=!0),e)}function vs(e,t,n,r,i){var a=M.p;M.p=a!==0&&8>a?a:8;var o=j.T,s={};j.T=s,As(e,!1,t,n);try{var c=i(),l=j.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?ks(e,t,ga(c,r),fu(e)):ks(e,t,r,fu(e))}catch(n){ks(e,t,{then:function(){},status:`rejected`,reason:n},fu())}finally{M.p=a,o!==null&&s.types!==null&&(o.types=s.types),j.T=o}}function ys(){}function bs(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=xs(e).queue;vs(e,a,t,ae,n===null?ys:function(){return Ss(e),n(r)})}function xs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:ae},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ss(e){var t=xs(e);t.next===null&&(t=e.alternate.memoizedState),ks(e,t.next.queue,{},fu())}function Cs(){return ta(Qf)}function ws(){return Eo().memoizedState}function Ts(){return Eo().memoizedState}function Es(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=fu();e=Ba(n);var r=Va(t,e,n);r!==null&&(mu(r,t,n),Ha(r,t,n)),t={cache:ca()},e.payload=t;return}t=t.return}}function Ds(e,t,n){var r=fu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},js(e)?Ms(t,n):(n=ni(e,t,n,r),n!==null&&(mu(n,e,r),Ns(n,t,r)))}function Os(e,t,n){ks(e,t,n,fu())}function ks(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(js(e))Ms(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Sr(s,o))return ti(e,t,i,0),Ll===null&&ei(),!1}catch{}if(n=ni(e,t,i,r),n!==null)return mu(n,e,r),Ns(n,t,r),!0}return!1}function As(e,t,n,r){if(r={lane:2,revertLane:ud(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},js(e)){if(t)throw Error(i(479))}else t=ni(e,n,r,2),t!==null&&mu(t,e,2)}function js(e){var t=e.alternate;return e===G||t!==null&&t===G}function Ms(e,t){uo=lo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ns(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$e(e,n)}}var Ps={readContext:ta,use:ko,useCallback:_o,useContext:_o,useEffect:_o,useImperativeHandle:_o,useLayoutEffect:_o,useInsertionEffect:_o,useMemo:_o,useReducer:_o,useRef:_o,useState:_o,useDebugValue:_o,useDeferredValue:_o,useTransition:_o,useSyncExternalStore:_o,useId:_o,useHostTransitionStatus:_o,useFormState:_o,useActionState:_o,useOptimistic:_o,useMemoCache:_o,useCacheRefresh:_o};Ps.useEffectEvent=_o;var Fs={readContext:ta,use:ko,useCallback:function(e,t){return To().memoizedState=[e,t===void 0?null:t],e},useContext:ta,useEffect:as,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),rs(4194308,4,ds.bind(null,t,e),n)},useLayoutEffect:function(e,t){return rs(4194308,4,e,t)},useInsertionEffect:function(e,t){rs(4,2,e,t)},useMemo:function(e,t){var n=To();t=t===void 0?null:t;var r=e();if(fo){Re(!0);try{e()}finally{Re(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=To();if(n!==void 0){var i=n(t);if(fo){Re(!0);try{n(t)}finally{Re(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ds.bind(null,G,e),[r.memoizedState,e]},useRef:function(e){var t=To();return e={current:e},t.memoizedState=e},useState:function(e){e=Vo(e);var t=e.queue,n=Os.bind(null,G,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ps,useDeferredValue:function(e,t){return gs(To(),e,t)},useTransition:function(){var e=Vo(!1);return e=vs.bind(null,G,e.queue,!0,!1),To().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=G,a=To();if(z){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Ll===null)throw Error(i(349));X&127||Io(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,as(Ro.bind(null,r,o,e),[e]),r.flags|=2048,ts(9,{destroy:void 0},Lo.bind(null,r,o,n,t),null),n},useId:function(){var e=To(),t=Ll.identifierPrefix;if(z){var n=Di,r=Ei;n=(r&~(1<<32-ze(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=po++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=go++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Cs,useFormState:Xo,useActionState:Xo,useOptimistic:function(e){var t=To();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=As.bind(null,G,!0,n),n.dispatch=t,[e,t]},useMemoCache:Ao,useCacheRefresh:function(){return To().memoizedState=Es.bind(null,G)},useEffectEvent:function(e){var t=To(),n={impl:e};return t.memoizedState=n,function(){if(J&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Is={readContext:ta,use:ko,useCallback:ms,useContext:ta,useEffect:os,useImperativeHandle:fs,useInsertionEffect:ls,useLayoutEffect:us,useMemo:hs,useReducer:Mo,useRef:ns,useState:function(){return Mo(jo)},useDebugValue:ps,useDeferredValue:function(e,t){return _s(Eo(),K.memoizedState,e,t)},useTransition:function(){var e=Mo(jo)[0],t=Eo().memoizedState;return[typeof e==`boolean`?e:Oo(e),t]},useSyncExternalStore:Fo,useId:ws,useHostTransitionStatus:Cs,useFormState:Zo,useActionState:Zo,useOptimistic:function(e,t){return Ho(Eo(),K,e,t)},useMemoCache:Ao,useCacheRefresh:Ts};Is.useEffectEvent=cs;var Ls={readContext:ta,use:ko,useCallback:ms,useContext:ta,useEffect:os,useImperativeHandle:fs,useInsertionEffect:ls,useLayoutEffect:us,useMemo:hs,useReducer:Po,useRef:ns,useState:function(){return Po(jo)},useDebugValue:ps,useDeferredValue:function(e,t){var n=Eo();return K===null?gs(n,e,t):_s(n,K.memoizedState,e,t)},useTransition:function(){var e=Po(jo)[0],t=Eo().memoizedState;return[typeof e==`boolean`?e:Oo(e),t]},useSyncExternalStore:Fo,useId:ws,useHostTransitionStatus:Cs,useFormState:es,useActionState:es,useOptimistic:function(e,t){var n=Eo();return K===null?(n.baseState=e,[e,n.queue.dispatch]):Ho(n,K,e,t)},useMemoCache:Ao,useCacheRefresh:Ts};Ls.useEffectEvent=cs;function Rs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:h({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var zs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=fu(),i=Ba(r);i.payload=t,n!=null&&(i.callback=n),t=Va(e,i,r),t!==null&&(mu(t,e,r),Ha(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=fu(),i=Ba(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Va(e,i,r),t!==null&&(mu(t,e,r),Ha(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=fu(),r=Ba(n);r.tag=2,t!=null&&(r.callback=t),t=Va(e,r,n),t!==null&&(mu(t,e,n),Ha(t,e,n))}};function Bs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Cr(n,r)||!Cr(i,a):!0}function Vs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&zs.enqueueReplaceState(t,t.state,null)}function Hs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=h({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Us(e){Xr(e)}function Ws(e){console.error(e)}function Gs(e){Xr(e)}function Ks(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function qs(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Js(e,t,n){return n=Ba(n),n.tag=3,n.payload={element:null},n.callback=function(){Ks(e,t)},n}function Ys(e){return e=Ba(e),e.tag=3,e}function Xs(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){qs(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){qs(t,n,r),typeof i!=`function`&&(nu===null?nu=new Set([this]):nu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Zs(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Qi(t,n,a,!0),n=Qa.current,n!==null){switch(n.tag){case 31:case 13:return $a===null?Eu():n.alternate===null&&Ul===0&&(Ul=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Ta?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Wu(e,r,a)),!1;case 22:return n.flags|=65536,r===Ta?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Wu(e,r,a)),!1}throw Error(i(435,n.tag))}return Wu(e,r,a),Eu(),!1}if(z)return t=Qa.current,t===null?(r!==Li&&(t=Error(i(423),{cause:r}),Wi(vi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=vi(r,n),a=Js(e.stateNode,r,a),Ua(e,a),Ul!==4&&(Ul=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Li&&(e=Error(i(422),{cause:r}),Wi(vi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=vi(o,n),Yl===null?Yl=[o]:Yl.push(o),Ul!==4&&(Ul=2),t===null)return!0;r=vi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Js(n.stateNode,r,e),Ua(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(nu===null||!nu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Ys(a),Xs(a,e,n,r),Ua(n,a),!1}n=n.return}while(n!==null);return!1}var Qs=Error(i(461)),$s=!1;function ec(e,t,n,r){t.child=e===null?H(t,null,n,r):Ia(t,e.child,n,r)}function tc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return ea(t),r=yo(e,t,n,o,a,i),s=Co(),e!==null&&!$s?(wo(e,t,i),Tc(e,t,i)):(z&&s&&Ai(t),t.flags|=1,ec(e,t,r,i),t.child)}function nc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!li(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,rc(e,t,a,r,i)):(e=fi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Ec(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Cr:n,n(o,r)&&e.ref===t.ref)return Tc(e,t,i)}return t.flags|=1,e=ui(a,r),e.ref=t.ref,e.return=t,t.child=e}function rc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Cr(a,r)&&e.ref===t.ref)if($s=!1,t.pendingProps=r=a,Ec(e,i))e.flags&131072&&($s=!0);else return t.lanes=e.lanes,Tc(e,t,i)}return dc(e,t,n,r,i)}function ic(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return oc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ba(t,a===null?null:a.cachePool),a===null?Xa():W(t,a),no(t);else return r=t.lanes=536870912,oc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ba(t,null),Xa(),ro(t)):(ba(t,a.cachePool),W(t,a),ro(t),t.memoizedState=null);return ec(e,t,i,n),t.child}function ac(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function oc(e,t,n,r,i){var a=ya();return a=a===null?null:{parent:sa._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ba(t,null),Xa(),no(t),e!==null&&Qi(e,t,r,!0),t.childLanes=i,null}function sc(e,t){return t=bc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function cc(e,t,n){return Ia(t,e.child,null,n),e=sc(t,t.pendingProps),e.flags|=2,io(t),t.memoizedState=null,e}function lc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(z){if(r.mode===`hidden`)return e=sc(t,r),t.lanes=536870912,ac(null,e);if(to(t),(e=Pi)?(e=rf(e,Ii),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ti===null?null:{id:Ei,overflow:Di},retryLane:536870912,hydrationErrors:null},n=hi(e),n.return=t,t.child=n,Ni=t,Pi=null)):e=null,e===null)throw Ri(t);return t.lanes=536870912,null}return sc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(to(t),a)if(t.flags&256)t.flags&=-257,t=cc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if($s||Qi(e,t,n,!1),a=(n&e.childLanes)!==0,$s||a){if(r=Ll,r!==null&&(s=et(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ri(e,s),mu(r,e,s),Qs;Eu(),t=cc(e,t,n)}else e=o.treeContext,Pi=cf(s.nextSibling),Ni=t,z=!0,Fi=null,Ii=!1,e!==null&&Mi(t,e),t=sc(t,r),t.flags|=4096;return t}return e=ui(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function uc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function dc(e,t,n,r,i){return ea(t),n=yo(e,t,n,r,void 0,i),r=Co(),e!==null&&!$s?(wo(e,t,i),Tc(e,t,i)):(z&&r&&Ai(t),t.flags|=1,ec(e,t,n,i),t.child)}function fc(e,t,n,r,i,a){return ea(t),t.updateQueue=null,n=xo(t,r,n,i),bo(e),r=Co(),e!==null&&!$s?(wo(e,t,a),Tc(e,t,a)):(z&&r&&Ai(t),t.flags|=1,ec(e,t,n,a),t.child)}function pc(e,t,n,r,i){if(ea(t),t.stateNode===null){var a=oi,o=n.contextType;typeof o==`object`&&o&&(a=ta(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=zs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Ra(t),o=n.contextType,a.context=typeof o==`object`&&o?ta(o):oi,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Rs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&zs.enqueueReplaceState(a,a.state,null),Ka(t,r,a,i),Ga(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Hs(n,s);a.props=c;var l=a.context,u=n.contextType;o=oi,typeof u==`object`&&u&&(o=ta(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Vs(t,a,r,o),La=!1;var f=t.memoizedState;a.state=f,Ka(t,r,a,i),Ga(),l=t.memoizedState,s||f!==l||La?(typeof d==`function`&&(Rs(t,n,d,r),l=t.memoizedState),(c=La||Bs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,za(e,t),o=t.memoizedProps,u=Hs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=oi,typeof l==`object`&&l&&(c=ta(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Vs(t,a,r,c),La=!1,f=t.memoizedState,a.state=f,Ka(t,r,a,i),Ga();var p=t.memoizedState;o!==d||f!==p||La||e!==null&&e.dependencies!==null&&$i(e.dependencies)?(typeof s==`function`&&(Rs(t,n,s,r),p=t.memoizedState),(u=La||Bs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&$i(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,uc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Ia(t,e.child,null,i),t.child=Ia(t,null,n,i)):ec(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Tc(e,t,i),e}function mc(e,t,n,r){return Hi(),t.flags|=256,ec(e,t,n,r),t.child}var hc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function gc(e){return{baseLanes:e,cachePool:xa()}}function _c(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=ql),e}function vc(e,t,n){var r=t.pendingProps,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(ao.current&2)),s&&(a=!0,t.flags&=-129),s=!!(t.flags&32),t.flags&=-33,e===null){if(z){if(a?eo(t):ro(t),(e=Pi)?(e=rf(e,Ii),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ti===null?null:{id:Ei,overflow:Di},retryLane:536870912,hydrationErrors:null},n=hi(e),n.return=t,t.child=n,Ni=t,Pi=null)):e=null,e===null)throw Ri(t);return of(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(ro(t),a=t.mode,c=bc({mode:`hidden`,children:c},a),r=pi(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=gc(n),r.childLanes=_c(e,s,n),t.memoizedState=hc,ac(null,r)):(eo(t),yc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(eo(t),t.flags&=-257,t=xc(e,t,n)):t.memoizedState===null?(ro(t),c=r.fallback,a=t.mode,r=bc({mode:`visible`,children:r.children},a),c=pi(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Ia(t,e.child,null,n),r=t.child,r.memoizedState=gc(n),r.childLanes=_c(e,s,n),t.memoizedState=hc,t=ac(null,r)):(ro(t),t.child=e.child,t.flags|=128,t=null);else if(eo(t),of(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Wi({value:r,source:null,stack:null}),t=xc(e,t,n)}else if($s||Qi(e,t,n,!1),s=(n&e.childLanes)!==0,$s||s){if(s=Ll,s!==null&&(r=et(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ri(e,r),mu(s,e,r),Qs;af(c)||Eu(),t=xc(e,t,n)}else af(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Pi=cf(c.nextSibling),Ni=t,z=!0,Fi=null,Ii=!1,e!==null&&Mi(t,e),t=yc(t,r.children),t.flags|=4096);return t}return a?(ro(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ui(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=pi(c,a,n,null),c.flags|=2):c=ui(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,ac(null,r),r=t.child,c=e.child.memoizedState,c===null?c=gc(n):(a=c.cachePool,a===null?a=xa():(l=sa._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=_c(e,s,n),t.memoizedState=hc,ac(e.child,r)):(eo(t),n=e.child,e=n.sibling,n=ui(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function yc(e,t){return t=bc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function bc(e,t){return e=ci(22,e,null,t),e.lanes=0,e}function xc(e,t,n){return Ia(t,e.child,null,n),e=yc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Sc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Xi(e.return,t,n)}function Cc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function wc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=ao.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,F(ao,o),ec(e,t,r,n),r=z?Si:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Sc(e,n,t);else if(e.tag===19)Sc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&oo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Cc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&oo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Cc(t,!0,n,null,a,r);break;case`together`:Cc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Tc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Wl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Qi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=ui(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ui(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Ec(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&$i(e)))}function Dc(e,t,n){switch(t.tag){case 3:fe(t,t.stateNode.containerInfo),Ji(t,sa,e.memoizedState.cache),Hi();break;case 27:case 5:me(t);break;case 4:fe(t,t.stateNode.containerInfo);break;case 10:Ji(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,to(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(eo(t),e=Tc(e,t,n),e===null?null:e.sibling):vc(e,t,n):(eo(t),t.flags|=128,null);eo(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=(Qi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return wc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),F(ao,ao.current),r)break;return null;case 22:return t.lanes=0,ic(e,t,n,t.pendingProps);case 24:Ji(t,sa,e.memoizedState.cache)}return Tc(e,t,n)}function Oc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)$s=!0;else{if(!Ec(e,n)&&!(t.flags&128))return $s=!1,Dc(e,t,n);$s=!!(e.flags&131072)}else $s=!1,z&&t.flags&1048576&&ki(t,Si,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Oa(t.elementType),t.type=e,typeof e==`function`)li(e)?(r=Hs(e,r),t.tag=1,t=pc(null,t,e,r,n)):(t.tag=0,t=dc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=tc(null,t,e,r,n);break a}if(a===D){t.tag=14,t=nc(null,t,e,r,n);break a}}throw t=ie(e)||e,Error(i(306,t,``))}}return t;case 0:return dc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Hs(r,t.pendingProps),pc(e,t,r,a,n);case 3:a:{if(fe(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,za(e,t),Ka(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Ji(t,sa,r),r!==o.cache&&Zi(t,[sa],n,!0),Ga(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=mc(e,t,r,n);break a}else if(r!==a){a=vi(Error(i(424)),t),Wi(a),t=mc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Pi=cf(e.firstChild),Ni=t,z=!0,Fi=null,Ii=!0,n=H(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Hi(),r===a){t=Tc(e,t,n);break a}ec(e,t,r,n)}t=t.child}return t;case 26:return uc(e,t),e===null?(n=kf(t.type,null,t.pendingProps,null))?t.memoizedState=n:z||(n=t.type,e=t.pendingProps,r=Bd(ue.current).createElement(n),r[ot]=t,r[st]=e,Pd(r,n,e),yt(r),t.stateNode=r):t.memoizedState=kf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return me(t),e===null&&z&&(r=t.stateNode=ff(t.type,t.pendingProps,ue.current),Ni=t,Ii=!0,a=Pi,Zd(t.type)?(lf=a,Pi=cf(r.firstChild)):Pi=a),ec(e,t,t.pendingProps.children,n),uc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&z&&((a=r=Pi)&&(r=tf(r,t.type,t.pendingProps,Ii),r===null?a=!1:(t.stateNode=r,Ni=t,Pi=cf(r.firstChild),Ii=!1,a=!0)),a||Ri(t)),me(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Ud(a,o)?r=null:s!==null&&Ud(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=yo(e,t,So,null,null,n),Qf._currentValue=a),uc(e,t),ec(e,t,r,n),t.child;case 6:return e===null&&z&&((e=n=Pi)&&(n=nf(n,t.pendingProps,Ii),n===null?e=!1:(t.stateNode=n,Ni=t,Pi=null,e=!0)),e||Ri(t)),null;case 13:return vc(e,t,n);case 4:return fe(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ia(t,null,r,n):ec(e,t,r,n),t.child;case 11:return tc(e,t,t.type,t.pendingProps,n);case 7:return ec(e,t,t.pendingProps,n),t.child;case 8:return ec(e,t,t.pendingProps.children,n),t.child;case 12:return ec(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Ji(t,t.type,r.value),ec(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,ea(t),a=ta(a),r=r(a),t.flags|=1,ec(e,t,r,n),t.child;case 14:return nc(e,t,t.type,t.pendingProps,n);case 15:return rc(e,t,t.type,t.pendingProps,n);case 19:return wc(e,t,n);case 31:return lc(e,t,n);case 22:return ic(e,t,n,t.pendingProps);case 24:return ea(t),r=ta(sa),e===null?(a=ya(),a===null&&(a=Ll,o=ca(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Ra(t),Ji(t,sa,a)):((e.lanes&n)!==0&&(za(e,t),Ka(t,null,null,n),Ga()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Ji(t,sa,r),r!==a.cache&&Zi(t,[sa],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Ji(t,sa,r))),ec(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function kc(e){e.flags|=4}function Ac(e,t,n,r,i){if((t=!!(e.mode&32))&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Cu())e.flags|=8192;else throw ka=Ta,Ca}else e.flags&=-16777217}function jc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Wf(t))if(Cu())e.flags|=8192;else throw ka=Ta,Ca}function Mc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Je(),e.lanes|=t,Jl|=t)}function Nc(e,t){if(!z)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Pc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Fc(e,t,n){var r=t.pendingProps;switch(ji(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pc(t),null;case 1:return Pc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Yi(sa),pe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Vi(t)?kc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ui())),Pc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(kc(t),o===null?(Pc(t),Ac(t,a,null,r,n)):(Pc(t),jc(t,o))):o?o===e.memoizedState?(Pc(t),t.flags&=-16777217):(kc(t),Pc(t),jc(t,o)):(e=e.memoizedProps,e!==r&&kc(t),Pc(t),Ac(t,a,e,r,n)),null;case 27:if(he(t),n=ue.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&kc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Pc(t),null}e=ce.current,Vi(t)?zi(t,e):(e=ff(a,r,n),t.stateNode=e,kc(t))}return Pc(t),null;case 5:if(he(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&kc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Pc(t),null}if(o=ce.current,Vi(t))zi(t,o);else{var s=Bd(ue.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[ot]=t,o[st]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Pd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&kc(t)}}return Pc(t),Ac(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&kc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=ue.current,Vi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Ni,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[ot]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||jd(e.nodeValue,n)),e||Ri(t,!0)}else e=Bd(e).createTextNode(r),e[ot]=t,t.stateNode=e}return Pc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Vi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[ot]=t}else Hi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Pc(t),e=!1}else n=Ui(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(io(t),t):(io(t),null);if(t.flags&128)throw Error(i(558))}return Pc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Vi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[ot]=t}else Hi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Pc(t),a=!1}else a=Ui(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(io(t),t):(io(t),null)}return io(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Mc(t,t.updateQueue),Pc(t),null);case 4:return pe(),e===null&&xd(t.stateNode.containerInfo),Pc(t),null;case 10:return Yi(t.type),Pc(t),null;case 19:if(P(ao),r=t.memoizedState,r===null)return Pc(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null)if(a)Nc(r,!1);else{if(Ul!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=oo(e),o!==null){for(t.flags|=128,Nc(r,!1),e=o.updateQueue,t.updateQueue=e,Mc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)di(n,e),n=n.sibling;return F(ao,ao.current&1|2),z&&Oi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&De()>eu&&(t.flags|=128,a=!0,Nc(r,!1),t.lanes=4194304)}else{if(!a)if(e=oo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Mc(t,e),Nc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!z)return Pc(t),null}else 2*De()-r.renderingStartTime>eu&&n!==536870912&&(t.flags|=128,a=!0,Nc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Pc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=De(),e.sibling=null,n=ao.current,F(ao,a?n&1|2:n&1),z&&Oi(t,r.treeForkCount),e);case 22:case 23:return io(t),Za(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Pc(t),t.subtreeFlags&6&&(t.flags|=8192)):Pc(t),n=t.updateQueue,n!==null&&Mc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&P(va),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Yi(sa),Pc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Ic(e,t){switch(ji(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Yi(sa),pe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return he(t),null;case 31:if(t.memoizedState!==null){if(io(t),t.alternate===null)throw Error(i(340));Hi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(io(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Hi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return P(ao),null;case 4:return pe(),null;case 10:return Yi(t.type),null;case 22:case 23:return io(t),Za(),e!==null&&P(va),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Yi(sa),null;case 25:return null;default:return null}}function Lc(e,t){switch(ji(t),t.tag){case 3:Yi(sa),pe();break;case 26:case 27:case 5:he(t);break;case 4:pe();break;case 31:t.memoizedState!==null&&io(t);break;case 13:io(t);break;case 19:P(ao);break;case 10:Yi(t.type);break;case 22:case 23:io(t),Za(),e!==null&&P(va);break;case 24:Yi(sa)}}function Rc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Q(t,t.return,e)}}function zc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Q(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Q(t,t.return,e)}}function Bc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ja(t,n)}catch(t){Q(e,e.return,t)}}}function Vc(e,t,n){n.props=Hs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Q(e,t,n)}}function Hc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Q(e,t,n)}}function Uc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Q(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Q(e,t,n)}else n.current=null}function Wc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Q(e,e.return,t)}}function Gc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[st]=t}catch(t){Q(e,e.return,t)}}function Kc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function qc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Kc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Jc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=$t));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Jc(e,t,n),e=e.sibling;e!==null;)Jc(e,t,n),e=e.sibling}function Yc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Yc(e,t,n),e=e.sibling;e!==null;)Yc(e,t,n),e=e.sibling}function Xc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[ot]=e,t[st]=n}catch(t){Q(e,e.return,t)}}var Zc=!1,Qc=!1,$c=!1,el=typeof WeakSet==`function`?WeakSet:Set,tl=null;function nl(e,t){if(e=e.containerInfo,Rd=sp,e=Dr(e),Or(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,tl=t;tl!==null;)if(t=tl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,tl=e;else for(;tl!==null;){switch(t=tl,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Hs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Q(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)ef(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:ef(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,tl=e;break}tl=t.return}}function rl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:vl(e,n),r&4&&Rc(5,n);break;case 1:if(vl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Q(n,n.return,e)}else{var i=Hs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Q(n,n.return,e)}}r&64&&Bc(n),r&512&&Hc(n,n.return);break;case 3:if(vl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Ja(e,t)}catch(e){Q(n,n.return,e)}}break;case 27:t===null&&r&4&&Xc(n);case 26:case 5:vl(e,n),t===null&&r&4&&Wc(n),r&512&&Hc(n,n.return);break;case 12:vl(e,n);break;case 31:vl(e,n),r&4&&ll(e,n);break;case 13:vl(e,n),r&4&&ul(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=qu.bind(null,n),sf(e,n))));break;case 22:if(r=n.memoizedState!==null||Zc,!r){t=t!==null&&t.memoizedState!==null||Qc,i=Zc;var a=Qc;Zc=r,(Qc=t)&&!a?bl(e,n,!!(n.subtreeFlags&8772)):vl(e,n),Zc=i,Qc=a}break;case 30:break;default:vl(e,n)}}function il(e){var t=e.alternate;t!==null&&(e.alternate=null,il(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&mt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var al=null,ol=!1;function sl(e,t,n){for(n=n.child;n!==null;)cl(e,t,n),n=n.sibling}function cl(e,t,n){if(Le&&typeof Le.onCommitFiberUnmount==`function`)try{Le.onCommitFiberUnmount(Ie,n)}catch{}switch(n.tag){case 26:Qc||Uc(n,t),sl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Qc||Uc(n,t);var r=al,i=ol;Zd(n.type)&&(al=n.stateNode,ol=!1),sl(e,t,n),pf(n.stateNode),al=r,ol=i;break;case 5:Qc||Uc(n,t);case 6:if(r=al,i=ol,al=null,sl(e,t,n),al=r,ol=i,al!==null)if(ol)try{(al.nodeType===9?al.body:al.nodeName===`HTML`?al.ownerDocument.body:al).removeChild(n.stateNode)}catch(e){Q(n,t,e)}else try{al.removeChild(n.stateNode)}catch(e){Q(n,t,e)}break;case 18:al!==null&&(ol?(e=al,Qd(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Np(e)):Qd(al,n.stateNode));break;case 4:r=al,i=ol,al=n.stateNode.containerInfo,ol=!0,sl(e,t,n),al=r,ol=i;break;case 0:case 11:case 14:case 15:zc(2,n,t),Qc||zc(4,n,t),sl(e,t,n);break;case 1:Qc||(Uc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Vc(n,t,r)),sl(e,t,n);break;case 21:sl(e,t,n);break;case 22:Qc=(r=Qc)||n.memoizedState!==null,sl(e,t,n),Qc=r;break;default:sl(e,t,n)}}function ll(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Np(e)}catch(e){Q(t,t.return,e)}}}function ul(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Np(e)}catch(e){Q(t,t.return,e)}}function dl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new el),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new el),t;default:throw Error(i(435,e.tag))}}function fl(e,t){var n=dl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Ju.bind(null,e,t);t.then(r,r)}})}function pl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(Zd(c.type)){al=c.stateNode,ol=!1;break a}break;case 5:al=c.stateNode,ol=!1;break a;case 3:case 4:al=c.stateNode.containerInfo,ol=!0;break a}c=c.return}if(al===null)throw Error(i(160));cl(o,s,a),al=null,ol=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)hl(t,e),t=t.sibling}var ml=null;function hl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:pl(t,e),gl(e),r&4&&(zc(3,e,e.return),Rc(3,e),zc(5,e,e.return));break;case 1:pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),r&64&&Zc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=ml;if(pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[pt]||o[ot]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Pd(o,r,n),o[ot]=e,yt(o),r=o;break a;case`link`:var s=Vf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Pd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Vf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Pd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[ot]=e,yt(o),r=o}e.stateNode=r}else Hf(a,e.type,e.stateNode);else e.stateNode=If(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Gc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Hf(a,e.type,e.stateNode):If(a,r,e.memoizedProps))}break;case 27:pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),n!==null&&r&4&&Gc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),e.flags&32){a=e.stateNode;try{Gt(a,``)}catch(t){Q(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Gc(e,a,n===null?a:n.memoizedProps)),r&1024&&($c=!0);break;case 6:if(pl(t,e),gl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Q(e,e.return,t)}}break;case 3:if(Bf=null,a=ml,ml=gf(t.containerInfo),pl(t,e),ml=a,gl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Np(t.containerInfo)}catch(t){Q(e,e.return,t)}$c&&($c=!1,_l(e));break;case 4:r=ml,ml=gf(e.stateNode.containerInfo),pl(t,e),gl(e),ml=r;break;case 12:pl(t,e),gl(e);break;case 31:pl(t,e),gl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 13:pl(t,e),gl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Ql=De()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Zc,d=Qc;if(Zc=u||a,Qc=d||l,pl(t,e),Qc=d,Zc=u,gl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Zc||Qc||yl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Q(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Q(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?$d(m,!0):$d(l.stateNode,!1)}catch(e){Q(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,fl(e,n))));break;case 19:pl(t,e),gl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 30:break;case 21:break;default:pl(t,e),gl(e)}}function gl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Kc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Yc(e,qc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Gt(o,``),n.flags&=-33),Yc(e,qc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Jc(e,qc(e),s);break;default:throw Error(i(161))}}catch(t){Q(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function _l(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;_l(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function vl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)rl(e,t.alternate,t),t=t.sibling}function yl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:zc(4,t,t.return),yl(t);break;case 1:Uc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Vc(t,t.return,n),yl(t);break;case 27:pf(t.stateNode);case 26:case 5:Uc(t,t.return),yl(t);break;case 22:t.memoizedState===null&&yl(t);break;case 30:yl(t);break;default:yl(t)}e=e.sibling}}function bl(e,t,n){for(n&&=!!(t.subtreeFlags&8772),t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:bl(i,a,n),Rc(4,a);break;case 1:if(bl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Q(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)qa(c[i],s)}catch(e){Q(r,r.return,e)}}n&&o&64&&Bc(a),Hc(a,a.return);break;case 27:Xc(a);case 26:case 5:bl(i,a,n),n&&r===null&&o&4&&Wc(a),Hc(a,a.return);break;case 12:bl(i,a,n);break;case 31:bl(i,a,n),n&&o&4&&ll(i,a);break;case 13:bl(i,a,n),n&&o&4&&ul(i,a);break;case 22:a.memoizedState===null&&bl(i,a,n),Hc(a,a.return);break;case 30:break;default:bl(i,a,n)}t=t.sibling}}function xl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&la(n))}function Sl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&la(e))}function Cl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)wl(e,t,n,r),t=t.sibling}function wl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Cl(e,t,n,r),i&2048&&Rc(9,t);break;case 1:Cl(e,t,n,r);break;case 3:Cl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&la(e)));break;case 12:if(i&2048){Cl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Q(t,t.return,e)}}else Cl(e,t,n,r);break;case 31:Cl(e,t,n,r);break;case 13:Cl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Cl(e,t,n,r):(a._visibility|=2,Tl(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?Cl(e,t,n,r):El(e,t),i&2048&&xl(o,t);break;case 24:Cl(e,t,n,r),i&2048&&Sl(t.alternate,t);break;default:Cl(e,t,n,r)}}function Tl(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Tl(a,o,s,c,i),Rc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Tl(a,o,s,c,i)):u._visibility&2?Tl(a,o,s,c,i):El(a,o),i&&l&2048&&xl(o.alternate,o);break;case 24:Tl(a,o,s,c,i),i&&l&2048&&Sl(o.alternate,o);break;default:Tl(a,o,s,c,i)}t=t.sibling}}function El(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:El(n,r),i&2048&&xl(r.alternate,r);break;case 24:El(n,r),i&2048&&Sl(r.alternate,r);break;default:El(n,r)}t=t.sibling}}var Dl=8192;function Ol(e,t,n){if(e.subtreeFlags&Dl)for(e=e.child;e!==null;)kl(e,t,n),e=e.sibling}function kl(e,t,n){switch(e.tag){case 26:Ol(e,t,n),e.flags&Dl&&e.memoizedState!==null&&Gf(n,ml,e.memoizedState,e.memoizedProps);break;case 5:Ol(e,t,n);break;case 3:case 4:var r=ml;ml=gf(e.stateNode.containerInfo),Ol(e,t,n),ml=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Dl,Dl=16777216,Ol(e,t,n),Dl=r):Ol(e,t,n));break;default:Ol(e,t,n)}}function Al(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function jl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];tl=r,Pl(r,e)}Al(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ml(e),e=e.sibling}function Ml(e){switch(e.tag){case 0:case 11:case 15:jl(e),e.flags&2048&&zc(9,e,e.return);break;case 3:jl(e);break;case 12:jl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Nl(e)):jl(e);break;default:jl(e)}}function Nl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];tl=r,Pl(r,e)}Al(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:zc(8,t,t.return),Nl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Nl(t));break;default:Nl(t)}e=e.sibling}}function Pl(e,t){for(;tl!==null;){var n=tl;switch(n.tag){case 0:case 11:case 15:zc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:la(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,tl=r;else a:for(n=e;tl!==null;){r=tl;var i=r.sibling,a=r.return;if(il(r),r===n){tl=null;break a}if(i!==null){i.return=a,tl=i;break a}tl=a}}}var Fl={getCacheForType:function(e){var t=ta(sa),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ta(sa).controller.signal}},Il=typeof WeakMap==`function`?WeakMap:Map,J=0,Ll=null,Y=null,X=0,Z=0,Rl=null,zl=!1,Bl=!1,Vl=!1,Hl=0,Ul=0,Wl=0,Gl=0,Kl=0,ql=0,Jl=0,Yl=null,Xl=null,Zl=!1,Ql=0,$l=0,eu=1/0,tu=null,nu=null,ru=0,iu=null,au=null,ou=0,su=0,cu=null,lu=null,uu=0,du=null;function fu(){return J&2&&X!==0?X&-X:j.T===null?rt():ud()}function pu(){if(ql===0)if(!(X&536870912)||z){var e=We;We<<=1,!(We&3932160)&&(We=262144),ql=e}else ql=536870912;return e=Qa.current,e!==null&&(e.flags|=32),ql}function mu(e,t,n){(e===Ll&&(Z===2||Z===9)||e.cancelPendingCommit!==null)&&(xu(e,0),vu(e,X,ql,!1)),Xe(e,n),(!(J&2)||e!==Ll)&&(e===Ll&&(!(J&2)&&(Gl|=n),Ul===4&&vu(e,X,ql,!1)),nd(e))}function hu(e,t,n){if(J&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||Ke(e,t),a=r?ku(e,t):Du(e,t,!0),o=r;do{if(a===0){Bl&&!r&&vu(e,t,0,!1);break}if(n=e.current.alternate,o&&!_u(n)){a=Du(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=Yl;var l=c.current.memoizedState.isDehydrated;if(l&&(xu(c,s).flags|=256),s=Du(c,s,!1),s!==2){if(Vl&&!l){c.errorRecoveryDisabledLanes|=o,Gl|=o,a=4;break a}o=Xl,Xl=a,o!==null&&(Xl===null?Xl=o:Xl.push.apply(Xl,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){xu(e,0),vu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:vu(r,t,ql,!zl);break a;case 2:Xl=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=Ql+300-De(),10<a)){if(vu(r,t,ql,!zl),Ge(r,0,!0)!==0)break a;ou=t,r.timeoutHandle=Kd(gu.bind(null,r,n,Xl,tu,Zl,t,ql,Gl,Jl,zl,o,`Throttled`,-0,0),a);break a}gu(r,n,Xl,tu,Zl,t,ql,Gl,Jl,zl,o,null,-0,0)}break}while(1);nd(e)}function gu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:$t},kl(t,a,d);var m=(a&62914560)===a?Ql-De():(a&4194048)===a?$l-De():0;if(m=qf(d,m),m!==null){ou=a,e.cancelPendingCommit=m(Iu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),vu(e,a,o,!l);return}}Iu(e,t,a,n,r,i,o,s,c)}function _u(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Sr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function vu(e,t,n,r){t&=~Kl,t&=~Gl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-ze(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Qe(e,n,t)}function yu(){return J&6?!0:(rd(0,!1),!1)}function bu(){if(Y!==null){if(Z===0)var e=Y.return;else e=Y,qi=Ki=null,q(e),B=null,Ma=0,e=Y;for(;e!==null;)Lc(e.alternate,e),e=e.return;Y=null}}function xu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,qd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),ou=0,bu(),Ll=e,Y=n=ui(e.current,null),X=t,Z=0,Rl=null,zl=!1,Bl=Ke(e,t),Vl=!1,Jl=ql=Kl=Gl=Wl=Ul=0,Xl=Yl=null,Zl=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-ze(r),a=1<<i;t|=e[i],r&=~a}return Hl=t,ei(),n}function Su(e,t){G=null,j.H=Ps,t===Sa||t===wa?(t=Aa(),Z=3):t===Ca?(t=Aa(),Z=4):Z=t===Qs?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Rl=t,Y===null&&(Ul=1,Ks(e,vi(t,e.current)))}function Cu(){var e=Qa.current;return e===null?!0:(X&4194048)===X?$a===null:(X&62914560)===X||X&536870912?e===$a:!1}function wu(){var e=j.H;return j.H=Ps,e===null?Ps:e}function Tu(){var e=j.A;return j.A=Fl,e}function Eu(){Ul=4,zl||(X&4194048)!==X&&Qa.current!==null||(Bl=!0),!(Wl&134217727)&&!(Gl&134217727)||Ll===null||vu(Ll,X,ql,!1)}function Du(e,t,n){var r=J;J|=2;var i=wu(),a=Tu();(Ll!==e||X!==t)&&(tu=null,xu(e,t)),t=!1;var o=Ul;a:do try{if(Z!==0&&Y!==null){var s=Y,c=Rl;switch(Z){case 8:bu(),o=6;break a;case 3:case 2:case 9:case 6:Qa.current===null&&(t=!0);var l=Z;if(Z=0,Rl=null,Nu(e,s,c,l),n&&Bl){o=0;break a}break;default:l=Z,Z=0,Rl=null,Nu(e,s,c,l)}}Ou(),o=Ul;break}catch(t){Su(e,t)}while(1);return t&&e.shellSuspendCounter++,qi=Ki=null,J=r,j.H=i,j.A=a,Y===null&&(Ll=null,X=0,ei()),o}function Ou(){for(;Y!==null;)ju(Y)}function ku(e,t){var n=J;J|=2;var r=wu(),a=Tu();Ll!==e||X!==t?(tu=null,eu=De()+500,xu(e,t)):Bl=Ke(e,t);a:do try{if(Z!==0&&Y!==null){t=Y;var o=Rl;b:switch(Z){case 1:Z=0,Rl=null,Nu(e,t,o,1);break;case 2:case 9:if(Ea(o)){Z=0,Rl=null,Mu(t);break}t=function(){Z!==2&&Z!==9||Ll!==e||(Z=7),nd(e)},o.then(t,t);break a;case 3:Z=7;break a;case 4:Z=5;break a;case 7:Ea(o)?(Z=0,Rl=null,Mu(t)):(Z=0,Rl=null,Nu(e,t,o,7));break;case 5:var s=null;switch(Y.tag){case 26:s=Y.memoizedState;case 5:case 27:var c=Y;if(s?Wf(s):c.stateNode.complete){Z=0,Rl=null;var l=c.sibling;if(l!==null)Y=l;else{var u=c.return;u===null?Y=null:(Y=u,Pu(u))}break b}}Z=0,Rl=null,Nu(e,t,o,5);break;case 6:Z=0,Rl=null,Nu(e,t,o,6);break;case 8:bu(),Ul=6;break a;default:throw Error(i(462))}}Au();break}catch(t){Su(e,t)}while(1);return qi=Ki=null,j.H=r,j.A=a,J=n,Y===null?(Ll=null,X=0,ei(),Ul):0}function Au(){for(;Y!==null&&!Te();)ju(Y)}function ju(e){var t=Oc(e.alternate,e,Hl);e.memoizedProps=e.pendingProps,t===null?Pu(e):Y=t}function Mu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=fc(n,t,t.pendingProps,t.type,void 0,X);break;case 11:t=fc(n,t,t.pendingProps,t.type.render,t.ref,X);break;case 5:q(t);default:Lc(n,t),t=Y=di(t,Hl),t=Oc(n,t,Hl)}e.memoizedProps=e.pendingProps,t===null?Pu(e):Y=t}function Nu(e,t,n,r){qi=Ki=null,q(t),B=null,Ma=0;var i=t.return;try{if(Zs(e,i,t,n,X)){Ul=1,Ks(e,vi(n,e.current)),Y=null;return}}catch(t){if(i!==null)throw Y=i,t;Ul=1,Ks(e,vi(n,e.current)),Y=null;return}t.flags&32768?(z||r===1?e=!0:Bl||X&536870912?e=!1:(zl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Qa.current,r!==null&&r.tag===13&&(r.flags|=16384))),Fu(t,e)):Pu(t)}function Pu(e){var t=e;do{if(t.flags&32768){Fu(t,zl);return}e=t.return;var n=Fc(t.alternate,t,Hl);if(n!==null){Y=n;return}if(t=t.sibling,t!==null){Y=t;return}Y=t=e}while(t!==null);Ul===0&&(Ul=5)}function Fu(e,t){do{var n=Ic(e.alternate,e);if(n!==null){n.flags&=32767,Y=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Y=e;return}Y=e=n}while(e!==null);Ul=6,Y=null}function Iu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Vu();while(ru!==0);if(J&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=$r,Ze(e,n,o,s,c,l),e===Ll&&(Y=Ll=null,X=0),au=t,iu=e,ou=n,su=o,cu=a,lu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Yu(je,function(){return Hu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=j.T,j.T=null,a=M.p,M.p=2,s=J,J|=4;try{nl(e,t,n)}finally{J=s,M.p=a,j.T=r}}ru=1,Lu(),Ru(),zu()}}function Lu(){if(ru===1){ru=0;var e=iu,t=au,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=j.T,j.T=null;var r=M.p;M.p=2;var i=J;J|=4;try{hl(t,e);var a=zd,o=Dr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Er(s.ownerDocument.documentElement,s)){if(c!==null&&Or(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Tr(s,h),v=Tr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}sp=!!Rd,zd=Rd=null}finally{J=i,M.p=r,j.T=n}}e.current=t,ru=2}}function Ru(){if(ru===2){ru=0;var e=iu,t=au,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=j.T,j.T=null;var r=M.p;M.p=2;var i=J;J|=4;try{rl(e,t.alternate,t)}finally{J=i,M.p=r,j.T=n}}ru=3}}function zu(){if(ru===4||ru===3){ru=0,Ee();var e=iu,t=au,n=ou,r=lu;t.subtreeFlags&10256||t.flags&10256?ru=5:(ru=0,au=iu=null,Bu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(nu=null),nt(n),t=t.stateNode,Le&&typeof Le.onCommitFiberRoot==`function`)try{Le.onCommitFiberRoot(Ie,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=j.T,i=M.p,M.p=2,j.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{j.T=t,M.p=i}}ou&3&&Vu(),nd(e),i=e.pendingLanes,n&261930&&i&42?e===du?uu++:(uu=0,du=e):uu=0,rd(0,!1)}}function Bu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,la(t)))}function Vu(){return Lu(),Ru(),zu(),Hu()}function Hu(){if(ru!==5)return!1;var e=iu,t=su;su=0;var n=nt(ou),r=j.T,a=M.p;try{M.p=32>n?32:n,j.T=null,n=cu,cu=null;var o=iu,s=ou;if(ru=0,au=iu=null,ou=0,J&6)throw Error(i(331));var c=J;if(J|=4,Ml(o.current),wl(o,o.current,s,n),J=c,rd(0,!1),Le&&typeof Le.onPostCommitFiberRoot==`function`)try{Le.onPostCommitFiberRoot(Ie,o)}catch{}return!0}finally{M.p=a,j.T=r,Bu(e,t)}}function Uu(e,t,n){t=vi(n,t),t=Js(e.stateNode,t,2),e=Va(e,t,2),e!==null&&(Xe(e,2),nd(e))}function Q(e,t,n){if(e.tag===3)Uu(e,e,n);else for(;t!==null;){if(t.tag===3){Uu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(nu===null||!nu.has(r))){e=vi(n,e),n=Ys(2),r=Va(t,n,2),r!==null&&(Xs(n,r,t,e),Xe(r,2),nd(r));break}}t=t.return}}function Wu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Il;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Vl=!0,i.add(n),e=Gu.bind(null,e,t,n),t.then(e,e))}function Gu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ll===e&&(X&n)===n&&(Ul===4||Ul===3&&(X&62914560)===X&&300>De()-Ql?!(J&2)&&xu(e,0):Kl|=n,Jl===X&&(Jl=0)),nd(e)}function Ku(e,t){t===0&&(t=Je()),e=ri(e,t),e!==null&&(Xe(e,t),nd(e))}function qu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ku(e,n)}function Ju(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Ku(e,n)}function Yu(e,t){return Ce(e,t)}var Xu=null,Zu=null,Qu=!1,$u=!1,ed=!1,td=0;function nd(e){e!==Zu&&e.next===null&&(Zu===null?Xu=Zu=e:Zu=Zu.next=e),$u=!0,Qu||(Qu=!0,ld())}function rd(e,t){if(!ed&&$u){ed=!0;do for(var n=!1,r=Xu;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-ze(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,cd(r,a))}else a=X,a=Ge(r,r===Ll?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ke(r,a)||(n=!0,cd(r,a));r=r.next}while(n);ed=!1}}function id(){ad()}function ad(){$u=Qu=!1;var e=0;td!==0&&Gd()&&(e=td);for(var t=De(),n=null,r=Xu;r!==null;){var i=r.next,a=od(r,t);a===0?(r.next=null,n===null?Xu=i:n.next=i,i===null&&(Zu=n)):(n=r,(e!==0||a&3)&&($u=!0)),r=i}ru!==0&&ru!==5||rd(e,!1),td!==0&&(td=0)}function od(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-ze(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=qe(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Ll,n=X,n=Ge(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Z===2||Z===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&we(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ke(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&we(r),nt(n)){case 2:case 8:n=Ae;break;case 32:n=je;break;case 268435456:n=Ne;break;default:n=je}return r=sd.bind(null,e),n=Ce(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&we(r),e.callbackPriority=2,e.callbackNode=null,2}function sd(e,t){if(ru!==0&&ru!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Vu()&&e.callbackNode!==n)return null;var r=X;return r=Ge(e,e===Ll?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(hu(e,r,t),od(e,De()),e.callbackNode!=null&&e.callbackNode===n?sd.bind(null,e):null)}function cd(e,t){if(Vu())return null;hu(e,t,!0)}function ld(){Yd(function(){J&6?Ce(ke,id):ad()})}function ud(){if(td===0){var e=fa;e===0&&(e=Ue,Ue<<=1,!(Ue&261888)&&(Ue=256)),td=e}return td}function dd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Qt(``+e)}function fd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function pd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=dd((i[st]||null).action),o=r.submitter;o&&(t=(t=o[st]||null)?dd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new xn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(td!==0){var e=o?fd(i,o):new FormData(i);bs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?fd(i,o):new FormData(i),bs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var md=0;md<Jr.length;md++){var hd=Jr[md];Yr(hd.toLowerCase(),`on`+(hd[0].toUpperCase()+hd.slice(1)))}Yr(Br,`onAnimationEnd`),Yr(Vr,`onAnimationIteration`),Yr(Hr,`onAnimationStart`),Yr(`dblclick`,`onDoubleClick`),Yr(`focusin`,`onFocus`),Yr(`focusout`,`onBlur`),Yr(Ur,`onTransitionRun`),Yr(Wr,`onTransitionStart`),Yr(Gr,`onTransitionCancel`),Yr(Kr,`onTransitionEnd`),Ct(`onMouseEnter`,[`mouseout`,`mouseover`]),Ct(`onMouseLeave`,[`mouseout`,`mouseover`]),Ct(`onPointerEnter`,[`pointerout`,`pointerover`]),Ct(`onPointerLeave`,[`pointerout`,`pointerover`]),St(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),St(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),St(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),St(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),St(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),St(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var gd=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),_d=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(gd));function vd(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Xr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Xr(e)}i.currentTarget=null,a=c}}}}function $(e,t){var n=t[lt];n===void 0&&(n=t[lt]=new Set);var r=e+`__bubble`;n.has(r)||(Sd(t,e,2,!1),n.add(r))}function yd(e,t,n){var r=0;t&&(r|=4),Sd(n,e,r,t)}var bd=`_reactListening`+Math.random().toString(36).slice(2);function xd(e){if(!e[bd]){e[bd]=!0,bt.forEach(function(t){t!==`selectionchange`&&(_d.has(t)||yd(t,!1,e),yd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[bd]||(t[bd]=!0,yd(`selectionchange`,!1,t))}}function Sd(e,t,n,r){switch(mp(t)){case 2:var i=cp;break;case 8:i=lp;break;default:i=up}n=i.bind(null,t,n,e),i=void 0,!un||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Cd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=ht(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}sn(function(){var r=a,i=tn(n),s=[];a:{var c=qr.get(e);if(c!==void 0){var l=xn,u=e;switch(e){case`keypress`:if(gn(n)===0)break a;case`keydown`:case`keyup`:l=zn;break;case`focusin`:u=`focus`,l=An;break;case`focusout`:u=`blur`,l=An;break;case`beforeblur`:case`afterblur`:l=An;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=On;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=kn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Vn;break;case Br:case Vr:case Hr:l=jn;break;case Kr:l=Hn;break;case`scroll`:case`scrollend`:l=Cn;break;case`wheel`:l=Un;break;case`copy`:case`cut`:case`paste`:l=Mn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Bn;break;case`toggle`:case`beforetoggle`:l=Wn}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=cn(m,p),g!=null&&d.push(wd(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==en&&(u=n.relatedTarget||n.fromElement)&&(ht(u)||u[ct]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?ht(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=On,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Bn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:_t(l),h=u==null?c:_t(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,ht(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Ed,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Dd(s,c,l,d,!1),u!==null&&f!==null&&Dd(s,f,u,d,!0)}}a:{if(c=r?_t(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=ur;else if(ir(c))if(dr)v=br;else{v=vr;var y=_r}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Yt(r.elementType)&&(v=ur):v=yr;if(v&&=v(e,r)){ar(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Vt(c,`number`,c.value)}switch(y=r?_t(r):window,e){case`focusin`:(ir(y)||y.contentEditable===`true`)&&(Ar=y,jr=r,Mr=null);break;case`focusout`:Mr=jr=Ar=null;break;case`mousedown`:Nr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Nr=!1,Pr(s,n,i);break;case`selectionchange`:if(kr)break;case`keydown`:case`keyup`:Pr(s,n,i)}var b;if(Kn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else er?Qn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Yn&&n.locale!==`ko`&&(er||x!==`onCompositionStart`?x===`onCompositionEnd`&&er&&(b=hn()):(fn=i,pn=`value`in fn?fn.value:fn.textContent,er=!0)),y=Td(r,x),0<y.length&&(x=new Nn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=$n(n),b!==null&&(x.data=b)))),(b=Jn?tr(e,n):nr(e,n))&&(x=Td(r,`onBeforeInput`),0<x.length&&(y=new Nn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),pd(s,e,r,n,i)}vd(s,t)})}function wd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Td(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=cn(e,n),i!=null&&r.unshift(wd(e,i,a)),i=cn(e,t),i!=null&&r.push(wd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Ed(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Dd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=cn(n,a),l!=null&&o.unshift(wd(n,l,c))):i||(l=cn(n,a),l!=null&&o.push(wd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Od=/\r\n?/g,kd=/\u0000|\uFFFD/g;function Ad(e){return(typeof e==`string`?e:``+e).replace(Od,`
|
|
9
|
+
`).replace(kd,``)}function jd(e,t){return t=Ad(t),Ad(e)===t}function Md(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Gt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Gt(e,``+r);break;case`className`:kt(e,`class`,r);break;case`tabIndex`:kt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:kt(e,n,r);break;case`style`:Jt(e,r,o);break;case`data`:if(t!==`object`){kt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Qt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&Md(e,t,`name`,a.name,a,null),Md(e,t,`formEncType`,a.formEncType,a,null),Md(e,t,`formMethod`,a.formMethod,a,null),Md(e,t,`formTarget`,a.formTarget,a,null)):(Md(e,t,`encType`,a.encType,a,null),Md(e,t,`method`,a.method,a,null),Md(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Qt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=$t);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Qt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:$(`beforetoggle`,e),$(`toggle`,e),Ot(e,`popover`,r);break;case`xlinkActuate`:At(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:At(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:At(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:At(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:At(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:At(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:At(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:At(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:At(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Ot(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Xt.get(n)||n,Ot(e,n,r))}}function Nd(e,t,n,r,a,o){switch(n){case`style`:Jt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Gt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Gt(e,``+r);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=$t);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!xt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[st]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Ot(e,n,r)}}}function Pd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:$(`error`,e),$(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Md(e,t,o,s,n,null)}}a&&Md(e,t,`srcSet`,n.srcSet,n,null),r&&Md(e,t,`src`,n.src,n,null);return;case`input`:$(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Md(e,t,r,d,n,null)}}Bt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in $(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Md(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Ht(e,!!r,n,!0):Ht(e,!!r,t,!1);return;case`textarea`:for(s in $(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Md(e,t,s,c,n,null)}Wt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Md(e,t,l,r,n,null)}return;case`dialog`:$(`beforetoggle`,e),$(`toggle`,e),$(`cancel`,e),$(`close`,e);break;case`iframe`:case`object`:$(`load`,e);break;case`video`:case`audio`:for(r=0;r<gd.length;r++)$(gd[r],e);break;case`image`:$(`error`,e),$(`load`,e);break;case`details`:$(`toggle`,e);break;case`embed`:case`source`:case`link`:$(`error`,e),$(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Md(e,t,u,r,n,null)}return;default:if(Yt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Nd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Md(e,t,c,r,n,null))}function Fd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Md(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Md(e,t,p,m,r,f)}}zt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Md(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Md(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Ht(e,!!n,n?[]:``,!1):Ht(e,!!n,t,!0)):Ht(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Md(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Md(e,t,s,a,r,o)}Ut(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Md(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Md(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Md(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Md(e,t,u,p,r,m)}return;default:if(Yt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Nd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Nd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Md(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Md(e,t,f,p,r,m)}function Id(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ld(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Id(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Rd=null,zd=null;function Bd(e){return e.nodeType===9?e:e.ownerDocument}function Vd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Hd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Ud(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Wd=null;function Gd(){var e=window.event;return e&&e.type===`popstate`?e!==Wd&&(Wd=e,!0):(Wd=null,!1)}var Kd=typeof setTimeout==`function`?setTimeout:void 0,qd=typeof clearTimeout==`function`?clearTimeout:void 0,Jd=typeof Promise==`function`?Promise:void 0,Yd=typeof queueMicrotask==`function`?queueMicrotask:Jd===void 0?Kd:function(e){return Jd.resolve(null).then(e).catch(Xd)};function Xd(e){setTimeout(function(){throw e})}function Zd(e){return e===`head`}function Qd(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Np(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)pf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,pf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[pt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&pf(e.ownerDocument.body);n=i}while(n);Np(t)}function $d(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function ef(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:ef(n),mt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function tf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[pt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=cf(e.nextSibling),e===null)break}return null}function nf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=cf(e.nextSibling),e===null))return null;return e}function rf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=cf(e.nextSibling),e===null))return null;return e}function af(e){return e.data===`$?`||e.data===`$~`}function of(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function sf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function cf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var lf=null;function uf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return cf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function df(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function ff(e,t,n){switch(t=Bd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function pf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);mt(e)}var mf=new Map,hf=new Set;function gf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _f=M.d;M.d={f:vf,r:yf,D:Sf,C:Cf,L:wf,m:Tf,X:Df,S:Ef,M:Of};function vf(){var e=_f.f(),t=yu();return e||t}function yf(e){var t=gt(e);t!==null&&t.tag===5&&t.type===`form`?Ss(t):_f.r(e)}var bf=typeof document>`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Rt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),yt(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Rt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Rt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Rt(n.imageSizes)+`"]`)):i+=`[href="`+Rt(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),yt(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Rt(r)+`"][href="`+Rt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),yt(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=vt(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);yt(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=vt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),yt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=vt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),yt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var a=(a=ue.current)?gf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=vt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var o=vt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),o||Nf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=vt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Af(e){return`href="`+Rt(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),yt(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Rt(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Rt(n.href)+`"]`);if(r)return t.instance=r,yt(r),r;var a=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),yt(r),Pd(r,`style`,a),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Af(n.href);var o=e.querySelector(jf(a));if(o)return t.state.loading|=4,t.instance=o,yt(o),o;r=Mf(n),(a=mf.get(a))&&Rf(r,a),o=(e.ownerDocument||e).createElement(`link`),yt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(a=e.querySelector(Ff(o)))?(t.instance=a,yt(a),a):(r=n,(a=mf.get(o))&&(r=h({},n),zf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),yt(a),Pd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Rf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Bf=null;function Vf(e,t,n){if(Bf===null){var r=new Map,i=Bf=new Map;i.set(n,r)}else i=Bf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[pt]||a[ot]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Hf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,yt(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),yt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Kf===0&&(Kf=62500*Ld());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Jf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Qf={$$typeof:C,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function $f(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ye(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ye(0),this.hiddenUpdates=Ye(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ep(e,t,n,r,i,a,o,s,c,l,u,d){return e=new $f(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ci(3,null,null,t),e.current=a,a.stateNode=e,t=ca(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ra(a),e}function tp(e){return e?(e=oi,e):oi}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=Ba(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Va(e,r,t),n!==null&&(mu(n,e,t),Ha(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=ri(e,67108864);t!==null&&mu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=fu();t=tt(t);var n=ri(e,t);n!==null&&mu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=j.T;j.T=null;var a=M.p;try{M.p=2,up(e,t,n,r)}finally{M.p=a,j.T=i}}function lp(e,t,n,r){var i=j.T;j.T=null;var a=M.p;try{M.p=8,up(e,t,n,r)}finally{M.p=a,j.T=i}}function up(e,t,n,r){if(sp){var i=dp(r);if(i===null)Cd(e,t,r,fp,n),Cp(e,r);else if(Tp(i,e,t,n,r))r.stopPropagation();else if(Cp(e,r),t&4&&-1<Sp.indexOf(e)){for(;i!==null;){var a=gt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=R(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-ze(o);s.entanglements[1]|=c,o&=~c}nd(a),!(J&6)&&(eu=De()+500,rd(0,!1))}}break;case 31:case 13:s=ri(a,2),s!==null&&mu(s,a,2),yu(),ip(a,2)}if(a=dp(r),a===null&&Cd(e,t,r,fp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Cd(e,t,r,null,n)}}function dp(e){return e=tn(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=ht(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return fp=e,null}function mp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Oe()){case ke:return 2;case Ae:return 8;case je:case Me:return 32;case Ne:return 268435456;default:return 32}default:return 32}}var hp=!1,gp=null,_p=null,vp=null,yp=new Map,bp=new Map,xp=[],Sp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Cp(e,t){switch(e){case`focusin`:case`focusout`:gp=null;break;case`dragenter`:case`dragleave`:_p=null;break;case`mouseover`:case`mouseout`:vp=null;break;case`pointerover`:case`pointerout`:yp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:bp.delete(t.pointerId)}}function wp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=gt(t),t!==null&&ap(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Tp(e,t,n,r,i){switch(t){case`focusin`:return gp=wp(gp,e,t,n,r,i),!0;case`dragenter`:return _p=wp(_p,e,t,n,r,i),!0;case`mouseover`:return vp=wp(vp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return yp.set(a,wp(yp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,bp.set(a,wp(bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ep(e){var t=ht(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,it(e.priority,function(){op(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,it(e.priority,function(){op(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Dp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);en=r,n.target.dispatchEvent(r),en=null}else return t=gt(n),t!==null&&ap(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Dp(e)&&n.delete(t)}function kp(){hp=!1,gp!==null&&Dp(gp)&&(gp=null),_p!==null&&Dp(_p)&&(_p=null),vp!==null&&Dp(vp)&&(vp=null),yp.forEach(Op),bp.forEach(Op)}function Ap(e,n){e.blockedOn===n&&(e.blockedOn=null,hp||(hp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,kp)))}var jp=null;function Mp(e){jp!==e&&(jp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jp===e&&(jp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(pp(r||n)===null)continue;break}var a=gt(n);a!==null&&(e.splice(t,3),t-=3,bs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Np(e){function t(t){return Ap(t,e)}gp!==null&&Ap(gp,e),_p!==null&&Ap(_p,e),vp!==null&&Ap(vp,e),yp.forEach(t),bp.forEach(t);for(var n=0;n<xp.length;n++){var r=xp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<xp.length&&(n=xp[0],n.blockedOn===null);)Ep(n),n.blockedOn===null&&xp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[st]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[st]||null)s=o.formAction;else if(pp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Mp(n)}}}function Pp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Fp(e){this._internalRoot=e}Ip.prototype.render=Fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;np(n,fu(),e,t,null,null)},Ip.prototype.unmount=Fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;np(e.current,2,null,e,null,null),yu(),t[ct]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=rt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xp.length&&t!==0&&t<xp[n].priority;n++);xp.splice(n,0,e),n===0&&Ep(e)}};var Lp=n.version;if(Lp!==`19.2.8`)throw Error(i(527,Lp,`19.2.8`));M.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=d(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.8`,rendererPackageName:`react-dom`,currentDispatcherRef:j,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{Ie=zp.inject(Rp),Le=zp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Us,s=Ws,c=Gs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=ep(e,1,!1,null,null,n,r,null,o,s,c,Pp),e[ct]=t.current,xd(e),new Fp(t)}})),g=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=h()})),_=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(){}},v=new class extends _{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},y={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},b=new class{#e=y;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function x(e){setTimeout(e,0)}var S=typeof window>`u`||`Deno`in globalThis;function C(){}function w(e,t){return typeof e==`function`?e(t):e}function T(e){return typeof e==`number`&&e>=0&&e!==1/0}function E(e,t){return Math.max(e+(t||0)-Date.now(),0)}function D(e,t){return typeof e==`function`?e(t):e}function O(e,t){return typeof e==`function`?e(t):e}function ee(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==k(o,t.options))return!1}else if(!re(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 te(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(ne(t.options.mutationKey)!==ne(a))return!1}else if(!re(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function k(e,t){return(t?.queryKeyHashFn||ne)(e)}function ne(e){return JSON.stringify(e,(e,t)=>ae(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function re(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!re(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!re(e[r],t[r]))return!1;return!0}return!1}var ie=Object.prototype.hasOwnProperty;function A(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=M(e)&&M(t);if(!r&&!(ae(e)&&ae(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:ie.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=A(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function j(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 M(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ae(e){if(!oe(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!oe(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function oe(e){return Object.prototype.toString.call(e)===`[object Object]`}function se(e){return new Promise(t=>{b.setTimeout(t,e)})}function N(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:A(e,t)}function P(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function F(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ce=Symbol();function le(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ce?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ue(e,t){return typeof e==`function`?e(...t):!!e}function de(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var fe=(()=>{let e=()=>S;return{isServer(){return e()},setIsServer(t){e=t}}})();function pe(){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}var me=x;function he(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=me,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 I=he(),ge=new class extends _{#e=!0;#t;#n;constructor(){super(),this.#n=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(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function _e(e){return Math.min(1e3*2**e,3e4)}function ve(e){return(e??`online`)!==`online`||ge.isOnline()}var ye=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function be(e){let t=!1,n=0,r,i=pe(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new ye(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>v.isFocused()&&(e.networkMode===`always`||ge.isOnline())&&e.canRun(),u=()=>ve(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??(fe.isServer()?0:3),o=e.retryDelay??_e,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),se(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 xe=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),T(this.gcTime)&&(this.#e=b.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(fe.isServer()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(b.clearTimeout(this.#e),this.#e=void 0)}};function Se(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=>{de(e,()=>t.signal,()=>n=!0)},u=le(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=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?F:P;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?we:Ce,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:Ce(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function Ce(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 we(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Te=class extends xe{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Oe(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Oe(this.options);e.data!==void 0&&(this.setState(De(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=N(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(C).catch(C):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>O(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ce||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>D(e.options.staleTime,this)===`static`)}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:!E(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.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:()=>(this.#s=!0,n.signal)})},i=()=>{let e=le(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Se(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=be({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof ye&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof ye){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(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,...Ee(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...De(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=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),I.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Ee(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ve(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function De(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Oe(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 ke=class extends _{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=pe(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),je(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Me(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Me(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof O(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!j(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Ne(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||O(this.options.enabled,this.#t)!==O(t.enabled,this.#t)||D(this.options.staleTime,this.#t)!==D(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||O(this.options.enabled,this.#t)!==O(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Fe(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(C)),t}#g(){this.#b();let e=D(this.options.staleTime,this.#t);if(fe.isServer()||this.#r.isStale||!T(e))return;let t=E(this.#r.dataUpdatedAt,e)+1;this.#d=b.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(fe.isServer()||O(this.options.enabled,this.#t)===!1||!T(this.#p)||this.#p===0)&&(this.#f=b.setInterval(()=>{(this.options.refetchIntervalInBackground||v.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(b.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(b.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&je(e,t),o=i&&Ne(e,n,t,r);(a||o)&&(l={...l,...Ee(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=N(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=N(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Pe(e,t),refetch:this.refetch,promise:this.#o,isEnabled:O(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{let e=this.#o=x.promise=pe();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a()}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!j(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){I.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Ae(e,t){return O(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||O(t.retryOnMount,e)!==!1)}function je(e,t){return Ae(e,t)||e.state.data!==void 0&&Me(e,t,t.refetchOnMount)}function Me(e,t,n){if(O(t.enabled,e)!==!1&&D(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Pe(e,t)}return!1}function Ne(e,t,n,r){return(e!==t||O(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Pe(e,n)}function Pe(e,t){return O(t.enabled,e)!==!1&&e.isStaleByTime(D(t.staleTime,e))}function Fe(e,t){return!j(e.getCurrentResult(),t)}var Ie=class extends xe{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Le(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=be({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.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 this.#n.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 this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(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),I.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Le(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Re=class extends _{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Ie({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=ze(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=ze(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=ze(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=ze(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){I.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>te(t,e))}findAll(e={}){return this.getAll().filter(t=>te(e,t))}notify(e){I.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return I.batch(()=>Promise.all(e.map(e=>e.continue().catch(C))))}};function ze(e){return e.options.scope?.id}var Be=class extends _{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),j(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&ne(t.mutationKey)!==ne(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Le();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){I.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},Ve=class extends _{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??k(r,t),a=this.get(i);return a||(a=new Te({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){I.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>ee(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>ee(e,t)):t}notify(e){I.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){I.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){I.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},He=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Ve,this.#t=e.mutationCache||new Re,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=v.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ge.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(D(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=w(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return I.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;I.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return I.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=I.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(C).catch(C)}invalidateQueries(e,t={}){return I.batch(()=>(this.#e.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=I.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(C)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(C)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(D(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(C).catch(C)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(C).catch(C)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return ge.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(ne(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{re(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(ne(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{re(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=k(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===ce&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Ue=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),We=o(((e,t)=>{t.exports=Ue()})),L=c(u(),1),R=We(),Ge=L.createContext(void 0),Ke=e=>{let t=L.useContext(Ge);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},qe=({client:e,children:t})=>(L.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,R.jsx)(Ge.Provider,{value:e,children:t})),Je=L.createContext(!1),Ye=()=>L.useContext(Je);Je.Provider;function Xe(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ze=L.createContext(Xe()),Qe=()=>L.useContext(Ze),$e=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?ue(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},et=e=>{L.useEffect(()=>{e.clearReset()},[e])},tt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||ue(n,[e.error,r])),nt=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},rt=(e,t)=>e.isLoading&&e.isFetching&&!t,it=(e,t)=>e?.suspense&&t.isPending,at=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ot(e,t,n){let r=Ye(),i=Qe(),a=Ke(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,nt(o),$e(o,i,s),et(i);let l=!a.getQueryCache().get(o.queryHash),[u]=L.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(L.useSyncExternalStore(L.useCallback(e=>{let t=f?u.subscribe(I.batchCalls(e)):C;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),L.useEffect(()=>{u.setOptions(o)},[o,u]),it(o,d))throw at(o,u,i);if(tt({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!fe.isServer()&&rt(d,r)&&(l?at(o,u,i):s?.promise)?.catch(C).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function st(e,t){return ot(e,ke,t)}function ct(e,t){let n=Ke(t),[r]=L.useState(()=>new Be(n,e));L.useEffect(()=>{r.setOptions(e)},[r,e]);let i=L.useSyncExternalStore(L.useCallback(e=>r.subscribe(I.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=L.useCallback((e,t)=>{r.mutate(e,t).catch(C)},[r]);if(i.error&&ue(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var lt=typeof window<`u`?L.useLayoutEffect:L.useEffect;function ut(e){let t=L.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function dt(e,t,n={},r={}){L.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!=`function`)return;let i=new IntersectionObserver(([e])=>{t(e)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,n,r.disabled,e])}function ft(e){let t=L.useRef(null);return L.useImperativeHandle(e,()=>t.current,[]),t}function pt(e){return e[e.length-1]}function mt(e){return typeof e==`function`}function ht(e,t){return mt(e)?e(t):e}var gt=Object.prototype.hasOwnProperty,_t=Object.prototype.propertyIsEnumerable;function vt(e){for(let t in e)if(gt.call(e,t))return!0;return!1}var yt=()=>Object.create(null),bt=(e,t)=>xt(e,t,yt);function xt(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=Tt(e)&&Tt(i);if(!a&&!(Ct(e)&&Ct(i)))return i;let o=a?e:St(e);if(!o)return i;let s=a?i:St(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:gt.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=xt(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function St(e){let t=Object.getOwnPropertyNames(e);for(let n of t)if(!_t.call(e,n))return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;let r=t;for(let t of n){if(!_t.call(e,t))return!1;r.push(t)}return r}function Ct(e){if(!wt(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!wt(n)||!n.hasOwnProperty(`isPrototypeOf`))}function wt(e){return Object.prototype.toString.call(e)===`[object Object]`}function Tt(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Et(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!Et(e[r],t[r],n))return!1;return!0}if(Ct(e)&&Ct(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!Et(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!Et(e[o],t[o],n)))return!1;return i===a}return!1}function Dt(e){let t,n,r=new Promise((e,r)=>{t=e,n=r});return r.status=`pending`,r.resolve=n=>{r.status=`resolved`,r.value=n,t(n),e?.(n)},r.reject=e=>{r.status=`rejected`,n(e)},r}function Ot(e){return!!(e&&typeof e==`object`&&typeof e.then==`function`)}var kt=/[\x00-\x1f\x7f"<>`{}]/g;function At(e){return e.replace(kt,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function jt(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return At(t)}var Mt=[`http:`,`https:`,`mailto:`,`tel:`];function Nt(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Pt(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=jt(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=jt(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function Ft(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function It(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Lt(){throw Error(`Invariant failed`)}function Rt(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var zt=4,Bt=5;function Vt(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);return n===-1||t+1>=e.length?null:[t,n]}function Ht(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=Vt(a);if(o){let[r,s]=o,c=a.charCodeAt(r+1);if(c===45){if(r+2<a.length&&a.charCodeAt(r+2)===36){let e=r+3,a=s;if(e<a)return n[0]=3,n[1]=t+r,n[2]=t+e,n[3]=t+a,n[4]=t+s+1,n[5]=i,n}}else if(c===36){let a=r+1,o=r+2;return o===s?(n[0]=2,n[1]=t+r,n[2]=t+a,n[3]=t+o,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+r,n[2]=t+o,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function Ut(e,t,n,r,i,a,o){o?.(n);let s=r;{let r=n.fullPath??n.from,o=r.length,c=n.options?.caseSensitive??e,l=n.options?.params?.parse??n.options?.parseParams;for(;s<o;){let e=Ht(r,s,t),o,u=s,d=e[5];switch(s=d+1,a++,e[0]){case 0:{let t=r.substring(e[2],e[3]);if(c){let e=i.static?.get(t);if(e)o=e;else{i.static??=new Map;let e=Kt(n.fullPath??n.from);e.parent=i,e.depth=a,o=e,i.static.set(t,e)}}else{let e=t.toLowerCase(),r=i.staticInsensitive?.get(e);if(r)o=r;else{i.staticInsensitive??=new Map;let t=Kt(n.fullPath??n.from);t.parent=i,t.depth=a,o=t,i.staticInsensitive.set(e,t)}}break}case 1:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.dynamic?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=qt(1,n.fullPath??n.from,f,p,m);o=e,e.depth=a,e.parent=i,i.dynamic??=[],i.dynamic.push(e)}break}case 3:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.optional?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=qt(3,n.fullPath??n.from,f,p,m);o=e,e.parent=i,e.depth=a,i.optional??=[],i.optional.push(e)}break}case 2:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),l=c&&!!(t||s),f=t?l?t:t.toLowerCase():void 0,p=s?l?s:s.toLowerCase():void 0,m=qt(2,n.fullPath??n.from,l,f,p);o=m,m.parent=i,m.depth=a,i.wildcard??=[],i.wildcard.push(m)}}i=o}if(l&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=Kt(n.fullPath??n.from);e.kind=Bt,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let u=(n.path||!n.children)&&!n.isRoot;if(u&&r.endsWith(`/`)){let e=Kt(n.fullPath??n.from);e.kind=zt,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=l??null,i.priority=n.options?.params?.priority??0,u&&!i.route&&(i.route=n,i.fullPath=n.fullPath??n.from)}if(n.children)for(let r of n.children)Ut(e,t,r,s,i,a,o)}function Wt(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Gt(e){if(e.pathless)for(let t of e.pathless)Gt(t);if(e.static)for(let t of e.static.values())Gt(t);if(e.staticInsensitive)for(let t of e.staticInsensitive.values())Gt(t);if(e.dynamic?.length){e.dynamic.sort(Wt);for(let t of e.dynamic)Gt(t)}if(e.optional?.length){e.optional.sort(Wt);for(let t of e.optional)Gt(t)}if(e.wildcard?.length){e.wildcard.sort(Wt);for(let t of e.wildcard)Gt(t)}}function Kt(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function qt(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function Jt(e,t){let n=Kt(`/`),r=new Uint16Array(6);for(let t of e)Ut(!1,r,t,1,n,0);Gt(n),t.masksTree=n,t.flatCache=Rt(1e3)}function Yt(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=en(e,t.masksTree);return t.flatCache.set(e,r),r}function Xt(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=Kt(`/`),Ut(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),en(r,o,n)}function Zt(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=en(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=nn(a.route)),t.matchCache.set(r,a),a}function Qt(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function $t(e,t=!1,n){let r=Kt(e.fullPath),i=new Uint16Array(6),a={},o={},s=0;return Ut(t,i,e,1,r,0,e=>{if(n?.(e,s),e.id in a&&Lt(),a[e.id]=e,s!==0&&e.path){let t=Qt(e.fullPath);(!o[t]||e.fullPath.endsWith(`/`))&&(o[t]=e)}s++}),Gt(r),{processedTree:{segmentTree:r,singleCache:Rt(1e3),matchCache:Rt(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:o}}function en(e,t,n=!1){let r=e.split(`/`),i=an(e,r,t,n);if(!i)return null;let[a]=tn(e,r,i);return{route:i.node.route,rawParams:a}}function tn(e,t,n){let r=rn(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===zt)break;if(u.kind===Bt){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0;if(e.charCodeAt(t)===123){let n=u.suffix?.length??0,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0,r=u.suffix?.length??0,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+(t.prefix?.length??0),e.length-(t.suffix?.length??0)),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function nn(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function rn(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function an(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!pt(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,depth:f,statics:p,dynamics:m,optionals:h}=n,{extract:g,rawParams:_}=n;if(i.kind===2&&i.route&&!ln(l,n))continue;if(i.parse){if(!cn(e,t,n))continue;_=n.rawParams,g=n.extract}r&&i.route&&i.kind!==zt&&ln(c,n)&&(c=n);let v=u===o;if(v&&(i.route&&(!a||i.kind===zt||i.kind===2)&&ln(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let y=v?void 0:t[u],b;if(v&&i.index){let n={node:i.index,index:u,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_},r=!0;if(i.index.parse&&(cn(e,t,n)||(r=!1)),r){if(!m&&!h&&!d&&sn(p,o))return n;ln(l,n)&&(l=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!(r&&(v||!(n.caseSensitive?y:b??=y.toLowerCase()).startsWith(r)))){if(a){if(v)continue;let e=t.slice(u).join(`/`).slice(-a.length);if((n.caseSensitive?e:e.toLowerCase())!==a)continue}s.push({node:n,index:o,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}if(i.optional){let e=d|1<<f,t=f+1;for(let n=i.optional.length-1;n>=0;n--){let r=i.optional[n];s.push({node:r,index:u,skipped:e,depth:t,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v)for(let e=i.optional.length-1;e>=0;e--){let n=i.optional[e],{prefix:r,suffix:a}=n;if(r||a){let e=n.caseSensitive?y:b??=y.toLowerCase();if(r&&!e.startsWith(r)||a&&!e.endsWith(a))continue}s.push({node:n,index:u+1,skipped:d,depth:t,statics:p,dynamics:m,optionals:h+on(o,u),extract:g,rawParams:_})}}if(!v&&i.dynamic&&y)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?y:b??=y.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:u+1,skipped:d,depth:f+1,statics:p,dynamics:m+on(o,u),optionals:h,extract:g,rawParams:_})}if(!v&&i.staticInsensitive){let e=i.staticInsensitive.get(b??=y.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+on(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v&&i.static){let e=i.static.get(y);e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+on(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(i.pathless){let e=f+1;for(let t=i.pathless.length-1;t>=0;t--){let n=i.pathless[t];s.push({node:n,index:u,skipped:d,depth:e,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;e<c.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return c.rawParams??=Object.create(null),c.rawParams[`**`]=decodeURIComponent(r),c}return null}function on(e,t){return 2**(e-t-1)}function sn(e,t){return e===2**(t-1)-1}function cn(e,t,n){let r,i;try{[r,i]=tn(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function ln(e,t){return!e||t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===zt)>(e.node.kind===zt)||t.node.kind===zt==(e.node.kind===zt)&&t.depth>e.depth)))}function un(e){return dn(e.filter(e=>e!==void 0).join(`/`))}function dn(e){return e.replace(/\/{2,}/g,`/`)}function fn(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function pn(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function mn(e){return pn(fn(e))}function hn(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function gn(e,t,n){return hn(e,n)===hn(t,n)}function _n({base:e,to:t,trailingSlash:n=`never`,cache:r}){let i=t.startsWith(`/`),a=!i&&t===`.`,o;if(r){o=i?t:a?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(a)s=e.split(`/`);else if(i)s=t.split(`/`);else{for(s=e.split(`/`);s.length>1&&pt(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.pop():r===`.`||s.push(r)}}s.length>1&&(pt(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=dn(s.join(`/`))||`/`;return o&&r&&r.set(o,c),c}function vn(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function yn(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>xn(e,n)).join(`/`):xn(r,n):r}function bn({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=Ht(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0){l+=`/`+e.substring(r,o);continue}if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=yn(`_splat`,t,n);l+=`/`+u+f+d;continue}if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=yn(s,t,n)??`undefined`;l+=`/`+u+f+d;continue}if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=yn(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function xn(e,t){let n=encodeURIComponent(e);return t?.(n)??n}function Sn(e){return e?.isNotFound===!0}function Cn(){try{return sessionStorage}catch{return}}var wn=`tsr-scroll-restoration-v1_3`,Tn=Cn();function En(){try{return JSON.parse(Tn?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function Dn(){try{Tn?.setItem(wn,JSON.stringify(On))}catch{}}var On=En(),kn=`data-scroll-restoration-id`,An=e=>e.state.__TSR_key||e.href;function jn(e){let t=e.getAttribute(kn);if(t)return`[${kn}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var Mn=!1,Nn=`window`;function Pn(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function Fn(e){let t=new Set;for(let n of e){if(n===Nn)continue;let e=Pn(n);e&&t.add(e)}return t}function In(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||An,a=new Set,o=e=>{let t=On[e]||={};for(let e of a)e===document?t[Nn]={scrollX,scrollY}:e.isConnected&&(t[jn(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.restoration&&(r.restoration=!0,Mn=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{Mn||a.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{o(i(e.stores.resolvedLocation.get()??e.stores.location.get())),Dn()})),!r.reset&&(r.reset=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.next,c=r.hash,l;if(a.clear(),r.next=!0,r.hash=!1,typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let u=i(t.toLocation),d=t.fromLocation&&i(t.fromLocation);if(r.restoring&&d&&d!==u){let e=On[d];if(e){let t=On[u];for(let n in e){if(n===Nn){if(s)continue}else{let e=Pn(n);if(!e||s&&o&&(l??=Fn(o),l.has(e)))continue}t||=On[u]={},t[n]??=e[n]}}}Mn=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=Fn(o));let t=e&&i&&c,s=r.restoring?On[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===Nn){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=Pn(e);t&&(t.scrollLeft=r,t.scrollTop=i,l?.delete(t))}}if(!e){let e={top:0,left:0,behavior:n};if(a||scrollTo(e),l)for(let t of l)t.scrollTo(e)}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{Mn=!1}}))}function Ln(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function Rn(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function zn(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=Rn(r):Array.isArray(t)?t.push(Rn(r)):n[e]=[t,Rn(r)]}return n}var Bn=Hn(JSON.parse),Vn=Un(JSON.stringify,JSON.parse);function Hn(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=zn(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function Un(e,t){let n=typeof t==`function`;function r(r){if(typeof r==`object`&&r)try{return e(r)}catch{}else if(n&&typeof r==`string`)try{return t(r),e(r)}catch{}return r}return e=>{let t=Ln(e,r);return t?`?${t}`:``}}var Wn=`__root__`;function Gn(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Kn(e){return e instanceof Response&&!!e.options}function qn(e){return{input:({url:t})=>{for(let n of e)t=Yn(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=Xn(e[n],t);return t}}}function Jn(e){let t=mn(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),i=`${r}/`;return{input:({url:t})=>{let a=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return a===r?t.pathname=`/`:a.startsWith(i)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=un([`/`,t,e.pathname]),e)}}function Yn(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Xn(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Zn(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i,init:a}=t,o=new Map,s=new Map,c=new Map,l=n(e.status),u=n(e.loadedAt),d=n(e.isLoading),f=n(e.isTransitioning),p=n(e.location),m=n(e.resolvedLocation),h=n(e.statusCode),g=n(e.redirect),_=n([]),v=n([]),y=n([]),b=r(()=>Qn(o,_.get())),x=r(()=>Qn(s,v.get())),S=r(()=>Qn(c,y.get())),C=r(()=>_.get()[0]),w=r(()=>_.get().some(e=>o.get(e)?.get().status===`pending`)),T=r(()=>({locationHref:p.get().href,resolvedLocationHref:m.get()?.href,status:l.get()})),E=r(()=>({status:l.get(),loadedAt:u.get(),isLoading:d.get(),isTransitioning:f.get(),matches:b.get(),location:p.get(),resolvedLocation:m.get(),statusCode:h.get(),redirect:g.get()})),D=Rt(64);function O(e){let t=D.get(e);return t||(t=r(()=>{let t=_.get();for(let n of t){let t=o.get(n);if(t&&t.routeId===e)return t.get()}}),D.set(e,t)),t}let ee={status:l,loadedAt:u,isLoading:d,isTransitioning:f,location:p,resolvedLocation:m,statusCode:h,redirect:g,matchesId:_,pendingIds:v,cachedIds:y,matches:b,pendingMatches:x,cachedMatches:S,firstId:C,hasPending:w,matchRouteDeps:T,matchStores:o,pendingMatchStores:s,cachedMatchStores:c,__store:E,getRouteMatchStore:O,setMatches:te,setPending:k,setCached:ne};te(e.matches),a?.(ee);function te(e){$n(e,o,_,n,i)}function k(e){$n(e,s,v,n,i)}function ne(e){$n(e,c,y,n,i)}return ee}function Qn(e,t){let n=[];for(let r of t){let t=e.get(r);t&&n.push(t.get())}return n}function $n(e,t,n,r,i){let a=e.map(e=>e.id),o=new Set(a);i(()=>{for(let e of t.keys())o.has(e)||t.delete(e);for(let n of e){let e=t.get(n.id);if(!e){let e=r(n);e.routeId=n.routeId,t.set(n.id,e);continue}e.routeId=n.routeId,e.get()!==n&&e.set(n)}It(n.get(),a)||n.set(a)})}var er=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},tr=e=>e.stores.matchesId.get().some(t=>e.stores.matchStores.get(t)?.get()._forcePending),nr=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),rr=(e,t,n=!0)=>{let r={...e.router.options.context??{}},i=n?t:t-1;for(let t=0;t<=i;t++){let n=e.matches[t];if(!n)continue;let i=e.router.getMatch(n.id);i&&Object.assign(r,i.__routeContext,i.__beforeLoadContext)}return r},ir=(e,t)=>{if(!e.matches.length)return;let n=t.routeId,r=e.matches.findIndex(t=>t.routeId===e.router.routeTree.id),i=r>=0?r:0,a=n?e.matches.findIndex(e=>e.routeId===n):e.firstBadMatchIndex??e.matches.length-1;a<0&&(a=i);for(let t=a;t>=0;t--){let n=e.matches[t];if(e.router.looseRoutesById[n.routeId].options.notFoundComponent)return t}return n?a:i},ar=(e,t,n)=>{if(!(!Kn(n)&&!Sn(n)))throw Kn(n)&&n.redirectHandled&&!n.options.reloadDocument?n:(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,r=>({...r,status:Kn(n)?`redirected`:Sn(n)?`notFound`:r.status===`pending`?`success`:r.status,context:rr(e,t.index),isFetching:!1,error:n})),Sn(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),Kn(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n)),n)},or=(e,t)=>{let n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},sr=(e,t,n)=>{let r=rr(e,n);e.updateMatch(t,e=>({...e,context:r}))},cr=(e,t,n)=>{let{id:r,routeId:i}=e.matches[t],a=e.router.looseRoutesById[i];if(n instanceof Promise)throw n;e.firstBadMatchIndex??=t,ar(e,e.router.getMatch(r),n);try{a.options.onError?.(n)}catch(t){n=t,ar(e,e.router.getMatch(r),n)}e.updateMatch(r,e=>(e._nonReactive.beforeLoadPromise?.resolve(),e._nonReactive.beforeLoadPromise=void 0,e._nonReactive.loadPromise?.resolve(),{...e,error:n,status:`error`,isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!Kn(n)&&!Sn(n)&&(e.serialError??=n)},lr=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;let i=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!nr(e,t)&&(n.options.loader||n.options.beforeLoad||br(n))&&typeof i==`number`&&i!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){let t=setTimeout(()=>{er(e)},i);r._nonReactive.pendingTimeout=t}},ur=(e,t,n)=>{let r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;lr(e,t,n,r);let i=()=>{let n=e.router.getMatch(t);n.preload&&(n.status===`redirected`||n.status===`notFound`)&&ar(e,n,n.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(i):i()},dr=(e,t,n,r)=>{let i=e.router.getMatch(t),a=i._nonReactive.loadPromise;i._nonReactive.loadPromise=Dt(()=>{a?.resolve(),a=void 0});let{paramsError:o,searchError:s}=i;o&&cr(e,n,o),s&&cr(e,n,s),lr(e,t,r,i);let c=new AbortController,l=!1,u=()=>{l||(l=!0,e.updateMatch(t,e=>({...e,isFetching:`beforeLoad`,fetchCount:e.fetchCount+1,abortController:c})))},d=()=>{i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,e=>({...e,isFetching:!1}))};if(!r.options.beforeLoad){e.router.batch(()=>{u(),d()});return}i._nonReactive.beforeLoadPromise=Dt();let f={...rr(e,n,!1),...i.__routeContext},{search:p,params:m,cause:h}=i,g=nr(e,t),_={search:p,abortController:c,params:m,preload:g,context:f,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:g?`preload`:h,matches:e.matches,routeId:r.id,...e.router.options.additionalContext},v=r=>{if(r===void 0){e.router.batch(()=>{u(),d()});return}(Kn(r)||Sn(r))&&(u(),cr(e,n,r)),e.router.batch(()=>{u(),e.updateMatch(t,e=>({...e,__beforeLoadContext:r})),d()})},y;try{if(y=r.options.beforeLoad(_),Ot(y))return u(),y.catch(t=>{cr(e,n,t)}).then(v)}catch(t){u(),cr(e,n,t)}v(y)},fr=(e,t)=>{let{id:n,routeId:r}=e.matches[t],i=e.router.looseRoutesById[r],a=()=>s(),o=()=>dr(e,n,t,i),s=()=>{if(or(e,n))return;let t=ur(e,n,i);return Ot(t)?t.then(o):o()};return a()},pr=(e,t,n)=>{let r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;let i={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(i),n.options.scripts?.(i),n.options.headers?.(i)]).then(([e,t,n])=>({meta:e?.meta,links:e?.links,headScripts:e?.scripts,headers:n,scripts:t,styles:e?.styles}))},mr=(e,t,n,r,i)=>{let a=t[r-1],{params:o,loaderDeps:s,abortController:c,cause:l}=e.router.getMatch(n),u=rr(e,r),d=nr(e,n);return{params:o,deps:s,preload:!!d,parentMatchPromise:a,abortController:c,context:u,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),cause:d?`preload`:l,route:i,...e.router.options.additionalContext}},hr=async(e,t,n,r,i)=>{try{let a=e.router.getMatch(n);try{yr(i);let o=i.options.loader,s=typeof o==`function`?o:o?.handler,c=s?.(mr(e,t,n,r,i)),l=!!s&&Ot(c);if((l||i._lazyPromise||i._componentsPromise||i.options.head||i.options.scripts||i.options.headers||a._nonReactive.minPendingPromise)&&e.updateMatch(n,e=>({...e,isFetching:`loader`})),s){let t=l?await c:c;ar(e,e.router.getMatch(n),t),t!==void 0&&e.updateMatch(n,e=>({...e,loaderData:t}))}i._lazyPromise&&await i._lazyPromise;let u=a._nonReactive.minPendingPromise;u&&await u,i._componentsPromise&&await i._componentsPromise,e.updateMatch(n,t=>({...t,error:void 0,context:rr(e,r),status:`success`,isFetching:!1,updatedAt:Date.now()}))}catch(t){let o=t;if(o?.name===`AbortError`){if(a.abortController.signal.aborted){a._nonReactive.loaderPromise?.resolve(),a._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,t=>({...t,status:t.status===`pending`?`success`:t.status,isFetching:!1,context:rr(e,r)}));return}let s=a._nonReactive.minPendingPromise;s&&await s,Sn(t)&&await i.options.notFoundComponent?.preload?.(),ar(e,e.router.getMatch(n),t);try{i.options.onError?.(t)}catch(t){o=t,ar(e,e.router.getMatch(n),t)}!Kn(o)&&!Sn(o)&&await yr(i,[`errorComponent`]),e.updateMatch(n,t=>({...t,error:o,context:rr(e,r),status:`error`,isFetching:!1}))}}catch(t){let r=e.router.getMatch(n);r&&(r._nonReactive.loaderPromise=void 0),ar(e,r,t)}},gr=async(e,t,n)=>{async function r(r,a,c,l,d){let f=Date.now()-a.updatedAt,p=r?d.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:d.options.staleTime??e.router.options.defaultStaleTime??0,m=d.options.shouldReload,h=typeof m==`function`?m(mr(e,t,i,n,d)):m,{status:g,invalid:_}=l,v=f>=p&&(!!e.forceStaleReload||l.cause===`enter`||c!==void 0&&c!==l.id);o=g===`success`&&(_||(h??v)),r&&d.options.preload===!1||(o&&!e.sync&&u?(s=!0,(async()=>{try{await hr(e,t,i,n,d);let r=e.router.getMatch(i);r._nonReactive.loaderPromise?.resolve(),r._nonReactive.loadPromise?.resolve(),r._nonReactive.loaderPromise=void 0,r._nonReactive.loadPromise=void 0}catch(t){Kn(t)&&await e.router.navigate(t.options)}})()):g!==`success`||o?await hr(e,t,i,n,d):sr(e,i,n))}let{id:i,routeId:a}=e.matches[n],o=!1,s=!1,c=e.router.looseRoutesById[a],l=c.options.loader,u=((typeof l==`function`?void 0:l?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!==`blocking`;if(or(e,i)){if(!e.router.getMatch(i))return e.matches[n];sr(e,i,n)}else{let t=e.router.getMatch(i),o=e.router.stores.matchesId.get()[n],s=(o&&e.router.stores.matchStores.get(o)||null)?.routeId===a?o:e.router.stores.matches.get().find(e=>e.routeId===a)?.id,l=nr(e,i);if(t._nonReactive.loaderPromise){if(t.status===`success`&&!e.sync&&!t.preload&&u)return t;await t._nonReactive.loaderPromise;let n=e.router.getMatch(i),a=n._nonReactive.error||n.error;a&&ar(e,n,a),n.status===`pending`&&await r(l,t,s,n,c)}else{let n=l&&!e.router.stores.matchStores.has(i),a=e.router.getMatch(i);a._nonReactive.loaderPromise=Dt(),n!==a.preload&&e.updateMatch(i,e=>({...e,preload:n})),await r(l,t,s,a,c)}}let d=e.router.getMatch(i);s||(d._nonReactive.loaderPromise?.resolve(),d._nonReactive.loadPromise?.resolve(),d._nonReactive.loadPromise=void 0),clearTimeout(d._nonReactive.pendingTimeout),d._nonReactive.pendingTimeout=void 0,s||(d._nonReactive.loaderPromise=void 0),d._nonReactive.dehydrated=void 0;let f=s?d.isFetching:!1;return f!==d.isFetching||d.invalid!==!1?(e.updateMatch(i,e=>({...e,isFetching:f,invalid:!1})),e.router.getMatch(i)):d};async function _r(e){let t=e,n=[];tr(t.router)&&er(t);let r;for(let e=0;e<t.matches.length;e++){try{let n=fr(t,e);Ot(n)&&await n}catch(e){if(Kn(e))throw e;if(Sn(e))r=e;else if(!t.preload)throw e;break}if(t.serialError||t.firstBadMatchIndex!=null)break}let i=t.firstBadMatchIndex??t.matches.length,a=r&&!t.preload?ir(t,r):void 0,o=r&&t.preload?0:a===void 0?i:Math.min(a+1,i),s,c;for(let e=0;e<o;e++)n.push(gr(t,n,e));try{await Promise.all(n)}catch{let e=await Promise.allSettled(n);for(let t of e){if(t.status!==`rejected`)continue;let e=t.reason;if(Kn(e))throw e;Sn(e)?s??=e:c??=e}if(c!==void 0)throw c}let l=s??(r&&!t.preload?r:void 0),u=t.firstBadMatchIndex===void 0?t.matches.length-1:t.firstBadMatchIndex;if(!l&&r&&t.preload)return t.matches;if(l){let e=ir(t,l);e===void 0&&Lt();let n=t.matches[e],r=t.router.looseRoutesById[n.routeId],i=t.router.options?.defaultNotFoundComponent;!r.options.notFoundComponent&&i&&(r.options.notFoundComponent=i),l.routeId=n.routeId;let a=n.routeId===t.router.routeTree.id;t.updateMatch(n.id,e=>({...e,...a?{status:`success`,globalNotFound:!0,error:void 0}:{status:`notFound`,error:l},isFetching:!1})),u=e,await yr(r,[`notFoundComponent`])}else if(!t.preload){let e=t.matches[0];e.globalNotFound||t.router.getMatch(e.id)?.globalNotFound&&t.updateMatch(e.id,e=>({...e,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){let e=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await yr(e,[`errorComponent`])}for(let e=0;e<=u;e++){let{id:n,routeId:r}=t.matches[e],i=t.router.looseRoutesById[r];try{let e=pr(t,n,i);if(e){let r=await e;t.updateMatch(n,e=>({...e,...r}))}}catch(e){console.error(`Error executing head for route ${r}:`,e)}}let d=er(t);if(Ot(d)&&await d,l)throw l;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function vr(e,t){let n=t.map(t=>e.options[t]?.preload?.()).filter(Boolean);if(n.length!==0)return Promise.all(n)}function yr(e,t=xr){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);let n=()=>e._componentsLoaded?void 0:t===xr?(()=>{if(e._componentsPromise===void 0){let t=vr(e,xr);t?e._componentsPromise=t.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():vr(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function br(e){for(let t of xr)if(e.options[t]?.preload)return!0;return!1}var xr=[`component`,`errorComponent`,`pendingComponent`,`notFoundComponent`],Sr=`__TSR_index`,Cr=`popstate`,wr=`beforeunload`;function Tr(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=kr(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[Sr];i=Er(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[Sr];i=Er(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[Sr]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function Er(e,t){t||={};let n=Ar();return{...t,key:n,__TSR_key:n,[Sr]:e}}function Dr(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>kr(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=Ar();t.history.replaceState({[Sr]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_,v=()=>{g&&(C._ignoreSubscribers=!0,(g.isPush?t.history.pushState:t.history.replaceState)(g.state,``,g.href),C._ignoreSubscribers=!1,g=void 0,_=void 0,u=void 0)},y=(e,t,n)=>{let r=s(t);_||(u=l),l=kr(t,n),g={href:r,state:n,isPush:g?.isPush||e===`push`},_||=Promise.resolve().then(()=>v())},b=e=>{l=c(),C.notify({type:e})},x=async()=>{if(f){f=!1;return}let e=c(),n=e.state[Sr]-l.state[Sr],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),C.notify(u);return}}}l=c(),C.notify(u)},S=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},C=Tr({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>y(`push`,e,t),replaceState:(e,t)=>y(`replace`,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:v,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(wr,S,{capture:!0}),t.removeEventListener(Cr,x)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(wr,S,{capture:!0}),t.addEventListener(Cr,x),t.history.pushState=function(...e){let r=n.apply(t.history,e);return C._ignoreSubscribers||b(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return C._ignoreSubscribers||b(`REPLACE`),n},C}function Or(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function kr(e,t){let n=Or(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=Ar();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[Sr]:0,key:a,__TSR_key:a}}}function Ar(){return(Math.random()+1).toString(36).substring(7)}function jr(e,t){let n=t,r=e;return{fromLocation:n,toLocation:r,pathChanged:n?.pathname!==r.pathname,hrefChanged:n?.href!==r.href,hashChanged:n?.hash!==r.hash}}var Mr=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=e=>e(),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=vn(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:Dr()),this.origin=this.options.origin,this.origin||=window?.origin&&window.origin!==`null`?window.origin:`http://localhost`,this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=Rt(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=Zn(Fr(this.latestLocation),e),In(this)}let a=!1,o=this.options.basepath??`/`,s=this.options.rewrite;if(r||n!==o||i!==s){this.basepath=o;let e=[],t=mn(o);t&&t!==`/`&&e.push(Jn({basepath:o})),s&&e.push(s),this.rewrite=e.length===0?void 0:e.length===1?e[0]:qn(e),this.history&&this.updateLatestLocation(),a=!0}a&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<`u`&&`CSS`in window&&typeof window.CSS?.supports==`function`&&(this.isViewTransitionTypesSupported=window.CSS.supports(`selector(:active-view-transition-type(a))`))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=$t(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&Jt(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{this.subscribers.forEach(t=>{t.eventType===e.type&&t.fn(e)})},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i,state:a})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:Pt(e).path,external:!1,searchStr:o,search:bt(t?.search,i),hash:Pt(r.slice(1)).path,state:xt(t?.state,a)}}let o=new URL(i,this.origin),s=Yn(this.rewrite,o),c=this.options.parseSearch(s.search),l=this.options.stringifySearch(c);return s.search=l,{href:s.href.replace(s.origin,``),publicHref:i,pathname:Pt(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:bt(t?.search,c),hash:Pt(s.hash.slice(1)).path,state:xt(t?.state,a)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>_n({base:e,to:t.includes(`//`)?dn(t):t,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>Lr({pathname:e,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=e=>{let t=this.getMatch(e);t&&(t.abortController.abort(),clearTimeout(t._nonReactive.pendingTimeout),t._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(e=>{this.cancelMatch(e)}),this.stores.matchesId.get().forEach(e=>{if(this.stores.pendingMatchStores.has(e))return;let t=this.stores.matchStores.get(e)?.get();t&&(t.status===`pending`||t.isFetching===`loader`)&&this.cancelMatch(e)})},this.buildLocation=e=>{let t=(t={})=>{let n=t._fromLocation||this.pendingBuiltLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r.fullPath,a=t.to?`${t.to}`:void 0,o=r.search,s=Object.assign(Object.create(null),r.params),c=a?.charCodeAt(0)===47?`/`:this.resolvePathWithBase(i,`.`),l=a?this.resolvePathWithBase(c,a):c,u=t.params===!1||t.params===null?Object.create(null):(t.params??!0)===!0?s:Object.assign(s,ht(t.params,s)),d=this.routesByPath[pn(l)],f;if(d)f=this.getRouteBranch(d);else if(l.includes(`$`))f=[];else{let e=this.getMatchedRoutes(l);f=e.matchedRoutes,this.options.notFoundRoute&&(!e.foundRoute||e.foundRoute.path!==`/`&&e.routeParams[`**`])&&(f=[...f,this.options.notFoundRoute])}if(f.length&&vt(u))for(let e of f){let t=e.options.params?.stringify??e.options.stringifyParams;if(t)try{Object.assign(u,t(u))}catch{}}let p=e.leaveParams?l:Pt(bn({path:l,params:u,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,m=o;if(e._includeValidateSearch&&this.options.search?.strict){let e={};f.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,Ir(t.options.validateSearch,{...e,...m}))}catch{}}),m=e}m=Rr({search:m,dest:t,destRoutes:f,_includeValidateSearch:e._includeValidateSearch}),m=bt(o,m);let h=this.options.stringifySearch(m),g=t.hash===!0?n.hash:t.hash?ht(t.hash,n.hash):void 0,_=g?`#${g}`:``,v=t.state===!0?n.state:t.state?ht(t.state,n.state):{};v=xt(n.state,v);let y=`${p}${h}${_}`,b,x,S=!1;if(this.rewrite){let e=new URL(y,this.origin),t=Xn(this.rewrite,e);b=e.href.replace(e.origin,``),t.origin===this.origin?x=t.pathname+t.search+t.hash:(x=t.href,S=!0)}else b=Ft(y),x=b;return{publicHref:x,href:b,pathname:p,search:m,searchStr:h,state:v,hash:g??``,external:S,unmaskOnReload:t.unmaskOnReload}},n=(n={},r)=>{let i=t(n),a=r?t(r):void 0;if(!a){let n=Object.create(null);if(this.options.routeMasks){let o=Yt(i.pathname,this.processedTree);if(o){Object.assign(n,o.rawParams);let{from:i,params:s,...c}=o.route,l=s===!1||s===null?Object.create(null):(s??!0)===!0?n:Object.assign(n,ht(s,n));r={from:e.from,...c,params:l},a=t(r)}}}return a&&(i.maskedLocation=a),i};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r,i=()=>{let e=[`key`,`__TSR_key`,`__TSR_index`,`__hashScrollIntoViewOptions`];e.forEach(e=>{n.state[e]=this.latestLocation.state[e]});let t=Et(n.state,this.latestLocation.state);return e.forEach(e=>{delete n.state[e]}),t},a=pn(this.latestLocation.href)===pn(n.href),o=this.commitLocationPromise;if(this.commitLocationPromise=Dt(()=>{o?.resolve(),o=void 0}),a&&i())this.load();else{let{maskedLocation:i,hashScrollIntoView:a,...o}=n;i&&(o={...i,state:{...i.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state.__hashScrollIntoViewOptions=a??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,r=n.replace?`REPLACE`:`PUSH`,this.history[r===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t})}return this._scroll.next=n.resetScroll??!0,this.history.subscribers.size||this.load(r?{action:{type:r}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,href:a,...o}={})=>{if(a){let t=this.history.location.state.__TSR_index,n=kr(a,{__TSR_index:e?t:t+1}),r=new URL(n.pathname,this.origin);o.to=Yn(this.rewrite,r).pathname,o.search=this.options.parseSearch(n.search),o.hash=n.hash.slice(1)}let s=this.buildLocation({...o,_includeValidateSearch:!0});this.pendingBuiltLocation=s;let c=this.commitLocation({...s,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this.pendingBuiltLocation===s&&(this.pendingBuiltLocation=void 0)}),c},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(Nt(t,this.protocolAllowlist))return;if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return}i.replace?window.location.replace(t):window.location.href=t;return}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();let e=this.matchRoutes(this.latestLocation),t=this.stores.cachedMatches.get().filter(t=>!e.some(e=>e.id===t.id));this.batch(()=>{this.stores.status.set(`pending`),this.stores.statusCode.set(200),this.stores.isLoading.set(!0),this.stores.location.set(this.latestLocation),this.stores.setPending(e),this.stores.setCached(t)})},this.load=async e=>{let t=e?.action?.type,n,r,i,a=this.stores.resolvedLocation.get()??this.stores.location.get();for(i=new Promise(o=>{this.startTransition(async()=>{try{this.beforeLoad(),t&&(this._scroll.hash=t===`PUSH`||t===`REPLACE`);let n=this.latestLocation,r=jr(n,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:`onBeforeNavigate`,...r}),this.emit({type:`onBeforeLoad`,...r}),await _r({router:this,sync:e?.sync,forceStaleReload:a.href===n.href,matches:this.stores.pendingMatches.get(),location:n,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let e=null,t=null,n=null,r=null;this.batch(()=>{let i=this.stores.pendingMatches.get(),a=i.length,o=this.stores.matches.get();e=a?o.filter(e=>!this.stores.pendingMatchStores.has(e.id)):null;let s=new Set;for(let e of this.stores.pendingMatchStores.values())e.routeId&&s.add(e.routeId);let c=new Set;for(let e of this.stores.matchStores.values())e.routeId&&c.add(e.routeId);t=a?o.filter(e=>!s.has(e.routeId)):null,n=a?i.filter(e=>!c.has(e.routeId)):null,r=a?i.filter(e=>c.has(e.routeId)):o,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),a&&(this.stores.setMatches(i),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...e.filter(e=>e.status!==`error`&&e.status!==`notFound`&&e.status!==`redirected`)]),this.clearExpiredCache())});for(let[e,i]of[[t,`onLeave`],[n,`onEnter`],[r,`onStay`]])if(e)for(let t of e)this.looseRoutesById[t.routeId].options[i]?.(t)})})}})}catch(e){Kn(e)?(n=e,this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):Sn(e)&&(r=e);let t=n?n.status:r?404:this.stores.matches.get().some(e=>e.status===`error`)?500:200;this.batch(()=>{this.stores.statusCode.set(t),this.stores.redirect.set(n)})}this.latestLoadPromise===i&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),o()})}),this.latestLoadPromise=i,await i;this.latestLoadPromise&&i!==this.latestLoadPromise;)await this.latestLoadPromise;let o;this.hasNotFoundMatch()?o=404:this.stores.matches.get().some(e=>e.status===`error`)&&(o=500),o!==void 0&&this.stores.statusCode.set(o)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document<`u`&&`startViewTransition`in document&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&this.isViewTransitionTypesSupported){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(jr(r,i)):t.types;if(a===!1){e();return}n={update:e,types:a}}else n=e;document.startViewTransition(n)}else e()},this.updateMatch=(e,t)=>{this.startTransition(()=>{let n=this.stores.pendingMatchStores.get(e);if(n){n.set(t);return}let r=this.stores.matchStores.get(e);if(r){r.set(t);return}let i=this.stores.cachedMatchStores.get(e);if(i){let n=t(i.get());n.status===`redirected`?this.stores.cachedMatchStores.delete(e)&&this.stores.cachedIds.set(t=>t.filter(t=>t!==e)):i.set(n)}})},this.getMatch=e=>this.stores.cachedMatchStores.get(e)?.get()??this.stores.pendingMatchStores.get(e)?.get()??this.stores.matchStores.get(e)?.get(),this.invalidate=e=>{let t=t=>e?.filter?.(t)??!0?{...t,invalid:!0,...e?.forcePending||t.status===`error`||t.status===`notFound`?{status:`pending`,error:void 0}:void 0}:t;return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(t)),this.stores.setCached(this.stores.cachedMatches.get().map(t)),this.stores.setPending(this.stores.pendingMatches.get().map(t))}),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.getParsedLocationHref=e=>e.publicHref||`/`,this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href||e.options._builtLocation){let t=e.options._builtLocation??this.buildLocation(e.options),n=this.getParsedLocationHref(t);e.options.href=n,e.headers.set(`Location`,n)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&!e.options._builtLocation&&Nt(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=e?.filter;t===void 0?this.stores.setCached([]):this.stores.setCached(this.stores.cachedMatches.get().filter(e=>!t(e)))},this.clearExpiredCache=()=>{let e=Date.now();this.clearCache({filter:t=>{let n=this.looseRoutesById[t.routeId];if(!n.options.loader)return!0;let r=(t.preload?n.options.preloadGcTime??this.options.defaultPreloadGcTime:n.options.gcTime??this.options.defaultGcTime)??3e5;return t.status===`error`||e-t.updatedAt>=r}})},this.loadRouteChunk=yr,this.preloadRoute=async e=>{let t=e._builtLocation??this.buildLocation(e),n=this.matchRoutes(t,{throwOnError:!0,preload:!0,dest:e}),r=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),i=new Set([...r,...this.stores.cachedIds.get()]),a=n.filter(e=>!i.has(e.id));if(a.length){let e=this.stores.cachedMatches.get();this.stores.setCached([...e,...a])}try{return n=await _r({router:this,matches:n,location:t,preload:!0,updateMatch:(e,t)=>{r.has(e)?n=n.map(n=>n.id===e?t(n):n):this.updateMatch(e,t)}}),n}catch(e){if(Kn(e))return e.options.reloadDocument?void 0:await this.preloadRoute({...e.options,_fromLocation:t});Sn(e)||console.error(e);return}},this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n);if(t?.pending&&this.stores.status.get()!==`pending`)return!1;let i=(t?.pending===void 0?!this.stores.isLoading.get():t.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),a=Xt(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,i.pathname,this.processedTree);return!a||e.params&&!Et(a.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?Et(i.search,r.search,{partial:!0})?a.rawParams:!1:a.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(e=>e.status===`notFound`||e.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??Vn,parseSearch:e.parseSearch??Bn,protocolAllowlist:e.protocolAllowlist??Mt}),typeof document<`u`&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=nn(e),this.routeBranchCache.set(e,t)),t}get looseRoutesById(){return this.routesById}getParentContext(e){return e?.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){let n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:i}=n,{matchedRoutes:a}=n,o=!1;(r?r.path!==`/`&&i[`**`]:pn(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?Br(this.options.notFoundMode,a):void 0,c=Array(a.length),l=new Map;for(let e of this.stores.matchStores.values())e.routeId&&l.set(e.routeId,e.get());for(let n=0;n<a.length;n++){let r=a[n],o=c[n-1],u,d,f;{let n=o?.search??e.search,i=o?._strictSearch??void 0;try{let e=Ir(r.options.validateSearch,{...n})??void 0;u={...n,...e},d={...i,...e},f=void 0}catch(e){let r=e;if(e instanceof Nr||(r=new Nr(e.message,{cause:e})),t?.throwOnError)throw r;u=n,d={},f=r}}let p=r.options.loaderDeps?.({search:u})??``,m=p?JSON.stringify(p):``,{interpolatedPath:h,usedParams:g}=bn({path:r.fullPath,params:i,decoder:this.pathParamsDecoder,server:this.isServer}),_=r.id+h+m,v=this.getMatch(_),y=l.get(r.id),b=v?._strictParams??g,x;if(!v)try{Vr(r,b)}catch(e){if(x=Sn(e)||Kn(e)?e:new Pr(e.message,{cause:e}),t?.throwOnError)throw x}Object.assign(i,b);let S=y?`stay`:`enter`,C;if(v)C={...v,cause:S,params:y?.params??i,_strictParams:b,search:bt(y?y.search:v.search,u),_strictSearch:d};else{let e=r.options.loader||r.options.beforeLoad||r.lazyFn||br(r)?`pending`:`success`;C={id:_,ssr:r.options.ssr,index:n,routeId:r.id,params:y?.params??i,_strictParams:b,pathname:h,updatedAt:Date.now(),search:y?bt(y.search,u):u,_strictSearch:d,searchError:void 0,status:e,isFetching:!1,error:void 0,paramsError:x,__routeContext:void 0,_nonReactive:{loadPromise:Dt()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:S,loaderDeps:y?xt(y.loaderDeps,p):p,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:r.options.staticData||{},fullPath:r.fullPath}}t?.preload||(C.globalNotFound=s===r.id),C.searchError=f;let w=this.getParentContext(o);C.context={...w,...C.__routeContext,...C.__beforeLoadContext},c[n]=C}for(let t=0;t<c.length;t++){let n=c[t],r=this.looseRoutesById[n.routeId],a=this.getMatch(n.id),o=l.get(n.routeId);if(n.params=o?bt(o.params,i):i,!a){let i=c[t-1],a=this.getParentContext(i);if(r.options.context){let t={deps:n.loaderDeps,params:n.params,context:a??{},location:e,navigate:t=>this.navigate({...t,_fromLocation:e}),buildLocation:this.buildLocation,cause:n.cause,abortController:n.abortController,preload:!!n.preload,matches:c,routeId:r.id};n.__routeContext=r.options.context(t)??void 0}n.context={...a,...n.__routeContext,...n.__beforeLoadContext}}}return c}matchRoutesLightweight(e){let t=pt(this.stores.matchesId.get()),n=this.lightweightCache.get(e);if(n&&n[0]===t)return n[1];let{matchedRoutes:r,routeParams:i}=this.getMatchedRoutes(e.pathname),a=pt(r),o={...e.search};for(let e of r)try{Object.assign(o,Ir(e.options.validateSearch,o))}catch{}let s=t&&this.stores.matchStores.get(t)?.get(),c=s&&s.routeId===a.id&&s.pathname===e.pathname,l;if(c)l=s.params;else{let e=Object.assign(Object.create(null),i);for(let t of r)try{Vr(t,e)}catch{}l=e}let u={matchedRoutes:r,fullPath:a.fullPath,search:o,params:l};return this.lightweightCache.set(e,[t,u]),u}},Nr=class extends Error{},Pr=class extends Error{};function Fr(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:`idle`,resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function Ir(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new Nr(`Async validation not supported`);if(n.issues)throw new Nr(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function Lr({pathname:e,routesById:t,processedTree:n}){let r=Object.create(null),i=pn(e),a,o=Zt(i,n,!0);return o&&(a=o.route,Object.assign(r,o.rawParams)),{matchedRoutes:o?.branch||[t.__root__],routeParams:r,foundRoute:a}}function Rr({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){return zr(n)(e,t,r??!1)}function zr(e){let t,n,r=[];for(let t of e){let e=t.options;`search`in e?e.search?.middlewares&&r.push(...e.search.middlewares):(e.preSearchFilters||e.postSearchFilters)&&r.push(({search:t,next:n})=>{let r=n(e.preSearchFilters?e.preSearchFilters.reduce((e,t)=>t(e),t):t);return e.postSearchFilters?e.postSearchFilters.reduce((e,t)=>t(e),r):r});let i=e.validateSearch;i&&r.push(({search:e,next:t,meta:r})=>{let a=t(e);if(n)try{let e=Ir(i,a);if(r&&e)for(let t in e)t in a||(r.defaulted||=new Map).set(t,e[t]);return{...a,...e}}catch{}return a})}let i=(e,n,a)=>{if(e>=r.length){if(!t.search)return{};if(t.search===!0)return n;let e=ht(t.search,n);return a&&(a.explicit=e),e}return r[e]({search:n,next:(t,n)=>{if(n){let n=a||{};return{search:i(e+1,t,n),meta:n}}return i(e+1,t,a)},meta:a})};return function(e,r,a){return t=r,n=a,i(0,e)}}function Br(e,t){if(e!==`root`)for(let e=t.length-1;e>=0;e--){let n=t[e];if(n.children)return n.id}return Wn}function Vr(e,t){let n=e.options.params?.parse??e.options.parseParams;if(n){let e=n(t);if(e===!1)throw Error(`Route params.parse returned false for a matched route`);Object.assign(t,e)}}var Hr=`Error preloading route! ☝️`,Ur=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Wn:this.parentRoute||Lt();let r=n?Wn:t?.path;r&&r!==`/`&&(r=fn(r));let i=t?.id||r,a=n?Wn:un([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=un([`/`,a]));let o=a===`__root__`?`/`:un([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=pn(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>Gn({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},Wr=class extends Ur{constructor(e){super(e)}};function Gr(e){let t=e.errorComponent??qr;return(0,R.jsx)(Kr,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?L.createElement(t,{error:n,reset:r}):e.children})}var Kr=class extends L.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function qr({error:e}){let[t,n]=L.useState(!1);return(0,R.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,R.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,R.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,R.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,R.jsx)(`div`,{children:(0,R.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,R.jsx)(`code`,{children:e.message}):null})}):null]})}function Jr({children:e,fallback:t=null}){return Yr()?(0,R.jsx)(L.Fragment,{children:e}):(0,R.jsx)(L.Fragment,{children:t})}function Yr(){return L.useSyncExternalStore(Xr,()=>!0,()=>!1)}function Xr(){return()=>{}}var Zr=L.createContext(null);function Qr(e){return L.useContext(Zr)}var $r=L.createContext(void 0),ei=L.createContext(void 0),ti=(e=>(e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e))(ti||{});function ni({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function ri(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var ii=[],ai=0,{link:oi,unlink:si,propagate:ci,checkDirty:li,shallowPropagate:ui}=ni({update(e){return e._update()},notify(e){ii[fi++]=e,e.flags&=~ti.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=ti.Mutable|ti.Dirty,gi(e))}}),di=0,fi=0,pi,mi=0;function hi(e){try{++mi,e()}finally{--mi||_i()}}function gi(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=si(n,e)}function _i(){if(!(mi>0)){for(;di<fi;){let e=ii[di];ii[di++]=void 0,e.notify()}di=0,fi=0}}function vi(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?ti.None:ti.Mutable,get(){return pi!==void 0&&oi(i,pi,ai),i._snapshot},subscribe(e){let t=ri(e),n={current:!1},r=yi(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=pi,o=t?.compare??Object.is;if(n)pi=i,++ai,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=ti.Mutable|ti.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{pi=a,n&&(i.flags&=~ti.RecursedCheck),gi(i)}}};return n?(i.flags=ti.Mutable|ti.Dirty,i.get=function(){let e=i.flags;if(e&ti.Dirty||e&ti.Pending&&li(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&ui(e)}}else e&ti.Pending&&(i.flags=e&~ti.Pending);return pi!==void 0&&oi(i,pi,ai),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(ci(e),ui(e),_i())}},i}function yi(e){let t=()=>{let t=pi;pi=n,++ai,n.depsTail=void 0,n.flags=ti.Watching|ti.RecursedCheck;try{return e()}finally{pi=t,n.flags&=~ti.RecursedCheck,gi(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:ti.Watching|ti.RecursedCheck,notify(){let e=this.flags;e&ti.Dirty||e&ti.Pending&&li(this.deps,this)?t():this.flags=ti.Watching},stop(){this.flags=ti.None,this.depsTail=void 0,gi(this)}};return t(),n}var bi=o((e=>{var t=u();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),xi=o(((e,t)=>{t.exports=bi()})),Si=o((e=>{var t=u(),n=xi();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Ci=o(((e,t)=>{t.exports=Si()}))();function wi(e,t){return e===t}function Ti(e,t,n=wi){let r=(0,L.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,L.useCallback)(()=>e?.get(),[e]);return(0,Ci.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var Ei={get(){},subscribe(){return{unsubscribe(){}}}};function Di(e,t){let n=L.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=xt(n.current,i):i}}function Oi(e){let t=Qr(),n=L.useContext(e.from?ei:$r),r=e.from?t.stores.getRouteMatchStore(e.from):t.stores.matchStores.get(n),i=Di(e,t),a=Ti(r??Ei,e=>e?i(e):Ei);if(a!==Ei)return a;(e.shouldThrow??!0)&&Lt()}function ki(e){return Oi({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Ai(e){let{select:t,...n}=e;return Oi({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function ji(e){return Oi({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Mi(e){return Oi({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Ni(e){let t=Qr();return L.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Pi(e){return Oi({...e,select:t=>e.select?e.select(t.context):t.context})}var z=m();function Fi(e,t){let n=Qr(),r=ft(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:s,preload:c,preloadDelay:l,preloadIntentProximity:u,hashScrollIntoView:d,replace:f,startTransition:p,resetScroll:m,viewTransition:h,children:g,target:_,disabled:v,style:y,className:b,onClick:x,onBlur:S,onFocus:C,onMouseEnter:w,onMouseLeave:T,onTouchStart:E,ignoreBlocker:D,params:O,search:ee,hash:te,state:k,mask:ne,reloadDocument:re,unsafeRelative:ie,from:A,_fromLocation:j,...M}=e,ae=Yr(),oe=L.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),se=Ti(n.stores.location,e=>e,(e,t)=>e.href===t.href),N=L.useMemo(()=>{let e={_fromLocation:se,...oe};return n.buildLocation(e)},[n,se,oe]),P=N.maskedLocation?N.maskedLocation.publicHref:N.publicHref,F=N.maskedLocation?N.maskedLocation.external:N.external,ce=L.useMemo(()=>Wi(P,F,n.history,v),[v,F,P,n.history]),le=L.useMemo(()=>{if(ce?.external)return Nt(ce.href,n.protocolAllowlist)?void 0:ce.href;if(!Gi(s)&&typeof s==`string`&&s.indexOf(`:`)!==-1)try{return new URL(s),Nt(s,n.protocolAllowlist)?void 0:s}catch{}},[s,ce,n.protocolAllowlist]),ue=L.useMemo(()=>{if(le)return!1;if(o?.exact){if(!gn(se.pathname,N.pathname,n.basepath))return!1}else{let e=hn(se.pathname,n.basepath),t=hn(N.pathname,n.basepath);if(!(e.startsWith(t)&&(e.length===t.length||e[t.length]===`/`)))return!1}return(o?.includeSearch??!0)&&!Et(se.search,N.search,{partial:!o?.exact,ignoreUndefined:!o?.explicitUndefined})?!1:!o?.includeHash||ae&&se.hash===N.hash},[o?.exact,o?.explicitUndefined,o?.includeHash,o?.includeSearch,se,le,ae,N.hash,N.pathname,N.search,n.basepath]),de=ue?ht(i,{})??Li:Ii,fe=ue?Ii:ht(a,{})??Ii,pe=[b,de.className,fe.className].filter(Boolean).join(` `),me=(y||de.style||fe.style)&&{...y,...de.style,...fe.style},[he,I]=L.useState(!1),ge=L.useRef(!1),_e=e.reloadDocument||le?!1:c??n.options.defaultPreload,ve=l??n.options.defaultPreloadDelay??0,ye=L.useCallback(()=>{n.preloadRoute({...oe,_builtLocation:N}).catch(e=>{console.warn(e),console.warn(Hr)})},[n,oe,N]);dt(r,L.useCallback(e=>{e?.isIntersecting&&ye()},[ye]),Hi,{disabled:!!v||_e!==`viewport`}),L.useEffect(()=>{ge.current||!v&&_e===`render`&&(ye(),ge.current=!0)},[v,ye,_e]);let be=e=>{let t=e.currentTarget.getAttribute(`target`),r=_===void 0?t:_;if(!v&&!qi(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0){e.preventDefault(),(0,z.flushSync)(()=>{I(!0)});let t=n.subscribe(`onResolved`,()=>{t(),I(!1)});n.navigate({...oe,replace:f,resetScroll:m,hashScrollIntoView:d,startTransition:p,viewTransition:h,ignoreBlocker:D})}};if(le)return{...M,ref:r,href:le,...g&&{children:g},..._&&{target:_},...v&&{disabled:v},...y&&{style:y},...b&&{className:b},...x&&{onClick:x},...S&&{onBlur:S},...C&&{onFocus:C},...w&&{onMouseEnter:w},...T&&{onMouseLeave:T},...E&&{onTouchStart:E}};let xe=e=>{if(v||_e!==`intent`)return;if(!ve){ye();return}let t=e.currentTarget;if(Vi.has(t))return;let n=setTimeout(()=>{Vi.delete(t),ye()},ve);Vi.set(t,n)},Se=e=>{v||_e!==`intent`||ye()},Ce=e=>{if(v||!_e||!ve)return;let t=e.currentTarget,n=Vi.get(t);n&&(clearTimeout(n),Vi.delete(t))};return{...M,...de,...fe,href:ce?.href,ref:r,onClick:Ui([x,be]),onBlur:Ui([S,Ce]),onFocus:Ui([C,xe]),onMouseEnter:Ui([w,xe]),onMouseLeave:Ui([T,Ce]),onTouchStart:Ui([E,Se]),disabled:!!v,target:_,...me&&{style:me},...pe&&{className:pe},...v&&Ri,...ue&&zi,...ae&&he&&Bi}}var Ii={},Li={className:`active`},Ri={role:`link`,"aria-disabled":!0},zi={"data-status":`active`,"aria-current":`page`},Bi={"data-transitioning":`transitioning`},Vi=new WeakMap,Hi={rootMargin:`100px`},Ui=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function Wi(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function Gi(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Ki=L.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=Fi(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return L.createElement(`a`,t,o)}return L.createElement(n,a,o)});function qi(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var Ji=class extends Ur{constructor(e){super(e),this.useMatch=e=>Oi({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Pi({...e,from:this.id}),this.useSearch=e=>Mi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>ji({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Ai({...e,from:this.id}),this.useLoaderData=e=>ki({...e,from:this.id}),this.useNavigate=()=>Ni({from:this.fullPath}),this.Link=L.forwardRef((e,t)=>(0,R.jsx)(Ki,{ref:t,from:this.fullPath,...e}))}};function Yi(e){return new Ji(e)}var Xi=class extends Wr{constructor(e){super(e),this.useMatch=e=>Oi({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Pi({...e,from:this.id}),this.useSearch=e=>Mi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>ji({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Ai({...e,from:this.id}),this.useLoaderData=e=>ki({...e,from:this.id}),this.useNavigate=()=>Ni({from:this.fullPath}),this.Link=L.forwardRef((e,t)=>(0,R.jsx)(Ki,{ref:t,from:this.fullPath,...e}))}};function Zi(e){return new Xi(e)}function Qi(e){let t=Qr(),n=`not-found-${Ti(t.stores.location,e=>e.pathname)}-${Ti(t.stores.status,e=>e)}`;return(0,R.jsx)(Gr,{getResetKey:()=>n,onCatch:(t,n)=>{if(Sn(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(Sn(t))return e.fallback?.(t);throw t},children:e.children})}function $i(){return(0,R.jsx)(`p`,{children:`Not Found`})}function ea(e){return(0,R.jsx)(R.Fragment,{children:e.children})}function ta(e,t,n){return t.options.notFoundComponent?(0,R.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,R.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,R.jsx)($i,{})}var na=(e,t)=>e.routeId===t.routeId&&e._displayPending===t._displayPending,ra=(e,t)=>e[0]===t[0]&&e[1]===t[1],ia=L.memo(function({matchId:e}){let t=Qr(),n=t.stores.matchStores.get(e);n||Lt();let r=Ti(t.stores.loadedAt,e=>e),i=Ti(n,e=>e,na);return(0,R.jsx)(aa,{router:t,matchId:e,resetKey:r,matchState:L.useMemo(()=>{let e=i.routeId,n=t.routesById[e].parentRoute?.id;return{routeId:e,ssr:i.ssr,_displayPending:i._displayPending,parentRouteId:n}},[i._displayPending,i.routeId,i.ssr,t.routesById])})});function aa({router:e,matchId:t,resetKey:n,matchState:r}){let i=e.routesById[r.routeId],a=i.options.pendingComponent??e.options.defaultPendingComponent,o=a?(0,R.jsx)(a,{}):null,s=i.options.errorComponent??e.options.defaultErrorComponent,c=i.options.onCatch??e.options.defaultOnCatch,l=i.isRoot?i.options.notFoundComponent??e.options.notFoundRoute?.options.component:i.options.notFoundComponent,u=r.ssr===!1||r.ssr===`data-only`,d=(!i.isRoot||i.options.wrapInSuspense||u)&&(i.options.wrapInSuspense??a??(i.options.errorComponent?.preload||u))?L.Suspense:ea,f=s?Gr:ea,p=l?Qi:ea;return(0,R.jsxs)(i.isRoot?i.options.shellComponent??ea:ea,{children:[(0,R.jsx)($r.Provider,{value:t,children:(0,R.jsx)(d,{fallback:o,children:(0,R.jsx)(f,{getResetKey:()=>n,errorComponent:s||qr,onCatch:(e,t)=>{if(Sn(e))throw e.routeId??=r.routeId,e;c?.(e,t)},children:(0,R.jsx)(p,{fallback:e=>{if(e.routeId??=r.routeId,!l||e.routeId&&e.routeId!==r.routeId||!e.routeId&&!i.isRoot)throw e;return L.createElement(l,e)},children:u||r._displayPending?(0,R.jsx)(Jr,{fallback:o,children:(0,R.jsx)(sa,{matchId:t})}):(0,R.jsx)(sa,{matchId:t})})})})}),r.parentRouteId===`__root__`?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(oa,{}),(e.options.scrollRestoration,null)]}):null]})}function oa(){let e=Qr(),t=L.useRef();return lt(()=>{let n=e.stores.resolvedLocation.get(),r=t.current;n&&(!r||r.href!==n.href)&&e.emit({type:`onRendered`,...jr(e.stores.location.get(),r??n)}),t.current=n},[Ti(e.stores.resolvedLocation,e=>e?.state.__TSR_key),e]),null}var sa=L.memo(function({matchId:e}){let t=Qr(),n=(e,n)=>t.getMatch(e.id)?._nonReactive[n]??e._nonReactive[n],r=t.stores.matchStores.get(e);r||Lt();let i=Ti(r,e=>e),a=i.routeId,o=t.routesById[a],s=L.useMemo(()=>{let e=(t.routesById[a].options.remountDeps??t.options.defaultRemountDeps)?.({routeId:a,loaderDeps:i.loaderDeps,params:i._strictParams,search:i._strictSearch});return e?JSON.stringify(e):void 0},[a,i.loaderDeps,i._strictParams,i._strictSearch,t.options.defaultRemountDeps,t.routesById]),c=L.useMemo(()=>{let e=o.options.component??t.options.defaultComponent;return e?(0,R.jsx)(e,{},s):(0,R.jsx)(ca,{})},[s,o.options.component,t.options.defaultComponent]);if(i._displayPending)throw n(i,`displayPendingPromise`);if(i._forcePending)throw n(i,`minPendingPromise`);if(i.status===`pending`){let e=o.options.pendingMinMs??t.options.defaultPendingMinMs;if(e){let n=t.getMatch(i.id);if(n&&!n._nonReactive.minPendingPromise){let t=Dt();n._nonReactive.minPendingPromise=t,setTimeout(()=>{t.resolve(),n._nonReactive.minPendingPromise=void 0},e)}}throw n(i,`loadPromise`)}if(i.status===`notFound`)return Sn(i.error)||Lt(),ta(t,o,i.error);if(i.status===`redirected`)throw Kn(i.error)||Lt(),n(i,`loadPromise`);if(i.status===`error`)throw i.error;return c}),ca=L.memo(function(){let e=Qr(),t=L.useContext($r),n,r=!1,i;{let a=t?e.stores.matchStores.get(t):void 0;[n,r]=Ti(a,e=>[e?.routeId,e?.globalNotFound??!1],ra),i=Ti(e.stores.matchesId,e=>e[e.findIndex(e=>e===t)+1])}let a=n?e.routesById[n]:void 0,o=e.options.defaultPendingComponent?(0,R.jsx)(e.options.defaultPendingComponent,{}):null;if(r)return a||Lt(),ta(e,a,void 0);if(!i)return null;let s=(0,R.jsx)(ia,{matchId:i});return n===`__root__`?(0,R.jsx)(L.Suspense,{fallback:o,children:s}):s});function la(){let e=Qr(),t=L.useRef({router:e,mounted:!1}),[n,r]=L.useState(!1),i=Ti(e.stores.isLoading,e=>e),a=Ti(e.stores.hasPending,e=>e),o=ut(i),s=i||n||a,c=ut(s),l=i||a,u=ut(l);return e.startTransition=e=>{r(!0),L.startTransition(()=>{e(),r(!1)})},L.useEffect(()=>{let t=e.history.subscribe(e.load),n=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return pn(e.latestLocation.publicHref)!==pn(n.publicHref)&&e.commitLocation({...n,replace:!0}),()=>{t()}},[e,e.history]),lt(()=>{typeof window<`u`&&e.ssr||t.current.router===e&&t.current.mounted||(t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(e){console.error(e)}})())},[e]),lt(()=>{o&&!i&&e.emit({type:`onLoad`,...jr(e.stores.location.get(),e.stores.resolvedLocation.get())})},[o,e,i]),lt(()=>{u&&!l&&e.emit({type:`onBeforeRouteMount`,...jr(e.stores.location.get(),e.stores.resolvedLocation.get())})},[l,u,e]),lt(()=>{if(c&&!s){let t=jr(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:`onResolved`,...t}),hi(()=>{e.stores.status.set(`idle`),e.stores.resolvedLocation.set(e.stores.location.get())})}},[s,c,e]),null}function ua(){let e=Qr(),t=e.routesById.__root__.options.pendingComponent??e.options.defaultPendingComponent,n=t?(0,R.jsx)(t,{}):null,r=(0,R.jsxs)(typeof document<`u`&&e.ssr?ea:L.Suspense,{fallback:n,children:[(0,R.jsx)(la,{}),(0,R.jsx)(da,{})]});return e.options.InnerWrap?(0,R.jsx)(e.options.InnerWrap,{children:r}):r}function da(){let e=Qr(),t=Ti(e.stores.firstId,e=>e),n=Ti(e.stores.loadedAt,e=>e),r=t?(0,R.jsx)(ia,{matchId:t}):null;return(0,R.jsx)($r.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:(0,R.jsx)(Gr,{getResetKey:()=>n,errorComponent:qr,onCatch:void 0,children:r})})}function fa(e){let t=Qr();return Ti(t.stores.matches,Di(e,t))}var pa=e=>({createMutableStore:vi,createReadonlyStore:vi,batch:hi}),ma=e=>new ha(e),ha=class extends Mr{constructor(e){super(e,pa)}};function ga({router:e,children:t,...n}){vt(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,R.jsx)(Zr.Provider,{value:e,children:t});return e.options.Wrap?(0,R.jsx)(e.options.Wrap,{children:r}):r}function _a({router:e,...t}){return(0,R.jsx)(ga,{router:e,...t,children:(0,R.jsx)(ua,{})})}var va=g(),ya=class extends L.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[ErrorBoundary]`,e,t.componentStack)}render(){return this.state.error?(0,R.jsxs)(`div`,{style:{padding:`40px 24px`,maxWidth:560},children:[(0,R.jsx)(`h2`,{style:{margin:`0 0 12px`,fontSize:18,fontWeight:500},children:`Something went wrong`}),(0,R.jsx)(`pre`,{style:{margin:0,padding:16,borderRadius:8,background:`var(--bg-1, #1a1a2e)`,border:`1px solid var(--border-0, #333)`,color:`var(--danger, #e55)`,fontSize:13,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:this.state.error.message}),(0,R.jsx)(`button`,{className:`btn`,style:{marginTop:16},onClick:()=>this.setState({error:null}),children:`Try again`})]}):this.props.children}},ba=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},xa=(e=>e?ba(e):ba),Sa=e=>e;function Ca(e,t=Sa){let n=L.useSyncExternalStore(e.subscribe,L.useCallback(()=>t(e.getState()),[e,t]),L.useCallback(()=>t(e.getInitialState()),[e,t]));return L.useDebugValue(n),n}var wa=e=>{let t=xa(e),n=e=>Ca(t,e);return Object.assign(n,t),n},Ta=(e=>e?wa(e):wa);function Ea(e,t){let n;try{n=e()}catch{return}return{getItem:e=>{let r=e=>e===null?null:JSON.parse(e,t?.reviver),i=n.getItem(e)??null;return i instanceof Promise?i.then(r):r(i)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,t?.replacer)),removeItem:e=>n.removeItem(e)}}var Da=e=>t=>{try{let n=e(t);return n instanceof Promise?n:{then(e){return Da(e)(n)},catch(e){return this}}}catch(e){return{then(e){return this},catch(t){return Da(t)(e)}}}},Oa=(e,t)=>(n,r,i)=>{let a={storage:Ea(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1,s=0,c=new Set,l=new Set,u=a.storage;if(!u)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...e)},r,i);let d=()=>{let e=a.partialize({...r()});return u.setItem(a.name,{state:e,version:a.version})},f=i.setState;i.setState=(e,t)=>(f(e,t),d());let p=e((...e)=>(n(...e),d()),r,i);i.getInitialState=()=>p;let m,h=()=>{if(!u)return;let e=++s;o=!1,c.forEach(e=>e(r()??p));let t=a.onRehydrateStorage?.call(a,r()??p)||void 0;return Da(u.getItem.bind(u))(a.name).then(e=>{if(e)if(typeof e.version==`number`&&e.version!==a.version){if(a.migrate){let t=a.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error(`State loaded from storage couldn't be migrated since no migrate function was provided`)}else return[!1,e.state];return[!1,void 0]}).then(t=>{if(e!==s)return;let[i,o]=t;if(m=a.merge(o,r()??p),n(m,!0),i)return d()}).then(()=>{e===s&&(t?.(r(),void 0),m=r(),o=!0,l.forEach(e=>e(m)))}).catch(n=>{e===s&&t?.(void 0,n)})};return i.persist={setOptions:e=>{a={...a,...e},e.storage&&(u=e.storage)},clearStorage:()=>{u?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>h(),hasHydrated:()=>o,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(l.add(e),()=>{l.delete(e)})},a.skipHydration||h(),m||p},ka=e=>[e.q,e.collection,e.mode,e.model??``,e.from??``,e.to??``].join(`\0`),Aa=e=>[e.collection,e.sourceFile,e.conversationKey??``].join(`\0`),ja=e=>`${e.provider}\0${e.id}`,B=Ta()(Oa(e=>({theme:`dark`,toggleTheme:()=>e(e=>({theme:e.theme===`dark`?`light`:`dark`})),setTheme:t=>e({theme:t}),activeColl:`all`,setActiveColl:t=>e({activeColl:t}),sidebarOpen:!1,setSidebarOpen:t=>e({sidebarOpen:t}),cmdkOpen:!1,setCmdkOpen:t=>e({cmdkOpen:t}),newCollOpen:!1,setNewCollOpen:t=>e({newCollOpen:t}),roles:{user:!0,thinking:!0,ai:!0},toggleRole:t=>e(e=>({roles:{...e.roles,[t]:!e.roles[t]}})),modelFilter:``,setModelFilter:t=>e({modelFilter:t}),savedSearches:[],addSavedSearch:t=>e(e=>{let n=ka(t);return e.savedSearches.some(e=>ka(e)===n)?e:{savedSearches:[{...t,id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,savedAt:new Date().toISOString()},...e.savedSearches].slice(0,50)}}),removeSavedSearch:t=>e(e=>({savedSearches:e.savedSearches.filter(e=>e.id!==t)})),pinnedConversations:[],togglePinned:t=>e(e=>{let n=Aa(t);return{pinnedConversations:e.pinnedConversations.some(e=>Aa(e)===n)?e.pinnedConversations.filter(e=>Aa(e)!==n):[t,...e.pinnedConversations].slice(0,100)}}),favoriteGenerationModels:[],toggleFavoriteGenerationModel:t=>e(e=>{let n=ja(t);return{favoriteGenerationModels:e.favoriteGenerationModels.some(e=>ja(e)===n)?e.favoriteGenerationModels.filter(e=>ja(e)!==n):[t,...e.favoriteGenerationModels].slice(0,100)}})}),{name:`threadshelf:ui`,partialize:e=>({theme:e.theme,activeColl:e.activeColl,roles:e.roles,savedSearches:e.savedSearches,pinnedConversations:e.pinnedConversations,favoriteGenerationModels:e.favoriteGenerationModels})})),Ma=class extends Error{plan;constructor(e,t){super(e),this.plan=t,this.name=`QuickSetupPlanChangedError`}},Na=class extends Error{status;field;constructor(e,t,n){super(t),this.status=e,this.field=n,this.name=`ApiError`}},V=async(e,t)=>{let n=await fetch(e,t),r=await n.json().catch(()=>({}));if(!n.ok){let e=r;throw new Na(n.status,e.error??n.statusText,e.field)}return r},Pa=(e,t)=>{let n=new URL(e,window.location.origin);if(t)for(let[e,r]of Object.entries(t))r!==void 0&&n.searchParams.set(e,r);return n.toString()},Fa=e=>{try{return JSON.parse(e)}catch(t){let n=e.length>120?`${e.slice(0,117)}...`:e,r=Error(`Invalid NDJSON event: ${n}`);throw r.cause=t,r}},Ia=async(e,t,n=()=>new TextDecoder)=>{if(!e.ok){let t=await e.json().catch(()=>({}));throw new Na(e.status,t.error??e.statusText,t.field)}if(!e.body)throw Error(`Streaming response is not available in this browser.`);let r=e.body.getReader(),i=n(),a=``;for(;;){let{done:e,value:n}=await r.read();a+=i.decode(n,{stream:!e});let o=a.indexOf(`
|
|
10
|
+
`);for(;o!==-1;){let e=a.slice(0,o).trim();a=a.slice(o+1),e&&t(Fa(e)),o=a.indexOf(`
|
|
11
|
+
`)}if(e){let e=a.trim();e&&t(Fa(e));break}}},H={async health(e){let t=AbortSignal.timeout(5e3),n=e?AbortSignal.any([e,t]):t;try{return(await fetch(`/api/health`,{signal:n})).ok}catch(t){if(e?.aborted)throw t;return!1}},collections(e){return V(`/api/collections`,{signal:e})},createCollection(e){return V(`/api/collections`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:e})})},clearCollection(e){return V(`/api/collections/${encodeURIComponent(e)}/clear`,{method:`POST`})},deleteCollection(e){return V(`/api/collections/${encodeURIComponent(e)}`,{method:`DELETE`})},collectionStats(e,t){return V(`/api/collections/${encodeURIComponent(e)}/stats`,{signal:t})},allCollectionStats(e){return V(`/api/collections/all/stats`,{signal:e})},insights(e,t){return V(Pa(`/api/insights`,{collection:e}),{signal:t})},files(e,t){return V(Pa(`/api/files`,{collection:e}),{signal:t})},search(e,t){return V(Pa(`/api/search`,{q:e.q,collection:e.collection,n:e.n?String(e.n):void 0,roles:e.roles,keywordBoost:e.keywordBoost?`1`:void 0,model:e.model||void 0,from:e.from||void 0,to:e.to||void 0,mode:e.mode===`keyword`?`keyword`:void 0,origin:e.origin}),{signal:t})},thread(e,t,n,r){return V(Pa(`/api/thread`,{sourceFile:e,collection:t,conversationKey:n}),{signal:r})},masterPrompts(e){return V(`/api/generation/prompts`,{signal:e})},createMasterPrompt(e){return V(`/api/generation/prompts`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})},updateMasterPrompt(e,t){return V(`/api/generation/prompts/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)})},deleteMasterPrompt(e){return V(`/api/generation/prompts/${encodeURIComponent(e)}`,{method:`DELETE`})},setActiveMasterPrompt(e){return V(`/api/generation/prompts/active`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({id:e})})},generationThreads(e){return V(`/api/generation/threads`,{signal:e})},createGenerationThread(e,t){return V(`/api/generation/threads`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:e,turns:t})})},renameGenerationThread(e,t){return V(`/api/generation/threads/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:t})})},deleteGenerationThread(e){return V(`/api/generation/threads/${encodeURIComponent(e)}`,{method:`DELETE`})},generationThread(e,t){return V(`/api/generation/threads/${encodeURIComponent(e)}`,{signal:t})},generationConfig(e){return V(`/api/generation/config`,{signal:e})},updateGenerationConfig(e){return V(`/api/generation/config`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})},generationModels(e,t={}){return V(Pa(`/api/generation/models`,{provider:e,sort:t.sort&&t.sort!=="default"?t.sort:void 0,free:t.freeOnly?`1`:void 0}),{signal:t.signal})},generationRuntime(e){return V(`/api/generation/runtime`,{signal:e})},generationLlamaLogs(e){return V(`/api/generation/runtime/logs`,{signal:e})},ejectGenerationModel(e){return V(`/api/generation/runtime/eject`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({model:e})})},generationHardware(e){return V(`/api/generation/hardware`,{signal:e})},catalogSearch(e={},t){return V(Pa(`/api/generation/catalog/search`,{q:e.q||void 0,sort:e.sort&&e.sort!==`downloads`?e.sort:void 0,limit:e.limit?String(e.limit):void 0}),{signal:t})},catalogModel(e,t){return V(Pa(`/api/generation/catalog/model`,{id:e}),{signal:t})},async catalogDownload(e,t,n){await Ia(await fetch(`/api/generation/catalog/download`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:n}),e=>{if(t(e),e.type===`error`)throw Error(e.error)})},quickSetupPlan(e,t){return V(Pa(`/api/generation/setup/plan`,{variant:e}),{signal:t})},async runQuickSetup(e,t,n){let r=await fetch(`/api/generation/setup/run`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...e,confirm:!0}),signal:n});if(r.status===409){let e=await r.json().catch(()=>({}));throw new Ma(e.error??`The setup plan changed since it was shown.`,e.plan)}await Ia(r,e=>{if(t(e),e.type===`error`)throw Error(e.error)})},generationDirectories(e,t){return V(Pa(`/api/generation/directories`,{path:e}),{signal:t})},async continueThreadStream(e,t,n){let r=await fetch(`/api/generation/chat/stream`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:n}),i;if(await Ia(r,e=>{if(t(e),e.type===`error`)throw Error(e.error);e.type===`done`&&(i=e.response)}),!i)throw Error(`Generation stream ended before completion.`);return i},continueThread(e,t){return V(`/api/generation/chat`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t})},ingestPreview(e,t,n){return V(Pa(`/api/ingest-preview`,{folderPath:e,collection:t}),{signal:n})},async ingestUpload(e,t,n){let r=new FormData;r.append(`clearFirst`,n?`true`:`false`),r.append(`collectionName`,t);for(let t of e)r.append(t.webkitRelativePath||t.name,t);return V(`/api/ingest-upload`,{method:`POST`,body:r})},async ingestUploadProgress(e,t,n,r,i){let a=new FormData;a.append(`clearFirst`,n?`true`:`false`),a.append(`collectionName`,t);for(let t of e)a.append(t.webkitRelativePath||t.name,t);await Ia(await fetch(`/api/ingest-upload-progress`,{method:`POST`,body:a,signal:i}),r)},async ingestPathProgress(e,t,n,r,i){await Ia(await fetch(`/api/ingest-progress`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({folderPath:e,collection:t,clearFirst:n}),signal:i}),r)}},La=0,Ra=()=>st({queryKey:[`health`],queryFn:async({signal:e})=>{let t=await H.health(e);return La=t?0:La+1,t||La<2},refetchInterval:3e4,staleTime:1e4}),za=()=>st({queryKey:[`collections`],queryFn:async({signal:e})=>{let{collections:t}=await H.collections(e),n=[...new Set([`all`,...t])],r={};try{let t=await H.allCollectionStats(e);for(let e of t.collections??[])e.collection&&(r[e.collection]=e)}catch{}return{collections:n,stats:r}},staleTime:15e3}),Ba=e=>st({queryKey:[`insights`,e],queryFn:({signal:t})=>H.insights(e,t),staleTime:6e4}),Va=(e,t)=>st({queryKey:[`files`,e],queryFn:({signal:t})=>H.files(e,t),enabled:t,staleTime:3e4}),Ha=()=>st({queryKey:[`generation-threads`],queryFn:({signal:e})=>H.generationThreads(e),staleTime:1e4}),Ua=e=>st({queryKey:[`search`,e],queryFn:({signal:t})=>H.search(e,t),enabled:e.q.trim().length>0,staleTime:6e4,gcTime:3e5}),Wa=()=>st({queryKey:[`master-prompts`],queryFn:({signal:e})=>H.masterPrompts(e),staleTime:6e4}),Ga=()=>{let{data:e}=Wa();return e?.prompts.find(t=>t.id===e.activeId)?.text??``},Ka=e=>{let t=Ke();return ct({mutationFn:e,onSuccess:e=>t.setQueryData([`master-prompts`],e)})},qa=()=>{let e=Ke();return ct({mutationFn:e=>H.deleteCollection(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`collections`]}),e.invalidateQueries({queryKey:[`files`]}),e.invalidateQueries({queryKey:[`search`]}),e.invalidateQueries({queryKey:[`thread`]})}})},Ja=()=>{let e=Ke();return ct({mutationFn:e=>H.clearCollection(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`collections`]}),e.invalidateQueries({queryKey:[`files`]}),e.invalidateQueries({queryKey:[`search`]}),e.invalidateQueries({queryKey:[`thread`]})}})},Ya=()=>{let e=Ke();return ct({mutationFn:e=>H.createCollection(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`collections`]})}})};function U({d:e,size:t=14,sw:n=1.6}){return(0,R.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:n,strokeLinecap:`round`,strokeLinejoin:`round`,children:e})}var W={search:(0,R.jsx)(U,{d:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,R.jsx)(`path`,{d:`m20 20-3.5-3.5`})]})}),searchLg:(0,R.jsx)(U,{d:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,R.jsx)(`path`,{d:`m20 20-3.5-3.5`})]}),size:18}),menu:(0,R.jsx)(U,{d:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`path`,{d:`M4 6h16`}),(0,R.jsx)(`path`,{d:`M4 12h16`}),(0,R.jsx)(`path`,{d:`M4 18h16`})]})}),star:(0,R.jsx)(U,{d:(0,R.jsx)(`path`,{d:`m12 3 2.7 5.6 6.1.8-4.5 4.3 1.1 6-5.4-2.9-5.4 2.9 1.1-6L3.2 9.4l6.1-.8z`})}),starFilled:(0,R.jsx)(U,{d:(0,R.jsx)(`path`,{d:`m12 3 2.7 5.6 6.1.8-4.5 4.3 1.1 6-5.4-2.9-5.4 2.9 1.1-6L3.2 9.4l6.1-.8z`,fill:`currentColor`})}),pin:(0,R.jsx)(U,{d:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`path`,{d:`M9 4h6l-1 7 3 3H7l3-3z`}),(0,R.jsx)(`path`,{d:`M12 14v6`})]})}),pinFilled:(0,R.jsx)(U,{d:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`path`,{d:`M9 4h6l-1 7 3 3H7l3-3z`,fill:`currentColor`}),(0,R.jsx)(`path`,{d:`M12 14v6`})]})}),chart:(0,R.jsx)(U,{d:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`path`,{d:`M4 4v16h16`}),(0,R.jsx)(`path`,{d:`M8 16v-5`}),(0,R.jsx)(`path`,{d:`M12 16V8`}),(0,R.jsx)(`path`,{d:`M16 16v-3`})]})}),spark:(0,R.jsx)(U,{d:(0,R.jsx)(`path`,{d:`M12 3v3M12 18v3M3 12h3M18 12h3M5.5 5.5l2 2M16.5 16.5l2 2M5.5 18.5l2-2M16.5 7.5l2-2`})}),chat:(0,R.jsx)(U,{d:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`path`,{d:`M5 4h14a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H9l-5 4v-4a2 2 0 0 1-1-2V6a2 2 0 0 1 2-2Z`}),(0,R.jsx)(`path`,{d:`M8 9h8`}),(0,R.jsx)(`path`,{d:`M8 13h5`})]})}),folder:(0,R.jsx)(U,{d:(0,R.jsx)(`path`,{d:`M3 6a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`})}),download:(0,R.jsx)(U,{d:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`path`,{d:`M12 3v12`}),(0,R.jsx)(`path`,{d:`m7 10 5 5 5-5`}),(0,R.jsx)(`path`,{d:`M5 21h14`})]})}),plug:(0,R.jsx)(U,{d:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`path`,{d:`M9 2v6`}),(0,R.jsx)(`path`,{d:`M15 2v6`}),(0,R.jsx)(`path`,{d:`M6 8h12v3a6 6 0 0 1-12 0z`}),(0,R.jsx)(`path`,{d:`M12 17v5`})]})}),settings:(0,R.jsx)(U,{d:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,R.jsx)(`path`,{d:`M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3h.1a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5h.1a1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8v.1a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z`})]})}),plus:(0,R.jsx)(U,{d:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`path`,{d:`M12 5v14`}),(0,R.jsx)(`path`,{d:`M5 12h14`})]})}),ghost:(0,R.jsx)(U,{d:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`path`,{d:`M6 19V10a6 6 0 0 1 12 0v9l-3-2-3 2-3-2-3 2Z`}),(0,R.jsx)(`path`,{d:`M9.25 10.5h.01`}),(0,R.jsx)(`path`,{d:`M14.75 10.5h.01`})]})}),trash:(0,R.jsx)(U,{d:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`path`,{d:`M3 6h18`}),(0,R.jsx)(`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`}),(0,R.jsx)(`path`,{d:`m19 6-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`})]})}),copy:(0,R.jsx)(U,{d:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`rect`,{x:`9`,y:`9`,width:`11`,height:`11`,rx:`2`}),(0,R.jsx)(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})]})}),arrowRight:(0,R.jsx)(U,{d:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`path`,{d:`M5 12h14`}),(0,R.jsx)(`path`,{d:`m12 5 7 7-7 7`})]})}),arrowLeft:(0,R.jsx)(U,{d:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`path`,{d:`M19 12H5`}),(0,R.jsx)(`path`,{d:`m12 19-7-7 7-7`})]})}),zap:(0,R.jsx)(U,{d:(0,R.jsx)(`path`,{d:`M13 2 3 14h9l-1 8 10-12h-9z`})}),sort:(0,R.jsx)(U,{d:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`path`,{d:`M3 6h18`}),(0,R.jsx)(`path`,{d:`M6 12h12`}),(0,R.jsx)(`path`,{d:`M10 18h4`})]})}),check:(0,R.jsx)(U,{d:(0,R.jsx)(`path`,{d:`m5 12 5 5 9-12`})}),close:(0,R.jsx)(U,{d:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`path`,{d:`M18 6 6 18`}),(0,R.jsx)(`path`,{d:`m6 6 12 12`})]})}),warn:(0,R.jsx)(U,{d:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`path`,{d:`M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z`}),(0,R.jsx)(`path`,{d:`M12 9v4`}),(0,R.jsx)(`path`,{d:`M12 17h0`})]})}),info:(0,R.jsx)(U,{d:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,R.jsx)(`path`,{d:`M12 16v-4`}),(0,R.jsx)(`path`,{d:`M12 8h0`})]})}),refresh:(0,R.jsx)(U,{d:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`path`,{d:`M3 12a9 9 0 0 1 15-6.7L21 8`}),(0,R.jsx)(`path`,{d:`M21 3v5h-5`}),(0,R.jsx)(`path`,{d:`M21 12a9 9 0 0 1-15 6.7L3 16`}),(0,R.jsx)(`path`,{d:`M3 21v-5h5`})]})}),scope:(0,R.jsx)(U,{d:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,R.jsx)(`path`,{d:`M12 3v18`}),(0,R.jsx)(`path`,{d:`M3 12h18`})]})}),database:(0,R.jsx)(U,{d:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`ellipse`,{cx:`12`,cy:`5`,rx:`8`,ry:`3`}),(0,R.jsx)(`path`,{d:`M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5`}),(0,R.jsx)(`path`,{d:`M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6`})]})}),sun:(0,R.jsx)(U,{d:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,R.jsx)(`path`,{d:`M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4`})]})}),moon:(0,R.jsx)(U,{d:(0,R.jsx)(`path`,{d:`M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z`})})},Xa=/(?:users|projects|user|message_feedback|shared_conversations|sora)\.json$/i,Za=e=>e===`all`||e===`__all__`?`All collections`:e===`chunks`?`Chunks`:e===`threadshelf_conversations`?`ThreadShelf conversations`:e,Qa=e=>{if(!e)return``;let t=e.replace(/\\/g,`/`).split(`/`);return t.length>2?t.slice(-2).join(`/`):e},$a=e=>{if(!e)return``;let t=String(e).replace(/^models\//,``);if(/^[a-z]:[\\/]/i.test(t)||t.startsWith(`/`)||t.includes(`\\`)){let e=t.replace(/\\/g,`/`).split(`/`);return e[e.length-1].replace(/\.gguf$/i,``)}return t},eo=(e,t)=>{if(e.length<=t)return e;let n=Math.max(2,t-1),r=Math.ceil(n*.42);return`${e.slice(0,r)}…${e.slice(-(n-r))}`},to=(e,t=25)=>{if(!e)return``;let n=e.replace(/\//g,`\\`);if(n.length<=t)return n;let r=/^[A-Za-z]:\\/.exec(n)?.[0]??``,i=n.split(`\\`).filter(Boolean);return eo(`${r}…\\${i[i.length-1]??n}`,t)},no=(e,t=30)=>{if(!e)return``;let n=e.replace(/^models\//,``).split(/[\\/]/);return eo((n[n.length-1]||e).replace(/\.gguf$/i,``),t)},ro=e=>{let t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`},io=e=>{if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?``:new Intl.DateTimeFormat(void 0,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}).format(t)},ao=e=>{if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?``:new Intl.DateTimeFormat(void 0,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`}).format(t)},oo=(e,t=Date.now())=>{if(!e)return``;let n=new Date(e),r=n.getTime();if(Number.isNaN(r))return``;let i=t-r;if(i<45e3)return`just now`;let a=Math.round(i/6e4);if(a<60)return`${a} min ago`;let o=Math.round(i/36e5);if(o<24)return`${o} h ago`;let s=Math.round(i/864e5);return s<7?`${s} d ago`:new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(n)},so=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),G=e=>{let t=e.trim().split(/\s+/).map(e=>e.replace(/^[^\p{L}\p{N}]+|[^\p{L}\p{N}]+$/gu,``)).filter(e=>e.length>=3),n=[...new Set(t.map(e=>e.toLocaleLowerCase()))];if(!n.length){let t=e.trim();return t?RegExp(`(${so(t)})`,`iu`):null}return RegExp(`(${n.map(so).join(`|`)})`,`iu`)},K=(e,t)=>{let n=G(t);return n?e.split(n).filter(e=>e.length>0):[e]},co=e=>{if(!e||Xa.test(e))return!1;let t=e.replace(/\\/g,`/`).split(`/`).pop()??``;return!t.toLowerCase().endsWith(`.json`)&&/^file[-_]/i.test(t)?!1:t.toLowerCase().endsWith(`.json`)||!t.includes(`.`)},lo=(e,t=280)=>{let n=e.replace(/\s+/g,` `).trim();if(n.length<=t)return n;let r=n.slice(0,t),i=r.lastIndexOf(` `);return(i>t/2?r.slice(0,i):r).trim()},uo=async e=>{try{return await navigator.clipboard.writeText(e),!0}catch{return!1}},fo=(e,t,n=96)=>{if(!t)return[...e];let r=Math.max(1,n),i=[...e],a=t,o=i.length-1;if(o>=0&&i[o].length<r){let e=r-i[o].length;i[o]=`${i[o]}${a.slice(0,e)}`,a=a.slice(e)}for(;a;)i.push(a.slice(0,r)),a=a.slice(r);return i},po=e=>e.user===void 0?e.thinking===void 0?`ai`:`thinking`:`user`,mo=e=>e.user??e.thinking??e.ai??``,ho={user:`### 🧑 User`,thinking:`### 💭 Reasoning`,ai:`### 🤖 Response`},go=(e,t,n)=>{let r=[`# ${e||`Conversation`}`,``],i=[];n?.model&&i.push(`**Model:** ${$a(n.model)}`),i.push(`**Turns:** ${t.length}`),n?.collection&&i.push(`**Collection:** ${n.collection}`),n?.sourceFile&&i.push(`**Source:** \`${n.sourceFile}\``),i.length&&r.push(i.join(` · `),``,`---`,``);for(let e of t){let t=po(e);r.push(ho[t]),io(e.createdAt)?r.push(`*${io(e.createdAt)}*`,``):r.push(``),r.push(mo(e).trim(),``)}return r.join(`
|
|
12
|
+
`).replace(/\n{3,}/g,`
|
|
13
|
+
|
|
14
|
+
`).trim()+`
|
|
15
|
+
`},_o=e=>(e||`conversation`).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,60)||`conversation`,vo=(e,t,n=`text/markdown;charset=utf-8`)=>{let r=new Blob([t],{type:n}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=e,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)},yo=e=>!e||e<=0?`—`:e>=1024**3?`${(e/1024**3).toFixed(e>=10*1024**3?0:1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} KB`,bo=e=>!e||e<=0?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${Math.round(e/1e3)}k`:String(e);function xo({variant:e=`full`}){let t=B(e=>e.theme),n=B(e=>e.toggleTheme),r=t===`dark`,i=r?`light`:`dark`;return(0,R.jsxs)(`button`,{className:`theme-toggle ${e}`,onClick:n,title:`Switch to ${i} theme`,"aria-label":`Switch to ${i} theme`,children:[(0,R.jsx)(`span`,{className:`tt-ico`,children:r?W.sun:W.moon}),e===`full`&&(0,R.jsx)(`span`,{className:`tt-label`,children:r?`Light`:`Dark`})]})}var So=1,Co=4e3,wo=Ta((e,t)=>({toasts:[],confirmState:null,pushToast:(n,r=`info`)=>{let i=So++;e(e=>({toasts:[...e.toasts,{id:i,type:r,text:n}]})),setTimeout(()=>t().dismissToast(i),Co)},dismissToast:t=>{e(e=>({toasts:e.toasts.filter(e=>e.id!==t)}))},confirm:n=>new Promise(r=>{let i=t().confirmState;i&&i.resolve(!1),e({confirmState:{...n,id:So++,resolve:r}})}),resolveConfirm:n=>{let r=t().confirmState;r&&r.resolve(n),e({confirmState:null})}})),q={info:e=>wo.getState().pushToast(e,`info`),success:e=>wo.getState().pushToast(e,`success`),error:e=>wo.getState().pushToast(e,`error`)},To=e=>wo.getState().confirm(e),Eo=e=>{if(!e)return``;let t=e.split(/[\\/]/);return t[t.length-1]||e};function Do({detailed:e=!1}){let[t,n]=(0,L.useState)(null),[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)(!1),s=(0,L.useCallback)(async()=>{try{let[e,t]=await Promise.all([H.generationRuntime(),H.generationLlamaLogs().catch(()=>null)]);n(e.runtime),t&&i(t)}catch{n(null)}},[]);(0,L.useEffect)(()=>{let e=window.setTimeout(()=>void s(),0),t=window.setInterval(()=>void s(),3e3),r=e=>{if(e instanceof CustomEvent&&e.detail){n(e.detail),H.generationLlamaLogs().then(i).catch(()=>void 0);return}s()};return window.addEventListener(`threadshelf:generation-runtime-changed`,r),()=>{window.clearTimeout(e),window.clearInterval(t),window.removeEventListener(`threadshelf:generation-runtime-changed`,r)}},[s]);let c=async()=>{o(!0);try{let e=await H.ejectGenerationModel(t?.model);n(e.runtime),window.dispatchEvent(new Event(`threadshelf:generation-runtime-changed`)),q.success(`llama.cpp model ejected from memory.`)}catch(e){q.error(e instanceof Error?e.message:`Could not eject the model.`)}finally{o(!1)}},l=t&&(t.state===`starting`||t.state===`ready`||t.state===`external`&&!!t.model),u=r?.devices[0]?.id.replace(/\d+$/,``).toUpperCase(),d=!t||!r?`unknown`:t.state===`stopped`?r.devices.length>0?`idle · GPU (${u||`accelerator`})`:`idle · CPU`:r.offload.mode===`hybrid`?`hybrid ${r.offload.gpuPercent}% GPU`:r.offload.mode===`gpu`?`GPU · ${u||`accelerator`}`:r.offload.mode===`cpu`?`CPU`:r.devices.length>0?`GPU · ${u||`accelerator`}`:r.deviceDetectionSupported?`CPU`:`unknown`,f=[r?.executable?`Selected executable: ${r.executable}`:void 0,`Detected compute: ${d}`,``,`Check for a newer stable llama.cpp build:`,`npm run setup:llama -- -- --check`,``,`Install CPU:`,`npm run setup:llama -- -- --install --variant cpu`,``,`Install NVIDIA CUDA:`,`npm run setup:llama -- -- --install --variant cuda`,``,`Install Vulkan GPU:`,`npm run setup:llama -- -- --install --variant vulkan`,``,`macOS: use the cpu variant; Metal is included automatically.`].filter(e=>e!==void 0).join(`
|
|
16
|
+
`),p=Object.entries(r?.offload.deviceBufferMiB??{}).filter(([e])=>!e.toUpperCase().startsWith(`CPU`)).reduce((e,[,t])=>e+t,0),m=(r?.profile??[]).filter(e=>e.applied),h=m.length>0&&t?.state!==`stopped`?[d,...m.map(e=>`${e.setting} ${e.value}`),p>0?`GPU weights ${(p/1024).toFixed(1)} GiB`:``].filter(Boolean).join(` · `):``,g=(r?.profile??[]).filter(e=>e.note).map(e=>`${e.setting}: ${e.applied?``:`skipped, `}${e.note}`).join(`
|
|
17
|
+
`);return(0,R.jsxs)(`div`,{className:`global-runtime`,"data-state":t?.state||`unknown`,title:t?.detail,children:[(0,R.jsx)(`span`,{className:`runtime-dot`,"aria-hidden":`true`}),(0,R.jsxs)(`span`,{className:`global-runtime-copy`,children:[(0,R.jsxs)(`b`,{children:[(0,R.jsx)(`span`,{children:t?.state===`starting`?`llama.cpp · loading`:`llama.cpp`}),(0,R.jsx)(`em`,{children:d}),(0,R.jsx)(`span`,{className:`runtime-install-help`,tabIndex:0,role:`img`,"aria-label":`llama.cpp CPU and GPU install commands`,title:f,children:`?`})]}),(0,R.jsx)(`span`,{children:t?.model?Eo(t.model):t?`no model loaded`:`status unavailable`}),e&&t?.detail&&(0,R.jsx)(`small`,{children:t.detail}),e&&h&&(0,R.jsx)(`small`,{className:`runtime-profile`,title:g||void 0,children:h})]}),l&&(0,R.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>void c(),children:a?`…`:`Eject`})]})}var Oo=[{id:`/search`,viewKey:`search`,label:`Search archive`,icon:W.search},{id:`/insights`,viewKey:`insights`,label:`Insights`,icon:W.chart}],ko=[{id:`/indexing`,viewKey:`indexing`,label:`Add data`,icon:W.download},{id:`/mcp`,viewKey:`mcp`,label:`MCP`,icon:W.plug},{id:`/settings`,viewKey:`settings`,label:`Settings`,icon:W.settings}];function Ao({view:e,setView:t,activeColl:n,setActiveColl:r,onNewChat:i,onNewPrivateChat:a,onOpenChat:o,activeChatId:s,onCmdK:c,onNewColl:l,onDeleteCollection:u,collections:d,stats:f}){let[p,m]=(0,L.useState)(!1),[h,g]=(0,L.useState)(e===`chat`),{data:_,isLoading:v,refetch:y}=Ha(),b=_?.threads??[],x=d.filter(e=>e!==`all`),S=x.reduce((e,t)=>e+(f[t]?.files??0),0),C=x.reduce((e,t)=>e+(f[t]?.chunks??0),0),w=e=>{let t=f[e];return(t?.chunks??0)===0&&(t?.files??0)===0&&(t?.conversations??0)===0},T=x.filter(e=>w(e)&&e!==n),E=x.filter(e=>p||!w(e)||e===n),D=e=>{let t=e?.conversations??0;return t>0?`${t.toLocaleString()} thread${t===1?``:`s`}`:`${(e?.files??0).toLocaleString()} files`},O=e=>{let t=e?.conversations??0;return`${t>0?`${t.toLocaleString()} conversation${t===1?``:`s`}`:`${(e?.files??0).toLocaleString()} files`} · ${(e?.chunks??0).toLocaleString()} indexed chunks`};return(0,R.jsxs)(`aside`,{className:`sidebar`,children:[(0,R.jsxs)(`div`,{className:`sb-brand`,children:[(0,R.jsx)(`div`,{className:`sb-logo`,"aria-hidden":`true`}),(0,R.jsxs)(`div`,{className:`sb-name`,children:[(0,R.jsx)(`b`,{children:`ThreadShelf`}),(0,R.jsxs)(`span`,{children:[`v`,`1.2.0`,` · local`]})]})]}),(0,R.jsxs)(`section`,{className:`sb-chat-panel`,"aria-label":`Conversations`,children:[(0,R.jsxs)(`div`,{className:`sb-chat-create`,children:[(0,R.jsxs)(`button`,{id:`sidebarNewChatButton`,className:`sb-new-chat`,onClick:i,children:[W.spark,(0,R.jsx)(`span`,{children:`New chat`})]}),(0,R.jsx)(`button`,{id:`sidebarPrivateChatButton`,className:`sb-private-chat`,"aria-label":`Start private conversation`,title:`Start a private chat that is cleared with this tab`,onClick:a,children:W.ghost})]}),(0,R.jsxs)(`div`,{className:`sb-chat-history`,children:[(0,R.jsxs)(`button`,{id:`sidebarChatHistoryToggle`,className:`sb-chat-history-toggle`,"aria-expanded":h,onClick:()=>{let e=!h;g(e),e&&y()},children:[(0,R.jsx)(`span`,{className:`ico`,children:W.chat}),(0,R.jsx)(`span`,{className:`label`,children:`Your chats`}),b.length>0&&(0,R.jsx)(`em`,{children:b.length}),(0,R.jsx)(`span`,{className:`sb-chat-chevron`,"aria-hidden":`true`,children:`▾`})]}),h&&(0,R.jsxs)(`div`,{className:`sb-chat-history-list`,children:[v&&(0,R.jsx)(`span`,{className:`sb-chat-history-empty`,children:`Loading chats…`}),!v&&b.length===0&&(0,R.jsx)(`span`,{className:`sb-chat-history-empty`,children:`No saved chats yet.`}),b.map(e=>(0,R.jsxs)(`button`,{className:`sb-chat-item`,"data-active":e.id===s,title:e.title,onClick:()=>o(e.id),children:[(0,R.jsx)(`strong`,{children:e.title}),(0,R.jsx)(`span`,{title:`${e.model?`${no(e.model)} · `:``}${e.turnCount} messages`,children:oo(e.updatedAt)||`just now`})]},e.id))]})]})]}),(0,R.jsxs)(`button`,{className:`sb-cmdk`,onClick:c,children:[W.search,(0,R.jsx)(`span`,{children:`Quick jump…`}),(0,R.jsx)(`kbd`,{children:`Ctrl+K`})]}),(0,R.jsx)(`div`,{className:`sb-section`,children:(0,R.jsx)(`span`,{children:`Library`})}),(0,R.jsx)(`nav`,{className:`sb-list`,style:{flex:`0 0 auto`},children:Oo.map(n=>(0,R.jsxs)(`button`,{id:n.viewKey===`indexing`?`indexingNavBtn`:void 0,className:`sb-item`,"data-active":e===n.viewKey,onClick:()=>t(n.id),children:[(0,R.jsx)(`span`,{className:`ico`,children:n.icon}),(0,R.jsx)(`span`,{className:`label`,children:n.label})]},n.id))}),(0,R.jsxs)(`div`,{className:`sb-section`,children:[(0,R.jsx)(`span`,{children:`Archive collections`}),(0,R.jsx)(`button`,{title:`New collection`,onClick:l,children:W.plus})]}),(0,R.jsxs)(`div`,{className:`sb-list sb-collections`,children:[(0,R.jsxs)(`button`,{id:`collection-all`,className:`sb-coll`,"data-active":n===`all`,onClick:()=>r(`all`),children:[(0,R.jsx)(`span`,{className:`sb-coll-dot`,style:{background:`var(--accent)`}}),(0,R.jsxs)(`span`,{className:`sb-coll-meta`,children:[(0,R.jsx)(`b`,{children:`All collections`}),(0,R.jsxs)(`span`,{children:[S,` files · `,C.toLocaleString(),` chunks`]})]})]}),E.map(e=>{let t=f[e];return(0,R.jsxs)(`div`,{className:`sb-coll-row`,children:[(0,R.jsxs)(`button`,{id:`collection-${e}`,className:`sb-coll`,"data-active":n===e,onClick:()=>r(e),children:[(0,R.jsx)(`span`,{className:`sb-coll-dot`}),(0,R.jsxs)(`span`,{className:`sb-coll-meta`,children:[(0,R.jsx)(`b`,{children:Za(e)}),(0,R.jsxs)(`span`,{title:O(t),children:[D(t),` · `,(t?.chunks??0).toLocaleString(),` chunks`]})]})]}),e!==`chunks`&&e!==`threadshelf_conversations`&&(0,R.jsx)(`button`,{id:`delete-collection-${e}`,className:`sb-coll-delete`,title:`Delete ${Za(e)}`,"aria-label":`Delete ${Za(e)}`,onClick:t=>{t.stopPropagation(),u(e)},children:W.trash})]},e)}),T.length>0&&(0,R.jsx)(`button`,{id:`toggleEmptyCollections`,className:`sb-coll-empty-toggle`,onClick:()=>m(e=>!e),children:p?`Hide empty collections`:`Show ${T.length} empty`})]}),(0,R.jsx)(`div`,{className:`sb-section sb-manage-section`,children:(0,R.jsx)(`span`,{children:`Manage`})}),(0,R.jsx)(`nav`,{className:`sb-list sb-manage-list`,children:ko.map(n=>(0,R.jsxs)(`button`,{id:n.viewKey===`indexing`?`indexingNavBtn`:void 0,className:`sb-item`,"data-active":e===n.viewKey,onClick:()=>t(n.id),children:[(0,R.jsx)(`span`,{className:`ico`,children:n.icon}),(0,R.jsx)(`span`,{className:`label`,children:n.label})]},n.id))}),(0,R.jsxs)(`div`,{className:`sb-footer`,children:[(0,R.jsx)(Do,{}),(0,R.jsxs)(`div`,{className:`sb-footer-row`,children:[(0,R.jsxs)(`span`,{className:`sb-status`,title:`Local backend · paraphrase-multilingual embeddings · LanceDB storage. Model runtime and eject live in the chat model menu.`,children:[`local · :`,window.location.port||`80`]}),(0,R.jsx)(xo,{variant:`icon`})]})]})]})}function jo({open:e,onClose:t,setView:n,onNewChat:r,setActiveColl:i,collections:a,stats:o,onNewColl:s,onRefresh:c}){let[l,u]=(0,L.useState)(``),[d,f]=(0,L.useState)(0),p=(0,L.useRef)(null);if((0,L.useEffect)(()=>{if(e){let e=window.setTimeout(()=>{u(``),f(0),p.current?.focus()},30);return()=>window.clearTimeout(e)}},[e]),!e)return null;let m=[{label:`Go to`,items:[{id:`go-search`,label:`Search archive`,icon:W.search,action:()=>n(`/search`)},{id:`go-chat`,label:`Chat history`,icon:W.chat,action:()=>n(`/chat`)},{id:`go-insights`,label:`Insights`,icon:W.chart,action:()=>n(`/insights`)},{id:`go-indexing`,label:`Indexing`,icon:W.download,action:()=>n(`/indexing`)},{id:`go-mcp`,label:`MCP`,icon:W.plug,action:()=>n(`/mcp`)},{id:`go-settings`,label:`Settings`,icon:W.settings,action:()=>n(`/settings`)}]},{label:`Collections`,items:[{id:`coll-all`,label:`All collections`,icon:W.scope,action:()=>i(`all`)},...a.filter(e=>e!==`all`).map(e=>({id:`coll-${e}`,label:Za(e),icon:W.database,meta:`${o[e]?.files??0} files`,action:()=>i(e)}))]},{label:`Actions`,items:[{id:`a-chat`,label:`New chat`,icon:W.spark,action:r},{id:`a-new`,label:`New collection…`,icon:W.plus,action:s},{id:`a-index`,label:`Index a folder`,icon:W.folder,action:()=>n(`/indexing`)},{id:`a-refresh`,label:`Refresh stats`,icon:W.refresh,action:c}]}].map(e=>({...e,items:e.items.filter(e=>!l||e.label.toLowerCase().includes(l.toLowerCase()))})).filter(e=>e.items.length>0),h=m.flatMap(e=>e.items),g=Math.min(d,h.length-1),_=e=>{e.key===`ArrowDown`?(e.preventDefault(),f(e=>(e+1)%Math.max(1,h.length))):e.key===`ArrowUp`?(e.preventDefault(),f(e=>(e-1+h.length)%Math.max(1,h.length))):e.key===`Enter`?(e.preventDefault(),h[g]?.action(),t()):e.key===`Escape`&&t()},v=0;return(0,R.jsx)(`div`,{className:`scrim`,onClick:t,children:(0,R.jsxs)(`div`,{className:`cmdk`,onClick:e=>e.stopPropagation(),children:[(0,R.jsxs)(`div`,{className:`cmdk-input`,children:[W.searchLg,(0,R.jsx)(`input`,{ref:p,value:l,onChange:e=>{u(e.target.value),f(0)},onKeyDown:_,placeholder:`Search commands, collections, or actions…`}),(0,R.jsx)(`kbd`,{children:`ESC`})]}),(0,R.jsxs)(`div`,{className:`cmdk-list`,children:[m.map(e=>(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`cmdk-group-h`,children:e.label}),e.items.map(e=>{let n=v++;return(0,R.jsxs)(`button`,{className:`cmdk-item`,"data-active":n===g,onMouseEnter:()=>f(n),onClick:()=>{e.action(),t()},children:[(0,R.jsx)(`span`,{className:`ico`,children:e.icon}),(0,R.jsx)(`span`,{children:e.label}),e.meta&&(0,R.jsx)(`span`,{className:`meta`,children:e.meta})]},e.id)})]},e.label)),h.length===0&&(0,R.jsx)(`div`,{style:{padding:24,textAlign:`center`,color:`var(--text-3)`,fontSize:12},children:`No matches`})]})]})})}function Mo({open:e,onClose:t,onCreated:n}){let[r,i]=(0,L.useState)(``),a=Ya(),o=(0,L.useCallback)(async()=>{if(r)try{let e=await a.mutateAsync(r);i(``),t(),n(e.collection??r),q.success(`Created collection "${e.collection??r}".`)}catch(e){q.error(e instanceof Error?e.message:`Unknown error`)}},[r,t,n,a]);return e?(0,R.jsx)(`div`,{className:`scrim`,onClick:t,children:(0,R.jsxs)(`div`,{className:`modal-card`,onClick:e=>e.stopPropagation(),children:[(0,R.jsxs)(`div`,{className:`modal-head`,children:[(0,R.jsx)(`h3`,{children:`New collection`}),(0,R.jsx)(`p`,{children:`Collections are local LanceDB tables. Use lowercase, alphanumeric, hyphens, underscores.`})]}),(0,R.jsxs)(`div`,{className:`modal-body`,children:[(0,R.jsx)(`label`,{children:`Name`}),(0,R.jsx)(`input`,{autoFocus:!0,value:r,onChange:e=>i(e.target.value.replace(/[^a-z0-9_-]/g,``).toLowerCase()),onKeyDown:e=>e.key===`Enter`&&r&&void o(),placeholder:`my-archive`})]}),(0,R.jsxs)(`div`,{className:`modal-foot`,children:[(0,R.jsx)(`button`,{className:`btn ghost`,onClick:t,children:`Cancel`}),(0,R.jsx)(`button`,{className:`btn primary`,onClick:()=>void o(),disabled:!r,children:`Create`})]})]})}):null}var No={info:W.info,success:W.check,error:W.warn};function Po(){let e=wo(e=>e.toasts),t=wo(e=>e.dismissToast);return e.length===0?null:(0,R.jsx)(`div`,{className:`toaster`,role:`status`,"aria-live":`polite`,children:e.map(e=>(0,R.jsxs)(`button`,{className:`toast`,"data-type":e.type,onClick:()=>t(e.id),title:`Dismiss`,children:[(0,R.jsx)(`span`,{className:`toast-ico`,children:No[e.type]}),(0,R.jsx)(`span`,{className:`toast-text`,children:e.text})]},e.id))})}function Fo(){let e=wo(e=>e.confirmState),t=wo(e=>e.resolveConfirm);if((0,L.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),t(!1))};return window.addEventListener(`keydown`,n,!0),()=>window.removeEventListener(`keydown`,n,!0)},[e,t]),!e)return null;let{title:n,message:r,confirmLabel:i,cancelLabel:a,danger:o}=e;return(0,R.jsx)(`div`,{className:`scrim`,onClick:()=>t(!1),children:(0,R.jsxs)(`div`,{className:`modal-card`,onClick:e=>e.stopPropagation(),role:`alertdialog`,"aria-modal":`true`,children:[(0,R.jsxs)(`div`,{className:`modal-head`,children:[(0,R.jsx)(`h3`,{children:n}),r&&(0,R.jsx)(`p`,{children:r})]}),(0,R.jsxs)(`div`,{className:`modal-foot`,children:[(0,R.jsx)(`button`,{className:`btn ghost`,onClick:()=>t(!1),children:a??`Cancel`}),(0,R.jsx)(`button`,{className:`btn ${o?`danger`:`primary`}`,onClick:()=>t(!0),autoFocus:!0,children:i??`Confirm`})]})]})})}function Io(){let e=Qr(),t=Ke(),n=fa(),r=n.some(e=>e.pathname===`/thread`),i=B(e=>e.theme),a=B(e=>e.activeColl),o=B(e=>e.setActiveColl),s=B(e=>e.sidebarOpen),c=B(e=>e.setSidebarOpen),l=B(e=>e.cmdkOpen),u=B(e=>e.setCmdkOpen),d=B(e=>e.newCollOpen),f=B(e=>e.setNewCollOpen),{data:p}=za(),m=p?.collections??[`all`,`chunks`],h=p?.stats??{},g=qa(),_=(0,L.useCallback)(()=>c(!1),[c]),v=(0,L.useCallback)(async()=>{await Promise.all([t.invalidateQueries({queryKey:[`collections`]}),t.invalidateQueries({queryKey:[`files`]}),t.invalidateQueries({queryKey:[`search`]}),t.invalidateQueries({queryKey:[`thread`]})]),q.success(`Local index data refreshed.`)},[t]);(0,L.useEffect)(()=>{document.documentElement.dataset.theme=i},[i]);let y=(0,L.useCallback)(async t=>{if(t!==`chunks`&&t!==`threadshelf_conversations`&&await To({title:`Delete collection "${Za(t)}"?`,message:`The index and copies previously uploaded through ThreadShelf are deleted. Files in the original folder you selected remain untouched.`,confirmLabel:`Delete`,danger:!0}))try{await g.mutateAsync(t),a===t&&(o(`all`),e.navigate({to:`/search/$collection`,params:{collection:`all`}})),q.success(`Deleted collection "${Za(t)}".`)}catch(e){q.error(e instanceof Error?e.message:`Unknown error`)}},[a,o,g,e]),b=(0,L.useCallback)(t=>{t===`/search`?e.navigate({to:`/search/$collection`,params:{collection:a}}):t===`/chat`?e.navigate({to:`/chat`,search:{}}):e.navigate({to:t}),_()},[e,_,a]),x=(0,L.useCallback)(()=>{e.navigate({to:`/chat`,search:{draft:Date.now().toString(36)}}),_()},[e,_]),S=(0,L.useCallback)(()=>{e.navigate({to:`/chat`,search:{private:Date.now().toString(36)}}),_()},[e,_]),C=(0,L.useCallback)(t=>{e.navigate({to:`/chat`,search:{thread:t}}),_()},[e,_]),w=(0,L.useCallback)(t=>{o(t),e.navigate({to:`/search/$collection`,params:{collection:t}}),_()},[o,e,_]);(0,L.useEffect)(()=>{let t=t=>{let n=t.target.tagName.toLowerCase(),i=n===`input`||n===`textarea`;if((t.metaKey||t.ctrlKey)&&t.key.toLowerCase()===`k`){t.preventDefault(),u(!l);return}if(t.key===`Escape`){l?u(!1):d?f(!1):r?e.history.back():s&&_();return}!i&&t.key===`/`&&(t.preventDefault(),document.querySelector(`.search-card input`)?.focus())};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[l,d,r,u,f,e,s,_]);let T=n[n.length-1]?.pathname??`/search`,E=r||T.startsWith(`/search`)?`search`:T.split(`/`)[1]||`search`,D=n.find(e=>e.pathname===`/chat`)?.search,O=typeof D?.thread==`string`?D.thread:``;return(0,R.jsxs)(`div`,{className:`app`,"data-reading":r,"data-sidebar-open":s,children:[(0,R.jsx)(Ao,{view:E,setView:b,activeColl:a,setActiveColl:w,onNewChat:x,onNewPrivateChat:S,onOpenChat:C,activeChatId:O,onCmdK:()=>{u(!0),_()},onNewColl:()=>{f(!0),_()},onDeleteCollection:y,collections:m,stats:h}),(0,R.jsx)(`button`,{className:`sidebar-scrim`,onClick:_,"aria-label":`Close sidebar`,tabIndex:s?0:-1}),(0,R.jsx)(`div`,{className:`main`,children:(0,R.jsx)(ca,{})}),(0,R.jsx)(jo,{open:l,onClose:()=>u(!1),setView:b,onNewChat:x,setActiveColl:w,collections:m,stats:h,onNewColl:()=>{u(!1),f(!0)},onRefresh:()=>void v()}),d&&(0,R.jsx)(Mo,{open:!0,onClose:()=>f(!1),onCreated:e=>{w(e)}}),(0,R.jsx)(Fo,{}),(0,R.jsx)(Po,{})]})}var Lo={"google-ai-studio":{label:`Google AI Studio`,short:`AI Studio`,color:`var(--p-google)`},google:{label:`Google AI Studio`,short:`AI Studio`,color:`var(--p-google)`},openrouter:{label:`OpenRouter`,short:`OpenRouter`,color:`var(--p-openrouter)`},openai:{label:`ChatGPT`,short:`ChatGPT`,color:`var(--p-openai)`},anthropic:{label:`Claude`,short:`Claude`,color:`var(--p-claude)`},claude:{label:`Claude`,short:`Claude`,color:`var(--p-claude)`},"lm-studio":{label:`LM Studio`,short:`LM Studio`,color:`var(--p-lmstudio)`},grok:{label:`Grok`,short:`Grok`,color:`var(--p-grok)`},threadshelf:{label:`ThreadShelf`,short:`ThreadShelf`,color:`oklch(0.74 0.16 165)`}},Ro={label:`Unknown`,short:`—`,color:`var(--border-2)`},zo=e=>e?Lo[e]??Ro:Ro,Bo=[`paper chromatography household experiment`,`fact-checking workflow with citations`,`sauna rules and temperature`,`openrouter export json schema`,`ablation study sample size`,`polish translation tone register`];function Vo({onPick:e}){return(0,R.jsxs)(`div`,{className:`empty`,children:[(0,R.jsx)(`h3`,{children:`Ask your archive in plain language.`}),(0,R.jsx)(`p`,{children:`ThreadShelf runs locally — your queries embed on this machine and search a local LanceDB. Try a topic, a draft you half-remember, or the shape of an answer you're looking for.`}),(0,R.jsx)(`div`,{className:`examples`,children:Bo.map(t=>(0,R.jsxs)(`button`,{className:`example-chip`,onClick:()=>e(t),children:[W.spark,(0,R.jsx)(`span`,{children:t})]},t))})]})}function Ho(e,t){let n=G(t);if(!n)return e;try{return K(e,t).map((e,t)=>n.test(e)?(0,R.jsx)(`mark`,{children:e},t):e)}catch{return e}}function Uo({result:e,query:t,onClick:n,selected:r,onMoreLikeThis:i}){let{metadata:a}=e,o=a.role??`ai`,s={user:`user`,thinking:`reasoning`,ai:`response`}[o]??o,c=zo(a.provider),l=$a(a.model),u=ao(a.createdAt),d=e.distance==null?``:(1-e.distance).toFixed(3),f=e.distance==null?0:Math.round((1-e.distance)*100),p=(0,L.useMemo)(()=>Ho(e.document,t),[e.document,t]),m=a.title?.trim()||Qa(a.sourceFile);return(0,R.jsxs)(`button`,{className:`result`,"data-selected":r,"aria-selected":r,onClick:n,children:[(0,R.jsxs)(`div`,{className:`result-head`,children:[(0,R.jsx)(`span`,{className:`r-role`,"data-role":o,children:s}),(0,R.jsxs)(`span`,{className:`r-provider`,children:[(0,R.jsx)(`span`,{className:`pdot`,style:{background:c.color}}),(0,R.jsx)(`span`,{children:c.short})]}),a.createdInThreadShelf&&(0,R.jsx)(`span`,{className:`threadshelf-turn-badge`,children:`ThreadShelf`}),e.distance!=null&&(0,R.jsx)(`div`,{className:`r-meta-right`,children:(0,R.jsxs)(`span`,{className:`r-score`,children:[(0,R.jsx)(`span`,{className:`r-score-bar`,children:(0,R.jsx)(`i`,{style:{width:`${f}%`}})}),(0,R.jsx)(`span`,{children:d})]})})]}),(0,R.jsx)(`div`,{className:`r-title`,title:m,children:m}),(0,R.jsx)(`div`,{className:`r-snippet`,children:p}),(0,R.jsxs)(`div`,{className:`r-foot`,children:[(0,R.jsxs)(`span`,{className:`r-source`,title:a.sourceFile,children:[W.folder,(0,R.jsx)(`span`,{className:`r-source-coll`,children:Za(a.collection??``)}),(0,R.jsx)(`span`,{className:`slash`,children:`/`}),(0,R.jsx)(`span`,{className:`r-source-file`,children:Qa(a.sourceFile)})]}),(0,R.jsx)(`span`,{className:`dot`}),l&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`mono`,children:l}),(0,R.jsx)(`span`,{className:`dot`})]}),u&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{children:u}),(0,R.jsx)(`span`,{className:`dot`})]}),a.turnIndex!=null&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`span`,{children:[`turn `,(0,R.jsxs)(`b`,{className:`mono`,children:[`#`,a.turnIndex]})]}),(0,R.jsx)(`span`,{className:`dot`})]}),i&&(0,R.jsx)(`span`,{className:`more-like-this`,role:`button`,tabIndex:0,title:`Search for similar passages`,onClick:e=>{e.stopPropagation(),i()},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),i())},children:`more like this`}),(0,R.jsxs)(`span`,{className:`open-thread`,children:[`open thread `,W.arrowRight]})]})]})}var Wo={search:`Archive`,insights:`Insights`,indexing:`Add data`,mcp:`MCP`,settings:`Settings`,chat:`Chat`};function Go({view:e,activeColl:t,onMenu:n,actions:r}){return(0,R.jsxs)(`div`,{className:`topbar`,children:[(0,R.jsx)(`button`,{className:`icon-btn mobile-menu-btn`,onClick:n,"aria-label":`Open sidebar`,children:W.menu}),(0,R.jsxs)(`div`,{className:`crumbs`,children:[(0,R.jsx)(`span`,{children:Wo[e]}),e===`search`&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`sep`,children:`/`}),(0,R.jsx)(`b`,{children:Za(t)})]})]}),(0,R.jsx)(`div`,{className:`topbar-spacer`}),r&&(0,R.jsx)(`div`,{className:`topbar-actions`,children:r})]})}var Ko=100,qo=e=>{switch(e){case`recent`:return(e,t)=>(t.lastTurnAt??``).localeCompare(e.lastTurnAt??``);case`longest`:return(e,t)=>(t.turnCount??0)-(e.turnCount??0);case`title`:return(e,t)=>(e.title||e.sourceFile).localeCompare(t.title||t.sourceFile,void 0,{sensitivity:`base`})}},Jo=[{id:`user`,label:`User`,key:`user`},{id:`reasoning`,label:`Reasoning`,key:`thinking`},{id:`response`,label:`Response`,key:`ai`}];function Yo(){return(0,R.jsx)(`div`,{className:`result-list`,style:{marginTop:16},children:[0,1,2].map(e=>(0,R.jsx)(`div`,{className:`shimmer-card`},e))})}function Xo(){let e=Ni(),{collection:t}=ji({from:`/search/$collection`}),{q:n,model:r,from:i,to:a,mode:o}=Mi({from:`/search/$collection`}),s=t?decodeURIComponent(t):`all`,c=B(e=>e.setActiveColl);(0,L.useEffect)(()=>{c(s)},[s,c]);let l=B(e=>e.roles),u=B(e=>e.toggleRole),d=B(e=>e.modelFilter),f=B(e=>e.setModelFilter),p=B(e=>e.setSidebarOpen),m=B(e=>e.savedSearches),h=B(e=>e.addSavedSearch),g=B(e=>e.removeSavedSearch),_=B(e=>e.pinnedConversations),v=B(e=>e.togglePinned),[y,b]=(0,L.useState)(n??``),[x,S]=(0,L.useState)(n??``),[C,w]=(0,L.useState)(i??``),[T,E]=(0,L.useState)(a??``),[D,O]=(0,L.useState)(o===`keyword`?`keyword`:`semantic`),[ee,te]=(0,L.useState)(15),[k,ne]=(0,L.useState)(-1),[re,ie]=(0,L.useState)(``),[A,j]=(0,L.useState)(`recent`),[M,ae]=(0,L.useState)(Ko),[oe,se]=(0,L.useState)(`all`),N=(0,L.useRef)(n??``),P=(0,L.useRef)(null),F=(0,L.useRef)(null),{data:ce}=Ra(),le=ce??!0,ue=(0,L.useMemo)(()=>{let e=[];return l.user&&e.push(`user`),l.thinking&&e.push(`thinking`),l.ai&&e.push(`ai`),e.length>0&&e.length<3?e.join(`,`):void 0},[l]),{data:de,isFetching:fe}=Ua((0,L.useMemo)(()=>({q:x.trim(),collection:s,n:ee,roles:ue,keywordBoost:D===`semantic`&&x.trim().length<=40,model:(r??d).trim()||void 0,from:C.trim()||void 0,to:T.trim()||void 0,mode:D,origin:oe===`all`?void 0:oe}),[x,s,ee,ue,r,d,C,T,D,oe])),{data:pe,isLoading:me}=Va(s,!x.trim()&&le),he=(0,L.useMemo)(()=>{let e=pe?.files??[],t=re.trim().toLowerCase();return[...(t?e.filter(e=>[e.title,e.sourceFile,e.conversationKey,e.collection].some(e=>(e??``).toLowerCase().includes(t))):e).filter(e=>oe===`threadshelf`?e.createdInThreadShelf===!0||e.hasThreadShelfTurns===!0:oe!==`archive`||e.hasThreadShelfTurns!==!0)].sort(qo(A))},[pe?.files,re,A,oe]),I=(0,L.useMemo)(()=>he.slice(0,M),[he,M]);(0,L.useEffect)(()=>{let e=window.setTimeout(()=>ae(Ko),0);return()=>window.clearTimeout(e)},[s,re,A,oe]),(0,L.useEffect)(()=>{P.current?.focus()},[]),(0,L.useEffect)(()=>{let e=n??``;if(e!==N.current){let t=window.setTimeout(()=>{N.current=e,b(e),S(e),w(i??``),E(a??``),O(o===`keyword`?`keyword`:`semantic`)},0);return()=>window.clearTimeout(t)}},[n,i,a,o]),(0,L.useEffect)(()=>{let e=window.setTimeout(()=>{w(i??``),E(a??``)},0);return()=>window.clearTimeout(e)},[i,a]),(0,L.useEffect)(()=>{let e=window.setTimeout(()=>te(15),0);return()=>window.clearTimeout(e)},[x,s,ue,r,d,C,T,D,oe]);let ge=(0,L.useCallback)(t=>{let n=y.trim(),r=t??D;N.current=n,S(n),e({to:`/search/$collection`,params:{collection:s},search:n?{q:n,model:d.trim()||void 0,from:C.trim()||void 0,to:T.trim()||void 0,mode:r===`keyword`?`keyword`:void 0}:{},replace:!0})},[y,d,C,T,e,s,D]),_e=(0,L.useCallback)(()=>{N.current=``,b(``),S(``),P.current?.focus(),e({to:`/search/$collection`,params:{collection:s},search:{},replace:!0})},[e,s]),ve=(0,L.useCallback)(e=>{O(e),ge(e)},[ge]),ye=(0,L.useCallback)(t=>{e({to:`/thread`,search:{sourceFile:t.metadata.sourceFile,collection:t.metadata.collection??s,conversationKey:t.metadata.conversationKey,q:x.trim()||void 0,title:t.metadata.title,matchIdx:t.metadata.turnIndex,provider:t.metadata.provider,model:t.metadata.model}})},[s,x,e]),be=(0,L.useCallback)(t=>{let n=lo(t.document);n&&(O(`semantic`),N.current=n,b(n),S(n),e({to:`/search/$collection`,params:{collection:s},search:{q:n,model:d.trim()||void 0,from:C.trim()||void 0,to:T.trim()||void 0}}))},[s,d,C,T,e]),xe=(0,L.useCallback)(t=>{e({to:`/thread`,search:{sourceFile:t.sourceFile,collection:t.collection,conversationKey:t.conversationKey,title:t.title}})},[e]),Se=x.trim().length>0,Ce=(0,L.useMemo)(()=>({q:x.trim(),collection:s,mode:D,model:(r??d).trim()||void 0,from:C.trim()||void 0,to:T.trim()||void 0}),[x,s,D,r,d,C,T]),we=(0,L.useMemo)(()=>{let e=ka(Ce);return m.find(t=>ka(t)===e)},[m,Ce]),Te=(0,L.useCallback)(()=>{we?g(we.id):h(Ce)},[we,g,h,Ce]),Ee=(0,L.useCallback)(t=>{O(t.mode),N.current=t.q,b(t.q),S(t.q),e({to:`/search/$collection`,params:{collection:t.collection},search:{q:t.q,model:t.model,from:t.from,to:t.to,mode:t.mode===`keyword`?`keyword`:void 0}})},[e]),De=(0,L.useMemo)(()=>s===`all`?_:_.filter(e=>e.collection===s),[_,s]),Oe=(0,L.useMemo)(()=>new Set(_.map(e=>Aa(e))),[_]),ke=e=>({collection:e.collection,sourceFile:e.sourceFile,conversationKey:e.conversationKey,title:e.title,provider:e.provider}),Ae=(0,L.useMemo)(()=>de?.results??[],[de?.results]),je=Se&&!fe&&Ae.length>=ee&&ee<50,Me=s===`all`?`Conversations`:`${Za(s)} conversations`,Ne=Se?Ae.length:I.length,Pe=(0,L.useCallback)(e=>{if(Se){let t=Ae[e];t&&ye(t)}else{let t=I[e];t&&xe(t)}},[Se,Ae,I,ye,xe]);return(0,L.useEffect)(()=>{let e=window.setTimeout(()=>ne(-1),0);return()=>window.clearTimeout(e)},[x,s,Se]),(0,L.useEffect)(()=>{let e=e=>{let t=e.target,n=t.tagName?.toLowerCase(),r=t===P.current;if((n===`input`||n===`textarea`)&&!r||Ne===0)return;let i=e.key===`ArrowDown`||e.key===`j`&&!r,a=e.key===`ArrowUp`||e.key===`k`&&!r;i?(e.preventDefault(),r&&P.current?.blur(),ne(e=>Math.min(Ne-1,e+1))):a?(e.preventDefault(),ne(e=>e<=0?0:e-1)):e.key===`Enter`&&!r&&k>=0&&(e.preventDefault(),Pe(k))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Ne,k,Pe]),(0,L.useEffect)(()=>{k<0||F.current?.querySelector(`[data-selected="true"]`)?.scrollIntoView({block:`nearest`})},[k]),(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Go,{view:`search`,activeColl:s,onMenu:()=>p(!0)}),(0,R.jsx)(`div`,{className:`main-scroll`,children:(0,R.jsxs)(`div`,{className:`view`,children:[!le&&(0,R.jsxs)(`div`,{className:`banner err`,children:[(0,R.jsx)(`span`,{className:`ico`,children:W.warn}),(0,R.jsxs)(`div`,{className:`grow`,children:[(0,R.jsx)(`b`,{style:{fontWeight:500},children:`Backend unreachable.`}),` `,(0,R.jsxs)(`span`,{style:{color:`var(--text-2)`},children:[`Run `,(0,R.jsx)(`code`,{children:`npm start`}),` in the project root.`]})]})]}),(0,R.jsxs)(`div`,{className:`search-card`,children:[(0,R.jsx)(`span`,{className:`search-ico`,children:W.searchLg}),(0,R.jsx)(`input`,{id:`searchInput`,ref:P,value:y,onChange:e=>b(e.target.value),onKeyDown:e=>{e.key===`Enter`?ge():e.key===`Escape`&&y&&(e.preventDefault(),e.stopPropagation(),_e())},placeholder:D===`keyword`?`Exact match: identifiers, error strings, code…`:`Search by meaning across your archive…`}),y&&(0,R.jsx)(`button`,{id:`clearSearch`,type:`button`,className:`search-clear`,"aria-label":`Clear search`,title:`Clear search (Esc)`,onClick:_e,children:W.close})]}),(0,R.jsxs)(`div`,{className:`search-toolbar`,children:[(0,R.jsxs)(`div`,{className:`mode-toggle`,role:`group`,"aria-label":`Search mode`,children:[(0,R.jsx)(`button`,{type:`button`,className:`mode-btn`,"data-on":D===`semantic`,title:`Rank by meaning (local embeddings)`,onClick:()=>ve(`semantic`),children:`Semantic`}),(0,R.jsx)(`button`,{type:`button`,className:`mode-btn`,"data-on":D===`keyword`,title:`Exact substring match (case-insensitive)`,onClick:()=>ve(`keyword`),children:`Exact`})]}),(0,R.jsx)(`div`,{className:`role-chips`,children:Jo.map(e=>(0,R.jsxs)(`button`,{className:`role-chip`,"data-role":e.id,"data-on":l[e.key],onClick:()=>u(e.key),children:[(0,R.jsx)(`span`,{className:`dot`}),e.label]},e.id))}),(0,R.jsxs)(`label`,{className:`origin-filter`,children:[(0,R.jsx)(`span`,{children:`origin`}),(0,R.jsxs)(`select`,{"aria-label":`Filter by conversation origin`,value:oe,onChange:e=>se(e.target.value),children:[(0,R.jsx)(`option`,{value:`all`,children:`All`}),(0,R.jsx)(`option`,{value:`threadshelf`,children:`ThreadShelf`}),(0,R.jsx)(`option`,{value:`archive`,children:`Clean archive`})]})]}),(0,R.jsxs)(`label`,{className:`model-filter`,children:[(0,R.jsx)(`span`,{children:`model`}),(0,R.jsx)(`input`,{value:d,onChange:e=>f(e.target.value),onKeyDown:e=>e.key===`Enter`&&ge(),placeholder:`gpt-5, claude, gemini...`})]}),(0,R.jsxs)(`label`,{className:`date-filter`,children:[(0,R.jsx)(`span`,{children:`from`}),(0,R.jsx)(`input`,{type:`date`,value:C,onChange:e=>w(e.target.value),onKeyDown:e=>e.key===`Enter`&&ge()})]}),(0,R.jsxs)(`label`,{className:`date-filter`,children:[(0,R.jsx)(`span`,{children:`to`}),(0,R.jsx)(`input`,{type:`date`,value:T,onChange:e=>E(e.target.value),onKeyDown:e=>e.key===`Enter`&&ge()})]}),(0,R.jsx)(`span`,{className:`toolbar-spacer`}),(0,R.jsxs)(`span`,{className:`toolbar-hint`,children:[(0,R.jsx)(`kbd`,{children:`/`}),` focus · `,(0,R.jsx)(`kbd`,{children:`↑↓`}),` navigate · `,(0,R.jsx)(`kbd`,{children:`↵`}),` open · `,(0,R.jsx)(`kbd`,{children:`Ctrl+K`}),` `,`commands`]})]}),!Se&&(0,R.jsxs)(R.Fragment,{children:[s===`all`&&(0,R.jsx)(Vo,{onPick:t=>{N.current=t,b(t),S(t),e({to:`/search/$collection`,params:{collection:s},search:{q:t},replace:!0})}}),m.length>0&&(0,R.jsxs)(`div`,{className:`saved-searches`,children:[(0,R.jsxs)(`span`,{className:`ss-label`,children:[W.star,` Saved`]}),m.map(e=>(0,R.jsxs)(`span`,{className:`ss-chip`,children:[(0,R.jsxs)(`button`,{type:`button`,className:`ss-run`,title:`Run: ${e.q}`,onClick:()=>Ee(e),children:[(0,R.jsx)(`span`,{className:`ss-q`,children:e.q}),e.collection!==`all`&&(0,R.jsx)(`span`,{className:`ss-tag`,children:Za(e.collection)}),e.mode===`keyword`&&(0,R.jsx)(`span`,{className:`ss-tag`,children:`exact`})]}),(0,R.jsx)(`button`,{type:`button`,className:`ss-del`,"aria-label":`Delete saved search "${e.q}"`,onClick:()=>g(e.id),children:`×`})]},e.id))]}),De.length>0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`results-meta-bar`,children:(0,R.jsxs)(`span`,{className:`h`,children:[`Pinned `,(0,R.jsx)(`b`,{children:De.length})]})}),(0,R.jsx)(`div`,{className:`result-list`,children:De.map(e=>{let t=e.provider?zo(e.provider):null,n=Qa(e.sourceFile);return(0,R.jsxs)(`button`,{className:`result`,onClick:()=>xe(e),children:[(0,R.jsxs)(`div`,{className:`result-head`,children:[(0,R.jsx)(`span`,{className:`r-role`,"data-role":`user`,children:`pinned`}),(0,R.jsxs)(`span`,{className:`r-provider`,children:[(0,R.jsx)(`span`,{className:`pdot`,style:{background:t?.color??`var(--accent)`}}),(0,R.jsx)(`span`,{children:t?.short??Za(e.collection)})]}),(0,R.jsx)(`span`,{className:`pin-toggle`,role:`button`,tabIndex:0,"data-on":`true`,title:`Unpin`,onClick:t=>{t.stopPropagation(),v(e)},onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),t.stopPropagation(),v(e))},children:W.pinFilled})]}),(0,R.jsx)(`div`,{className:`r-title`,title:e.title||n,children:e.title||n}),(0,R.jsxs)(`div`,{className:`r-foot`,children:[(0,R.jsxs)(`span`,{className:`r-source`,title:e.sourceFile,children:[W.folder,(0,R.jsx)(`span`,{className:`r-source-coll`,children:Za(e.collection)}),(0,R.jsx)(`span`,{className:`slash`,children:`/`}),(0,R.jsx)(`span`,{className:`r-source-file`,children:n})]}),(0,R.jsxs)(`span`,{className:`open-thread`,children:[`open thread `,W.arrowRight]})]})]},Aa(e))})})]}),(0,R.jsxs)(`div`,{className:`results-meta-bar`,children:[(0,R.jsxs)(`span`,{className:`h`,children:[Me,` `,(0,R.jsx)(`b`,{children:he.length})]}),(0,R.jsxs)(`label`,{className:`conv-sort`,children:[(0,R.jsx)(`span`,{children:`sort`}),(0,R.jsxs)(`select`,{value:A,onChange:e=>j(e.target.value),"aria-label":`Sort conversations`,children:[(0,R.jsx)(`option`,{value:`recent`,children:`Recent`}),(0,R.jsx)(`option`,{value:`longest`,children:`Longest`}),(0,R.jsx)(`option`,{value:`title`,children:`Title`})]})]}),(0,R.jsx)(`input`,{className:`conv-filter`,value:re,onChange:e=>ie(e.target.value),placeholder:`Filter by title or file…`,"aria-label":`Filter conversations`})]}),me?(0,R.jsx)(Yo,{}):he.length>0?(0,R.jsxs)(`div`,{className:`result-list`,ref:F,children:[I.map((e,t)=>{let n=Qa(e.sourceFile),r=e.title||n,i=e.provider?zo(e.provider):null,a=ao(e.lastTurnAt),o=ke(e),s=Oe.has(Aa(o));return(0,R.jsxs)(`button`,{className:`result`,"data-selected":t===k,"aria-selected":t===k,onClick:()=>xe(e),children:[(0,R.jsxs)(`div`,{className:`result-head`,children:[(0,R.jsx)(`span`,{className:`r-role`,"data-role":`ai`,children:`thread`}),e.hasThreadShelfTurns&&(0,R.jsx)(`span`,{className:`threadshelf-turn-badge`,children:e.createdInThreadShelf?`Created in ThreadShelf`:`Continued in ThreadShelf`}),(0,R.jsxs)(`span`,{className:`r-provider`,children:[(0,R.jsx)(`span`,{className:`pdot`,style:{background:i?.color??`var(--accent)`}}),(0,R.jsx)(`span`,{children:i?.short??Za(e.collection)})]}),(0,R.jsx)(`span`,{className:`pin-toggle`,role:`button`,tabIndex:0,"data-on":s,title:s?`Unpin`:`Pin conversation`,onClick:e=>{e.stopPropagation(),v(o)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),v(o))},children:s?W.pinFilled:W.pin})]}),(0,R.jsx)(`div`,{className:`r-title`,title:r,children:r}),(0,R.jsxs)(`div`,{className:`r-foot`,children:[(0,R.jsxs)(`span`,{className:`r-source`,title:e.sourceFile,children:[W.folder,(0,R.jsx)(`span`,{className:`r-source-coll`,children:Za(e.collection)}),(0,R.jsx)(`span`,{className:`slash`,children:`/`}),(0,R.jsx)(`span`,{className:`r-source-file`,children:n})]}),e.turnCount!=null&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`dot`}),(0,R.jsxs)(`span`,{children:[e.turnCount,` turns`]})]}),a&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`dot`}),(0,R.jsx)(`span`,{children:a})]}),(0,R.jsxs)(`span`,{className:`open-thread`,children:[`open thread `,W.arrowRight]})]})]},`${e.collection}:${e.sourceFile}:${t}`)}),he.length>M&&(0,R.jsx)(`div`,{className:`load-more-row`,children:(0,R.jsxs)(`button`,{type:`button`,className:`load-more-button`,onClick:()=>ae(e=>e+Ko),children:[`Show more (`,he.length-M,` left)`]})})]}):re.trim()?(0,R.jsxs)(`div`,{className:`empty`,children:[(0,R.jsx)(`h3`,{children:`No conversations match the filter.`}),(0,R.jsx)(`p`,{children:`Try a different phrase or clear the filter box.`})]}):s===`all`?null:(0,R.jsxs)(`div`,{className:`empty`,children:[(0,R.jsx)(`h3`,{children:`No conversations indexed.`}),(0,R.jsx)(`p`,{children:`Index a folder into this collection or switch to another collection.`})]})]}),Se&&fe&&(0,R.jsx)(Yo,{}),Se&&!fe&&Ae.length===0&&(0,R.jsxs)(`div`,{className:`empty`,children:[(0,R.jsx)(`h3`,{children:`No results found.`}),(0,R.jsx)(`p`,{children:`Try another query, broaden your role filters, or index more files.`})]}),Se&&!fe&&Ae.length>0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`results-meta-bar`,children:[(0,R.jsxs)(`span`,{className:`h`,children:[`Results `,(0,R.jsx)(`b`,{children:Ae.length}),(0,R.jsxs)(`span`,{style:{marginLeft:14,color:`var(--text-3)`},children:[`in `,Za(s)]})]}),(0,R.jsxs)(`button`,{type:`button`,className:`save-search`,"data-on":!!we,title:we?`Remove from saved searches`:`Save this search`,onClick:Te,children:[we?W.starFilled:W.star,(0,R.jsx)(`span`,{children:we?`Saved`:`Save search`})]})]}),(0,R.jsx)(`div`,{className:`result-list`,ref:F,children:Ae.map((e,t)=>(0,R.jsx)(Uo,{result:e,query:x,selected:t===k,onClick:()=>ye(e),onMoreLikeThis:()=>be(e)},t))}),je&&(0,R.jsx)(`div`,{className:`load-more-row`,children:(0,R.jsx)(`button`,{type:`button`,className:`load-more-button`,onClick:()=>te(e=>Math.min(e+15,50)),children:`Load more`})})]})]})})]})}var Zo=/^(\s*)([-*+]|\d+[.)])\s+(.*)$/,Qo=/^\s*\d+[.)]\s+/,$o=e=>{let t=e.trim();return/^(?:https?:\/\/|mailto:|#|\/)/i.test(t)?t:null},es=e=>{let t=[],n=``,r=()=>{n&&=(t.push({type:`text`,value:n}),``)},i=0;for(;i<e.length;){let a=e[i];if(a==="`"){let n=e.indexOf("`",i+1);if(n>i){r(),t.push({type:`code`,value:e.slice(i+1,n)}),i=n+1;continue}}if(a===`[`){let n=e.indexOf(`]`,i+1);if(n>i&&e[n+1]===`(`){let a=e.indexOf(`)`,n+2);if(a>n){let o=$o(e.slice(n+2,a));if(o){r(),t.push({type:`link`,href:o,children:es(e.slice(i+1,n))}),i=a+1;continue}}}}if(a===`*`&&e[i+1]===`*`||a===`_`&&e[i+1]===`_`){let n=e.slice(i,i+2),a=e.indexOf(n,i+2);if(a>i+1){r(),t.push({type:`strong`,children:es(e.slice(i+2,a))}),i=a+2;continue}}if(a===`*`){let n=e.indexOf(`*`,i+1);if(n>i+1){r(),t.push({type:`em`,children:es(e.slice(i+1,n))}),i=n+1;continue}}n+=a,i+=1}return r(),t},ts=e=>{let t=e.replace(/\r\n?/g,`
|
|
18
|
+
`).split(`
|
|
19
|
+
`),n=[],r=0;for(;r<t.length;){let e=t[r];if(!e.trim()){r+=1;continue}let i=/^```(\w+)?\s*$/.exec(e);if(i){let e=[];for(r+=1;r<t.length&&!/^```\s*$/.test(t[r]);)e.push(t[r]),r+=1;r+=1,n.push({type:`code`,value:e.join(`
|
|
20
|
+
`),lang:i[1]});continue}let a=/^(#{1,6})\s+(.*)$/.exec(e);if(a){n.push({type:`heading`,level:a[1].length,children:es(a[2].trim())}),r+=1;continue}if(/^>\s?/.test(e)){let e=[];for(;r<t.length&&/^>\s?/.test(t[r]);)e.push(t[r].replace(/^>\s?/,``)),r+=1;n.push({type:`quote`,children:es(e.join(`
|
|
21
|
+
`))});continue}if(Zo.test(e)){let i=Qo.test(e),a=[];for(;r<t.length&&Zo.test(t[r])&&Qo.test(t[r])===i;)a.push(es(Zo.exec(t[r])[3])),r+=1;n.push({type:`list`,ordered:i,items:a});continue}let o=[];for(;r<t.length&&t[r].trim()&&!/^```/.test(t[r])&&!/^#{1,6}\s/.test(t[r])&&!/^>\s?/.test(t[r])&&!Zo.test(t[r]);)o.push(t[r]),r+=1;n.push({type:`paragraph`,children:es(o.join(`
|
|
22
|
+
`))})}return n},ns=e=>e.map((e,t)=>{switch(e.type){case`text`:return(0,R.jsx)(L.Fragment,{children:e.value},t);case`strong`:return(0,R.jsx)(`strong`,{children:ns(e.children)},t);case`em`:return(0,R.jsx)(`em`,{children:ns(e.children)},t);case`code`:return(0,R.jsx)(`code`,{children:e.value},t);case`link`:return(0,R.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer noopener`,children:ns(e.children)},t)}}),rs=(e,t)=>{switch(e.type){case`heading`:{let n=`h${Math.min(6,e.level+2)}`;return(0,R.jsx)(n,{children:ns(e.children)},t)}case`paragraph`:return(0,R.jsx)(`p`,{children:ns(e.children)},t);case`code`:return(0,R.jsx)(`pre`,{children:(0,R.jsx)(`code`,{children:e.value})},t);case`quote`:return(0,R.jsx)(`blockquote`,{children:ns(e.children)},t);case`list`:{let n=e.items.map((e,t)=>(0,R.jsx)(`li`,{children:ns(e)},t));return e.ordered?(0,R.jsx)(`ol`,{children:n},t):(0,R.jsx)(`ul`,{children:n},t)}}};function is({text:e,className:t}){let n=ts(e);return(0,R.jsx)(`div`,{className:t?`md-body ${t}`:`md-body`,children:n.map((e,t)=>rs(e,t))})}function as(){let{data:e}=Wa(),t=Ka(H.createMasterPrompt),n=Ka(e=>H.updateMasterPrompt(e.id,{name:e.name,text:e.text})),r=Ka(H.deleteMasterPrompt),i=Ka(H.setActiveMasterPrompt),a=(0,L.useRef)(null),[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(``),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(``),m=e?.prompts??[],h=e?.activeId??``,g=m.find(e=>e.id===h),_=t.isPending||n.isPending||r.isPending||i.isPending;(0,L.useEffect)(()=>{if(!o)return;let e=e=>{a.current?.contains(e.target)||s(!1)},t=()=>{let e=a.current,t=e?.querySelector(`.master-prompt-popover`);if(!e||!t)return;let n=e.getBoundingClientRect(),r=window.visualViewport,i=r?.offsetTop??0,o=r?.offsetLeft??0,s=r?.height??window.innerHeight,c=r?.width??window.innerWidth,l=window.innerWidth<=640?60:56,u=n.top-(i+l)-8,d=i+s-n.bottom-20,f=d>u?`down`:`up`,p=Math.max(96,Math.floor(f===`down`?d:u)),m=o+12,h=o+c-12,g=Math.min(Math.max(n.left,m),Math.max(m,h-t.offsetWidth));e.dataset.popoverPlacement=f,e.style.setProperty(`--master-popover-available-height`,`${p}px`),e.style.setProperty(`--master-popover-shift-x`,`${g-n.left}px`)};return t(),document.addEventListener(`pointerdown`,e),window.addEventListener(`resize`,t),window.addEventListener(`scroll`,t,!0),window.visualViewport?.addEventListener(`resize`,t),()=>{document.removeEventListener(`pointerdown`,e),window.removeEventListener(`resize`,t),window.removeEventListener(`scroll`,t,!0),window.visualViewport?.removeEventListener(`resize`,t)}},[o]);let v=e=>{let t=m.find(t=>t.id===e);l(t?e:``),d(t?.name??``),p(t?.text??``)},y=(e,t)=>q.error(e instanceof Error?e.message:t);return(0,R.jsxs)(`div`,{className:`master-prompt`,ref:a,children:[(0,R.jsx)(`button`,{type:`button`,id:`masterPromptButton`,className:`master-prompt-chip`,"data-active":!!g,"aria-expanded":o,"aria-haspopup":`dialog`,title:g?`Master prompt: ${g.name}`:`No master prompt — click to add one`,onClick:()=>{o||v(h),s(e=>!e)},children:g?g.name:`System`}),o&&(0,R.jsxs)(`div`,{className:`master-prompt-popover`,role:`dialog`,"aria-label":`Master prompt`,children:[(0,R.jsxs)(`div`,{className:`master-prompt-tabs`,children:[(0,R.jsx)(`button`,{type:`button`,"data-active":!h,title:`Send no master prompt`,disabled:_,onClick:()=>i.mutate(``,{onError:e=>y(e,`Could not turn the master prompt off.`)}),children:`Off`}),m.map(e=>(0,R.jsx)(`button`,{type:`button`,"data-active":e.id===h,title:e.text,disabled:_,onClick:()=>{v(e.id),i.mutate(e.id,{onError:e=>y(e,`Could not switch the master prompt.`)})},children:e.name},e.id)),(0,R.jsx)(`button`,{type:`button`,className:`master-prompt-new`,title:`New master prompt`,"aria-label":`New master prompt`,onClick:()=>v(``),children:`+`})]}),(0,R.jsx)(`input`,{className:`master-prompt-name`,"aria-label":`Master prompt name`,placeholder:`Name (optional)`,value:u,maxLength:60,onChange:e=>d(e.target.value)}),(0,R.jsx)(`textarea`,{id:`masterPromptText`,"aria-label":`Master prompt text`,placeholder:`Sent as a system message with every request…`,rows:5,maxLength:2e4,value:f,onChange:e=>p(e.target.value)}),(0,R.jsxs)(`div`,{className:`master-prompt-foot`,children:[(0,R.jsxs)(`span`,{children:[f.trim().length.toLocaleString(),` chars · saved locally`]}),c&&(0,R.jsx)(`button`,{type:`button`,className:`btn sm ghost`,disabled:_,onClick:()=>r.mutate(c,{onSuccess:()=>v(``),onError:e=>y(e,`Could not delete the master prompt.`)}),children:`Delete`}),(0,R.jsx)(`button`,{type:`button`,className:`btn sm primary`,disabled:_,onClick:()=>{let e=f.trim();if(!e){q.error(`A master prompt cannot be empty.`);return}let r=()=>{s(!1),q.success(`Master prompt saved and active for every new message.`)};c?n.mutate({id:c,name:u.trim(),text:e},{onSuccess:r,onError:e=>y(e,`Could not save the master prompt.`)}):t.mutate({name:u.trim(),text:e},{onSuccess:r,onError:e=>y(e,`Could not save the master prompt.`)})},children:c?`Save`:`Add`})]})]})]})}var os=[{value:`downloads`,label:`Most downloaded`},{value:`trending`,label:`Trending`},{value:`likes`,label:`Most liked`},{value:`recent`,label:`Recently updated`}],ss={fits:`fits in VRAM`,tight:`partly on CPU`,"too-large":`too large`},cs=e=>{if(!e)return`detecting hardware…`;let t=e.devices[0];return t?`${t.name} · ${yo(e.modelBudgetBytes)} usable`:`CPU only · ${yo(e.modelBudgetBytes)} usable RAM`};function ls({open:e,onClose:t,onDownloaded:n}){let[r,i]=(0,L.useState)(``),[a,o]=(0,L.useState)(`downloads`),[s,c]=(0,L.useState)([]),[l,u]=(0,L.useState)(null),[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)(!1),[h,g]=(0,L.useState)(``),[_,v]=(0,L.useState)(null),[y,b]=(0,L.useState)(null),[x,S]=(0,L.useState)(!1),[C,w]=(0,L.useState)(null),[T,E]=(0,L.useState)({done:0,total:0,file:``}),D=(0,L.useRef)(null);(0,L.useEffect)(()=>{if(!e)return;let t=new AbortController,n=setTimeout(()=>{m(!0),g(``),H.catalogSearch({q:r,sort:a},t.signal).then(e=>{c(e.models),u(e.hardware),f(e.tokenConfigured)}).catch(e=>{t.signal.aborted||g(e instanceof Error?e.message:`Could not reach the model catalog.`)}).finally(()=>{t.signal.aborted||m(!1)})},r?350:0);return()=>{clearTimeout(n),t.abort()}},[e,r,a]);let O=(0,L.useCallback)(()=>{D.current?.abort(),v(null),b(null),t()},[t]),ee=(0,L.useCallback)(e=>{if(_===e){v(null),b(null);return}v(e),b(null),S(!0),H.catalogModel(e).then(e=>{b(e.model),u(e.hardware)}).catch(e=>q.error(e instanceof Error?e.message:`Could not load model files.`)).finally(()=>S(!1))},[_]),te=(0,L.useCallback)(async(e,t)=>{let r=new AbortController;D.current=r,w(`${e}:${t}`),E({done:0,total:0,file:``});try{let i=``;await H.catalogDownload({repoId:e,quant:t},e=>{e.type===`progress`&&e.phase===`downloading`&&E({done:e.downloadedBytes??0,total:e.totalBytes??0,file:e.file??``}),e.type===`done`&&(i=e.primaryPath)},r.signal),q.success(`Downloaded ${e} (${t}).`),i&&n?.(i)}catch(e){r.signal.aborted||q.error(e instanceof Error?e.message:`Download failed.`)}finally{w(null),D.current=null}},[n]);if(!e)return null;let k=T.total>0?Math.round(T.done/T.total*100):0;return(0,R.jsx)(`div`,{className:`scrim`,onClick:O,children:(0,R.jsxs)(`div`,{className:`modal-card catalog-modal`,onClick:e=>e.stopPropagation(),role:`dialog`,"aria-label":`Download a model`,children:[(0,R.jsxs)(`div`,{className:`modal-head catalog-head`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{children:`Download a model`}),(0,R.jsx)(`p`,{children:`GGUF models from the Hugging Face Hub, matched against your hardware. Only search terms leave this machine — no chat content is ever sent.`})]}),(0,R.jsx)(`span`,{className:`catalog-origin`,title:`Catalog metadata is fetched from huggingface.co`,children:`catalog · huggingface.co`})]}),(0,R.jsxs)(`div`,{className:`catalog-controls`,children:[(0,R.jsx)(`input`,{autoFocus:!0,value:r,onChange:e=>i(e.target.value),placeholder:`Search models — e.g. qwen, coder, heretic, uncensored…`,"aria-label":`Search models`}),(0,R.jsx)(`select`,{value:a,onChange:e=>o(e.target.value),"aria-label":`Sort models`,children:os.map(e=>(0,R.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,R.jsxs)(`div`,{className:`catalog-hardware`,children:[(0,R.jsx)(`b`,{children:`Your machine:`}),` `,cs(l),!d&&(0,R.jsx)(`span`,{className:`catalog-token-hint`,children:`No HF_TOKEN set — gated models are marked and cannot be downloaded.`})]}),(0,R.jsxs)(`div`,{className:`catalog-body`,children:[h&&(0,R.jsx)(`p`,{className:`catalog-error`,children:h}),p&&s.length===0&&(0,R.jsx)(`p`,{className:`catalog-empty`,children:`Loading catalog…`}),!p&&!h&&s.length===0&&(0,R.jsx)(`p`,{className:`catalog-empty`,children:`No GGUF models matched that search.`}),s.map(e=>{let t=_===e.id;return(0,R.jsxs)(`div`,{className:`catalog-item`,"data-open":t,children:[(0,R.jsxs)(`button`,{type:`button`,className:`catalog-item-head`,onClick:()=>ee(e.id),"aria-expanded":t,children:[(0,R.jsxs)(`span`,{className:`catalog-item-title`,title:e.id,children:[(0,R.jsx)(`b`,{children:e.name}),(0,R.jsx)(`em`,{children:e.author})]}),(0,R.jsxs)(`span`,{className:`catalog-item-meta`,children:[(0,R.jsxs)(`span`,{title:`${e.downloads.toLocaleString()} downloads`,children:[`↓ `,bo(e.downloads)]}),(0,R.jsxs)(`span`,{title:`${e.likes.toLocaleString()} likes`,children:[`♥ `,bo(e.likes)]}),e.trustedPublisher&&(0,R.jsx)(`span`,{className:`catalog-badge trusted`,title:`Known-good GGUF publisher`,children:`trusted`}),e.gated!==!1&&(0,R.jsx)(`span`,{className:`catalog-badge gated`,title:`This repository is gated on Hugging Face. Accept its licence there and set HF_TOKEN in the server .env.`,children:`needs HF login`})]})]}),t&&(0,R.jsxs)(`div`,{className:`catalog-quants`,children:[x&&(0,R.jsx)(`p`,{className:`catalog-empty`,children:`Reading files…`}),y&&y.gated!==!1&&(0,R.jsxs)(`p`,{className:`catalog-gated-note`,children:[y.id,` is gated. Accept the licence on Hugging Face, then set`,` `,(0,R.jsx)(`code`,{children:`HF_TOKEN`}),` in the server `,(0,R.jsx)(`code`,{children:`.env`}),` to download it here.`]}),y?.quants.map(e=>{let t=C===`${y.id}:${e.label}`,n=y.gated!==!1&&!d;return(0,R.jsxs)(`div`,{className:`catalog-quant`,"data-fit":e.fit,children:[(0,R.jsxs)(`span`,{className:`catalog-quant-name`,children:[e.label,e.recommended&&(0,R.jsx)(`em`,{title:`Balanced default`,children:`recommended`}),e.shards>1&&(0,R.jsxs)(`i`,{children:[e.shards,` shards`]})]}),(0,R.jsx)(`span`,{className:`catalog-quant-size`,children:yo(e.totalBytes)}),(0,R.jsx)(`span`,{className:`catalog-quant-fit`,"data-fit":e.fit,children:ss[e.fit]}),(0,R.jsx)(`button`,{type:`button`,className:`btn`,disabled:t||!!C||n,onClick:()=>void te(y.id,e.label),title:n?`Gated repository — HF_TOKEN required`:void 0,children:t?`${k}%`:`Download`})]},e.label)}),us(C,y?.id,k,T.file)]})]},e.id)})]}),(0,R.jsx)(`div`,{className:`modal-foot`,children:C?(0,R.jsx)(`button`,{className:`btn ghost`,onClick:()=>D.current?.abort(),children:`Cancel download`}):(0,R.jsx)(`button`,{className:`btn ghost`,onClick:O,children:`Close`})})]})})}var us=(e,t,n,r)=>!e||!t||!e.startsWith(`${t}:`)?null:(0,R.jsxs)(`div`,{className:`catalog-progress`,children:[(0,R.jsx)(`div`,{className:`catalog-progress-track`,children:(0,R.jsx)(`div`,{className:`catalog-progress-fill`,style:{width:`${n}%`}})}),(0,R.jsxs)(`span`,{title:r,children:[n,`% · `,r||`starting…`]})]}),ds=e=>{let t=[];return e.loaded&&t.push(`loaded`),e.sizeBytes&&t.push(`${(e.sizeBytes/1024**3).toFixed(1)} GB`),e.contextLength&&t.push(`${Math.round(e.contextLength/1024)}k ctx`),(e.id===`openrouter/free`||e.id.endsWith(`:free`)||Number(e.promptPrice)===0&&Number(e.completionPrice)===0)&&t.push(`free`),e.createdAt&&t.push(new Date(e.createdAt).toLocaleDateString()),t.join(` · `)};function fs({provider:e,models:t,value:n,onChange:r,disabled:i=!1}){let a=(0,L.useRef)(null),o=B(e=>e.favoriteGenerationModels),s=B(e=>e.toggleFavoriteGenerationModel),[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(0),m=t.find(e=>e.id===n),h=(0,L.useMemo)(()=>new Set(o.map(e=>ja(e))),[o]),g=(0,L.useMemo)(()=>{let e=u.trim().toLowerCase();return t.filter(t=>!e||t.name.toLowerCase().includes(e)||t.id.toLowerCase().includes(e)).sort((e,t)=>{let n=h.has(ja(e));return n===h.has(ja(t))?0:n?-1:1}).slice(0,100)},[t,u,h]);(0,L.useEffect)(()=>{let e=e=>{a.current?.contains(e.target)||l(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[]);let _=Math.min(f,Math.max(g.length-1,0)),v=e=>{r(e.id),d(``),l(!1)};return(0,R.jsxs)(`div`,{className:`model-combobox`,ref:a,children:[(0,R.jsxs)(`div`,{className:`model-combobox-input`,children:[(0,R.jsx)(`input`,{role:`combobox`,"aria-label":`Generation model`,"aria-expanded":c,"aria-controls":`generation-model-options`,"aria-autocomplete":`list`,autoComplete:`off`,disabled:i,value:c?u:m?.name??``,title:m?.path||m?.id,placeholder:i?`No models available`:`Type to find a model…`,onFocus:()=>{l(!0),d(``)},onChange:e=>{d(e.target.value),l(!0),p(0)},onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),e.stopPropagation(),l(!0),p(Math.min(_+1,g.length-1))):e.key===`ArrowUp`?(e.preventDefault(),e.stopPropagation(),p(Math.max(_-1,0))):e.key===`Enter`&&c&&g[_]?(e.preventDefault(),e.stopPropagation(),v(g[_])):e.key===`Escape`&&(e.stopPropagation(),l(!1),d(``))}}),(0,R.jsx)(`span`,{className:`model-combobox-chevron`,"aria-hidden":`true`,children:`⌄`})]}),c&&(0,R.jsxs)(`div`,{id:`generation-model-options`,className:`model-combobox-popover`,role:`listbox`,onMouseDown:e=>e.preventDefault(),children:[(0,R.jsxs)(`div`,{className:`model-combobox-summary`,children:[(0,R.jsxs)(`span`,{children:[g.length===100?`100+`:g.length,` matches`]}),(0,R.jsx)(`span`,{children:`favorites first`})]}),g.length===0?(0,R.jsx)(`div`,{className:`model-combobox-empty`,children:`No matching models`}):g.map((t,r)=>{let i=h.has(ja(t));return(0,R.jsxs)(`div`,{className:`model-option`,"data-active":r===_,"data-selected":t.id===n,role:`option`,"aria-selected":t.id===n,onMouseEnter:()=>p(r),onClick:()=>v(t),children:[(0,R.jsx)(`button`,{type:`button`,className:`model-favorite`,"data-favorite":i,"aria-label":`${i?`Remove`:`Add`} ${t.name} ${i?`from`:`to`} favorites`,title:i?`Remove from favorites`:`Add to favorites`,onClick:n=>{n.stopPropagation(),s({provider:e,id:t.id,name:t.name})},children:i?`★`:`☆`}),(0,R.jsxs)(`span`,{className:`model-option-copy`,children:[(0,R.jsx)(`strong`,{title:t.name,children:no(t.name,38)}),(0,R.jsx)(`span`,{title:t.path||t.id,children:to(t.path||t.id,44)})]}),ds(t)&&(0,R.jsx)(`span`,{className:`model-option-meta`,children:ds(t)})]},t.id)})]})]})}function ps({id:e,label:t,value:n,onChange:r,options:i,optionLabel:a,invalid:o=!1,title:s,placeholder:c}){let l=(0,L.useRef)(null),u=`${(0,L.useId)()}-options`,[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)(0),h=Math.min(p,Math.max(i.length-1,0));(0,L.useEffect)(()=>{if(!d)return;let e=e=>{l.current?.contains(e.target)||f(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[d]);let g=e=>{r(String(e)),f(!1)};return(0,R.jsxs)(`div`,{className:`number-combobox`,ref:l,children:[(0,R.jsx)(`input`,{id:e,role:`combobox`,"aria-label":t,"aria-expanded":d,"aria-controls":u,"aria-autocomplete":`list`,"aria-invalid":o,autoComplete:`off`,inputMode:`numeric`,title:s,placeholder:c,value:n,onChange:e=>{r(e.target.value.replace(/\D/g,``)),f(!0)},onFocus:()=>f(!0),onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),e.stopPropagation(),d?m(Math.min(h+1,i.length-1)):f(!0)):e.key===`ArrowUp`?(e.preventDefault(),e.stopPropagation(),m(Math.max(h-1,0))):e.key===`Enter`&&d&&i[h]!==void 0?(e.preventDefault(),e.stopPropagation(),g(i[h])):e.key===`Escape`&&(e.stopPropagation(),f(!1))}}),(0,R.jsx)(`button`,{type:`button`,className:`number-combobox-toggle`,tabIndex:-1,"aria-label":`Show presets`,title:`Show presets`,onClick:()=>f(e=>!e),children:`▾`}),d&&i.length>0&&(0,R.jsx)(`div`,{className:`number-combobox-popover`,id:u,role:`listbox`,children:i.map((e,t)=>(0,R.jsx)(`button`,{type:`button`,role:`option`,"aria-selected":String(e)===n,"data-active":t===h,"data-selected":String(e)===n,onMouseEnter:()=>m(t),onMouseDown:e=>e.preventDefault(),onClick:()=>g(e),children:a?a(e):e.toLocaleString()},e))})]})}var ms=e=>`${(e/1024**3).toFixed(1)} GiB`,hs=e=>{let{offload:t}=e;return t.mode===`cpu`?`CPU only`:t.mode===`gpu`?`GPU ${t.gpuPercent??100}%`:t.mode===`hybrid`?`GPU ${t.gpuPercent}% · CPU ${t.cpuPercent}%`:e.devices.length>0?`GPU available · placement pending`:`Compute placement unknown`};function gs({model:e,active:t}){let[n,r]=(0,L.useState)(null),[i,a]=(0,L.useState)(``),[o,s]=(0,L.useState)(!1),c=(0,L.useRef)(null);(0,L.useEffect)(()=>{let e=!1,n=null,i=async()=>{n?.abort(),n=new AbortController;try{let t=await H.generationLlamaLogs(n.signal);e||(r(t),a(``))}catch(t){if(t instanceof DOMException&&t.name===`AbortError`)return;e||a(t instanceof Error?t.message:`Could not read logs.`)}};i();let s=window.setInterval(()=>void i(),t||o?1e3:8e3);return()=>{e=!0,n?.abort(),window.clearInterval(s)}},[t,o]),(0,L.useEffect)(()=>{o&&c.current&&(c.current.scrollTop=c.current.scrollHeight)},[n?.logs,o]);let l=(0,L.useMemo)(()=>n?.devices.reduce((e,t)=>e+t.freeBytes,0)??0,[n?.devices]),u=!!(e?.sizeBytes&&l&&e.sizeBytes>l);return(0,R.jsxs)(`div`,{className:`llama-diagnostics`,"data-mode":n?.offload.mode??`unknown`,children:[(0,R.jsxs)(`div`,{className:`llama-placement`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`strong`,{children:n?hs(n):`Inspecting CPU/GPU placement…`}),n?.offload.gpuLayers!==void 0&&(0,R.jsxs)(`span`,{children:[n.offload.gpuLayers,`/`,n.offload.totalLayers,` model layers on GPU`]}),n?.devices.length?(0,R.jsx)(`span`,{children:n.devices.map(e=>`${e.id} ${e.name} · ${ms(e.freeBytes)} free`).join(` · `)}):n?.deviceDetectionSupported?(0,R.jsx)(`span`,{children:`No accelerator reported by this llama.cpp executable.`}):(0,R.jsx)(`span`,{children:`VRAM/device reporting is unavailable for this executable.`})]}),n?.offload.deviceBufferMiB&&(0,R.jsx)(`span`,{className:`llama-buffer-split`,children:Object.entries(n.offload.deviceBufferMiB).map(([e,t])=>`${e}: ${t.toFixed(0)} MiB`).join(` · `)})]}),u&&e?.sizeBytes&&(0,R.jsxs)(`div`,{className:`llama-memory-warning`,children:[`Model file `,ms(e.sizeBytes),` exceeds currently reported free VRAM `,ms(l),`. Full GPU placement is not possible; auto-fit should use a CPU/GPU mix. Context and compute buffers require additional memory.`]}),(0,R.jsxs)(`details`,{className:`llama-log-details`,open:o,onToggle:e=>s(e.currentTarget.open),children:[(0,R.jsxs)(`summary`,{children:[(0,R.jsx)(`span`,{children:`llama.cpp process logs`}),(0,R.jsx)(`span`,{children:t?`live`:n?.source===`managed`?`last process`:`diagnostics`})]}),(0,R.jsxs)(`div`,{className:`llama-log-toolbar`,children:[(0,R.jsx)(`span`,{children:n?.logsTruncated?`Oldest output was truncated after 4 MiB.`:`Complete stdout/stderr. Prompts, answers, and model reasoning are not written to process logs.`}),(0,R.jsx)(`button`,{className:`btn sm`,disabled:!n?.logs,onClick:()=>{uo(n?.logs??``).then(e=>e?q.success(`llama.cpp logs copied.`):q.error(`Could not copy logs.`))},children:`Copy logs`})]}),i&&(0,R.jsx)(`div`,{className:`banner err`,children:i}),(0,R.jsx)(`pre`,{ref:c,children:n?.logs||`No managed llama.cpp process logs yet.`})]})]})}var _s=e=>{let t=e.sizeBytes?` · ${(e.sizeBytes/1024**3).toFixed(1)} GB`:``;return`${e.loaded?`● `:``}${e.name}${t}`},vs=[4096,8192,16384,32768,65536,131072],ys=e=>{try{let t=JSON.parse(sessionStorage.getItem(e)??`[]`);return Array.isArray(t)?t.filter(e=>!!e&&typeof e==`object`&&typeof e.id==`string`&&typeof e.prompt==`string`&&typeof e.content==`string`&&typeof e.reasoning==`string`&&typeof e.error==`string`):[]}catch{return[]}},bs=e=>[`Prompt:\n${e.prompt}`,e.reasoning?`Reasoning (partial):\n${e.reasoning}`:``,e.content?`Answer (partial):\n${e.content}`:``,`Failure:\n${e.error}`].filter(Boolean).join(`
|
|
23
|
+
|
|
24
|
+
`);function xs({sourceFile:e,collection:t,conversationKey:n,threadId:r,attemptScope:i,ephemeral:a=!1,draftSaved:o=!1,onCreateThread:s,initialMessages:c=[],onCompleted:l,onMessagesChanged:u,onRecoveryChanged:d,onModelChanged:f,showThreadShelfTurns:p=!0}){let m=Ke(),h=Ga(),[g,_]=(0,L.useState)(null),[v,y]=(0,L.useState)(`llama-cpp`),[b,x]=(0,L.useState)([]),[S,C]=(0,L.useState)(null),[w,T]=(0,L.useState)(``),[E,D]=(0,L.useState)(`most-popular`),[O,ee]=(0,L.useState)(!0),[te,k]=(0,L.useState)(``),[ne,re]=(0,L.useState)([...c]),[ie,A]=(0,L.useState)(!0),[j,M]=(0,L.useState)(!1),[ae,oe]=(0,L.useState)(``),[se,N]=(0,L.useState)([]),[P,F]=(0,L.useState)([]),[ce,le]=(0,L.useState)(``),[ue,de]=(0,L.useState)(`Discovering local GGUF models…`),[fe,pe]=(0,L.useState)(0),[me,he]=(0,L.useState)(!1),[I,ge]=(0,L.useState)(``),[_e,ve]=(0,L.useState)(`4096`),[ye,be]=(0,L.useState)(`8192`),[xe,Se]=(0,L.useState)(!1),[Ce,we]=(0,L.useState)(!1),[Te,Ee]=(0,L.useState)(!1),[De,Oe]=(0,L.useState)(``),ke=(0,L.useRef)(null),Ae=(0,L.useRef)(null),je=(0,L.useRef)(!1),Me=(0,L.useRef)(``),Ne=(0,L.useRef)(``),Pe=(0,L.useRef)(``),Fe=(0,L.useRef)(``),Ie=`threadshelf:interrupted-generations:${i||r||`${t??`chat`}:${e??`new`}:${n??``}`}`,[Le,Re]=(0,L.useState)(()=>ys(Ie));(0,L.useEffect)(()=>{try{sessionStorage.setItem(Ie,JSON.stringify(Le))}catch{}},[Le,Ie]),(0,L.useEffect)(()=>{d?.(Le.length>0)},[Le.length,d]),(0,L.useEffect)(()=>{if(!Ce)return;let e=e=>{ke.current?.contains(e.target)||we(!1)},t=()=>{let e=ke.current,t=e?.getBoundingClientRect();if(!e||!t)return;let n=window.visualViewport,r=n?.offsetTop??0,i=r+(n?.height??window.innerHeight),a=window.innerWidth<=640?60:56,o=t.top-(r+a)-8,s=i-t.bottom-20,c=s>o?`down`:`up`,l=Math.max(96,Math.floor(c===`down`?s:o));e.dataset.popoverPlacement=c,e.style.setProperty(`--model-popover-available-height`,`${l}px`)};return t(),document.addEventListener(`pointerdown`,e),window.addEventListener(`resize`,t),window.addEventListener(`scroll`,t,!0),window.visualViewport?.addEventListener(`resize`,t),()=>{document.removeEventListener(`pointerdown`,e),window.removeEventListener(`resize`,t),window.removeEventListener(`scroll`,t,!0),window.visualViewport?.removeEventListener(`resize`,t)}},[Ce]),(0,L.useEffect)(()=>{let e=new AbortController;return Promise.all([H.generationConfig(e.signal),H.generationModels(`llama-cpp`,{signal:e.signal})]).then(([e,t])=>{_(e);let n=e.config.llamaCpp?.contextSize??8192;be(String(n)),ve(String(Math.min(4096,Math.max(1,n)))),he(e.config.openRouter.enforceZdr),x(t.models),C(t.runtime),T(t.models.find(e=>e.loaded)?.id??t.models[0]?.id??``),t.models.length===0&&ge(`No GGUF models found. Download one from the model menu or add a directory in Settings.`)}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||ge(e instanceof Error?e.message:`Could not load generation settings.`)}).finally(()=>A(!1)),()=>{e.abort(),Ae.current?.abort()}},[]),(0,L.useEffect)(()=>{if(!j)return;let e=Date.now(),t=window.setInterval(()=>pe(Math.floor((Date.now()-e)/1e3)),1e3);return()=>window.clearInterval(t)},[j]),(0,L.useEffect)(()=>{if(!j||v!==`llama-cpp`)return;let e=new AbortController,t=async()=>{try{let t=await H.generationRuntime(e.signal);C(t.runtime);let n=JSON.stringify(t.runtime);n!==Fe.current&&(Fe.current=n,window.dispatchEvent(new CustomEvent(`threadshelf:generation-runtime-changed`,{detail:t.runtime}))),t.runtime.state===`starting`?de(t.runtime.detail):t.runtime.state===`ready`&&!je.current&&de(`Model loaded. Processing the prompt and waiting for the first token…`)}catch(e){e instanceof DOMException&&e.name}};t();let n=window.setInterval(()=>void t(),1e3);return()=>{e.abort(),window.clearInterval(n)}},[v,j]);let ze=async(e=v,t={})=>{A(!0),ge(``);try{let n=await H.generationModels(e,{sort:t.sort??E,freeOnly:t.freeOnly??O});x(n.models),C(n.runtime),T(e=>{let r=t.selectModel?n.models.find(e=>e.id===t.selectModel||e.path===t.selectModel):void 0;if(r)return r.id;let i=n.models.find(e=>e.loaded);return i?i.id:n.models.some(t=>t.id===e)?e:n.models[0]?.id??``}),n.models.length===0&&ge(e===`llama-cpp`?`No GGUF models found. Download one here or add a directory in Settings.`:`OpenRouter returned no models.`)}catch(e){x([]),T(``),ge(e instanceof Error?e.message:`Could not load models.`)}finally{A(!1)}},Be=async e=>{await ze(`llama-cpp`,{selectModel:e}),Ee(!1),we(!0)},Ve=!!r||a||o,He=b.find(e=>e.id===w),Ue=v===`llama-cpp`?S?.contextSize??g?.config.llamaCpp?.contextSize:He?.contextLength,We=/^\d+$/.test(ye)?Number(ye):NaN,Ge=Number.isSafeInteger(We)&&We>=512&&We<=1048576,qe=v===`llama-cpp`&&Ge&&We!==g?.config.llamaCpp?.contextSize,Je=Math.min(32768,Ue??32768),Ye=/^\d+$/.test(_e)?Number(_e):NaN,Xe=Number.isSafeInteger(Ye)&&Ye>=1&&Ye<=Je,Ze=Xe?Ye:4096,Qe=[256,512,1024,2048,4096,8192,16384,32768].filter(e=>e<=Je);(0,L.useEffect)(()=>{f?.(He?.name||S?.model||w)},[w,f,S?.model,He?.name]);let $e=e=>{y(e),x([]),C(null),T(``),ge(``),de(e===`llama-cpp`?`Discovering local GGUF models…`:`Loading live OpenRouter models…`),ze(e,{sort:E,freeOnly:O})},et=async()=>{if(!Ge){ge(`Context window must be a whole number from 512 to 1,048,576 tokens.`);return}Se(!0),ge(``);try{let e=await H.updateGenerationConfig({llamaCpp:{contextSize:We}}),t=await H.generationModels(`llama-cpp`);_(e),be(String(e.config.llamaCpp.contextSize)),x(t.models),C(t.runtime),window.dispatchEvent(new Event(`threadshelf:generation-runtime-changed`)),q.success(`Context window changed to ${e.config.llamaCpp.contextSize.toLocaleString()} tokens.`)}catch(e){let t=e instanceof Error?e.message:`Could not change context window.`;ge(t),q.error(t)}finally{Se(!1)}},tt=async()=>{try{let e=await H.ejectGenerationModel(S?.model||w);C(e.runtime),x(e=>e.map(e=>({...e,loaded:!1}))),window.dispatchEvent(new Event(`threadshelf:generation-runtime-changed`)),Promise.all([m.invalidateQueries({queryKey:[`collections`]}),m.invalidateQueries({queryKey:[`files`]}),m.invalidateQueries({queryKey:[`search`]}),m.invalidateQueries({queryKey:[`thread`]})]),q.success(`Model unloaded from memory. GGUF file kept on disk.`)}catch(e){q.error(e instanceof Error?e.message:`Could not unload model.`)}},nt=async()=>{let i=te.trim();if(!i||!w)return;if(!Xe){ge(`Max answer must be a whole number from 1 to ${Je.toLocaleString()}.`);return}let c=r||De;if(!a&&!c&&o&&s){M(!0),ge(``);try{c=await s(),Oe(c)}catch(e){M(!1),ge(e instanceof Error?e.message:`Could not create the chat.`);return}}M(!0),pe(0),ge(``),oe(i),N([]),F([]),le(w),Me.current=``,Ne.current=``,Pe.current=w,je.current=!1,de(v===`llama-cpp`?`Preparing llama.cpp. The first model load can take a while…`:`Preparing an OpenRouter request…`);let d=new AbortController;Ae.current=d;try{let r={provider:v,model:w,prompt:i,maxTokens:Ze,temperature:.7,systemPrompt:h.trim()||void 0,openRouterZdr:v===`openrouter`?me:void 0},o=await H.continueThreadStream(a?{...r,ephemeral:!0,continuation:ne}:c?{...r,threadId:c}:{...r,sourceFile:e,collection:t===`__all__`?`all`:t,conversationKey:n},e=>{e.type===`status`?(de(e.message),e.model&&le(e.model)):e.type===`delta`&&(je.current=!0,e.content&&(Me.current+=e.content,N(t=>fo(t,e.content))),e.reasoning&&(Ne.current+=e.reasoning,F(t=>fo(t,e.reasoning))),e.model&&(Pe.current=e.model,le(e.model)))},d.signal);re(e=>{let t=[...e,{role:`user`,content:i},{role:`assistant`,content:o.content,reasoning:o.reasoning,model:o.model,usage:o.usage,performance:o.performance,contextWindowTokens:Ue}];return u?.(t),t}),k(``),C(v===`llama-cpp`?{state:`ready`,model:w,contextSize:Ue,detail:`The local model is loaded and ready.`}:{state:`remote`,model:o.model,detail:`The response ran through OpenRouter.`}),v===`llama-cpp`&&x(e=>e.map(e=>({...e,loaded:e.id===w}))),window.dispatchEvent(new Event(`threadshelf:generation-runtime-changed`)),o.persistence?.warning&&q.info(o.persistence.warning),l?.()}catch(e){let t=d.signal.aborted,n=t?`Generation stopped by the user.`:e instanceof Error?e.message:`Generation failed.`,r={id:globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random()}`,prompt:i,content:Me.current,reasoning:Ne.current,model:Pe.current||w,provider:v,error:n,stopped:t,createdAt:new Date().toISOString()};Re(e=>[...e,r].slice(-8)),t?q.info(`Generation stopped.`):ge(n)}finally{Ae.current===d&&(Ae.current=null),M(!1),oe(``),N([]),F([]),le(``)}},rt=S?.model?no(S.model):void 0,it=no(He?.name||S?.model||w,24)||(ie?`Loading models…`:`Select a model`),at=j?`loading`:v===`openrouter`?`remote`:He?.loaded||S?.state===`ready`?`ready`:`stopped`;return(0,R.jsxs)(`div`,{className:`thread-continuation`,children:[(Ve||p)&&ne.map((e,t)=>{let n=ne.slice(0,t).filter(e=>e.role===`assistant`),r=n[n.length-1]?.model,i=e.role===`assistant`&&!!e.model&&(!Ve||e.model!==r);return(0,R.jsxs)(`div`,{className:`turn generated-turn`,"data-role":e.role===`user`?`user`:`ai`,"data-origin":`threadshelf`,"data-standalone":Ve,children:[!Ve&&(0,R.jsx)(`div`,{className:`turn-avatar`,children:e.role===`user`?`U`:`A`}),(0,R.jsxs)(`div`,{className:`turn-content`,children:[(!Ve||i)&&(0,R.jsxs)(`div`,{className:`turn-head`,children:[!Ve&&(0,R.jsx)(`span`,{className:`role-tag`,children:e.role===`user`?`continued user`:`generated response`}),i&&(0,R.jsx)(`span`,{className:`turn-model`,title:e.model,children:no(e.model)}),!Ve&&(0,R.jsx)(`span`,{className:`threadshelf-turn-badge`,children:`ThreadShelf`})]}),e.reasoning&&(0,R.jsxs)(`details`,{className:`generated-reasoning`,children:[(0,R.jsx)(`summary`,{children:`Model reasoning`}),(0,R.jsx)(`div`,{children:e.reasoning})]}),e.role===`assistant`?(0,R.jsx)(is,{className:`turn-body`,text:e.content}):(0,R.jsx)(`div`,{className:`turn-body`,children:e.content}),e.role===`assistant`&&e.usage&&(Ve?(0,R.jsxs)(`div`,{className:`turn-generation-metrics`,title:[e.usage.promptTokens===void 0?``:`prompt ${e.usage.promptTokens.toLocaleString()} tokens`,e.usage.completionTokens===void 0?``:`answer ${e.usage.completionTokens.toLocaleString()} tokens`,e.performance?.source===`provider`?`speed reported by the backend`:`speed measured across the request`].filter(Boolean).join(` · `),children:[e.performance&&(0,R.jsxs)(`strong`,{children:[e.performance.completionTokensPerSecond.toFixed(1),` tok/s`]}),e.contextWindowTokens&&e.usage.totalTokens!==void 0&&(0,R.jsxs)(`span`,{children:[`context `,e.usage.totalTokens.toLocaleString(),` /`,` `,e.contextWindowTokens.toLocaleString()]})]}):(0,R.jsxs)(`div`,{className:`turn-generation-metrics`,title:e.performance?.source===`provider`?`Token speed reported by the generation backend`:`Token speed measured across the request`,children:[e.performance&&(0,R.jsxs)(`strong`,{children:[e.performance.completionTokensPerSecond.toFixed(1),` tok/s`]}),e.usage.promptTokens!==void 0&&(0,R.jsxs)(`span`,{children:[`prompt `,e.usage.promptTokens.toLocaleString()]}),e.usage.completionTokens!==void 0&&(0,R.jsxs)(`span`,{children:[`answer `,e.usage.completionTokens.toLocaleString()]}),e.contextWindowTokens&&e.usage.totalTokens!==void 0&&(0,R.jsxs)(`span`,{children:[`context `,e.usage.totalTokens.toLocaleString(),` /`,` `,e.contextWindowTokens.toLocaleString(),` ·`,` `,Math.max(0,e.contextWindowTokens-e.usage.totalTokens).toLocaleString(),` `,`left`]})]}))]})]},t)}),(Ve||p)&&Le.map(e=>(0,R.jsxs)(`section`,{className:`interrupted-generation`,children:[(0,R.jsxs)(`header`,{children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`strong`,{children:e.stopped?`Stopped generation`:`Failed generation`}),(0,R.jsxs)(`span`,{children:[`not saved · `,no(e.model),` ·`,` `,new Date(e.createdAt).toLocaleTimeString()]})]}),(0,R.jsxs)(`div`,{className:`interrupted-generation-actions`,children:[(0,R.jsx)(`button`,{className:`btn sm`,disabled:j,onClick:()=>k(e.prompt),children:`Retry prompt`}),(0,R.jsxs)(`button`,{className:`btn sm`,onClick:()=>void uo(bs(e)).then(e=>e?q.success(`Partial generation copied.`):q.error(`Could not copy partial generation.`)),children:[W.copy,` Copy attempt`]}),(0,R.jsx)(`button`,{className:`btn sm ghost`,"aria-label":`Dismiss failed generation`,onClick:()=>Re(t=>t.filter(t=>t.id!==e.id)),children:`Dismiss`})]})]}),(0,R.jsxs)(`div`,{className:`interrupted-prompt`,children:[(0,R.jsx)(`span`,{children:`Prompt`}),(0,R.jsx)(`p`,{children:e.prompt})]}),e.reasoning&&(0,R.jsxs)(`details`,{className:`generated-reasoning`,open:!0,children:[(0,R.jsx)(`summary`,{children:`Partial model reasoning`}),(0,R.jsx)(`div`,{children:e.reasoning})]}),(0,R.jsx)(`div`,{className:`turn-body interrupted-answer`,children:e.content||(0,R.jsx)(`em`,{children:`No answer tokens were received.`})}),(0,R.jsx)(`footer`,{children:e.error})]},e.id)),(Ve||p)&&j&&ae&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`turn generated-turn`,"data-role":`user`,"data-origin":`threadshelf`,"data-standalone":Ve,children:[!Ve&&(0,R.jsx)(`div`,{className:`turn-avatar`,children:`U`}),(0,R.jsxs)(`div`,{className:`turn-content`,children:[!Ve&&(0,R.jsxs)(`div`,{className:`turn-head`,children:[(0,R.jsx)(`span`,{className:`role-tag`,children:`continued user`}),(0,R.jsx)(`span`,{className:`threadshelf-turn-badge`,children:`ThreadShelf`})]}),(0,R.jsx)(`div`,{className:`turn-body`,children:ae})]})]}),(0,R.jsxs)(`div`,{className:`turn generated-turn streaming-turn`,"data-role":`ai`,"data-origin":`threadshelf`,"data-standalone":Ve,"aria-live":`polite`,children:[!Ve&&(0,R.jsx)(`div`,{className:`turn-avatar`,children:`A`}),(0,R.jsxs)(`div`,{className:`turn-content`,children:[(0,R.jsxs)(`div`,{className:`turn-head`,children:[!Ve&&(0,R.jsx)(`span`,{className:`role-tag`,children:`generating response`}),(0,R.jsx)(`span`,{className:`turn-model`,title:ce||w,children:no(ce||w)}),!Ve&&(0,R.jsx)(`span`,{className:`threadshelf-turn-badge`,children:`ThreadShelf`})]}),P.length>0&&(0,R.jsxs)(`details`,{className:`generated-reasoning`,children:[(0,R.jsx)(`summary`,{children:`Model reasoning · streaming`}),(0,R.jsx)(`div`,{children:P.map((e,t)=>(0,R.jsx)(`span`,{className:`stream-fragment`,children:e},t))})]}),(0,R.jsxs)(`div`,{className:`turn-body`,children:[se.length>0?se.map((e,t)=>(0,R.jsx)(`span`,{className:`stream-fragment`,children:e},t)):(0,R.jsx)(`span`,{className:`stream-placeholder`,children:`Waiting for first token`}),(0,R.jsx)(`span`,{className:`stream-cursor`,"aria-hidden":`true`})]}),(se.length>0||P.length>0)&&(0,R.jsxs)(`button`,{className:`stream-copy-button`,onClick:()=>void uo([Ne.current?`Reasoning (partial):\n${Ne.current}`:``,Me.current?`Answer (partial):\n${Me.current}`:``].filter(Boolean).join(`
|
|
25
|
+
|
|
26
|
+
`)).then(e=>e?q.success(`Current output copied.`):q.error(`Could not copy current output.`)),children:[W.copy,` Copy current output`]})]})]})]}),(0,R.jsxs)(`div`,{className:`continue-card`,children:[I&&(0,R.jsx)(`div`,{className:`banner err`,children:I}),j&&(0,R.jsxs)(`div`,{className:`generation-progress`,role:`status`,"aria-live":`polite`,children:[(0,R.jsx)(`span`,{className:`generation-spinner`,"aria-hidden":`true`}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`strong`,{children:ue}),(0,R.jsxs)(`span`,{children:[no(ce||w),` · `,fe,`s elapsed`]})]})]}),(0,R.jsx)(`textarea`,{id:`continuePrompt`,value:te,onChange:e=>k(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),nt())},placeholder:`${Ve?`Message`:`Ask a follow-up`}… (Enter to send, Shift+Enter for a new line)`,maxLength:1e5,rows:Ve?2:3,disabled:j}),(0,R.jsxs)(`div`,{className:`composer-bar`,children:[(0,R.jsxs)(`div`,{className:`model-menu`,ref:ke,children:[(0,R.jsxs)(`button`,{type:`button`,id:`modelMenuButton`,className:`model-status`,"data-state":at,"aria-expanded":Ce,"aria-haspopup":`dialog`,title:`Model and generation settings`,onClick:()=>we(e=>!e),children:[(0,R.jsx)(`span`,{className:`runtime-dot`,"aria-hidden":`true`}),(0,R.jsx)(`span`,{className:`model-status-name`,children:it}),v===`openrouter`&&(0,R.jsx)(`span`,{className:`off-device-chip`,children:`off-device`}),(0,R.jsx)(`span`,{className:`model-status-chevron`,"aria-hidden":`true`,children:`▾`})]}),Ce&&(0,R.jsxs)(`div`,{className:`model-popover`,role:`dialog`,"aria-label":`Model and generation settings`,children:[(0,R.jsxs)(`div`,{className:`model-popover-providers`,role:`tablist`,"aria-label":`Generation provider`,children:[(0,R.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":v===`llama-cpp`,"data-active":v===`llama-cpp`,onClick:()=>v!==`llama-cpp`&&$e(`llama-cpp`),children:`llama.cpp · local`}),(0,R.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":v===`openrouter`,"data-active":v===`openrouter`,onClick:()=>v!==`openrouter`&&$e(`openrouter`),children:`OpenRouter · external`})]}),(0,R.jsxs)(`div`,{className:`model-popover-pick`,children:[(0,R.jsx)(fs,{provider:v,models:b,value:w,onChange:T,disabled:b.length===0}),(0,R.jsxs)(`div`,{className:`model-popover-pick-actions`,children:[v===`llama-cpp`&&(0,R.jsx)(`button`,{className:`btn sm icon-only`,title:`Browse and download GGUF models`,"aria-label":`Browse and download GGUF models`,disabled:j,onClick:()=>{we(!1),Ee(!0)},children:W.download}),(0,R.jsx)(`button`,{className:`btn sm icon-only`,title:`Refresh model list`,"aria-label":`Refresh model list`,disabled:ie,onClick:()=>void ze(),children:W.refresh})]})]}),v===`openrouter`&&(0,R.jsxs)(`div`,{className:`model-catalog-filters`,"aria-label":`OpenRouter model filters`,children:[(0,R.jsx)(`span`,{children:`Catalog`}),(0,R.jsxs)(`select`,{"aria-label":`Sort OpenRouter models`,value:E,onChange:e=>{let t=e.target.value;D(t),ze(`openrouter`,{sort:t,freeOnly:O})},children:[(0,R.jsx)(`option`,{value:`most-popular`,children:`Most popular this week`}),(0,R.jsx)(`option`,{value:`newest`,children:`Latest`}),(0,R.jsx)(`option`,{value:`default`,children:`Default`})]}),(0,R.jsxs)(`label`,{children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:O,onChange:e=>{let t=e.target.checked;ee(t),ze(`openrouter`,{sort:E,freeOnly:t})}}),`Free only`]})]}),(0,R.jsxs)(`div`,{className:`model-runtime`,"data-state":S?.state||`loading`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`strong`,{children:[b.length.toLocaleString(),` `,v===`llama-cpp`?`GGUF models discovered`:`live models available`]}),(0,R.jsx)(`span`,{title:He?.path||He?.id,children:He?`${He.loaded?`Loaded`:`Selected`} · ${_s(He)}`:`No model selected`}),rt&&!He?.loaded&&(0,R.jsxs)(`span`,{children:[`Active: `,rt]}),S&&(0,R.jsx)(`span`,{children:S.detail})]}),S&&(S.state===`starting`||S.state===`ready`||S.state===`external`&&!!S.model)&&(0,R.jsx)(`button`,{className:`btn sm`,onClick:()=>void tt(),children:`Eject`})]}),(0,R.jsxs)(`div`,{className:`generation-budget`,children:[v===`llama-cpp`?(0,R.jsxs)(`div`,{className:`generation-budget-field`,children:[(0,R.jsx)(`span`,{children:`Context window`}),(0,R.jsx)(ps,{id:`chatContextSize`,label:`Context window in tokens`,value:ye,onChange:be,options:vs,optionLabel:e=>`${e.toLocaleString()} tokens`,invalid:!Ge,title:`Pick a preset or type any whole number from 512 to 1,048,576 tokens`}),(0,R.jsx)(`button`,{type:`button`,className:`btn sm generation-context-apply`,disabled:!qe||xe||j,onClick:()=>void et(),children:xe?`Applying…`:`Apply`})]}):(0,R.jsxs)(`span`,{children:[`Context window`,` `,(0,R.jsx)(`strong`,{children:Ue?.toLocaleString()??`unknown`}),` tokens`]}),(0,R.jsxs)(`div`,{className:`generation-budget-field`,children:[(0,R.jsx)(`span`,{children:`Max answer`}),(0,R.jsx)(ps,{id:`maxAnswerTokens`,label:`Maximum response tokens`,value:_e,onChange:ve,options:Qe,optionLabel:e=>`${e.toLocaleString()} tokens`,invalid:!Xe,title:`Pick a preset or type any whole number from 1 to ${Je.toLocaleString()} tokens`})]})]}),v===`openrouter`&&(0,R.jsxs)(`label`,{className:`openrouter-zdr-option`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:me,onChange:e=>he(e.target.checked)}),`ZDR-only routing `,(0,R.jsx)(`span`,{children:`may exclude most endpoints`})]}),v===`llama-cpp`&&(0,R.jsx)(gs,{model:He,active:j})]})]}),(0,R.jsx)(as,{}),(0,R.jsxs)(`div`,{className:`composer-actions`,children:[(0,R.jsx)(`span`,{className:`composer-hint`,children:v===`llama-cpp`?`Loopback-only llama-server`:`Sent off-device via OpenRouter`}),j?(0,R.jsx)(`button`,{className:`btn danger`,onClick:()=>Ae.current?.abort(),children:`Stop`}):(0,R.jsx)(`button`,{id:`continueSend`,className:`btn primary`,disabled:!te.trim()||!w,onClick:()=>void nt(),children:Ve?`Send`:`Continue`})]})]})]}),(0,R.jsx)(ls,{open:Te,onClose:()=>Ee(!1),onDownloaded:e=>void Be(e)})]})}var Ss=`threadshelf://chat/`,Cs=1800;function ws(e){return e.toLocaleString()}function Ts({text:e}){let[t,n]=(0,L.useState)(!1);return(0,R.jsx)(`button`,{className:`copy-turn`,onClick:t=>{t.stopPropagation(),uo(e).then(()=>{n(!0),setTimeout(()=>n(!1),1200)})},children:t?`copied`:`copy`})}function Es({text:e,q:t}){let n=G(t);return n?(0,R.jsx)(R.Fragment,{children:K(e,t).map((e,t)=>n.test(e)?(0,R.jsx)(`mark`,{children:e},t):(0,R.jsx)(`span`,{children:e},t))}):(0,R.jsx)(R.Fragment,{children:e})}function Ds(e){return e.user===void 0?e.thinking===void 0?`ai`:`thinking`:`user`}function Os(e){return e.user??e.thinking??e.ai??``}function ks({sourceFile:e,collection:t,conversationKey:n,title:r,matchIdx:i,provider:a,model:o,onBack:s,onMenu:c,query:l,onSimilar:u}){let[d,f]=(0,L.useState)(null),[p,m]=(0,L.useState)(!1),[h,g]=(0,L.useState)(null),[_,v]=(0,L.useState)({user:!0,thinking:!1,ai:!0}),[y,b]=(0,L.useState)(!0),[x,S]=(0,L.useState)(new Set),C=(0,L.useRef)(null),w=(0,L.useRef)(null);(0,L.useEffect)(()=>{let r=window.setTimeout(()=>{f(null),m(!1),g(null),S(new Set)},0),i=t===`__all__`?`all`:t,a=new AbortController;return H.thread(e,i,n,a.signal).then(e=>{f(e.turns),m(e.createdInThreadShelf)}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||g(e instanceof Error?e.message:`Unknown error`)}),()=>{window.clearTimeout(r),a.abort()}},[e,t,n]),(0,L.useEffect)(()=>{if(!d||i==null)return;let e=d[Number(i)];if(!e||Ds(e)!==`thinking`)return;let t=window.setTimeout(()=>{v(e=>e.thinking?e:{...e,thinking:!0})},0);return()=>window.clearTimeout(t)},[d,i]),(0,L.useEffect)(()=>{if(w.current&&C.current){let e=w.current.offsetTop-140;C.current.scrollTo({top:Math.max(0,e),behavior:`smooth`})}},[d]);let T=e=>v(t=>({...t,[e]:!t[e]})),E=e=>S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),D=(0,L.useCallback)(()=>{w.current&&C.current&&C.current.scrollTo({top:Math.max(0,w.current.offsetTop-140),behavior:`smooth`})},[]),O=(0,L.useCallback)(()=>{d&&uo(d.map(e=>`${{user:`User`,thinking:`Thinking`,ai:`Response`}[Ds(e)]}:\n${Os(e).trim()}`).filter(Boolean).join(`
|
|
27
|
+
|
|
28
|
+
`)).then(e=>e?q.success(`Conversation copied.`):q.error(`Clipboard unavailable.`))},[d]),ee=(0,L.useCallback)(()=>{if(d&&i!=null){let e=d[i];e&&uo(Os(e))}},[d,i]),te=d?d.reduce((e,t)=>{let n=Os(t);return e.chars+=n.length,e.words+=n.trim()?n.trim().split(/\s+/).length:0,e},{chars:0,words:0}):{chars:0,words:0},k=r?.trim()||Qa(e);if(d&&!r?.trim()){let e=d.find(e=>e.user!==void 0);if(e){let t=(e.user??``).trim();k=t.length>80?`${t.slice(0,77)}…`:t||k}}let ne=Ke(),re=zo(a).color,ie=$a(o)||(d?$a(d.find(e=>e.model)?.model):``),A=p?n||e.replace(Ss,``):``,j=async()=>{if(A&&await To({title:`Delete “${k}”?`,message:`The conversation and its search index entries will be permanently removed.`,confirmLabel:`Delete chat`,danger:!0}))try{await H.deleteGenerationThread(A),await Promise.all([ne.invalidateQueries({queryKey:[`collections`]}),ne.invalidateQueries({queryKey:[`files`]}),ne.invalidateQueries({queryKey:[`search`]})]),q.success(`Conversation deleted.`),s()}catch(e){q.error(e instanceof Error?e.message:`Could not delete this chat.`)}};return(0,R.jsxs)(`div`,{id:`threadOverlay`,className:`thread`,style:{"--provider-color":re},children:[(0,R.jsxs)(`div`,{className:`thread-bar`,children:[(0,R.jsx)(`button`,{className:`icon-btn mobile-menu-btn`,onClick:c,"aria-label":`Open sidebar`,children:W.menu}),(0,R.jsxs)(`button`,{id:`threadClose`,className:`thread-back`,onClick:s,title:`Esc`,children:[W.arrowLeft,(0,R.jsx)(`span`,{children:`Back`})]}),(0,R.jsx)(`span`,{className:`title-preview`,title:k,children:d?k:`Loading…`}),ie&&(0,R.jsxs)(`span`,{className:`bar-meta`,children:[(0,R.jsx)(`span`,{className:`pdot`,style:{background:re}}),(0,R.jsx)(`span`,{className:`bar-model`,children:ie})]}),(0,R.jsxs)(`span`,{className:`path-crumb`,title:e,children:[(0,R.jsx)(`span`,{className:`coll`,children:Za(t)}),(0,R.jsx)(`span`,{className:`sl`,children:`/`}),(0,R.jsx)(`span`,{children:Qa(e)})]}),(0,R.jsx)(`kbd`,{children:`Esc`})]}),h&&(0,R.jsxs)(`div`,{className:`banner err`,style:{margin:16},children:[(0,R.jsx)(`span`,{className:`ico`,children:W.warn}),(0,R.jsx)(`div`,{className:`grow`,children:h})]}),d&&(0,R.jsxs)(`div`,{id:`threadContent`,className:`thread-inner`,ref:C,children:[(0,R.jsxs)(`div`,{className:`thread-hero`,children:[(0,R.jsx)(`h1`,{children:k}),(0,R.jsxs)(`div`,{className:`meta-row`,children:[ie&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`span`,{className:`item`,children:[(0,R.jsx)(`span`,{className:`k`,children:`model`}),(0,R.jsx)(`span`,{className:`v`,children:ie})]}),(0,R.jsx)(`span`,{className:`sep`,children:`·`})]}),(0,R.jsxs)(`span`,{className:`item`,children:[(0,R.jsx)(`span`,{className:`k`,children:`turns`}),(0,R.jsx)(`span`,{className:`v`,children:d.length})]}),(0,R.jsx)(`span`,{className:`sep`,children:`·`}),(0,R.jsxs)(`span`,{className:`item`,children:[(0,R.jsx)(`span`,{className:`k`,children:`length`}),(0,R.jsxs)(`span`,{className:`v`,children:[ws(te.words),` words`]})]}),(0,R.jsx)(`span`,{className:`sep`,children:`·`}),(0,R.jsxs)(`span`,{className:`item`,children:[(0,R.jsx)(`span`,{className:`k`,children:`chars`}),(0,R.jsx)(`span`,{className:`v`,children:ws(te.chars)})]}),(0,R.jsx)(`span`,{className:`sep`,children:`·`}),(0,R.jsxs)(`span`,{className:`item`,children:[(0,R.jsx)(`span`,{className:`k`,children:`file`}),(0,R.jsx)(`span`,{className:`v`,children:Qa(e)})]}),i!=null&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`sep`,children:`·`}),(0,R.jsxs)(`span`,{className:`item`,children:[(0,R.jsx)(`span`,{className:`k`,children:`match`}),(0,R.jsxs)(`span`,{className:`v match`,children:[`turn #`,i]})]})]})]})]}),(0,R.jsxs)(`div`,{className:`thread-actions-bar`,children:[i!=null&&(0,R.jsxs)(`button`,{className:`btn sm`,onClick:D,children:[W.zap,` Jump to match`]}),(0,R.jsxs)(`button`,{className:`btn sm`,onClick:O,children:[W.copy,` Copy conversation`]}),(0,R.jsxs)(`button`,{className:`btn sm`,onClick:()=>{if(!d)return;let n=go(k,d,{model:ie||o,sourceFile:e,collection:Za(t)});vo(`${_o(k)}.md`,n),q.success(`Exported as Markdown.`)},children:[W.download,` Export .md`]}),(0,R.jsxs)(`button`,{className:`btn sm`,onClick:()=>{if(!d)return;let r=d.map(e=>e.model?{...e,model:$a(e.model)}:e),i={title:k,sourceFile:e,collection:t,conversationKey:n||void 0,model:ie||o||void 0,exportedAt:new Date().toISOString(),turns:r};vo(`${_o(k)}.json`,JSON.stringify(i,null,2),`application/json;charset=utf-8`),q.success(`Exported as JSON.`)},children:[W.download,` Export .json`]}),i!=null&&(0,R.jsxs)(`button`,{className:`btn sm ghost`,onClick:ee,children:[W.copy,` Copy matched turn`]}),A&&(0,R.jsxs)(`button`,{id:`deleteThreadShelfChat`,className:`btn sm ghost danger`,onClick:()=>void j(),children:[W.trash,` Delete chat`]}),(0,R.jsx)(`span`,{style:{flex:1}}),(0,R.jsxs)(`div`,{className:`role-toggles`,role:`group`,children:[[{id:`user`,label:`User`},{id:`thinking`,label:`Reasoning`},{id:`ai`,label:`Response`}].map(e=>(0,R.jsxs)(`label`,{className:`role-toggle`,"data-role":e.id,"data-on":_[e.id],children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:_[e.id],onChange:()=>T(e.id)}),(0,R.jsx)(`span`,{className:`rt-dot`}),(0,R.jsx)(`span`,{children:e.label})]},e.id)),!p&&d.some(e=>e.createdInThreadShelf)&&(0,R.jsxs)(`label`,{className:`role-toggle`,"data-role":`threadshelf`,"data-on":y,title:`Turns generated locally in ThreadShelf as continuations of this imported thread`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:y,onChange:e=>b(e.target.checked)}),(0,R.jsx)(`span`,{className:`rt-dot`}),(0,R.jsx)(`span`,{children:`Continuations`})]})]})]}),(0,R.jsxs)(`div`,{className:`thread-body`,children:[d.map((e,t)=>{let n=Ds(e),r=Os(e),a=i!=null&&t===Number(i),o=n===`thinking`,s=r.length>Cs,c=x.has(t)||a;if(!y&&e.createdInThreadShelf||!_[n]&&!o)return null;if(!_[n]&&o){let e=x.has(t);return(0,R.jsxs)(`div`,{className:`turn turn-stub`,"data-role":`thinking`,children:[(0,R.jsxs)(`button`,{className:`reasoning-stub`,"data-open":e,onClick:()=>E(t),children:[(0,R.jsx)(`span`,{className:`rs-r`,children:`R`}),(0,R.jsx)(`span`,{className:`rs-label`,children:`reasoning`}),(0,R.jsxs)(`span`,{className:`rs-idx`,children:[`#`,t]}),(0,R.jsx)(`span`,{className:`rs-chevron`,children:e?`−`:`+`})]}),e&&(0,R.jsx)(`div`,{className:`reasoning-stub-body`,children:r})]},t)}let d={user:`U`,thinking:`R`,ai:`A`}[n],f={user:`user`,thinking:`reasoning`,ai:`response`}[n];return(0,R.jsxs)(`div`,{ref:a?w:null,className:`turn`,"data-role":n,"data-matched":a,"data-origin":e.createdInThreadShelf?`threadshelf`:`archive`,children:[(0,R.jsx)(`div`,{className:`turn-avatar`,title:f,children:d}),(0,R.jsxs)(`div`,{className:`turn-content`,children:[(0,R.jsxs)(`div`,{className:`turn-head`,children:[(0,R.jsx)(`span`,{className:`role-tag`,children:f}),(0,R.jsxs)(`span`,{className:`turn-idx`,children:[`#`,t]}),n===`ai`&&$a(e.model)&&(0,R.jsx)(`span`,{className:`turn-model`,title:e.model,children:no(e.model)}),e.createdInThreadShelf&&!p&&(0,R.jsx)(`span`,{className:`threadshelf-turn-badge`,children:`ThreadShelf`}),io(e.createdAt)&&(0,R.jsx)(`time`,{className:`turn-date`,dateTime:e.createdAt,children:io(e.createdAt)}),a?(0,R.jsx)(`span`,{className:`match-pill`,children:`● match`}):(0,R.jsx)(Ts,{text:r}),u&&(0,R.jsx)(`button`,{className:`copy-turn`,title:`Search for similar passages`,onClick:e=>{e.stopPropagation(),u(r)},children:`similar`})]}),(0,R.jsx)(`div`,{className:`turn-body`,"data-collapsed":s&&!c,children:a?(0,R.jsx)(Es,{text:r,q:l}):n===`ai`?(0,R.jsx)(is,{text:r}):r}),s&&(0,R.jsx)(`button`,{className:`show-more`,onClick:()=>E(t),children:c?`Show less`:`Show more`})]})]},t)}),(0,R.jsx)(xs,{sourceFile:e,collection:t,conversationKey:n,showThreadShelfTurns:y}),(0,R.jsxs)(`div`,{className:`thread-end`,"aria-hidden":`true`,children:[(0,R.jsx)(`span`,{className:`dot`}),(0,R.jsx)(`span`,{children:`End of conversation`}),(0,R.jsx)(`span`,{className:`dot`})]})]})]})]})}function As(){let e=Qr(),t=Ni(),n=Mi({from:`/thread`}),r=B(e=>e.setSidebarOpen),i=B(e=>e.activeColl),a=n.collection??i;return(0,R.jsx)(ks,{sourceFile:n.sourceFile,collection:a,conversationKey:n.conversationKey,title:n.title,matchIdx:n.matchIdx,provider:n.provider,model:n.model,onBack:()=>e.history.back(),onMenu:()=>r(!0),query:n.q??``,onSimilar:e=>{let n=lo(e);n&&t({to:`/search/$collection`,params:{collection:a===`__all__`?`all`:a},search:{q:n}})}})}function js(e){let t=e.totalFiles||1,n=e.processedFiles||0,r=(e.phase||``).toLowerCase();return r===`uploading`?`Uploading ${n} / ${t} files`:r===`reading`?`Reading ${n} / ${t} files`:r===`embedding`?e.embeddingTotal===void 0?`Embedding ${n} / ${t} files`:`Embedding ${e.embeddingDone??0} / ${e.embeddingTotal} chunks`:e.status===`starting`?`Starting 0 / ${t} files`:`${n} / ${t} files`}function Ms(e){let t=e.totalFiles||1,n=e.processedFiles||0;return{pct:Math.round(e.progressPercent??n/t*100),step:js(e),chunks:e.totalChunks,time:e.elapsedMs,file:e.currentFile}}function Ns(e){let t=e.result;if(t?.replacementSkipped)return`Nothing was saved. The existing collection was kept because the folder contains empty or invalid exports, or no conversations. Fix the exports and retry.`;let n=t?.files?.length??0,r=t?.conversations??n,i=t?.errors?.length??0,a=`Indexed ${r} conversations as ${t?.ingested??0} chunks from ${n} files in ${ro(t?.elapsedMs??0)}.`;return i?`${a} ${i} file${i===1?``:`s`} failed.`:a}var Ps=e=>e.webkitRelativePath||e.name,Fs=(e,t)=>{if(e.webkitRelativePath)return e;try{Object.defineProperty(e,"webkitRelativePath",{configurable:!0,value:t})}catch{}return e},Is=async e=>{let t=e.createReader(),n=[];for(;;){let e=await new Promise((e,n)=>{t.readEntries(e,n)});if(!e.length)break;n.push(...e)}return n},Ls=async(e,t=``)=>{if(e.isFile){let n=await new Promise((t,n)=>e.file(t,n));return[Fs(n,`${t}${n.name}`)]}let n=await Is(e);return(await Promise.all(n.map(n=>Ls(n,`${t}${e.name}/`)))).flat()};function Rs({collections:e,onRefresh:t}){let[n,r]=(0,L.useState)(!1),[i,a]=(0,L.useState)(``),[o,s]=(0,L.useState)(null),[c,l]=(0,L.useState)(``),[u,d]=(0,L.useState)(!1),[f,p]=(0,L.useState)(e.find(e=>e!==`all`)??`chunks`),[m,h]=(0,L.useState)(!1),[g,_]=(0,L.useState)(null),[v,y]=(0,L.useState)(null),[b,x]=(0,L.useState)(null),[S,C]=(0,L.useState)(!1),[w,T]=(0,L.useState)(``),E=(0,L.useRef)(null),D=(0,L.useRef)(null),O=(0,L.useCallback)(async e=>{try{let t=await fetch(`/scripts/${e}`);if(!t.ok)throw Error(`not found`);await navigator.clipboard.writeText(await t.text()),T(e),setTimeout(()=>T(``),2500)}catch{y({type:`err`,text:`Could not copy script — open scripts/${e} manually.`})}},[]),ee=(0,L.useMemo)(()=>o?o.filter(e=>co(Ps(e))):[],[o]),te=(0,L.useCallback)(e=>{if(!e.length)return;s([...e]);let t=Ps(e[0]).replace(/\\/g,`/`).split(`/`)[0]??`folder`,n=e.filter(e=>co(Ps(e)));l(`${n.length} files from "${t}"`),x(e.map(e=>{let t=Ps(e);return{name:t.replace(/\\/g,`/`).split(`/`).pop()??``,ok:co(t)}}))},[]),k=(0,L.useCallback)(()=>{let e=E.current?.files;e?.length&&te(Array.from(e))},[te]),ne=(0,L.useCallback)(async e=>{try{let t=Array.from(e.items).map(e=>e.webkitGetAsEntry?.()).filter(e=>!!e),n=t.length?(await Promise.all(t.map(e=>Ls(e)))).flat():Array.from(e.files);if(!n.length){l(`Drop did not include readable files. Use Choose folder instead.`);return}te(n)}catch(e){l(`Drop failed: ${e instanceof Error?e.message:`Unknown error`}`)}},[te]),re=(0,L.useCallback)(async()=>{if(i.trim()){l(`Checking…`);try{let e=await H.ingestPreview(i,f),t=new Set(e.duplicates.map(e=>e.sourceFile));l(`${e.files.length} export files found${t.size?`, ${t.size} will be re-indexed`:``}`),x(e.files.map(e=>({name:String(e).replace(/\\/g,`/`).split(`/`).pop()??``,ok:!0,note:t.has(e)?`re-index`:``})))}catch(e){l(`Error: ${e instanceof Error?e.message:`Unknown`}`)}}},[i,f]),ie=(0,L.useCallback)(async()=>{let e=o&&ee.length>0,n=f;if(e&&n===`chunks`&&(n=Ps(o[0]).replace(/\\/g,`/`).split(`/`).filter(Boolean)[0]??n),!e&&!i.trim()){y({type:`err`,text:`Choose a folder or enter a path.`});return}h(!0),_({pct:0,step:`Starting…`}),y(null);let r=new AbortController;D.current=r;let a=e=>{if(e.status===`completed`){y({type:e.result?.errors?.length||e.result?.replacementSkipped?`err`:`info`,text:Ns(e)});return}if(e.status===`error`){y({type:`err`,text:`Error: ${e.error??`Unknown`}`});return}_(Ms(e))};try{e?await H.ingestUploadProgress(ee,n,u,a,r.signal):await H.ingestPathProgress(i,n,u,a,r.signal)}catch(e){r.signal.aborted?y({type:`info`,text:`Indexing stopped. Completed files remain indexed.`}):y({type:`err`,text:`Error: ${e instanceof Error?e.message:`Unknown`}`})}finally{D.current===r&&(D.current=null),h(!1),_(null),t()}},[o,ee,f,i,u,t]),A=e.filter(e=>e!==`all`);return(0,R.jsxs)(`div`,{className:`view`,children:[(0,R.jsxs)(`div`,{className:`section-h`,children:[(0,R.jsx)(`h2`,{children:`Index a folder`}),(0,R.jsx)(`span`,{className:`desc`,children:`Local parse → chunk → embed → write to LanceDB. Your chat data stays on this machine.`})]}),(0,R.jsxs)(`details`,{className:`panel`,style:{marginBottom:16},children:[(0,R.jsxs)(`summary`,{style:{cursor:`pointer`,padding:`12px 14px`,fontWeight:500,listStyle:`revert`},children:[W.info,` Where to get your data (export guides)`]}),(0,R.jsxs)(`div`,{style:{padding:`4px 14px 16px`,fontSize:13,color:`var(--text-2)`,display:`grid`,gap:16},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`b`,{style:{color:`var(--text-1)`},children:`OpenRouter`}),` — no built-in export. Run a browser-console script, then index the downloaded folder:`,(0,R.jsxs)(`ol`,{style:{margin:`6px 0`,paddingLeft:20,lineHeight:1.7},children:[(0,R.jsx)(`li`,{children:`Open openrouter.ai signed in, with your chat list visible.`}),(0,R.jsxs)(`li`,{children:[`Open DevTools → Console (`,(0,R.jsx)(`kbd`,{children:`F12`}),`).`]}),(0,R.jsx)(`li`,{children:`Copy a script below, paste into the console, press Enter.`}),(0,R.jsx)(`li`,{children:`Allow “multiple downloads” if asked; then index the folder here.`})]}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`},children:[(0,R.jsxs)(`button`,{className:`btn sm`,onClick:()=>void O(`openrouter-export-all.js`),children:[W.copy,` `,w===`openrouter-export-all.js`?`Copied!`:`Copy “export all chats” script`]}),(0,R.jsxs)(`button`,{className:`btn sm`,onClick:()=>void O(`openrouter-export-browser.js`),children:[W.copy,` `,w===`openrouter-export-browser.js`?`Copied!`:`Copy “single chat” script`]})]})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`b`,{style:{color:`var(--text-1)`},children:`LM Studio`}),` — point at its local conversation folder (paste into “paste path” below):`,(0,R.jsxs)(`ul`,{style:{margin:`6px 0`,paddingLeft:20,lineHeight:1.8},children:[(0,R.jsxs)(`li`,{children:[`Windows: `,(0,R.jsx)(`code`,{children:`%USERPROFILE%\\.lmstudio\\conversations\\`})]}),(0,R.jsxs)(`li`,{children:[`macOS / Linux: `,(0,R.jsx)(`code`,{children:`~/.lmstudio/conversations/`})]}),(0,R.jsxs)(`li`,{children:[`Older builds: `,(0,R.jsx)(`code`,{children:`~/.cache/lm-studio/conversations/`})]})]})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`b`,{style:{color:`var(--text-1)`},children:`Google AI Studio`}),` — download your Google Drive “Google AI Studio” folder, unzip it, and index that folder (files may have no extension — that’s fine). Text chats and Imagen prompt histories are supported.`]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`b`,{style:{color:`var(--text-1)`},children:`ChatGPT / Claude`}),` — use the app’s official data export, then index the `,(0,R.jsx)(`code`,{children:`conversations.json`}),` it produces.`]})]})]}),(0,R.jsxs)(`div`,{className:`drop-zone`,"data-dragging":n,onDragOver:e=>{e.preventDefault(),r(!0)},onDragLeave:()=>r(!1),onDrop:e=>{e.preventDefault(),r(!1),ne(e.dataTransfer)},children:[(0,R.jsx)(`div`,{className:`ico-big`,children:W.folder}),(0,R.jsx)(`h3`,{children:`Drop a folder of exports here`}),(0,R.jsx)(`p`,{children:`Supported: Google AI Studio, OpenRouter, ChatGPT/OpenAI, Claude/Anthropic, LM Studio, and Grok JSON exports. Subfolders are recursed; account metadata files are skipped automatically.`}),(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,flexWrap:`wrap`},children:[(0,R.jsx)(`input`,{id:`folderFileInput`,ref:E,type:`file`,style:{display:`none`},webkitdirectory:``,directory:``,multiple:!0,onChange:k}),(0,R.jsxs)(`button`,{className:`btn primary`,onClick:()=>E.current?.click(),children:[W.folder,` Choose folder`]}),c&&(0,R.jsx)(`span`,{id:`folderChosenLabel`,className:`mono`,style:{fontSize:12,color:`var(--text-2)`},children:c})]}),(0,R.jsx)(`div`,{style:{fontSize:11,color:`var(--text-3)`,margin:`4px 0`},children:`or paste path`}),(0,R.jsxs)(`div`,{className:`path-input`,children:[(0,R.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:`/absolute/path/to/exports`}),(0,R.jsxs)(`button`,{className:`btn`,onClick:re,disabled:!i,children:[W.arrowRight,` Use path`]})]})]}),(0,R.jsxs)(`div`,{className:`ingest-options`,children:[(0,R.jsx)(`label`,{style:{color:`var(--text-3)`},children:`Target collection`}),(0,R.jsx)(`select`,{id:`targetCollectionSelect`,value:f,onChange:e=>p(e.target.value),className:`btn sm`,style:{padding:`0 8px`,background:`var(--bg-2)`},children:A.map(e=>(0,R.jsx)(`option`,{value:e,children:Za(e)},e))}),(0,R.jsxs)(`button`,{id:`newCollectionBtnIndexing`,className:`btn sm`,onClick:()=>C(!0),title:`Create a new collection`,children:[W.plus,` New`]}),(0,R.jsxs)(`label`,{children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:u,onChange:e=>d(e.target.checked)}),` `,`Clear collection first`]}),(0,R.jsxs)(`button`,{id:`ingestBtn`,className:`btn primary`,onClick:ie,disabled:m,children:[W.zap,` `,m?`Indexing…`:`Index folder`]}),m&&(0,R.jsx)(`button`,{id:`stopIngestBtn`,className:`btn danger`,onClick:()=>D.current?.abort(),children:`Stop indexing`})]}),b&&b.length>0&&(0,R.jsxs)(`div`,{className:`panel`,children:[(0,R.jsxs)(`div`,{className:`panel-head`,children:[(0,R.jsx)(`h3`,{children:`Ingest preview`}),(0,R.jsxs)(`span`,{className:`sub`,children:[b.filter(e=>e.ok).length,` ok · `,b.filter(e=>!e.ok).length,` `,`skipped`]})]}),(0,R.jsx)(`div`,{style:{maxHeight:260,overflow:`auto`},children:b.slice(0,60).map((e,t)=>(0,R.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`20px 1fr auto`,alignItems:`center`,gap:8,padding:`6px 14px`,borderBottom:`1px solid var(--border-0)`,fontSize:12},children:[(0,R.jsx)(`span`,{style:{color:e.ok?`var(--success)`:`var(--text-4)`},children:e.ok?W.check:`·`}),(0,R.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,color:e.ok?`var(--text-1)`:`var(--text-3)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.name}),(0,R.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:10.5,color:`var(--text-3)`},children:e.note||(e.ok?``:`skipped`)})]},t))})]}),g&&(0,R.jsxs)(`div`,{className:`progress-panel`,children:[(0,R.jsxs)(`div`,{className:`progress-head`,children:[(0,R.jsx)(`span`,{className:`step`,children:(0,R.jsx)(`b`,{children:g.step})}),(0,R.jsxs)(`span`,{className:`pct`,children:[g.pct,`%`]})]}),(0,R.jsx)(`div`,{className:`progress-bar-new`,children:(0,R.jsx)(`i`,{style:{width:`${g.pct}%`}})}),g.chunks!=null&&(0,R.jsxs)(`div`,{className:`progress-details-new`,children:[`Chunks: `,(0,R.jsx)(`strong`,{children:g.chunks.toLocaleString()}),(0,R.jsx)(`span`,{style:{color:`var(--text-4)`},children:`·`}),`Time: `,(0,R.jsx)(`strong`,{children:ro(g.time??0)})]}),g.file&&(0,R.jsx)(`div`,{className:`progress-file`,children:g.file.replace(/^.*[\\/]/,``)})]}),v&&(0,R.jsxs)(`div`,{id:`ingestStatus`,className:`banner ${v.type}`,children:[(0,R.jsx)(`span`,{className:`ico`,children:v.type===`err`?W.warn:W.check}),(0,R.jsx)(`div`,{className:`grow`,children:v.text})]}),S&&(0,R.jsx)(Mo,{open:!0,onClose:()=>C(!1),onCreated:e=>{p(e),t()}})]})}function zs(){let e=Ke(),t=B(e=>e.activeColl),n=B(e=>e.setSidebarOpen),{data:r}=za(),i=r?.collections??[`all`,`chunks`],a=(0,L.useCallback)(async()=>{await e.invalidateQueries({queryKey:[`collections`]}),await e.invalidateQueries({queryKey:[`files`]}),await e.invalidateQueries({queryKey:[`search`]}),await e.invalidateQueries({queryKey:[`thread`]})},[e]);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Go,{view:`indexing`,activeColl:t,onMenu:()=>n(!0)}),(0,R.jsx)(`div`,{className:`main-scroll`,children:(0,R.jsx)(Rs,{collections:i,onRefresh:a})})]})}var Bs=e=>new Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:1}).format(e),Vs=e=>e.toLocaleString(`en`),Hs=e=>{if(e<=0)return 1;let t=10**Math.floor(Math.log10(e));for(let n of[1,2,5,10])if(e<=n*t)return n*t;return 10*t},Us=e=>{let t=new Date(`${e}-01T00:00:00Z`);return new Intl.DateTimeFormat(`en`,{month:`short`,year:`numeric`,timeZone:`UTC`}).format(t)},Ws=e=>{let t=new Date(`${e}-01T00:00:00Z`);return`${new Intl.DateTimeFormat(`en`,{month:`short`,timeZone:`UTC`}).format(t)} ’${e.slice(2,4)}`};function Gs({label:e,value:t}){return(0,R.jsxs)(`div`,{className:`stat-tile`,children:[(0,R.jsx)(`span`,{className:`stat-label`,children:e}),(0,R.jsx)(`span`,{className:`stat-value`,title:Vs(t),children:Bs(t)})]})}function Ks({activity:e}){let[t,n]=(0,L.useState)(null),r=Hs(Math.max(...e.map(e=>e.count),0)),i=(0,L.useMemo)(()=>{let t=0;return e.forEach((n,r)=>{n.count>(e[t]?.count??0)&&(t=r)}),t},[e]);if(e.length===0)return(0,R.jsx)(`p`,{className:`chart-empty`,children:`No dated turns yet — timestamps appear as you index.`});let a=e.length>18?12:e.length>8?6:2;return(0,R.jsxs)(`div`,{className:`activity-chart`,onMouseLeave:()=>n(null),children:[(0,R.jsx)(`div`,{className:`chart-grid`,"aria-hidden":`true`,children:[1,.5,0].map(e=>{let t=r*e;return(0,R.jsxs)(`div`,{className:`grid-row`,children:[(0,R.jsx)(`span`,{className:`grid-tick`,children:Number.isInteger(t)?Vs(t):``}),(0,R.jsx)(`span`,{className:`grid-line`})]},e)})}),(0,R.jsx)(`div`,{className:`chart-cols`,role:`img`,"aria-label":`Indexed passages per month`,children:e.map((e,a)=>{let o=r>0?e.count/r*100:0,s=a===i&&e.count>0;return(0,R.jsxs)(`div`,{className:`col-slot`,onMouseEnter:()=>n(a),"aria-label":`${Us(e.month)}: ${Vs(e.count)} passages`,children:[s&&t===null&&(0,R.jsx)(`span`,{className:`col-peak`,children:Vs(e.count)}),(0,R.jsx)(`div`,{className:`col-bar`,"data-hover":t===a,style:{height:`${Math.max(o,e.count>0?2:0)}%`}}),t===a&&(0,R.jsxs)(`div`,{className:`chart-tip`,children:[(0,R.jsx)(`b`,{children:Us(e.month)}),(0,R.jsxs)(`span`,{children:[Vs(e.count),` passages`]})]})]},e.month)})}),(0,R.jsx)(`div`,{className:`chart-x`,"aria-hidden":`true`,children:e.map((e,t)=>(0,R.jsx)(`span`,{className:`x-slot`,children:t%a===0?Ws(e.month):``},e.month))})]})}function qs({items:e}){let t=Math.max(...e.map(e=>e.value),1);return(0,R.jsx)(`div`,{className:`bar-list`,children:e.map(e=>(0,R.jsxs)(`div`,{className:`bar-row`,title:e.detail,children:[(0,R.jsx)(`span`,{className:`bar-label`,children:e.label}),(0,R.jsx)(`span`,{className:`bar-track`,children:(0,R.jsx)(`span`,{className:`bar-fill`,style:{width:`${e.value/t*100}%`}})}),(0,R.jsx)(`span`,{className:`bar-value`,children:Vs(e.value)})]},e.key))})}function Js(){let e=Ni(),t=B(e=>e.setSidebarOpen),n=B(e=>e.activeColl),[r,i]=(0,L.useState)(n||`all`),{data:a}=za(),o=a?.collections??[`all`],{data:s,isLoading:c,isError:l}=Ba(r),u=t=>{e({to:`/thread`,search:{sourceFile:t.sourceFile,collection:t.collection,conversationKey:t.conversationKey||void 0,title:t.title||void 0,provider:t.provider||void 0}})},d=s!=null&&s.totals.chunks===0;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Go,{view:`insights`,activeColl:r,onMenu:()=>t(!0)}),(0,R.jsx)(`div`,{className:`main-scroll`,children:(0,R.jsxs)(`div`,{className:`view insights-view`,children:[(0,R.jsxs)(`div`,{className:`insights-head`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h2`,{children:`Archive insights`}),s?.firstActivity&&s?.lastActivity&&(0,R.jsxs)(`p`,{className:`insights-range`,children:[io(s.firstActivity).split(`,`)[0],` —`,` `,io(s.lastActivity).split(`,`)[0]]})]}),(0,R.jsxs)(`label`,{className:`insights-scope`,children:[(0,R.jsx)(`span`,{children:`scope`}),(0,R.jsx)(`select`,{value:r,onChange:e=>i(e.target.value),"aria-label":`Insights scope`,children:o.map(e=>(0,R.jsx)(`option`,{value:e,children:Za(e)},e))})]})]}),l&&(0,R.jsxs)(`div`,{className:`empty`,children:[(0,R.jsx)(`h3`,{children:`Could not load insights.`}),(0,R.jsx)(`p`,{children:`Is the backend running?`})]}),c&&(0,R.jsx)(`div`,{className:`shimmer-card`,style:{height:220}}),d&&(0,R.jsxs)(`div`,{className:`empty`,children:[(0,R.jsx)(`h3`,{children:`Nothing indexed yet.`}),(0,R.jsx)(`p`,{children:`Index a folder of chat exports and your archive stats will appear here.`})]}),s&&!d&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`stat-tiles`,children:[(0,R.jsx)(Gs,{label:`Conversations`,value:s.totals.conversations}),(0,R.jsx)(Gs,{label:`Turns`,value:s.totals.turns}),(0,R.jsx)(Gs,{label:`Files`,value:s.totals.files}),(0,R.jsx)(Gs,{label:`Indexed passages`,value:s.totals.chunks}),r===`all`&&(0,R.jsx)(Gs,{label:`Collections`,value:s.totals.collections})]}),(0,R.jsxs)(`section`,{className:`insight-card`,children:[(0,R.jsx)(`h3`,{children:`Activity over time`}),(0,R.jsx)(`p`,{className:`insight-sub`,children:`Indexed passages per month, by turn date`}),(0,R.jsx)(Ks,{activity:s.activity})]}),(0,R.jsxs)(`div`,{className:`insight-grid`,children:[(0,R.jsxs)(`section`,{className:`insight-card`,children:[(0,R.jsx)(`h3`,{children:`Top models`}),(0,R.jsx)(`p`,{className:`insight-sub`,children:`By indexed passages`}),s.topModels.length===0?(0,R.jsx)(`p`,{className:`chart-empty`,children:`No model metadata in this scope.`}):(0,R.jsx)(qs,{items:s.topModels.map(e=>({key:e.model,label:(0,R.jsx)(`span`,{className:`mono`,children:e.model}),value:e.count,detail:`${e.model}: ${Vs(e.count)} passages`}))})]}),(0,R.jsxs)(`section`,{className:`insight-card`,children:[(0,R.jsx)(`h3`,{children:`Providers`}),(0,R.jsx)(`p`,{className:`insight-sub`,children:`Turns per provider`}),s.providers.length===0?(0,R.jsx)(`p`,{className:`chart-empty`,children:`No conversations stored yet.`}):(0,R.jsx)(qs,{items:s.providers.map(e=>{let t=zo(e.provider);return{key:e.provider,label:(0,R.jsxs)(`span`,{className:`provider-label`,children:[(0,R.jsx)(`span`,{className:`pdot`,style:{background:t.color}}),(0,R.jsx)(`span`,{children:t.short===`—`?e.provider:t.short})]}),value:e.turns,detail:`${t.label}: ${Vs(e.conversations)} conversations, ${Vs(e.turns)} turns`}})})]})]}),(0,R.jsxs)(`section`,{className:`insight-card`,children:[(0,R.jsx)(`h3`,{children:`Longest conversations`}),(0,R.jsxs)(`p`,{className:`insight-sub`,children:[`Top `,s.longestThreads.length,` by turn count`]}),(0,R.jsx)(`div`,{className:`longest-list`,children:s.longestThreads.map((e,t)=>{let n=zo(e.provider);return(0,R.jsxs)(`button`,{className:`longest-row`,onClick:()=>u(e),title:e.sourceFile,children:[(0,R.jsx)(`span`,{className:`rank`,children:t+1}),(0,R.jsx)(`span`,{className:`pdot`,style:{background:n.color}}),(0,R.jsx)(`span`,{className:`l-title`,children:e.title||Qa(e.sourceFile)}),(0,R.jsxs)(`span`,{className:`l-meta`,children:[e.turnCount,` turns`,e.lastTurnAt?` · ${io(e.lastTurnAt).split(`,`)[0]}`:``]})]},`${e.collection}:${e.sourceFile}:${e.conversationKey}:${t}`)})})]})]})]})})]})}var Ys=`npm run mcp`,Xs=`{
|
|
29
|
+
"mcpServers": {
|
|
30
|
+
"threadshelf": {
|
|
31
|
+
"command": "npm",
|
|
32
|
+
"args": ["run", "mcp"],
|
|
33
|
+
"cwd": "/path/to/threadshelf"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}`;function Zs(){let[e,t]=(0,L.useState)(``),n=(0,L.useCallback)((e,n)=>{uo(n),t(e),setTimeout(()=>t(``),1400)},[]);return(0,R.jsxs)(`div`,{className:`view`,children:[(0,R.jsxs)(`div`,{className:`section-h`,children:[(0,R.jsx)(`h2`,{children:`MCP server`}),(0,R.jsx)(`span`,{className:`desc`,children:`Expose your local archive to Claude Desktop, Cursor, and other MCP clients over stdio.`})]}),(0,R.jsxs)(`div`,{className:`banner info`,children:[(0,R.jsx)(`span`,{className:`ico`,children:W.info}),(0,R.jsx)(`div`,{className:`grow`,children:`MCP runs over stdio against your local LanceDB — no port, no auth surface. Stop the process to revoke access.`})]}),(0,R.jsxs)(`div`,{className:`panel`,children:[(0,R.jsxs)(`div`,{className:`panel-head`,children:[(0,R.jsx)(`h3`,{children:`Start the server`}),(0,R.jsx)(`span`,{className:`sub`,children:`run from project root`})]}),(0,R.jsx)(`div`,{className:`panel-body`,children:(0,R.jsxs)(`pre`,{style:{position:`relative`,fontFamily:`var(--font-mono)`,fontSize:12.5,background:`var(--bg-2)`,padding:`12px 14px`,borderRadius:`var(--r-sm)`,color:`var(--text-0)`,whiteSpace:`pre-wrap`},children:[Ys,(0,R.jsx)(`button`,{className:`btn sm ghost`,style:{position:`absolute`,top:6,right:6},onClick:()=>n(`cmd`,Ys),children:e===`cmd`?`copied`:`copy`})]})})]}),(0,R.jsxs)(`div`,{className:`panel`,children:[(0,R.jsxs)(`div`,{className:`panel-head`,children:[(0,R.jsx)(`h3`,{children:`Claude Desktop config`}),(0,R.jsx)(`span`,{className:`sub`,children:`Settings → MCP → Edit config`})]}),(0,R.jsx)(`div`,{className:`panel-body`,children:(0,R.jsxs)(`pre`,{style:{position:`relative`,fontFamily:`var(--font-mono)`,fontSize:12,background:`var(--bg-2)`,padding:`12px 14px`,borderRadius:`var(--r-sm)`,color:`var(--text-0)`,whiteSpace:`pre-wrap`},children:[Xs,(0,R.jsx)(`button`,{className:`btn sm ghost`,style:{position:`absolute`,top:6,right:6},onClick:()=>n(`cfg`,Xs),children:e===`cfg`?`copied`:`copy`})]})})]})]})}function Qs(){let e=B(e=>e.activeColl),t=B(e=>e.setSidebarOpen);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Go,{view:`mcp`,activeColl:e,onMenu:()=>t(!0)}),(0,R.jsx)(`div`,{className:`main-scroll`,children:(0,R.jsx)(Zs,{})})]})}function $s({title:e,desc:t,btn:n,onClick:r}){return(0,R.jsxs)(`div`,{className:`danger-row`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`title`,children:e}),(0,R.jsx)(`div`,{className:`desc`,children:t})]}),(0,R.jsxs)(`button`,{className:`btn danger`,onClick:r,children:[W.trash,` `,n]})]})}function ec({activeColl:e,stats:t,onRefresh:n,onDeleted:r}){let i=e===`all`||e===`__all__`,{data:a}=Va(e,!i),o=a?[...new Set(a.files.map(e=>e.sourceFile))]:null,s=Ja(),c=qa(),l=(0,L.useCallback)(async()=>{if(e===`threadshelf_conversations`){q.error(`ThreadShelf conversations are managed from the Chat page.`);return}if(await To({title:`Clear indexed data for "${Za(e)}"?`,message:`All vectors are dropped, but the collection itself is kept.`,confirmLabel:`Clear data`,danger:!0}))try{await s.mutateAsync(e),n(),q.success(`Cleared "${Za(e)}".`)}catch(e){q.error(e instanceof Error?e.message:`Unknown error`)}},[e,n,s]),u=(0,L.useCallback)(async()=>{if(e===`chunks`||e===`threadshelf_conversations`){q.error(`Cannot delete the default collection.`);return}if(await To({title:`Delete collection "${Za(e)}"?`,message:`The index and copies previously uploaded through ThreadShelf are deleted. Files in the original folder you selected remain untouched.`,confirmLabel:`Delete`,danger:!0}))try{await c.mutateAsync(e),await n(),q.success(`Deleted "${Za(e)}".`),r()}catch(e){q.error(e instanceof Error?e.message:`Unknown error`)}},[e,n,r,c]);if(i)return(0,R.jsxs)(`div`,{className:`view`,children:[(0,R.jsxs)(`div`,{className:`section-h`,children:[(0,R.jsx)(`h2`,{children:`Collection settings`}),(0,R.jsx)(`span`,{className:`desc`,children:`Pick a collection from the sidebar to manage it.`})]}),(0,R.jsxs)(`div`,{className:`banner info`,children:[(0,R.jsx)(`span`,{className:`ico`,children:W.info}),(0,R.jsxs)(`div`,{className:`grow`,children:[`Destructive actions are disabled while `,(0,R.jsx)(`b`,{children:`All collections`}),` is selected.`]})]})]});let d=t[e],f=d?.roles??{user:0,thinking:0,ai:0},p=f.user+f.thinking+f.ai;return(0,R.jsxs)(`div`,{className:`view`,children:[(0,R.jsxs)(`div`,{className:`section-h`,children:[(0,R.jsx)(`h2`,{children:(0,R.jsx)(`span`,{className:`mono`,style:{fontWeight:500},children:Za(e)})}),(0,R.jsx)(`span`,{className:`desc`,children:`Local LanceDB table`})]}),(0,R.jsxs)(`div`,{className:`panel`,style:{padding:0},children:[(0,R.jsxs)(`div`,{className:`stat-grid`,children:[(0,R.jsxs)(`div`,{className:`stat`,children:[(0,R.jsx)(`span`,{className:`k`,children:`files`}),(0,R.jsx)(`span`,{className:`v`,children:(d?.files??0).toLocaleString()}),(0,R.jsx)(`span`,{className:`d`,children:`source exports`})]}),(0,R.jsxs)(`div`,{className:`stat`,children:[(0,R.jsx)(`span`,{className:`k`,children:`chunks`}),(0,R.jsx)(`span`,{className:`v`,children:(d?.chunks??0).toLocaleString()}),(0,R.jsx)(`span`,{className:`d`,children:`indexed vectors`})]}),(0,R.jsxs)(`div`,{className:`stat`,children:[(0,R.jsx)(`span`,{className:`k`,children:`user`}),(0,R.jsx)(`span`,{className:`v`,children:f.user.toLocaleString()}),(0,R.jsx)(`span`,{className:`d`,children:`user turns`})]}),(0,R.jsxs)(`div`,{className:`stat`,children:[(0,R.jsx)(`span`,{className:`k`,children:`response`}),(0,R.jsx)(`span`,{className:`v`,children:f.ai.toLocaleString()}),(0,R.jsx)(`span`,{className:`d`,children:`ai turns`})]})]}),p>0&&(0,R.jsxs)(`div`,{className:`role-dist`,children:[(0,R.jsxs)(`div`,{className:`role-bar`,children:[(0,R.jsx)(`i`,{className:`user`,style:{flex:f.user}}),(0,R.jsx)(`i`,{className:`thinking`,style:{flex:f.thinking}}),(0,R.jsx)(`i`,{className:`ai`,style:{flex:f.ai}})]}),(0,R.jsxs)(`div`,{className:`role-legend`,children:[(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`i`,{className:`user`}),`User `,f.user]}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`i`,{className:`thinking`}),`Thinking `,f.thinking]}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`i`,{className:`ai`}),`Response `,f.ai]})]})]})]}),(0,R.jsxs)(`div`,{className:`panel`,children:[(0,R.jsxs)(`div`,{className:`panel-head`,children:[(0,R.jsx)(`h3`,{children:`Indexed files`}),(0,R.jsxs)(`span`,{className:`sub`,children:[d?.files??0,` files`]})]}),(0,R.jsxs)(`div`,{className:`file-list`,children:[o===null&&(0,R.jsx)(`div`,{className:`file-list-empty`,children:`Loading…`}),o&&o.length===0&&(0,R.jsx)(`div`,{className:`file-list-empty`,children:`No indexed files.`}),o?.map((e,t)=>{let n=String(e).replace(/\\/g,`/`).split(`/`).pop();return(0,R.jsxs)(`div`,{className:`file-row`,children:[(0,R.jsx)(`i`,{}),(0,R.jsx)(`span`,{className:`name`,title:String(e),children:n})]},t)})]})]}),(0,R.jsxs)(`div`,{className:`panel`,children:[(0,R.jsxs)(`div`,{className:`panel-head`,children:[(0,R.jsx)(`h3`,{children:`Danger zone`}),(0,R.jsx)(`span`,{className:`sub`,children:`destructive, irreversible`})]}),(0,R.jsx)(`div`,{className:`panel-body`,style:{display:`flex`,flexDirection:`column`,gap:12},children:e===`threadshelf_conversations`?(0,R.jsx)(`p`,{className:`muted`,children:`This protected collection is maintained automatically from chats created or continued in ThreadShelf.`}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)($s,{title:`Clear indexed data`,desc:`Drop all vectors but keep the collection itself.`,btn:`Clear data`,onClick:l}),(0,R.jsx)($s,{title:`Delete collection`,desc:`Delete the index and ThreadShelf upload copies. Files in your original folder stay untouched.`,btn:`Delete`,onClick:u})]})})]})]})}function tc({initialPath:e,onSelect:t}){let[n,r]=(0,L.useState)(!1),[i,a]=(0,L.useState)(null),[o,s]=(0,L.useState)(e||``),[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)(``),f=async e=>{l(!0),d(``);try{let t=await H.generationDirectories(e);a(t),s(t.path),r(!0)}catch(e){d(e instanceof Error?e.message:`Could not browse system folders.`)}finally{l(!1)}};return n?(0,R.jsxs)(`div`,{className:`directory-picker`,children:[(0,R.jsxs)(`div`,{className:`directory-picker-bar`,children:[(0,R.jsx)(`button`,{className:`btn sm`,type:`button`,disabled:!i?.parent||c,onClick:()=>void f(i?.parent),children:`Up`}),(0,R.jsx)(`input`,{"aria-label":`System folder path`,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&f(o)}}),(0,R.jsx)(`button`,{className:`btn sm`,type:`button`,disabled:c,onClick:()=>void f(o),children:`Go`}),(0,R.jsx)(`button`,{className:`btn sm`,type:`button`,onClick:()=>r(!1),children:`Close`})]}),(0,R.jsx)(`div`,{className:`directory-picker-roots`,children:i?.roots.map(e=>(0,R.jsx)(`button`,{type:`button`,onClick:()=>void f(e.path),children:e.name},e.path))}),u&&(0,R.jsx)(`div`,{className:`field-error`,children:u}),(0,R.jsxs)(`div`,{className:`directory-picker-list`,role:`listbox`,"aria-label":`System folders`,children:[i?.directories.map(e=>(0,R.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":`false`,onClick:()=>void f(e.path),children:[(0,R.jsx)(`span`,{"aria-hidden":`true`,children:`▸`}),e.name]},e.path)),i?.directories.length===0&&(0,R.jsx)(`span`,{children:`No subdirectories`})]}),i?.truncated&&(0,R.jsx)(`span`,{className:`sub`,children:`Showing the first 500 directories.`}),(0,R.jsxs)(`div`,{className:`directory-picker-foot`,children:[(0,R.jsx)(`span`,{title:i?.path,children:i?.path}),(0,R.jsx)(`button`,{className:`btn primary sm`,type:`button`,onClick:()=>{i?.path&&t(i.path),r(!1)},children:`Add this folder`})]})]}):(0,R.jsxs)(`div`,{className:`directory-picker-launch`,children:[(0,R.jsx)(`button`,{className:`btn sm`,type:`button`,disabled:c,onClick:()=>void f(o),children:c?`Opening…`:`Browse system folders…`}),u&&(0,R.jsx)(`span`,{className:`field-error`,children:u})]})}var nc=[{value:``,label:`Detect automatically`},{value:`cpu`,label:`CPU (most compatible)`},{value:`cuda`,label:`NVIDIA CUDA`},{value:`vulkan`,label:`Vulkan (AMD / Intel)`},{value:`rocm`,label:`AMD ROCm`}],rc=e=>e?`${e.slice(0,8)}…${e.slice(-4)}`:`no digest`;function ic({onCompleted:e}){let[t,n]=(0,L.useState)(``),[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)(!0),[s,c]=(0,L.useState)(``),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(``),[p,m]=(0,L.useState)(0),h=(0,L.useRef)(null),g=(0,L.useCallback)(e=>H.quickSetupPlan(t||void 0,e).then(e=>{i(e),c(``)}).catch(t=>{e?.aborted||c(t instanceof Error?t.message:`Could not build a setup plan.`)}).finally(()=>{e?.aborted||o(!1)}),[t]);(0,L.useEffect)(()=>{let e=new AbortController;return g(e.signal),()=>e.abort()},[g]);let _=(0,L.useCallback)(()=>{o(!0),g()},[g]),v=(0,L.useCallback)(async()=>{let n=new AbortController;h.current=n,u(!0),f(`Starting…`),m(0);try{await H.runQuickSetup({variant:t||void 0,model:r?.model?.repoId,quant:r?.model?.quant,releaseTag:r?.runtime.tag,fingerprint:r?.fingerprint},e=>{if(e.type===`progress`){let t=e.step===`runtime`?`llama.cpp`:`Model`;f(`${t}: ${e.phase??``}${e.file?` · ${e.file}`:``}`),m(e.percent??0)}e.type===`done`&&f(`Finished.`)},n.signal),q.success(`Local generation is ready.`),e?.(),_()}catch(e){if(n.signal.aborted)return;if(e instanceof Ma){e.plan&&i(e.plan),f(``),q.error(e.message);return}q.error(e instanceof Error?e.message:`Setup failed.`)}finally{u(!1),h.current=null}},[t,r,e,_]),y=r?.runtime.action===`reuse`&&(!r.model||r.model.action===`reuse`);return(0,R.jsxs)(`div`,{className:`panel generation-panel`,children:[(0,R.jsxs)(`div`,{className:`panel-head`,children:[(0,R.jsx)(`h3`,{children:`Set up local generation`}),(0,R.jsx)(`span`,{className:`sub`,children:`one screen · one confirmation`})]}),(0,R.jsxs)(`div`,{className:`panel-body quick-setup`,children:[(0,R.jsxs)(`label`,{className:`quick-setup-variant`,children:[(0,R.jsx)(`span`,{children:`Accelerator`}),(0,R.jsx)(`select`,{value:t,onChange:e=>n(e.target.value),disabled:l,children:nc.map(e=>(0,R.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),a&&(0,R.jsx)(`p`,{className:`catalog-empty`,children:`Checking your hardware and the latest release…`}),s&&(0,R.jsx)(`p`,{className:`catalog-error`,children:s}),r&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`p`,{className:`quick-setup-detected`,children:[`Detected:`,` `,(0,R.jsxs)(`b`,{children:[r.hardware.devices[0]?.name??`no accelerator`,r.hardware.devices[0]?` · ${yo(r.hardware.modelBudgetBytes)}`:``]}),` `,`→ llama.cpp `,(0,R.jsx)(`b`,{children:r.runtime.variant}),` build`]}),(0,R.jsxs)(`ol`,{className:`quick-setup-steps`,children:[(0,R.jsxs)(`li`,{"data-action":r.runtime.action,children:[(0,R.jsxs)(`span`,{className:`quick-setup-step-title`,children:[`llama.cpp `,r.runtime.tag,` (`,r.runtime.variant,`)`,r.runtime.action===`reuse`&&(0,R.jsx)(`em`,{children:`already installed`})]}),r.runtime.action===`install`&&(0,R.jsxs)(`span`,{className:`quick-setup-step-meta`,title:r.runtime.url,children:[r.runtime.url,` · `,yo(r.runtime.sizeBytes),` · sha256`,` `,rc(r.runtime.sha256)]}),r.runtime.companions.map(e=>(0,R.jsxs)(`span`,{className:`quick-setup-step-meta`,title:e.url,children:[`runtime companion · `,yo(e.sizeBytes),` · sha256`,` `,rc(e.sha256)]},e.url))]}),r.model?(0,R.jsxs)(`li`,{"data-action":r.model.action,children:[(0,R.jsxs)(`span`,{className:`quick-setup-step-title`,children:[r.model.repoId,` · `,r.model.quant,(0,R.jsx)(`em`,{children:r.model.action===`reuse`?`already downloaded`:yo(r.model.totalBytes)})]}),(0,R.jsxs)(`span`,{className:`quick-setup-step-meta`,children:[r.model.files.length,` file`,r.model.files.length===1?``:`s`,` · sha256 `,rc(r.model.files[0]?.sha256),r.model.license?` · ${r.model.license}`:``]})]}):(0,R.jsx)(`li`,{"data-action":`none`,children:(0,R.jsxs)(`span`,{className:`quick-setup-step-title`,children:[`No model selected automatically`,(0,R.jsx)(`em`,{children:`pick one in the model browser`})]})})]}),(0,R.jsxs)(`p`,{className:`quick-setup-destination`,children:[`Destination: `,(0,R.jsx)(`code`,{children:r.runtime.destination}),r.model&&(0,R.jsxs)(R.Fragment,{children:[` `,`and `,(0,R.jsx)(`code`,{children:r.model.directory})]})]}),r.warnings.map(e=>(0,R.jsx)(`p`,{className:`quick-setup-warning`,children:e},e)),l&&(0,R.jsxs)(`div`,{className:`catalog-progress`,children:[(0,R.jsx)(`div`,{className:`catalog-progress-track`,children:(0,R.jsx)(`div`,{className:`catalog-progress-fill`,style:{width:`${p}%`}})}),(0,R.jsx)(`span`,{children:d})]}),(0,R.jsxs)(`div`,{className:`generation-actions`,children:[(0,R.jsx)(`button`,{className:`btn primary`,onClick:()=>void v(),disabled:l||y,children:l?`Working…`:y?`Everything is already installed`:`Download and install${r.totalDownloadBytes?` · ${yo(r.totalDownloadBytes)}`:``}`}),l&&(0,R.jsx)(`button`,{className:`btn ghost`,onClick:()=>h.current?.abort(),children:`Cancel`}),!l&&(0,R.jsx)(`button`,{className:`btn ghost`,onClick:_,children:`Re-check`})]})]})]})]})}var ac=e=>e.join(`
|
|
37
|
+
`),oc=[4096,8192,16384,32768,65536,131072,262144],sc={4096:`4k · light`,8192:`8k · balanced`,16384:`16k`,32768:`32k · recommended for 24 GB GPUs`,65536:`64k · long`,131072:`128k · experimental`,262144:`262k · native for Qwen3.8 · experimental`},cc=65536,lc={default:`F16 · llama.cpp default, uses the most KV memory.`,quality:`Q8_0 keys and values · near-lossless, about half the KV memory. Turns Flash Attention on.`,memory:`Q4_0 keys and values · longest context per GB, small quality cost. Turns Flash Attention on.`},uc={off:`No speculative decoding.`,auto:`Drafts 2 tokens with the model's own MTP/NextN head when the GGUF has one; otherwise stays off.`,aggressive:`Drafts 3 tokens · faster on predictable text, slightly more VRAM. Needs an MTP/NextN head.`},dc={default:`Keeps the chat template default.`,off:`Disables thinking where the chat template supports it.`,low:`Short thinking · fastest answers.`,medium:`Recommended desktop balance of speed and quality.`,high:`Longer thinking.`,xhigh:`Slowest · maximum reasoning, can consume much of the context.`},fc={auto:`Recommended. llama.cpp fits as many layers as possible to available accelerators, then uses CPU.`,cpu:`CPU only. Most compatible, but usually slower for generation.`,gpu:`Single GPU maximum. Loads all possible model layers on the selected GPU.`,hybrid:`CPU + GPU. Offloads an exact number of layers and keeps the rest on CPU.`,"multi-gpu":`Loads all possible layers and distributes work across multiple GPUs.`};function pc(){let[e,t]=(0,L.useState)(null),[n,r]=(0,L.useState)(``),[i,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)(``),[c,l]=(0,L.useState)(``),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(`8192`),[m,h]=(0,L.useState)(`auto`),[g,_]=(0,L.useState)(20),[v,y]=(0,L.useState)(`layer`),[b,x]=(0,L.useState)(0),[S,C]=(0,L.useState)(``),[w,T]=(0,L.useState)(-1),[E,D]=(0,L.useState)(`auto`),[O,ee]=(0,L.useState)(`quality`),[te,k]=(0,L.useState)(`auto`),[ne,re]=(0,L.useState)(`medium`),[ie,A]=(0,L.useState)(``),[j,M]=(0,L.useState)(!1),[ae,oe]=(0,L.useState)(!1),[se,N]=(0,L.useState)(!0),[P,F]=(0,L.useState)(null),[ce,le]=(0,L.useState)(!1),ue=e=>{t(e),s(e.config.llamaCpp.executablePath??``),l(e.config.llamaCpp.baseUrl??``),d(ac(e.config.llamaCpp.modelDirectories)),p(String(e.config.llamaCpp.contextSize)),h(e.config.llamaCpp.acceleration),_(e.config.llamaCpp.gpuLayers),y(e.config.llamaCpp.splitMode),x(e.config.llamaCpp.mainGpu),C(e.config.llamaCpp.tensorSplit??``),T(e.config.llamaCpp.threads),D(e.config.llamaCpp.flashAttention),ee(e.config.llamaCpp.kvCache??`quality`),k(e.config.llamaCpp.speculative??`auto`),re(e.config.llamaCpp.reasoningEffort??`medium`),M(e.config.openRouter.enforceZdr),oe(e.config.openRouter.denyDataCollection),N(e.config.diagnostics?.persistErrorLogs??!0)};(0,L.useEffect)(()=>{let e=new AbortController;return H.generationConfig(e.signal).then(ue).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||r(e instanceof Error?e.message:`Could not load generation settings.`)}),()=>e.abort()},[]);let de=Number(f),fe=/^\d+$/.test(f)&&de>=512&&de<=1048576,pe=async()=>{if(!fe){r(`Context window must be a whole number from 512 to 1,048,576 tokens.`);return}a(!0),r(``);try{let e=await H.updateGenerationConfig({llamaCpp:{executablePath:o,baseUrl:c,modelDirectories:u.split(/\r?\n/).map(e=>e.trim()).filter(Boolean),contextSize:de,acceleration:m,gpuLayers:g,splitMode:v,mainGpu:b,tensorSplit:S,threads:w,flashAttention:E,kvCache:O,speculative:te,reasoningEffort:ne},openRouter:{apiKey:ie||void 0,enforceZdr:j,denyDataCollection:ae},diagnostics:{persistErrorLogs:se}});ue(e),A(``),F(null),window.dispatchEvent(new Event(`threadshelf:generation-runtime-changed`)),q.success(`Generation settings saved.`)}catch(e){let t=e instanceof Error?e.message:`Could not save settings.`;r(t),q.error(t)}finally{a(!1)}},me=async()=>{F(null),r(``);try{let e=await H.generationModels(`llama-cpp`);F(e.models)}catch(e){r(e instanceof Error?e.message:`Model scan failed.`)}};return(0,R.jsxs)(`section`,{className:`generation-settings`,"aria-labelledby":`generation-settings-title`,children:[(0,R.jsx)(`div`,{className:`section-h`,children:(0,R.jsx)(`h2`,{id:`generation-settings-title`,children:`Conversation generation`})}),(0,R.jsx)(`div`,{className:`banner warn`,children:`llama.cpp stays local. OpenRouter sends the selected archived conversation and new prompts to OpenRouter and its downstream provider.`}),n&&(0,R.jsx)(`div`,{className:`banner err`,children:n}),(0,R.jsx)(Do,{detailed:!0}),(0,R.jsx)(ic,{onCompleted:()=>void me()}),(0,R.jsxs)(`div`,{className:`panel generation-panel`,children:[(0,R.jsxs)(`div`,{className:`panel-head`,children:[(0,R.jsx)(`h3`,{children:`llama.cpp wrapper`}),(0,R.jsx)(`span`,{className:`sub`,children:`local · primary engine`})]}),(0,R.jsxs)(`div`,{className:`panel-body generation-form`,children:[(0,R.jsxs)(`label`,{children:[(0,R.jsx)(`span`,{children:`llama-server executable`}),(0,R.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),placeholder:`Auto-detect from PATH or .threadshelf/tools`})]}),(0,R.jsxs)(`label`,{children:[(0,R.jsx)(`span`,{children:`Existing local server URL (optional)`}),(0,R.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),placeholder:`http://127.0.0.1:8080`})]}),(0,R.jsxs)(`label`,{children:[(0,R.jsx)(`span`,{children:`Model directories — one absolute path per line`}),(0,R.jsx)(`textarea`,{value:u,onChange:e=>d(e.target.value),rows:6}),(0,R.jsx)(tc,{initialPath:u.split(/\r?\n/).find(e=>e.trim()),onSelect:e=>{let t=u.split(/\r?\n/).map(e=>e.trim()).filter(Boolean);t.includes(e)||d([...t,e].join(`
|
|
38
|
+
`))}}),e?.config.llamaCpp.defaultModelDirectories.length?(0,R.jsxs)(`small`,{children:[`Also scanning `,e.config.llamaCpp.defaultModelDirectories.length,` default or environment-provided model roots. These are not saved in this field.`]}):null]}),(0,R.jsxs)(`div`,{className:`llama-runtime-config`,children:[(0,R.jsxs)(`label`,{children:[(0,R.jsx)(`span`,{children:`Acceleration profile`}),(0,R.jsxs)(`select`,{value:m,onChange:e=>h(e.target.value),children:[(0,R.jsx)(`option`,{value:`auto`,children:`Auto-fit (recommended)`}),(0,R.jsx)(`option`,{value:`cpu`,children:`CPU only`}),(0,R.jsx)(`option`,{value:`gpu`,children:`Single GPU · maximum offload`}),(0,R.jsx)(`option`,{value:`hybrid`,children:`CPU + GPU · selected layers`}),(0,R.jsx)(`option`,{value:`multi-gpu`,children:`Multi-GPU`})]}),(0,R.jsx)(`small`,{children:fc[m]})]}),(0,R.jsxs)(`label`,{children:[(0,R.jsx)(`span`,{children:`Context window`}),(0,R.jsx)(ps,{id:`llamaContextSize`,label:`Context window in tokens`,value:f,onChange:p,options:oc,optionLabel:e=>sc[e]??e.toLocaleString(),invalid:!fe,title:`Pick a preset or type any whole number from 512 to 1,048,576 tokens`}),(0,R.jsx)(`small`,{children:fe?`${Number(f).toLocaleString()} tokens${de>cc?` · Experimental: decoding can slow sharply past ~64–80K on current CUDA builds.`:``}`:`Enter a whole number from 512 to 1,048,576.`})]}),m===`hybrid`&&(0,R.jsxs)(`label`,{children:[(0,R.jsx)(`span`,{children:`GPU layers`}),(0,R.jsx)(`input`,{type:`number`,min:1,max:999,value:g,onChange:e=>_(Number(e.target.value))})]}),(m===`gpu`||m===`multi-gpu`&&v===`row`)&&(0,R.jsxs)(`label`,{children:[(0,R.jsx)(`span`,{children:`Main GPU index`}),(0,R.jsx)(`input`,{type:`number`,min:0,max:31,value:b,onChange:e=>x(Number(e.target.value))})]}),m===`multi-gpu`&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`label`,{children:[(0,R.jsx)(`span`,{children:`Multi-GPU split`}),(0,R.jsxs)(`select`,{value:v,onChange:e=>y(e.target.value),children:[(0,R.jsx)(`option`,{value:`layer`,children:`Layer · balanced default`}),(0,R.jsx)(`option`,{value:`row`,children:`Row · parallel weights`})]})]}),(0,R.jsxs)(`label`,{children:[(0,R.jsx)(`span`,{children:`GPU proportions (optional)`}),(0,R.jsx)(`input`,{value:S,onChange:e=>C(e.target.value),placeholder:`1,1 or 3,1`})]})]}),(0,R.jsxs)(`label`,{children:[(0,R.jsx)(`span`,{children:`CPU threads`}),(0,R.jsx)(`input`,{type:`number`,min:-1,max:1024,value:w,onChange:e=>T(Number(e.target.value))}),(0,R.jsx)(`small`,{children:`-1 lets llama.cpp choose automatically.`})]}),(0,R.jsxs)(`label`,{children:[(0,R.jsx)(`span`,{children:`Flash Attention`}),(0,R.jsxs)(`select`,{value:E,onChange:e=>D(e.target.value),children:[(0,R.jsx)(`option`,{value:`auto`,children:`Auto (recommended)`}),(0,R.jsx)(`option`,{value:`on`,children:`On`}),(0,R.jsx)(`option`,{value:`off`,children:`Off`})]})]}),(0,R.jsxs)(`label`,{children:[(0,R.jsx)(`span`,{children:`KV cache`}),(0,R.jsxs)(`select`,{value:O,onChange:e=>ee(e.target.value),children:[(0,R.jsx)(`option`,{value:`quality`,children:`Quality · Q8 (recommended)`}),(0,R.jsx)(`option`,{value:`memory`,children:`Memory saver · Q4`}),(0,R.jsx)(`option`,{value:`default`,children:`Default · F16`})]}),(0,R.jsx)(`small`,{children:lc[O]})]}),(0,R.jsxs)(`label`,{children:[(0,R.jsx)(`span`,{children:`Speculative decoding (MTP)`}),(0,R.jsxs)(`select`,{value:te,onChange:e=>k(e.target.value),children:[(0,R.jsx)(`option`,{value:`auto`,children:`Auto · draft 2 (recommended)`}),(0,R.jsx)(`option`,{value:`aggressive`,children:`Aggressive · draft 3`}),(0,R.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,R.jsx)(`small`,{children:uc[te]})]}),(0,R.jsxs)(`label`,{children:[(0,R.jsx)(`span`,{children:`Reasoning effort`}),(0,R.jsxs)(`select`,{value:ne,onChange:e=>re(e.target.value),children:[(0,R.jsx)(`option`,{value:`medium`,children:`Medium (recommended)`}),(0,R.jsx)(`option`,{value:`low`,children:`Low`}),(0,R.jsx)(`option`,{value:`high`,children:`High`}),(0,R.jsx)(`option`,{value:`xhigh`,children:`XHigh · slow`}),(0,R.jsx)(`option`,{value:`off`,children:`Off`}),(0,R.jsx)(`option`,{value:`default`,children:`Template default`})]}),(0,R.jsx)(`small`,{children:dc[ne]})]})]}),(0,R.jsxs)(`div`,{className:`setup-note`,children:[`Safe discovery: `,(0,R.jsx)(`code`,{children:`npm run setup:llama`}),`. Check latest release:`,` `,(0,R.jsx)(`code`,{children:`npm run setup:llama -- -- --check`}),`. Nothing downloads until explicit`,` `,(0,R.jsx)(`code`,{children:`--install`}),` or `,(0,R.jsx)(`code`,{children:`--url`}),` approval.`,(0,R.jsx)(`br`,{}),`GPU profiles require a compatible build. Install explicitly with`,` `,(0,R.jsx)(`code`,{children:`--variant cuda`}),`, `,(0,R.jsx)(`code`,{children:`vulkan`}),`, `,(0,R.jsx)(`code`,{children:`rocm`}),`, or`,` `,(0,R.jsx)(`code`,{children:`sycl`}),`; Metal is automatic on supported Macs.`]}),(0,R.jsxs)(`div`,{className:`generation-actions`,children:[(0,R.jsx)(`button`,{className:`btn primary`,onClick:()=>le(!0),children:`Download a model…`}),(0,R.jsx)(`button`,{className:`btn`,onClick:()=>void me(),children:`Scan GGUF models`}),P&&(0,R.jsxs)(`span`,{children:[P.length.toLocaleString(),` model files found`]})]})]})]}),(0,R.jsxs)(`div`,{className:`panel generation-panel`,children:[(0,R.jsxs)(`div`,{className:`panel-head`,children:[(0,R.jsx)(`h3`,{children:`OpenRouter API`}),(0,R.jsx)(`span`,{className:`sub`,children:`external · opt-in`})]}),(0,R.jsxs)(`div`,{className:`panel-body generation-form`,children:[(0,R.jsxs)(`label`,{children:[(0,R.jsx)(`span`,{children:`Session API key (or set OPENROUTER_API_KEY in the server .env)`}),(0,R.jsx)(`input`,{type:`password`,autoComplete:`off`,value:ie,onChange:e=>A(e.target.value),placeholder:e?.config.openRouter.apiKeyConfigured?`A key is configured`:`sk-or-v1-…`})]}),(0,R.jsx)(`p`,{className:`sub`,children:`A key entered here stays in server-process memory only. A key in the gitignored .env persists across restarts. Neither value is returned by the API.`}),(0,R.jsxs)(`label`,{className:`check-field`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:j,onChange:e=>M(e.target.checked)}),`Use ZDR-only routing by default (can exclude many endpoints)`]}),(0,R.jsxs)(`label`,{className:`check-field`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:ae,onChange:e=>oe(e.target.checked)}),`Use only providers that deny data collection/training`]})]})]}),(0,R.jsxs)(`div`,{className:`panel generation-panel`,children:[(0,R.jsxs)(`div`,{className:`panel-head`,children:[(0,R.jsx)(`h3`,{children:`Diagnostics`}),(0,R.jsx)(`span`,{className:`sub`,children:`local error log`})]}),(0,R.jsxs)(`div`,{className:`panel-body generation-form`,children:[(0,R.jsxs)(`label`,{className:`check-field`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:se,onChange:e=>N(e.target.checked)}),`Save generation errors to .threadshelf/generation-errors.log`]}),(0,R.jsx)(`p`,{className:`sub`,children:`ThreadShelf writes provider/model errors without adding prompts, answers, or reasoning. Private tab-scoped chats are never written, regardless of this setting.`})]})]}),(0,R.jsxs)(`div`,{className:`generation-actions`,children:[(0,R.jsx)(`button`,{className:`btn primary`,disabled:i,onClick:()=>void pe(),children:i?`Saving…`:`Save generation settings`}),e?.providers.map(e=>(0,R.jsxs)(`span`,{className:`provider-status`,"data-ready":e.available,children:[e.label,`: `,e.available?`ready`:`not configured`]},e.id))]}),(0,R.jsx)(ls,{open:ce,onClose:()=>le(!1),onDownloaded:()=>void me()})]})}function mc(){let e=Ke(),t=Ni(),n=B(e=>e.activeColl),r=B(e=>e.setActiveColl),i=B(e=>e.setSidebarOpen),{data:a}=za(),o=a?.stats??{},s=(0,L.useCallback)(async()=>{await e.invalidateQueries({queryKey:[`collections`]}),await e.invalidateQueries({queryKey:[`files`]})},[e]),c=(0,L.useCallback)(()=>{r(`all`),t({to:`/search/$collection`,params:{collection:`all`}})},[t,r]);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Go,{view:`settings`,activeColl:n,onMenu:()=>i(!0)}),(0,R.jsxs)(`div`,{className:`main-scroll`,children:[(0,R.jsx)(`div`,{className:`view`,children:(0,R.jsx)(pc,{})}),(0,R.jsx)(ec,{activeColl:n,stats:o,onRefresh:s,onDeleted:c})]})]})}var hc=`private-session`,gc=`draft-saved`,_c=`threadshelf:private-chat`,vc=`threadshelf:interrupted-generations:`,yc=()=>({createdAt:new Date().toISOString(),messages:[],hasRecovery:!1}),bc=()=>globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random()}`,xc=()=>{try{let e=JSON.parse(sessionStorage.getItem(_c)??``);return!e?.createdAt||!Array.isArray(e.messages)||e.messages.some(e=>!e||![`user`,`assistant`].includes(e.role)||typeof e.content!=`string`)?yc():{...e,hasRecovery:e.hasRecovery===!0}}catch{return yc()}},Sc=e=>{let t=[],n;for(let r of e)r.user===void 0?r.thinking===void 0?r.ai!==void 0&&(t.push({role:`assistant`,content:r.ai,model:r.model,reasoning:n}),n=void 0):n=r.thinking:(t.push({role:`user`,content:r.user,model:r.model}),n=void 0);return t},Cc=e=>{let t=e.find(e=>e.role===`user`)?.content.trim();if(!t)return`New chat`;let n=t.replace(/\s+/g,` `);return n.length>52?`${n.slice(0,49)}…`:n};function wc(){let e=Ke(),t=Ni(),n=Mi({from:`/chat`}),r=B(e=>e.activeColl),i=B(e=>e.setSidebarOpen),[a,o]=(0,L.useState)([]),[s,c]=(0,L.useState)(xc),[l,u]=(0,L.useState)(()=>n.draft?gc:n.private?hc:n.thread?n.thread:s.messages.length||s.hasRecovery?hc:``),[d,f]=(0,L.useState)(),[p,m]=(0,L.useState)(!0),[h,g]=(0,L.useState)(``),[,_]=(0,L.useState)(``),[v,y]=(0,L.useState)(()=>n.draft??bc()),[b,x]=(0,L.useState)(!1),[S,C]=(0,L.useState)(``),w=(0,L.useCallback)(async t=>{let n=await H.generationThreads(t);return o(n.threads),e.setQueryData([`generation-threads`],n),n.threads},[e]);(0,L.useEffect)(()=>{s.messages.length||s.hasRecovery?sessionStorage.setItem(_c,JSON.stringify(s)):sessionStorage.removeItem(_c)},[s]);let T=(0,L.useCallback)(e=>{c(t=>t.hasRecovery===e?t:{...t,hasRecovery:e})},[]);(0,L.useEffect)(()=>{let t=new AbortController;return H.generationThreads(t.signal).then(t=>{o(t.threads),e.setQueryData([`generation-threads`],t),u(e=>e||t.threads[0]?.id||``)}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||g(e instanceof Error?e.message:`Could not load local chats.`)}).finally(()=>m(!1)),()=>t.abort()},[e]),(0,L.useEffect)(()=>{if(l===hc||l===gc||!l)return;let e=new AbortController;return H.generationThread(l,e.signal).then(f).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||g(e instanceof Error?e.message:`Could not open this chat.`)}),()=>e.abort()},[l]);let E=(0,L.useCallback)(()=>{f(void 0),u(hc),g(``)},[]),D=(0,L.useCallback)(e=>{f(void 0),_(``),y(e??bc()),x(!1),u(gc),g(``)},[]);(0,L.useEffect)(()=>{if(!n.draft)return;let e=window.setTimeout(()=>D(n.draft),0);return()=>window.clearTimeout(e)},[n.draft,D]),(0,L.useEffect)(()=>{if(!n.private)return;let e=window.setTimeout(E,0);return()=>window.clearTimeout(e)},[n.private,E]),(0,L.useEffect)(()=>{if(!n.thread)return;let e=window.setTimeout(()=>{f(void 0),x(!1),g(``),u(n.thread??``)},0);return()=>window.clearTimeout(e)},[n.thread]),(0,L.useEffect)(()=>{document.querySelector(`.main-scroll`)?.scrollTo({top:0})},[l]);let O=(0,L.useCallback)(async()=>{let t=await H.createGenerationThread(`New chat`);return o(e=>[t,...e.filter(e=>e.id!==t.id)]),e.setQueryData([`generation-threads`],e=>({threads:[t,...(e?.threads??[]).filter(e=>e.id!==t.id)]})),_(t.id),await e.invalidateQueries({queryKey:[`collections`]}),t.id},[e]),ee=(0,L.useCallback)(async()=>{try{await w()}catch{}_(e=>(e&&(u(e),t({to:`/chat`,search:{thread:e}})),``))},[w,t]),te=()=>{d&&(C(d.title),x(!0))},k=async()=>{let t=S.replace(/\s+/g,` `).trim();if(x(!1),!(!d||!t||t===d.title))try{let n=await H.renameGenerationThread(d.id,t);f(n),o(e=>e.map(e=>e.id===n.id?{...e,title:n.title}:e)),await e.invalidateQueries({queryKey:[`generation-threads`]}),q.success(`Chat renamed.`)}catch(e){g(e instanceof Error?e.message:`Could not rename this chat.`)}},ne=async()=>{(s.messages.length||s.hasRecovery)&&!await To({title:`Delete this private chat?`,message:`This unsaved session and its recovery attempts will be removed from this tab.`,confirmLabel:`Delete chat`,danger:!0})||(sessionStorage.removeItem(`${vc}${s.createdAt}`),c(yc()),sessionStorage.removeItem(_c),f(void 0),u(a[0]?.id??``),q.success(`Private chat deleted.`))},re=async n=>{if(await To({title:`Delete “${n.title}”?`,message:`The conversation and its search index entries will be permanently removed.`,confirmLabel:`Delete chat`,danger:!0}))try{await H.deleteGenerationThread(n.id);let r=a.filter(e=>e.id!==n.id);if(o(r),l===n.id){f(void 0);let e=r[0]?.id??``;u(e),t({to:`/chat`,search:e?{thread:e}:{}})}await Promise.all([e.invalidateQueries({queryKey:[`collections`]}),e.invalidateQueries({queryKey:[`generation-threads`]})]),q.success(`Conversation deleted.`)}catch(e){g(e instanceof Error?e.message:`Could not delete this chat.`)}},ie=(0,L.useCallback)(async()=>{if(l!==hc)try{let[e]=await Promise.all([H.generationThread(l),w()]);f(e)}catch(e){g(e instanceof Error?e.message:`The chat was saved but could not refresh.`)}},[l,w]),A=l===hc,j=l===gc,M=(0,L.useMemo)(()=>A?[...s.messages]:j?[]:Sc(d?.turns??[]),[d?.turns,j,A,s.messages]),ae=A?Cc(s.messages):j?`New chat`:d?.title??`Chat`;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Go,{view:`chat`,activeColl:r,onMenu:()=>i(!0)}),(0,R.jsx)(`div`,{className:`main-scroll`,children:(0,R.jsx)(`div`,{className:`chat-page`,children:(0,R.jsxs)(`main`,{className:`chat-workspace`,children:[h&&(0,R.jsx)(`div`,{className:`banner err`,children:h}),!l&&!p&&(0,R.jsxs)(`div`,{className:`chat-empty`,children:[(0,R.jsx)(`span`,{className:`chat-empty-icon`,children:W.plus}),(0,R.jsx)(`h1`,{children:`Start a new conversation`}),(0,R.jsx)(`p`,{children:`Chats created here are separate from your imported archive. They stay local and become searchable after each complete response.`}),(0,R.jsxs)(`button`,{className:`btn primary`,onClick:()=>D(),children:[W.plus,` New chat`]}),(0,R.jsxs)(`span`,{className:`chat-empty-alpha`,children:[W.warn,` Chat generation is experimental (alpha).`]})]}),(A||j||d)&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`header`,{className:`chat-hero`,children:[(0,R.jsxs)(`div`,{className:`chat-title-row`,children:[b&&d?(0,R.jsx)(`input`,{id:`chatTitleInput`,className:`chat-title-input`,"aria-label":`Chat title`,autoFocus:!0,value:S,onChange:e=>C(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),k()):e.key===`Escape`&&x(!1)},onBlur:()=>void k()}):(0,R.jsx)(`h1`,{title:d?`Double-click to rename`:ae,onDoubleClick:d?te:void 0,children:ae}),A?(0,R.jsxs)(`span`,{className:`chat-storage-badge private`,children:[W.ghost,` Private`]}):(0,R.jsx)(`span`,{className:`chat-storage-badge saved`,title:`Stored locally and indexed for search`,children:`Saved locally`})]}),(0,R.jsxs)(`div`,{className:`chat-hero-actions`,children:[(0,R.jsx)(`span`,{className:`chat-storage-status`,children:A?`Not saved or indexed · removed when this tab closes`:j?`Not saved yet · a chat is created on your first message`:d?.updatedAt?`Updated ${oo(d.updatedAt)||`just now`}`:`Saved locally by default`}),A?(0,R.jsx)(`div`,{className:`saved-chat-actions`,children:(0,R.jsxs)(`button`,{className:`btn sm ghost`,onClick:()=>void ne(),children:[W.trash,` Delete`]})}):d&&(0,R.jsxs)(`div`,{className:`saved-chat-actions`,children:[(0,R.jsx)(`button`,{id:`renameChatButton`,className:`btn sm ghost`,onClick:te,children:`Rename`}),(0,R.jsxs)(`button`,{className:`btn sm ghost`,onClick:()=>void re(d),children:[W.trash,` Delete`]})]})]})]}),(0,R.jsx)(`div`,{className:`chat-conversation`,children:(0,R.jsx)(xs,{threadId:A||j?void 0:d.id,attemptScope:A?s.createdAt:j?`draft:${v}`:d.id,ephemeral:A,draftSaved:j,onCreateThread:j?O:void 0,initialMessages:M,onMessagesChanged:A?e=>c(t=>({...t,messages:e})):void 0,onRecoveryChanged:A?T:void 0,onCompleted:A?void 0:j?()=>void ee():()=>void ie()},A?s.createdAt:j?`draft:${v}`:d.id)})]})]})})})]})}function Tc(){let e=Ni(),t=B(e=>e.activeColl),n=B(e=>e.setSidebarOpen);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Go,{view:`search`,activeColl:t,onMenu:()=>n(!0)}),(0,R.jsx)(`div`,{className:`main-scroll`,children:(0,R.jsx)(`div`,{className:`view`,children:(0,R.jsxs)(`div`,{className:`empty`,id:`notFound`,children:[(0,R.jsx)(`h3`,{children:`That page does not exist.`}),(0,R.jsxs)(`p`,{children:[`The address `,(0,R.jsx)(`code`,{children:window.location.pathname}),` is not part of ThreadShelf. The link may be from an older version, or a path may have been mistyped.`]}),(0,R.jsxs)(`div`,{className:`examples`,children:[(0,R.jsxs)(`button`,{className:`example-chip`,onClick:()=>void e({to:`/search/$collection`,params:{collection:t||`all`}}),children:[W.search,(0,R.jsx)(`span`,{children:`Back to search`})]}),(0,R.jsxs)(`button`,{className:`example-chip`,onClick:()=>void e({to:`/indexing`}),children:[W.download,(0,R.jsx)(`span`,{children:`Index a folder`})]})]})]})})})]})}var Ec=Zi({component:Io}),Dc=Yi({getParentRoute:()=>Ec,path:`/`,beforeLoad:()=>{throw Gn({to:`/search/$collection`,params:{collection:`all`}})}}),Oc=Yi({getParentRoute:()=>Ec,path:`/search`,beforeLoad:({search:e})=>{throw Gn({to:`/search/$collection`,params:{collection:typeof e.collection==`string`?e.collection:`all`},search:{q:typeof e.q==`string`?e.q:void 0,model:typeof e.model==`string`?e.model:void 0,from:typeof e.from==`string`?e.from:void 0,to:typeof e.to==`string`?e.to:void 0,mode:typeof e.mode==`string`?e.mode:void 0}})}}),kc=Yi({getParentRoute:()=>Ec,path:`/search/$collection`,component:Xo,validateSearch:e=>({q:typeof e.q==`string`?e.q:void 0,model:typeof e.model==`string`?e.model:void 0,from:typeof e.from==`string`?e.from:void 0,to:typeof e.to==`string`?e.to:void 0,mode:e.mode===`keyword`?`keyword`:void 0})}),Ac=Yi({getParentRoute:()=>Ec,path:`/thread`,component:As,validateSearch:e=>({sourceFile:typeof e.sourceFile==`string`?e.sourceFile:``,collection:typeof e.collection==`string`?e.collection:void 0,conversationKey:typeof e.conversationKey==`string`?e.conversationKey:void 0,q:typeof e.q==`string`?e.q:void 0,title:typeof e.title==`string`?e.title:void 0,provider:typeof e.provider==`string`?e.provider:void 0,model:typeof e.model==`string`?e.model:void 0,matchIdx:typeof e.matchIdx==`number`?e.matchIdx:void 0})}),jc=Yi({getParentRoute:()=>Ec,path:`/insights`,component:Js}),Mc=Yi({getParentRoute:()=>Ec,path:`/indexing`,component:zs}),Nc=Yi({getParentRoute:()=>Ec,path:`/mcp`,component:Qs}),Pc=Yi({getParentRoute:()=>Ec,path:`/settings`,component:mc}),Fc=Yi({getParentRoute:()=>Ec,path:`/chat`,component:wc,validateSearch:e=>({draft:typeof e.draft==`string`?e.draft:void 0,private:typeof e.private==`string`?e.private:void 0,thread:typeof e.thread==`string`?e.thread:void 0})}),Ic=ma({routeTree:Ec.addChildren([Dc,Oc,kc,Ac,jc,Mc,Nc,Pc,Fc]),defaultNotFoundComponent:Tc}),Lc=new He({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});(0,va.createRoot)(document.getElementById(`root`)).render((0,R.jsx)(L.StrictMode,{children:(0,R.jsx)(ya,{children:(0,R.jsx)(qe,{client:Lc,children:(0,R.jsx)(_a,{router:Ic})})})}));
|