(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))o(a);new MutationObserver(a=>{for(const c of a)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&o(u)}).observe(document,{childList:!0,subtree:!0});function r(a){const c={};return a.integrity&&(c.integrity=a.integrity),a.referrerPolicy&&(c.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?c.credentials="include":a.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function o(a){if(a.ep)return;a.ep=!0;const c=r(a);fetch(a.href,c)}})();function lo(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ta={exports:{}},wi={},na={exports:{}},Ce={};/** * @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 Uf;function Jm(){if(Uf)return Ce;Uf=1;var t=Symbol.for("react.element"),i=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),x=Symbol.iterator;function v(P){return P===null||typeof P!="object"?null:(P=x&&P[x]||P["@@iterator"],typeof P=="function"?P:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,L={};function j(P,B,C){this.props=P,this.context=B,this.refs=L,this.updater=C||w}j.prototype.isReactComponent={},j.prototype.setState=function(P,B){if(typeof P!="object"&&typeof P!="function"&&P!=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,P,B,"setState")},j.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function T(){}T.prototype=j.prototype;function O(P,B,C){this.props=P,this.context=B,this.refs=L,this.updater=C||w}var A=O.prototype=new T;A.constructor=O,E(A,j.prototype),A.isPureReactComponent=!0;var J=Array.isArray,le=Object.prototype.hasOwnProperty,D={current:null},ue={key:!0,ref:!0,__self:!0,__source:!0};function ce(P,B,C){var me,we={},he=null,Te=null;if(B!=null)for(me in B.ref!==void 0&&(Te=B.ref),B.key!==void 0&&(he=""+B.key),B)le.call(B,me)&&!ue.hasOwnProperty(me)&&(we[me]=B[me]);var Se=arguments.length-2;if(Se===1)we.children=C;else if(1>>1,B=U[P];if(0>>1;Pa(we,S))hea(Te,we)?(U[P]=Te,U[he]=S,P=he):(U[P]=we,U[me]=S,P=me);else if(hea(Te,S))U[P]=Te,U[he]=S,P=he;else break e}}return re}function a(U,re){var S=U.sortIndex-re.sortIndex;return S!==0?S:U.id-re.id}if(typeof performance=="object"&&typeof performance.now=="function"){var c=performance;t.unstable_now=function(){return c.now()}}else{var u=Date,d=u.now();t.unstable_now=function(){return u.now()-d}}var m=[],h=[],y=1,x=null,v=3,w=!1,E=!1,L=!1,j=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function A(U){for(var re=r(h);re!==null;){if(re.callback===null)o(h);else if(re.startTime<=U)o(h),re.sortIndex=re.expirationTime,i(m,re);else break;re=r(h)}}function J(U){if(L=!1,A(U),!E)if(r(m)!==null)E=!0,$(le);else{var re=r(h);re!==null&&se(J,re.startTime-U)}}function le(U,re){E=!1,L&&(L=!1,T(ce),ce=-1),w=!0;var S=v;try{for(A(re),x=r(m);x!==null&&(!(x.expirationTime>re)||U&&!Y());){var P=x.callback;if(typeof P=="function"){x.callback=null,v=x.priorityLevel;var B=P(x.expirationTime<=re);re=t.unstable_now(),typeof B=="function"?x.callback=B:x===r(m)&&o(m),A(re)}else o(m);x=r(m)}if(x!==null)var C=!0;else{var me=r(h);me!==null&&se(J,me.startTime-re),C=!1}return C}finally{x=null,v=S,w=!1}}var D=!1,ue=null,ce=-1,ge=5,R=-1;function Y(){return!(t.unstable_now()-RU||125P?(U.sortIndex=S,i(h,U),r(m)===null&&U===r(h)&&(L?(T(ce),ce=-1):L=!0,se(J,S-P))):(U.sortIndex=B,i(m,U),E||w||(E=!0,$(le))),U},t.unstable_shouldYield=Y,t.unstable_wrapCallback=function(U){var re=v;return function(){var S=v;v=re;try{return U.apply(this,arguments)}finally{v=S}}}})(la)),la}var Qf;function ng(){return Qf||(Qf=1,ia.exports=tg()),ia.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 Gf;function rg(){if(Gf)return xt;Gf=1;var t=Aa(),i=ng();function r(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,l=1;l"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),m=Object.prototype.hasOwnProperty,h=/^[: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]*$/,y={},x={};function v(e){return m.call(x,e)?!0:m.call(y,e)?!1:h.test(e)?x[e]=!0:(y[e]=!0,!1)}function w(e,n,l,s){if(l!==null&&l.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return s?!1:l!==null?!l.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function E(e,n,l,s){if(n===null||typeof n>"u"||w(e,n,l,s))return!0;if(s)return!1;if(l!==null)switch(l.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function L(e,n,l,s,f,p,k){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=s,this.attributeNamespace=f,this.mustUseProperty=l,this.propertyName=e,this.type=n,this.sanitizeURL=p,this.removeEmptyString=k}var j={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){j[e]=new L(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];j[n]=new L(n,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){j[e]=new L(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){j[e]=new L(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){j[e]=new L(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){j[e]=new L(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){j[e]=new L(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){j[e]=new L(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){j[e]=new L(e,5,!1,e.toLowerCase(),null,!1,!1)});var T=/[\-:]([a-z])/g;function O(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 n=e.replace(T,O);j[n]=new L(n,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(T,O);j[n]=new L(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(T,O);j[n]=new L(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){j[e]=new L(e,1,!1,e.toLowerCase(),null,!1,!1)}),j.xlinkHref=new L("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){j[e]=new L(e,1,!1,e.toLowerCase(),null,!0,!0)});function A(e,n,l,s){var f=j.hasOwnProperty(n)?j[n]:null;(f!==null?f.type!==0:s||!(2b||f[k]!==p[b]){var N=` `+f[k].replace(" at new "," at ");return e.displayName&&N.includes("")&&(N=N.replace("",e.displayName)),N}while(1<=k&&0<=b);break}}}finally{C=!1,Error.prepareStackTrace=l}return(e=e?e.displayName||e.name:"")?B(e):""}function we(e){switch(e.tag){case 5:return B(e.type);case 16:return B("Lazy");case 13:return B("Suspense");case 19:return B("SuspenseList");case 0:case 2:case 15:return e=me(e.type,!1),e;case 11:return e=me(e.type.render,!1),e;case 1:return e=me(e.type,!0),e;default:return""}}function he(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 ue:return"Fragment";case D:return"Portal";case ge:return"Profiler";case ce:return"StrictMode";case ve:return"Suspense";case X:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Y:return(e.displayName||"Context")+".Consumer";case R:return(e._context.displayName||"Context")+".Provider";case Z:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case G:return n=e.displayName||null,n!==null?n:he(e.type)||"Memo";case $:n=e._payload,e=e._init;try{return he(e(n))}catch{}}return null}function Te(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return he(n);case 8:return n===ce?"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 n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function Se(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ie(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function He(e){var n=Ie(e)?"checked":"value",l=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),s=""+e[n];if(!e.hasOwnProperty(n)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var f=l.get,p=l.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(k){s=""+k,p.call(this,k)}}),Object.defineProperty(e,n,{enumerable:l.enumerable}),{getValue:function(){return s},setValue:function(k){s=""+k},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function Jt(e){e._valueTracker||(e._valueTracker=He(e))}function Di(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var l=n.getValue(),s="";return e&&(s=Ie(e)?e.checked?"true":"false":e.value),e=s,e!==l?(n.setValue(e),!0):!1}function rr(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 Mr(e,n){var l=n.checked;return S({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:l??e._wrapperState.initialChecked})}function Dr(e,n){var l=n.defaultValue==null?"":n.defaultValue,s=n.checked!=null?n.checked:n.defaultChecked;l=Se(n.value!=null?n.value:l),e._wrapperState={initialChecked:s,initialValue:l,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function Ar(e,n){n=n.checked,n!=null&&A(e,"checked",n,!1)}function ir(e,n){Ar(e,n);var l=Se(n.value),s=n.type;if(l!=null)s==="number"?(l===0&&e.value===""||e.value!=l)&&(e.value=""+l):e.value!==""+l&&(e.value=""+l);else if(s==="submit"||s==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?lr(e,n.type,l):n.hasOwnProperty("defaultValue")&&lr(e,n.type,Se(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function Ai(e,n,l){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var s=n.type;if(!(s!=="submit"&&s!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,l||n===e.value||(e.value=n),e.defaultValue=n}l=e.name,l!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,l!==""&&(e.name=l)}function lr(e,n,l){(n!=="number"||rr(e.ownerDocument)!==e)&&(l==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+l&&(e.defaultValue=""+l))}var fn=Array.isArray;function dn(e,n,l,s){if(e=e.options,n){n={};for(var f=0;f"+n.valueOf().toString()+"",n=xe.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function Ne(e,n){if(n){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=n;return}}e.textContent=n}var Ze={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},Zt=["Webkit","ms","Moz","O"];Object.keys(Ze).forEach(function(e){Zt.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),Ze[n]=Ze[e]})});function _t(e,n,l){return n==null||typeof n=="boolean"||n===""?"":l||typeof n!="number"||n===0||Ze.hasOwnProperty(e)&&Ze[e]?(""+n).trim():n+"px"}function pn(e,n){e=e.style;for(var l in n)if(n.hasOwnProperty(l)){var s=l.indexOf("--")===0,f=_t(l,n[l],s);l==="float"&&(l="cssFloat"),s?e.setProperty(l,f):e[l]=f}}var An=S({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 et(e,n){if(n){if(An[e]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(r(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(r(61))}if(n.style!=null&&typeof n.style!="object")throw Error(r(62))}}function Ht(e,n){if(e.indexOf("-")===-1)return typeof n.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 kt=null;function go(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var xo=null,or=null,sr=null;function iu(e){if(e=oi(e)){if(typeof xo!="function")throw Error(r(280));var n=e.stateNode;n&&(n=ul(n),xo(e.stateNode,e.type,n))}}function lu(e){or?sr?sr.push(e):sr=[e]:or=e}function ou(){if(or){var e=or,n=sr;if(sr=or=null,iu(e),n)for(e=0;e>>=0,e===0?32:31-(hh(e)/mh|0)|0}var Wi=64,qi=4194304;function Ur(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 Qi(e,n){var l=e.pendingLanes;if(l===0)return 0;var s=0,f=e.suspendedLanes,p=e.pingedLanes,k=l&268435455;if(k!==0){var b=k&~f;b!==0?s=Ur(b):(p&=k,p!==0&&(s=Ur(p)))}else k=l&~f,k!==0?s=Ur(k):p!==0&&(s=Ur(p));if(s===0)return 0;if(n!==0&&n!==s&&(n&f)===0&&(f=s&-s,p=n&-n,f>=p||f===16&&(p&4194240)!==0))return n;if((s&4)!==0&&(s|=l&16),n=e.entangledLanes,n!==0)for(e=e.entanglements,n&=s;0l;l++)n.push(e);return n}function Vr(e,n,l){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-Dt(n),e[n]=l}function vh(e,n){var l=e.pendingLanes&~n;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=n,e.mutableReadLanes&=n,e.entangledLanes&=n,n=e.entanglements;var s=e.eventTimes;for(e=e.expirationTimes;0=Xr),Ru=" ",Mu=!1;function Du(e,n){switch(e){case"keyup":return Qh.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Au(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var cr=!1;function Kh(e,n){switch(e){case"compositionend":return Au(n);case"keypress":return n.which!==32?null:(Mu=!0,Ru);case"textInput":return e=n.data,e===Ru&&Mu?null:e;default:return null}}function Yh(e,n){if(cr)return e==="compositionend"||!Mo&&Du(e,n)?(e=_u(),Ji=To=yn=null,cr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:l,offset:n-e};e=s}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Hu(l)}}function qu(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?qu(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Qu(){for(var e=window,n=rr();n instanceof e.HTMLIFrameElement;){try{var l=typeof n.contentWindow.location.href=="string"}catch{l=!1}if(l)e=n.contentWindow;else break;n=rr(e.document)}return n}function Oo(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}function lm(e){var n=Qu(),l=e.focusedElem,s=e.selectionRange;if(n!==l&&l&&l.ownerDocument&&qu(l.ownerDocument.documentElement,l)){if(s!==null&&Oo(l)){if(n=s.start,e=s.end,e===void 0&&(e=n),"selectionStart"in l)l.selectionStart=n,l.selectionEnd=Math.min(e,l.value.length);else if(e=(n=l.ownerDocument||document)&&n.defaultView||window,e.getSelection){e=e.getSelection();var f=l.textContent.length,p=Math.min(s.start,f);s=s.end===void 0?p:Math.min(s.end,f),!e.extend&&p>s&&(f=s,s=p,p=f),f=Wu(l,p);var k=Wu(l,s);f&&k&&(e.rangeCount!==1||e.anchorNode!==f.node||e.anchorOffset!==f.offset||e.focusNode!==k.node||e.focusOffset!==k.offset)&&(n=n.createRange(),n.setStart(f.node,f.offset),e.removeAllRanges(),p>s?(e.addRange(n),e.extend(k.node,k.offset)):(n.setEnd(k.node,k.offset),e.addRange(n)))}}for(n=[],e=l;e=e.parentNode;)e.nodeType===1&&n.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;l=document.documentMode,fr=null,Fo=null,ti=null,$o=!1;function Gu(e,n,l){var s=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;$o||fr==null||fr!==rr(s)||(s=fr,"selectionStart"in s&&Oo(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),ti&&ei(ti,s)||(ti=s,s=ol(Fo,"onSelect"),0gr||(e.current=Jo[gr],Jo[gr]=null,gr--)}function Me(e,n){gr++,Jo[gr]=e.current,e.current=n}var Sn={},rt=wn(Sn),dt=wn(!1),$n=Sn;function xr(e,n){var l=e.type.contextTypes;if(!l)return Sn;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===n)return s.__reactInternalMemoizedMaskedChildContext;var f={},p;for(p in l)f[p]=n[p];return s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=f),f}function pt(e){return e=e.childContextTypes,e!=null}function cl(){Ae(dt),Ae(rt)}function uc(e,n,l){if(rt.current!==Sn)throw Error(r(168));Me(rt,n),Me(dt,l)}function cc(e,n,l){var s=e.stateNode;if(n=n.childContextTypes,typeof s.getChildContext!="function")return l;s=s.getChildContext();for(var f in s)if(!(f in n))throw Error(r(108,Te(e)||"Unknown",f));return S({},l,s)}function fl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Sn,$n=rt.current,Me(rt,e),Me(dt,dt.current),!0}function fc(e,n,l){var s=e.stateNode;if(!s)throw Error(r(169));l?(e=cc(e,n,$n),s.__reactInternalMemoizedMergedChildContext=e,Ae(dt),Ae(rt),Me(rt,e)):Ae(dt),Me(dt,l)}var tn=null,dl=!1,Zo=!1;function dc(e){tn===null?tn=[e]:tn.push(e)}function xm(e){dl=!0,dc(e)}function bn(){if(!Zo&&tn!==null){Zo=!0;var e=0,n=ze;try{var l=tn;for(ze=1;e>=k,f-=k,nn=1<<32-Dt(n)+f|l<ye?(Je=de,de=null):Je=de.sibling;var Pe=V(I,de,z[ye],Q);if(Pe===null){de===null&&(de=Je);break}e&&de&&Pe.alternate===null&&n(I,de),_=p(Pe,_,ye),fe===null?ae=Pe:fe.sibling=Pe,fe=Pe,de=Je}if(ye===z.length)return l(I,de),Oe&&Un(I,ye),ae;if(de===null){for(;yeye?(Je=de,de=null):Je=de.sibling;var zn=V(I,de,Pe.value,Q);if(zn===null){de===null&&(de=Je);break}e&&de&&zn.alternate===null&&n(I,de),_=p(zn,_,ye),fe===null?ae=zn:fe.sibling=zn,fe=zn,de=Je}if(Pe.done)return l(I,de),Oe&&Un(I,ye),ae;if(de===null){for(;!Pe.done;ye++,Pe=z.next())Pe=W(I,Pe.value,Q),Pe!==null&&(_=p(Pe,_,ye),fe===null?ae=Pe:fe.sibling=Pe,fe=Pe);return Oe&&Un(I,ye),ae}for(de=s(I,de);!Pe.done;ye++,Pe=z.next())Pe=ee(de,I,ye,Pe.value,Q),Pe!==null&&(e&&Pe.alternate!==null&&de.delete(Pe.key===null?ye:Pe.key),_=p(Pe,_,ye),fe===null?ae=Pe:fe.sibling=Pe,fe=Pe);return e&&de.forEach(function(Xm){return n(I,Xm)}),Oe&&Un(I,ye),ae}function Ve(I,_,z,Q){if(typeof z=="object"&&z!==null&&z.type===ue&&z.key===null&&(z=z.props.children),typeof z=="object"&&z!==null){switch(z.$$typeof){case le:e:{for(var ae=z.key,fe=_;fe!==null;){if(fe.key===ae){if(ae=z.type,ae===ue){if(fe.tag===7){l(I,fe.sibling),_=f(fe,z.props.children),_.return=I,I=_;break e}}else if(fe.elementType===ae||typeof ae=="object"&&ae!==null&&ae.$$typeof===$&&yc(ae)===fe.type){l(I,fe.sibling),_=f(fe,z.props),_.ref=si(I,fe,z),_.return=I,I=_;break e}l(I,fe);break}else n(I,fe);fe=fe.sibling}z.type===ue?(_=Yn(z.props.children,I.mode,Q,z.key),_.return=I,I=_):(Q=$l(z.type,z.key,z.props,null,I.mode,Q),Q.ref=si(I,_,z),Q.return=I,I=Q)}return k(I);case D:e:{for(fe=z.key;_!==null;){if(_.key===fe)if(_.tag===4&&_.stateNode.containerInfo===z.containerInfo&&_.stateNode.implementation===z.implementation){l(I,_.sibling),_=f(_,z.children||[]),_.return=I,I=_;break e}else{l(I,_);break}else n(I,_);_=_.sibling}_=Ys(z,I.mode,Q),_.return=I,I=_}return k(I);case $:return fe=z._init,Ve(I,_,fe(z._payload),Q)}if(fn(z))return ie(I,_,z,Q);if(re(z))return oe(I,_,z,Q);gl(I,z)}return typeof z=="string"&&z!==""||typeof z=="number"?(z=""+z,_!==null&&_.tag===6?(l(I,_.sibling),_=f(_,z),_.return=I,I=_):(l(I,_),_=Ks(z,I.mode,Q),_.return=I,I=_),k(I)):l(I,_)}return Ve}var wr=vc(!0),kc=vc(!1),xl=wn(null),yl=null,Sr=null,ls=null;function os(){ls=Sr=yl=null}function ss(e){var n=xl.current;Ae(xl),e._currentValue=n}function as(e,n,l){for(;e!==null;){var s=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,s!==null&&(s.childLanes|=n)):s!==null&&(s.childLanes&n)!==n&&(s.childLanes|=n),e===l)break;e=e.return}}function br(e,n){yl=e,ls=Sr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&n)!==0&&(ht=!0),e.firstContext=null)}function It(e){var n=e._currentValue;if(ls!==e)if(e={context:e,memoizedValue:n,next:null},Sr===null){if(yl===null)throw Error(r(308));Sr=e,yl.dependencies={lanes:0,firstContext:e}}else Sr=Sr.next=e;return n}var Vn=null;function us(e){Vn===null?Vn=[e]:Vn.push(e)}function wc(e,n,l,s){var f=n.interleaved;return f===null?(l.next=l,us(n)):(l.next=f.next,f.next=l),n.interleaved=l,ln(e,s)}function ln(e,n){e.lanes|=n;var l=e.alternate;for(l!==null&&(l.lanes|=n),l=e,e=e.return;e!==null;)e.childLanes|=n,l=e.alternate,l!==null&&(l.childLanes|=n),l=e,e=e.return;return l.tag===3?l.stateNode:null}var Cn=!1;function cs(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Sc(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function on(e,n){return{eventTime:e,lane:n,tag:0,payload:null,callback:null,next:null}}function jn(e,n,l){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(_e&2)!==0){var f=s.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),s.pending=n,ln(e,l)}return f=s.interleaved,f===null?(n.next=n,us(s)):(n.next=f.next,f.next=n),s.interleaved=n,ln(e,l)}function vl(e,n,l){if(n=n.updateQueue,n!==null&&(n=n.shared,(l&4194240)!==0)){var s=n.lanes;s&=e.pendingLanes,l|=s,n.lanes=l,Co(e,l)}}function bc(e,n){var l=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,l===s)){var f=null,p=null;if(l=l.firstBaseUpdate,l!==null){do{var k={eventTime:l.eventTime,lane:l.lane,tag:l.tag,payload:l.payload,callback:l.callback,next:null};p===null?f=p=k:p=p.next=k,l=l.next}while(l!==null);p===null?f=p=n:p=p.next=n}else f=p=n;l={baseState:s.baseState,firstBaseUpdate:f,lastBaseUpdate:p,shared:s.shared,effects:s.effects},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=n:e.next=n,l.lastBaseUpdate=n}function kl(e,n,l,s){var f=e.updateQueue;Cn=!1;var p=f.firstBaseUpdate,k=f.lastBaseUpdate,b=f.shared.pending;if(b!==null){f.shared.pending=null;var N=b,M=N.next;N.next=null,k===null?p=M:k.next=M,k=N;var H=e.alternate;H!==null&&(H=H.updateQueue,b=H.lastBaseUpdate,b!==k&&(b===null?H.firstBaseUpdate=M:b.next=M,H.lastBaseUpdate=N))}if(p!==null){var W=f.baseState;k=0,H=M=N=null,b=p;do{var V=b.lane,ee=b.eventTime;if((s&V)===V){H!==null&&(H=H.next={eventTime:ee,lane:0,tag:b.tag,payload:b.payload,callback:b.callback,next:null});e:{var ie=e,oe=b;switch(V=n,ee=l,oe.tag){case 1:if(ie=oe.payload,typeof ie=="function"){W=ie.call(ee,W,V);break e}W=ie;break e;case 3:ie.flags=ie.flags&-65537|128;case 0:if(ie=oe.payload,V=typeof ie=="function"?ie.call(ee,W,V):ie,V==null)break e;W=S({},W,V);break e;case 2:Cn=!0}}b.callback!==null&&b.lane!==0&&(e.flags|=64,V=f.effects,V===null?f.effects=[b]:V.push(b))}else ee={eventTime:ee,lane:V,tag:b.tag,payload:b.payload,callback:b.callback,next:null},H===null?(M=H=ee,N=W):H=H.next=ee,k|=V;if(b=b.next,b===null){if(b=f.shared.pending,b===null)break;V=b,b=V.next,V.next=null,f.lastBaseUpdate=V,f.shared.pending=null}}while(!0);if(H===null&&(N=W),f.baseState=N,f.firstBaseUpdate=M,f.lastBaseUpdate=H,n=f.shared.interleaved,n!==null){f=n;do k|=f.lane,f=f.next;while(f!==n)}else p===null&&(f.shared.lanes=0);qn|=k,e.lanes=k,e.memoizedState=W}}function Cc(e,n,l){if(e=n.effects,n.effects=null,e!==null)for(n=0;nl?l:4,e(!0);var s=ms.transition;ms.transition={};try{e(!1),n()}finally{ze=l,ms.transition=s}}function Vc(){return zt().memoizedState}function wm(e,n,l){var s=Tn(e);if(l={lane:s,action:l,hasEagerState:!1,eagerState:null,next:null},Hc(e))Wc(n,l);else if(l=wc(e,n,l,s),l!==null){var f=ct();Ut(l,e,s,f),qc(l,n,s)}}function Sm(e,n,l){var s=Tn(e),f={lane:s,action:l,hasEagerState:!1,eagerState:null,next:null};if(Hc(e))Wc(n,f);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=n.lastRenderedReducer,p!==null))try{var k=n.lastRenderedState,b=p(k,l);if(f.hasEagerState=!0,f.eagerState=b,At(b,k)){var N=n.interleaved;N===null?(f.next=f,us(n)):(f.next=N.next,N.next=f),n.interleaved=f;return}}catch{}finally{}l=wc(e,n,f,s),l!==null&&(f=ct(),Ut(l,e,s,f),qc(l,n,s))}}function Hc(e){var n=e.alternate;return e===$e||n!==null&&n===$e}function Wc(e,n){fi=bl=!0;var l=e.pending;l===null?n.next=n:(n.next=l.next,l.next=n),e.pending=n}function qc(e,n,l){if((l&4194240)!==0){var s=n.lanes;s&=e.pendingLanes,l|=s,n.lanes=l,Co(e,l)}}var El={readContext:It,useCallback:it,useContext:it,useEffect:it,useImperativeHandle:it,useInsertionEffect:it,useLayoutEffect:it,useMemo:it,useReducer:it,useRef:it,useState:it,useDebugValue:it,useDeferredValue:it,useTransition:it,useMutableSource:it,useSyncExternalStore:it,useId:it,unstable_isNewReconciler:!1},bm={readContext:It,useCallback:function(e,n){return Gt().memoizedState=[e,n===void 0?null:n],e},useContext:It,useEffect:Mc,useImperativeHandle:function(e,n,l){return l=l!=null?l.concat([e]):null,Cl(4194308,4,Oc.bind(null,n,e),l)},useLayoutEffect:function(e,n){return Cl(4194308,4,e,n)},useInsertionEffect:function(e,n){return Cl(4,2,e,n)},useMemo:function(e,n){var l=Gt();return n=n===void 0?null:n,e=e(),l.memoizedState=[e,n],e},useReducer:function(e,n,l){var s=Gt();return n=l!==void 0?l(n):n,s.memoizedState=s.baseState=n,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},s.queue=e,e=e.dispatch=wm.bind(null,$e,e),[s.memoizedState,e]},useRef:function(e){var n=Gt();return e={current:e},n.memoizedState=e},useState:Lc,useDebugValue:Ss,useDeferredValue:function(e){return Gt().memoizedState=e},useTransition:function(){var e=Lc(!1),n=e[0];return e=km.bind(null,e[1]),Gt().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,l){var s=$e,f=Gt();if(Oe){if(l===void 0)throw Error(r(407));l=l()}else{if(l=n(),Xe===null)throw Error(r(349));(Wn&30)!==0||_c(s,n,l)}f.memoizedState=l;var p={value:l,getSnapshot:n};return f.queue=p,Mc(Pc.bind(null,s,p,e),[e]),s.flags|=2048,hi(9,Tc.bind(null,s,p,l,n),void 0,null),l},useId:function(){var e=Gt(),n=Xe.identifierPrefix;if(Oe){var l=rn,s=nn;l=(s&~(1<<32-Dt(s)-1)).toString(32)+l,n=":"+n+"R"+l,l=di++,0<\/script>",e=e.removeChild(e.firstChild)):typeof s.is=="string"?e=k.createElement(l,{is:s.is}):(e=k.createElement(l),l==="select"&&(k=e,s.multiple?k.multiple=!0:s.size&&(k.size=s.size))):e=k.createElementNS(e,l),e[qt]=n,e[li]=s,pf(e,n,!1,!1),n.stateNode=e;e:{switch(k=Ht(l,s),l){case"dialog":De("cancel",e),De("close",e),f=s;break;case"iframe":case"object":case"embed":De("load",e),f=s;break;case"video":case"audio":for(f=0;f_r&&(n.flags|=128,s=!0,mi(p,!1),n.lanes=4194304)}else{if(!s)if(e=wl(k),e!==null){if(n.flags|=128,s=!0,l=e.updateQueue,l!==null&&(n.updateQueue=l,n.flags|=4),mi(p,!0),p.tail===null&&p.tailMode==="hidden"&&!k.alternate&&!Oe)return lt(n),null}else 2*Ue()-p.renderingStartTime>_r&&l!==1073741824&&(n.flags|=128,s=!0,mi(p,!1),n.lanes=4194304);p.isBackwards?(k.sibling=n.child,n.child=k):(l=p.last,l!==null?l.sibling=k:n.child=k,p.last=k)}return p.tail!==null?(n=p.tail,p.rendering=n,p.tail=n.sibling,p.renderingStartTime=Ue(),n.sibling=null,l=Fe.current,Me(Fe,s?l&1|2:l&1),n):(lt(n),null);case 22:case 23:return qs(),s=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(n.flags|=8192),s&&(n.mode&1)!==0?(Ct&1073741824)!==0&&(lt(n),n.subtreeFlags&6&&(n.flags|=8192)):lt(n),null;case 24:return null;case 25:return null}throw Error(r(156,n.tag))}function Im(e,n){switch(ts(n),n.tag){case 1:return pt(n.type)&&cl(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Cr(),Ae(dt),Ae(rt),hs(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 5:return ds(n),null;case 13:if(Ae(Fe),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));kr()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return Ae(Fe),null;case 4:return Cr(),null;case 10:return ss(n.type._context),null;case 22:case 23:return qs(),null;case 24:return null;default:return null}}var Pl=!1,ot=!1,zm=typeof WeakSet=="function"?WeakSet:Set,te=null;function Er(e,n){var l=e.ref;if(l!==null)if(typeof l=="function")try{l(null)}catch(s){Be(e,n,s)}else l.current=null}function Rs(e,n,l){try{l()}catch(s){Be(e,n,s)}}var gf=!1;function Lm(e,n){if(qo=Yi,e=Qu(),Oo(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var s=l.getSelection&&l.getSelection();if(s&&s.rangeCount!==0){l=s.anchorNode;var f=s.anchorOffset,p=s.focusNode;s=s.focusOffset;try{l.nodeType,p.nodeType}catch{l=null;break e}var k=0,b=-1,N=-1,M=0,H=0,W=e,V=null;t:for(;;){for(var ee;W!==l||f!==0&&W.nodeType!==3||(b=k+f),W!==p||s!==0&&W.nodeType!==3||(N=k+s),W.nodeType===3&&(k+=W.nodeValue.length),(ee=W.firstChild)!==null;)V=W,W=ee;for(;;){if(W===e)break t;if(V===l&&++M===f&&(b=k),V===p&&++H===s&&(N=k),(ee=W.nextSibling)!==null)break;W=V,V=W.parentNode}W=ee}l=b===-1||N===-1?null:{start:b,end:N}}else l=null}l=l||{start:0,end:0}}else l=null;for(Qo={focusedElem:e,selectionRange:l},Yi=!1,te=n;te!==null;)if(n=te,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,te=e;else for(;te!==null;){n=te;try{var ie=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(ie!==null){var oe=ie.memoizedProps,Ve=ie.memoizedState,I=n.stateNode,_=I.getSnapshotBeforeUpdate(n.elementType===n.type?oe:Ft(n.type,oe),Ve);I.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var z=n.stateNode.containerInfo;z.nodeType===1?z.textContent="":z.nodeType===9&&z.documentElement&&z.removeChild(z.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(Q){Be(n,n.return,Q)}if(e=n.sibling,e!==null){e.return=n.return,te=e;break}te=n.return}return ie=gf,gf=!1,ie}function gi(e,n,l){var s=n.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var f=s=s.next;do{if((f.tag&e)===e){var p=f.destroy;f.destroy=void 0,p!==void 0&&Rs(n,l,p)}f=f.next}while(f!==s)}}function Il(e,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var l=n=n.next;do{if((l.tag&e)===e){var s=l.create;l.destroy=s()}l=l.next}while(l!==n)}}function Ms(e){var n=e.ref;if(n!==null){var l=e.stateNode;switch(e.tag){case 5:e=l;break;default:e=l}typeof n=="function"?n(e):n.current=e}}function xf(e){var n=e.alternate;n!==null&&(e.alternate=null,xf(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[qt],delete n[li],delete n[Xo],delete n[mm],delete n[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 yf(e){return e.tag===5||e.tag===3||e.tag===4}function vf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||yf(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,n,l){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?l.nodeType===8?l.parentNode.insertBefore(e,n):l.insertBefore(e,n):(l.nodeType===8?(n=l.parentNode,n.insertBefore(e,l)):(n=l,n.appendChild(e)),l=l._reactRootContainer,l!=null||n.onclick!==null||(n.onclick=al));else if(s!==4&&(e=e.child,e!==null))for(Ds(e,n,l),e=e.sibling;e!==null;)Ds(e,n,l),e=e.sibling}function As(e,n,l){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?l.insertBefore(e,n):l.appendChild(e);else if(s!==4&&(e=e.child,e!==null))for(As(e,n,l),e=e.sibling;e!==null;)As(e,n,l),e=e.sibling}var tt=null,$t=!1;function En(e,n,l){for(l=l.child;l!==null;)kf(e,n,l),l=l.sibling}function kf(e,n,l){if(Wt&&typeof Wt.onCommitFiberUnmount=="function")try{Wt.onCommitFiberUnmount(Hi,l)}catch{}switch(l.tag){case 5:ot||Er(l,n);case 6:var s=tt,f=$t;tt=null,En(e,n,l),tt=s,$t=f,tt!==null&&($t?(e=tt,l=l.stateNode,e.nodeType===8?e.parentNode.removeChild(l):e.removeChild(l)):tt.removeChild(l.stateNode));break;case 18:tt!==null&&($t?(e=tt,l=l.stateNode,e.nodeType===8?Yo(e.parentNode,l):e.nodeType===1&&Yo(e,l),Gr(e)):Yo(tt,l.stateNode));break;case 4:s=tt,f=$t,tt=l.stateNode.containerInfo,$t=!0,En(e,n,l),tt=s,$t=f;break;case 0:case 11:case 14:case 15:if(!ot&&(s=l.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){f=s=s.next;do{var p=f,k=p.destroy;p=p.tag,k!==void 0&&((p&2)!==0||(p&4)!==0)&&Rs(l,n,k),f=f.next}while(f!==s)}En(e,n,l);break;case 1:if(!ot&&(Er(l,n),s=l.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=l.memoizedProps,s.state=l.memoizedState,s.componentWillUnmount()}catch(b){Be(l,n,b)}En(e,n,l);break;case 21:En(e,n,l);break;case 22:l.mode&1?(ot=(s=ot)||l.memoizedState!==null,En(e,n,l),ot=s):En(e,n,l);break;default:En(e,n,l)}}function wf(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var l=e.stateNode;l===null&&(l=e.stateNode=new zm),n.forEach(function(s){var f=Um.bind(null,e,s);l.has(s)||(l.add(s),s.then(f,f))})}}function Bt(e,n){var l=n.deletions;if(l!==null)for(var s=0;sf&&(f=k),s&=~p}if(s=f,s=Ue()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*Mm(s/1960))-s,10e?16:e,_n===null)var s=!1;else{if(e=_n,_n=null,Dl=0,(_e&6)!==0)throw Error(r(331));var f=_e;for(_e|=4,te=e.current;te!==null;){var p=te,k=p.child;if((te.flags&16)!==0){var b=p.deletions;if(b!==null){for(var N=0;NUe()-$s?Gn(e,0):Fs|=l),gt(e,n)}function Rf(e,n){n===0&&((e.mode&1)===0?n=1:(n=qi,qi<<=1,(qi&130023424)===0&&(qi=4194304)));var l=ct();e=ln(e,n),e!==null&&(Vr(e,n,l),gt(e,l))}function Bm(e){var n=e.memoizedState,l=0;n!==null&&(l=n.retryLane),Rf(e,l)}function Um(e,n){var l=0;switch(e.tag){case 13:var s=e.stateNode,f=e.memoizedState;f!==null&&(l=f.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(r(314))}s!==null&&s.delete(n),Rf(e,l)}var Mf;Mf=function(e,n,l){if(e!==null)if(e.memoizedProps!==n.pendingProps||dt.current)ht=!0;else{if((e.lanes&l)===0&&(n.flags&128)===0)return ht=!1,Tm(e,n,l);ht=(e.flags&131072)!==0}else ht=!1,Oe&&(n.flags&1048576)!==0&&pc(n,hl,n.index);switch(n.lanes=0,n.tag){case 2:var s=n.type;Tl(e,n),e=n.pendingProps;var f=xr(n,rt.current);br(n,l),f=xs(null,n,s,e,f,l);var p=ys();return n.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,pt(s)?(p=!0,fl(n)):p=!1,n.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,cs(n),f.updater=Nl,n.stateNode=f,f._reactInternals=n,Cs(n,s,e,l),n=_s(null,n,s,!0,p,l)):(n.tag=0,Oe&&p&&es(n),ut(null,n,f,l),n=n.child),n;case 16:s=n.elementType;e:{switch(Tl(e,n),e=n.pendingProps,f=s._init,s=f(s._payload),n.type=s,f=n.tag=Hm(s),e=Ft(s,e),f){case 0:n=Ns(null,n,s,e,l);break e;case 1:n=sf(null,n,s,e,l);break e;case 11:n=tf(null,n,s,e,l);break e;case 14:n=nf(null,n,s,Ft(s.type,e),l);break e}throw Error(r(306,s,""))}return n;case 0:return s=n.type,f=n.pendingProps,f=n.elementType===s?f:Ft(s,f),Ns(e,n,s,f,l);case 1:return s=n.type,f=n.pendingProps,f=n.elementType===s?f:Ft(s,f),sf(e,n,s,f,l);case 3:e:{if(af(n),e===null)throw Error(r(387));s=n.pendingProps,p=n.memoizedState,f=p.element,Sc(e,n),kl(n,s,null,l);var k=n.memoizedState;if(s=k.element,p.isDehydrated)if(p={element:s,isDehydrated:!1,cache:k.cache,pendingSuspenseBoundaries:k.pendingSuspenseBoundaries,transitions:k.transitions},n.updateQueue.baseState=p,n.memoizedState=p,n.flags&256){f=jr(Error(r(423)),n),n=uf(e,n,s,l,f);break e}else if(s!==f){f=jr(Error(r(424)),n),n=uf(e,n,s,l,f);break e}else for(bt=kn(n.stateNode.containerInfo.firstChild),St=n,Oe=!0,Ot=null,l=kc(n,null,s,l),n.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(kr(),s===f){n=sn(e,n,l);break e}ut(e,n,s,l)}n=n.child}return n;case 5:return jc(n),e===null&&rs(n),s=n.type,f=n.pendingProps,p=e!==null?e.memoizedProps:null,k=f.children,Go(s,f)?k=null:p!==null&&Go(s,p)&&(n.flags|=32),of(e,n),ut(e,n,k,l),n.child;case 6:return e===null&&rs(n),null;case 13:return cf(e,n,l);case 4:return fs(n,n.stateNode.containerInfo),s=n.pendingProps,e===null?n.child=wr(n,null,s,l):ut(e,n,s,l),n.child;case 11:return s=n.type,f=n.pendingProps,f=n.elementType===s?f:Ft(s,f),tf(e,n,s,f,l);case 7:return ut(e,n,n.pendingProps,l),n.child;case 8:return ut(e,n,n.pendingProps.children,l),n.child;case 12:return ut(e,n,n.pendingProps.children,l),n.child;case 10:e:{if(s=n.type._context,f=n.pendingProps,p=n.memoizedProps,k=f.value,Me(xl,s._currentValue),s._currentValue=k,p!==null)if(At(p.value,k)){if(p.children===f.children&&!dt.current){n=sn(e,n,l);break e}}else for(p=n.child,p!==null&&(p.return=n);p!==null;){var b=p.dependencies;if(b!==null){k=p.child;for(var N=b.firstContext;N!==null;){if(N.context===s){if(p.tag===1){N=on(-1,l&-l),N.tag=2;var M=p.updateQueue;if(M!==null){M=M.shared;var H=M.pending;H===null?N.next=N:(N.next=H.next,H.next=N),M.pending=N}}p.lanes|=l,N=p.alternate,N!==null&&(N.lanes|=l),as(p.return,l,n),b.lanes|=l;break}N=N.next}}else if(p.tag===10)k=p.type===n.type?null:p.child;else if(p.tag===18){if(k=p.return,k===null)throw Error(r(341));k.lanes|=l,b=k.alternate,b!==null&&(b.lanes|=l),as(k,l,n),k=p.sibling}else k=p.child;if(k!==null)k.return=p;else for(k=p;k!==null;){if(k===n){k=null;break}if(p=k.sibling,p!==null){p.return=k.return,k=p;break}k=k.return}p=k}ut(e,n,f.children,l),n=n.child}return n;case 9:return f=n.type,s=n.pendingProps.children,br(n,l),f=It(f),s=s(f),n.flags|=1,ut(e,n,s,l),n.child;case 14:return s=n.type,f=Ft(s,n.pendingProps),f=Ft(s.type,f),nf(e,n,s,f,l);case 15:return rf(e,n,n.type,n.pendingProps,l);case 17:return s=n.type,f=n.pendingProps,f=n.elementType===s?f:Ft(s,f),Tl(e,n),n.tag=1,pt(s)?(e=!0,fl(n)):e=!1,br(n,l),Gc(n,s,f),Cs(n,s,f,l),_s(null,n,s,!0,e,l);case 19:return df(e,n,l);case 22:return lf(e,n,l)}throw Error(r(156,n.tag))};function Df(e,n){return hu(e,n)}function Vm(e,n,l,s){this.tag=e,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Rt(e,n,l,s){return new Vm(e,n,l,s)}function Gs(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Hm(e){if(typeof e=="function")return Gs(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Z)return 11;if(e===G)return 14}return 2}function In(e,n){var l=e.alternate;return l===null?(l=Rt(e.tag,n,e.key,e.mode),l.elementType=e.elementType,l.type=e.type,l.stateNode=e.stateNode,l.alternate=e,e.alternate=l):(l.pendingProps=n,l.type=e.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=e.flags&14680064,l.childLanes=e.childLanes,l.lanes=e.lanes,l.child=e.child,l.memoizedProps=e.memoizedProps,l.memoizedState=e.memoizedState,l.updateQueue=e.updateQueue,n=e.dependencies,l.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},l.sibling=e.sibling,l.index=e.index,l.ref=e.ref,l}function $l(e,n,l,s,f,p){var k=2;if(s=e,typeof e=="function")Gs(e)&&(k=1);else if(typeof e=="string")k=5;else e:switch(e){case ue:return Yn(l.children,f,p,n);case ce:k=8,f|=8;break;case ge:return e=Rt(12,l,n,f|2),e.elementType=ge,e.lanes=p,e;case ve:return e=Rt(13,l,n,f),e.elementType=ve,e.lanes=p,e;case X:return e=Rt(19,l,n,f),e.elementType=X,e.lanes=p,e;case se:return Bl(l,f,p,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case R:k=10;break e;case Y:k=9;break e;case Z:k=11;break e;case G:k=14;break e;case $:k=16,s=null;break e}throw Error(r(130,e==null?e:typeof e,""))}return n=Rt(k,l,n,f),n.elementType=e,n.type=s,n.lanes=p,n}function Yn(e,n,l,s){return e=Rt(7,e,s,n),e.lanes=l,e}function Bl(e,n,l,s){return e=Rt(22,e,s,n),e.elementType=se,e.lanes=l,e.stateNode={isHidden:!1},e}function Ks(e,n,l){return e=Rt(6,e,null,n),e.lanes=l,e}function Ys(e,n,l){return n=Rt(4,e.children!==null?e.children:[],e.key,n),n.lanes=l,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function Wm(e,n,l,s,f){this.tag=n,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=bo(0),this.expirationTimes=bo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=bo(0),this.identifierPrefix=s,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function Xs(e,n,l,s,f,p,k,b,N){return e=new Wm(e,n,l,b,N),n===1?(n=1,p===!0&&(n|=8)):n=0,p=Rt(3,null,null,n),e.current=p,p.stateNode=e,p.memoizedState={element:s,isDehydrated:l,cache:null,transitions:null,pendingSuspenseBoundaries:null},cs(p),e}function qm(e,n,l){var s=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(i){console.error(i)}}return t(),ra.exports=rg(),ra.exports}var Yf;function lg(){if(Yf)return Gl;Yf=1;var t=ig();return Gl.createRoot=t.createRoot,Gl.hydrateRoot=t.hydrateRoot,Gl}var og=lg();const sg=lo(og),Nt=(t,i)=>({width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.7,strokeLinecap:"round",strokeLinejoin:"round",className:i}),ag=({size:t=19,className:i})=>g.jsx("svg",{...Nt(t,i),children:g.jsx("path",{d:"M4 6h16v10H10l-4 3v-3H4z"})}),ug=({size:t=19,className:i})=>g.jsxs("svg",{...Nt(t,i),children:[g.jsx("circle",{cx:"12",cy:"12",r:"8.5"}),g.jsx("path",{d:"M12 7.5V12l3 1.8"})]}),cg=({size:t=19,className:i})=>g.jsx("svg",{...Nt(t,i),children:g.jsx("path",{d:"M4 7h6l2 2h8v9H4z"})}),fg=({size:t=19,className:i})=>g.jsxs("svg",{...Nt(t,i),children:[g.jsx("circle",{cx:"7",cy:"7",r:"2.4"}),g.jsx("circle",{cx:"17",cy:"7",r:"2.4"}),g.jsx("circle",{cx:"7",cy:"17",r:"2.4"}),g.jsx("circle",{cx:"17",cy:"17",r:"2.4"})]}),dg=({size:t=18,className:i})=>g.jsxs("svg",{...Nt(t,i),children:[g.jsx("line",{x1:"4",y1:"8",x2:"20",y2:"8"}),g.jsx("line",{x1:"4",y1:"13",x2:"20",y2:"13"}),g.jsx("line",{x1:"4",y1:"18",x2:"20",y2:"18"})]}),oo=({size:t=13,className:i})=>g.jsx("svg",{...Nt(t,i),strokeWidth:2,children:g.jsx("path",{d:"m6 9 6 6 6-6"})}),Qd=({size:t=13,className:i})=>g.jsx("svg",{...Nt(t,i),strokeWidth:2.2,children:g.jsx("path",{d:"M12 5v14M5 12h14"})}),Gd=({size:t=15,className:i})=>g.jsx("svg",{...Nt(t,i),children:g.jsx("path",{d:"M21 12a9 9 0 1 1-3-6.7M21 4v4h-4"})}),pg=({size:t=15,className:i})=>g.jsx("svg",{...Nt(t,i),strokeWidth:2.2,children:g.jsx("path",{d:"M5 12h14M13 6l6 6-6 6"})}),so=({size:t=14,className:i})=>g.jsx("svg",{...Nt(t,i),strokeWidth:1.9,children:g.jsx("path",{d:"M12 4v11m0 0 4-4m-4 4-4-4M5 20h14"})}),ao=({size:t=14,className:i})=>g.jsx("svg",{...Nt(t,i),strokeWidth:1.9,children:g.jsx("path",{d:"M4 7h16M10 7V5h4v2M9 7l.8 13h4.4L15 7M6.5 7l.7 13h9.6l.7-13"})}),hg=({size:t=14,className:i})=>g.jsxs("svg",{...Nt(t,i),strokeWidth:1.7,children:[g.jsx("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2"}),g.jsx("path",{d:"M5 15V5a2 2 0 0 1 2-2h8"})]}),mg=({size:t=14,className:i})=>g.jsx("svg",{...Nt(t,i),strokeWidth:2.3,children:g.jsx("path",{d:"m5 12 4.5 4.5L19 7"})}),Kd=({size:t=30})=>g.jsx("div",{className:"flex items-center justify-center bg-accent",style:{width:t,height:t,border:"3px solid #fff",boxShadow:"3px 3px 0 #ff5436",borderRadius:7},children:g.jsx("div",{style:{width:t*.3,height:t*.3,background:"#fff"}})}),gg=[{id:"chat",label:"Chat",icon:g.jsx(ag,{})},{id:"history",label:"Historique",icon:g.jsx(ug,{})},{id:"files",label:"Fichiers",icon:g.jsx(cg,{})},{id:"tools",label:"Outils",icon:g.jsx(fg,{})}],Xf=t=>`flex h-10 w-10 items-center justify-center border-[3px] ${t?"border-white bg-accent text-white shadow-accent-soft":"border-chrome-3 text-on-dark-2 hover:text-white"}`;function xg({active:t,onChange:i}){return g.jsxs("div",{className:"flex w-[60px] flex-none flex-col items-center gap-2 border-r-[3px] border-line bg-bar py-3",children:[gg.map(r=>g.jsx("button",{onClick:()=>i(r.id),className:Xf(t===r.id),title:r.label,"aria-label":r.label,children:r.icon},r.id)),g.jsx("div",{className:"flex-1"}),g.jsx("button",{onClick:()=>i("settings"),className:Xf(t==="settings"),title:"Configuration","aria-label":"Configuration",children:g.jsx(dg,{})}),g.jsx("div",{className:"font-pixel flex h-[34px] w-[34px] items-center justify-center border-[3px] border-white bg-white text-[11px] text-line",children:"M"})]})}const Jf=t=>{let i;const r=new Set,o=(h,y)=>{const x=typeof h=="function"?h(i):h;if(!Object.is(x,i)){const v=i;i=y??(typeof x!="object"||x===null)?x:Object.assign({},i,x),r.forEach(w=>w(i,v))}},a=()=>i,d={setState:o,getState:a,getInitialState:()=>m,subscribe:h=>(r.add(h),()=>r.delete(h))},m=i=t(o,a,d);return d},yg=(t=>t?Jf(t):Jf),vg=t=>t;function kg(t,i=vg){const r=Ei.useSyncExternalStore(t.subscribe,Ei.useCallback(()=>i(t.getState()),[t,i]),Ei.useCallback(()=>i(t.getInitialState()),[t,i]));return Ei.useDebugValue(r),r}const Zf=t=>{const i=yg(t),r=o=>kg(i,o);return Object.assign(r,i),r},wg=(t=>t?Zf(t):Zf);async function Sg(){return(await fetch("/api/status")).json()}async function bg(){return(await fetch("/api/system/stats")).json()}const uo=t=>t?`&project=${encodeURIComponent(t)}`:"";async function Cg(t){try{return(await(await fetch(`/api/git/log?limit=40${uo(t)}`)).json()).commits}catch{return[]}}async function jg(t,i){const r=new URLSearchParams;t&&r.set("hash",t),i&&r.set("project",i);const o=r.toString(),a=await fetch(`/api/git/diff${o?`?${o}`:""}`);return a.ok?(await a.json()).diff:""}async function Eg(t,i){const r=await fetch("/api/git/revert",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hash:t,project:i??null})});if(!r.ok)throw await un(r,"revert impossible");return r.json()}async function Ng(){return(await fetch("/api/system/hardware")).json()}async function _g(){try{return(await(await fetch("/api/version")).json()).version??"?"}catch{return"?"}}async function un(t,i){try{const r=await t.json();return new Error((r==null?void 0:r.detail)??(r==null?void 0:r.error)??i)}catch{return new Error(i)}}const Tg=t=>new Promise(i=>setTimeout(i,t));async function Pg(t,i="30m"){const r=await fetch("/api/models/warm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,keep_alive:i})});if(!r.ok)throw await un(r,`préchargement refusé (${r.status})`);const o=Date.now()+600*1e3;let a=1e3;for(;Date.now()null);throw new Error((r==null?void 0:r.detail)??`suppression refusée (${i.status})`)}}async function Rg(){return(await(await fetch("/api/bench")).json()).scores}async function Mg(t,i){let r;try{r=await fetch("/api/bench",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:t})})}catch(m){const h=m instanceof Error?m.message:"connexion impossible";throw new Error(/network error|failed to fetch|load failed/i.test(h)?"connexion au benchmark interrompue par le réseau ou le reverse proxy":h)}if(!r.ok)throw await un(r,`benchmark refusé (${r.status})`);if(!r.body)throw new Error("le serveur n'a pas renvoyé de progression");const o=r.body.getReader(),a=new TextDecoder;let c="",u=null;const d=m=>{let h="message";const y=[];for(const v of m.replace(/\r\n/g,` `).split(` `))v.startsWith("event:")?h=v.slice(6).trim():v.startsWith("data:")&&y.push(v.slice(5).trimStart());if(y.length===0)return;const x=JSON.parse(y.join(` `));if(h==="task_start")i(x.task,null);else if(h==="task_done")i(x.task,x.score,x.detail);else{if(h==="error")throw new Error(x.message??"le benchmark a échoué");h==="done"&&(u={score:x.score,details:x.details,at:Date.now()/1e3})}};try{for(;;){const{done:m,value:h}=await o.read();if(m)break;c+=a.decode(h,{stream:!0}).replace(/\r\n/g,` `);const y=c.split(` `);c=y.pop()??"";for(const x of y)x.trim()&&d(x)}c+=a.decode(),c.trim()&&d(c)}catch(m){const h=m instanceof Error?m.message:"connexion interrompue";throw/network error|failed to fetch|load failed/i.test(h)?new Error("flux du benchmark interrompu par le reverse proxy"):m}if(!u)throw new Error("le benchmark s'est interrompu avant le résultat");return u}async function Dg(t){return(await fetch("/api/shell/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:t})})).json()}async function Ag(t){const i=t?`?model=${encodeURIComponent(t)}`:"";return(await fetch(`/api/config${i}`)).json()}async function Og(t,i){const r=i?`?model=${encodeURIComponent(i)}`:"";return(await(await fetch(`/api/config${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json()).config}async function Fg(t){const i=t?`?project=${encodeURIComponent(t)}`:"";return(await(await fetch(`/api/files${i}`)).json()).tree}async function $g(t,i){const r=await fetch(`/api/files/content?path=${encodeURIComponent(t)}${uo(i)}`);return r.ok?(await r.json()).content:""}async function Bg(t,i){const r=await fetch(`/api/files?path=${encodeURIComponent(t)}${uo(i)}`,{method:"DELETE"});if(!r.ok)throw await un(r,`suppression impossible (${r.status})`)}function Oa(t,i){const r=document.createElement("a");r.href=`/api/files/download?path=${encodeURIComponent(t)}${uo(i)}`,r.download=t.split(/[\\/]/).pop()??"fichier",document.body.appendChild(r),r.click(),r.remove()}async function Ug(){return(await(await fetch("/api/mcp")).json()).servers}async function ed(t,i,r){const o=await fetch(`/api/mcp/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:i,params:r})});if(!o.ok)throw await un(o,"mise à jour MCP impossible");return(await o.json()).servers}async function Vg(t){return(await fetch(`/api/mcp/${t}/test`,{method:"POST"})).json()}async function Hg(){return(await(await fetch("/api/sessions")).json()).sessions}async function oa(t,i){return(await fetch("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:"Nouvelle session",model:t,project:i??null})})).json()}async function Wg(){return(await fetch("/api/projects")).json()}async function qg(t){const i=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t})});if(!i.ok)throw await un(i,"création du projet impossible")}async function Qg(t,i){const r=await fetch(`/api/sessions/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:i??""})});if(!r.ok)throw await un(r,"changement de projet impossible")}async function Gg(t){return(await fetch(`/api/sessions/${t}`)).json()}async function Kg(t){await fetch(`/api/sessions/${t}`,{method:"DELETE"})}async function Yg(t,i){const r=await fetch(`/api/sessions/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:i})});if(!r.ok)throw await un(r,`renommage impossible (${r.status})`)}async function Xg(t,i,r){var y,x;let o;try{o=await fetch("/api/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:r})}catch(v){if(v instanceof DOMException&&v.name==="AbortError"){(y=i.onAbort)==null||y.call(i);return}const w=v instanceof Error?v.message:"serveur Loki injoignable";i.onError(/network error|failed to fetch/i.test(w)?"Serveur Loki injoignable. Vérifiez le reverse proxy et le conteneur.":w);return}if(!o.ok){let v=`requête refusée (${o.status})`;try{const w=await o.json();v=w.detail??w.error??v}catch{}i.onError(v);return}if(!o.body){i.onError("pas de flux de réponse");return}const a=o.body.getReader(),c=new TextDecoder;let u="",d=!1,m=!1;const h=v=>{var j,T;const w=v.replace(/\r\n/g,` `);let E="message";const L=[];for(const O of w.split(` `))O.startsWith("event:")?E=O.slice(6).trim():O.startsWith("data:")&&L.push(O.slice(5).trimStart());if(L.length!==0)try{const O=JSON.parse(L.join(` `));E==="token"?i.onToken(O.content):E==="plan"?(j=i.onPlan)==null||j.call(i,O.steps):E==="revision"?(T=i.onRevision)==null||T.call(i,O.content):E==="thinking"?i.onThinking(O.content):E==="status"?i.onStatus(O.message):E==="notice"?i.onNotice(O.message):E==="tool_call"?i.onToolCall({...O,status:"running"}):E==="tool_result"?i.onToolResult(O):E==="tool_confirm"?i.onToolConfirm(O.command):E==="error"?(m=!0,i.onError(O.message)):E==="done"&&(d=!0,O.error?(m||i.onError(O.error),m=!0):m||i.onDone(O.content))}catch{m||(m=!0,i.onError("réponse illisible reçue du serveur"))}};try{for(;;){const{done:v,value:w}=await a.read();if(v)break;u+=c.decode(w,{stream:!0}).replace(/\r\n/g,` `);const E=u.split(` `);u=E.pop()??"";for(const L of E)L.trim()&&h(L)}u+=c.decode(),u.trim()&&h(u)}catch(v){if(!m){if(v instanceof DOMException&&v.name==="AbortError"){(x=i.onAbort)==null||x.call(i);return}m=!0;const w=v instanceof Error?v.message:"connexion interrompue";i.onError(/network error|failed to fetch/i.test(w)?"Connexion interrompue pendant le chargement du modèle. Vérifiez OLLAMA_HOST et le délai du reverse proxy.":w)}}!d&&!m&&i.onError("le serveur a fermé la réponse avant sa fin")}async function Jg(t,i){const r=await fetch("/api/models/pull",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t})});if(!r.body)return;const o=r.body.getReader(),a=new TextDecoder;let c="";for(;;){const{done:u,value:d}=await o.read();if(u)break;c+=a.decode(d,{stream:!0});const m=c.split(` `);c=m.pop()??"";for(const h of m){const y=h.replace(/^data: /,"").trim();if(!(!y||y==="[DONE]"))try{const x=JSON.parse(y),v=x.total&&x.completed?Math.round(x.completed/x.total*100):0;i(x.status??"",v)}catch{}}}}let Ln=null;const Qe=wg((t,i)=>({status:null,systemStats:null,loadedModels:[],warmingModel:null,warmError:null,models:[],selectedModel:"",loadingModels:!1,sessions:[],currentSessionId:null,messages:[],streaming:!1,streamingSessionId:null,streamContent:"",streamThinking:"",streamStatus:"",streamNotice:null,streamTools:[],streamPlan:[],fileTree:[],previewPath:null,previewContent:"",projects:[],config:null,availableTools:[],pendingShell:null,mode:"build",setMode:r=>t({mode:r}),approveShell:async()=>{const r=i().pendingShell;if(!r)return;t({pendingShell:null});let o;try{const a=await Dg(r);o=`J'ai validé la commande \`${r}\` (code ${a.exit_code}). Sortie : \`\`\` ${a.output||"(vide)"} \`\`\``}catch{o=`Échec de l'exécution de \`${r}\`.`}await i().refreshFiles(),await i().sendMessage(o)},rejectShell:async()=>{const r=i().pendingShell;r&&(t({pendingShell:null}),await i().sendMessage(`J'ai refusé la commande \`${r}\`. N'exécute pas cette commande.`))},refreshConfig:async()=>{const r=i().selectedModel,{config:o,available_tools:a}=await Ag(r||void 0);i().selectedModel===r&&t({config:o,availableTools:a})},updateConfig:async r=>{const o=await Og(r,i().selectedModel||void 0);t({config:o})},openPreview:async r=>{const o=await $g(r,i().currentProject());t({previewPath:r,previewContent:o})},setSelectedModel:r=>{t({selectedModel:r,warmingModel:r||null,warmError:null}),(async()=>{var o;try{if(await i().refreshConfig(),!r||i().selectedModel!==r)return;const a=((o=i().config)==null?void 0:o.keep_alive)??"30m",c=await Pg(r,a);await i().refreshLoadedModels(),(c.processor==="cpu"||c.processor==="mixte")&&i().selectedModel===r&&t({warmError:c.processor==="cpu"?"Modèle chargé sur le CPU (trop gros pour la VRAM) — lent. Choisis un modèle plus petit ou une quantization plus légère.":`Modèle en partie sur GPU (${c.gpu_percent??"?"}%) : dépasse la VRAM, chargement plus lent.`})}catch(a){i().selectedModel===r&&t({warmError:a instanceof Error?a.message:"préchargement impossible"})}finally{i().warmingModel===r&&t({warmingModel:null})}})()},refreshFiles:async()=>{try{t({fileTree:await Fg(i().currentProject())})}catch{}},refreshProjects:async()=>{try{const{projects:r}=await Wg();t({projects:r})}catch{}},currentProject:()=>{const r=i().sessions.find(o=>o.id===i().currentSessionId);return(r==null?void 0:r.project)??null},setProject:async r=>{const o=i().currentSessionId;if(o)await Qg(o,r);else{const a=await oa(i().selectedModel||void 0,r);t({currentSessionId:a.id,messages:[]})}await i().refreshSessions(),t({previewPath:null,previewContent:""}),await i().refreshFiles()},refreshStatus:async()=>{try{const r=await Sg();t({status:r})}catch{t({status:{connected:!1,host:"",default_model:""}})}},refreshSystemStats:async()=>{try{t({systemStats:await bg()})}catch{t({systemStats:null})}},refreshLoadedModels:async()=>{t({loadedModels:await Ig()})},refreshModels:async()=>{var r;t({loadingModels:!0});try{const{models:o,default:a}=await zg(),c=new Set(o.map(m=>m.name)),u=i().selectedModel,d=c.has(u)?u:c.has(a)?a:((r=o[0])==null?void 0:r.name)??"";t({models:o}),i().setSelectedModel(d)}finally{t({loadingModels:!1})}},refreshSessions:async()=>{const r=await Hg();t({sessions:r})},newSession:async()=>{const r=await oa(i().selectedModel||void 0,i().currentProject()),o=i().streaming;t({currentSessionId:r.id,messages:[],...o?{}:{streamContent:"",streamStatus:"",streamNotice:null}}),await i().refreshSessions()},openSession:async r=>{const{messages:o}=await Gg(r),a=i().streaming;t({currentSessionId:r,messages:o,...a?{}:{streamContent:"",streamStatus:"",streamNotice:null}}),await i().refreshFiles()},removeSession:async r=>{await Kg(r),i().currentSessionId===r&&t({currentSessionId:null,messages:[]}),await i().refreshSessions()},renameSession:async(r,o)=>{const a=o.trim();a&&(await Yg(r,a),await i().refreshSessions())},removeFile:async r=>{await Bg(r,i().currentProject());const o=i().previewPath;o&&(o===r||o.startsWith(r+"/"))&&t({previewPath:null,previewContent:""}),await i().refreshFiles()},stopStreaming:()=>{Ln==null||Ln.abort(),Ln=null,t({streaming:!1,streamingSessionId:null,streamContent:"",streamThinking:"",streamStatus:"",streamNotice:null,streamTools:[],streamPlan:[],pendingShell:null}),i().refreshSessions()},sendMessage:async r=>{if(i().streaming||(r=r.trim(),!r))return;if(!i().selectedModel){const u={id:`err-${Date.now()}`,session_id:i().currentSessionId??"",role:"assistant",content:"⚠️ Aucun modèle Ollama installé ou sélectionné.",created_at:Date.now()/1e3};t({messages:[...i().messages,u]});return}let o=i().currentSessionId;try{if(!o){const u=await oa(i().selectedModel||void 0);o=u.id,t({currentSessionId:u.id})}}catch(u){const d=u instanceof Error?u.message:"backend injoignable",m={id:`err-${Date.now()}`,session_id:"",role:"assistant",content:`⚠️ Impossible de créer la session : ${d}`,created_at:Date.now()/1e3};t({messages:[...i().messages,m]});return}const a={id:`tmp-${Date.now()}`,session_id:o,role:"user",content:r,created_at:Date.now()/1e3};t({messages:[...i().messages,a],streaming:!0,streamingSessionId:o,streamContent:"",streamThinking:"",streamStatus:"Connexion à Ollama…",streamNotice:null,streamTools:[],pendingShell:null});const c=new AbortController;Ln=c,await Xg({session_id:o,content:r,model:i().selectedModel||void 0,mode:i().mode},{onToken:u=>t({streamContent:i().streamContent+u}),onThinking:u=>t({streamThinking:i().streamThinking+u}),onStatus:u=>t({streamStatus:u}),onPlan:u=>t({streamPlan:u}),onRevision:u=>t({streamContent:u}),onNotice:u=>t({streamNotice:u}),onToolCall:u=>t({streamTools:[...i().streamTools,u]}),onToolResult:u=>{const d=[...i().streamTools];for(let m=d.length-1;m>=0;m--)if(d[m].name===u.name&&d[m].status==="running"){d[m]={...d[m],...u};break}t({streamTools:d})},onToolConfirm:u=>t({pendingShell:u}),onDone:async()=>{Ln=null;const u=[...i().streamTools].reverse().find(d=>{var m;return d.name==="write_file"&&typeof((m=d.args)==null?void 0:m.path)=="string"&&/\.html?$/.test(d.args.path)});t({streaming:!1,streamingSessionId:null,streamContent:"",streamThinking:"",streamStatus:"",streamNotice:null,streamTools:[]}),await Promise.all([i().currentSessionId===o?i().openSession(o):Promise.resolve(),i().refreshSessions(),i().refreshFiles()]),u&&await i().openPreview(u.args.path)},onError:u=>{Ln=null;const d={id:`err-${Date.now()}`,session_id:o,role:"assistant",content:`⚠️ Erreur : ${u}`,created_at:Date.now()/1e3};t({streaming:!1,streamingSessionId:null,streamContent:"",streamThinking:"",streamStatus:"",streamNotice:null,streamTools:[],messages:i().currentSessionId===o?[...i().messages,d]:i().messages}),i().refreshSessions()},onAbort:()=>{Ln=null,t({streaming:!1,streamingSessionId:null,streamContent:"",streamThinking:"",streamStatus:"",streamNotice:null,streamTools:[],pendingShell:null}),i().refreshSessions()}},c.signal)}}));function Yd(t){const i=Date.now()/1e3-t;return i<60?"à l'instant":i<3600?`il y a ${Math.floor(i/60)} min`:i<86400?`il y a ${Math.floor(i/3600)} h`:`il y a ${Math.floor(i/86400)} j`}function Zg(){const{sessions:t,currentSessionId:i,streamingSessionId:r,newSession:o,openSession:a,removeSession:c,renameSession:u}=Qe(),[d,m]=ne.useState(!1),[h,y]=ne.useState(null),[x,v]=ne.useState(""),w=ne.useRef(null),E=t.find(j=>j.id===i);ne.useEffect(()=>{if(!d)return;const j=O=>{w.current&&!w.current.contains(O.target)&&(m(!1),y(null))},T=O=>{O.key==="Escape"&&(m(!1),y(null))};return document.addEventListener("mousedown",j),document.addEventListener("keydown",T),()=>{document.removeEventListener("mousedown",j),document.removeEventListener("keydown",T)}},[d]);const L=async j=>{const T=x.trim();y(null),T&&await u(j,T)};return g.jsxs("div",{ref:w,className:"relative",children:[g.jsxs("button",{onClick:()=>m(j=>!j),className:"flex cursor-pointer items-center gap-2 text-[13px] text-on-dark hover:text-white",title:"Sessions",children:[g.jsx("span",{className:"max-w-[220px] truncate",children:(E==null?void 0:E.title)??"Nouvelle session"}),g.jsx(oo,{className:"text-on-dark-3"})]}),d&&g.jsxs("div",{className:"absolute left-0 top-[calc(100%+9px)] z-30 w-[300px] border-[3px] border-line bg-chrome-2 shadow-hard",style:{borderRadius:7},children:[g.jsxs("button",{onClick:async()=>{m(!1),await o()},className:"flex w-full cursor-pointer items-center gap-2 border-b-[3px] border-chrome-3 px-3 py-2.5 text-[13px] font-bold text-accent hover:bg-chrome-3",children:[g.jsx(Qd,{}),"Nouvelle session"]}),g.jsxs("div",{className:"scr max-h-[320px] overflow-auto",children:[t.length===0&&g.jsx("div",{className:"px-3 py-4 text-center text-[12px] text-on-dark-3",children:"Aucune session enregistrée."}),t.map(j=>{const T=j.id===i,O=j.id===r;return g.jsxs("div",{onClick:()=>{h!==j.id&&(m(!1),a(j.id))},className:`group cursor-pointer border-b-2 border-chrome-3 px-3 py-2 last:border-b-0 ${T?"bg-chrome-3":"hover:bg-chrome-3"}`,children:[g.jsxs("div",{className:"flex items-center gap-1.5",children:[h===j.id?g.jsx("input",{autoFocus:!0,value:x,onChange:A=>v(A.target.value),onClick:A=>A.stopPropagation(),onKeyDown:A=>{A.key==="Enter"&&L(j.id),A.key==="Escape"&&(A.stopPropagation(),y(null))},onBlur:()=>y(null),className:"min-w-0 flex-1 border-2 border-line bg-card-deep px-1.5 py-0.5 text-[13px] text-white outline-none"}):g.jsx("span",{className:`min-w-0 flex-1 truncate text-[13px] ${T?"text-white":"text-on-dark"}`,children:j.title}),O&&g.jsx("span",{className:"flex-none border-2 border-line bg-accent px-1 py-0.5 text-[9px] leading-none text-white",title:"Session en cours de travail",children:"EN COURS"}),g.jsx("button",{onClick:A=>{A.stopPropagation(),y(j.id),v(j.title)},className:"hidden flex-none text-[11px] text-on-dark-3 hover:text-white group-hover:block",title:"Renommer la session",children:"✎"}),g.jsx("button",{onClick:A=>{A.stopPropagation(),window.confirm("Supprimer cette session ?")&&c(j.id)},className:"hidden flex-none text-on-dark-3 hover:text-accent group-hover:block",title:"Supprimer la session",children:g.jsx(ao,{size:12})})]}),g.jsxs("div",{className:"mt-0.5 text-[11px] text-on-dark-3",children:[Yd(j.updated_at)," · ",j.message_count??0," message",(j.message_count??0)>1?"s":""]})]},j.id)})]})]})]})}function ex(){const t=Qe(c=>c.status),i=Qe(c=>c.systemStats),r=(t==null?void 0:t.connected)??!1,[o,a]=ne.useState("");return ne.useEffect(()=>{_g().then(a)},[]),g.jsxs("div",{className:"flex h-[54px] flex-none items-center gap-3.5 border-b-[3px] border-line bg-bar px-4",children:[g.jsxs("div",{className:"flex items-center gap-2.5",children:[g.jsx(Kd,{}),g.jsx("div",{className:"font-pixel text-[14px] text-white",children:"LOKI"}),g.jsxs("div",{className:"text-[13px] leading-none text-on-dark-2",title:o?`build ${o}`:void 0,children:["agent local",o&&o!=="dev"&&g.jsxs("span",{className:"ml-1.5 text-on-dark-3",children:["· ",o.slice(0,7)]})]})]}),g.jsx("div",{className:"h-6 w-[3px] bg-chrome-3"}),g.jsx(Zg,{}),g.jsx("div",{className:"flex-1"}),i&&g.jsxs("div",{className:"flex h-8 items-center gap-2.5 border-[3px] border-chrome-3 bg-chrome-2 px-[11px] text-[13px] text-on-dark",children:[g.jsxs("span",{children:["CPU ",i.cpu_pct.toFixed(0),"%"]}),g.jsx("span",{className:"text-on-dark-3",children:"·"}),g.jsxs("span",{children:["RAM ",i.ram_pct.toFixed(0),"%"]}),i.gpu&&g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-on-dark-3",children:"·"}),g.jsxs("span",{children:["GPU ",i.gpu.util_pct.toFixed(0),"%"]}),g.jsxs("span",{className:"text-on-dark-3",children:["VRAM ",(i.gpu.vram_used_mb/1024).toFixed(1),"/",(i.gpu.vram_total_mb/1024).toFixed(1),"G"]})]})]}),g.jsxs("div",{className:"flex h-8 items-center gap-2 border-[3px] border-chrome-3 bg-chrome-2 px-[11px]",title:r?t==null?void 0:t.host:t==null?void 0:t.error,children:[g.jsx("span",{className:`h-[11px] w-[11px] border-2 border-line ${r?"bg-ok":"bg-warn"}`}),g.jsx("span",{className:"text-[13px] text-on-dark",children:"Ollama"}),g.jsx("span",{className:"text-[13px] text-on-dark-3",children:r?t==null?void 0:t.host.replace(/^https?:\/\//,""):"déconnecté"})]})]})}function tx(){const{sessions:t,currentSessionId:i,streamingSessionId:r,refreshSessions:o,refreshFiles:a,fileTree:c,newSession:u,openSession:d,removeSession:m}=Qe();return ne.useEffect(()=>{o(),a()},[o,a]),g.jsxs("div",{className:"flex w-[280px] flex-none flex-col border-r-[3px] border-line bg-panel",children:[g.jsxs("div",{className:"flex items-center justify-between px-4 pb-2.5 pt-4",children:[g.jsx("span",{className:"font-pixel text-[10px] text-label",children:"HISTORIQUE"}),g.jsxs("button",{onClick:u,className:"flex cursor-pointer items-center gap-1 text-[13px] text-accent",children:[g.jsx(Qd,{}),"Nouvelle"]})]}),g.jsxs("div",{className:"scr flex max-h-[45%] flex-col gap-2 overflow-auto px-3 py-1",children:[t.length===0&&g.jsx("div",{className:"px-1 py-2 text-xs text-muted-2",children:"Aucune session. Lance une conversation ci-dessous."}),t.map(h=>{const y=h.id===i,x=h.id===r;return g.jsxs("div",{onClick:()=>d(h.id),className:`group cursor-pointer border-[3px] border-line px-3 py-2.5 ${y?"bg-card-deep shadow-hard-accent":"bg-card"}`,style:{borderRadius:7},children:[g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx("div",{className:`flex-1 truncate text-[14px] leading-tight ${y?"text-white":"text-ink-2"}`,children:h.title}),x&&g.jsx("span",{className:"flex-none border-2 border-line bg-accent px-1.5 py-0.5 text-[10px] leading-none text-white",title:"Session en cours de travail",children:"EN COURS"}),g.jsx("button",{onClick:v=>{v.stopPropagation(),m(h.id)},className:`hidden group-hover:block ${y?"text-on-dark-2 hover:text-accent":"text-muted-3 hover:text-warn"}`,title:"Supprimer",children:"×"})]}),g.jsxs("div",{className:"mt-1 text-[13px] text-muted-3",children:[Yd(h.updated_at)," · ",h.message_count??0," message",(h.message_count??0)>1?"s":""]})]},h.id)})]}),g.jsx("div",{className:"mx-0 my-4 h-[3px] bg-line"}),g.jsxs("div",{className:"flex items-center justify-between px-4 pb-2",children:[g.jsx("span",{className:"font-pixel text-[10px] text-label",children:"FICHIERS"}),g.jsx("span",{className:"text-[13px] text-muted-3",children:"workspace/"})]}),g.jsx("div",{className:"scr flex-1 overflow-auto px-3 pb-3.5 text-[14px]",children:c.length===0?g.jsxs("div",{className:"px-2 py-4 text-center text-muted-2",children:["Aucun fichier pour l'instant.",g.jsx("br",{}),"L'agent créera des fichiers ici."]}):g.jsx(Xd,{nodes:c,depth:0})})]})}function Xd({nodes:t,depth:i}){const{openPreview:r,previewPath:o,removeFile:a,currentProject:c}=Qe(),u=d=>{const m=d.type==="dir"?`Supprimer le dossier ${d.path} et tout son contenu ?`:`Supprimer ${d.path} ?`;window.confirm(m)&&a(d.path)};return g.jsx(g.Fragment,{children:t.map(d=>{const m=d.type==="file"&&d.path===o;return g.jsxs("div",{children:[g.jsxs("div",{onClick:()=>d.type==="file"&&r(d.path),className:`group mb-[3px] flex items-center gap-2 px-2 py-[5px] ${d.type==="file"?m?"cursor-pointer border-2 border-line bg-card-deep text-white":"cursor-pointer text-ink-2 hover:bg-base":"text-muted"}`,style:{paddingLeft:8+i*14},children:[d.type==="dir"?g.jsx("span",{className:"text-muted-2",children:"▾"}):g.jsx("span",{className:`h-2 w-2 border-2 ${m?"border-white bg-accent":"border-line bg-muted-2"}`}),g.jsx("span",{className:"min-w-0 flex-1 truncate",children:d.name}),d.type==="file"&&g.jsx("button",{onClick:h=>{h.stopPropagation(),Oa(d.path,c())},className:"hidden flex-none text-muted-2 hover:text-accent group-hover:block",title:`Télécharger ${d.name}`,children:g.jsx(so,{size:13})}),g.jsx("button",{onClick:h=>{h.stopPropagation(),u(d)},className:"hidden flex-none text-muted-2 hover:text-warn group-hover:block",title:`Supprimer ${d.name}`,children:g.jsx(ao,{size:13})})]}),d.children&&g.jsx(Xd,{nodes:d.children,depth:i+1})]},d.path)})})}function nx({call:t}){var d,m,h,y,x;const i=t.status==="running",r=t.status==="error",o=t.status==="pending",a=((d=t.args)==null?void 0:d.path)??((m=t.args)==null?void 0:m.query)??((h=t.args)==null?void 0:h.pattern)??((y=t.args)==null?void 0:y.command)??((x=t.args)==null?void 0:x.instruction),c=typeof a=="string"?`("${a.length>48?a.slice(0,48)+"…":a}")`:Object.keys(t.args??{}).length?"(…)":"()",u=t.name==="write_file"||t.name==="edit_file";return g.jsxs("div",{className:"mb-[11px] overflow-hidden border-[3px] border-line bg-card shadow-hard-sm",style:{borderRadius:7},children:[g.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5",children:[g.jsx("span",{className:`flex h-[26px] w-[26px] items-center justify-center border-2 border-line ${u?"bg-accent text-white":"bg-card-deep text-white"}`,children:g.jsx(rx,{name:t.name})}),g.jsx("span",{className:"text-[14px] text-ink",children:t.name}),g.jsx("span",{className:"text-[13px] text-muted-3",children:c}),g.jsx("div",{className:"flex-1"}),i?g.jsxs("span",{className:"flex items-center gap-1.5 text-[13px] text-muted-2",children:[g.jsx("span",{className:"h-2.5 w-2.5 animate-spin rounded-full border-2 border-muted-3 border-t-accent"}),"en cours"]}):o?g.jsx("span",{className:"text-[13px] text-accent",children:"⏸ à valider"}):g.jsx("span",{className:`flex items-center gap-1.5 text-[13px] ${r?"text-warn":"text-ok"}`,children:r?"✕ échec":"✓ terminé"})]}),t.summary&&!i&&g.jsxs("div",{className:"border-t-2 border-line-soft px-3 py-2 text-[13px] text-muted-2",children:["→ ",t.summary]})]})}function rx({name:t}){const i={width:13,height:13,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round"};return t==="write_file"||t==="edit_file"?g.jsx("svg",{...i,children:g.jsx("path",{d:"M5 19h14M7 14l9-9 3 3-9 9-4 1z"})}):t==="list_dir"?g.jsx("svg",{...i,children:g.jsx("path",{d:"M4 7h6l2 2h8v9H4z"})}):t==="code_task"?g.jsx("svg",{...i,children:g.jsx("path",{d:"m8 6-5 6 5 6M16 6l5 6-5 6"})}):t==="web_search"||t==="grep_search"?g.jsxs("svg",{...i,children:[g.jsx("circle",{cx:"11",cy:"11",r:"7"}),g.jsx("path",{d:"m21 21-4.3-4.3"})]}):t==="run_shell"?g.jsxs("svg",{...i,children:[g.jsx("path",{d:"m6 9 3 3-3 3M13 15h5"}),g.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"})]}):g.jsxs("svg",{...i,children:[g.jsx("path",{d:"M7 4h7l4 4v12H7z"}),g.jsx("path",{d:"M14 4v4h4"})]})}function ix(t,i){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const lx=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ox=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,sx={};function td(t,i){return(sx.jsx?ox:lx).test(t)}const ax=/[ \t\n\f\r]/g;function ux(t){return typeof t=="object"?t.type==="text"?nd(t.value):!1:nd(t)}function nd(t){return t.replace(ax,"")===""}class Li{constructor(i,r,o){this.normal=r,this.property=i,o&&(this.space=o)}}Li.prototype.normal={};Li.prototype.property={};Li.prototype.space=void 0;function Jd(t,i){const r={},o={};for(const a of t)Object.assign(r,a.property),Object.assign(o,a.normal);return new Li(r,o,i)}function Ea(t){return t.toLowerCase()}class vt{constructor(i,r){this.attribute=r,this.property=i}}vt.prototype.attribute="";vt.prototype.booleanish=!1;vt.prototype.boolean=!1;vt.prototype.commaOrSpaceSeparated=!1;vt.prototype.commaSeparated=!1;vt.prototype.defined=!1;vt.prototype.mustUseProperty=!1;vt.prototype.number=!1;vt.prototype.overloadedBoolean=!1;vt.prototype.property="";vt.prototype.spaceSeparated=!1;vt.prototype.space=void 0;let cx=0;const ke=nr(),qe=nr(),Na=nr(),q=nr(),Le=nr(),er=nr(),jt=nr();function nr(){return 2**++cx}const _a=Object.freeze(Object.defineProperty({__proto__:null,boolean:ke,booleanish:qe,commaOrSpaceSeparated:jt,commaSeparated:er,number:q,overloadedBoolean:Na,spaceSeparated:Le},Symbol.toStringTag,{value:"Module"})),sa=Object.keys(_a);class Fa extends vt{constructor(i,r,o,a){let c=-1;if(super(i,r),rd(this,"space",a),typeof o=="number")for(;++c4&&r.slice(0,4)==="data"&&mx.test(i)){if(i.charAt(4)==="-"){const c=i.slice(5).replace(id,yx);o="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=i.slice(4);if(!id.test(c)){let u=c.replace(hx,xx);u.charAt(0)!=="-"&&(u="-"+u),i="data"+u}}a=Fa}return new a(o,i)}function xx(t){return"-"+t.toLowerCase()}function yx(t){return t.charAt(1).toUpperCase()}const vx=Jd([Zd,fx,np,rp,ip],"html"),$a=Jd([Zd,dx,np,rp,ip],"svg");function kx(t){return t.join(" ").trim()}var Pr={},aa,ld;function wx(){if(ld)return aa;ld=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,i=/\n/g,r=/^\s*/,o=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,d=/^\s+|\s+$/g,m=` `,h="/",y="*",x="",v="comment",w="declaration";function E(j,T){if(typeof j!="string")throw new TypeError("First argument must be a string");if(!j)return[];T=T||{};var O=1,A=1;function J(X){var G=X.match(i);G&&(O+=G.length);var $=X.lastIndexOf(m);A=~$?X.length-$:A+X.length}function le(){var X={line:O,column:A};return function(G){return G.position=new D(X),ge(),G}}function D(X){this.start=X,this.end={line:O,column:A},this.source=T.source}D.prototype.content=j;function ue(X){var G=new Error(T.source+":"+O+":"+A+": "+X);if(G.reason=X,G.filename=T.source,G.line=O,G.column=A,G.source=j,!T.silent)throw G}function ce(X){var G=X.exec(j);if(G){var $=G[0];return J($),j=j.slice($.length),G}}function ge(){ce(r)}function R(X){var G;for(X=X||[];G=Y();)G!==!1&&X.push(G);return X}function Y(){var X=le();if(!(h!=j.charAt(0)||y!=j.charAt(1))){for(var G=2;x!=j.charAt(G)&&(y!=j.charAt(G)||h!=j.charAt(G+1));)++G;if(G+=2,x===j.charAt(G-1))return ue("End of comment missing");var $=j.slice(2,G-2);return A+=2,J($),j=j.slice(G),A+=2,X({type:v,comment:$})}}function Z(){var X=le(),G=ce(o);if(G){if(Y(),!ce(a))return ue("property missing ':'");var $=ce(c),se=X({type:w,property:L(G[0].replace(t,x)),value:$?L($[0].replace(t,x)):x});return ce(u),se}}function ve(){var X=[];R(X);for(var G;G=Z();)G!==!1&&(X.push(G),R(X));return X}return ge(),ve()}function L(j){return j?j.replace(d,x):x}return aa=E,aa}var od;function Sx(){if(od)return Pr;od=1;var t=Pr&&Pr.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(Pr,"__esModule",{value:!0}),Pr.default=r;const i=t(wx());function r(o,a){let c=null;if(!o||typeof o!="string")return c;const u=(0,i.default)(o),d=typeof a=="function";return u.forEach(m=>{if(m.type!=="declaration")return;const{property:h,value:y}=m;d?a(h,y,m):y&&(c=c||{},c[h]=y)}),c}return Pr}var Si={},sd;function bx(){if(sd)return Si;sd=1,Object.defineProperty(Si,"__esModule",{value:!0}),Si.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,i=/-([a-z])/g,r=/^[^-]+$/,o=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,c=function(h){return!h||r.test(h)||t.test(h)},u=function(h,y){return y.toUpperCase()},d=function(h,y){return"".concat(y,"-")},m=function(h,y){return y===void 0&&(y={}),c(h)?h:(h=h.toLowerCase(),y.reactCompat?h=h.replace(a,d):h=h.replace(o,d),h.replace(i,u))};return Si.camelCase=m,Si}var bi,ad;function Cx(){if(ad)return bi;ad=1;var t=bi&&bi.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},i=t(Sx()),r=bx();function o(a,c){var u={};return!a||typeof a!="string"||(0,i.default)(a,function(d,m){d&&m&&(u[(0,r.camelCase)(d,c)]=m)}),u}return o.default=o,bi=o,bi}var jx=Cx();const Ex=lo(jx),lp=op("end"),Ba=op("start");function op(t){return i;function i(r){const o=r&&r.position&&r.position[t]||{};if(typeof o.line=="number"&&o.line>0&&typeof o.column=="number"&&o.column>0)return{line:o.line,column:o.column,offset:typeof o.offset=="number"&&o.offset>-1?o.offset:void 0}}}function Nx(t){const i=Ba(t),r=lp(t);if(i&&r)return{start:i,end:r}}function _i(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?ud(t.position):"start"in t||"end"in t?ud(t):"line"in t||"column"in t?Ta(t):""}function Ta(t){return cd(t&&t.line)+":"+cd(t&&t.column)}function ud(t){return Ta(t&&t.start)+"-"+Ta(t&&t.end)}function cd(t){return t&&typeof t=="number"?t:1}class at extends Error{constructor(i,r,o){super(),typeof r=="string"&&(o=r,r=void 0);let a="",c={},u=!1;if(r&&("line"in r&&"column"in r?c={place:r}:"start"in r&&"end"in r?c={place:r}:"type"in r?c={ancestors:[r],place:r.position}:c={...r}),typeof i=="string"?a=i:!c.cause&&i&&(u=!0,a=i.message,c.cause=i),!c.ruleId&&!c.source&&typeof o=="string"){const m=o.indexOf(":");m===-1?c.ruleId=o:(c.source=o.slice(0,m),c.ruleId=o.slice(m+1))}if(!c.place&&c.ancestors&&c.ancestors){const m=c.ancestors[c.ancestors.length-1];m&&(c.place=m.position)}const d=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=d?d.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=d?d.line:void 0,this.name=_i(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=u&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}at.prototype.file="";at.prototype.name="";at.prototype.reason="";at.prototype.message="";at.prototype.stack="";at.prototype.column=void 0;at.prototype.line=void 0;at.prototype.ancestors=void 0;at.prototype.cause=void 0;at.prototype.fatal=void 0;at.prototype.place=void 0;at.prototype.ruleId=void 0;at.prototype.source=void 0;const Ua={}.hasOwnProperty,_x=new Map,Tx=/[A-Z]/g,Px=new Set(["table","tbody","thead","tfoot","tr"]),Ix=new Set(["td","th"]),sp="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function zx(t,i){if(!i||i.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=i.filePath||void 0;let o;if(i.development){if(typeof i.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");o=$x(r,i.jsxDEV)}else{if(typeof i.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof i.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");o=Fx(r,i.jsx,i.jsxs)}const a={Fragment:i.Fragment,ancestors:[],components:i.components||{},create:o,elementAttributeNameCase:i.elementAttributeNameCase||"react",evaluater:i.createEvaluater?i.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:i.ignoreInvalidStyle||!1,passKeys:i.passKeys!==!1,passNode:i.passNode||!1,schema:i.space==="svg"?$a:vx,stylePropertyNameCase:i.stylePropertyNameCase||"dom",tableCellAlignToStyle:i.tableCellAlignToStyle!==!1},c=ap(a,t,void 0);return c&&typeof c!="string"?c:a.create(t,a.Fragment,{children:c||void 0},void 0)}function ap(t,i,r){if(i.type==="element")return Lx(t,i,r);if(i.type==="mdxFlowExpression"||i.type==="mdxTextExpression")return Rx(t,i);if(i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement")return Dx(t,i,r);if(i.type==="mdxjsEsm")return Mx(t,i);if(i.type==="root")return Ax(t,i,r);if(i.type==="text")return Ox(t,i)}function Lx(t,i,r){const o=t.schema;let a=o;i.tagName.toLowerCase()==="svg"&&o.space==="html"&&(a=$a,t.schema=a),t.ancestors.push(i);const c=cp(t,i.tagName,!1),u=Bx(t,i);let d=Ha(t,i);return Px.has(i.tagName)&&(d=d.filter(function(m){return typeof m=="string"?!ux(m):!0})),up(t,u,c,i),Va(u,d),t.ancestors.pop(),t.schema=o,t.create(i,c,u,r)}function Rx(t,i){if(i.data&&i.data.estree&&t.evaluater){const o=i.data.estree.body[0];return o.type,t.evaluater.evaluateExpression(o.expression)}Ii(t,i.position)}function Mx(t,i){if(i.data&&i.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(i.data.estree);Ii(t,i.position)}function Dx(t,i,r){const o=t.schema;let a=o;i.name==="svg"&&o.space==="html"&&(a=$a,t.schema=a),t.ancestors.push(i);const c=i.name===null?t.Fragment:cp(t,i.name,!0),u=Ux(t,i),d=Ha(t,i);return up(t,u,c,i),Va(u,d),t.ancestors.pop(),t.schema=o,t.create(i,c,u,r)}function Ax(t,i,r){const o={};return Va(o,Ha(t,i)),t.create(i,t.Fragment,o,r)}function Ox(t,i){return i.value}function up(t,i,r,o){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(i.node=o)}function Va(t,i){if(i.length>0){const r=i.length>1?i:i[0];r&&(t.children=r)}}function Fx(t,i,r){return o;function o(a,c,u,d){const h=Array.isArray(u.children)?r:i;return d?h(c,u,d):h(c,u)}}function $x(t,i){return r;function r(o,a,c,u){const d=Array.isArray(c.children),m=Ba(o);return i(a,c,u,d,{columnNumber:m?m.column-1:void 0,fileName:t,lineNumber:m?m.line:void 0},void 0)}}function Bx(t,i){const r={};let o,a;for(a in i.properties)if(a!=="children"&&Ua.call(i.properties,a)){const c=Vx(t,a,i.properties[a]);if(c){const[u,d]=c;t.tableCellAlignToStyle&&u==="align"&&typeof d=="string"&&Ix.has(i.tagName)?o=d:r[u]=d}}if(o){const c=r.style||(r.style={});c[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=o}return r}function Ux(t,i){const r={};for(const o of i.attributes)if(o.type==="mdxJsxExpressionAttribute")if(o.data&&o.data.estree&&t.evaluater){const c=o.data.estree.body[0];c.type;const u=c.expression;u.type;const d=u.properties[0];d.type,Object.assign(r,t.evaluater.evaluateExpression(d.argument))}else Ii(t,i.position);else{const a=o.name;let c;if(o.value&&typeof o.value=="object")if(o.value.data&&o.value.data.estree&&t.evaluater){const d=o.value.data.estree.body[0];d.type,c=t.evaluater.evaluateExpression(d.expression)}else Ii(t,i.position);else c=o.value===null?!0:o.value;r[a]=c}return r}function Ha(t,i){const r=[];let o=-1;const a=t.passKeys?new Map:_x;for(;++oa?0:a+i:i=i>a?a:i,r=r>0?r:0,o.length<1e4)u=Array.from(o),u.unshift(i,r),t.splice(...u);else for(r&&t.splice(i,r);c0?(Et(t,t.length,0,i),t):i}const pd={}.hasOwnProperty;function dp(t){const i={};let r=-1;for(;++r13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function Vt(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ft=Dn(/[A-Za-z]/),st=Dn(/[\dA-Za-z]/),Jx=Dn(/[#-'*+\--9=?A-Z^-~]/);function to(t){return t!==null&&(t<32||t===127)}const Pa=Dn(/\d/),Zx=Dn(/[\dA-Fa-f]/),ey=Dn(/[!-/:-@[-`{-~]/);function pe(t){return t!==null&&t<-2}function Re(t){return t!==null&&(t<0||t===32)}function je(t){return t===-2||t===-1||t===32}const co=Dn(new RegExp("\\p{P}|\\p{S}","u")),tr=Dn(/\s/);function Dn(t){return i;function i(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function Rr(t){const i=[];let r=-1,o=0,a=0;for(;++r55295&&c<57344){const d=t.charCodeAt(r+1);c<56320&&d>56319&&d<57344?(u=String.fromCharCode(c,d),a=1):u="�"}else u=String.fromCharCode(c);u&&(i.push(t.slice(o,r),encodeURIComponent(u)),o=r+a+1,u=""),a&&(r+=a,a=0)}return i.join("")+t.slice(o)}function Ee(t,i,r,o){const a=o?o-1:Number.POSITIVE_INFINITY;let c=0;return u;function u(m){return je(m)?(t.enter(r),d(m)):i(m)}function d(m){return je(m)&&c++u))return;const ue=i.events.length;let ce=ue,ge,R;for(;ce--;)if(i.events[ce][0]==="exit"&&i.events[ce][1].type==="chunkFlow"){if(ge){R=i.events[ce][1].end;break}ge=!0}for(T(o),D=ue;DA;){const le=r[J];i.containerState=le[1],le[0].exit.call(i,t)}r.length=A}function O(){a.write([null]),c=void 0,a=void 0,i.containerState._closeFlow=void 0}}function ly(t,i,r){return Ee(t,t.attempt(this.parser.constructs.document,i,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function zr(t){if(t===null||Re(t)||tr(t))return 1;if(co(t))return 2}function fo(t,i,r){const o=[];let a=-1;for(;++a1&&t[r][1].end.offset-t[r][1].start.offset>1?2:1;const x={...t[o][1].end},v={...t[r][1].start};md(x,-m),md(v,m),u={type:m>1?"strongSequence":"emphasisSequence",start:x,end:{...t[o][1].end}},d={type:m>1?"strongSequence":"emphasisSequence",start:{...t[r][1].start},end:v},c={type:m>1?"strongText":"emphasisText",start:{...t[o][1].end},end:{...t[r][1].start}},a={type:m>1?"strong":"emphasis",start:{...u.start},end:{...d.end}},t[o][1].end={...u.start},t[r][1].start={...d.end},h=[],t[o][1].end.offset-t[o][1].start.offset&&(h=Mt(h,[["enter",t[o][1],i],["exit",t[o][1],i]])),h=Mt(h,[["enter",a,i],["enter",u,i],["exit",u,i],["enter",c,i]]),h=Mt(h,fo(i.parser.constructs.insideSpan.null,t.slice(o+1,r),i)),h=Mt(h,[["exit",c,i],["enter",d,i],["exit",d,i],["exit",a,i]]),t[r][1].end.offset-t[r][1].start.offset?(y=2,h=Mt(h,[["enter",t[r][1],i],["exit",t[r][1],i]])):y=0,Et(t,o-1,r-o+3,h),r=o+h.length-y-2;break}}for(r=-1;++r0&&je(D)?Ee(t,O,"linePrefix",c+1)(D):O(D)}function O(D){return D===null||pe(D)?t.check(gd,L,J)(D):(t.enter("codeFlowValue"),A(D))}function A(D){return D===null||pe(D)?(t.exit("codeFlowValue"),O(D)):(t.consume(D),A)}function J(D){return t.exit("codeFenced"),i(D)}function le(D,ue,ce){let ge=0;return R;function R(G){return D.enter("lineEnding"),D.consume(G),D.exit("lineEnding"),Y}function Y(G){return D.enter("codeFencedFence"),je(G)?Ee(D,Z,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G):Z(G)}function Z(G){return G===d?(D.enter("codeFencedFenceSequence"),ve(G)):ce(G)}function ve(G){return G===d?(ge++,D.consume(G),ve):ge>=u?(D.exit("codeFencedFenceSequence"),je(G)?Ee(D,X,"whitespace")(G):X(G)):ce(G)}function X(G){return G===null||pe(G)?(D.exit("codeFencedFence"),ue(G)):ce(G)}}}function xy(t,i,r){const o=this;return a;function a(u){return u===null?r(u):(t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),c)}function c(u){return o.parser.lazy[o.now().line]?r(u):i(u)}}const ca={name:"codeIndented",tokenize:vy},yy={partial:!0,tokenize:ky};function vy(t,i,r){const o=this;return a;function a(h){return t.enter("codeIndented"),Ee(t,c,"linePrefix",5)(h)}function c(h){const y=o.events[o.events.length-1];return y&&y[1].type==="linePrefix"&&y[2].sliceSerialize(y[1],!0).length>=4?u(h):r(h)}function u(h){return h===null?m(h):pe(h)?t.attempt(yy,u,m)(h):(t.enter("codeFlowValue"),d(h))}function d(h){return h===null||pe(h)?(t.exit("codeFlowValue"),u(h)):(t.consume(h),d)}function m(h){return t.exit("codeIndented"),i(h)}}function ky(t,i,r){const o=this;return a;function a(u){return o.parser.lazy[o.now().line]?r(u):pe(u)?(t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),a):Ee(t,c,"linePrefix",5)(u)}function c(u){const d=o.events[o.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?i(u):pe(u)?a(u):r(u)}}const wy={name:"codeText",previous:by,resolve:Sy,tokenize:Cy};function Sy(t){let i=t.length-4,r=3,o,a;if((t[r][1].type==="lineEnding"||t[r][1].type==="space")&&(t[i][1].type==="lineEnding"||t[i][1].type==="space")){for(o=r;++o=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+i+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ithis.left.length?this.right.slice(this.right.length-o+this.left.length,this.right.length-i+this.left.length).reverse():this.left.slice(i).concat(this.right.slice(this.right.length-o+this.left.length).reverse())}splice(i,r,o){const a=r||0;this.setCursor(Math.trunc(i));const c=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return o&&Ci(this.left,o),c.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(i){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(i)}pushMany(i){this.setCursor(Number.POSITIVE_INFINITY),Ci(this.left,i)}unshift(i){this.setCursor(0),this.right.push(i)}unshiftMany(i){this.setCursor(0),Ci(this.right,i.reverse())}setCursor(i){if(!(i===this.left.length||i>this.left.length&&this.right.length===0||i<0&&this.left.length===0))if(i=4?i(u):t.interrupt(o.parser.constructs.flow,r,i)(u)}}function yp(t,i,r,o,a,c,u,d,m){const h=m||Number.POSITIVE_INFINITY;let y=0;return x;function x(T){return T===60?(t.enter(o),t.enter(a),t.enter(c),t.consume(T),t.exit(c),v):T===null||T===32||T===41||to(T)?r(T):(t.enter(o),t.enter(u),t.enter(d),t.enter("chunkString",{contentType:"string"}),L(T))}function v(T){return T===62?(t.enter(c),t.consume(T),t.exit(c),t.exit(a),t.exit(o),i):(t.enter(d),t.enter("chunkString",{contentType:"string"}),w(T))}function w(T){return T===62?(t.exit("chunkString"),t.exit(d),v(T)):T===null||T===60||pe(T)?r(T):(t.consume(T),T===92?E:w)}function E(T){return T===60||T===62||T===92?(t.consume(T),w):w(T)}function L(T){return!y&&(T===null||T===41||Re(T))?(t.exit("chunkString"),t.exit(d),t.exit(u),t.exit(o),i(T)):y999||w===null||w===91||w===93&&!m||w===94&&!d&&"_hiddenFootnoteSupport"in u.parser.constructs?r(w):w===93?(t.exit(c),t.enter(a),t.consume(w),t.exit(a),t.exit(o),i):pe(w)?(t.enter("lineEnding"),t.consume(w),t.exit("lineEnding"),y):(t.enter("chunkString",{contentType:"string"}),x(w))}function x(w){return w===null||w===91||w===93||pe(w)||d++>999?(t.exit("chunkString"),y(w)):(t.consume(w),m||(m=!je(w)),w===92?v:x)}function v(w){return w===91||w===92||w===93?(t.consume(w),d++,x):x(w)}}function kp(t,i,r,o,a,c){let u;return d;function d(v){return v===34||v===39||v===40?(t.enter(o),t.enter(a),t.consume(v),t.exit(a),u=v===40?41:v,m):r(v)}function m(v){return v===u?(t.enter(a),t.consume(v),t.exit(a),t.exit(o),i):(t.enter(c),h(v))}function h(v){return v===u?(t.exit(c),m(u)):v===null?r(v):pe(v)?(t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),Ee(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),y(v))}function y(v){return v===u||v===null||pe(v)?(t.exit("chunkString"),h(v)):(t.consume(v),v===92?x:y)}function x(v){return v===u||v===92?(t.consume(v),y):y(v)}}function Ti(t,i){let r;return o;function o(a){return pe(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),r=!0,o):je(a)?Ee(t,o,r?"linePrefix":"lineSuffix")(a):i(a)}}const zy={name:"definition",tokenize:Ry},Ly={partial:!0,tokenize:My};function Ry(t,i,r){const o=this;let a;return c;function c(w){return t.enter("definition"),u(w)}function u(w){return vp.call(o,t,d,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function d(w){return a=Vt(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)),w===58?(t.enter("definitionMarker"),t.consume(w),t.exit("definitionMarker"),m):r(w)}function m(w){return Re(w)?Ti(t,h)(w):h(w)}function h(w){return yp(t,y,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function y(w){return t.attempt(Ly,x,x)(w)}function x(w){return je(w)?Ee(t,v,"whitespace")(w):v(w)}function v(w){return w===null||pe(w)?(t.exit("definition"),o.parser.defined.push(a),i(w)):r(w)}}function My(t,i,r){return o;function o(d){return Re(d)?Ti(t,a)(d):r(d)}function a(d){return kp(t,c,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function c(d){return je(d)?Ee(t,u,"whitespace")(d):u(d)}function u(d){return d===null||pe(d)?i(d):r(d)}}const Dy={name:"hardBreakEscape",tokenize:Ay};function Ay(t,i,r){return o;function o(c){return t.enter("hardBreakEscape"),t.consume(c),a}function a(c){return pe(c)?(t.exit("hardBreakEscape"),i(c)):r(c)}}const Oy={name:"headingAtx",resolve:Fy,tokenize:$y};function Fy(t,i){let r=t.length-2,o=3,a,c;return t[o][1].type==="whitespace"&&(o+=2),r-2>o&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(o===r-1||r-4>o&&t[r-2][1].type==="whitespace")&&(r-=o+1===r?2:4),r>o&&(a={type:"atxHeadingText",start:t[o][1].start,end:t[r][1].end},c={type:"chunkText",start:t[o][1].start,end:t[r][1].end,contentType:"text"},Et(t,o,r-o+1,[["enter",a,i],["enter",c,i],["exit",c,i],["exit",a,i]])),t}function $y(t,i,r){let o=0;return a;function a(y){return t.enter("atxHeading"),c(y)}function c(y){return t.enter("atxHeadingSequence"),u(y)}function u(y){return y===35&&o++<6?(t.consume(y),u):y===null||Re(y)?(t.exit("atxHeadingSequence"),d(y)):r(y)}function d(y){return y===35?(t.enter("atxHeadingSequence"),m(y)):y===null||pe(y)?(t.exit("atxHeading"),i(y)):je(y)?Ee(t,d,"whitespace")(y):(t.enter("atxHeadingText"),h(y))}function m(y){return y===35?(t.consume(y),m):(t.exit("atxHeadingSequence"),d(y))}function h(y){return y===null||y===35||Re(y)?(t.exit("atxHeadingText"),d(y)):(t.consume(y),h)}}const By=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],yd=["pre","script","style","textarea"],Uy={concrete:!0,name:"htmlFlow",resolveTo:Wy,tokenize:qy},Vy={partial:!0,tokenize:Gy},Hy={partial:!0,tokenize:Qy};function Wy(t){let i=t.length;for(;i--&&!(t[i][0]==="enter"&&t[i][1].type==="htmlFlow"););return i>1&&t[i-2][1].type==="linePrefix"&&(t[i][1].start=t[i-2][1].start,t[i+1][1].start=t[i-2][1].start,t.splice(i-2,2)),t}function qy(t,i,r){const o=this;let a,c,u,d,m;return h;function h(C){return y(C)}function y(C){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(C),x}function x(C){return C===33?(t.consume(C),v):C===47?(t.consume(C),c=!0,L):C===63?(t.consume(C),a=3,o.interrupt?i:S):ft(C)?(t.consume(C),u=String.fromCharCode(C),j):r(C)}function v(C){return C===45?(t.consume(C),a=2,w):C===91?(t.consume(C),a=5,d=0,E):ft(C)?(t.consume(C),a=4,o.interrupt?i:S):r(C)}function w(C){return C===45?(t.consume(C),o.interrupt?i:S):r(C)}function E(C){const me="CDATA[";return C===me.charCodeAt(d++)?(t.consume(C),d===me.length?o.interrupt?i:Z:E):r(C)}function L(C){return ft(C)?(t.consume(C),u=String.fromCharCode(C),j):r(C)}function j(C){if(C===null||C===47||C===62||Re(C)){const me=C===47,we=u.toLowerCase();return!me&&!c&&yd.includes(we)?(a=1,o.interrupt?i(C):Z(C)):By.includes(u.toLowerCase())?(a=6,me?(t.consume(C),T):o.interrupt?i(C):Z(C)):(a=7,o.interrupt&&!o.parser.lazy[o.now().line]?r(C):c?O(C):A(C))}return C===45||st(C)?(t.consume(C),u+=String.fromCharCode(C),j):r(C)}function T(C){return C===62?(t.consume(C),o.interrupt?i:Z):r(C)}function O(C){return je(C)?(t.consume(C),O):R(C)}function A(C){return C===47?(t.consume(C),R):C===58||C===95||ft(C)?(t.consume(C),J):je(C)?(t.consume(C),A):R(C)}function J(C){return C===45||C===46||C===58||C===95||st(C)?(t.consume(C),J):le(C)}function le(C){return C===61?(t.consume(C),D):je(C)?(t.consume(C),le):A(C)}function D(C){return C===null||C===60||C===61||C===62||C===96?r(C):C===34||C===39?(t.consume(C),m=C,ue):je(C)?(t.consume(C),D):ce(C)}function ue(C){return C===m?(t.consume(C),m=null,ge):C===null||pe(C)?r(C):(t.consume(C),ue)}function ce(C){return C===null||C===34||C===39||C===47||C===60||C===61||C===62||C===96||Re(C)?le(C):(t.consume(C),ce)}function ge(C){return C===47||C===62||je(C)?A(C):r(C)}function R(C){return C===62?(t.consume(C),Y):r(C)}function Y(C){return C===null||pe(C)?Z(C):je(C)?(t.consume(C),Y):r(C)}function Z(C){return C===45&&a===2?(t.consume(C),$):C===60&&a===1?(t.consume(C),se):C===62&&a===4?(t.consume(C),P):C===63&&a===3?(t.consume(C),S):C===93&&a===5?(t.consume(C),re):pe(C)&&(a===6||a===7)?(t.exit("htmlFlowData"),t.check(Vy,B,ve)(C)):C===null||pe(C)?(t.exit("htmlFlowData"),ve(C)):(t.consume(C),Z)}function ve(C){return t.check(Hy,X,B)(C)}function X(C){return t.enter("lineEnding"),t.consume(C),t.exit("lineEnding"),G}function G(C){return C===null||pe(C)?ve(C):(t.enter("htmlFlowData"),Z(C))}function $(C){return C===45?(t.consume(C),S):Z(C)}function se(C){return C===47?(t.consume(C),u="",U):Z(C)}function U(C){if(C===62){const me=u.toLowerCase();return yd.includes(me)?(t.consume(C),P):Z(C)}return ft(C)&&u.length<8?(t.consume(C),u+=String.fromCharCode(C),U):Z(C)}function re(C){return C===93?(t.consume(C),S):Z(C)}function S(C){return C===62?(t.consume(C),P):C===45&&a===2?(t.consume(C),S):Z(C)}function P(C){return C===null||pe(C)?(t.exit("htmlFlowData"),B(C)):(t.consume(C),P)}function B(C){return t.exit("htmlFlow"),i(C)}}function Qy(t,i,r){const o=this;return a;function a(u){return pe(u)?(t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),c):r(u)}function c(u){return o.parser.lazy[o.now().line]?r(u):i(u)}}function Gy(t,i,r){return o;function o(a){return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),t.attempt(Ri,i,r)}}const Ky={name:"htmlText",tokenize:Yy};function Yy(t,i,r){const o=this;let a,c,u;return d;function d(S){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(S),m}function m(S){return S===33?(t.consume(S),h):S===47?(t.consume(S),le):S===63?(t.consume(S),A):ft(S)?(t.consume(S),ce):r(S)}function h(S){return S===45?(t.consume(S),y):S===91?(t.consume(S),c=0,E):ft(S)?(t.consume(S),O):r(S)}function y(S){return S===45?(t.consume(S),w):r(S)}function x(S){return S===null?r(S):S===45?(t.consume(S),v):pe(S)?(u=x,se(S)):(t.consume(S),x)}function v(S){return S===45?(t.consume(S),w):x(S)}function w(S){return S===62?$(S):S===45?v(S):x(S)}function E(S){const P="CDATA[";return S===P.charCodeAt(c++)?(t.consume(S),c===P.length?L:E):r(S)}function L(S){return S===null?r(S):S===93?(t.consume(S),j):pe(S)?(u=L,se(S)):(t.consume(S),L)}function j(S){return S===93?(t.consume(S),T):L(S)}function T(S){return S===62?$(S):S===93?(t.consume(S),T):L(S)}function O(S){return S===null||S===62?$(S):pe(S)?(u=O,se(S)):(t.consume(S),O)}function A(S){return S===null?r(S):S===63?(t.consume(S),J):pe(S)?(u=A,se(S)):(t.consume(S),A)}function J(S){return S===62?$(S):A(S)}function le(S){return ft(S)?(t.consume(S),D):r(S)}function D(S){return S===45||st(S)?(t.consume(S),D):ue(S)}function ue(S){return pe(S)?(u=ue,se(S)):je(S)?(t.consume(S),ue):$(S)}function ce(S){return S===45||st(S)?(t.consume(S),ce):S===47||S===62||Re(S)?ge(S):r(S)}function ge(S){return S===47?(t.consume(S),$):S===58||S===95||ft(S)?(t.consume(S),R):pe(S)?(u=ge,se(S)):je(S)?(t.consume(S),ge):$(S)}function R(S){return S===45||S===46||S===58||S===95||st(S)?(t.consume(S),R):Y(S)}function Y(S){return S===61?(t.consume(S),Z):pe(S)?(u=Y,se(S)):je(S)?(t.consume(S),Y):ge(S)}function Z(S){return S===null||S===60||S===61||S===62||S===96?r(S):S===34||S===39?(t.consume(S),a=S,ve):pe(S)?(u=Z,se(S)):je(S)?(t.consume(S),Z):(t.consume(S),X)}function ve(S){return S===a?(t.consume(S),a=void 0,G):S===null?r(S):pe(S)?(u=ve,se(S)):(t.consume(S),ve)}function X(S){return S===null||S===34||S===39||S===60||S===61||S===96?r(S):S===47||S===62||Re(S)?ge(S):(t.consume(S),X)}function G(S){return S===47||S===62||Re(S)?ge(S):r(S)}function $(S){return S===62?(t.consume(S),t.exit("htmlTextData"),t.exit("htmlText"),i):r(S)}function se(S){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(S),t.exit("lineEnding"),U}function U(S){return je(S)?Ee(t,re,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):re(S)}function re(S){return t.enter("htmlTextData"),u(S)}}const Qa={name:"labelEnd",resolveAll:e1,resolveTo:t1,tokenize:n1},Xy={tokenize:r1},Jy={tokenize:i1},Zy={tokenize:l1};function e1(t){let i=-1;const r=[];for(;++i=3&&(h===null||pe(h))?(t.exit("thematicBreak"),i(h)):r(h)}function m(h){return h===a?(t.consume(h),o++,m):(t.exit("thematicBreakSequence"),je(h)?Ee(t,d,"whitespace")(h):d(h))}}const yt={continuation:{tokenize:m1},exit:x1,name:"list",tokenize:h1},d1={partial:!0,tokenize:y1},p1={partial:!0,tokenize:g1};function h1(t,i,r){const o=this,a=o.events[o.events.length-1];let c=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,u=0;return d;function d(w){const E=o.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(E==="listUnordered"?!o.containerState.marker||w===o.containerState.marker:Pa(w)){if(o.containerState.type||(o.containerState.type=E,t.enter(E,{_container:!0})),E==="listUnordered")return t.enter("listItemPrefix"),w===42||w===45?t.check(eo,r,h)(w):h(w);if(!o.interrupt||w===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),m(w)}return r(w)}function m(w){return Pa(w)&&++u<10?(t.consume(w),m):(!o.interrupt||u<2)&&(o.containerState.marker?w===o.containerState.marker:w===41||w===46)?(t.exit("listItemValue"),h(w)):r(w)}function h(w){return t.enter("listItemMarker"),t.consume(w),t.exit("listItemMarker"),o.containerState.marker=o.containerState.marker||w,t.check(Ri,o.interrupt?r:y,t.attempt(d1,v,x))}function y(w){return o.containerState.initialBlankLine=!0,c++,v(w)}function x(w){return je(w)?(t.enter("listItemPrefixWhitespace"),t.consume(w),t.exit("listItemPrefixWhitespace"),v):r(w)}function v(w){return o.containerState.size=c+o.sliceSerialize(t.exit("listItemPrefix"),!0).length,i(w)}}function m1(t,i,r){const o=this;return o.containerState._closeFlow=void 0,t.check(Ri,a,c);function a(d){return o.containerState.furtherBlankLines=o.containerState.furtherBlankLines||o.containerState.initialBlankLine,Ee(t,i,"listItemIndent",o.containerState.size+1)(d)}function c(d){return o.containerState.furtherBlankLines||!je(d)?(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,u(d)):(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,t.attempt(p1,i,u)(d))}function u(d){return o.containerState._closeFlow=!0,o.interrupt=void 0,Ee(t,t.attempt(yt,i,r),"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function g1(t,i,r){const o=this;return Ee(t,a,"listItemIndent",o.containerState.size+1);function a(c){const u=o.events[o.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===o.containerState.size?i(c):r(c)}}function x1(t){t.exit(this.containerState.type)}function y1(t,i,r){const o=this;return Ee(t,a,"listItemPrefixWhitespace",o.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(c){const u=o.events[o.events.length-1];return!je(c)&&u&&u[1].type==="listItemPrefixWhitespace"?i(c):r(c)}}const vd={name:"setextUnderline",resolveTo:v1,tokenize:k1};function v1(t,i){let r=t.length,o,a,c;for(;r--;)if(t[r][0]==="enter"){if(t[r][1].type==="content"){o=r;break}t[r][1].type==="paragraph"&&(a=r)}else t[r][1].type==="content"&&t.splice(r,1),!c&&t[r][1].type==="definition"&&(c=r);const u={type:"setextHeading",start:{...t[o][1].start},end:{...t[t.length-1][1].end}};return t[a][1].type="setextHeadingText",c?(t.splice(a,0,["enter",u,i]),t.splice(c+1,0,["exit",t[o][1],i]),t[o][1].end={...t[c][1].end}):t[o][1]=u,t.push(["exit",u,i]),t}function k1(t,i,r){const o=this;let a;return c;function c(h){let y=o.events.length,x;for(;y--;)if(o.events[y][1].type!=="lineEnding"&&o.events[y][1].type!=="linePrefix"&&o.events[y][1].type!=="content"){x=o.events[y][1].type==="paragraph";break}return!o.parser.lazy[o.now().line]&&(o.interrupt||x)?(t.enter("setextHeadingLine"),a=h,u(h)):r(h)}function u(h){return t.enter("setextHeadingLineSequence"),d(h)}function d(h){return h===a?(t.consume(h),d):(t.exit("setextHeadingLineSequence"),je(h)?Ee(t,m,"lineSuffix")(h):m(h))}function m(h){return h===null||pe(h)?(t.exit("setextHeadingLine"),i(h)):r(h)}}const w1={tokenize:S1};function S1(t){const i=this,r=t.attempt(Ri,o,t.attempt(this.parser.constructs.flowInitial,a,Ee(t,t.attempt(this.parser.constructs.flow,a,t.attempt(Ny,a)),"linePrefix")));return r;function o(c){if(c===null){t.consume(c);return}return t.enter("lineEndingBlank"),t.consume(c),t.exit("lineEndingBlank"),i.currentConstruct=void 0,r}function a(c){if(c===null){t.consume(c);return}return t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),i.currentConstruct=void 0,r}}const b1={resolveAll:Sp()},C1=wp("string"),j1=wp("text");function wp(t){return{resolveAll:Sp(t==="text"?E1:void 0),tokenize:i};function i(r){const o=this,a=this.parser.constructs[t],c=r.attempt(a,u,d);return u;function u(y){return h(y)?c(y):d(y)}function d(y){if(y===null){r.consume(y);return}return r.enter("data"),r.consume(y),m}function m(y){return h(y)?(r.exit("data"),c(y)):(r.consume(y),m)}function h(y){if(y===null)return!0;const x=a[y];let v=-1;if(x)for(;++v-1){const d=u[0];typeof d=="string"?u[0]=d.slice(o):u.shift()}c>0&&u.push(t[a].slice(0,c))}return u}function F1(t,i){let r=-1;const o=[];let a;for(;++r0){const Ze=xe.tokenStack[xe.tokenStack.length-1];(Ze[1]||wd).call(xe,void 0,Ze[0])}for(K.position={start:Rn(F.length>0?F[0][1].start:{line:1,column:1,offset:0}),end:Rn(F.length>0?F[F.length-2][1].end:{line:1,column:1,offset:0})},Ne=-1;++Ne0&&(o.className=["language-"+a[0]]);let c={type:"element",tagName:"code",properties:o,children:[{type:"text",value:r}]};return i.meta&&(c.data={meta:i.meta}),t.patch(i,c),c=t.applyData(i,c),c={type:"element",tagName:"pre",properties:{},children:[c]},t.patch(i,c),c}function Z1(t,i){const r={type:"element",tagName:"del",properties:{},children:t.all(i)};return t.patch(i,r),t.applyData(i,r)}function ev(t,i){const r={type:"element",tagName:"em",properties:{},children:t.all(i)};return t.patch(i,r),t.applyData(i,r)}function tv(t,i){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",o=String(i.identifier).toUpperCase(),a=Rr(o.toLowerCase()),c=t.footnoteOrder.indexOf(o);let u,d=t.footnoteCounts.get(o);d===void 0?(d=0,t.footnoteOrder.push(o),u=t.footnoteOrder.length):u=c+1,d+=1,t.footnoteCounts.set(o,d);const m={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+a,id:r+"fnref-"+a+(d>1?"-"+d:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};t.patch(i,m);const h={type:"element",tagName:"sup",properties:{},children:[m]};return t.patch(i,h),t.applyData(i,h)}function nv(t,i){const r={type:"element",tagName:"h"+i.depth,properties:{},children:t.all(i)};return t.patch(i,r),t.applyData(i,r)}function rv(t,i){if(t.options.allowDangerousHtml){const r={type:"raw",value:i.value};return t.patch(i,r),t.applyData(i,r)}}function jp(t,i){const r=i.referenceType;let o="]";if(r==="collapsed"?o+="[]":r==="full"&&(o+="["+(i.label||i.identifier)+"]"),i.type==="imageReference")return[{type:"text",value:"!["+i.alt+o}];const a=t.all(i),c=a[0];c&&c.type==="text"?c.value="["+c.value:a.unshift({type:"text",value:"["});const u=a[a.length-1];return u&&u.type==="text"?u.value+=o:a.push({type:"text",value:o}),a}function iv(t,i){const r=String(i.identifier).toUpperCase(),o=t.definitionById.get(r);if(!o)return jp(t,i);const a={src:Rr(o.url||""),alt:i.alt};o.title!==null&&o.title!==void 0&&(a.title=o.title);const c={type:"element",tagName:"img",properties:a,children:[]};return t.patch(i,c),t.applyData(i,c)}function lv(t,i){const r={src:Rr(i.url)};i.alt!==null&&i.alt!==void 0&&(r.alt=i.alt),i.title!==null&&i.title!==void 0&&(r.title=i.title);const o={type:"element",tagName:"img",properties:r,children:[]};return t.patch(i,o),t.applyData(i,o)}function ov(t,i){const r={type:"text",value:i.value.replace(/\r?\n|\r/g," ")};t.patch(i,r);const o={type:"element",tagName:"code",properties:{},children:[r]};return t.patch(i,o),t.applyData(i,o)}function sv(t,i){const r=String(i.identifier).toUpperCase(),o=t.definitionById.get(r);if(!o)return jp(t,i);const a={href:Rr(o.url||"")};o.title!==null&&o.title!==void 0&&(a.title=o.title);const c={type:"element",tagName:"a",properties:a,children:t.all(i)};return t.patch(i,c),t.applyData(i,c)}function av(t,i){const r={href:Rr(i.url)};i.title!==null&&i.title!==void 0&&(r.title=i.title);const o={type:"element",tagName:"a",properties:r,children:t.all(i)};return t.patch(i,o),t.applyData(i,o)}function uv(t,i,r){const o=t.all(i),a=r?cv(r):Ep(i),c={},u=[];if(typeof i.checked=="boolean"){const y=o[0];let x;y&&y.type==="element"&&y.tagName==="p"?x=y:(x={type:"element",tagName:"p",properties:{},children:[]},o.unshift(x)),x.children.length>0&&x.children.unshift({type:"text",value:" "}),x.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:i.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let d=-1;for(;++d1}function fv(t,i){const r={},o=t.all(i);let a=-1;for(typeof i.start=="number"&&i.start!==1&&(r.start=i.start);++a0){const u={type:"element",tagName:"tbody",properties:{},children:t.wrap(r,!0)},d=Ba(i.children[1]),m=lp(i.children[i.children.length-1]);d&&m&&(u.position={start:d,end:m}),a.push(u)}const c={type:"element",tagName:"table",properties:{},children:t.wrap(a,!0)};return t.patch(i,c),t.applyData(i,c)}function gv(t,i,r){const o=r?r.children:void 0,c=(o?o.indexOf(i):1)===0?"th":"td",u=r&&r.type==="table"?r.align:void 0,d=u?u.length:i.children.length;let m=-1;const h=[];for(;++m0,!0),o[0]),a=o.index+o[0].length,o=r.exec(i);return c.push(Cd(i.slice(a),a>0,!1)),c.join("")}function Cd(t,i,r){let o=0,a=t.length;if(i){let c=t.codePointAt(o);for(;c===Sd||c===bd;)o++,c=t.codePointAt(o)}if(r){let c=t.codePointAt(a-1);for(;c===Sd||c===bd;)a--,c=t.codePointAt(a-1)}return a>o?t.slice(o,a):""}function vv(t,i){const r={type:"text",value:yv(String(i.value))};return t.patch(i,r),t.applyData(i,r)}function kv(t,i){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(i,r),t.applyData(i,r)}const wv={blockquote:Y1,break:X1,code:J1,delete:Z1,emphasis:ev,footnoteReference:tv,heading:nv,html:rv,imageReference:iv,image:lv,inlineCode:ov,linkReference:sv,link:av,listItem:uv,list:fv,paragraph:dv,root:pv,strong:hv,table:mv,tableCell:xv,tableRow:gv,text:vv,thematicBreak:kv,toml:Kl,yaml:Kl,definition:Kl,footnoteDefinition:Kl};function Kl(){}const Np=-1,po=0,Pi=1,no=2,Ga=3,Ka=4,Ya=5,Xa=6,_p=7,Tp=8,Sv=typeof self=="object"?self:globalThis,jd=(t,i)=>{switch(t){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+t)}return new Sv[t](i)},bv=(t,i)=>{const r=(a,c)=>(t.set(c,a),a),o=a=>{if(t.has(a))return t.get(a);const[c,u]=i[a];switch(c){case po:case Np:return r(u,a);case Pi:{const d=r([],a);for(const m of u)d.push(o(m));return d}case no:{const d=r({},a);for(const[m,h]of u)d[o(m)]=o(h);return d}case Ga:return r(new Date(u),a);case Ka:{const{source:d,flags:m}=u;return r(new RegExp(d,m),a)}case Ya:{const d=r(new Map,a);for(const[m,h]of u)d.set(o(m),o(h));return d}case Xa:{const d=r(new Set,a);for(const m of u)d.add(o(m));return d}case _p:{const{name:d,message:m}=u;return r(jd(d,m),a)}case Tp:return r(BigInt(u),a);case"BigInt":return r(Object(BigInt(u)),a);case"ArrayBuffer":return r(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:d}=new Uint8Array(u);return r(new DataView(d),u)}}return r(jd(c,u),a)};return o},Ed=t=>bv(new Map,t)(0),Zn="",{toString:Cv}={},{keys:jv}=Object,ji=t=>{const i=typeof t;if(i!=="object"||!t)return[po,i];const r=Cv.call(t).slice(8,-1);switch(r){case"Array":return[Pi,Zn];case"Object":return[no,Zn];case"Date":return[Ga,Zn];case"RegExp":return[Ka,Zn];case"Map":return[Ya,Zn];case"Set":return[Xa,Zn];case"DataView":return[Pi,r]}return r.includes("Array")?[Pi,r]:r.includes("Error")?[_p,r]:[no,r]},Yl=([t,i])=>t===po&&(i==="function"||i==="symbol"),Ev=(t,i,r,o)=>{const a=(u,d)=>{const m=o.push(u)-1;return r.set(d,m),m},c=u=>{if(r.has(u))return r.get(u);let[d,m]=ji(u);switch(d){case po:{let y=u;switch(m){case"bigint":d=Tp,y=u.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+m);y=null;break;case"undefined":return a([Np],u)}return a([d,y],u)}case Pi:{if(m){let v=u;return m==="DataView"?v=new Uint8Array(u.buffer):m==="ArrayBuffer"&&(v=new Uint8Array(u)),a([m,[...v]],u)}const y=[],x=a([d,y],u);for(const v of u)y.push(c(v));return x}case no:{if(m)switch(m){case"BigInt":return a([m,u.toString()],u);case"Boolean":case"Number":case"String":return a([m,u.valueOf()],u)}if(i&&"toJSON"in u)return c(u.toJSON());const y=[],x=a([d,y],u);for(const v of jv(u))(t||!Yl(ji(u[v])))&&y.push([c(v),c(u[v])]);return x}case Ga:return a([d,isNaN(u.getTime())?Zn:u.toISOString()],u);case Ka:{const{source:y,flags:x}=u;return a([d,{source:y,flags:x}],u)}case Ya:{const y=[],x=a([d,y],u);for(const[v,w]of u)(t||!(Yl(ji(v))||Yl(ji(w))))&&y.push([c(v),c(w)]);return x}case Xa:{const y=[],x=a([d,y],u);for(const v of u)(t||!Yl(ji(v)))&&y.push(c(v));return x}}const{message:h}=u;return a([d,{name:m,message:h}],u)};return c},Nd=(t,{json:i,lossy:r}={})=>{const o=[];return Ev(!(i||r),!!i,new Map,o)(t),o},ro=typeof structuredClone=="function"?(t,i)=>i&&("json"in i||"lossy"in i)?Ed(Nd(t,i)):structuredClone(t):(t,i)=>Ed(Nd(t,i));function Nv(t,i){const r=[{type:"text",value:"↩"}];return i>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(i)}]}),r}function _v(t,i){return"Back to reference "+(t+1)+(i>1?"-"+i:"")}function Tv(t){const i=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||Nv,o=t.options.footnoteBackLabel||_v,a=t.options.footnoteLabel||"Footnotes",c=t.options.footnoteLabelTagName||"h2",u=t.options.footnoteLabelProperties||{className:["sr-only"]},d=[];let m=-1;for(;++m0&&E.push({type:"text",value:" "});let O=typeof r=="string"?r:r(m,w);typeof O=="string"&&(O={type:"text",value:O}),E.push({type:"element",tagName:"a",properties:{href:"#"+i+"fnref-"+v+(w>1?"-"+w:""),dataFootnoteBackref:"",ariaLabel:typeof o=="string"?o:o(m,w),className:["data-footnote-backref"]},children:Array.isArray(O)?O:[O]})}const j=y[y.length-1];if(j&&j.type==="element"&&j.tagName==="p"){const O=j.children[j.children.length-1];O&&O.type==="text"?O.value+=" ":j.children.push({type:"text",value:" "}),j.children.push(...E)}else y.push(...E);const T={type:"element",tagName:"li",properties:{id:i+"fn-"+v},children:t.wrap(y,!0)};t.patch(h,T),d.push(T)}if(d.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...ro(u),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:` `},{type:"element",tagName:"ol",properties:{},children:t.wrap(d,!0)},{type:"text",value:` `}]}}const ho=(function(t){if(t==null)return Lv;if(typeof t=="function")return mo(t);if(typeof t=="object")return Array.isArray(t)?Pv(t):Iv(t);if(typeof t=="string")return zv(t);throw new Error("Expected function, string, or object as test")});function Pv(t){const i=[];let r=-1;for(;++r":""))+")"})}return v;function v(){let w=Pp,E,L,j;if((!i||c(m,h,y[y.length-1]||void 0))&&(w=Av(r(m,y)),w[0]===za))return w;if("children"in m&&m.children){const T=m;if(T.children&&w[0]!==Dv)for(L=(o?T.children.length:-1)+u,j=y.concat(T);L>-1&&L0&&r.push({type:"text",value:` `}),r}function _d(t){let i=0,r=t.charCodeAt(i);for(;r===9||r===32;)i++,r=t.charCodeAt(i);return t.slice(i)}function Td(t,i){const r=Fv(t,i),o=r.one(t,void 0),a=Tv(r),c=Array.isArray(o)?{type:"root",children:o}:o||{type:"root",children:[]};return a&&c.children.push({type:"text",value:` `},a),c}function Hv(t,i){return t&&"run"in t?async function(r,o){const a=Td(r,{file:o,...i});await t.run(a,o)}:function(r,o){return Td(r,{file:o,...t||i})}}function Pd(t){if(t)throw t}var da,Id;function Wv(){if(Id)return da;Id=1;var t=Object.prototype.hasOwnProperty,i=Object.prototype.toString,r=Object.defineProperty,o=Object.getOwnPropertyDescriptor,a=function(h){return typeof Array.isArray=="function"?Array.isArray(h):i.call(h)==="[object Array]"},c=function(h){if(!h||i.call(h)!=="[object Object]")return!1;var y=t.call(h,"constructor"),x=h.constructor&&h.constructor.prototype&&t.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!y&&!x)return!1;var v;for(v in h);return typeof v>"u"||t.call(h,v)},u=function(h,y){r&&y.name==="__proto__"?r(h,y.name,{enumerable:!0,configurable:!0,value:y.newValue,writable:!0}):h[y.name]=y.newValue},d=function(h,y){if(y==="__proto__")if(t.call(h,y)){if(o)return o(h,y).value}else return;return h[y]};return da=function m(){var h,y,x,v,w,E,L=arguments[0],j=1,T=arguments.length,O=!1;for(typeof L=="boolean"&&(O=L,L=arguments[1]||{},j=2),(L==null||typeof L!="object"&&typeof L!="function")&&(L={});ju.length;let m;d&&u.push(a);try{m=t.apply(this,u)}catch(h){const y=h;if(d&&r)throw y;return a(y)}d||(m&&m.then&&typeof m.then=="function"?m.then(c,a):m instanceof Error?a(m):c(m))}function a(u,...d){r||(r=!0,i(u,...d))}function c(u){a(null,u)}}const Yt={basename:Kv,dirname:Yv,extname:Xv,join:Jv,sep:"/"};function Kv(t,i){if(i!==void 0&&typeof i!="string")throw new TypeError('"ext" argument must be a string');Mi(t);let r=0,o=-1,a=t.length,c;if(i===void 0||i.length===0||i.length>t.length){for(;a--;)if(t.codePointAt(a)===47){if(c){r=a+1;break}}else o<0&&(c=!0,o=a+1);return o<0?"":t.slice(r,o)}if(i===t)return"";let u=-1,d=i.length-1;for(;a--;)if(t.codePointAt(a)===47){if(c){r=a+1;break}}else u<0&&(c=!0,u=a+1),d>-1&&(t.codePointAt(a)===i.codePointAt(d--)?d<0&&(o=a):(d=-1,o=u));return r===o?o=u:o<0&&(o=t.length),t.slice(r,o)}function Yv(t){if(Mi(t),t.length===0)return".";let i=-1,r=t.length,o;for(;--r;)if(t.codePointAt(r)===47){if(o){i=r;break}}else o||(o=!0);return i<0?t.codePointAt(0)===47?"/":".":i===1&&t.codePointAt(0)===47?"//":t.slice(0,i)}function Xv(t){Mi(t);let i=t.length,r=-1,o=0,a=-1,c=0,u;for(;i--;){const d=t.codePointAt(i);if(d===47){if(u){o=i+1;break}continue}r<0&&(u=!0,r=i+1),d===46?a<0?a=i:c!==1&&(c=1):a>-1&&(c=-1)}return a<0||r<0||c===0||c===1&&a===r-1&&a===o+1?"":t.slice(a,r)}function Jv(...t){let i=-1,r;for(;++i0&&t.codePointAt(t.length-1)===47&&(r+="/"),i?"/"+r:r}function ek(t,i){let r="",o=0,a=-1,c=0,u=-1,d,m;for(;++u<=t.length;){if(u2){if(m=r.lastIndexOf("/"),m!==r.length-1){m<0?(r="",o=0):(r=r.slice(0,m),o=r.length-1-r.lastIndexOf("/")),a=u,c=0;continue}}else if(r.length>0){r="",o=0,a=u,c=0;continue}}i&&(r=r.length>0?r+"/..":"..",o=2)}else r.length>0?r+="/"+t.slice(a+1,u):r=t.slice(a+1,u),o=u-a-1;a=u,c=0}else d===46&&c>-1?c++:c=-1}return r}function Mi(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const tk={cwd:nk};function nk(){return"/"}function Ma(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function rk(t){if(typeof t=="string")t=new URL(t);else if(!Ma(t)){const i=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw i.code="ERR_INVALID_ARG_TYPE",i}if(t.protocol!=="file:"){const i=new TypeError("The URL must be of scheme file");throw i.code="ERR_INVALID_URL_SCHEME",i}return ik(t)}function ik(t){if(t.hostname!==""){const o=new TypeError('File URL host must be "localhost" or empty on darwin');throw o.code="ERR_INVALID_FILE_URL_HOST",o}const i=t.pathname;let r=-1;for(;++r0){let[w,...E]=y;const L=o[v][1];Ra(L)&&Ra(w)&&(w=pa(!0,L,w)),o[v]=[h,w,...E]}}}}const ak=new Za().freeze();function xa(t,i){if(typeof i!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function ya(t,i){if(typeof i!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function va(t,i){if(i)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Ld(t){if(!Ra(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Rd(t,i,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+i+"` instead")}function Xl(t){return uk(t)?t:new zp(t)}function uk(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function ck(t){return typeof t=="string"||fk(t)}function fk(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const dk="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Md=[],Dd={allowDangerousHtml:!0},pk=/^(https?|ircs?|mailto|xmpp)$/i,hk=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function mk(t){const i=gk(t),r=xk(t);return yk(i.runSync(i.parse(r),r),t)}function gk(t){const i=t.rehypePlugins||Md,r=t.remarkPlugins||Md,o=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...Dd}:Dd;return ak().use(K1).use(r).use(Hv,o).use(i)}function xk(t){const i=t.children||"",r=new zp;return typeof i=="string"&&(r.value=i),r}function yk(t,i){const r=i.allowedElements,o=i.allowElement,a=i.components,c=i.disallowedElements,u=i.skipHtml,d=i.unwrapDisallowed,m=i.urlTransform||vk;for(const y of hk)Object.hasOwn(i,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+dk+y.id,void 0);return Ja(t,h),zx(t,{Fragment:g.Fragment,components:a,ignoreInvalidStyle:!0,jsx:g.jsx,jsxs:g.jsxs,passKeys:!0,passNode:!0});function h(y,x,v){if(y.type==="raw"&&v&&typeof x=="number")return u?v.children.splice(x,1):v.children[x]={type:"text",value:y.value},x;if(y.type==="element"){let w;for(w in ua)if(Object.hasOwn(ua,w)&&Object.hasOwn(y.properties,w)){const E=y.properties[w],L=ua[w];(L===null||L.includes(y.tagName))&&(y.properties[w]=m(String(E||""),w,y))}}if(y.type==="element"){let w=r?!r.includes(y.tagName):c?c.includes(y.tagName):!1;if(!w&&o&&typeof x=="number"&&(w=!o(y,x,v)),w&&v&&typeof x=="number")return d&&y.children?v.children.splice(x,1,...y.children):v.children.splice(x,1),x}}}function vk(t){const i=t.indexOf(":"),r=t.indexOf("?"),o=t.indexOf("#"),a=t.indexOf("/");return i===-1||a!==-1&&i>a||r!==-1&&i>r||o!==-1&&i>o||pk.test(t.slice(0,i))?t:""}function Ad(t,i){const r=String(t);if(typeof i!="string")throw new TypeError("Expected character");let o=0,a=r.indexOf(i);for(;a!==-1;)o++,a=r.indexOf(i,a+i.length);return o}function kk(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function wk(t,i,r){const a=ho((r||{}).ignore||[]),c=Sk(i);let u=-1;for(;++u0?{type:"text",value:D}:void 0),D===!1?v.lastIndex=J+1:(E!==J&&O.push({type:"text",value:h.value.slice(E,J)}),Array.isArray(D)?O.push(...D):D&&O.push(D),E=J+A[0].length,T=!0),!v.global)break;A=v.exec(h.value)}return T?(E?\]}]+$/.exec(t);if(!i)return[t,void 0];t=t.slice(0,i.index);let r=i[0],o=r.indexOf(")");const a=Ad(t,"(");let c=Ad(t,")");for(;o!==-1&&a>c;)t+=r.slice(0,o+1),r=r.slice(o+1),o=r.indexOf(")"),c++;return[t,r]}function Lp(t,i){const r=t.input.charCodeAt(t.index-1);return(t.index===0||tr(r)||co(r))&&(!i||r!==47)}Rp.peek=Wk;function Ak(){this.buffer()}function Ok(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function Fk(){this.buffer()}function $k(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function Bk(t){const i=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Vt(this.sliceSerialize(t)).toLowerCase(),r.label=i}function Uk(t){this.exit(t)}function Vk(t){const i=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Vt(this.sliceSerialize(t)).toLowerCase(),r.label=i}function Hk(t){this.exit(t)}function Wk(){return"["}function Rp(t,i,r,o){const a=r.createTracker(o);let c=a.move("[^");const u=r.enter("footnoteReference"),d=r.enter("reference");return c+=a.move(r.safe(r.associationId(t),{after:"]",before:c})),d(),u(),c+=a.move("]"),c}function qk(){return{enter:{gfmFootnoteCallString:Ak,gfmFootnoteCall:Ok,gfmFootnoteDefinitionLabelString:Fk,gfmFootnoteDefinition:$k},exit:{gfmFootnoteCallString:Bk,gfmFootnoteCall:Uk,gfmFootnoteDefinitionLabelString:Vk,gfmFootnoteDefinition:Hk}}}function Qk(t){let i=!1;return t&&t.firstLineBlank&&(i=!0),{handlers:{footnoteDefinition:r,footnoteReference:Rp},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(o,a,c,u){const d=c.createTracker(u);let m=d.move("[^");const h=c.enter("footnoteDefinition"),y=c.enter("label");return m+=d.move(c.safe(c.associationId(o),{before:m,after:"]"})),y(),m+=d.move("]:"),o.children&&o.children.length>0&&(d.shift(4),m+=d.move((i?` `:" ")+c.indentLines(c.containerFlow(o,d.current()),i?Mp:Gk))),h(),m}}function Gk(t,i,r){return i===0?t:Mp(t,i,r)}function Mp(t,i,r){return(r?"":" ")+t}const Kk=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Dp.peek=ew;function Yk(){return{canContainEols:["delete"],enter:{strikethrough:Jk},exit:{strikethrough:Zk}}}function Xk(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Kk}],handlers:{delete:Dp}}}function Jk(t){this.enter({type:"delete",children:[]},t)}function Zk(t){this.exit(t)}function Dp(t,i,r,o){const a=r.createTracker(o),c=r.enter("strikethrough");let u=a.move("~~");return u+=r.containerPhrasing(t,{...a.current(),before:u,after:"~"}),u+=a.move("~~"),c(),u}function ew(){return"~"}function tw(t){return t.length}function nw(t,i){const r=i||{},o=(r.align||[]).concat(),a=r.stringLength||tw,c=[],u=[],d=[],m=[];let h=0,y=-1;for(;++yh&&(h=t[y].length);++Tm[T])&&(m[T]=A)}L.push(O)}u[y]=L,d[y]=j}let x=-1;if(typeof o=="object"&&"length"in o)for(;++xm[x]&&(m[x]=O),w[x]=O),v[x]=A}u.splice(1,0,v),d.splice(1,0,w),y=-1;const E=[];for(;++y "),c.shift(2);const u=r.indentLines(r.containerFlow(t,c.current()),lw);return a(),u}function lw(t,i,r){return">"+(r?"":" ")+t}function ow(t,i){return Fd(t,i.inConstruct,!0)&&!Fd(t,i.notInConstruct,!1)}function Fd(t,i,r){if(typeof i=="string"&&(i=[i]),!i||i.length===0)return r;let o=-1;for(;++ou&&(u=c):c=1,a=o+i.length,o=r.indexOf(i,a);return u}function aw(t,i){return!!(i.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function uw(t){const i=t.options.fence||"`";if(i!=="`"&&i!=="~")throw new Error("Cannot serialize code with `"+i+"` for `options.fence`, expected `` ` `` or `~`");return i}function cw(t,i,r,o){const a=uw(r),c=t.value||"",u=a==="`"?"GraveAccent":"Tilde";if(aw(t,r)){const x=r.enter("codeIndented"),v=r.indentLines(c,fw);return x(),v}const d=r.createTracker(o),m=a.repeat(Math.max(sw(c,a)+1,3)),h=r.enter("codeFenced");let y=d.move(m);if(t.lang){const x=r.enter(`codeFencedLang${u}`);y+=d.move(r.safe(t.lang,{before:y,after:" ",encode:["`"],...d.current()})),x()}if(t.lang&&t.meta){const x=r.enter(`codeFencedMeta${u}`);y+=d.move(" "),y+=d.move(r.safe(t.meta,{before:y,after:` `,encode:["`"],...d.current()})),x()}return y+=d.move(` `),c&&(y+=d.move(c+` `)),y+=d.move(m),h(),y}function fw(t,i,r){return(r?"":" ")+t}function eu(t){const i=t.options.quote||'"';if(i!=='"'&&i!=="'")throw new Error("Cannot serialize title with `"+i+"` for `options.quote`, expected `\"`, or `'`");return i}function dw(t,i,r,o){const a=eu(r),c=a==='"'?"Quote":"Apostrophe",u=r.enter("definition");let d=r.enter("label");const m=r.createTracker(o);let h=m.move("[");return h+=m.move(r.safe(r.associationId(t),{before:h,after:"]",...m.current()})),h+=m.move("]: "),d(),!t.url||/[\0- \u007F]/.test(t.url)?(d=r.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(r.safe(t.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(d=r.enter("destinationRaw"),h+=m.move(r.safe(t.url,{before:h,after:t.title?" ":` `,...m.current()}))),d(),t.title&&(d=r.enter(`title${c}`),h+=m.move(" "+a),h+=m.move(r.safe(t.title,{before:h,after:a,...m.current()})),h+=m.move(a),d()),u(),h}function pw(t){const i=t.options.emphasis||"*";if(i!=="*"&&i!=="_")throw new Error("Cannot serialize emphasis with `"+i+"` for `options.emphasis`, expected `*`, or `_`");return i}function zi(t){return"&#x"+t.toString(16).toUpperCase()+";"}function io(t,i,r){const o=zr(t),a=zr(i);return o===void 0?a===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:o===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Ap.peek=hw;function Ap(t,i,r,o){const a=pw(r),c=r.enter("emphasis"),u=r.createTracker(o),d=u.move(a);let m=u.move(r.containerPhrasing(t,{after:a,before:d,...u.current()}));const h=m.charCodeAt(0),y=io(o.before.charCodeAt(o.before.length-1),h,a);y.inside&&(m=zi(h)+m.slice(1));const x=m.charCodeAt(m.length-1),v=io(o.after.charCodeAt(0),x,a);v.inside&&(m=m.slice(0,-1)+zi(x));const w=u.move(a);return c(),r.attentionEncodeSurroundingInfo={after:v.outside,before:y.outside},d+m+w}function hw(t,i,r){return r.options.emphasis||"*"}function mw(t,i){let r=!1;return Ja(t,function(o){if("value"in o&&/\r?\n|\r/.test(o.value)||o.type==="break")return r=!0,za}),!!((!t.depth||t.depth<3)&&Wa(t)&&(i.options.setext||r))}function gw(t,i,r,o){const a=Math.max(Math.min(6,t.depth||1),1),c=r.createTracker(o);if(mw(t,r)){const y=r.enter("headingSetext"),x=r.enter("phrasing"),v=r.containerPhrasing(t,{...c.current(),before:` `,after:` `});return x(),y(),v+` `+(a===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.lastIndexOf(` `))+1))}const u="#".repeat(a),d=r.enter("headingAtx"),m=r.enter("phrasing");c.move(u+" ");let h=r.containerPhrasing(t,{before:"# ",after:` `,...c.current()});return/^[\t ]/.test(h)&&(h=zi(h.charCodeAt(0))+h.slice(1)),h=h?u+" "+h:u,r.options.closeAtx&&(h+=" "+u),m(),d(),h}Op.peek=xw;function Op(t){return t.value||""}function xw(){return"<"}Fp.peek=yw;function Fp(t,i,r,o){const a=eu(r),c=a==='"'?"Quote":"Apostrophe",u=r.enter("image");let d=r.enter("label");const m=r.createTracker(o);let h=m.move("![");return h+=m.move(r.safe(t.alt,{before:h,after:"]",...m.current()})),h+=m.move("]("),d(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(d=r.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(r.safe(t.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(d=r.enter("destinationRaw"),h+=m.move(r.safe(t.url,{before:h,after:t.title?" ":")",...m.current()}))),d(),t.title&&(d=r.enter(`title${c}`),h+=m.move(" "+a),h+=m.move(r.safe(t.title,{before:h,after:a,...m.current()})),h+=m.move(a),d()),h+=m.move(")"),u(),h}function yw(){return"!"}$p.peek=vw;function $p(t,i,r,o){const a=t.referenceType,c=r.enter("imageReference");let u=r.enter("label");const d=r.createTracker(o);let m=d.move("![");const h=r.safe(t.alt,{before:m,after:"]",...d.current()});m+=d.move(h+"]["),u();const y=r.stack;r.stack=[],u=r.enter("reference");const x=r.safe(r.associationId(t),{before:m,after:"]",...d.current()});return u(),r.stack=y,c(),a==="full"||!h||h!==x?m+=d.move(x+"]"):a==="shortcut"?m=m.slice(0,-1):m+=d.move("]"),m}function vw(){return"!"}Bp.peek=kw;function Bp(t,i,r){let o=t.value||"",a="`",c=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(o);)a+="`";for(/[^ \r\n]/.test(o)&&(/^[ \r\n]/.test(o)&&/[ \r\n]$/.test(o)||/^`|`$/.test(o))&&(o=" "+o+" ");++c\u007F]/.test(t.url))}Vp.peek=ww;function Vp(t,i,r,o){const a=eu(r),c=a==='"'?"Quote":"Apostrophe",u=r.createTracker(o);let d,m;if(Up(t,r)){const y=r.stack;r.stack=[],d=r.enter("autolink");let x=u.move("<");return x+=u.move(r.containerPhrasing(t,{before:x,after:">",...u.current()})),x+=u.move(">"),d(),r.stack=y,x}d=r.enter("link"),m=r.enter("label");let h=u.move("[");return h+=u.move(r.containerPhrasing(t,{before:h,after:"](",...u.current()})),h+=u.move("]("),m(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(m=r.enter("destinationLiteral"),h+=u.move("<"),h+=u.move(r.safe(t.url,{before:h,after:">",...u.current()})),h+=u.move(">")):(m=r.enter("destinationRaw"),h+=u.move(r.safe(t.url,{before:h,after:t.title?" ":")",...u.current()}))),m(),t.title&&(m=r.enter(`title${c}`),h+=u.move(" "+a),h+=u.move(r.safe(t.title,{before:h,after:a,...u.current()})),h+=u.move(a),m()),h+=u.move(")"),d(),h}function ww(t,i,r){return Up(t,r)?"<":"["}Hp.peek=Sw;function Hp(t,i,r,o){const a=t.referenceType,c=r.enter("linkReference");let u=r.enter("label");const d=r.createTracker(o);let m=d.move("[");const h=r.containerPhrasing(t,{before:m,after:"]",...d.current()});m+=d.move(h+"]["),u();const y=r.stack;r.stack=[],u=r.enter("reference");const x=r.safe(r.associationId(t),{before:m,after:"]",...d.current()});return u(),r.stack=y,c(),a==="full"||!h||h!==x?m+=d.move(x+"]"):a==="shortcut"?m=m.slice(0,-1):m+=d.move("]"),m}function Sw(){return"["}function tu(t){const i=t.options.bullet||"*";if(i!=="*"&&i!=="+"&&i!=="-")throw new Error("Cannot serialize items with `"+i+"` for `options.bullet`, expected `*`, `+`, or `-`");return i}function bw(t){const i=tu(t),r=t.options.bulletOther;if(!r)return i==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===i)throw new Error("Expected `bullet` (`"+i+"`) and `bulletOther` (`"+r+"`) to be different");return r}function Cw(t){const i=t.options.bulletOrdered||".";if(i!=="."&&i!==")")throw new Error("Cannot serialize items with `"+i+"` for `options.bulletOrdered`, expected `.` or `)`");return i}function Wp(t){const i=t.options.rule||"*";if(i!=="*"&&i!=="-"&&i!=="_")throw new Error("Cannot serialize rules with `"+i+"` for `options.rule`, expected `*`, `-`, or `_`");return i}function jw(t,i,r,o){const a=r.enter("list"),c=r.bulletCurrent;let u=t.ordered?Cw(r):tu(r);const d=t.ordered?u==="."?")":".":bw(r);let m=i&&r.bulletLastUsed?u===r.bulletLastUsed:!1;if(!t.ordered){const y=t.children?t.children[0]:void 0;if((u==="*"||u==="-")&&y&&(!y.children||!y.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(m=!0),Wp(r)===u&&y){let x=-1;for(;++x-1?i.start:1)+(r.options.incrementListMarker===!1?0:i.children.indexOf(t))+c);let u=c.length+1;(a==="tab"||a==="mixed"&&(i&&i.type==="list"&&i.spread||t.spread))&&(u=Math.ceil(u/4)*4);const d=r.createTracker(o);d.move(c+" ".repeat(u-c.length)),d.shift(u);const m=r.enter("listItem"),h=r.indentLines(r.containerFlow(t,d.current()),y);return m(),h;function y(x,v,w){return v?(w?"":" ".repeat(u))+x:(w?c:c+" ".repeat(u-c.length))+x}}function _w(t,i,r,o){const a=r.enter("paragraph"),c=r.enter("phrasing"),u=r.containerPhrasing(t,o);return c(),a(),u}const Tw=ho(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Pw(t,i,r,o){return(t.children.some(function(u){return Tw(u)})?r.containerPhrasing:r.containerFlow).call(r,t,o)}function Iw(t){const i=t.options.strong||"*";if(i!=="*"&&i!=="_")throw new Error("Cannot serialize strong with `"+i+"` for `options.strong`, expected `*`, or `_`");return i}qp.peek=zw;function qp(t,i,r,o){const a=Iw(r),c=r.enter("strong"),u=r.createTracker(o),d=u.move(a+a);let m=u.move(r.containerPhrasing(t,{after:a,before:d,...u.current()}));const h=m.charCodeAt(0),y=io(o.before.charCodeAt(o.before.length-1),h,a);y.inside&&(m=zi(h)+m.slice(1));const x=m.charCodeAt(m.length-1),v=io(o.after.charCodeAt(0),x,a);v.inside&&(m=m.slice(0,-1)+zi(x));const w=u.move(a+a);return c(),r.attentionEncodeSurroundingInfo={after:v.outside,before:y.outside},d+m+w}function zw(t,i,r){return r.options.strong||"*"}function Lw(t,i,r,o){return r.safe(t.value,o)}function Rw(t){const i=t.options.ruleRepetition||3;if(i<3)throw new Error("Cannot serialize rules with repetition `"+i+"` for `options.ruleRepetition`, expected `3` or more");return i}function Mw(t,i,r){const o=(Wp(r)+(r.options.ruleSpaces?" ":"")).repeat(Rw(r));return r.options.ruleSpaces?o.slice(0,-1):o}const Qp={blockquote:iw,break:$d,code:cw,definition:dw,emphasis:Ap,hardBreak:$d,heading:gw,html:Op,image:Fp,imageReference:$p,inlineCode:Bp,link:Vp,linkReference:Hp,list:jw,listItem:Nw,paragraph:_w,root:Pw,strong:qp,text:Lw,thematicBreak:Mw};function Dw(){return{enter:{table:Aw,tableData:Bd,tableHeader:Bd,tableRow:Fw},exit:{codeText:$w,table:Ow,tableData:ba,tableHeader:ba,tableRow:ba}}}function Aw(t){const i=t._align;this.enter({type:"table",align:i.map(function(r){return r==="none"?null:r}),children:[]},t),this.data.inTable=!0}function Ow(t){this.exit(t),this.data.inTable=void 0}function Fw(t){this.enter({type:"tableRow",children:[]},t)}function ba(t){this.exit(t)}function Bd(t){this.enter({type:"tableCell",children:[]},t)}function $w(t){let i=this.resume();this.data.inTable&&(i=i.replace(/\\([\\|])/g,Bw));const r=this.stack[this.stack.length-1];r.type,r.value=i,this.exit(t)}function Bw(t,i){return i==="|"?i:t}function Uw(t){const i=t||{},r=i.tableCellPadding,o=i.tablePipeAlign,a=i.stringLength,c=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:v,table:u,tableCell:m,tableRow:d}};function u(w,E,L,j){return h(y(w,L,j),w.align)}function d(w,E,L,j){const T=x(w,L,j),O=h([T]);return O.slice(0,O.indexOf(` `))}function m(w,E,L,j){const T=L.enter("tableCell"),O=L.enter("phrasing"),A=L.containerPhrasing(w,{...j,before:c,after:c});return O(),T(),A}function h(w,E){return nw(w,{align:E,alignDelimiters:o,padding:r,stringLength:a})}function y(w,E,L){const j=w.children;let T=-1;const O=[],A=E.enter("table");for(;++T0&&!r&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const o0={tokenize:h0,partial:!0};function s0(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:f0,continuation:{tokenize:d0},exit:p0}},text:{91:{name:"gfmFootnoteCall",tokenize:c0},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:a0,resolveTo:u0}}}}function a0(t,i,r){const o=this;let a=o.events.length;const c=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]);let u;for(;a--;){const m=o.events[a][1];if(m.type==="labelImage"){u=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return d;function d(m){if(!u||!u._balanced)return r(m);const h=Vt(o.sliceSerialize({start:u.end,end:o.now()}));return h.codePointAt(0)!==94||!c.includes(h.slice(1))?r(m):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(m),t.exit("gfmFootnoteCallLabelMarker"),i(m))}}function u0(t,i){let r=t.length;for(;r--;)if(t[r][1].type==="labelImage"&&t[r][0]==="enter"){t[r][1];break}t[r+1][1].type="data",t[r+3][1].type="gfmFootnoteCallLabelMarker";const o={type:"gfmFootnoteCall",start:Object.assign({},t[r+3][1].start),end:Object.assign({},t[t.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},t[r+3][1].end),end:Object.assign({},t[r+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const c={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},t[t.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},d=[t[r+1],t[r+2],["enter",o,i],t[r+3],t[r+4],["enter",a,i],["exit",a,i],["enter",c,i],["enter",u,i],["exit",u,i],["exit",c,i],t[t.length-2],t[t.length-1],["exit",o,i]];return t.splice(r,t.length-r+1,...d),t}function c0(t,i,r){const o=this,a=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]);let c=0,u;return d;function d(x){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(x),t.exit("gfmFootnoteCallLabelMarker"),m}function m(x){return x!==94?r(x):(t.enter("gfmFootnoteCallMarker"),t.consume(x),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",h)}function h(x){if(c>999||x===93&&!u||x===null||x===91||Re(x))return r(x);if(x===93){t.exit("chunkString");const v=t.exit("gfmFootnoteCallString");return a.includes(Vt(o.sliceSerialize(v)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(x),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),i):r(x)}return Re(x)||(u=!0),c++,t.consume(x),x===92?y:h}function y(x){return x===91||x===92||x===93?(t.consume(x),c++,h):h(x)}}function f0(t,i,r){const o=this,a=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]);let c,u=0,d;return m;function m(E){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(E){return E===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",y):r(E)}function y(E){if(u>999||E===93&&!d||E===null||E===91||Re(E))return r(E);if(E===93){t.exit("chunkString");const L=t.exit("gfmFootnoteDefinitionLabelString");return c=Vt(o.sliceSerialize(L)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),v}return Re(E)||(d=!0),u++,t.consume(E),E===92?x:y}function x(E){return E===91||E===92||E===93?(t.consume(E),u++,y):y(E)}function v(E){return E===58?(t.enter("definitionMarker"),t.consume(E),t.exit("definitionMarker"),a.includes(c)||a.push(c),Ee(t,w,"gfmFootnoteDefinitionWhitespace")):r(E)}function w(E){return i(E)}}function d0(t,i,r){return t.check(Ri,i,t.attempt(o0,i,r))}function p0(t){t.exit("gfmFootnoteDefinition")}function h0(t,i,r){const o=this;return Ee(t,a,"gfmFootnoteDefinitionIndent",5);function a(c){const u=o.events[o.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?i(c):r(c)}}function m0(t){let r=(t||{}).singleTilde;const o={name:"strikethrough",tokenize:c,resolveAll:a};return r==null&&(r=!0),{text:{126:o},insideSpan:{null:[o]},attentionMarkers:{null:[126]}};function a(u,d){let m=-1;for(;++m1?m(E):(u.consume(E),x++,w);if(x<2&&!r)return m(E);const j=u.exit("strikethroughSequenceTemporary"),T=zr(E);return j._open=!T||T===2&&!!L,j._close=!L||L===2&&!!T,d(E)}}}class g0{constructor(){this.map=[]}add(i,r,o){x0(this,i,r,o)}consume(i){if(this.map.sort(function(c,u){return c[0]-u[0]}),this.map.length===0)return;let r=this.map.length;const o=[];for(;r>0;)r-=1,o.push(i.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),i.length=this.map[r][0];o.push(i.slice()),i.length=0;let a=o.pop();for(;a;){for(const c of a)i.push(c);a=o.pop()}this.map.length=0}}function x0(t,i,r,o){let a=0;if(!(r===0&&o.length===0)){for(;a-1;){const X=o.events[Y][1].type;if(X==="lineEnding"||X==="linePrefix")Y--;else break}const Z=Y>-1?o.events[Y][1].type:null,ve=Z==="tableHead"||Z==="tableRow"?D:m;return ve===D&&o.parser.lazy[o.now().line]?r(R):ve(R)}function m(R){return t.enter("tableHead"),t.enter("tableRow"),h(R)}function h(R){return R===124||(u=!0,c+=1),y(R)}function y(R){return R===null?r(R):pe(R)?c>1?(c=0,o.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),w):r(R):je(R)?Ee(t,y,"whitespace")(R):(c+=1,u&&(u=!1,a+=1),R===124?(t.enter("tableCellDivider"),t.consume(R),t.exit("tableCellDivider"),u=!0,y):(t.enter("data"),x(R)))}function x(R){return R===null||R===124||Re(R)?(t.exit("data"),y(R)):(t.consume(R),R===92?v:x)}function v(R){return R===92||R===124?(t.consume(R),x):x(R)}function w(R){return o.interrupt=!1,o.parser.lazy[o.now().line]?r(R):(t.enter("tableDelimiterRow"),u=!1,je(R)?Ee(t,E,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):E(R))}function E(R){return R===45||R===58?j(R):R===124?(u=!0,t.enter("tableCellDivider"),t.consume(R),t.exit("tableCellDivider"),L):le(R)}function L(R){return je(R)?Ee(t,j,"whitespace")(R):j(R)}function j(R){return R===58?(c+=1,u=!0,t.enter("tableDelimiterMarker"),t.consume(R),t.exit("tableDelimiterMarker"),T):R===45?(c+=1,T(R)):R===null||pe(R)?J(R):le(R)}function T(R){return R===45?(t.enter("tableDelimiterFiller"),O(R)):le(R)}function O(R){return R===45?(t.consume(R),O):R===58?(u=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(R),t.exit("tableDelimiterMarker"),A):(t.exit("tableDelimiterFiller"),A(R))}function A(R){return je(R)?Ee(t,J,"whitespace")(R):J(R)}function J(R){return R===124?E(R):R===null||pe(R)?!u||a!==c?le(R):(t.exit("tableDelimiterRow"),t.exit("tableHead"),i(R)):le(R)}function le(R){return r(R)}function D(R){return t.enter("tableRow"),ue(R)}function ue(R){return R===124?(t.enter("tableCellDivider"),t.consume(R),t.exit("tableCellDivider"),ue):R===null||pe(R)?(t.exit("tableRow"),i(R)):je(R)?Ee(t,ue,"whitespace")(R):(t.enter("data"),ce(R))}function ce(R){return R===null||R===124||Re(R)?(t.exit("data"),ue(R)):(t.consume(R),R===92?ge:ce)}function ge(R){return R===92||R===124?(t.consume(R),ce):ce(R)}}function w0(t,i){let r=-1,o=!0,a=0,c=[0,0,0,0],u=[0,0,0,0],d=!1,m=0,h,y,x;const v=new g0;for(;++rr[2]+1){const E=r[2]+1,L=r[3]-r[2]-1;t.add(E,L,[])}}t.add(r[3]+1,0,[["exit",x,i]])}return a!==void 0&&(c.end=Object.assign({},Ir(i.events,a)),t.add(a,0,[["exit",c,i]]),c=void 0),c}function Vd(t,i,r,o,a){const c=[],u=Ir(i.events,r);a&&(a.end=Object.assign({},u),c.push(["exit",a,i])),o.end=Object.assign({},u),c.push(["exit",o,i]),t.add(r+1,0,c)}function Ir(t,i){const r=t[i],o=r[0]==="enter"?"start":"end";return r[1][o]}const S0={name:"tasklistCheck",tokenize:C0};function b0(){return{text:{91:S0}}}function C0(t,i,r){const o=this;return a;function a(m){return o.previous!==null||!o._gfmTasklistFirstContentOfListItem?r(m):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(m),t.exit("taskListCheckMarker"),c)}function c(m){return Re(m)?(t.enter("taskListCheckValueUnchecked"),t.consume(m),t.exit("taskListCheckValueUnchecked"),u):m===88||m===120?(t.enter("taskListCheckValueChecked"),t.consume(m),t.exit("taskListCheckValueChecked"),u):r(m)}function u(m){return m===93?(t.enter("taskListCheckMarker"),t.consume(m),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),d):r(m)}function d(m){return pe(m)?i(m):je(m)?t.check({tokenize:j0},i,r)(m):r(m)}}function j0(t,i,r){return Ee(t,o,"whitespace");function o(a){return a===null?r(a):i(a)}}function E0(t){return dp([Xw(),s0(),m0(t),v0(),b0()])}const N0={};function _0(t){const i=this,r=t||N0,o=i.data(),a=o.micromarkExtensions||(o.micromarkExtensions=[]),c=o.fromMarkdownExtensions||(o.fromMarkdownExtensions=[]),u=o.toMarkdownExtensions||(o.toMarkdownExtensions=[]);a.push(E0(r)),c.push(Qw()),u.push(Gw(r))}function Hd(t){const i=document.createElement("textarea");i.value=t,i.setAttribute("readonly",""),i.style.position="fixed",i.style.left="-9999px",i.style.top="0",document.body.appendChild(i),i.select();const r=document.execCommand("copy");if(i.remove(),!r)throw new Error("copy failed")}function T0({lang:t,code:i}){const[r,o]=ne.useState(!1),[a,c]=ne.useState(!1),u=async()=>{var d;try{(d=navigator.clipboard)!=null&&d.writeText?await navigator.clipboard.writeText(i):Hd(i),o(!0),c(!1),setTimeout(()=>o(!1),1500)}catch{try{Hd(i),o(!0),c(!1),setTimeout(()=>o(!1),1500)}catch{c(!0),setTimeout(()=>c(!1),1800)}}};return g.jsxs("div",{className:"my-2 overflow-hidden border-[3px] border-line bg-card-deep shadow-hard-sm",style:{borderRadius:7},children:[g.jsxs("div",{className:"flex items-center justify-between border-b-2 border-chrome-2 px-3 py-1.5",children:[g.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wide text-on-dark-2",children:t||"code"}),g.jsxs("button",{type:"button",onClick:u,className:"flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[11px] text-on-dark-2 transition-colors hover:text-white",children:[r?g.jsx(mg,{size:13}):g.jsx(hg,{size:13}),a?"Erreur":r?"Copié":"Copier"]})]}),g.jsx("pre",{className:"scr m-0 overflow-auto p-3 font-mono text-[12px] leading-relaxed text-on-dark",children:g.jsx("code",{children:i})})]})}const P0={pre:({children:t})=>g.jsx(g.Fragment,{children:t}),code({className:t,children:i}){const r=String(i).replace(/\n$/,""),o=/language-(\w+)/.exec(t||"");return o||r.includes(` `)?g.jsx(T0,{lang:(o==null?void 0:o[1])??"",code:r}):g.jsx("code",{className:"rounded bg-sunken px-1 py-0.5 font-mono text-[12px] text-accent-1",children:i})},h1:({children:t})=>g.jsx("h1",{className:"mb-2 mt-3 text-[17px] font-bold text-ink first:mt-0",children:t}),h2:({children:t})=>g.jsx("h2",{className:"mb-2 mt-3 text-[15px] font-bold text-ink first:mt-0",children:t}),h3:({children:t})=>g.jsx("h3",{className:"mb-1.5 mt-2.5 text-[13.5px] font-bold text-ink first:mt-0",children:t}),p:({children:t})=>g.jsx("p",{className:"my-2 first:mt-0 last:mb-0",children:t}),ul:({children:t})=>g.jsx("ul",{className:"my-2 list-disc space-y-1 pl-5 marker:text-muted-3",children:t}),ol:({children:t})=>g.jsx("ol",{className:"my-2 list-decimal space-y-1 pl-5 marker:text-muted-3",children:t}),li:({children:t})=>g.jsx("li",{className:"leading-relaxed",children:t}),a:({href:t,children:i})=>g.jsx("a",{href:t,target:"_blank",rel:"noreferrer",className:"text-accent underline decoration-accent/40 underline-offset-2 hover:decoration-accent",children:i}),strong:({children:t})=>g.jsx("strong",{className:"font-semibold text-ink",children:t}),em:({children:t})=>g.jsx("em",{className:"italic",children:t}),blockquote:({children:t})=>g.jsx("blockquote",{className:"my-2 border-l-2 border-line-strong pl-3 text-muted",children:t}),hr:()=>g.jsx("hr",{className:"my-3 border-line-soft"}),table:({children:t})=>g.jsx("div",{className:"my-2 overflow-x-auto",children:g.jsx("table",{className:"w-full border-collapse text-[12.5px]",children:t})}),th:({children:t})=>g.jsx("th",{className:"border border-line-strong bg-card-deep px-2.5 py-1.5 text-left font-semibold text-ink-2",children:t}),td:({children:t})=>g.jsx("td",{className:"border border-line-soft px-2.5 py-1.5",children:t})};function I0({text:t}){return g.jsx(mk,{remarkPlugins:[_0],components:P0,children:t})}function z0(){const{projects:t,refreshProjects:i,currentProject:r,setProject:o}=Qe(),[a,c]=ne.useState(!1),[u,d]=ne.useState(!1),[m,h]=ne.useState(""),[y,x]=ne.useState(null),v=ne.useRef(null),w=r();ne.useEffect(()=>{a&&i()},[a,i]),ne.useEffect(()=>{if(!a)return;const j=T=>{v.current&&!v.current.contains(T.target)&&(c(!1),d(!1),x(null))};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[a]);const E=async j=>{c(!1),await o(j)},L=async()=>{const j=m.trim();if(j)try{await qg(j),d(!1),h(""),await E(j)}catch(T){x(T instanceof Error?T.message:"création impossible")}};return g.jsxs("div",{ref:v,className:"relative",children:[g.jsxs("button",{onClick:()=>c(j=>!j),className:"flex h-8 items-center gap-1.5 border-2 border-line bg-base px-2.5 text-[12px] text-ink-2",title:"Projet de travail de cette session",children:["📁 ",g.jsx("span",{className:"max-w-[140px] truncate",children:w??"workspace"})]}),a&&g.jsxs("div",{className:"absolute bottom-[calc(100%+6px)] left-0 z-30 w-[240px] border-[3px] border-line bg-card shadow-hard",style:{borderRadius:7},children:[g.jsx("button",{onClick:()=>E(null),className:`block w-full px-3 py-2 text-left text-[13px] text-ink-2 hover:bg-base ${w===null?"bg-base font-bold":""}`,children:"workspace (racine)"}),t.map(j=>g.jsxs("button",{onClick:()=>E(j.name),className:`block w-full border-t-2 border-line-soft px-3 py-2 text-left text-[13px] text-ink-2 hover:bg-base ${w===j.name?"bg-base font-bold":""}`,children:["📁 ",j.name,g.jsxs("span",{className:"ml-1.5 text-[11px] text-muted-2",children:[j.files," fichier",j.files>1?"s":""]})]},j.name)),g.jsxs("div",{className:"border-t-2 border-line-soft p-2",children:[u?g.jsx("input",{autoFocus:!0,value:m,onChange:j=>h(j.target.value),onKeyDown:j=>{j.key==="Enter"&&L(),j.key==="Escape"&&(d(!1),x(null))},placeholder:"nom-du-projet",className:"w-full border-2 border-line bg-base px-2 py-1 text-[12px] text-ink outline-none"}):g.jsx("button",{onClick:()=>d(!0),className:"w-full text-left text-[13px] font-bold text-accent",children:"+ Nouveau projet"}),y&&g.jsx("div",{className:"mt-1 text-[11px] text-warn",children:y})]})]})]})}function L0({variant:t="top"}){const{models:i,selectedModel:r,setSelectedModel:o,loadedModels:a,warmingModel:c,warmError:u}=Qe(),[d,m]=ne.useState(!1),h=ne.useRef(null),y=v=>a.find(w=>w.name===v),x=y(r);return ne.useEffect(()=>{const v=w=>{h.current&&!h.current.contains(w.target)&&m(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[]),g.jsxs("div",{className:"relative",ref:h,children:[g.jsxs("button",{onClick:()=>m(v=>!v),className:t==="composer"?"flex h-8 min-w-0 max-w-[220px] items-center gap-1.5 border-2 border-line bg-accent px-2.5 text-[13px] text-white":"flex h-[34px] min-w-0 max-w-[260px] items-center gap-2 border-[3px] border-white bg-accent px-3 text-white shadow-accent-soft",title:r||void 0,style:{borderRadius:7},children:[g.jsx("span",{className:`h-2.5 w-2.5 border-2 border-line ${c===r?"bg-accent animate-pulse":x?x.on_gpu?"bg-ok":"bg-warn":"bg-white"}`,title:u||(c===r?"préchargement en cours…":x?x.on_gpu?"chargé sur GPU":`chargé (${x.gpu_percent}% GPU)`:"à charger")}),g.jsx("span",{className:"min-w-0 truncate text-[14px] leading-none",children:r||"—"}),g.jsx(oo,{size:12,className:"flex-none"})]}),d&&g.jsxs("div",{className:`absolute z-20 w-64 border-[3px] border-line bg-card p-1 shadow-hard ${t==="composer"?"bottom-[calc(100%+6px)] left-0":"right-0 top-11"}`,children:[i.length===0&&g.jsx("div",{className:"px-3 py-2 text-xs text-muted-2",children:"Aucun modèle installé"}),i.map(v=>g.jsxs("button",{onClick:()=>{o(v.name),m(!1)},className:`flex w-full items-center gap-2 px-2 py-2 text-left hover:bg-base ${v.name===r?"bg-base":""}`,children:[g.jsx("span",{className:`h-2 w-2 border-2 border-line ${v.name===r?"bg-accent":"bg-card"}`}),g.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-ink-2",title:v.name,children:v.name}),y(v.name)&&g.jsx("span",{className:`h-1.5 w-1.5 border border-line ${y(v.name).on_gpu?"bg-ok":"bg-warn"}`,title:y(v.name).on_gpu?"chargé GPU":"chargé CPU"}),v.size_go>0&&g.jsxs("span",{className:"text-[10px] text-muted-2",children:[v.size_go," Go"]})]},v.name))]})]})}function R0(){const{selectedModel:t,messages:i,streaming:r,streamingSessionId:o,streamContent:a,streamThinking:c,streamStatus:u,streamNotice:d,streamTools:m,streamPlan:h,sendMessage:y,currentSessionId:x,config:v,pendingShell:w,approveShell:E,rejectShell:L,sessions:j,stopStreaming:T}=Qe(),O=v?Object.values(v.tools).filter(Boolean).length:0,[A,J]=ne.useState(""),le=ne.useRef(null);ne.useEffect(()=>{var Y;(Y=le.current)==null||Y.scrollTo({top:le.current.scrollHeight})},[i,a,c,m,h]);const D=()=>{!A.trim()||r||(y(A),J(""))},ue=Y=>{Y.key==="Enter"&&!Y.shiftKey&&(Y.preventDefault(),D())},ce=r&&x===o,ge=j.find(Y=>Y.id===o),R=i.length===0&&!ce;return g.jsxs("div",{className:"flex min-w-0 flex-1 flex-col bg-base",children:[g.jsxs("div",{className:"flex h-[46px] flex-none items-center gap-2 border-b-[3px] border-line bg-panel px-4",children:[g.jsx(ja,{children:"⚑ Invite système"}),g.jsxs(ja,{children:[g.jsx("span",{className:"h-2 w-2 border-2 border-line bg-ok"}),O," outil",O>1?"s":""]}),g.jsxs(ja,{children:["Temp"," ",g.jsx("b",{className:"text-accent",children:v?v.temperature.toFixed(1):"—"})]}),g.jsx("div",{className:"flex-1"}),g.jsx("span",{className:"text-[13px] text-muted-3",children:x?`${i.length} message${i.length>1?"s":""}`:"aucune session"})]}),g.jsx("div",{ref:le,className:"scr flex-1 overflow-auto px-7 py-6",children:R?g.jsxs("div",{className:"mx-auto flex max-w-[680px] flex-col items-center justify-center gap-4 pt-24 text-center",children:[g.jsx(Kd,{size:48}),g.jsx("div",{className:"font-pixel text-[15px] text-ink",children:"PRÊT À TRAVAILLER"}),g.jsx("div",{className:"max-w-[380px] text-[14px] leading-relaxed text-muted",children:"Décris une tâche à l'agent. Outils fichiers et aperçu en direct disponibles."})]}):g.jsxs("div",{className:"mx-auto flex max-w-[680px] flex-col gap-5",children:[i.map(Y=>g.jsx(Wd,{msg:Y},Y.id)),ce&&g.jsx(Wd,{msg:{id:"stream",session_id:"",role:"assistant",content:a,model:t,meta:{tools:m,plan:h},created_at:Date.now()/1e3},pending:!0,pendingStatus:u,notice:d,thinking:c}),ce&&w&&g.jsx(O0,{command:w,onApprove:E,onReject:L})]})}),g.jsx("div",{className:"flex-none border-t-[3px] border-line bg-panel px-7 pb-[18px] pt-3.5",children:g.jsx("div",{className:"mx-auto max-w-[680px]",children:g.jsxs("div",{className:"border-[3px] border-line bg-card p-3 shadow-hard",style:{borderRadius:8},children:[g.jsx("textarea",{rows:1,value:A,onChange:Y=>J(Y.target.value),onKeyDown:ue,placeholder:"Envoyer un message à l'agent…",className:"min-h-[40px] w-full resize-none bg-transparent text-[14px] leading-relaxed text-ink outline-none placeholder:text-muted-3"}),g.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[g.jsx(M0,{}),g.jsx(z0,{}),g.jsx(L0,{variant:"composer"}),r&&!ce?g.jsxs("span",{className:"min-w-0 flex-1 truncate text-[13px] text-accent",children:["Travail en cours : ",(ge==null?void 0:ge.title)??"session ouverte"]}):g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"flex-1"}),g.jsx("span",{className:"text-[13px] text-muted-3",children:"⏎ envoyer · ⇧⏎ ligne"})]}),g.jsxs("button",{onClick:r?T:D,disabled:!r&&!A.trim(),className:`flex h-[38px] items-center gap-1.5 border-[3px] border-line px-4 text-[14px] text-white shadow-hard-accent disabled:opacity-40 ${r?"bg-warn":"bg-card-deep"}`,style:{borderRadius:7},children:[r?"ARRÊTER":"ENVOYER",!r&&g.jsx(pg,{})]})]})]})})})]})}const Ca=[{id:"plan",label:"Plan",icon:"🔍",desc:"Lecture seule : analyse et propose, sans rien modifier"},{id:"build",label:"Build",icon:"🔨",desc:"Normal : écrit les fichiers, confirme les commandes shell"},{id:"yolo",label:"Yolo",icon:"⚡",desc:"Auto : approuve tout, y compris le shell"}];function M0(){const{mode:t,setMode:i}=Qe(),[r,o]=ne.useState(!1),a=ne.useRef(null);ne.useEffect(()=>{const u=d=>{a.current&&!a.current.contains(d.target)&&o(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[]);const c=Ca.find(u=>u.id===t)??Ca[1];return g.jsxs("div",{className:"relative",ref:a,children:[g.jsxs("button",{onClick:()=>o(u=>!u),className:`flex h-8 items-center gap-1.5 border-2 border-line px-2.5 text-[13px] ${t==="plan"?"bg-info text-white":t==="yolo"?"bg-accent text-white":"bg-card text-ink-2"}`,title:c.desc,children:[g.jsx("span",{children:c.icon}),g.jsx("span",{children:c.label}),g.jsx(oo,{size:11})]}),r&&g.jsx("div",{className:"absolute bottom-10 left-0 z-20 w-64 border-[3px] border-line bg-card p-1 shadow-hard",children:Ca.map(u=>g.jsxs("button",{onClick:()=>{i(u.id),o(!1)},className:`flex w-full flex-col items-start gap-0.5 px-2 py-2 text-left hover:bg-base ${u.id===t?"bg-base":""}`,children:[g.jsxs("span",{className:"text-[13px] text-ink",children:[u.icon," ",u.label]}),g.jsx("span",{className:"text-[11px] leading-tight text-muted-2",children:u.desc})]},u.id))})]})}function D0({steps:t}){return g.jsxs("div",{className:"mb-[11px] overflow-hidden border-[3px] border-line bg-card shadow-hard-sm",style:{borderRadius:7},children:[g.jsxs("div",{className:"flex items-center gap-2 border-b-2 border-line-soft px-3 py-2",children:[g.jsx("span",{className:"font-pixel text-[9px] text-accent",children:"PLAN"}),g.jsxs("span",{className:"text-[12px] text-muted-2",children:[t.length," étape",t.length>1?"s":""]})]}),g.jsx("ol",{className:"m-0 list-none px-3 py-2",children:t.map((i,r)=>g.jsxs("li",{className:"flex gap-2 py-[3px] text-[13px] text-ink-2",children:[g.jsx("span",{className:"flex h-[18px] w-[18px] flex-none items-center justify-center border-2 border-line bg-base text-[11px] text-ink",children:r+1}),g.jsx("span",{className:"min-w-0",children:i})]},r))})]})}function Wd({msg:t,pending:i,pendingStatus:r,notice:o,thinking:a}){var u,d,m,h,y;const c=new Date(t.created_at*1e3).toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"});return t.role==="user"?g.jsxs("div",{className:"flex gap-3",children:[g.jsx("div",{className:"font-pixel flex h-[34px] w-[34px] flex-none items-center justify-center border-[3px] border-line bg-card-deep text-[11px] text-white",children:"M"}),g.jsxs("div",{className:"flex-1",children:[g.jsxs("div",{className:"mb-1.5 flex items-baseline gap-2",children:[g.jsx("span",{className:"text-[14px] text-ink",children:"VOUS"}),g.jsx("span",{className:"text-[13px] text-muted-3",children:c})]}),g.jsx("div",{className:"border-[3px] border-line bg-card px-[14px] py-3 text-[14px] leading-snug text-ink shadow-hard-sm whitespace-pre-wrap",style:{borderRadius:7},children:t.content})]})]}):g.jsxs("div",{className:"flex gap-3",children:[g.jsx("div",{className:"flex h-[34px] w-[34px] flex-none items-center justify-center border-[3px] border-line bg-accent",children:g.jsx("div",{style:{width:10,height:10,background:"#fff"}})}),g.jsxs("div",{className:"min-w-0 flex-1",children:[g.jsxs("div",{className:"mb-2 flex items-baseline gap-2",children:[g.jsx("span",{className:"text-[14px] text-ink",children:"LOKI"}),g.jsxs("span",{className:"text-[13px] text-muted-3",children:[t.model?`${t.model} · `:"",c]})]}),g.jsx(A0,{text:a??((u=t.meta)==null?void 0:u.thinking)??"",live:!!i}),(((m=(d=t.meta)==null?void 0:d.plan)==null?void 0:m.length)??0)>0&&g.jsx(D0,{steps:t.meta.plan}),(((h=t.meta)==null?void 0:h.tools)??[]).map((x,v)=>g.jsx(nx,{call:x},v)),o&&g.jsx("div",{className:"mb-2 border-[3px] border-line bg-card px-3 py-2 text-[13px] text-warn",children:o}),(t.content||i)&&g.jsxs("div",{className:"text-[14px] leading-[1.5] text-ink-2",children:[t.content?g.jsx(I0,{text:t.content}):g.jsx("span",{className:"text-muted-2",children:r||"Génération…"}),i&&g.jsx("span",{className:"ml-0.5 inline-block h-3.5 w-[7px] animate-pulse bg-accent align-middle"})]}),!i&&((y=t.meta)==null?void 0:y.stats)&&g.jsxs("div",{className:"mt-2 flex items-center gap-2.5 text-[12px] text-muted-3",children:[t.meta.stats.tokens_per_sec!=null&&g.jsxs("span",{className:"text-accent-2",children:[t.meta.stats.tokens_per_sec," tok/s"]}),g.jsxs("span",{children:[t.meta.stats.eval_count," jetons"]}),t.meta.stats.prompt_eval_count>0&&g.jsxs("span",{children:["· ",t.meta.stats.prompt_eval_count," en entrée"]})]})]})]})}function A0({text:t,live:i}){const[r,o]=ne.useState(i),a=ne.useRef(null);return ne.useEffect(()=>{i&&o(!0)},[i]),ne.useEffect(()=>{var c;r&&i&&((c=a.current)==null||c.scrollTo({top:a.current.scrollHeight}))},[t,r,i]),t?g.jsxs("div",{className:"mb-[11px] overflow-hidden border-[3px] border-line bg-card shadow-hard-sm",style:{borderRadius:7},children:[g.jsxs("button",{onClick:()=>o(c=>!c),className:"flex w-full items-center gap-2 px-3 py-2 text-left",children:[g.jsx(oo,{size:12,className:`text-ink-2 transition-transform ${r?"":"-rotate-90"}`}),g.jsx("span",{className:"text-[13px] font-medium text-ink",children:"Raisonnement"}),i&&g.jsxs("span",{className:"flex items-center gap-1 text-[12px] text-accent",children:[g.jsx("span",{className:"h-2 w-2 animate-pulse border-2 border-line bg-accent"}),"en cours…"]}),g.jsx("span",{className:"ml-auto text-[12px] text-muted-3",children:r?"réduire":"afficher"})]}),r&&g.jsx("div",{ref:a,className:"scr max-h-[200px] min-h-[60px] resize-y overflow-auto whitespace-pre-wrap border-t-2 border-line-soft bg-card-deep px-3 py-2 text-[12.5px] leading-relaxed text-on-dark-2",children:t})]}):null}function O0({command:t,onApprove:i,onReject:r}){return g.jsxs("div",{className:"ml-[46px] overflow-hidden border-[3px] border-line bg-card shadow-hard",style:{borderRadius:7},children:[g.jsxs("div",{className:"flex items-center gap-2 border-b-2 border-line px-3 py-2.5",children:[g.jsx("span",{className:"text-[14px] text-accent",children:"run_shell"}),g.jsx("span",{className:"text-[13px] text-muted-2",children:"· commande sensible à valider"})]}),g.jsxs("div",{className:"px-3 py-3",children:[g.jsxs("pre",{className:"m-0 mb-3 overflow-auto whitespace-pre-wrap border-2 border-line bg-card-deep px-3 py-2.5 text-[12.5px] text-on-dark",children:["$ ",t]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("button",{onClick:i,className:"flex h-[32px] items-center gap-1.5 border-[3px] border-line bg-card-deep px-3.5 text-[13px] text-white shadow-hard-accent",style:{borderRadius:7},children:"Approuver & exécuter"}),g.jsx("button",{onClick:r,className:"flex h-[32px] items-center border-[3px] border-line bg-card px-3.5 text-[13px] text-ink-2",style:{borderRadius:7},children:"Refuser"})]})]})]})}function ja({children:t}){return g.jsx("div",{className:"flex h-7 items-center gap-1.5 border-2 border-line bg-card px-2.5 text-[13px] text-ink-2",children:t})}function qd(){const{previewPath:t,previewContent:i,messages:r,streamTools:o,removeFile:a}=Qe(),[c,u]=ne.useState("preview"),[d,m]=ne.useState(()=>{const j=Number(window.localStorage.getItem("loki.preview.width"));return Number.isFinite(j)&&j>=300?j:452}),h=j=>{const T=Math.max(300,Math.min(j,window.innerWidth-520));m(T),window.localStorage.setItem("loki.preview.width",String(T))},y=j=>{j.preventDefault();const T=j.clientX,O=d,A=le=>h(O+T-le.clientX),J=()=>{window.removeEventListener("pointermove",A),window.removeEventListener("pointerup",J)};window.addEventListener("pointermove",A),window.addEventListener("pointerup",J)},x=t?/\.html?$/.test(t):!1,[v,w]=ne.useState(()=>window.localStorage.getItem("loki.preview.collapsed")==="1"),E=()=>{w(j=>(window.localStorage.setItem("loki.preview.collapsed",j?"0":"1"),!j))},L=[...r.flatMap(j=>{var T;return((T=j.meta)==null?void 0:T.tools)??[]}),...o];return v?g.jsxs("div",{className:"flex w-9 flex-none flex-col items-center border-l-[3px] border-line bg-panel pt-3",children:[g.jsx("button",{onClick:E,title:"Déplier l'aperçu",className:"text-[15px] text-muted-2 hover:text-accent",children:"⇤"}),g.jsx("div",{className:"mt-3 rotate-90 whitespace-nowrap text-[10px] font-bold tracking-wide text-muted-3",children:"APERÇU"})]}):g.jsxs("div",{className:"relative flex flex-none flex-col border-l-[3px] border-line bg-panel",style:{width:d},children:[g.jsx("div",{role:"separator","aria-label":"Redimensionner le panneau d'aperçu","aria-orientation":"vertical",tabIndex:0,onPointerDown:y,onKeyDown:j=>{j.key==="ArrowLeft"&&h(d+20),j.key==="ArrowRight"&&h(d-20)},className:"absolute -left-[6px] top-0 z-20 h-full w-[9px] cursor-col-resize bg-transparent hover:bg-accent/50 focus:bg-accent/50 focus:outline-none",title:"Glisser pour redimensionner"}),g.jsxs("div",{className:"flex h-[46px] flex-none items-center gap-1.5 border-b-[3px] border-line bg-base px-3",children:[g.jsx(Zl,{active:c==="preview",onClick:()=>u("preview"),children:"Aperçu"}),g.jsx(Zl,{active:c==="code",onClick:()=>u("code"),children:"Code"}),g.jsxs(Zl,{active:c==="logs",onClick:()=>u("logs"),children:["Logs",g.jsx("span",{className:"font-pixel ml-1.5 border-2 border-line bg-accent px-1 py-0.5 text-[8px] text-white",children:L.length})]}),g.jsx(Zl,{active:c==="git",onClick:()=>u("git"),children:"Git"}),g.jsx("div",{className:"flex-1"}),g.jsx("button",{onClick:E,title:"Replier l'aperçu",className:"px-2 text-[15px] text-muted-2 hover:text-accent",children:"⇥"})]}),g.jsxs("div",{className:"flex flex-none items-center gap-2 px-3 py-2.5",children:[g.jsxs("div",{className:"flex h-8 flex-1 items-center gap-2 border-[3px] border-line bg-card px-[11px]",children:[g.jsx("span",{className:"text-[13px]",children:"🔒"}),g.jsx("span",{className:"truncate text-[13px] text-muted-2",children:t?`workspace/${t}`:"workspace/"})]}),t&&g.jsxs(g.Fragment,{children:[g.jsxs("button",{onClick:()=>Oa(t,Qe.getState().currentProject()),className:"flex h-8 items-center gap-1.5 border-[3px] border-line bg-card px-2.5 text-[12px] text-accent",title:`Télécharger ${t}`,children:[g.jsx(so,{size:13}),"Télécharger"]}),g.jsxs("button",{onClick:()=>{window.confirm(`Supprimer ${t} ?`)&&a(t)},className:"flex h-8 items-center gap-1.5 border-[3px] border-line bg-card px-2.5 text-[12px] text-warn",title:`Supprimer ${t}`,children:[g.jsx(ao,{size:13}),"Supprimer"]})]})]}),c==="git"?g.jsx(F0,{}):c==="logs"?g.jsx("div",{className:"scr mx-3 mb-3 flex-1 overflow-auto border-[3px] border-line bg-card-deep p-3 text-[12.5px]",children:L.length===0?g.jsx("div",{className:"py-10 text-center text-on-dark-3",children:"Aucune activité d'outil pour cette session."}):L.map((j,T)=>{var O,A,J;return g.jsxs("div",{className:"flex items-center gap-2 border-b-2 border-chrome-2 py-[7px] last:border-0",children:[g.jsx("span",{className:j.status==="error"||j.status==="pending"?"text-accent":j.status==="running"?"text-on-dark-2":"text-ok",children:j.status==="error"?"✕":j.status==="pending"?"⏸":j.status==="running"?"…":"✓"}),g.jsx("span",{className:"text-on-dark",children:j.name}),g.jsx("span",{className:"flex-1 truncate text-on-dark-3",children:((O=j.args)==null?void 0:O.path)??((A=j.args)==null?void 0:A.query)??((J=j.args)==null?void 0:J.command)??""}),g.jsx("span",{className:"text-on-dark-3",children:j.summary})]},T)})}):g.jsx("div",{className:"scr mx-3 mb-3 flex-1 overflow-auto border-[3px] border-line bg-[#faf6ef] shadow-hard",children:t?c==="code"?g.jsx("pre",{className:"m-0 whitespace-pre-wrap p-4 text-[12px] leading-relaxed text-[#2a2018]",children:i}):x?g.jsx("iframe",{title:"aperçu",srcDoc:i,className:"h-full w-full border-0 bg-white",sandbox:"allow-scripts"}):g.jsx("pre",{className:"m-0 whitespace-pre-wrap p-4 text-[12px] leading-relaxed text-[#2a2018]",children:i}):g.jsx(B0,{children:"L'aperçu s'affichera ici dès que l'agent générera un fichier (clique aussi un fichier à gauche)."})})]})}function F0(){const t=Qe(j=>j.refreshFiles),r=Qe(j=>j.currentProject)(),[o,a]=ne.useState([]),[c,u]=ne.useState(null),[d,m]=ne.useState(""),[h,y]=ne.useState(null),[x,v]=ne.useState(null),w=()=>Cg(r).then(a).catch(()=>{});ne.useEffect(()=>{w()},[r]);const E=async j=>{u(j),m("Chargement…"),m(await jg(j,r)||"(diff vide)")},L=async j=>{if(window.confirm(`Annuler le commit ${j.slice(0,7)} ? (crée un commit inverse)`)){y(j),v(null);try{await Eg(j,r),await w(),await t(),c===j&&u(null)}catch(T){v(T instanceof Error?T.message:"revert impossible")}finally{y(null)}}};return g.jsxs("div",{className:"scr mx-3 mb-3 flex flex-1 flex-col overflow-hidden border-[3px] border-line bg-card",children:[x&&g.jsx("div",{className:"border-b-2 border-line bg-warn/10 px-3 py-2 text-[12px] text-warn",children:x}),g.jsx("div",{className:"scr max-h-[45%] overflow-auto border-b-2 border-line",children:o.length===0?g.jsx("div",{className:"p-4 text-center text-[12px] text-muted-2",children:"Aucun commit. L'agent commitera chaque modification de code ici."}):o.map(j=>g.jsxs("div",{className:`flex items-center gap-2 border-b border-line-soft px-3 py-2 last:border-0 ${c===j.hash?"bg-base":""}`,children:[g.jsxs("button",{onClick:()=>E(j.hash),className:"min-w-0 flex-1 text-left",title:j.subject,children:[g.jsx("div",{className:"truncate text-[13px] text-ink",children:j.subject}),g.jsxs("div",{className:"text-[11px] text-muted-2",children:[j.hash," · ",j.when," · ",j.files_changed," fichier",j.files_changed>1?"s":""]})]}),g.jsx("button",{onClick:()=>L(j.hash),disabled:h===j.hash,className:"flex-none border-2 border-line bg-card px-2 py-1 text-[11px] text-warn disabled:opacity-40",title:"Annuler ce commit (revert)",children:h===j.hash?"…":"↶ Annuler"})]},j.full_hash))}),g.jsx("div",{className:"scr flex-1 overflow-auto bg-card-deep p-3",children:c?g.jsx($0,{diff:d}):g.jsx("div",{className:"py-8 text-center text-[12px] text-on-dark-3",children:"Clique un commit pour voir ses modifications."})})]})}function $0({diff:t}){return g.jsx("pre",{className:"m-0 whitespace-pre-wrap text-[11.5px] leading-relaxed",children:t.split(` `).map((i,r)=>{let o="text-on-dark-2";return i.startsWith("+")&&!i.startsWith("+++")?o="text-ok":i.startsWith("-")&&!i.startsWith("---")?o="text-accent":i.startsWith("@@")?o="text-info":/^(commit|Author|Date|diff|index)/.test(i)&&(o="text-on-dark-3"),g.jsx("div",{className:o,children:i||" "},r)})})}function B0({children:t}){return g.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-8 text-center",children:[g.jsx("div",{className:"font-pixel text-[10px] text-[#a98b63]",children:"AUCUN APERÇU"}),g.jsx("div",{className:"max-w-[240px] text-[13px] text-[#8a7a66]",children:t})]})}function Zl({children:t,active:i,onClick:r}){return g.jsx("button",{onClick:r,className:`flex h-[30px] items-center border-[3px] border-line px-[13px] text-[13px] ${i?"bg-card-deep text-white":"bg-card text-muted"}`,children:t})}const U0={read_file:"Lire un fichier du projet",write_file:"Créer / modifier un fichier",edit_file:"Modification chirurgicale (recherche/remplacement)",list_dir:"Lister un répertoire",grep_search:"Chercher dans les fichiers",code_task:"Moteur code (multi-fichiers, git)",web_search:"Recherche web",run_shell:"Exécuter une commande"},V0=new Set(["run_shell"]);function H0(){const{models:t,selectedModel:i,setSelectedModel:r,refreshModels:o,loadedModels:a,warmingModel:c,warmError:u,status:d,config:m,availableTools:h,refreshConfig:y,updateConfig:x}=Qe(),[v,w]=ne.useState(m),[E,L]=ne.useState(!1);ne.useEffect(()=>{y()},[y,i]),ne.useEffect(()=>{m&&w(m)},[m]);const[j,T]=ne.useState(""),[O,A]=ne.useState(null),[J,le]=ne.useState(0),[D,ue]=ne.useState(null),[ce,ge]=ne.useState(null),R=async $=>{if(window.confirm(`Supprimer définitivement le modèle ${$} ?`)){ue($),ge(null);try{await Lg($),await o()}catch(se){ge(se instanceof Error?se.message:"suppression impossible")}finally{ue(null)}}},Y=async()=>{if(j.trim()){A("démarrage…"),le(0);try{await Jg(j.trim(),($,se)=>{A($),se&&le(se)}),A("terminé"),await o()}catch{A("échec")}}},Z=v&&m&&JSON.stringify(v)!==JSON.stringify(m),ve=async()=>{v&&(await x(v),L(!0),setTimeout(()=>L(!1),2e3))},X=($,se)=>w(U=>U&&{...U,[$]:se}),G=v?Object.values(v.tools).filter(Boolean).length:0;return g.jsx("div",{className:"scr flex-1 overflow-auto bg-base px-[30px] py-[26px]",children:g.jsxs("div",{className:"mx-auto max-w-[1000px]",children:[g.jsxs("div",{className:"mb-[22px] flex items-end justify-between",children:[g.jsxs("div",{children:[g.jsx("div",{className:"font-pixel text-[13px] text-ink",children:"MODÈLE & GÉNÉRATION"}),g.jsx("div",{className:"mt-2 text-[14px] text-muted-2",children:"Choisis le modèle local et règle son comportement. Les changements sont sauvegardés pour le modèle sélectionné."})]}),g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsxs("div",{className:"flex items-center gap-1.5 text-[13px] text-ok",children:[g.jsx("span",{className:"h-2 w-2 border-2 border-line bg-ok"}),d!=null&&d.connected?"Ollama connecté":"Ollama déconnecté"]}),g.jsx("button",{onClick:ve,disabled:!Z,className:"flex h-[34px] items-center gap-1.5 border-[3px] border-line bg-accent px-4 text-[14px] text-white shadow-accent-soft disabled:opacity-40",style:{borderRadius:7},children:E?"✓ ENREGISTRÉ":Z?"ENREGISTRER":"À JOUR"})]})]}),v?g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"grid grid-cols-2 items-start gap-[18px]",children:[g.jsxs(Mn,{children:[g.jsxs("div",{className:"mb-3.5 flex items-center justify-between",children:[g.jsx("div",{className:"font-pixel text-[11px] text-ink",children:"MODÈLE OLLAMA"}),g.jsxs("button",{onClick:o,className:"flex h-7 items-center gap-1.5 border-2 border-line bg-card-soft px-2.5 text-[13px] text-muted-2",children:[g.jsx(Gd,{size:12}),"Actualiser"]})]}),g.jsxs("div",{className:"flex flex-col gap-2",children:[t.length===0&&g.jsx("div",{className:"border-2 border-line bg-base p-4 text-center text-[13px] text-muted-2",children:"Aucun modèle installé. Télécharge-en un ci-dessous."}),t.map($=>{const se=$.name===i,U=a.find(S=>S.name===$.name),re=c===$.name;return g.jsxs("div",{className:`flex items-center gap-3 border-[3px] border-line p-3 text-left ${se?"bg-card-deep":"bg-card-soft"}`,children:[g.jsxs("button",{onClick:()=>r($.name),className:"flex min-w-0 flex-1 items-center gap-3 text-left",children:[g.jsx("span",{className:`flex h-[18px] w-[18px] flex-none items-center justify-center border-[3px] ${se?"border-accent":"border-muted-3"}`,children:se&&g.jsx("span",{className:"h-2 w-2 bg-accent"})}),g.jsxs("div",{className:"min-w-0 flex-1",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:`truncate text-[14px] ${se?"text-white":"text-ink"}`,children:$.name}),$.name===(d==null?void 0:d.default_model)&&g.jsx("span",{className:"font-pixel flex-none border-2 border-white bg-accent px-1.5 py-0.5 text-[7px] text-white",children:"DÉFAUT"})]}),g.jsx("div",{className:`mt-1 text-[13px] ${se?"text-on-dark-2":"text-muted-2"}`,children:[$.size_go?`${$.size_go} Go`:null,$.quantization,$.parameter_size,$.family].filter(Boolean).join(" · ")}),g.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 text-[11px]",children:[g.jsx("span",{className:`h-2 w-2 border border-line ${re?"bg-accent animate-pulse":U!=null&&U.on_gpu?"bg-ok":U?"bg-warn":"bg-card"}`}),g.jsx("span",{className:se?"text-on-dark-2":"text-muted-2",children:re?"Préchargement en cours…":U!=null&&U.on_gpu?"Chargé sur GPU":U?`Chargé · ${U.gpu_percent}% GPU`:"Non chargé"})]})]})]}),g.jsx("button",{onClick:()=>R($.name),disabled:D===$.name,className:"flex-none border-2 border-line bg-base px-2 py-1 text-[12px] text-warn disabled:opacity-50",title:`Supprimer ${$.name}`,children:D===$.name?"…":"Supprimer"})]},$.name)}),ce&&g.jsx("div",{className:"border-2 border-warn bg-base px-3 py-2 text-[12px] text-warn",children:ce}),u&&g.jsxs("div",{className:"border-2 border-warn bg-base px-3 py-2 text-[12px] text-warn",children:["Préchargement : ",u]})]}),g.jsx("div",{className:"my-4 h-[3px] bg-line"}),g.jsx("div",{className:"font-pixel mb-2.5 text-[10px] text-label",children:"TÉLÉCHARGER"}),g.jsxs("div",{className:"mb-3 flex gap-2",children:[g.jsx("input",{value:j,onChange:$=>T($.target.value),placeholder:"gemma2:9b",className:"h-9 flex-1 border-[3px] border-line bg-card-soft px-3 text-[13px] text-ink outline-none placeholder:text-muted-3"}),g.jsxs("button",{onClick:Y,className:"flex h-9 items-center gap-1.5 border-[3px] border-line bg-card-deep px-3.5 text-[13px] text-white",children:[g.jsx(so,{}),"Récupérer"]})]}),O&&g.jsxs("div",{className:"border-[3px] border-line bg-card-soft p-3",children:[g.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[g.jsx("span",{className:"text-[13px] text-ink-2",children:j}),g.jsxs("span",{className:"text-[13px] text-accent",children:[O," ",J?`· ${J}%`:""]})]}),g.jsx("div",{className:"flex h-3.5 gap-px border-2 border-line bg-card p-px",children:g.jsx("span",{className:"bg-accent transition-all",style:{width:`${J}%`}})})]})]}),g.jsxs("div",{className:"flex flex-col gap-[18px]",children:[g.jsxs(Mn,{children:[g.jsx("div",{className:"font-pixel mb-4 text-[11px] text-ink",children:"GÉNÉRATION"}),g.jsx(Jn,{label:"Température",value:v.temperature,min:0,max:2,step:.05,fmt:$=>$.toFixed(2),onChange:$=>X("temperature",$)}),g.jsx(Jn,{label:"Top-P",value:v.top_p,min:0,max:1,step:.05,fmt:$=>$.toFixed(2),onChange:$=>X("top_p",$)}),g.jsx(Jn,{label:"Top-K",value:v.top_k,min:1,max:100,step:1,fmt:$=>String(Math.round($)),onChange:$=>X("top_k",Math.round($))}),g.jsx(Jn,{label:"Jetons max",value:v.max_tokens,min:256,max:8192,step:128,fmt:$=>String(Math.round($)),onChange:$=>X("max_tokens",Math.round($))}),g.jsx(Jn,{label:"Cache KV / contexte",value:v.num_ctx,min:2048,max:32768,step:1024,fmt:$=>`${Math.round($/1024)}K`,onChange:$=>X("num_ctx",Math.round($))}),g.jsx(Jn,{label:"Couches GPU",value:v.num_gpu,min:-1,max:120,step:1,fmt:$=>$<0?"auto":String(Math.round($)),onChange:$=>X("num_gpu",Math.round($))}),g.jsx(Jn,{label:"Batch",value:v.num_batch,min:64,max:1024,step:64,fmt:$=>String(Math.round($)),onChange:$=>X("num_batch",Math.round($)),last:!0}),g.jsxs("div",{className:"mt-4 flex items-center gap-3 border-2 border-line bg-base px-3 py-2.5",children:[g.jsxs("div",{className:"flex-1",children:[g.jsx("div",{className:"text-[14px] text-ink",children:"Mode réflexion"}),g.jsx("div",{className:"text-[12px] text-muted-2",children:"Désactive si le modèle ne renvoie que du raisonnement sans réponse."})]}),g.jsx(Ni,{on:v.think,onClick:()=>X("think",!v.think)})]}),g.jsxs("div",{className:"mt-3 border-2 border-line bg-card-soft px-3 py-2 text-[12px] leading-relaxed text-muted-2",children:["La précision KV (",g.jsx("code",{children:"f16"}),"/",g.jsx("code",{children:"q8_0"}),") est un réglage global du serveur Ollama et nécessite son redémarrage."]})]}),g.jsxs(Mn,{children:[g.jsxs("div",{className:"mb-3.5 flex items-center justify-between",children:[g.jsx("div",{className:"font-pixel text-[11px] text-ink",children:"OUTILS"}),g.jsxs("span",{className:"text-[13px] text-muted-2",children:[G," / ",h.length," actifs"]})]}),h.map(($,se)=>{const U=v.tools[$]??!1;return g.jsxs("div",{className:`flex items-center gap-3 py-2 ${se>0?"border-t-2 border-line-soft":""}`,children:[g.jsx("span",{className:`w-32 flex-none text-[14px] ${U?"text-ink":"text-muted-3"}`,children:$}),g.jsxs("span",{className:"flex-1 text-[13px] text-muted-2",children:[U0[$]??"",V0.has($)&&g.jsx("span",{className:"text-accent",children:" · sensible"})]}),g.jsx(Ni,{on:U,onClick:()=>X("tools",{...v.tools,[$]:!U})})]},$)}),v.tools.run_shell&&g.jsxs("div",{className:"mt-2 flex items-center gap-3 border-2 border-line bg-base px-3 py-2.5",children:[g.jsx("span",{className:"flex-1 text-[13px] text-ink-2",children:"Demander une validation avant chaque commande shell"}),g.jsx(Ni,{on:v.confirm_shell,onClick:()=>X("confirm_shell",!v.confirm_shell)})]})]}),g.jsxs(Mn,{children:[g.jsx("div",{className:"mb-3.5 font-pixel text-[11px] text-ink",children:"INTELLIGENCE"}),[["plan_mode","Plan-puis-exécute","Décompose les demandes complexes en étapes"],["self_review","Auto-critique (Qualité +)","Relit et révise la réponse avant de la donner"],["rag_enabled","Mémoire long-terme (RAG)","Se souvient des anciennes sessions (modèle d'embedding requis)"],["skills_enabled","Skills automatiques","Méthodes expertes injectées selon la tâche (débogage, web, refactor…)"]].map(([$,se,U],re)=>g.jsxs("div",{className:`flex items-center gap-3 py-2 ${re>0?"border-t-2 border-line-soft":""}`,children:[g.jsxs("span",{className:"flex-1",children:[g.jsx("span",{className:"block text-[14px] text-ink",children:se}),g.jsx("span",{className:"block text-[12px] text-muted-2",children:U})]}),g.jsx(Ni,{on:!!v[$],onClick:()=>X($,!v[$])})]},$)),g.jsxs("div",{className:"mt-2 flex items-center gap-3 border-t-2 border-line-soft pt-3",children:[g.jsxs("span",{className:"flex-1",children:[g.jsx("span",{className:"block text-[14px] text-ink",children:"Maintien en VRAM (préchargement)"}),g.jsx("span",{className:"block text-[12px] text-muted-2",children:"Garde le modèle chargé pour des réponses instantanées"})]}),g.jsxs("select",{value:v.keep_alive,onChange:$=>X("keep_alive",$.target.value),className:"h-8 border-[3px] border-line bg-card px-2 text-[13px] text-ink",children:[g.jsx("option",{value:"0",children:"Décharger aussitôt"}),g.jsx("option",{value:"5m",children:"5 min"}),g.jsx("option",{value:"30m",children:"30 min"}),g.jsx("option",{value:"2h",children:"2 heures"}),g.jsx("option",{value:"-1",children:"Toujours"})]})]})]}),g.jsx(W0,{}),g.jsx(q0,{}),g.jsx(Q0,{})]})]}),g.jsxs(Mn,{className:"mt-[18px]",children:[g.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[g.jsx("div",{className:"font-pixel text-[11px] text-ink",children:"INVITE SYSTÈME"}),g.jsxs("span",{className:"text-[13px] text-muted-2",children:[v.system_prompt.length," caractères"]})]}),g.jsx("textarea",{value:v.system_prompt,onChange:$=>X("system_prompt",$.target.value),rows:6,className:"scr w-full resize-y border-[3px] border-line bg-card-deep p-4 text-[13px] leading-[1.6] text-on-dark outline-none"})]})]}):g.jsx("div",{className:"py-20 text-center text-muted-2",children:"Chargement de la configuration…"})]})})}function W0(){const[t,i]=ne.useState([]),[r,o]=ne.useState(null),[a,c]=ne.useState({});ne.useEffect(()=>{Ug().then(i).catch(()=>{})},[]);const u=async h=>{i(await ed(h.id,!h.enabled,h.params))},d=async(h,y,x)=>{i(await ed(h.id,h.enabled,{...h.params,[y]:x}))},m=async h=>{o(h.id);try{const y=await Vg(h.id);c(x=>({...x,[h.id]:y.ok?`✓ ${y.tools.length} outil(s) : ${y.tools.join(", ").slice(0,120)}`:`✗ ${y.error??"échec"}`}))}finally{o(null)}};return g.jsxs(Mn,{children:[g.jsx("div",{className:"mb-1 font-pixel text-[11px] text-ink",children:"SERVEURS MCP"}),g.jsx("div",{className:"mb-3.5 text-[12px] text-muted-2",children:"Outils professionnels pour l'agent (navigateur, docs, web). Désactivé = zéro coût."}),g.jsx("div",{className:"flex flex-col gap-3",children:t.map(h=>g.jsxs("div",{className:"border-[3px] border-line bg-base p-3",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("span",{className:`h-[11px] w-[11px] flex-none border-2 border-line ${h.state==="connected"?"bg-ok":h.state==="error"?"bg-warn":"bg-muted-2"}`,title:h.error??h.state}),g.jsxs("div",{className:"min-w-0 flex-1",children:[g.jsxs("div",{className:"text-[14px] font-semibold text-ink",children:[h.label,h.tools>0&&g.jsxs("span",{className:"ml-2 text-[11px] text-muted-2",children:[h.tools," outil(s)"]})]}),g.jsx("div",{className:"truncate text-[12px] text-muted-2",children:h.description})]}),g.jsx("button",{onClick:()=>m(h),disabled:r===h.id,className:"border-2 border-line bg-card px-2 py-1 text-[11px] text-ink-2",children:r===h.id?"test…":"Tester"}),g.jsx(Ni,{on:h.enabled,onClick:()=>u(h)})]}),(h.url_param||h.env_params.length>0)&&g.jsxs("div",{className:"mt-2 flex flex-col gap-1.5",children:[h.url_param&&g.jsx("input",{defaultValue:h.params.command??"",onBlur:y=>d(h,"command",y.target.value),placeholder:"commande stdio (ex. npx -y mon-mcp) ou URL",className:"border-2 border-line bg-card px-2 py-1 text-[12px] text-ink"}),h.env_params.map(y=>g.jsx("input",{defaultValue:h.params[y]??"",onBlur:x=>d(h,y,x.target.value),placeholder:y,className:"border-2 border-line bg-card px-2 py-1 text-[12px] text-ink"},y))]}),h.error&&g.jsx("div",{className:"mt-1.5 text-[12px] text-warn",children:h.error}),a[h.id]&&g.jsx("div",{className:"mt-1.5 text-[12px] text-muted-2",children:a[h.id]})]},h.id))})]})}function q0(){const[t,i]=ne.useState(null),r=()=>Ng().then(i).catch(()=>{});return ne.useEffect(()=>{r();const o=setInterval(r,5e3);return()=>clearInterval(o)},[]),g.jsxs(Mn,{children:[g.jsxs("div",{className:"mb-3.5 flex items-center justify-between",children:[g.jsx("div",{className:"font-pixel text-[11px] text-ink",children:"MATÉRIEL"}),g.jsxs("button",{onClick:r,className:"flex h-7 items-center gap-1.5 border-2 border-line bg-card-soft px-2.5 text-[13px] text-muted-2",children:[g.jsx(Gd,{size:12}),"Rafraîchir"]})]}),g.jsx("div",{className:"mb-1 text-[12px] font-bold uppercase tracking-wide text-label",children:"GPU vu par Loki (conteneur)"}),t!=null&&t.loki_gpus.length?t.loki_gpus.map(o=>g.jsx("div",{className:"border-2 border-line bg-base px-3 py-2 text-[13px]",children:g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"text-ink",children:o.name}),g.jsxs("span",{className:"text-muted-2",children:[(o.vram_used_mb/1024).toFixed(1),"/",(o.vram_total_mb/1024).toFixed(1)," Go · ",o.util_pct.toFixed(0),"%"]})]})},o.index)):t!=null&&t.gpu_override?g.jsxs("div",{className:"border-2 border-line bg-base px-3 py-2 text-[13px] text-ink",children:[t.gpu_override.name," ·"," ",(t.gpu_override.vram_total_mb/1024).toFixed(0)," Go"," ",g.jsx("span",{className:"text-muted-2",children:"(valeur déclarée)"}),g.jsxs("div",{className:"mt-1 text-[11px] text-muted-2",children:["C'est la valeur de ",g.jsx("code",{children:"GPU_VRAM_MB"})," que tu as fixée, pas une détection réelle. Corrige-la (ex. 16000 pour 16 Go) ou mets 0."]})]}):g.jsxs("div",{className:"border-2 border-line bg-base px-3 py-2 text-[12px] text-muted-2",children:["Aucun GPU visible depuis le conteneur — normal si Ollama tourne sur une autre machine. Déclare ",g.jsx("code",{children:"GPU_VRAM_MB"})," pour l'auto-réglage."]}),g.jsxs("div",{className:"mb-1 mt-3 text-[12px] font-bold uppercase tracking-wide text-label",children:["Ollama ",t!=null&&t.ollama_is_local?"(local)":"(distant)"]}),g.jsxs("div",{className:"border-2 border-line bg-base px-3 py-2 text-[13px]",children:[g.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[g.jsx("span",{className:`h-2 w-2 border-2 border-line ${t!=null&&t.ollama.connected?"bg-ok":"bg-warn"}`}),g.jsx("span",{className:"min-w-0 flex-1 truncate text-muted-2",title:t==null?void 0:t.ollama.host,children:t==null?void 0:t.ollama.host}),(t==null?void 0:t.ollama.version)&&g.jsxs("span",{className:"text-[11px] text-muted-3",children:["v",t.ollama.version]})]}),t!=null&&t.ollama.running.length?t.ollama.running.map(o=>g.jsxs("div",{className:"flex items-center gap-2 py-[2px]",children:[g.jsx("span",{className:"min-w-0 flex-1 truncate text-ink",title:o.name,children:o.name}),g.jsxs("span",{className:o.processor==="GPU"?"text-ok":o.processor==="CPU"?"text-warn":"text-ink",children:[o.processor,o.processor==="mixte"?` ${o.gpu_percent}%`:""]}),g.jsxs("span",{className:"text-[11px] text-muted-3",children:[(o.vram_mb/1024).toFixed(1),"G VRAM"]})]},o.name)):g.jsx("div",{className:"text-[12px] text-muted-2",children:"Aucun modèle chargé actuellement."})]}),g.jsx("div",{className:"mt-2 text-[11px] leading-relaxed text-muted-3",children:t==null?void 0:t.note})]})}function Q0(){const t=Qe(x=>x.selectedModel),[i,r]=ne.useState({}),[o,a]=ne.useState(!1),[c,u]=ne.useState(null),[d,m]=ne.useState([]);ne.useEffect(()=>{Rg().then(r).catch(()=>{})},[]);const h=async()=>{if(!(!t||o)){a(!0),u(null),m([]);try{const x=await Mg(t,(v,w,E)=>{m(L=>[...L.filter(T=>T.task!==v),{task:v,score:w,detail:E}])});x&&r(v=>({...v,[t]:x}))}catch(x){u(x instanceof Error?x.message:"benchmark impossible")}finally{a(!1)}}},y=i[t];return g.jsxs(Mn,{children:[g.jsxs("div",{className:"mb-3.5 flex items-center justify-between",children:[g.jsx("div",{className:"font-pixel text-[11px] text-ink",children:"BENCHMARK"}),g.jsx("button",{onClick:h,disabled:o||!t,className:"flex h-8 items-center gap-1.5 border-[3px] border-line bg-accent px-3 text-[13px] text-white shadow-accent-soft disabled:opacity-40",style:{borderRadius:7},children:o?"ÉVALUATION…":"TESTER CE MODÈLE"})]}),g.jsxs("div",{className:"mb-2 text-[13px] text-muted-2",children:["5 mini-épreuves (outils, code, consignes, JSON, format) — score /100 pour ",g.jsx("b",{className:"text-ink",children:t||"—"}),"."]}),o&&g.jsx("div",{className:"border-2 border-line bg-base px-3 py-2",children:d.map(x=>g.jsxs("div",{className:"flex items-center gap-2 py-[2px] text-[13px]",children:[g.jsx("span",{className:"flex-1 text-ink-2",children:x.task}),x.score===null?g.jsx("span",{className:"text-muted-3",children:"…"}):g.jsxs("span",{className:x.score>=14?"text-ok":x.score>=8?"text-ink":"text-warn",children:[x.score,"/20"]})]},x.task))}),c&&g.jsxs("div",{className:"border-2 border-warn bg-base px-3 py-2 text-[12px] text-warn",children:["Échec du test : ",c]}),!o&&y&&g.jsxs("div",{className:"border-2 border-line bg-base px-3 py-2",children:[g.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[g.jsx("span",{className:"text-[13px] text-ink",children:"Score"}),g.jsxs("span",{className:`font-pixel text-[13px] ${y.score>=70?"text-ok":y.score>=45?"text-ink":"text-warn"}`,children:[y.score,"/100"]})]}),y.details.map(x=>g.jsxs("div",{className:"flex items-center gap-2 py-[2px] text-[12px]",children:[g.jsx("span",{className:"flex-1 text-muted-2",children:x.task}),g.jsxs("span",{className:"text-muted",title:x.detail,children:[x.score,"/20"]})]},x.task))]}),Object.keys(i).length>1&&g.jsxs("div",{className:"mt-2 text-[12px] text-muted-2",children:["Autres :"," ",Object.entries(i).filter(([x])=>x!==t).map(([x,v])=>`${x} (${v.score})`).join(" · ")]})]})}function Mn({children:t,className:i=""}){return g.jsx("div",{className:`border-[3px] border-line bg-card p-4 shadow-hard-lg ${i}`,style:{borderRadius:9},children:t})}function Ni({on:t,onClick:i}){return g.jsx("button",{onClick:i,className:`relative h-5 w-[38px] flex-none ${t?"bg-card-deep":"border-2 border-line bg-base"}`,children:g.jsx("span",{className:`absolute h-3.5 w-3.5 ${t?"right-0.5 top-0.5 bg-accent":"left-0.5 top-[3px] bg-muted-3"}`})})}function Jn({label:t,value:i,min:r,max:o,step:a,fmt:c,onChange:u,last:d}){const m=(i-r)/(o-r)*100;return g.jsxs("div",{className:d?"":"mb-[15px]",children:[g.jsxs("div",{className:"mb-[7px] flex items-center justify-between",children:[g.jsx("span",{className:"text-[13px] text-ink-2",children:t}),g.jsx("span",{className:"text-[13px] text-accent",children:c(i)})]}),g.jsxs("div",{className:"relative h-[14px] border-2 border-line bg-card",children:[g.jsx("div",{className:"absolute left-0 top-0 bottom-0 bg-line",style:{width:`${m}%`}}),g.jsx("div",{className:"absolute top-1/2 h-5 w-4 -translate-x-1/2 -translate-y-1/2 border-[3px] border-line bg-accent",style:{left:`${m}%`}}),g.jsx("input",{type:"range",min:r,max:o,step:a,value:i,onChange:h=>u(parseFloat(h.target.value)),className:"absolute inset-0 h-full w-full cursor-pointer opacity-0"})]})]})}function G0({onOpen:t}){const{sessions:i,refreshSessions:r,openSession:o,removeSession:a}=Qe();return ne.useEffect(()=>{r()},[r]),g.jsx(ru,{title:"Historique",subtitle:"Toutes les conversations enregistrées localement.",children:g.jsxs("div",{className:"grid grid-cols-1 gap-3 lg:grid-cols-2 xl:grid-cols-3",children:[i.map(c=>g.jsxs("div",{className:"border-[3px] border-line bg-card p-4 shadow-hard",children:[g.jsx("div",{className:"truncate text-[15px] font-semibold text-ink",children:c.title}),g.jsxs("div",{className:"mt-1 text-[12px] text-muted-2",children:[c.message_count??0," message(s) · ",new Date(c.updated_at*1e3).toLocaleString("fr-FR")]}),g.jsxs("div",{className:"mt-4 flex gap-2",children:[g.jsx("button",{onClick:async()=>{await o(c.id),t()},className:"border-2 border-line bg-accent px-3 py-1.5 text-[12px] font-bold text-white",children:"Ouvrir"}),g.jsx("button",{onClick:()=>a(c.id),className:"border-2 border-line bg-base px-3 py-1.5 text-[12px] text-warn",children:"Supprimer"})]})]},c.id)),i.length===0&&g.jsx(rh,{text:"Aucune conversation enregistrée."})]})})}function K0(){const{fileTree:t,refreshFiles:i}=Qe();return ne.useEffect(()=>{i()},[i]),g.jsx(ru,{title:"Fichiers",subtitle:"Workspace créé et modifié par l’agent.",children:g.jsx("div",{className:"border-[3px] border-line bg-panel p-3 shadow-hard",children:t.length?g.jsx(nh,{nodes:t,depth:0}):g.jsx(rh,{text:"Le workspace est vide."})})})}function nh({nodes:t,depth:i}){const{openPreview:r,previewPath:o,removeFile:a,currentProject:c}=Qe(),u=d=>{const m=d.type==="dir"?`Supprimer le dossier ${d.path} et tout son contenu ?`:`Supprimer ${d.path} ?`;window.confirm(m)&&a(d.path)};return g.jsx(g.Fragment,{children:t.map(d=>g.jsxs("div",{children:[g.jsxs("div",{className:`mb-1 flex items-center gap-2 border-2 px-3 py-2 ${d.path===o?"border-accent bg-card-deep text-white":"border-line bg-card text-ink-2"}`,style:{marginLeft:i*18},children:[g.jsxs("button",{onClick:()=>d.type==="file"&&r(d.path),className:"flex min-w-0 flex-1 items-center gap-2 text-left",children:[g.jsx("span",{children:d.type==="dir"?"▾":"▪"}),g.jsx("span",{className:"truncate",children:d.name}),d.size!==void 0&&g.jsx("span",{className:"ml-auto text-[11px] text-muted-2",children:X0(d.size)})]}),d.type==="file"&&g.jsxs("button",{onClick:()=>Oa(d.path,c()),className:"flex items-center gap-1 border-2 border-line bg-base px-2 py-1 text-[11px] text-accent",title:`Télécharger ${d.name}`,children:[g.jsx(so,{size:12})," Télécharger"]}),g.jsxs("button",{onClick:()=>u(d),className:"flex items-center gap-1 border-2 border-line bg-base px-2 py-1 text-[11px] text-warn",title:`Supprimer ${d.name}`,children:[g.jsx(ao,{size:12})," Supprimer"]})]}),d.children&&g.jsx(nh,{nodes:d.children,depth:i+1})]},d.path))})}function Y0({onSettings:t}){const{config:i,availableTools:r,refreshConfig:o,selectedModel:a}=Qe();return ne.useEffect(()=>{o()},[o,a]),g.jsxs(ru,{title:"Outils",subtitle:`Capacités proposées à ${a||"l’agent"}.`,children:[g.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3",children:r.map(c=>{const u=(i==null?void 0:i.tools[c])??!1;return g.jsx("div",{className:"border-[3px] border-line bg-card p-4 shadow-hard",children:g.jsxs("div",{className:"flex items-center justify-between gap-3",children:[g.jsx("span",{className:"font-mono text-[14px] text-ink",children:c}),g.jsx("span",{className:`border-2 border-line px-2 py-1 text-[10px] ${u?"bg-ok text-white":"bg-base text-muted-2"}`,children:u?"ACTIF":"INACTIF"})]})},c)})}),g.jsx("button",{onClick:t,className:"mt-5 border-[3px] border-line bg-accent px-4 py-2 text-[13px] font-bold text-white shadow-hard",children:"Configurer les outils"})]})}function ru({title:t,subtitle:i,children:r}){return g.jsx("div",{className:"scr min-w-0 flex-1 overflow-auto bg-base p-7",children:g.jsxs("div",{className:"mx-auto max-w-[1100px]",children:[g.jsx("h1",{className:"m-0 text-xl font-bold text-ink",children:t}),g.jsx("p",{className:"mb-6 mt-1 text-[13px] text-muted-2",children:i}),r]})})}function rh({text:t}){return g.jsx("div",{className:"border-2 border-line bg-card p-8 text-center text-muted-2",children:t})}function X0(t){return t<1024?`${t} o`:t<1024*1024?`${Math.round(t/1024)} Ko`:`${(t/1024/1024).toFixed(1)} Mo`}function J0(){const[t,i]=ne.useState("chat"),{refreshStatus:r,refreshSystemStats:o,refreshModels:a,refreshLoadedModels:c,refreshSessions:u}=Qe();return ne.useEffect(()=>{r(),o(),a(),c(),u();const d=setInterval(r,1e4),m=setInterval(o,5e3),h=setInterval(c,8e3);return()=>{clearInterval(d),clearInterval(m),clearInterval(h)}},[r,o,a,c,u]),g.jsxs("div",{className:"flex h-full flex-col bg-base text-ink",children:[g.jsx(ex,{}),g.jsxs("div",{className:"flex min-h-0 flex-1",children:[g.jsx(xg,{active:t,onChange:i}),t==="chat"&&g.jsxs(g.Fragment,{children:[g.jsx(tx,{}),g.jsx(R0,{}),g.jsx(qd,{})]}),t==="history"&&g.jsx(G0,{onOpen:()=>i("chat")}),t==="files"&&g.jsxs(g.Fragment,{children:[g.jsx(K0,{}),g.jsx(qd,{})]}),t==="tools"&&g.jsx(Y0,{onSettings:()=>i("settings")}),t==="settings"&&g.jsx(H0,{})]})]})}sg.createRoot(document.getElementById("root")).render(g.jsx(Ei.StrictMode,{children:g.jsx(J0,{})}));