diff --git a/dist/assets/index-CEHqzDAN.js b/dist/assets/index-CEHqzDAN.js new file mode 100644 index 0000000..0f09f11 --- /dev/null +++ b/dist/assets/index-CEHqzDAN.js @@ -0,0 +1,73 @@ +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(l){if(l.ep)return;l.ep=!0;const o=n(l);fetch(l.href,o)}})();function Mp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var yc={exports:{}},ko={},wc={exports:{}},J={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var nl=Symbol.for("react.element"),zp=Symbol.for("react.portal"),Fp=Symbol.for("react.fragment"),Ip=Symbol.for("react.strict_mode"),Op=Symbol.for("react.profiler"),Dp=Symbol.for("react.provider"),Ap=Symbol.for("react.context"),Up=Symbol.for("react.forward_ref"),Bp=Symbol.for("react.suspense"),Hp=Symbol.for("react.memo"),Wp=Symbol.for("react.lazy"),Wa=Symbol.iterator;function Vp(e){return e===null||typeof e!="object"?null:(e=Wa&&e[Wa]||e["@@iterator"],typeof e=="function"?e:null)}var Sc={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},xc=Object.assign,kc={};function ur(e,t,n){this.props=e,this.context=t,this.refs=kc,this.updater=n||Sc}ur.prototype.isReactComponent={};ur.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): 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")};ur.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Ec(){}Ec.prototype=ur.prototype;function Es(e,t,n){this.props=e,this.context=t,this.refs=kc,this.updater=n||Sc}var Cs=Es.prototype=new Ec;Cs.constructor=Es;xc(Cs,ur.prototype);Cs.isPureReactComponent=!0;var Va=Array.isArray,Cc=Object.prototype.hasOwnProperty,Ns={current:null},Nc={key:!0,ref:!0,__self:!0,__source:!0};function _c(e,t,n){var r,l={},o=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(o=""+t.key),t)Cc.call(t,r)&&!Nc.hasOwnProperty(r)&&(l[r]=t[r]);var a=arguments.length-2;if(a===1)l.children=n;else if(1>>1,ge=R[te];if(0>>1;tel(Et,V))Ctl(Xe,Et)?(R[te]=Xe,R[Ct]=V,te=Ct):(R[te]=Et,R[ht]=V,te=ht);else if(Ctl(Xe,V))R[te]=Xe,R[Ct]=V,te=Ct;else break e}}return z}function l(R,z){var V=R.sortIndex-z.sortIndex;return V!==0?V:R.id-z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,a=i.now();e.unstable_now=function(){return i.now()-a}}var s=[],u=[],p=1,v=null,y=3,S=!1,k=!1,C=!1,_=typeof setTimeout=="function"?setTimeout:null,h=typeof clearTimeout=="function"?clearTimeout:null,f=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function d(R){for(var z=n(u);z!==null;){if(z.callback===null)r(u);else if(z.startTime<=R)r(u),z.sortIndex=z.expirationTime,t(s,z);else break;z=n(u)}}function E(R){if(C=!1,d(R),!k)if(n(s)!==null)k=!0,O(P);else{var z=n(u);z!==null&&G(E,z.startTime-R)}}function P(R,z){k=!1,C&&(C=!1,h(F),F=-1),S=!0;var V=y;try{for(d(z),v=n(s);v!==null&&(!(v.expirationTime>z)||R&&!ee());){var te=v.callback;if(typeof te=="function"){v.callback=null,y=v.priorityLevel;var ge=te(v.expirationTime<=z);z=e.unstable_now(),typeof ge=="function"?v.callback=ge:v===n(s)&&r(s),d(z)}else r(s);v=n(s)}if(v!==null)var kt=!0;else{var ht=n(u);ht!==null&&G(E,ht.startTime-z),kt=!1}return kt}finally{v=null,y=V,S=!1}}var T=!1,M=null,F=-1,B=5,D=-1;function ee(){return!(e.unstable_now()-DR||125te?(R.sortIndex=V,t(u,R),n(s)===null&&R===n(u)&&(C?(h(F),F=-1):C=!0,G(E,V-te))):(R.sortIndex=ge,t(s,R),k||S||(k=!0,O(P))),R},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(R){var z=y;return function(){var V=y;y=z;try{return R.apply(this,arguments)}finally{y=V}}}})(Tc);Rc.exports=Tc;var th=Rc.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var nh=g,Ye=th;function L(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Li=Object.prototype.hasOwnProperty,rh=/^[: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]*$/,Qa={},Ka={};function lh(e){return Li.call(Ka,e)?!0:Li.call(Qa,e)?!1:rh.test(e)?Ka[e]=!0:(Qa[e]=!0,!1)}function oh(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function ih(e,t,n,r){if(t===null||typeof t>"u"||oh(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ae(e,t,n,r,l,o,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var Le={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Le[e]=new Ae(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Le[t]=new Ae(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Le[e]=new Ae(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Le[e]=new Ae(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Le[e]=new Ae(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Le[e]=new Ae(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Le[e]=new Ae(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Le[e]=new Ae(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Le[e]=new Ae(e,5,!1,e.toLowerCase(),null,!1,!1)});var Ls=/[\-:]([a-z])/g;function Ps(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Ls,Ps);Le[t]=new Ae(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Ls,Ps);Le[t]=new Ae(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Ls,Ps);Le[t]=new Ae(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Le[e]=new Ae(e,1,!1,e.toLowerCase(),null,!1,!1)});Le.xlinkHref=new Ae("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Le[e]=new Ae(e,1,!1,e.toLowerCase(),null,!0,!0)});function js(e,t,n,r){var l=Le.hasOwnProperty(t)?Le[t]:null;(l!==null?l.type!==0:r||!(2a||l[i]!==o[a]){var s=` +`+l[i].replace(" at new "," at ");return e.displayName&&s.includes("")&&(s=s.replace("",e.displayName)),s}while(1<=i&&0<=a);break}}}finally{ei=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Cr(e):""}function sh(e){switch(e.tag){case 5:return Cr(e.type);case 16:return Cr("Lazy");case 13:return Cr("Suspense");case 19:return Cr("SuspenseList");case 0:case 2:case 15:return e=ti(e.type,!1),e;case 11:return e=ti(e.type.render,!1),e;case 1:return e=ti(e.type,!0),e;default:return""}}function Ti(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case An:return"Fragment";case Dn:return"Portal";case Pi:return"Profiler";case Rs:return"StrictMode";case ji:return"Suspense";case Ri:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case zc:return(e.displayName||"Context")+".Consumer";case Mc:return(e._context.displayName||"Context")+".Provider";case Ts:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case $s:return t=e.displayName||null,t!==null?t:Ti(e.type)||"Memo";case bt:t=e._payload,e=e._init;try{return Ti(e(t))}catch{}}return null}function ah(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ti(t);case 8:return t===Rs?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function on(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ic(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function uh(e){var t=Ic(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(i){r=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function wl(e){e._valueTracker||(e._valueTracker=uh(e))}function Oc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Ic(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Gl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function $i(e,t){var n=t.checked;return fe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ja(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=on(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Dc(e,t){t=t.checked,t!=null&&js(e,"checked",t,!1)}function Mi(e,t){Dc(e,t);var n=on(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?zi(e,t.type,n):t.hasOwnProperty("defaultValue")&&zi(e,t.type,on(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ga(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function zi(e,t,n){(t!=="number"||Gl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Nr=Array.isArray;function Gn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Sl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Dr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Pr={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ch=["Webkit","ms","Moz","O"];Object.keys(Pr).forEach(function(e){ch.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Pr[t]=Pr[e]})});function Hc(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Pr.hasOwnProperty(e)&&Pr[e]?(""+t).trim():t+"px"}function Wc(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Hc(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var fh=fe({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Oi(e,t){if(t){if(fh[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(L(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(L(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(L(61))}if(t.style!=null&&typeof t.style!="object")throw Error(L(62))}}function Di(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";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 Ai=null;function Ms(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ui=null,Xn=null,Zn=null;function qa(e){if(e=ol(e)){if(typeof Ui!="function")throw Error(L(280));var t=e.stateNode;t&&(t=Lo(t),Ui(e.stateNode,e.type,t))}}function Vc(e){Xn?Zn?Zn.push(e):Zn=[e]:Xn=e}function bc(){if(Xn){var e=Xn,t=Zn;if(Zn=Xn=null,qa(e),t)for(e=0;e>>=0,e===0?32:31-(kh(e)/Eh|0)|0}var xl=64,kl=4194304;function _r(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function eo(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,i=n&268435455;if(i!==0){var a=i&~l;a!==0?r=_r(a):(o&=i,o!==0&&(r=_r(o)))}else i=n&~l,i!==0?r=_r(i):o!==0&&(r=_r(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,o=t&-t,l>=o||l===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function rl(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ct(t),e[t]=n}function Lh(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Rr),au=" ",uu=!1;function df(e,t){switch(e){case"keyup":return tm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function pf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Un=!1;function rm(e,t){switch(e){case"compositionend":return pf(t);case"keypress":return t.which!==32?null:(uu=!0,au);case"textInput":return e=t.data,e===au&&uu?null:e;default:return null}}function lm(e,t){if(Un)return e==="compositionend"||!Bs&&df(e,t)?(e=cf(),Dl=Ds=Jt=null,Un=!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)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=pu(n)}}function vf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?vf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function yf(){for(var e=window,t=Gl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Gl(e.document)}return t}function Hs(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")}function pm(e){var t=yf(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&vf(n.ownerDocument.documentElement,n)){if(r!==null&&Hs(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,o=Math.min(r.start,l);r=r.end===void 0?o:Math.min(r.end,l),!e.extend&&o>r&&(l=r,r=o,o=l),l=hu(n,o);var i=hu(n,r);l&&i&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Bn=null,Qi=null,$r=null,Ki=!1;function mu(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ki||Bn==null||Bn!==Gl(r)||(r=Bn,"selectionStart"in r&&Hs(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}),$r&&Vr($r,r)||($r=r,r=ro(Qi,"onSelect"),0Vn||(e.current=qi[Vn],qi[Vn]=null,Vn--)}function ne(e,t){Vn++,qi[Vn]=e.current,e.current=t}var sn={},Me=un(sn),He=un(!1),kn=sn;function rr(e,t){var n=e.type.contextTypes;if(!n)return sn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in n)l[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function We(e){return e=e.childContextTypes,e!=null}function oo(){oe(He),oe(Me)}function ku(e,t,n){if(Me.current!==sn)throw Error(L(168));ne(Me,t),ne(He,n)}function Lf(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(L(108,ah(e)||"Unknown",l));return fe({},n,r)}function io(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||sn,kn=Me.current,ne(Me,e),ne(He,He.current),!0}function Eu(e,t,n){var r=e.stateNode;if(!r)throw Error(L(169));n?(e=Lf(e,t,kn),r.__reactInternalMemoizedMergedChildContext=e,oe(He),oe(Me),ne(Me,e)):oe(He),ne(He,n)}var Pt=null,Po=!1,mi=!1;function Pf(e){Pt===null?Pt=[e]:Pt.push(e)}function Nm(e){Po=!0,Pf(e)}function cn(){if(!mi&&Pt!==null){mi=!0;var e=0,t=q;try{var n=Pt;for(q=1;e>=i,l-=i,jt=1<<32-ct(t)+l|n<F?(B=M,M=null):B=M.sibling;var D=y(h,M,d[F],E);if(D===null){M===null&&(M=B);break}e&&M&&D.alternate===null&&t(h,M),f=o(D,f,F),T===null?P=D:T.sibling=D,T=D,M=B}if(F===d.length)return n(h,M),ie&&mn(h,F),P;if(M===null){for(;FF?(B=M,M=null):B=M.sibling;var ee=y(h,M,D.value,E);if(ee===null){M===null&&(M=B);break}e&&M&&ee.alternate===null&&t(h,M),f=o(ee,f,F),T===null?P=ee:T.sibling=ee,T=ee,M=B}if(D.done)return n(h,M),ie&&mn(h,F),P;if(M===null){for(;!D.done;F++,D=d.next())D=v(h,D.value,E),D!==null&&(f=o(D,f,F),T===null?P=D:T.sibling=D,T=D);return ie&&mn(h,F),P}for(M=r(h,M);!D.done;F++,D=d.next())D=S(M,h,F,D.value,E),D!==null&&(e&&D.alternate!==null&&M.delete(D.key===null?F:D.key),f=o(D,f,F),T===null?P=D:T.sibling=D,T=D);return e&&M.forEach(function(H){return t(h,H)}),ie&&mn(h,F),P}function _(h,f,d,E){if(typeof d=="object"&&d!==null&&d.type===An&&d.key===null&&(d=d.props.children),typeof d=="object"&&d!==null){switch(d.$$typeof){case yl:e:{for(var P=d.key,T=f;T!==null;){if(T.key===P){if(P=d.type,P===An){if(T.tag===7){n(h,T.sibling),f=l(T,d.props.children),f.return=h,h=f;break e}}else if(T.elementType===P||typeof P=="object"&&P!==null&&P.$$typeof===bt&&_u(P)===T.type){n(h,T.sibling),f=l(T,d.props),f.ref=Sr(h,T,d),f.return=h,h=f;break e}n(h,T);break}else t(h,T);T=T.sibling}d.type===An?(f=xn(d.props.children,h.mode,E,d.key),f.return=h,h=f):(E=Ql(d.type,d.key,d.props,null,h.mode,E),E.ref=Sr(h,f,d),E.return=h,h=E)}return i(h);case Dn:e:{for(T=d.key;f!==null;){if(f.key===T)if(f.tag===4&&f.stateNode.containerInfo===d.containerInfo&&f.stateNode.implementation===d.implementation){n(h,f.sibling),f=l(f,d.children||[]),f.return=h,h=f;break e}else{n(h,f);break}else t(h,f);f=f.sibling}f=Ei(d,h.mode,E),f.return=h,h=f}return i(h);case bt:return T=d._init,_(h,f,T(d._payload),E)}if(Nr(d))return k(h,f,d,E);if(mr(d))return C(h,f,d,E);jl(h,d)}return typeof d=="string"&&d!==""||typeof d=="number"?(d=""+d,f!==null&&f.tag===6?(n(h,f.sibling),f=l(f,d),f.return=h,h=f):(n(h,f),f=ki(d,h.mode,E),f.return=h,h=f),i(h)):n(h,f)}return _}var or=$f(!0),Mf=$f(!1),uo=un(null),co=null,Kn=null,Qs=null;function Ks(){Qs=Kn=co=null}function Ys(e){var t=uo.current;oe(uo),e._currentValue=t}function ns(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function er(e,t){co=e,Qs=Kn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Be=!0),e.firstContext=null)}function rt(e){var t=e._currentValue;if(Qs!==e)if(e={context:e,memoizedValue:t,next:null},Kn===null){if(co===null)throw Error(L(308));Kn=e,co.dependencies={lanes:0,firstContext:e}}else Kn=Kn.next=e;return t}var yn=null;function Js(e){yn===null?yn=[e]:yn.push(e)}function zf(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Js(t)):(n.next=l.next,l.next=n),t.interleaved=n,Ft(e,r)}function Ft(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Qt=!1;function Gs(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ff(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Tt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function tn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,X&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,Ft(e,n)}return l=r.interleaved,l===null?(t.next=t,Js(r)):(t.next=l.next,l.next=t),r.interleaved=t,Ft(e,n)}function Ul(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Fs(e,n)}}function Lu(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?l=o=i:o=o.next=i,n=n.next}while(n!==null);o===null?l=o=t:o=o.next=t}else l=o=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function fo(e,t,n,r){var l=e.updateQueue;Qt=!1;var o=l.firstBaseUpdate,i=l.lastBaseUpdate,a=l.shared.pending;if(a!==null){l.shared.pending=null;var s=a,u=s.next;s.next=null,i===null?o=u:i.next=u,i=s;var p=e.alternate;p!==null&&(p=p.updateQueue,a=p.lastBaseUpdate,a!==i&&(a===null?p.firstBaseUpdate=u:a.next=u,p.lastBaseUpdate=s))}if(o!==null){var v=l.baseState;i=0,p=u=s=null,a=o;do{var y=a.lane,S=a.eventTime;if((r&y)===y){p!==null&&(p=p.next={eventTime:S,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var k=e,C=a;switch(y=t,S=n,C.tag){case 1:if(k=C.payload,typeof k=="function"){v=k.call(S,v,y);break e}v=k;break e;case 3:k.flags=k.flags&-65537|128;case 0:if(k=C.payload,y=typeof k=="function"?k.call(S,v,y):k,y==null)break e;v=fe({},v,y);break e;case 2:Qt=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,y=l.effects,y===null?l.effects=[a]:y.push(a))}else S={eventTime:S,lane:y,tag:a.tag,payload:a.payload,callback:a.callback,next:null},p===null?(u=p=S,s=v):p=p.next=S,i|=y;if(a=a.next,a===null){if(a=l.shared.pending,a===null)break;y=a,a=y.next,y.next=null,l.lastBaseUpdate=y,l.shared.pending=null}}while(!0);if(p===null&&(s=v),l.baseState=s,l.firstBaseUpdate=u,l.lastBaseUpdate=p,t=l.shared.interleaved,t!==null){l=t;do i|=l.lane,l=l.next;while(l!==t)}else o===null&&(l.shared.lanes=0);Nn|=i,e.lanes=i,e.memoizedState=v}}function Pu(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=vi.transition;vi.transition={};try{e(!1),t()}finally{q=n,vi.transition=r}}function Zf(){return lt().memoizedState}function jm(e,t,n){var r=rn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},qf(e))ed(t,n);else if(n=zf(e,t,n,r),n!==null){var l=Oe();ft(n,e,r,l),td(n,t,r)}}function Rm(e,t,n){var r=rn(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(qf(e))ed(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,a=o(i,n);if(l.hasEagerState=!0,l.eagerState=a,dt(a,i)){var s=t.interleaved;s===null?(l.next=l,Js(t)):(l.next=s.next,s.next=l),t.interleaved=l;return}}catch{}finally{}n=zf(e,t,l,r),n!==null&&(l=Oe(),ft(n,e,r,l),td(n,t,r))}}function qf(e){var t=e.alternate;return e===ue||t!==null&&t===ue}function ed(e,t){Mr=ho=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function td(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Fs(e,n)}}var mo={readContext:rt,useCallback:Re,useContext:Re,useEffect:Re,useImperativeHandle:Re,useInsertionEffect:Re,useLayoutEffect:Re,useMemo:Re,useReducer:Re,useRef:Re,useState:Re,useDebugValue:Re,useDeferredValue:Re,useTransition:Re,useMutableSource:Re,useSyncExternalStore:Re,useId:Re,unstable_isNewReconciler:!1},Tm={readContext:rt,useCallback:function(e,t){return vt().memoizedState=[e,t===void 0?null:t],e},useContext:rt,useEffect:Ru,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Hl(4194308,4,Kf.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Hl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Hl(4,2,e,t)},useMemo:function(e,t){var n=vt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=vt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=jm.bind(null,ue,e),[r.memoizedState,e]},useRef:function(e){var t=vt();return e={current:e},t.memoizedState=e},useState:ju,useDebugValue:la,useDeferredValue:function(e){return vt().memoizedState=e},useTransition:function(){var e=ju(!1),t=e[0];return e=Pm.bind(null,e[1]),vt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ue,l=vt();if(ie){if(n===void 0)throw Error(L(407));n=n()}else{if(n=t(),Ee===null)throw Error(L(349));Cn&30||Af(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,Ru(Bf.bind(null,r,o,e),[e]),r.flags|=2048,Zr(9,Uf.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=vt(),t=Ee.identifierPrefix;if(ie){var n=Rt,r=jt;n=(r&~(1<<32-ct(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Gr++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[yt]=t,e[Kr]=r,fd(e,t,!1,!1),t.stateNode=e;e:{switch(i=Di(n,r),n){case"dialog":le("cancel",e),le("close",e),l=r;break;case"iframe":case"object":case"embed":le("load",e),l=r;break;case"video":case"audio":for(l=0;lar&&(t.flags|=128,r=!0,xr(o,!1),t.lanes=4194304)}else{if(!r)if(e=po(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),xr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!ie)return Te(t),null}else 2*me()-o.renderingStartTime>ar&&n!==1073741824&&(t.flags|=128,r=!0,xr(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(n=o.last,n!==null?n.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=me(),t.sibling=null,n=ae.current,ne(ae,r?n&1|2:n&1),t):(Te(t),null);case 22:case 23:return ca(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?be&1073741824&&(Te(t),t.subtreeFlags&6&&(t.flags|=8192)):Te(t),null;case 24:return null;case 25:return null}throw Error(L(156,t.tag))}function Am(e,t){switch(Vs(t),t.tag){case 1:return We(t.type)&&oo(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ir(),oe(He),oe(Me),qs(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Zs(t),null;case 13:if(oe(ae),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(L(340));lr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return oe(ae),null;case 4:return ir(),null;case 10:return Ys(t.type._context),null;case 22:case 23:return ca(),null;case 24:return null;default:return null}}var Tl=!1,$e=!1,Um=typeof WeakSet=="function"?WeakSet:Set,I=null;function Yn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){de(e,t,r)}else n.current=null}function fs(e,t,n){try{n()}catch(r){de(e,t,r)}}var Bu=!1;function Bm(e,t){if(Yi=to,e=yf(),Hs(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,a=-1,s=-1,u=0,p=0,v=e,y=null;t:for(;;){for(var S;v!==n||l!==0&&v.nodeType!==3||(a=i+l),v!==o||r!==0&&v.nodeType!==3||(s=i+r),v.nodeType===3&&(i+=v.nodeValue.length),(S=v.firstChild)!==null;)y=v,v=S;for(;;){if(v===e)break t;if(y===n&&++u===l&&(a=i),y===o&&++p===r&&(s=i),(S=v.nextSibling)!==null)break;v=y,y=v.parentNode}v=S}n=a===-1||s===-1?null:{start:a,end:s}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ji={focusedElem:e,selectionRange:n},to=!1,I=t;I!==null;)if(t=I,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,I=e;else for(;I!==null;){t=I;try{var k=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(k!==null){var C=k.memoizedProps,_=k.memoizedState,h=t.stateNode,f=h.getSnapshotBeforeUpdate(t.elementType===t.type?C:st(t.type,C),_);h.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var d=t.stateNode.containerInfo;d.nodeType===1?d.textContent="":d.nodeType===9&&d.documentElement&&d.removeChild(d.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(L(163))}}catch(E){de(t,t.return,E)}if(e=t.sibling,e!==null){e.return=t.return,I=e;break}I=t.return}return k=Bu,Bu=!1,k}function zr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&fs(t,n,o)}l=l.next}while(l!==r)}}function To(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function ds(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function hd(e){var t=e.alternate;t!==null&&(e.alternate=null,hd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[yt],delete t[Kr],delete t[Zi],delete t[Em],delete t[Cm])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function md(e){return e.tag===5||e.tag===3||e.tag===4}function Hu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||md(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.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ps(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=lo));else if(r!==4&&(e=e.child,e!==null))for(ps(e,t,n),e=e.sibling;e!==null;)ps(e,t,n),e=e.sibling}function hs(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&&(e=e.child,e!==null))for(hs(e,t,n),e=e.sibling;e!==null;)hs(e,t,n),e=e.sibling}var Ne=null,at=!1;function Vt(e,t,n){for(n=n.child;n!==null;)gd(e,t,n),n=n.sibling}function gd(e,t,n){if(wt&&typeof wt.onCommitFiberUnmount=="function")try{wt.onCommitFiberUnmount(Eo,n)}catch{}switch(n.tag){case 5:$e||Yn(n,t);case 6:var r=Ne,l=at;Ne=null,Vt(e,t,n),Ne=r,at=l,Ne!==null&&(at?(e=Ne,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ne.removeChild(n.stateNode));break;case 18:Ne!==null&&(at?(e=Ne,n=n.stateNode,e.nodeType===8?hi(e.parentNode,n):e.nodeType===1&&hi(e,n),Hr(e)):hi(Ne,n.stateNode));break;case 4:r=Ne,l=at,Ne=n.stateNode.containerInfo,at=!0,Vt(e,t,n),Ne=r,at=l;break;case 0:case 11:case 14:case 15:if(!$e&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var o=l,i=o.destroy;o=o.tag,i!==void 0&&(o&2||o&4)&&fs(n,t,i),l=l.next}while(l!==r)}Vt(e,t,n);break;case 1:if(!$e&&(Yn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){de(n,t,a)}Vt(e,t,n);break;case 21:Vt(e,t,n);break;case 22:n.mode&1?($e=(r=$e)||n.memoizedState!==null,Vt(e,t,n),$e=r):Vt(e,t,n);break;default:Vt(e,t,n)}}function Wu(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Um),t.forEach(function(r){var l=Gm.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function it(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=i),r&=~o}if(r=l,r=me()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Wm(r/1960))-r,10e?16:e,Gt===null)var r=!1;else{if(e=Gt,Gt=null,yo=0,X&6)throw Error(L(331));var l=X;for(X|=4,I=e.current;I!==null;){var o=I,i=o.child;if(I.flags&16){var a=o.deletions;if(a!==null){for(var s=0;sme()-aa?Sn(e,0):sa|=n),Ve(e,t)}function Cd(e,t){t===0&&(e.mode&1?(t=kl,kl<<=1,!(kl&130023424)&&(kl=4194304)):t=1);var n=Oe();e=Ft(e,t),e!==null&&(rl(e,t,n),Ve(e,n))}function Jm(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Cd(e,n)}function Gm(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(L(314))}r!==null&&r.delete(t),Cd(e,n)}var Nd;Nd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||He.current)Be=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Be=!1,Om(e,t,n);Be=!!(e.flags&131072)}else Be=!1,ie&&t.flags&1048576&&jf(t,ao,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Wl(e,t),e=t.pendingProps;var l=rr(t,Me.current);er(t,n),l=ta(null,t,r,e,l,n);var o=na();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,We(r)?(o=!0,io(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Gs(t),l.updater=Ro,t.stateNode=l,l._reactInternals=t,ls(t,r,e,n),t=ss(null,t,r,!0,o,n)):(t.tag=0,ie&&o&&Ws(t),Ie(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Wl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Zm(r),e=st(r,e),l){case 0:t=is(null,t,r,e,n);break e;case 1:t=Du(null,t,r,e,n);break e;case 11:t=Iu(null,t,r,e,n);break e;case 14:t=Ou(null,t,r,st(r.type,e),n);break e}throw Error(L(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:st(r,l),is(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:st(r,l),Du(e,t,r,l,n);case 3:e:{if(ad(t),e===null)throw Error(L(387));r=t.pendingProps,o=t.memoizedState,l=o.element,Ff(e,t),fo(t,r,null,n);var i=t.memoizedState;if(r=i.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){l=sr(Error(L(423)),t),t=Au(e,t,r,n,l);break e}else if(r!==l){l=sr(Error(L(424)),t),t=Au(e,t,r,n,l);break e}else for(Qe=en(t.stateNode.containerInfo.firstChild),Ke=t,ie=!0,ut=null,n=Mf(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(lr(),r===l){t=It(e,t,n);break e}Ie(e,t,r,n)}t=t.child}return t;case 5:return If(t),e===null&&ts(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,i=l.children,Gi(r,l)?i=null:o!==null&&Gi(r,o)&&(t.flags|=32),sd(e,t),Ie(e,t,i,n),t.child;case 6:return e===null&&ts(t),null;case 13:return ud(e,t,n);case 4:return Xs(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=or(t,null,r,n):Ie(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:st(r,l),Iu(e,t,r,l,n);case 7:return Ie(e,t,t.pendingProps,n),t.child;case 8:return Ie(e,t,t.pendingProps.children,n),t.child;case 12:return Ie(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,o=t.memoizedProps,i=l.value,ne(uo,r._currentValue),r._currentValue=i,o!==null)if(dt(o.value,i)){if(o.children===l.children&&!He.current){t=It(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var a=o.dependencies;if(a!==null){i=o.child;for(var s=a.firstContext;s!==null;){if(s.context===r){if(o.tag===1){s=Tt(-1,n&-n),s.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var p=u.pending;p===null?s.next=s:(s.next=p.next,p.next=s),u.pending=s}}o.lanes|=n,s=o.alternate,s!==null&&(s.lanes|=n),ns(o.return,n,t),a.lanes|=n;break}s=s.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(L(341));i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),ns(i,n,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}Ie(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,er(t,n),l=rt(l),r=r(l),t.flags|=1,Ie(e,t,r,n),t.child;case 14:return r=t.type,l=st(r,t.pendingProps),l=st(r.type,l),Ou(e,t,r,l,n);case 15:return od(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:st(r,l),Wl(e,t),t.tag=1,We(r)?(e=!0,io(t)):e=!1,er(t,n),nd(t,r,l),ls(t,r,l,n),ss(null,t,r,!0,e,n);case 19:return cd(e,t,n);case 22:return id(e,t,n)}throw Error(L(156,t.tag))};function _d(e,t){return Zc(e,t)}function Xm(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.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 tt(e,t,n,r){return new Xm(e,t,n,r)}function da(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Zm(e){if(typeof e=="function")return da(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ts)return 11;if(e===$s)return 14}return 2}function ln(e,t){var n=e.alternate;return n===null?(n=tt(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&14680064,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}function Ql(e,t,n,r,l,o){var i=2;if(r=e,typeof e=="function")da(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case An:return xn(n.children,l,o,t);case Rs:i=8,l|=8;break;case Pi:return e=tt(12,n,t,l|2),e.elementType=Pi,e.lanes=o,e;case ji:return e=tt(13,n,t,l),e.elementType=ji,e.lanes=o,e;case Ri:return e=tt(19,n,t,l),e.elementType=Ri,e.lanes=o,e;case Fc:return Mo(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Mc:i=10;break e;case zc:i=9;break e;case Ts:i=11;break e;case $s:i=14;break e;case bt:i=16,r=null;break e}throw Error(L(130,e==null?e:typeof e,""))}return t=tt(i,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function xn(e,t,n,r){return e=tt(7,e,r,t),e.lanes=n,e}function Mo(e,t,n,r){return e=tt(22,e,r,t),e.elementType=Fc,e.lanes=n,e.stateNode={isHidden:!1},e}function ki(e,t,n){return e=tt(6,e,null,t),e.lanes=n,e}function Ei(e,t,n){return t=tt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function qm(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ri(0),this.expirationTimes=ri(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ri(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function pa(e,t,n,r,l,o,i,a,s){return e=new qm(e,t,n,a,s),t===1?(t=1,o===!0&&(t|=8)):t=0,o=tt(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Gs(o),e}function eg(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Rd)}catch(e){console.error(e)}}Rd(),jc.exports=Je;var Td=jc.exports,$d,Xu=Td;$d=Xu.createRoot,Xu.hydrateRoot;/** + * react-router v7.8.2 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */var Zu="popstate";function og(e={}){function t(l,o){let{pathname:i="/",search:a="",hash:s=""}=jn(l.location.hash.substring(1));return!i.startsWith("/")&&!i.startsWith(".")&&(i="/"+i),ws("",{pathname:i,search:a,hash:s},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function n(l,o){let i=l.document.querySelector("base"),a="";if(i&&i.getAttribute("href")){let s=l.location.href,u=s.indexOf("#");a=u===-1?s:s.slice(0,u)}return a+"#"+(typeof o=="string"?o:el(o))}function r(l,o){pt(l.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(o)})`)}return sg(t,n,r,e)}function ce(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function pt(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function ig(){return Math.random().toString(36).substring(2,10)}function qu(e,t){return{usr:e.state,key:e.key,idx:t}}function ws(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?jn(t):t,state:n,key:t&&t.key||r||ig()}}function el({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function jn(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function sg(e,t,n,r={}){let{window:l=document.defaultView,v5Compat:o=!1}=r,i=l.history,a="POP",s=null,u=p();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function p(){return(i.state||{idx:null}).idx}function v(){a="POP";let _=p(),h=_==null?null:_-u;u=_,s&&s({action:a,location:C.location,delta:h})}function y(_,h){a="PUSH";let f=ws(C.location,_,h);n&&n(f,_),u=p()+1;let d=qu(f,u),E=C.createHref(f);try{i.pushState(d,"",E)}catch(P){if(P instanceof DOMException&&P.name==="DataCloneError")throw P;l.location.assign(E)}o&&s&&s({action:a,location:C.location,delta:1})}function S(_,h){a="REPLACE";let f=ws(C.location,_,h);n&&n(f,_),u=p();let d=qu(f,u),E=C.createHref(f);i.replaceState(d,"",E),o&&s&&s({action:a,location:C.location,delta:0})}function k(_){return ag(_)}let C={get action(){return a},get location(){return e(l,i)},listen(_){if(s)throw new Error("A history only accepts one active listener");return l.addEventListener(Zu,v),s=_,()=>{l.removeEventListener(Zu,v),s=null}},createHref(_){return t(l,_)},createURL:k,encodeLocation(_){let h=k(_);return{pathname:h.pathname,search:h.search,hash:h.hash}},push:y,replace:S,go(_){return i.go(_)}};return C}function ag(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),ce(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:el(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function Md(e,t,n="/"){return ug(e,t,n,!1)}function ug(e,t,n,r){let l=typeof t=="string"?jn(t):t,o=Ot(l.pathname||"/",n);if(o==null)return null;let i=zd(e);cg(i);let a=null;for(let s=0;a==null&&s{let p={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:a,route:i};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(r)&&s)return;ce(p.relativePath.startsWith(r),`Absolute route path "${p.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(r.length)}let v=$t([r,p.relativePath]),y=n.concat(p);i.children&&i.children.length>0&&(ce(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),zd(i.children,t,y,v,s)),!(i.path==null&&!i.index)&&t.push({path:v,score:vg(v,i.index),routesMeta:y})};return e.forEach((i,a)=>{var s;if(i.path===""||!((s=i.path)!=null&&s.includes("?")))o(i,a);else for(let u of Fd(i.path))o(i,a,!0,u)}),t}function Fd(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,l=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return l?[o,""]:[o];let i=Fd(r.join("/")),a=[];return a.push(...i.map(s=>s===""?o:[o,s].join("/"))),l&&a.push(...i),a.map(s=>e.startsWith("/")&&s===""?"/":s)}function cg(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:yg(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var fg=/^:[\w-]+$/,dg=3,pg=2,hg=1,mg=10,gg=-2,ec=e=>e==="*";function vg(e,t){let n=e.split("/"),r=n.length;return n.some(ec)&&(r+=gg),t&&(r+=pg),n.filter(l=>!ec(l)).reduce((l,o)=>l+(fg.test(o)?dg:o===""?hg:mg),r)}function yg(e,t){return e.length===t.length&&e.slice(0,-1).every((r,l)=>r===t[l])?e[e.length-1]-t[t.length-1]:0}function wg(e,t,n=!1){let{routesMeta:r}=e,l={},o="/",i=[];for(let a=0;a{if(p==="*"){let k=a[y]||"";i=o.slice(0,o.length-k.length).replace(/(.)\/+$/,"$1")}const S=a[y];return v&&!S?u[p]=void 0:u[p]=(S||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function Sg(e,t=!1,n=!0){pt(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,a,s)=>(r.push({paramName:a,isOptional:s!=null}),s?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,t?void 0:"i"),r]}function xg(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return pt(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Ot(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function kg(e,t="/"){let{pathname:n,search:r="",hash:l=""}=typeof e=="string"?jn(e):e;return{pathname:n?n.startsWith("/")?n:Eg(n,t):t,search:_g(r),hash:Lg(l)}}function Eg(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(l=>{l===".."?n.length>1&&n.pop():l!=="."&&n.push(l)}),n.length>1?n.join("/"):"/"}function Ci(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function Cg(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Id(e){let t=Cg(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Od(e,t,n,r=!1){let l;typeof e=="string"?l=jn(e):(l={...e},ce(!l.pathname||!l.pathname.includes("?"),Ci("?","pathname","search",l)),ce(!l.pathname||!l.pathname.includes("#"),Ci("#","pathname","hash",l)),ce(!l.search||!l.search.includes("#"),Ci("#","search","hash",l)));let o=e===""||l.pathname==="",i=o?"/":l.pathname,a;if(i==null)a=n;else{let v=t.length-1;if(!r&&i.startsWith("..")){let y=i.split("/");for(;y[0]==="..";)y.shift(),v-=1;l.pathname=y.join("/")}a=v>=0?t[v]:"/"}let s=kg(l,a),u=i&&i!=="/"&&i.endsWith("/"),p=(o||i===".")&&n.endsWith("/");return!s.pathname.endsWith("/")&&(u||p)&&(s.pathname+="/"),s}var $t=e=>e.join("/").replace(/\/\/+/g,"/"),Ng=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),_g=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Lg=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Pg(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}var Dd=["POST","PUT","PATCH","DELETE"];new Set(Dd);var jg=["GET",...Dd];new Set(jg);var dr=g.createContext(null);dr.displayName="DataRouter";var Do=g.createContext(null);Do.displayName="DataRouterState";g.createContext(!1);var Ad=g.createContext({isTransitioning:!1});Ad.displayName="ViewTransition";var Rg=g.createContext(new Map);Rg.displayName="Fetchers";var Tg=g.createContext(null);Tg.displayName="Await";var xt=g.createContext(null);xt.displayName="Navigation";var sl=g.createContext(null);sl.displayName="Location";var At=g.createContext({outlet:null,matches:[],isDataRoute:!1});At.displayName="Route";var va=g.createContext(null);va.displayName="RouteError";function $g(e,{relative:t}={}){ce(al(),"useHref() may be used only in the context of a component.");let{basename:n,navigator:r}=g.useContext(xt),{hash:l,pathname:o,search:i}=ul(e,{relative:t}),a=o;return n!=="/"&&(a=o==="/"?n:$t([n,o])),r.createHref({pathname:a,search:i,hash:l})}function al(){return g.useContext(sl)!=null}function Rn(){return ce(al(),"useLocation() may be used only in the context of a component."),g.useContext(sl).location}var Ud="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Bd(e){g.useContext(xt).static||g.useLayoutEffect(e)}function Mg(){let{isDataRoute:e}=g.useContext(At);return e?Qg():zg()}function zg(){ce(al(),"useNavigate() may be used only in the context of a component.");let e=g.useContext(dr),{basename:t,navigator:n}=g.useContext(xt),{matches:r}=g.useContext(At),{pathname:l}=Rn(),o=JSON.stringify(Id(r)),i=g.useRef(!1);return Bd(()=>{i.current=!0}),g.useCallback((s,u={})=>{if(pt(i.current,Ud),!i.current)return;if(typeof s=="number"){n.go(s);return}let p=Od(s,JSON.parse(o),l,u.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:$t([t,p.pathname])),(u.replace?n.replace:n.push)(p,u.state,u)},[t,n,o,l,e])}g.createContext(null);function ul(e,{relative:t}={}){let{matches:n}=g.useContext(At),{pathname:r}=Rn(),l=JSON.stringify(Id(n));return g.useMemo(()=>Od(e,JSON.parse(l),r,t==="path"),[e,l,r,t])}function Fg(e,t){return Hd(e,t)}function Hd(e,t,n,r,l){var f;ce(al(),"useRoutes() may be used only in the context of a component.");let{navigator:o}=g.useContext(xt),{matches:i}=g.useContext(At),a=i[i.length-1],s=a?a.params:{},u=a?a.pathname:"/",p=a?a.pathnameBase:"/",v=a&&a.route;{let d=v&&v.path||"";Wd(u,!v||d.endsWith("*")||d.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${u}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. + +Please change the parent to .`)}let y=Rn(),S;if(t){let d=typeof t=="string"?jn(t):t;ce(p==="/"||((f=d.pathname)==null?void 0:f.startsWith(p)),`When overriding the location using \`\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${p}" but pathname "${d.pathname}" was given in the \`location\` prop.`),S=d}else S=y;let k=S.pathname||"/",C=k;if(p!=="/"){let d=p.replace(/^\//,"").split("/");C="/"+k.replace(/^\//,"").split("/").slice(d.length).join("/")}let _=Md(e,{pathname:C});pt(v||_!=null,`No routes matched location "${S.pathname}${S.search}${S.hash}" `),pt(_==null||_[_.length-1].route.element!==void 0||_[_.length-1].route.Component!==void 0||_[_.length-1].route.lazy!==void 0,`Matched leaf route at location "${S.pathname}${S.search}${S.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`);let h=Ug(_&&_.map(d=>Object.assign({},d,{params:Object.assign({},s,d.params),pathname:$t([p,o.encodeLocation?o.encodeLocation(d.pathname).pathname:d.pathname]),pathnameBase:d.pathnameBase==="/"?p:$t([p,o.encodeLocation?o.encodeLocation(d.pathnameBase).pathname:d.pathnameBase])})),i,n,r,l);return t&&h?g.createElement(sl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...S},navigationType:"POP"}},h):h}function Ig(){let e=bg(),t=Pg(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",l={padding:"0.5rem",backgroundColor:r},o={padding:"2px 4px",backgroundColor:r},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=g.createElement(g.Fragment,null,g.createElement("p",null,"💿 Hey developer 👋"),g.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",g.createElement("code",{style:o},"ErrorBoundary")," or"," ",g.createElement("code",{style:o},"errorElement")," prop on your route.")),g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},t),n?g.createElement("pre",{style:l},n):null,i)}var Og=g.createElement(Ig,null),Dg=class extends g.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.unstable_onError?this.props.unstable_onError(e,t):console.error("React Router caught the following error during render",e)}render(){return this.state.error!==void 0?g.createElement(At.Provider,{value:this.props.routeContext},g.createElement(va.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function Ag({routeContext:e,match:t,children:n}){let r=g.useContext(dr);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),g.createElement(At.Provider,{value:e},n)}function Ug(e,t=[],n=null,r=null,l=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,i=n==null?void 0:n.errors;if(i!=null){let u=o.findIndex(p=>p.route.id&&(i==null?void 0:i[p.route.id])!==void 0);ce(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),o=o.slice(0,Math.min(o.length,u+1))}let a=!1,s=-1;if(n)for(let u=0;u=0?o=o.slice(0,s+1):o=[o[0]];break}}}return o.reduceRight((u,p,v)=>{let y,S=!1,k=null,C=null;n&&(y=i&&p.route.id?i[p.route.id]:void 0,k=p.route.errorElement||Og,a&&(s<0&&v===0?(Wd("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,C=null):s===v&&(S=!0,C=p.route.hydrateFallbackElement||null)));let _=t.concat(o.slice(0,v+1)),h=()=>{let f;return y?f=k:S?f=C:p.route.Component?f=g.createElement(p.route.Component,null):p.route.element?f=p.route.element:f=u,g.createElement(Ag,{match:p,routeContext:{outlet:u,matches:_,isDataRoute:n!=null},children:f})};return n&&(p.route.ErrorBoundary||p.route.errorElement||v===0)?g.createElement(Dg,{location:n.location,revalidation:n.revalidation,component:k,error:y,children:h(),routeContext:{outlet:null,matches:_,isDataRoute:!0},unstable_onError:r}):h()},null)}function ya(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Bg(e){let t=g.useContext(dr);return ce(t,ya(e)),t}function Hg(e){let t=g.useContext(Do);return ce(t,ya(e)),t}function Wg(e){let t=g.useContext(At);return ce(t,ya(e)),t}function wa(e){let t=Wg(e),n=t.matches[t.matches.length-1];return ce(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Vg(){return wa("useRouteId")}function bg(){var r;let e=g.useContext(va),t=Hg("useRouteError"),n=wa("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function Qg(){let{router:e}=Bg("useNavigate"),t=wa("useNavigate"),n=g.useRef(!1);return Bd(()=>{n.current=!0}),g.useCallback(async(l,o={})=>{pt(n.current,Ud),n.current&&(typeof l=="number"?e.navigate(l):await e.navigate(l,{fromRouteId:t,...o}))},[e,t])}var tc={};function Wd(e,t,n){!t&&!tc[e]&&(tc[e]=!0,pt(!1,n))}g.memo(Kg);function Kg({routes:e,future:t,state:n,unstable_onError:r}){return Hd(e,void 0,n,r,t)}function Vd(e){ce(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function Yg({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:l,static:o=!1}){ce(!al(),"You cannot render a inside another . You should never have more than one in your app.");let i=e.replace(/^\/*/,"/"),a=g.useMemo(()=>({basename:i,navigator:l,static:o,future:{}}),[i,l,o]);typeof n=="string"&&(n=jn(n));let{pathname:s="/",search:u="",hash:p="",state:v=null,key:y="default"}=n,S=g.useMemo(()=>{let k=Ot(s,i);return k==null?null:{location:{pathname:k,search:u,hash:p,state:v,key:y},navigationType:r}},[i,s,u,p,v,y,r]);return pt(S!=null,` is not able to match the URL "${s}${u}${p}" because it does not start with the basename, so the won't render anything.`),S==null?null:g.createElement(xt.Provider,{value:a},g.createElement(sl.Provider,{children:t,value:S}))}function Jg({children:e,location:t}){return Fg(Ss(e),t)}function Ss(e,t=[]){let n=[];return g.Children.forEach(e,(r,l)=>{if(!g.isValidElement(r))return;let o=[...t,l];if(r.type===g.Fragment){n.push.apply(n,Ss(r.props.children,o));return}ce(r.type===Vd,`[${typeof r.type=="string"?r.type:r.type.name}] is not a component. All component children of must be a or `),ce(!r.props.index||!r.props.children,"An index route cannot have child routes.");let i={id:r.props.id||o.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(i.children=Ss(r.props.children,o)),n.push(i)}),n}var Kl="get",Yl="application/x-www-form-urlencoded";function Ao(e){return e!=null&&typeof e.tagName=="string"}function Gg(e){return Ao(e)&&e.tagName.toLowerCase()==="button"}function Xg(e){return Ao(e)&&e.tagName.toLowerCase()==="form"}function Zg(e){return Ao(e)&&e.tagName.toLowerCase()==="input"}function qg(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function ev(e,t){return e.button===0&&(!t||t==="_self")&&!qg(e)}var zl=null;function tv(){if(zl===null)try{new FormData(document.createElement("form"),0),zl=!1}catch{zl=!0}return zl}var nv=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ni(e){return e!=null&&!nv.has(e)?(pt(!1,`"${e}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${Yl}"`),null):e}function rv(e,t){let n,r,l,o,i;if(Xg(e)){let a=e.getAttribute("action");r=a?Ot(a,t):null,n=e.getAttribute("method")||Kl,l=Ni(e.getAttribute("enctype"))||Yl,o=new FormData(e)}else if(Gg(e)||Zg(e)&&(e.type==="submit"||e.type==="image")){let a=e.form;if(a==null)throw new Error('Cannot submit a `,k=`
${y}
`;return`
${S}${k}
`}),i=i.replace(/
\s*(?=
]*>[\s\S]*?<\/div>)\s*
/g,"$1"),i}function ry(e){const t=e.split(/\r?\n/);let n=null;for(let r=0;r/i,n=/<\/think(?:ing)?>/i,r=e.match(t);if(!r)return{think:null,answer:e};const l=r.index,o=r[0].length,i=e.substring(0,l).trim();let a=e.substring(l+o);const s=a.match(n);let u=null,p=i;return s?(u=a.substring(0,s.index).trim(),p+=a.substring(s.index+s[0].length)):u=a.trim(),{think:u||null,answer:p.trim()}}function ly({content:e,streamOutput:t,sources:n}){const{think:r,answer:l}=ep(e||""),[o,i]=Fe.useState(!1),a=!!r;return m.jsxs("div",{className:"assistant-message",children:[a&&m.jsxs("div",{className:"assistant-thoughts",children:[m.jsxs("button",{className:"think-toggle",onClick:()=>i(s=>!s),"aria-expanded":o?"true":"false","aria-controls":"think-content",children:[m.jsx("span",{className:"think-toggle-icon","aria-hidden":"true",children:o?"▾":"▸"}),"Thoughts"]}),o&&m.jsx("div",{id:"think-content",className:"think-content",dangerouslySetInnerHTML:{__html:hc(r)}})]}),m.jsx("div",{className:"msg-content",dangerouslySetInnerHTML:{__html:hc(l||e||"")}}),Array.isArray(n)&&n.length>0&&m.jsx("div",{className:"msg-sources chips",children:n.map((s,u)=>{let p=s,v=!1;try{const y=new URL(s);if(y.protocol==="file:"){v=!0;const S=y.pathname.split("/").filter(Boolean);p=decodeURIComponent(S[S.length-1]||s)}else p=(y.hostname||s).replace(/^www\./i,"")}catch{}return m.jsx("a",{className:"chip",href:s,target:"_blank",rel:"noreferrer",title:s,onClick:y=>{var S,k;if(v){y.preventDefault();try{const C=new URL(s);(k=(S=window.electronAPI)==null?void 0:S.openPath)==null||k.call(S,decodeURIComponent(C.pathname))}catch{}}},children:p},s+u)})})]})}const mc="websearch.searxUrl",gc="websearch.engines",vc="chat.libraryBySession";let tp="http://127.0.0.1:8000";const oy=48,iy=24;function sy(e){return e.backendApiUrl||e.ollamaApiUrl||tp}function ay(){var Ha;const[e,t]=g.useState([]),[n,r]=g.useState(null),[l,o]=g.useState("chats"),[i,a]=g.useState("General"),[s,u]=g.useState(null),[p,v]=g.useState(null),[y,S]=g.useState([]),[k,C]=g.useState([]),[_,h]=g.useState(null),[f,d]=g.useState(()=>{try{const c=localStorage.getItem(vc);return c?JSON.parse(c):{}}catch{return{}}}),[E,P]=g.useState(!1),[T,M]=g.useState(""),[F,B]=g.useState(""),[D,ee]=g.useState(!1),[H,K]=g.useState(""),[pe,j]=g.useState(""),O=g.useRef(null),G=g.useRef(null),R=g.useRef(null),[z,V]=g.useState(tp),[te,ge]=g.useState("Default"),[kt,ht]=g.useState(!1),[Et,Ct]=g.useState(localStorage.getItem(mc)||"http://localhost:8888"),[Xe,np]=g.useState(()=>{try{const c=localStorage.getItem(gc);if(c)return JSON.parse(c)}catch{}return["duckduckgo","bing","wikipedia","github","stack_overflow"]});g.useEffect(()=>{localStorage.setItem(mc,Et||"")},[Et]),g.useEffect(()=>{try{localStorage.setItem(gc,JSON.stringify(Xe||[]))}catch{}},[Xe]);const[cl,rp]=g.useState(!1),[Ut,Uo]=g.useState(!1),[fy,Bo]=g.useState(!0),[lp,Tn]=g.useState([]),[fl,Ea]=g.useState({}),[op,Ho]=g.useState(null),[Wo,dl]=g.useState("");function ip(c){const w=c.content||"";if(c.role==="assistant")try{const{answer:x}=ep(w);return(x||w).trim()}catch{return w.trim()}return w}async function Ca(c){try{await navigator.clipboard.writeText(ip(c))}catch(w){console.error("Failed to copy message:",w)}}function fn(c,w,x,N={}){const{removeIfEmpty:$=!1}=N;t(A=>A.map(W=>{if(W.session_id!==c)return W;const U=[];for(const b of W.messages||[]){if(b.id!==w){U.push(b);continue}$&&!x||U.push({...b,content:x})}return{...W,messages:U}}))}function Bt(c){return(c==null?void 0:c.name)==="AbortError"}function Vo(c){return c instanceof Error&&c.message?c.message:String(c)}async function Na(c,w,x){if(!c)return{contextBlock:null,sources:[]};const $=await(await fetch(`${z}/libraries/${c}/context`,{method:"POST",headers:{"Content-Type":"application/json"},signal:x,body:JSON.stringify({prompt:w,top_k:5})})).json();return{contextBlock:typeof($==null?void 0:$.context_block)=="string"&&$.context_block.trim()?$.context_block.trim():null,sources:Array.isArray($==null?void 0:$.sources)?$.sources:[]}}function sp(c,w){Ho(c),dl(w||"")}function pl(){Ho(null),dl("")}async function ap(c){var A;const w=(((A=Fn[c])==null?void 0:A.content)||"").trim(),N=(Wo??"").trim();if(N.length===0){pl();return}if(N===w){pl();return}const $=n;if($){t(W=>W.map(U=>{if(U.session_id!==$)return U;const je=(U.messages||[]).slice(0,c+1).map((we,Ze)=>Ze===c?{...we,content:N}:we);return{...U,messages:je}})),Ho(null),dl(""),requestAnimationFrame(()=>Go("auto",$));try{const W=await fetch(`${z}/sessions/${$}/messages/${c}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:N})});if(!W.ok)throw new Error(`HTTP ${W.status}`)}catch(W){console.error("Failed to update message:",W),t(U=>U.map(b=>{if(b.session_id!==$)return b;const we=(b.messages||[]).map((Ze,Q)=>Q===c?{...Ze,content:w}:Ze);return{...b,messages:we}}));return}await _a(c,N)}}async function _a(c,w=null){var je,we,Ze,Q,he,Ce;const x=n;if(Ut||!x||typeof c!="number")return;const N=((je=e.find(Z=>Z.session_id===x))==null?void 0:je.messages)||[];let $=c;for(let Z=c;Z>=0;Z--)if(((we=N[Z])==null?void 0:we.role)==="user"){$=Z;break}t(Z=>Z.map(se=>se.session_id===x?{...se,messages:(se.messages||[]).slice(0,$+1)}:se));const A=$a(x);let W=w??(((Ze=N[$])==null?void 0:Ze.content)||""),U=[];const b=[];try{const Z=Ia(x),se=w??(((Q=N[$])==null?void 0:Q.content)||"");if((he=Z==null?void 0:Z.states)!=null&&he.is_indexed)try{const Y=await Na(Z.slug,se,A.signal);Y.contextBlock&&b.push(Y.contextBlock),Array.isArray(Y.sources)&&U.push(...Y.sources)}catch(Y){if(Bt(Y))throw Y;console.warn("local library enrichment (regenerate) failed",Y)}if(cl)try{const Y=N.slice(Math.max(0,$-7),$+1).map(ve=>({role:ve.role,content:ve.content||""}));Y.length>0&&(Y[Y.length-1]={role:"user",content:se});const re=await(await fetch(`${z}/websearch`,{method:"POST",headers:{"Content-Type":"application/json"},signal:A.signal,body:JSON.stringify({prompt:se,model:H,messages:Y,history_limit:8,searx_url:Et||null,engines:Array.isArray(Xe)?Xe:null})})).json();re&&typeof re.context_block=="string"&&re.context_block.trim()&&b.push(re.context_block.trim()),Array.isArray(re==null?void 0:re.sources)&&U.push(...re.sources)}catch(Y){if(Bt(Y))throw Y;console.warn("web search enrichment (regenerate) failed",Y)}if(U=[...new Set(U)],b.length>0?W=`${se} + +${b.join(` + +`)}`:W=null,kt){const Y=`msg-${Date.now()}-${Math.random()}`;let _t="";t(re=>re.map(ve=>ve.session_id===x?{...ve,messages:[...ve.messages||[],{id:Y,role:"assistant",content:"",sources:U}]}:ve));try{const re=await fetch(`${z}/sessions/${x}/regenerate`,{method:"POST",headers:{"Content-Type":"application/json"},signal:A.signal,body:JSON.stringify({index:c,model:H,stream:!0,enriched_message:W,sources:U||[]})});if(!re.ok)throw new Error(`HTTP ${re.status}`);const ve=(Ce=re.body)==null?void 0:Ce.getReader();if(!ve)throw new Error("Missing response body");const Wt=new TextDecoder;let mt=!1;for(;;){const{value:hn,done:Tp}=await ve.read();if(Tp)break;const $p=Wt.decode(hn,{stream:!0});_t+=$p,fn(x,Y,_t),!mt&&Pe.current!==x&&(mt=!0,dn(Xo=>({...Xo,[x]:Y})),Tn(Xo=>[...new Set([...Xo,x])]))}Pe.current!==x?(dn(hn=>({...hn,[x]:Y})),Tn(hn=>[...new Set([...hn,x])])):$n.current[x]?Mn(hn=>({...hn,[x]:Y})):requestAnimationFrame(()=>In(Y,"smooth",x))}catch(re){if(Bt(re)){fn(x,Y,_t,{removeIfEmpty:!0});return}console.error(re),fn(x,Y,`Error: ${Vo(re)}`,{removeIfEmpty:!0});return}}else{const Y=await fetch(`${z}/sessions/${x}/regenerate`,{method:"POST",headers:{"Content-Type":"application/json"},signal:A.signal,body:JSON.stringify({index:c,model:H,stream:!1,enriched_message:W,sources:U||[]})});if(!Y.ok)throw new Error(`HTTP ${Y.status}`);const _t=await Y.json(),re=`msg-${Date.now()}`;t(ve=>ve.map(Wt=>Wt.session_id===x?{...Wt,messages:[...Wt.messages||[],{role:"assistant",content:_t.reply,id:re,sources:U}]}:Wt)),Pe.current!==x?(dn(ve=>({...ve,[x]:re})),Tn(ve=>[...new Set([...ve,x])])):$n.current[x]?Mn(ve=>({...ve,[x]:re})):requestAnimationFrame(()=>In(re,"smooth",x))}}catch(Z){Bt(Z)||console.error(Z)}finally{bo(A)}}const[La,up]=g.useState({}),$n=g.useRef({}),[cp,dn]=g.useState({}),pn=g.useRef({}),Pa=g.useRef({}),[ja,Mn]=g.useState({}),[fp,Ra]=g.useState({}),Ta=(c,w,x)=>c!=null&&c.id?c.id:`${x}:${w}`;g.useEffect(()=>{var w;if(!n)return;const c=((w=e.find(x=>x.session_id===n))==null?void 0:w.messages)||[];Ra(x=>{const N={};return c.forEach(($,A)=>{if($.role!=="user")return;const W=Ta($,A,n),b=($.content||"").split(/\r\n|\r|\n/).length>30;N[W]=b?x[W]??!0:!1}),N})},[e,n]);function dp(c){Ra(w=>({...w,[c]:!(w[c]??!0)}))}const pr=Fe.useCallback((c,w)=>{up(x=>{const N={...x,[c]:w};return $n.current=N,N})},[]),zn=g.useRef(null),pp=g.useRef(!1),hp=g.useRef(null),Pe=g.useRef(n);g.useEffect(()=>{Pe.current=n},[n]);const $a=Fe.useCallback(c=>{const w=new AbortController;return zn.current={controller:w,sessionId:c},Uo(!0),w},[]),bo=Fe.useCallback(c=>{var w;((w=zn.current)==null?void 0:w.controller)===c&&(zn.current=null,Uo(!1))},[]),mp=Fe.useCallback(()=>{const c=zn.current;c&&(zn.current=null,c.controller.abort(),Uo(!1))},[]);g.useEffect(()=>()=>{var c;(c=zn.current)==null||c.controller.abort()},[]);const Ht=g.useRef(null),[gp,vp]=g.useState(230),[hl,Ma]=g.useState(!1),yp=Fe.useCallback(c=>{Ma(!0)},[]),Qo=Fe.useCallback(()=>{Ma(!1)},[]),Ko=Fe.useCallback(c=>{if(hl){const w=Math.max(230,Math.min(500,c.clientX));vp(w)}},[hl]);Fe.useEffect(()=>(window.addEventListener("mousemove",Ko),window.addEventListener("mouseup",Qo),()=>{window.removeEventListener("mousemove",Ko),window.removeEventListener("mouseup",Qo)}),[Ko,Qo]),Fe.useEffect(()=>{hl?document.body.classList.add("no-select"):document.body.classList.remove("no-select")},[hl]),Fe.useEffect(()=>{const c=async w=>{const x=w.target.closest(".codeblock__copy");if(!x)return;const N=x.closest(".codeblock"),$=N==null?void 0:N.querySelector("pre > code");if($)try{await navigator.clipboard.writeText($.textContent||""),x.classList.add("copied"),setTimeout(()=>x.classList.remove("copied"),800)}catch(A){console.error("Copy failed:",A)}};return document.addEventListener("click",c),()=>document.removeEventListener("click",c)},[]),g.useEffect(()=>{window.electronAPI.getSettings().then(w=>{V(sy(w)),ge(w.colorScheme||"Default"),K(w.chatModel||""),ht(w.streamOutput||!1),Ea(w.scrollPositions||{}),tl(w.colorScheme||"Default")});const c=()=>{var w;l==="chats"&&((w=G.current)==null||w.focus())};return window.electronAPI.onWindowFocus(c),()=>{}},[l]),g.useEffect(()=>{tl(te)},[te]);const wp=c=>{!c||!z||fetch(`${z}/history?session_id=${encodeURIComponent(c)}`).then(w=>w.json()).then(w=>{t(x=>x.map(N=>N.session_id===c?{...N,messages:w.messages||[]}:N))}).catch(()=>{})};async function hr(){if(z)try{const w=await(await fetch(`${z}/libraries`)).json(),x=Array.isArray(w.libraries)?w.libraries:[];if(S(x),x.length===0){h(null);return}x.some(N=>N.slug===_)||h(x[0].slug)}catch(c){console.warn("Failed to load libraries",c)}}async function ml(){if(z)try{const w=await(await fetch(`${z}/jobs`)).json();C(Array.isArray(w.jobs)?w.jobs:[])}catch(c){console.warn("Failed to load library jobs",c)}}async function za(c=null){const x=(typeof c=="string"?c:T).trim();if(!x){B("Name is required.");return}try{B("");const N=await fetch(`${z}/libraries`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:x})});if(!N.ok){const A=await N.text();throw new Error(A||`HTTP ${N.status}`)}const $=await N.json();P(!1),M(""),await hr(),$!=null&&$.slug&&h($.slug)}catch(N){console.error("Failed to create library",N),B(String((N==null?void 0:N.message)||N))}}async function Sp(){S([]),C([]),h(null),v(null),ee(!1),d({}),await hr(),await ml()}g.useEffect(()=>{z&&(Bo(!0),fetch(`${z}/sessions`).then(c=>c.json()).then(c=>{const w=c.sessions.map(x=>({...x,messages:[]}));t(w),w.length>0?r(w[0].session_id):r(null),Bo(!1)}).catch(()=>{Bo(!1)}))},[z]),g.useEffect(()=>{z&&(hr(),ml())},[z]),g.useEffect(()=>{try{localStorage.setItem(vc,JSON.stringify(f||{}))}catch{}},[f]),g.useEffect(()=>{if(!z)return;const c=setInterval(()=>{hr(),ml()},3e3);return()=>clearInterval(c)},[z,l,_]),g.useEffect(()=>{wp(n)},[n,z]),g.useEffect(()=>{const c=new Set(y.map(w=>w.slug));d(w=>{let x=!1;const N={};for(const[$,A]of Object.entries(w||{}))c.has(A)?N[$]=A:x=!0;return x?N:w})},[y]);const Yo=c=>{o(c)},xp=c=>{_p(c)},Fn=g.useMemo(()=>{var c;return((c=e.find(w=>w.session_id===n))==null?void 0:c.messages)||[]},[n,e]),gl=g.useMemo(()=>y.find(c=>c.slug===_)||null,[_,y]),Nt=n&&f[n]||null,ot=g.useMemo(()=>y.find(c=>c.slug===Nt)||null,[Nt,y]),Fa=g.useMemo(()=>Nt?k.some(c=>c.slug===Nt&&(c.status==="queued"||c.status==="running")):!1,[Nt,k]),Jo=g.useMemo(()=>{var c,w;return ot?(c=ot.files)!=null&&c.length?(w=ot.states)!=null&&w.is_indexed?"":Fa?" (syncing)":" (needs sync)":" (empty)":""},[ot,Fa]);function kp(c){return c&&f[c]||null}function Ia(c){const w=kp(c);return w&&y.find(x=>x.slug===w)||null}function Oa(c){return c?k.some(w=>w.slug===c&&(w.status==="queued"||w.status==="running")):!1}function Da(c,w){c&&d(x=>{const N={...x||{}};return w?N[c]=w:delete N[c],N})}function Ep(c){c&&d(w=>{let x=!1;const N={};for(const[$,A]of Object.entries(w||{})){if(A===c){x=!0;continue}N[$]=A}return x?N:w})}g.useEffect(()=>{if(!D)return;const c=w=>{var x;(x=R.current)!=null&&x.contains(w.target)||ee(!1)};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[D]),g.useEffect(()=>{ee(!1)},[n,l]),g.useEffect(()=>{const c=n,w=l;return()=>{if(w==="chats"&&c){const x=typeof pn.current[c]=="number"?pn.current[c]:O.current?O.current.scrollTop:0;Ea(N=>{const $={...N,[c]:x};return window.electronAPI.updateSettings({scrollPositions:$}),$})}}},[n,l]),g.useEffect(()=>{const c=O.current;if(!c)return;const w=()=>{const{scrollTop:x,scrollHeight:N,clientHeight:$}=c,A=N-x-$<=iy;if(n){const W=Pa.current[n],U=typeof W=="number"&&xc.removeEventListener("scroll",w)},[n,pr]),g.useEffect(()=>{const c=n;c&&La[c]===!1&&Mn(w=>{if(!(c in w))return w;const x={...w};return delete x[c],x})},[n,La]),g.useLayoutEffect(()=>{if(l!=="chats"||!n)return;const c=O.current;if(!c)return;Ht.current=null;const w=()=>{if(Ht.current===n)return;const W=typeof pn.current[n]=="number"?pn.current[n]:void 0,U=typeof W=="number"?W:fl[n];if(typeof U=="number"){c.scrollTop=U,Ht.current=n;return}Fn.length>0&&(c.scrollTop=c.scrollHeight,Ht.current=n)};w();const x=requestAnimationFrame(w),N=()=>{Ht.current!==n&&requestAnimationFrame(w)},$=new MutationObserver(N);$.observe(c,{childList:!0,subtree:!0});const A=new ResizeObserver(N);return A.observe(c),()=>{cancelAnimationFrame(x),$.disconnect(),A.disconnect()}},[n,l,Fn.length,fl]),g.useEffect(()=>{if(l!=="chats"||!n||Ht.current===n)return;const c=typeof pn.current[n]=="number"?pn.current[n]:void 0;typeof(typeof c=="number"?c:fl[n])!="number"&&Fn.length>0&&requestAnimationFrame(()=>{const x=O.current;x&&(x.scrollTop=x.scrollHeight,Ht.current=n)})},[Fn.length,n,l,fl]);const Go=(c="smooth",w=null)=>{const x=O.current;if(!x)return;const N=w??Pe.current;Pe.current===N&&(x.scrollTo({top:x.scrollHeight,behavior:c}),pr(N,!1))},In=(c,w="auto",x=null)=>{const N=O.current;if(!N)return;const $=x??Pe.current;if(Pe.current!==$)return;const A=document.getElementById(c);if(A){const W=Math.max(0,A.offsetTop-oy);N.scrollTo({top:W,behavior:w})}},Cp=()=>{const c=Pe.current,w=ja[c];w&&(In(w,"smooth",c),Mn(x=>{const{[c]:N,...$}=x;return $}))};async function Aa(){var $,A,W;if(Ut||!pe.trim()||!H)return;let c=n,w=!1;if(c){const U=e.find(b=>b.session_id===c);w=U&&U.name==="New Chat"&&U.messages.length===0}else{const U=await Ua();await new Promise(b=>setTimeout(b,200)),c=U.session_id,w=!0}const x={role:"user",content:pe.trim(),id:`msg-${Date.now()}-${Math.random()}`};pp.current=!0,hp.current=c,pr(c,!1),Pe.current===c&&(Ht.current=Pe.current),Td.flushSync(()=>{t(U=>U.map(b=>b.session_id===c?{...b,messages:[...b.messages||[],x]}:b)),j("")}),requestAnimationFrame(()=>Go("auto",c));const N=$a(c);try{let U=[];try{U=[...((($=e.find(Ce=>Ce.session_id===c))==null?void 0:$.messages)||[]).slice(-8).map(Ce=>({role:Ce.role,content:Ce.content||""})),{role:"user",content:x.content}]}catch{}let b=x.content,je=[];const we=[],Ze=Ia(c);if((A=Ze==null?void 0:Ze.states)!=null&&A.is_indexed)try{const Q=await Na(Ze.slug,x.content,N.signal);Q.contextBlock&&we.push(Q.contextBlock),Array.isArray(Q.sources)&&je.push(...Q.sources)}catch(Q){if(Bt(Q))throw Q;console.warn("local library enrichment failed",Q)}if(cl)try{const he=await(await fetch(`${z}/websearch`,{method:"POST",headers:{"Content-Type":"application/json"},signal:N.signal,body:JSON.stringify({prompt:x.content,model:H,messages:U,history_limit:8,searx_url:Et||null,engines:Array.isArray(Xe)?Xe:null})})).json();he&&typeof he.context_block=="string"&&he.context_block.trim()&&we.push(he.context_block.trim()),Array.isArray(he==null?void 0:he.sources)&&je.push(...he.sources)}catch(Q){if(Bt(Q))throw Q;console.warn("web search enrichment failed",Q)}if(je=[...new Set(je)],we.length>0&&(b=`${x.content} + +${we.join(` + +`)}`),kt){const Q=`msg-${Date.now()}-${Math.random()}`;let he="";const Ce={role:"assistant",content:"",id:Q,sources:je};t(Z=>Z.map(se=>se.session_id===c?{...se,messages:[...se.messages||[],Ce]}:se));try{const Z=await fetch(`${z}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},signal:N.signal,body:JSON.stringify({session_id:c,model:H,message:x.content,enriched_message:we.length>0?b:null,stream:!0,sources:je||[]})});if(!Z.ok)throw new Error(`HTTP ${Z.status}`);const se=(W=Z.body)==null?void 0:W.getReader();if(!se)throw new Error("Missing response body");const Y=new TextDecoder;let _t=!1;for(;;){const{value:re,done:ve}=await se.read();if(ve){fn(c,Q,he),Pe.current===c?$n.current[c]?Mn(mt=>({...mt,[c]:Q})):requestAnimationFrame(()=>In(Q,"smooth",c)):(dn(mt=>({...mt,[c]:Q})),Tn(mt=>[...new Set([...mt,c])]));break}const Wt=Y.decode(re,{stream:!0});he+=Wt,fn(c,Q,he),Pe.current===c&&!$n.current[c]&&Go("auto",c),Pe.current!==c&&!_t&&(dn(mt=>({...mt,[c]:Q})),_t=!0)}}catch(Z){if(Bt(Z)){fn(c,Q,he,{removeIfEmpty:!0});return}console.error("Failed to send message:",Z),fn(c,Q,"Error: "+Vo(Z),{removeIfEmpty:!0});return}}else{const Q=await fetch(`${z}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},signal:N.signal,body:JSON.stringify({session_id:c,model:H,message:x.content,enriched_message:we.length>0?b:null,stream:!1,sources:je||[]})});if(!Q.ok)throw new Error(`HTTP ${Q.status}`);const he=await Q.json(),Ce=`msg-${Date.now()}`,Z={role:"assistant",content:he.reply,id:Ce,sources:je};t(se=>se.map(Y=>Y.session_id===c?{...Y,messages:[...Y.messages||[],Z]}:Y)),Ce&&(Pe.current===c?$n.current[c]?Mn(se=>({...se,[c]:Ce})):requestAnimationFrame(()=>In(Ce,"smooth",c)):dn(se=>({...se,[c]:Ce})))}Pe.current!==c&&Tn(Q=>[...new Set([...Q,c])]),w&&fetch(`${z}/generate-title`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:c,message:x.content,model:H})}).then(Q=>Q.json()).then(Q=>{const he=Q.title.replace(/[\s\S]*?<\/think(?:ing)?>/i,"").trim();t(Ce=>Ce.map(Z=>Z.session_id===c?{...Z,name:he}:Z))})}catch(U){if(Bt(U)){bo(N);return}console.error("Failed to send message:",U);const b={role:"assistant",content:"Error: "+Vo(U),id:`msg-${Date.now()}-${Math.random()}`};t(je=>je.map(we=>we.session_id===c?{...we,messages:[...we.messages,b]}:we))}finally{bo(N)}}function Np(){rp(c=>!c)}async function Ua(){var $;const c="sess-"+Math.random().toString(36).slice(2)+Date.now().toString(36),x=await(await fetch(`${z}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:c})})).json(),N={...x,messages:[]};return t(A=>[N,...A]),r(x.session_id),($=G.current)==null||$.focus(),x}function _p(c){r(c),Tn(x=>x.filter(N=>N!==c));const w=cp[c];w&&requestAnimationFrame(()=>{let x=12;const N=()=>{if(!O.current)return;let A=document.getElementById(w);if(!A){const W=e.find(U=>U.session_id===c);if(W&&Array.isArray(W.messages))for(let U=W.messages.length-1;U>=0;U--){const b=W.messages[U];if(b.role==="assistant"&&b.id){A=document.getElementById(b.id);break}}}A?(In(A.id,"smooth",c),dn(W=>{const{[c]:U,...b}=W;return b})):x-- >0&&requestAnimationFrame(N)};requestAnimationFrame(N)})}function Lp(c,w){fetch(`${z}/sessions/${c}/rename`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:w})}).then(()=>{t(x=>x.map(N=>N.session_id===c?{...N,name:w}:N)),u(null)})}function Pp(c,w){const x=(w||"").trim(),N=y.find($=>$.slug===c);if(!N){v(null);return}if(!x||x===N.name){v(null);return}fetch(`${z}/libraries/${c}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:x})}).then(()=>{S($=>$.map(A=>A.slug===c?{...A,name:x}:A)),v(null)})}function Ba(c){fetch(`${z}/sessions/${c}`,{method:"DELETE"}).then(()=>{const w=e.filter(x=>x.session_id!==c);t(w),d(x=>{const N={...x||{}};return delete N[c],N}),n===c&&r(w.length>0?w[0].session_id:null)})}function jp(c){fetch(`${z}/libraries/${c}`,{method:"DELETE"}).then(async w=>{var N;if(!w.ok){const $=await w.text();throw new Error($||`HTTP ${w.status}`)}const x=y.filter($=>$.slug!==c);S(x),C($=>$.filter(A=>A.slug!==c)),v($=>$===c?null:$),_===c&&h(((N=x[0])==null?void 0:N.slug)||null),Ep(c)}).catch(w=>{console.error("Failed to delete library",w)})}g.useEffect(()=>{const c=e.filter(w=>w.name==="New Chat"&&w.session_id!==n&&w.messages.length===0);c.length>0&&c.forEach(w=>{Ba(w.session_id)})},[n,e,z]);const Rp=c=>{var x;window.getSelection().toString().length>0||document.activeElement!==G.current&&(c.target.closest(".msg")||(x=G.current)==null||x.focus())};return m.jsxs("div",{className:"app",style:{gridTemplateColumns:`${gp}px 1fr`},children:[m.jsxs("div",{className:"sidebar",children:[m.jsxs("div",{className:"sidebar-header",children:[m.jsx("div",{className:`sidebar-tab ${l==="chats"?"active":""}`,onClick:()=>Yo("chats"),children:"Chats"}),m.jsx("div",{className:`sidebar-tab ${l==="dbs"?"active":""}`,onClick:()=>Yo("dbs"),children:"DBs"}),m.jsx("div",{className:`sidebar-tab ${l==="settings"?"active":""}`,onClick:()=>Yo("settings"),children:"Settings"})]}),m.jsxs("div",{className:"sidebar-content",children:[l==="chats"&&m.jsx("div",{className:"chat-list",children:e.map(c=>m.jsx("div",{className:`chat-item ${c.session_id===n?"active":""}`,onClick:()=>xp(c.session_id),children:s===c.session_id?m.jsx("input",{type:"text",className:"rename-input",defaultValue:c.name,onBlur:()=>u(null),onKeyDown:w=>{w.key==="Enter"?Lp(c.session_id,w.target.value):w.key==="Escape"&&u(null)},autoFocus:!0}):m.jsxs(m.Fragment,{children:[m.jsx("span",{children:c.name}),m.jsxs("div",{className:"chat-item-buttons",children:[lp.includes(c.session_id)&&m.jsx("div",{className:"unread-dot"}),m.jsx("button",{className:"icon-button",onClick:w=>{w.stopPropagation(),u(c.session_id)},children:m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-edit-2",children:m.jsx("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}),m.jsx("button",{className:"icon-button",onClick:w=>{w.stopPropagation(),Ba(c.session_id)},children:m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-x",children:[m.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),m.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})},c.session_id))}),l==="dbs"&&m.jsx("div",{className:"db-list",children:y.length===0?m.jsx("div",{className:"empty-list-message",children:"No databases yet."}):y.map(c=>m.jsx("div",{className:`chat-item ${c.slug===_?"active":""}`,onClick:()=>h(c.slug),children:p===c.slug?m.jsx("input",{type:"text",className:"rename-input",defaultValue:c.name,onBlur:()=>v(null),onKeyDown:w=>{w.key==="Enter"?Pp(c.slug,w.target.value):w.key==="Escape"&&v(null)},autoFocus:!0}):m.jsxs(m.Fragment,{children:[m.jsx("span",{children:c.name}),m.jsxs("div",{className:"chat-item-buttons",children:[Nt===c.slug&&m.jsx("div",{className:"db-active-badge",children:"Chat"}),Oa(c.slug)&&m.jsx("div",{className:"db-active-badge",children:"Syncing"}),m.jsx("button",{className:"icon-button",onClick:w=>{w.stopPropagation(),v(c.slug)},children:m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-edit-2",children:m.jsx("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}),m.jsx("button",{className:"icon-button",onClick:w=>{w.stopPropagation(),jp(c.slug)},children:m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-x",children:[m.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),m.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})},c.slug))}),l==="settings"&&m.jsxs("div",{className:"settings-list",children:[m.jsx("div",{className:`settings-item ${i==="General"?"active":""}`,onClick:()=>a("General"),children:"General"}),m.jsx("div",{className:`settings-item ${i==="Interface"?"active":""}`,onClick:()=>a("Interface"),children:"Interface"}),m.jsx("div",{className:`settings-item ${i==="Websearch"?"active":""}`,onClick:()=>a("Websearch"),children:"Websearch"})]})]}),l!=="settings"&&m.jsxs("div",{className:"sidebar-footer",children:[l==="chats"&&m.jsx("button",{className:"button new-chat-button",onClick:Ua,children:"New Chat"}),l==="dbs"&&(E?m.jsxs("div",{className:"new-db-form",children:[m.jsx("input",{type:"text",className:"rename-input",value:T,onChange:c=>M(c.target.value),onKeyDown:c=>{c.key==="Enter"?za():c.key==="Escape"&&(P(!1),M(""),B(""))},placeholder:"Database name",autoFocus:!0}),F&&m.jsx("div",{className:"form-error",children:F}),m.jsxs("div",{className:"new-db-actions",children:[m.jsx("button",{className:"button new-db-button",onClick:()=>za(),children:"Create"}),m.jsx("button",{className:"button ghost",onClick:()=>{P(!1),M(""),B("")},children:"Cancel"})]})]}):m.jsx("button",{className:"button new-db-button",onClick:()=>{P(!0),B("")},children:"New Database"}))]}),m.jsx("div",{className:"resizer",onMouseDown:yp})]}),m.jsxs("div",{className:"main-content",children:[l==="chats"&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"header",children:[m.jsxs("strong",{children:["Chat - ",((Ha=e.find(c=>c.session_id===n))==null?void 0:Ha.name)||"New Chat"]}),ot&&m.jsx("span",{className:"header-subtle",children:`DB: ${ot.name}${Jo}`})]}),m.jsx("div",{className:"chat",ref:O,onClick:Rp,children:Fn.map((c,w)=>{const x=c.role==="user"&&op===w;return m.jsx("div",{id:c.id,className:"msg "+(c.role==="user"?"user":"assistant")+(x?" editing":""),children:c.role==="assistant"?m.jsxs("div",{className:"assistant-message-wrapper",children:[m.jsx(ly,{content:c.content,streamOutput:kt,sources:c.sources}),!Ut&&m.jsxs("div",{className:"message-options-bar assistant-options",children:[m.jsx("button",{className:"icon-button",title:"Copy message",onClick:()=>Ca(c),children:m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[m.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),m.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}),m.jsx("button",{className:"icon-button",title:"Regenerate response",onClick:()=>_a(w),children:m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:m.jsx("path",{d:"M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.3"})})})]})]}):m.jsxs("div",{className:"user-message-wrapper",children:[x?m.jsxs("div",{className:"msg-content msg-content--user editing",children:[m.jsx("div",{className:"user-edit-shadow","aria-hidden":"true",children:Wo}),m.jsx(ac,{className:"edit-message-input edit-overlay",value:Wo,onChange:N=>dl(N.target.value),onBlur:pl,onKeyDown:N=>{N.key==="Escape"&&(N.preventDefault(),pl()),N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),ap(w))},autoFocus:!0,minRows:1})]}):(()=>{const N=c.content||"",$=N.split(/\r\n|\r|\n/),A=$.length>30,W=Ta(c,w,n),U=A?fp[W]??!0:!1,b=U?$.slice(0,30).join(` +`)+` +…`:N;return m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"msg-content msg-content--user",children:b}),A&&m.jsx("button",{className:"user-msg-expand",onClick:()=>dp(W),"aria-expanded":U?"false":"true",children:U?"Show entire message":"Collapse"})]})})(),!Ut&&!x&&m.jsxs("div",{className:"message-options-bar user-options",children:[m.jsx("button",{className:"icon-button",title:"Edit message",onClick:()=>sp(w,c.content),children:m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[m.jsx("path",{d:"M12 20h9"}),m.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"})]})}),m.jsx("button",{className:"icon-button",title:"Copy message",onClick:()=>Ca(c),children:m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[m.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),m.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})]})},c.id||w)})},n),ja[n]&&m.jsxs("button",{className:"new-msg-tip",onClick:Cp,title:"Jump to the new message","aria-label":"Jump to the new message",children:["New message",m.jsx("span",{style:{marginLeft:6},children:"↓"})]}),m.jsx("div",{className:"footer",children:m.jsxs("div",{className:"footer-content-wrapper",children:[m.jsx(ac,{ref:G,className:"input",value:pe,onChange:c=>j(c.target.value),onKeyDown:c=>{c.key==="Enter"&&!c.shiftKey&&(c.preventDefault(),Aa())},placeholder:"Ask any question...",maxRows:13}),m.jsxs("div",{className:"footer-tool-group",ref:R,children:[m.jsx("button",{type:"button",className:"db-picker-toggle"+(ot?" active":""),onClick:()=>{n&&ee(c=>!c)},title:ot?`Database: ${ot.name}${Jo}`:"Select database for this chat","aria-haspopup":"menu","aria-expanded":D,disabled:!n,children:m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[m.jsx("ellipse",{cx:"12",cy:"5",rx:"8",ry:"3"}),m.jsx("path",{d:"M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5"}),m.jsx("path",{d:"M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6"})]})}),D&&m.jsxs("div",{className:"db-picker-menu",role:"menu",children:[m.jsxs("button",{type:"button",className:"db-picker-option"+(Nt?"":" selected"),onClick:()=>{Da(n,null),ee(!1)},children:[m.jsx("span",{children:"No database"}),!Nt&&m.jsx("span",{className:"db-picker-status",children:"Selected"})]}),y.length===0?m.jsx("div",{className:"db-picker-empty",children:"No databases yet."}):y.map(c=>{var $,A,W;const w=Nt===c.slug,x=Oa(c.slug),N=($=c.files)!=null&&$.length?(A=c.states)!=null&&A.is_indexed?"Ready":x?"Syncing":"Needs sync":"Empty";return m.jsxs("button",{type:"button",className:"db-picker-option"+(w?" selected":""),disabled:!((W=c.files)!=null&&W.length),onClick:()=>{Da(n,c.slug),ee(!1)},children:[m.jsx("span",{children:c.name}),m.jsx("span",{className:"db-picker-status",children:w?"Selected":N})]},c.slug)})]})]}),m.jsx("button",{type:"button",className:"websearch-toggle"+(cl?" active":""),onClick:Np,title:"Toggle web search","aria-pressed":cl,children:m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[m.jsx("circle",{cx:"12",cy:"12",r:"10"}),m.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),m.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]})}),m.jsx("button",{className:"button",onClick:Ut?mp:Aa,title:Ut?"Cancel generation":"Send","aria-label":Ut?"Cancel generation":"Send",children:Ut?m.jsx("div",{className:"spinner"}):"Send"})]})})]}),l==="dbs"&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"header",children:[m.jsx("strong",{children:(gl==null?void 0:gl.name)||"Databases"}),ot&&m.jsx("span",{className:"header-subtle",children:`Current chat DB: ${ot.name}${Jo}`})]}),m.jsx(ty,{apiBase:z,library:gl,jobs:k,onRefresh:async()=>{await hr(),await ml()}})]}),l==="settings"&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"header",children:m.jsxs("strong",{children:[i," Settings"]})}),i==="General"&&m.jsx(Jv,{onModelChange:K,streamOutput:kt,onStreamOutputChange:ht,onLibrariesPurged:Sp}),i==="Interface"&&m.jsx(qv,{}),i==="Websearch"&&m.jsx(ny,{searxUrl:Et,setSearxUrl:Ct,engines:Xe,setEngines:np})]})]})]})}function uy(){return g.useEffect(()=>{window.electronAPI.getSettings().then(e=>{tl(e.colorScheme||"Default")})},[]),m.jsx(Fe.StrictMode,{children:m.jsx(yv,{children:m.jsx(Jg,{children:m.jsx(Vd,{path:"/",element:m.jsx(ay,{})})})})})}const cy=$d(document.getElementById("root"));cy.render(m.jsx(uy,{})); diff --git a/dist/assets/index-z8MB-_Ve.js b/dist/assets/index-z8MB-_Ve.js deleted file mode 100644 index 459e537..0000000 --- a/dist/assets/index-z8MB-_Ve.js +++ /dev/null @@ -1,73 +0,0 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(l){if(l.ep)return;l.ep=!0;const o=n(l);fetch(l.href,o)}})();function $p(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var yc={exports:{}},xo={},wc={exports:{}},b={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var tl=Symbol.for("react.element"),Mp=Symbol.for("react.portal"),zp=Symbol.for("react.fragment"),Fp=Symbol.for("react.strict_mode"),Ip=Symbol.for("react.profiler"),Op=Symbol.for("react.provider"),Ap=Symbol.for("react.context"),Dp=Symbol.for("react.forward_ref"),Up=Symbol.for("react.suspense"),Bp=Symbol.for("react.memo"),Hp=Symbol.for("react.lazy"),Wa=Symbol.iterator;function Wp(e){return e===null||typeof e!="object"?null:(e=Wa&&e[Wa]||e["@@iterator"],typeof e=="function"?e:null)}var Sc={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},xc=Object.assign,kc={};function ur(e,t,n){this.props=e,this.context=t,this.refs=kc,this.updater=n||Sc}ur.prototype.isReactComponent={};ur.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): 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")};ur.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Ec(){}Ec.prototype=ur.prototype;function Es(e,t,n){this.props=e,this.context=t,this.refs=kc,this.updater=n||Sc}var Cs=Es.prototype=new Ec;Cs.constructor=Es;xc(Cs,ur.prototype);Cs.isPureReactComponent=!0;var Va=Array.isArray,Cc=Object.prototype.hasOwnProperty,Ns={current:null},Nc={key:!0,ref:!0,__self:!0,__source:!0};function _c(e,t,n){var r,l={},o=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(o=""+t.key),t)Cc.call(t,r)&&!Nc.hasOwnProperty(r)&&(l[r]=t[r]);var a=arguments.length-2;if(a===1)l.children=n;else if(1>>1,pe=$[Z];if(0>>1;Zl(Et,W))Ctl(Je,Et)?($[Z]=Je,$[Ct]=W,Z=Ct):($[Z]=Et,$[pt]=W,Z=pt);else if(Ctl(Je,W))$[Z]=Je,$[Ct]=W,Z=Ct;else break e}}return z}function l($,z){var W=$.sortIndex-z.sortIndex;return W!==0?W:$.id-z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,a=i.now();e.unstable_now=function(){return i.now()-a}}var s=[],u=[],p=1,y=null,g=3,S=!1,k=!1,C=!1,L=typeof setTimeout=="function"?setTimeout:null,h=typeof clearTimeout=="function"?clearTimeout:null,f=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function d($){for(var z=n(u);z!==null;){if(z.callback===null)r(u);else if(z.startTime<=$)r(u),z.sortIndex=z.expirationTime,t(s,z);else break;z=n(u)}}function E($){if(C=!1,d($),!k)if(n(s)!==null)k=!0,O(j);else{var z=n(u);z!==null&&Y(E,z.startTime-$)}}function j($,z){k=!1,C&&(C=!1,h(F),F=-1),S=!0;var W=g;try{for(d(z),y=n(s);y!==null&&(!(y.expirationTime>z)||$&&!le());){var Z=y.callback;if(typeof Z=="function"){y.callback=null,g=y.priorityLevel;var pe=Z(y.expirationTime<=z);z=e.unstable_now(),typeof pe=="function"?y.callback=pe:y===n(s)&&r(s),d(z)}else r(s);y=n(s)}if(y!==null)var kt=!0;else{var pt=n(u);pt!==null&&Y(E,pt.startTime-z),kt=!1}return kt}finally{y=null,g=W,S=!1}}var N=!1,P=null,F=-1,B=5,U=-1;function le(){return!(e.unstable_now()-U$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):B=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_getFirstCallbackNode=function(){return n(s)},e.unstable_next=function($){switch(g){case 1:case 2:case 3:var z=3;break;default:z=g}var W=g;g=z;try{return $()}finally{g=W}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function($,z){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var W=g;g=$;try{return z()}finally{g=W}},e.unstable_scheduleCallback=function($,z,W){var Z=e.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0Z?($.sortIndex=W,t(u,$),n(s)===null&&$===n(u)&&(C?(h(F),F=-1):C=!0,Y(E,W-Z))):($.sortIndex=pe,t(s,$),k||S||(k=!0,O(j))),$},e.unstable_shouldYield=le,e.unstable_wrapCallback=function($){var z=g;return function(){var W=g;g=z;try{return $.apply(this,arguments)}finally{g=W}}}})(Tc);Rc.exports=Tc;var eh=Rc.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var th=v,Ke=eh;function R(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Li=Object.prototype.hasOwnProperty,nh=/^[: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]*$/,Ka={},ba={};function rh(e){return Li.call(ba,e)?!0:Li.call(Ka,e)?!1:nh.test(e)?ba[e]=!0:(Ka[e]=!0,!1)}function lh(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function oh(e,t,n,r){if(t===null||typeof t>"u"||lh(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Oe(e,t,n,r,l,o,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var Ne={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ne[e]=new Oe(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ne[t]=new Oe(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ne[e]=new Oe(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ne[e]=new Oe(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Ne[e]=new Oe(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ne[e]=new Oe(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ne[e]=new Oe(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ne[e]=new Oe(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ne[e]=new Oe(e,5,!1,e.toLowerCase(),null,!1,!1)});var Ls=/[\-:]([a-z])/g;function Ps(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Ls,Ps);Ne[t]=new Oe(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Ls,Ps);Ne[t]=new Oe(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Ls,Ps);Ne[t]=new Oe(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ne[e]=new Oe(e,1,!1,e.toLowerCase(),null,!1,!1)});Ne.xlinkHref=new Oe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ne[e]=new Oe(e,1,!1,e.toLowerCase(),null,!0,!0)});function js(e,t,n,r){var l=Ne.hasOwnProperty(t)?Ne[t]:null;(l!==null?l.type!==0:r||!(2a||l[i]!==o[a]){var s=` -`+l[i].replace(" at new "," at ");return e.displayName&&s.includes("")&&(s=s.replace("",e.displayName)),s}while(1<=i&&0<=a);break}}}finally{ei=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Er(e):""}function ih(e){switch(e.tag){case 5:return Er(e.type);case 16:return Er("Lazy");case 13:return Er("Suspense");case 19:return Er("SuspenseList");case 0:case 2:case 15:return e=ti(e.type,!1),e;case 11:return e=ti(e.type.render,!1),e;case 1:return e=ti(e.type,!0),e;default:return""}}function Ti(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Dn:return"Fragment";case An:return"Portal";case Pi:return"Profiler";case Rs:return"StrictMode";case ji:return"Suspense";case Ri:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case zc:return(e.displayName||"Context")+".Consumer";case Mc:return(e._context.displayName||"Context")+".Provider";case Ts:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case $s:return t=e.displayName||null,t!==null?t:Ti(e.type)||"Memo";case Qt:t=e._payload,e=e._init;try{return Ti(e(t))}catch{}}return null}function sh(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ti(t);case 8:return t===Rs?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function on(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ic(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ah(e){var t=Ic(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(i){r=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function yl(e){e._valueTracker||(e._valueTracker=ah(e))}function Oc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Ic(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Jl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function $i(e,t){var n=t.checked;return ue({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ja(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=on(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Ac(e,t){t=t.checked,t!=null&&js(e,"checked",t,!1)}function Mi(e,t){Ac(e,t);var n=on(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?zi(e,t.type,n):t.hasOwnProperty("defaultValue")&&zi(e,t.type,on(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ga(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function zi(e,t,n){(t!=="number"||Jl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Cr=Array.isArray;function Gn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=wl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Or(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Lr={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},uh=["Webkit","ms","Moz","O"];Object.keys(Lr).forEach(function(e){uh.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Lr[t]=Lr[e]})});function Hc(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Lr.hasOwnProperty(e)&&Lr[e]?(""+t).trim():t+"px"}function Wc(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Hc(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var ch=ue({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Oi(e,t){if(t){if(ch[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(R(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(R(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(R(61))}if(t.style!=null&&typeof t.style!="object")throw Error(R(62))}}function Ai(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";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 Di=null;function Ms(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ui=null,Xn=null,Zn=null;function qa(e){if(e=ll(e)){if(typeof Ui!="function")throw Error(R(280));var t=e.stateNode;t&&(t=_o(t),Ui(e.stateNode,e.type,t))}}function Vc(e){Xn?Zn?Zn.push(e):Zn=[e]:Xn=e}function Qc(){if(Xn){var e=Xn,t=Zn;if(Zn=Xn=null,qa(e),t)for(e=0;e>>=0,e===0?32:31-(xh(e)/kh|0)|0}var Sl=64,xl=4194304;function Nr(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ql(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,i=n&268435455;if(i!==0){var a=i&~l;a!==0?r=Nr(a):(o&=i,o!==0&&(r=Nr(o)))}else i=n&~l,i!==0?r=Nr(i):o!==0&&(r=Nr(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,o=t&-t,l>=o||l===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function nl(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ut(t),e[t]=n}function _h(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=jr),au=" ",uu=!1;function df(e,t){switch(e){case"keyup":return em.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function pf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Un=!1;function nm(e,t){switch(e){case"compositionend":return pf(t);case"keypress":return t.which!==32?null:(uu=!0,au);case"textInput":return e=t.data,e===au&&uu?null:e;default:return null}}function rm(e,t){if(Un)return e==="compositionend"||!Bs&&df(e,t)?(e=cf(),Ol=As=Jt=null,Un=!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)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=pu(n)}}function vf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?vf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function yf(){for(var e=window,t=Jl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Jl(e.document)}return t}function Hs(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")}function dm(e){var t=yf(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&vf(n.ownerDocument.documentElement,n)){if(r!==null&&Hs(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,o=Math.min(r.start,l);r=r.end===void 0?o:Math.min(r.end,l),!e.extend&&o>r&&(l=r,r=o,o=l),l=hu(n,o);var i=hu(n,r);l&&i&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Bn=null,Ki=null,Tr=null,bi=!1;function mu(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;bi||Bn==null||Bn!==Jl(r)||(r=Bn,"selectionStart"in r&&Hs(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}),Tr&&Wr(Tr,r)||(Tr=r,r=no(Ki,"onSelect"),0Vn||(e.current=qi[Vn],qi[Vn]=null,Vn--)}function q(e,t){Vn++,qi[Vn]=e.current,e.current=t}var sn={},Te=un(sn),Ue=un(!1),kn=sn;function rr(e,t){var n=e.type.contextTypes;if(!n)return sn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in n)l[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function Be(e){return e=e.childContextTypes,e!=null}function lo(){ne(Ue),ne(Te)}function ku(e,t,n){if(Te.current!==sn)throw Error(R(168));q(Te,t),q(Ue,n)}function Lf(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(R(108,sh(e)||"Unknown",l));return ue({},n,r)}function oo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||sn,kn=Te.current,q(Te,e),q(Ue,Ue.current),!0}function Eu(e,t,n){var r=e.stateNode;if(!r)throw Error(R(169));n?(e=Lf(e,t,kn),r.__reactInternalMemoizedMergedChildContext=e,ne(Ue),ne(Te),q(Te,e)):ne(Ue),q(Ue,n)}var Pt=null,Lo=!1,mi=!1;function Pf(e){Pt===null?Pt=[e]:Pt.push(e)}function Cm(e){Lo=!0,Pf(e)}function cn(){if(!mi&&Pt!==null){mi=!0;var e=0,t=X;try{var n=Pt;for(X=1;e>=i,l-=i,jt=1<<32-ut(t)+l|n<F?(B=P,P=null):B=P.sibling;var U=g(h,P,d[F],E);if(U===null){P===null&&(P=B);break}e&&P&&U.alternate===null&&t(h,P),f=o(U,f,F),N===null?j=U:N.sibling=U,N=U,P=B}if(F===d.length)return n(h,P),re&&mn(h,F),j;if(P===null){for(;FF?(B=P,P=null):B=P.sibling;var le=g(h,P,U.value,E);if(le===null){P===null&&(P=B);break}e&&P&&le.alternate===null&&t(h,P),f=o(le,f,F),N===null?j=le:N.sibling=le,N=le,P=B}if(U.done)return n(h,P),re&&mn(h,F),j;if(P===null){for(;!U.done;F++,U=d.next())U=y(h,U.value,E),U!==null&&(f=o(U,f,F),N===null?j=U:N.sibling=U,N=U);return re&&mn(h,F),j}for(P=r(h,P);!U.done;F++,U=d.next())U=S(P,h,F,U.value,E),U!==null&&(e&&U.alternate!==null&&P.delete(U.key===null?F:U.key),f=o(U,f,F),N===null?j=U:N.sibling=U,N=U);return e&&P.forEach(function(xe){return t(h,xe)}),re&&mn(h,F),j}function L(h,f,d,E){if(typeof d=="object"&&d!==null&&d.type===Dn&&d.key===null&&(d=d.props.children),typeof d=="object"&&d!==null){switch(d.$$typeof){case vl:e:{for(var j=d.key,N=f;N!==null;){if(N.key===j){if(j=d.type,j===Dn){if(N.tag===7){n(h,N.sibling),f=l(N,d.props.children),f.return=h,h=f;break e}}else if(N.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Qt&&_u(j)===N.type){n(h,N.sibling),f=l(N,d.props),f.ref=wr(h,N,d),f.return=h,h=f;break e}n(h,N);break}else t(h,N);N=N.sibling}d.type===Dn?(f=xn(d.props.children,h.mode,E,d.key),f.return=h,h=f):(E=Ql(d.type,d.key,d.props,null,h.mode,E),E.ref=wr(h,f,d),E.return=h,h=E)}return i(h);case An:e:{for(N=d.key;f!==null;){if(f.key===N)if(f.tag===4&&f.stateNode.containerInfo===d.containerInfo&&f.stateNode.implementation===d.implementation){n(h,f.sibling),f=l(f,d.children||[]),f.return=h,h=f;break e}else{n(h,f);break}else t(h,f);f=f.sibling}f=Ei(d,h.mode,E),f.return=h,h=f}return i(h);case Qt:return N=d._init,L(h,f,N(d._payload),E)}if(Cr(d))return k(h,f,d,E);if(hr(d))return C(h,f,d,E);Pl(h,d)}return typeof d=="string"&&d!==""||typeof d=="number"?(d=""+d,f!==null&&f.tag===6?(n(h,f.sibling),f=l(f,d),f.return=h,h=f):(n(h,f),f=ki(d,h.mode,E),f.return=h,h=f),i(h)):n(h,f)}return L}var or=$f(!0),Mf=$f(!1),ao=un(null),uo=null,bn=null,Ks=null;function bs(){Ks=bn=uo=null}function Ys(e){var t=ao.current;ne(ao),e._currentValue=t}function ns(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function er(e,t){uo=e,Ks=bn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(De=!0),e.firstContext=null)}function tt(e){var t=e._currentValue;if(Ks!==e)if(e={context:e,memoizedValue:t,next:null},bn===null){if(uo===null)throw Error(R(308));bn=e,uo.dependencies={lanes:0,firstContext:e}}else bn=bn.next=e;return t}var yn=null;function Js(e){yn===null?yn=[e]:yn.push(e)}function zf(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Js(t)):(n.next=l.next,l.next=n),t.interleaved=n,Ft(e,r)}function Ft(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Kt=!1;function Gs(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ff(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Tt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function tn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,J&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,Ft(e,n)}return l=r.interleaved,l===null?(t.next=t,Js(r)):(t.next=l.next,l.next=t),r.interleaved=t,Ft(e,n)}function Dl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Fs(e,n)}}function Lu(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?l=o=i:o=o.next=i,n=n.next}while(n!==null);o===null?l=o=t:o=o.next=t}else l=o=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function co(e,t,n,r){var l=e.updateQueue;Kt=!1;var o=l.firstBaseUpdate,i=l.lastBaseUpdate,a=l.shared.pending;if(a!==null){l.shared.pending=null;var s=a,u=s.next;s.next=null,i===null?o=u:i.next=u,i=s;var p=e.alternate;p!==null&&(p=p.updateQueue,a=p.lastBaseUpdate,a!==i&&(a===null?p.firstBaseUpdate=u:a.next=u,p.lastBaseUpdate=s))}if(o!==null){var y=l.baseState;i=0,p=u=s=null,a=o;do{var g=a.lane,S=a.eventTime;if((r&g)===g){p!==null&&(p=p.next={eventTime:S,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var k=e,C=a;switch(g=t,S=n,C.tag){case 1:if(k=C.payload,typeof k=="function"){y=k.call(S,y,g);break e}y=k;break e;case 3:k.flags=k.flags&-65537|128;case 0:if(k=C.payload,g=typeof k=="function"?k.call(S,y,g):k,g==null)break e;y=ue({},y,g);break e;case 2:Kt=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,g=l.effects,g===null?l.effects=[a]:g.push(a))}else S={eventTime:S,lane:g,tag:a.tag,payload:a.payload,callback:a.callback,next:null},p===null?(u=p=S,s=y):p=p.next=S,i|=g;if(a=a.next,a===null){if(a=l.shared.pending,a===null)break;g=a,a=g.next,g.next=null,l.lastBaseUpdate=g,l.shared.pending=null}}while(!0);if(p===null&&(s=y),l.baseState=s,l.firstBaseUpdate=u,l.lastBaseUpdate=p,t=l.shared.interleaved,t!==null){l=t;do i|=l.lane,l=l.next;while(l!==t)}else o===null&&(l.shared.lanes=0);Nn|=i,e.lanes=i,e.memoizedState=y}}function Pu(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=vi.transition;vi.transition={};try{e(!1),t()}finally{X=n,vi.transition=r}}function Zf(){return nt().memoizedState}function Pm(e,t,n){var r=rn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},qf(e))ed(t,n);else if(n=zf(e,t,n,r),n!==null){var l=Fe();ct(n,e,r,l),td(n,t,r)}}function jm(e,t,n){var r=rn(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(qf(e))ed(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,a=o(i,n);if(l.hasEagerState=!0,l.eagerState=a,ft(a,i)){var s=t.interleaved;s===null?(l.next=l,Js(t)):(l.next=s.next,s.next=l),t.interleaved=l;return}}catch{}finally{}n=zf(e,t,l,r),n!==null&&(l=Fe(),ct(n,e,r,l),td(n,t,r))}}function qf(e){var t=e.alternate;return e===se||t!==null&&t===se}function ed(e,t){$r=po=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function td(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Fs(e,n)}}var ho={readContext:tt,useCallback:Pe,useContext:Pe,useEffect:Pe,useImperativeHandle:Pe,useInsertionEffect:Pe,useLayoutEffect:Pe,useMemo:Pe,useReducer:Pe,useRef:Pe,useState:Pe,useDebugValue:Pe,useDeferredValue:Pe,useTransition:Pe,useMutableSource:Pe,useSyncExternalStore:Pe,useId:Pe,unstable_isNewReconciler:!1},Rm={readContext:tt,useCallback:function(e,t){return gt().memoizedState=[e,t===void 0?null:t],e},useContext:tt,useEffect:Ru,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Bl(4194308,4,bf.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Bl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Bl(4,2,e,t)},useMemo:function(e,t){var n=gt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=gt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Pm.bind(null,se,e),[r.memoizedState,e]},useRef:function(e){var t=gt();return e={current:e},t.memoizedState=e},useState:ju,useDebugValue:la,useDeferredValue:function(e){return gt().memoizedState=e},useTransition:function(){var e=ju(!1),t=e[0];return e=Lm.bind(null,e[1]),gt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=se,l=gt();if(re){if(n===void 0)throw Error(R(407));n=n()}else{if(n=t(),Se===null)throw Error(R(349));Cn&30||Df(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,Ru(Bf.bind(null,r,o,e),[e]),r.flags|=2048,Xr(9,Uf.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=gt(),t=Se.identifierPrefix;if(re){var n=Rt,r=jt;n=(r&~(1<<32-ut(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Jr++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[vt]=t,e[Kr]=r,fd(e,t,!1,!1),t.stateNode=e;e:{switch(i=Ai(n,r),n){case"dialog":te("cancel",e),te("close",e),l=r;break;case"iframe":case"object":case"embed":te("load",e),l=r;break;case"video":case"audio":for(l=0;l<_r.length;l++)te(_r[l],e);l=r;break;case"source":te("error",e),l=r;break;case"img":case"image":case"link":te("error",e),te("load",e),l=r;break;case"details":te("toggle",e),l=r;break;case"input":Ja(e,r),l=$i(e,r),te("invalid",e);break;case"option":l=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},l=ue({},r,{value:void 0}),te("invalid",e);break;case"textarea":Xa(e,r),l=Fi(e,r),te("invalid",e);break;default:l=r}Oi(n,l),a=l;for(o in a)if(a.hasOwnProperty(o)){var s=a[o];o==="style"?Wc(e,s):o==="dangerouslySetInnerHTML"?(s=s?s.__html:void 0,s!=null&&Bc(e,s)):o==="children"?typeof s=="string"?(n!=="textarea"||s!=="")&&Or(e,s):typeof s=="number"&&Or(e,""+s):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(Ir.hasOwnProperty(o)?s!=null&&o==="onScroll"&&te("scroll",e):s!=null&&js(e,o,s,i))}switch(n){case"input":yl(e),Ga(e,r,!1);break;case"textarea":yl(e),Za(e);break;case"option":r.value!=null&&e.setAttribute("value",""+on(r.value));break;case"select":e.multiple=!!r.multiple,o=r.value,o!=null?Gn(e,!!r.multiple,o,!1):r.defaultValue!=null&&Gn(e,!!r.multiple,r.defaultValue,!0);break;default:typeof l.onClick=="function"&&(e.onclick=ro)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return je(t),null;case 6:if(e&&t.stateNode!=null)pd(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(R(166));if(n=wn(Yr.current),wn(wt.current),Ll(t)){if(r=t.stateNode,n=t.memoizedProps,r[vt]=t,(o=r.nodeValue!==n)&&(e=Qe,e!==null))switch(e.tag){case 3:_l(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&_l(r.nodeValue,n,(e.mode&1)!==0)}o&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[vt]=t,t.stateNode=r}return je(t),null;case 13:if(ne(ie),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(re&&Ve!==null&&t.mode&1&&!(t.flags&128))Tf(),lr(),t.flags|=98560,o=!1;else if(o=Ll(t),r!==null&&r.dehydrated!==null){if(e===null){if(!o)throw Error(R(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(R(317));o[vt]=t}else lr(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;je(t),o=!1}else at!==null&&(ys(at),at=null),o=!0;if(!o)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||ie.current&1?ye===0&&(ye=3):fa())),t.updateQueue!==null&&(t.flags|=4),je(t),null);case 4:return ir(),cs(e,t),e===null&&Vr(t.stateNode.containerInfo),je(t),null;case 10:return Ys(t.type._context),je(t),null;case 17:return Be(t.type)&&lo(),je(t),null;case 19:if(ne(ie),o=t.memoizedState,o===null)return je(t),null;if(r=(t.flags&128)!==0,i=o.rendering,i===null)if(r)Sr(o,!1);else{if(ye!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=fo(e),i!==null){for(t.flags|=128,Sr(o,!1),r=i.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)o=n,e=r,o.flags&=14680066,i=o.alternate,i===null?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=i.childLanes,o.lanes=i.lanes,o.child=i.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=i.memoizedProps,o.memoizedState=i.memoizedState,o.updateQueue=i.updateQueue,o.type=i.type,e=i.dependencies,o.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return q(ie,ie.current&1|2),t.child}e=e.sibling}o.tail!==null&&de()>ar&&(t.flags|=128,r=!0,Sr(o,!1),t.lanes=4194304)}else{if(!r)if(e=fo(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Sr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!re)return je(t),null}else 2*de()-o.renderingStartTime>ar&&n!==1073741824&&(t.flags|=128,r=!0,Sr(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(n=o.last,n!==null?n.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=de(),t.sibling=null,n=ie.current,q(ie,r?n&1|2:n&1),t):(je(t),null);case 22:case 23:return ca(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?We&1073741824&&(je(t),t.subtreeFlags&6&&(t.flags|=8192)):je(t),null;case 24:return null;case 25:return null}throw Error(R(156,t.tag))}function Am(e,t){switch(Vs(t),t.tag){case 1:return Be(t.type)&&lo(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ir(),ne(Ue),ne(Te),qs(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Zs(t),null;case 13:if(ne(ie),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(R(340));lr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ne(ie),null;case 4:return ir(),null;case 10:return Ys(t.type._context),null;case 22:case 23:return ca(),null;case 24:return null;default:return null}}var Rl=!1,Re=!1,Dm=typeof WeakSet=="function"?WeakSet:Set,I=null;function Yn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ce(e,t,r)}else n.current=null}function fs(e,t,n){try{n()}catch(r){ce(e,t,r)}}var Bu=!1;function Um(e,t){if(Yi=eo,e=yf(),Hs(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,a=-1,s=-1,u=0,p=0,y=e,g=null;t:for(;;){for(var S;y!==n||l!==0&&y.nodeType!==3||(a=i+l),y!==o||r!==0&&y.nodeType!==3||(s=i+r),y.nodeType===3&&(i+=y.nodeValue.length),(S=y.firstChild)!==null;)g=y,y=S;for(;;){if(y===e)break t;if(g===n&&++u===l&&(a=i),g===o&&++p===r&&(s=i),(S=y.nextSibling)!==null)break;y=g,g=y.parentNode}y=S}n=a===-1||s===-1?null:{start:a,end:s}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ji={focusedElem:e,selectionRange:n},eo=!1,I=t;I!==null;)if(t=I,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,I=e;else for(;I!==null;){t=I;try{var k=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(k!==null){var C=k.memoizedProps,L=k.memoizedState,h=t.stateNode,f=h.getSnapshotBeforeUpdate(t.elementType===t.type?C:it(t.type,C),L);h.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var d=t.stateNode.containerInfo;d.nodeType===1?d.textContent="":d.nodeType===9&&d.documentElement&&d.removeChild(d.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(R(163))}}catch(E){ce(t,t.return,E)}if(e=t.sibling,e!==null){e.return=t.return,I=e;break}I=t.return}return k=Bu,Bu=!1,k}function Mr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&fs(t,n,o)}l=l.next}while(l!==r)}}function Ro(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function ds(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function hd(e){var t=e.alternate;t!==null&&(e.alternate=null,hd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[vt],delete t[Kr],delete t[Zi],delete t[km],delete t[Em])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function md(e){return e.tag===5||e.tag===3||e.tag===4}function Hu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||md(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.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ps(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ro));else if(r!==4&&(e=e.child,e!==null))for(ps(e,t,n),e=e.sibling;e!==null;)ps(e,t,n),e=e.sibling}function hs(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&&(e=e.child,e!==null))for(hs(e,t,n),e=e.sibling;e!==null;)hs(e,t,n),e=e.sibling}var Ee=null,st=!1;function Vt(e,t,n){for(n=n.child;n!==null;)gd(e,t,n),n=n.sibling}function gd(e,t,n){if(yt&&typeof yt.onCommitFiberUnmount=="function")try{yt.onCommitFiberUnmount(ko,n)}catch{}switch(n.tag){case 5:Re||Yn(n,t);case 6:var r=Ee,l=st;Ee=null,Vt(e,t,n),Ee=r,st=l,Ee!==null&&(st?(e=Ee,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ee.removeChild(n.stateNode));break;case 18:Ee!==null&&(st?(e=Ee,n=n.stateNode,e.nodeType===8?hi(e.parentNode,n):e.nodeType===1&&hi(e,n),Br(e)):hi(Ee,n.stateNode));break;case 4:r=Ee,l=st,Ee=n.stateNode.containerInfo,st=!0,Vt(e,t,n),Ee=r,st=l;break;case 0:case 11:case 14:case 15:if(!Re&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var o=l,i=o.destroy;o=o.tag,i!==void 0&&(o&2||o&4)&&fs(n,t,i),l=l.next}while(l!==r)}Vt(e,t,n);break;case 1:if(!Re&&(Yn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){ce(n,t,a)}Vt(e,t,n);break;case 21:Vt(e,t,n);break;case 22:n.mode&1?(Re=(r=Re)||n.memoizedState!==null,Vt(e,t,n),Re=r):Vt(e,t,n);break;default:Vt(e,t,n)}}function Wu(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Dm),t.forEach(function(r){var l=Jm.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function ot(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=i),r&=~o}if(r=l,r=de()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Hm(r/1960))-r,10e?16:e,Gt===null)var r=!1;else{if(e=Gt,Gt=null,vo=0,J&6)throw Error(R(331));var l=J;for(J|=4,I=e.current;I!==null;){var o=I,i=o.child;if(I.flags&16){var a=o.deletions;if(a!==null){for(var s=0;sde()-aa?Sn(e,0):sa|=n),He(e,t)}function Cd(e,t){t===0&&(e.mode&1?(t=xl,xl<<=1,!(xl&130023424)&&(xl=4194304)):t=1);var n=Fe();e=Ft(e,t),e!==null&&(nl(e,t,n),He(e,n))}function Ym(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Cd(e,n)}function Jm(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(R(314))}r!==null&&r.delete(t),Cd(e,n)}var Nd;Nd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ue.current)De=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return De=!1,Im(e,t,n);De=!!(e.flags&131072)}else De=!1,re&&t.flags&1048576&&jf(t,so,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Hl(e,t),e=t.pendingProps;var l=rr(t,Te.current);er(t,n),l=ta(null,t,r,e,l,n);var o=na();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Be(r)?(o=!0,oo(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Gs(t),l.updater=jo,t.stateNode=l,l._reactInternals=t,ls(t,r,e,n),t=ss(null,t,r,!0,o,n)):(t.tag=0,re&&o&&Ws(t),ze(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Hl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Xm(r),e=it(r,e),l){case 0:t=is(null,t,r,e,n);break e;case 1:t=Au(null,t,r,e,n);break e;case 11:t=Iu(null,t,r,e,n);break e;case 14:t=Ou(null,t,r,it(r.type,e),n);break e}throw Error(R(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:it(r,l),is(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:it(r,l),Au(e,t,r,l,n);case 3:e:{if(ad(t),e===null)throw Error(R(387));r=t.pendingProps,o=t.memoizedState,l=o.element,Ff(e,t),co(t,r,null,n);var i=t.memoizedState;if(r=i.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){l=sr(Error(R(423)),t),t=Du(e,t,r,n,l);break e}else if(r!==l){l=sr(Error(R(424)),t),t=Du(e,t,r,n,l);break e}else for(Ve=en(t.stateNode.containerInfo.firstChild),Qe=t,re=!0,at=null,n=Mf(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(lr(),r===l){t=It(e,t,n);break e}ze(e,t,r,n)}t=t.child}return t;case 5:return If(t),e===null&&ts(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,i=l.children,Gi(r,l)?i=null:o!==null&&Gi(r,o)&&(t.flags|=32),sd(e,t),ze(e,t,i,n),t.child;case 6:return e===null&&ts(t),null;case 13:return ud(e,t,n);case 4:return Xs(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=or(t,null,r,n):ze(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:it(r,l),Iu(e,t,r,l,n);case 7:return ze(e,t,t.pendingProps,n),t.child;case 8:return ze(e,t,t.pendingProps.children,n),t.child;case 12:return ze(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,o=t.memoizedProps,i=l.value,q(ao,r._currentValue),r._currentValue=i,o!==null)if(ft(o.value,i)){if(o.children===l.children&&!Ue.current){t=It(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var a=o.dependencies;if(a!==null){i=o.child;for(var s=a.firstContext;s!==null;){if(s.context===r){if(o.tag===1){s=Tt(-1,n&-n),s.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var p=u.pending;p===null?s.next=s:(s.next=p.next,p.next=s),u.pending=s}}o.lanes|=n,s=o.alternate,s!==null&&(s.lanes|=n),ns(o.return,n,t),a.lanes|=n;break}s=s.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(R(341));i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),ns(i,n,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}ze(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,er(t,n),l=tt(l),r=r(l),t.flags|=1,ze(e,t,r,n),t.child;case 14:return r=t.type,l=it(r,t.pendingProps),l=it(r.type,l),Ou(e,t,r,l,n);case 15:return od(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:it(r,l),Hl(e,t),t.tag=1,Be(r)?(e=!0,oo(t)):e=!1,er(t,n),nd(t,r,l),ls(t,r,l,n),ss(null,t,r,!0,e,n);case 19:return cd(e,t,n);case 22:return id(e,t,n)}throw Error(R(156,t.tag))};function _d(e,t){return Zc(e,t)}function Gm(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.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 qe(e,t,n,r){return new Gm(e,t,n,r)}function da(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Xm(e){if(typeof e=="function")return da(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ts)return 11;if(e===$s)return 14}return 2}function ln(e,t){var n=e.alternate;return n===null?(n=qe(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&14680064,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}function Ql(e,t,n,r,l,o){var i=2;if(r=e,typeof e=="function")da(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Dn:return xn(n.children,l,o,t);case Rs:i=8,l|=8;break;case Pi:return e=qe(12,n,t,l|2),e.elementType=Pi,e.lanes=o,e;case ji:return e=qe(13,n,t,l),e.elementType=ji,e.lanes=o,e;case Ri:return e=qe(19,n,t,l),e.elementType=Ri,e.lanes=o,e;case Fc:return $o(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Mc:i=10;break e;case zc:i=9;break e;case Ts:i=11;break e;case $s:i=14;break e;case Qt:i=16,r=null;break e}throw Error(R(130,e==null?e:typeof e,""))}return t=qe(i,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function xn(e,t,n,r){return e=qe(7,e,r,t),e.lanes=n,e}function $o(e,t,n,r){return e=qe(22,e,r,t),e.elementType=Fc,e.lanes=n,e.stateNode={isHidden:!1},e}function ki(e,t,n){return e=qe(6,e,null,t),e.lanes=n,e}function Ei(e,t,n){return t=qe(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Zm(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ri(0),this.expirationTimes=ri(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ri(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function pa(e,t,n,r,l,o,i,a,s){return e=new Zm(e,t,n,a,s),t===1?(t=1,o===!0&&(t|=8)):t=0,o=qe(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Gs(o),e}function qm(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Rd)}catch(e){console.error(e)}}Rd(),jc.exports=be;var Td=jc.exports,$d,Xu=Td;$d=Xu.createRoot,Xu.hydrateRoot;/** - * react-router v7.8.2 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */var Zu="popstate";function lg(e={}){function t(l,o){let{pathname:i="/",search:a="",hash:s=""}=jn(l.location.hash.substring(1));return!i.startsWith("/")&&!i.startsWith(".")&&(i="/"+i),ws("",{pathname:i,search:a,hash:s},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function n(l,o){let i=l.document.querySelector("base"),a="";if(i&&i.getAttribute("href")){let s=l.location.href,u=s.indexOf("#");a=u===-1?s:s.slice(0,u)}return a+"#"+(typeof o=="string"?o:qr(o))}function r(l,o){dt(l.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(o)})`)}return ig(t,n,r,e)}function ae(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function dt(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function og(){return Math.random().toString(36).substring(2,10)}function qu(e,t){return{usr:e.state,key:e.key,idx:t}}function ws(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?jn(t):t,state:n,key:t&&t.key||r||og()}}function qr({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function jn(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function ig(e,t,n,r={}){let{window:l=document.defaultView,v5Compat:o=!1}=r,i=l.history,a="POP",s=null,u=p();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function p(){return(i.state||{idx:null}).idx}function y(){a="POP";let L=p(),h=L==null?null:L-u;u=L,s&&s({action:a,location:C.location,delta:h})}function g(L,h){a="PUSH";let f=ws(C.location,L,h);n&&n(f,L),u=p()+1;let d=qu(f,u),E=C.createHref(f);try{i.pushState(d,"",E)}catch(j){if(j instanceof DOMException&&j.name==="DataCloneError")throw j;l.location.assign(E)}o&&s&&s({action:a,location:C.location,delta:1})}function S(L,h){a="REPLACE";let f=ws(C.location,L,h);n&&n(f,L),u=p();let d=qu(f,u),E=C.createHref(f);i.replaceState(d,"",E),o&&s&&s({action:a,location:C.location,delta:0})}function k(L){return sg(L)}let C={get action(){return a},get location(){return e(l,i)},listen(L){if(s)throw new Error("A history only accepts one active listener");return l.addEventListener(Zu,y),s=L,()=>{l.removeEventListener(Zu,y),s=null}},createHref(L){return t(l,L)},createURL:k,encodeLocation(L){let h=k(L);return{pathname:h.pathname,search:h.search,hash:h.hash}},push:g,replace:S,go(L){return i.go(L)}};return C}function sg(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),ae(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:qr(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function Md(e,t,n="/"){return ag(e,t,n,!1)}function ag(e,t,n,r){let l=typeof t=="string"?jn(t):t,o=Ot(l.pathname||"/",n);if(o==null)return null;let i=zd(e);ug(i);let a=null;for(let s=0;a==null&&s{let p={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:a,route:i};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(r)&&s)return;ae(p.relativePath.startsWith(r),`Absolute route path "${p.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(r.length)}let y=$t([r,p.relativePath]),g=n.concat(p);i.children&&i.children.length>0&&(ae(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${y}".`),zd(i.children,t,g,y,s)),!(i.path==null&&!i.index)&&t.push({path:y,score:gg(y,i.index),routesMeta:g})};return e.forEach((i,a)=>{var s;if(i.path===""||!((s=i.path)!=null&&s.includes("?")))o(i,a);else for(let u of Fd(i.path))o(i,a,!0,u)}),t}function Fd(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,l=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return l?[o,""]:[o];let i=Fd(r.join("/")),a=[];return a.push(...i.map(s=>s===""?o:[o,s].join("/"))),l&&a.push(...i),a.map(s=>e.startsWith("/")&&s===""?"/":s)}function ug(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:vg(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var cg=/^:[\w-]+$/,fg=3,dg=2,pg=1,hg=10,mg=-2,ec=e=>e==="*";function gg(e,t){let n=e.split("/"),r=n.length;return n.some(ec)&&(r+=mg),t&&(r+=dg),n.filter(l=>!ec(l)).reduce((l,o)=>l+(cg.test(o)?fg:o===""?pg:hg),r)}function vg(e,t){return e.length===t.length&&e.slice(0,-1).every((r,l)=>r===t[l])?e[e.length-1]-t[t.length-1]:0}function yg(e,t,n=!1){let{routesMeta:r}=e,l={},o="/",i=[];for(let a=0;a{if(p==="*"){let k=a[g]||"";i=o.slice(0,o.length-k.length).replace(/(.)\/+$/,"$1")}const S=a[g];return y&&!S?u[p]=void 0:u[p]=(S||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function wg(e,t=!1,n=!0){dt(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,a,s)=>(r.push({paramName:a,isOptional:s!=null}),s?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,t?void 0:"i"),r]}function Sg(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return dt(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Ot(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function xg(e,t="/"){let{pathname:n,search:r="",hash:l=""}=typeof e=="string"?jn(e):e;return{pathname:n?n.startsWith("/")?n:kg(n,t):t,search:Ng(r),hash:_g(l)}}function kg(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(l=>{l===".."?n.length>1&&n.pop():l!=="."&&n.push(l)}),n.length>1?n.join("/"):"/"}function Ci(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function Eg(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Id(e){let t=Eg(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Od(e,t,n,r=!1){let l;typeof e=="string"?l=jn(e):(l={...e},ae(!l.pathname||!l.pathname.includes("?"),Ci("?","pathname","search",l)),ae(!l.pathname||!l.pathname.includes("#"),Ci("#","pathname","hash",l)),ae(!l.search||!l.search.includes("#"),Ci("#","search","hash",l)));let o=e===""||l.pathname==="",i=o?"/":l.pathname,a;if(i==null)a=n;else{let y=t.length-1;if(!r&&i.startsWith("..")){let g=i.split("/");for(;g[0]==="..";)g.shift(),y-=1;l.pathname=g.join("/")}a=y>=0?t[y]:"/"}let s=xg(l,a),u=i&&i!=="/"&&i.endsWith("/"),p=(o||i===".")&&n.endsWith("/");return!s.pathname.endsWith("/")&&(u||p)&&(s.pathname+="/"),s}var $t=e=>e.join("/").replace(/\/\/+/g,"/"),Cg=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Ng=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,_g=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Lg(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}var Ad=["POST","PUT","PATCH","DELETE"];new Set(Ad);var Pg=["GET",...Ad];new Set(Pg);var dr=v.createContext(null);dr.displayName="DataRouter";var Oo=v.createContext(null);Oo.displayName="DataRouterState";v.createContext(!1);var Dd=v.createContext({isTransitioning:!1});Dd.displayName="ViewTransition";var jg=v.createContext(new Map);jg.displayName="Fetchers";var Rg=v.createContext(null);Rg.displayName="Await";var St=v.createContext(null);St.displayName="Navigation";var il=v.createContext(null);il.displayName="Location";var Dt=v.createContext({outlet:null,matches:[],isDataRoute:!1});Dt.displayName="Route";var va=v.createContext(null);va.displayName="RouteError";function Tg(e,{relative:t}={}){ae(sl(),"useHref() may be used only in the context of a component.");let{basename:n,navigator:r}=v.useContext(St),{hash:l,pathname:o,search:i}=al(e,{relative:t}),a=o;return n!=="/"&&(a=o==="/"?n:$t([n,o])),r.createHref({pathname:a,search:i,hash:l})}function sl(){return v.useContext(il)!=null}function Rn(){return ae(sl(),"useLocation() may be used only in the context of a component."),v.useContext(il).location}var Ud="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Bd(e){v.useContext(St).static||v.useLayoutEffect(e)}function $g(){let{isDataRoute:e}=v.useContext(Dt);return e?Qg():Mg()}function Mg(){ae(sl(),"useNavigate() may be used only in the context of a component.");let e=v.useContext(dr),{basename:t,navigator:n}=v.useContext(St),{matches:r}=v.useContext(Dt),{pathname:l}=Rn(),o=JSON.stringify(Id(r)),i=v.useRef(!1);return Bd(()=>{i.current=!0}),v.useCallback((s,u={})=>{if(dt(i.current,Ud),!i.current)return;if(typeof s=="number"){n.go(s);return}let p=Od(s,JSON.parse(o),l,u.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:$t([t,p.pathname])),(u.replace?n.replace:n.push)(p,u.state,u)},[t,n,o,l,e])}v.createContext(null);function al(e,{relative:t}={}){let{matches:n}=v.useContext(Dt),{pathname:r}=Rn(),l=JSON.stringify(Id(n));return v.useMemo(()=>Od(e,JSON.parse(l),r,t==="path"),[e,l,r,t])}function zg(e,t){return Hd(e,t)}function Hd(e,t,n,r,l){var f;ae(sl(),"useRoutes() may be used only in the context of a component.");let{navigator:o}=v.useContext(St),{matches:i}=v.useContext(Dt),a=i[i.length-1],s=a?a.params:{},u=a?a.pathname:"/",p=a?a.pathnameBase:"/",y=a&&a.route;{let d=y&&y.path||"";Wd(u,!y||d.endsWith("*")||d.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${u}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. - -Please change the parent to .`)}let g=Rn(),S;if(t){let d=typeof t=="string"?jn(t):t;ae(p==="/"||((f=d.pathname)==null?void 0:f.startsWith(p)),`When overriding the location using \`\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${p}" but pathname "${d.pathname}" was given in the \`location\` prop.`),S=d}else S=g;let k=S.pathname||"/",C=k;if(p!=="/"){let d=p.replace(/^\//,"").split("/");C="/"+k.replace(/^\//,"").split("/").slice(d.length).join("/")}let L=Md(e,{pathname:C});dt(y||L!=null,`No routes matched location "${S.pathname}${S.search}${S.hash}" `),dt(L==null||L[L.length-1].route.element!==void 0||L[L.length-1].route.Component!==void 0||L[L.length-1].route.lazy!==void 0,`Matched leaf route at location "${S.pathname}${S.search}${S.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`);let h=Dg(L&&L.map(d=>Object.assign({},d,{params:Object.assign({},s,d.params),pathname:$t([p,o.encodeLocation?o.encodeLocation(d.pathname).pathname:d.pathname]),pathnameBase:d.pathnameBase==="/"?p:$t([p,o.encodeLocation?o.encodeLocation(d.pathnameBase).pathname:d.pathnameBase])})),i,n,r,l);return t&&h?v.createElement(il.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...S},navigationType:"POP"}},h):h}function Fg(){let e=Vg(),t=Lg(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",l={padding:"0.5rem",backgroundColor:r},o={padding:"2px 4px",backgroundColor:r},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=v.createElement(v.Fragment,null,v.createElement("p",null,"💿 Hey developer 👋"),v.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",v.createElement("code",{style:o},"ErrorBoundary")," or"," ",v.createElement("code",{style:o},"errorElement")," prop on your route.")),v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},t),n?v.createElement("pre",{style:l},n):null,i)}var Ig=v.createElement(Fg,null),Og=class extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.unstable_onError?this.props.unstable_onError(e,t):console.error("React Router caught the following error during render",e)}render(){return this.state.error!==void 0?v.createElement(Dt.Provider,{value:this.props.routeContext},v.createElement(va.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function Ag({routeContext:e,match:t,children:n}){let r=v.useContext(dr);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(Dt.Provider,{value:e},n)}function Dg(e,t=[],n=null,r=null,l=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,i=n==null?void 0:n.errors;if(i!=null){let u=o.findIndex(p=>p.route.id&&(i==null?void 0:i[p.route.id])!==void 0);ae(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),o=o.slice(0,Math.min(o.length,u+1))}let a=!1,s=-1;if(n)for(let u=0;u=0?o=o.slice(0,s+1):o=[o[0]];break}}}return o.reduceRight((u,p,y)=>{let g,S=!1,k=null,C=null;n&&(g=i&&p.route.id?i[p.route.id]:void 0,k=p.route.errorElement||Ig,a&&(s<0&&y===0?(Wd("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,C=null):s===y&&(S=!0,C=p.route.hydrateFallbackElement||null)));let L=t.concat(o.slice(0,y+1)),h=()=>{let f;return g?f=k:S?f=C:p.route.Component?f=v.createElement(p.route.Component,null):p.route.element?f=p.route.element:f=u,v.createElement(Ag,{match:p,routeContext:{outlet:u,matches:L,isDataRoute:n!=null},children:f})};return n&&(p.route.ErrorBoundary||p.route.errorElement||y===0)?v.createElement(Og,{location:n.location,revalidation:n.revalidation,component:k,error:g,children:h(),routeContext:{outlet:null,matches:L,isDataRoute:!0},unstable_onError:r}):h()},null)}function ya(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ug(e){let t=v.useContext(dr);return ae(t,ya(e)),t}function Bg(e){let t=v.useContext(Oo);return ae(t,ya(e)),t}function Hg(e){let t=v.useContext(Dt);return ae(t,ya(e)),t}function wa(e){let t=Hg(e),n=t.matches[t.matches.length-1];return ae(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Wg(){return wa("useRouteId")}function Vg(){var r;let e=v.useContext(va),t=Bg("useRouteError"),n=wa("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function Qg(){let{router:e}=Ug("useNavigate"),t=wa("useNavigate"),n=v.useRef(!1);return Bd(()=>{n.current=!0}),v.useCallback(async(l,o={})=>{dt(n.current,Ud),n.current&&(typeof l=="number"?e.navigate(l):await e.navigate(l,{fromRouteId:t,...o}))},[e,t])}var tc={};function Wd(e,t,n){!t&&!tc[e]&&(tc[e]=!0,dt(!1,n))}v.memo(Kg);function Kg({routes:e,future:t,state:n,unstable_onError:r}){return Hd(e,void 0,n,r,t)}function Vd(e){ae(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function bg({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:l,static:o=!1}){ae(!sl(),"You cannot render a inside another . You should never have more than one in your app.");let i=e.replace(/^\/*/,"/"),a=v.useMemo(()=>({basename:i,navigator:l,static:o,future:{}}),[i,l,o]);typeof n=="string"&&(n=jn(n));let{pathname:s="/",search:u="",hash:p="",state:y=null,key:g="default"}=n,S=v.useMemo(()=>{let k=Ot(s,i);return k==null?null:{location:{pathname:k,search:u,hash:p,state:y,key:g},navigationType:r}},[i,s,u,p,y,g,r]);return dt(S!=null,` is not able to match the URL "${s}${u}${p}" because it does not start with the basename, so the won't render anything.`),S==null?null:v.createElement(St.Provider,{value:a},v.createElement(il.Provider,{children:t,value:S}))}function Yg({children:e,location:t}){return zg(Ss(e),t)}function Ss(e,t=[]){let n=[];return v.Children.forEach(e,(r,l)=>{if(!v.isValidElement(r))return;let o=[...t,l];if(r.type===v.Fragment){n.push.apply(n,Ss(r.props.children,o));return}ae(r.type===Vd,`[${typeof r.type=="string"?r.type:r.type.name}] is not a component. All component children of must be a or `),ae(!r.props.index||!r.props.children,"An index route cannot have child routes.");let i={id:r.props.id||o.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(i.children=Ss(r.props.children,o)),n.push(i)}),n}var Kl="get",bl="application/x-www-form-urlencoded";function Ao(e){return e!=null&&typeof e.tagName=="string"}function Jg(e){return Ao(e)&&e.tagName.toLowerCase()==="button"}function Gg(e){return Ao(e)&&e.tagName.toLowerCase()==="form"}function Xg(e){return Ao(e)&&e.tagName.toLowerCase()==="input"}function Zg(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function qg(e,t){return e.button===0&&(!t||t==="_self")&&!Zg(e)}var Ml=null;function ev(){if(Ml===null)try{new FormData(document.createElement("form"),0),Ml=!1}catch{Ml=!0}return Ml}var tv=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ni(e){return e!=null&&!tv.has(e)?(dt(!1,`"${e}" is not a valid \`encType\` for \`\`/\`\` and will default to "${bl}"`),null):e}function nv(e,t){let n,r,l,o,i;if(Gg(e)){let a=e.getAttribute("action");r=a?Ot(a,t):null,n=e.getAttribute("method")||Kl,l=Ni(e.getAttribute("enctype"))||bl,o=new FormData(e)}else if(Jg(e)||Xg(e)&&(e.type==="submit"||e.type==="image")){let a=e.form;if(a==null)throw new Error('Cannot submit a
`,k=`
${g}
`;return`
${S}${k}
`}),i=i.replace(/
\s*(?=
]*>[\s\S]*?<\/div>)\s*
/g,"$1"),i}function ny(e){const t=e.split(/\r?\n/);let n=null;for(let r=0;r/i,n=/<\/think(?:ing)?>/i,r=e.match(t);if(!r)return{think:null,answer:e};const l=r.index,o=r[0].length,i=e.substring(0,l).trim();let a=e.substring(l+o);const s=a.match(n);let u=null,p=i;return s?(u=a.substring(0,s.index).trim(),p+=a.substring(s.index+s[0].length)):u=a.trim(),{think:u||null,answer:p.trim()}}function ry({content:e,streamOutput:t,sources:n}){const{think:r,answer:l}=ep(e||""),[o,i]=Me.useState(!1),a=!!r;return m.jsxs("div",{className:"assistant-message",children:[a&&m.jsxs("div",{className:"assistant-thoughts",children:[m.jsxs("button",{className:"think-toggle",onClick:()=>i(s=>!s),"aria-expanded":o?"true":"false","aria-controls":"think-content",children:[m.jsx("span",{className:"think-toggle-icon","aria-hidden":"true",children:o?"▾":"▸"}),"Thoughts"]}),o&&m.jsx("div",{id:"think-content",className:"think-content",dangerouslySetInnerHTML:{__html:hc(r)}})]}),m.jsx("div",{className:"msg-content",dangerouslySetInnerHTML:{__html:hc(l||e||"")}}),Array.isArray(n)&&n.length>0&&m.jsx("div",{className:"msg-sources chips",children:n.map((s,u)=>{let p=s,y=!1;try{const g=new URL(s);if(g.protocol==="file:"){y=!0;const S=g.pathname.split("/").filter(Boolean);p=decodeURIComponent(S[S.length-1]||s)}else p=(g.hostname||s).replace(/^www\./i,"")}catch{}return m.jsx("a",{className:"chip",href:s,target:"_blank",rel:"noreferrer",title:s,onClick:g=>{var S,k;if(y){g.preventDefault();try{const C=new URL(s);(k=(S=window.electronAPI)==null?void 0:S.openPath)==null||k.call(S,decodeURIComponent(C.pathname))}catch{}}},children:p},s+u)})})]})}const mc="websearch.searxUrl",gc="websearch.engines",vc="chat.libraryBySession";let tp="http://127.0.0.1:8000";const ly=48,oy=24;function iy(e){return e.backendApiUrl||e.ollamaApiUrl||tp}function sy(){var Ha;const[e,t]=v.useState([]),[n,r]=v.useState(null),[l,o]=v.useState("chats"),[i,a]=v.useState("General"),[s,u]=v.useState(null),[p,y]=v.useState(null),[g,S]=v.useState([]),[k,C]=v.useState([]),[L,h]=v.useState(null),[f,d]=v.useState(()=>{try{const c=localStorage.getItem(vc);return c?JSON.parse(c):{}}catch{return{}}}),[E,j]=v.useState(!1),[N,P]=v.useState(""),[F,B]=v.useState(""),[U,le]=v.useState(!1),[xe,rt]=v.useState(""),[xt,T]=v.useState(""),O=v.useRef(null),Y=v.useRef(null),$=v.useRef(null),[z,W]=v.useState(tp),[Z,pe]=v.useState("Default"),[kt,pt]=v.useState(!1),[Et,Ct]=v.useState(localStorage.getItem(mc)||"http://localhost:8888"),[Je,np]=v.useState(()=>{try{const c=localStorage.getItem(gc);if(c)return JSON.parse(c)}catch{}return["duckduckgo","bing","wikipedia","github","stack_overflow"]});v.useEffect(()=>{localStorage.setItem(mc,Et||"")},[Et]),v.useEffect(()=>{try{localStorage.setItem(gc,JSON.stringify(Je||[]))}catch{}},[Je]);const[ul,rp]=v.useState(!1),[Ut,Do]=v.useState(!1),[cy,Uo]=v.useState(!0),[lp,Tn]=v.useState([]),[cl,Ea]=v.useState({}),[op,Bo]=v.useState(null),[Ho,fl]=v.useState("");function ip(c){const w=c.content||"";if(c.role==="assistant")try{const{answer:x}=ep(w);return(x||w).trim()}catch{return w.trim()}return w}async function Ca(c){try{await navigator.clipboard.writeText(ip(c))}catch(w){console.error("Failed to copy message:",w)}}function fn(c,w,x,_={}){const{removeIfEmpty:M=!1}=_;t(A=>A.map(H=>{if(H.session_id!==c)return H;const D=[];for(const V of H.messages||[]){if(V.id!==w){D.push(V);continue}M&&!x||D.push({...V,content:x})}return{...H,messages:D}}))}function Bt(c){return(c==null?void 0:c.name)==="AbortError"}function Wo(c){return c instanceof Error&&c.message?c.message:String(c)}async function Na(c,w,x){if(!c)return{contextBlock:null,sources:[]};const M=await(await fetch(`${z}/libraries/${c}/context`,{method:"POST",headers:{"Content-Type":"application/json"},signal:x,body:JSON.stringify({prompt:w,top_k:5})})).json();return{contextBlock:typeof(M==null?void 0:M.context_block)=="string"&&M.context_block.trim()?M.context_block.trim():null,sources:Array.isArray(M==null?void 0:M.sources)?M.sources:[]}}function sp(c,w){Bo(c),fl(w||"")}function dl(){Bo(null),fl("")}async function ap(c){var A;const w=(((A=Fn[c])==null?void 0:A.content)||"").trim(),_=(Ho??"").trim();if(_.length===0){dl();return}if(_===w){dl();return}const M=n;if(M){t(H=>H.map(D=>{if(D.session_id!==M)return D;const Le=(D.messages||[]).slice(0,c+1).map((ge,Ge)=>Ge===c?{...ge,content:_}:ge);return{...D,messages:Le}})),Bo(null),fl(""),requestAnimationFrame(()=>Go("auto",M));try{const H=await fetch(`${z}/sessions/${M}/messages/${c}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:_})});if(!H.ok)throw new Error(`HTTP ${H.status}`)}catch(H){console.error("Failed to update message:",H),t(D=>D.map(V=>{if(V.session_id!==M)return V;const ge=(V.messages||[]).map((Ge,Q)=>Q===c?{...Ge,content:w}:Ge);return{...V,messages:ge}}));return}await _a(c,_)}}async function _a(c,w=null){var Le,ge,Ge,Q,fe,ke;const x=n;if(Ut||!x||typeof c!="number")return;const _=((Le=e.find(G=>G.session_id===x))==null?void 0:Le.messages)||[];let M=c;for(let G=c;G>=0;G--)if(((ge=_[G])==null?void 0:ge.role)==="user"){M=G;break}t(G=>G.map(oe=>oe.session_id===x?{...oe,messages:(oe.messages||[]).slice(0,M+1)}:oe));const A=$a(x);let H=w??(((Ge=_[M])==null?void 0:Ge.content)||""),D=[];const V=[];try{const G=Ia(x),oe=w??(((Q=_[M])==null?void 0:Q.content)||"");if((fe=G==null?void 0:G.states)!=null&&fe.is_indexed)try{const K=await Na(G.slug,oe,A.signal);K.contextBlock&&V.push(K.contextBlock),Array.isArray(K.sources)&&D.push(...K.sources)}catch(K){if(Bt(K))throw K;console.warn("local library enrichment (regenerate) failed",K)}if(ul)try{const K=_.slice(Math.max(0,M-7),M+1).map(he=>({role:he.role,content:he.content||""}));K.length>0&&(K[K.length-1]={role:"user",content:oe});const ee=await(await fetch(`${z}/websearch`,{method:"POST",headers:{"Content-Type":"application/json"},signal:A.signal,body:JSON.stringify({prompt:oe,model:xe,messages:K,history_limit:8,searx_url:Et||null,engines:Array.isArray(Je)?Je:null})})).json();ee&&typeof ee.context_block=="string"&&ee.context_block.trim()&&V.push(ee.context_block.trim()),Array.isArray(ee==null?void 0:ee.sources)&&D.push(...ee.sources)}catch(K){if(Bt(K))throw K;console.warn("web search enrichment (regenerate) failed",K)}if(D=[...new Set(D)],V.length>0?H=`${oe} - -${V.join(` - -`)}`:H=null,kt){const K=`msg-${Date.now()}-${Math.random()}`;let _t="";t(ee=>ee.map(he=>he.session_id===x?{...he,messages:[...he.messages||[],{id:K,role:"assistant",content:"",sources:D}]}:he));try{const ee=await fetch(`${z}/sessions/${x}/regenerate`,{method:"POST",headers:{"Content-Type":"application/json"},signal:A.signal,body:JSON.stringify({index:c,model:xe,stream:!0,enriched_message:H,sources:D||[]})});if(!ee.ok)throw new Error(`HTTP ${ee.status}`);const he=(ke=ee.body)==null?void 0:ke.getReader();if(!he)throw new Error("Missing response body");const Wt=new TextDecoder;let ht=!1;for(;;){const{value:hn,done:Rp}=await he.read();if(Rp)break;const Tp=Wt.decode(hn,{stream:!0});_t+=Tp,fn(x,K,_t),!ht&&_e.current!==x&&(ht=!0,dn(Xo=>({...Xo,[x]:K})),Tn(Xo=>[...new Set([...Xo,x])]))}_e.current!==x?(dn(hn=>({...hn,[x]:K})),Tn(hn=>[...new Set([...hn,x])])):$n.current[x]?Mn(hn=>({...hn,[x]:K})):requestAnimationFrame(()=>In(K,"smooth",x))}catch(ee){if(Bt(ee)){fn(x,K,_t,{removeIfEmpty:!0});return}console.error(ee),fn(x,K,`Error: ${Wo(ee)}`,{removeIfEmpty:!0});return}}else{const K=await fetch(`${z}/sessions/${x}/regenerate`,{method:"POST",headers:{"Content-Type":"application/json"},signal:A.signal,body:JSON.stringify({index:c,model:xe,stream:!1,enriched_message:H,sources:D||[]})});if(!K.ok)throw new Error(`HTTP ${K.status}`);const _t=await K.json(),ee=`msg-${Date.now()}`;t(he=>he.map(Wt=>Wt.session_id===x?{...Wt,messages:[...Wt.messages||[],{role:"assistant",content:_t.reply,id:ee,sources:D}]}:Wt)),_e.current!==x?(dn(he=>({...he,[x]:ee})),Tn(he=>[...new Set([...he,x])])):$n.current[x]?Mn(he=>({...he,[x]:ee})):requestAnimationFrame(()=>In(ee,"smooth",x))}}catch(G){Bt(G)||console.error(G)}finally{Vo(A)}}const[La,up]=v.useState({}),$n=v.useRef({}),[cp,dn]=v.useState({}),pn=v.useRef({}),Pa=v.useRef({}),[ja,Mn]=v.useState({}),[fp,Ra]=v.useState({}),Ta=(c,w,x)=>c!=null&&c.id?c.id:`${x}:${w}`;v.useEffect(()=>{var w;if(!n)return;const c=((w=e.find(x=>x.session_id===n))==null?void 0:w.messages)||[];Ra(x=>{const _={};return c.forEach((M,A)=>{if(M.role!=="user")return;const H=Ta(M,A,n),V=(M.content||"").split(/\r\n|\r|\n/).length>30;_[H]=V?x[H]??!0:!1}),_})},[e,n]);function dp(c){Ra(w=>({...w,[c]:!(w[c]??!0)}))}const pr=Me.useCallback((c,w)=>{up(x=>{const _={...x,[c]:w};return $n.current=_,_})},[]),zn=v.useRef(null),pp=v.useRef(!1),hp=v.useRef(null),_e=v.useRef(n);v.useEffect(()=>{_e.current=n},[n]);const $a=Me.useCallback(c=>{const w=new AbortController;return zn.current={controller:w,sessionId:c},Do(!0),w},[]),Vo=Me.useCallback(c=>{var w;((w=zn.current)==null?void 0:w.controller)===c&&(zn.current=null,Do(!1))},[]),mp=Me.useCallback(()=>{const c=zn.current;c&&(zn.current=null,c.controller.abort(),Do(!1))},[]);v.useEffect(()=>()=>{var c;(c=zn.current)==null||c.controller.abort()},[]);const Ht=v.useRef(null),[gp,vp]=v.useState(230),[pl,Ma]=v.useState(!1),yp=Me.useCallback(c=>{Ma(!0)},[]),Qo=Me.useCallback(()=>{Ma(!1)},[]),Ko=Me.useCallback(c=>{if(pl){const w=Math.max(230,Math.min(500,c.clientX));vp(w)}},[pl]);Me.useEffect(()=>(window.addEventListener("mousemove",Ko),window.addEventListener("mouseup",Qo),()=>{window.removeEventListener("mousemove",Ko),window.removeEventListener("mouseup",Qo)}),[Ko,Qo]),Me.useEffect(()=>{pl?document.body.classList.add("no-select"):document.body.classList.remove("no-select")},[pl]),Me.useEffect(()=>{const c=async w=>{const x=w.target.closest(".codeblock__copy");if(!x)return;const _=x.closest(".codeblock"),M=_==null?void 0:_.querySelector("pre > code");if(M)try{await navigator.clipboard.writeText(M.textContent||""),x.classList.add("copied"),setTimeout(()=>x.classList.remove("copied"),800)}catch(A){console.error("Copy failed:",A)}};return document.addEventListener("click",c),()=>document.removeEventListener("click",c)},[]),v.useEffect(()=>{window.electronAPI.getSettings().then(w=>{W(iy(w)),pe(w.colorScheme||"Default"),rt(w.chatModel||""),pt(w.streamOutput||!1),Ea(w.scrollPositions||{}),el(w.colorScheme||"Default")});const c=()=>{var w;l==="chats"&&((w=Y.current)==null||w.focus())};return window.electronAPI.onWindowFocus(c),()=>{}},[l]),v.useEffect(()=>{el(Z)},[Z]);const wp=c=>{!c||!z||fetch(`${z}/history?session_id=${encodeURIComponent(c)}`).then(w=>w.json()).then(w=>{t(x=>x.map(_=>_.session_id===c?{..._,messages:w.messages||[]}:_))}).catch(()=>{})};async function hl(){if(z)try{const w=await(await fetch(`${z}/libraries`)).json(),x=Array.isArray(w.libraries)?w.libraries:[];if(S(x),x.length===0){h(null);return}x.some(_=>_.slug===L)||h(x[0].slug)}catch(c){console.warn("Failed to load libraries",c)}}async function bo(){if(z)try{const w=await(await fetch(`${z}/jobs`)).json();C(Array.isArray(w.jobs)?w.jobs:[])}catch(c){console.warn("Failed to load library jobs",c)}}async function za(c=null){const x=(typeof c=="string"?c:N).trim();if(!x){B("Name is required.");return}try{B("");const _=await fetch(`${z}/libraries`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:x})});if(!_.ok){const A=await _.text();throw new Error(A||`HTTP ${_.status}`)}const M=await _.json();j(!1),P(""),await hl(),M!=null&&M.slug&&h(M.slug)}catch(_){console.error("Failed to create library",_),B(String((_==null?void 0:_.message)||_))}}v.useEffect(()=>{z&&(Uo(!0),fetch(`${z}/sessions`).then(c=>c.json()).then(c=>{const w=c.sessions.map(x=>({...x,messages:[]}));t(w),w.length>0?r(w[0].session_id):r(null),Uo(!1)}).catch(()=>{Uo(!1)}))},[z]),v.useEffect(()=>{z&&(hl(),bo())},[z]),v.useEffect(()=>{try{localStorage.setItem(vc,JSON.stringify(f||{}))}catch{}},[f]),v.useEffect(()=>{if(!z)return;const c=setInterval(()=>{hl(),bo()},3e3);return()=>clearInterval(c)},[z,l,L]),v.useEffect(()=>{wp(n)},[n,z]),v.useEffect(()=>{const c=new Set(g.map(w=>w.slug));d(w=>{let x=!1;const _={};for(const[M,A]of Object.entries(w||{}))c.has(A)?_[M]=A:x=!0;return x?_:w})},[g]);const Yo=c=>{o(c)},Sp=c=>{Np(c)},Fn=v.useMemo(()=>{var c;return((c=e.find(w=>w.session_id===n))==null?void 0:c.messages)||[]},[n,e]),ml=v.useMemo(()=>g.find(c=>c.slug===L)||null,[L,g]),Nt=n&&f[n]||null,lt=v.useMemo(()=>g.find(c=>c.slug===Nt)||null,[Nt,g]),Fa=v.useMemo(()=>Nt?k.some(c=>c.slug===Nt&&(c.status==="queued"||c.status==="running")):!1,[Nt,k]),Jo=v.useMemo(()=>{var c,w;return lt?(c=lt.files)!=null&&c.length?(w=lt.states)!=null&&w.is_indexed?"":Fa?" (syncing)":" (needs sync)":" (empty)":""},[lt,Fa]);function xp(c){return c&&f[c]||null}function Ia(c){const w=xp(c);return w&&g.find(x=>x.slug===w)||null}function Oa(c){return c?k.some(w=>w.slug===c&&(w.status==="queued"||w.status==="running")):!1}function Aa(c,w){c&&d(x=>{const _={...x||{}};return w?_[c]=w:delete _[c],_})}function kp(c){c&&d(w=>{let x=!1;const _={};for(const[M,A]of Object.entries(w||{})){if(A===c){x=!0;continue}_[M]=A}return x?_:w})}v.useEffect(()=>{if(!U)return;const c=w=>{var x;(x=$.current)!=null&&x.contains(w.target)||le(!1)};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[U]),v.useEffect(()=>{le(!1)},[n,l]),v.useEffect(()=>{const c=n,w=l;return()=>{if(w==="chats"&&c){const x=typeof pn.current[c]=="number"?pn.current[c]:O.current?O.current.scrollTop:0;Ea(_=>{const M={..._,[c]:x};return window.electronAPI.updateSettings({scrollPositions:M}),M})}}},[n,l]),v.useEffect(()=>{const c=O.current;if(!c)return;const w=()=>{const{scrollTop:x,scrollHeight:_,clientHeight:M}=c,A=_-x-M<=oy;if(n){const H=Pa.current[n],D=typeof H=="number"&&xc.removeEventListener("scroll",w)},[n,pr]),v.useEffect(()=>{const c=n;c&&La[c]===!1&&Mn(w=>{if(!(c in w))return w;const x={...w};return delete x[c],x})},[n,La]),v.useLayoutEffect(()=>{if(l!=="chats"||!n)return;const c=O.current;if(!c)return;Ht.current=null;const w=()=>{if(Ht.current===n)return;const H=typeof pn.current[n]=="number"?pn.current[n]:void 0,D=typeof H=="number"?H:cl[n];if(typeof D=="number"){c.scrollTop=D,Ht.current=n;return}Fn.length>0&&(c.scrollTop=c.scrollHeight,Ht.current=n)};w();const x=requestAnimationFrame(w),_=()=>{Ht.current!==n&&requestAnimationFrame(w)},M=new MutationObserver(_);M.observe(c,{childList:!0,subtree:!0});const A=new ResizeObserver(_);return A.observe(c),()=>{cancelAnimationFrame(x),M.disconnect(),A.disconnect()}},[n,l,Fn.length,cl]),v.useEffect(()=>{if(l!=="chats"||!n||Ht.current===n)return;const c=typeof pn.current[n]=="number"?pn.current[n]:void 0;typeof(typeof c=="number"?c:cl[n])!="number"&&Fn.length>0&&requestAnimationFrame(()=>{const x=O.current;x&&(x.scrollTop=x.scrollHeight,Ht.current=n)})},[Fn.length,n,l,cl]);const Go=(c="smooth",w=null)=>{const x=O.current;if(!x)return;const _=w??_e.current;_e.current===_&&(x.scrollTo({top:x.scrollHeight,behavior:c}),pr(_,!1))},In=(c,w="auto",x=null)=>{const _=O.current;if(!_)return;const M=x??_e.current;if(_e.current!==M)return;const A=document.getElementById(c);if(A){const H=Math.max(0,A.offsetTop-ly);_.scrollTo({top:H,behavior:w})}},Ep=()=>{const c=_e.current,w=ja[c];w&&(In(w,"smooth",c),Mn(x=>{const{[c]:_,...M}=x;return M}))};async function Da(){var M,A,H;if(Ut||!xt.trim()||!xe)return;let c=n,w=!1;if(c){const D=e.find(V=>V.session_id===c);w=D&&D.name==="New Chat"&&D.messages.length===0}else{const D=await Ua();await new Promise(V=>setTimeout(V,200)),c=D.session_id,w=!0}const x={role:"user",content:xt.trim(),id:`msg-${Date.now()}-${Math.random()}`};pp.current=!0,hp.current=c,pr(c,!1),_e.current===c&&(Ht.current=_e.current),Td.flushSync(()=>{t(D=>D.map(V=>V.session_id===c?{...V,messages:[...V.messages||[],x]}:V)),T("")}),requestAnimationFrame(()=>Go("auto",c));const _=$a(c);try{let D=[];try{D=[...(((M=e.find(ke=>ke.session_id===c))==null?void 0:M.messages)||[]).slice(-8).map(ke=>({role:ke.role,content:ke.content||""})),{role:"user",content:x.content}]}catch{}let V=x.content,Le=[];const ge=[],Ge=Ia(c);if((A=Ge==null?void 0:Ge.states)!=null&&A.is_indexed)try{const Q=await Na(Ge.slug,x.content,_.signal);Q.contextBlock&&ge.push(Q.contextBlock),Array.isArray(Q.sources)&&Le.push(...Q.sources)}catch(Q){if(Bt(Q))throw Q;console.warn("local library enrichment failed",Q)}if(ul)try{const fe=await(await fetch(`${z}/websearch`,{method:"POST",headers:{"Content-Type":"application/json"},signal:_.signal,body:JSON.stringify({prompt:x.content,model:xe,messages:D,history_limit:8,searx_url:Et||null,engines:Array.isArray(Je)?Je:null})})).json();fe&&typeof fe.context_block=="string"&&fe.context_block.trim()&&ge.push(fe.context_block.trim()),Array.isArray(fe==null?void 0:fe.sources)&&Le.push(...fe.sources)}catch(Q){if(Bt(Q))throw Q;console.warn("web search enrichment failed",Q)}if(Le=[...new Set(Le)],ge.length>0&&(V=`${x.content} - -${ge.join(` - -`)}`),kt){const Q=`msg-${Date.now()}-${Math.random()}`;let fe="";const ke={role:"assistant",content:"",id:Q,sources:Le};t(G=>G.map(oe=>oe.session_id===c?{...oe,messages:[...oe.messages||[],ke]}:oe));try{const G=await fetch(`${z}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},signal:_.signal,body:JSON.stringify({session_id:c,model:xe,message:x.content,enriched_message:ge.length>0?V:null,stream:!0,sources:Le||[]})});if(!G.ok)throw new Error(`HTTP ${G.status}`);const oe=(H=G.body)==null?void 0:H.getReader();if(!oe)throw new Error("Missing response body");const K=new TextDecoder;let _t=!1;for(;;){const{value:ee,done:he}=await oe.read();if(he){fn(c,Q,fe),_e.current===c?$n.current[c]?Mn(ht=>({...ht,[c]:Q})):requestAnimationFrame(()=>In(Q,"smooth",c)):(dn(ht=>({...ht,[c]:Q})),Tn(ht=>[...new Set([...ht,c])]));break}const Wt=K.decode(ee,{stream:!0});fe+=Wt,fn(c,Q,fe),_e.current===c&&!$n.current[c]&&Go("auto",c),_e.current!==c&&!_t&&(dn(ht=>({...ht,[c]:Q})),_t=!0)}}catch(G){if(Bt(G)){fn(c,Q,fe,{removeIfEmpty:!0});return}console.error("Failed to send message:",G),fn(c,Q,"Error: "+Wo(G),{removeIfEmpty:!0});return}}else{const Q=await fetch(`${z}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},signal:_.signal,body:JSON.stringify({session_id:c,model:xe,message:x.content,enriched_message:ge.length>0?V:null,stream:!1,sources:Le||[]})});if(!Q.ok)throw new Error(`HTTP ${Q.status}`);const fe=await Q.json(),ke=`msg-${Date.now()}`,G={role:"assistant",content:fe.reply,id:ke,sources:Le};t(oe=>oe.map(K=>K.session_id===c?{...K,messages:[...K.messages||[],G]}:K)),ke&&(_e.current===c?$n.current[c]?Mn(oe=>({...oe,[c]:ke})):requestAnimationFrame(()=>In(ke,"smooth",c)):dn(oe=>({...oe,[c]:ke})))}_e.current!==c&&Tn(Q=>[...new Set([...Q,c])]),w&&fetch(`${z}/generate-title`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:c,message:x.content,model:xe})}).then(Q=>Q.json()).then(Q=>{const fe=Q.title.replace(/[\s\S]*?<\/think(?:ing)?>/i,"").trim();t(ke=>ke.map(G=>G.session_id===c?{...G,name:fe}:G))})}catch(D){if(Bt(D)){Vo(_);return}console.error("Failed to send message:",D);const V={role:"assistant",content:"Error: "+Wo(D),id:`msg-${Date.now()}-${Math.random()}`};t(Le=>Le.map(ge=>ge.session_id===c?{...ge,messages:[...ge.messages,V]}:ge))}finally{Vo(_)}}function Cp(){rp(c=>!c)}async function Ua(){var M;const c="sess-"+Math.random().toString(36).slice(2)+Date.now().toString(36),x=await(await fetch(`${z}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:c})})).json(),_={...x,messages:[]};return t(A=>[_,...A]),r(x.session_id),(M=Y.current)==null||M.focus(),x}function Np(c){r(c),Tn(x=>x.filter(_=>_!==c));const w=cp[c];w&&requestAnimationFrame(()=>{let x=12;const _=()=>{if(!O.current)return;let A=document.getElementById(w);if(!A){const H=e.find(D=>D.session_id===c);if(H&&Array.isArray(H.messages))for(let D=H.messages.length-1;D>=0;D--){const V=H.messages[D];if(V.role==="assistant"&&V.id){A=document.getElementById(V.id);break}}}A?(In(A.id,"smooth",c),dn(H=>{const{[c]:D,...V}=H;return V})):x-- >0&&requestAnimationFrame(_)};requestAnimationFrame(_)})}function _p(c,w){fetch(`${z}/sessions/${c}/rename`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:w})}).then(()=>{t(x=>x.map(_=>_.session_id===c?{..._,name:w}:_)),u(null)})}function Lp(c,w){const x=(w||"").trim(),_=g.find(M=>M.slug===c);if(!_){y(null);return}if(!x||x===_.name){y(null);return}fetch(`${z}/libraries/${c}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:x})}).then(()=>{S(M=>M.map(A=>A.slug===c?{...A,name:x}:A)),y(null)})}function Ba(c){fetch(`${z}/sessions/${c}`,{method:"DELETE"}).then(()=>{const w=e.filter(x=>x.session_id!==c);t(w),d(x=>{const _={...x||{}};return delete _[c],_}),n===c&&r(w.length>0?w[0].session_id:null)})}function Pp(c){fetch(`${z}/libraries/${c}`,{method:"DELETE"}).then(async w=>{var _;if(!w.ok){const M=await w.text();throw new Error(M||`HTTP ${w.status}`)}const x=g.filter(M=>M.slug!==c);S(x),C(M=>M.filter(A=>A.slug!==c)),y(M=>M===c?null:M),L===c&&h(((_=x[0])==null?void 0:_.slug)||null),kp(c)}).catch(w=>{console.error("Failed to delete library",w)})}v.useEffect(()=>{const c=e.filter(w=>w.name==="New Chat"&&w.session_id!==n&&w.messages.length===0);c.length>0&&c.forEach(w=>{Ba(w.session_id)})},[n,e,z]);const jp=c=>{var x;window.getSelection().toString().length>0||document.activeElement!==Y.current&&(c.target.closest(".msg")||(x=Y.current)==null||x.focus())};return m.jsxs("div",{className:"app",style:{gridTemplateColumns:`${gp}px 1fr`},children:[m.jsxs("div",{className:"sidebar",children:[m.jsxs("div",{className:"sidebar-header",children:[m.jsx("div",{className:`sidebar-tab ${l==="chats"?"active":""}`,onClick:()=>Yo("chats"),children:"Chats"}),m.jsx("div",{className:`sidebar-tab ${l==="dbs"?"active":""}`,onClick:()=>Yo("dbs"),children:"DBs"}),m.jsx("div",{className:`sidebar-tab ${l==="settings"?"active":""}`,onClick:()=>Yo("settings"),children:"Settings"})]}),m.jsxs("div",{className:"sidebar-content",children:[l==="chats"&&m.jsx("div",{className:"chat-list",children:e.map(c=>m.jsx("div",{className:`chat-item ${c.session_id===n?"active":""}`,onClick:()=>Sp(c.session_id),children:s===c.session_id?m.jsx("input",{type:"text",className:"rename-input",defaultValue:c.name,onBlur:()=>u(null),onKeyDown:w=>{w.key==="Enter"?_p(c.session_id,w.target.value):w.key==="Escape"&&u(null)},autoFocus:!0}):m.jsxs(m.Fragment,{children:[m.jsx("span",{children:c.name}),m.jsxs("div",{className:"chat-item-buttons",children:[lp.includes(c.session_id)&&m.jsx("div",{className:"unread-dot"}),m.jsx("button",{className:"icon-button",onClick:w=>{w.stopPropagation(),u(c.session_id)},children:m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-edit-2",children:m.jsx("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}),m.jsx("button",{className:"icon-button",onClick:w=>{w.stopPropagation(),Ba(c.session_id)},children:m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-x",children:[m.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),m.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})},c.session_id))}),l==="dbs"&&m.jsx("div",{className:"db-list",children:g.length===0?m.jsx("div",{className:"empty-list-message",children:"No databases yet."}):g.map(c=>m.jsx("div",{className:`chat-item ${c.slug===L?"active":""}`,onClick:()=>h(c.slug),children:p===c.slug?m.jsx("input",{type:"text",className:"rename-input",defaultValue:c.name,onBlur:()=>y(null),onKeyDown:w=>{w.key==="Enter"?Lp(c.slug,w.target.value):w.key==="Escape"&&y(null)},autoFocus:!0}):m.jsxs(m.Fragment,{children:[m.jsx("span",{children:c.name}),m.jsxs("div",{className:"chat-item-buttons",children:[Nt===c.slug&&m.jsx("div",{className:"db-active-badge",children:"Chat"}),Oa(c.slug)&&m.jsx("div",{className:"db-active-badge",children:"Syncing"}),m.jsx("button",{className:"icon-button",onClick:w=>{w.stopPropagation(),y(c.slug)},children:m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-edit-2",children:m.jsx("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}),m.jsx("button",{className:"icon-button",onClick:w=>{w.stopPropagation(),Pp(c.slug)},children:m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-x",children:[m.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),m.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})},c.slug))}),l==="settings"&&m.jsxs("div",{className:"settings-list",children:[m.jsx("div",{className:`settings-item ${i==="General"?"active":""}`,onClick:()=>a("General"),children:"General"}),m.jsx("div",{className:`settings-item ${i==="Interface"?"active":""}`,onClick:()=>a("Interface"),children:"Interface"}),m.jsx("div",{className:`settings-item ${i==="Websearch"?"active":""}`,onClick:()=>a("Websearch"),children:"Websearch"})]})]}),l!=="settings"&&m.jsxs("div",{className:"sidebar-footer",children:[l==="chats"&&m.jsx("button",{className:"button new-chat-button",onClick:Ua,children:"New Chat"}),l==="dbs"&&(E?m.jsxs("div",{className:"new-db-form",children:[m.jsx("input",{type:"text",className:"rename-input",value:N,onChange:c=>P(c.target.value),onKeyDown:c=>{c.key==="Enter"?za():c.key==="Escape"&&(j(!1),P(""),B(""))},placeholder:"Database name",autoFocus:!0}),F&&m.jsx("div",{className:"form-error",children:F}),m.jsxs("div",{className:"new-db-actions",children:[m.jsx("button",{className:"button new-db-button",onClick:()=>za(),children:"Create"}),m.jsx("button",{className:"button ghost",onClick:()=>{j(!1),P(""),B("")},children:"Cancel"})]})]}):m.jsx("button",{className:"button new-db-button",onClick:()=>{j(!0),B("")},children:"New Database"}))]}),m.jsx("div",{className:"resizer",onMouseDown:yp})]}),m.jsxs("div",{className:"main-content",children:[l==="chats"&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"header",children:[m.jsxs("strong",{children:["Chat - ",((Ha=e.find(c=>c.session_id===n))==null?void 0:Ha.name)||"New Chat"]}),lt&&m.jsx("span",{className:"header-subtle",children:`DB: ${lt.name}${Jo}`})]}),m.jsx("div",{className:"chat",ref:O,onClick:jp,children:Fn.map((c,w)=>{const x=c.role==="user"&&op===w;return m.jsx("div",{id:c.id,className:"msg "+(c.role==="user"?"user":"assistant")+(x?" editing":""),children:c.role==="assistant"?m.jsxs("div",{className:"assistant-message-wrapper",children:[m.jsx(ry,{content:c.content,streamOutput:kt,sources:c.sources}),!Ut&&m.jsxs("div",{className:"message-options-bar assistant-options",children:[m.jsx("button",{className:"icon-button",title:"Copy message",onClick:()=>Ca(c),children:m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[m.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),m.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}),m.jsx("button",{className:"icon-button",title:"Regenerate response",onClick:()=>_a(w),children:m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:m.jsx("path",{d:"M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.3"})})})]})]}):m.jsxs("div",{className:"user-message-wrapper",children:[x?m.jsxs("div",{className:"msg-content msg-content--user editing",children:[m.jsx("div",{className:"user-edit-shadow","aria-hidden":"true",children:Ho}),m.jsx(ac,{className:"edit-message-input edit-overlay",value:Ho,onChange:_=>fl(_.target.value),onBlur:dl,onKeyDown:_=>{_.key==="Escape"&&(_.preventDefault(),dl()),_.key==="Enter"&&!_.shiftKey&&(_.preventDefault(),ap(w))},autoFocus:!0,minRows:1})]}):(()=>{const _=c.content||"",M=_.split(/\r\n|\r|\n/),A=M.length>30,H=Ta(c,w,n),D=A?fp[H]??!0:!1,V=D?M.slice(0,30).join(` -`)+` -…`:_;return m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"msg-content msg-content--user",children:V}),A&&m.jsx("button",{className:"user-msg-expand",onClick:()=>dp(H),"aria-expanded":D?"false":"true",children:D?"Show entire message":"Collapse"})]})})(),!Ut&&!x&&m.jsxs("div",{className:"message-options-bar user-options",children:[m.jsx("button",{className:"icon-button",title:"Edit message",onClick:()=>sp(w,c.content),children:m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[m.jsx("path",{d:"M12 20h9"}),m.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"})]})}),m.jsx("button",{className:"icon-button",title:"Copy message",onClick:()=>Ca(c),children:m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[m.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),m.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})]})},c.id||w)})},n),ja[n]&&m.jsxs("button",{className:"new-msg-tip",onClick:Ep,title:"Jump to the new message","aria-label":"Jump to the new message",children:["New message",m.jsx("span",{style:{marginLeft:6},children:"↓"})]}),m.jsx("div",{className:"footer",children:m.jsxs("div",{className:"footer-content-wrapper",children:[m.jsx(ac,{ref:Y,className:"input",value:xt,onChange:c=>T(c.target.value),onKeyDown:c=>{c.key==="Enter"&&!c.shiftKey&&(c.preventDefault(),Da())},placeholder:"Ask any question...",maxRows:13}),m.jsxs("div",{className:"footer-tool-group",ref:$,children:[m.jsx("button",{type:"button",className:"db-picker-toggle"+(lt?" active":""),onClick:()=>{n&&le(c=>!c)},title:lt?`Database: ${lt.name}${Jo}`:"Select database for this chat","aria-haspopup":"menu","aria-expanded":U,disabled:!n,children:m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[m.jsx("ellipse",{cx:"12",cy:"5",rx:"8",ry:"3"}),m.jsx("path",{d:"M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5"}),m.jsx("path",{d:"M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6"})]})}),U&&m.jsxs("div",{className:"db-picker-menu",role:"menu",children:[m.jsxs("button",{type:"button",className:"db-picker-option"+(Nt?"":" selected"),onClick:()=>{Aa(n,null),le(!1)},children:[m.jsx("span",{children:"No database"}),!Nt&&m.jsx("span",{className:"db-picker-status",children:"Selected"})]}),g.length===0?m.jsx("div",{className:"db-picker-empty",children:"No databases yet."}):g.map(c=>{var M,A,H;const w=Nt===c.slug,x=Oa(c.slug),_=(M=c.files)!=null&&M.length?(A=c.states)!=null&&A.is_indexed?"Ready":x?"Syncing":"Needs sync":"Empty";return m.jsxs("button",{type:"button",className:"db-picker-option"+(w?" selected":""),disabled:!((H=c.files)!=null&&H.length),onClick:()=>{Aa(n,c.slug),le(!1)},children:[m.jsx("span",{children:c.name}),m.jsx("span",{className:"db-picker-status",children:w?"Selected":_})]},c.slug)})]})]}),m.jsx("button",{type:"button",className:"websearch-toggle"+(ul?" active":""),onClick:Cp,title:"Toggle web search","aria-pressed":ul,children:m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[m.jsx("circle",{cx:"12",cy:"12",r:"10"}),m.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),m.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]})}),m.jsx("button",{className:"button",onClick:Ut?mp:Da,title:Ut?"Cancel generation":"Send","aria-label":Ut?"Cancel generation":"Send",children:Ut?m.jsx("div",{className:"spinner"}):"Send"})]})})]}),l==="dbs"&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"header",children:[m.jsx("strong",{children:(ml==null?void 0:ml.name)||"Databases"}),lt&&m.jsx("span",{className:"header-subtle",children:`Current chat DB: ${lt.name}${Jo}`})]}),m.jsx(ey,{apiBase:z,library:ml,jobs:k,onRefresh:async()=>{await hl(),await bo()}})]}),l==="settings"&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"header",children:m.jsxs("strong",{children:[i," Settings"]})}),i==="General"&&m.jsx(Yv,{onModelChange:rt,streamOutput:kt,onStreamOutputChange:pt}),i==="Interface"&&m.jsx(Zv,{}),i==="Websearch"&&m.jsx(ty,{searxUrl:Et,setSearxUrl:Ct,engines:Je,setEngines:np})]})]})]})}function ay(){return v.useEffect(()=>{window.electronAPI.getSettings().then(e=>{el(e.colorScheme||"Default")})},[]),m.jsx(Me.StrictMode,{children:m.jsx(vv,{children:m.jsx(Yg,{children:m.jsx(Vd,{path:"/",element:m.jsx(sy,{})})})})})}const uy=$d(document.getElementById("root"));uy.render(m.jsx(ay,{})); diff --git a/dist/index.html b/dist/index.html index c57f81c..ce4dac7 100644 --- a/dist/index.html +++ b/dist/index.html @@ -5,7 +5,7 @@ LLM Desktop - +