diff --git a/dist/assets/index-C2JOafdN.js b/dist/assets/index-C2JOafdN.js deleted file mode 100644 index 449c0ee..0000000 --- a/dist/assets/index-C2JOafdN.js +++ /dev/null @@ -1,69 +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 hp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ic={exports:{}},wo={},sc={exports:{}},K={};/** - * @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 Zr=Symbol.for("react.element"),mp=Symbol.for("react.portal"),gp=Symbol.for("react.fragment"),vp=Symbol.for("react.strict_mode"),yp=Symbol.for("react.profiler"),wp=Symbol.for("react.provider"),Sp=Symbol.for("react.context"),xp=Symbol.for("react.forward_ref"),kp=Symbol.for("react.suspense"),Ep=Symbol.for("react.memo"),Cp=Symbol.for("react.lazy"),Ia=Symbol.iterator;function Np(e){return e===null||typeof e!="object"?null:(e=Ia&&e[Ia]||e["@@iterator"],typeof e=="function"?e:null)}var ac={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},uc=Object.assign,cc={};function rr(e,t,n){this.props=e,this.context=t,this.refs=cc,this.updater=n||ac}rr.prototype.isReactComponent={};rr.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")};rr.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function fc(){}fc.prototype=rr.prototype;function Ss(e,t,n){this.props=e,this.context=t,this.refs=cc,this.updater=n||ac}var xs=Ss.prototype=new fc;xs.constructor=Ss;uc(xs,rr.prototype);xs.isPureReactComponent=!0;var Fa=Array.isArray,dc=Object.prototype.hasOwnProperty,ks={current:null},pc={key:!0,ref:!0,__self:!0,__source:!0};function hc(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)dc.call(t,r)&&!pc.hasOwnProperty(r)&&(l[r]=t[r]);var a=arguments.length-2;if(a===1)l.children=n;else if(1>>1,oe=P[le];if(0>>1;lel(sr,W))Tel(En,sr)?(P[le]=En,P[Te]=W,le=Te):(P[le]=sr,P[We]=W,le=We);else if(Tel(En,W))P[le]=En,P[Te]=W,le=Te;else break e}}return H}function l(P,H){var W=P.sortIndex-H.sortIndex;return W!==0?W:P.id-H.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,m=null,v=3,w=!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(P){for(var H=n(u);H!==null;){if(H.callback===null)r(u);else if(H.startTime<=P)r(u),H.sortIndex=H.expirationTime,t(s,H);else break;H=n(u)}}function x(P){if(C=!1,d(P),!k)if(n(s)!==null)k=!0,pe(N);else{var H=n(u);H!==null&&Ee(x,H.startTime-P)}}function N(P,H){k=!1,C&&(C=!1,h(M),M=-1),w=!0;var W=v;try{for(d(H),m=n(s);m!==null&&(!(m.expirationTime>H)||P&&!te());){var le=m.callback;if(typeof le=="function"){m.callback=null,v=m.priorityLevel;var oe=le(m.expirationTime<=H);H=e.unstable_now(),typeof oe=="function"?m.callback=oe:m===n(s)&&r(s),d(H)}else r(s);m=n(s)}if(m!==null)var tn=!0;else{var We=n(u);We!==null&&Ee(x,We.startTime-H),tn=!1}return tn}finally{m=null,v=W,w=!1}}var j=!1,T=null,M=-1,B=5,D=-1;function te(){return!(e.unstable_now()-DP||125le?(P.sortIndex=W,t(u,P),n(s)===null&&P===n(u)&&(C?(h(M),M=-1):C=!0,Ee(x,W-le))):(P.sortIndex=oe,t(s,P),k||w||(k=!0,pe(N))),P},e.unstable_shouldYield=te,e.unstable_wrapCallback=function(P){var H=v;return function(){var W=v;v=H;try{return P.apply(this,arguments)}finally{v=W}}}})(wc);yc.exports=wc;var Fp=yc.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 Op=g,Je=Fp;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"),Ci=Object.prototype.hasOwnProperty,Dp=/^[: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]*$/,Da={},Aa={};function Ap(e){return Ci.call(Aa,e)?!0:Ci.call(Da,e)?!1:Dp.test(e)?Aa[e]=!0:(Da[e]=!0,!1)}function Up(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 Hp(e,t,n,r){if(t===null||typeof t>"u"||Up(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 ke={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ke[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];ke[t]=new Oe(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ke[e]=new Oe(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ke[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){ke[e]=new Oe(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ke[e]=new Oe(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ke[e]=new Oe(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ke[e]=new Oe(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ke[e]=new Oe(e,5,!1,e.toLowerCase(),null,!1,!1)});var Cs=/[\-:]([a-z])/g;function Ns(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(Cs,Ns);ke[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(Cs,Ns);ke[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(Cs,Ns);ke[t]=new Oe(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ke[e]=new Oe(e,1,!1,e.toLowerCase(),null,!1,!1)});ke.xlinkHref=new Oe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ke[e]=new Oe(e,1,!1,e.toLowerCase(),null,!0,!0)});function _s(e,t,n,r){var l=ke.hasOwnProperty(t)?ke[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{bo=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Sr(e):""}function Bp(e){switch(e.tag){case 5:return Sr(e.type);case 16:return Sr("Lazy");case 13:return Sr("Suspense");case 19:return Sr("SuspenseList");case 0:case 2:case 15:return e=Zo(e.type,!1),e;case 11:return e=Zo(e.type.render,!1),e;case 1:return e=Zo(e.type,!0),e;default:return""}}function Li(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 Mn:return"Fragment";case $n:return"Portal";case Ni:return"Profiler";case Ps:return"StrictMode";case _i:return"Suspense";case Pi:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case kc:return(e.displayName||"Context")+".Consumer";case xc:return(e._context.displayName||"Context")+".Provider";case Ls:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Rs:return t=e.displayName||null,t!==null?t:Li(e.type)||"Memo";case Ft:t=e._payload,e=e._init;try{return Li(e(t))}catch{}}return null}function Wp(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 Li(t);case 8:return t===Ps?"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 Xt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Cc(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Vp(e){var t=Cc(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 gl(e){e._valueTracker||(e._valueTracker=Vp(e))}function Nc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Cc(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Yl(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 Ri(e,t){var n=t.checked;return ue({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ha(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Xt(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 _c(e,t){t=t.checked,t!=null&&_s(e,"checked",t,!1)}function ji(e,t){_c(e,t);var n=Xt(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")?Ti(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ti(e,t.type,Xt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ba(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 Ti(e,t,n){(t!=="number"||Yl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var xr=Array.isArray;function Vn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=vl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function zr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Cr={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},Qp=["Webkit","ms","Moz","O"];Object.keys(Cr).forEach(function(e){Qp.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Cr[t]=Cr[e]})});function jc(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Cr.hasOwnProperty(e)&&Cr[e]?(""+t).trim():t+"px"}function Tc(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=jc(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Kp=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 zi(e,t){if(t){if(Kp[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 Ii(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 Fi=null;function js(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Oi=null,Qn=null,Kn=null;function Qa(e){if(e=tl(e)){if(typeof Oi!="function")throw Error(R(280));var t=e.stateNode;t&&(t=Co(t),Oi(e.stateNode,e.type,t))}}function $c(e){Qn?Kn?Kn.push(e):Kn=[e]:Qn=e}function Mc(){if(Qn){var e=Qn,t=Kn;if(Kn=Qn=null,Qa(e),t)for(e=0;e>>=0,e===0?32:31-(rh(e)/lh|0)|0}var yl=64,wl=4194304;function kr(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 bl(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=kr(a):(o&=i,o!==0&&(r=kr(o)))}else i=n&~l,i!==0?r=kr(i):o!==0&&(r=kr(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 qr(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 ah(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=_r),eu=" ",tu=!1;function qc(e,t){switch(e){case"keyup":return Fh.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ef(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var zn=!1;function Dh(e,t){switch(e){case"compositionend":return ef(t);case"keypress":return t.which!==32?null:(tu=!0,eu);case"textInput":return e=t.data,e===eu&&tu?null:e;default:return null}}function Ah(e,t){if(zn)return e==="compositionend"||!Ds&&qc(e,t)?(e=bc(),Il=Is=Ut=null,zn=!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=ou(n)}}function lf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?lf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function of(){for(var e=window,t=Yl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Yl(e.document)}return t}function As(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 Jh(e){var t=of(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&lf(n.ownerDocument.documentElement,n)){if(r!==null&&As(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=iu(n,o);var i=iu(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,In=null,Wi=null,Lr=null,Vi=!1;function su(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Vi||In==null||In!==Yl(r)||(r=In,"selectionStart"in r&&As(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}),Lr&&Ur(Lr,r)||(Lr=r,r=eo(Wi,"onSelect"),0Dn||(e.current=Xi[Dn],Xi[Dn]=null,Dn--)}function Z(e,t){Dn++,Xi[Dn]=e.current,e.current=t}var bt={},je=qt(bt),Ue=qt(!1),hn=bt;function bn(e,t){var n=e.type.contextTypes;if(!n)return bt;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 He(e){return e=e.childContextTypes,e!=null}function no(){ee(Ue),ee(je)}function hu(e,t,n){if(je.current!==bt)throw Error(R(168));Z(je,t),Z(Ue,n)}function mf(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,Wp(e)||"Unknown",l));return ue({},n,r)}function ro(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||bt,hn=je.current,Z(je,e),Z(Ue,Ue.current),!0}function mu(e,t,n){var r=e.stateNode;if(!r)throw Error(R(169));n?(e=mf(e,t,hn),r.__reactInternalMemoizedMergedChildContext=e,ee(Ue),ee(je),Z(je,e)):ee(Ue),Z(Ue,n)}var xt=null,No=!1,di=!1;function gf(e){xt===null?xt=[e]:xt.push(e)}function im(e){No=!0,gf(e)}function en(){if(!di&&xt!==null){di=!0;var e=0,t=b;try{var n=xt;for(b=1;e>=i,l-=i,kt=1<<32-ut(t)+l|n<M?(B=T,T=null):B=T.sibling;var D=v(h,T,d[M],x);if(D===null){T===null&&(T=B);break}e&&T&&D.alternate===null&&t(h,T),f=o(D,f,M),j===null?N=D:j.sibling=D,j=D,T=B}if(M===d.length)return n(h,T),ne&&sn(h,M),N;if(T===null){for(;MM?(B=T,T=null):B=T.sibling;var te=v(h,T,D.value,x);if(te===null){T===null&&(T=B);break}e&&T&&te.alternate===null&&t(h,T),f=o(te,f,M),j===null?N=te:j.sibling=te,j=te,T=B}if(D.done)return n(h,T),ne&&sn(h,M),N;if(T===null){for(;!D.done;M++,D=d.next())D=m(h,D.value,x),D!==null&&(f=o(D,f,M),j===null?N=D:j.sibling=D,j=D);return ne&&sn(h,M),N}for(T=r(h,T);!D.done;M++,D=d.next())D=w(T,h,M,D.value,x),D!==null&&(e&&D.alternate!==null&&T.delete(D.key===null?M:D.key),f=o(D,f,M),j===null?N=D:j.sibling=D,j=D);return e&&T.forEach(function(we){return t(h,we)}),ne&&sn(h,M),N}function L(h,f,d,x){if(typeof d=="object"&&d!==null&&d.type===Mn&&d.key===null&&(d=d.props.children),typeof d=="object"&&d!==null){switch(d.$$typeof){case ml:e:{for(var N=d.key,j=f;j!==null;){if(j.key===N){if(N=d.type,N===Mn){if(j.tag===7){n(h,j.sibling),f=l(j,d.props.children),f.return=h,h=f;break e}}else if(j.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===Ft&&yu(N)===j.type){n(h,j.sibling),f=l(j,d.props),f.ref=gr(h,j,d),f.return=h,h=f;break e}n(h,j);break}else t(h,j);j=j.sibling}d.type===Mn?(f=pn(d.props.children,h.mode,x,d.key),f.return=h,h=f):(x=Wl(d.type,d.key,d.props,null,h.mode,x),x.ref=gr(h,f,d),x.return=h,h=x)}return i(h);case $n:e:{for(j=d.key;f!==null;){if(f.key===j)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=Si(d,h.mode,x),f.return=h,h=f}return i(h);case Ft:return j=d._init,L(h,f,j(d._payload),x)}if(xr(d))return k(h,f,d,x);if(fr(d))return C(h,f,d,x);_l(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=wi(d,h.mode,x),f.return=h,h=f),i(h)):n(h,f)}return L}var qn=Sf(!0),xf=Sf(!1),io=qt(null),so=null,Hn=null,Ws=null;function Vs(){Ws=Hn=so=null}function Qs(e){var t=io.current;ee(io),e._currentValue=t}function qi(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 Jn(e,t){so=e,Ws=Hn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ae=!0),e.firstContext=null)}function tt(e){var t=e._currentValue;if(Ws!==e)if(e={context:e,memoizedValue:t,next:null},Hn===null){if(so===null)throw Error(R(308));Hn=e,so.dependencies={lanes:0,firstContext:e}}else Hn=Hn.next=e;return t}var cn=null;function Ks(e){cn===null?cn=[e]:cn.push(e)}function kf(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Ks(t)):(n.next=l.next,l.next=n),t.interleaved=n,Lt(e,r)}function Lt(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 Ot=!1;function Ys(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ef(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 Ct(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Kt(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,Lt(e,n)}return l=r.interleaved,l===null?(t.next=t,Ks(r)):(t.next=l.next,l.next=t),r.interleaved=t,Lt(e,n)}function Ol(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,$s(e,n)}}function wu(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 ao(e,t,n,r){var l=e.updateQueue;Ot=!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 m=l.baseState;i=0,p=u=s=null,a=o;do{var v=a.lane,w=a.eventTime;if((r&v)===v){p!==null&&(p=p.next={eventTime:w,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var k=e,C=a;switch(v=t,w=n,C.tag){case 1:if(k=C.payload,typeof k=="function"){m=k.call(w,m,v);break e}m=k;break e;case 3:k.flags=k.flags&-65537|128;case 0:if(k=C.payload,v=typeof k=="function"?k.call(w,m,v):k,v==null)break e;m=ue({},m,v);break e;case 2:Ot=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,v=l.effects,v===null?l.effects=[a]:v.push(a))}else w={eventTime:w,lane:v,tag:a.tag,payload:a.payload,callback:a.callback,next:null},p===null?(u=p=w,s=m):p=p.next=w,i|=v;if(a=a.next,a===null){if(a=l.shared.pending,a===null)break;v=a,a=v.next,v.next=null,l.lastBaseUpdate=v,l.shared.pending=null}}while(!0);if(p===null&&(s=m),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);vn|=i,e.lanes=i,e.memoizedState=m}}function Su(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=hi.transition;hi.transition={};try{e(!1),t()}finally{b=n,hi.transition=r}}function Uf(){return nt().memoizedState}function cm(e,t,n){var r=Jt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Hf(e))Bf(t,n);else if(n=kf(e,t,n,r),n!==null){var l=Ie();ct(n,e,r,l),Wf(n,t,r)}}function fm(e,t,n){var r=Jt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Hf(e))Bf(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,Ks(t)):(l.next=s.next,s.next=l),t.interleaved=l;return}}catch{}finally{}n=kf(e,t,l,r),n!==null&&(l=Ie(),ct(n,e,r,l),Wf(n,t,r))}}function Hf(e){var t=e.alternate;return e===se||t!==null&&t===se}function Bf(e,t){Rr=co=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Wf(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$s(e,n)}}var fo={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},dm={readContext:tt,useCallback:function(e,t){return ht().memoizedState=[e,t===void 0?null:t],e},useContext:tt,useEffect:ku,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Al(4194308,4,If.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Al(4194308,4,e,t)},useInsertionEffect:function(e,t){return Al(4,2,e,t)},useMemo:function(e,t){var n=ht();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ht();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=cm.bind(null,se,e),[r.memoizedState,e]},useRef:function(e){var t=ht();return e={current:e},t.memoizedState=e},useState:xu,useDebugValue:ta,useDeferredValue:function(e){return ht().memoizedState=e},useTransition:function(){var e=xu(!1),t=e[0];return e=um.bind(null,e[1]),ht().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=se,l=ht();if(ne){if(n===void 0)throw Error(R(407));n=n()}else{if(n=t(),ye===null)throw Error(R(349));gn&30||Pf(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,ku(Rf.bind(null,r,o,e),[e]),r.flags|=2048,Jr(9,Lf.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=ht(),t=ye.identifierPrefix;if(ne){var n=Et,r=kt;n=(r&~(1<<32-ut(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Kr++,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[mt]=t,e[Wr]=r,qf(e,t,!1,!1),t.stateNode=e;e:{switch(i=Ii(n,r),n){case"dialog":q("cancel",e),q("close",e),l=r;break;case"iframe":case"object":case"embed":q("load",e),l=r;break;case"video":case"audio":for(l=0;lnr&&(t.flags|=128,r=!0,vr(o,!1),t.lanes=4194304)}else{if(!r)if(e=uo(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),vr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!ne)return Le(t),null}else 2*fe()-o.renderingStartTime>nr&&n!==1073741824&&(t.flags|=128,r=!0,vr(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=fe(),t.sibling=null,n=ie.current,Z(ie,r?n&1|2:n&1),t):(Le(t),null);case 22:case 23:return sa(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Qe&1073741824&&(Le(t),t.subtreeFlags&6&&(t.flags|=8192)):Le(t),null;case 24:return null;case 25:return null}throw Error(R(156,t.tag))}function Sm(e,t){switch(Hs(t),t.tag){case 1:return He(t.type)&&no(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return er(),ee(Ue),ee(je),Xs(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Gs(t),null;case 13:if(ee(ie),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(R(340));Zn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ee(ie),null;case 4:return er(),null;case 10:return Qs(t.type._context),null;case 22:case 23:return sa(),null;case 24:return null;default:return null}}var Ll=!1,Re=!1,xm=typeof WeakSet=="function"?WeakSet:Set,$=null;function Bn(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 as(e,t,n){try{n()}catch(r){ce(e,t,r)}}var Mu=!1;function km(e,t){if(Qi=Zl,e=of(),As(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,m=e,v=null;t:for(;;){for(var w;m!==n||l!==0&&m.nodeType!==3||(a=i+l),m!==o||r!==0&&m.nodeType!==3||(s=i+r),m.nodeType===3&&(i+=m.nodeValue.length),(w=m.firstChild)!==null;)v=m,m=w;for(;;){if(m===e)break t;if(v===n&&++u===l&&(a=i),v===o&&++p===r&&(s=i),(w=m.nextSibling)!==null)break;m=v,v=m.parentNode}m=w}n=a===-1||s===-1?null:{start:a,end:s}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ki={focusedElem:e,selectionRange:n},Zl=!1,$=t;$!==null;)if(t=$,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,$=e;else for(;$!==null;){t=$;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(x){ce(t,t.return,x)}if(e=t.sibling,e!==null){e.return=t.return,$=e;break}$=t.return}return k=Mu,Mu=!1,k}function jr(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&&as(t,n,o)}l=l.next}while(l!==r)}}function Lo(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 us(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 nd(e){var t=e.alternate;t!==null&&(e.alternate=null,nd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[mt],delete t[Wr],delete t[Gi],delete t[lm],delete t[om])),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 rd(e){return e.tag===5||e.tag===3||e.tag===4}function zu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||rd(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 cs(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=to));else if(r!==4&&(e=e.child,e!==null))for(cs(e,t,n),e=e.sibling;e!==null;)cs(e,t,n),e=e.sibling}function fs(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(fs(e,t,n),e=e.sibling;e!==null;)fs(e,t,n),e=e.sibling}var Se=null,st=!1;function It(e,t,n){for(n=n.child;n!==null;)ld(e,t,n),n=n.sibling}function ld(e,t,n){if(gt&&typeof gt.onCommitFiberUnmount=="function")try{gt.onCommitFiberUnmount(So,n)}catch{}switch(n.tag){case 5:Re||Bn(n,t);case 6:var r=Se,l=st;Se=null,It(e,t,n),Se=r,st=l,Se!==null&&(st?(e=Se,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Se.removeChild(n.stateNode));break;case 18:Se!==null&&(st?(e=Se,n=n.stateNode,e.nodeType===8?fi(e.parentNode,n):e.nodeType===1&&fi(e,n),Dr(e)):fi(Se,n.stateNode));break;case 4:r=Se,l=st,Se=n.stateNode.containerInfo,st=!0,It(e,t,n),Se=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)&&as(n,t,i),l=l.next}while(l!==r)}It(e,t,n);break;case 1:if(!Re&&(Bn(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)}It(e,t,n);break;case 21:It(e,t,n);break;case 22:n.mode&1?(Re=(r=Re)||n.memoizedState!==null,It(e,t,n),Re=r):It(e,t,n);break;default:It(e,t,n)}}function Iu(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new xm),t.forEach(function(r){var l=Tm.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=fe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Cm(r/1960))-r,10e?16:e,Ht===null)var r=!1;else{if(e=Ht,Ht=null,mo=0,J&6)throw Error(R(331));var l=J;for(J|=4,$=e.current;$!==null;){var o=$,i=o.child;if($.flags&16){var a=o.deletions;if(a!==null){for(var s=0;sfe()-oa?dn(e,0):la|=n),Be(e,t)}function dd(e,t){t===0&&(e.mode&1?(t=wl,wl<<=1,!(wl&130023424)&&(wl=4194304)):t=1);var n=Ie();e=Lt(e,t),e!==null&&(qr(e,t,n),Be(e,n))}function jm(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),dd(e,n)}function Tm(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),dd(e,n)}var pd;pd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ue.current)Ae=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ae=!1,ym(e,t,n);Ae=!!(e.flags&131072)}else Ae=!1,ne&&t.flags&1048576&&vf(t,oo,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Ul(e,t),e=t.pendingProps;var l=bn(t,je.current);Jn(t,n),l=Zs(null,t,r,e,l,n);var o=qs();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,He(r)?(o=!0,ro(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Ys(t),l.updater=Po,t.stateNode=l,l._reactInternals=t,ts(t,r,e,n),t=ls(null,t,r,!0,o,n)):(t.tag=0,ne&&o&&Us(t),ze(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Ul(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Mm(r),e=it(r,e),l){case 0:t=rs(null,t,r,e,n);break e;case 1:t=ju(null,t,r,e,n);break e;case 11:t=Lu(null,t,r,e,n);break e;case 14:t=Ru(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),rs(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:it(r,l),ju(e,t,r,l,n);case 3:e:{if(Xf(t),e===null)throw Error(R(387));r=t.pendingProps,o=t.memoizedState,l=o.element,Ef(e,t),ao(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=tr(Error(R(423)),t),t=Tu(e,t,r,n,l);break e}else if(r!==l){l=tr(Error(R(424)),t),t=Tu(e,t,r,n,l);break e}else for(Ke=Qt(t.stateNode.containerInfo.firstChild),Ye=t,ne=!0,at=null,n=xf(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Zn(),r===l){t=Rt(e,t,n);break e}ze(e,t,r,n)}t=t.child}return t;case 5:return Cf(t),e===null&&Zi(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,i=l.children,Yi(r,l)?i=null:o!==null&&Yi(r,o)&&(t.flags|=32),Gf(e,t),ze(e,t,i,n),t.child;case 6:return e===null&&Zi(t),null;case 13:return bf(e,t,n);case 4:return Js(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=qn(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),Lu(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,Z(io,r._currentValue),r._currentValue=i,o!==null)if(ft(o.value,i)){if(o.children===l.children&&!Ue.current){t=Rt(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=Ct(-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),qi(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),qi(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,Jn(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),Ru(e,t,r,l,n);case 15:return Yf(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:it(r,l),Ul(e,t),t.tag=1,He(r)?(e=!0,ro(t)):e=!1,Jn(t,n),Vf(t,r,l),ts(t,r,l,n),ls(null,t,r,!0,e,n);case 19:return Zf(e,t,n);case 22:return Jf(e,t,n)}throw Error(R(156,t.tag))};function hd(e,t){return Uc(e,t)}function $m(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 $m(e,t,n,r)}function ua(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Mm(e){if(typeof e=="function")return ua(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ls)return 11;if(e===Rs)return 14}return 2}function Gt(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 Wl(e,t,n,r,l,o){var i=2;if(r=e,typeof e=="function")ua(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Mn:return pn(n.children,l,o,t);case Ps:i=8,l|=8;break;case Ni:return e=qe(12,n,t,l|2),e.elementType=Ni,e.lanes=o,e;case _i:return e=qe(13,n,t,l),e.elementType=_i,e.lanes=o,e;case Pi:return e=qe(19,n,t,l),e.elementType=Pi,e.lanes=o,e;case Ec:return jo(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case xc:i=10;break e;case kc:i=9;break e;case Ls:i=11;break e;case Rs:i=14;break e;case Ft: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 pn(e,t,n,r){return e=qe(7,e,r,t),e.lanes=n,e}function jo(e,t,n,r){return e=qe(22,e,r,t),e.elementType=Ec,e.lanes=n,e.stateNode={isHidden:!1},e}function wi(e,t,n){return e=qe(6,e,null,t),e.lanes=n,e}function Si(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=ei(0),this.expirationTimes=ei(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ei(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function ca(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},Ys(o),e}function Im(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(yd)}catch(e){console.error(e)}}yd(),vc.exports=Ge;var wd=vc.exports,Sd,Wu=wd;Sd=Wu.createRoot,Wu.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 Vu="popstate";function Um(e={}){function t(l,o){let{pathname:i="/",search:a="",hash:s=""}=xn(l.location.hash.substring(1));return!i.startsWith("/")&&!i.startsWith(".")&&(i="/"+i),gs("",{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:Xr(o))}function r(l,o){dt(l.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(o)})`)}return Bm(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 Hm(){return Math.random().toString(36).substring(2,10)}function Qu(e,t){return{usr:e.state,key:e.key,idx:t}}function gs(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?xn(t):t,state:n,key:t&&t.key||r||Hm()}}function Xr({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 xn(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 Bm(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 m(){a="POP";let L=p(),h=L==null?null:L-u;u=L,s&&s({action:a,location:C.location,delta:h})}function v(L,h){a="PUSH";let f=gs(C.location,L,h);n&&n(f,L),u=p()+1;let d=Qu(f,u),x=C.createHref(f);try{i.pushState(d,"",x)}catch(N){if(N instanceof DOMException&&N.name==="DataCloneError")throw N;l.location.assign(x)}o&&s&&s({action:a,location:C.location,delta:1})}function w(L,h){a="REPLACE";let f=gs(C.location,L,h);n&&n(f,L),u=p();let d=Qu(f,u),x=C.createHref(f);i.replaceState(d,"",x),o&&s&&s({action:a,location:C.location,delta:0})}function k(L){return Wm(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(Vu,m),s=L,()=>{l.removeEventListener(Vu,m),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:v,replace:w,go(L){return i.go(L)}};return C}function Wm(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:Xr(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function xd(e,t,n="/"){return Vm(e,t,n,!1)}function Vm(e,t,n,r){let l=typeof t=="string"?xn(t):t,o=jt(l.pathname||"/",n);if(o==null)return null;let i=kd(e);Qm(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 m=Nt([r,p.relativePath]),v=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 "${m}".`),kd(i.children,t,v,m,s)),!(i.path==null&&!i.index)&&t.push({path:m,score:Zm(m,i.index),routesMeta:v})};return e.forEach((i,a)=>{var s;if(i.path===""||!((s=i.path)!=null&&s.includes("?")))o(i,a);else for(let u of Ed(i.path))o(i,a,!0,u)}),t}function Ed(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=Ed(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 Qm(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:qm(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var Km=/^:[\w-]+$/,Ym=3,Jm=2,Gm=1,Xm=10,bm=-2,Ku=e=>e==="*";function Zm(e,t){let n=e.split("/"),r=n.length;return n.some(Ku)&&(r+=bm),t&&(r+=Jm),n.filter(l=>!Ku(l)).reduce((l,o)=>l+(Km.test(o)?Ym:o===""?Gm:Xm),r)}function qm(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 eg(e,t,n=!1){let{routesMeta:r}=e,l={},o="/",i=[];for(let a=0;a{if(p==="*"){let k=a[v]||"";i=o.slice(0,o.length-k.length).replace(/(.)\/+$/,"$1")}const w=a[v];return m&&!w?u[p]=void 0:u[p]=(w||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function tg(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 ng(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 jt(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 rg(e,t="/"){let{pathname:n,search:r="",hash:l=""}=typeof e=="string"?xn(e):e;return{pathname:n?n.startsWith("/")?n:lg(n,t):t,search:sg(r),hash:ag(l)}}function lg(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 xi(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 og(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Cd(e){let t=og(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Nd(e,t,n,r=!1){let l;typeof e=="string"?l=xn(e):(l={...e},ae(!l.pathname||!l.pathname.includes("?"),xi("?","pathname","search",l)),ae(!l.pathname||!l.pathname.includes("#"),xi("#","pathname","hash",l)),ae(!l.search||!l.search.includes("#"),xi("#","search","hash",l)));let o=e===""||l.pathname==="",i=o?"/":l.pathname,a;if(i==null)a=n;else{let m=t.length-1;if(!r&&i.startsWith("..")){let v=i.split("/");for(;v[0]==="..";)v.shift(),m-=1;l.pathname=v.join("/")}a=m>=0?t[m]:"/"}let s=rg(l,a),u=i&&i!=="/"&&i.endsWith("/"),p=(o||i===".")&&n.endsWith("/");return!s.pathname.endsWith("/")&&(u||p)&&(s.pathname+="/"),s}var Nt=e=>e.join("/").replace(/\/\/+/g,"/"),ig=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),sg=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,ag=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function ug(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}var _d=["POST","PUT","PATCH","DELETE"];new Set(_d);var cg=["GET",..._d];new Set(cg);var ir=g.createContext(null);ir.displayName="DataRouter";var Io=g.createContext(null);Io.displayName="DataRouterState";g.createContext(!1);var Pd=g.createContext({isTransitioning:!1});Pd.displayName="ViewTransition";var fg=g.createContext(new Map);fg.displayName="Fetchers";var dg=g.createContext(null);dg.displayName="Await";var yt=g.createContext(null);yt.displayName="Navigation";var rl=g.createContext(null);rl.displayName="Location";var $t=g.createContext({outlet:null,matches:[],isDataRoute:!1});$t.displayName="Route";var ha=g.createContext(null);ha.displayName="RouteError";function pg(e,{relative:t}={}){ae(ll(),"useHref() may be used only in the context of a component.");let{basename:n,navigator:r}=g.useContext(yt),{hash:l,pathname:o,search:i}=ol(e,{relative:t}),a=o;return n!=="/"&&(a=o==="/"?n:Nt([n,o])),r.createHref({pathname:a,search:i,hash:l})}function ll(){return g.useContext(rl)!=null}function kn(){return ae(ll(),"useLocation() may be used only in the context of a component."),g.useContext(rl).location}var Ld="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Rd(e){g.useContext(yt).static||g.useLayoutEffect(e)}function hg(){let{isDataRoute:e}=g.useContext($t);return e?Pg():mg()}function mg(){ae(ll(),"useNavigate() may be used only in the context of a component.");let e=g.useContext(ir),{basename:t,navigator:n}=g.useContext(yt),{matches:r}=g.useContext($t),{pathname:l}=kn(),o=JSON.stringify(Cd(r)),i=g.useRef(!1);return Rd(()=>{i.current=!0}),g.useCallback((s,u={})=>{if(dt(i.current,Ld),!i.current)return;if(typeof s=="number"){n.go(s);return}let p=Nd(s,JSON.parse(o),l,u.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:Nt([t,p.pathname])),(u.replace?n.replace:n.push)(p,u.state,u)},[t,n,o,l,e])}g.createContext(null);function ol(e,{relative:t}={}){let{matches:n}=g.useContext($t),{pathname:r}=kn(),l=JSON.stringify(Cd(n));return g.useMemo(()=>Nd(e,JSON.parse(l),r,t==="path"),[e,l,r,t])}function gg(e,t){return jd(e,t)}function jd(e,t,n,r,l){var f;ae(ll(),"useRoutes() may be used only in the context of a component.");let{navigator:o}=g.useContext(yt),{matches:i}=g.useContext($t),a=i[i.length-1],s=a?a.params:{},u=a?a.pathname:"/",p=a?a.pathnameBase:"/",m=a&&a.route;{let d=m&&m.path||"";Td(u,!m||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 v=kn(),w;if(t){let d=typeof t=="string"?xn(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.`),w=d}else w=v;let k=w.pathname||"/",C=k;if(p!=="/"){let d=p.replace(/^\//,"").split("/");C="/"+k.replace(/^\//,"").split("/").slice(d.length).join("/")}let L=xd(e,{pathname:C});dt(m||L!=null,`No routes matched location "${w.pathname}${w.search}${w.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 "${w.pathname}${w.search}${w.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=xg(L&&L.map(d=>Object.assign({},d,{params:Object.assign({},s,d.params),pathname:Nt([p,o.encodeLocation?o.encodeLocation(d.pathname).pathname:d.pathname]),pathnameBase:d.pathnameBase==="/"?p:Nt([p,o.encodeLocation?o.encodeLocation(d.pathnameBase).pathname:d.pathnameBase])})),i,n,r,l);return t&&h?g.createElement(rl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...w},navigationType:"POP"}},h):h}function vg(){let e=_g(),t=ug(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 yg=g.createElement(vg,null),wg=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($t.Provider,{value:this.props.routeContext},g.createElement(ha.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function Sg({routeContext:e,match:t,children:n}){let r=g.useContext(ir);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),g.createElement($t.Provider,{value:e},n)}function xg(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,m)=>{let v,w=!1,k=null,C=null;n&&(v=i&&p.route.id?i[p.route.id]:void 0,k=p.route.errorElement||yg,a&&(s<0&&m===0?(Td("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,C=null):s===m&&(w=!0,C=p.route.hydrateFallbackElement||null)));let L=t.concat(o.slice(0,m+1)),h=()=>{let f;return v?f=k:w?f=C:p.route.Component?f=g.createElement(p.route.Component,null):p.route.element?f=p.route.element:f=u,g.createElement(Sg,{match:p,routeContext:{outlet:u,matches:L,isDataRoute:n!=null},children:f})};return n&&(p.route.ErrorBoundary||p.route.errorElement||m===0)?g.createElement(wg,{location:n.location,revalidation:n.revalidation,component:k,error:v,children:h(),routeContext:{outlet:null,matches:L,isDataRoute:!0},unstable_onError:r}):h()},null)}function ma(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function kg(e){let t=g.useContext(ir);return ae(t,ma(e)),t}function Eg(e){let t=g.useContext(Io);return ae(t,ma(e)),t}function Cg(e){let t=g.useContext($t);return ae(t,ma(e)),t}function ga(e){let t=Cg(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 Ng(){return ga("useRouteId")}function _g(){var r;let e=g.useContext(ha),t=Eg("useRouteError"),n=ga("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function Pg(){let{router:e}=kg("useNavigate"),t=ga("useNavigate"),n=g.useRef(!1);return Rd(()=>{n.current=!0}),g.useCallback(async(l,o={})=>{dt(n.current,Ld),n.current&&(typeof l=="number"?e.navigate(l):await e.navigate(l,{fromRouteId:t,...o}))},[e,t])}var Yu={};function Td(e,t,n){!t&&!Yu[e]&&(Yu[e]=!0,dt(!1,n))}g.memo(Lg);function Lg({routes:e,future:t,state:n,unstable_onError:r}){return jd(e,void 0,n,r,t)}function $d(e){ae(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function Rg({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:l,static:o=!1}){ae(!ll(),"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=xn(n));let{pathname:s="/",search:u="",hash:p="",state:m=null,key:v="default"}=n,w=g.useMemo(()=>{let k=jt(s,i);return k==null?null:{location:{pathname:k,search:u,hash:p,state:m,key:v},navigationType:r}},[i,s,u,p,m,v,r]);return dt(w!=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.`),w==null?null:g.createElement(yt.Provider,{value:a},g.createElement(rl.Provider,{children:t,value:w}))}function jg({children:e,location:t}){return gg(vs(e),t)}function vs(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,vs(r.props.children,o));return}ae(r.type===$d,`[${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=vs(r.props.children,o)),n.push(i)}),n}var Vl="get",Ql="application/x-www-form-urlencoded";function Fo(e){return e!=null&&typeof e.tagName=="string"}function Tg(e){return Fo(e)&&e.tagName.toLowerCase()==="button"}function $g(e){return Fo(e)&&e.tagName.toLowerCase()==="form"}function Mg(e){return Fo(e)&&e.tagName.toLowerCase()==="input"}function zg(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ig(e,t){return e.button===0&&(!t||t==="_self")&&!zg(e)}var Tl=null;function Fg(){if(Tl===null)try{new FormData(document.createElement("form"),0),Tl=!1}catch{Tl=!0}return Tl}var Og=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function ki(e){return e!=null&&!Og.has(e)?(dt(!1,`"${e}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${Ql}"`),null):e}function Dg(e,t){let n,r,l,o,i;if($g(e)){let a=e.getAttribute("action");r=a?jt(a,t):null,n=e.getAttribute("method")||Vl,l=ki(e.getAttribute("enctype"))||Ql,o=new FormData(e)}else if(Tg(e)||Mg(e)&&(e.type==="submit"||e.type==="image")){let a=e.form;if(a==null)throw new Error('Cannot submit a `,k=`
${v}
`;return`
${w}${k}
`}),i=i.replace(/
\s*(?=
]*>[\s\S]*?<\/div>)\s*
/g,"$1"),i}function Iv(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 Fv({content:e,streamOutput:t,sources:n}){const{think:r,answer:l}=Hd(e||""),[o,i]=Me.useState(!1),a=!!r;return y.jsxs("div",{className:"assistant-message",children:[a&&y.jsxs("div",{className:"assistant-thoughts",children:[y.jsxs("button",{className:"think-toggle",onClick:()=>i(s=>!s),"aria-expanded":o?"true":"false","aria-controls":"think-content",children:[y.jsx("span",{className:"think-toggle-icon","aria-hidden":"true",children:o?"▾":"▸"}),"Thoughts"]}),o&&y.jsx("div",{id:"think-content",className:"think-content",dangerouslySetInnerHTML:{__html:rc(r)}})]}),y.jsx("div",{className:"msg-content",dangerouslySetInnerHTML:{__html:rc(l||e||"")}}),Array.isArray(n)&&n.length>0&&y.jsx("div",{className:"msg-sources chips",children:n.map((s,u)=>{let p=s,m=!1;try{const v=new URL(s);if(v.protocol==="file:"){m=!0;const w=v.pathname.split("/").filter(Boolean);p=decodeURIComponent(w[w.length-1]||s)}else p=(v.hostname||s).replace(/^www\./i,"")}catch{}return y.jsx("a",{className:"chip",href:s,target:"_blank",rel:"noreferrer",title:s,onClick:v=>{var w,k;if(m){v.preventDefault();try{const C=new URL(s);(k=(w=window.electronAPI)==null?void 0:w.openPath)==null||k.call(w,decodeURIComponent(C.pathname))}catch{}}},children:p},s+u)})})]})}const lc="websearch.searxUrl",oc="websearch.engines",Ei="chat.librarySlug";let Ov="http://127.0.0.1:8000";const Dv=48,Av=24;function Uv(){var za;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,m]=g.useState(null),[v,w]=g.useState([]),[k,C]=g.useState([]),[L,h]=g.useState(null),[f,d]=g.useState(localStorage.getItem(Ei)||null),[x,N]=g.useState(null),[j,T]=g.useState(!1),[M,B]=g.useState(""),[D,te]=g.useState(""),[we,rt]=g.useState(""),[U,re]=g.useState(""),pe=g.useRef(null),Ee=g.useRef(null),[P,H]=g.useState(Ov),[W,le]=g.useState("Default"),[oe,tn]=g.useState(!1),[We,sr]=g.useState(localStorage.getItem(lc)||"http://localhost:8888"),[Te,En]=g.useState(()=>{try{const c=localStorage.getItem(oc);if(c)return JSON.parse(c)}catch{}return["duckduckgo","bing","wikipedia","github","stack_overflow"]});g.useEffect(()=>{localStorage.setItem(lc,We||"")},[We]),g.useEffect(()=>{try{localStorage.setItem(oc,JSON.stringify(Te||[]))}catch{}},[Te]);const[il,Bd]=g.useState(!1),[Mt,Oo]=g.useState(!1),[Wv,Do]=g.useState(!0),[Wd,Cn]=g.useState([]),[sl,Sa]=g.useState({}),[Vd,Ao]=g.useState(null),[Uo,al]=g.useState("");function Qd(c){const S=c.content||"";if(c.role==="assistant")try{const{answer:E}=Hd(S);return(E||S).trim()}catch{return S.trim()}return S}async function xa(c){try{await navigator.clipboard.writeText(Qd(c))}catch(S){console.error("Failed to copy message:",S)}}function nn(c,S,E,_={}){const{removeIfEmpty:I=!1}=_;t(F=>F.map(A=>{if(A.session_id!==c)return A;const O=[];for(const Q of A.messages||[]){if(Q.id!==S){O.push(Q);continue}I&&!E||O.push({...Q,content:E})}return{...A,messages:O}}))}function rn(c){return(c==null?void 0:c.name)==="AbortError"}function Ho(c){return c instanceof Error&&c.message?c.message:String(c)}function Kd(c,S){Ao(c),al(S||"")}function ul(){Ao(null),al("")}async function Yd(c){var F;const S=(((F=Ln[c])==null?void 0:F.content)||"").trim(),_=(Uo??"").trim();if(_.length===0){ul();return}if(_===S){ul();return}const I=n;if(I){t(A=>A.map(O=>{if(O.session_id!==I)return O;const Ne=(O.messages||[]).slice(0,c+1).map((he,V)=>V===c?{...he,content:_}:he);return{...O,messages:Ne}})),Ao(null),al(""),requestAnimationFrame(()=>Ko("auto",I));try{const A=await fetch(`${P}/sessions/${I}/messages/${c}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:_})});if(!A.ok)throw new Error(`HTTP ${A.status}`)}catch(A){console.error("Failed to update message:",A),t(O=>O.map(Q=>{if(Q.session_id!==I)return Q;const he=(Q.messages||[]).map((V,z)=>z===c?{...V,content:S}:V);return{...Q,messages:he}}));return}await ka(c,_)}}async function ka(c,S=null){var Q,Ne,he,V;const E=n;if(Mt||!E||typeof c!="number")return;const _=((Q=e.find(z=>z.session_id===E))==null?void 0:Q.messages)||[];let I=c;for(let z=c;z>=0;z--)if(((Ne=_[z])==null?void 0:Ne.role)==="user"){I=z;break}t(z=>z.map(X=>X.session_id===E?{...X,messages:(X.messages||[]).slice(0,I+1)}:X));const F=La(E);let A=null,O=[];try{if(il)try{const z=S??(((he=_[I])==null?void 0:he.content)||""),X=_.slice(Math.max(0,I-7),I+1).map(_e=>({role:_e.role,content:_e.content||""}));X.length>0&&(X[X.length-1]={role:"user",content:z});const Y=await(await fetch(`${P}/websearch`,{method:"POST",headers:{"Content-Type":"application/json"},signal:F.signal,body:JSON.stringify({prompt:z,model:we,messages:X,history_limit:8,searx_url:We||null,engines:Array.isArray(Te)?Te:null})})).json();Y&&typeof Y.enriched_prompt=="string"&&(A=Y.enriched_prompt,O=Array.isArray(Y.sources)?Y.sources:[])}catch(z){if(rn(z))throw z;console.warn("web search enrichment (regenerate) failed",z)}if(oe){const z=`msg-${Date.now()}-${Math.random()}`;let X="";t(G=>G.map(Y=>Y.session_id===E?{...Y,messages:[...Y.messages||[],{id:z,role:"assistant",content:"",sources:O}]}:Y));try{const G=await fetch(`${P}/sessions/${E}/regenerate`,{method:"POST",headers:{"Content-Type":"application/json"},signal:F.signal,body:JSON.stringify({index:c,model:we,stream:!0,enriched_message:A,sources:O||[]})});if(!G.ok)throw new Error(`HTTP ${G.status}`);const Y=(V=G.body)==null?void 0:V.getReader();if(!Y)throw new Error("Missing response body");const _e=new TextDecoder;let cr=!1;for(;;){const{value:wt,done:Yo}=await Y.read();if(Yo)break;const Jo=_e.decode(wt,{stream:!0});X+=Jo,nn(E,z,X),!cr&&Ce.current!==E&&(cr=!0,ln(lt=>({...lt,[E]:z})),Cn(lt=>[...new Set([...lt,E])]))}Ce.current!==E?(ln(wt=>({...wt,[E]:z})),Cn(wt=>[...new Set([...wt,E])])):Nn.current[E]?_n(wt=>({...wt,[E]:z})):requestAnimationFrame(()=>jn(z,"smooth",E))}catch(G){if(rn(G)){nn(E,z,X,{removeIfEmpty:!0});return}console.error(G),nn(E,z,`Error: ${Ho(G)}`,{removeIfEmpty:!0});return}}else{const z=await fetch(`${P}/sessions/${E}/regenerate`,{method:"POST",headers:{"Content-Type":"application/json"},signal:F.signal,body:JSON.stringify({index:c,model:we,stream:!1,enriched_message:A,sources:O||[]})});if(!z.ok)throw new Error(`HTTP ${z.status}`);const X=await z.json(),G=`msg-${Date.now()}`;t(Y=>Y.map(_e=>_e.session_id===E?{..._e,messages:[..._e.messages||[],{role:"assistant",content:X.reply,id:G,sources:O}]}:_e)),Ce.current!==E?(ln(Y=>({...Y,[E]:G})),Cn(Y=>[...new Set([...Y,E])])):Nn.current[E]?_n(Y=>({...Y,[E]:G})):requestAnimationFrame(()=>jn(G,"smooth",E))}}catch(z){rn(z)||console.error(z)}finally{Bo(F)}}const[Ea,Jd]=g.useState({}),Nn=g.useRef({}),[Gd,ln]=g.useState({}),on=g.useRef({}),Ca=g.useRef({}),[Na,_n]=g.useState({}),[Xd,_a]=g.useState({}),Pa=(c,S,E)=>c!=null&&c.id?c.id:`${E}:${S}`;g.useEffect(()=>{var S;if(!n)return;const c=((S=e.find(E=>E.session_id===n))==null?void 0:S.messages)||[];_a(E=>{const _={};return c.forEach((I,F)=>{if(I.role!=="user")return;const A=Pa(I,F,n),Q=(I.content||"").split(/\r\n|\r|\n/).length>30;_[A]=Q?E[A]??!0:!1}),_})},[e,n]);function bd(c){_a(S=>({...S,[c]:!(S[c]??!0)}))}const ar=Me.useCallback((c,S)=>{Jd(E=>{const _={...E,[c]:S};return Nn.current=_,_})},[]),Pn=g.useRef(null),Zd=g.useRef(!1),qd=g.useRef(null),Ce=g.useRef(n);g.useEffect(()=>{Ce.current=n},[n]);const La=Me.useCallback(c=>{const S=new AbortController;return Pn.current={controller:S,sessionId:c},Oo(!0),S},[]),Bo=Me.useCallback(c=>{var S;((S=Pn.current)==null?void 0:S.controller)===c&&(Pn.current=null,Oo(!1))},[]),ep=Me.useCallback(()=>{const c=Pn.current;c&&(Pn.current=null,c.controller.abort(),Oo(!1))},[]);g.useEffect(()=>()=>{var c;(c=Pn.current)==null||c.controller.abort()},[]);const zt=g.useRef(null),[tp,np]=g.useState(230),[cl,Ra]=g.useState(!1),rp=Me.useCallback(c=>{Ra(!0)},[]),Wo=Me.useCallback(()=>{Ra(!1)},[]),Vo=Me.useCallback(c=>{if(cl){const S=Math.max(230,Math.min(500,c.clientX));np(S)}},[cl]);Me.useEffect(()=>(window.addEventListener("mousemove",Vo),window.addEventListener("mouseup",Wo),()=>{window.removeEventListener("mousemove",Vo),window.removeEventListener("mouseup",Wo)}),[Vo,Wo]),Me.useEffect(()=>{cl?document.body.classList.add("no-select"):document.body.classList.remove("no-select")},[cl]),Me.useEffect(()=>{const c=async S=>{const E=S.target.closest(".codeblock__copy");if(!E)return;const _=E.closest(".codeblock"),I=_==null?void 0:_.querySelector("pre > code");if(I)try{await navigator.clipboard.writeText(I.textContent||""),E.classList.add("copied"),setTimeout(()=>E.classList.remove("copied"),800)}catch(F){console.error("Copy failed:",F)}};return document.addEventListener("click",c),()=>document.removeEventListener("click",c)},[]),g.useEffect(()=>{window.electronAPI.getSettings().then(S=>{H(S.ollamaApiUrl),le(S.colorScheme||"Default"),rt(S.chatModel||""),tn(S.streamOutput||!1),Sa(S.scrollPositions||{}),br(S.colorScheme||"Default")});const c=()=>{var S;l==="chats"&&((S=Ee.current)==null||S.focus())};return window.electronAPI.onWindowFocus(c),()=>{}},[l]),g.useEffect(()=>{br(W)},[W]);const lp=c=>{!c||!P||fetch(`${P}/history?session_id=${encodeURIComponent(c)}`).then(S=>S.json()).then(S=>{t(E=>E.map(_=>_.session_id===c?{..._,messages:S.messages||[]}:_))}).catch(()=>{})};async function ur(){if(P)try{const S=await(await fetch(`${P}/libraries`)).json(),E=Array.isArray(S.libraries)?S.libraries:[];if(w(E),E.length===0){h(null),d(null),N(null);return}E.some(_=>_.slug===L)||h(E[0].slug),f&&!E.some(_=>_.slug===f)&&d(null),x&&!E.some(_=>_.slug===x)&&N(null)}catch(c){console.warn("Failed to load libraries",c)}}async function fl(){if(P)try{const S=await(await fetch(`${P}/jobs`)).json();C(Array.isArray(S.jobs)?S.jobs:[])}catch(c){console.warn("Failed to load library jobs",c)}}async function op(c,S){const E={method:"POST",headers:{"Content-Type":"application/json"}},_=await fetch(`${P}/libraries/${c}/jobs/${S}`,E);if(!_.ok){const I=await _.text();throw new Error(I||`HTTP ${_.status}`)}await fl()}async function ja(c=null){const E=(typeof c=="string"?c:M).trim();if(!E){te("Name is required.");return}try{te("");const _=await fetch(`${P}/libraries`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:E})});if(!_.ok){const F=await _.text();throw new Error(F||`HTTP ${_.status}`)}const I=await _.json();T(!1),B(""),await ur(),I!=null&&I.slug&&h(I.slug)}catch(_){console.error("Failed to create library",_),te(String((_==null?void 0:_.message)||_))}}g.useEffect(()=>{P&&(Do(!0),fetch(`${P}/sessions`).then(c=>c.json()).then(c=>{const S=c.sessions.map(E=>({...E,messages:[]}));t(S),S.length>0?r(S[0].session_id):r(null),Do(!1)}).catch(()=>{Do(!1)}))},[P]),g.useEffect(()=>{P&&(ur(),fl())},[P]),g.useEffect(()=>{try{f?localStorage.setItem(Ei,f):localStorage.removeItem(Ei)}catch{}},[f]),g.useEffect(()=>{if(!P)return;const c=setInterval(()=>{ur(),fl()},3e3);return()=>clearInterval(c)},[P,l,L,f]),g.useEffect(()=>{lp(n)},[n]);const Qo=c=>{o(c)},ip=c=>{cp(c)},Ln=g.useMemo(()=>{var c;return((c=e.find(S=>S.session_id===n))==null?void 0:c.messages)||[]},[n,e]),dl=g.useMemo(()=>v.find(c=>c.slug===L)||null,[L,v]),Ve=g.useMemo(()=>v.find(c=>c.slug===f)||null,[f,v]),Rn=g.useMemo(()=>v.find(c=>c.slug===x)||null,[x,v]),pl=g.useMemo(()=>Ve||Rn||null,[Ve,Rn]);g.useEffect(()=>{var c,S;f&&Ve&&!((c=Ve.states)!=null&&c.is_indexed)&&((S=Ve.files)!=null&&S.length&&N(f),d(null))},[f,Ve]),g.useEffect(()=>{var I,F;if(!x||!P)return;const c=k.filter(A=>A.slug===x).sort((A,O)=>String(O.created_at||"").localeCompare(String(A.created_at||""))),S=c.some(A=>A.status==="queued"||A.status==="running"),E=c[0]||null;if(!Rn){N(null);return}if((I=Rn.states)!=null&&I.is_indexed){d(x),N(null);return}if(S)return;if((E==null?void 0:E.status)==="failed"){N(null);return}if(!((F=Rn.files)!=null&&F.length)){N(null);return}let _=!1;return(async()=>{try{await op(x,"prepare"),_||await ur()}catch(A){console.error("Failed to prepare library for chat",A),_||N(null)}})(),()=>{_=!0}},[x,Rn,k,P]);async function sp(c){var _,I;const S=typeof c=="string"?c:c==null?void 0:c.slug;if(!S)return;if(f===S||x===S){d(F=>F===S?null:F),N(F=>F===S?null:F);return}const E=v.find(F=>F.slug===S);if(E){if((_=E.states)!=null&&_.is_indexed){d(S),N(null);return}if(!((I=E.files)!=null&&I.length))throw new Error("Add files before adding this database to chat.");N(S)}}g.useEffect(()=>{const c=n,S=l;return()=>{if(S==="chats"&&c){const E=typeof on.current[c]=="number"?on.current[c]:pe.current?pe.current.scrollTop:0;Sa(_=>{const I={..._,[c]:E};return window.electronAPI.updateSettings({scrollPositions:I}),I})}}},[n,l]),g.useEffect(()=>{const c=pe.current;if(!c)return;const S=()=>{const{scrollTop:E,scrollHeight:_,clientHeight:I}=c,F=_-E-I<=Av;if(n){const A=Ca.current[n],O=typeof A=="number"&&Ec.removeEventListener("scroll",S)},[n,ar]),g.useEffect(()=>{const c=n;c&&Ea[c]===!1&&_n(S=>{if(!(c in S))return S;const E={...S};return delete E[c],E})},[n,Ea]),g.useLayoutEffect(()=>{if(l!=="chats"||!n)return;const c=pe.current;if(!c)return;zt.current=null;const S=()=>{if(zt.current===n)return;const A=typeof on.current[n]=="number"?on.current[n]:void 0,O=typeof A=="number"?A:sl[n];if(typeof O=="number"){c.scrollTop=O,zt.current=n;return}Ln.length>0&&(c.scrollTop=c.scrollHeight,zt.current=n)};S();const E=requestAnimationFrame(S),_=()=>{zt.current!==n&&requestAnimationFrame(S)},I=new MutationObserver(_);I.observe(c,{childList:!0,subtree:!0});const F=new ResizeObserver(_);return F.observe(c),()=>{cancelAnimationFrame(E),I.disconnect(),F.disconnect()}},[n,l,Ln.length,sl]),g.useEffect(()=>{if(l!=="chats"||!n||zt.current===n)return;const c=typeof on.current[n]=="number"?on.current[n]:void 0;typeof(typeof c=="number"?c:sl[n])!="number"&&Ln.length>0&&requestAnimationFrame(()=>{const E=pe.current;E&&(E.scrollTop=E.scrollHeight,zt.current=n)})},[Ln.length,n,l,sl]);const Ko=(c="smooth",S=null)=>{const E=pe.current;if(!E)return;const _=S??Ce.current;Ce.current===_&&(E.scrollTo({top:E.scrollHeight,behavior:c}),ar(_,!1))},jn=(c,S="auto",E=null)=>{const _=pe.current;if(!_)return;const I=E??Ce.current;if(Ce.current!==I)return;const F=document.getElementById(c);if(F){const A=Math.max(0,F.offsetTop-Dv);_.scrollTo({top:A,behavior:S})}},ap=()=>{const c=Ce.current,S=Na[c];S&&(jn(S,"smooth",c),_n(E=>{const{[c]:_,...I}=E;return I}))};async function Ta(){var I,F,A;if(Mt||!U.trim()||!we)return;let c=n,S=!1;if(c){const O=e.find(Q=>Q.session_id===c);S=O&&O.name==="New Chat"&&O.messages.length===0}else{const O=await $a();await new Promise(Q=>setTimeout(Q,200)),c=O.session_id,S=!0}const E={role:"user",content:U.trim(),id:`msg-${Date.now()}-${Math.random()}`};Zd.current=!0,qd.current=c,ar(c,!1),Ce.current===c&&(zt.current=Ce.current),wd.flushSync(()=>{t(O=>O.map(Q=>Q.session_id===c?{...Q,messages:[...Q.messages||[],E]}:Q)),re("")}),requestAnimationFrame(()=>Ko("auto",c));const _=La(c);try{let O=[];try{O=[...(((I=e.find(X=>X.session_id===c))==null?void 0:I.messages)||[]).slice(-8).map(X=>({role:X.role,content:X.content||""})),{role:"user",content:E.content}]}catch{}let Q=E.content,Ne=[];const he=[];if(f&&((F=Ve==null?void 0:Ve.states)!=null&&F.is_indexed))try{const z=await(await fetch(`${P}/libraries/${f}/context`,{method:"POST",headers:{"Content-Type":"application/json"},signal:_.signal,body:JSON.stringify({prompt:E.content,top_k:5})})).json();z&&typeof z.context_block=="string"&&z.context_block.trim()&&he.push(z.context_block.trim()),Array.isArray(z==null?void 0:z.sources)&&Ne.push(...z.sources)}catch(V){if(rn(V))throw V;console.warn("local library enrichment failed",V)}if(il)try{const z=await(await fetch(`${P}/websearch`,{method:"POST",headers:{"Content-Type":"application/json"},signal:_.signal,body:JSON.stringify({prompt:E.content,model:we,messages:O,history_limit:8,searx_url:We||null,engines:Array.isArray(Te)?Te:null})})).json();z&&typeof z.context_block=="string"&&z.context_block.trim()&&he.push(z.context_block.trim()),Array.isArray(z==null?void 0:z.sources)&&Ne.push(...z.sources)}catch(V){if(rn(V))throw V;console.warn("web search enrichment failed",V)}if(Ne=[...new Set(Ne)],he.length>0&&(Q=`${E.content} - -${he.join(` - -`)}`),oe){const V=`msg-${Date.now()}-${Math.random()}`;let z="";const X={role:"assistant",content:"",id:V,sources:Ne};t(G=>G.map(Y=>Y.session_id===c?{...Y,messages:[...Y.messages||[],X]}:Y));try{const G=await fetch(`${P}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},signal:_.signal,body:JSON.stringify({session_id:c,model:we,message:E.content,enriched_message:he.length>0?Q:null,stream:!0,sources:Ne||[]})});if(!G.ok)throw new Error(`HTTP ${G.status}`);const Y=(A=G.body)==null?void 0:A.getReader();if(!Y)throw new Error("Missing response body");const _e=new TextDecoder;let cr=!1;for(;;){const{value:wt,done:Yo}=await Y.read();if(Yo){nn(c,V,z),Ce.current===c?Nn.current[c]?_n(lt=>({...lt,[c]:V})):requestAnimationFrame(()=>jn(V,"smooth",c)):(ln(lt=>({...lt,[c]:V})),Cn(lt=>[...new Set([...lt,c])]));break}const Jo=_e.decode(wt,{stream:!0});z+=Jo,nn(c,V,z),Ce.current===c&&!Nn.current[c]&&Ko("auto",c),Ce.current!==c&&!cr&&(ln(lt=>({...lt,[c]:V})),cr=!0)}}catch(G){if(rn(G)){nn(c,V,z,{removeIfEmpty:!0});return}console.error("Failed to send message:",G),nn(c,V,"Error: "+Ho(G),{removeIfEmpty:!0});return}}else{const V=await fetch(`${P}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},signal:_.signal,body:JSON.stringify({session_id:c,model:we,message:E.content,enriched_message:he.length>0?Q:null,stream:!1,sources:Ne||[]})});if(!V.ok)throw new Error(`HTTP ${V.status}`);const z=await V.json(),X=`msg-${Date.now()}`,G={role:"assistant",content:z.reply,id:X,sources:Ne};t(Y=>Y.map(_e=>_e.session_id===c?{..._e,messages:[..._e.messages||[],G]}:_e)),X&&(Ce.current===c?Nn.current[c]?_n(Y=>({...Y,[c]:X})):requestAnimationFrame(()=>jn(X,"smooth",c)):ln(Y=>({...Y,[c]:X})))}Ce.current!==c&&Cn(V=>[...new Set([...V,c])]),S&&fetch(`${P}/generate-title`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:c,message:E.content,model:we})}).then(V=>V.json()).then(V=>{const z=V.title.replace(/[\s\S]*?<\/think(?:ing)?>/i,"").trim();t(X=>X.map(G=>G.session_id===c?{...G,name:z}:G))})}catch(O){if(rn(O)){Bo(_);return}console.error("Failed to send message:",O);const Q={role:"assistant",content:"Error: "+Ho(O),id:`msg-${Date.now()}-${Math.random()}`};t(Ne=>Ne.map(he=>he.session_id===c?{...he,messages:[...he.messages,Q]}:he))}finally{Bo(_)}}function up(){Bd(c=>!c)}async function $a(){var I;const c="sess-"+Math.random().toString(36).slice(2)+Date.now().toString(36),E=await(await fetch(`${P}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:c})})).json(),_={...E,messages:[]};return t(F=>[_,...F]),r(E.session_id),(I=Ee.current)==null||I.focus(),E}function cp(c){r(c),Cn(E=>E.filter(_=>_!==c));const S=Gd[c];S&&requestAnimationFrame(()=>{let E=12;const _=()=>{if(!pe.current)return;let F=document.getElementById(S);if(!F){const A=e.find(O=>O.session_id===c);if(A&&Array.isArray(A.messages))for(let O=A.messages.length-1;O>=0;O--){const Q=A.messages[O];if(Q.role==="assistant"&&Q.id){F=document.getElementById(Q.id);break}}}F?(jn(F.id,"smooth",c),ln(A=>{const{[c]:O,...Q}=A;return Q})):E-- >0&&requestAnimationFrame(_)};requestAnimationFrame(_)})}function fp(c,S){fetch(`${P}/sessions/${c}/rename`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:S})}).then(()=>{t(E=>E.map(_=>_.session_id===c?{..._,name:S}:_)),u(null)})}function dp(c,S){const E=(S||"").trim(),_=v.find(I=>I.slug===c);if(!_){m(null);return}if(!E||E===_.name){m(null);return}fetch(`${P}/libraries/${c}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:E})}).then(()=>{w(I=>I.map(F=>F.slug===c?{...F,name:E}:F)),m(null)})}function Ma(c){fetch(`${P}/sessions/${c}`,{method:"DELETE"}).then(()=>{const S=e.filter(E=>E.session_id!==c);t(S),n===c&&r(S.length>0?S[0].session_id:null)})}g.useEffect(()=>{const c=e.filter(S=>S.name==="New Chat"&&S.session_id!==n&&S.messages.length===0);c.length>0&&c.forEach(S=>{Ma(S.session_id)})},[n,e,P]);const pp=c=>{var E;window.getSelection().toString().length>0||document.activeElement!==Ee.current&&(c.target.closest(".msg")||(E=Ee.current)==null||E.focus())};return y.jsxs("div",{className:"app",style:{gridTemplateColumns:`${tp}px 1fr`},children:[y.jsxs("div",{className:"sidebar",children:[y.jsxs("div",{className:"sidebar-header",children:[y.jsx("div",{className:`sidebar-tab ${l==="chats"?"active":""}`,onClick:()=>Qo("chats"),children:"Chats"}),y.jsx("div",{className:`sidebar-tab ${l==="dbs"?"active":""}`,onClick:()=>Qo("dbs"),children:"DBs"}),y.jsx("div",{className:`sidebar-tab ${l==="settings"?"active":""}`,onClick:()=>Qo("settings"),children:"Settings"})]}),y.jsxs("div",{className:"sidebar-content",children:[l==="chats"&&y.jsx("div",{className:"chat-list",children:e.map(c=>y.jsx("div",{className:`chat-item ${c.session_id===n?"active":""}`,onClick:()=>ip(c.session_id),children:s===c.session_id?y.jsx("input",{type:"text",className:"rename-input",defaultValue:c.name,onBlur:()=>u(null),onKeyDown:S=>{S.key==="Enter"?fp(c.session_id,S.target.value):S.key==="Escape"&&u(null)},autoFocus:!0}):y.jsxs(y.Fragment,{children:[y.jsx("span",{children:c.name}),y.jsxs("div",{className:"chat-item-buttons",children:[Wd.includes(c.session_id)&&y.jsx("div",{className:"unread-dot"}),y.jsx("button",{className:"icon-button",onClick:S=>{S.stopPropagation(),u(c.session_id)},children:y.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:y.jsx("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}),y.jsx("button",{className:"icon-button",onClick:S=>{S.stopPropagation(),Ma(c.session_id)},children:y.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:[y.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),y.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})},c.session_id))}),l==="dbs"&&y.jsx("div",{className:"db-list",children:v.length===0?y.jsx("div",{className:"empty-list-message",children:"No databases yet."}):v.map(c=>y.jsx("div",{className:`chat-item ${c.slug===L?"active":""}`,onClick:()=>h(c.slug),children:p===c.slug?y.jsx("input",{type:"text",className:"rename-input",defaultValue:c.name,onBlur:()=>m(null),onKeyDown:S=>{S.key==="Enter"?dp(c.slug,S.target.value):S.key==="Escape"&&m(null)},autoFocus:!0}):y.jsxs(y.Fragment,{children:[y.jsx("span",{children:c.name}),y.jsxs("div",{className:"chat-item-buttons",children:[f===c.slug&&y.jsx("div",{className:"db-active-badge",children:"Chat"}),x===c.slug&&y.jsx("div",{className:"db-active-badge",children:"Preparing"}),y.jsx("button",{className:"icon-button",onClick:S=>{S.stopPropagation(),m(c.slug)},children:y.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:y.jsx("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})})]})]})},c.slug))}),l==="settings"&&y.jsxs("div",{className:"settings-list",children:[y.jsx("div",{className:`settings-item ${i==="General"?"active":""}`,onClick:()=>a("General"),children:"General"}),y.jsx("div",{className:`settings-item ${i==="Interface"?"active":""}`,onClick:()=>a("Interface"),children:"Interface"}),y.jsx("div",{className:`settings-item ${i==="Websearch"?"active":""}`,onClick:()=>a("Websearch"),children:"Websearch"})]})]}),l!=="settings"&&y.jsxs("div",{className:"sidebar-footer",children:[l==="chats"&&y.jsx("button",{className:"button new-chat-button",onClick:$a,children:"New Chat"}),l==="dbs"&&(j?y.jsxs("div",{className:"new-db-form",children:[y.jsx("input",{type:"text",className:"rename-input",value:M,onChange:c=>B(c.target.value),onKeyDown:c=>{c.key==="Enter"?ja():c.key==="Escape"&&(T(!1),B(""),te(""))},placeholder:"Database name",autoFocus:!0}),D&&y.jsx("div",{className:"form-error",children:D}),y.jsxs("div",{className:"new-db-actions",children:[y.jsx("button",{className:"button new-db-button",onClick:()=>ja(),children:"Create"}),y.jsx("button",{className:"button ghost",onClick:()=>{T(!1),B(""),te("")},children:"Cancel"})]})]}):y.jsx("button",{className:"button new-db-button",onClick:()=>{T(!0),te("")},children:"New Database"}))]}),y.jsx("div",{className:"resizer",onMouseDown:rp})]}),y.jsxs("div",{className:"main-content",children:[l==="chats"&&y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"header",children:[y.jsxs("strong",{children:["Chat - ",((za=e.find(c=>c.session_id===n))==null?void 0:za.name)||"New Chat"]}),pl&&y.jsx("span",{className:"header-subtle",children:Ve?`DB: ${Ve.name}`:`DB: ${pl.name} (preparing)`})]}),y.jsx("div",{className:"chat",ref:pe,onClick:pp,children:Ln.map((c,S)=>{const E=c.role==="user"&&Vd===S;return y.jsx("div",{id:c.id,className:"msg "+(c.role==="user"?"user":"assistant")+(E?" editing":""),children:c.role==="assistant"?y.jsxs("div",{className:"assistant-message-wrapper",children:[y.jsx(Fv,{content:c.content,streamOutput:oe,sources:c.sources}),!Mt&&y.jsxs("div",{className:"message-options-bar assistant-options",children:[y.jsx("button",{className:"icon-button",title:"Copy message",onClick:()=>xa(c),children:y.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:[y.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),y.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}),y.jsx("button",{className:"icon-button",title:"Regenerate response",onClick:()=>ka(S),children:y.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:y.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"})})})]})]}):y.jsxs("div",{className:"user-message-wrapper",children:[E?y.jsxs("div",{className:"msg-content msg-content--user editing",children:[y.jsx("div",{className:"user-edit-shadow","aria-hidden":"true",children:Uo}),y.jsx(ec,{className:"edit-message-input edit-overlay",value:Uo,onChange:_=>al(_.target.value),onBlur:ul,onKeyDown:_=>{_.key==="Escape"&&(_.preventDefault(),ul()),_.key==="Enter"&&!_.shiftKey&&(_.preventDefault(),Yd(S))},autoFocus:!0,minRows:1})]}):(()=>{const _=c.content||"",I=_.split(/\r\n|\r|\n/),F=I.length>30,A=Pa(c,S,n),O=F?Xd[A]??!0:!1,Q=O?I.slice(0,30).join(` -`)+` -…`:_;return y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"msg-content msg-content--user",children:Q}),F&&y.jsx("button",{className:"user-msg-expand",onClick:()=>bd(A),"aria-expanded":O?"false":"true",children:O?"Show entire message":"Collapse"})]})})(),!Mt&&!E&&y.jsxs("div",{className:"message-options-bar user-options",children:[y.jsx("button",{className:"icon-button",title:"Edit message",onClick:()=>Kd(S,c.content),children:y.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:[y.jsx("path",{d:"M12 20h9"}),y.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"})]})}),y.jsx("button",{className:"icon-button",title:"Copy message",onClick:()=>xa(c),children:y.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:[y.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),y.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||S)})},n),Na[n]&&y.jsxs("button",{className:"new-msg-tip",onClick:ap,title:"Jump to the new message","aria-label":"Jump to the new message",children:["New message",y.jsx("span",{style:{marginLeft:6},children:"↓"})]}),y.jsx("div",{className:"footer",children:y.jsxs("div",{className:"footer-content-wrapper",children:[y.jsx(ec,{ref:Ee,className:"input",value:U,onChange:c=>re(c.target.value),onKeyDown:c=>{c.key==="Enter"&&!c.shiftKey&&(c.preventDefault(),Ta())},placeholder:"Ask any question...",maxRows:13}),y.jsx("button",{type:"button",className:"websearch-toggle"+(il?" active":""),onClick:up,title:"Toggle web search","aria-pressed":il,children:y.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:[y.jsx("circle",{cx:"12",cy:"12",r:"10"}),y.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),y.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"})]})}),y.jsx("button",{className:"button",onClick:Mt?ep:Ta,title:Mt?"Cancel generation":"Send","aria-label":Mt?"Cancel generation":"Send",children:Mt?y.jsx("div",{className:"spinner"}):"Send"})]})})]}),l==="dbs"&&y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"header",children:[y.jsx("strong",{children:(dl==null?void 0:dl.name)||"Databases"}),pl&&y.jsx("span",{className:"header-subtle",children:Ve?`Chat DB: ${Ve.name}`:`Chat DB: ${pl.name} (preparing)`})]}),y.jsx(Mv,{apiBase:P,library:dl,jobs:k,chatLibrarySlug:f,pendingChatLibrarySlug:x,onRefresh:async()=>{await ur(),await fl()},onToggleChatLibrary:sp,onDeleted:c=>{if(L===c){const S=v.find(E=>E.slug!==c);h((S==null?void 0:S.slug)||null)}f===c&&d(null),x===c&&N(null)}})]}),l==="settings"&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"header",children:y.jsxs("strong",{children:[i," Settings"]})}),i==="General"&&y.jsx(Pv,{onModelChange:rt,streamOutput:oe,onStreamOutputChange:tn}),i==="Interface"&&y.jsx(Tv,{}),i==="Websearch"&&y.jsx(zv,{searxUrl:We,setSearxUrl:sr,engines:Te,setEngines:En})]})]})]})}function Hv(){return g.useEffect(()=>{window.electronAPI.getSettings().then(e=>{br(e.colorScheme||"Default")})},[]),y.jsx(Me.StrictMode,{children:y.jsx(qg,{children:y.jsx(jg,{children:y.jsx($d,{path:"/",element:y.jsx(Uv,{})})})})})}const Bv=Sd(document.getElementById("root"));Bv.render(y.jsx(Hv,{})); diff --git a/dist/assets/index-Cc0DLWqA.css b/dist/assets/index-Cc0DLWqA.css deleted file mode 100644 index 0502232..0000000 --- a/dist/assets/index-Cc0DLWqA.css +++ /dev/null @@ -1 +0,0 @@ -:root{--bg: #0b1020;--panel: #141b34;--text: #e6e8ef;--muted: #9aa3b2;--accent: #6ea8fe;--border: #24304f}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{background:var(--bg);color:var(--text);font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Inter,Helvetica,Arial}.no-select{-webkit-user-select:none;user-select:none;cursor:ew-resize!important}.app{display:grid;grid-template-columns:var(--sidebar-width, 230px) 1fr;grid-template-rows:1fr;height:100%}.sidebar{display:grid;grid-template-rows:auto 1fr auto;background:var(--panel);border-right:1px solid var(--border);height:100vh;overflow:hidden;position:relative}.sidebar span{font-size:14px}.resizer{width:13px;cursor:ew-resize;background:transparent;position:absolute;top:0;right:-5px;bottom:0;z-index:1}.sidebar-header{display:flex;justify-content:space-around;padding:0;background:var(--panel)}.sidebar-tab{flex-grow:1;text-align:center;padding:11px 16px;cursor:pointer;border-bottom:3px solid transparent;transition:background-color .2s ease}.sidebar-tab:hover{background-color:var(--hover-bg)}.sidebar-tab.active{background-color:var(--active-bg);border-bottom-color:var(--accent)}.sidebar-tab.active:hover{background-color:var(--active-bg)}.sidebar-content{flex-grow:1;overflow-y:auto}.db-list,.settings-list{padding:8px 0}.empty-list-message{padding:10px 16px;color:var(--muted);text-align:center}.settings-item{padding:10px 16px;cursor:pointer;border-left:3px solid transparent}.settings-item.active{background:var(--active-bg);border-left-color:var(--accent)}.settings-item.active:hover{background:var(--active-bg)}.settings-item:hover{background:var(--hover-bg)}.settings-footer-placeholder{height:40px;padding:12px 16px;border-top:1px solid var(--border);background:var(--panel)}.new-db-button{width:100%;padding:10px;background:var(--accent);border-color:var(--accent);color:var(--bg);font-weight:700}.new-db-button:hover{opacity:.9}.chat-list{overflow-y:auto;padding:8px 0}.chat-item{display:flex;justify-content:space-between;align-items:center;padding:10px 16px;cursor:pointer;border-left:3px solid transparent;overflow:hidden;white-space:nowrap}.chat-item span{flex-grow:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-item-buttons{display:flex;gap:8px;align-items:center}.unread-dot{width:8px;height:8px;background-color:red;border-radius:50%;margin-right:4px}.icon-button{background:none;border:none;color:var(--muted);cursor:pointer;font-size:16px;padding:0;display:flex;align-items:center;justify-content:center}.icon-button svg{width:16px;height:16px;stroke:var(--muted);transition:stroke .2s ease}.icon-button:hover svg{stroke:var(--accent)}.icon-button:hover{color:var(--accent)}.chat-item.active{background:var(--active-bg);border-left-color:var(--accent)}.chat-item:hover{background:var(--hover-bg)}.chat-item.active:hover{background:var(--active-bg)}.rename-input{background:var(--input-bg);border:1px solid var(--accent);color:var(--text);border-radius:10px;padding:8px 12px;outline:none;width:100%}::-webkit-scrollbar{width:8px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:var(--muted);border-radius:4px}::-webkit-scrollbar-thumb:hover{background:var(--accent)}.sidebar-footer{padding:12px 16px;background:var(--panel)}.new-db-form,.library-inline-form{display:grid;gap:8px}.new-db-actions{display:flex;gap:8px}.form-error{color:#ff9aa8;font-size:12px}.new-chat-button{width:100%;padding:10px;background:var(--accent);border-color:var(--accent);color:var(--bg);font-weight:700}.new-chat-button:hover{opacity:.9}.main-content{position:relative;display:grid;grid-template-rows:auto 1fr auto;height:100vh;overflow:hidden}.header{display:flex;align-items:center;gap:12px;padding:12px 16px;border-bottom:1px solid var(--border);background:var(--panel)}.select,.input,.button{background:var(--input-bg);border:1px solid var(--border);color:var(--text);border-radius:10px;padding:8px 12px;outline:none}.footer-content-wrapper .button{flex-shrink:0}.select{min-width:220px}.button{cursor:pointer}.button:hover{border-color:var(--accent)}.button.ghost{background:transparent}.button.danger{border-color:#8f3d49;color:#ffb8c2}.button.danger:hover{border-color:#d86a79}.header-subtle{color:var(--muted);font-size:13px}.chat{display:grid;grid-template-columns:1fr minmax(auto,1000px) 1fr;align-content:start;gap:8px;padding:16px;overflow:auto}.chat>*{grid-column:2}.msg{padding:12px 14px;border-radius:12px;line-height:1.5;white-space:wrap;font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Inter,Helvetica,Arial}textarea.input{resize:none;font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Inter,Helvetica,Arial;overflow-y:auto;flex-grow:1}.msg.user{background:var(--user-msg-bg);margin-left:auto;max-width:80%;border:1px solid var(--border);margin-right:5px;margin-bottom:15px;transition:border-color .15s ease,box-shadow .15s ease}.msg.user.editing{border-color:var(--accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--accent) 35%,transparent)}.msg.user .msg-content--user{white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;position:relative}.msg.user .user-msg-expand{margin-top:8px;padding:0;background:transparent;border:none;color:var(--muted);font-weight:700;cursor:pointer;align-self:flex-start;margin-left:0;text-align:left}.msg.assistant{background:transparent;border:none;max-width:none;animation:fadeIn .3s ease-in-out;margin-bottom:30px}.user-message-wrapper{display:flex;flex-direction:column;align-items:flex-end;position:relative}.assistant-message-wrapper{display:flex;flex-direction:column;align-items:flex-start;position:relative}.message-options-bar{display:flex;gap:2px;padding:0;border-radius:8px;background-color:transparent;border:none;position:absolute;bottom:-30px}.user-options{right:-10px;bottom:-40px}.assistant-options{left:0}.message-options-bar .icon-button{padding:4px;border-radius:4px;border:none}.message-options-bar .icon-button:hover{background-color:var(--hover-bg)}.new-msg-tip{position:absolute;right:24px;bottom:84px;padding:8px 12px;border-radius:9999px;background:var(--accent);color:var(--bg);border:none;cursor:pointer;font-weight:600;box-shadow:0 6px 20px #00000059}.new-msg-tip:hover{opacity:.9}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.footer{display:flex;justify-content:center;padding:12px 16px;border-top:1px solid var(--border);background:var(--panel);align-items:flex-end}.footer-content-wrapper{display:flex;gap:8px;width:100%;max-width:1000px;align-items:flex-end}.settings-content-panel{padding:20px;overflow-y:auto;height:100%}.settings-category{margin-bottom:30px}.settings-category h2{color:var(--accent);margin-bottom:15px;font-size:1.3em}.setting-section{margin-bottom:20px;padding:15px;border-bottom:1px solid var(--border);background-color:var(--panel);border-radius:8px}.setting-section:last-child{border-bottom:none;margin-bottom:0}.setting-section h3{color:var(--text);margin-top:0;margin-bottom:10px;font-size:1.1em}.settings-content-panel .input,.settings-content-panel .select{width:100%;max-width:400px;padding:10px 12px;border-radius:8px;border:1px solid var(--border);background-color:var(--input-bg);color:var(--text);font-size:1em}.settings-content-panel .select{min-width:unset}.setting-control-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.range-input{width:min(360px,100%);accent-color:var(--accent)}.setting-value{min-width:48px;color:var(--text);font-variant-numeric:tabular-nums}.setting-description{margin:10px 0 0;color:var(--muted);line-height:1.5}.msg h1,.msg h2,.msg h3,.msg h4{margin:10px 0;color:var(--accent)}.msg blockquote{border-left:4px solid var(--accent);padding-left:15px;margin-left:0;color:var(--muted)}.msg ul{padding-left:20px}.msg li{margin-bottom:5px}.msg code{background-color:var(--input-bg);padding:2px 4px;border-radius:4px;font-family:monospace}.msg pre{background-color:var(--input-bg);padding:10px;border-radius:8px;overflow-x:auto;white-space:pre-wrap}.msg pre code{padding:0;background-color:transparent}.msg a{color:var(--text);display:inline-flex;align-items:center;gap:4px;position:relative;text-decoration:underline dotted;text-underline-offset:3px}.msg a .tooltip{visibility:hidden;width:auto;background-color:var(--panel);color:var(--text);text-align:center;border-radius:6px;padding:5px 10px;position:absolute;z-index:1;bottom:110%;left:50%;transform:translate(-50%);opacity:0;transition:opacity .3s;white-space:nowrap}.msg a:hover .tooltip{visibility:visible;opacity:1}.msg a:hover{color:var(--accent)}.msg a svg{width:14px;height:14px;stroke:var(--text);transition:stroke .2s ease}.msg a:hover svg{stroke:var(--accent)}.msg hr{border:none;border-top:1px solid var(--border);margin:20px 0}:root{--outline-w: 1px;--grid-w: 1px;--grid: var(--border)}.msg table.nice{border-collapse:separate;border-spacing:0;width:100%;margin:1rem 0;border-radius:12px;box-shadow:0 0 0 var(--outline-w) var(--border)}.msg table.nice th,.msg table.nice td{border:var(--grid-w) solid var(--grid);border-width:.5px;padding:.6rem .75rem;vertical-align:top}.msg table.nice thead tr:first-child th{border-top:0}.msg table.nice tr th:first-child,.msg table.nice tr td:first-child{border-left:0}.msg table.nice tr th:last-child,.msg table.nice tr td:last-child{border-right:0}.msg table.nice tbody tr:last-child td{border-bottom:0}.msg table.nice thead tr:first-child th{background-color:var(--panel)}.msg table.nice thead tr:first-child th:first-child{border-top-left-radius:12px;background-clip:padding-box}.msg table.nice thead tr:first-child th:last-child{border-top-right-radius:12px;background-clip:padding-box}.msg table.nice tbody tr:last-child td:first-child{border-bottom-left-radius:12px;background-clip:padding-box}.msg table.nice tbody tr:last-child td:last-child{border-bottom-right-radius:12px;background-clip:padding-box}.toggle-switch{position:relative;display:inline-block;width:50px;height:28px}.toggle-switch input{opacity:0;width:0;height:0}.slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:var(--input-bg);border:1px solid var(--border);transition:.4s;border-radius:28px}.slider:before{position:absolute;content:"";height:20px;width:20px;left:3px;bottom:3px;background-color:var(--muted);transition:.4s;border-radius:50%}input:checked+.slider{background-color:var(--accent)}input:checked+.slider:before{transform:translate(22px);background-color:var(--panel)}.spinner{border:3px solid rgba(255,255,255,.3);border-radius:50%;border-top:3px solid var(--accent);width:20px;height:20px;animation:spin 1s linear infinite;margin:0 auto}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.codeblock{border:1px solid var(--grid, #e5e7eb);border-radius:12px;overflow:hidden;margin:1rem 0}.codeblock__header{display:flex;align-items:center;justify-content:space-between;padding:.5rem .75rem;background:var(--panel);border-bottom:1px solid var(--grid);font-weight:600;font-size:.875rem}.codeblock__lang{opacity:.9}.codeblock__copy{display:inline-flex;align-items:center;gap:.25rem;border:0;background:transparent;padding:.25rem;border-radius:8px;cursor:pointer}.codeblock__copy:hover{background:#0000000f}.codeblock__copy.copied .icon-copy{transform:scale(1.05)}.codeblock__pre{margin:0;padding:.75rem;overflow:auto}.codeblock__code{display:block;white-space:pre}.assistant-message{display:block}.assistant-thoughts{margin-bottom:8px}.think-toggle{background:var(--active-bg);color:var(--muted);border:1px solid var(--border);border-radius:10px;font-size:12px;padding:4px 8px;cursor:pointer}.think-toggle:hover{color:var(--text);border-color:var(--accent)}.think-toggle-icon{display:inline-block;margin-right:6px}.think-content{margin-top:8px;padding:10px 12px;border:1px solid var(--border);border-radius:12px;background:var(--panel);color:var(--muted);font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:13px;line-height:1.5;overflow-x:auto;white-space:pre-wrap}.edit-message-input{display:block;width:100%;height:100%;background:transparent;border:0;padding:0;margin:0;color:inherit;font:inherit;line-height:inherit;letter-spacing:inherit;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;resize:none;overflow:hidden;outline:none}.edit-message-input:focus{border-color:var(--accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--accent) 35%,transparent)}.user-edit-shadow{visibility:hidden;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word}.edit-message-input.edit-overlay{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;background:transparent;border:0;padding:0;margin:0;color:inherit;font:inherit;line-height:inherit;letter-spacing:inherit;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;resize:none;overflow:hidden;outline:none;box-shadow:none}.websearch-toggle{background:transparent;border:0;padding:0;margin:0 .1rem 0 0;line-height:0;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;position:relative;top:-7.5px;color:var(--muted);box-shadow:none;outline:none;-webkit-tap-highlight-color:transparent}.websearch-toggle svg{width:20px;height:20px;pointer-events:none}.websearch-toggle.active{color:var(--accent)}.websearch-toggle:focus,.websearch-toggle:focus-visible{outline:none;box-shadow:none}.msg-sources{margin-top:8px;font-size:12px;color:var(--muted)}.msg-sources a{color:var(--accent);text-decoration:none;margin-right:8px}.msg-sources a:hover{text-decoration:underline}.msg-sources.chips{display:flex;flex-wrap:wrap;margin:.5rem 0}.msg-sources.chips .chip{display:inline-flex;align-items:center;padding:.25rem .6rem;border-radius:9999px;border:1px solid var(--border);text-decoration:none;font-size:.85rem;line-height:1;white-space:nowrap;margin-top:.5rem}.db-active-badge{margin-left:8px;padding:2px 8px;border-radius:999px;background:color-mix(in srgb,var(--accent) 20%,transparent);color:var(--accent);font-size:11px}.placeholder-view,.library-panel{overflow:auto;padding:20px}.placeholder-view h1{margin-top:0}.library-toolbar{display:flex;flex-wrap:wrap;gap:10px;margin-bottom:18px}.library-states{display:flex;flex-wrap:wrap;gap:10px;margin-bottom:14px}.state-pill{padding:6px 10px;border-radius:999px;border:1px solid var(--border);color:var(--muted);font-size:13px}.state-pill.ready{color:var(--text);border-color:color-mix(in srgb,var(--accent) 45%,var(--border))}.library-chat-note,.job-card{margin-bottom:12px;padding:12px 14px;border-radius:12px;background:color-mix(in srgb,var(--panel) 82%,black);border:1px solid var(--border)}.library-inline-form{margin-bottom:14px;padding:12px 14px;border-radius:12px;border:1px solid var(--border);background:color-mix(in srgb,var(--panel) 88%,black)}.danger-zone{border-color:#8f3d49}.library-files h2{margin:18px 0 12px;font-size:16px}.library-file-list{display:grid;gap:10px}.library-file-row{display:flex;justify-content:space-between;gap:14px;align-items:flex-start;padding:12px 14px;border-radius:12px;border:1px solid var(--border);background:color-mix(in srgb,var(--panel) 88%,black)}.library-file-meta{min-width:0}.library-file-name{font-weight:600;margin-bottom:4px}.library-file-path,.muted-copy{color:var(--muted);font-size:13px;word-break:break-word}.library-file-actions{display:flex;gap:8px;flex-shrink:0} diff --git a/dist/assets/index-HsqF-Zwv.css b/dist/assets/index-HsqF-Zwv.css new file mode 100644 index 0000000..c7120ec --- /dev/null +++ b/dist/assets/index-HsqF-Zwv.css @@ -0,0 +1 @@ +:root{--bg: #0b1020;--panel: #141b34;--text: #e6e8ef;--muted: #9aa3b2;--accent: #6ea8fe;--border: #24304f}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{background:var(--bg);color:var(--text);font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Inter,Helvetica,Arial}.no-select{-webkit-user-select:none;user-select:none;cursor:ew-resize!important}.app{display:grid;grid-template-columns:var(--sidebar-width, 230px) 1fr;grid-template-rows:1fr;height:100%}.sidebar{display:grid;grid-template-rows:auto 1fr auto;background:var(--panel);border-right:1px solid var(--border);height:100vh;overflow:hidden;position:relative}.sidebar span{font-size:14px}.resizer{width:13px;cursor:ew-resize;background:transparent;position:absolute;top:0;right:-5px;bottom:0;z-index:1}.sidebar-header{display:flex;justify-content:space-around;padding:0;background:var(--panel)}.sidebar-tab{flex-grow:1;text-align:center;padding:11px 16px;cursor:pointer;border-bottom:3px solid transparent;transition:background-color .2s ease}.sidebar-tab:hover{background-color:var(--hover-bg)}.sidebar-tab.active{background-color:var(--active-bg);border-bottom-color:var(--accent)}.sidebar-tab.active:hover{background-color:var(--active-bg)}.sidebar-content{flex-grow:1;overflow-y:auto}.db-list,.settings-list{padding:8px 0}.empty-list-message{padding:10px 16px;color:var(--muted);text-align:center}.settings-item{padding:10px 16px;cursor:pointer;border-left:3px solid transparent}.settings-item.active{background:var(--active-bg);border-left-color:var(--accent)}.settings-item.active:hover{background:var(--active-bg)}.settings-item:hover{background:var(--hover-bg)}.settings-footer-placeholder{height:40px;padding:12px 16px;border-top:1px solid var(--border);background:var(--panel)}.new-db-button{width:100%;padding:10px;background:var(--accent);border-color:var(--accent);color:var(--bg);font-weight:700}.new-db-button:hover{opacity:.9}.chat-list{overflow-y:auto;padding:8px 0}.chat-item{display:flex;justify-content:space-between;align-items:center;padding:10px 16px;cursor:pointer;border-left:3px solid transparent;overflow:hidden;white-space:nowrap}.chat-item span{flex-grow:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-item-buttons{display:flex;gap:8px;align-items:center}.unread-dot{width:8px;height:8px;background-color:red;border-radius:50%;margin-right:4px}.icon-button{background:none;border:none;color:var(--muted);cursor:pointer;font-size:16px;padding:0;display:flex;align-items:center;justify-content:center}.icon-button svg{width:16px;height:16px;stroke:var(--muted);transition:stroke .2s ease}.icon-button:hover svg{stroke:var(--accent)}.icon-button:hover{color:var(--accent)}.chat-item.active{background:var(--active-bg);border-left-color:var(--accent)}.chat-item:hover{background:var(--hover-bg)}.chat-item.active:hover{background:var(--active-bg)}.rename-input{background:var(--input-bg);border:1px solid var(--accent);color:var(--text);border-radius:10px;padding:8px 12px;outline:none;width:100%}::-webkit-scrollbar{width:8px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:var(--muted);border-radius:4px}::-webkit-scrollbar-thumb:hover{background:var(--accent)}.sidebar-footer{padding:12px 16px;background:var(--panel)}.new-db-form,.library-inline-form{display:grid;gap:8px}.new-db-actions{display:flex;gap:8px}.form-error{color:#ff9aa8;font-size:12px}.new-chat-button{width:100%;padding:10px;background:var(--accent);border-color:var(--accent);color:var(--bg);font-weight:700}.new-chat-button:hover{opacity:.9}.main-content{position:relative;display:grid;grid-template-rows:auto 1fr auto;height:100vh;overflow:hidden}.header{display:flex;align-items:center;gap:12px;padding:12px 16px;border-bottom:1px solid var(--border);background:var(--panel)}.select,.input,.button{background:var(--input-bg);border:1px solid var(--border);color:var(--text);border-radius:10px;padding:8px 12px;outline:none}.footer-content-wrapper .button{flex-shrink:0}.select{min-width:220px}.button{cursor:pointer}.button:hover{border-color:var(--accent)}.button.ghost{background:transparent}.button.danger{border-color:#8f3d49;color:#ffb8c2}.button.danger:hover{border-color:#d86a79}.header-subtle{color:var(--muted);font-size:13px}.chat{display:grid;grid-template-columns:1fr minmax(auto,1000px) 1fr;align-content:start;gap:8px;padding:16px;overflow:auto}.chat>*{grid-column:2}.msg{padding:12px 14px;border-radius:12px;line-height:1.5;white-space:wrap;font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Inter,Helvetica,Arial}textarea.input{resize:none;font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Inter,Helvetica,Arial;overflow-y:auto;flex-grow:1}.msg.user{background:var(--user-msg-bg);margin-left:auto;max-width:80%;border:1px solid var(--border);margin-right:5px;margin-bottom:15px;transition:border-color .15s ease,box-shadow .15s ease}.msg.user.editing{border-color:var(--accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--accent) 35%,transparent)}.msg.user .msg-content--user{white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;position:relative}.msg.user .user-msg-expand{margin-top:8px;padding:0;background:transparent;border:none;color:var(--muted);font-weight:700;cursor:pointer;align-self:flex-start;margin-left:0;text-align:left}.msg.assistant{background:transparent;border:none;max-width:none;animation:fadeIn .3s ease-in-out;margin-bottom:30px}.user-message-wrapper{display:flex;flex-direction:column;align-items:flex-end;position:relative}.assistant-message-wrapper{display:flex;flex-direction:column;align-items:flex-start;position:relative}.message-options-bar{display:flex;gap:2px;padding:0;border-radius:8px;background-color:transparent;border:none;position:absolute;bottom:-30px}.user-options{right:-10px;bottom:-40px}.assistant-options{left:0}.message-options-bar .icon-button{padding:4px;border-radius:4px;border:none}.message-options-bar .icon-button:hover{background-color:var(--hover-bg)}.new-msg-tip{position:absolute;right:24px;bottom:84px;padding:8px 12px;border-radius:9999px;background:var(--accent);color:var(--bg);border:none;cursor:pointer;font-weight:600;box-shadow:0 6px 20px #00000059}.new-msg-tip:hover{opacity:.9}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.footer{display:flex;justify-content:center;padding:12px 16px;border-top:1px solid var(--border);background:var(--panel);align-items:flex-end}.footer-content-wrapper{display:flex;gap:8px;width:100%;max-width:1000px;align-items:flex-end}.footer-tool-group{position:relative;display:inline-flex;align-items:center}.settings-content-panel{padding:20px;overflow-y:auto;height:100%}.settings-category{margin-bottom:30px}.settings-category h2{color:var(--accent);margin-bottom:15px;font-size:1.3em}.setting-section{margin-bottom:20px;padding:15px;border-bottom:1px solid var(--border);background-color:var(--panel);border-radius:8px}.setting-section:last-child{border-bottom:none;margin-bottom:0}.setting-section h3{color:var(--text);margin-top:0;margin-bottom:10px;font-size:1.1em}.settings-content-panel .input,.settings-content-panel .select{width:100%;max-width:400px;padding:10px 12px;border-radius:8px;border:1px solid var(--border);background-color:var(--input-bg);color:var(--text);font-size:1em}.settings-content-panel .select{min-width:unset}.setting-control-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.range-input{width:min(360px,100%);accent-color:var(--accent)}.setting-value{min-width:48px;color:var(--text);font-variant-numeric:tabular-nums}.setting-description{margin:10px 0 0;color:var(--muted);line-height:1.5}.msg h1,.msg h2,.msg h3,.msg h4{margin:10px 0;color:var(--accent)}.msg blockquote{border-left:4px solid var(--accent);padding-left:15px;margin-left:0;color:var(--muted)}.msg ul{padding-left:20px}.msg li{margin-bottom:5px}.msg code{background-color:var(--input-bg);padding:2px 4px;border-radius:4px;font-family:monospace}.msg pre{background-color:var(--input-bg);padding:10px;border-radius:8px;overflow-x:auto;white-space:pre-wrap}.msg pre code{padding:0;background-color:transparent}.msg a{color:var(--text);display:inline-flex;align-items:center;gap:4px;position:relative;text-decoration:underline dotted;text-underline-offset:3px}.msg a .tooltip{visibility:hidden;width:auto;background-color:var(--panel);color:var(--text);text-align:center;border-radius:6px;padding:5px 10px;position:absolute;z-index:1;bottom:110%;left:50%;transform:translate(-50%);opacity:0;transition:opacity .3s;white-space:nowrap}.msg a:hover .tooltip{visibility:visible;opacity:1}.msg a:hover{color:var(--accent)}.msg a svg{width:14px;height:14px;stroke:var(--text);transition:stroke .2s ease}.msg a:hover svg{stroke:var(--accent)}.msg hr{border:none;border-top:1px solid var(--border);margin:20px 0}:root{--outline-w: 1px;--grid-w: 1px;--grid: var(--border)}.msg table.nice{border-collapse:separate;border-spacing:0;width:100%;margin:1rem 0;border-radius:12px;box-shadow:0 0 0 var(--outline-w) var(--border)}.msg table.nice th,.msg table.nice td{border:var(--grid-w) solid var(--grid);border-width:.5px;padding:.6rem .75rem;vertical-align:top}.msg table.nice thead tr:first-child th{border-top:0}.msg table.nice tr th:first-child,.msg table.nice tr td:first-child{border-left:0}.msg table.nice tr th:last-child,.msg table.nice tr td:last-child{border-right:0}.msg table.nice tbody tr:last-child td{border-bottom:0}.msg table.nice thead tr:first-child th{background-color:var(--panel)}.msg table.nice thead tr:first-child th:first-child{border-top-left-radius:12px;background-clip:padding-box}.msg table.nice thead tr:first-child th:last-child{border-top-right-radius:12px;background-clip:padding-box}.msg table.nice tbody tr:last-child td:first-child{border-bottom-left-radius:12px;background-clip:padding-box}.msg table.nice tbody tr:last-child td:last-child{border-bottom-right-radius:12px;background-clip:padding-box}.toggle-switch{position:relative;display:inline-block;width:50px;height:28px}.toggle-switch input{opacity:0;width:0;height:0}.slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:var(--input-bg);border:1px solid var(--border);transition:.4s;border-radius:28px}.slider:before{position:absolute;content:"";height:20px;width:20px;left:3px;bottom:3px;background-color:var(--muted);transition:.4s;border-radius:50%}input:checked+.slider{background-color:var(--accent)}input:checked+.slider:before{transform:translate(22px);background-color:var(--panel)}.spinner{border:3px solid rgba(255,255,255,.3);border-radius:50%;border-top:3px solid var(--accent);width:20px;height:20px;animation:spin 1s linear infinite;margin:0 auto}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.codeblock{border:1px solid var(--grid, #e5e7eb);border-radius:12px;overflow:hidden;margin:1rem 0}.codeblock__header{display:flex;align-items:center;justify-content:space-between;padding:.5rem .75rem;background:var(--panel);border-bottom:1px solid var(--grid);font-weight:600;font-size:.875rem}.codeblock__lang{opacity:.9}.codeblock__copy{display:inline-flex;align-items:center;gap:.25rem;border:0;background:transparent;padding:.25rem;border-radius:8px;cursor:pointer}.codeblock__copy:hover{background:#0000000f}.codeblock__copy.copied .icon-copy{transform:scale(1.05)}.codeblock__pre{margin:0;padding:.75rem;overflow:auto}.codeblock__code{display:block;white-space:pre}.assistant-message{display:block}.assistant-thoughts{margin-bottom:8px}.think-toggle{background:var(--active-bg);color:var(--muted);border:1px solid var(--border);border-radius:10px;font-size:12px;padding:4px 8px;cursor:pointer}.think-toggle:hover{color:var(--text);border-color:var(--accent)}.think-toggle-icon{display:inline-block;margin-right:6px}.think-content{margin-top:8px;padding:10px 12px;border:1px solid var(--border);border-radius:12px;background:var(--panel);color:var(--muted);font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:13px;line-height:1.5;overflow-x:auto;white-space:pre-wrap}.edit-message-input{display:block;width:100%;height:100%;background:transparent;border:0;padding:0;margin:0;color:inherit;font:inherit;line-height:inherit;letter-spacing:inherit;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;resize:none;overflow:hidden;outline:none}.edit-message-input:focus{border-color:var(--accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--accent) 35%,transparent)}.user-edit-shadow{visibility:hidden;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word}.edit-message-input.edit-overlay{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;background:transparent;border:0;padding:0;margin:0;color:inherit;font:inherit;line-height:inherit;letter-spacing:inherit;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;resize:none;overflow:hidden;outline:none;box-shadow:none}.websearch-toggle,.db-picker-toggle{background:transparent;border:0;padding:0;margin:0 .1rem 0 0;line-height:0;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;position:relative;top:-7.5px;color:var(--muted);box-shadow:none;outline:none;-webkit-tap-highlight-color:transparent}.websearch-toggle svg,.db-picker-toggle svg{width:20px;height:20px;pointer-events:none}.websearch-toggle.active,.db-picker-toggle.active{color:var(--accent)}.websearch-toggle:focus,.websearch-toggle:focus-visible,.db-picker-toggle:focus,.db-picker-toggle:focus-visible{outline:none;box-shadow:none}.db-picker-menu{position:absolute;right:0;bottom:calc(100% + 10px);min-width:240px;max-height:280px;overflow-y:auto;padding:6px;border-radius:12px;border:1px solid var(--border);background:var(--panel);box-shadow:0 14px 32px #00000059;z-index:20}.db-picker-option{width:100%;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:9px 10px;border:0;border-radius:10px;background:transparent;color:var(--text);cursor:pointer;text-align:left}.db-picker-option:hover:not(:disabled){background:var(--hover-bg)}.db-picker-option.selected{background:var(--active-bg)}.db-picker-option:disabled{color:var(--muted);cursor:not-allowed}.db-picker-status{flex-shrink:0;color:var(--muted);font-size:12px}.db-picker-empty{padding:10px;color:var(--muted);font-size:13px}.msg-sources{margin-top:8px;font-size:12px;color:var(--muted)}.msg-sources a{color:var(--accent);text-decoration:none;margin-right:8px}.msg-sources a:hover{text-decoration:underline}.msg-sources.chips{display:flex;flex-wrap:wrap;margin:.5rem 0}.msg-sources.chips .chip{display:inline-flex;align-items:center;padding:.25rem .6rem;border-radius:9999px;border:1px solid var(--border);text-decoration:none;font-size:.85rem;line-height:1;white-space:nowrap;margin-top:.5rem}.db-active-badge{margin-left:8px;padding:2px 8px;border-radius:999px;background:color-mix(in srgb,var(--accent) 20%,transparent);color:var(--accent);font-size:11px}.placeholder-view,.library-panel{overflow:auto;padding:20px}.placeholder-view h1{margin-top:0}.library-toolbar{display:flex;flex-wrap:wrap;gap:10px;margin-bottom:18px}.library-states{display:flex;flex-wrap:wrap;gap:10px;margin-bottom:14px}.state-pill{padding:6px 10px;border-radius:999px;border:1px solid var(--border);color:var(--muted);font-size:13px}.state-pill.ready{color:var(--text);border-color:color-mix(in srgb,var(--accent) 45%,var(--border))}.library-chat-note,.job-card{margin-bottom:12px;padding:12px 14px;border-radius:12px;background:color-mix(in srgb,var(--panel) 82%,black);border:1px solid var(--border)}.library-inline-form{margin-bottom:14px;padding:12px 14px;border-radius:12px;border:1px solid var(--border);background:color-mix(in srgb,var(--panel) 88%,black)}.danger-zone{border-color:#8f3d49}.library-files h2{margin:18px 0 12px;font-size:16px}.library-file-list{display:grid;gap:10px}.library-file-row{display:flex;justify-content:space-between;gap:14px;align-items:flex-start;padding:12px 14px;border-radius:12px;border:1px solid var(--border);background:color-mix(in srgb,var(--panel) 88%,black)}.library-file-meta{min-width:0}.library-file-name{font-weight:600;margin-bottom:4px}.library-file-path,.muted-copy{color:var(--muted);font-size:13px;word-break:break-word}.library-file-actions{display:flex;gap:8px;flex-shrink:0} diff --git a/dist/assets/index-gF5dDH11.js b/dist/assets/index-gF5dDH11.js new file mode 100644 index 0000000..45dd94f --- /dev/null +++ b/dist/assets/index-gF5dDH11.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 Np(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var hc={exports:{}},xo={},mc={exports:{}},K={};/** + * @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 el=Symbol.for("react.element"),_p=Symbol.for("react.portal"),Lp=Symbol.for("react.fragment"),Pp=Symbol.for("react.strict_mode"),Rp=Symbol.for("react.profiler"),jp=Symbol.for("react.provider"),Tp=Symbol.for("react.context"),$p=Symbol.for("react.forward_ref"),Mp=Symbol.for("react.suspense"),zp=Symbol.for("react.memo"),Op=Symbol.for("react.lazy"),Ha=Symbol.iterator;function Fp(e){return e===null||typeof e!="object"?null:(e=Ha&&e[Ha]||e["@@iterator"],typeof e=="function"?e:null)}var gc={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},vc=Object.assign,yc={};function ar(e,t,n){this.props=e,this.context=t,this.refs=yc,this.updater=n||gc}ar.prototype.isReactComponent={};ar.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")};ar.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function wc(){}wc.prototype=ar.prototype;function ks(e,t,n){this.props=e,this.context=t,this.refs=yc,this.updater=n||gc}var Es=ks.prototype=new wc;Es.constructor=ks;vc(Es,ar.prototype);Es.isPureReactComponent=!0;var Wa=Array.isArray,Sc=Object.prototype.hasOwnProperty,Cs={current:null},xc={key:!0,ref:!0,__self:!0,__source:!0};function kc(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)Sc.call(t,r)&&!xc.hasOwnProperty(r)&&(l[r]=t[r]);var a=arguments.length-2;if(a===1)l.children=n;else if(1>>1,fe=z[ee];if(0>>1;eel(xt,B))ktl(be,xt)?(z[ee]=be,z[kt]=B,ee=kt):(z[ee]=xt,z[ft]=B,ee=ft);else if(ktl(be,B))z[ee]=be,z[kt]=B,ee=kt;else break e}}return $}function l(z,$){var B=z.sortIndex-$.sortIndex;return B!==0?B:z.id-$.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,m=null,v=3,S=!1,x=!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(z){for(var $=n(u);$!==null;){if($.callback===null)r(u);else if($.startTime<=z)r(u),$.sortIndex=$.expirationTime,t(s,$);else break;$=n(u)}}function E(z){if(C=!1,d(z),!x)if(n(s)!==null)x=!0,Be(P);else{var $=n(u);$!==null&&wt(E,$.startTime-z)}}function P(z,$){x=!1,C&&(C=!1,h(F),F=-1),S=!0;var B=v;try{for(d($),m=n(s);m!==null&&(!(m.expirationTime>$)||z&&!H());){var ee=m.callback;if(typeof ee=="function"){m.callback=null,v=m.priorityLevel;var fe=ee(m.expirationTime<=$);$=e.unstable_now(),typeof fe=="function"?m.callback=fe:m===n(s)&&r(s),d($)}else r(s);m=n(s)}if(m!==null)var St=!0;else{var ft=n(u);ft!==null&&wt(E,ft.startTime-$),St=!1}return St}finally{m=null,v=B,S=!1}}var j=!1,T=null,F=-1,A=5,R=-1;function H(){return!(e.unstable_now()-Rz||125ee?(z.sortIndex=B,t(u,z),n(s)===null&&z===n(u)&&(C?(h(F),F=-1):C=!0,wt(E,B-ee))):(z.sortIndex=fe,t(s,z),x||S||(x=!0,Be(P))),z},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(z){var $=v;return function(){var B=v;v=$;try{return z.apply(this,arguments)}finally{v=B}}}})(Lc);_c.exports=Lc;var Yp=_c.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 bp=g,Qe=Yp;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"),_i=Object.prototype.hasOwnProperty,Jp=/^[: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 Gp(e){return _i.call(Ka,e)?!0:_i.call(Qa,e)?!1:Jp.test(e)?Ka[e]=!0:(Qa[e]=!0,!1)}function Xp(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 Zp(e,t,n,r){if(t===null||typeof t>"u"||Xp(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 ke={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ke[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];ke[t]=new Oe(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ke[e]=new Oe(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ke[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){ke[e]=new Oe(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ke[e]=new Oe(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ke[e]=new Oe(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ke[e]=new Oe(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ke[e]=new Oe(e,5,!1,e.toLowerCase(),null,!1,!1)});var _s=/[\-:]([a-z])/g;function Ls(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(_s,Ls);ke[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(_s,Ls);ke[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(_s,Ls);ke[t]=new Oe(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ke[e]=new Oe(e,1,!1,e.toLowerCase(),null,!1,!1)});ke.xlinkHref=new Oe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ke[e]=new Oe(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ps(e,t,n,r){var l=ke.hasOwnProperty(t)?ke[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:"")?kr(e):""}function qp(e){switch(e.tag){case 5:return kr(e.type);case 16:return kr("Lazy");case 13:return kr("Suspense");case 19:return kr("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 ji(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 In:return"Portal";case Li:return"Profiler";case Rs:return"StrictMode";case Pi:return"Suspense";case Ri:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case jc:return(e.displayName||"Context")+".Consumer";case Rc:return(e._context.displayName||"Context")+".Provider";case js:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ts:return t=e.displayName||null,t!==null?t:ji(e.type)||"Memo";case Wt:t=e._payload,e=e._init;try{return ji(e(t))}catch{}}return null}function eh(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 ji(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 rn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function $c(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function th(e){var t=$c(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=th(e))}function Mc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=$c(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 Ti(e,t){var n=t.checked;return ie({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ba(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=rn(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 zc(e,t){t=t.checked,t!=null&&Ps(e,"checked",t,!1)}function $i(e,t){zc(e,t);var n=rn(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")?Mi(e,t.type,n):t.hasOwnProperty("defaultValue")&&Mi(e,t.type,rn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ja(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 Mi(e,t,n){(t!=="number"||Jl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Er=Array.isArray;function Jn(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 Fr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var _r={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},nh=["Webkit","ms","Moz","O"];Object.keys(_r).forEach(function(e){nh.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),_r[t]=_r[e]})});function Dc(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||_r.hasOwnProperty(e)&&_r[e]?(""+t).trim():t+"px"}function Ac(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Dc(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var rh=ie({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 Fi(e,t){if(t){if(rh[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 Ii(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 $s(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ai=null,Gn=null,Xn=null;function Za(e){if(e=rl(e)){if(typeof Ai!="function")throw Error(L(280));var t=e.stateNode;t&&(t=_o(t),Ai(e.stateNode,e.type,t))}}function Uc(e){Gn?Xn?Xn.push(e):Xn=[e]:Gn=e}function Bc(){if(Gn){var e=Gn,t=Xn;if(Xn=Gn=null,Za(e),t)for(e=0;e>>=0,e===0?32:31-(hh(e)/mh|0)|0}var Sl=64,xl=4194304;function Cr(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=Cr(a):(o&=i,o!==0&&(r=Cr(o)))}else i=n&~l,i!==0?r=Cr(i):o!==0&&(r=Cr(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 tl(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-st(t),e[t]=n}function wh(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=Pr),su=" ",au=!1;function af(e,t){switch(e){case"keyup":return Yh.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function uf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var An=!1;function Jh(e,t){switch(e){case"compositionend":return uf(t);case"keypress":return t.which!==32?null:(au=!0,su);case"textInput":return e=t.data,e===su&&au?null:e;default:return null}}function Gh(e,t){if(An)return e==="compositionend"||!Us&&af(e,t)?(e=of(),Il=Is=Yt=null,An=!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=du(n)}}function pf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?pf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function hf(){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 Bs(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 om(e){var t=hf(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&pf(n.ownerDocument.documentElement,n)){if(r!==null&&Bs(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=pu(n,o);var i=pu(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,Un=null,Qi=null,jr=null,Ki=!1;function hu(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ki||Un==null||Un!==Jl(r)||(r=Un,"selectionStart"in r&&Bs(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}),jr&&Hr(jr,r)||(jr=r,r=no(Qi,"onSelect"),0Wn||(e.current=Zi[Wn],Zi[Wn]=null,Wn--)}function G(e,t){Wn++,Zi[Wn]=e.current,e.current=t}var ln={},Pe=sn(ln),De=sn(!1),Sn=ln;function nr(e,t){var n=e.type.contextTypes;if(!n)return ln;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 Ae(e){return e=e.childContextTypes,e!=null}function lo(){q(De),q(Pe)}function xu(e,t,n){if(Pe.current!==ln)throw Error(L(168));G(Pe,t),G(De,n)}function Ef(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,eh(e)||"Unknown",l));return ie({},n,r)}function oo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ln,Sn=Pe.current,G(Pe,e),G(De,De.current),!0}function ku(e,t,n){var r=e.stateNode;if(!r)throw Error(L(169));n?(e=Ef(e,t,Sn),r.__reactInternalMemoizedMergedChildContext=e,q(De),q(Pe),G(Pe,e)):q(De),G(De,n)}var _t=null,Lo=!1,mi=!1;function Cf(e){_t===null?_t=[e]:_t.push(e)}function vm(e){Lo=!0,Cf(e)}function an(){if(!mi&&_t!==null){mi=!0;var e=0,t=J;try{var n=_t;for(J=1;e>=i,l-=i,Lt=1<<32-st(t)+l|n<F?(A=T,T=null):A=T.sibling;var R=v(h,T,d[F],E);if(R===null){T===null&&(T=A);break}e&&T&&R.alternate===null&&t(h,T),f=o(R,f,F),j===null?P=R:j.sibling=R,j=R,T=A}if(F===d.length)return n(h,T),te&&pn(h,F),P;if(T===null){for(;FF?(A=T,T=null):A=T.sibling;var H=v(h,T,R.value,E);if(H===null){T===null&&(T=A);break}e&&T&&H.alternate===null&&t(h,T),f=o(H,f,F),j===null?P=H:j.sibling=H,j=H,T=A}if(R.done)return n(h,T),te&&pn(h,F),P;if(T===null){for(;!R.done;F++,R=d.next())R=m(h,R.value,E),R!==null&&(f=o(R,f,F),j===null?P=R:j.sibling=R,j=R);return te&&pn(h,F),P}for(T=r(h,T);!R.done;F++,R=d.next())R=S(T,h,F,R.value,E),R!==null&&(e&&R.alternate!==null&&T.delete(R.key===null?F:R.key),f=o(R,f,F),j===null?P=R:j.sibling=R,j=R);return e&&T.forEach(function(ce){return t(h,ce)}),te&&pn(h,F),P}function _(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 P=d.key,j=f;j!==null;){if(j.key===P){if(P=d.type,P===Dn){if(j.tag===7){n(h,j.sibling),f=l(j,d.props.children),f.return=h,h=f;break e}}else if(j.elementType===P||typeof P=="object"&&P!==null&&P.$$typeof===Wt&&Nu(P)===j.type){n(h,j.sibling),f=l(j,d.props),f.ref=yr(h,j,d),f.return=h,h=f;break e}n(h,j);break}else t(h,j);j=j.sibling}d.type===Dn?(f=wn(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=yr(h,f,d),E.return=h,h=E)}return i(h);case In:e:{for(j=d.key;f!==null;){if(f.key===j)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 Wt:return j=d._init,_(h,f,j(d._payload),E)}if(Er(d))return x(h,f,d,E);if(pr(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 _}var lr=Pf(!0),Rf=Pf(!1),ao=sn(null),uo=null,Kn=null,Qs=null;function Ks(){Qs=Kn=uo=null}function Ys(e){var t=ao.current;q(ao),e._currentValue=t}function ts(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 qn(e,t){uo=e,Qs=Kn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ie=!0),e.firstContext=null)}function et(e){var t=e._currentValue;if(Qs!==e)if(e={context:e,memoizedValue:t,next:null},Kn===null){if(uo===null)throw Error(L(308));Kn=e,uo.dependencies={lanes:0,firstContext:e}}else Kn=Kn.next=e;return t}var gn=null;function bs(e){gn===null?gn=[e]:gn.push(e)}function jf(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,bs(t)):(n.next=l.next,l.next=n),t.interleaved=n,Mt(e,r)}function Mt(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 Vt=!1;function Js(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Tf(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 Rt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function qt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Y&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,Mt(e,n)}return l=r.interleaved,l===null?(t.next=t,bs(r)):(t.next=l.next,l.next=t),r.interleaved=t,Mt(e,n)}function Al(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,zs(e,n)}}function _u(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;Vt=!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 m=l.baseState;i=0,p=u=s=null,a=o;do{var v=a.lane,S=a.eventTime;if((r&v)===v){p!==null&&(p=p.next={eventTime:S,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var x=e,C=a;switch(v=t,S=n,C.tag){case 1:if(x=C.payload,typeof x=="function"){m=x.call(S,m,v);break e}m=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=C.payload,v=typeof x=="function"?x.call(S,m,v):x,v==null)break e;m=ie({},m,v);break e;case 2:Vt=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,v=l.effects,v===null?l.effects=[a]:v.push(a))}else S={eventTime:S,lane:v,tag:a.tag,payload:a.payload,callback:a.callback,next:null},p===null?(u=p=S,s=m):p=p.next=S,i|=v;if(a=a.next,a===null){if(a=l.shared.pending,a===null)break;v=a,a=v.next,v.next=null,l.lastBaseUpdate=v,l.shared.pending=null}}while(!0);if(p===null&&(s=m),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);En|=i,e.lanes=i,e.memoizedState=m}}function Lu(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{J=n,vi.transition=r}}function bf(){return tt().memoizedState}function xm(e,t,n){var r=tn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Jf(e))Gf(t,n);else if(n=jf(e,t,n,r),n!==null){var l=Me();at(n,e,r,l),Xf(n,t,r)}}function km(e,t,n){var r=tn(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Jf(e))Gf(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,ut(a,i)){var s=t.interleaved;s===null?(l.next=l,bs(t)):(l.next=s.next,s.next=l),t.interleaved=l;return}}catch{}finally{}n=jf(e,t,l,r),n!==null&&(l=Me(),at(n,e,r,l),Xf(n,t,r))}}function Jf(e){var t=e.alternate;return e===le||t!==null&&t===le}function Gf(e,t){Tr=po=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Xf(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,zs(e,n)}}var ho={readContext:et,useCallback:Ne,useContext:Ne,useEffect:Ne,useImperativeHandle:Ne,useInsertionEffect:Ne,useLayoutEffect:Ne,useMemo:Ne,useReducer:Ne,useRef:Ne,useState:Ne,useDebugValue:Ne,useDeferredValue:Ne,useTransition:Ne,useMutableSource:Ne,useSyncExternalStore:Ne,useId:Ne,unstable_isNewReconciler:!1},Em={readContext:et,useCallback:function(e,t){return ht().memoizedState=[e,t===void 0?null:t],e},useContext:et,useEffect:Ru,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Bl(4194308,4,Wf.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=ht();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ht();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=xm.bind(null,le,e),[r.memoizedState,e]},useRef:function(e){var t=ht();return e={current:e},t.memoizedState=e},useState:Pu,useDebugValue:ra,useDeferredValue:function(e){return ht().memoizedState=e},useTransition:function(){var e=Pu(!1),t=e[0];return e=Sm.bind(null,e[1]),ht().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=le,l=ht();if(te){if(n===void 0)throw Error(L(407));n=n()}else{if(n=t(),ye===null)throw Error(L(349));kn&30||Of(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,Ru(If.bind(null,r,o,e),[e]),r.flags|=2048,Gr(9,Ff.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=ht(),t=ye.identifierPrefix;if(te){var n=Pt,r=Lt;n=(r&~(1<<32-st(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=br++,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[mt]=t,e[Qr]=r,sd(e,t,!1,!1),t.stateNode=e;e:{switch(i=Ii(n,r),n){case"dialog":Z("cancel",e),Z("close",e),l=r;break;case"iframe":case"object":case"embed":Z("load",e),l=r;break;case"video":case"audio":for(l=0;lsr&&(t.flags|=128,r=!0,wr(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),wr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!te)return _e(t),null}else 2*ue()-o.renderingStartTime>sr&&n!==1073741824&&(t.flags|=128,r=!0,wr(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=ue(),t.sibling=null,n=re.current,G(re,r?n&1|2:n&1),t):(_e(t),null);case 22:case 23:return ua(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?He&1073741824&&(_e(t),t.subtreeFlags&6&&(t.flags|=8192)):_e(t),null;case 24:return null;case 25:return null}throw Error(L(156,t.tag))}function Tm(e,t){switch(Ws(t),t.tag){case 1:return Ae(t.type)&&lo(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return or(),q(De),q(Pe),Zs(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Xs(t),null;case 13:if(q(re),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(L(340));rr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return q(re),null;case 4:return or(),null;case 10:return Ys(t.type._context),null;case 22:case 23:return ua(),null;case 24:return null;default:return null}}var jl=!1,Le=!1,$m=typeof WeakSet=="function"?WeakSet:Set,O=null;function Yn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){se(e,t,r)}else n.current=null}function cs(e,t,n){try{n()}catch(r){se(e,t,r)}}var Uu=!1;function Mm(e,t){if(Yi=eo,e=hf(),Bs(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,m=e,v=null;t:for(;;){for(var S;m!==n||l!==0&&m.nodeType!==3||(a=i+l),m!==o||r!==0&&m.nodeType!==3||(s=i+r),m.nodeType===3&&(i+=m.nodeValue.length),(S=m.firstChild)!==null;)v=m,m=S;for(;;){if(m===e)break t;if(v===n&&++u===l&&(a=i),v===o&&++p===r&&(s=i),(S=m.nextSibling)!==null)break;m=v,v=m.parentNode}m=S}n=a===-1||s===-1?null:{start:a,end:s}}else n=null}n=n||{start:0,end:0}}else n=null;for(bi={focusedElem:e,selectionRange:n},eo=!1,O=t;O!==null;)if(t=O,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,O=e;else for(;O!==null;){t=O;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var C=x.memoizedProps,_=x.memoizedState,h=t.stateNode,f=h.getSnapshotBeforeUpdate(t.elementType===t.type?C:lt(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){se(t,t.return,E)}if(e=t.sibling,e!==null){e.return=t.return,O=e;break}O=t.return}return x=Uu,Uu=!1,x}function $r(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&&cs(t,n,o)}l=l.next}while(l!==r)}}function jo(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 fs(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 cd(e){var t=e.alternate;t!==null&&(e.alternate=null,cd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[mt],delete t[Qr],delete t[Xi],delete t[mm],delete t[gm])),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 fd(e){return e.tag===5||e.tag===3||e.tag===4}function Bu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||fd(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 ds(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(ds(e,t,n),e=e.sibling;e!==null;)ds(e,t,n),e=e.sibling}function ps(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(ps(e,t,n),e=e.sibling;e!==null;)ps(e,t,n),e=e.sibling}var Se=null,ot=!1;function Ht(e,t,n){for(n=n.child;n!==null;)dd(e,t,n),n=n.sibling}function dd(e,t,n){if(gt&&typeof gt.onCommitFiberUnmount=="function")try{gt.onCommitFiberUnmount(ko,n)}catch{}switch(n.tag){case 5:Le||Yn(n,t);case 6:var r=Se,l=ot;Se=null,Ht(e,t,n),Se=r,ot=l,Se!==null&&(ot?(e=Se,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Se.removeChild(n.stateNode));break;case 18:Se!==null&&(ot?(e=Se,n=n.stateNode,e.nodeType===8?hi(e.parentNode,n):e.nodeType===1&&hi(e,n),Ur(e)):hi(Se,n.stateNode));break;case 4:r=Se,l=ot,Se=n.stateNode.containerInfo,ot=!0,Ht(e,t,n),Se=r,ot=l;break;case 0:case 11:case 14:case 15:if(!Le&&(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)&&cs(n,t,i),l=l.next}while(l!==r)}Ht(e,t,n);break;case 1:if(!Le&&(Yn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){se(n,t,a)}Ht(e,t,n);break;case 21:Ht(e,t,n);break;case 22:n.mode&1?(Le=(r=Le)||n.memoizedState!==null,Ht(e,t,n),Le=r):Ht(e,t,n);break;default:Ht(e,t,n)}}function Hu(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new $m),t.forEach(function(r){var l=Hm.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function rt(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=i),r&=~o}if(r=l,r=ue()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Om(r/1960))-r,10e?16:e,bt===null)var r=!1;else{if(e=bt,bt=null,vo=0,Y&6)throw Error(L(331));var l=Y;for(Y|=4,O=e.current;O!==null;){var o=O,i=o.child;if(O.flags&16){var a=o.deletions;if(a!==null){for(var s=0;sue()-sa?yn(e,0):ia|=n),Ue(e,t)}function Sd(e,t){t===0&&(e.mode&1?(t=xl,xl<<=1,!(xl&130023424)&&(xl=4194304)):t=1);var n=Me();e=Mt(e,t),e!==null&&(tl(e,t,n),Ue(e,n))}function Bm(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Sd(e,n)}function Hm(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),Sd(e,n)}var xd;xd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||De.current)Ie=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ie=!1,Rm(e,t,n);Ie=!!(e.flags&131072)}else Ie=!1,te&&t.flags&1048576&&Nf(t,so,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Hl(e,t),e=t.pendingProps;var l=nr(t,Pe.current);qn(t,n),l=ea(null,t,r,e,l,n);var o=ta();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,Ae(r)?(o=!0,oo(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Js(t),l.updater=Ro,t.stateNode=l,l._reactInternals=t,rs(t,r,e,n),t=is(null,t,r,!0,o,n)):(t.tag=0,te&&o&&Hs(t),$e(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=Vm(r),e=lt(r,e),l){case 0:t=os(null,t,r,e,n);break e;case 1:t=Iu(null,t,r,e,n);break e;case 11:t=Ou(null,t,r,e,n);break e;case 14:t=Fu(null,t,r,lt(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:lt(r,l),os(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:lt(r,l),Iu(e,t,r,l,n);case 3:e:{if(ld(t),e===null)throw Error(L(387));r=t.pendingProps,o=t.memoizedState,l=o.element,Tf(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=ir(Error(L(423)),t),t=Du(e,t,r,n,l);break e}else if(r!==l){l=ir(Error(L(424)),t),t=Du(e,t,r,n,l);break e}else for(We=Zt(t.stateNode.containerInfo.firstChild),Ve=t,te=!0,it=null,n=Rf(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(rr(),r===l){t=zt(e,t,n);break e}$e(e,t,r,n)}t=t.child}return t;case 5:return $f(t),e===null&&es(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,i=l.children,Ji(r,l)?i=null:o!==null&&Ji(r,o)&&(t.flags|=32),rd(e,t),$e(e,t,i,n),t.child;case 6:return e===null&&es(t),null;case 13:return od(e,t,n);case 4:return Gs(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=lr(t,null,r,n):$e(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:lt(r,l),Ou(e,t,r,l,n);case 7:return $e(e,t,t.pendingProps,n),t.child;case 8:return $e(e,t,t.pendingProps.children,n),t.child;case 12:return $e(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,G(ao,r._currentValue),r._currentValue=i,o!==null)if(ut(o.value,i)){if(o.children===l.children&&!De.current){t=zt(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=Rt(-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),ts(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),ts(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}$e(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,qn(t,n),l=et(l),r=r(l),t.flags|=1,$e(e,t,r,n),t.child;case 14:return r=t.type,l=lt(r,t.pendingProps),l=lt(r.type,l),Fu(e,t,r,l,n);case 15:return td(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:lt(r,l),Hl(e,t),t.tag=1,Ae(r)?(e=!0,oo(t)):e=!1,qn(t,n),Zf(t,r,l),rs(t,r,l,n),is(null,t,r,!0,e,n);case 19:return id(e,t,n);case 22:return nd(e,t,n)}throw Error(L(156,t.tag))};function kd(e,t){return bc(e,t)}function Wm(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 Ze(e,t,n,r){return new Wm(e,t,n,r)}function fa(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Vm(e){if(typeof e=="function")return fa(e)?1:0;if(e!=null){if(e=e.$$typeof,e===js)return 11;if(e===Ts)return 14}return 2}function nn(e,t){var n=e.alternate;return n===null?(n=Ze(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")fa(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Dn:return wn(n.children,l,o,t);case Rs:i=8,l|=8;break;case Li:return e=Ze(12,n,t,l|2),e.elementType=Li,e.lanes=o,e;case Pi:return e=Ze(13,n,t,l),e.elementType=Pi,e.lanes=o,e;case Ri:return e=Ze(19,n,t,l),e.elementType=Ri,e.lanes=o,e;case Tc:return $o(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Rc:i=10;break e;case jc:i=9;break e;case js:i=11;break e;case Ts:i=14;break e;case Wt:i=16,r=null;break e}throw Error(L(130,e==null?e:typeof e,""))}return t=Ze(i,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function wn(e,t,n,r){return e=Ze(7,e,r,t),e.lanes=n,e}function $o(e,t,n,r){return e=Ze(22,e,r,t),e.elementType=Tc,e.lanes=n,e.stateNode={isHidden:!1},e}function ki(e,t,n){return e=Ze(6,e,null,t),e.lanes=n,e}function Ei(e,t,n){return t=Ze(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 da(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=Ze(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Js(o),e}function Km(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(_d)}catch(e){console.error(e)}}_d(),Nc.exports=Ke;var Ld=Nc.exports,Pd,Gu=Ld;Pd=Gu.createRoot,Gu.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 Xu="popstate";function Xm(e={}){function t(l,o){let{pathname:i="/",search:a="",hash:s=""}=Ln(l.location.hash.substring(1));return!i.startsWith("/")&&!i.startsWith(".")&&(i="/"+i),ys("",{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:Zr(o))}function r(l,o){ct(l.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(o)})`)}return qm(t,n,r,e)}function oe(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ct(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Zm(){return Math.random().toString(36).substring(2,10)}function Zu(e,t){return{usr:e.state,key:e.key,idx:t}}function ys(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Ln(t):t,state:n,key:t&&t.key||r||Zm()}}function Zr({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 Ln(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 qm(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 m(){a="POP";let _=p(),h=_==null?null:_-u;u=_,s&&s({action:a,location:C.location,delta:h})}function v(_,h){a="PUSH";let f=ys(C.location,_,h);n&&n(f,_),u=p()+1;let d=Zu(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=ys(C.location,_,h);n&&n(f,_),u=p();let d=Zu(f,u),E=C.createHref(f);i.replaceState(d,"",E),o&&s&&s({action:a,location:C.location,delta:0})}function x(_){return eg(_)}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(Xu,m),s=_,()=>{l.removeEventListener(Xu,m),s=null}},createHref(_){return t(l,_)},createURL:x,encodeLocation(_){let h=x(_);return{pathname:h.pathname,search:h.search,hash:h.hash}},push:v,replace:S,go(_){return i.go(_)}};return C}function eg(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),oe(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:Zr(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function Rd(e,t,n="/"){return tg(e,t,n,!1)}function tg(e,t,n,r){let l=typeof t=="string"?Ln(t):t,o=Ot(l.pathname||"/",n);if(o==null)return null;let i=jd(e);ng(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;oe(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 m=jt([r,p.relativePath]),v=n.concat(p);i.children&&i.children.length>0&&(oe(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),jd(i.children,t,v,m,s)),!(i.path==null&&!i.index)&&t.push({path:m,score:ug(m,i.index),routesMeta:v})};return e.forEach((i,a)=>{var s;if(i.path===""||!((s=i.path)!=null&&s.includes("?")))o(i,a);else for(let u of Td(i.path))o(i,a,!0,u)}),t}function Td(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=Td(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 ng(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:cg(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var rg=/^:[\w-]+$/,lg=3,og=2,ig=1,sg=10,ag=-2,qu=e=>e==="*";function ug(e,t){let n=e.split("/"),r=n.length;return n.some(qu)&&(r+=ag),t&&(r+=og),n.filter(l=>!qu(l)).reduce((l,o)=>l+(rg.test(o)?lg:o===""?ig:sg),r)}function cg(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 fg(e,t,n=!1){let{routesMeta:r}=e,l={},o="/",i=[];for(let a=0;a{if(p==="*"){let x=a[v]||"";i=o.slice(0,o.length-x.length).replace(/(.)\/+$/,"$1")}const S=a[v];return m&&!S?u[p]=void 0:u[p]=(S||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function dg(e,t=!1,n=!0){ct(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 pg(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ct(!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 hg(e,t="/"){let{pathname:n,search:r="",hash:l=""}=typeof e=="string"?Ln(e):e;return{pathname:n?n.startsWith("/")?n:mg(n,t):t,search:yg(r),hash:wg(l)}}function mg(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 gg(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function $d(e){let t=gg(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Md(e,t,n,r=!1){let l;typeof e=="string"?l=Ln(e):(l={...e},oe(!l.pathname||!l.pathname.includes("?"),Ci("?","pathname","search",l)),oe(!l.pathname||!l.pathname.includes("#"),Ci("#","pathname","hash",l)),oe(!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 m=t.length-1;if(!r&&i.startsWith("..")){let v=i.split("/");for(;v[0]==="..";)v.shift(),m-=1;l.pathname=v.join("/")}a=m>=0?t[m]:"/"}let s=hg(l,a),u=i&&i!=="/"&&i.endsWith("/"),p=(o||i===".")&&n.endsWith("/");return!s.pathname.endsWith("/")&&(u||p)&&(s.pathname+="/"),s}var jt=e=>e.join("/").replace(/\/\/+/g,"/"),vg=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),yg=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,wg=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Sg(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}var zd=["POST","PUT","PATCH","DELETE"];new Set(zd);var xg=["GET",...zd];new Set(xg);var fr=g.createContext(null);fr.displayName="DataRouter";var Io=g.createContext(null);Io.displayName="DataRouterState";g.createContext(!1);var Od=g.createContext({isTransitioning:!1});Od.displayName="ViewTransition";var kg=g.createContext(new Map);kg.displayName="Fetchers";var Eg=g.createContext(null);Eg.displayName="Await";var yt=g.createContext(null);yt.displayName="Navigation";var ol=g.createContext(null);ol.displayName="Location";var It=g.createContext({outlet:null,matches:[],isDataRoute:!1});It.displayName="Route";var ga=g.createContext(null);ga.displayName="RouteError";function Cg(e,{relative:t}={}){oe(il(),"useHref() may be used only in the context of a component.");let{basename:n,navigator:r}=g.useContext(yt),{hash:l,pathname:o,search:i}=sl(e,{relative:t}),a=o;return n!=="/"&&(a=o==="/"?n:jt([n,o])),r.createHref({pathname:a,search:i,hash:l})}function il(){return g.useContext(ol)!=null}function Pn(){return oe(il(),"useLocation() may be used only in the context of a component."),g.useContext(ol).location}var Fd="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Id(e){g.useContext(yt).static||g.useLayoutEffect(e)}function Ng(){let{isDataRoute:e}=g.useContext(It);return e?Dg():_g()}function _g(){oe(il(),"useNavigate() may be used only in the context of a component.");let e=g.useContext(fr),{basename:t,navigator:n}=g.useContext(yt),{matches:r}=g.useContext(It),{pathname:l}=Pn(),o=JSON.stringify($d(r)),i=g.useRef(!1);return Id(()=>{i.current=!0}),g.useCallback((s,u={})=>{if(ct(i.current,Fd),!i.current)return;if(typeof s=="number"){n.go(s);return}let p=Md(s,JSON.parse(o),l,u.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:jt([t,p.pathname])),(u.replace?n.replace:n.push)(p,u.state,u)},[t,n,o,l,e])}g.createContext(null);function sl(e,{relative:t}={}){let{matches:n}=g.useContext(It),{pathname:r}=Pn(),l=JSON.stringify($d(n));return g.useMemo(()=>Md(e,JSON.parse(l),r,t==="path"),[e,l,r,t])}function Lg(e,t){return Dd(e,t)}function Dd(e,t,n,r,l){var f;oe(il(),"useRoutes() may be used only in the context of a component.");let{navigator:o}=g.useContext(yt),{matches:i}=g.useContext(It),a=i[i.length-1],s=a?a.params:{},u=a?a.pathname:"/",p=a?a.pathnameBase:"/",m=a&&a.route;{let d=m&&m.path||"";Ad(u,!m||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 v=Pn(),S;if(t){let d=typeof t=="string"?Ln(t):t;oe(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=v;let x=S.pathname||"/",C=x;if(p!=="/"){let d=p.replace(/^\//,"").split("/");C="/"+x.replace(/^\//,"").split("/").slice(d.length).join("/")}let _=Rd(e,{pathname:C});ct(m||_!=null,`No routes matched location "${S.pathname}${S.search}${S.hash}" `),ct(_==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=$g(_&&_.map(d=>Object.assign({},d,{params:Object.assign({},s,d.params),pathname:jt([p,o.encodeLocation?o.encodeLocation(d.pathname).pathname:d.pathname]),pathnameBase:d.pathnameBase==="/"?p:jt([p,o.encodeLocation?o.encodeLocation(d.pathnameBase).pathname:d.pathnameBase])})),i,n,r,l);return t&&h?g.createElement(ol.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...S},navigationType:"POP"}},h):h}function Pg(){let e=Ig(),t=Sg(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 Rg=g.createElement(Pg,null),jg=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(It.Provider,{value:this.props.routeContext},g.createElement(ga.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function Tg({routeContext:e,match:t,children:n}){let r=g.useContext(fr);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),g.createElement(It.Provider,{value:e},n)}function $g(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);oe(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,m)=>{let v,S=!1,x=null,C=null;n&&(v=i&&p.route.id?i[p.route.id]:void 0,x=p.route.errorElement||Rg,a&&(s<0&&m===0?(Ad("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,C=null):s===m&&(S=!0,C=p.route.hydrateFallbackElement||null)));let _=t.concat(o.slice(0,m+1)),h=()=>{let f;return v?f=x:S?f=C:p.route.Component?f=g.createElement(p.route.Component,null):p.route.element?f=p.route.element:f=u,g.createElement(Tg,{match:p,routeContext:{outlet:u,matches:_,isDataRoute:n!=null},children:f})};return n&&(p.route.ErrorBoundary||p.route.errorElement||m===0)?g.createElement(jg,{location:n.location,revalidation:n.revalidation,component:x,error:v,children:h(),routeContext:{outlet:null,matches:_,isDataRoute:!0},unstable_onError:r}):h()},null)}function va(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Mg(e){let t=g.useContext(fr);return oe(t,va(e)),t}function zg(e){let t=g.useContext(Io);return oe(t,va(e)),t}function Og(e){let t=g.useContext(It);return oe(t,va(e)),t}function ya(e){let t=Og(e),n=t.matches[t.matches.length-1];return oe(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Fg(){return ya("useRouteId")}function Ig(){var r;let e=g.useContext(ga),t=zg("useRouteError"),n=ya("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function Dg(){let{router:e}=Mg("useNavigate"),t=ya("useNavigate"),n=g.useRef(!1);return Id(()=>{n.current=!0}),g.useCallback(async(l,o={})=>{ct(n.current,Fd),n.current&&(typeof l=="number"?e.navigate(l):await e.navigate(l,{fromRouteId:t,...o}))},[e,t])}var ec={};function Ad(e,t,n){!t&&!ec[e]&&(ec[e]=!0,ct(!1,n))}g.memo(Ag);function Ag({routes:e,future:t,state:n,unstable_onError:r}){return Dd(e,void 0,n,r,t)}function Ud(e){oe(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function Ug({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:l,static:o=!1}){oe(!il(),"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=Ln(n));let{pathname:s="/",search:u="",hash:p="",state:m=null,key:v="default"}=n,S=g.useMemo(()=>{let x=Ot(s,i);return x==null?null:{location:{pathname:x,search:u,hash:p,state:m,key:v},navigationType:r}},[i,s,u,p,m,v,r]);return ct(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(yt.Provider,{value:a},g.createElement(ol.Provider,{children:t,value:S}))}function Bg({children:e,location:t}){return Lg(ws(e),t)}function ws(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,ws(r.props.children,o));return}oe(r.type===Ud,`[${typeof r.type=="string"?r.type:r.type.name}] is not a component. All component children of must be a or `),oe(!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=ws(r.props.children,o)),n.push(i)}),n}var Kl="get",Yl="application/x-www-form-urlencoded";function Do(e){return e!=null&&typeof e.tagName=="string"}function Hg(e){return Do(e)&&e.tagName.toLowerCase()==="button"}function Wg(e){return Do(e)&&e.tagName.toLowerCase()==="form"}function Vg(e){return Do(e)&&e.tagName.toLowerCase()==="input"}function Qg(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Kg(e,t){return e.button===0&&(!t||t==="_self")&&!Qg(e)}var Ml=null;function Yg(){if(Ml===null)try{new FormData(document.createElement("form"),0),Ml=!1}catch{Ml=!0}return Ml}var bg=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ni(e){return e!=null&&!bg.has(e)?(ct(!1,`"${e}" is not a valid \`encType\` for \`\`/\`\` and will default to "${Yl}"`),null):e}function Jg(e,t){let n,r,l,o,i;if(Wg(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(Hg(e)||Vg(e)&&(e.type==="submit"||e.type==="image")){let a=e.form;if(a==null)throw new Error('Cannot submit a
`,x=`
${v}
`;return`
${S}${x}
`}),i=i.replace(/
\s*(?=
]*>[\s\S]*?<\/div>)\s*
/g,"$1"),i}function Kv(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 Yv({content:e,streamOutput:t,sources:n}){const{think:r,answer:l}=Jd(e||""),[o,i]=Te.useState(!1),a=!!r;return y.jsxs("div",{className:"assistant-message",children:[a&&y.jsxs("div",{className:"assistant-thoughts",children:[y.jsxs("button",{className:"think-toggle",onClick:()=>i(s=>!s),"aria-expanded":o?"true":"false","aria-controls":"think-content",children:[y.jsx("span",{className:"think-toggle-icon","aria-hidden":"true",children:o?"▾":"▸"}),"Thoughts"]}),o&&y.jsx("div",{id:"think-content",className:"think-content",dangerouslySetInnerHTML:{__html:cc(r)}})]}),y.jsx("div",{className:"msg-content",dangerouslySetInnerHTML:{__html:cc(l||e||"")}}),Array.isArray(n)&&n.length>0&&y.jsx("div",{className:"msg-sources chips",children:n.map((s,u)=>{let p=s,m=!1;try{const v=new URL(s);if(v.protocol==="file:"){m=!0;const S=v.pathname.split("/").filter(Boolean);p=decodeURIComponent(S[S.length-1]||s)}else p=(v.hostname||s).replace(/^www\./i,"")}catch{}return y.jsx("a",{className:"chip",href:s,target:"_blank",rel:"noreferrer",title:s,onClick:v=>{var S,x;if(m){v.preventDefault();try{const C=new URL(s);(x=(S=window.electronAPI)==null?void 0:S.openPath)==null||x.call(S,decodeURIComponent(C.pathname))}catch{}}},children:p},s+u)})})]})}const fc="websearch.searxUrl",dc="websearch.engines",pc="chat.libraryBySession";let bv="http://127.0.0.1:8000";const Jv=48,Gv=24;function Xv(){var Ba;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,m]=g.useState(null),[v,S]=g.useState([]),[x,C]=g.useState([]),[_,h]=g.useState(null),[f,d]=g.useState(()=>{try{const c=localStorage.getItem(pc);return c?JSON.parse(c):{}}catch{return{}}}),[E,P]=g.useState(!1),[j,T]=g.useState(""),[F,A]=g.useState(""),[R,H]=g.useState(!1),[ce,Re]=g.useState(""),[Rn,al]=g.useState(""),Be=g.useRef(null),wt=g.useRef(null),z=g.useRef(null),[$,B]=g.useState(bv),[ee,fe]=g.useState("Default"),[St,ft]=g.useState(!1),[xt,kt]=g.useState(localStorage.getItem(fc)||"http://localhost:8888"),[be,Gd]=g.useState(()=>{try{const c=localStorage.getItem(dc);if(c)return JSON.parse(c)}catch{}return["duckduckgo","bing","wikipedia","github","stack_overflow"]});g.useEffect(()=>{localStorage.setItem(fc,xt||"")},[xt]),g.useEffect(()=>{try{localStorage.setItem(dc,JSON.stringify(be||[]))}catch{}},[be]);const[ul,Xd]=g.useState(!1),[Dt,Ao]=g.useState(!1),[ey,Uo]=g.useState(!0),[Zd,jn]=g.useState([]),[cl,ka]=g.useState({}),[qd,Bo]=g.useState(null),[Ho,fl]=g.useState("");function ep(c){const w=c.content||"";if(c.role==="assistant")try{const{answer:k}=Jd(w);return(k||w).trim()}catch{return w.trim()}return w}async function Ea(c){try{await navigator.clipboard.writeText(ep(c))}catch(w){console.error("Failed to copy message:",w)}}function un(c,w,k,N={}){const{removeIfEmpty:M=!1}=N;t(D=>D.map(U=>{if(U.session_id!==c)return U;const I=[];for(const W of U.messages||[]){if(W.id!==w){I.push(W);continue}M&&!k||I.push({...W,content:k})}return{...U,messages:I}}))}function At(c){return(c==null?void 0:c.name)==="AbortError"}function Wo(c){return c instanceof Error&&c.message?c.message:String(c)}async function Ca(c,w,k){if(!c)return{contextBlock:null,sources:[]};const M=await(await fetch(`${$}/libraries/${c}/context`,{method:"POST",headers:{"Content-Type":"application/json"},signal:k,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 tp(c,w){Bo(c),fl(w||"")}function dl(){Bo(null),fl("")}async function np(c){var D;const w=(((D=zn[c])==null?void 0:D.content)||"").trim(),N=(Ho??"").trim();if(N.length===0){dl();return}if(N===w){dl();return}const M=n;if(M){t(U=>U.map(I=>{if(I.session_id!==M)return I;const Ce=(I.messages||[]).slice(0,c+1).map((he,Je)=>Je===c?{...he,content:N}:he);return{...I,messages:Ce}})),Bo(null),fl(""),requestAnimationFrame(()=>Go("auto",M));try{const U=await fetch(`${$}/sessions/${M}/messages/${c}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:N})});if(!U.ok)throw new Error(`HTTP ${U.status}`)}catch(U){console.error("Failed to update message:",U),t(I=>I.map(W=>{if(W.session_id!==M)return W;const he=(W.messages||[]).map((Je,V)=>V===c?{...Je,content:w}:Je);return{...W,messages:he}}));return}await Na(c,N)}}async function Na(c,w=null){var Ce,he,Je,V,ae,we;const k=n;if(Dt||!k||typeof c!="number")return;const N=((Ce=e.find(b=>b.session_id===k))==null?void 0:Ce.messages)||[];let M=c;for(let b=c;b>=0;b--)if(((he=N[b])==null?void 0:he.role)==="user"){M=b;break}t(b=>b.map(ne=>ne.session_id===k?{...ne,messages:(ne.messages||[]).slice(0,M+1)}:ne));const D=Ta(k);let U=w??(((Je=N[M])==null?void 0:Je.content)||""),I=[];const W=[];try{const b=Oa(k),ne=w??(((V=N[M])==null?void 0:V.content)||"");if((ae=b==null?void 0:b.states)!=null&&ae.is_indexed)try{const Q=await Ca(b.slug,ne,D.signal);Q.contextBlock&&W.push(Q.contextBlock),Array.isArray(Q.sources)&&I.push(...Q.sources)}catch(Q){if(At(Q))throw Q;console.warn("local library enrichment (regenerate) failed",Q)}if(ul)try{const Q=N.slice(Math.max(0,M-7),M+1).map(de=>({role:de.role,content:de.content||""}));Q.length>0&&(Q[Q.length-1]={role:"user",content:ne});const X=await(await fetch(`${$}/websearch`,{method:"POST",headers:{"Content-Type":"application/json"},signal:D.signal,body:JSON.stringify({prompt:ne,model:ce,messages:Q,history_limit:8,searx_url:xt||null,engines:Array.isArray(be)?be:null})})).json();X&&typeof X.context_block=="string"&&X.context_block.trim()&&W.push(X.context_block.trim()),Array.isArray(X==null?void 0:X.sources)&&I.push(...X.sources)}catch(Q){if(At(Q))throw Q;console.warn("web search enrichment (regenerate) failed",Q)}if(I=[...new Set(I)],W.length>0?U=`${ne} + +${W.join(` + +`)}`:U=null,St){const Q=`msg-${Date.now()}-${Math.random()}`;let Ct="";t(X=>X.map(de=>de.session_id===k?{...de,messages:[...de.messages||[],{id:Q,role:"assistant",content:"",sources:I}]}:de));try{const X=await fetch(`${$}/sessions/${k}/regenerate`,{method:"POST",headers:{"Content-Type":"application/json"},signal:D.signal,body:JSON.stringify({index:c,model:ce,stream:!0,enriched_message:U,sources:I||[]})});if(!X.ok)throw new Error(`HTTP ${X.status}`);const de=(we=X.body)==null?void 0:we.getReader();if(!de)throw new Error("Missing response body");const Bt=new TextDecoder;let dt=!1;for(;;){const{value:dn,done:Ep}=await de.read();if(Ep)break;const Cp=Bt.decode(dn,{stream:!0});Ct+=Cp,un(k,Q,Ct),!dt&&Ee.current!==k&&(dt=!0,cn(Xo=>({...Xo,[k]:Q})),jn(Xo=>[...new Set([...Xo,k])]))}Ee.current!==k?(cn(dn=>({...dn,[k]:Q})),jn(dn=>[...new Set([...dn,k])])):Tn.current[k]?$n(dn=>({...dn,[k]:Q})):requestAnimationFrame(()=>On(Q,"smooth",k))}catch(X){if(At(X)){un(k,Q,Ct,{removeIfEmpty:!0});return}console.error(X),un(k,Q,`Error: ${Wo(X)}`,{removeIfEmpty:!0});return}}else{const Q=await fetch(`${$}/sessions/${k}/regenerate`,{method:"POST",headers:{"Content-Type":"application/json"},signal:D.signal,body:JSON.stringify({index:c,model:ce,stream:!1,enriched_message:U,sources:I||[]})});if(!Q.ok)throw new Error(`HTTP ${Q.status}`);const Ct=await Q.json(),X=`msg-${Date.now()}`;t(de=>de.map(Bt=>Bt.session_id===k?{...Bt,messages:[...Bt.messages||[],{role:"assistant",content:Ct.reply,id:X,sources:I}]}:Bt)),Ee.current!==k?(cn(de=>({...de,[k]:X})),jn(de=>[...new Set([...de,k])])):Tn.current[k]?$n(de=>({...de,[k]:X})):requestAnimationFrame(()=>On(X,"smooth",k))}}catch(b){At(b)||console.error(b)}finally{Vo(D)}}const[_a,rp]=g.useState({}),Tn=g.useRef({}),[lp,cn]=g.useState({}),fn=g.useRef({}),La=g.useRef({}),[Pa,$n]=g.useState({}),[op,Ra]=g.useState({}),ja=(c,w,k)=>c!=null&&c.id?c.id:`${k}:${w}`;g.useEffect(()=>{var w;if(!n)return;const c=((w=e.find(k=>k.session_id===n))==null?void 0:w.messages)||[];Ra(k=>{const N={};return c.forEach((M,D)=>{if(M.role!=="user")return;const U=ja(M,D,n),W=(M.content||"").split(/\r\n|\r|\n/).length>30;N[U]=W?k[U]??!0:!1}),N})},[e,n]);function ip(c){Ra(w=>({...w,[c]:!(w[c]??!0)}))}const dr=Te.useCallback((c,w)=>{rp(k=>{const N={...k,[c]:w};return Tn.current=N,N})},[]),Mn=g.useRef(null),sp=g.useRef(!1),ap=g.useRef(null),Ee=g.useRef(n);g.useEffect(()=>{Ee.current=n},[n]);const Ta=Te.useCallback(c=>{const w=new AbortController;return Mn.current={controller:w,sessionId:c},Ao(!0),w},[]),Vo=Te.useCallback(c=>{var w;((w=Mn.current)==null?void 0:w.controller)===c&&(Mn.current=null,Ao(!1))},[]),up=Te.useCallback(()=>{const c=Mn.current;c&&(Mn.current=null,c.controller.abort(),Ao(!1))},[]);g.useEffect(()=>()=>{var c;(c=Mn.current)==null||c.controller.abort()},[]);const Ut=g.useRef(null),[cp,fp]=g.useState(230),[pl,$a]=g.useState(!1),dp=Te.useCallback(c=>{$a(!0)},[]),Qo=Te.useCallback(()=>{$a(!1)},[]),Ko=Te.useCallback(c=>{if(pl){const w=Math.max(230,Math.min(500,c.clientX));fp(w)}},[pl]);Te.useEffect(()=>(window.addEventListener("mousemove",Ko),window.addEventListener("mouseup",Qo),()=>{window.removeEventListener("mousemove",Ko),window.removeEventListener("mouseup",Qo)}),[Ko,Qo]),Te.useEffect(()=>{pl?document.body.classList.add("no-select"):document.body.classList.remove("no-select")},[pl]),Te.useEffect(()=>{const c=async w=>{const k=w.target.closest(".codeblock__copy");if(!k)return;const N=k.closest(".codeblock"),M=N==null?void 0:N.querySelector("pre > code");if(M)try{await navigator.clipboard.writeText(M.textContent||""),k.classList.add("copied"),setTimeout(()=>k.classList.remove("copied"),800)}catch(D){console.error("Copy failed:",D)}};return document.addEventListener("click",c),()=>document.removeEventListener("click",c)},[]),g.useEffect(()=>{window.electronAPI.getSettings().then(w=>{B(w.ollamaApiUrl),fe(w.colorScheme||"Default"),Re(w.chatModel||""),ft(w.streamOutput||!1),ka(w.scrollPositions||{}),qr(w.colorScheme||"Default")});const c=()=>{var w;l==="chats"&&((w=wt.current)==null||w.focus())};return window.electronAPI.onWindowFocus(c),()=>{}},[l]),g.useEffect(()=>{qr(ee)},[ee]);const pp=c=>{!c||!$||fetch(`${$}/history?session_id=${encodeURIComponent(c)}`).then(w=>w.json()).then(w=>{t(k=>k.map(N=>N.session_id===c?{...N,messages:w.messages||[]}:N))}).catch(()=>{})};async function hl(){if($)try{const w=await(await fetch(`${$}/libraries`)).json(),k=Array.isArray(w.libraries)?w.libraries:[];if(S(k),k.length===0){h(null);return}k.some(N=>N.slug===_)||h(k[0].slug)}catch(c){console.warn("Failed to load libraries",c)}}async function Yo(){if($)try{const w=await(await fetch(`${$}/jobs`)).json();C(Array.isArray(w.jobs)?w.jobs:[])}catch(c){console.warn("Failed to load library jobs",c)}}async function Ma(c=null){const k=(typeof c=="string"?c:j).trim();if(!k){A("Name is required.");return}try{A("");const N=await fetch(`${$}/libraries`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:k})});if(!N.ok){const D=await N.text();throw new Error(D||`HTTP ${N.status}`)}const M=await N.json();P(!1),T(""),await hl(),M!=null&&M.slug&&h(M.slug)}catch(N){console.error("Failed to create library",N),A(String((N==null?void 0:N.message)||N))}}g.useEffect(()=>{$&&(Uo(!0),fetch(`${$}/sessions`).then(c=>c.json()).then(c=>{const w=c.sessions.map(k=>({...k,messages:[]}));t(w),w.length>0?r(w[0].session_id):r(null),Uo(!1)}).catch(()=>{Uo(!1)}))},[$]),g.useEffect(()=>{$&&(hl(),Yo())},[$]),g.useEffect(()=>{try{localStorage.setItem(pc,JSON.stringify(f||{}))}catch{}},[f]),g.useEffect(()=>{if(!$)return;const c=setInterval(()=>{hl(),Yo()},3e3);return()=>clearInterval(c)},[$,l,_]),g.useEffect(()=>{pp(n)},[n]),g.useEffect(()=>{const c=new Set(v.map(w=>w.slug));d(w=>{let k=!1;const N={};for(const[M,D]of Object.entries(w||{}))c.has(D)?N[M]=D:k=!0;return k?N:w})},[v]);const bo=c=>{o(c)},hp=c=>{wp(c)},zn=g.useMemo(()=>{var c;return((c=e.find(w=>w.session_id===n))==null?void 0:c.messages)||[]},[n,e]),ml=g.useMemo(()=>v.find(c=>c.slug===_)||null,[_,v]),Et=n&&f[n]||null,nt=g.useMemo(()=>v.find(c=>c.slug===Et)||null,[Et,v]),za=g.useMemo(()=>Et?x.some(c=>c.slug===Et&&(c.status==="queued"||c.status==="running")):!1,[Et,x]),Jo=g.useMemo(()=>{var c,w;return nt?(c=nt.files)!=null&&c.length?(w=nt.states)!=null&&w.is_indexed?"":za?" (syncing)":" (needs sync)":" (empty)":""},[nt,za]);function mp(c){return c&&f[c]||null}function Oa(c){const w=mp(c);return w&&v.find(k=>k.slug===w)||null}function Fa(c){return c?x.some(w=>w.slug===c&&(w.status==="queued"||w.status==="running")):!1}function Ia(c,w){c&&d(k=>{const N={...k||{}};return w?N[c]=w:delete N[c],N})}function gp(c){c&&d(w=>{let k=!1;const N={};for(const[M,D]of Object.entries(w||{})){if(D===c){k=!0;continue}N[M]=D}return k?N:w})}g.useEffect(()=>{if(!R)return;const c=w=>{var k;(k=z.current)!=null&&k.contains(w.target)||H(!1)};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[R]),g.useEffect(()=>{H(!1)},[n,l]),g.useEffect(()=>{const c=n,w=l;return()=>{if(w==="chats"&&c){const k=typeof fn.current[c]=="number"?fn.current[c]:Be.current?Be.current.scrollTop:0;ka(N=>{const M={...N,[c]:k};return window.electronAPI.updateSettings({scrollPositions:M}),M})}}},[n,l]),g.useEffect(()=>{const c=Be.current;if(!c)return;const w=()=>{const{scrollTop:k,scrollHeight:N,clientHeight:M}=c,D=N-k-M<=Gv;if(n){const U=La.current[n],I=typeof U=="number"&&kc.removeEventListener("scroll",w)},[n,dr]),g.useEffect(()=>{const c=n;c&&_a[c]===!1&&$n(w=>{if(!(c in w))return w;const k={...w};return delete k[c],k})},[n,_a]),g.useLayoutEffect(()=>{if(l!=="chats"||!n)return;const c=Be.current;if(!c)return;Ut.current=null;const w=()=>{if(Ut.current===n)return;const U=typeof fn.current[n]=="number"?fn.current[n]:void 0,I=typeof U=="number"?U:cl[n];if(typeof I=="number"){c.scrollTop=I,Ut.current=n;return}zn.length>0&&(c.scrollTop=c.scrollHeight,Ut.current=n)};w();const k=requestAnimationFrame(w),N=()=>{Ut.current!==n&&requestAnimationFrame(w)},M=new MutationObserver(N);M.observe(c,{childList:!0,subtree:!0});const D=new ResizeObserver(N);return D.observe(c),()=>{cancelAnimationFrame(k),M.disconnect(),D.disconnect()}},[n,l,zn.length,cl]),g.useEffect(()=>{if(l!=="chats"||!n||Ut.current===n)return;const c=typeof fn.current[n]=="number"?fn.current[n]:void 0;typeof(typeof c=="number"?c:cl[n])!="number"&&zn.length>0&&requestAnimationFrame(()=>{const k=Be.current;k&&(k.scrollTop=k.scrollHeight,Ut.current=n)})},[zn.length,n,l,cl]);const Go=(c="smooth",w=null)=>{const k=Be.current;if(!k)return;const N=w??Ee.current;Ee.current===N&&(k.scrollTo({top:k.scrollHeight,behavior:c}),dr(N,!1))},On=(c,w="auto",k=null)=>{const N=Be.current;if(!N)return;const M=k??Ee.current;if(Ee.current!==M)return;const D=document.getElementById(c);if(D){const U=Math.max(0,D.offsetTop-Jv);N.scrollTo({top:U,behavior:w})}},vp=()=>{const c=Ee.current,w=Pa[c];w&&(On(w,"smooth",c),$n(k=>{const{[c]:N,...M}=k;return M}))};async function Da(){var M,D,U;if(Dt||!Rn.trim()||!ce)return;let c=n,w=!1;if(c){const I=e.find(W=>W.session_id===c);w=I&&I.name==="New Chat"&&I.messages.length===0}else{const I=await Aa();await new Promise(W=>setTimeout(W,200)),c=I.session_id,w=!0}const k={role:"user",content:Rn.trim(),id:`msg-${Date.now()}-${Math.random()}`};sp.current=!0,ap.current=c,dr(c,!1),Ee.current===c&&(Ut.current=Ee.current),Ld.flushSync(()=>{t(I=>I.map(W=>W.session_id===c?{...W,messages:[...W.messages||[],k]}:W)),al("")}),requestAnimationFrame(()=>Go("auto",c));const N=Ta(c);try{let I=[];try{I=[...(((M=e.find(we=>we.session_id===c))==null?void 0:M.messages)||[]).slice(-8).map(we=>({role:we.role,content:we.content||""})),{role:"user",content:k.content}]}catch{}let W=k.content,Ce=[];const he=[],Je=Oa(c);if((D=Je==null?void 0:Je.states)!=null&&D.is_indexed)try{const V=await Ca(Je.slug,k.content,N.signal);V.contextBlock&&he.push(V.contextBlock),Array.isArray(V.sources)&&Ce.push(...V.sources)}catch(V){if(At(V))throw V;console.warn("local library enrichment failed",V)}if(ul)try{const ae=await(await fetch(`${$}/websearch`,{method:"POST",headers:{"Content-Type":"application/json"},signal:N.signal,body:JSON.stringify({prompt:k.content,model:ce,messages:I,history_limit:8,searx_url:xt||null,engines:Array.isArray(be)?be:null})})).json();ae&&typeof ae.context_block=="string"&&ae.context_block.trim()&&he.push(ae.context_block.trim()),Array.isArray(ae==null?void 0:ae.sources)&&Ce.push(...ae.sources)}catch(V){if(At(V))throw V;console.warn("web search enrichment failed",V)}if(Ce=[...new Set(Ce)],he.length>0&&(W=`${k.content} + +${he.join(` + +`)}`),St){const V=`msg-${Date.now()}-${Math.random()}`;let ae="";const we={role:"assistant",content:"",id:V,sources:Ce};t(b=>b.map(ne=>ne.session_id===c?{...ne,messages:[...ne.messages||[],we]}:ne));try{const b=await fetch(`${$}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},signal:N.signal,body:JSON.stringify({session_id:c,model:ce,message:k.content,enriched_message:he.length>0?W:null,stream:!0,sources:Ce||[]})});if(!b.ok)throw new Error(`HTTP ${b.status}`);const ne=(U=b.body)==null?void 0:U.getReader();if(!ne)throw new Error("Missing response body");const Q=new TextDecoder;let Ct=!1;for(;;){const{value:X,done:de}=await ne.read();if(de){un(c,V,ae),Ee.current===c?Tn.current[c]?$n(dt=>({...dt,[c]:V})):requestAnimationFrame(()=>On(V,"smooth",c)):(cn(dt=>({...dt,[c]:V})),jn(dt=>[...new Set([...dt,c])]));break}const Bt=Q.decode(X,{stream:!0});ae+=Bt,un(c,V,ae),Ee.current===c&&!Tn.current[c]&&Go("auto",c),Ee.current!==c&&!Ct&&(cn(dt=>({...dt,[c]:V})),Ct=!0)}}catch(b){if(At(b)){un(c,V,ae,{removeIfEmpty:!0});return}console.error("Failed to send message:",b),un(c,V,"Error: "+Wo(b),{removeIfEmpty:!0});return}}else{const V=await fetch(`${$}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},signal:N.signal,body:JSON.stringify({session_id:c,model:ce,message:k.content,enriched_message:he.length>0?W:null,stream:!1,sources:Ce||[]})});if(!V.ok)throw new Error(`HTTP ${V.status}`);const ae=await V.json(),we=`msg-${Date.now()}`,b={role:"assistant",content:ae.reply,id:we,sources:Ce};t(ne=>ne.map(Q=>Q.session_id===c?{...Q,messages:[...Q.messages||[],b]}:Q)),we&&(Ee.current===c?Tn.current[c]?$n(ne=>({...ne,[c]:we})):requestAnimationFrame(()=>On(we,"smooth",c)):cn(ne=>({...ne,[c]:we})))}Ee.current!==c&&jn(V=>[...new Set([...V,c])]),w&&fetch(`${$}/generate-title`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:c,message:k.content,model:ce})}).then(V=>V.json()).then(V=>{const ae=V.title.replace(/[\s\S]*?<\/think(?:ing)?>/i,"").trim();t(we=>we.map(b=>b.session_id===c?{...b,name:ae}:b))})}catch(I){if(At(I)){Vo(N);return}console.error("Failed to send message:",I);const W={role:"assistant",content:"Error: "+Wo(I),id:`msg-${Date.now()}-${Math.random()}`};t(Ce=>Ce.map(he=>he.session_id===c?{...he,messages:[...he.messages,W]}:he))}finally{Vo(N)}}function yp(){Xd(c=>!c)}async function Aa(){var M;const c="sess-"+Math.random().toString(36).slice(2)+Date.now().toString(36),k=await(await fetch(`${$}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:c})})).json(),N={...k,messages:[]};return t(D=>[N,...D]),r(k.session_id),(M=wt.current)==null||M.focus(),k}function wp(c){r(c),jn(k=>k.filter(N=>N!==c));const w=lp[c];w&&requestAnimationFrame(()=>{let k=12;const N=()=>{if(!Be.current)return;let D=document.getElementById(w);if(!D){const U=e.find(I=>I.session_id===c);if(U&&Array.isArray(U.messages))for(let I=U.messages.length-1;I>=0;I--){const W=U.messages[I];if(W.role==="assistant"&&W.id){D=document.getElementById(W.id);break}}}D?(On(D.id,"smooth",c),cn(U=>{const{[c]:I,...W}=U;return W})):k-- >0&&requestAnimationFrame(N)};requestAnimationFrame(N)})}function Sp(c,w){fetch(`${$}/sessions/${c}/rename`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:w})}).then(()=>{t(k=>k.map(N=>N.session_id===c?{...N,name:w}:N)),u(null)})}function xp(c,w){const k=(w||"").trim(),N=v.find(M=>M.slug===c);if(!N){m(null);return}if(!k||k===N.name){m(null);return}fetch(`${$}/libraries/${c}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:k})}).then(()=>{S(M=>M.map(D=>D.slug===c?{...D,name:k}:D)),m(null)})}function Ua(c){fetch(`${$}/sessions/${c}`,{method:"DELETE"}).then(()=>{const w=e.filter(k=>k.session_id!==c);t(w),d(k=>{const N={...k||{}};return delete N[c],N}),n===c&&r(w.length>0?w[0].session_id:null)})}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=>{Ua(w.session_id)})},[n,e,$]);const kp=c=>{var k;window.getSelection().toString().length>0||document.activeElement!==wt.current&&(c.target.closest(".msg")||(k=wt.current)==null||k.focus())};return y.jsxs("div",{className:"app",style:{gridTemplateColumns:`${cp}px 1fr`},children:[y.jsxs("div",{className:"sidebar",children:[y.jsxs("div",{className:"sidebar-header",children:[y.jsx("div",{className:`sidebar-tab ${l==="chats"?"active":""}`,onClick:()=>bo("chats"),children:"Chats"}),y.jsx("div",{className:`sidebar-tab ${l==="dbs"?"active":""}`,onClick:()=>bo("dbs"),children:"DBs"}),y.jsx("div",{className:`sidebar-tab ${l==="settings"?"active":""}`,onClick:()=>bo("settings"),children:"Settings"})]}),y.jsxs("div",{className:"sidebar-content",children:[l==="chats"&&y.jsx("div",{className:"chat-list",children:e.map(c=>y.jsx("div",{className:`chat-item ${c.session_id===n?"active":""}`,onClick:()=>hp(c.session_id),children:s===c.session_id?y.jsx("input",{type:"text",className:"rename-input",defaultValue:c.name,onBlur:()=>u(null),onKeyDown:w=>{w.key==="Enter"?Sp(c.session_id,w.target.value):w.key==="Escape"&&u(null)},autoFocus:!0}):y.jsxs(y.Fragment,{children:[y.jsx("span",{children:c.name}),y.jsxs("div",{className:"chat-item-buttons",children:[Zd.includes(c.session_id)&&y.jsx("div",{className:"unread-dot"}),y.jsx("button",{className:"icon-button",onClick:w=>{w.stopPropagation(),u(c.session_id)},children:y.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:y.jsx("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}),y.jsx("button",{className:"icon-button",onClick:w=>{w.stopPropagation(),Ua(c.session_id)},children:y.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:[y.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),y.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})},c.session_id))}),l==="dbs"&&y.jsx("div",{className:"db-list",children:v.length===0?y.jsx("div",{className:"empty-list-message",children:"No databases yet."}):v.map(c=>y.jsx("div",{className:`chat-item ${c.slug===_?"active":""}`,onClick:()=>h(c.slug),children:p===c.slug?y.jsx("input",{type:"text",className:"rename-input",defaultValue:c.name,onBlur:()=>m(null),onKeyDown:w=>{w.key==="Enter"?xp(c.slug,w.target.value):w.key==="Escape"&&m(null)},autoFocus:!0}):y.jsxs(y.Fragment,{children:[y.jsx("span",{children:c.name}),y.jsxs("div",{className:"chat-item-buttons",children:[Et===c.slug&&y.jsx("div",{className:"db-active-badge",children:"Chat"}),Fa(c.slug)&&y.jsx("div",{className:"db-active-badge",children:"Syncing"}),y.jsx("button",{className:"icon-button",onClick:w=>{w.stopPropagation(),m(c.slug)},children:y.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:y.jsx("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})})]})]})},c.slug))}),l==="settings"&&y.jsxs("div",{className:"settings-list",children:[y.jsx("div",{className:`settings-item ${i==="General"?"active":""}`,onClick:()=>a("General"),children:"General"}),y.jsx("div",{className:`settings-item ${i==="Interface"?"active":""}`,onClick:()=>a("Interface"),children:"Interface"}),y.jsx("div",{className:`settings-item ${i==="Websearch"?"active":""}`,onClick:()=>a("Websearch"),children:"Websearch"})]})]}),l!=="settings"&&y.jsxs("div",{className:"sidebar-footer",children:[l==="chats"&&y.jsx("button",{className:"button new-chat-button",onClick:Aa,children:"New Chat"}),l==="dbs"&&(E?y.jsxs("div",{className:"new-db-form",children:[y.jsx("input",{type:"text",className:"rename-input",value:j,onChange:c=>T(c.target.value),onKeyDown:c=>{c.key==="Enter"?Ma():c.key==="Escape"&&(P(!1),T(""),A(""))},placeholder:"Database name",autoFocus:!0}),F&&y.jsx("div",{className:"form-error",children:F}),y.jsxs("div",{className:"new-db-actions",children:[y.jsx("button",{className:"button new-db-button",onClick:()=>Ma(),children:"Create"}),y.jsx("button",{className:"button ghost",onClick:()=>{P(!1),T(""),A("")},children:"Cancel"})]})]}):y.jsx("button",{className:"button new-db-button",onClick:()=>{P(!0),A("")},children:"New Database"}))]}),y.jsx("div",{className:"resizer",onMouseDown:dp})]}),y.jsxs("div",{className:"main-content",children:[l==="chats"&&y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"header",children:[y.jsxs("strong",{children:["Chat - ",((Ba=e.find(c=>c.session_id===n))==null?void 0:Ba.name)||"New Chat"]}),nt&&y.jsx("span",{className:"header-subtle",children:`DB: ${nt.name}${Jo}`})]}),y.jsx("div",{className:"chat",ref:Be,onClick:kp,children:zn.map((c,w)=>{const k=c.role==="user"&&qd===w;return y.jsx("div",{id:c.id,className:"msg "+(c.role==="user"?"user":"assistant")+(k?" editing":""),children:c.role==="assistant"?y.jsxs("div",{className:"assistant-message-wrapper",children:[y.jsx(Yv,{content:c.content,streamOutput:St,sources:c.sources}),!Dt&&y.jsxs("div",{className:"message-options-bar assistant-options",children:[y.jsx("button",{className:"icon-button",title:"Copy message",onClick:()=>Ea(c),children:y.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:[y.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),y.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}),y.jsx("button",{className:"icon-button",title:"Regenerate response",onClick:()=>Na(w),children:y.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:y.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"})})})]})]}):y.jsxs("div",{className:"user-message-wrapper",children:[k?y.jsxs("div",{className:"msg-content msg-content--user editing",children:[y.jsx("div",{className:"user-edit-shadow","aria-hidden":"true",children:Ho}),y.jsx(sc,{className:"edit-message-input edit-overlay",value:Ho,onChange:N=>fl(N.target.value),onBlur:dl,onKeyDown:N=>{N.key==="Escape"&&(N.preventDefault(),dl()),N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),np(w))},autoFocus:!0,minRows:1})]}):(()=>{const N=c.content||"",M=N.split(/\r\n|\r|\n/),D=M.length>30,U=ja(c,w,n),I=D?op[U]??!0:!1,W=I?M.slice(0,30).join(` +`)+` +…`:N;return y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"msg-content msg-content--user",children:W}),D&&y.jsx("button",{className:"user-msg-expand",onClick:()=>ip(U),"aria-expanded":I?"false":"true",children:I?"Show entire message":"Collapse"})]})})(),!Dt&&!k&&y.jsxs("div",{className:"message-options-bar user-options",children:[y.jsx("button",{className:"icon-button",title:"Edit message",onClick:()=>tp(w,c.content),children:y.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:[y.jsx("path",{d:"M12 20h9"}),y.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"})]})}),y.jsx("button",{className:"icon-button",title:"Copy message",onClick:()=>Ea(c),children:y.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:[y.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),y.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),Pa[n]&&y.jsxs("button",{className:"new-msg-tip",onClick:vp,title:"Jump to the new message","aria-label":"Jump to the new message",children:["New message",y.jsx("span",{style:{marginLeft:6},children:"↓"})]}),y.jsx("div",{className:"footer",children:y.jsxs("div",{className:"footer-content-wrapper",children:[y.jsx(sc,{ref:wt,className:"input",value:Rn,onChange:c=>al(c.target.value),onKeyDown:c=>{c.key==="Enter"&&!c.shiftKey&&(c.preventDefault(),Da())},placeholder:"Ask any question...",maxRows:13}),y.jsxs("div",{className:"footer-tool-group",ref:z,children:[y.jsx("button",{type:"button",className:"db-picker-toggle"+(nt?" active":""),onClick:()=>{n&&H(c=>!c)},title:nt?`Database: ${nt.name}${Jo}`:"Select database for this chat","aria-haspopup":"menu","aria-expanded":R,disabled:!n,children:y.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:[y.jsx("ellipse",{cx:"12",cy:"5",rx:"8",ry:"3"}),y.jsx("path",{d:"M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5"}),y.jsx("path",{d:"M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6"})]})}),R&&y.jsxs("div",{className:"db-picker-menu",role:"menu",children:[y.jsxs("button",{type:"button",className:"db-picker-option"+(Et?"":" selected"),onClick:()=>{Ia(n,null),H(!1)},children:[y.jsx("span",{children:"No database"}),!Et&&y.jsx("span",{className:"db-picker-status",children:"Selected"})]}),v.length===0?y.jsx("div",{className:"db-picker-empty",children:"No databases yet."}):v.map(c=>{var M,D,U;const w=Et===c.slug,k=Fa(c.slug),N=(M=c.files)!=null&&M.length?(D=c.states)!=null&&D.is_indexed?"Ready":k?"Syncing":"Needs sync":"Empty";return y.jsxs("button",{type:"button",className:"db-picker-option"+(w?" selected":""),disabled:!((U=c.files)!=null&&U.length),onClick:()=>{Ia(n,c.slug),H(!1)},children:[y.jsx("span",{children:c.name}),y.jsx("span",{className:"db-picker-status",children:w?"Selected":N})]},c.slug)})]})]}),y.jsx("button",{type:"button",className:"websearch-toggle"+(ul?" active":""),onClick:yp,title:"Toggle web search","aria-pressed":ul,children:y.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:[y.jsx("circle",{cx:"12",cy:"12",r:"10"}),y.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),y.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"})]})}),y.jsx("button",{className:"button",onClick:Dt?up:Da,title:Dt?"Cancel generation":"Send","aria-label":Dt?"Cancel generation":"Send",children:Dt?y.jsx("div",{className:"spinner"}):"Send"})]})})]}),l==="dbs"&&y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"header",children:[y.jsx("strong",{children:(ml==null?void 0:ml.name)||"Databases"}),nt&&y.jsx("span",{className:"header-subtle",children:`Current chat DB: ${nt.name}${Jo}`})]}),y.jsx(Vv,{apiBase:$,library:ml,jobs:x,onRefresh:async()=>{await hl(),await Yo()},onDeleted:c=>{if(_===c){const w=v.find(k=>k.slug!==c);h((w==null?void 0:w.slug)||null)}gp(c)}})]}),l==="settings"&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"header",children:y.jsxs("strong",{children:[i," Settings"]})}),i==="General"&&y.jsx(Dv,{onModelChange:Re,streamOutput:St,onStreamOutputChange:ft}),i==="Interface"&&y.jsx(Hv,{}),i==="Websearch"&&y.jsx(Qv,{searxUrl:xt,setSearxUrl:kt,engines:be,setEngines:Gd})]})]})]})}function Zv(){return g.useEffect(()=>{window.electronAPI.getSettings().then(e=>{qr(e.colorScheme||"Default")})},[]),y.jsx(Te.StrictMode,{children:y.jsx(cv,{children:y.jsx(Bg,{children:y.jsx(Ud,{path:"/",element:y.jsx(Xv,{})})})})})}const qv=Pd(document.getElementById("root"));qv.render(y.jsx(Zv,{})); diff --git a/dist/index.html b/dist/index.html index a03c29d..b7d83ca 100644 --- a/dist/index.html +++ b/dist/index.html @@ -5,8 +5,8 @@ LLM Desktop - - + +
diff --git a/src/App.jsx b/src/App.jsx index 07d094c..10ee051 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -773,22 +773,6 @@ async function regenerateFromIndex(index, overrideUserText = null) { } } - async function startLibraryJob(slug, kind) { - const options = { - method: 'POST', - headers: { 'Content-Type': 'application/json' } - } - if (kind === 'embed') { - options.body = JSON.stringify({}) - } - const response = await fetch(`${ollamaApiUrl}/libraries/${slug}/jobs/${kind}`, options) - if (!response.ok) { - const detail = await response.text() - throw new Error(detail || `HTTP ${response.status}`) - } - await refreshLibraryJobs() - } - async function createLibrary(nameOverride = null) { const rawName = typeof nameOverride === 'string' ? nameOverride : newLibraryName const name = rawName.trim()