@bibobonking/opensol 3.1.2 → 3.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -1
- package/dist/assets/index-B1pQC9Fe.js +288 -0
- package/dist/assets/index-qLr4aZVC.css +1 -0
- package/dist/favicon.svg +11 -5
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/public/favicon.svg +11 -5
- package/server/daemon.mjs +42 -4
- package/server/lib/deploy.mjs +78 -7
- package/server/lib/skills.mjs +128 -0
- package/server/lib/tools.mjs +40 -0
- package/src/agent/adapters/openai-responses.ts +5 -1
- package/src/agent/adapters/openai.ts +15 -2
- package/src/agent/prompt.ts +4 -7
- package/src/agent/tools.ts +1 -0
- package/src/components/DeployModal.tsx +77 -15
- package/src/components/FileIcon.tsx +108 -0
- package/src/components/HomeDashboard.tsx +9 -2
- package/src/components/Logo.tsx +11 -5
- package/src/components/ModelDeck.tsx +12 -2
- package/src/components/SettingsModal.tsx +144 -199
- package/src/components/Sidebar.tsx +4 -5
- package/src/components/SystemPromptModal.tsx +168 -0
- package/src/components/TopBar.tsx +19 -0
- package/src/components/WorkspacePanel.tsx +94 -46
- package/src/core/kernel.ts +2 -0
- package/src/core/plugins/tools/skill.ts +101 -0
- package/src/core/services/agent-loop.ts +26 -28
- package/src/core/services/system-prompt.ts +15 -13
- package/src/core/services/tools.ts +1 -0
- package/src/lib/daemon.ts +19 -0
- package/src/lib/permissions.ts +1 -1
- package/src/lib/retry.test.mjs +17 -0
- package/src/lib/retry.ts +13 -0
- package/src/lib/skills.test.mjs +22 -0
- package/src/lib/skills.ts +93 -0
- package/src/lib/usage.ts +12 -0
- package/src/store/chats.ts +1 -0
- package/src/store/settings.ts +21 -9
- package/src/types.ts +14 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/assets/index-CeN54A2N.css +0 -1
- package/dist/assets/index-fhIO9a7_.js +0 -318
- package/src/data/skills.ts +0 -68
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&r(d)}).observe(document,{childList:!0,subtree:!0});function a(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function r(o){if(o.ep)return;o.ep=!0;const u=a(o);fetch(o.href,u)}})();function fd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var lm={exports:{}},mo={};var Y0;function $S(){if(Y0)return mo;Y0=1;var e=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function a(r,o,u){var d=null;if(u!==void 0&&(d=""+u),o.key!==void 0&&(d=""+o.key),"key"in o){u={};for(var p in o)p!=="key"&&(u[p]=o[p])}else u=o;return o=u.ref,{$$typeof:e,type:r,key:d,ref:o!==void 0?o:null,props:u}}return mo.Fragment=i,mo.jsx=a,mo.jsxs=a,mo}var V0;function PS(){return V0||(V0=1,lm.exports=$S()),lm.exports}var c=PS(),om={exports:{}},Qe={};var K0;function HS(){if(K0)return Qe;K0=1;var e=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),d=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),y=Symbol.for("react.view_transition"),v=Symbol.iterator;function w(U){return U===null||typeof U!="object"?null:(U=v&&U[v]||U["@@iterator"],typeof U=="function"?U:null)}var T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,N={};function j(U,re,ge){this.props=U,this.context=re,this.refs=N,this.updater=ge||T}j.prototype.isReactComponent={},j.prototype.setState=function(U,re){if(typeof U!="object"&&typeof U!="function"&&U!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,U,re,"setState")},j.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function A(){}A.prototype=j.prototype;function R(U,re,ge){this.props=U,this.context=re,this.refs=N,this.updater=ge||T}var $=R.prototype=new A;$.constructor=R,E($,j.prototype),$.isPureReactComponent=!0;var z=Array.isArray;function C(){}var L={H:null,A:null,T:null,S:null},q=Object.prototype.hasOwnProperty;function M(U,re,ge){var _e=ge.ref;return{$$typeof:e,type:U,key:re,ref:_e!==void 0?_e:null,props:ge}}function H(U,re){return M(U.type,re,U.props)}function Z(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function he(U){var re={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(ge){return re[ge]})}var se=/\/+/g;function ae(U,re){return typeof U=="object"&&U!==null&&U.key!=null?he(""+U.key):re.toString(36)}function O(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(C,C):(U.status="pending",U.then(function(re){U.status==="pending"&&(U.status="fulfilled",U.value=re)},function(re){U.status==="pending"&&(U.status="rejected",U.reason=re)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function ee(U,re,ge,_e,Ue){var de=typeof U;(de==="undefined"||de==="boolean")&&(U=null);var Ne=!1;if(U===null)Ne=!0;else switch(de){case"bigint":case"string":case"number":Ne=!0;break;case"object":switch(U.$$typeof){case e:case i:Ne=!0;break;case x:return Ne=U._init,ee(Ne(U._payload),re,ge,_e,Ue)}}if(Ne)return Ue=Ue(U),Ne=_e===""?"."+ae(U,0):_e,z(Ue)?(ge="",Ne!=null&&(ge=Ne.replace(se,"$&/")+"/"),ee(Ue,re,ge,"",function(Pe){return Pe})):Ue!=null&&(Z(Ue)&&(Ue=H(Ue,ge+(Ue.key==null||U&&U.key===Ue.key?"":(""+Ue.key).replace(se,"$&/")+"/")+Ne)),re.push(Ue)),1;Ne=0;var ye=_e===""?".":_e+":";if(z(U))for(var Q=0;Q<U.length;Q++)_e=U[Q],de=ye+ae(_e,Q),Ne+=ee(_e,re,ge,de,Ue);else if(Q=w(U),typeof Q=="function")for(U=Q.call(U),Q=0;!(_e=U.next()).done;)_e=_e.value,de=ye+ae(_e,Q++),Ne+=ee(_e,re,ge,de,Ue);else if(de==="object"){if(typeof U.then=="function")return ee(O(U),re,ge,_e,Ue);throw re=String(U),Error("Objects are not valid as a React child (found: "+(re==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":re)+"). If you meant to render a collection of children, use an array instead.")}return Ne}function te(U,re,ge){if(U==null)return U;var _e=[],Ue=0;return ee(U,_e,"","",function(de){return re.call(ge,de,Ue++)}),_e}function be(U){if(U._status===-1){var re=U._result,ge=re();ge.then(function(_e){(U._status===0||U._status===-1)&&(U._status=1,U._result=_e,ge.status===void 0&&(ge.status="fulfilled",ge.value=_e))},function(_e){(U._status===0||U._status===-1)&&(U._status=2,U._result=_e,ge.status===void 0&&(ge.status="rejected",ge.reason=_e))}),U._status===-1&&(U._status=0,U._result=ge)}if(U._status===1)return U._result.default;throw U._result}var S=typeof reportError=="function"?reportError:function(U){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var re=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof U=="object"&&U!==null&&typeof U.message=="string"?String(U.message):String(U),error:U});if(!window.dispatchEvent(re))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",U);return}console.error(U)};function ve(U){var re=L.T,ge={};ge.types=re!==null?re.types:null,L.T=ge;try{var _e=U(),Ue=L.S;Ue!==null&&Ue(ge,_e),typeof _e=="object"&&_e!==null&&typeof _e.then=="function"&&_e.then(C,S)}catch(de){S(de)}finally{re!==null&&ge.types!==null&&(re.types=ge.types),L.T=re}}function ce(U){var re=L.T;if(re!==null){var ge=re.types;ge===null?re.types=[U]:ge.indexOf(U)===-1&&ge.push(U)}else ve(ce.bind(null,U))}var D={map:te,forEach:function(U,re,ge){te(U,function(){re.apply(this,arguments)},ge)},count:function(U){var re=0;return te(U,function(){re++}),re},toArray:function(U){return te(U,function(re){return re})||[]},only:function(U){if(!Z(U))throw Error("React.Children.only expected to receive a single React element child.");return U}};return Qe.Activity=b,Qe.Children=D,Qe.Component=j,Qe.Fragment=a,Qe.Profiler=o,Qe.PureComponent=R,Qe.StrictMode=r,Qe.Suspense=h,Qe.ViewTransition=y,Qe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,Qe.__COMPILER_RUNTIME={__proto__:null,c:function(U){return L.H.useMemoCache(U)}},Qe.addTransitionType=ce,Qe.cache=function(U){return function(){return U.apply(null,arguments)}},Qe.cacheSignal=function(){return null},Qe.cloneElement=function(U,re,ge){if(U==null)throw Error("The argument must be a React element, but you passed "+U+".");var _e=E({},U.props),Ue=U.key;if(re!=null)for(de in re.key!==void 0&&(Ue=""+re.key),re)!q.call(re,de)||de==="key"||de==="__self"||de==="__source"||de==="ref"&&re.ref===void 0||(_e[de]=re[de]);var de=arguments.length-2;if(de===1)_e.children=ge;else if(1<de){for(var Ne=Array(de),ye=0;ye<de;ye++)Ne[ye]=arguments[ye+2];_e.children=Ne}return M(U.type,Ue,_e)},Qe.createContext=function(U){return U={$$typeof:d,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null},U.Provider=U,U.Consumer={$$typeof:u,_context:U},U},Qe.createElement=function(U,re,ge){var _e,Ue={},de=null;if(re!=null)for(_e in re.key!==void 0&&(de=""+re.key),re)q.call(re,_e)&&_e!=="key"&&_e!=="__self"&&_e!=="__source"&&(Ue[_e]=re[_e]);var Ne=arguments.length-2;if(Ne===1)Ue.children=ge;else if(1<Ne){for(var ye=Array(Ne),Q=0;Q<Ne;Q++)ye[Q]=arguments[Q+2];Ue.children=ye}if(U&&U.defaultProps)for(_e in Ne=U.defaultProps,Ne)Ue[_e]===void 0&&(Ue[_e]=Ne[_e]);return M(U,de,Ue)},Qe.createRef=function(){return{current:null}},Qe.forwardRef=function(U){return{$$typeof:p,render:U}},Qe.isValidElement=Z,Qe.lazy=function(U){return{$$typeof:x,_payload:{_status:-1,_result:U},_init:be}},Qe.memo=function(U,re){return{$$typeof:g,type:U,compare:re===void 0?null:re}},Qe.startTransition=ve,Qe.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},Qe.use=function(U){return L.H.use(U)},Qe.useActionState=function(U,re,ge){return L.H.useActionState(U,re,ge)},Qe.useCallback=function(U,re){return L.H.useCallback(U,re)},Qe.useContext=function(U){return L.H.useContext(U)},Qe.useDebugValue=function(){},Qe.useDeferredValue=function(U,re){return L.H.useDeferredValue(U,re)},Qe.useEffect=function(U,re){return L.H.useEffect(U,re)},Qe.useEffectEvent=function(U){return L.H.useEffectEvent(U)},Qe.useId=function(){return L.H.useId()},Qe.useImperativeHandle=function(U,re,ge){return L.H.useImperativeHandle(U,re,ge)},Qe.useInsertionEffect=function(U,re){return L.H.useInsertionEffect(U,re)},Qe.useLayoutEffect=function(U,re){return L.H.useLayoutEffect(U,re)},Qe.useMemo=function(U,re){return L.H.useMemo(U,re)},Qe.useOptimistic=function(U,re){return L.H.useOptimistic(U,re)},Qe.useReducer=function(U,re,ge){return L.H.useReducer(U,re,ge)},Qe.useRef=function(U){return L.H.useRef(U)},Qe.useState=function(U){return L.H.useState(U)},Qe.useSyncExternalStore=function(U,re,ge){return L.H.useSyncExternalStore(U,re,ge)},Qe.useTransition=function(){return L.H.useTransition()},Qe.version="19.3.1",Qe}var X0;function Gh(){return X0||(X0=1,om.exports=HS()),om.exports}var B=Gh();const cm=fd(B);var um={exports:{}},ho={},dm={exports:{}},fm={};var Z0;function FS(){return Z0||(Z0=1,(function(e){function i(O,ee){var te=O.length;O.push(ee);e:for(;0<te;){var be=te-1>>>1,S=O[be];if(0<o(S,ee))O[be]=ee,O[te]=S,te=be;else break e}}function a(O){return O.length===0?null:O[0]}function r(O){if(O.length===0)return null;var ee=O[0],te=O.pop();if(te!==ee){O[0]=te;e:for(var be=0,S=O.length,ve=S>>>1;be<ve;){var ce=2*(be+1)-1,D=O[ce],U=ce+1,re=O[U];if(0>o(D,te))U<S&&0>o(re,D)?(O[be]=re,O[U]=te,be=U):(O[be]=D,O[ce]=te,be=ce);else if(U<S&&0>o(re,te))O[be]=re,O[U]=te,be=U;else break e}}return ee}function o(O,ee){var te=O.sortIndex-ee.sortIndex;return te!==0?te:O.id-ee.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var d=Date,p=d.now();e.unstable_now=function(){return d.now()-p}}var h=[],g=[],x=1,b=null,y=3,v=!1,w=!1,T=!1,E=!1,N=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function R(O){for(var ee=a(g);ee!==null;){if(ee.callback===null)r(g);else if(ee.startTime<=O)r(g),ee.sortIndex=ee.expirationTime,i(h,ee);else break;ee=a(g)}}function $(O){if(T=!1,R(O),!w)if(a(h)!==null)w=!0,z||(z=!0,Z());else{var ee=a(g);ee!==null&&ae($,ee.startTime-O)}}var z=!1,C=-1,L=5,q=-1;function M(){return E?!0:!(e.unstable_now()-q<L)}function H(){if(E=!1,z){var O=e.unstable_now();q=O;var ee=!0;try{e:{w=!1,T&&(T=!1,j(C),C=-1),v=!0;var te=y;try{t:{for(R(O),b=a(h);b!==null&&!(b.expirationTime>O&&M());){var be=b.callback;if(typeof be=="function"){b.callback=null,y=b.priorityLevel;var S=be(b.expirationTime<=O);if(O=e.unstable_now(),typeof S=="function"){b.callback=S,R(O),ee=!0;break t}b===a(h)&&r(h),R(O)}else r(h);b=a(h)}if(b!==null)ee=!0;else{var ve=a(g);ve!==null&&ae($,ve.startTime-O),ee=!1}}break e}finally{b=null,y=te,v=!1}ee=void 0}}finally{ee?Z():z=!1}}}var Z;if(typeof A=="function")Z=function(){A(H)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,se=he.port2;he.port1.onmessage=H,Z=function(){se.postMessage(null)}}else Z=function(){N(H,0)};function ae(O,ee){C=N(function(){O(e.unstable_now())},ee)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(O){O.callback=null},e.unstable_forceFrameRate=function(O){0>O||125<O?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<O?Math.floor(1e3/O):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(O){switch(y){case 1:case 2:case 3:var ee=3;break;default:ee=y}var te=y;y=ee;try{return O()}finally{y=te}},e.unstable_requestPaint=function(){E=!0},e.unstable_runWithPriority=function(O,ee){switch(O){case 1:case 2:case 3:case 4:case 5:break;default:O=3}var te=y;y=O;try{return ee()}finally{y=te}},e.unstable_scheduleCallback=function(O,ee,te){var be=e.unstable_now();switch(typeof te=="object"&&te!==null?(te=te.delay,te=typeof te=="number"&&0<te?be+te:be):te=be,O){case 1:var S=-1;break;case 2:S=250;break;case 5:S=1073741823;break;case 4:S=1e4;break;default:S=5e3}return S=te+S,O={id:x++,callback:ee,priorityLevel:O,startTime:te,expirationTime:S,sortIndex:-1},te>be?(O.sortIndex=te,i(g,O),a(h)===null&&O===a(g)&&(T?(j(C),C=-1):T=!0,ae($,te-be))):(O.sortIndex=S,i(h,O),w||v||(w=!0,z||(z=!0,Z()))),O},e.unstable_shouldYield=M,e.unstable_wrapCallback=function(O){var ee=y;return function(){var te=y;y=ee;try{return O.apply(this,arguments)}finally{y=te}}}})(fm)),fm}var Q0;function qS(){return Q0||(Q0=1,dm.exports=FS()),dm.exports}var pm={exports:{}},Sn={};var J0;function GS(){if(J0)return Sn;J0=1;var e=Gh();function i(x){var b="https://react.dev/errors/"+x;if(1<arguments.length){b+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)b+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+x+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(){}var r={d:{f:a,r:function(){throw Error(i(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},o=Symbol.for("react.portal"),u=Symbol.for("react.recoverable"),d=Symbol.for("react.optimistic_key");function p(x,b,y){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:v==null?null:v===d?d:""+v,children:x,containerInfo:b,implementation:y}}var h=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function g(x,b){if(x==="font")return"";if(typeof b=="string")return b==="use-credentials"?b:""}return Sn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Sn.browser=function(x){return{$$typeof:u,_reason:x}},Sn.createPortal=function(x,b){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!b||b.nodeType!==1&&b.nodeType!==9&&b.nodeType!==11)throw Error(i(299));return p(x,b,null,y)},Sn.flushSync=function(x){var b=h.T,y=r.p;try{if(h.T=null,r.p=2,x)return x()}finally{h.T=b,r.p=y,r.d.f()}},Sn.preconnect=function(x,b){typeof x=="string"&&(b?(b=b.crossOrigin,b=typeof b=="string"?b==="use-credentials"?b:"":void 0):b=null,r.d.C(x,b))},Sn.prefetchDNS=function(x){typeof x=="string"&&r.d.D(x)},Sn.preinit=function(x,b){if(typeof x=="string"&&b&&typeof b.as=="string"){var y=b.as,v=g(y,b.crossOrigin),w=typeof b.integrity=="string"?b.integrity:void 0,T=typeof b.fetchPriority=="string"?b.fetchPriority:void 0;y==="style"?r.d.S(x,typeof b.precedence=="string"?b.precedence:void 0,{crossOrigin:v,integrity:w,fetchPriority:T}):y==="script"&&r.d.X(x,{crossOrigin:v,integrity:w,fetchPriority:T,nonce:typeof b.nonce=="string"?b.nonce:void 0})}},Sn.preinitModule=function(x,b){if(typeof x=="string")if(typeof b=="object"&&b!==null){if(b.as==null||b.as==="script"){var y=g(b.as,b.crossOrigin);r.d.M(x,{crossOrigin:y,integrity:typeof b.integrity=="string"?b.integrity:void 0,nonce:typeof b.nonce=="string"?b.nonce:void 0,fetchPriority:typeof b.fetchPriority=="string"?b.fetchPriority:void 0})}}else b==null&&r.d.M(x)},Sn.preload=function(x,b){if(typeof x=="string"&&typeof b=="object"&&b!==null&&typeof b.as=="string"){var y=b.as,v=g(y,b.crossOrigin);r.d.L(x,y,{crossOrigin:v,integrity:typeof b.integrity=="string"?b.integrity:void 0,nonce:typeof b.nonce=="string"?b.nonce:void 0,type:typeof b.type=="string"?b.type:void 0,fetchPriority:typeof b.fetchPriority=="string"?b.fetchPriority:void 0,referrerPolicy:typeof b.referrerPolicy=="string"?b.referrerPolicy:void 0,imageSrcSet:typeof b.imageSrcSet=="string"?b.imageSrcSet:void 0,imageSizes:typeof b.imageSizes=="string"?b.imageSizes:void 0,media:typeof b.media=="string"?b.media:void 0})}},Sn.preloadModule=function(x,b){if(typeof x=="string")if(b){var y=g(b.as,b.crossOrigin);r.d.m(x,{as:typeof b.as=="string"&&b.as!=="script"?b.as:void 0,crossOrigin:y,integrity:typeof b.integrity=="string"?b.integrity:void 0,nonce:typeof b.nonce=="string"?b.nonce:void 0,fetchPriority:typeof b.fetchPriority=="string"?b.fetchPriority:void 0})}else r.d.m(x)},Sn.requestFormReset=function(x){r.d.r(x)},Sn.unstable_batchedUpdates=function(x,b){return x(b)},Sn.useFormState=function(x,b,y){return h.H.useFormState(x,b,y)},Sn.useFormStatus=function(){return h.H.useHostTransitionStatus()},Sn.version="19.3.1",Sn}var W0;function ew(){if(W0)return pm.exports;W0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(i){console.error(i)}}return e(),pm.exports=GS(),pm.exports}var e1;function YS(){if(e1)return ho;e1=1;var e=qS(),i=Gh(),a=ew();function r(t){var n="https://react.dev/errors/"+t;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)n+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function u(t){for(var n=t,s=n;s&&!s.alternate;)n=s,(n.flags&4098)!==0&&(t=n.return),s=n.return;for(;n.return;)n=n.return;return n.tag===3?t:null}function d(t){if(t.tag===13){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function p(t){if(t.tag===31){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function h(t){if(u(t)!==t)throw Error(r(188))}function g(t){var n=t.alternate;if(!n){if(n=u(t),n===null)throw Error(r(188));return n!==t?null:t}for(var s=t,l=n;;){var f=s.return;if(f===null)break;var m=f.alternate;if(m===null){if(l=f.return,l!==null){s=l;continue}break}if(f.child===m.child){for(m=f.child;m;){if(m===s)return h(f),t;if(m===l)return h(f),n;m=m.sibling}throw Error(r(188))}if(s.return!==l.return)s=f,l=m;else{for(var k=!1,_=f.child;_;){if(_===s){k=!0,s=f,l=m;break}if(_===l){k=!0,l=f,s=m;break}_=_.sibling}if(!k){for(_=m.child;_;){if(_===s){k=!0,s=m,l=f;break}if(_===l){k=!0,l=m,s=f;break}_=_.sibling}if(!k)throw Error(r(189))}}if(s.alternate!==l)throw Error(r(190))}if(s.tag!==3)throw Error(r(188));return s.stateNode.current===s?t:n}function x(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=x(t),n!==null)return n;t=t.sibling}return null}function b(t,n,s,l,f,m){for(;t!==null;){if((t.tag===5||t.tag===27||t.tag===6)&&s(t,l,f,m)||(t.tag!==22||t.memoizedState===null)&&(n||t.tag!==5&&t.tag!==27)&&b(t.child,n,s,l,f,m))return!0;t=t.sibling}return!1}function y(t){for(t=t.return;t!==null;){if(t.tag===3||t.tag===5||t.tag===27)return t;t=t.return}return null}function v(t){var n=!1;for(t=t.return;t!==null&&(t.tag===4&&(n=!0),!(t.tag===3||t.tag===5||t.tag===27));)t=t.return;return n}function w(t){var n=[null,null],s=y(t);return s===null||T(n,t,s.child,{foundSelf:!1}),n}function T(t,n,s,l){for(;s!==null;){if(s===n)l.foundSelf=!0;else if(s.tag===5||s.tag===27||s.tag===6){if(l.foundSelf)return t[1]=s,!0;t[0]=s}else if((s.tag!==22||s.memoizedState===null)&&T(t,n,s.child,l))return!0;s=s.sibling}return!1}function E(t){switch(t.tag){case 5:case 27:case 6:return t.stateNode;case 3:return t.stateNode.containerInfo;default:throw Error(r(559))}}var N=null,j=null;function A(t,n,s){return t===s?!0:t===n?(N=t,!0):!1}function R(t,n,s){return t===s?(j=t,!1):t===n?(j!==null&&(N=t),!0):!1}function $(t){if(t===null)return null;do t=t===null?null:t.return;while(t&&t.tag!==5&&t.tag!==27&&t.tag!==3);return t||null}function z(t,n,s){for(var l=0,f=t;f;f=s(f))l++;f=0;for(var m=n;m;m=s(m))f++;for(;0<l-f;)t=s(t),l--;for(;0<f-l;)n=s(n),f--;for(;l--;){if(t===n||n!==null&&t===n.alternate)return t;t=s(t),n=s(n)}return null}var C=Object.assign,L=Symbol.for("react.element"),q=Symbol.for("react.transitional.element"),M=Symbol.for("react.portal"),H=Symbol.for("react.fragment"),Z=Symbol.for("react.strict_mode"),he=Symbol.for("react.profiler"),se=Symbol.for("react.consumer"),ae=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),ee=Symbol.for("react.suspense"),te=Symbol.for("react.suspense_list"),be=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),ve=Symbol.for("react.activity"),ce=Symbol.for("react.legacy_hidden"),D=Symbol.for("react.memo_cache_sentinel"),U=Symbol.for("react.view_transition"),re=Symbol.for("react.recoverable"),ge=Symbol.iterator;function _e(t){return t===null||typeof t!="object"?null:(t=ge&&t[ge]||t["@@iterator"],typeof t=="function"?t:null)}var Ue=Symbol.for("react.client.reference");function de(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===Ue?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case H:return"Fragment";case he:return"Profiler";case Z:return"StrictMode";case ee:return"Suspense";case te:return"SuspenseList";case ve:return"Activity";case U:return"ViewTransition"}if(typeof t=="object")switch(t.$$typeof){case M:return"Portal";case ae:return t.displayName||"Context";case se:return(t._context.displayName||"Context")+".Consumer";case O:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case be:return n=t.displayName||null,n!==null?n:de(t.type)||"Memo";case S:n=t._payload,t=t._init;try{return de(t(n))}catch{}}return null}var Ne=Array.isArray,ye=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Pe={pending:!1,data:null,method:null,action:null},ne=[],et=-1;function Ae(t){return{current:t}}function rt(t){0>et||(t.current=ne[et],ne[et]=null,et--)}function Ke(t,n){et++,ne[et]=t.current,t.current=n}var It=Ae(null),jn=Ae(null),xn=Ae(null),fe=Ae(null);function Ge(t,n){switch(Ke(xn,n),Ke(jn,t),Ke(It,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?t0(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=t0(n),t=n0(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}rt(It),Ke(It,t)}function ht(){rt(It),rt(jn),rt(xn)}function xt(t){var n=t.memoizedState;n!==null&&(Zs._currentValue=n.memoizedState,Ke(fe,t)),n=It.current;var s=n0(n,t.type);n!==s&&(Ke(jn,t),Ke(It,s))}function ln(t){jn.current===t&&(rt(It),rt(jn)),fe.current===t&&(rt(fe),Zs._currentValue=Pe)}var ie,ke;function He(t){if(ie===void 0)try{throw Error()}catch(s){var n=s.stack.trim().match(/\n( *(at )?)/);ie=n&&n[1]||"",ke=-1<s.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+ie+t+ke}var Xe=!1;function Zt(t,n){if(!t||Xe)return"";Xe=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(n){var oe=function(){throw Error()};if(Object.defineProperty(oe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(oe,[])}catch(Se){var G=Se}Reflect.construct(t,[],oe)}else{try{oe.call()}catch(Se){G=Se}oe=!1;try{var X=Object.getOwnPropertyDescriptor(t.prototype,"props");Object.defineProperty(t.prototype,"props",{configurable:!0,set:function(){throw Error()}}),oe=!0,new t}finally{oe&&(X!==void 0?Object.defineProperty(t.prototype,"props",X):delete t.prototype.props)}}}else{try{throw Error()}catch(Se){G=Se}(oe=t())&&typeof oe.catch=="function"&&oe.catch(function(){})}}catch(Se){if(Se&&G&&typeof Se.stack=="string")return[Se.stack,G.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var m=l.DetermineComponentFrameRoot(),k=m[0],_=m[1];if(k&&_){var I=k.split(`
|
|
4
|
+
`),V=_.split(`
|
|
5
|
+
`);for(f=l=0;l<I.length&&!I[l].includes("DetermineComponentFrameRoot");)l++;for(;f<V.length&&!V[f].includes("DetermineComponentFrameRoot");)f++;if(l===I.length||f===V.length)for(l=I.length-1,f=V.length-1;1<=l&&0<=f&&I[l]!==V[f];)f--;for(;1<=l&&0<=f;l--,f--)if(I[l]!==V[f]){if(l!==1||f!==1)do if(l--,f--,0>f||I[l]!==V[f]){var J=`
|
|
6
|
+
`+I[l].replace(" at new "," at ");return t.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",t.displayName)),J}while(1<=l&&0<=f);break}}}finally{Xe=!1,Error.prepareStackTrace=s}return(s=t?t.displayName||t.name:"")?He(s):""}function Et(t,n){switch(t.tag){case 26:case 27:case 5:return He(t.type);case 16:return He("Lazy");case 13:return t.child!==n&&n!==null?He("Suspense Fallback"):He("Suspense");case 19:return He("SuspenseList");case 0:case 15:return Zt(t.type,!1);case 11:return Zt(t.type.render,!1);case 1:return Zt(t.type,!0);case 31:return He("Activity");case 30:return He("ViewTransition");default:return""}}function on(t){try{var n="",s=null;do n+=Et(t,s),s=t,t=t.return;while(t);return n}catch(l){return`
|
|
7
|
+
Error generating stack: `+l.message+`
|
|
8
|
+
`+l.stack}}var bn=Object.prototype.hasOwnProperty,_i=e.unstable_scheduleCallback,Si=e.unstable_cancelCallback,ca=e.unstable_shouldYield,La=e.unstable_requestPaint,Qt=e.unstable_now,dn=e.unstable_getCurrentPriorityLevel,Ti=e.unstable_ImmediatePriority,zn=e.unstable_UserBlockingPriority,Ci=e.unstable_NormalPriority,P=e.unstable_LowPriority,ue=e.unstable_IdlePriority,Ce=e.log,Ze=e.unstable_setDisableYieldValue,Rt=null,pt=null;function Oe(t){if(typeof Ce=="function"&&Ze(t),pt&&typeof pt.setStrictMode=="function")try{pt.setStrictMode(Rt,t)}catch{}}var Te=Math.clz32?Math.clz32:Ft,Ye=Math.log,Jt=Math.LN2;function Ft(t){return t>>>=0,t===0?32:31-(Ye(t)/Jt|0)|0}var Fi=256,Ia=262144,Ua=4194304;function ua(t){var n=t&42;if(n!==0)return n;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&-t;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Ba(t,n,s){var l=t.pendingLanes;if(l===0)return 0;var f=0,m=t.suspendedLanes,k=t.pingedLanes;t=t.warmLanes;var _=l&134217727;return _!==0?(l=_&~m,l!==0?f=ua(l):(k&=_,k!==0?f=ua(k):s||(s=_&~t,s!==0&&(f=ua(s))))):(_=l&~m,_!==0?f=ua(_):k!==0?f=ua(k):s||(s=l&~t,s!==0&&(f=ua(s)))),f===0?0:n!==0&&n!==f&&(n&m)===0&&(m=f&-f,s=n&-n,m>=s||m===32&&(s&4194048)!==0)?n:f}function _r(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function Wo(t,n){(n&8)!==0&&(n|=n&32);var s=t.entangledLanes;if(s!==0)for(t=t.entanglements,s&=n;0<s;){var l=31-Te(s),f=1<<l;n|=t[l],s&=~f}return n}function Id(t,n){switch(t){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function wl(){var t=Ua;return Ua<<=1,(Ua&62914560)===0&&(Ua=4194304),t}function $a(t){for(var n=[],s=0;31>s;s++)n.push(t);return n}function Sr(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Ud(t,n,s,l,f,m){var k=t.pendingLanes;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=s,t.entangledLanes&=s,t.errorRecoveryDisabledLanes&=s,t.shellSuspendCounter=0;var _=t.entanglements,I=t.expirationTimes,V=t.hiddenUpdates;for(s=k&~s;0<s;){var J=31-Te(s),oe=1<<J;_[J]=0,I[J]=-1;var G=V[J];if(G!==null)for(V[J]=null,J=0;J<G.length;J++){var X=G[J];X!==null&&(X.lane&=-536870913)}s&=~oe}l!==0&&ec(t,l,0),m!==0&&f===0&&t.tag!==0&&(t.suspendedLanes|=m&~(k&~n))}function ec(t,n,s){t.pendingLanes|=n,t.suspendedLanes&=~n;var l=31-Te(n);t.entangledLanes|=n,t.entanglements[l]=t.entanglements[l]|1073741824|s&261930}function ji(t,n){var s=t.entangledLanes|=n;for(t=t.entanglements;s;){var l=31-Te(s),f=1<<l;f&n|t[l]&n&&(t[l]|=n),s&=~f}}function kl(t,n){var s=n&-n;return s=(s&42)!==0?1:ds(s),(s&(t.suspendedLanes|n))!==0?0:s}function ds(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function Nl(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function tc(){var t=Q.p;return t!==0?t:(t=window.event,t===void 0?32:B0(t.type))}function nc(t,n){var s=Q.p;try{return Q.p=t,n()}finally{Q.p=s}}var Fn=Math.random().toString(36).slice(2),cn="__reactFiber$"+Fn,xe="__reactProps$"+Fn,Le="__reactContainer$"+Fn,ot="__reactEvents$"+Fn,jt="__reactListeners$"+Fn,Vt="__reactHandles$"+Fn,qn="__reactResources$"+Fn,Gn="__reactMarker$"+Fn,da="__reactLoad$"+Fn;function fn(t){delete t[cn],delete t[xe],delete t[jt],delete t[Vt]}function pn(t){var n;if(n=t[cn])return n;for(var s=t.parentNode;s;){if(n=s[Le]||s[cn]){if(s=n.alternate,n.child!==null||s!==null&&s.child!==null)for(t=y0(t);t!==null;){if(s=t[cn])return s;t=y0(t)}return n}t=s,s=t.parentNode}return null}function fa(t){if(t=t[cn]||t[Le]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function Pa(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(r(33))}function pa(t){var n=t[qn];return n||(n=t[qn]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Wt(t){t[Gn]=!0}function ic(t){t[da]=void 0}var ac=new Set,rc={};function di(t,n){ma(t,n),ma(t+"Capture",n)}function ma(t,n){for(rc[t]=n,t=0;t<n.length;t++)ac.add(n[t])}var fi=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),sc={},fs={};function Je(t){return bn.call(fs,t)?!0:bn.call(sc,t)?!1:fi.test(t)?fs[t]=!0:(sc[t]=!0,!1)}var mt=!1;function en(){var t=mt;return mt=!1,t}function yt(t,n,s){if(Je(n))if(s===null)t.removeAttribute(n);else{switch(typeof s){case"undefined":case"function":case"symbol":t.removeAttribute(n);return;case"boolean":var l=n.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){t.removeAttribute(n);return}}t.setAttribute(n,s)}}function ha(t,n,s){if(s===null)t.removeAttribute(n);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttribute(n,s)}}function yn(t,n,s,l){if(l===null)t.removeAttribute(s);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(s);return}t.setAttributeNS(n,s,l)}}function vn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function ps(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function je(t,n,s){var l=Object.getOwnPropertyDescriptor(t.constructor.prototype,n);if(!t.hasOwnProperty(n)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var f=l.get,m=l.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return f.call(this)},set:function(k){s=""+k,m.call(this,k)}}),Object.defineProperty(t,n,{enumerable:l.enumerable}),{getValue:function(){return s},setValue:function(k){s=""+k},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function Ie(t){if(!t._valueTracker){var n=ps(t)?"checked":"value";t._valueTracker=je(t,n,""+t[n])}}function nt(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var s=n.getValue(),l="";return t&&(l=ps(t)?t.checked?"true":"false":t.value),t=l,t!==s?(n.setValue(t),!0):!1}var vt=/[\n"\\]/g;function _t(t){return t.replace(vt,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function ti(t,n,s,l,f,m,k,_){t.name="",k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?t.type=k:t.removeAttribute("type"),n!=null?k==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+vn(n)):t.value!==""+vn(n)&&(t.value=""+vn(n)):k!=="submit"&&k!=="reset"||t.removeAttribute("value"),n!=null?k==="number"&&t.value==n?El(t,vn(t.value)):El(t,vn(n)):s!=null?El(t,vn(s)):l!=null&&t.removeAttribute("value"),f==null&&m!=null&&(t.defaultChecked=!!m),f!=null&&(t.checked=f&&typeof f!="function"&&typeof f!="symbol"),_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?t.name=""+vn(_):t.removeAttribute("name")}function lc(t,n,s,l,f,m,k,_){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(t.type=m),n!=null||s!=null){if(!(m!=="submit"&&m!=="reset"||n!=null)){Ie(t);return}s=s!=null?""+vn(s):"",n=n!=null?""+vn(n):s,_||n===t.value||(t.value=n),t.defaultValue=n}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,t.checked=_?t.checked:!!l,t.defaultChecked=!!l,k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(t.name=k),Ie(t)}function El(t,n){t.defaultValue!==""+n&&(t.defaultValue=""+n)}function ms(t,n,s,l){if(t=t.options,n){n={};for(var f=0;f<s.length;f++)n["$"+s[f]]=!0;for(s=0;s<t.length;s++)f=n.hasOwnProperty("$"+t[s].value),t[s].selected!==f&&(t[s].selected=f),f&&l&&(t[s].defaultSelected=!0)}else{for(s=""+vn(s),n=null,f=0;f<t.length;f++){if(t[f].value===s){t[f].selected=!0,l&&(t[f].defaultSelected=!0);return}n!==null||t[f].disabled||(n=t[f])}n!==null&&(n.selected=!0)}}function Gg(t,n,s){if(n!=null&&(n=""+vn(n),n!==t.value&&(t.value=n),s==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=s!=null?""+vn(s):""}function Yg(t,n,s,l){if(n==null){if(l!=null){if(s!=null)throw Error(r(92));if(Ne(l)){if(1<l.length)throw Error(r(93));l=l[0]}s=l}s==null&&(s=""),n=s}s=vn(n),t.defaultValue=s,l=t.textContent,l===s&&l!==""&&l!==null&&(t.value=l),Ie(t)}function hs(t,n){if(n){var s=t.firstChild;if(s&&s===t.lastChild&&s.nodeType===3){s.nodeValue=n;return}}t.textContent=n}var oE=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Vg(t,n,s){var l=n.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?l?t.setProperty(n,""):n==="float"?t.cssFloat="":t[n]="":l?t.setProperty(n,s):typeof s!="number"||s===0||oE.has(n)?n==="float"?t.cssFloat=s:t[n]=(""+s).trim():t[n]=s+"px"}function Kg(t,n,s){if(n!=null&&typeof n!="object")throw Error(r(62));if(t=t.style,s!=null){for(var l in s)!s.hasOwnProperty(l)||n!=null&&n.hasOwnProperty(l)||(l.indexOf("--")===0?t.setProperty(l,""):l==="float"?t.cssFloat="":t[l]="",mt=!0);for(var f in n)l=n[f],n.hasOwnProperty(f)&&s[f]!==l&&(Vg(t,f,l),mt=!0)}else for(var m in n)n.hasOwnProperty(m)&&Vg(t,m,n[m])}function Bd(t){if(t.indexOf("-")===-1)return!1;switch(t){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 cE=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["maskType","mask-type"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),uE=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function oc(t){return uE.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function qi(){}var $d=null;function Pd(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var gs=null,xs=null;function Xg(t){var n=fa(t);if(n&&(t=n.stateNode)){var s=t[xe]||null;e:switch(t=n.stateNode,n.type){case"input":if(ti(t,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),n=s.name,s.type==="radio"&&n!=null){for(s=t;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+_t(""+n)+'"][type="radio"]'),n=0;n<s.length;n++){var l=s[n];if(l!==t&&l.form===t.form){var f=l[xe]||null;if(!f)throw Error(r(90));ti(l,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(n=0;n<s.length;n++)l=s[n],l.form===t.form&&nt(l)}break e;case"textarea":Gg(t,s.value,s.defaultValue);break e;case"select":n=s.value,n!=null&&ms(t,!!s.multiple,n,!1)}}}var Hd=!1;function Zg(t,n,s){if(Hd)return t(n,s);Hd=!0;try{var l=t(n);return l}finally{if(Hd=!1,(gs!==null||xs!==null)&&(ou(),gs&&(n=gs,t=xs,xs=gs=null,Xg(n),t)))for(n=0;n<t.length;n++)Xg(t[n])}}function _l(t,n){var s=t.stateNode;if(s===null)return null;var l=s[xe]||null;if(l===null)return null;s=l[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(t=t.type,l=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!l;break e;default:t=!1}if(t)return null;if(s&&typeof s!="function")throw Error(r(231,n,typeof s));return s}var ga=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Fd=!1;if(ga)try{var Sl={};Object.defineProperty(Sl,"passive",{get:function(){Fd=!0}}),window.addEventListener("test",Sl,Sl),window.removeEventListener("test",Sl,Sl)}catch{Fd=!1}var Ha=null,qd=null,cc=null;function Qg(){if(cc)return cc;var t,n=qd,s=n.length,l,f="value"in Ha?Ha.value:Ha.textContent,m=f.length;for(t=0;t<s&&n[t]===f[t];t++);var k=s-t;for(l=1;l<=k&&n[s-l]===f[m-l];l++);return cc=f.slice(t,1<l?1-l:void 0)}function uc(t){var n=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&n===13&&(t=13)):t=n,t===10&&(t=13),32<=t||t===13?t:0}function dc(){return!0}function Jg(){return!1}function Ln(t){function n(s,l,f,m,k){this._reactName=s,this._targetInst=f,this.type=l,this.nativeEvent=m,this.target=k,this.currentTarget=null;for(var _ in t)t.hasOwnProperty(_)&&(s=t[_],this[_]=s?s(m):m[_]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?dc:Jg,this.isPropagationStopped=Jg,this}return C(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=dc)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=dc)},persist:function(){},isPersistent:dc}),n}var Fa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},fc=Ln(Fa),Tl=C({},Fa,{view:0,detail:0}),dE=Ln(Tl),Gd,Yd,Cl,pc=C({},Tl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Kd,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Cl&&(Cl&&t.type==="mousemove"?(Gd=t.screenX-Cl.screenX,Yd=t.screenY-Cl.screenY):Yd=Gd=0,Cl=t),Gd)},movementY:function(t){return"movementY"in t?t.movementY:Yd}}),Wg=Ln(pc),fE=C({},pc,{dataTransfer:0}),pE=Ln(fE),mE=C({},Tl,{relatedTarget:0}),Vd=Ln(mE),hE=C({},Fa,{animationName:0,elapsedTime:0,pseudoElement:0}),gE=Ln(hE),xE=C({},Fa,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),bE=Ln(xE),yE=C({},Fa,{data:0}),ex=Ln(yE),vE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},wE={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},kE={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function NE(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=kE[t])?!!n[t]:!1}function Kd(){return NE}var EE=C({},Tl,{key:function(t){if(t.key){var n=vE[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=uc(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?wE[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Kd,charCode:function(t){return t.type==="keypress"?uc(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?uc(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),_E=Ln(EE),SE=C({},pc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),tx=Ln(SE),TE=C({},Fa,{submitter:0}),CE=Ln(TE),jE=C({},Tl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Kd}),AE=Ln(jE),OE=C({},Fa,{propertyName:0,elapsedTime:0,pseudoElement:0}),ME=Ln(OE),RE=C({},pc,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),DE=Ln(RE),zE=C({},Fa,{newState:0,oldState:0,source:0}),LE=Ln(zE),IE=[9,13,27,32],Xd=ga&&"CompositionEvent"in window,jl=null;ga&&"documentMode"in document&&(jl=document.documentMode);var UE=ga&&"TextEvent"in window&&!jl,nx=ga&&(!Xd||jl&&8<jl&&11>=jl),ix=" ",ax=!1;function rx(t,n){switch(t){case"keyup":return IE.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function sx(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var bs=!1;function BE(t,n){switch(t){case"compositionend":return sx(n);case"keypress":return n.which!==32?null:(ax=!0,ix);case"textInput":return t=n.data,t===ix&&ax?null:t;default:return null}}function $E(t,n){if(bs)return t==="compositionend"||!Xd&&rx(t,n)?(t=Qg(),cc=qd=Ha=null,bs=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return nx&&n.locale!=="ko"?null:n.data;default:return null}}var PE={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function lx(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!PE[t.type]:n==="textarea"}function ox(t,n,s,l){gs?xs?xs.push(l):xs=[l]:gs=l,n=mu(n,"onChange"),0<n.length&&(s=new fc("onChange","change",null,s,l),t.push({event:s,listeners:n}))}var Al=null,Ol=null;function HE(t){Xy(t,0)}function mc(t){var n=Pa(t);if(nt(n))return t}function cx(t,n){if(t==="change")return n}var ux=!1;if(ga){var Zd;if(ga){var Qd="oninput"in document;if(!Qd){var dx=document.createElement("div");dx.setAttribute("oninput","return;"),Qd=typeof dx.oninput=="function"}Zd=Qd}else Zd=!1;ux=Zd&&(!document.documentMode||9<document.documentMode)}function fx(){Al&&(Al.detachEvent("onpropertychange",px),Ol=Al=null)}function px(t){if(t.propertyName==="value"&&mc(Ol)){var n=[];ox(n,Ol,t,Pd(t)),Zg(HE,n)}}function FE(t,n,s){t==="focusin"?(fx(),Al=n,Ol=s,Al.attachEvent("onpropertychange",px)):t==="focusout"&&fx()}function qE(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return mc(Ol)}function GE(t,n){if(t==="click")return mc(n)}function YE(t,n){if(t==="input"||t==="change")return mc(n)}function VE(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var ni=typeof Object.is=="function"?Object.is:VE;function Ml(t,n){if(ni(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var s=Object.keys(t),l=Object.keys(n);if(s.length!==l.length)return!1;for(l=0;l<s.length;l++){var f=s[l];if(!bn.call(n,f)||!ni(t[f],n[f]))return!1}return!0}function Jd(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function mx(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function hx(t,n){var s=mx(t);t=0;for(var l;s;){if(s.nodeType===3){if(l=t+s.textContent.length,t<=n&&l>=n)return{node:s,offset:n-t};t=l}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=mx(s)}}function gx(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?gx(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function xx(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=Jd(t.document);n instanceof t.HTMLIFrameElement;){try{var s=typeof n.contentWindow.location.href=="string"}catch{s=!1}if(s)t=n.contentWindow;else break;n=Jd(t.document)}return n}function Wd(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}var KE=ga&&"documentMode"in document&&11>=document.documentMode,ys=null,ef=null,Rl=null,tf=!1;function bx(t,n,s){var l=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;tf||ys==null||ys!==Jd(l)||(l=ys,"selectionStart"in l&&Wd(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Rl&&Ml(Rl,l)||(Rl=l,l=mu(ef,"onSelect"),0<l.length&&(n=new fc("onSelect","select",null,n,s),t.push({event:n,listeners:l}),n.target=ys)))}function Tr(t,n){var s={};return s[t.toLowerCase()]=n.toLowerCase(),s["Webkit"+t]="webkit"+n,s["Moz"+t]="moz"+n,s}var vs={animationend:Tr("Animation","AnimationEnd"),animationiteration:Tr("Animation","AnimationIteration"),animationstart:Tr("Animation","AnimationStart"),transitionrun:Tr("Transition","TransitionRun"),transitionstart:Tr("Transition","TransitionStart"),transitioncancel:Tr("Transition","TransitionCancel"),transitionend:Tr("Transition","TransitionEnd")},nf={},yx={};ga&&(yx=document.createElement("div").style,"AnimationEvent"in window||(delete vs.animationend.animation,delete vs.animationiteration.animation,delete vs.animationstart.animation),"TransitionEvent"in window||delete vs.transitionend.transition);function Cr(t){if(nf[t])return nf[t];if(!vs[t])return t;var n=vs[t],s;for(s in n)if(n.hasOwnProperty(s)&&s in yx)return nf[t]=n[s];return t}var vx=Cr("animationend"),wx=Cr("animationiteration"),kx=Cr("animationstart"),XE=Cr("transitionrun"),ZE=Cr("transitionstart"),QE=Cr("transitioncancel"),Nx=Cr("transitionend"),Ex=new Map,af="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");af.push("scrollEnd");function Ai(t,n){Ex.set(t,n),di(n,[t])}var JE=0;function xa(t,n){if(t.name!=null&&t.name!=="auto")return t.name;if(n.autoName!==null)return n.autoName;t=Di.identifierPrefix;var s=JE++;return t="_"+t+"t_"+s.toString(32)+"_",n.autoName=t}function _x(t){if(t==null||typeof t=="string")return t;var n=null,s=$s;if(s!==null)for(var l=0;l<s.length;l++){var f=t[s[l]];if(f!=null){if(f==="none")return"none";n=n==null?f:n+(" "+f)}}return n??t.default}function ba(t,n){return t=_x(t),n=_x(n),n==null?t==="auto"?null:t:n==="auto"?null:n}var hc=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},pi=[],ws=0,rf=0;function gc(){for(var t=ws,n=rf=ws=0;n<t;){var s=pi[n];pi[n++]=null;var l=pi[n];pi[n++]=null;var f=pi[n];pi[n++]=null;var m=pi[n];if(pi[n++]=null,l!==null&&f!==null){var k=l.pending;k===null?f.next=f:(f.next=k.next,k.next=f),l.pending=f}m!==0&&Sx(s,f,m)}}function xc(t,n,s,l){pi[ws++]=t,pi[ws++]=n,pi[ws++]=s,pi[ws++]=l,rf|=l,t.lanes|=l,t=t.alternate,t!==null&&(t.lanes|=l)}function sf(t,n,s,l){return xc(t,n,s,l),bc(t)}function jr(t,n){return xc(t,null,null,n),bc(t)}function Sx(t,n,s){t.lanes|=s;var l=t.alternate;l!==null&&(l.lanes|=s);for(var f=!1,m=t.return;m!==null;)m.childLanes|=s,l=m.alternate,l!==null&&(l.childLanes|=s),m.tag===22&&(t=m.stateNode,t===null||t._visibility&1||(f=!0)),t=m,m=m.return;return t.tag===3?(m=t.stateNode,f&&n!==null&&(f=31-Te(s),t=m.hiddenUpdates,l=t[f],l===null?t[f]=[n]:l.push(n),n.lane=s|536870912),m):null}function bc(t){if(50<to)throw to=0,lu=null,Error(r(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var ks={};function WE(t,n,s,l){this.tag=t,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Yn(t,n,s,l){return new WE(t,n,s,l)}function lf(t){return t=t.prototype,!(!t||!t.isReactComponent)}function ya(t,n){var s=t.alternate;return s===null?(s=Yn(t.tag,n,t.key,t.mode),s.elementType=t.elementType,s.type=t.type,s.stateNode=t.stateNode,s.alternate=t,t.alternate=s):(s.pendingProps=n,s.type=t.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=t.flags&1206910976,s.childLanes=t.childLanes,s.lanes=t.lanes,s.child=t.child,s.memoizedProps=t.memoizedProps,s.memoizedState=t.memoizedState,s.updateQueue=t.updateQueue,n=t.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},s.sibling=t.sibling,s.index=t.index,s.ref=t.ref,s.refCleanup=t.refCleanup,s}function Tx(t,n){t.flags&=1206910978;var s=t.alternate;return s===null?(t.childLanes=0,t.lanes=n,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=s.childLanes,t.lanes=s.lanes,t.child=s.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=s.memoizedProps,t.memoizedState=s.memoizedState,t.updateQueue=s.updateQueue,t.type=s.type,n=s.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t}function yc(t,n,s,l,f,m){var k=0;if(l=t,typeof l=="function")lf(l)&&(k=1);else if(typeof l=="string")k=TS(t,s,It.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(l){case ve:return t=Yn(31,s,n,f),t.elementType=ve,t.lanes=m,t;case H:return Ar(s.children,f,m,n);case Z:k=8,f|=24;break;case he:return t=Yn(12,s,n,f|2),t.elementType=he,t.lanes=m,t;case ee:return t=Yn(13,s,n,f),t.elementType=ee,t.lanes=m,t;case te:return t=Yn(19,s,n,f),t.elementType=te,t.lanes=m,t;case ce:case U:return t=f|32,t=Yn(30,s,n,t),t.elementType=U,t.lanes=m,t.stateNode={autoName:null,paired:null,clones:null,ref:null},t;default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case ae:k=10;break e;case se:k=9;break e;case O:k=11;break e;case be:k=14;break e;case S:k=16,l=null;break e}k=29,s=Error(r(130,t===null?"null":typeof t,"")),l=null}return n=Yn(k,s,n,f),n.elementType=t,n.type=l,n.lanes=m,n}function Ar(t,n,s,l){return t=Yn(7,t,l,n),t.lanes=s,t}function of(t,n,s){return t=Yn(6,t,null,n),t.lanes=s,t}function Cx(t){var n=Yn(18,null,null,0);return n.stateNode=t,n}function cf(t,n,s){return n=Yn(4,t.children!==null?t.children:[],t.key,n),n.lanes=s,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}var jx=new WeakMap;function mi(t,n){if(typeof t=="object"&&t!==null){var s=jx.get(t);return s!==void 0?s:(n={value:t,source:n,stack:on(n)},jx.set(t,n),n)}return{value:t,source:n,stack:on(n)}}var Ns=[],Es=0,vc=null,Dl=0,hi=[],gi=0,qa=null,Gi=1,Yi="";function va(t,n){Ns[Es++]=Dl,Ns[Es++]=vc,vc=t,Dl=n}function Ax(t,n,s){hi[gi++]=Gi,hi[gi++]=Yi,hi[gi++]=qa,qa=t;var l=Gi;t=Yi;var f=32-Te(l)-1;l&=~(1<<f),s+=1;var m=32-Te(n)+f;if(30<m){var k=f-f%5;m=(l&(1<<k)-1).toString(32),l>>=k,f-=k,Gi=1<<32-Te(n)+f|s<<f|l,Yi=m+t}else Gi=1<<m|s<<f|l,Yi=t}function wc(t){t.return!==null&&(va(t,1),Ax(t,1,0))}function uf(t){for(;t===vc;)vc=Ns[--Es],Ns[Es]=null,Dl=Ns[--Es],Ns[Es]=null;for(;t===qa;)qa=hi[--gi],hi[gi]=null,Yi=hi[--gi],hi[gi]=null,Gi=hi[--gi],hi[gi]=null}function Ox(t,n){hi[gi++]=Gi,hi[gi++]=Yi,hi[gi++]=qa,Gi=n.id,Yi=n.overflow,qa=t}var mn=null,Ut=null,st=!1,Ga=null,xi=!1,df=Error(r(519));function Ya(t){var n=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw zl(mi(n,t)),df}function Mx(t){var n=t.stateNode,s=t.type,l=t.memoizedProps;switch(n[cn]=t,n[xe]=l,s){case"dialog":ut("cancel",n),ut("close",n);break;case"iframe":case"object":case"embed":ut("load",n);break;case"video":case"audio":for(s=0;s<io.length;s++)ut(io[s],n);break;case"source":ut("error",n);break;case"img":case"image":case"link":ut("error",n),ut("load",n);break;case"details":ut("toggle",n);break;case"input":ut("invalid",n),lc(n,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":ut("invalid",n);break;case"textarea":ut("invalid",n),Yg(n,l.value,l.defaultValue,l.children)}s=l.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||n.textContent===""+s||l.suppressHydrationWarning===!0||Wy(n.textContent,s)?(l.popover!=null&&(ut("beforetoggle",n),ut("toggle",n)),l.onScroll!=null&&ut("scroll",n),l.onScrollEnd!=null&&ut("scrollend",n),l.onClick!=null&&(n.onclick=qi),n=!0):n=!1,n||Ya(t,!0)}function kc(t){for(mn=t.return;mn;)switch(mn.tag){case 5:case 31:case 13:xi=!1;return;case 27:case 3:xi=!0;return;default:mn=mn.return}}function _s(t){if(t!==mn)return!1;if(!st)return kc(t),st=!0,!1;var n=t.tag,s;if((s=n!==3&&n!==27)&&((s=n===5)&&(s=t.type,s=!(s!=="form"&&s!=="button")||Pp(t.type,t.memoizedProps)),s=!s),s&&Ut&&Ya(t),kc(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));Ut=b0(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));Ut=b0(t)}else n===27?(n=Ut,or(t.type)?(t=Zp,Zp=null,Ut=t):Ut=n):Ut=mn?yi(t.stateNode.nextSibling):null;return!0}function Or(){Ut=mn=null,st=!1}function ff(){var t=Ga;return t!==null&&(Xn===null?Xn=t:Xn.push.apply(Xn,t),Ga=null),t}function zl(t){Ga===null?Ga=[t]:Ga.push(t)}var pf=Ae(null),Mr=null,wa=null;function Va(t,n,s){Ke(pf,n._currentValue),n._currentValue=s}function ka(t){t._currentValue=pf.current,rt(pf)}function Nc(t,n,s){for(;t!==null;){var l=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,l!==null&&(l.childLanes|=n)):l!==null&&(l.childLanes&n)!==n&&(l.childLanes|=n),t===s)break;t=t.return}}function mf(t,n,s,l){var f=t.child;for(f!==null&&(f.return=t);f!==null;){var m=f.dependencies;if(m!==null){var k=f.child;m=m.firstContext;e:for(;m!==null;){var _=m;m=f;for(var I=0;I<n.length;I++)if(_.context===n[I]){m.lanes|=s,_=m.alternate,_!==null&&(_.lanes|=s),Nc(m.return,s,t),l||(k=null);break e}m=_.next}}else if(f.tag===18){if(k=f.return,k===null)throw Error(r(341));k.lanes|=s,m=k.alternate,m!==null&&(m.lanes|=s),Nc(k,s,t),k=null}else f.tag===13&&f.memoizedState!==null&&f.memoizedState.dehydrated===null?(f.lanes|=s,k=f.alternate,k!==null&&(k.lanes|=s),Nc(f.return,s,t),k=f.child,k=k!==null?k.sibling:null):k=f.child;if(k!==null)k.return=f;else for(k=f;k!==null;){if(k===t){k=null;break}if(f=k.sibling,f!==null){f.return=k.return,k=f;break}k=k.return}f=k}}function Rr(t,n,s,l){t=null;for(var f=n,m=!1;f!==null;){if(!m){if((f.flags&524288)!==0)m=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var k=f.alternate;if(k===null)throw Error(r(387));if(k=k.memoizedProps,k!==null){var _=f.type;ni(f.pendingProps.value,k.value)||(t!==null?t.push(_):t=[_])}}else if(f===fe.current){if(k=f.alternate,k===null)throw Error(r(387));k.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(t!==null?t.push(Zs):t=[Zs])}f=f.return}return t!==null&&mf(n,t,s,l),n.flags|=262144,t!==null}function Ec(t){for(t=t.firstContext;t!==null;){if(!ni(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Dr(t){Mr=t,wa=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function wn(t){return Rx(Mr,t)}function _c(t,n){return Mr===null&&Dr(t),Rx(t,n)}function Rx(t,n){var s=n._currentValue;if(n={context:n,memoizedValue:s,next:null},wa===null){if(t===null)throw Error(r(308));wa=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else wa=wa.next=n;return s}var e_=typeof AbortController<"u"?AbortController:function(){var t=[],n=this.signal={aborted:!1,addEventListener:function(s,l){t.push(l)}};this.abort=function(){n.aborted=!0,t.forEach(function(s){return s()})}},t_=e.unstable_scheduleCallback,n_=e.unstable_NormalPriority,tn={$$typeof:ae,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function hf(){return{controller:new e_,data:new Map,refCount:0}}function Ll(t){t.refCount--,t.refCount===0&&t_(n_,function(){t.controller.abort()})}function Dx(t,n){if((t.pendingLanes&4194048)!==0){var s=t.transitionTypes;for(s===null&&(s=t.transitionTypes=[]),t=0;t<n.length;t++){var l=n[t];s.indexOf(l)===-1&&s.push(l)}}}var Il=null;function i_(t){var n=t.transitionTypes;return t.transitionTypes=null,n}var Ul=null,gf=0,zr=0,Ss=null;function a_(t,n){if(Ul===null){var s=Ul=[];gf=0,zr=Mp(),Ss={status:"pending",value:void 0,then:function(l){s.push(l)}}}return gf++,n.then(zx,zx),n}function zx(){if(--gf===0&&(Il=null,Ul!==null)){Ss!==null&&(Ss.status="fulfilled");var t=Ul;Ul=null,zr=0,Ss=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function r_(t,n){var s=[],l={status:"pending",value:null,reason:null,then:function(f){s.push(f)}};return t.then(function(){l.status="fulfilled",l.value=n;for(var f=0;f<s.length;f++)(0,s[f])(n)},function(f){for(l.status="rejected",l.reason=f,f=0;f<s.length;f++)(0,s[f])(void 0)}),l}var Lx=ye.S;ye.S=function(t,n){if(Cy=Qt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&a_(t,n),Il!==null)for(var s=qs;s!==null;)Dx(s,Il),s=s.next;if(s=t.types,s!==null){for(var l=qs;l!==null;)Dx(l,s),l=l.next;if(zr!==0){l=Il,l===null&&(l=Il=[]);for(var f=0;f<s.length;f++){var m=s[f];l.indexOf(m)===-1&&l.push(m)}}}Lx!==null&&Lx(t,n)};var Lr=Ae(null);function xf(){var t=Lr.current;return t!==null?t:Dt.pooledCache}function Sc(t,n){n===null?Ke(Lr,Lr.current):Ke(Lr,n.pool)}function Ix(){var t=xf();return t===null?null:{parent:tn._currentValue,pool:t}}var Ts=Error(r(460)),bf=Error(r(474)),Tc=Error(r(542)),Cc={then:function(){}};function Ux(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Bx(t,n,s){switch(s=t[s],s===void 0?t.push(n):s!==n&&(n.then(qi,qi),n=s),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,Px(t),t===void 0&&!("reason"in n)?Error(r(600)):t;default:if(typeof n.status=="string")n.then(qi,qi);else{if(t=Dt,t!==null&&100<t.shellSuspendCounter)throw Error(r(482));t=n,t.status="pending",t.then(function(l){if(n.status==="pending"){var f=n;f.status="fulfilled",f.value=l}},function(l){if(n.status==="pending"){var f=n;f.status="rejected",f.reason=l}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,Px(t),t}throw Ur=n,Ts}}function Ir(t){try{var n=t._init;return n(t._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(Ur=s,Ts):s}}var Ur=null;function $x(){if(Ur===null)throw Error(r(459));var t=Ur;return Ur=null,t}function Px(t){if(t===Ts||t===Tc)throw Error(r(483))}var Cs=null,Bl=0;function jc(t){var n=Bl;return Bl+=1,Cs===null&&(Cs=[]),Bx(Cs,t,n)}function Ka(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function Ac(t,n){throw n.$$typeof===L?Error(r(525)):(t=Object.prototype.toString.call(n),Error(r(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)))}function Hx(t){function n(Y,F){if(t){var K=Y.deletions;K===null?(Y.deletions=[F],Y.flags|=16):K.push(F)}}function s(Y,F){if(!t)return null;for(;F!==null;)n(Y,F),F=F.sibling;return null}function l(Y){for(var F=new Map;Y!==null;)Y.key===null?F.set(Y.index,Y):F.set(Y.key,Y),Y=Y.sibling;return F}function f(Y,F){return Y=ya(Y,F),Y.index=0,Y.sibling=null,Y}function m(Y,F,K){return Y.index=K,t?(K=Y.alternate,K!==null?(K=K.index,K<F?(Y.flags|=2,F):K):(Y.flags|=134217730,F)):(Y.flags|=1048576,F)}function k(Y){return t&&Y.alternate===null&&(Y.flags|=134217730),Y}function _(Y,F,K,le){return F===null||F.tag!==6?(F=of(K,Y.mode,le),F.return=Y,F):(F=f(F,K),F.return=Y,F)}function I(Y,F,K,le){var Re=K.type;return Re===H?(Y=J(Y,F,K.props.children,le,K.key),Ka(Y,K),Y):F!==null&&(F.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===S&&Ir(Re)===F.type)?(F=f(F,K.props),Ka(F,K),F.return=Y,F):(F=yc(K.type,K.key,K.props,null,Y.mode,le),Ka(F,K),F.return=Y,F)}function V(Y,F,K,le){return F===null||F.tag!==4||F.stateNode.containerInfo!==K.containerInfo||F.stateNode.implementation!==K.implementation?(F=cf(K,Y.mode,le),F.return=Y,F):(F=f(F,K.children||[]),F.return=Y,F)}function J(Y,F,K,le,Re){return F===null||F.tag!==7?(F=Ar(K,Y.mode,le,Re),F.return=Y,F):(F=f(F,K),F.return=Y,F)}function oe(Y,F,K){if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return F=of(""+F,Y.mode,K),F.return=Y,F;if(typeof F=="object"&&F!==null){switch(F.$$typeof){case q:return K=yc(F.type,F.key,F.props,null,Y.mode,K),Ka(K,F),K.return=Y,K;case M:return F=cf(F,Y.mode,K),F.return=Y,F;case S:return F=Ir(F),oe(Y,F,K)}if(Ne(F)||_e(F))return F=Ar(F,Y.mode,K,null),F.return=Y,F;if(typeof F.then=="function")return oe(Y,jc(F),K);if(F.$$typeof===ae)return oe(Y,_c(Y,F),K);Ac(Y,F)}return null}function G(Y,F,K,le){var Re=F!==null?F.key:null;if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return Re!==null?null:_(Y,F,""+K,le);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case q:return K.key===Re?I(Y,F,K,le):null;case M:return K.key===Re?V(Y,F,K,le):null;case S:return K=Ir(K),G(Y,F,K,le)}if(Ne(K)||_e(K))return Re!==null?null:J(Y,F,K,le,null);if(typeof K.then=="function")return G(Y,F,jc(K),le);if(K.$$typeof===ae)return G(Y,F,_c(Y,K),le);Ac(Y,K)}return null}function X(Y,F,K,le,Re){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return Y=Y.get(K)||null,_(F,Y,""+le,Re);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case q:return Y=Y.get(le.key===null?K:le.key)||null,I(F,Y,le,Re);case M:return Y=Y.get(le.key===null?K:le.key)||null,V(F,Y,le,Re);case S:return le=Ir(le),X(Y,F,K,le,Re)}if(Ne(le)||_e(le))return Y=Y.get(K)||null,J(F,Y,le,Re,null);if(typeof le.then=="function")return X(Y,F,K,jc(le),Re);if(le.$$typeof===ae)return X(Y,F,K,_c(F,le),Re);Ac(F,le)}return null}function Se(Y,F,K,le){for(var Re=null,ft=null,$e=F,qe=F=0,rn=null;$e!==null&&qe<K.length;qe++){$e.index>qe?(rn=$e,$e=null):rn=$e.sibling;var gt=G(Y,$e,K[qe],le);if(gt===null){$e===null&&($e=rn);break}t&&$e&>.alternate===null&&n(Y,$e),F=m(gt,F,qe),ft===null?Re=gt:ft.sibling=gt,ft=gt,$e=rn}if(qe===K.length)return s(Y,$e),st&&va(Y,qe),Re;if($e===null){for(;qe<K.length;qe++)$e=oe(Y,K[qe],le),$e!==null&&(F=m($e,F,qe),ft===null?Re=$e:ft.sibling=$e,ft=$e);return st&&va(Y,qe),Re}for($e=l($e);qe<K.length;qe++)rn=X($e,Y,qe,K[qe],le),rn!==null&&(t&&(gt=rn.alternate,gt!==null&&$e.delete(gt.key===null?qe:gt.key)),F=m(rn,F,qe),ft===null?Re=rn:ft.sibling=rn,ft=rn);return t&&$e.forEach(function(pr){return n(Y,pr)}),st&&va(Y,qe),Re}function ze(Y,F,K,le){if(K==null)throw Error(r(151));for(var Re=null,ft=null,$e=F,qe=F=0,rn=null,gt=K.next();$e!==null&&!gt.done;qe++,gt=K.next()){$e.index>qe?(rn=$e,$e=null):rn=$e.sibling;var pr=G(Y,$e,gt.value,le);if(pr===null){$e===null&&($e=rn);break}t&&$e&&pr.alternate===null&&n(Y,$e),F=m(pr,F,qe),ft===null?Re=pr:ft.sibling=pr,ft=pr,$e=rn}if(gt.done)return s(Y,$e),st&&va(Y,qe),Re;if($e===null){for(;!gt.done;qe++,gt=K.next())gt=oe(Y,gt.value,le),gt!==null&&(F=m(gt,F,qe),ft===null?Re=gt:ft.sibling=gt,ft=gt);return st&&va(Y,qe),Re}for($e=l($e);!gt.done;qe++,gt=K.next())gt=X($e,Y,qe,gt.value,le),gt!==null&&(t&&(rn=gt.alternate,rn!==null&&$e.delete(rn.key===null?qe:rn.key)),F=m(gt,F,qe),ft===null?Re=gt:ft.sibling=gt,ft=gt);return t&&$e.forEach(function(BS){return n(Y,BS)}),st&&va(Y,qe),Re}function at(Y,F,K,le){if(typeof K=="object"&&K!==null&&K.type===H&&K.key===null&&K.props.ref===void 0&&(K=K.props.children),typeof K=="object"&&K!==null){switch(K.$$typeof){case q:e:{for(var Re=K.key;F!==null;){if(F.key===Re){if(Re=K.type,Re===H){if(F.tag===7){s(Y,F.sibling),le=f(F,K.props.children),Ka(le,K),le.return=Y,Y=le;break e}}else if(F.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===S&&Ir(Re)===F.type){s(Y,F.sibling),le=f(F,K.props),Ka(le,K),le.return=Y,Y=le;break e}s(Y,F);break}else n(Y,F);F=F.sibling}K.type===H?(le=Ar(K.props.children,Y.mode,le,K.key),Ka(le,K),le.return=Y,Y=le):(le=yc(K.type,K.key,K.props,null,Y.mode,le),Ka(le,K),le.return=Y,Y=le)}return k(Y);case M:e:{for(Re=K.key;F!==null;){if(F.key===Re)if(F.tag===4&&F.stateNode.containerInfo===K.containerInfo&&F.stateNode.implementation===K.implementation){s(Y,F.sibling),le=f(F,K.children||[]),le.return=Y,Y=le;break e}else{s(Y,F);break}else n(Y,F);F=F.sibling}le=cf(K,Y.mode,le),le.return=Y,Y=le}return k(Y);case S:return K=Ir(K),at(Y,F,K,le)}if(Ne(K))return Se(Y,F,K,le);if(_e(K)){if(Re=_e(K),typeof Re!="function")throw Error(r(150));return K=Re.call(K),ze(Y,F,K,le)}if(typeof K.then=="function")return at(Y,F,jc(K),le);if(K.$$typeof===ae)return at(Y,F,_c(Y,K),le);Ac(Y,K)}return typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint"?(K=""+K,F!==null&&F.tag===6?(s(Y,F.sibling),le=f(F,K),le.return=Y,Y=le):(s(Y,F),le=of(K,Y.mode,le),le.return=Y,Y=le),k(Y)):s(Y,F)}return function(Y,F,K,le){try{Bl=0;var Re=at(Y,F,K,le);return Cs=null,Re}catch($e){if($e===Ts||$e===Tc)throw $e;var ft=Yn(29,$e,null,Y.mode);return ft.lanes=le,ft.return=Y,ft}}}var Br=Hx(!0),Fx=Hx(!1),Xa=!1;function yf(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function vf(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Za(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Qa(t,n,s){var l=t.updateQueue;if(l===null)return null;if(l=l.shared,(wt&2)!==0){var f=l.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),l.pending=n,n=bc(t),Sx(t,null,s),n}return xc(t,l,n,s),bc(t)}function $l(t,n,s){if(n=n.updateQueue,n!==null&&(n=n.shared,(s&4194048)!==0)){var l=n.lanes;l&=t.pendingLanes,s|=l,n.lanes=s,ji(t,s)}}function wf(t,n){var s=t.updateQueue,l=t.alternate;if(l!==null&&(l=l.updateQueue,s===l)){var f=null,m=null;if(s=s.firstBaseUpdate,s!==null){do{var k={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};m===null?f=m=k:m=m.next=k,s=s.next}while(s!==null);m===null?f=m=n:m=m.next=n}else f=m=n;s={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:m,shared:l.shared,callbacks:l.callbacks},t.updateQueue=s;return}t=s.lastBaseUpdate,t===null?s.firstBaseUpdate=n:t.next=n,s.lastBaseUpdate=n}var kf=!1;function Pl(){if(kf){var t=Ss;if(t!==null)throw t}}function Hl(t,n,s,l){kf=!1;var f=t.updateQueue;Xa=!1;var m=f.firstBaseUpdate,k=f.lastBaseUpdate,_=f.shared.pending;if(_!==null){f.shared.pending=null;var I=_,V=I.next;I.next=null,k===null?m=V:k.next=V,k=I;var J=t.alternate;J!==null&&(J=J.updateQueue,_=J.lastBaseUpdate,_!==k&&(_===null?J.firstBaseUpdate=V:_.next=V,J.lastBaseUpdate=I))}if(m!==null){var oe=f.baseState;k=0,J=V=I=null,_=m;do{var G=_.lane&-536870913,X=G!==_.lane;if(X?(dt&G)===G:(l&G)===G){G!==0&&G===zr&&(kf=!0),J!==null&&(J=J.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var Se=t,ze=_;G=n;var at=s;switch(ze.tag){case 1:if(Se=ze.payload,typeof Se=="function"){oe=Se.call(at,oe,G);break e}oe=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=ze.payload,G=typeof Se=="function"?Se.call(at,oe,G):Se,G==null)break e;oe=C({},oe,G);break e;case 2:Xa=!0}}G=_.callback,G!==null&&(t.flags|=64,X&&(t.flags|=8192),X=f.callbacks,X===null?f.callbacks=[G]:X.push(G))}else X={lane:G,tag:_.tag,payload:_.payload,callback:_.callback,next:null},J===null?(V=J=X,I=oe):J=J.next=X,k|=G;if(_=_.next,_===null){if(_=f.shared.pending,_===null)break;X=_,_=X.next,X.next=null,f.lastBaseUpdate=X,f.shared.pending=null}}while(!0);J===null&&(I=oe),f.baseState=I,f.firstBaseUpdate=V,f.lastBaseUpdate=J,m===null&&(f.shared.lanes=0),ar|=k,t.lanes=k,t.memoizedState=oe}}function qx(t,n){if(typeof t!="function")throw Error(r(191,t));t.call(n)}function Gx(t,n){var s=t.callbacks;if(s!==null)for(t.callbacks=null,t=0;t<s.length;t++)qx(s[t],n)}var Ja=Ae(null),Oc=Ae(0);function Yx(t,n){t=Ta,Ke(Oc,t),Ke(Ja,n),Ta=t|n.baseLanes}function Nf(){Ke(Oc,Ta),Ke(Ja,Ja.current)}function Ef(){Ta=Oc.current,rt(Ja),rt(Oc)}var kn=Ae(null),An=null;function Wa(t){var n=t.alternate;Ke(Nn,Nn.current&1),Ke(kn,t),An===null&&(n===null||Ja.current!==null||n.memoizedState!==null)&&(An=t)}function _f(t){Ke(Nn,Nn.current),Ke(kn,t),An===null&&(An=t)}function Vx(t){t.tag===22?(Ke(Nn,Nn.current),Ke(kn,t),An===null&&(An=t)):er()}function er(){Ke(Nn,Nn.current),Ke(kn,kn.current)}function ii(t){rt(kn),An===t&&(An=null),rt(Nn)}var Nn=Ae(0);function Fl(t,n){Ke(kn,kn.current),Ke(Nn,n)}function Sf(t){rt(Nn),rt(kn),An===t&&(An=null)}function Mc(t){for(var n=t;n!==null;){if(n.tag===13){var s=n.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||Kp(s)||Xp(s)))return n}else if(n.tag===19&&n.memoizedProps.revealOrder!=="independent"){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Na=0,it=null,At=null,nn=null,Rc=!1,js=!1,$r=!1,Dc=0,ql=0,As=null,s_=0;function qt(){throw Error(r(321))}function Tf(t,n){if(n===null)return!1;for(var s=0;s<n.length&&s<t.length;s++)if(!ni(t[s],n[s]))return!1;return!0}function Cf(t,n,s,l,f,m){return Na=m,it=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,ye.H=t===null||t.memoizedState===null?Ab:Ob,$r=!1,m=s(l,f),$r=!1,js&&(m=Xx(n,s,l,f)),Kx(t),m}function Kx(t){ye.H=Pc;var n=At!==null&&At.next!==null;if(Na=0,nn=At=it=null,Rc=!1,ql=0,As=null,n)throw Error(r(300));t===null||an||(t=t.dependencies,t!==null&&Ec(t)&&(an=!0))}function Xx(t,n,s,l){it=t;var f=0;do{if(js&&(As=null),ql=0,js=!1,25<=f)throw Error(r(301));if(f+=1,nn=At=null,t.updateQueue!=null){var m=t.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}ye.H=m_,m=n(s,l)}while(js);return m}function l_(){var t=ye.H,n=t.useState()[0];return n=typeof n.then=="function"?Gl(n):n,t=t.useState()[0],(At!==null?At.memoizedState:null)!==t&&(it.flags|=1024),n}function jf(){var t=Dc!==0;return Dc=0,t}function Af(t,n,s){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~s}function Of(t){if(Rc){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}Rc=!1}Na=0,nn=At=it=null,js=!1,ql=Dc=0,As=null}function In(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return nn===null?it.memoizedState=nn=t:nn=nn.next=t,nn}function Kt(){if(At===null){var t=it.alternate;t=t!==null?t.memoizedState:null}else t=At.next;var n=nn===null?it.memoizedState:nn.next;if(n!==null)nn=n,At=t;else{if(t===null)throw it.alternate===null?Error(r(467)):Error(r(310));At=t,t={memoizedState:At.memoizedState,baseState:At.baseState,baseQueue:At.baseQueue,queue:At.queue,next:null},nn===null?it.memoizedState=nn=t:nn=nn.next=t}return nn}function zc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Gl(t){var n=ql;return ql+=1,As===null&&(As=[]),t=Bx(As,t,n),n=it,(nn===null?n.memoizedState:nn.next)===null&&(n=n.alternate,ye.H=n===null||n.memoizedState===null?Ab:Ob),t}function Lc(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Gl(t);if(t.$$typeof===re)return;if(t.$$typeof===ae)return wn(t)}throw Error(r(438,String(t)))}function Mf(t){var n=null,s=it.updateQueue;if(s!==null&&(n=s.memoCache),n==null){var l=it.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(n={data:l.data.map(function(f){return f.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),s===null&&(s=zc(),it.updateQueue=s),s.memoCache=n,s=n.data[n.index],s===void 0)for(s=n.data[n.index]=Array(t),l=0;l<t;l++)s[l]=D;return n.index++,s}function Ea(t,n){return typeof n=="function"?n(t):n}function Ic(t){var n=Kt();return Rf(n,At,t)}function Rf(t,n,s){var l=t.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=s;var f=t.baseQueue,m=l.pending;if(m!==null){if(f!==null){var k=f.next;f.next=m.next,m.next=k}n.baseQueue=f=m,l.pending=null}if(m=t.baseState,f===null)t.memoizedState=m;else{n=f.next;var _=k=null,I=null,V=n,J=!1;do{var oe=V.lane&-536870913;if(oe!==V.lane?(dt&oe)===oe:(Na&oe)===oe){var G=V.revertLane;if(G===0)I!==null&&(I=I.next={lane:0,revertLane:0,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null}),oe===zr&&(J=!0);else if((Na&G)===G){V=V.next,G===zr&&(J=!0);continue}else oe={lane:0,revertLane:V.revertLane,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},I===null?(_=I=oe,k=m):I=I.next=oe,it.lanes|=G,ar|=G;oe=V.action,$r&&s(m,oe),m=V.hasEagerState?V.eagerState:s(m,oe)}else G={lane:oe,revertLane:V.revertLane,gesture:V.gesture,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},I===null?(_=I=G,k=m):I=I.next=G,it.lanes|=oe,ar|=oe;V=V.next}while(V!==null&&V!==n);if(I===null?k=m:I.next=_,!ni(m,t.memoizedState)&&(an=!0,J&&(s=Ss,s!==null)))throw s;t.memoizedState=m,t.baseState=k,t.baseQueue=I,l.lastRenderedState=m}return f===null&&(l.lanes=0),[t.memoizedState,l.dispatch]}function Df(t){var n=Kt(),s=n.queue;if(s===null)throw Error(r(311));s.lastRenderedReducer=t;var l=s.dispatch,f=s.pending,m=n.memoizedState;if(f!==null){s.pending=null;var k=f=f.next;do m=t(m,k.action),k=k.next;while(k!==f);ni(m,n.memoizedState)||(an=!0),n.memoizedState=m,n.baseQueue===null&&(n.baseState=m),s.lastRenderedState=m}return[m,l]}function Zx(t,n,s){var l=it,f=Kt(),m=st;if(m){if(s===void 0)throw Error(r(407));s=s()}else s=n();var k=!ni((At||f).memoizedState,s);if(k&&(f.memoizedState=s,an=!0),f=f.queue,If(Wx.bind(null,l,f,t),[t]),t=f.getSnapshot!==n||k||nn!==null&&(nn.memoizedState.tag&1)!==0,Os(t?9:8,{destroy:void 0},Jx.bind(null,l,f,s,n),null),t){if(l.flags|=2048,Dt===null)throw Error(r(349));m||(Na&127)!==0||Qx(l,n,s)}return s}function Qx(t,n,s){t.flags|=16384,t={getSnapshot:n,value:s},n=it.updateQueue,n===null?(n=zc(),it.updateQueue=n,n.stores=[t]):(s=n.stores,s===null?n.stores=[t]:s.push(t))}function Jx(t,n,s,l){n.value=s,n.getSnapshot=l,eb(n)&&tb(t)}function Wx(t,n,s){return s(function(){eb(n)&&tb(t)})}function eb(t){var n=t.getSnapshot;t=t.value;try{var s=n();return!ni(t,s)}catch{return!0}}function tb(t){var n=jr(t,2);n!==null&&Zn(n,t,2)}function zf(t){var n=In();if(typeof t=="function"){var s=t;if(t=s(),$r){Oe(!0);try{s()}finally{Oe(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ea,lastRenderedState:t},n}function nb(t,n,s,l){return t.baseState=s,Rf(t,At,typeof l=="function"?l:Ea)}function o_(t,n,s,l,f){if($c(t))throw Error(r(485));if(t=n.action,t!==null){var m={payload:f,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(k){m.listeners.push(k)}};ye.T!==null?s(!0):m.isTransition=!1,l(m),s=n.pending,s===null?(m.next=n.pending=m,ib(n,m)):(m.next=s.next,n.pending=s.next=m)}}function ib(t,n){var s=n.action,l=n.payload,f=t.state;if(n.isTransition){var m=ye.T,k={};k.types=m!==null?m.types:null,ye.T=k;try{var _=s(f,l),I=ye.S;I!==null&&I(k,_),ab(t,n,_)}catch(V){Lf(t,n,V)}finally{m!==null&&k.types!==null&&(m.types=k.types),ye.T=m}}else try{m=s(f,l),ab(t,n,m)}catch(V){Lf(t,n,V)}}function ab(t,n,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(l){rb(t,n,l)},function(l){return Lf(t,n,l)}):rb(t,n,s)}function rb(t,n,s){n.status="fulfilled",n.value=s,sb(n),t.state=s,n=t.pending,n!==null&&(s=n.next,s===n?t.pending=null:(s=s.next,n.next=s,ib(t,s)))}function Lf(t,n,s){var l=t.pending;if(t.pending=null,l!==null){l=l.next;do n.status="rejected",n.reason=s,sb(n),n=n.next;while(n!==l)}t.action=null}function sb(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function lb(t,n){return n}function ob(t,n){if(st){var s=Dt.formState;if(s!==null){e:{var l=it;if(st){if(Ut){t:{for(var f=Ut,m=xi;f.nodeType!==8;){if(!m){f=null;break t}if(f=yi(f.nextSibling),f===null){f=null;break t}}m=f.data,f=m==="F!"||m==="F"?f:null}if(f){Ut=yi(f.nextSibling),l=f.data==="F!";break e}}Ya(l)}l=!1}l&&(n=s[0])}}return s=In(),s.memoizedState=s.baseState=n,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:lb,lastRenderedState:n},s.queue=l,s=Tb.bind(null,it,l),l.dispatch=s,l=zf(!1),m=Hf.bind(null,it,!1,l.queue),l=In(),f={state:n,dispatch:null,action:t,pending:null},l.queue=f,s=o_.bind(null,it,f,m,s),f.dispatch=s,l.memoizedState=t,[n,s,!1]}function cb(t){var n=Kt();return ub(n,At,t)}function ub(t,n,s){if(n=Rf(t,n,lb)[0],t=Ic(Ea)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var l=Gl(n)}catch(k){throw k===Ts?Tc:k}else l=n;n=Kt();var f=n.queue,m=f.dispatch;return s!==n.memoizedState&&(it.flags|=2048,Os(9,{destroy:void 0},c_.bind(null,f,s),null)),[l,m,t]}function c_(t,n){t.action=n}function db(t){var n=Kt(),s=At;if(s!==null)return ub(n,s,t);Kt(),n=n.memoizedState,s=Kt();var l=s.queue.dispatch;return s.memoizedState=t,[n,l,!1]}function Os(t,n,s,l){return t={tag:t,create:s,deps:l,inst:n,next:null},n=it.updateQueue,n===null&&(n=zc(),it.updateQueue=n),s=n.lastEffect,s===null?n.lastEffect=t.next=t:(l=s.next,s.next=t,t.next=l,n.lastEffect=t),t}function fb(){return Kt().memoizedState}function Uc(t,n,s,l){var f=In();it.flags|=t,f.memoizedState=Os(1|n,{destroy:void 0},s,l===void 0?null:l)}function Bc(t,n,s,l){var f=Kt();l=l===void 0?null:l;var m=f.memoizedState.inst;At!==null&&l!==null&&Tf(l,At.memoizedState.deps)?f.memoizedState=Os(n,m,s,l):(it.flags|=t,f.memoizedState=Os(1|n,m,s,l))}function pb(t,n){Uc(8390656,8,t,n)}function If(t,n){Bc(2048,8,t,n)}function u_(t){it.flags|=4;var n=it.updateQueue;if(n===null)n=zc(),it.updateQueue=n,n.events=[t];else{var s=n.events;s===null?n.events=[t]:s.push(t)}}function mb(t){var n=Kt().memoizedState;return u_({ref:n,nextImpl:t}),function(){if((wt&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}function hb(t,n){return Bc(4,2,t,n)}function gb(t,n){return Bc(4,4,t,n)}function xb(t,n){if(typeof n=="function"){t=t();var s=n(t);return function(){typeof s=="function"?s():n(null)}}if(n!=null)return t=t(),n.current=t,function(){n.current=null}}function bb(t,n,s){s=s!=null?s.concat([t]):null,Bc(4,4,xb.bind(null,n,t),s)}function Uf(){}function yb(t,n){var s=Kt();n=n===void 0?null:n;var l=s.memoizedState;return n!==null&&Tf(n,l[1])?l[0]:(s.memoizedState=[t,n],t)}function vb(t,n){var s=Kt();n=n===void 0?null:n;var l=s.memoizedState;if(n!==null&&Tf(n,l[1]))return l[0];if(l=t(),$r){Oe(!0);try{t()}finally{Oe(!1)}}return s.memoizedState=[l,n],l}function Bf(t,n,s){return s===void 0||(Na&1073741824)!==0&&(dt&261930)===0?t.memoizedState=n:(t.memoizedState=s,t=Ay(),it.lanes|=t,ar|=t,s)}function wb(t,n,s,l){return ni(s,n)?s:Ja.current!==null?(t=Bf(t,s,l),ni(t,n)||(an=!0),t):(Na&106)===0||(Na&1073741824)!==0&&(dt&261930)===0?(an=!0,t.memoizedState=s):(t=Ay(),it.lanes|=t,ar|=t,n)}function kb(t,n,s,l,f){var m=Q.p;Q.p=m!==0&&8>m?m:8;var k=ye.T,_={};_.types=k!==null?k.types:null,ye.T=_,Hf(t,!1,n,s);try{var I=f(),V=ye.S;if(V!==null&&V(_,I),I!==null&&typeof I=="object"&&typeof I.then=="function"){var J=r_(I,l);Yl(t,n,J,li(t))}else Yl(t,n,l,li(t))}catch(oe){Yl(t,n,{then:function(){},status:"rejected",reason:oe},li())}finally{Q.p=m,k!==null&&_.types!==null&&(k.types=_.types),ye.T=k}}function d_(){}function $f(t,n,s,l){if(t.tag!==5)throw Error(r(476));var f=Nb(t).queue;kb(t,f,n,Pe,s===null?d_:function(){return Eb(t),s(l)})}function Nb(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:Pe,baseState:Pe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ea,lastRenderedState:Pe},next:null};var s={};return n.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ea,lastRenderedState:s},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function Eb(t){var n=Nb(t);n.next===null&&(n=t.alternate.memoizedState),Yl(t,n.next.queue,{},li())}function Pf(){return wn(Zs)}function _b(){return Kt().memoizedState}function Sb(){return Kt().memoizedState}function f_(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var s=li();t=Za(s);var l=Qa(n,t,s);l!==null&&(Zn(l,n,s),$l(l,n,s)),n={cache:hf()},t.payload=n;return}n=n.return}}function p_(t,n,s){var l=li();s={lane:l,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},$c(t)?Cb(n,s):(s=sf(t,n,s,l),s!==null&&(Zn(s,t,l),jb(s,n,l)))}function Tb(t,n,s){var l=li();Yl(t,n,s,l)}function Yl(t,n,s,l){var f={lane:l,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if($c(t))Cb(n,f);else{var m=t.alternate;if(t.lanes===0&&(m===null||m.lanes===0)&&(m=n.lastRenderedReducer,m!==null))try{var k=n.lastRenderedState,_=m(k,s);if(f.hasEagerState=!0,f.eagerState=_,ni(_,k))return xc(t,n,f,0),Dt===null&&gc(),!1}catch{}if(s=sf(t,n,f,l),s!==null)return Zn(s,t,l),jb(s,n,l),!0}return!1}function Hf(t,n,s,l){if(l={lane:2,revertLane:Mp(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},$c(t)){if(n)throw Error(r(479))}else n=sf(t,s,l,2),n!==null&&Zn(n,t,2)}function $c(t){var n=t.alternate;return t===it||n!==null&&n===it}function Cb(t,n){js=Rc=!0;var s=t.pending;s===null?n.next=n:(n.next=s.next,s.next=n),t.pending=n}function jb(t,n,s){if((s&4194048)!==0){var l=n.lanes;l&=t.pendingLanes,s|=l,n.lanes=s,ji(t,s)}}var Pc={readContext:wn,use:Lc,useCallback:qt,useContext:qt,useEffect:qt,useImperativeHandle:qt,useLayoutEffect:qt,useInsertionEffect:qt,useMemo:qt,useReducer:qt,useRef:qt,useState:qt,useDebugValue:qt,useDeferredValue:qt,useTransition:qt,useSyncExternalStore:qt,useId:qt,useHostTransitionStatus:qt,useFormState:qt,useActionState:qt,useOptimistic:qt,useMemoCache:qt,useCacheRefresh:qt,useEffectEvent:qt},Ab={readContext:wn,use:Lc,useCallback:function(t,n){return In().memoizedState=[t,n===void 0?null:n],t},useContext:wn,useEffect:pb,useImperativeHandle:function(t,n,s){s=s!=null?s.concat([t]):null,Uc(4194308,4,xb.bind(null,n,t),s)},useLayoutEffect:function(t,n){return Uc(4194308,4,t,n)},useInsertionEffect:function(t,n){Uc(4,2,t,n)},useMemo:function(t,n){var s=In();n=n===void 0?null:n;var l=t();if($r){Oe(!0);try{t()}finally{Oe(!1)}}return s.memoizedState=[l,n],l},useReducer:function(t,n,s){var l=In();if(s!==void 0){var f=s(n);if($r){Oe(!0);try{s(n)}finally{Oe(!1)}}}else f=n;return l.memoizedState=l.baseState=f,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:f},l.queue=t,t=t.dispatch=p_.bind(null,it,t),[l.memoizedState,t]},useRef:function(t){var n=In();return t={current:t},n.memoizedState=t},useState:function(t){t=zf(t);var n=t.queue,s=Tb.bind(null,it,n);return n.dispatch=s,[t.memoizedState,s]},useDebugValue:Uf,useDeferredValue:function(t,n){var s=In();return Bf(s,t,n)},useTransition:function(){var t=zf(!1);return t=kb.bind(null,it,t.queue,!0,!1),In().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,s){var l=it,f=In();if(st){if(s===void 0)throw Error(r(407));s=s()}else{if(s=n(),Dt===null)throw Error(r(349));(dt&127)!==0||Qx(l,n,s)}f.memoizedState=s;var m={value:s,getSnapshot:n};return f.queue=m,pb(Wx.bind(null,l,m,t),[t]),l.flags|=2048,Os(9,{destroy:void 0},Jx.bind(null,l,m,s,n),null),s},useId:function(){var t=In(),n=Dt.identifierPrefix;if(st){var s=Yi,l=Gi;s=(l&~(1<<32-Te(l)-1)).toString(32)+s,n="_"+n+"R_"+s,s=Dc++,0<s&&(n+="H"+s.toString(32)),n+="_"}else s=s_++,n="_"+n+"r_"+s.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:Pf,useFormState:ob,useActionState:ob,useOptimistic:function(t){var n=In();n.memoizedState=n.baseState=t;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=s,n=Hf.bind(null,it,!0,s),s.dispatch=n,[t,n]},useMemoCache:Mf,useCacheRefresh:function(){return In().memoizedState=f_.bind(null,it)},useEffectEvent:function(t){var n=In(),s={impl:t};return n.memoizedState=s,function(){if((wt&2)!==0)throw Error(r(440));return s.impl.apply(void 0,arguments)}}},Ob={readContext:wn,use:Lc,useCallback:yb,useContext:wn,useEffect:If,useImperativeHandle:bb,useInsertionEffect:hb,useLayoutEffect:gb,useMemo:vb,useReducer:Ic,useRef:fb,useState:function(){return Ic(Ea)},useDebugValue:Uf,useDeferredValue:function(t,n){var s=Kt();return wb(s,At.memoizedState,t,n)},useTransition:function(){var t=Ic(Ea)[0],n=Kt().memoizedState;return[typeof t=="boolean"?t:Gl(t),n]},useSyncExternalStore:Zx,useId:_b,useHostTransitionStatus:Pf,useFormState:cb,useActionState:cb,useOptimistic:function(t,n){var s=Kt();return nb(s,At,t,n)},useMemoCache:Mf,useCacheRefresh:Sb,useEffectEvent:mb},m_={readContext:wn,use:Lc,useCallback:yb,useContext:wn,useEffect:If,useImperativeHandle:bb,useInsertionEffect:hb,useLayoutEffect:gb,useMemo:vb,useReducer:Df,useRef:fb,useState:function(){return Df(Ea)},useDebugValue:Uf,useDeferredValue:function(t,n){var s=Kt();return At===null?Bf(s,t,n):wb(s,At.memoizedState,t,n)},useTransition:function(){var t=Df(Ea)[0],n=Kt().memoizedState;return[typeof t=="boolean"?t:Gl(t),n]},useSyncExternalStore:Zx,useId:_b,useHostTransitionStatus:Pf,useFormState:db,useActionState:db,useOptimistic:function(t,n){var s=Kt();return At!==null?nb(s,At,t,n):(s.baseState=t,[t,s.queue.dispatch])},useMemoCache:Mf,useCacheRefresh:Sb,useEffectEvent:mb};function Ff(t,n,s,l){n=t.memoizedState,s=s(l,n),s=s==null?n:C({},n,s),t.memoizedState=s,t.lanes===0&&(t.updateQueue.baseState=s)}var qf={enqueueSetState:function(t,n,s){t=t._reactInternals;var l=li(),f=Za(l);f.payload=n,s!=null&&(f.callback=s),n=Qa(t,f,l),n!==null&&(Zn(n,t,l),$l(n,t,l))},enqueueReplaceState:function(t,n,s){t=t._reactInternals;var l=li(),f=Za(l);f.tag=1,f.payload=n,s!=null&&(f.callback=s),n=Qa(t,f,l),n!==null&&(Zn(n,t,l),$l(n,t,l))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var s=li(),l=Za(s);l.tag=2,n!=null&&(l.callback=n),n=Qa(t,l,s),n!==null&&(Zn(n,t,s),$l(n,t,s))}};function Mb(t,n,s,l,f,m,k){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(l,m,k):n.prototype&&n.prototype.isPureReactComponent?!Ml(s,l)||!Ml(f,m):!0}function Rb(t,n,s,l){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(s,l),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(s,l),n.state!==t&&qf.enqueueReplaceState(n,n.state,null)}function Pr(t,n){var s=n;if("ref"in n){s={};for(var l in n)l!=="ref"&&(s[l]=n[l])}if(t=t.defaultProps){s===n&&(s=C({},s));for(var f in t)s[f]===void 0&&(s[f]=t[f])}return s}function Db(t){hc(t)}function zb(t){console.error(t)}function Lb(t){hc(t)}function Hc(t,n){try{var s=t.onUncaughtError;s(n.value,{componentStack:n.stack})}catch(l){setTimeout(function(){throw l})}}function Ib(t,n,s){try{var l=t.onCaughtError;l(s.value,{componentStack:s.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Gf(t,n,s){return s=Za(s),s.tag=3,s.payload={element:null},s.callback=function(){Hc(t,n)},s}function Ub(t){return t=Za(t),t.tag=3,t}function Bb(t,n,s,l){var f=s.type.getDerivedStateFromError;if(typeof f=="function"){var m=l.value;t.payload=function(){return f(m)},t.callback=function(){Ib(n,s,l)}}var k=s.stateNode;k!==null&&typeof k.componentDidCatch=="function"&&(t.callback=function(){Ib(n,s,l),typeof f!="function"&&(rr===null?rr=new Set([this]):rr.add(this));var _=l.stack;this.componentDidCatch(l.value,{componentStack:_!==null?_:""})})}function h_(t,n,s,l,f){if(s.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(n=s.alternate,n!==null&&Rr(n,s,f,!0),s=kn.current,s!==null){switch(s.tag){case 31:case 13:case 19:return An===null?cu():s.alternate===null&&Gt===0&&(Gt=3),s.flags&=-257,s.flags|=65536,s.lanes=f,l===Cc?s.flags|=16384:(n=s.updateQueue,n===null?s.updateQueue=new Set([l]):n.add(l),jp(t,l,f)),!1;case 22:return s.flags|=65536,l===Cc?s.flags|=16384:(n=s.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([l])},s.updateQueue=n):(s=n.retryQueue,s===null?n.retryQueue=new Set([l]):s.add(l)),jp(t,l,f)),!1}throw Error(r(435,s.tag))}return jp(t,l,f),cu(),!1}if(st)return n=kn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,l!==df&&(t=Error(r(422),{cause:l}),zl(mi(t,s)))):(l!==df&&(n=Error(r(423),{cause:l}),zl(mi(n,s))),t=t.current.alternate,t.flags|=65536,f&=-f,t.lanes|=f,l=mi(l,s),f=Gf(t.stateNode,l,f),wf(t,f),Gt!==4&&(Gt=2)),!1;var m=Error(r(520),{cause:l});if(m=mi(m,s),eo===null?eo=[m]:eo.push(m),Gt!==4&&(Gt=2),n===null)return!0;l=mi(l,s),s=n;do{switch(s.tag){case 3:return s.flags|=65536,t=f&-f,s.lanes|=t,t=Gf(s.stateNode,l,t),wf(s,t),!1;case 1:if(n=s.type,m=s.stateNode,(s.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(rr===null||!rr.has(m))))return s.flags|=65536,f&=-f,s.lanes|=f,f=Ub(f),Bb(f,t,s,l),wf(s,f),!1;break;case 22:if(s.memoizedState!==null)return s.flags|=65536,!1}s=s.return}while(s!==null);return!1}var Yf=Error(r(461)),an=!1;function un(t,n,s,l){n.child=t===null?Fx(n,null,s,l):Br(n,t.child,s,l)}function $b(t,n,s,l,f){s=s.render;var m=n.ref;if("ref"in l){var k={};for(var _ in l)_!=="ref"&&(k[_]=l[_])}else k=l;return Dr(n),l=Cf(t,n,s,k,m,f),_=jf(),t!==null&&!an?(Af(t,n,f),_a(t,n,f)):(st&&_&&wc(n),n.flags|=1,un(t,n,l,f),n.child)}function Pb(t,n,s,l,f){if(t===null){var m=s.type;return typeof m=="function"&&!lf(m)&&m.defaultProps===void 0&&s.compare===null?(n.tag=15,n.type=m,Hb(t,n,m,l,f)):(t=yc(s.type,null,l,n,n.mode,f),t.ref=n.ref,t.return=n,n.child=t)}if(m=t.child,!ep(t,f)){var k=m.memoizedProps;if(s=s.compare,s=s!==null?s:Ml,s(k,l)&&t.ref===n.ref)return _a(t,n,f)}return n.flags|=1,t=ya(m,l),t.ref=n.ref,t.return=n,n.child=t}function Hb(t,n,s,l,f){if(t!==null){var m=t.memoizedProps;if(Ml(m,l)&&t.ref===n.ref)if(an=!1,n.pendingProps=l=m,ep(t,f))(t.flags&131072)!==0&&(an=!0);else return n.lanes=t.lanes,_a(t,n,f)}return Vf(t,n,s,l,f)}function Fb(t,n,s,l){var f=l.children,m=t!==null?t.memoizedState:null;if(t===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((n.flags&128)!==0){if(m=m!==null?m.baseLanes|s:s,t!==null){for(l=n.child=t.child,f=0;l!==null;)f=f|l.lanes|l.childLanes,l=l.sibling;l=f&~m}else l=0,n.child=null;return qb(t,n,m,s,l)}if((s&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&Sc(n,m!==null?m.cachePool:null),m!==null?Yx(n,m):Nf(),Vx(n);else return l=n.lanes=536870912,qb(t,n,m!==null?m.baseLanes|s:s,s,l)}else m!==null?(Sc(n,m.cachePool),Yx(n,m),er(),n.memoizedState=null):(t!==null&&Sc(n,null),Nf(),er());return un(t,n,f,s),n.child}function Vl(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function qb(t,n,s,l,f){var m=xf();return m=m===null?null:{parent:tn._currentValue,pool:m},n.memoizedState={baseLanes:s,cachePool:m},t!==null&&Sc(n,null),Nf(),Vx(n),t!==null&&Rr(t,n,l,!0),n.childLanes=f,null}function Fc(t,n){return n=qc({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function Gb(t,n,s){return Br(n,t.child,null,s),t=Fc(n,n.pendingProps),t.flags|=2,ii(n),n.memoizedState=null,t}function g_(t,n,s){var l=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(st){if(l.mode==="hidden")return t=Fc(n,l),n.lanes=536870912,t.memoizedState={baseLanes:0,cachePool:null},Vl(null,t);if(_f(n),(t=Ut)?(t=x0(t,xi),t=t!==null&&t.data==="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:qa!==null?{id:Gi,overflow:Yi}:null,retryLane:536870912,hydrationErrors:null},s=Cx(t),s.return=n,n.child=s,mn=n,Ut=null)):t=null,t===null)throw Ya(n);return n.lanes=536870912,null}return Fc(n,l)}var m=t.memoizedState;if(m!==null){var k=m.dehydrated;if(_f(n),f)if(n.flags&256)n.flags&=-257,n=Gb(t,n,s);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(r(558));else if(an||Rr(t,n,s,!1),f=(s&t.childLanes)!==0,an||f){if(Ja.current===null){if(l=Dt,l!==null&&(k=kl(l,s),k!==0&&k!==m.retryLane))throw m.retryLane=k,jr(t,k),Zn(l,t,k),Yf;cu()}n=Gb(t,n,s)}else t=m.treeContext,Ut=yi(k.nextSibling),mn=n,st=!0,Ga=null,xi=!1,t!==null&&Ox(n,t),n=Fc(n,l),n.flags|=134221824;return n}return t=ya(t.child,{mode:l.mode,children:l.children}),t.ref=n.ref,n.child=t,t.return=n,t}function Ms(t,n){var s=n.ref;if(s===null)t!==null&&t.ref!==null&&(n.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(r(284));(t===null||t.ref!==s)&&(n.flags|=4194816)}}function Vf(t,n,s,l,f){return Dr(n),s=Cf(t,n,s,l,void 0,f),l=jf(),t!==null&&!an?(Af(t,n,f),_a(t,n,f)):(st&&l&&wc(n),n.flags|=1,un(t,n,s,f),n.child)}function Yb(t,n,s,l,f,m){return Dr(n),n.updateQueue=null,s=Xx(n,l,s,f),Kx(t),l=jf(),t!==null&&!an?(Af(t,n,m),_a(t,n,m)):(st&&l&&wc(n),n.flags|=1,un(t,n,s,m),n.child)}function Vb(t,n,s,l,f){if(Dr(n),n.stateNode===null){var m=ks,k=s.contextType;typeof k=="object"&&k!==null&&(m=wn(k)),m=new s(l,m),n.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=qf,n.stateNode=m,m._reactInternals=n,m=n.stateNode,m.props=l,m.state=n.memoizedState,m.refs={},yf(n),k=s.contextType,m.context=typeof k=="object"&&k!==null?wn(k):ks,m.state=n.memoizedState,k=s.getDerivedStateFromProps,typeof k=="function"&&(Ff(n,s,k,l),m.state=n.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(k=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),k!==m.state&&qf.enqueueReplaceState(m,m.state,null),Hl(n,l,m,f),Pl(),m.state=n.memoizedState),typeof m.componentDidMount=="function"&&(n.flags|=4194308),l=!0}else if(t===null){m=n.stateNode;var _=n.memoizedProps,I=Pr(s,_);m.props=I;var V=m.context,J=s.contextType;k=ks,typeof J=="object"&&J!==null&&(k=wn(J));var oe=s.getDerivedStateFromProps;J=typeof oe=="function"||typeof m.getSnapshotBeforeUpdate=="function",_=n.pendingProps!==_,J||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(_||V!==k)&&Rb(n,m,l,k),Xa=!1;var G=n.memoizedState;m.state=G,Hl(n,l,m,f),Pl(),V=n.memoizedState,_||G!==V||Xa?(typeof oe=="function"&&(Ff(n,s,oe,l),V=n.memoizedState),(I=Xa||Mb(n,s,I,l,G,V,k))?(J||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount()),typeof m.componentDidMount=="function"&&(n.flags|=4194308)):(typeof m.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=l,n.memoizedState=V),m.props=l,m.state=V,m.context=k,l=I):(typeof m.componentDidMount=="function"&&(n.flags|=4194308),l=!1)}else{m=n.stateNode,vf(t,n),k=n.memoizedProps,J=Pr(s,k),m.props=J,oe=n.pendingProps,G=m.context,V=s.contextType,I=ks,typeof V=="object"&&V!==null&&(I=wn(V)),_=s.getDerivedStateFromProps,(V=typeof _=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(k!==oe||G!==I)&&Rb(n,m,l,I),Xa=!1,G=n.memoizedState,m.state=G,Hl(n,l,m,f),Pl();var X=n.memoizedState;k!==oe||G!==X||Xa||t!==null&&t.dependencies!==null&&Ec(t.dependencies)?(typeof _=="function"&&(Ff(n,s,_,l),X=n.memoizedState),(J=Xa||Mb(n,s,J,l,G,X,I)||t!==null&&t.dependencies!==null&&Ec(t.dependencies))?(V||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(l,X,I),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(l,X,I)),typeof m.componentDidUpdate=="function"&&(n.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof m.componentDidUpdate!="function"||k===t.memoizedProps&&G===t.memoizedState||(n.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||k===t.memoizedProps&&G===t.memoizedState||(n.flags|=1024),n.memoizedProps=l,n.memoizedState=X),m.props=l,m.state=X,m.context=I,l=J):(typeof m.componentDidUpdate!="function"||k===t.memoizedProps&&G===t.memoizedState||(n.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||k===t.memoizedProps&&G===t.memoizedState||(n.flags|=1024),l=!1)}return m=l,Ms(t,n),l=(n.flags&128)!==0,m||l?(m=n.stateNode,s=l&&typeof s.getDerivedStateFromError!="function"?null:m.render(),n.flags|=1,t!==null&&l?(n.child=Br(n,t.child,null,f),n.child=Br(n,null,s,f)):un(t,n,s,f),n.memoizedState=m.state,t=n.child):t=_a(t,n,f),t}function Kb(t,n,s,l){return Or(),n.flags|=256,un(t,n,s,l),n.child}var Kf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Xf(t){return{baseLanes:t,cachePool:Ix()}}function Zf(t,n,s){return t=t!==null?t.childLanes&~s:0,n&&(t|=si),t}function Xb(t,n,s){var l=n.pendingProps,f=!1,m=(n.flags&128)!==0,k;if((k=m)||(k=t!==null&&t.memoizedState===null?!1:(Nn.current&2)!==0),k&&(f=!0,n.flags&=-129),k=(n.flags&32)!==0,n.flags&=-33,t===null){if(st){if(f?Wa(n):er(),(t=Ut)?(t=x0(t,xi),t=t!==null&&t.data!=="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:qa!==null?{id:Gi,overflow:Yi}:null,retryLane:536870912,hydrationErrors:null},s=Cx(t),s.return=n,n.child=s,mn=n,Ut=null)):t=null,t===null)throw Ya(n);return Xp(t)?n.lanes=32:n.lanes=536870912,null}return m=l.children,l=l.fallback,f?(er(),f=n.mode,m=qc({mode:"hidden",children:m},f),l=Ar(l,f,s,null),m.return=n,l.return=n,m.sibling=l,n.child=m,l=n.child,l.memoizedState=Xf(s),l.childLanes=Zf(t,k,s),n.memoizedState=Kf,Vl(null,l)):(Wa(n),Qf(n,m))}var _=t.memoizedState;if(_!==null){var I=_.dehydrated;if(I!==null)return x_(t,n,m,k,l,I,_,s)}return f?(er(),f=l.fallback,m=n.mode,_=t.child,I=_.sibling,l=ya(_,{mode:"hidden",children:l.children}),l.subtreeFlags=_.subtreeFlags&1206910976,I!==null?f=ya(I,f):(f=Ar(f,m,s,null),f.flags|=2),f.return=n,l.return=n,l.sibling=f,n.child=l,Vl(null,l),l=n.child,f=t.child.memoizedState,f===null?f=Xf(s):(m=f.cachePool,m!==null?(_=tn._currentValue,m=m.parent!==_?{parent:_,pool:_}:m):m=Ix(),f={baseLanes:f.baseLanes|s,cachePool:m}),l.memoizedState=f,l.childLanes=Zf(t,k,s),n.memoizedState=Kf,Vl(t.child,l)):(Wa(n),s=t.child,t=s.sibling,s=ya(s,{mode:"visible",children:l.children}),s.return=n,s.sibling=null,t!==null&&(k=n.deletions,k===null?(n.deletions=[t],n.flags|=16):k.push(t)),n.child=s,n.memoizedState=null,s)}function Qf(t,n){return n=qc({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function qc(t,n){return t=Yn(22,t,null,n),t.lanes=0,t}function Gc(t,n,s){return Br(n,t.child,null,s),t=Qf(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function x_(t,n,s,l,f,m,k,_){if(s)return n.flags&256?(Wa(n),n.flags&=-257,Gc(t,n,_)):n.memoizedState!==null?(er(),n.child=t.child,n.flags|=128,null):(er(),m=f.fallback,k=n.mode,f=qc({mode:"visible",children:f.children},k),m=Ar(m,k,_,null),m.flags|=2,f.return=n,m.return=n,f.sibling=m,n.child=f,Br(n,t.child,null,_),f=n.child,f.memoizedState=Xf(_),f.childLanes=Zf(t,l,_),n.memoizedState=Kf,Vl(null,f));if(Wa(n),Xp(m)){if(l=m.nextSibling&&m.nextSibling.dataset,l)var I=l.dgst;return l=I,l!==""&&(f=Error(r(419)),f.stack="",f.digest=l,zl({value:f,source:null,stack:null})),Gc(t,n,_)}if(an||Rr(t,n,_,!1),l=(_&t.childLanes)!==0,an||l){if(Ja.current!==null)return Gc(t,n,_);if(l=Dt,l!==null&&(f=kl(l,_),f!==0&&f!==k.retryLane))throw k.retryLane=f,jr(t,f),Zn(l,t,f),Yf;return Kp(m)||cu(),Gc(t,n,_)}return Kp(m)?(n.flags|=192,n.child=t.child,null):(t=k.treeContext,Ut=yi(m.nextSibling),mn=n,st=!0,Ga=null,xi=!1,t!==null&&Ox(n,t),n=Qf(n,f.children),n.flags|=134221824,n)}function Zb(t,n,s){t.lanes|=n;var l=t.alternate;l!==null&&(l.lanes|=n),Nc(t.return,n,s)}function Qb(t){for(var n=null;t!==null;){var s=t.alternate;s!==null&&Mc(s)===null&&(n=t),t=t.sibling}return n}function Yc(t,n,s,l,f,m){var k=t.memoizedState;k===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:l,tail:s,tailMode:f,treeForkCount:m}:(k.isBackwards=n,k.rendering=null,k.renderingStartTime=0,k.last=l,k.tail=s,k.tailMode=f,k.treeForkCount=m)}function Jf(t){var n=t.child;for(t.child=null;n!==null;){var s=n.sibling;n.sibling=t.child,t.child=n,n=s}}function Wf(t,n,s){var l=n.pendingProps,f=l.revealOrder,m=l.tail;l=l.children;var k=Nn.current;if(n.flags&128)return Fl(n,k),null;var _=(k&2)!==0;if(_?(k=k&1|2,n.flags|=128):k&=1,Fl(n,k),f==="backwards"&&t!==null?(Jf(t),un(t,n,l,s),Jf(t)):un(t,n,l,s),l=st?Dl:0,!_&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Zb(t,s,n);else if(t.tag===19)Zb(t,s,n);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break e;for(;t.sibling===null;){if(t.return===null||t.return===n)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(f){case"backwards":s=Qb(n.child),s===null?(f=n.child,n.child=null):(f=s.sibling,s.sibling=null,Jf(n)),Yc(n,!0,f,null,m,l);break;case"unstable_legacy-backwards":for(s=null,f=n.child,n.child=null;f!==null;){if(t=f.alternate,t!==null&&Mc(t)===null){n.child=f;break}t=f.sibling,f.sibling=s,s=f,f=t}Yc(n,!0,s,null,m,l);break;case"together":Yc(n,!1,null,null,void 0,l);break;case"independent":n.memoizedState=null;break;default:s=Qb(n.child),s===null?(f=n.child,n.child=null):(f=s.sibling,s.sibling=null),Yc(n,!1,f,s,m,l)}return n.child}function Jb(t,n,s){var l=n.pendingProps;return Va(n,n.type,l.value),un(t,n,l.children,s),n.child}function _a(t,n,s){if(t!==null&&(n.dependencies=t.dependencies),ar|=n.lanes,(s&n.childLanes)===0)if(t!==null){if(Rr(t,n,s,!1),(s&n.childLanes)===0)return null}else return null;if(t!==null&&n.child!==t.child)throw Error(r(153));if(n.child!==null){for(t=n.child,s=ya(t,t.pendingProps),n.child=s,s.return=n;t.sibling!==null;)t=t.sibling,s=s.sibling=ya(t,t.pendingProps),s.return=n;s.sibling=null}return n.child}function ep(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&Ec(t)))}function b_(t,n,s){switch(n.tag){case 3:Ge(n,n.stateNode.containerInfo),Va(n,tn,t.memoizedState.cache),Or();break;case 27:case 5:xt(n);break;case 4:Ge(n,n.stateNode.containerInfo);break;case 10:Va(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,_f(n),null;break;case 13:var l=n.memoizedState;if(l!==null){if(l.dehydrated!==null)return Wa(n),n.flags|=128,null;l=Rr(t,n,s,!1);var f=n.child.childLanes;return l||(s&f)!==0?Xb(t,n,s):(Wa(n),t=_a(t,n,s),t!==null?t.sibling:null)}Wa(n);break;case 19:if(n.flags&128)return Wf(t,n,s);if(f=(t.flags&128)!==0,l=(s&n.childLanes)!==0,l||(Rr(t,n,s,!1),l=(s&n.childLanes)!==0),f){if(l)return Wf(t,n,s);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Fl(n,Nn.current),l)break;return null;case 22:return n.lanes=0,Fb(t,n,s,n.pendingProps);case 24:Va(n,tn,t.memoizedState.cache)}return _a(t,n,s)}function Wb(t,n,s){if(t!==null)if(t.memoizedProps!==n.pendingProps)an=!0;else{if(!ep(t,s)&&(n.flags&128)===0)return an=!1,b_(t,n,s);an=(t.flags&131072)!==0}else an=!1,st&&(n.flags&1048576)!==0&&Ax(n,Dl,n.index);switch(n.lanes=0,n.tag){case 16:e:{var l=n.pendingProps;if(t=Ir(n.elementType),n.type=t,typeof t=="function")lf(t)?(l=Pr(t,l),n.tag=1,n=Vb(null,n,t,l,s)):(n.tag=0,n=Vf(null,n,t,l,s));else{if(t!=null){var f=t.$$typeof;if(f===O){n.tag=11,n=$b(null,n,t,l,s);break e}else if(f===be){n.tag=14,n=Pb(null,n,t,l,s);break e}else if(f===ae){n.tag=10,n.type=t,n=Jb(null,n,s);break e}}throw n=de(t)||t,Error(r(306,n,""))}}return n;case 0:return Vf(t,n,n.type,n.pendingProps,s);case 1:return l=n.type,f=Pr(l,n.pendingProps),Vb(t,n,l,f,s);case 3:e:{if(Ge(n,n.stateNode.containerInfo),t===null)throw Error(r(387));l=n.pendingProps;var m=n.memoizedState;f=m.element,vf(t,n),Hl(n,l,null,s);var k=n.memoizedState;if(l=k.cache,Va(n,tn,l),l!==m.cache&&mf(n,[tn],s,!0),Pl(),l=k.element,m.isDehydrated)if(m={element:l,isDehydrated:!1,cache:k.cache},n.updateQueue.baseState=m,n.memoizedState=m,n.flags&256){n=Kb(t,n,l,s);break e}else if(l!==f){f=mi(Error(r(424)),n),zl(f),n=Kb(t,n,l,s);break e}else for(t=n.stateNode.containerInfo,t.nodeType===9?t=t.body:t=t.nodeName==="HTML"?t.ownerDocument.body:t,Ut=yi(t.firstChild),mn=n,st=!0,Ga=null,xi=!0,s=Fx(n,null,l,s),n.child=s;s;)s.flags=s.flags&-3|134221824,s=s.sibling;else{if(Or(),l===f){n=_a(t,n,s);break e}un(t,n,l,s)}n=n.child}return n;case 26:return Ms(t,n),t===null?(s=E0(n.type,null,n.pendingProps,null))?n.memoizedState=s:st||(n.stateNode=i0(n.type,n.pendingProps,xn.current,n)):n.memoizedState=E0(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return xt(n),t===null&&st&&(l=n.stateNode=v0(n.type,n.pendingProps,xn.current),mn=n,xi=!0,f=Ut,or(n.type)?(Zp=f,Ut=yi(l.firstChild)):Ut=f),un(t,n,n.pendingProps.children,s),Ms(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&st&&((f=l=Ut)&&(l=fS(l,n.type,n.pendingProps,xi),l!==null?(n.stateNode=l,mn=n,Ut=yi(l.firstChild),xi=!1,f=!0):f=!1),f||Ya(n)),xt(n),f=n.type,m=n.pendingProps,k=t!==null?t.memoizedProps:null,l=m.children,Pp(f,m)?l=null:k!==null&&Pp(f,k)&&(n.flags|=32),n.memoizedState!==null&&(f=Cf(t,n,l_,null,null,s),Zs._currentValue=f),Ms(t,n),un(t,n,l,s),n.child;case 6:return t===null&&st&&((t=s=Ut)&&(s=pS(s,n.pendingProps,xi),s!==null?(n.stateNode=s,mn=n,Ut=null,t=!0):t=!1),t||Ya(n)),null;case 13:return Xb(t,n,s);case 4:return Ge(n,n.stateNode.containerInfo),l=n.pendingProps,t===null?n.child=Br(n,null,l,s):un(t,n,l,s),n.child;case 11:return $b(t,n,n.type,n.pendingProps,s);case 7:return l=n.pendingProps,Ms(t,n),un(t,n,l,s),n.child;case 8:return un(t,n,n.pendingProps.children,s),n.child;case 12:return un(t,n,n.pendingProps.children,s),n.child;case 10:return Jb(t,n,s);case 9:return f=n.type._context,l=n.pendingProps.children,Dr(n),f=wn(f),l=l(f),n.flags|=1,un(t,n,l,s),n.child;case 14:return Pb(t,n,n.type,n.pendingProps,s);case 15:return Hb(t,n,n.type,n.pendingProps,s);case 19:return Wf(t,n,s);case 31:return g_(t,n,s);case 22:return Fb(t,n,s,n.pendingProps);case 24:return Dr(n),l=wn(tn),t===null?(f=xf(),f===null&&(f=Dt,m=hf(),f.pooledCache=m,m.refCount++,m!==null&&(f.pooledCacheLanes|=s),f=m),n.memoizedState={parent:l,cache:f},yf(n),Va(n,tn,f)):((t.lanes&s)!==0&&(vf(t,n),Hl(n,null,null,s),Pl()),f=t.memoizedState,m=n.memoizedState,f.parent!==l?(f={parent:l,cache:l},n.memoizedState=f,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=f),Va(n,tn,l)):(l=m.cache,Va(n,tn,l),l!==f.cache&&mf(n,[tn],s,!0))),un(t,n,n.pendingProps.children,s),n.child;case 30:return n.stateNode===null&&(n.stateNode={autoName:null,paired:null,clones:null,ref:null}),l=n.pendingProps,l.name!=null&&l.name!=="auto"?n.flags|=t===null?18882560:18874368:st&&wc(n),t!==null&&t.memoizedProps.name!==l.name?n.flags|=4194816:Ms(t,n),un(t,n,l.children,s),n.child;case 29:throw n.pendingProps}throw Error(r(156,n.tag))}function Sa(t){t.flags|=4}function tp(t,n,s,l,f){var m;if((m=(t.mode&32)!==0)&&(m=s===null?C0(n,l):C0(n,l)&&(l.src!==s.src||l.srcSet!==s.srcSet)),m){if(t.flags|=16777216,(f&335544128)===f)if(t.stateNode.complete)t.flags|=8192;else if(Dy())t.flags|=8192;else throw Ur=Cc,bf}else t.flags&=-16777217}function ey(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!j0(n))if(Dy())t.flags|=8192;else throw Ur=Cc,bf}function Vc(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?wl():536870912,t.lanes|=n,Is|=n)}function Kl(t,n){if(!st)switch(t.tailMode){case"visible":break;case"collapsed":for(var s=t.tail,l=null;s!==null;)s.alternate!==null&&(l=s),s=s.sibling;l===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:l.sibling=null;break;default:for(n=t.tail,s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t.tail=null:s.sibling=null}}function Bt(t){var n=t.alternate!==null&&t.alternate.child===t.child,s=0,l=0;if(n)for(var f=t.child;f!==null;)s|=f.lanes|f.childLanes,l|=f.subtreeFlags&1206910976,l|=f.flags&1206910976,f.return=t,f=f.sibling;else for(f=t.child;f!==null;)s|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=t,f=f.sibling;return t.subtreeFlags|=l,t.childLanes=s,n}function y_(t,n,s){var l=n.pendingProps;switch(uf(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Bt(n),null;case 1:return Bt(n),null;case 3:return s=n.stateNode,l=null,t!==null&&(l=t.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),ka(tn),ht(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(t===null||t.child===null)&&(_s(n)?Sa(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,ff())),Bt(n),null;case 26:var f=n.type,m=n.memoizedState;return t===null?(Sa(n),m!==null?(Bt(n),ey(n,m)):(Bt(n),tp(n,f,null,l,s))):m?m!==t.memoizedState?(Sa(n),Bt(n),ey(n,m)):(Bt(n),n.flags&=-16777217):(t=t.memoizedProps,t!==l&&Sa(n),Bt(n),tp(n,f,t,l,s)),null;case 27:if(ln(n),s=xn.current,f=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==l&&Sa(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return Bt(n),n.subtreeFlags&=-33554433,null}t=It.current,_s(n)?Mx(n):(t=v0(f,l,s),n.stateNode=t,Sa(n))}return Bt(n),n.subtreeFlags&=-33554433,null;case 5:if(ln(n),f=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==l&&Sa(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return Bt(n),n.subtreeFlags&=-33554433,null}if(m=It.current,_s(n))Mx(n);else{var k=ro(xn.current);switch(m){case 1:m=k.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:m=k.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":m=k.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":m=k.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":m=k.createElement("div"),m.innerHTML="<script><\/script>",m=m.removeChild(m.firstChild);break;case"select":m=typeof l.is=="string"?k.createElement("select",{is:l.is}):k.createElement("select"),l.multiple?m.multiple=!0:l.size&&(m.size=l.size);break;default:m=typeof l.is=="string"?k.createElement(f,{is:l.is}):k.createElement(f)}}m[cn]=n,m[xe]=l;e:for(k=n.child;k!==null;){if(k.tag===5||k.tag===6)m.appendChild(k.stateNode);else if(k.tag!==4&&k.tag!==27&&k.child!==null){k.child.return=k,k=k.child;continue}if(k===n)break e;for(;k.sibling===null;){if(k.return===null||k.return===n)break e;k=k.return}k.sibling.return=k.return,k=k.sibling}n.stateNode=m;e:switch(_n(m,f,l),f){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Sa(n)}}return Bt(n),n.subtreeFlags&=-33554433,tp(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,s),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==l&&Sa(n);else{if(typeof l!="string"&&n.stateNode===null)throw Error(r(166));if(t=xn.current,_s(n)){if(t=n.stateNode,s=n.memoizedProps,l=null,f=mn,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}t[cn]=n,t=!!(t.nodeValue===s||l!==null&&l.suppressHydrationWarning===!0||Wy(t.nodeValue,s)),t||Ya(n,!0)}else t=ro(t).createTextNode(l),t[cn]=n,n.stateNode=t}return Bt(n),null;case 31:if(s=n.memoizedState,t===null||t.memoizedState!==null){if(l=_s(n),s!==null){if(t===null){if(!l)throw Error(r(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(557));t[cn]=n}else Or(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Bt(n),t=!1}else s=ff(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=s),t=!0;if(!t)return n.flags&256?(ii(n),n):(ii(n),null);if((n.flags&128)!==0)throw Error(r(558))}return Bt(n),null;case 13:if(l=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(f=_s(n),l!==null&&l.dehydrated!==null){if(t===null){if(!f)throw Error(r(318));if(f=n.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(r(317));f[cn]=n}else Or(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Bt(n),f=!1}else f=ff(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(ii(n),n):(ii(n),null)}return ii(n),(n.flags&128)!==0?(n.lanes=s,n):(s=l!==null,t=t!==null&&t.memoizedState!==null,s&&(l=n.child,f=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(f=l.alternate.memoizedState.cachePool.pool),m=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(m=l.memoizedState.cachePool.pool),m!==f&&(l.flags|=2048)),s!==t&&s&&(n.child.flags|=8192),Vc(n,n.updateQueue),Bt(n),null);case 4:return ht(),t===null&&Lp(n.stateNode.containerInfo),n.flags|=67108864,Bt(n),null;case 10:return ka(n.type),Bt(n),null;case 19:if(Sf(n),l=n.memoizedState,l===null)return Bt(n),null;if(f=(n.flags&128)!==0,m=l.rendering,m===null)if(f)Kl(l,!1);else{if(Gt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(m=Mc(t),m!==null){for(n.flags|=128,Kl(l,!1),t=m.updateQueue,n.updateQueue=t,Vc(n,t),n.subtreeFlags=0,t=s,s=n.child;s!==null;)Tx(s,t),s=s.sibling;return Fl(n,Nn.current&1|2),st&&va(n,l.treeForkCount),n.child}t=t.sibling}l.tail!==null&&Qt()>ru&&(n.flags|=128,f=!0,Kl(l,!1),n.lanes=4194304)}else{if(!f)if(t=Mc(m),t!==null){if(n.flags|=128,f=!0,t=t.updateQueue,n.updateQueue=t,Vc(n,t),Kl(l,!0),l.tail===null&&l.tailMode!=="collapsed"&&l.tailMode!=="visible"&&!m.alternate&&!st)return Bt(n),null}else 2*Qt()-l.renderingStartTime>ru&&s!==536870912&&(n.flags|=128,f=!0,Kl(l,!1),n.lanes=4194304);l.isBackwards?(m.sibling=n.child,n.child=m):(t=l.last,t!==null?t.sibling=m:n.child=m,l.last=m)}if(l.tail!==null){t=l.tail;e:{for(s=t;s!==null;){if(s.alternate!==null){s=!1;break e}s=s.sibling}s=!0}return l.rendering=t,l.tail=t.sibling,l.renderingStartTime=Qt(),t.sibling=null,m=Nn.current,m=f?m&1|2:m&1,l.tailMode==="visible"||l.tailMode==="collapsed"||!s||st?Fl(n,m):(s=m,Ke(kn,n),Ke(Nn,s),An===null&&(An=n)),st&&va(n,l.treeForkCount),t}return Bt(n),null;case 22:case 23:return ii(n),Ef(),l=n.memoizedState!==null,t!==null?t.memoizedState!==null!==l&&(n.flags|=8192):l&&(n.flags|=8192),l?(s&536870912)!==0&&(n.flags&128)===0&&(Bt(n),n.subtreeFlags&6&&(n.flags|=8192)):Bt(n),s=n.updateQueue,s!==null&&Vc(n,s.retryQueue),s=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),l=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(l=n.memoizedState.cachePool.pool),l!==s&&(n.flags|=2048),t!==null&&rt(Lr),null;case 24:return s=null,t!==null&&(s=t.memoizedState.cache),n.memoizedState.cache!==s&&(n.flags|=2048),ka(tn),Bt(n),null;case 25:return null;case 30:return n.flags|=33554432,Bt(n),null}throw Error(r(156,n.tag))}function v_(t,n){switch(uf(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return ka(tn),ht(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return ln(n),null;case 31:if(n.memoizedState!==null){if(ii(n),n.alternate===null)throw Error(r(340));Or()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(ii(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(r(340));Or()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return Sf(n),t=n.flags,t&65536?(n.flags=t&-65537|128,t=n.memoizedState,t!==null&&(t.rendering=null,t.tail=null),n.flags|=4,n):null;case 4:return ht(),null;case 10:return ka(n.type),null;case 22:case 23:return ii(n),Ef(),t!==null&&rt(Lr),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return ka(tn),null;case 25:return null;default:return null}}function ty(t,n){switch(uf(n),n.tag){case 3:ka(tn),ht();break;case 26:case 27:case 5:ln(n);break;case 4:ht();break;case 31:n.memoizedState!==null&&ii(n);break;case 13:ii(n);break;case 19:Sf(n);break;case 10:ka(n.type);break;case 22:case 23:ii(n),Ef(),t!==null&&rt(Lr);break;case 24:ka(tn)}}function Xl(t,n){try{var s=n.updateQueue,l=s!==null?s.lastEffect:null;if(l!==null){var f=l.next;s=f;do{if((s.tag&t)===t){l=void 0;var m=s.create,k=s.inst;l=m(),k.destroy=l}s=s.next}while(s!==f)}}catch(_){Tt(n,n.return,_)}}function tr(t,n,s){try{var l=n.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var m=f.next;l=m;do{if((l.tag&t)===t){var k=l.inst,_=k.destroy;if(_!==void 0){k.destroy=void 0,f=n;var I=s,V=_;try{V()}catch(J){Tt(f,I,J)}}}l=l.next}while(l!==m)}}catch(J){Tt(n,n.return,J)}}function ny(t){var n=t.updateQueue;if(n!==null){var s=t.stateNode;try{Gx(n,s)}catch(l){Tt(t,t.return,l)}}}function iy(t,n,s){s.props=Pr(t.type,t.memoizedProps),s.state=t.memoizedState;try{s.componentWillUnmount()}catch(l){Tt(t,n,l)}}function Vi(t,n){try{var s=t.ref;if(s!==null){switch(t.tag){case 26:case 27:case 5:var l=t.stateNode;break;case 30:var f=t.stateNode,m=xa(t.memoizedProps,f);(f.ref===null||f.ref.name!==m)&&(f.ref=u0(m)),l=f.ref;break;case 7:if(t.stateNode===null){var k=new oi(t);b(t.child,!1,uS,k,void 0,void 0),t.stateNode=k}l=t.stateNode;break;default:l=t.stateNode}typeof s=="function"?t.refCleanup=s(l):s.current=l}}catch(_){Tt(t,n,_)}}function En(t,n){var s=t.ref,l=t.refCleanup;if(s!==null)if(typeof l=="function")try{l()}catch(f){Tt(t,n,f)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(f){Tt(t,n,f)}else s.current=null}function Kc(t,n){if((t.tag===5||t.tag===27||t.tag===6)&&t.alternate===null&&n!==null)for(var s=0;s<n.length;s++)g0(t.stateNode,n[s])}function ay(t){for(var n=t.return;n!==null&&(ip(n)&&g0(t.stateNode,n.stateNode),!np(n));)n=n.return}function Zl(t){for(var n=t.return;n!==null&&(ip(n)&&dS(t.stateNode,n.stateNode),!np(n));)n=n.return}function np(t){return t.tag===5||t.tag===3||t.tag===27}function ip(t){return t&&t.tag===7&&t.stateNode!==null}function ap(t){var n=t.type,s=t.memoizedProps,l=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":s.autoFocus&&l.focus();break e;case"img":s.src?l.src=s.src:s.srcSet&&(l.srcset=s.srcSet)}}catch(f){Tt(t,t.return,f)}}function rp(t,n,s){try{var l=t.stateNode;Y_(l,t.type,s,n),l[xe]=n}catch(f){Tt(t,t.return,f)}}function ry(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&or(t.type)||t.tag===4}function sp(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||ry(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&or(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function lp(t,n,s,l){var f=t.tag;if(f===5||f===6)f=t.stateNode,n?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(f,n):(n=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,n.appendChild(f),s=s._reactRootContainer,s!=null||n.onclick!==null||(n.onclick=qi)),Kc(t,l),mt=!0;else if(f!==4&&(f===27&&(Kc(t,l),l=null,or(t.type)&&(s=t.stateNode,n=null)),t=t.child,t!==null))for(lp(t,n,s,l),t=t.sibling;t!==null;)lp(t,n,s,l),t=t.sibling}function Xc(t,n,s,l){var f=t.tag;if(f===5||f===6)f=t.stateNode,n?s.insertBefore(f,n):s.appendChild(f),Kc(t,l),mt=!0;else if(f!==4&&(f===27&&(Kc(t,l),l=null,or(t.type)&&(s=t.stateNode)),t=t.child,t!==null))for(Xc(t,n,s,l),t=t.sibling;t!==null;)Xc(t,n,s,l),t=t.sibling}function sy(t){var n=t.stateNode,s=t.memoizedProps;try{for(var l=t.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);_n(n,l,s),n[cn]=t,n[xe]=s}catch(m){Tt(t,t.return,m)}}var Zc=!1,ai=null;function ly(t){(t.tag===30||(t.subtreeFlags&33554432)!==0)&&(Zc=!0)}var Ki=null;function oy(){var t=Ki;return Ki=null,t}var Vn=0;function Rs(t,n,s,l,f){return Vn=0,cy(t.child,n,s,l,f)}function cy(t,n,s,l,f){for(var m=!1;t!==null;){if(t.tag===5){var k=t.stateNode;if(l!==null){var _=qp(k);l.push(_),_.view&&(m=!0)}else m||qp(k).view&&(m=!0);Zc=!0,o0(k,Vn===0?n:n+"_"+Vn,s),Vn++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&f||cy(t.child,n,s,l,f)&&(m=!0));t=t.sibling}return m}function Xi(t,n){for(;t!==null;)t.tag===5?c0(t.stateNode,t.memoizedProps):(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&n||Xi(t.child,n)),t=t.sibling}function Qc(t){if((t.subtreeFlags&18874368)!==0)for(t=t.child;t!==null;){if((t.tag!==22||t.memoizedState===null)&&(Qc(t),t.tag===30&&(t.flags&18874368)!==0&&t.stateNode.paired)){var n=t.memoizedProps;if(n.name==null||n.name==="auto")throw Error(r(544));var s=n.name;n=ba(n.default,n.share),n!=="none"&&(Rs(t,s,n,null,!1)||Xi(t.child,!1))}t=t.sibling}}function op(t,n){if(t.tag===30){var s=t.stateNode,l=t.memoizedProps,f=xa(l,s),m=ba(l.default,s.paired?l.share:l.enter);m!=="none"?Rs(t,f,m,null,!1)?(Qc(t),s.paired||n||Ps(t,l.onEnter)):Xi(t.child,!1):Qc(t)}else if((t.subtreeFlags&33554432)!==0)for(t=t.child;t!==null;)op(t,n),t=t.sibling;else Qc(t)}function cp(t){if(ai!==null&&ai.size!==0){var n=ai;if((t.subtreeFlags&18874368)!==0)for(t=t.child;t!==null;){if(t.tag!==22||t.memoizedState===null){if(t.tag===30&&(t.flags&18874368)!==0){var s=t.memoizedProps,l=s.name;if(l!=null&&l!=="auto"){var f=n.get(l);if(f!==void 0){var m=ba(s.default,s.share);if(m!=="none"&&(Rs(t,l,m,null,!1)?(m=t.stateNode,f.paired=m,m.paired=f,Ps(t,s.onShare)):Xi(t.child,!1)),n.delete(l),n.size===0)break}}}cp(t)}t=t.sibling}}}function up(t){if(t.tag===30){var n=t.memoizedProps,s=xa(n,t.stateNode),l=ai!==null?ai.get(s):void 0,f=ba(n.default,l!==void 0?n.share:n.exit);f!=="none"&&(Rs(t,s,f,null,!1)?l!==void 0?(f=t.stateNode,l.paired=f,f.paired=l,ai.delete(s),Ps(t,n.onShare)):Ps(t,n.onExit):Xi(t.child,!1)),ai!==null&&cp(t)}else if((t.subtreeFlags&33554432)!==0)for(t=t.child;t!==null;)up(t),t=t.sibling;else ai!==null&&cp(t)}function uy(t){for(t=t.child;t!==null;){if(t.tag===30){var n=t.memoizedProps,s=xa(n,t.stateNode);n=ba(n.default,n.update),t.flags&=-5,n!=="none"&&Rs(t,s,n,t.memoizedState=[],!1)}else(t.subtreeFlags&33554432)!==0&&uy(t);t=t.sibling}}function dp(t){if((t.subtreeFlags&18874368)!==0)for(t=t.child;t!==null;){if(t.tag!==22||t.memoizedState===null){if(t.tag===30&&(t.flags&18874368)!==0){var n=t.stateNode;n.paired!==null&&(n.paired=null,Xi(t.child,!1))}dp(t)}t=t.sibling}}function Jc(t){if(t.tag===30)t.stateNode.paired=null,Xi(t.child,!1),dp(t);else if((t.subtreeFlags&33554432)!==0)for(t=t.child;t!==null;)Jc(t),t=t.sibling;else dp(t)}function dy(t){for(t=t.child;t!==null;)t.tag===30?Xi(t.child,!1):(t.subtreeFlags&33554432)!==0&&dy(t),t=t.sibling}function fp(t,n,s,l,f,m,k){for(var _=!1;n!==null;){if(n.tag===5){var I=n.stateNode;if(m!==null&&Vn<m.length){var V=m[Vn],J=qp(I);(V.view||J.view)&&(_=!0);var oe;if(oe=(t.flags&4)===0)if(J.clip)oe=!0;else{oe=V.rect;var G=J.rect;oe=oe.y!==G.y||oe.x!==G.x||oe.height!==G.height||oe.width!==G.width}oe&&(t.flags|=4),J.abs?J=!V.abs:(V=V.rect,J=J.rect,J=V.height!==J.height||V.width!==J.width),J&&(t.flags|=32)}else t.flags|=32;(t.flags&4)!==0&&o0(I,Vn===0?s:s+"_"+Vn,f),_&&(t.flags&4)!==0||(Ki===null&&(Ki=[]),Ki.push(I,Vn===0?l:l+"_"+Vn,n.memoizedProps)),Vn++}else(n.tag!==22||n.memoizedState===null)&&(n.tag===30&&k?t.flags|=n.flags&32:fp(t,n.child,s,l,f,m,k)&&(_=!0));n=n.sibling}return _}function fy(t,n){for(t=t.child;t!==null;){if(t.tag===30){var s=t.memoizedProps,l=t.stateNode,f=xa(s,l),m=ba(s.default,s.update),k;k=t.memoizedState,t.memoizedState=null,l=t;var _=t.child;Vn=0,f=fp(l,_,f,f,m,k,!1),(t.flags&4)!==0&&f&&Ps(t,s.onUpdate)}else(t.subtreeFlags&33554432)!==0&&fy(t);t=t.sibling}}var hn=!1,Nt=!1,Zi=!1,pp=!1,py=typeof WeakSet=="function"?WeakSet:Set,gn=null,Qi=!1,Ql=!1,Wc=!1,mp=!1;function w_(t,n,s){if(t=t.containerInfo,Bp=Qs,t=xx(t),Wd(t)){if("selectionStart"in t)var l={start:t.selectionStart,end:t.selectionEnd};else e:{l=(l=t.ownerDocument)&&l.defaultView||window;var f=l.getSelection&&l.getSelection();if(f&&f.rangeCount!==0){l=f.anchorNode;var m=f.anchorOffset,k=f.focusNode;f=f.focusOffset;try{l.nodeType,k.nodeType}catch{l=null;break e}var _=0,I=-1,V=-1,J=0,oe=0,G=t,X=null;t:for(;;){for(var Se;G!==l||m!==0&&G.nodeType!==3||(I=_+m),G!==k||f!==0&&G.nodeType!==3||(V=_+f),G.nodeType===3&&(_+=G.nodeValue.length),(Se=G.firstChild)!==null;)X=G,G=Se;for(;;){if(G===t)break t;if(X===l&&++J===m&&(I=_),X===k&&++oe===f&&(V=_),(Se=G.nextSibling)!==null)break;G=X,X=G.parentNode}G=Se}l=I===-1||V===-1?null:{start:I,end:V}}else l=null}l=l||{start:0,end:0}}else l=null;for($p={focusedElem:t,selectionRange:l},Qs=!1,s=(s&335544064)===s,gn=n,n=s?9270:1024;gn!==null;){if(t=gn,s&&(l=t.deletions,l!==null))for(m=0;m<l.length;m++)s&&up(l[m]);if(t.alternate===null&&(t.flags&2)!==0)s&&ly(t),eu(s);else{if(t.tag===22){if(l=t.alternate,t.memoizedState!==null){l!==null&&l.memoizedState===null&&s&&up(l),eu(s);continue}else if(l!==null&&l.memoizedState!==null){s&&ly(t),eu(s);continue}}l=t.child,(t.subtreeFlags&n)!==0&&l!==null?(l.return=t,gn=l):(s&&uy(t),eu(s))}}ai=null}function eu(t){for(;gn!==null;){var n=gn,s=t,l=n.alternate,f=n.flags;switch(n.tag){case 0:case 11:case 15:break;case 1:if((f&1024)!==0&&l!==null){s=void 0,f=l.memoizedProps,l=l.memoizedState;var m=n.stateNode;try{var k=Pr(n.type,f);s=m.getSnapshotBeforeUpdate(k,l),m.__reactInternalSnapshotBeforeUpdate=s}catch(_){Tt(n,n.return,_)}}break;case 3:if((f&1024)!==0){if(l=n.stateNode.containerInfo,s=l.nodeType,s===9)Vp(l);else if(s===1)switch(l.nodeName){case"HEAD":case"HTML":case"BODY":Vp(l);break;default:l.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:s&&l!==null&&(s=xa(l.memoizedProps,l.stateNode),f=n.memoizedProps,f=ba(f.default,f.update),f!=="none"&&Rs(l,s,f,l.memoizedState=[],!0));break;default:if((f&1024)!==0)throw Error(r(163))}if(l=n.sibling,l!==null){l.return=n.return,gn=l;break}gn=n.return}}function my(t,n,s){var l=s.flags;switch(s.tag){case 0:case 11:case 15:Ji(t,s),l&4&&Xl(5,s);break;case 1:if(Ji(t,s),l&4)if(t=s.stateNode,n===null)try{t.componentDidMount()}catch(k){Tt(s,s.return,k)}else{var f=Pr(s.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(f,n,t.__reactInternalSnapshotBeforeUpdate)}catch(k){Tt(s,s.return,k)}}l&64&&ny(s),l&512&&Vi(s,s.return);break;case 3:if(Ji(t,s),l&64&&(t=s.updateQueue,t!==null)){if(n=null,s.child!==null)switch(s.child.tag){case 27:case 5:n=s.child.stateNode;break;case 1:n=s.child.stateNode}try{Gx(t,n)}catch(k){Tt(s,s.return,k)}}break;case 27:n===null&&l&4&&sy(s);case 26:case 5:Ji(t,s),n===null&&l&4&&ap(s),l&512&&Vi(s,s.return);break;case 12:Ji(t,s);break;case 31:Ji(t,s),l&4&&by(t,s);break;case 13:Ji(t,s),l&4&&yy(t,s),l&64&&(t=s.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(s=R_.bind(null,s),mS(t,s))));break;case 22:if(l=s.memoizedState!==null||hn,!l){var m=n!==null&&n.memoizedState!==null||Nt;n=hn,f=Nt,hn=l,(Nt=m)&&!f?(l=2,(s.subtreeFlags&8772)!==0&&(l|=1),Ri(t,s,l)):Ji(t,s),hn=n,Nt=f}break;case 30:Ji(t,s),l&512&&Vi(s,s.return);break;case 7:l&512&&Vi(s,s.return);default:Ji(t,s)}}function hp(t,n){for(t=t.child;t!==null;)hy(t,n),t=t.sibling}function hy(t,n){switch(t.tag){case 5:case 26:try{var s=t.stateNode;if(n){var l=s.style;typeof l.setProperty=="function"?l.setProperty("display","none","important"):l.display="none"}else{var f=t.stateNode,m=t.memoizedProps.style,k=m!=null&&m.hasOwnProperty("display")?m.display:null;f.style.display=k==null||typeof k=="boolean"?"":(""+k).trim()}}catch(I){Tt(t,t.return,I)}gp(t,n);break;case 6:try{t.stateNode.nodeValue=n?"":t.memoizedProps,mt=!0}catch(I){Tt(t,t.return,I)}break;case 18:try{var _=t.stateNode;n?l0(_,!0):l0(t.stateNode,!1)}catch(I){Tt(t,t.return,I)}break;case 22:case 23:t.memoizedState===null&&hp(t,n);break;default:hp(t,n)}}function gp(t,n){if(t.subtreeFlags&67108864)for(t=t.child;t!==null;){e:{var s=t,l=n;switch(s.tag){case 4:hy(s,l);break e;case 22:s.memoizedState===null&&gp(s,l);break e;default:gp(s,l)}}t=t.sibling}}function gy(t){var n=t.alternate;n!==null&&(t.alternate=null,gy(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&fn(n)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var $t=null,Kn=!1;function Oi(t,n,s){for(s=s.child;s!==null;)xy(t,n,s),s=s.sibling}function xy(t,n,s){if(pt&&typeof pt.onCommitFiberUnmount=="function")try{pt.onCommitFiberUnmount(Rt,s)}catch{}switch(s.tag){case 26:Nt||En(s,n),Oi(t,n,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&!Nt&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:Nt||En(s,n),Zl(s);var l=$t,f=Kn;or(s.type)&&($t=s.stateNode,Kn=!1),Oi(t,n,s),w0(s.stateNode,s.type,s.memoizedProps),$t=l,Kn=f;break;case 5:Nt||En(s,n),Zl(s);case 6:if(s.tag===6&&Zl(s),l=$t,f=Kn,$t=null,Oi(t,n,s),$t=l,Kn=f,$t!==null)if(Kn)try{($t.nodeType===9?$t.body:$t.nodeName==="HTML"?$t.ownerDocument.body:$t).removeChild(s.stateNode),mt=!0}catch(m){Tt(s,n,m)}else try{$t.removeChild(s.stateNode),mt=!0}catch(m){Tt(s,n,m)}break;case 18:$t!==null&&(Kn?(t=$t,s0(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,s.stateNode),Js(t)):s0($t,s.stateNode));break;case 4:l=$t,f=Kn,$t=s.stateNode.containerInfo,Kn=!0,Oi(t,n,s),$t=l,Kn=f;break;case 0:case 11:case 14:case 15:tr(2,s,n),Nt||tr(4,s,n),Oi(t,n,s);break;case 1:Nt||(En(s,n),l=s.stateNode,typeof l.componentWillUnmount=="function"&&iy(s,n,l)),Oi(t,n,s);break;case 21:Oi(t,n,s);break;case 22:Nt=(l=Nt)||s.memoizedState!==null,Oi(t,n,s),Nt=l;break;case 30:En(s,n),Oi(t,n,s);break;case 7:Nt||En(s,n),Oi(t,n,s);break;default:Oi(t,n,s)}}function by(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Js(t)}catch(s){Tt(n,n.return,s)}}}function yy(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Js(t)}catch(s){Tt(n,n.return,s)}}function k_(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new py),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new py),n;default:throw Error(r(435,t.tag))}}function tu(t,n){var s=k_(t);n.forEach(function(l){if(!s.has(l)){s.add(l);var f=D_.bind(null,t,l);l.then(f,f)}})}function Un(t,n,s){var l=n.deletions;if(l!==null)for(var f=0;f<l.length;f++){var m=l[f],k=t,_=n,I=_;e:for(;I!==null;){switch(I.tag){case 27:if(or(I.type)){$t=I.stateNode,Kn=!1;break e}break;case 5:$t=I.stateNode,Kn=!1;break e;case 3:case 4:$t=I.stateNode.containerInfo,Kn=!0;break e}I=I.return}if($t===null)throw Error(r(160));xy(k,_,m),$t=null,Kn=!1,k=m.alternate,k!==null&&(k.return=null),m.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)vy(n,t,s),n=n.sibling}var Mi=null;function vy(t,n,s){var l=t.alternate,f=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(f&4&&(l=t.updateQueue,l=l!==null?l.events:null,l!==null))for(var m=0;m<l.length;m++){var k=l[m];k.ref.impl=k.nextImpl}Un(n,t,s),Bn(t),f&4&&(tr(3,t,t.return),Xl(3,t),tr(5,t,t.return));break;case 1:Un(n,t,s),Bn(t),f&512&&(Nt||l===null||En(l,l.return)),f&64&&hn&&(t=t.updateQueue,t!==null&&(n=t.callbacks,n!==null&&(s=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=s===null?n:s.concat(n))));break;case 26:if(m=Mi,Un(n,t,s),Bn(t),f&512&&(Nt||l===null||En(l,l.return)),f&4)if(f=l!==null?l.memoizedState:null,s=t.memoizedState,l===null)if(s===null)if(t.stateNode===null)if(hn)t.stateNode=i0(t.type,t.memoizedProps,n.containerInfo,t);else{e:{n=t.type,s=t.memoizedProps,f=m.ownerDocument||m;t:switch(n){case"title":l=f.getElementsByTagName("title")[0],(!l||l[Gn]||l[cn]||l.namespaceURI==="http://www.w3.org/2000/svg"||l.hasAttribute("itemprop"))&&(l=f.createElement(n),f.head.insertBefore(l,f.querySelector("head > title"))),_n(l,n,s),l[cn]=t,Wt(l),n=l;break e;case"link":if(m=T0("link","href",f).get(n+(s.href||""))){for(k=0;k<m.length;k++)if(l=m[k],l.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&l.getAttribute("rel")===(s.rel==null?null:s.rel)&&l.getAttribute("title")===(s.title==null?null:s.title)&&l.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){m.splice(k,1);break t}}l=f.createElement(n),_n(l,n,s),f.head.appendChild(l);break;case"meta":if(m=T0("meta","content",f).get(n+(s.content||""))){for(k=0;k<m.length;k++)if(l=m[k],l.getAttribute("content")===(s.content==null?null:""+s.content)&&l.getAttribute("name")===(s.name==null?null:s.name)&&l.getAttribute("property")===(s.property==null?null:s.property)&&l.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&l.getAttribute("charset")===(s.charSet==null?null:s.charSet)){m.splice(k,1);break t}}l=f.createElement(n),_n(l,n,s),f.head.appendChild(l);break;default:throw Error(r(468,n))}l[cn]=t,Wt(l),n=l}t.stateNode=n}else hn||em(m,t.type,t.stateNode);else t.stateNode=S0(m,s,t.memoizedProps);else f!==s?(f===null?(n=l.stateNode,n===null||Nt||n.parentNode.removeChild(n)):f.count--,s===null?hn||em(m,t.type,t.stateNode):S0(m,s,t.memoizedProps)):s===null&&t.stateNode!==null&&rp(t,t.memoizedProps,l.memoizedProps);break;case 27:Un(n,t,s),Bn(t),f&512&&(Nt||l===null||En(l,l.return)),l!==null&&f&4&&rp(t,t.memoizedProps,l.memoizedProps);break;case 5:if(m=Zi,Zi=!1,Un(n,t,s),Zi=m,Bn(t),f&512&&(Nt||l===null||En(l,l.return)),t.flags&32){n=t.stateNode;try{hs(n,""),mt=!0}catch(J){Tt(t,t.return,J)}}f&4&&t.stateNode!=null&&(n=t.memoizedProps,rp(t,n,l!==null?l.memoizedProps:n)),f&1024&&(pp=!0);break;case 6:if(Un(n,t,s),Bn(t),f&4){if(t.stateNode===null)throw Error(r(162));n=t.memoizedProps,s=t.stateNode;try{s.nodeValue=n,mt=!0}catch(J){Tt(t,t.return,J)}}break;case 3:if(mt=!1,gu=null,m=Mi,Mi=so(n.containerInfo),Un(n,t,s),Mi=m,Bn(t),f&4&&l!==null&&l.memoizedState.isDehydrated)try{Js(n.containerInfo)}catch(J){Tt(t,t.return,J)}pp&&(pp=!1,wy(t)),mt=!1;break;case 4:f=Zi,Zi=hn,l=en(),m=Mi,Mi=so(t.stateNode.containerInfo),Un(n,t,s),Bn(t),Mi=m,mt&&Ql&&(Wc=!0),mt=l,Zi=f;break;case 12:Un(n,t,s),Bn(t);break;case 31:Un(n,t,s),Bn(t),f&4&&(n=t.updateQueue,n!==null&&(t.updateQueue=null,tu(t,n)));break;case 13:Un(n,t,s),Bn(t),t.child.flags&8192&&t.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(au=Qt()),f&4&&(n=t.updateQueue,n!==null&&(t.updateQueue=null,tu(t,n)));break;case 22:m=t.memoizedState!==null,k=l!==null&&l.memoizedState!==null;var _=hn,I=Nt,V=Zi;hn=_||m,Zi=V||m,Nt=I||k,Un(n,t,s),Nt=I,Zi=V,hn=_,Bn(t),f&8192&&(n=t.stateNode,n._visibility=m?n._visibility&-2:n._visibility|1,!m||l===null||k||hn||Nt||(n=k||Nt,s=hn,l=Nt,hn=m||hn,Nt=n,nr(t,2),hn=s,Nt=l),!m&&Zi||hp(t,m)),f&4&&(n=t.updateQueue,n!==null&&(s=n.retryQueue,s!==null&&(n.retryQueue=null,tu(t,s))));break;case 19:Un(n,t,s),Bn(t),f&4&&(n=t.updateQueue,n!==null&&(t.updateQueue=null,tu(t,n)));break;case 30:f&512&&(Nt||l===null||En(l,l.return)),f=en(),m=Ql,k=(s&335544064)===s,_=t.memoizedProps,Ql=k&&ba(_.default,_.update)!=="none",Un(n,t,s),Bn(t),k&&l!==null&&mt&&(t.flags|=4),Ql=m,mt=f;break;case 21:break;case 7:f&512&&(Nt||l===null||En(l,l.return)),l&&l.stateNode!==null&&(l.stateNode._fragmentFiber=t);default:Un(n,t,s),Bn(t)}}function Bn(t){var n=t.flags;if(n&2){try{for(var s,l=t.return;l!==null;){if(ry(l)){s=l;break}l=l.return}l=null;for(var f=t.return;f!==null;){if(ip(f)){var m=f.stateNode;l===null?l=[m]:l.push(m)}if(np(f))break;f=f.return}var k=l;if(s==null)throw Error(r(160));switch(s.tag){case 27:var _=s.stateNode,I=sp(t);Xc(t,I,_,k);break;case 5:var V=s.stateNode;s.flags&32&&(hs(V,""),s.flags&=-33);var J=sp(t);Xc(t,J,V,k);break;case 3:case 4:var oe=s.stateNode.containerInfo,G=sp(t);lp(t,G,oe,k);break;default:throw Error(r(161))}}catch(X){Tt(t,t.return,X)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function wy(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;wy(n),n.tag===5&&n.flags&1024&&(n=n.stateNode,Qs=!0,n.reset(),Qs=!1),t=t.sibling}}function Ds(t,n){if(n.subtreeFlags&9270)for(n=n.child;n!==null;)ky(n,t),n=n.sibling;else fy(n)}function ky(t,n){var s=t.alternate;if(s===null)op(t,!1);else switch(t.tag){case 3:if(mp=Qi=!1,oy(),Ds(n,t),!Qi&&!Wc){if(t=Ki,t!==null)for(var l=0;l<t.length;l+=3){s=t[l];var f=t[l+1];c0(s,t[l+2]),s=s.ownerDocument.documentElement,s!==null&&s.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+f+")"})}t=n.containerInfo,t=t.nodeType===9?t.documentElement:t.ownerDocument.documentElement,t!==null&&t.style.viewTransitionName===""&&(t.style.viewTransitionName="none",t.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),t.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),mp=!0}Ki=null;break;case 5:Ds(n,t);break;case 4:l=Qi,Qi=!1,Ds(n,t),Qi&&(Wc=!0),Qi=l;break;case 22:t.memoizedState===null&&(s.memoizedState!==null?op(t,!1):Ds(n,t));break;case 30:l=Qi,f=oy(),Qi=!1,Ds(n,t),Qi&&(t.flags|=4);var m=t.memoizedProps,k=t.stateNode;n=xa(m,k),k=xa(s.memoizedProps,k);var _=ba(m.default,m.update);_==="none"?n=!1:(m=s.memoizedState,s.memoizedState=null,s=t.child,Vn=0,n=fp(t,s,n,k,_,m,!0),Vn!==(m===null?0:m.length)&&(t.flags|=32)),(t.flags&4)!==0&&n?(Ps(t,t.memoizedProps.onUpdate),Ki=f):f!==null&&(f.push.apply(f,Ki),Ki=f),Qi=(t.flags&32)!==0?!0:l;break;default:Ds(n,t)}}function Ji(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)my(t,n.alternate,n),n=n.sibling}function nr(t,n){for(t=t.child;t!==null;){var s=t,l=n;switch(s.tag){case 0:case 11:case 14:case 15:tr(4,s,s.return),nr(s,l);break;case 1:En(s,s.return);var f=s.stateNode;typeof f.componentWillUnmount=="function"&&iy(s,s.return,f),nr(s,l);break;case 27:(l&2)!==0&&w0(s.stateNode,s.type,s.memoizedProps);case 5:En(s,s.return),s.tag!==5&&s.tag!==27||Zl(s),nr(s,l);break;case 6:Zl(s);break;case 26:En(s,s.return),f=s.stateNode,s.memoizedState!==null||f===null||Nt||f.parentNode.removeChild(f),nr(s,l);break;case 22:s.memoizedState===null&&nr(s,l);break;case 30:En(s,s.return),nr(s,l);break;case 7:En(s,s.return);default:nr(s,l)}t=t.sibling}}function Ri(t,n,s){for(s=(n.subtreeFlags&8772)!==0?s:s&-2,n=n.child;n!==null;){var l=n.alternate,f=t,m=n,k=m.flags,_=(s&1)!==0;switch(m.tag){case 0:case 11:case 15:Ri(f,m,s),Xl(4,m);break;case 1:if(Ri(f,m,s),l=m,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(J){Tt(l,l.return,J)}if(l=m,f=l.updateQueue,f!==null){var I=l.stateNode;try{var V=f.shared.hiddenCallbacks;if(V!==null)for(f.shared.hiddenCallbacks=null,f=0;f<V.length;f++)qx(V[f],I)}catch(J){Tt(l,l.return,J)}}_&&k&64&&ny(m),Vi(m,m.return);break;case 27:(s&2)!==0&&sy(m);case 5:m.tag!==5&&m.tag!==27||ay(m),Ri(f,m,s),_&&l===null&&k&4&&ap(m),Vi(m,m.return);break;case 6:ay(m);break;case 26:I=m.stateNode,m.memoizedState!==null||I===null||hn||em(so(I.ownerDocument),m.type,I),Ri(f,m,s),_&&l===null&&k&4&&ap(m),Vi(m,m.return);break;case 12:Ri(f,m,s);break;case 31:Ri(f,m,s),_&&k&4&&by(f,m);break;case 13:Ri(f,m,s),_&&k&4&&yy(f,m);break;case 22:m.memoizedState===null&&Ri(f,m,s),Vi(m,m.return);break;case 30:Ri(f,m,s),Vi(m,m.return);break;case 7:Vi(m,m.return);default:Ri(f,m,s)}n=n.sibling}}function xp(t,n){var s=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),t=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(t=n.memoizedState.cachePool.pool),t!==s&&(t!=null&&t.refCount++,s!=null&&Ll(s))}function bp(t,n){t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Ll(t))}function bi(t,n,s,l){var f=(s&335544064)===s;if(n.subtreeFlags&(f?10262:10256))for(n=n.child;n!==null;)Ny(t,n,s,l),n=n.sibling;else f&&dy(n)}function Ny(t,n,s,l){var f=(s&335544064)===s;f&&n.alternate===null&&n.return!==null&&n.return.alternate!==null&&Jc(n);var m=n.flags;switch(n.tag){case 0:case 11:case 15:bi(t,n,s,l),m&2048&&Xl(9,n);break;case 1:bi(t,n,s,l);break;case 3:bi(t,n,s,l),f&&mp&&(t=t.containerInfo,t=t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,t.style.viewTransitionName==="root"&&(t.style.viewTransitionName=""),t=t.ownerDocument.documentElement,t!==null&&t.style.viewTransitionName==="none"&&(t.style.viewTransitionName="")),m&2048&&(m=null,n.alternate!==null&&(m=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==m&&(n.refCount++,m!=null&&Ll(m)));break;case 12:if(m&2048){bi(t,n,s,l),m=n.stateNode;try{var k=n.memoizedProps,_=k.id,I=k.onPostCommit;typeof I=="function"&&I(_,n.alternate===null?"mount":"update",m.passiveEffectDuration,-0)}catch(V){Tt(n,n.return,V)}}else bi(t,n,s,l);break;case 31:bi(t,n,s,l);break;case 13:bi(t,n,s,l);break;case 23:break;case 22:k=n.stateNode,_=n.alternate,n.memoizedState!==null?(f&&_!==null&&_.memoizedState===null&&Jc(_),k._visibility&2?bi(t,n,s,l):Jl(t,n)):(f&&_!==null&&_.memoizedState!==null&&Jc(n),k._visibility&2?bi(t,n,s,l):(k._visibility|=2,zs(t,n,s,l,(n.subtreeFlags&10256)!==0||!1))),m&2048&&xp(_,n);break;case 24:bi(t,n,s,l),m&2048&&bp(n.alternate,n);break;case 30:f&&(m=n.alternate,m!==null&&(Xi(m.child,!0),Xi(n.child,!0))),bi(t,n,s,l);break;default:bi(t,n,s,l)}}function zs(t,n,s,l,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var m=t,k=n,_=s,I=l,V=k.flags;switch(k.tag){case 0:case 11:case 15:zs(m,k,_,I,f),Xl(8,k);break;case 23:break;case 22:var J=k.stateNode;k.memoizedState!==null?J._visibility&2?zs(m,k,_,I,f):Jl(m,k):(J._visibility|=2,zs(m,k,_,I,f)),f&&V&2048&&xp(k.alternate,k);break;case 24:zs(m,k,_,I,f),f&&V&2048&&bp(k.alternate,k);break;default:zs(m,k,_,I,f)}n=n.sibling}}function Jl(t,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var s=t,l=n,f=l.flags;switch(l.tag){case 22:Jl(s,l),f&2048&&xp(l.alternate,l);break;case 24:Jl(s,l),f&2048&&bp(l.alternate,l);break;default:Jl(s,l)}n=n.sibling}}var Hr=8192;function Fr(t,n,s){if(t.subtreeFlags&Hr)for(t=t.child;t!==null;)Ey(t,n,s),t=t.sibling}function Ey(t,n,s){switch(t.tag){case 26:Fr(t,n,s),t.flags&Hr&&(t.memoizedState!==null?CS(s,Mi,t.memoizedState,t.memoizedProps):(t=t.stateNode,(n&335544128)===n&&O0(s,t)));break;case 5:Fr(t,n,s),t.flags&Hr&&(t=t.stateNode,(n&335544128)===n&&O0(s,t));break;case 3:case 4:var l=Mi;Mi=so(t.stateNode.containerInfo),Fr(t,n,s),Mi=l;break;case 22:t.memoizedState===null&&(l=t.alternate,l!==null&&l.memoizedState!==null?(l=Hr,Hr=16777216,Fr(t,n,s),Hr=l):Fr(t,n,s));break;case 30:if((t.flags&Hr)!==0&&(l=t.memoizedProps.name,l!=null&&l!=="auto")){var f=t.stateNode;f.paired=null,ai===null&&(ai=new Map),ai.set(l,f)}Fr(t,n,s);break;default:Fr(t,n,s)}}function _y(t){var n=t.alternate;if(n!==null&&(t=n.child,t!==null)){n.child=null;do n=t.sibling,t.sibling=null,t=n;while(t!==null)}}function Wl(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var s=0;s<n.length;s++){var l=n[s];gn=l,Ty(l,t)}_y(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Sy(t),t=t.sibling}function Sy(t){switch(t.tag){case 0:case 11:case 15:Wl(t),t.flags&2048&&tr(9,t,t.return);break;case 3:Wl(t);break;case 12:Wl(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,nu(t)):Wl(t);break;default:Wl(t)}}function nu(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var s=0;s<n.length;s++){var l=n[s];gn=l,Ty(l,t)}_y(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:tr(8,n,n.return),nu(n);break;case 22:s=n.stateNode,s._visibility&2&&(s._visibility&=-3,nu(n));break;default:nu(n)}t=t.sibling}}function Ty(t,n){for(;gn!==null;){var s=gn;switch(s.tag){case 0:case 11:case 15:tr(8,s,n);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var l=s.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Ll(s.memoizedState.cache)}if(l=s.child,l!==null)l.return=s,gn=l;else e:for(s=t;gn!==null;){l=gn;var f=l.sibling,m=l.return;if(gy(l),l===s){gn=null;break e}if(f!==null){f.return=m,gn=f;break e}gn=m}}}var N_={getCacheForType:function(t){var n=wn(tn),s=n.data.get(t);return s===void 0&&(s=t(),n.data.set(t,s)),s},cacheSignal:function(){return wn(tn).controller.signal}},E_=typeof WeakMap=="function"?WeakMap:Map,wt=0,Dt=null,ct=null,dt=0,St=0,ri=null,ir=!1,Ls=!1,yp=!1,Ta=0,Gt=0,ar=0,qr=0,iu=0,si=0,Is=0,eo=null,Xn=null,vp=!1,au=0,Cy=0,ru=1/0,su=null,rr=null,Ht=0,Di=null,Gr=null,Wi=0,wp=0,kp=null,jy=null,Us=null,Bs=null,$s=null,to=0,lu=null;function li(){return(wt&2)!==0&&dt!==0?dt&-dt:ye.T!==null?Mp():tc()}function Ay(){if(si===0)if((dt&536870912)===0||st){var t=Ia;Ia<<=1,(Ia&3932160)===0&&(Ia=262144),si=t}else si=536870912;return t=kn.current,t!==null&&(t.flags|=32),si}function Ps(t,n){if(n!=null){var s=t.stateNode,l=s.ref;l===null&&(l=s.ref=u0(xa(t.memoizedProps,s))),Bs===null&&(Bs=[]),Bs.push(n.bind(null,l))}}function Zn(t,n,s){(t===Dt&&(St===2||St===9)||t.cancelPendingCommit!==null)&&(Hs(t,0),sr(t,dt,si,!1)),Sr(t,s),((wt&2)===0||t!==Dt)&&(t===Dt&&((wt&2)===0&&(qr|=s),Gt===4&&sr(t,dt,si,!1)),ea(t))}function Oy(t,n,s){if((wt&6)!==0)throw Error(r(327));var l=!s&&(n&127)===0&&(n&t.expiredLanes)===0||_r(t,n),f=l?T_(t,n):Ep(t,n,!0),m=l;do{if(f===0){Ls&&!l&&sr(t,n,0,!1);break}else{if(s=t.current.alternate,m&&!__(s)){f=Ep(t,n,!1),m=!1;continue}if(f===2){if(m=n,t.errorRecoveryDisabledLanes&m)var k=0;else k=t.pendingLanes&-536870913,k=k!==0?k:k&536870912?536870912:0;if(k!==0){n=k;e:{var _=t;f=eo;var I=_.current.memoizedState.isDehydrated;if(I&&(Hs(_,k).flags|=256),k=Ep(_,k,!1),k!==2&&k!==6){if(yp&&!I){_.errorRecoveryDisabledLanes|=m,qr|=m,f=4;break e}m=Xn,Xn=f,m!==null&&(Xn===null?Xn=m:Xn.push.apply(Xn,m))}f=k}if(m=!1,f!==2)continue}}if(f===1){Hs(t,0),sr(t,n,0,!0);break}e:{switch(l=t,m=f,m){case 0:case 1:throw Error(r(345));case 4:if((n&4194048)!==n&&(n&62914560)!==n)break;case 6:sr(l,n,si,!ir);break e;case 2:Xn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((n&62914560)===n&&(f=au+300-Qt(),10<f)){if(sr(l,n,si,!ir),Ba(l,0,!0)!==0)break e;Wi=n,l.timeoutHandle=Fp(My.bind(null,l,s,Xn,su,vp,n,si,qr,Is,ir,m,"Throttled",-0,0),f);break e}My(l,s,Xn,su,vp,n,si,qr,Is,ir,m,null,-0,0)}}break}while(!0);ea(t)}function My(t,n,s,l,f,m,k,_,I,V,J,oe,G,X){t.timeoutHandle=-1;var Se=n.subtreeFlags,ze=(m&335544064)===m;if(oe=null,(ze||Se&8192||(Se&16785408)===16785408)&&(oe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:qi},ai=null,Ey(n,m,oe),ze&&(Se=oe,ze=t.containerInfo,ze=(ze.nodeType===9?ze:ze.ownerDocument).__reactViewTransition,ze!=null&&(Se.count++,Se.waitingForViewTransition=!0,Se=co.bind(Se),ze.finished.then(Se,Se))),Se=(m&62914560)===m?au-Qt():(m&4194048)===m?Cy-Qt():0,Se=jS(oe,Se),Se!==null)){Wi=m,t.cancelPendingCommit=Se($y.bind(null,t,n,m,s,l,f,k,_,I,V,J,oe,null,G,X)),sr(t,m,k,!V);return}$y(t,n,m,s,l,f,k,_,I,V,J,oe)}function __(t){for(var n=t;;){var s=n.tag;if((s===0||s===11||s===15)&&n.flags&16384&&(s=n.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var l=0;l<s.length;l++){var f=s[l],m=f.getSnapshot;f=f.value;try{if(!ni(m(),f))return!1}catch{return!1}}if(s=n.child,n.subtreeFlags&16384&&s!==null)s.return=n,n=s;else{if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function sr(t,n,s,l){n=Wo(t,n),n&=~iu,n&=~qr,t.suspendedLanes|=n,t.pingedLanes&=~n,l&&(t.warmLanes|=n),l=t.expirationTimes;for(var f=n;0<f;){var m=31-Te(f),k=1<<m;l[m]=-1,f&=~k}s!==0&&ec(t,s,n)}function ou(){return(wt&6)===0?(no(0),!1):!0}function Np(){if(ct!==null){if(St===0)var t=ct.return;else t=ct,wa=Mr=null,Of(t),Cs=null,Bl=0,t=ct;for(;t!==null;)ty(t.alternate,t),t=t.return;ct=null}}function Hs(t,n){var s=t.timeoutHandle;return s!==-1&&(t.timeoutHandle=-1,X_(s)),s=t.cancelPendingCommit,s!==null&&(t.cancelPendingCommit=null,s()),Wi=0,Np(),Dt=t,ct=s=ya(t.current,null),dt=n,St=0,ri=null,ir=!1,Ls=_r(t,n),yp=!1,Is=si=iu=qr=ar=Gt=0,Xn=eo=null,vp=!1,Ta=Wo(t,n),gc(),s}function Ry(t,n){it=null,ye.H=Pc,n===Ts||n===Tc?(n=$x(),St=3):n===bf?(n=$x(),St=4):St=n===Yf?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,ri=n,ct===null&&(Gt=1,Hc(t,mi(n,t.current)))}function Dy(){var t=kn.current;return t===null?!0:(dt&4194048)===dt?An===null:(dt&62914560)===dt||(dt&536870912)!==0?t===An:!1}function zy(){var t=ye.H;return ye.H=Pc,t===null?Pc:t}function Ly(){var t=ye.A;return ye.A=N_,t}function cu(){Gt=4,ir||(dt&4194048)!==dt&&kn.current!==null||(Ls=!0),(ar&134217727)===0&&(qr&134217727)===0||Dt===null||sr(Dt,dt,si,!1)}function Ep(t,n,s){var l=wt;wt|=2;var f=zy(),m=Ly();(Dt!==t||dt!==n)&&(su=null,Hs(t,n)),n=!1;var k=Gt;e:do try{if(St!==0&&ct!==null){var _=ct,I=ri;switch(St){case 8:Np(),k=6;break e;case 3:case 2:case 9:case 6:kn.current===null&&(n=!0);var V=St;if(St=0,ri=null,Fs(t,_,I,V),s&&Ls){k=0;break e}break;default:V=St,St=0,ri=null,Fs(t,_,I,V)}}S_(),k=Gt;break}catch(J){Ry(t,J)}while(!0);return n&&t.shellSuspendCounter++,wa=Mr=null,wt=l,ye.H=f,ye.A=m,ct===null&&(Dt=null,dt=0,gc()),k}function S_(){for(;ct!==null;)Iy(ct)}function T_(t,n){var s=wt;wt|=2;var l=zy(),f=Ly();Dt!==t||dt!==n?(su=null,ru=Qt()+500,Hs(t,n)):Ls=_r(t,n);e:do try{if(St!==0&&ct!==null){n=ct;var m=ri;t:switch(St){case 1:St=0,ri=null,Fs(t,n,m,1);break;case 2:case 9:if(Ux(m)){St=0,ri=null,Uy(n);break}n=function(){St!==2&&St!==9||Dt!==t||(St=7),ea(t)},m.then(n,n);break e;case 3:St=7;break e;case 4:St=5;break e;case 7:Ux(m)?(St=0,ri=null,Uy(n)):(St=0,ri=null,Fs(t,n,m,7));break;case 5:var k=null;switch(ct.tag){case 26:k=ct.memoizedState;case 5:case 27:var _=ct;if(k?j0(k):_.stateNode.complete){St=0,ri=null;var I=_.sibling;if(I!==null)ct=I;else{var V=_.return;V!==null?(ct=V,uu(V)):ct=null}break t}}St=0,ri=null,Fs(t,n,m,5);break;case 6:St=0,ri=null,Fs(t,n,m,6);break;case 8:Np(),Gt=6;break e;default:throw Error(r(462))}}C_();break}catch(J){Ry(t,J)}while(!0);return wa=Mr=null,ye.H=l,ye.A=f,wt=s,ct!==null?0:(Dt=null,dt=0,gc(),Gt)}function C_(){for(;ct!==null&&!ca();)Iy(ct)}function Iy(t){var n=Wb(t.alternate,t,Ta);t.memoizedProps=t.pendingProps,n===null?uu(t):ct=n}function Uy(t){var n=t,s=n.alternate;switch(n.tag){case 15:case 0:n=Yb(s,n,n.pendingProps,n.type,void 0,dt);break;case 11:n=Yb(s,n,n.pendingProps,n.type.render,n.ref,dt);break;case 5:Of(n);var l=n;l===mn&&(st?(kc(l),l.tag===5&&l.stateNode!=null&&(Ut=l.stateNode)):(kc(l),st=!0));default:ty(s,n),n=ct=Tx(n,Ta),n=Wb(s,n,Ta)}t.memoizedProps=t.pendingProps,n===null?uu(t):ct=n}function Fs(t,n,s,l){wa=Mr=null,Of(n),Cs=null,Bl=0;var f=n.return;try{if(h_(t,f,n,s,dt)){Gt=1,Hc(t,mi(s,t.current)),ct=null;return}}catch(m){if(f!==null)throw ct=f,m;Gt=1,Hc(t,mi(s,t.current)),ct=null;return}n.flags&32768?(st||l===1?t=!0:Ls||(dt&536870912)!==0?t=!1:(ir=t=!0,(l===2||l===9||l===3||l===6)&&(l=kn.current,l!==null&&l.tag===13&&(l.flags|=16384))),By(n,t)):uu(n)}function uu(t){var n=t;do{if((n.flags&32768)!==0){By(n,ir);return}t=n.return;var s=y_(n.alternate,n,Ta);if(s!==null){ct=s;return}if(n=n.sibling,n!==null){ct=n;return}ct=n=t}while(n!==null);Gt===0&&(Gt=5)}function By(t,n){do{var s=v_(t.alternate,t);if(s!==null){s.flags&=32767,ct=s;return}if(s=t.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!n&&(t=t.sibling,t!==null)){ct=t;return}ct=t=s}while(t!==null);Gt=6,ct=null}function $y(t,n,s,l,f,m,k,_,I,V,J,oe){t.cancelPendingCommit=null;do du();while(Ht!==0);if((wt&6)!==0)throw Error(r(327));if(n!==null){if(n===t.current)throw Error(r(177));t===Dt&&(ct=Dt=null,dt=0),Gr=n,Di=t,Wi=s,kp=f,jy=l,j_(t,n,s,k,_,I,oe)}}function j_(t,n,s,l,f,m,k){var _=n.lanes|n.childLanes;if(wp=_,_|=rf,Ud(t,s,_,l,f,m),Bs=null,(s&335544064)===s?($s=i_(t),l=10262):($s=null,l=10256),(n.subtreeFlags&l)!==0||(n.flags&l)!==0?(t.callbackNode=null,t.callbackPriority=0,z_(Ci,function(){return Cp(),null})):(t.callbackNode=null,t.callbackPriority=0),Zc=!1,l=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||l){l=ye.T,ye.T=null,f=Q.p,Q.p=2,m=wt,wt|=4;try{w_(t,n,s)}finally{wt=m,Q.p=f,ye.T=l}}Ht=1,Zc?Us=tS(k,t.containerInfo,$s,_p,Sp,O_,Tp,Cp,A_):(_p(),Sp(),Tp())}function A_(t){if(Ht!==0){var n=Di.onRecoverableError;n(t,{componentStack:null})}}function O_(){Ht===3&&(Ht=0,ky(Gr,Di),Ht=4)}function _p(){if(Ht===1){Ht=0;var t=Di,n=Gr,s=Wi,l=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||l){l=ye.T,ye.T=null;var f=Q.p;Q.p=2;var m=wt;wt|=4;try{Ql=Wc=!1,vy(n,t,s),s=$p;var k=xx(t.containerInfo),_=s.focusedElem,I=s.selectionRange;if(k!==_&&_&&_.ownerDocument&&gx(_.ownerDocument.documentElement,_)){if(I!==null&&Wd(_)){var V=I.start,J=I.end;if(J===void 0&&(J=V),"selectionStart"in _)_.selectionStart=V,_.selectionEnd=Math.min(J,_.value.length);else{var oe=_.ownerDocument||document,G=oe&&oe.defaultView||window;if(G.getSelection){var X=G.getSelection(),Se=_.textContent.length,ze=Math.min(I.start,Se),at=I.end===void 0?ze:Math.min(I.end,Se);!X.extend&&ze>at&&(k=at,at=ze,ze=k);var Y=hx(_,ze),F=hx(_,at);if(Y&&F&&(X.rangeCount!==1||X.anchorNode!==Y.node||X.anchorOffset!==Y.offset||X.focusNode!==F.node||X.focusOffset!==F.offset)){var K=oe.createRange();K.setStart(Y.node,Y.offset),X.removeAllRanges(),ze>at?(X.addRange(K),X.extend(F.node,F.offset)):(K.setEnd(F.node,F.offset),X.addRange(K))}}}}for(oe=[],X=_;X=X.parentNode;)X.nodeType===1&&oe.push({element:X,left:X.scrollLeft,top:X.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_<oe.length;_++){var le=oe[_];le.element.scrollLeft=le.left,le.element.scrollTop=le.top}}Qs=!!Bp,$p=Bp=null}finally{wt=m,Q.p=f,ye.T=l}}t.current=n,Ht=2}}function Sp(){if(Ht===2){Ht=0;var t=Di,n=Gr,s=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||s){s=ye.T,ye.T=null;var l=Q.p;Q.p=2;var f=wt;wt|=4;try{my(t,n.alternate,n)}finally{wt=f,Q.p=l,ye.T=s}}Ht=3}}function Tp(){if(Ht===4||Ht===3){Ht=0;var t=Us;Us=null,La();var n=Di,s=Gr,l=Wi,f=jy,m=(l&335544064)===l?10262:10256;if((s.subtreeFlags&m)!==0||(s.flags&m)!==0?Ht=5:(Ht=0,Gr=Di=null,Py(n,n.pendingLanes)),m=n.pendingLanes,m===0&&(rr=null),Nl(l),s=s.stateNode,pt&&typeof pt.onCommitFiberRoot=="function")try{pt.onCommitFiberRoot(Rt,s,void 0,(s.current.flags&128)===128)}catch{}if(f!==null){s=ye.T,m=Q.p,Q.p=2,ye.T=null;try{for(var k=n.onRecoverableError,_=0;_<f.length;_++){var I=f[_];k(I.value,{componentStack:I.stack})}}finally{ye.T=s,Q.p=m}}if(f=Bs,k=$s,$s=null,f!==null&&(Bs=null,k===null&&(k=[]),t!==null))for(I=0;I<f.length;I++)s=(0,f[I])(k),s!==void 0&&t.finished.finally(s);(Wi&3)!==0&&du(),ea(n),m=n.pendingLanes,(l&261930)!==0&&(m&42)!==0?n===lu?to++:(to=0,lu=n):(to=0,lu=null),no(0)}}function Py(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,Ll(n)))}function du(){return Us!==null&&(Us.skipTransition(),Us=null),_p(),Sp(),Tp(),Cp()}function Cp(){if(Ht!==5)return!1;var t=Di,n=wp;wp=0;var s=Nl(Wi),l=ye.T,f=Q.p;try{Q.p=32>s?32:s,ye.T=null,s=kp,kp=null;var m=Di,k=Wi;if(Ht=0,Gr=Di=null,Wi=0,(wt&6)!==0)throw Error(r(331));var _=wt;if(wt|=4,Sy(m.current),Ny(m,m.current,k,s),wt=_,no(0,!1),pt&&typeof pt.onPostCommitFiberRoot=="function")try{pt.onPostCommitFiberRoot(Rt,m)}catch{}return!0}finally{Q.p=f,ye.T=l,Py(t,n)}}function Hy(t,n,s){n=mi(s,n),n=Gf(t.stateNode,n,2),t=Qa(t,n,2),t!==null&&(Sr(t,2),ea(t))}function Tt(t,n,s){if(t.tag===3)Hy(t,t,s);else for(;n!==null;){if(n.tag===3){Hy(n,t,s);break}else if(n.tag===1){var l=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(rr===null||!rr.has(l))){t=mi(s,t),s=Ub(2),l=Qa(n,s,2),l!==null&&(Bb(s,l,n,t),Sr(l,2),ea(l));break}}n=n.return}}function jp(t,n,s){var l=t.pingCache;if(l===null){l=t.pingCache=new E_;var f=new Set;l.set(n,f)}else f=l.get(n),f===void 0&&(f=new Set,l.set(n,f));f.has(s)||(yp=!0,f.add(s),t=M_.bind(null,t,n,s),n.then(t,t))}function M_(t,n,s){var l=t.pingCache;l!==null&&l.delete(n),t.pingedLanes|=t.suspendedLanes&s,t.warmLanes&=~s,Dt===t&&(dt&s)===s&&((Gt===4||Gt===3&&(dt&62914560)===dt&&300>Qt()-au)&&(wt&2)===0?Hs(t,0):iu|=s,Is===dt&&(Is=0)),ea(t)}function Fy(t,n){n===0&&(n=wl()),t=jr(t,n),t!==null&&(Sr(t,n),ea(t))}function R_(t){var n=t.memoizedState,s=0;n!==null&&(s=n.retryLane),Fy(t,s)}function D_(t,n){var s=0;switch(t.tag){case 31:case 13:var l=t.stateNode,f=t.memoizedState;f!==null&&(s=f.retryLane);break;case 19:l=t.stateNode;break;case 22:l=t.stateNode._retryCache;break;default:throw Error(r(314))}l!==null&&l.delete(n),Fy(t,s)}function z_(t,n){return _i(t,n)}var qs=null,Gs=null,Ap=!1,fu=!1,Op=!1,lr=0;function ea(t){t!==Gs&&t.next===null&&(Gs===null?qs=Gs=t:Gs=Gs.next=t),fu=!0,Ap||(Ap=!0,I_())}function no(t,n){if(!Op&&fu){Op=!0;do for(var s=!1,l=qs;l!==null;){if(t!==0){var f=l.pendingLanes;if(f===0)var m=0;else{var k=l.suspendedLanes,_=l.pingedLanes;m=(1<<31-Te(42|t)+1)-1,m&=f&~(k&~_),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(s=!0,Vy(l,m))}else m=dt,m=Ba(l,l===Dt?m:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(m&3)===0||_r(l,m)||(s=!0,Vy(l,m));l=l.next}while(s);Op=!1}}function L_(){qy()}function qy(){fu=Ap=!1;var t=0;lr!==0&&K_()&&(t=lr);for(var n=Qt(),s=null,l=qs;l!==null;){var f=l.next,m=Gy(l,n);m===0?(l.next=null,s===null?qs=f:s.next=f,f===null&&(Gs=s)):(s=l,(t!==0||(m&3)!==0)&&(fu=!0)),l=f}Ht!==0&&Ht!==5||no(t),lr!==0&&(lr=0)}function Gy(t,n){for(var s=t.suspendedLanes,l=t.pingedLanes,f=t.expirationTimes,m=t.pendingLanes&-62914561;0<m;){var k=31-Te(m),_=1<<k,I=f[k];I===-1?((_&s)===0||(_&l)!==0)&&(f[k]=Id(_,n)):I<=n&&(t.expiredLanes|=_),m&=~_}if(n=Dt,s=dt,s=Ba(t,t===n?s:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),l=t.callbackNode,s===0||t===n&&(St===2||St===9)||t.cancelPendingCommit!==null)return l!==null&&l!==null&&Si(l),t.callbackNode=null,t.callbackPriority=0;if((s&3)===0||_r(t,s)){if(n=s&-s,n===t.callbackPriority)return n;switch(l!==null&&Si(l),Nl(s)){case 2:case 8:s=zn;break;case 32:s=Ci;break;case 268435456:s=ue;break;default:s=Ci}return l=Yy.bind(null,t),s=_i(s,l),t.callbackPriority=n,t.callbackNode=s,n}return l!==null&&l!==null&&Si(l),t.callbackPriority=2,t.callbackNode=null,2}function Yy(t,n){if(Ht!==0&&Ht!==5)return t.callbackNode=null,t.callbackPriority=0,null;var s=t.callbackNode;if(du()&&t.callbackNode!==s)return null;var l=dt;return l=Ba(t,t===Dt?l:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),l===0?null:(Oy(t,l,n),Gy(t,Qt()),t.callbackNode!=null&&t.callbackNode===s?Yy.bind(null,t):null)}function Vy(t,n){if(du())return null;Oy(t,n,!0)}function I_(){Z_(function(){(wt&6)!==0?_i(Ti,L_):qy()})}function Mp(){if(lr===0){var t=zr;t===0&&(t=Fi,Fi<<=1,(Fi&261888)===0&&(Fi=256)),lr=t}return lr}function Ky(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:oc(t)}function U_(t,n,s,l,f){if(n==="submit"&&s&&s.stateNode===f){var m=Ky((f[xe]||null).action),k=l.submitter;k&&(n=(n=k[xe]||null)?Ky(n.formAction):k.getAttribute("formAction"),n!==null&&(m=n,k=null));var _=new fc("action","action",null,l,f);t.push({event:_,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(lr!==0){var I=new FormData(f,k);$f(s,{pending:!0,data:I,method:f.method,action:m},null,I)}}else typeof m=="function"&&(_.preventDefault(),I=new FormData(f,k),$f(s,{pending:!0,data:I,method:f.method,action:m},m,I))},currentTarget:f}]})}}for(var Rp=0;Rp<af.length;Rp++){var Dp=af[Rp],B_=Dp.toLowerCase(),$_=Dp[0].toUpperCase()+Dp.slice(1);Ai(B_,"on"+$_)}Ai(vx,"onAnimationEnd"),Ai(wx,"onAnimationIteration"),Ai(kx,"onAnimationStart"),Ai("dblclick","onDoubleClick"),Ai("focusin","onFocus"),Ai("focusout","onBlur"),Ai(XE,"onTransitionRun"),Ai(ZE,"onTransitionStart"),Ai(QE,"onTransitionCancel"),Ai(Nx,"onTransitionEnd"),ma("onMouseEnter",["mouseout","mouseover"]),ma("onMouseLeave",["mouseout","mouseover"]),ma("onPointerEnter",["pointerout","pointerover"]),ma("onPointerLeave",["pointerout","pointerover"]),di("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),di("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),di("onBeforeInput",["compositionend","keypress","textInput","paste"]),di("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),di("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),di("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var io="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),P_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(io));function Xy(t,n){n=(n&4)!==0;for(var s=0;s<t.length;s++){var l=t[s],f=l.event;l=l.listeners;e:{var m=void 0;if(n)for(var k=l.length-1;0<=k;k--){var _=l[k],I=_.instance,V=_.currentTarget;if(_=_.listener,I!==m&&f.isPropagationStopped())break e;m=_,f.currentTarget=V;try{m(f)}catch(J){hc(J)}f.currentTarget=null,m=I}else for(k=0;k<l.length;k++){if(_=l[k],I=_.instance,V=_.currentTarget,_=_.listener,I!==m&&f.isPropagationStopped())break e;m=_,f.currentTarget=V;try{m(f)}catch(J){hc(J)}f.currentTarget=null,m=I}}}}function ut(t,n){var s=n[ot];s===void 0&&(s=n[ot]=new Set);var l=t+"__bubble";s.has(l)||(Zy(n,t,2,!1),s.add(l))}function zp(t,n,s){var l=0;n&&(l|=4),Zy(s,t,l,n)}var pu="_reactListening"+Math.random().toString(36).slice(2);function Lp(t){if(!t[pu]){t[pu]=!0,ac.forEach(function(s){s!=="selectionchange"&&(P_.has(s)||zp(s,!1,t),zp(s,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[pu]||(n[pu]=!0,zp("selectionchange",!1,n))}}function Zy(t,n,s,l){switch(B0(n)){case 2:var f=RS;break;case 8:f=DS;break;default:f=nm}s=f.bind(null,n,s,t),f=void 0,!Fd||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),l?f!==void 0?t.addEventListener(n,s,{capture:!0,passive:f}):t.addEventListener(n,s,!0):f!==void 0?t.addEventListener(n,s,{passive:f}):t.addEventListener(n,s,!1)}function Ip(t,n,s,l,f){var m=l;if((n&1)===0&&(n&2)===0&&l!==null)e:for(;;){if(l===null)return;var k=l.tag;if(k===3||k===4){var _=l.stateNode.containerInfo;if(_===f)break;if(k===4)for(k=l.return;k!==null;){var I=k.tag;if((I===3||I===4)&&k.stateNode.containerInfo===f)return;k=k.return}for(;_!==null;){if(k=pn(_),k===null)return;if(I=k.tag,I===5||I===6||I===26||I===27){l=m=k;continue e}_=_.parentNode}}l=l.return}Zg(function(){var V=m,J=Pd(s),oe=[];e:{var G=Ex.get(t);if(G!==void 0){var X=fc,Se=t;switch(t){case"keypress":if(uc(s)===0)break e;case"keydown":case"keyup":X=_E;break;case"focusin":Se="focus",X=Vd;break;case"focusout":Se="blur",X=Vd;break;case"beforeblur":case"afterblur":X=Vd;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":X=Wg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":X=pE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":X=AE;break;case vx:case wx:case kx:X=gE;break;case Nx:X=ME;break;case"scroll":case"scrollend":X=dE;break;case"wheel":X=DE;break;case"copy":case"cut":case"paste":X=bE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":X=tx;break;case"submit":X=CE;break;case"toggle":case"beforetoggle":X=LE}var ze=(n&4)!==0,at=!ze&&(t==="scroll"||t==="scrollend"),Y=ze?G!==null?G+"Capture":null:G;ze=[];for(var F=V,K;F!==null;){var le=F;if(K=le.stateNode,le=le.tag,le!==5&&le!==26&&le!==27||K===null||Y===null||(le=_l(F,Y),le!=null&&ze.push(ao(F,le,K))),at)break;F=F.return}0<ze.length&&(G=new X(G,Se,null,s,J),oe.push({event:G,listeners:ze}))}}if((n&7)===0){e:{if(X=t==="mouseover"||t==="pointerover",G=t==="mouseout"||t==="pointerout",X&&s!==$d&&(Se=s.relatedTarget||s.fromElement)&&(pn(Se)||Se[Le]))break e;(G||X)&&(Se=J.window===J?J:(X=J.ownerDocument)?X.defaultView||X.parentWindow:window,G?(X=s.relatedTarget||s.toElement,G=V,X=X?pn(X):null,X!==null&&(at=u(X),ze=X.tag,X!==at||ze!==5&&ze!==27&&ze!==6)&&(X=null)):(G=null,X=V),G!==X&&(ze=Wg,le="onMouseLeave",Y="onMouseEnter",F="mouse",(t==="pointerout"||t==="pointerover")&&(ze=tx,le="onPointerLeave",Y="onPointerEnter",F="pointer"),at=G==null?Se:Pa(G),K=X==null?Se:Pa(X),Se=new ze(le,F+"leave",G,s,J),Se.target=at,Se.relatedTarget=K,le=null,pn(J)===V&&(ze=new ze(Y,F+"enter",X,s,J),ze.target=K,ze.relatedTarget=at,le=ze),at=le,ze=G&&X?z(G,X,H_):null,G!==null&&Qy(oe,Se,G,ze,!1),X!==null&&at!==null&&Qy(oe,at,X,ze,!0)))}e:{if(G=V?Pa(V):window,X=G.nodeName&&G.nodeName.toLowerCase(),X==="select"||X==="input"&&G.type==="file")var Re=cx;else if(lx(G))if(ux)Re=YE;else{Re=qE;var ft=FE}else X=G.nodeName,!X||X.toLowerCase()!=="input"||G.type!=="checkbox"&&G.type!=="radio"?V&&Bd(V.elementType)&&(Re=cx):Re=GE;if(Re&&(Re=Re(t,V))){ox(oe,Re,s,J);break e}ft&&ft(t,G,V)}switch(ft=V?Pa(V):window,t){case"focusin":(lx(ft)||ft.contentEditable==="true")&&(ys=ft,ef=V,Rl=null);break;case"focusout":Rl=ef=ys=null;break;case"mousedown":tf=!0;break;case"contextmenu":case"mouseup":case"dragend":tf=!1,bx(oe,s,J);break;case"selectionchange":if(KE)break;case"keydown":case"keyup":bx(oe,s,J)}var $e;if(Xd)e:{switch(t){case"compositionstart":var qe="onCompositionStart";break e;case"compositionend":qe="onCompositionEnd";break e;case"compositionupdate":qe="onCompositionUpdate";break e}qe=void 0}else bs?rx(t,s)&&(qe="onCompositionEnd"):t==="keydown"&&s.keyCode===229&&(qe="onCompositionStart");qe&&(nx&&s.locale!=="ko"&&(bs||qe!=="onCompositionStart"?qe==="onCompositionEnd"&&bs&&($e=Qg()):(Ha=J,qd="value"in Ha?Ha.value:Ha.textContent,bs=!0)),ft=mu(V,qe),0<ft.length&&(qe=new ex(qe,t,null,s,J),oe.push({event:qe,listeners:ft}),$e?qe.data=$e:($e=sx(s),$e!==null&&(qe.data=$e)))),($e=UE?BE(t,s):$E(t,s))&&(qe=mu(V,"onBeforeInput"),0<qe.length&&(ft=new ex("onBeforeInput","beforeinput",null,s,J),oe.push({event:ft,listeners:qe}),ft.data=$e)),U_(oe,t,V,s,J)}Xy(oe,n)})}function ao(t,n,s){return{instance:t,listener:n,currentTarget:s}}function mu(t,n){for(var s=n+"Capture",l=[];t!==null;){var f=t,m=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||m===null||(f=_l(t,s),f!=null&&l.unshift(ao(t,f,m)),f=_l(t,n),f!=null&&l.push(ao(t,f,m))),t.tag===3)return l;t=t.return}return[]}function H_(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Qy(t,n,s,l,f){for(var m=n._reactName,k=[];s!==null&&s!==l;){var _=s,I=_.alternate,V=_.stateNode;if(_=_.tag,I!==null&&I===l)break;_!==5&&_!==26&&_!==27||V===null||(I=V,f?(V=_l(s,m),V!=null&&k.unshift(ao(s,V,I))):f||(V=_l(s,m),V!=null&&k.push(ao(s,V,I)))),s=s.return}k.length!==0&&t.push({event:n,listeners:k})}var F_=/\r\n?/g,q_=/\u0000|\uFFFD/g;function Jy(t){return(typeof t=="string"?t:""+t).replace(F_,`
|
|
9
|
+
`).replace(q_,"")}function Wy(t,n){return n=Jy(n),Jy(t)===n}function Ct(t,n,s,l,f,m){switch(s){case"children":if(typeof l=="string")n==="body"||n==="textarea"&&l===""||hs(t,l);else if(typeof l=="number"||typeof l=="bigint")n!=="body"&&hs(t,""+l);else return;break;case"className":ha(t,"class",l);break;case"tabIndex":ha(t,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":ha(t,s,l);break;case"style":Kg(t,l,m);return;case"data":if(n!=="object"){ha(t,"data",l);break}case"src":case"href":if(l===""&&(n!=="a"||s!=="href")){t.removeAttribute(s);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){t.removeAttribute(s);break}l=oc(l),t.setAttribute(s,l);break;case"action":case"formAction":if(typeof l=="function"){t.setAttribute(s,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof m=="function"&&(s==="formAction"?(n!=="input"&&Ct(t,n,"name",f.name,f,null),Ct(t,n,"formEncType",f.formEncType,f,null),Ct(t,n,"formMethod",f.formMethod,f,null),Ct(t,n,"formTarget",f.formTarget,f,null)):(Ct(t,n,"encType",f.encType,f,null),Ct(t,n,"method",f.method,f,null),Ct(t,n,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){t.removeAttribute(s);break}l=oc(l),t.setAttribute(s,l);break;case"onClick":l!=null&&(t.onclick=qi);return;case"onScroll":l!=null&&ut("scroll",t);return;case"onScrollEnd":l!=null&&ut("scrollend",t);return;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(s=l.__html,s!=null){if(f.children!=null)throw Error(r(60));m?.__html!==s&&(t.innerHTML=s)}}break;case"multiple":t.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":t.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){t.removeAttribute("xlink:href");break}s=oc(l),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?t.setAttribute(s,l):t.removeAttribute(s);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?t.setAttribute(s,""):t.removeAttribute(s);break;case"capture":case"download":l===!0?t.setAttribute(s,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?t.setAttribute(s,l):t.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?t.setAttribute(s,l):t.removeAttribute(s);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?t.removeAttribute(s):t.setAttribute(s,l);break;case"popover":ut("beforetoggle",t),ut("toggle",t),yt(t,"popover",l);break;case"xlinkActuate":yn(t,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":yn(t,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":yn(t,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":yn(t,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":yn(t,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":yn(t,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":yn(t,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":yn(t,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":yn(t,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":yt(t,"is",l);break;case"innerText":case"textContent":return;default:if(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")s=cE.get(s)||s,yt(t,s,l);else return}mt=!0}function Up(t,n,s,l,f,m){switch(s){case"style":Kg(t,l,m);return;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(s=l.__html,s!=null){if(f.children!=null)throw Error(r(60));m?.__html!==s&&(t.innerHTML=s)}}break;case"children":if(typeof l=="string")hs(t,l);else if(typeof l=="number"||typeof l=="bigint")hs(t,""+l);else return;break;case"onScroll":l!=null&&ut("scroll",t);return;case"onScrollEnd":l!=null&&ut("scrollend",t);return;case"onClick":l!=null&&(t.onclick=qi);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!rc.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(f=s.endsWith("Capture"),m=s.slice(2,f?s.length-7:void 0),n=t[xe]||null,n=n!=null?n[s]:null,typeof n=="function"&&t.removeEventListener(m,n,f),typeof l=="function")){typeof n!="function"&&n!==null&&(s in t?t[s]=null:t.hasAttribute(s)&&t.removeAttribute(s)),t.addEventListener(m,l,f);break e}mt=!0,s in t?t[s]=l:l===!0?t.setAttribute(s,""):yt(t,s,l)}return}mt=!0}function _n(t,n,s){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ut("error",t),ut("load",t);var l=!1,f=!1,m;for(m in s)if(s.hasOwnProperty(m)){var k=s[m];if(k!=null)switch(m){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:Ct(t,n,m,k,s,null)}}f&&Ct(t,n,"srcSet",s.srcSet,s,null),l&&Ct(t,n,"src",s.src,s,null);return;case"input":ut("invalid",t);var _=m=k=f=null,I=null,V=null;for(l in s)if(s.hasOwnProperty(l)){var J=s[l];if(J!=null)switch(l){case"name":f=J;break;case"type":k=J;break;case"checked":I=J;break;case"defaultChecked":V=J;break;case"value":m=J;break;case"defaultValue":_=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(r(137,n));break;default:Ct(t,n,l,J,s,null)}}lc(t,m,_,I,V,k,f,!1);return;case"select":ut("invalid",t),l=k=m=null;for(f in s)if(s.hasOwnProperty(f)&&(_=s[f],_!=null))switch(f){case"value":m=_;break;case"defaultValue":k=_;break;case"multiple":l=_;default:Ct(t,n,f,_,s,null)}n=m,s=k,t.multiple=!!l,n!=null?ms(t,!!l,n,!1):s!=null&&ms(t,!!l,s,!0);return;case"textarea":ut("invalid",t),m=f=l=null;for(k in s)if(s.hasOwnProperty(k)&&(_=s[k],_!=null))switch(k){case"value":l=_;break;case"defaultValue":f=_;break;case"children":m=_;break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(r(91));break;default:Ct(t,n,k,_,s,null)}Yg(t,l,f,m);return;case"option":for(I in s)s.hasOwnProperty(I)&&(l=s[I],l!=null)&&(I==="selected"?t.selected=l&&typeof l!="function"&&typeof l!="symbol":Ct(t,n,I,l,s,null));return;case"dialog":ut("beforetoggle",t),ut("toggle",t),ut("cancel",t),ut("close",t);break;case"iframe":case"object":ut("load",t);break;case"video":case"audio":for(l=0;l<io.length;l++)ut(io[l],t);break;case"image":ut("error",t),ut("load",t);break;case"details":ut("toggle",t);break;case"embed":case"source":case"link":ut("error",t),ut("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(V in s)if(s.hasOwnProperty(V)&&(l=s[V],l!=null))switch(V){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:Ct(t,n,V,l,s,null)}return;default:if(Bd(n)){for(J in s)s.hasOwnProperty(J)&&(l=s[J],l!==void 0&&Up(t,n,J,l,s,void 0));return}}for(_ in s)s.hasOwnProperty(_)&&(l=s[_],l!=null&&Ct(t,n,_,l,s,null))}var G_={};function Y_(t,n,s,l){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,m=null,k=null,_=null,I=null,V=null,J=null;for(X in s){var oe=s[X];if(s.hasOwnProperty(X)&&oe!=null)switch(X){case"checked":break;case"value":break;case"defaultValue":I=oe;default:l.hasOwnProperty(X)||Ct(t,n,X,null,l,oe)}}for(var G in l){var X=l[G];if(oe=s[G],l.hasOwnProperty(G)&&(X!=null||oe!=null))switch(G){case"type":X!==oe&&(mt=!0),m=X;break;case"name":X!==oe&&(mt=!0),f=X;break;case"checked":X!==oe&&(mt=!0),V=X;break;case"defaultChecked":X!==oe&&(mt=!0),J=X;break;case"value":X!==oe&&(mt=!0),k=X;break;case"defaultValue":X!==oe&&(mt=!0),_=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(r(137,n));break;default:X!==oe&&Ct(t,n,G,X,l,oe)}}ti(t,k,_,I,V,J,m,f);return;case"select":X=k=_=G=null;for(m in s)if(I=s[m],s.hasOwnProperty(m)&&I!=null)switch(m){case"value":break;case"multiple":X=I;default:l.hasOwnProperty(m)||Ct(t,n,m,null,l,I)}for(f in l)if(m=l[f],I=s[f],l.hasOwnProperty(f)&&(m!=null||I!=null))switch(f){case"value":m!==I&&(mt=!0),G=m;break;case"defaultValue":m!==I&&(mt=!0),_=m;break;case"multiple":m!==I&&(mt=!0),k=m;default:m!==I&&Ct(t,n,f,m,l,I)}n=_,s=k,l=X,G!=null?ms(t,!!s,G,!1):!!l!=!!s&&(n!=null?ms(t,!!s,n,!0):ms(t,!!s,s?[]:"",!1));return;case"textarea":X=G=null;for(_ in s)if(f=s[_],s.hasOwnProperty(_)&&f!=null&&!l.hasOwnProperty(_))switch(_){case"value":break;case"children":break;default:Ct(t,n,_,null,l,f)}for(k in l)if(f=l[k],m=s[k],l.hasOwnProperty(k)&&(f!=null||m!=null))switch(k){case"value":f!==m&&(mt=!0),G=f;break;case"defaultValue":f!==m&&(mt=!0),X=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(r(91));break;default:f!==m&&Ct(t,n,k,f,l,m)}Gg(t,G,X);return;case"option":for(var Se in s)G=s[Se],s.hasOwnProperty(Se)&&G!=null&&!l.hasOwnProperty(Se)&&(Se==="selected"?t.selected=!1:Ct(t,n,Se,null,l,G));for(I in l)G=l[I],X=s[I],l.hasOwnProperty(I)&&G!==X&&(G!=null||X!=null)&&(I==="selected"?(G!==X&&(mt=!0),t.selected=G&&typeof G!="function"&&typeof G!="symbol"):Ct(t,n,I,G,l,X));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ze in s)G=s[ze],s.hasOwnProperty(ze)&&G!=null&&!l.hasOwnProperty(ze)&&Ct(t,n,ze,null,l,G);for(V in l)if(G=l[V],X=s[V],l.hasOwnProperty(V)&&G!==X&&(G!=null||X!=null))switch(V){case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(r(137,n));break;default:Ct(t,n,V,G,l,X)}return;default:if(Bd(n)){for(var at in s)G=s[at],s.hasOwnProperty(at)&&G!==void 0&&!l.hasOwnProperty(at)&&Up(t,n,at,void 0,l,G);for(J in l)G=l[J],X=s[J],!l.hasOwnProperty(J)||G===X||G===void 0&&X===void 0||Up(t,n,J,G,l,X);return}}for(var Y in s)G=s[Y],s.hasOwnProperty(Y)&&G!=null&&!l.hasOwnProperty(Y)&&Ct(t,n,Y,null,l,G);for(oe in l)G=l[oe],X=s[oe],!l.hasOwnProperty(oe)||G===X||G==null&&X==null||Ct(t,n,oe,G,l,X)}function e0(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function V_(){if(typeof performance.getEntriesByType=="function"){for(var t=0,n=0,s=performance.getEntriesByType("resource"),l=0;l<s.length;l++){var f=s[l],m=f.transferSize,k=f.initiatorType,_=f.duration;if(m&&_&&e0(k)){for(k=0,_=f.responseEnd,l+=1;l<s.length;l++){var I=s[l],V=I.startTime;if(V>_)break;var J=I.transferSize,oe=I.initiatorType;J&&e0(oe)&&(I=I.responseEnd,k+=J*(I<_?1:(_-V)/(I-V)))}if(--l,n+=8*(m+k)/(f.duration/1e3),t++,10<t)break}}if(0<t)return n/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Bp=null,$p=null;function ro(t){return t.nodeType===9?t:t.ownerDocument}function t0(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function n0(t,n){if(t===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&n==="foreignObject"?0:t}function i0(t,n,s,l){return s=ro(s).createElement(t),s[cn]=l,s[xe]=n,_n(s,t,n),Wt(s),s}function Pp(t,n){return t==="textarea"||t==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Hp=null;function K_(){var t=window.event;return t&&t.type==="popstate"?t===Hp?!1:(Hp=t,!0):(Hp=null,!1)}var Fp=typeof setTimeout=="function"?setTimeout:void 0,X_=typeof clearTimeout=="function"?clearTimeout:void 0,a0=typeof Promise=="function"?Promise:void 0,r0=typeof requestAnimationFrame=="function"?requestAnimationFrame:Fp,Z_=typeof queueMicrotask=="function"?queueMicrotask:typeof a0<"u"?function(t){return a0.resolve(null).then(t).catch(Q_)}:Fp;function Q_(t){setTimeout(function(){throw t})}function or(t){return t==="head"}function s0(t,n){var s=n,l=0;do{var f=s.nextSibling;if(t.removeChild(s),f&&f.nodeType===8)if(s=f.data,s==="/$"||s==="/&"){if(l===0){t.removeChild(f),Js(n);return}l--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")l++;else if(s==="html")Qp(t.ownerDocument.documentElement);else if(s==="head"){s=t.ownerDocument.head,Qp(s);for(var m=s.firstChild;m;){var k=m.nextSibling,_=m.nodeName;m[Gn]||_==="SCRIPT"||_==="STYLE"||_==="LINK"&&m.rel.toLowerCase()==="stylesheet"||s.removeChild(m),m=k}}else s==="body"&&Qp(t.ownerDocument.body);s=f}while(s);Js(n)}function l0(t,n){var s=t;t=0;do{var l=s.nextSibling;if(s.nodeType===1?n?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(n?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),l&&l.nodeType===8)if(s=l.data,s==="/$"){if(t===0)break;t--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||t++;s=l}while(s)}function o0(t,n,s){if(n=CSS.escape(n)!==n?"r-"+btoa(n).replace(/=/g,""):n,t.style.viewTransitionName=n,s!=null&&(t.style.viewTransitionClass=s),s=getComputedStyle(t),s.display==="inline"){if(n=t.getClientRects(),n.length===1)var l=1;else for(var f=l=0;f<n.length;f++){var m=n[f];0<m.width&&0<m.height&&l++}l===1&&(t=t.style,t.display=n.length===1?"inline-block":"block",t.marginTop="-"+s.paddingTop,t.marginBottom="-"+s.paddingBottom)}}function c0(t,n){t=t.style,n=n.style;var s=n!=null?n.hasOwnProperty("viewTransitionName")?n.viewTransitionName:n.hasOwnProperty("view-transition-name")?n["view-transition-name"]:null:null;t.viewTransitionName=s==null||typeof s=="boolean"?"":(""+s).trim(),s=n!=null?n.hasOwnProperty("viewTransitionClass")?n.viewTransitionClass:n.hasOwnProperty("view-transition-class")?n["view-transition-class"]:null:null,t.viewTransitionClass=s==null||typeof s=="boolean"?"":(""+s).trim(),t.display==="inline-block"&&(n==null?t.display=t.margin="":(s=n.display,t.display=s==null||typeof s=="boolean"?"":s,s=n.margin,s!=null?t.margin=s:(s=n.hasOwnProperty("marginTop")?n.marginTop:n["margin-top"],t.marginTop=s==null||typeof s=="boolean"?"":s,n=n.hasOwnProperty("marginBottom")?n.marginBottom:n["margin-bottom"],t.marginBottom=n==null||typeof n=="boolean"?"":n)))}function J_(t,n,s){return s=s.ownerDocument.defaultView,{rect:t,abs:n.position==="absolute"||n.position==="fixed",clip:n.clipPath!=="none"||n.overflow!=="visible"||n.filter!=="none"||n.mask!=="none"||n.mask!=="none"||n.borderRadius!=="0px",view:0<=t.bottom&&0<=t.right&&t.top<=s.innerHeight&&t.left<=s.innerWidth}}function qp(t){var n=t.getBoundingClientRect(),s=getComputedStyle(t);return J_(n,s,t)}function W_(t){return t.documentElement.clientHeight}function eS(t){this.addEventListener("load",t),this.addEventListener("error",t)}function tS(t,n,s,l,f,m,k,_,I){var V=n.nodeType===9?n:n.ownerDocument;try{var J=V.startViewTransition({update:function(){var G=V.defaultView,X=G.navigation&&G.navigation.transition,Se=V.fonts.status;l();var ze=[];if(Se==="loaded"&&(W_(V),V.fonts.status==="loading"&&ze.push(V.fonts.ready)),Se=ze.length,t!==null)for(var at=t.suspenseyImages,Y=0,F=0;F<at.length;F++){var K=at[F];if(!K.complete){var le=K.getBoundingClientRect();if(0<le.bottom&&0<le.right&&le.top<G.innerHeight&&le.left<G.innerWidth){if(Y+=A0(K),Y>xu){ze.length=Se;break}K=new Promise(eS.bind(K)),ze.push(K)}}}if(0<ze.length)return G=Promise.race([Promise.all(ze),new Promise(function(Re){return setTimeout(Re,500)})]).then(f,f),(X?Promise.allSettled([X.finished,G]):G).then(m,m);if(f(),X)return X.finished.then(m,m);m()},types:s});V.__reactViewTransition=J;var oe=[];return J.ready.then(function(){for(var G=V.documentElement.getAnimations({subtree:!0}),X=0;X<G.length;X++){var Se=G[X],ze=Se.effect,at=ze.pseudoElement;if(at!=null&&at.startsWith("::view-transition")){oe.push(Se),Se=ze.getKeyframes();for(var Y=at=void 0,F=!0,K=0;K<Se.length;K++){var le=Se[K],Re=le.width;if(at===void 0)at=Re;else if(at!==Re){F=!1;break}if(Re=le.height,Y===void 0)Y=Re;else if(Y!==Re){F=!1;break}delete le.width,delete le.height,le.transform==="none"&&delete le.transform}F&&at!==void 0&&Y!==void 0&&(ze.setKeyframes(Se),F=getComputedStyle(ze.target,ze.pseudoElement),F.width!==at||F.height!==Y)&&(F=Se[0],F.width=at,F.height=Y,F=Se[Se.length-1],F.width=at,F.height=Y,ze.setKeyframes(Se))}}k()},function(G){V.__reactViewTransition===J&&(V.__reactViewTransition=null);try{typeof G=="object"&&G!==null&&G.name==="InvalidStateError"&&(G.message==="View transition was skipped because document visibility state is hidden."||G.message==="Skipping view transition because document visibility state has become hidden."||G.message==="Skipping view transition because viewport size changed."||G.message==="Transition was aborted because of invalid state")&&(G=null),G!==null&&I(G)}finally{l(),f(),k()}}),J.finished.finally(function(){for(var G=0;G<oe.length;G++)oe[G].cancel();V.__reactViewTransition===J&&(V.__reactViewTransition=null),_()}),J}catch{return l(),f(),k(),null}}function Yr(t,n){this._scope=document.documentElement,this._selector="::view-transition-"+t+"("+n+")"}Yr.prototype.animate=function(t,n){return n=typeof n=="number"?{duration:n}:C({},n),n.pseudoElement=this._selector,this._scope.animate(t,n)},Yr.prototype.getAnimations=function(){for(var t=this._scope,n=this._selector,s=t.getAnimations({subtree:!0}),l=[],f=0;f<s.length;f++){var m=s[f].effect;m!==null&&m.target===t&&m.pseudoElement===n&&l.push(s[f])}return l},Yr.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function u0(t){return{name:t,group:new Yr("group",t),imagePair:new Yr("image-pair",t),old:new Yr("old",t),new:new Yr("new",t)}}function oi(t){this._fragmentFiber=t,this._observers=this._eventListeners=null}oi.prototype.addEventListener=function(t,n,s){var l=null,f=null;if(!(s!=null&&typeof s!="boolean"&&(l=s.signal||null,l!==null&&l.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var m=this._eventListeners;if(f0(m,t,n,s)===-1){var k=this,_=n;s!=null&&typeof s!="boolean"&&s.once===!0&&(_=function(I){k.removeEventListener(t,n,s),typeof n=="function"?n.call(this,I):n.handleEvent(I)}),l!==null&&(f=k.removeEventListener.bind(k,t,n,s),l.addEventListener("abort",f,{once:!0}),f=l.removeEventListener.bind(l,"abort",f)),l=Ys(s),m.push({type:t,listener:n,optionsOrUseCapture:s,attachedListener:_,cleanup:f}),b(this._fragmentFiber.child,!1,nS,t,_,l)}this._eventListeners=m}};function nS(t,n,s,l){return E(t).addEventListener(n,s,l),!1}oi.prototype.removeEventListener=function(t,n,s){var l=this._eventListeners;if(l!==null&&(n=f0(l,t,n,s),n!==-1)){var f=l[n];s=f.attachedListener;var m=f.cleanup;f=Ys(f.optionsOrUseCapture),b(this._fragmentFiber.child,!1,iS,t,s,f),l.splice(n,1),m!==null&&m()}};function iS(t,n,s,l){return E(t).removeEventListener(n,s,l),!1}function Ys(t){return t!=null&&typeof t!="boolean"&&(t.once===!0||t.signal instanceof AbortSignal)?{capture:t.capture,passive:t.passive}:t}function d0(t){return t==null?"c=0":typeof t=="boolean"?"c="+(t?"1":"0"):"c="+(t.capture?"1":"0")}function f0(t,n,s,l){if(t.length===0)return-1;l=d0(l);for(var f=0;f<t.length;f++){var m=t[f];if(m.type===n&&m.listener===s&&d0(m.optionsOrUseCapture)===l)return f}return-1}oi.prototype.dispatchEvent=function(t){var n=y(this._fragmentFiber);if(n===null)return!0;n=E(n);var s=this._eventListeners;if(s!==null&&0<s.length||!t.bubbles){var l=n.nodeType===9?n.createComment(""):document.createTextNode("");if(s)for(var f=0;f<s.length;f++){var m=s[f];l.addEventListener(m.type,m.attachedListener,Ys(m.optionsOrUseCapture))}if(n.appendChild(l),t=l.dispatchEvent(t),s)for(f=0;f<s.length;f++)m=s[f],l.removeEventListener(m.type,m.attachedListener,Ys(m.optionsOrUseCapture));return n.removeChild(l),t}return n.dispatchEvent(t)},oi.prototype.focus=function(t){b(this._fragmentFiber.child,!0,p0,t,void 0,void 0)};function p0(t,n){return t.tag===6?!1:(t=E(t),hS(t,n))}oi.prototype.focusLast=function(t){var n=[];b(this._fragmentFiber.child,!0,Gp,n,void 0,void 0);for(var s=n.length-1;0<=s&&!p0(n[s],t);s--);};function Gp(t,n){return n.push(t),!1}oi.prototype.blur=function(){var t=y(this._fragmentFiber);t!==null&&(t=E(t),t=ro(t).activeElement,t!==null&&b(this._fragmentFiber.child,!1,aS,t,void 0,void 0))};function aS(t,n){return t.tag===6?!1:(t=E(t),t===n||t.contains(n)?(n.blur(),!0):!1)}oi.prototype.observeUsing=function(t){this._observers===null&&(this._observers=new Set),this._observers.add(t),b(this._fragmentFiber.child,!1,rS,t,void 0,void 0)};function rS(t,n){return t.tag===6||(t=E(t),n.observe(t)),!1}oi.prototype.unobserveUsing=function(t){var n=this._observers;if(n!==null&&n.has(t)){n.delete(t),b(this._fragmentFiber.child,!1,sS,t,void 0,void 0);for(var s=n=0;s<zi.length;s++){var l=zi[s];l.fragmentInstance===this&&l.observer===t?t.unobserve(l.instance):zi[n++]=l}zi.length=n}};function sS(t,n){return t.tag===6||(t=E(t),n.unobserve(t)),!1}var zi=[],Yp=!1;function lS(t,n,s){zi.push({fragmentInstance:t,observer:n,instance:s}),Yp||(Yp=!0,gS(function(){Yp=!1;var l=zi;zi=[];for(var f=0;f<l.length;f++){var m=l[f];m.observer.unobserve(m.instance)}}))}oi.prototype.getClientRects=function(){var t=[];return b(this._fragmentFiber.child,!1,oS,t,void 0,void 0),t};function oS(t,n){if(t.tag===6){t=t.stateNode;var s=t.ownerDocument.createRange();s.selectNodeContents(t),n.push.apply(n,s.getClientRects())}else t=E(t),n.push.apply(n,t.getClientRects());return!1}oi.prototype.getRootNode=function(t){var n=y(this._fragmentFiber);return n===null?this:E(n).getRootNode(t)},oi.prototype.compareDocumentPosition=function(t){var n=y(this._fragmentFiber);if(n===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var s=[];b(this._fragmentFiber.child,!1,Gp,s,void 0,void 0);var l=E(n);if(s.length===0){if(s=l,v(this._fragmentFiber)){e:{for(n=this._fragmentFiber.return;n!==null;){if(n.tag===4){n=n.stateNode.containerInfo;break e}if(n.tag===3||n.tag===5||n.tag===27)break;n=n.return}n=null}n!=null&&(s=n)}n=this._fragmentFiber;var f=l=s.compareDocumentPosition(t);return s===t?f=Node.DOCUMENT_POSITION_CONTAINS:l&Node.DOCUMENT_POSITION_CONTAINED_BY&&(s=w(n)[1],s===null?f=Node.DOCUMENT_POSITION_PRECEDING:(t=E(s).compareDocumentPosition(t),f=t===0||t&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),f|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}n=E(s[0]),f=E(s[s.length-1]);var m=v(this._fragmentFiber)?n.parentElement:l;if(m==null)return Node.DOCUMENT_POSITION_DISCONNECTED;l=m.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_CONTAINED_BY,m=m.compareDocumentPosition(f)&Node.DOCUMENT_POSITION_CONTAINED_BY;var k=n.compareDocumentPosition(t),_=f.compareDocumentPosition(t),I=k&Node.DOCUMENT_POSITION_CONTAINED_BY||_&Node.DOCUMENT_POSITION_CONTAINED_BY;return _=l&&m&&k&Node.DOCUMENT_POSITION_FOLLOWING&&_&Node.DOCUMENT_POSITION_PRECEDING,n=l&&n===t||m&&f===t||I||_?Node.DOCUMENT_POSITION_CONTAINED_BY:!l&&n===t||!m&&f===t?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:k,n&Node.DOCUMENT_POSITION_DISCONNECTED||n&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||cS(n,this._fragmentFiber,s[0],s[s.length-1],t)?n:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function cS(t,n,s,l,f){var m=pn(f);if(t&Node.DOCUMENT_POSITION_CONTAINED_BY){if(s=!!m)e:{for(;m!==null;){if(m.tag===7&&(m===n||m.alternate===n)){s=!0;break e}m=m.return}s=!1}return s}if(t&Node.DOCUMENT_POSITION_CONTAINS){if(m===null)return m=f.ownerDocument,f===m||f===m.documentElement||f===m.body;e:{for(m=n,n=y(n);m!==null;){if(!(m.tag!==5&&m.tag!==3&&m.tag!==27||m!==n&&m.alternate!==n)){m=!0;break e}m=m.return}m=!1}return m}return t&Node.DOCUMENT_POSITION_PRECEDING?((n=!!m)&&!(n=m===s)&&(n=z(s,m,$),n===null?n=!1:(b(n,!0,A,m,s),m=N,N=null,n=m!==null)),n):t&Node.DOCUMENT_POSITION_FOLLOWING?((n=!!m)&&!(n=m===l)&&(n=z(l,m,$),n===null?n=!1:(b(n,!0,R,m,l),m=N,j=N=null,n=m!==null)),n):!1}function m0(t,n){var s=t.ownerDocument.createRange();s.selectNodeContents(t),t=s.getBoundingClientRect(),window.scrollTo(window.scrollX+t.left,n?window.scrollY+t.top:window.scrollY+t.bottom-window.innerHeight)}oi.prototype.scrollIntoView=function(t){if(typeof t=="object")throw Error(r(566));var n=[];b(this._fragmentFiber.child,!1,Gp,n,void 0,void 0);var s=t!==!1;if(n.length===0){var l=w(this._fragmentFiber);if(l=s?l[1]||l[0]||y(this._fragmentFiber):l[0]||l[1],l===null)return;if(l.tag===6){t=E(l),m0(t,s);return}if(l=E(l),l.nodeType!==9){if(l.nodeType===11){s="host"in l?l.host:null,s!==null&&s.scrollIntoView(t);return}l.scrollIntoView(t)}}for(l=s?n.length-1:0;l!==(s?-1:n.length);){var f=n[l];f.tag===6?(f=E(f),m0(f,s)):E(f).scrollIntoView(t),l+=s?-1:1}};function uS(t,n){return t=E(t),h0(t,n),!1}function h0(t,n){t.reactFragments==null&&(t.reactFragments=new Set),t.reactFragments.add(n)}function g0(t,n){var s=n._eventListeners;if(s!==null)for(var l=0;l<s.length;l++){var f=s[l];t.addEventListener(f.type,f.attachedListener,Ys(f.optionsOrUseCapture))}t.nodeType!==3&&(s=n._observers,s!==null&&s.forEach(function(m){for(var k=0,_=0;_<zi.length;_++){var I=zi[_];(I.fragmentInstance!==n||I.observer!==m||I.instance!==t)&&(zi[k++]=I)}zi.length=k,m.observe(t)}),h0(t,n))}function dS(t,n){var s=n._eventListeners;if(s!==null)for(var l=0;l<s.length;l++){var f=s[l];t.removeEventListener(f.type,f.attachedListener,Ys(f.optionsOrUseCapture))}t.nodeType!==3&&(s=n._observers,s!==null&&s.forEach(function(m){typeof m.rootMargin=="string"?lS(n,m,t):m.unobserve(t)}),t.reactFragments!=null&&t.reactFragments.delete(n))}function Vp(t){var n=t.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var s=n;switch(n=n.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":Vp(s),fn(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}t.removeChild(s)}}function fS(t,n,s,l){for(;t.nodeType===1;){var f=s;if(t.nodeName.toLowerCase()!==n.toLowerCase()){if(!l&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(l){if(!t[Gn])switch(n){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(m=t.getAttribute("rel"),m==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(m!==f.rel||t.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||t.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||t.getAttribute("title")!==(f.title==null?null:f.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(m=t.getAttribute("src"),(m!==(f.src==null?null:f.src)||t.getAttribute("type")!==(f.type==null?null:f.type)||t.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&m&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(n==="input"&&t.type==="hidden"){var m=f.name==null?null:""+f.name;if(f.type==="hidden"&&t.getAttribute("name")===m)return t}else return t;if(t=yi(t.nextSibling),t===null)break}return null}function pS(t,n,s){if(n==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!s||(t=yi(t.nextSibling),t===null))return null;return t}function x0(t,n){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=yi(t.nextSibling),t===null))return null;return t}function Kp(t){return t.data==="$?"||t.data==="$~"}function Xp(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function mS(t,n){var s=t.ownerDocument;if(t.data==="$~")t._reactRetry=n;else if(t.data!=="$?"||s.readyState!=="loading")n();else{var l=function(){n(),s.removeEventListener("DOMContentLoaded",l)};s.addEventListener("DOMContentLoaded",l),t._reactRetry=l}}function yi(t){for(;t!=null;t=t.nextSibling){var n=t.nodeType;if(n===1||n===3)break;if(n===8){if(n=t.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return t}var Zp=null;function b0(t){t=t.nextSibling;for(var n=0;t;){if(t.nodeType===8){var s=t.data;if(s==="/$"||s==="/&"){if(n===0)return yi(t.nextSibling);n--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||n++}t=t.nextSibling}return null}function y0(t){t=t.previousSibling;for(var n=0;t;){if(t.nodeType===8){var s=t.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(n===0)return t;n--}else s!=="/$"&&s!=="/&"||n++}t=t.previousSibling}return null}function hS(t,n){function s(){l=!0}if(t.ownerDocument.activeElement===t)return!0;var l=!1;try{t.ownerDocument.addEventListener("focus",s,!0),(t.focus||HTMLElement.prototype.focus).call(t,n)}finally{t.ownerDocument.removeEventListener("focus",s,!0)}return l}function gS(t){r0(function(){r0(function(n){return t(n)})})}function v0(t,n,s){switch(n=ro(s),t){case"html":if(t=n.documentElement,!t)throw Error(r(452));return t;case"head":if(t=n.head,!t)throw Error(r(453));return t;case"body":if(t=n.body,!t)throw Error(r(454));return t;default:throw Error(r(451))}}function w0(t,n,s){for(var l in s){var f=s[l];s.hasOwnProperty(l)&&f!=null&&Ct(t,n,l,null,G_,f)}s.dangerouslySetInnerHTML!=null&&(t.textContent=""),t.onclick===qi&&(t.onclick=null),fn(t)}function Qp(t){for(var n=t.attributes;n.length;)t.removeAttributeNode(n[0]);fn(t)}var vi=new Map,k0=new Set;function so(t){if(typeof t.getRootNode=="function"){var n=t.getRootNode();if(n.nodeType===9||n.nodeType===11)return n}return t.nodeType===9?t:t.ownerDocument}var Ca=Q.d;Q.d={f:xS,r:bS,D:yS,C:vS,L:wS,m:kS,X:ES,S:NS,M:_S};function xS(){var t=Ca.f(),n=ou();return t||n}function bS(t){var n=fa(t);n!==null&&n.tag===5&&n.type==="form"?Eb(n):Ca.r(t)}var Vs=typeof document>"u"?null:document;function N0(t,n,s){var l=Vs;if(l&&typeof n=="string"&&n){var f=_t(n);f='link[rel="'+t+'"][href="'+f+'"]',typeof s=="string"&&(f+='[crossorigin="'+s+'"]'),k0.has(f)||(k0.add(f),t={rel:t,crossOrigin:s,href:n},l.querySelector(f)===null&&(n=l.createElement("link"),_n(n,"link",t),Wt(n),l.head.appendChild(n)))}}function yS(t){Ca.D(t),N0("dns-prefetch",t,null)}function vS(t,n){Ca.C(t,n),N0("preconnect",t,n)}function wS(t,n,s){Ca.L(t,n,s);var l=Vs;if(l&&t&&n){var f='link[rel="preload"][as="'+_t(n)+'"]';n==="image"&&s&&s.imageSrcSet?(f+='[imagesrcset="'+_t(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(f+='[imagesizes="'+_t(s.imageSizes)+'"]')):f+='[href="'+_t(t)+'"]';var m=f;switch(n){case"style":m=Ks(t);break;case"script":m=Xs(t)}if(!(vi.has(m)||(t=C({rel:"preload",href:n==="image"&&s&&s.imageSrcSet?void 0:t,as:n},s),vi.set(m,t),l.querySelector(f)!==null||n==="style"&&l.querySelector(lo(m))||n==="script"&&l.querySelector(oo(m))))){var k=l.createElement("link");_n(k,"link",t),n==="style"&&(k[da]=!0,k.onload=k.onerror=function(){ic(k)}),Wt(k),l.head.appendChild(k)}}}function kS(t,n){Ca.m(t,n);var s=Vs;if(s&&t){var l=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+_t(l)+'"][href="'+_t(t)+'"]',m=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=Xs(t)}if(!vi.has(m)&&(t=C({rel:"modulepreload",href:t},n),vi.set(m,t),s.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(oo(m)))return}l=s.createElement("link"),_n(l,"link",t),Wt(l),s.head.appendChild(l)}}}function NS(t,n,s){Ca.S(t,n,s);var l=Vs;if(l&&t){var f=pa(l).hoistableStyles,m=Ks(t);n=n||"default";var k=f.get(m);if(!k){var _={loading:0,preload:null};if(k=l.querySelector(lo(m)))_.loading=5;else{t=C({rel:"stylesheet",href:t,"data-precedence":n},s),(s=vi.get(m))&&Jp(t,s);var I=k=l.createElement("link");Wt(I),_n(I,"link",t),I._p=new Promise(function(V,J){I.onload=V,I.onerror=J}),I.addEventListener("load",function(){_.loading|=1}),I.addEventListener("error",function(){_.loading|=2}),_.loading|=4,hu(k,n,l)}k={type:"stylesheet",instance:k,count:1,state:_},f.set(m,k)}}}function ES(t,n){Ca.X(t,n);var s=Vs;if(s&&t){var l=pa(s).hoistableScripts,f=Xs(t),m=l.get(f);m||(m=s.querySelector(oo(f)),m||(t=C({src:t,async:!0},n),(n=vi.get(f))&&Wp(t,n),m=s.createElement("script"),Wt(m),_n(m,"link",t),s.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},l.set(f,m))}}function _S(t,n){Ca.M(t,n);var s=Vs;if(s&&t){var l=pa(s).hoistableScripts,f=Xs(t),m=l.get(f);m||(m=s.querySelector(oo(f)),m||(t=C({src:t,async:!0,type:"module"},n),(n=vi.get(f))&&Wp(t,n),m=s.createElement("script"),Wt(m),_n(m,"link",t),s.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},l.set(f,m))}}function E0(t,n,s,l){var f=(f=xn.current)?so(f):null;if(!f)throw Error(r(446));switch(t){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(s=Ks(s.href),n=pa(f).hoistableStyles,l=n.get(s),l||(l={type:"style",instance:null,count:0,state:null},n.set(s,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){t=Ks(s.href);var m=pa(f).hoistableStyles,k=m.get(t);if(k||(f=f.ownerDocument||f,k={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(t,k),(m=f.querySelector(lo(t)))?m._p||(k.instance=m,k.state.loading=5):(m=vi.get(t),m||(m={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},vi.set(t,m)),SS(f,t,m,k.state))),n&&l===null)throw Error(r(528,""));return k}if(n&&l!==null)throw Error(r(529,""));return null;case"script":return n=s.async,s=s.src,typeof s=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(s=Xs(s),n=pa(f).hoistableScripts,l=n.get(s),l||(l={type:"script",instance:null,count:0,state:null},n.set(s,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,t))}}function Ks(t){return'href="'+_t(t)+'"'}function lo(t){return'link[rel="stylesheet"]['+t+"]"}function _0(t){return C({},t,{"data-precedence":t.precedence,precedence:null})}function SS(t,n,s,l){if(n=t.querySelector('link[rel="preload"][as="style"]['+n+"]")){if(n[da]!==!0){l.loading=1;return}}else n=t.createElement("link"),n[da]=!0,n.onload=n.onerror=ic.bind(null,n),_n(n,"link",s),Wt(n),t.head.appendChild(n);l.preload=n,n.addEventListener("load",function(){return l.loading|=1}),n.addEventListener("error",function(){return l.loading|=2})}function Xs(t){return'[src="'+_t(t)+'"]'}function oo(t){return"script[async]"+t}function S0(t,n,s){if(n.count++,n.instance===null)switch(n.type){case"style":var l=t.querySelector('style[data-href~="'+_t(s.href)+'"]');if(l)return n.instance=l,Wt(l),l;var f=C({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return l=(t.ownerDocument||t).createElement("style"),Wt(l),_n(l,"style",f),hu(l,s.precedence,t),n.instance=l;case"stylesheet":f=Ks(s.href);var m=t.querySelector(lo(f));if(m)return n.state.loading|=4,n.instance=m,Wt(m),m;l=_0(s),(f=vi.get(f))&&Jp(l,f),m=(t.ownerDocument||t).createElement("link"),Wt(m);var k=m;return k._p=new Promise(function(_,I){k.onload=_,k.onerror=I}),_n(m,"link",l),n.state.loading|=4,hu(m,s.precedence,t),n.instance=m;case"script":return m=Xs(s.src),(f=t.querySelector(oo(m)))?(n.instance=f,Wt(f),f):(l=s,(f=vi.get(m))&&(l=C({},s),Wp(l,f)),t=t.ownerDocument||t,f=t.createElement("script"),Wt(f),_n(f,"link",l),t.head.appendChild(f),n.instance=f);case"void":return null;default:throw Error(r(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(l=n.instance,n.state.loading|=4,hu(l,s.precedence,t));return n.instance}function hu(t,n,s){for(var l=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,m=f,k=0;k<l.length;k++){var _=l[k];if(_.dataset.precedence===n)m=_;else if(m!==f)break}m?m.parentNode.insertBefore(t,m.nextSibling):(n=s.nodeType===9?s.head:s,n.insertBefore(t,n.firstChild))}function Jp(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.title==null&&(t.title=n.title)}function Wp(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.integrity==null&&(t.integrity=n.integrity)}var gu=null;function T0(t,n,s){if(gu===null){var l=new Map,f=gu=new Map;f.set(s,l)}else f=gu,l=f.get(s),l||(l=new Map,f.set(s,l));if(l.has(t))return l;for(l.set(t,null),s=s.getElementsByTagName(t),f=0;f<s.length;f++){var m=s[f];if(!(m[Gn]||m[cn]||t==="link"&&m.getAttribute("rel")==="stylesheet")&&m.namespaceURI!=="http://www.w3.org/2000/svg"){var k=m.getAttribute(n)||"";k=t+k;var _=l.get(k);_?_.push(m):l.set(k,[m])}}return l}function em(t,n,s){t=t.ownerDocument||t,t.head.insertBefore(s,n==="title"?t.querySelector("head > title"):null)}function TS(t,n,s){if(s===1||n.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;return n.rel==="stylesheet"?(t=n.disabled,typeof n.precedence=="string"&&t==null):!0;case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function C0(t,n){return t==="img"&&n.src!=null&&n.src!==""&&n.onLoad==null&&n.loading!=="lazy"}function j0(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function A0(t){return(t.width||100)*(t.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function O0(t,n){typeof n.decode=="function"&&(t.imgCount++,n.complete||(t.imgBytes+=A0(n),t.suspenseyImages.push(n)),t=AS.bind(t),n.decode().then(t,t))}function CS(t,n,s,l){if(s.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var f=Ks(l.href),m=n.querySelector(lo(f));if(m){n=m._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=co.bind(t),n.then(t,t)),s.state.loading|=4,s.instance=m,Wt(m);return}m=n.ownerDocument||n,l=_0(l),(f=vi.get(f))&&Jp(l,f),m=m.createElement("link"),Wt(m);var k=m;k._p=new Promise(function(_,I){k.onload=_,k.onerror=I}),_n(m,"link",l),s.instance=m}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(s,n),(n=s.state.preload)&&(s.state.loading&3)===0&&(t.count++,s=co.bind(t),n.addEventListener("load",s),n.addEventListener("error",s))}}var xu=0;function jS(t,n){return t.stylesheets&&t.count===0&&yu(t,t.stylesheets),0<t.count||0<t.imgCount?function(s){var l=setTimeout(function(){if(t.stylesheets&&yu(t,t.stylesheets),t.unsuspend){var m=t.unsuspend;t.unsuspend=null,m()}},6e4+n);0<t.imgBytes&&xu===0&&(xu=62500*V_());var f=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&yu(t,t.stylesheets),t.unsuspend)){var m=t.unsuspend;t.unsuspend=null,m()}},(t.imgBytes>xu?50:800)+n);return t.unsuspend=s,function(){t.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function M0(t){if(t.count===0&&(t.imgCount===0||!t.waitingForImages)){if(t.stylesheets)yu(t,t.stylesheets);else if(t.unsuspend){var n=t.unsuspend;t.unsuspend=null,n()}}}function co(){this.count--,M0(this)}function AS(){this.imgCount--,M0(this)}var bu=null;function yu(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,bu=new Map,n.forEach(OS,t),bu=null,co.call(t))}function OS(t,n){if(!(n.state.loading&4)){var s=bu.get(t);if(s)var l=s.get(null);else{s=new Map,bu.set(t,s);for(var f=t.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m<f.length;m++){var k=f[m];(k.nodeName==="LINK"||k.getAttribute("media")!=="not all")&&(s.set(k.dataset.precedence,k),l=k)}l&&s.set(null,l)}f=n.instance,k=f.getAttribute("data-precedence"),m=s.get(k)||l,m===l&&s.set(null,f),s.set(k,f),this.count++,l=co.bind(this),f.addEventListener("load",l),f.addEventListener("error",l),m?m.parentNode.insertBefore(f,m.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(f,t.firstChild)),n.state.loading|=4}}var Zs={$$typeof:ae,Provider:null,Consumer:null,_currentValue:Pe,_currentValue2:Pe,_threadCount:0};function MS(t,n,s,l,f,m,k,_,I){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=$a(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$a(0),this.hiddenUpdates=$a(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=m,this.onRecoverableError=k,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=I,this.transitionTypes=null,this.incompleteTransitions=new Map}function R0(t,n,s,l,f,m,k,_,I,V,J,oe){return t=new MS(t,n,s,k,I,V,J,oe,_),n=1,m===!0&&(n|=24),m=Yn(3,null,null,n),t.current=m,m.stateNode=t,n=hf(),n.refCount++,t.pooledCache=n,n.refCount++,m.memoizedState={element:l,isDehydrated:s,cache:n},yf(m),t}function D0(t){return t?(t=ks,t):ks}function z0(t,n,s,l,f,m){f=D0(f),l.context===null?l.context=f:l.pendingContext=f,l=Za(n),l.payload={element:s},m=m===void 0?null:m,m!==null&&(l.callback=m),s=Qa(t,l,n),s!==null&&(Zn(s,t,n),$l(s,t,n))}function L0(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var s=t.retryLane;t.retryLane=s!==0&&s<n?s:n}}function tm(t,n){L0(t,n),(t=t.alternate)&&L0(t,n)}function I0(t){if(t.tag===13||t.tag===31){var n=jr(t,67108864);n!==null&&Zn(n,t,67108864),tm(t,67108864)}}function U0(t){if(t.tag===13||t.tag===31){var n=li();n=ds(n);var s=jr(t,n);s!==null&&Zn(s,t,n),tm(t,n)}}var Qs=!0;function RS(t,n,s,l){var f=ye.T;ye.T=null;var m=Q.p;try{Q.p=2,nm(t,n,s,l)}finally{Q.p=m,ye.T=f}}function DS(t,n,s,l){var f=ye.T;ye.T=null;var m=Q.p;try{Q.p=8,nm(t,n,s,l)}finally{Q.p=m,ye.T=f}}function nm(t,n,s,l){if(Qs){var f=im(l);if(f===null)Ip(t,n,l,vu,s),$0(t,l);else if(LS(f,t,n,s,l))l.stopPropagation();else if($0(t,l),n&4&&-1<zS.indexOf(t)){for(;f!==null;){var m=fa(f);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var k=ua(m.pendingLanes);if(k!==0){var _=m;for(_.pendingLanes|=2,_.entangledLanes|=2;k;){var I=1<<31-Te(k);_.entanglements[1]|=I,k&=~I}ea(m),(wt&6)===0&&(ru=Qt()+500,no(0))}}break;case 31:case 13:_=jr(m,2),_!==null&&Zn(_,m,2),ou(),tm(m,2)}if(m=im(l),m===null&&Ip(t,n,l,vu,s),m===f)break;f=m}f!==null&&l.stopPropagation()}else Ip(t,n,l,null,s)}}function im(t){return t=Pd(t),am(t)}var vu=null;function am(t){if(vu=null,t=pn(t),t!==null){var n=u(t);if(n===null)t=null;else{var s=n.tag;if(s===13){if(t=d(n),t!==null)return t;t=null}else if(s===31){if(t=p(n),t!==null)return t;t=null}else if(s===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;t=null}else n!==t&&(t=null)}}return vu=t,null}function B0(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(dn()){case Ti:return 2;case zn:return 8;case Ci:case P:return 32;case ue:return 268435456;default:return 32}default:return 32}}var rm=!1,cr=null,ur=null,dr=null,uo=new Map,fo=new Map,fr=[],zS="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function $0(t,n){switch(t){case"focusin":case"focusout":cr=null;break;case"dragenter":case"dragleave":ur=null;break;case"mouseover":case"mouseout":dr=null;break;case"pointerover":case"pointerout":uo.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":fo.delete(n.pointerId)}}function po(t,n,s,l,f,m){return t===null||t.nativeEvent!==m?(t={blockedOn:n,domEventName:s,eventSystemFlags:l,nativeEvent:m,targetContainers:[f]},n!==null&&(n=fa(n),n!==null&&I0(n)),t):(t.eventSystemFlags|=l,n=t.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),t)}function LS(t,n,s,l,f){switch(n){case"focusin":return cr=po(cr,t,n,s,l,f),!0;case"dragenter":return ur=po(ur,t,n,s,l,f),!0;case"mouseover":return dr=po(dr,t,n,s,l,f),!0;case"pointerover":var m=f.pointerId;return uo.set(m,po(uo.get(m)||null,t,n,s,l,f)),!0;case"gotpointercapture":return m=f.pointerId,fo.set(m,po(fo.get(m)||null,t,n,s,l,f)),!0}return!1}function P0(t){var n=pn(t.target);if(n!==null){var s=u(n);if(s!==null){if(n=s.tag,n===13){if(n=d(s),n!==null){t.blockedOn=n,nc(t.priority,function(){U0(s)});return}}else if(n===31){if(n=p(s),n!==null){t.blockedOn=n,nc(t.priority,function(){U0(s)});return}}else if(n===3&&s.stateNode.current.memoizedState.isDehydrated){t.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}t.blockedOn=null}function wu(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var s=im(t.nativeEvent);if(s===null){s=t.nativeEvent;var l=new s.constructor(s.type,s);$d=l,s.target.dispatchEvent(l),$d=null}else return n=fa(s),n!==null&&I0(n),t.blockedOn=s,!1;n.shift()}return!0}function H0(t,n,s){wu(t)&&s.delete(n)}function IS(){rm=!1,cr!==null&&wu(cr)&&(cr=null),ur!==null&&wu(ur)&&(ur=null),dr!==null&&wu(dr)&&(dr=null),uo.forEach(H0),fo.forEach(H0)}function ku(t,n){t.blockedOn===n&&(t.blockedOn=null,rm||(rm=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,IS)))}var Nu=null;function F0(t){Nu!==t&&(Nu=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Nu===t&&(Nu=null);for(var n=0;n<t.length;n+=3){var s=t[n],l=t[n+1],f=t[n+2];if(typeof l!="function"){if(am(l||s)===null)continue;break}var m=fa(s);m!==null&&(t.splice(n,3),n-=3,$f(m,{pending:!0,data:f,method:s.method,action:l},l,f))}}))}function Js(t){function n(I){return ku(I,t)}cr!==null&&ku(cr,t),ur!==null&&ku(ur,t),dr!==null&&ku(dr,t),uo.forEach(n),fo.forEach(n);for(var s=0;s<fr.length;s++){var l=fr[s];l.blockedOn===t&&(l.blockedOn=null)}for(;0<fr.length&&(s=fr[0],s.blockedOn===null);)P0(s),s.blockedOn===null&&fr.shift();if(s=(t.ownerDocument||t).$$reactFormReplay,s!=null)for(l=0;l<s.length;l+=3){var f=s[l],m=s[l+1],k=f[xe]||null;if(typeof m=="function")k||F0(s);else if(k){var _=null;if(m&&m.hasAttribute("formAction")){if(f=m,k=m[xe]||null)_=k.formAction;else if(am(f)!==null)continue}else _=k.action;typeof _=="function"?s[l+1]=_:(s.splice(l,3),l-=3),F0(s)}}}function q0(){function t(m){m.canIntercept&&m.info==="react-transition"&&m.intercept({handler:function(){return new Promise(function(k){return f=k})},focusReset:"manual",scroll:"manual"})}function n(){f!==null&&(f(),f=null),l||setTimeout(s,20)}function s(){if(!l&&!navigation.transition){var m=navigation.currentEntry;m&&m.url!=null&&navigation.navigate(m.url,{state:m.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,f=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(s,100),function(){l=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),f!==null&&(f(),f=null)}}}function sm(t){this._internalRoot=t}Eu.prototype.render=sm.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(r(409));var s=n.current,l=li();z0(s,l,t,n,null,null)},Eu.prototype.unmount=sm.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;z0(t.current,2,null,t,null,null),ou(),n[Le]=null}};function Eu(t){this._internalRoot=t}Eu.prototype.unstable_scheduleHydration=function(t){if(t){var n=tc();t={blockedOn:null,target:t,priority:n};for(var s=0;s<fr.length&&n!==0&&n<fr[s].priority;s++);fr.splice(s,0,t),s===0&&P0(t)}};var G0=i.version;if(G0!=="19.3.1")throw Error(r(527,G0,"19.3.1"));Q.findDOMNode=function(t){var n=t._reactInternals;if(n===void 0)throw typeof t.render=="function"?Error(r(188)):(t=Object.keys(t).join(","),Error(r(268,t)));return t=g(n),t=t!==null?x(t):null,t=t===null?null:t.stateNode,t};var US={bundleType:0,version:"19.3.1",rendererPackageName:"react-dom",currentDispatcherRef:ye,reconcilerVersion:"19.3.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var _u=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!_u.isDisabled&&_u.supportsFiber)try{Rt=_u.inject(US),pt=_u}catch{}}return ho.createRoot=function(t,n){if(!o(t))throw Error(r(299));var s=!1,l="",f=Db,m=zb,k=Lb;return n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(m=n.onCaughtError),n.onRecoverableError!==void 0&&(k=n.onRecoverableError)),n=R0(t,1,!1,null,null,s,l,null,f,m,k,q0),t[Le]=n.current,Lp(t),new sm(n)},ho.hydrateRoot=function(t,n,s){if(!o(t))throw Error(r(299));var l=!1,f="",m=Db,k=zb,_=Lb,I=null;return s!=null&&(s.unstable_strictMode===!0&&(l=!0),s.identifierPrefix!==void 0&&(f=s.identifierPrefix),s.onUncaughtError!==void 0&&(m=s.onUncaughtError),s.onCaughtError!==void 0&&(k=s.onCaughtError),s.onRecoverableError!==void 0&&(_=s.onRecoverableError),s.formState!==void 0&&(I=s.formState)),n=R0(t,1,!0,n,s??null,l,f,I,m,k,_,q0),n.context=D0(null),s=n.current,l=li(),l=ds(l),f=Za(l),f.callback=null,Qa(s,f,l),s=l,n.current.lanes=s,Sr(n,s),ea(n),t[Le]=n.current,Lp(t),new Eu(n)},ho.version="19.3.1",ho}var t1;function VS(){if(t1)return um.exports;t1=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(i){console.error(i)}}return e(),um.exports=YS(),um.exports}var KS=VS();const XS=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ZS=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(i,a,r)=>r?r.toUpperCase():a.toLowerCase()),n1=e=>{const i=ZS(e);return i.charAt(0).toUpperCase()+i.slice(1)},tw=(...e)=>e.filter((i,a,r)=>!!i&&i.trim()!==""&&r.indexOf(i)===a).join(" ").trim(),QS=e=>{for(const i in e)if(i.startsWith("aria-")||i==="role"||i==="title")return!0};var JS={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const WS=B.forwardRef(({color:e="currentColor",size:i=24,strokeWidth:a=2,absoluteStrokeWidth:r,className:o="",children:u,iconNode:d,...p},h)=>B.createElement("svg",{ref:h,...JS,width:i,height:i,stroke:e,strokeWidth:r?Number(a)*24/Number(i):a,className:tw("lucide",o),...!u&&!QS(p)&&{"aria-hidden":"true"},...p},[...d.map(([g,x])=>B.createElement(g,x)),...Array.isArray(u)?u:[u]]));const pe=(e,i)=>{const a=B.forwardRef(({className:r,...o},u)=>B.createElement(WS,{ref:u,iconNode:i,className:tw(`lucide-${XS(n1(e))}`,`lucide-${e}`,r),...o}));return a.displayName=n1(e),a};const e2=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],t2=pe("activity",e2);const n2=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],Yh=pe("arrow-down-to-line",n2);const i2=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],a2=pe("arrow-left",i2);const r2=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],pd=pe("arrow-right",r2);const s2=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],l2=pe("arrow-up-right",s2);const o2=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],c2=pe("arrow-up",o2);const u2=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],d2=pe("bot",u2);const f2=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],ah=pe("braces",f2);const p2=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],i1=pe("brain",p2);const m2=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],h2=pe("bug",m2);const g2=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],x2=pe("calendar-days",g2);const b2=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Cn=pe("check",b2);const y2=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Po=pe("chevron-down",y2);const v2=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],w2=pe("chevron-left",v2);const k2=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],nw=pe("chevron-right",k2);const N2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],md=pe("circle-alert",N2);const E2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],_2=pe("circle-check",E2);const S2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],T2=pe("circle-x",S2);const C2=[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],j2=pe("clock-3",C2);const A2=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],rh=pe("cloud",A2);const O2=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],hd=pe("copy",O2);const M2=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],Yu=pe("cpu",M2);const R2=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],D2=pe("credit-card",R2);const z2=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],iw=pe("download",z2);const L2=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ss=pe("earth",L2);const I2=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],U2=pe("ellipsis",I2);const B2=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Vu=pe("external-link",B2);const $2=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],P2=pe("eye-off",$2);const H2=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Vh=pe("eye",H2);const F2=[["path",{d:"M10 12v-1",key:"v7bkov"}],["path",{d:"M10 18v-2",key:"1cjy8d"}],["path",{d:"M10 7V6",key:"dljcrl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01",key:"gkbcor"}],["circle",{cx:"10",cy:"20",r:"2",key:"1xzdoj"}]],mm=pe("file-archive",F2);const q2=[["path",{d:"M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"rslqgf"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0",key:"9f7x3i"}]],a1=pe("file-audio",q2);const G2=[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]],Qn=pe("file-code-2",G2);const Y2=[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m2.305 15.53.923-.382",key:"yfp9st"}],["path",{d:"m3.228 12.852-.924-.383",key:"bckynb"}],["path",{d:"M4.677 21.5a2 2 0 0 0 1.313.5H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2.5",key:"1yo3oz"}],["path",{d:"m4.852 11.228-.383-.923",key:"1j88i9"}],["path",{d:"m4.852 16.772-.383.924",key:"sag1dv"}],["path",{d:"m7.148 11.228.383-.923",key:"rj39hk"}],["path",{d:"m7.53 17.696-.382-.924",key:"1uu5cs"}],["path",{d:"m8.772 12.852.923-.383",key:"13811l"}],["path",{d:"m8.772 15.148.923.383",key:"z1a5l0"}],["circle",{cx:"6",cy:"14",r:"3",key:"a1xfv6"}]],Wr=pe("file-cog",Y2);const V2=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]],Vr=pe("file-image",V2);const K2=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],r1=pe("file-json",K2);const X2=[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v6",key:"rc0qvx"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"4",cy:"16",r:"2",key:"1ehqvc"}],["path",{d:"m10 10-4.5 4.5",key:"7fwrp6"}],["path",{d:"m9 11 1 1",key:"wa6s5q"}]],aw=pe("file-key-2",X2);const Z2=[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v1",key:"jmtmu2"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"8",height:"5",x:"2",y:"13",rx:"1",key:"10y5wo"}],["path",{d:"M8 13v-2a2 2 0 1 0-4 0v2",key:"1pdxzg"}]],Q2=pe("file-lock-2",Z2);const J2=[["path",{d:"m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2",key:"142zxg"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}],["path",{d:"M8 18h1",key:"13wk12"}]],s1=pe("file-pen-line",J2);const W2=[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["path",{d:"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z",key:"1tzo1f"}]],l1=pe("file-play",W2);const eT=[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]],rw=pe("file-plus-2",eT);const tT=[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]],nT=pe("file-search",tT);const iT=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Pn=pe("file-text",iT);const aT=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]],rT=pe("file-up",aT);const sT=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],lT=pe("flask-conical",sT);const oT=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],ls=pe("folder-open",oT);const cT=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],uT=pe("folder-plus",cT);const dT=[["path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]],fT=pe("folder-search",dT);const pT=[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]],sw=pe("folder-tree",pT);const mT=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Ro=pe("folder",mT);const hT=[["line",{x1:"6",x2:"10",y1:"11",y2:"11",key:"1gktln"}],["line",{x1:"8",x2:"8",y1:"9",y2:"13",key:"qnk9ow"}],["line",{x1:"15",x2:"15.01",y1:"12",y2:"12",key:"krot7o"}],["line",{x1:"18",x2:"18.01",y1:"10",y2:"10",key:"1lcuu1"}],["path",{d:"M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z",key:"mfqc10"}]],gT=pe("gamepad-2",hT);const xT=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],lw=pe("git-branch",xT);const bT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],yT=pe("globe",bT);const vT=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]],wT=pe("hammer",vT);const kT=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],gd=pe("hard-drive",kT);const NT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Kh=pe("info",NT);const ET=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],Ho=pe("key-round",ET);const _T=[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]],ST=pe("layout-template",_T);const TT=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],Xh=pe("link-2",TT);const CT=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],Zh=pe("list-checks",CT);const jT=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Qh=pe("loader-circle",jT);const AT=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],xd=pe("lock-keyhole",AT);const OT=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],MT=pe("log-out",OT);const RT=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],DT=pe("maximize-2",RT);const zT=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],LT=pe("menu",zT);const IT=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"m10 8-3 3 3 3",key:"fp6dz7"}],["path",{d:"m14 14 3-3-3-3",key:"1yrceu"}]],ow=pe("message-square-code",IT);const UT=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],cw=pe("message-square",UT);const BT=[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]],$T=pe("messages-square",BT);const PT=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],Jh=pe("monitor",PT);const HT=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],Wh=pe("moon",HT);const FT=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],eg=pe("package",FT);const qT=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],ll=pe("palette",qT);const GT=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],YT=pe("panel-left-close",GT);const VT=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],KT=pe("panel-left-open",VT);const XT=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],ZT=pe("paperclip",XT);const QT=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Fo=pe("pencil",QT);const JT=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],WT=pe("play",JT);const eC=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]],tg=pe("plug",eC);const tC=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ns=pe("plus",tC);const nC=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],iC=pe("radio",nC);const aC=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Bi=pe("refresh-cw",aC);const rC=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],vr=pe("rocket",rC);const sC=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],ng=pe("rotate-ccw",sC);const lC=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],uw=pe("rotate-cw",lC);const oC=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],cC=pe("save",oC);const uC=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],os=pe("search",uC);const dC=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],dw=pe("settings",dC);const fC=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],fw=pe("settings-2",fC);const pC=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],mC=pe("shield-alert",pC);const hC=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],wr=pe("shield-check",hC);const gC=[["path",{d:"M22 2 2 22",key:"y4kqgn"}]],xC=pe("slash",gC);const bC=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],yC=pe("sliders-horizontal",bC);const vC=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],wC=pe("smartphone",vC);const kC=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],Wn=pe("sparkles",kC);const NC=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],pw=pe("square-terminal",NC);const EC=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],ig=pe("square",EC);const _C=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],ag=pe("sun",_C);const SC=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]],TC=pe("tablet",SC);const CC=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],cl=pe("terminal",CC);const jC=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],la=pe("trash-2",jC);const AC=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],OC=pe("triangle-alert",AC);const MC=[["path",{d:"M13.73 4a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"14u9p9"}]],RC=pe("triangle",MC);const DC=[["path",{d:"m19 5 3-3",key:"yk6iyv"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z",key:"1snsnr"}]],zC=pe("unplug",DC);const LC=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],rg=pe("upload",LC);const IC=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],UC=pe("user-round",IC);const BC=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Do=pe("wrench",BC);const $C=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ni=pe("x",$C);const PC=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],HC=pe("zap",PC),o1=e=>{let i;const a=new Set,r=(g,x)=>{const b=typeof g=="function"?g(i):g;if(!Object.is(b,i)){const y=i;i=x??(typeof b!="object"||b===null)?b:Object.assign({},i,b),a.forEach(v=>v(i,y))}},o=()=>i,p={setState:r,getState:o,getInitialState:()=>h,subscribe:g=>(a.add(g),()=>a.delete(g))},h=i=e(r,o,p);return p},FC=(e=>e?o1(e):o1),qC=e=>e;function GC(e,i=qC){const a=cm.useSyncExternalStore(e.subscribe,cm.useCallback(()=>i(e.getState()),[e,i]),()=>i(e.getInitialState()));return cm.useDebugValue(a),a}const YC=e=>{const i=FC(e),a=r=>GC(i,r);return Object.assign(a,i),a},kr=(e=>YC);class is extends Error{status;code;constructor(i,a=0,r="daemon_error"){super(i),this.name="DaemonError",this.status=a,this.code=r}}let qo="",go=null;function VC(){return qo}async function bd(e){const i=await e.text().catch(()=>"");if(i)try{const a=JSON.parse(i);if(a.error?.message)return new is(a.error.message,a.error.status??e.status,a.error.code??"daemon_error")}catch{}return new is(i.trim().slice(0,400)||`The local daemon returned ${e.status}.`,e.status,"daemon_error")}async function pl(e=!1){return go&&!e||(go=(async()=>{let i;try{i=await fetch("/api/session",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin"})}catch{throw new is("OpenSol’s local daemon is not reachable. Start it with “npm start” in the OpenSol folder, then reload this page.",0,"daemon_unreachable")}if(!i.ok)throw await bd(i);const a=await i.json();qo=typeof a.csrf=="string"?a.csrf:""})().catch(i=>{throw go=null,i})),go}async function tt(e,i={},a=!0){await pl();const r=(i.method??"GET").toUpperCase(),o=new Headers(i.headers);i.body&&!o.has("Content-Type")&&o.set("Content-Type","application/json"),["GET","HEAD"].includes(r)||o.set("x-maxcode-csrf",qo);let u;try{u=await fetch(e,{...i,method:r,headers:o,credentials:"same-origin"})}catch{throw new is("Lost the connection to the local daemon. Check that it is still running.",0,"daemon_unreachable")}if(u.status===401&&a)return await pl(!0),tt(e,i,!1);if(!u.ok)throw await bd(u);return u.status===204?void 0:(u.headers.get("content-type")??"").includes("application/json")?await u.json():await u.text()}function yd(e){return{method:"POST",body:JSON.stringify(e)}}function KC(){return tt("/api/state")}function mw(){return tt("/api/plugins")}function XC(e){const i=atob(e),a=new Uint8Array(i.length);for(let r=0;r<i.length;r+=1)a[r]=i.charCodeAt(r);return a}async function hw(e){const i=await tt(`/api/plugins/${encodeURIComponent(e)}/package`);return XC(i.archive)}function ZC(e){let i="";for(let a=0;a<e.length;a+=32768)i+=String.fromCharCode(...e.subarray(a,a+32768));return btoa(i)}function gw(e){return tt("/api/plugins",{method:"POST",body:JSON.stringify({archive:ZC(e)})})}function QC(e,i){return tt(`/api/plugins/${encodeURIComponent(e)}/grants`,{method:"PUT",body:JSON.stringify(i)})}function c1(e,i){return tt(`/api/plugins/${encodeURIComponent(e)}/safe`,{method:"PUT",body:JSON.stringify({safe:i})})}function JC(e,i){return tt(`/api/plugins/${encodeURIComponent(e)}/enabled`,{method:"PUT",body:JSON.stringify({enabled:i})})}function WC(e){return tt(`/api/plugins/${encodeURIComponent(e)}`,{method:"DELETE"})}function ej(e,i){return tt(`/api/plugins/${encodeURIComponent(e)}/network`,{method:"POST",body:JSON.stringify(i)})}function tj(e){return tt("/api/settings",{method:"PATCH",body:JSON.stringify(e)})}function xw(e){return tt("/api/chats",{method:"PUT",body:JSON.stringify(e)})}function nj(e){return tt("/api/migrate",yd(e))}function ij(){return tt("/api/providers")}function aj(e){return tt(`/api/models?provider=${encodeURIComponent(e)}`)}function rj(e,i){return i?tt(`/api/providers/${e}/key`,{method:"PUT",body:JSON.stringify({apiKey:i})}):tt(`/api/providers/${e}/key`,{method:"DELETE"})}function sj(e){return tt("/api/search/key",{method:"PUT",body:JSON.stringify({apiKey:e})})}function lj(e,i){return tt(`/api/deploy/credentials/${e}`,{method:"PUT",body:JSON.stringify(i)})}function oj(e){return tt("/api/skills/install",{method:"POST",body:JSON.stringify({package:e})})}function cj(e){return tt("/api/reset",yd({scope:e}))}function uj(e){return tt("/api/workspaces",yd({path:e}))}function dj(){return tt("/api/workspaces",{method:"DELETE"})}function fj(e){return tt(`/api/workspaces?path=${encodeURIComponent(e)}`,{method:"DELETE"})}function pj(){return tt("/api/mcp")}function mj(e){return tt("/api/mcp",{method:"PUT",body:JSON.stringify({servers:e})})}function hj(e,i){return tt(`/api/mcp/${encodeURIComponent(e)}/${i}`,{method:"POST",body:"{}"})}function gj(e){return tt(`/api/mcp/${encodeURIComponent(e)}/authorize`,{method:"POST",body:"{}"})}function xj(e){return tt(`/api/mcp/${encodeURIComponent(e)}/logout`,{method:"POST",body:"{}"})}function bj(e,i,a,r){return tt("/api/mcp/call",{method:"POST",body:JSON.stringify({server:e,tool:i,args:a}),signal:r})}function yj(e){return tt(`/api/workspaces/browse?path=${encodeURIComponent(e)}`)}function bw(e="",i=6){return tt(`/api/workspace/tree?depth=${i}&path=${encodeURIComponent(e)}`)}function sh(e){return tt(`/api/workspace/file?path=${encodeURIComponent(e)}`)}function lh(e,i){return tt("/api/workspace/file",{method:"PUT",body:JSON.stringify({path:e,content:i})})}function vj(e,i){return tt("/api/workspace/file",{method:"POST",body:JSON.stringify({action:"create",path:e,type:i})})}function wj(e,i){return tt("/api/workspace/file",{method:"POST",body:JSON.stringify({action:"rename",from:e,to:i})})}function kj(e){return tt("/api/workspace/file",{method:"POST",body:JSON.stringify({action:"delete",path:e})})}function Nj(){return tt("/api/git")}function Xt(e,i,a,r,o){return tt("/api/tools/execute",{...yd({name:e,args:i,mode:a,checkpoint:o}),signal:r})}function Ej(){return tt("/api/preview/token")}function _j(){return tt("/api/workspace/instructions")}function Sj(e){return tt(`/api/checkpoints/${encodeURIComponent(e)}/restore`,{method:"POST",body:JSON.stringify({})})}async function Go(e,i,a,r,o,u=!0){await pl();let d;try{d=await fetch("/api/llm",{method:"POST",headers:{"Content-Type":"application/json","x-maxcode-csrf":qo},body:JSON.stringify({provider:e,kind:i,model:a,body:r}),signal:o,credentials:"same-origin"})}catch(p){throw p instanceof DOMException&&p.name==="AbortError"?p:new is("Lost the connection to the local daemon while calling the model.",0,"daemon_unreachable")}if(d.status===401&&u)return await pl(!0),Go(e,i,a,r,o,!1);if(!d.ok)throw await bd(d);return d}function Tj(e){return tt("/api/deploy/inspect",{method:"POST",body:JSON.stringify({path:e})})}async function*Cj(e,i){await pl();let a;try{a=await fetch("/api/deploy",{method:"POST",headers:{"Content-Type":"application/json","x-maxcode-csrf":qo},body:JSON.stringify(e),signal:i,credentials:"same-origin"})}catch(d){throw d instanceof DOMException&&d.name==="AbortError"?d:new is("Lost the connection to the local daemon while deploying.",0,"daemon_unreachable")}if(!a.ok)throw await bd(a);if(!a.body)throw new is("The deploy stream was empty.",502,"empty_stream");const r=a.body.getReader(),o=new TextDecoder;let u="";try{for(;;){const{done:p,value:h}=await r.read();if(p)break;u+=o.decode(h,{stream:!0});let g=u.indexOf(`
|
|
10
|
+
`);for(;g!==-1;){const x=u.slice(0,g).trim();if(u=u.slice(g+1),x)try{yield JSON.parse(x)}catch{yield{type:"log",stream:"meta",text:x}}g=u.indexOf(`
|
|
11
|
+
`)}}const d=u.trim();if(d)try{yield JSON.parse(d)}catch{yield{type:"log",stream:"meta",text:d}}}finally{r.releaseLock()}}const Ra=kr()(e=>({titling:{},setTitling:(i,a)=>e(r=>{if(!!r.titling[i]===a)return r;const o={...r.titling};return a?o[i]=!0:delete o[i],{titling:o}}),streaming:{},setStreaming:(i,a)=>e(r=>{if(!!r.streaming[i]===a)return r;const o={...r.streaming};return a?o[i]=!0:delete o[i],{streaming:o}})}));function jj(){try{return localStorage.getItem("maxcode.sidebar-collapsed")==="1"}catch{return!1}}function Aj(e){try{localStorage.setItem("maxcode.sidebar-collapsed",e?"1":"0")}catch{}}const me=kr()((e,i)=>({sidebarCollapsed:jj(),toggleSidebar:()=>e(a=>{const r=!a.sidebarCollapsed;return Aj(r),{sidebarCollapsed:r}}),mobileSidebarOpen:!1,setMobileSidebarOpen:a=>e({mobileSidebarOpen:a}),workspaceOpen:!1,setWorkspaceOpen:a=>e({workspaceOpen:a}),mcpOpen:!1,setMcpOpen:a=>e({mcpOpen:a,...a?{mobileSidebarOpen:!1,settingsOpen:!1}:{}}),settingsOpen:!1,settingsTab:"general",openSettings:(a="general")=>e({settingsOpen:!0,settingsTab:a,mobileSidebarOpen:!1}),closeSettings:()=>e({settingsOpen:!1}),deployOpen:!1,setDeployOpen:a=>e({deployOpen:a}),paletteOpen:!1,setPaletteOpen:a=>e({paletteOpen:a}),composerFocus:0,focusComposer:()=>e(a=>({composerFocus:a.composerFocus+1})),toast:null,notify:(a,r="info")=>e({toast:{id:Date.now()+Math.random(),message:a,tone:r}}),dismissToast:a=>e(r=>r.toast?.id===a?{toast:null}:r),confirm:null,askConfirm:a=>new Promise(r=>{i().confirm&&i().confirm?.resolve(!1),e({confirm:{...a,resolve:r}})}),resolveConfirm:a=>{const r=i().confirm;e({confirm:null}),r?.resolve(a)}}));window.addEventListener("maxcode:notice",e=>{const i=e.detail;i?.message&&me.getState().notify(i.message,i.tone??"info")});const Oj={root:"",name:"",available:!1,error:"",workspaces:[]},xo={available:!1,root:"",branch:"",entries:[],error:""};function u1(e,i){return!!(e&&(e===i||e.startsWith(`${i}/`)))}const Be=kr()((e,i)=>({info:Oj,root:"",entries:[],truncated:!1,loadingTree:!1,treeError:"",activeFile:null,file:null,content:"",dirty:!1,saving:!1,openingFile:!1,git:xo,gitLoading:!1,instructions:{file:"",content:"",truncated:!1},hydrate:async a=>{e({info:a,root:a.root,treeError:a.available?"":a.error,entries:a.available?i().entries:[],activeFile:a.available?i().activeFile:null,file:a.available?i().file:null,content:a.available?i().content:"",dirty:!1,git:a.available?i().git:xo}),a.available?(await i().loadTree(),i().loadGit(),i().loadInstructions()):e({instructions:{file:"",content:"",truncated:!1}})},loadInstructions:async()=>{if(i().info.available)try{e({instructions:await _j()})}catch{e({instructions:{file:"",content:"",truncated:!1}})}},loadTree:async()=>{const a=i().info;if(!a.available||!a.root){e({entries:[],loadingTree:!1,treeError:a.error});return}e({loadingTree:!0,treeError:""});try{const r=await bw("",7);e({entries:r.entries,truncated:r.truncated,loadingTree:!1,root:r.root,info:r.workspace}),i().loadInstructions()}catch(r){e({loadingTree:!1,treeError:r instanceof Error?r.message:"Could not read the workspace."})}},refresh:async({treeOnly:a=!1}={})=>{if(await i().loadTree(),a)return;const r=i().activeFile;if(!r||i().dirty)return;if(!i().entries.some(u=>u.path===r&&u.type==="file")){e({activeFile:null,file:null,content:"",dirty:!1});return}try{await i().openFile(r,{force:!0})}catch{}},openFile:async(a,{force:r=!1}={})=>{if(!(!a||i().openingFile)&&!(!r&&i().activeFile===a&&i().file)&&!(i().dirty&&!await i().saveFile())){e({openingFile:!0,treeError:""});try{const o=await sh(a);e({activeFile:a,file:o,content:o.content,dirty:!1,openingFile:!1})}catch(o){e({openingFile:!1,treeError:o instanceof Error?o.message:"Could not open that file."}),me.getState().notify(o instanceof Error?o.message:"Could not open that file.","error")}}},closeFile:()=>e({activeFile:null,file:null,content:"",dirty:!1}),setContent:a=>{i().file?.binary||a!==i().content&&e({content:a,dirty:!0})},saveFile:async()=>{const{activeFile:a,content:r,dirty:o,file:u,saving:d}=i();if(!a||!o||d||u?.binary)return!0;e({saving:!0});try{const p=await lh(a,r);return e({saving:!1,dirty:!1,file:u&&{...u,size:p.size,mtime:p.mtime,hash:p.hash,truncated:!1}}),me.getState().notify(`Saved ${a}`,"success"),!0}catch(p){return e({saving:!1}),me.getState().notify(p instanceof Error?p.message:"Could not save that file.","error"),!1}},createEntry:async(a,r)=>{await vj(a,r),await i().loadTree(),r==="file"&&await i().openFile(a),me.getState().notify(`${r==="dir"?"Folder":"File"} created: ${a}`,"success")},renameEntry:async(a,r)=>{if(await wj(a,r),await i().loadTree(),u1(i().activeFile,a)){const o=i().activeFile===a?r:`${r}${i().activeFile?.slice(a.length)??""}`;e({activeFile:null,file:null,content:"",dirty:!1}),await i().openFile(o)}me.getState().notify(`Renamed to ${r}`,"success")},deleteEntry:async a=>{await kj(a),u1(i().activeFile,a)&&e({activeFile:null,file:null,content:"",dirty:!1}),await i().loadTree(),me.getState().notify(`Deleted ${a}`,"success")},addWorkspace:async a=>{const r=await uj(a);e({activeFile:null,file:null,content:"",dirty:!1,entries:[]}),await i().hydrate(r.workspace),me.getState().notify(`Workspace set to ${r.entry.name}`,"success")},forgetWorkspace:async()=>{if(i().dirty&&!await i().saveFile())return;const a=await dj();e({info:a,root:"",entries:[],activeFile:null,file:null,content:"",dirty:!1,git:xo,instructions:{file:"",content:"",truncated:!1}})},removeWorkspace:async a=>{const r=i().info.root===a;if(r&&i().dirty&&!await i().saveFile())return;const o=await fj(a);if(!r){e({info:o});return}e({info:o,root:"",entries:[],activeFile:null,file:null,content:"",dirty:!1,git:xo,instructions:{file:"",content:"",truncated:!1}})},loadGit:async()=>{if(i().info.available){e({gitLoading:!0});try{const a=await Nj();e({git:{...a},gitLoading:!1})}catch(a){e({git:{...xo,error:a instanceof Error?a.message:"Git status failed."},gitLoading:!1})}}},setActiveFile:a=>{a?i().openFile(a):i().closeFile()}}));function Ui(e){const i=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,9)}`;return`${e}_${i}`}function yw(e){if(!e||typeof e!="object")return!1;const i=e;return typeof i.id=="string"&&typeof i.title=="string"&&Array.isArray(i.messages)}function vw(e){let i=0;const a=e.messages.filter(r=>!!(r&&typeof r=="object")).map((r,o)=>{if(r.role==="user")return o>0&&(i+=1),r;const u=typeof r.round=="number"?r.round:i;return r.role==="assistant"?{...r,content:typeof r.content=="string"?r.content:"",reasoning:typeof r.reasoning=="string"?r.reasoning:"",toolCalls:Array.isArray(r.toolCalls)?r.toolCalls:[],round:u}:{...r,round:u}});return{...e,title:e.title.trim()||"New conversation",messages:a,createdAt:typeof e.createdAt=="number"?e.createdAt:Date.now(),updatedAt:typeof e.updatedAt=="number"?e.updatedAt:Date.now(),mode:e.mode==="plan"?"plan":e.mode==="build"?"build":void 0,workspace:typeof e.workspace=="string"?e.workspace:void 0,systemPrompt:typeof e.systemPrompt=="string"?e.systemPrompt:void 0,titleSource:e.titleSource==="ai"||e.titleSource==="user"||e.titleSource==="auto"?e.titleSource:void 0}}function Mj(e){const i=e.replace(/\s+/g," ").trim();return i?i.length>56?`${i.slice(0,56).trim()}…`:i:"New conversation"}const Ve=kr()((e,i)=>({sessions:[],activeId:null,hydrated:!1,hydrate:a=>{const r=(a.sessions??[]).filter(yw).map(vw).sort((u,d)=>d.updatedAt-u.updatedAt),o=typeof a.activeId=="string"&&r.some(u=>u.id===a.activeId)?a.activeId:r[0]?.id??null;e({sessions:r,activeId:o,hydrated:!0})},setActive:a=>e({activeId:a}),newChat:()=>e({activeId:null}),createSession:(a,r,o)=>{const u=Ui("chat"),d=Date.now(),p={id:u,title:"New conversation",createdAt:d,updatedAt:d,messages:[],provider:a,model:r,mode:o,workspace:Be.getState().info.root||void 0,titleSource:"auto"};return e(h=>({sessions:[p,...h.sessions],activeId:u})),u},addMessage:(a,r)=>{e(o=>({sessions:o.sessions.map(u=>{if(u.id!==a)return u;const d={messages:[...u.messages,r],updatedAt:Date.now()};return r.role==="user"&&u.messages.length===0&&(d.title=Mj(r.content)),{...u,...d}})}))},updateMessage:(a,r,o)=>{e(u=>({sessions:u.sessions.map(d=>{if(d.id!==a)return d;let p=!1;const h=d.messages.map(g=>{if(g.id!==r)return g;const x=typeof o=="function"?o(g):o;return!x||Object.keys(x).length===0?g:(p=!0,{...g,...x})});return p?{...d,messages:h,updatedAt:Date.now()}:d})}))},updateSession:(a,r)=>{e(o=>({sessions:o.sessions.map(u=>u.id===a?{...u,...r,updatedAt:Date.now()}:u)}))},renameSession:(a,r)=>{const o=r.trim();o&&i().updateSession(a,{title:o,titleSource:"user"})},deleteSession:a=>{e(r=>{const o=r.sessions.filter(u=>u.id!==a);return{sessions:o,activeId:r.activeId===a?o[0]?.id??null:r.activeId}})},clearAll:()=>e({sessions:[],activeId:null}),persistNow:async()=>{const{sessions:a,activeId:r}=i();await xw({sessions:a,activeId:r})}}));let vd=!1,es,ul;function Rj(){vd=!0}function Dj(){!vd||typeof window>"u"||(es!==void 0&&window.clearTimeout(es),es=window.setTimeout(()=>{es=void 0,d1()},900),ul===void 0&&(ul=window.setTimeout(()=>{ul=void 0,d1()},6e3)))}async function d1(){if(!vd)return;es!==void 0&&(window.clearTimeout(es),es=void 0),ul!==void 0&&(window.clearTimeout(ul),ul=void 0);const{sessions:e,activeId:i}=Ve.getState();try{await xw({sessions:e,activeId:i})}catch(a){window.dispatchEvent(new CustomEvent("maxcode:notice",{detail:{message:a instanceof Error?a.message:"Could not save conversations to the local daemon.",tone:"error"}}))}}Ve.subscribe(Dj);if(typeof window<"u"){const e=()=>{if(!vd)return;const{sessions:i,activeId:a}=Ve.getState();try{const r=JSON.stringify({sessions:i,activeId:a});if(r.length>6e4)return;fetch("/api/chats",{method:"PUT",keepalive:!0,headers:{"Content-Type":"application/json","x-maxcode-csrf":VC()},body:r}).catch(()=>{})}catch{}};window.addEventListener("beforeunload",e),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&e()})}function ww(){const e=Ve.getState().sessions,i=new Blob([JSON.stringify({app:"OpenSol",exportedAt:new Date().toISOString(),sessions:e},null,2)],{type:"application/json"}),a=URL.createObjectURL(i),r=document.createElement("a");r.href=a,r.download=`maxcode-history-${new Date().toISOString().slice(0,10)}.json`,r.click(),URL.revokeObjectURL(a)}function zj(e){return e.text().then(i=>{const a=JSON.parse(i);if(!Array.isArray(a.sessions))throw new Error("This file does not contain a OpenSol history.");const r=a.sessions.filter(yw).map(vw);if(r.length===0)throw new Error("No valid conversations were found in this file.");const o=new Set(Ve.getState().sessions.map(d=>d.id)),u=r.filter(d=>!o.has(d.id));return Ve.setState(d=>({sessions:[...u,...d.sessions],activeId:u[0]?.id??d.activeId})),u.length})}const Ku=[{id:"openai",name:"OpenAI",format:"openai",baseUrl:"https://api.openai.com/v1",keyHint:"sk-…",note:"GPT and Codex models. Requests are made by your local daemon, never by OpenSoftX."},{id:"anthropic",name:"Anthropic",format:"anthropic",baseUrl:"https://api.anthropic.com/v1",keyHint:"sk-ant-…",note:"Claude models, including extended thinking where the model supports it."},{id:"google",name:"Google",format:"gemini",baseUrl:"https://generativelanguage.googleapis.com/v1beta",keyHint:"AIza…",note:"Gemini models through the Generative Language API."},{id:"opencode",name:"OpenCode",format:"openai",baseUrl:"https://opencode.ai/inference/v1",keyHint:"OpenCode API key",note:"OpenCode routes each model to its native API. Free-tier models only work inside OpenCode and are hidden."},{id:"deepseek",name:"DeepSeek",format:"openai",baseUrl:"https://api.deepseek.com",keyHint:"sk-…",note:"DeepSeek chat and reasoning models."},{id:"openrouter",name:"OpenRouter",format:"openai",baseUrl:"https://openrouter.ai/api/v1",keyHint:"sk-or-…",note:"One key for hundreds of models and providers."},{id:"groq",name:"Groq",format:"openai",baseUrl:"https://api.groq.com/openai/v1",keyHint:"gsk_…"},{id:"mistral",name:"Mistral",format:"openai",baseUrl:"https://api.mistral.ai/v1",keyHint:"…"},{id:"xai",name:"xAI",format:"openai",baseUrl:"https://api.x.ai/v1",keyHint:"xai-…"},{id:"together",name:"Together AI",format:"openai",baseUrl:"https://api.together.xyz/v1",keyHint:"…"},{id:"ollama",name:"Ollama",format:"openai",baseUrl:"http://localhost:11434/v1",keyless:!0,keyHint:"Not required",note:"Runs on your machine. The daemon reaches it at localhost; no data leaves your computer."},{id:"custom",name:"Custom endpoint",format:"openai",baseUrl:"",keyHint:"Optional",note:"Any OpenAI-compatible endpoint or proxy you control."}],sa=Object.fromEntries(Ku.map(e=>[e.id,e]));function sg(e){return sa[e]?.name??e}const f1=["none","minimal","low","medium","high","xhigh","max"],lg={none:{label:"None",description:"Disable extra reasoning"},minimal:{label:"Minimal",description:"Very light reasoning"},low:{label:"Low",description:"Fast, lighter reasoning"},medium:{label:"Medium",description:"Balanced reasoning"},high:{label:"High",description:"Deeper reasoning, slower"},xhigh:{label:"Extra high",description:"Very deep reasoning"},max:{label:"Max",description:"Maximum effort the model allows"}};function Xu(e){return lg[e]?.label??e}function Nr(e){return e?.reasoningOptions.find(a=>a.type==="effort")?.values??[]}function kw(e){return e?.reasoningOptions.find(i=>i.type==="budget_tokens")}function Zu(e){return!!kw(e)}function Nw(e){return!!e?.reasoningOptions.some(i=>i.type==="toggle")}function Ew(e){const i=Nr(e);if(i.length===0)return"medium";for(const a of["medium","high","low"])if(i.includes(a))return a;return i[0]}function ml(e,i){const a=Nr(i);return a.length===0||a.includes(e)?e:Ew(i)}function Lj(e,i){const a=kw(i),r=Math.max(0,a?.min??1024),o=Math.max(r,a?.max??32768);return Math.max(r,Math.min(o,e))}const Ij={none:1024,minimal:1024,low:2048,medium:8192,high:16384,xhigh:24576,max:32768};function _w(e,i){return Lj(Ij[e]??8192,i)}function zo(e){return[...Nr(e)].sort((a,r)=>f1.indexOf(a)-f1.indexOf(r))}function oh(e){if(!e)return"Choose a model to see live reasoning controls.";const i=Nr(e);return i.length>0?`Effort levels from this model: ${i.join(", ")}.`:Zu(e)?"This model accepts a thinking token budget, derived from the effort level.":Nw(e)?"This model controls reasoning itself; no effort value is sent.":"This model advertises no reasoning controls, so effort does not apply."}const Sw=[{id:"light",label:"Light",dark:!1},{id:"dark",label:"Dark",dark:!0},{id:"night-owl",label:"Night Owl",dark:!0},{id:"claude-code",label:"Claude Code",dark:!0},{id:"flame",label:"Flame",dark:!0}],Uj=/^[a-z0-9][a-z0-9:_-]{0,79}$/,og=new Map(Sw.map(e=>[e.id,e]));function Tw(e){og.set(e.id,e)}function Cw(e){Sw.some(i=>i.id===e)||og.delete(e)}function jw(e){return typeof e=="string"&&Uj.test(e)}function Aw(e,i){return e==="system"?i?"dark":"light":jw(e)?e:"light"}function ch(e,i){return og.get(Aw(e,i))?.dark??!1}function Bj(e){return e==="system"?"system":jw(e)?e:"system"}const Lo=`You are OpenSol, a senior web engineer and coding agent built by OpenSoftX.
|
|
12
|
+
|
|
13
|
+
You work directly in the user's open folder through a local daemon. The shell, file, git, search and deploy tools are real. Never describe tool output you did not receive.
|
|
14
|
+
|
|
15
|
+
Engineering standard:
|
|
16
|
+
- Read every file you change. Match the existing stack, style, naming and conventions. Never invent APIs, versions, flags, package names or paths.
|
|
17
|
+
- Make the smallest correct change. One concern per edit. No speculative abstraction, dead code, placeholder TODOs or swallowed errors.
|
|
18
|
+
- Keep public behavior stable unless the task explicitly changes it.
|
|
19
|
+
- Security: never expose secrets, never weaken auth, CSRF, CSP or validation to make something pass, and validate untrusted input at boundaries.
|
|
20
|
+
- Accessibility: semantic HTML, keyboard paths, visible focus, sufficient contrast.
|
|
21
|
+
- Performance: avoid needless work; measure before optimizing.
|
|
22
|
+
- Every bug fix gets a regression test when a test setup exists. Tests assert behavior, not implementation.
|
|
23
|
+
|
|
24
|
+
Working loop:
|
|
25
|
+
1. Inspect before editing: list files, read the relevant source, grep for call sites, check git status.
|
|
26
|
+
2. For non-trivial work, state a short plan.
|
|
27
|
+
3. Edit in small, coherent steps.
|
|
28
|
+
4. Verify with the project's real commands (typecheck, lint, tests, build) and read the output.
|
|
29
|
+
5. Report what changed, which files, and what was verified. If a check fails or cannot run, say so plainly and explain why.
|
|
30
|
+
|
|
31
|
+
Never claim a check passed without running it. Ask only when a decision is genuinely ambiguous or destructive. Answer in the user's language. Cite web sources as links, and only when you actually read them.`,uh={shell:{enabled:!0,approval:"ask"},read_file:{enabled:!0,approval:"auto"},list_files:{enabled:!0,approval:"auto"},write_file:{enabled:!0,approval:"auto"},edit_file:{enabled:!0,approval:"auto"},rewrite_file:{enabled:!0,approval:"auto"},grep:{enabled:!0,approval:"auto"},web_search:{enabled:!0,approval:"auto"},read_url:{enabled:!0,approval:"auto"},git:{enabled:!0,approval:"ask"},subagent:{enabled:!0,approval:"ask"},skill:{enabled:!0,approval:"ask"}},Aa={provider:"openai",model:"",effort:"medium",webSearchEnabled:!0,temperature:.4,maxTokens:8192,systemPrompt:Lo,workspacePrompts:{},providers:{},searchProvider:"duckduckgo",tools:uh,skills:[],theme:"system",showTokenEstimate:!0,mode:"build",chatFontSize:15,workDetail:"detailed",autoCollapseWork:!0,aiSessionTitles:!0},$j=new Set(["none","minimal","low","medium","high","xhigh","max"]);function Ow(e,i="error"){typeof window>"u"||window.dispatchEvent(new CustomEvent("maxcode:notice",{detail:{message:e,tone:i}}))}function Pj(e){const i={};for(const a of Object.keys(uh))i[a]={...uh[a],...e?.[a]??{}};return i}function Hj(e){return(e??[]).filter(i=>!!i&&typeof i.id=="string"&&typeof i.name=="string"&&!i.builtIn).map(i=>({...i,description:typeof i.description=="string"?i.description:"",instructions:typeof i.instructions=="string"?i.instructions:"",enabled:i.enabled!==!1}))}function Fj(e){return typeof e!="string"||!e.trim()||/sandboxed workspace stored in the user's browser/i.test(e)||/There is no node, npm, git or network in the shell/i.test(e)||/workspace root is \/workspace/i.test(e)?Lo:e}function qj(e){const i={};for(const[a,r]of Object.entries(e??{}))!(a in sa)||!r||typeof r!="object"||typeof r.baseUrl=="string"&&r.baseUrl.trim()&&(i[a]={baseUrl:r.baseUrl.trim()});return i}function Gj(e){const i=e??{},a=typeof i.provider=="string"&&i.provider in sa?i.provider:Aa.provider,r=i.mode==="plan"?"plan":i.mode==="build"?"build":Aa.mode;return{...Aa,...i,provider:a,model:typeof i.model=="string"?i.model.trim():"",mode:r,effort:typeof i.effort=="string"&&$j.has(i.effort)?i.effort:Aa.effort,webSearchEnabled:i.webSearchEnabled!==!1,showTokenEstimate:i.showTokenEstimate!==!1,temperature:typeof i.temperature=="number"&&Number.isFinite(i.temperature)?Math.max(0,Math.min(2,i.temperature)):Aa.temperature,maxTokens:typeof i.maxTokens=="number"&&Number.isFinite(i.maxTokens)?Math.max(256,Math.min(2e5,Math.round(i.maxTokens))):Aa.maxTokens,systemPrompt:Fj(i.systemPrompt),workspacePrompts:i.workspacePrompts&&typeof i.workspacePrompts=="object"?Object.fromEntries(Object.entries(i.workspacePrompts).filter(([o,u])=>o.startsWith("/")&&typeof u=="string")):{},providers:qj(i.providers),searchProvider:i.searchProvider&&["duckduckgo","tavily","brave","serper"].includes(i.searchProvider)?i.searchProvider:Aa.searchProvider,tools:Pj(i.tools),skills:Hj(i.skills),theme:Bj(i.theme),chatFontSize:typeof i.chatFontSize=="number"&&Number.isFinite(i.chatFontSize)?Math.max(12,Math.min(20,Math.round(i.chatFontSize))):Aa.chatFontSize,workDetail:i.workDetail==="concise"?"concise":"detailed",autoCollapseWork:i.autoCollapseWork!==!1,aiSessionTitles:i.aiSessionTitles!==!1}}let cg=!1,dl={},fl,To;function Mw(e){const i={},a=["provider","model","effort","webSearchEnabled","temperature","maxTokens","systemPrompt","workspacePrompts","providers","searchProvider","tools","skills","theme","showTokenEstimate","mode","chatFontSize","workDetail","autoCollapseWork","aiSessionTitles"];for(const r of a)r in e&&(i[r]=e[r]);return i}function dh(){if(!cg||Object.keys(dl).length===0)return Promise.resolve();const e=Mw(dl);return dl={},fl!==void 0&&window.clearTimeout(fl),To!==void 0&&window.clearTimeout(To),fl=void 0,To=void 0,tj(e).then(()=>{}).catch(i=>{Ow(i instanceof Error?i.message:"Could not save settings to the local daemon.")})}function Oa(e){cg&&(dl={...dl,...Mw(e)},fl!==void 0&&window.clearTimeout(fl),fl=window.setTimeout(()=>{dh()},550),To===void 0&&(To=window.setTimeout(()=>{dh()},4e3)))}function Yj(){cg=!0,Object.keys(dl).length>0&&Oa({})}const Me=kr()((e,i)=>({...Aa,hydrated:!1,daemon:null,secretStatus:null,providerStatus:[],deployTools:null,deploySecrets:null,secretsError:"",hydrate:a=>{const r=Gj(a.settings),o=a.providers,u=o.filter(d=>d.configured);!fh(r,o,r.provider)&&u.length>0&&(r.provider=u[0].id,r.model=""),fh(r,o,r.provider)||(r.model=""),e({...r,hydrated:!0,daemon:a,secretStatus:a.secrets,providerStatus:o,deployTools:a.deployTools,deploySecrets:a.deploySecrets,secretsError:a.secretsError})},update:a=>{e(a),Oa(a)},selectModel:(a,r,o)=>{const u=o??i().effort,d={provider:a,model:r.trim(),effort:u};e(d),Oa(d)},updateProvider:(a,r)=>{const o={providers:{...i().providers,[a]:{...i().providers[a]??{},...r}}};e(o),Oa(o)},saveProviderKey:async(a,r)=>{const o=await rj(a,r.trim()),u=wd(i(),a);e(d=>{const p=d.secretStatus?{...d.secretStatus,providers:{...d.secretStatus.providers,[a]:{configured:o.configured,hint:o.hint}}}:d.secretStatus,h=d.providerStatus.map(y=>y.id===a?{...y,configured:o.configured,hint:o.hint}:y),g=o.configured?!hl(d)||d.provider===a:!1,x=d.provider===a&&!o.configured,b={};return g&&(b.provider=a),x&&(b.model=""),{secretStatus:p,providerStatus:h,...b}}),!u&&o.configured&&Ow(`${sa[a]?.name??a} is connected.`,"success")},saveSearchKey:async a=>{const r=await sj(a.trim());e(o=>({secretStatus:o.secretStatus?{...o.secretStatus,search:{configured:r.configured,hint:r.hint}}:o.secretStatus}))},saveDeployCredentials:async(a,r)=>{const o=await lj(a,r);e(u=>({secretStatus:u.secretStatus?{...u.secretStatus,deploy:{...u.secretStatus.deploy,[a]:o}}:u.secretStatus,deploySecrets:u.deploySecrets?{...u.deploySecrets,[a]:o}:u.deploySecrets}))},refreshProviders:async()=>{const a=await ij();e({providerStatus:a.providers})},updateTool:(a,r)=>{const o={tools:{...i().tools,[a]:{...i().tools[a],...r}}};e(o),Oa(o)},addSkill:a=>{const r={skills:[...i().skills,a]};e(r),Oa(r)},updateSkill:(a,r)=>{const o={skills:i().skills.map(u=>u.id===a?{...u,...r}:u)};e(o),Oa(o)},removeSkill:a=>{const r={skills:i().skills.filter(o=>o.id!==a)};e(r),Oa(r)},setMode:a=>{const r={mode:a};e(r),Oa(r)},flush:()=>dh()}));function ui(e){return e.model.trim()}function wd(e,i){return fh(e,Me.getState().providerStatus,i)}function fh(e,i,a){const r=sa[a];if(!r)return!1;const o=i.find(u=>u.id===a);return o?o.configured:a==="custom"?!!e.providers.custom?.baseUrl?.trim():!!r.keyless}function hl(e){return wd(e,e.provider)}typeof window<"u"&&(window.addEventListener("beforeunload",()=>{Me.getState().flush()}),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Me.getState().flush()}));function Qu(e){return e==null}function Da(e,i,a){return Object.defineProperty(e,i,{writable:!0,value:a,enumerable:!1})}function ph(e,i){return arguments.length===1?a=>ph(e,a):e in globalThis&&i instanceof globalThis[e]||Object.prototype.toString.call(i).slice(8,-1)===e}function Rw(e){return ph("ArrayBuffer",e)||ph("SharedArrayBuffer",e)}function Vj(e){return Rw(e)||ArrayBuffer.isView(e)}var gl;(e=>{e.is=Rw,e.isSource=Vj;function i(d){return ArrayBuffer.isView(d)?d.buffer.slice(d.byteOffset,d.byteOffset+d.byteLength):d}e.fromSource=i;function a(d){if(d=i(d),typeof Buffer<"u")return Buffer.from(d).toString("base64");let p="";const h=new Uint8Array(d);for(let g=0;g<h.byteLength;g++)p+=String.fromCharCode(h[g]);return btoa(p)}e.toBase64=a;function r(d){return typeof Buffer<"u"?i(Buffer.from(d,"base64")):Uint8Array.from(atob(d),p=>p.charCodeAt(0))}e.fromBase64=r;function o(d){return d=i(d),typeof Buffer<"u"?Buffer.from(d).toString("hex"):Array.from(new Uint8Array(d),p=>p.toString(16).padStart(2,"0")).join("")}e.toHex=o;function u(d){if(typeof Buffer<"u")return i(Buffer.from(d,"hex"));const p=d.length%2===0?d:d.slice(0,d.length-1),h=[];for(let g=0;g<p.length;g+=2)h.push(parseInt(`${p[g]}${p[g+1]}`,16));return Uint8Array.from(h).buffer}e.fromHex=u})(gl||(gl={}));gl.fromBase64;gl.toBase64;gl.fromHex;gl.toHex;function Kj(e,i,a){const r=[];let o=0;for(let u=0;u<e.length;u++){const d=e.charCodeAt(u);if(d>=65&&d<=90){if(o===1){const p=e.charCodeAt(u+1);p>=97&&p<=122&&r.push(a),r.push(d+32)}else o!==0&&r.push(a),r.push(d+32);o=1}else d>=97&&d<=122?(r.push(d),o=2):i.includes(d)?(o!==0&&r.push(a),o=0):r.push(d)}return String.fromCharCode(...r)}function Xj(e){return Kj(e,[45,95],45)}var Zj=Xj,p1;(e=>{e.millisecond=1,e.second=1e3,e.minute=e.second*60,e.hour=e.minute*60,e.day=e.hour*24,e.week=e.day*7;let i=new Date().getTimezoneOffset();function a(v){i=v}e.setTimezoneOffset=a;function r(){return i}e.getTimezoneOffset=r;function o(v=new Date,w){return typeof v=="number"&&(v=new Date(v)),w===void 0&&(w=i),Math.floor((v.valueOf()/e.minute-w)/1440)}e.getDateNumber=o;function u(v,w){const T=new Date(v*e.day);return w===void 0&&(w=i),new Date(+T+w*e.minute)}e.fromDateNumber=u;const d=/\d+(?:\.\d+)?/.source,p=new RegExp(`^${["w(?:eek(?:s)?)?","d(?:ay(?:s)?)?","h(?:our(?:s)?)?","m(?:in(?:ute)?(?:s)?)?","s(?:ec(?:ond)?(?:s)?)?"].map(v=>`(${d}${v})?`).join("")}$`);function h(v){const w=p.exec(v);return w?(parseFloat(w[1])*e.week||0)+(parseFloat(w[2])*e.day||0)+(parseFloat(w[3])*e.hour||0)+(parseFloat(w[4])*e.minute||0)+(parseFloat(w[5])*e.second||0):0}e.parseTime=h;function g(v){const w=h(v);return w?v=Date.now()+w:/^\d{1,2}(:\d{1,2}){1,2}$/.test(v)?v=`${new Date().toLocaleDateString()}-${v}`:/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(v)&&(v=`${new Date().getFullYear()}-${v}`),v?new Date(v):new Date}e.parseDate=g;function x(v){const w=Math.abs(v);return w>=e.day-e.hour/2?Math.round(v/e.day)+"d":w>=e.hour-e.minute/2?Math.round(v/e.hour)+"h":w>=e.minute-e.second/2?Math.round(v/e.minute)+"m":w>=e.second?Math.round(v/e.second)+"s":v+"ms"}e.format=x;function b(v,w=2){return v.toString().padStart(w,"0")}e.toDigits=b;function y(v,w=new Date){return v.replace("yyyy",w.getFullYear().toString()).replace("yy",w.getFullYear().toString().slice(2)).replace("MM",b(w.getMonth()+1)).replace("dd",b(w.getDate())).replace("hh",b(w.getHours())).replace("mm",b(w.getMinutes())).replace("ss",b(w.getSeconds())).replace("SSS",b(w.getMilliseconds(),3))}e.template=y})(p1||(p1={}));var Qj=Object.defineProperty,De=(e,i)=>Qj(e,"name",{value:i,configurable:!0}),ug=class{static{De(this,"DisposableList")}sn=0;map=new Map;weak=new WeakMap;get length(){return this.map.size}push(e){const i=++this.sn;return this.map.set(i,e),this.weak.set(e,i),()=>this.map.delete(i)}delete(e){const i=this.weak.get(e);return i?this.map.delete(i):!1}clear(){const e=[...this.map.values()];return this.map.clear(),e.reverse()}[Symbol.iterator](){return this.map.values()}[Symbol.for("nodejs.util.inspect.custom")](){return[...this]}},Ee={shadow:Symbol.for("cordis.shadow"),caller:Symbol.for("cordis.caller"),receiver:Symbol.for("cordis.receiver"),original:Symbol.for("cordis.original"),decorator:Symbol.for("cordis.decorator"),initHooks:Symbol.for("cordis.initHooks"),checkProto:Symbol.for("cordis.checkProto"),root:Symbol.for("cordis.root"),effect:Symbol.for("cordis.effect"),filter:Symbol.for("cordis.filter"),isolate:Symbol.for("cordis.isolate"),intercept:Symbol.for("cordis.intercept"),init:Symbol.for("cordis.init"),check:Symbol.for("cordis.check"),invoke:Symbol.for("cordis.invoke"),metadata:Symbol.for("cordis.metadata"),extend:Symbol.for("cordis.extend"),tracker:Symbol.for("cordis.tracker"),mergeIntercept:Symbol.for("cordis.mergeIntercept"),resolveIntercept:Symbol.for("cordis.resolveIntercept")},Jj=function*(){}.constructor,m1=async function*(){}.constructor;function Dw(e){return!(!e.prototype||e instanceof Jj||m1!==Function&&e instanceof m1)}De(Dw,"isConstructor");function kd(e,i){if(e===Object.prototype)return i;const a=Object.create(kd(Object.getPrototypeOf(e),i));for(const r of Reflect.ownKeys(e))Object.defineProperty(a,r,Object.getOwnPropertyDescriptor(e,r));return a}De(kd,"joinPrototype");function Io(e){return e&&(typeof e=="object"||typeof e=="function")}De(Io,"isObject");function dg(e,i){let a=e;for(;a;){const r=Reflect.getOwnPropertyDescriptor(a,i);if(r)return r;a=Object.getPrototypeOf(a)}}De(dg,"getPropertyDescriptor");function br(e,i){if(!Io(i))return i;if(Object.hasOwn(i,Ee.shadow))return Object.getPrototypeOf(i);const a=i[Ee.tracker];return a?Nd(e,i,a):i}De(br,"getTraceable");function Uo(e,i){return i?new Proxy(e,{get:De((a,r,o)=>r in i&&r!=="constructor"?Reflect.get(i,r,o):Reflect.get(a,r,o),"get"),set:De((a,r,o,u)=>r in i&&r!=="constructor"?Reflect.set(i,r,o,u):Reflect.set(a,r,o,u),"set")}):e}De(Uo,"withProps");function Ju(e,i,a){return Uo(e,Object.defineProperty(Object.create(null),i,{value:a,writable:!1}))}De(Ju,"withProp");function _o(e,i,a,r){if(!a)return r;const o=dg(i,a)?.value;if(!o)return r;const u=o[Ee.shadow]??o;return Ju(r,a,e.extend({[Ee.shadow]:u}))}De(_o,"createShadow");function zw(e,i,a,r){return new Proxy(i,{apply:De((o,u,d)=>(u===a&&(u=r),br(e,Reflect.apply(o,u,d))),"apply")})}De(zw,"createShadowMethod");function Nd(e,i,a){const r=e[Ee.shadow]??e,o=e[Ee.shadow]?Object.getPrototypeOf(e):e,u=new Proxy(i,{get:De((d,p,h)=>{if(p===Ee.original)return d;if(p===Ee.caller)return r;if(p===a.property)return o;if(typeof p=="symbol")return Reflect.get(d,p,h);if(a.associate&&o.reflect.props[`${a.associate}.${p}`])return Reflect.get(e,`${a.associate}.${p}`,Ju(e,Ee.receiver,h));let g,x;const b=dg(d,p);b&&"value"in b?x=b.value:(g=_o(o,d,a.property,h),x=Reflect.get(d,p,g));const y=x?.[Ee.tracker];return y?Nd(o,x,y):!a.noShadow&&typeof x=="function"?(g??=_o(o,d,a.property,h),zw(o,x,h,g)):x},"get"),set:De((d,p,h,g)=>{if(p===Ee.original||p===Ee.caller||p===a.property)return!1;if(typeof p=="symbol")return Reflect.set(d,p,h,g);if(a.associate&&o.reflect.props[`${a.associate}.${p}`])return Reflect.set(e,`${a.associate}.${p}`,h,Ju(e,Ee.receiver,g));const x=_o(o,d,a.property,g);return Reflect.set(d,p,h,x)},"set"),apply:De((d,p,h)=>{const g=a.noShadow?u:_o(o,d,a.property,u);return Lw(g,d,p,h)},"apply")});return u}De(Nd,"createTraceable");function Lw(e,i,a,r){return i[Ee.invoke]?i[Ee.invoke].apply(e,r):Reflect.apply(i,a,r)}De(Lw,"applyTraceable");function Wu(e,i,a){const r=De(function(...o){const u=Nd(r.ctx,r,a);return Reflect.apply(u,this,o)},"self");return Da(r,"name",e),Object.setPrototypeOf(r,i)}De(Wu,"createCallable");function mh(e,i,a){const r=e.error.stack.split(`
|
|
32
|
+
`);if(typeof i?.stack!="string"){const d=new Error(i),p=d.stack.split(`
|
|
33
|
+
`);throw p.splice(1,1/0,...a()),d.stack=p.join(`
|
|
34
|
+
`),d}const o=i.stack.split(`
|
|
35
|
+
`);let u=o.indexOf(r[2]);if(u===-1)throw i;for(u-=e.offset;u>0&&o[u-1].endsWith(" (<anonymous>)");)u-=1;throw o.splice(u,1/0,...a()),i.stack=o.join(`
|
|
36
|
+
`),i}De(mh,"handleError");function hh(e,i=Ed()){const a={offset:1,error:new Error};try{const r=e(a);return Io(r)&&"then"in r?r.then(void 0,o=>mh(a,o,i)):r}catch(r){mh(a,r,i)}}De(hh,"composeError");function Ed(e=0){const i=new Error;return()=>i.stack.split(`
|
|
37
|
+
`).slice(3+e)}De(Ed,"buildOuterStack");var Iw=Symbol.for("ValidationError"),Uw=class gh extends TypeError{constructor(i){super(`invalid config:
|
|
38
|
+
`+i.map(a=>a.path?.length?` - ${a.message} (at ${gh.formatPath(a.path)})`:` - ${a.message}`).join(`
|
|
39
|
+
`)),this.issues=i}issues;static{De(this,"ValidationError")}name="ValidationError";static is(i){return!!i?.[Iw]}static normalizePath(i=[]){return i.map(a=>typeof a=="object"?a.key:a)}static formatPath(i){return gh.normalizePath(i).map(String).join(".")}};Object.defineProperty(Uw.prototype,Iw,{value:!0});function Bw(e,i){if(!e.Config)return i;const a=e.Config["~standard"].validate(i);if("then"in a)throw new TypeError("Async config validation is not supported");if(a.issues)throw new Uw(a.issues);return a.value}De(Bw,"resolveConfig");var xh=class $w extends Error{constructor(i,a){super(a??$w.Code[i]),this.code=i}code;static{De(this,"CordisError")}};(e=>{e.Code={INACTIVE_EFFECT:"cannot create effect on inactive context"}})(xh||(xh={}));var ja="__INACTIVE__",Pw=class{constructor(e,i,a,r,o){this.parent=e,this.config=i,this.inject=a,this.runtime=r;const u=De(d=>{this._disposables.push(d)},"collect");if(r){this.uid=e.registry.counter,this.ctx=this.context=e.extend({fiber:this}),this._runner={epoch:ja,getOuterStack:o,execute:De(function(){const d=this._resolve(this.config);if(Dw(r.callback)){const p=new r.callback(this.ctx,d);for(const h of p?.[Ee.initHooks]??[])h();return p?.[Ee.init]?.()}else return r.callback(this.ctx,d)},"execute"),collect:u},this.context.emit("internal/plugin",this);for(const d of Object.keys(this.inject))this._checkImpl(d);this.dispose=e.fiber.effect(()=>{const d=r.fibers.push(this);try{this._refresh()}catch(p){this.ctx.logger.error(p),this._error=p}return async()=>{for(this.uid=null,this.context.emit("internal/plugin",this),this.ctx.registry.has(r.callback)&&(d(),r.fibers.length||this.ctx.registry.delete(r.callback)),this._setEpoch(ja);this.inertia;)await this.inertia;this._updateState(()=>{})}},"ctx.plugin()")}else this.uid=0,this.ctx=this.context=e,this.state=2,this.committed=Object.create(null),this._runner={epoch:"0",getOuterStack:o,execute:De(()=>{},"execute"),collect:u},this.dispose=()=>this.restart()}parent;config;inject;runtime;static{De(this,"Fiber")}uid;ctx;state=0;dispose;committed;provisions=new Set;inertia;_hooks=Object.create(null);_disposables=new ug;context;_error;_revision=0;_runner;_store=Object.create(null);_release;get name(){let e=this;do{if(e.runtime?.name)return e.runtime.name;e=e.parent.fiber}while(e!==e.parent.fiber);return"root"}assertActive(){if(this.uid===null)throw new xh("INACTIVE_EFFECT")}_resolve(e){return this.context.waterfall("internal/config",this,()=>e)}_execute(e){const i=e.epoch;return hh(a=>{const r=De(u=>{if(typeof u=="function")e.collect(u);else if(!Qu(u))throw new TypeError("Invalid effect")},"safeCollect"),o=e.execute.call(this);if(typeof o=="function")return e.collect(o);if(!Qu(o))if(Io(o)){if("then"in o)return o.then(r);if(Symbol.iterator in o){a.error=new Error;const u=o[Symbol.iterator]();for(;;){const d=u.next();if(r(d.value),d.done)return}}else if(Symbol.asyncIterator in o){const u=o[Symbol.asyncIterator]();return(async()=>{for(await Promise.resolve(),a.error=new Error;;){if(e.epoch!==i)return;const d=await u.next();if(r(d.value),d.done)return}})()}else throw new TypeError("Invalid effect")}else throw new TypeError("Invalid effect")},e.getOuterStack)}effect(e,i="anonymous"){this.assertActive();const a=[],r=De(()=>{let g;for(const x of a.splice(0).reverse())if(g)g=g.then(x);else{const b=x();Io(b)&&"then"in b&&(g=b)}return g},"dispose"),o={label:i,children:[]},u={execute:e,epoch:!0,collect:De(g=>{a.push(g),this._disposables.delete(g),g[Ee.effect]&&o.children.push(g[Ee.effect])},"collect"),getOuterStack:Ed()};let d;try{d=this._execute(u)}catch(g){throw r(),g}d?.catch(r).catch(g=>this.ctx.logger.error(g));const p=Da(()=>{if(u.epoch)return u.epoch=!1,d?d.then(r):r()},Ee.effect,o),h=De(()=>{if(u.epoch)return u.epoch=!1,r()},"disposeAsync");return p.then=async(g,x)=>Promise.resolve(d).then(()=>h).then(g,x),a.push(this._disposables.push(p)),p}getEffects(){return[...this._disposables].map(e=>e[Ee.effect]).filter(Boolean)}_getState(){return this.uid===null?4:this._error?3:this._runner.epoch!==ja?2:0}_updateState(e){const i=this.state;if(this.state=e()??this._getState(),i!==this.state&&(this.context.emit("internal/status",this,i),!(i!==2&&this.state!==2)))for(const a of Reflect.ownKeys(this.ctx.reflect.store)){const r=this.ctx.reflect.store[a];r.ctx.fiber===this&&this.ctx.isolate(r.name,r.isolate).reflect.notify([r.name])}}_checkImpl(e){const i=this.ctx.reflect._getImpl(e,!0);if(!i)return delete this._store[e];try{if(i.check&&!i.check.call(br(this.ctx,i.value)))return delete this._store[e]}catch(a){return i.ctx.logger.error(a),delete this._store[e]}this._store[e]=i}_refresh(){let e=`${this._revision}`;for(const i of Object.keys(this.inject)){const a=this._store[i];if(!a){e=ja;break}e+=":"+a.uid}this._setEpoch(e)}_setEpoch(e){const i=this._runner.epoch;e!==i&&(this._error||(this._runner.epoch=e,!this.inertia&&this._updateState(()=>e!==ja&&i===ja?(this.inertia=this._reload(),1):(this.inertia=this._unload(),5))))}async _reload(){this.committed={...this._store};for(const i of Object.values(this.committed))i.ctx.fiber!==this&&i.dependents.add(this);const e=this._runner.epoch;try{await Promise.resolve(),this._runner.epoch===e&&await this._execute(this._runner)}catch(i){this.ctx.logger.error(i),this._runner.epoch===e&&(this._error=i,this._runner.epoch=ja)}this._updateState(()=>{if(this._runner.epoch===e)this.inertia=void 0;else return this.inertia=this._unload(),5})}async _unload(){for(;[...this.provisions].some(e=>e.dependents.size);)await new Promise(e=>this._release=e);this._release=void 0,await Promise.all(this._disposables.clear().map(async e=>{try{await hh(async i=>{await Promise.resolve(),i.error=new Error,await e()},this._runner.getOuterStack)}catch(i){this.ctx.logger.error(i)}}));for(const e of Object.values(this.committed??{}))!e.dependents.delete(this)||e.dependents.size||(e.release?.(),e.ctx.fiber._release?.());this.committed=void 0,this._updateState(()=>{if(this._runner.epoch===ja)this.inertia=void 0;else return this.inertia=this._reload(),1})}async await(){for(;this.inertia;)await this.inertia;if(this._error)throw this._error;return this}async restart(){const e=this.ctx.fiber;e.assertActive(),e._revision++,e._refresh(),await e.await()}update(e,i=!1){const a=this.ctx.fiber;a.assertActive();const r=a._runner.epoch!==ja,o=r?a._resolve(e):void 0;i||a.context.emit("internal/commit",a,e),a.config=e,a._error=void 0;const u=De(()=>a.restart(),"restart"),d=r?a.context.waterfall(a,"internal/update",o,u):u();if(d===void 0)return;const p=Promise.resolve(d);return p.catch(()=>{}),p}};function bh(e){return e!==null&&e!==!1&&e!==void 0}De(bh,"isBailed");var Wj=class{constructor(e){this.ctx=e,Da(this,Ee.tracker,{property:"ctx",noShadow:!0}),this.on("internal/listener",function(i,a,r){if(i==="internal/update"&&!r.global){const o=this.fiber._hooks["internal/update"]??=new ug,u=r.prepend?"unshift":"push";return this.fiber.effect(()=>o[u](a),'ctx.on("internal/update")')}}),this.on("internal/update",function(i,a){const r=[...this._hooks["internal/update"]||[]],o=De(()=>(r.shift()??a).call(this,i,o),"_next");return o()},{global:!0,prepend:!0}),this.on("internal/config",(i,a)=>Bw(i.runtime,a()))}ctx;static{De(this,"EventsService")}_hooks=Object.create(null);_resolve(e,i){const a=typeof i[0]=="object"||typeof i[0]=="function"?i.shift():null,r=i.shift();(typeof r!="string"||!r.startsWith("internal/"))&&this._hooks["internal/dispatch"]?.length&&this.emit("internal/dispatch",e,r,i,a);const o=a?.[pg.filter],u=(this._hooks[r]||[]).filter(d=>d.global||!o||o.call(a,d.ctx)).map(d=>d.callback);return[a,u,r]}dispatch(e,i){const[a,r]=this._resolve(e,i);return r.map(o=>o.bind(a))}async parallel(...e){const[i,a,r]=this._resolve("parallel",e),u=(await Promise.allSettled(a.map(async p=>Reflect.apply(p,i,e)))).filter(p=>p.status==="rejected");if(!u.length)return;const d=typeof r=="symbol"?String(r):`"${r}"`;throw new AggregateError(u.map(p=>p.reason),`one or more listeners of event ${d} failed`)}emit(...e){const[i,a]=this._resolve("emit",e);for(const r of a)Reflect.apply(r,i,e)}async serial(...e){const[i,a]=this._resolve("serial",e);for(const r of a){const o=await Reflect.apply(r,i,e);if(bh(o))return o}}bail(...e){const[i,a]=this._resolve("bail",e);for(const r of a){const o=Reflect.apply(r,i,e);if(bh(o))return o}}waterfall(...e){const[i,a]=this._resolve("waterfall",e),r=e.pop(),o=De(()=>{const u=a.shift();if(!u)return r();let d=!1;const p=De(()=>{if(d)throw new Error("next() called multiple times");return d=!0,o()},"next");return Reflect.apply(u,i,[...e,p])},"dispatch");return o()}register(e,i,a,r){const o=r.prepend?"unshift":"push";return this.ctx.fiber.effect(()=>((this._hooks[i]??=[])[o]({ctx:this.ctx,callback:a,...r}),()=>this.unregister(i,a)),e)}unregister(e,i){const a=this._hooks[e];if(!a)return;const r=a.findIndex(o=>o.callback===i);if(r>=0)return a.splice(r,1),a.length||delete this._hooks[e],!0}on(e,i,a){typeof a!="object"&&(a={prepend:a}),this.ctx.fiber.assertActive(),i=this.ctx.reflect.bind(i);const r=this.bail(this.ctx,"internal/listener",e,i,a);if(r)return r;const o=`ctx.on(${typeof e=="string"?JSON.stringify(e):e.toString()})`;return this.register(o,e,i,a)}once(e,i,a){const r=this.on(e,function(...o){return r(),i.apply(this,o)},a);return r}};function Bu(e){const i=e.stack.split(`
|
|
40
|
+
`);return i.splice(0,2,`Error: ${e.message}`),e.stack=i.join(`
|
|
41
|
+
`),e}De(Bu,"enhanceError");var eA=["prototype","then"];function $u(e){return typeof e=="symbol"||eA.includes(e)||parseInt(e).toString()===e||e.startsWith("_")}De($u,"isSpecialProperty");function fg(e,i){const a=e[Ee.isolate][i];let r=e[Ee.isolate],o=e.fiber;for(;;){let u;for(const d of o.provisions)d.name===i&&d.ctx[Ee.isolate][i]===a&&(u=d);if(u)return{impl:u};for(;r!==o.ctx[Ee.isolate];){if(!r||Object.hasOwn(r,i))return;r=Object.getPrototypeOf(r)}if(u=o.committed?.[i],u||i in o.inject)return{fiber:o,impl:u};if(!o.runtime)return;o=o.parent.fiber}}De(fg,"locate");var h1=class{constructor(e){this.ctx=e,Da(this,Ee.tracker,{property:"ctx",noShadow:!0}),this.mixin("reflect",["get","set","provide","accessor","mixin"]),this.mixin("fiber",["runtime","effect"]),this.mixin("registry",["inject","plugin"]),this.mixin("events",["on","once","parallel","emit","serial","bail","waterfall"])}ctx;static{De(this,"ReflectService")}static handler={get:De((e,i,a)=>{if($u(i))return Reflect.get(e,i,a);if(Reflect.has(e,i))return br(a,Reflect.get(e,i,a));const r=new Error(`cannot get property "${i}" without inject`);try{const o=e.reflect.props[i];if(o?.type==="accessor")return o.get.call(a,a[Ee.receiver],r);const u=a[Ee.shadow]??a;return u.fiber.runtime?a.events.waterfall("internal/get",a,i,r,()=>{const d=fg(u,i);if(!d)throw r;if(d.impl)return br(a,d.impl.value);throw r.message=`cannot get required service "${i}" in inactive context`,r}):a.reflect.get(i,!1)}catch(o){throw o===r?Bu(o):o}},"get"),set:De((e,i,a,r)=>{if($u(i))return Reflect.set(e,i,a,r);const o=new Error(`cannot set property "${i}" without provide`),u=e.reflect.props[i];if(!u){if(!r.fiber.runtime)return Reflect.set(e,i,a,r);throw Bu(o)}try{return u.type==="accessor"?u.set?u.set.call(r,a,r[Ee.receiver],o):!1:r.events.waterfall("internal/set",r,i,a,o,()=>r.reflect.set(i,a,o))}catch(d){throw d===o?Bu(d):d}},"set"),has:De((e,i)=>$u(i)?Reflect.has(e,i):Reflect.has(e,i)?!0:!!e.reflect.props[i],"has")};store=Object.create(null);props=Object.create(null);_implCounter=0;get(e,i=!0){return br(this.ctx,this._getImpl(e,i)?.value)}_getImpl(e,i=!0){const a=this.ctx[Ee.isolate][e],r=a&&this.store[a];if(r&&!(i&&r.ctx.fiber.state!==2))return r}set(e,i,a){const r=this.ctx[Ee.isolate][e],o=this.store[r];if(!o)throw new Error(`cannot set property "${e}" without provide`);if(o.ctx.fiber!==this.ctx.fiber)throw new Error(`cannot set property "${e}" in multiple fibers`);return o.value=i,!0}provide(e,i,a){return this.ctx.fiber.effect(()=>{if(!this.props[e])this.props[e]??={type:"service"};else if(this.props[e].type!=="service")throw new Error(`property "${e}" is already declared as ${this.props[e].type}`);this.props[e]={type:"service"},this.ctx[Ee.root][Ee.isolate][e]??=Symbol(e);const r=this.ctx[Ee.isolate][e],o={uid:++this._implCounter,name:e,value:i,ctx:this.ctx,check:a,isolate:r,dependents:new Set};if(this.store[r])throw new Error(`service "${e}" has been registered at <${this.store[r].ctx.fiber.name}>`);return this.store[r]=o,this.ctx.fiber.provisions.add(o),this.ctx.fiber.state===2&&this.notify([e]),async()=>{this.store[o.isolate]===o&&delete this.store[o.isolate],this.ctx.isolate(e,o.isolate).reflect.notify([e]),await new Promise(u=>{o.release=u,o.dependents.size||u()}),o.release=void 0,this.ctx.fiber.provisions.delete(o)}},`ctx.provide(${JSON.stringify(e)})`)}notify(e,i=(a,r)=>a[Ee.isolate][r]===this.ctx[Ee.isolate][r]){for(const a of this.ctx.registry.values())for(const r of a.fibers){let o=!1;for(const u of e)u in r.inject&&i(r.ctx,u)&&(o=!0,r._checkImpl(u));o&&r._refresh()}for(const a of e){const r=Object.create(this.ctx);r[Ee.filter]=o=>i(o,a),this.ctx.events.emit(r,"internal/service",a,this._getImpl(a,!1)?.value)}}accessor(e,i){return this.ctx.fiber.effect(()=>{if(e in this.props)throw new Error(`property "${e}" is already declared as ${this.props[e].type}`);return this.props[e]={type:"accessor",...i},()=>delete this.props[e]},`ctx.accessor(${JSON.stringify(e)})`)}mixin(e,i){const a=this;return this.ctx.fiber.effect(function*(){const r=Array.isArray(i)?i.map(u=>[u,u]):Object.entries(i),o=De((u,d)=>u[e],"getTarget");for(const[u,d]of r)yield a.accessor(d,{get(p,h){const g=o(this,h);if(Qu(g))return g;const x=p?Uo(p,g):g,b=Reflect.get(g,u,x);return typeof b!="function"?b:b.bind(x??g)},set(p,h,g){const x=o(this,g),b=h?Uo(h,x):x;return Reflect.set(x,u,p,b)}})},`ctx.mixin(${JSON.stringify(e)})`)}trace(e){return br(this.ctx,e)}bind(e){return new Proxy(e,{apply:De((i,a,r)=>Reflect.apply(i,this.trace(a),r.map(o=>this.trace(o))),"apply"),construct:De((i,a,r)=>Reflect.construct(i,a.map(o=>this.trace(o)),r),"construct")})}},Ei=class yh{constructor(i,a){this.ctx=i,a??=this.constructor.provide;let r=this;const o={associate:a,property:"ctx"};return r[Ee.invoke]&&(r=Wu(a,kd(Object.getPrototypeOf(this),Function.prototype),o)),r.ctx=i,r.name=a,Da(r,Ee.tracker,o),r.ctx.reflect.provide(a,r,this[Ee.check]),r}ctx;static{De(this,"Service")}static init=Ee.init;static check=Ee.check;static invoke=Ee.invoke;static metadata=Ee.metadata;static extend=Ee.extend;static tracker=Ee.tracker;static mergeIntercept=Ee.mergeIntercept;static resolveIntercept=Ee.resolveIntercept;name;[Ee.filter](i){return i[Ee.isolate][this.name]===this.ctx[Ee.isolate][this.name]}[Ee.extend](i){let a;return this[yh.invoke]?a=Wu(this.name,this,this[Ee.tracker]):a=Object.create(this),Object.assign(a,i)}[Ee.mergeIntercept](...i){return Object.assign({},...i)}[Ee.resolveIntercept](){const i=[];let a=this.ctx[pg.intercept];for(;this.name in a;)Object.hasOwn(a,this.name)&&i.unshift(a[this.name]),a=Object.getPrototypeOf(a);const r=fg(this[Ee.caller]??this.ctx,this.name)?.fiber?.inject[this.name];return Qu(r)||i.unshift(r),(this[Ee.mergeIntercept]??yh.prototype[Ee.mergeIntercept]).apply(this,i)}static[Symbol.hasInstance](i){if(!i)return!1;let a=i.constructor;for(;a;){if(a=a.prototype?.constructor,a===this)return!0;a&&=Object.getPrototypeOf(a)}return!1}},g1={s:De(e=>String(e),"s"),d:De(e=>Math.trunc(Number(e)),"d"),i:De(e=>Math.trunc(Number(e)),"i"),f:De(e=>Number(e),"f"),o:De(e=>JSON.stringify(e),"o"),O:De(e=>JSON.stringify(e),"O"),c:De(()=>"","c"),C:De((e,i,a)=>vh.color(i,vh.code(a.name,i.colors),e),"C")};function Hw(e){return e instanceof Error&&Array.isArray(e.errors)}De(Hw,"isAggregateError");var vh=class{constructor(e,i){this.service=i,Object.assign(this,e),this.error=this._method("error",0),this.info=this._method("info",2),this.warn=this._method("warn",1),this.debug=this._method("debug",3)}service;static{De(this,"Logger")}static color(e,i,a,r=""){return e.colors?`\x1B[3${i<8?i:"8;5;"+i}${e.colors>=2?r:""}m${a}\x1B[0m`:""+a}static code(e,i){let a=0;for(let o=0;o<e.length;o++)a=(a<<3)-a+e.charCodeAt(o)+13,a|=0;const r=i?i>=2?nA:tA:[];return r[Math.abs(a)%r.length]}static format(e,i){const a=i.args.slice();a[0]instanceof Error?(a[0]=a[0].stack||a[0].message,a.unshift("%s")):typeof a[0]!="string"&&a.unshift("%o");let r=a.shift();r=r.replace(/%([a-zA-Z%])/g,(d,p)=>{if(d==="%%")return"%";const h=e.formatters?.[p]??g1[p];if(typeof h=="function"){const g=a.shift();return h(g,e,i)}return d});const o=e.formatters?.o??g1.o;for(let d of a)typeof d=="object"&&d&&(d=o(d,e,i)),r+=" "+d;const{maxLength:u=10240}=e;return r.split(/\r?\n/g).map(d=>d.slice(0,u)+(d.length>u?"...":"")).join(`
|
|
42
|
+
`)}_method(e,i){return(...a)=>{if(a.length===1&&a[0]instanceof Error){if(a[0].cause)this[e](a[0].cause);else if(Hw(a[0])&&a[0].errors.length){a[0].errors.forEach(u=>this[e](u));return}}const r=++this.service._snMessage,o=Date.now();for(const u of this.service.exporters.values()){if((u.levels?.[this.name]??u.levels?.default??this.level??2)<i)continue;const p={sn:r,ts:o,type:e,level:i,name:this.name,...this.meta,args:a};u.export(p)}}}},tA=[6,2,3,4,5,1],nA=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221],iA=class Fw{static{De(this,"LoggerService")}bufferSize=1e3;buffer=[];ctx;_snMessage=0;_snExporter=0;exporters=new Map;constructor(i){const a={property:"ctx",noShadow:!0},r=Wu("logger",kd(Object.getPrototypeOf(this),Function.prototype),a);return Object.assign(r,this),r.ctx=i,Da(r,Ee.tracker,a),r.exporter({colors:3,export:De(o=>{r.buffer.push(o);const u=r.buffer.length-r.bufferSize;u===1?r.buffer.shift():u>1&&r.buffer.splice(0,u)},"export")}),r}exporter(i){return this.ctx.effect(()=>{const a=++this._snExporter;return this.exporters.set(a,i),()=>this.exporters.delete(a)},"ctx.logger.exporter()")}[Ee.invoke](i){const a=this[Ee.caller],r=Ei.prototype[Ei.resolveIntercept].call(this),o=(a??this.ctx).fiber;return i??=r.name,i??=Zj(o.name),new vh({name:i,level:r.level,meta:{fiber:new WeakRef(o)}},this)}static{for(const i of["error","info","warn","debug"])Fw.prototype[i]=function(...a){return this()[i](...a)}}};function qw(e){return e&&typeof e=="object"&&typeof e.apply=="function"}De(qw,"isApplicable");function ed(e,i){return function(a,r){if(r.kind==="class")Object.hasOwn(a,"inject")||(Da(a,"inject",Object.create(Object.getPrototypeOf(a).inject??null)),Da(a.inject,Ee.checkProto,!0)),a.inject[e]=i;else if(r.kind==="method"){const o=(a[Ee.decorator]??={}).inject??=Object.create(null);o[e]=i,r.addInitializer(function(){const u=this[Ee.tracker]?.property;(this[Ee.initHooks]??=[]).push(()=>{this.ctx.inject(o,d=>a.call(u?Uo(this,{[u]:d}):this))})})}else throw new Error("@Inject() can only be used on class or class methods")}}De(ed,"Inject");(e=>{function i(a,r=Object.create(null)){if(!a)return r;if(Array.isArray(a))for(const o of a)r[o]=null;else if(Reflect.has(a,Ee.checkProto)){Object.assign(r,i(Object.getPrototypeOf(a)));for(const o of Object.keys(a))r[o]=a[o]??null}else for(const o of Object.keys(a))r[o]=a[o]??null;return r}e.resolve=i,De(i,"resolve")})(ed||(ed={}));var aA=class{constructor(e){this.ctx=e,Da(this,Ee.tracker,{property:"ctx",noShadow:!0})}ctx;static{De(this,"RegistryService")}_counter=0;_internal=new Map;get counter(){return++this._counter}get size(){return this._internal.size}resolve(e){try{if(typeof e=="function")return e;if(qw(e))return e.apply}catch{}}get(e){const i=this.resolve(e);return i&&this._internal.get(i)}has(e){const i=this.resolve(e);return!!i&&this._internal.has(i)}delete(e){const i=this.resolve(e),a=i&&this._internal.get(i);if(a){this._internal.delete(i);for(const r of a.fibers)r.dispose();return a}}keys(){return this._internal.keys()}values(){return this._internal.values()}entries(){return this._internal.entries()}forEach(e){return this._internal.forEach(e)}inject(e,i){return this.plugin({inject:e,apply:i,name:i.name})}plugin(e,i,a=Ed()){const r=this.resolve(e);if(!r)throw new Error('invalid plugin, expect function or object with an "apply" method, received '+typeof e);this.ctx.fiber.assertActive();let o=this._internal.get(r);if(!o){let p=e.name;p==="apply"&&(p=void 0),o={name:p,callback:r,fibers:new ug,Config:e.Config},this._internal.set(r,o)}const u=new Pw(this.ctx,i,ed.resolve(e.inject),o,a),d=Object.create(u);return d.then=(p,h)=>u.await().then(p,h),d}},pg=class So{static{De(this,"Context")}static root=Ee.root;static effect=Ee.effect;static filter=Ee.filter;static isolate=Ee.isolate;static intercept=Ee.intercept;static is(i){return!!i?.[So.is]}static{So.is[Symbol.toPrimitive]=()=>Symbol.for("cordis.is"),So.prototype[So.is]=!0}constructor(){this[Ee.isolate]=Object.create(null),this[Ee.intercept]=Object.create(null);const i=new Proxy(this,h1.handler);return this[Ee.root]=i,this.baseUrl=void 0,this.fiber=new Pw(i,{},Object.create(null),null,()=>[]),this.reflect=new h1(i),this.registry=new aA(i),this.events=new Wj(i),this.logger=new iA(i),this.fiber._disposables.clear(),i}[Symbol.for("nodejs.util.inspect.custom")](){return`Context <${this.fiber.name}>`}extend(i={}){const a=Reflect.getOwnPropertyDescriptor(this,Ee.shadow)?.value,r=Object.create(br(this,this));for(const o of Reflect.ownKeys(i))Object.defineProperty(r,o,Reflect.getOwnPropertyDescriptor(i,o));return a?Object.assign(Object.create(r),{[Ee.shadow]:a}):r}isolate(i,a){const r=Object.create(this[Ee.isolate]);return r[i]=a??Symbol(i),this.extend({[Ee.isolate]:r})}intercept(i,a){const r=Object.create(this[Ee.intercept]);return r[i]=a,this.extend({[Ee.intercept]:r})}};function rA(e,i){const a=e.findIndex(r=>r.id===i);if(a===-1)return null;for(let r=a+1;r<e.length;r+=1)if(e[r].role==="user")return e.slice(0,r);return e.slice()}function hm(e){for(let i=e.length-1;i>=0;i-=1){const a=e[i];if(a.role==="user")return a.id}return null}function sA(e){const i=new Map;return{isBusy:a=>i.has(a),isIdle:()=>i.size===0,clear(a){const r=i.get(a);r&&i.set(a,{chain:r.chain,token:{}})},clearAll(){for(const[a,r]of i)i.set(a,{chain:r.chain,token:{}})},push(a,r){const o=i.get(a)??{chain:Promise.resolve(),token:{}},u=o.token,p=o.chain.then(()=>i.get(a)?.token===u?e(a,r):void 0,()=>i.get(a)?.token===u?e(a,r):void 0).then(()=>{},()=>{});return i.set(a,{chain:p,token:u}),p.then(()=>{i.get(a)?.chain===p&&i.delete(a)}),p}}}class lA extends Ei{static provide="sessions";constructor(i){super(i,"sessions")}current(i){return Ve.getState().sessions.find(a=>a.id===i)}all(){return Ve.getState().sessions}getMessages(i){return this.current(i)?.messages??[]}addMessage(i,a){Ve.getState().addMessage(i,a),this.flush(i)}updateMessage(i,a,r){Ve.getState().updateMessage(i,a,r),this.flush(i)}updateSession(i,a){Ve.getState().updateSession(i,a),this.flush(i)}turnHistory(i,a){return rA(i,a)}async flush(i){await this.ctx.events.parallel("session/flush",i).catch(()=>{})}}function oA(){const e=Be.getState(),i=e.root||e.info.root;if(!i)return"No folder is open yet. Ask the user to choose a workspace folder in the Workspace panel before using file, shell or git tools.";const a=e.entries.filter(o=>!o.path.includes("/")).slice(0,40).map(o=>`${o.path}${o.type==="dir"?"/":""}`),r=e.git.available?`${e.git.branch||"detached HEAD"} · ${e.git.entries.length} changed file${e.git.entries.length===1?"":"s"}`:"not a git repository";return[`Root: ${i}`,`Git: ${r}`,a.length>0?`Top level: ${a.join(", ")}`:"The folder is empty.",e.truncated?"The file tree was truncated; use list_files or grep for deeper paths.":""].filter(Boolean).join(`
|
|
43
|
+
`)}class cA extends Ei{static provide="systemPrompt";customSections=new Map;constructor(i){super(i,"systemPrompt")}registerSection(i,a){return this.customSections.set(i,a),()=>this.customSections.delete(i)}assemble(i,a=i.mode,r={}){const o=[],u=r.sessionPrompt?.trim()||r.workspacePrompt?.trim()||i.systemPrompt?.trim();u&&o.push({name:"base",priority:10,content:u});const d=i.tools.skill?.enabled===!1?[]:i.skills.filter(h=>h.enabled);d.length>0&&o.push({name:"skills",priority:20,content:["## Available skills","Call the `skill` tool to load the full instructions (and run scripts from the skill folder) when a task matches one of these. Do not guess a skill’s contents.",...d.map(h=>`- ${h.name} (${h.id}): ${h.description}`)].join(`
|
|
44
|
+
`)}),o.push({name:"workspace",priority:30,content:["## Workspace","You operate on the real folder below through the local OpenSol daemon. Tools return real output; never invent file contents, command results, URLs or deployments.",oA()].join(`
|
|
45
|
+
|
|
46
|
+
`)});const p=Be.getState().instructions;p.content.trim()&&o.push({name:"project-instructions",priority:35,content:[`## Project instructions (${p.file})`,"The owner of this project wrote the notes below. Follow them for conventions, commands and style. They never override safety, tool permissions or plan mode.",`<project-instructions file="${p.file}">
|
|
47
|
+
${p.content.trim()}${p.truncated?`
|
|
48
|
+
… (file clipped)`:""}
|
|
49
|
+
</project-instructions>`].join(`
|
|
50
|
+
|
|
51
|
+
`)}),o.push({name:"mode",priority:40,content:a==="plan"?["## Mode: Plan (read-only)","Investigate and design. Do not modify anything.","- Allowed: read_file, list_files, grep, web_search, read_url, read-only shell commands and read-only git actions.","- Forbidden: write_file, edit_file, rewrite_file, git add/commit/init/checkout, and shell commands that change files, install packages or change system state. The daemon rejects these.","- Read the relevant source before proposing changes. Grep for call sites and inspect the real files.","- Finish with a concrete, ordered implementation plan naming files and functions. State assumptions and open questions plainly.","- Never pretend an edit was made or a check was run."].join(`
|
|
52
|
+
`):["## Mode: Build","You may inspect and change the real workspace.","- Inspect before editing: list files, read the source, grep for call sites, check git status.","- Make the smallest coherent change. Do not reformat unrelated code, add speculative abstractions or invent APIs.","- After a mutation, inspect the result. Run the project’s real typecheck, lint, tests and build when they exist, and read the output.","- Never claim a check passed without running it. If a check cannot run, say why.","- Ask before destructive actions, force pushes, credential changes or anything that leaves the workspace."].join(`
|
|
53
|
+
`)}),o.push({name:"vibe-coding",priority:45,content:["## Vibe coding","- For a game, demo, landing page or visual prototype that does not need a project folder, reply with ONE self-contained HTML file in a single ```html code block (inline CSS and JS). OpenSol renders that block as a live, sandboxed preview, so it must run with no build step and no calls to localhost. Load libraries only from https://cdnjs.cloudflare.com or https://cdn.jsdelivr.net with a pinned version.","- With a folder open in Build mode, write real files with the tools instead of pasting large code into the chat, then say how to run them.","- Deliver something that runs first, then improve it in small steps based on what the user sees. Keep explanations to a few sentences; the code is the answer.","- If something needs an API key, a server or an asset you cannot create, say so plainly instead of faking it."].join(`
|
|
54
|
+
`)}),o.push({name:"session-context",priority:50,content:["## Session context",`- Model: ${ui(i)||"unset"}`,`- Date: ${new Date().toISOString().slice(0,10)}`,`- Mode: ${a}`,i.webSearchEnabled?"- Web search is enabled. Use it when facts may be current or when the user asks for sources.":"- Web search is turned off for this session.","- Use relative paths from the workspace root. Do not use /workspace paths."].join(`
|
|
55
|
+
`)});for(const h of this.customSections.values()){const g=h(i,a);g&&g.content&&o.push(g)}return this.ctx.events.waterfall("system-prompt/assemble",o,a,()=>(o.sort((h,g)=>h.priority-g.priority),o.map(h=>h.content).filter(Boolean).join(`
|
|
56
|
+
|
|
57
|
+
`)))}buildSubagentPrompt(i){return[this.assemble(i,"plan"),["## Subagent","You are a focused read-only investigator. Work only on the assigned task.","- Inspect the real workspace with read-only file, grep, shell and web tools.","- Do not edit files, change git state or run commands that mutate the machine. The daemon enforces this.","- Be concise: return findings, exact file paths and line references, and any uncertainty.","- Do not repeat the task back. Do not invent evidence. If something cannot be verified, say so."].join(`
|
|
58
|
+
`)].join(`
|
|
59
|
+
|
|
60
|
+
`)}}let Su;const Tn=kr()((e,i)=>{const a=r=>{e({servers:r,loaded:!0,loading:!1,error:""}),Su!==void 0&&window.clearTimeout(Su),Su=void 0,r.some(o=>o.status==="connecting")&&(Su=window.setTimeout(()=>{i().load()},1200))};return{servers:[],loaded:!1,loading:!1,error:"",load:async()=>{e({loading:!0});try{a((await pj()).servers)}catch(r){e({loading:!1,loaded:!0,error:r instanceof Error?r.message:"Could not load MCP servers."})}},save:async r=>{const o=await mj(r);a(o.servers)},act:async(r,o)=>{o!=="disconnect"&&e(d=>({servers:d.servers.map(p=>p.id===r?{...p,status:"connecting",error:""}:p)}));const u=await hj(r,o);a(u.servers)},authorize:async r=>{const{url:o}=await gj(r),u=window.open(o,"opensol-mcp-oauth","popup=yes,width=520,height=720");if(!u)throw new Error("The browser blocked the sign-in window. Allow pop-ups for OpenSol and try again.");const d=Date.now(),p=window.setInterval(()=>{i().load();const h=i().servers.find(g=>g.id===r);(u.closed||h?.oauth?.authorized||Date.now()-d>5*6e4)&&(window.clearInterval(p),i().load())},1500)},logout:async r=>{a((await xj(r)).servers)},lookup:r=>{for(const o of i().servers){const u=o.tools.find(d=>d.fn===r);if(u)return{server:o,tool:u}}return null}}});function Gw(e){return e.startsWith("mcp__")}try{new BroadcastChannel("opensol-mcp-oauth").onmessage=()=>{Tn.getState().load()}}catch{}const gm=28e3;function uA(e){const i=e.properties&&typeof e.properties=="object"?e.properties:{},a=Array.isArray(e.required)?e.required.filter(r=>typeof r=="string"):void 0;return{type:"object",properties:i,...a?.length?{required:a}:{}}}function Yw(e){if(!Gw(e))return;const i=Tn.getState().lookup(e);if(!i)return;const{server:a,tool:r}=i;if(!(!a.enabled||a.status!=="connected"||a.disabledTools.includes(r.name)))return{name:e,description:`[MCP server “${a.name}”] ${r.description||r.name}`.slice(0,1200),parameters:uA(r.inputSchema),allowedInMode:o=>o==="build"||r.readOnly,async execute(o,u){const{result:d}=await bj(a.id,r.name,o,u.signal),p=d.text.trim()||"(the tool returned no output)";return{output:p.length>gm?`${p.slice(0,gm)}
|
|
61
|
+
… truncated (${p.length-gm} more characters)`:p,isError:d.isError}}}}function dA(){const e=[];for(const i of Tn.getState().servers)for(const a of i.tools){const r=Yw(a.fn);r&&e.push(r)}return e}function td(e,i){if(!Gw(i))return e.tools[i];const a=Tn.getState().lookup(i);if(!a)return;const{server:r,tool:o}=a;return{enabled:r.enabled&&r.status==="connected"&&!r.disabledTools.includes(o.name),approval:r.approval}}const fA=new Set(["read_file","list_files","grep","web_search","read_url","skill"]);function x1(e,i){return i==="build"?!0:fA.has(e)||e==="shell"||e==="git"||e==="subagent"}class pA extends Ei{static provide="tools";definitions=new Map;constructor(i){super(i,"tools")}register(i){return this.definitions.set(i.name,i),()=>{this.definitions.get(i.name)===i&&this.definitions.delete(i.name)}}get(i){return this.definitions.get(i)??Yw(i)}list(){return[...this.definitions.values(),...dA()]}schemas(i,a="build",{subagent:r=!1}={}){const o=[],u=r?[...this.definitions.values()]:this.list();for(const d of u)d.name==="subagent"&&r||!td(i,d.name)?.enabled||!(d.allowedInMode?d.allowedInMode(a):x1(d.name,a))||(d.name==="web_search"||d.name==="read_url")&&!i.webSearchEnabled||o.push({name:d.name,description:d.description,parameters:d.parameters});return o}async execute(i,a,r,o,u,d,p){const h={name:i,args:a,settings:r,mode:o,signal:u,callId:d,turnId:p},g=await this.ctx.events.waterfall("tools/pre-execute",h,async()=>{if(!td(r,i)?.enabled)return{decision:"deny",reason:"This tool is disabled or its MCP server is not connected (Settings → Tools / MCP)."};const y=this.get(i);return(y?.allowedInMode?y.allowedInMode(o):x1(i,o))?(i==="web_search"||i==="read_url")&&!r.webSearchEnabled?{decision:"deny",reason:"Web access is turned off for this session."}:{decision:"allow"}:{decision:"deny",reason:"Plan mode is read-only. Do not edit files or change git state. Finish with an implementation plan instead."}});if(g.decision==="deny"){const y={output:g.reason??"Tool call denied.",isError:!0};return this.ctx.events.emit("tools/result",y,h),y}if(u.aborted)throw new DOMException("Aborted","AbortError");const x=await this.ctx.events.waterfall("tools/execute",h,async()=>{const y=this.get(i);return y?await y.execute(a,h):{output:`Tool "${i}" is not registered.`,isError:!0}}),b=await this.ctx.events.waterfall("tools/post-execute",x,h,async()=>x);return this.ctx.events.emit("tools/result",b,h),b}}const Pu=new Map;class mA extends Ei{static provide="approval";static inject=["tools"];constructor(i){super(i,"approval"),this.ctx.on("tools/pre-execute",async(a,r)=>td(a.settings,a.name)?.approval==="ask"&&a.callId&&!await this.waitForApproval(a.callId,a.signal)?{decision:"deny",reason:a.signal.aborted?"Stopped before the tool ran.":"You denied this tool call."}:r())}waitForApproval(i,a){return hA(i,a)}resolveApproval(i,a){Vw(i,a)}}function hA(e,i){return i.aborted?Promise.resolve(!1):new Promise(a=>{const r=u=>{const d=Pu.get(e);d&&(d.cleanup(),Pu.delete(e),a(u))},o=()=>r(!1);i.addEventListener("abort",o,{once:!0}),Pu.set(e,{toolCallId:e,resolve:r,cleanup:()=>i.removeEventListener("abort",o)})})}function Vw(e,i){Pu.get(e)?.resolve(i)}async function*_d(e){if(!e.body)throw new Error("The provider returned an empty response body.");const i=e.body.getReader(),a=new TextDecoder;let r="";try{for(;;){const{done:o,value:u}=await i.read();if(o)break;r+=a.decode(u,{stream:!0}),r=r.replace(/\r\n/g,`
|
|
62
|
+
`);let d=r.indexOf(`
|
|
63
|
+
|
|
64
|
+
`);for(;d!==-1;){const p=r.slice(0,d);r=r.slice(d+2);for(const h of p.split(`
|
|
65
|
+
`)){if(!h.startsWith("data:"))continue;const g=h.slice(5).trim();g&&(yield g)}d=r.indexOf(`
|
|
66
|
+
|
|
67
|
+
`)}}for(const o of r.split(`
|
|
68
|
+
`))if(o.startsWith("data:")){const u=o.slice(5).trim();u&&(yield u)}}finally{i.releaseLock()}}function gA(e,i){return e instanceof DOMException&&e.name==="AbortError"?"Stopped.":e instanceof Error?/daemon is not reachable|lost the connection/i.test(e.message)?"The local OpenSol daemon is not reachable. Start it with “npm start”, then try again.":/failed to fetch|networkerror|load failed/i.test(e.message)?`The local daemon could not reach ${i}. Check the network and the provider base URL, then try again.`:/401|403/.test(e.message)&&/key|auth|permission|refus|reject/i.test(e.message)?`${e.message} Check the API key in Settings → Models, or choose a model this key can access.`:e.message:"The request failed for an unknown reason."}const xA=28e3,bA=new Set(["read_file","list_files","grep","web_search","read_url"]);function Ws(e,i=xA){return e.length<=i?e:`${e.slice(0,i)}
|
|
69
|
+
… truncated (${e.length-i} more characters)`}function wi(e){return e&&typeof e=="object"?e:{}}function Mt(e){return typeof e=="string"?e:""}function Li(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function ta(e,i){const a=e[i];if(typeof a!="string"||!a.trim())throw new Error(`Missing string argument "${i}".`);return a}function b1(e,i){const a=e[i];return typeof a=="string"?a:void 0}function bo(e,i,a){const r=e[i];return typeof r=="number"&&Number.isFinite(r)?r:typeof r=="string"&&Number.isFinite(Number(r))?Number(r):a}function Kw(e,i){return i==="build"?!0:bA.has(e)||e==="shell"||e==="git"||e==="subagent"}function Sd(e,i="build",{subagent:a=!1}={}){if(Yt.tools)return Yt.tools.schemas(e,i,{subagent:a});const r=[{name:"shell",description:"Run a shell command in the workspace root. The working directory resets between calls. Prefer dedicated file and git tools for edits. In Plan mode only read-only commands are accepted.",parameters:{type:"object",properties:{command:{type:"string",description:"The shell command to run."},timeoutMs:{type:"number",description:"Timeout in milliseconds (max 600000)."}},required:["command"],additionalProperties:!1}},{name:"read_file",description:"Read a text file from the workspace. Use offset and limit for large files.",parameters:{type:"object",properties:{path:{type:"string",description:"Relative path from the workspace root."},offset:{type:"number",description:"1-based first line. Defaults to 1."},limit:{type:"number",description:"Maximum lines. Defaults to 400."}},required:["path"],additionalProperties:!1}},{name:"list_files",description:"List files and folders below a workspace path.",parameters:{type:"object",properties:{path:{type:"string",description:"Folder path. Defaults to the workspace root."},depth:{type:"number",description:"Recursion depth, 1–8. Defaults to 3."}},additionalProperties:!1}},{name:"write_file",description:"Create a file or replace its full contents. Prefer edit_file for small changes.",parameters:{type:"object",properties:{path:{type:"string",description:"Relative file path."},content:{type:"string",description:"Complete file content."}},required:["path","content"],additionalProperties:!1}},{name:"edit_file",description:"Replace an exact text occurrence in a file. oldText must match whitespace exactly and be unique unless replaceAll is true.",parameters:{type:"object",properties:{path:{type:"string",description:"Relative file path."},oldText:{type:"string",description:"Exact text to replace."},newText:{type:"string",description:"Replacement text."},replaceAll:{type:"boolean",description:"Replace every occurrence. Defaults to false."}},required:["path","oldText","newText"],additionalProperties:!1}},{name:"rewrite_file",description:"Replace the complete contents of an existing file. Use when most of the file changes.",parameters:{type:"object",properties:{path:{type:"string",description:"Relative file path."},content:{type:"string",description:"The new complete file content."}},required:["path","content"],additionalProperties:!1}},{name:"grep",description:"Search workspace contents with a regular expression. Returns path, line and matching text.",parameters:{type:"object",properties:{pattern:{type:"string",description:"Regular expression to search for."},path:{type:"string",description:"File or folder. Defaults to the workspace root."},ignoreCase:{type:"boolean",description:"Case-insensitive search. Defaults to false."},maxResults:{type:"number",description:"Maximum matches. Defaults to 80."}},required:["pattern"],additionalProperties:!1}},{name:"web_search",description:"Search the web for current information. Returns titles, URLs and snippets. Cite URLs you use.",parameters:{type:"object",properties:{query:{type:"string",description:"Search query."}},required:["query"],additionalProperties:!1}},{name:"read_url",description:"Read a public web page as plain text.",parameters:{type:"object",properties:{url:{type:"string",description:"The http(s) URL to read."}},required:["url"],additionalProperties:!1}},{name:"git",description:"Inspect or change git state. In Plan mode only status, diff, log, show and branch are accepted.",parameters:{type:"object",properties:{action:{type:"string",enum:["status","diff","log","show","branch","add","commit","init","checkout"]},path:{type:"string",description:"Limit diff to this file."},staged:{type:"boolean",description:"Diff the staged changes."},ref:{type:"string",description:"Commit or ref for show."},limit:{type:"number",description:"Log limit."},paths:{type:"array",items:{type:"string"},description:"Files to stage."},message:{type:"string",description:"Commit message."},branch:{type:"string",description:"Branch to create or check out."},create:{type:"boolean",description:"Create a new branch. Defaults to true."}},required:["action"],additionalProperties:!1}}];return a||r.push({name:"subagent",description:"Delegate a focused investigation to a read-only subagent. Use it to explore a large area, trace a bug or verify assumptions without changing files. The subagent returns a concise report.",parameters:{type:"object",properties:{task:{type:"string",description:"The specific question or investigation to perform."},context:{type:"string",description:"Optional context, constraints or files to start from."}},required:["task"],additionalProperties:!1}}),r.filter(o=>!(!e.tools[o.name]?.enabled||!Kw(o.name,i)||(o.name==="web_search"||o.name==="read_url")&&!e.webSearchEnabled))}async function yA(){await Be.getState().refresh({treeOnly:!0}).catch(()=>{})}async function y1(){await Be.getState().refresh().catch(()=>{})}function vA(e){const i=Array.isArray(e.entries)?e.entries:[];if(i.length===0)return"This folder is empty.";const a=i.map(o=>{const u=wi(o),d=Mt(u.path);return u.type==="dir"?`${d}/`:u.type==="link"?`${d} -> link`:`${d}${Li(u.size)!==void 0?` (${Li(u.size)} B)`:""}`}),r=e.truncated===!0?`
|
|
70
|
+
… listing truncated. Narrow the path or reduce depth.`:"";return`${Mt(e.root)?`Root: ${Mt(e.root)}
|
|
71
|
+
`:""}${a.join(`
|
|
72
|
+
`)}${r}`}function wA(e,i){const a=[`$ ${i}`,Mt(e.stdout)];Mt(e.stderr)&&a.push(`stderr:
|
|
73
|
+
${Mt(e.stderr)}`);const r=Li(e.code);return r!==void 0&&r!==0&&a.push(`exit code: ${r}`),e.timedOut===!0&&a.push("The command timed out."),a.filter(o=>o!=="").join(`
|
|
74
|
+
`)}function kA(e,i){const a=Array.isArray(e.matches)?e.matches:[];if(a.length===0)return`No matches for ${i}.`;const r=a.map(u=>{const d=wi(u);return`${Mt(d.file)}:${Li(d.line)??0}: ${Mt(d.text)}`}),o=e.truncated===!0?`
|
|
75
|
+
… more matches exist. Narrow the pattern or path.`:"";return r.join(`
|
|
76
|
+
`)+o}function NA(e){const i=[];Mt(e.current)&&i.push(`Current branch: ${Mt(e.current)}`),Mt(e.branches)&&i.push(Mt(e.branches)),Mt(e.stdout)&&i.push(Mt(e.stdout)),Mt(e.stderr)&&i.push(`stderr:
|
|
77
|
+
${Mt(e.stderr)}`);const a=Li(e.code);return a!==void 0&&a!==0&&i.push(`exit code: ${a}`),i.filter(Boolean).join(`
|
|
78
|
+
`)||"Git completed with no output."}async function EA(e,i,a,r,o){if(o.aborted)throw new DOMException("Aborted","AbortError");if(e==="read_file"){const h=ta(i,"path"),g=wi((await Xt("read_file",{path:h},r,o)).result);if(g.binary===!0)return{output:`${h} is binary (${Li(g.size)??0} bytes).`,isError:!1};const x=Math.max(1,Math.round(bo(i,"offset",1))),b=Math.min(Math.max(1,Math.round(bo(i,"limit",400))),2e3),y=Mt(g.content).split(`
|
|
79
|
+
`),v=y.slice(x-1,x-1+b),w=y.length-(x-1+b),T=`${Mt(g.path)||h} · ${y.length} lines${g.truncated===!0?" · file clipped by daemon":""}`,E=w>0?`
|
|
80
|
+
… ${w} more lines. Read again with offset ${x+b}.`:"";return{output:Ws(`${T}
|
|
81
|
+
────
|
|
82
|
+
${v.join(`
|
|
83
|
+
`)}${E}`),isError:!1}}if(e==="list_files"){const h=wi((await Xt("list_files",{path:b1(i,"path")??"",depth:Math.min(Math.max(1,bo(i,"depth",3)),8)},r,o)).result);return{output:vA(h),isError:!1}}if(e==="write_file"||e==="rewrite_file"){const h=ta(i,"path"),g=ta(i,"content"),x=wi((await Xt(e,{path:h,content:g},r,o)).result);return await y1(),{output:`${x.created===!0?"Created":e==="rewrite_file"?"Rewrote":"Updated"} ${Mt(x.path)||h} · ${g.split(`
|
|
84
|
+
`).length} lines, ${Li(x.size)??g.length} bytes.`,isError:!1}}if(e==="edit_file"){const h=ta(i,"path"),g=ta(i,"oldText"),x=typeof i.newText=="string"?i.newText:"",b=wi((await Xt("edit_file",{path:h,oldText:g,newText:x,replaceAll:i.replaceAll===!0},r,o)).result);return await y1(),{output:`Edited ${Mt(b.path)||h} · ${Li(b.replacements)??1} replacement${Li(b.replacements)===1?"":"s"}.`,isError:!1}}if(e==="shell"){const h=ta(i,"command"),g=wi((await Xt("shell",{command:h,timeoutMs:bo(i,"timeoutMs",12e4)},r,o)).result);return yA(),{output:Ws(wA(g,h)),isError:(Li(g.code)??0)!==0||g.timedOut===!0}}if(e==="grep"){const h=ta(i,"pattern"),g=wi((await Xt("grep",{pattern:h,path:b1(i,"path")??"",ignoreCase:i.ignoreCase===!0},r,o)).result),x=Math.min(Math.max(1,Math.round(bo(i,"maxResults",80))),200),b=Array.isArray(g.matches)?g.matches.slice(0,x):[],y={...g,matches:b,truncated:g.truncated===!0||Array.isArray(g.matches)&&g.matches.length>x};return{output:Ws(kA(y,h)),isError:!1}}if(e==="web_search"){const h=ta(i,"query"),g=wi((await Xt("web_search",{query:h,provider:a.searchProvider},r,o)).result),x=Array.isArray(g.results)?g.results:[];if(x.length===0)return{output:"No results found.",isError:!1};const b=x.map((y,v)=>{const w=wi(y);return`${v+1}. ${Mt(w.title)}
|
|
85
|
+
${Mt(w.url)}${Mt(w.snippet)?`
|
|
86
|
+
${Mt(w.snippet)}`:""}`}).join(`
|
|
87
|
+
|
|
88
|
+
`);return{output:Ws(`Search: ${h}
|
|
89
|
+
Provider: ${Mt(g.provider)||"web"}
|
|
90
|
+
|
|
91
|
+
${b}`),isError:!1}}if(e==="read_url"){const h=ta(i,"url"),g=wi((await Xt("read_url",{url:h},r,o)).result),x=Mt(g.title);return{output:Ws(`Source: ${Mt(g.url)||h}${x?`
|
|
92
|
+
Title: ${x}`:""}
|
|
93
|
+
|
|
94
|
+
${Mt(g.content)}${g.truncated===!0?`
|
|
95
|
+
|
|
96
|
+
… page truncated.`:""}`),isError:!1}}const u=ta(i,"action"),d={...i};delete d.action;const p=wi((await Xt("git",{action:u,...d},r,o)).result);return(u==="add"||u==="commit"||u==="init"||u==="checkout")&&await Be.getState().loadGit().catch(()=>{}),{output:Ws(NA(p)),isError:(Li(p.code)??0)!==0}}async function _A(e,i,a,r,o){if(Yt.tools)return await Yt.tools.execute(e,i,a,r,o);if(!a.tools[e]?.enabled)return{output:"This tool is disabled in Settings → Tools.",isError:!0};if(!Kw(e,r))return{output:"Plan mode is read-only. Do not edit files or change git state. Finish with an implementation plan instead.",isError:!0};if((e==="web_search"||e==="read_url")&&!a.webSearchEnabled)return{output:"Web access is turned off for this session.",isError:!0};if(e==="subagent")return{output:"Subagents are handled by the agent loop.",isError:!0};try{return await EA(e,i,a,r,o)}catch(u){if(u instanceof DOMException&&u.name==="AbortError")throw u;return{output:u instanceof Error?u.message:"The tool failed.",isError:!0}}}function mg(e){return e.startsWith("mcp__")?e.split("__").slice(2).join(" ").replace(/_/g," ")||"MCP tool":{shell:"Shell",read_file:"Read file",list_files:"List files",write_file:"Write file",edit_file:"Edit file",rewrite_file:"Rewrite file",grep:"Grep",web_search:"Web search",read_url:"Read URL",git:"Git",subagent:"Subagent",skill:"Skill"}[e]??"Tool"}function Xw(e,i){const a=e==="shell"?i.command:e==="grep"?i.pattern:e==="web_search"?i.query:e==="read_url"?i.url:e==="git"?i.action:e==="subagent"?i.task:i.path??"";return typeof a=="string"?a:""}const Zw={onText:()=>{},onReasoning:()=>{},onToolCalls:()=>{},onUsage:()=>{}};function Bo(e){const i=[e.content];for(const a of e.attachments??[])a.kind==="text"&&a.text&&i.push(`
|
|
97
|
+
|
|
98
|
+
--- Attached file: ${a.name} ---
|
|
99
|
+
${a.text}`);return i.filter(Boolean).join("")}function Td(e){return!!(e.content.trim()||e.toolCalls.length>0)}function Cd(e){return(e.attachments??[]).filter(i=>i.kind==="image"&&i.dataUrl)}function hg(e,i){if(!e.trim())return{};try{const a=JSON.parse(e);if(a&&typeof a=="object"&&!Array.isArray(a))return a;throw new Error("arguments must be a JSON object")}catch(a){throw new Error(`The model returned invalid arguments for ${i}: ${a.message}`)}}function jd(e,i){return i==="done"?e??"(no output)":i==="denied"?"The user denied this tool call.":i==="error"?`Tool error: ${e??"unknown error"}`:i==="awaiting"?"The tool call was interrupted before approval.":e??"(no output)"}function SA(e){const i=[],a=(r,o)=>{if(o.length===0)return;const u=i[i.length-1];u?.role===r?u.content.push(...o):i.push({role:r,content:o})};for(const r of e){if(r.role==="user"){const o=[];for(const d of Cd(r)){const p=/^data:(image\/[a-z0-9.+-]+);base64,(.+)$/i.exec(d.dataUrl??"");p&&o.push({type:"image",source:{type:"base64",media_type:p[1],data:p[2]}})}const u=Bo(r);u.trim()&&o.push({type:"text",text:u}),o.length===0&&o.push({type:"text",text:"(empty message)"}),a("user",o);continue}if(r.role==="assistant"){if(!Td(r))continue;const o=[];for(const u of r.thinkingBlocks??[])u.signature&&o.push({type:"thinking",thinking:u.text,signature:u.signature});r.content.trim()&&o.push({type:"text",text:r.content});for(const u of r.toolCalls)o.push({type:"tool_use",id:u.id,name:u.name,input:u.args});a("assistant",o);continue}a("user",[{type:"tool_result",tool_use_id:r.call.id,content:jd(r.result,r.status),is_error:r.status==="error"||r.status==="denied"}])}return i}async function Qw(e){const{settings:i,model:a,history:r,system:o,mode:u,signal:d,handlers:p}=e,h=i.model.trim();if(!h)throw new Error("Choose a model before sending a message.");const g=Nr(a),x=ml(i.effort,a),b=x!=="none"&&(g.length>0||Zu(a));let y=i.maxTokens,v=0;b&&g.length===0&&Zu(a)&&(v=_w(x,a),y=Math.max(i.maxTokens,v+1024),a?.maxOutput&&(y=Math.min(y,a.maxOutput)),v=Math.min(v,y-1024),v<1024&&(v=0));const w=Sd(i,u).map(L=>({name:L.name,description:L.description,input_schema:L.parameters})),T={model:h,max_tokens:y,system:o,messages:SA(r),stream:!0};if(w.length>0&&(T.tools=w),b&&g.length>0){const L=x==="minimal"?"low":x;T.output_config={effort:L}}else v>0?T.thinking={type:"enabled",budget_tokens:v}:b||(!a||a.temperature)&&(T.temperature=i.temperature);const E=await Go(i.provider,"anthropic",h,T,d);let N="",j="",A={};const R=new Map;for await(const L of _d(E)){let q;try{q=JSON.parse(L)}catch{continue}const M=q.type;if(M==="error"){const H=q.error;throw new Error(typeof H=="string"?H:H?.message??"Anthropic returned an error.")}if(M==="message_start"){const H=q.message;A={...A,input:H?.usage?.input_tokens};continue}if(M==="content_block_start"){const H=Number(q.index??R.size),Z=q.content_block;R.set(H,{type:String(Z.type??""),text:typeof Z.text=="string"?Z.text:typeof Z.thinking=="string"?Z.thinking:"",signature:typeof Z.signature=="string"?Z.signature:"",id:typeof Z.id=="string"?Z.id:"",name:typeof Z.name=="string"?Z.name:"",json:"",input:Z.input});continue}if(M==="content_block_delta"){const H=Number(q.index??0),Z=R.get(H),he=q.delta;if(!Z||!he)continue;he.type==="text_delta"&&typeof he.text=="string"?(Z.text+=he.text,N+=he.text,p.onText(he.text)):he.type==="thinking_delta"&&typeof he.thinking=="string"?(Z.text+=he.thinking,j+=he.thinking,p.onReasoning(he.thinking)):he.type==="signature_delta"&&typeof he.signature=="string"?Z.signature+=he.signature:he.type==="input_json_delta"&&typeof he.partial_json=="string"&&(Z.json+=he.partial_json);continue}if(M==="message_delta"){const H=q.usage;A={...A,output:H?.output_tokens??A.output},p.onUsage(A);continue}if(M==="message_stop")break}const $=new Set(w.map(L=>L.name)),z=[],C=[];for(const[,L]of[...R.entries()].sort((q,M)=>q[0]-M[0])){if(L.type==="tool_use"&&L.name){if(!$.has(L.name))throw new Error(`The model requested a tool that is not enabled: ${L.name}`);const q=L.json?hg(L.json,L.name):L.input&&typeof L.input=="object"?L.input:{};z.push({id:L.id||`call_${Date.now().toString(36)}_${z.length}`,name:L.name,args:q})}L.type==="thinking"&&L.text&&C.push({text:L.text,signature:L.signature||void 0})}return z.length>0&&p.onToolCalls(z),{content:N,reasoning:j,toolCalls:z,thinkingBlocks:C,usage:A}}function TA(e){const i=[],a=(r,o)=>{if(o.length===0)return;const u=i[i.length-1];u?.role===r?u.parts.push(...o):i.push({role:r,parts:o})};for(const r of e){if(r.role==="user"){const o=[];for(const d of Cd(r)){const p=/^data:([^;]+);base64,(.+)$/i.exec(d.dataUrl??"");p&&o.push({inlineData:{mimeType:p[1],data:p[2]}})}const u=Bo(r);u.trim()&&o.push({text:u}),o.length===0&&o.push({text:"(empty message)"}),a("user",o);continue}if(r.role==="assistant"){if(!Td(r))continue;const o=[];r.content.trim()&&o.push({text:r.content});for(const u of r.toolCalls)o.push({functionCall:{name:u.name,args:u.args},...u.thoughtSignature?{thoughtSignature:u.thoughtSignature}:{}});a("model",o);continue}a("user",[{functionResponse:{name:r.call.name,response:{result:jd(r.result,r.status),...r.status==="error"||r.status==="denied"?{isError:!0}:{}}}}])}return i}function wh(e){if(Array.isArray(e))return e.map(wh);if(!e||typeof e!="object")return e;const i={};for(const[a,r]of Object.entries(e))a==="additionalProperties"||a==="$schema"||(i[a]=wh(r));return i}async function Jw(e){const{settings:i,model:a,history:r,system:o,mode:u,signal:d,handlers:p}=e,h=i.model.trim();if(!h)throw new Error("Choose a model before sending a message.");const g=Nr(a),x=ml(i.effort,a),b=Zu(a)?_w(x,a):0,y=x!=="none"&&(g.length>0||b>0);let v=i.maxTokens;y&&b>0&&(v=Math.max(v,b+2048),a?.maxOutput&&(v=Math.min(v,a.maxOutput)));const w=Sd(i,u),T={maxOutputTokens:v};(!a||a.temperature)&&(T.temperature=i.temperature),y&&g.length>0?T.thinkingConfig={thinkingLevel:x.toUpperCase(),includeThoughts:!0}:y&&b>0?T.thinkingConfig={thinkingBudget:Math.min(b,Math.max(1024,v-1024)),includeThoughts:!0}:y&&Nw(a)&&(T.thinkingConfig={includeThoughts:!0});const E={systemInstruction:{parts:[{text:o}]},contents:TA(r),generationConfig:T};w.length>0&&(E.tools=[{functionDeclarations:w.map(M=>({name:M.name,description:M.description,parameters:wh(M.parameters)}))}],E.toolConfig={functionCallingConfig:{mode:"AUTO"}});const N=await Go(i.provider,"gemini",h,E,d);let j="",A="",R={},$="";const z=[],C=new Set(w.map(M=>M.name));let L;for await(const M of _d(N)){let H;try{H=JSON.parse(M)}catch{continue}const Z=H.error;if(Z?.message)throw new Error(Z.message);const he=H.promptFeedback;if(he?.blockReason)throw new Error(`Gemini blocked this request (${he.blockReason}).`);const se=H.usageMetadata;se&&(R={input:se.promptTokenCount,output:(se.candidatesTokenCount??0)+(se.thoughtsTokenCount??0)||se.candidatesTokenCount},p.onUsage(R));const O=H.candidates?.[0];O?.finishReason&&($=O.finishReason);for(const ee of O?.content?.parts??[]){const te=typeof ee.thoughtSignature=="string"?ee.thoughtSignature:void 0;te&&(L=te),typeof ee.text=="string"&&ee.text&&(ee.thought===!0?(A+=ee.text,p.onReasoning(ee.text)):(j+=ee.text,p.onText(ee.text)));const be=ee.functionCall;if(be?.name){if(!C.has(be.name))throw new Error(`Gemini requested a tool that is not enabled: ${be.name}`);z.push({name:be.name,args:be.args??{},signature:te??L}),L=void 0}}}if($==="SAFETY"||$==="RECITATION")throw new Error(`Gemini stopped the response (${$.toLowerCase()}).`);const q=z.map((M,H)=>({id:`gemini_${Date.now().toString(36)}_${H}`,name:M.name,args:M.args,thoughtSignature:M.signature}));return q.length>0&&p.onToolCalls(q),{content:j,reasoning:A,toolCalls:q,usage:R}}function CA(e){const i=[];for(const a of e){if(a.role==="user"){const r=Cd(a);if(r.length>0){const o=[{type:"text",text:Bo(a)||"See the attached image."}];for(const u of r)o.push({type:"image_url",image_url:{url:u.dataUrl,detail:"auto"}});i.push({role:"user",content:o})}else{const o=Bo(a);o.trim()&&i.push({role:"user",content:o})}continue}if(a.role==="assistant"){if(!Td(a))continue;const r={role:"assistant",content:a.content||null};a.toolCalls.length>0&&(r.tool_calls=a.toolCalls.map(o=>({id:o.id,type:"function",function:{name:o.name,arguments:JSON.stringify(o.args)}}))),i.push(r);continue}i.push({role:"tool",tool_call_id:a.call.id,content:jd(a.result,a.status)})}return i}function v1(e,i){return e!=="openai"?!1:/^(gpt-5|o[1-9]|codex)/i.test(i)}async function Ww(e){const{settings:i,model:a,history:r,system:o,mode:u,signal:d,handlers:p}=e,h=i.model.trim();if(!h)throw new Error("Choose a model before sending a message.");const g=Sd(i,u),x=new Set(g.map(z=>z.name)),b=g.map(z=>({type:"function",function:{name:z.name,description:z.description,parameters:z.parameters}})),y={model:h,messages:[{role:"system",content:o},...CA(r)],stream:!0};b.length>0&&(y.tools=b,y.tool_choice="auto"),(i.provider==="openai"||i.provider==="openrouter")&&(y.stream_options={include_usage:!0}),i.provider==="openrouter"&&(y.usage={include:!0}),v1(i.provider,h)?y.max_completion_tokens=i.maxTokens:y.max_tokens=i.maxTokens;let w=Nr(a).length>0?ml(i.effort,a):"";w==="none"&&(w=""),w&&(i.provider==="openrouter"?y.reasoning={effort:w}:y.reasoning_effort=w);const T=a?a.temperature:!v1(i.provider,h);!w&&T&&(y.temperature=i.temperature);const E=await Go(i.provider,"openai-chat",h,y,d);let N="",j="",A={};const R=new Map;for await(const z of _d(E)){if(z==="[DONE]")break;let C;try{C=JSON.parse(z)}catch{continue}if(C.error){const H=C.error;throw new Error(typeof H=="string"?H:H.message??"The provider returned an error.")}if(C.usage&&typeof C.usage=="object"){const H=C.usage;A={input:H.prompt_tokens,output:H.completion_tokens,cost:typeof H.cost=="number"?H.cost:typeof H.total_cost=="number"?H.total_cost:void 0},p.onUsage(A)}const q=C.choices?.[0]?.delta;if(!q)continue;typeof q.content=="string"&&q.content&&(N+=q.content,p.onText(q.content));const M=typeof q.reasoning_content=="string"?q.reasoning_content:typeof q.reasoning=="string"?q.reasoning:(q.reasoning_details??[]).map(H=>H.text??"").join("");M&&(j+=M,p.onReasoning(M));for(const[H,Z]of(q.tool_calls??[]).entries()){const he=typeof Z.index=="number"?Z.index:H,se=R.get(he)??{id:"",name:"",arguments:""};Z.id&&(se.id=Z.id),Z.function?.name&&(se.name=Z.function.name),Z.function?.arguments&&(se.arguments+=Z.function.arguments),R.set(he,se)}}const $=[];for(const[z,C]of[...R.entries()].sort((L,q)=>L[0]-q[0]))if(C.name){if(!x.has(C.name))throw new Error(`The model requested a tool that is not enabled: ${C.name}`);$.push({id:C.id||`call_${Date.now().toString(36)}_${z}`,name:C.name,args:hg(C.arguments,C.name)})}return $.length>0&&p.onToolCalls($),{content:N,reasoning:j,toolCalls:$,usage:A}}function jA(e){const i=[];for(const a of e){if(a.role==="user"){const r=Cd(a),o=Bo(a)||(r.length>0?"See the attached image.":"");if(!o.trim()&&r.length===0)continue;if(r.length===0){i.push({role:"user",content:o});continue}const u=[{type:"input_text",text:o}];for(const d of r)u.push({type:"input_image",image_url:d.dataUrl,detail:"auto"});i.push({role:"user",content:u});continue}if(a.role==="assistant"){if(!Td(a))continue;a.content.trim()&&i.push({role:"assistant",content:a.content});for(const r of a.toolCalls)i.push({type:"function_call",call_id:r.id,name:r.name,arguments:JSON.stringify(r.args)});continue}i.push({type:"function_call_output",call_id:a.call.id,output:jd(a.result,a.status)})}return i}function el(e){return e&&typeof e=="object"?e:{}}async function ek(e){const{settings:i,model:a,history:r,system:o,mode:u,signal:d,handlers:p}=e,h=i.model.trim();if(!h)throw new Error("Choose a model before sending a message.");const g=Sd(i,u),x=new Set(g.map(C=>C.name)),b={model:h,instructions:o,input:jA(r),max_output_tokens:i.maxTokens,tool_choice:"auto"};g.length>0&&(b.tools=g.map(C=>({type:"function",name:C.name,description:C.description,parameters:C.parameters,strict:!1})));const v=Nr(a).length>0?ml(i.effort,a):"none";v!=="none"&&(b.reasoning={effort:v});const w=await Go(i.provider,"openai-responses",h,b,d);let T="",E="",N={};const j=new Map;let A=0;const R=(C,L)=>{const q=j.get(C),M=typeof L.call_id=="string"?L.call_id:q?.id||C,H=typeof L.name=="string"?L.name:q?.name||"",Z=typeof L.arguments=="string"?L.arguments:q?.args||"";j.set(C,{id:M,name:H,args:Z,order:q?.order??A++})};for await(const C of _d(w)){if(C==="[DONE]")break;let L;try{L=JSON.parse(C)}catch{continue}const q=typeof L.type=="string"?L.type:"";if(q==="error"||q==="response.failed"){const M=el(L.response).error??L.error??L.message,H=el(M);throw new Error(typeof M=="string"?M:typeof H.message=="string"?H.message:"The model request failed.")}if(q==="response.output_text.delta"&&typeof L.delta=="string"){T+=L.delta,p.onText(L.delta);continue}if((q==="response.reasoning_summary_text.delta"||q==="response.reasoning_text.delta")&&typeof L.delta=="string"){E+=L.delta,p.onReasoning(L.delta);continue}if(q==="response.output_item.added"){const M=el(L.item);if(M.type==="function_call"){const H=typeof M.id=="string"?M.id:typeof M.call_id=="string"?M.call_id:"";H&&R(H,M)}continue}if(q==="response.function_call_arguments.delta"){const M=typeof L.item_id=="string"?L.item_id:"",H=M?j.get(M):void 0;H&&typeof L.delta=="string"&&(H.args+=L.delta);continue}if(q==="response.function_call_arguments.done"){const M=typeof L.item_id=="string"?L.item_id:"",H=M?j.get(M):void 0;H&&typeof L.arguments=="string"&&(H.args=L.arguments);continue}if(q==="response.output_item.done"){const M=el(L.item);if(M.type==="function_call"){const H=typeof M.id=="string"?M.id:typeof M.call_id=="string"?M.call_id:"";H&&R(H,M)}continue}if(q==="response.completed"){const M=el(L.response),H=el(M.usage);(typeof H.input_tokens=="number"||typeof H.output_tokens=="number")&&(N={input:Number(H.input_tokens)||void 0,output:Number(H.output_tokens)||void 0,cost:typeof H.cost=="number"?H.cost:void 0},p.onUsage(N))}}const $=[],z=[...j.entries()].sort((C,L)=>C[1].order-L[1].order);for(const[C,L]of z)if(L.name){if(!x.has(L.name))throw new Error(`The model requested a tool that is not enabled: ${L.name}`);$.push({id:L.id||C,name:L.name,args:hg(L.args,L.name)})}return $.length>0&&p.onToolCalls($),{content:T,reasoning:E,toolCalls:$,usage:N}}const Co=[],tk=600*1e3,On=kr()((e,i)=>({byProvider:{},loading:{},errors:{},notes:{},source:{},fetchedAt:{},fetchModels:async(a,r=!1)=>{if(i().loading[a])return i().byProvider[a]??Co;if(!r){const o=i().byProvider[a]??Co,u=i().fetchedAt[a]??0;if(o.length>0&&Date.now()-u<tk)return o}e(o=>({loading:{...o.loading,[a]:!0},errors:{...o.errors,[a]:""}}));try{const o=await aj(a);return e(u=>({byProvider:{...u.byProvider,[a]:o.models},loading:{...u.loading,[a]:!1},errors:{...u.errors,[a]:""},notes:{...u.notes,[a]:o.note||o.catalogError||""},source:{...u.source,[a]:o.source},fetchedAt:{...u.fetchedAt,[a]:o.fetchedAt||Date.now()}})),o.models}catch(o){const u=o instanceof Error?o.message:"Could not load models from this provider.";return e(d=>({loading:{...d.loading,[a]:!1},errors:{...d.errors,[a]:u},source:{...d.source,[a]:""}})),i().byProvider[a]??Co}}}));function AA(e){return On(i=>i.byProvider[e])??Co}function Ad(){const e=Me(a=>a.provider),i=Me(a=>a.model);return On(a=>i?a.byProvider[e]?.find(r=>r.id===i)??null:null)}function Yo(e,i){return i?On.getState().byProvider[e]?.find(a=>a.id===i)??null:null}function OA(){const e=Me(a=>a.hydrated),i=Me(a=>a.provider);B.useEffect(()=>{if(!e)return;const a=Me.getState();if(!hl(a))return;const r=On.getState(),o=r.byProvider[i]??Co,u=r.fetchedAt[i]??0;o.length>0&&Date.now()-u<tk||r.fetchModels(i)},[e,i])}function nk(e,i,a){if(a?.apiKind)return a.apiKind;const r=sa[e];if(e!=="opencode")return r?.format==="anthropic"?"anthropic":r?.format==="gemini"?"gemini":"openai-chat";const o=i.toLowerCase();return/gemini|gemma/.test(o)?"gemini":/claude|qwen.*(flash|plus)/.test(o)?"anthropic":/gpt|grok|muse|codex/.test(o)?"openai-responses":"openai-chat"}class MA extends Ei{static provide="llm";constructor(i){super(i,"llm")}async stream(i){return await this.ctx.events.waterfall("agent/request",i,async()=>{switch(nk(i.settings.provider,i.settings.model,i.model)){case"anthropic":return await Qw(i);case"gemini":return await Jw(i);case"openai-responses":return await ek(i);default:return await Ww(i)}})}}function ik(e){switch(nk(e.settings.provider,e.settings.model,e.model)){case"anthropic":return Qw(e);case"gemini":return Jw(e);case"openai-responses":return ek(e);default:return Ww(e)}}const RA=`You are a session compactor. Your ONLY job is to produce a detailed, structured summary of the conversation you are given. This summary will replace the original messages so the AI agent can continue the task without losing important context.
|
|
100
|
+
|
|
101
|
+
The summary MUST include, in clear sections:
|
|
102
|
+
|
|
103
|
+
## Task & Goal
|
|
104
|
+
What the user originally asked for. The full scope, requirements, and any constraints they stated.
|
|
105
|
+
|
|
106
|
+
## Work Completed So Far
|
|
107
|
+
Every meaningful action taken: files read, files created or modified (list each file path and what changed), commands run (and their output), API calls made, decisions reached, bugs found and fixed.
|
|
108
|
+
|
|
109
|
+
## Current State
|
|
110
|
+
What is the exact state of the workspace right now? Which files are in what state? What has been verified to work? What is broken or incomplete?
|
|
111
|
+
|
|
112
|
+
## Open Tasks & Next Steps
|
|
113
|
+
What remains to be done? List concrete next actions with enough detail that the agent can pick up exactly where things left off.
|
|
114
|
+
|
|
115
|
+
## Key Facts & Decisions
|
|
116
|
+
Important technical facts discovered during the session: library versions, APIs used, architectural decisions made, pitfalls encountered.
|
|
117
|
+
|
|
118
|
+
## Files Modified or Created
|
|
119
|
+
An exhaustive list of every file path that was touched and a one-line description of what was done.
|
|
120
|
+
|
|
121
|
+
Be exhaustive and precise. Do not summarize tool output vaguely — include actual file paths, function names, error messages, command outputs. The agent continuing the work must be able to act on this summary without access to the original messages.`,Hu=new Set;function ak(e){return Hu.has(e)}async function DA(e){if(Hu.has(e))return!1;Hu.add(e);try{const i=Ve.getState().sessions.find(w=>w.id===e);if(!i||i.messages.length<4)return!1;const a=Me.getState(),r=ui(a);if(!r)return!1;const o=Yo(a.provider,r),u=zA(i.messages),d=[{id:Ui("msg"),role:"user",content:`Below is a complete transcript of a coding session. Produce the detailed summary as instructed.
|
|
122
|
+
|
|
123
|
+
${u}`,createdAt:Date.now()}];let p="";try{const w=await ik({settings:a,model:o,history:d,system:RA,mode:"build",signal:new AbortController().signal,handlers:{...Zw,onText:T=>{p+=T}}});w.content.trim()&&(p=w.content)}catch(w){return window.dispatchEvent(new CustomEvent("maxcode:notice",{detail:{message:`Auto-compact failed: ${w instanceof Error?w.message:"Unknown error"}. Continuing with full context.`,tone:"error"}})),!1}if(!p.trim())return!1;const h=i.messages.find(w=>w.role==="user"),g=Date.now(),x=[];h&&x.push({...h});const b={id:Ui("msg"),role:"assistant",content:p.trim(),reasoning:"",toolCalls:[],round:0,model:r,provider:a.provider,createdAt:g,durationMs:0};x.push(b);const y=LA(i.messages),v={id:Ui("msg"),role:"user",content:y,createdAt:g};return x.push(v),Ve.getState().updateSession(e,{messages:x}),window.dispatchEvent(new CustomEvent("maxcode:notice",{detail:{message:"✦ Context compacted — session summary saved, continuing with fresh context.",tone:"success"}})),!0}finally{Hu.delete(e)}}function zA(e){const i=[];for(const a of e)if(a.role==="user"){const r=a.attachments&&a.attachments.length>0?`
|
|
124
|
+
[Attachments: ${a.attachments.map(o=>o.name).join(", ")}]`:"";i.push(`[USER]
|
|
125
|
+
${a.content}${r}`)}else if(a.role==="assistant"){const r=[];a.reasoning.trim()&&r.push(`<thinking>
|
|
126
|
+
${a.reasoning.trim()}
|
|
127
|
+
</thinking>`),a.content.trim()&&r.push(a.content.trim());for(const o of a.toolCalls)r.push(`<tool_call name="${o.name}">
|
|
128
|
+
${JSON.stringify(o.args,null,2)}
|
|
129
|
+
</tool_call>`);r.length>0&&i.push(`[ASSISTANT]
|
|
130
|
+
${r.join(`
|
|
131
|
+
|
|
132
|
+
`)}`)}else if(a.role==="tool"){const r=a.status==="done"?"OK":a.status.toUpperCase(),o=(a.result??"").slice(0,8e3),u=(a.result??"").length>8e3?`
|
|
133
|
+
… (truncated)`:"";i.push(`[TOOL: ${a.call.name} — ${r}]
|
|
134
|
+
${o}${u}`)}return i.join(`
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
`)}function LA(e){const r=[...e].reverse().find(d=>d.role==="user")?.content?.trim()??"",o=e.filter(d=>d.role==="tool").length;return[`[CONTEXT COMPACTED — ${e.filter(d=>d.role==="user").length} user turns, ${o} tool calls summarised above]`,"","The summary above contains the full record of work done so far. Please:","1. Read the summary carefully before acting — it contains critical state information.","2. Continue exactly where you left off.","3. Do not repeat work already marked as completed in the summary.",r?`
|
|
139
|
+
The most recent task/request was:
|
|
140
|
+
${r}`:""].filter(d=>d!==void 0).join(`
|
|
141
|
+
`)}const xm=3;function IA(e){if(e.role==="user"){const i=(e.attachments??[]).reduce((a,r)=>a+(r.text?.length??0),0);return Math.ceil((e.content.length+i)/xm)+4}if(e.role==="assistant"){const i=e.toolCalls.reduce((a,r)=>a+JSON.stringify(r.args).length+r.name.length+10,0);return Math.ceil((e.content.length+e.reasoning.length+i)/xm)+4}return Math.ceil((e.result??"").length/xm)+4}function rk(e){return e.reduce((i,a)=>i+IA(a),0)}function sk(e){return e?.context??128e3}function UA(e,i){const r=rk(e)+2e3,o=sk(i);return Math.min(r/o,1)}function lk(e,i){const r=rk(e)+2e3,o=sk(i),u=Math.min(r/o,1);return{used:r,limit:o,ratio:u,pct:Math.round(u*100)}}const ok=.85;class BA extends Ei{static provide="compaction";static inject=["sessions","llm"];constructor(i){super(i,"compaction")}isCompacting(i){return ak(i)}async compact(i){return await DA(i)}async checkAutoCompact(i){const a=Ve.getState().sessions.find(d=>d.id===i);if(!a||a.messages.length<4||this.isCompacting(i))return!1;const r=Me.getState(),o=Yo(r.provider,ui(r)),u=UA(a.messages,o);return u>=ok?(window.dispatchEvent(new CustomEvent("maxcode:notice",{detail:{message:`Context at ${Math.round(u*100)}% — compacting session before next request…`,tone:"info"}})),await this.compact(i)):!1}}function $A(){const e=Be.getState(),i=e.root||e.info.root;if(!i)return"No folder is open yet. Ask the user to choose a workspace folder in the Workspace panel before using file, shell or git tools.";const a=e.entries.filter(o=>!o.path.includes("/")).slice(0,40).map(o=>`${o.path}${o.type==="dir"?"/":""}`),r=e.git.available?`${e.git.branch||"detached HEAD"} · ${e.git.entries.length} changed file${e.git.entries.length===1?"":"s"}`:"not a git repository";return[`Root: ${i}`,`Git: ${r}`,a.length>0?`Top level: ${a.join(", ")}`:"The folder is empty.",e.truncated?"The file tree was truncated; use list_files or grep for deeper paths.":""].filter(Boolean).join(`
|
|
142
|
+
`)}function PA(e,i=e.mode){if(Yt.systemPrompt)return Yt.systemPrompt.assemble(e,i);const a=[e.systemPrompt.trim()],r=e.skills.filter(o=>o.enabled);return r.length>0&&a.push(["## Available skills","Call the `skill` tool to load the full instructions (and run scripts from the skill folder) when a task matches one of these. Do not guess a skill’s contents.",...r.map(o=>`- ${o.name} (${o.id}): ${o.description}`)].join(`
|
|
143
|
+
`)),a.push(["## Workspace","You operate on the real folder below through the local OpenSol daemon. Tools return real output; never invent file contents, command results, URLs or deployments.",$A()].join(`
|
|
144
|
+
|
|
145
|
+
`)),a.push(i==="plan"?["## Mode: Plan (read-only)","Investigate and design. Do not modify anything.","- Allowed: read_file, list_files, grep, web_search, read_url, read-only shell commands and read-only git actions.","- Forbidden: write_file, edit_file, rewrite_file, git add/commit/init/checkout, and shell commands that change files, install packages or change system state. The daemon rejects these.","- Read the relevant source before proposing changes. Grep for call sites and inspect the real files.","- Finish with a concrete, ordered implementation plan naming files and functions. State assumptions and open questions plainly.","- Never pretend an edit was made or a check was run."].join(`
|
|
146
|
+
`):["## Mode: Build","You may inspect and change the real workspace.","- Inspect before editing: list files, read the source, grep for call sites, check git status.","- Make the smallest coherent change. Do not reformat unrelated code, add speculative abstractions or invent APIs.","- After a mutation, inspect the result. Run the project’s real typecheck, lint, tests and build when they exist, and read the output.","- Never claim a check passed without running it. If a check cannot run, say why.","- Ask before destructive actions, force pushes, credential changes or anything that leaves the workspace."].join(`
|
|
147
|
+
`)),a.push(["## Session context",`- Model: ${ui(e)||"unset"}`,`- Date: ${new Date().toISOString().slice(0,10)}`,`- Mode: ${i}`,e.webSearchEnabled?"- Web search is enabled. Use it when facts may be current or when the user asks for sources.":"- Web search is turned off for this session.","- Use relative paths from the workspace root. Do not use /workspace paths."].join(`
|
|
148
|
+
`)),a.filter(Boolean).join(`
|
|
149
|
+
|
|
150
|
+
`)}function HA(e){return[PA(e,"plan"),["## Subagent","You are a focused read-only investigator. Work only on the assigned task.","- Inspect the real workspace with read-only file, grep, shell and web tools.","- Do not edit files, change git state or run commands that mutate the machine. The daemon enforces this.","- Be concise: return findings, exact file paths and line references, and any uncertainty.","- Do not repeat the task back. Do not invent evidence. If something cannot be verified, say so."].join(`
|
|
151
|
+
`)].join(`
|
|
152
|
+
|
|
153
|
+
`)}const w1=6;function bm(e){const i=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,9)}`;return`${e}_${i}`}function ym(){return new DOMException("Aborted","AbortError")}async function FA(e,i,a){const r=e.trim();if(!r)return"The subagent was not given a task.";if(a.aborted)throw ym();const o=Me.getState(),u=Yo(o.provider,o.model),d=HA(o),p=Date.now(),g=[{id:bm("sub"),role:"user",content:[`Task: ${r}`,i.trim()?`
|
|
154
|
+
Context from the main agent:
|
|
155
|
+
${i.trim()}`:"",`
|
|
156
|
+
Investigate now. Return a concise report with file paths and evidence.`].filter(Boolean).join(`
|
|
157
|
+
`),createdAt:p}];let x="";for(let b=0;b<w1;b+=1){if(a.aborted)throw ym();const y=await ik({settings:o,model:u,history:g,system:d,mode:"plan",signal:a,handlers:Zw});y.content.trim()&&(x=y.content.trim());const v={id:bm("submsg"),role:"assistant",content:y.content,reasoning:y.reasoning,thinkingBlocks:y.thinkingBlocks,toolCalls:y.toolCalls,round:b,createdAt:Date.now()};if(g.push(v),y.toolCalls.length===0)return v.content.trim()||"The subagent returned no report.";if(a.aborted)throw ym();for(const w of y.toolCalls){const T=await _A(w.name,w.args,o,"plan",a),E={id:bm("subtool"),role:"tool",call:w,status:T.isError?"error":"done",result:T.output,round:b,createdAt:Date.now()};g.push(E)}}return[x,`The subagent stopped after ${w1} investigation rounds. Continue with the evidence above or ask a narrower question.`].filter(Boolean).join(`
|
|
158
|
+
|
|
159
|
+
`)}class qA extends Ei{static provide="subagents";static inject=["tools","llm","systemPrompt"];constructor(i){super(i,"subagents")}async run(i,a,r){return await FA(i,a,r)}}const kh=e=>`maxcode-plugin-theme-${e}`;function GA(e){return Object.entries(e).filter(([i,a])=>/^[a-z][a-z0-9-]*$/.test(i)&&/^[\d\s.]+$/.test(a))}function YA(e){const i=(e.canvas??"").trim().split(/\s+/).map(Number),[a,r,o]=i.length===3?i:[255,255,255];return .2126*a+.7152*r+.0722*o<110}function VA(e,i){const a=GA(i).map(([r,o])=>`--${r}:${o.trim()}`);return a.length===0?"":`[data-theme='${e}']{${a.join(";")}}`}function KA(e,i){if(typeof document>"u")return;let a=document.getElementById(kh(e));a||(a=document.createElement("style"),a.id=kh(e),document.head.append(a)),a.textContent=i}function XA(e){typeof document>"u"||document.getElementById(kh(e))?.remove()}class ZA extends Ei{static provide="ui";_commands=new Map;_panels=new Map;_themes=new Map;constructor(i){super(i,"ui")}registerCommand(i,a,r){const o={id:i,label:a,run:r};return this._commands.set(i,o),()=>{this._commands.get(i)===o&&this._commands.delete(i)}}registerPanel(i,a,r){const o={id:i,label:a,render:r};return this._panels.set(i,o),()=>{this._panels.get(i)===o&&this._panels.delete(i)}}registerTheme(i,a,r){const o={id:i,label:a,palette:r};return this._themes.set(i,o),Tw({id:i,label:a,dark:YA(r)}),KA(i,VA(i,r)),()=>{this._themes.get(i)===o&&(this._themes.delete(i),Cw(i),XA(i))}}commands(){return[...this._commands.values()]}panels(){return[...this._panels.values()]}themes(){return[...this._themes.values()].map(i=>({id:i.id,label:i.label}))}}const QA=5,JA=/\b(408|409|425|429|500|502|503|504|522|524|529)\b|rate.?limit|overloaded|temporar|timed out|could not be reached|lost the connection|failed to fetch|networkerror|econnreset|etimedout|enotfound|eai_again/i;function WA(e){return JA.test(e)}function eO(e){return Math.min(1200*e*e,8e3)}const k1=QA;function tO(e,i){return new Promise(a=>{const r=()=>{window.clearTimeout(o),i.removeEventListener("abort",r),a()},o=window.setTimeout(r,e);i.addEventListener("abort",r,{once:!0})})}function N1(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function nO(e,i=4e4){return e.length<=i?e:`${e.slice(0,i)}
|
|
160
|
+
… truncated (${e.length-i} more characters)`}class iO extends Ei{static provide="agentLoop";static inject=["sessions","systemPrompt","tools","llm","approval","compaction","subagents"];controllers=new Map;queue=sA((i,a)=>this.runTurn(i,a));constructor(i){super(i,"agentLoop")}isBusy(i){return this.queue.isBusy(i)}stopRun(i){this.queue.clear(i),this.controllers.get(i)?.abort(),this.ctx.events.serial("agent/turn-stopping",i)}stopAllRuns(){this.queue.clearAll(),this.controllers.forEach((i,a)=>{i.abort(),this.ctx.events.serial("agent/turn-stopping",a)})}runAgent(i,a){const r=this.ctx.sessions.current(i);if(!r)return;const o=a??hm(r.messages);o&&this.queue.push(i,o)}regenerateLastTurn(i){const a=this.ctx.sessions.current(i);if(!a||this.queue.isBusy(i))return!1;let r=-1;for(let u=a.messages.length-1;u>=0;u-=1)if(a.messages[u].role==="user"){r=u;break}if(r<0)return!1;const o=a.messages[r].id;return this.ctx.sessions.updateSession(i,{messages:a.messages.slice(0,r+1)}),this.runAgent(i,o),!0}async runTurn(i,a){const r=this.ctx.sessions.current(i);if(!r||!this.ctx.sessions.turnHistory(r.messages,a))return;const o=new AbortController;this.controllers.set(i,o),Ra.getState().setStreaming(i,!0);const u=Me.getState(),d=sg(u.provider),p=r.mode??u.mode,h=Date.now();let g=0,x;try{e:for(let b=0;g=b+1,!o.signal.aborted;b+=1){let y=this.ctx.sessions.current(i);if(!y)break;if(b===0&&hm(y.messages)===a&&await this.ctx.compaction.checkAutoCompact(i)){const H=this.ctx.sessions.current(i);if(!H)break;const Z=hm(H.messages);if(!Z)break;a=Z,y=H}const v=this.ctx.sessions.turnHistory(y.messages,a);if(!v)break;const w=Ui("msg"),T={id:w,role:"assistant",content:"",reasoning:"",toolCalls:[],round:b,model:ui(u),provider:u.provider,createdAt:Date.now()};this.ctx.sessions.addMessage(i,T);let E="",N="",j,A={};const R=()=>{j===void 0&&(j=window.setTimeout(()=>{j=void 0,this.ctx.sessions.updateMessage(i,w,{content:E,reasoning:N})},40))},$={sessionId:i,round:b,history:v,settings:u,mode:p,signal:o.signal,assistantId:w};await this.ctx.events.waterfall("agent/pre-step",$,()=>{});let z,C=0;for(;;)try{z=await this.ctx.llm.stream({settings:u,model:Yo(u.provider,ui(u)),history:v,system:this.ctx.systemPrompt.assemble(u,p,{sessionPrompt:y.systemPrompt,workspacePrompt:y.workspace?u.workspacePrompts[y.workspace]:u.workspacePrompts[Be.getState().root??""]}),mode:p,signal:o.signal,handlers:{onText:M=>{E+=M,R()},onReasoning:M=>{N+=M,R()},onToolCalls:()=>{},onUsage:M=>{A=M}}});break}catch(M){const H=N1(M)||o.signal.aborted;if(!H&&C<k1&&!E&&!N&&WA(M instanceof Error?M.message:"")){C+=1;const he=(M instanceof Error?M.message:"provider error").replace(/\s+/g," ").slice(0,240);if(window.dispatchEvent(new CustomEvent("maxcode:notice",{detail:{message:`${d}: ${he} — retrying ${C}/${k1}…`,tone:"info"}})),await tO(eO(C),o.signal),o.signal.aborted)continue;continue}j!==void 0&&window.clearTimeout(j),x=H?void 0:gA(M,d),x&&window.dispatchEvent(new CustomEvent("maxcode:notice",{detail:{message:`${d} failed after ${C+1} attempt${C===0?"":"s"}: ${x}`,tone:"error"}})),this.ctx.sessions.updateMessage(i,w,{content:E,reasoning:N,stopped:H,durationMs:Date.now()-h,error:x}),await this.ctx.events.waterfall("agent/request-error",M,$,()=>{});break e}if(j!==void 0&&window.clearTimeout(j),this.ctx.sessions.updateMessage(i,w,{content:z.content,reasoning:z.reasoning,thinkingBlocks:z.thinkingBlocks,toolCalls:z.toolCalls,usage:A.input||A.output||A.cost?A:z.usage,durationMs:Date.now()-h,stopped:o.signal.aborted||void 0}),this.ctx.sessions.updateSession(i,{provider:u.provider,model:ui(u),mode:p}),o.signal.aborted)break;if(z.toolCalls.length===0){const M={sessionId:i,round:b,assistant:T,toolResults:[],stopped:o.signal.aborted};this.ctx.events.emit("agent/step-finish",M);break}const L=[];for(const M of z.toolCalls){if(o.signal.aborted)break;const H=td(u,M.name);if(!H?.enabled){const O={id:Ui("tool"),role:"tool",call:M,status:"error",result:"This tool is disabled in Settings → Tools.",round:b,createdAt:Date.now()};this.ctx.sessions.addMessage(i,O),L.push(O);continue}const Z=Ui("tool"),he=H.approval==="ask",se={id:Z,role:"tool",call:M,status:he?"awaiting":"running",round:b,createdAt:Date.now()};this.ctx.sessions.addMessage(i,se);const ae=Date.now();try{const O=M.name==="subagent"?{output:nO(await this.ctx.subagents.run(typeof M.args.task=="string"?M.args.task:"",typeof M.args.context=="string"?M.args.context:"",o.signal)),isError:!1}:await this.ctx.tools.execute(M.name,M.args,u,p,o.signal,M.id,a),ee={...se,status:O.isError?"error":"done",result:O.output,durationMs:Date.now()-ae,diff:O.diff};this.ctx.sessions.updateMessage(i,Z,ee),L.push(ee)}catch(O){const ee=N1(O),te={...se,status:"error",result:ee?"Stopped.":O instanceof Error?O.message:"The tool failed.",durationMs:Date.now()-ae};if(this.ctx.sessions.updateMessage(i,Z,te),L.push(te),ee)break}}const q={sessionId:i,round:b,assistant:T,toolResults:L,stopped:o.signal.aborted};if(this.ctx.events.emit("agent/step-finish",q),o.signal.aborted){const M=this.ctx.sessions.current(i);if(M){const H=new Set(M.messages.filter(Z=>Z.role==="tool").map(Z=>Z.call.id));for(const Z of z.toolCalls)H.has(Z.id)||this.ctx.sessions.addMessage(i,{id:Ui("tool"),role:"tool",call:Z,status:"error",result:"Stopped before the tool ran.",round:b,createdAt:Date.now()})}break}}}finally{this.controllers.delete(i),Ra.getState().setStreaming(i,!1);const b={sessionId:i,userMessageId:a,rounds:g,durationMs:Date.now()-h,stopped:o.signal.aborted,error:x};this.ctx.events.emit("agent/turn-finish",b)}}}const aO="You name chat sessions for a coding assistant. Reply with the title only: 2 to 6 words, in the same language as the user, no quotes, no markdown, no trailing punctuation.";function E1(e,i){const a=e.replace(/\s+/g," ").trim();return a.length>i?`${a.slice(0,i)}…`:a}function rO(e){const i=e.replace(/<think>[\s\S]*?<\/think>/gi,"").split(`
|
|
161
|
+
`).map(r=>r.trim()).find(Boolean);if(!i)return"";const a=i.replace(/^(title|tiêu đề)\s*[::-]\s*/i,"").replace(/^[#>*\-\s"'“”‘’`]+|[\s"'“”‘’`.。!]+$/g,"").trim();return a.length>64?`${a.slice(0,63).trim()}…`:a}function sO(e){const i=e.find(r=>r.role==="user"),a=[...e].reverse().find(r=>r.role==="assistant"&&r.content.trim());return{user:i&&i.role==="user"?E1(i.content,700):"",assistant:a&&a.role==="assistant"?E1(a.content,700):""}}class lO extends Ei{static provide="titles";static inject=["llm","sessions"];inflight=new Set;constructor(i){super(i,"titles"),this.ctx.on("agent/turn-finish",a=>{if(a.error||a.stopped||!Me.getState().aiSessionTitles)return;const o=this.ctx.sessions.current(a.sessionId);!o||(o.titleSource??"auto")!=="auto"||this.generate(a.sessionId)})}async generate(i,{force:a=!1}={}){if(this.inflight.has(i))return null;const r=this.ctx.sessions.current(i);if(!r||!a&&(r.titleSource??"auto")!=="auto")return null;const{user:o,assistant:u}=sO(r.messages);if(!o)return null;const d=Me.getState(),p=Yo(d.provider,ui(d)),h=Object.fromEntries(Object.entries(d.tools).map(([y,v])=>[y,{...v,enabled:!1}])),g=zo(p),x={...d,tools:h,webSearchEnabled:!1,temperature:.3,maxTokens:512,effort:g[0]??d.effort},b=[{id:Ui("title"),role:"user",createdAt:Date.now(),content:`Name this conversation.
|
|
162
|
+
|
|
163
|
+
User: ${o}
|
|
164
|
+
|
|
165
|
+
Assistant: ${u||"(no answer yet)"}`}];this.inflight.add(i),Ra.getState().setTitling(i,!0);try{const y=new AbortController,v=window.setTimeout(()=>y.abort(),25e3);let w="";const T=await this.ctx.llm.stream({settings:x,model:p,history:b,system:aO,mode:"plan",signal:y.signal,handlers:{onText:j=>{w+=j},onReasoning:()=>{},onToolCalls:()=>{},onUsage:()=>{}}}).finally(()=>window.clearTimeout(v)),E=rO(T.content||w),N=this.ctx.sessions.current(i);return!E||!N||!a&&(N.titleSource??"auto")!=="auto"?null:(this.ctx.sessions.updateSession(i,{title:E,titleSource:"ai"}),E)}catch{return null}finally{this.inflight.delete(i),Ra.getState().setTitling(i,!1)}}}const oO=28e3;function cO(e,i=oO){return e.length<=i?e:`${e.slice(0,i)}
|
|
166
|
+
… truncated (${e.length-i} more characters)`}function Jr(e){return e&&typeof e=="object"?e:{}}function xr(e){return typeof e=="string"?e:""}function Ii(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function Kr(e,i){const a=e[i];if(typeof a!="string"||!a.trim())throw new Error(`Missing string argument "${i}".`);return a}function uO(e,i){const a=e[i];return typeof a=="string"?a:void 0}function vm(e,i,a){const r=e[i];return typeof r=="number"&&Number.isFinite(r)?r:typeof r=="string"&&Number.isFinite(Number(r))?Number(r):a}function dO(e){const i=Array.isArray(e.entries)?e.entries:[];if(i.length===0)return"This folder is empty.";const a=i.map(o=>{const u=Jr(o),d=xr(u.path);return u.type==="dir"?`${d}/`:u.type==="link"?`${d} -> link`:`${d}${Ii(u.size)!==void 0?` (${Ii(u.size)} B)`:""}`}),r=e.truncated===!0?`
|
|
167
|
+
… listing truncated. Narrow the path or reduce depth.`:"";return`${xr(e.root)?`Root: ${xr(e.root)}
|
|
168
|
+
`:""}${a.join(`
|
|
169
|
+
`)}${r}`}function wm(e){const i=Jr(e.diff),a=Ii(i.added),r=Ii(i.removed);if(!(a===void 0||r===void 0))return{added:a,removed:r,line:Ii(i.line),column:Ii(i.column)}}function km(e){if(!e)return"";const i=e.line?` at L${e.line}${e.column?`:${e.column}`:""}`:"";return` · +${e.added} −${e.removed}${i}`}async function Nm(){await Be.getState().refresh().catch(()=>{})}const fO="tool-fs",pO=["tools"];function mO(e){const i=[e.tools.register({name:"read_file",description:"Read a text file from the workspace. Use offset and limit for large files.",parameters:{type:"object",properties:{path:{type:"string",description:"Relative path from the workspace root."},offset:{type:"number",description:"1-based first line. Defaults to 1."},limit:{type:"number",description:"Maximum lines. Defaults to 400."}},required:["path"],additionalProperties:!1},allowedInMode:()=>!0,async execute(a,r){const o=Kr(a,"path"),u=Jr((await Xt("read_file",{path:o},r.mode,r.signal)).result);if(u.binary===!0)return{output:`${o} is binary (${Ii(u.size)??0} bytes).`,isError:!1};const d=Math.max(1,Math.round(vm(a,"offset",1))),p=Math.min(Math.max(1,Math.round(vm(a,"limit",400))),2e3),h=xr(u.content).split(`
|
|
170
|
+
`),g=h.slice(d-1,d-1+p),x=h.length-(d-1+p),b=`${xr(u.path)||o} · ${h.length} lines${u.truncated===!0?" · file clipped by daemon":""}`,y=x>0?`
|
|
171
|
+
… ${x} more lines. Read again with offset ${d+p}.`:"";return{output:cO(`${b}
|
|
172
|
+
────
|
|
173
|
+
${g.join(`
|
|
174
|
+
`)}${y}`),isError:!1}}}),e.tools.register({name:"list_files",description:"List files and folders below a workspace path.",parameters:{type:"object",properties:{path:{type:"string",description:"Folder path. Defaults to the workspace root."},depth:{type:"number",description:"Recursion depth, 1–8. Defaults to 3."}},additionalProperties:!1},allowedInMode:()=>!0,async execute(a,r){const o=Jr((await Xt("list_files",{path:uO(a,"path")??"",depth:Math.min(Math.max(1,vm(a,"depth",3)),8)},r.mode,r.signal)).result);return{output:dO(o),isError:!1}}}),e.tools.register({name:"write_file",description:"Create a file or replace its full contents. Prefer edit_file for small changes.",parameters:{type:"object",properties:{path:{type:"string",description:"Relative file path."},content:{type:"string",description:"Complete file content."}},required:["path","content"],additionalProperties:!1},allowedInMode:a=>a==="build",async execute(a,r){const o=Kr(a,"path"),u=Kr(a,"content"),d=Jr((await Xt("write_file",{path:o,content:u},r.mode,r.signal,r.turnId)).result);await Nm();const p=d.created===!0?"Created":"Updated",h=wm(d);return{output:`${p} ${xr(d.path)||o} · ${u.split(`
|
|
175
|
+
`).length} lines, ${Ii(d.size)??u.length} bytes${km(h)}.`,isError:!1,diff:h}}}),e.tools.register({name:"rewrite_file",description:"Replace the complete contents of an existing file. Use when most of the file changes.",parameters:{type:"object",properties:{path:{type:"string",description:"Relative file path."},content:{type:"string",description:"The new complete file content."}},required:["path","content"],additionalProperties:!1},allowedInMode:a=>a==="build",async execute(a,r){const o=Kr(a,"path"),u=Kr(a,"content"),d=Jr((await Xt("rewrite_file",{path:o,content:u},r.mode,r.signal,r.turnId)).result);await Nm();const p=wm(d);return{output:`Rewrote ${xr(d.path)||o} · ${u.split(`
|
|
176
|
+
`).length} lines, ${Ii(d.size)??u.length} bytes${km(p)}.`,isError:!1,diff:p}}}),e.tools.register({name:"edit_file",description:"Replace an exact text occurrence in a file. oldText must match whitespace exactly and be unique unless replaceAll is true.",parameters:{type:"object",properties:{path:{type:"string",description:"Relative file path."},oldText:{type:"string",description:"Exact text to replace."},newText:{type:"string",description:"Replacement text."},replaceAll:{type:"boolean",description:"Replace every occurrence. Defaults to false."}},required:["path","oldText","newText"],additionalProperties:!1},allowedInMode:a=>a==="build",async execute(a,r){const o=Kr(a,"path"),u=Kr(a,"oldText"),d=typeof a.newText=="string"?a.newText:"",p=Jr((await Xt("edit_file",{path:o,oldText:u,newText:d,replaceAll:a.replaceAll===!0},r.mode,r.signal,r.turnId)).result);await Nm();const h=wm(p);return{output:`Edited ${xr(p.path)||o} · ${Ii(p.replacements)??1} replacement${Ii(p.replacements)===1?"":"s"}${km(h)}.`,isError:!1,diff:h}}})];return()=>i.forEach(a=>a())}const hO=Object.freeze(Object.defineProperty({__proto__:null,apply:mO,inject:pO,name:fO},Symbol.toStringTag,{value:"Module"})),gO=28e3;function xO(e,i=gO){return e.length<=i?e:`${e.slice(0,i)}
|
|
177
|
+
… truncated (${e.length-i} more characters)`}function bO(e){return e&&typeof e=="object"?e:{}}function Em(e){return typeof e=="string"?e:""}function ck(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function yO(e,i){const a=e[i];if(typeof a!="string"||!a.trim())throw new Error(`Missing string argument "${i}".`);return a}function vO(e,i,a){const r=e[i];return typeof r=="number"&&Number.isFinite(r)?r:typeof r=="string"&&Number.isFinite(Number(r))?Number(r):a}function wO(e,i){const a=[`$ ${i}`,Em(e.stdout)];Em(e.stderr)&&a.push(`stderr:
|
|
178
|
+
${Em(e.stderr)}`);const r=ck(e.code);return r!==void 0&&r!==0&&a.push(`exit code: ${r}`),e.timedOut===!0&&a.push("The command timed out."),a.filter(o=>o!=="").join(`
|
|
179
|
+
`)}async function kO(){await Be.getState().refresh({treeOnly:!0}).catch(()=>{})}const NO="tool-shell",EO=["tools"];function _O(e){return e.tools.register({name:"shell",description:"Run a shell command in the workspace root. The working directory resets between calls. Prefer dedicated file and git tools for edits. In Plan mode only read-only commands are accepted.",parameters:{type:"object",properties:{command:{type:"string",description:"The shell command to run."},timeoutMs:{type:"number",description:"Timeout in milliseconds (max 600000)."}},required:["command"],additionalProperties:!1},allowedInMode:()=>!0,async execute(i,a){const r=yO(i,"command"),o=bO((await Xt("shell",{command:r,timeoutMs:vO(i,"timeoutMs",12e4)},a.mode,a.signal)).result);return kO(),{output:xO(wO(o,r)),isError:(ck(o.code)??0)!==0||o.timedOut===!0}}})}const SO=Object.freeze(Object.defineProperty({__proto__:null,apply:_O,inject:EO,name:NO},Symbol.toStringTag,{value:"Module"})),TO=28e3;function CO(e,i=TO){return e.length<=i?e:`${e.slice(0,i)}
|
|
180
|
+
… truncated (${e.length-i} more characters)`}function uk(e){return e&&typeof e=="object"?e:{}}function _1(e){return typeof e=="string"?e:""}function jO(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function AO(e,i){const a=e[i];if(typeof a!="string"||!a.trim())throw new Error(`Missing string argument "${i}".`);return a}function OO(e,i){const a=e[i];return typeof a=="string"?a:void 0}function MO(e,i,a){const r=e[i];return typeof r=="number"&&Number.isFinite(r)?r:typeof r=="string"&&Number.isFinite(Number(r))?Number(r):a}function RO(e,i){const a=Array.isArray(e.matches)?e.matches:[];if(a.length===0)return`No matches for ${i}.`;const r=a.map(u=>{const d=uk(u);return`${_1(d.file)}:${jO(d.line)??0}: ${_1(d.text)}`}),o=e.truncated===!0?`
|
|
181
|
+
… more matches exist. Narrow the pattern or path.`:"";return r.join(`
|
|
182
|
+
`)+o}const DO="tool-grep",zO=["tools"];function LO(e){return e.tools.register({name:"grep",description:"Search workspace contents with a regular expression. Returns path, line and matching text.",parameters:{type:"object",properties:{pattern:{type:"string",description:"Regular expression to search for."},path:{type:"string",description:"File or folder. Defaults to the workspace root."},ignoreCase:{type:"boolean",description:"Case-insensitive search. Defaults to false."},maxResults:{type:"number",description:"Maximum matches. Defaults to 80."}},required:["pattern"],additionalProperties:!1},allowedInMode:()=>!0,async execute(i,a){const r=AO(i,"pattern"),o=uk((await Xt("grep",{pattern:r,path:OO(i,"path")??"",ignoreCase:i.ignoreCase===!0},a.mode,a.signal)).result),u=Math.min(Math.max(1,Math.round(MO(i,"maxResults",80))),200),d=Array.isArray(o.matches)?o.matches.slice(0,u):[],p={...o,matches:d,truncated:o.truncated===!0||Array.isArray(o.matches)&&o.matches.length>u};return{output:CO(RO(p,r)),isError:!1}}})}const IO=Object.freeze(Object.defineProperty({__proto__:null,apply:LO,inject:zO,name:DO},Symbol.toStringTag,{value:"Module"})),UO=28e3;function BO(e,i=UO){return e.length<=i?e:`${e.slice(0,i)}
|
|
183
|
+
… truncated (${e.length-i} more characters)`}function $O(e){return e&&typeof e=="object"?e:{}}function mr(e){return typeof e=="string"?e:""}function dk(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function PO(e,i){const a=e[i];if(typeof a!="string"||!a.trim())throw new Error(`Missing string argument "${i}".`);return a}function HO(e){const i=[];mr(e.current)&&i.push(`Current branch: ${mr(e.current)}`),mr(e.branches)&&i.push(mr(e.branches)),mr(e.stdout)&&i.push(mr(e.stdout)),mr(e.stderr)&&i.push(`stderr:
|
|
184
|
+
${mr(e.stderr)}`);const a=dk(e.code);return a!==void 0&&a!==0&&i.push(`exit code: ${a}`),i.filter(Boolean).join(`
|
|
185
|
+
`)||"Git completed with no output."}const FO="tool-git",qO=["tools"];function GO(e){return e.tools.register({name:"git",description:"Inspect or change git state. In Plan mode only status, diff, log, show and branch are accepted.",parameters:{type:"object",properties:{action:{type:"string",enum:["status","diff","log","show","branch","add","commit","init","checkout"]},path:{type:"string",description:"Limit diff to this file."},staged:{type:"boolean",description:"Diff the staged changes."},ref:{type:"string",description:"Commit or ref for show."},limit:{type:"number",description:"Log limit."},paths:{type:"array",items:{type:"string"},description:"Files to stage."},message:{type:"string",description:"Commit message."},branch:{type:"string",description:"Branch to create or check out."},create:{type:"boolean",description:"Create a new branch. Defaults to true."}},required:["action"],additionalProperties:!1},allowedInMode:()=>!0,async execute(i,a){const r=PO(i,"action"),o={...i};delete o.action;const u=$O((await Xt("git",{action:r,...o},a.mode,a.signal)).result);return(r==="add"||r==="commit"||r==="init"||r==="checkout")&&await Be.getState().loadGit().catch(()=>{}),{output:BO(HO(u)),isError:(dk(u.code)??0)!==0}}})}const YO=Object.freeze(Object.defineProperty({__proto__:null,apply:GO,inject:qO,name:FO},Symbol.toStringTag,{value:"Module"})),VO=28e3;function S1(e,i=VO){return e.length<=i?e:`${e.slice(0,i)}
|
|
186
|
+
… truncated (${e.length-i} more characters)`}function _m(e){return e&&typeof e=="object"?e:{}}function hr(e){return typeof e=="string"?e:""}function T1(e,i){const a=e[i];if(typeof a!="string"||!a.trim())throw new Error(`Missing string argument "${i}".`);return a}const KO="tool-web",XO=["tools"];function ZO(e){const i=[e.tools.register({name:"web_search",description:"Search the web for current information. Returns titles, URLs and snippets. Cite URLs you use.",parameters:{type:"object",properties:{query:{type:"string",description:"Search query."}},required:["query"],additionalProperties:!1},allowedInMode:()=>!0,async execute(a,r){const o=T1(a,"query"),u=_m((await Xt("web_search",{query:o,provider:r.settings.searchProvider},r.mode,r.signal)).result),d=Array.isArray(u.results)?u.results:[];if(d.length===0)return{output:"No results found.",isError:!1};const p=d.map((h,g)=>{const x=_m(h);return`${g+1}. ${hr(x.title)}
|
|
187
|
+
${hr(x.url)}${hr(x.snippet)?`
|
|
188
|
+
${hr(x.snippet)}`:""}`}).join(`
|
|
189
|
+
|
|
190
|
+
`);return{output:S1(`Search: ${o}
|
|
191
|
+
Provider: ${hr(u.provider)||"web"}
|
|
192
|
+
|
|
193
|
+
${p}`),isError:!1}}}),e.tools.register({name:"read_url",description:"Read a public web page as plain text.",parameters:{type:"object",properties:{url:{type:"string",description:"The http(s) URL to read."}},required:["url"],additionalProperties:!1},allowedInMode:()=>!0,async execute(a,r){const o=T1(a,"url"),u=_m((await Xt("read_url",{url:o},r.mode,r.signal)).result),d=hr(u.title);return{output:S1(`Source: ${hr(u.url)||o}${d?`
|
|
194
|
+
Title: ${d}`:""}
|
|
195
|
+
|
|
196
|
+
${hr(u.content)}${u.truncated===!0?`
|
|
197
|
+
|
|
198
|
+
… page truncated.`:""}`),isError:!1}}})];return()=>i.forEach(a=>a())}const QO=Object.freeze(Object.defineProperty({__proto__:null,apply:ZO,inject:XO,name:KO},Symbol.toStringTag,{value:"Module"})),JO=28e3;function WO(e,i=JO){return e.length<=i?e:`${e.slice(0,i)}
|
|
199
|
+
… truncated (${e.length-i} more characters)`}const eM="tool-subagent",tM=["tools","subagents"];function nM(e){return e.tools.register({name:"subagent",description:"Delegate a focused investigation to a read-only subagent. Use it to explore a large area, trace a bug or verify assumptions without changing files. The subagent returns a concise report.",parameters:{type:"object",properties:{task:{type:"string",description:"The specific question or investigation to perform."},context:{type:"string",description:"Optional context, constraints or files to start from."}},required:["task"],additionalProperties:!1},allowedInMode:()=>!0,async execute(i,a){const r=typeof i.task=="string"?i.task:"",o=typeof i.context=="string"?i.context:"",u=await e.subagents.run(r,o,a.signal);return{output:WO(u),isError:!1}}})}const iM=Object.freeze(Object.defineProperty({__proto__:null,apply:nM,inject:tM,name:eM},Symbol.toStringTag,{value:"Module"}));function aM(e,i){const a=i.trim().toLowerCase();return e.find(r=>r.id.toLowerCase()===a||r.name.toLowerCase()===a)}function Tu(e,i){return typeof e[i]=="string"?String(e[i]).trim():""}const rM="tool-skill",sM=["tools"];function lM(e){const i=e.tools.register({name:"skill",description:'Work with installed skills. Use action "list" to see them, "read" to load a skill’s SKILL.md, and "run" to execute a command inside the skill folder.',parameters:{type:"object",properties:{action:{type:"string",enum:["list","read","run"],description:"What to do."},name:{type:"string",description:"Skill id or name. Required for read and run."},command:{type:"string",description:"Shell command to run inside the skill folder. Required for run."}},required:["action"],additionalProperties:!1},allowedInMode:()=>!0,async execute(a,r){const o=r.settings.skills.filter(p=>p.enabled),u=Tu(a,"action")||"list";if(u==="list")return o.length===0?{output:"No skills are installed.",isError:!1}:{output:o.map(p=>`${p.name} (${p.id})${p.package?` · ${p.package}`:""}
|
|
200
|
+
${p.description}`).join(`
|
|
201
|
+
`),isError:!1};const d=aM(o,Tu(a,"name"));if(!d)return{output:`No enabled skill matches "${Tu(a,"name")}". Call action "list" to see the available skills.`,isError:!0};if(u==="read"){const p=Object.keys(d.files??{});return{output:[`# ${d.name}`,d.description,d.package?`Package: ${d.package}`:"",p.length>0?`Files:
|
|
202
|
+
${p.map(h=>`- ${h}`).join(`
|
|
203
|
+
`)}`:"","---",d.instructions.trim()||"This skill has no instructions."].filter(Boolean).join(`
|
|
204
|
+
|
|
205
|
+
`),isError:!1}}if(u==="run"){if(r.mode==="plan")return{output:"Plan mode is read-only: skill scripts may change the machine, so they cannot run here.",isError:!0};const p=Tu(a,"command");if(!p)return{output:"Pass the command to run inside the skill folder.",isError:!0};if(!d.files||Object.keys(d.files).length===0)return{output:`"${d.name}" has no files to run. Install it from a folder or npm.`,isError:!0};const h=(await Xt("skill_run",{name:d.id,files:d.files,command:p},r.mode,r.signal)).result,g=typeof h.code=="number"?h.code:1;return{output:`${h.stdout??""}${h.stderr??""}`.trim()||`The skill command exited with code ${g} and printed nothing.`,isError:g!==0}}return{output:`Unknown skill action "${u}". Use list, read or run.`,isError:!0}}});return()=>i()}const oM=Object.freeze(Object.defineProperty({__proto__:null,apply:lM,inject:sM,name:rM},Symbol.toStringTag,{value:"Module"}));function cM(){const e=new pg;return e.plugin(lA),e.plugin(cA),e.plugin(pA),e.plugin(mA),e.plugin(MA),e.plugin(BA),e.plugin(qA),e.plugin(ZA),e.plugin(iO),e.plugin(lO),e.plugin(hO),e.plugin(SO),e.plugin(IO),e.plugin(YO),e.plugin(QO),e.plugin(iM),e.plugin(oM),e}const Yt=cM();function nd(e){Yt.agentLoop?Yt.agentLoop.stopRun(e):queueMicrotask(()=>Yt.agentLoop?.stopRun(e))}function uM(){Yt.agentLoop?Yt.agentLoop.stopAllRuns():queueMicrotask(()=>Yt.agentLoop?.stopAllRuns())}function fk(e,i){Yt.agentLoop?Yt.agentLoop.runAgent(e,i):queueMicrotask(()=>Yt.agentLoop?.runAgent(e,i))}function Sm(e){return Yt.agentLoop?Yt.agentLoop.regenerateLastTurn(e):!1}function pk(e){var i,a,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(i=0;i<o;i++)e[i]&&(a=pk(e[i]))&&(r&&(r+=" "),r+=a)}else for(a in e)e[a]&&(r&&(r+=" "),r+=a);return r}function dM(){for(var e,i,a=0,r="",o=arguments.length;a<o;a++)(e=arguments[a])&&(i=pk(e))&&(r&&(r+=" "),r+=i);return r}function W(...e){return dM(e)}function xl(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function id(e){const i=Math.round((Date.now()-e)/1e3);return i<60?"now":i<3600?`${Math.floor(i/60)}m`:i<86400?`${Math.floor(i/3600)}h`:i<604800?`${Math.floor(i/86400)}d`:new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function fM(e){const i=new Date,a=new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime(),r=a-864e5,o=a-6*864e5,u=a-29*864e5,d=[{label:"Today",items:[]},{label:"Yesterday",items:[]},{label:"Previous 7 days",items:[]},{label:"Previous 30 days",items:[]},{label:"Older",items:[]}],p=[...e].sort((h,g)=>g.updatedAt-h.updatedAt);for(const h of p){let g=4;h.updatedAt>=a?g=0:h.updatedAt>=r?g=1:h.updatedAt>=o?g=2:h.updatedAt>=u&&(g=3),d[g].items.push(h)}return d.filter(h=>h.items.length>0)}function pM(e){return new Promise((i,a)=>{const r=new FileReader;r.onload=()=>i(String(r.result)),r.onerror=()=>a(r.error??new Error("Could not read this file.")),r.readAsDataURL(e)})}function mM(e){return new Promise((i,a)=>{const r=new FileReader;r.onload=()=>i(String(r.result)),r.onerror=()=>a(r.error??new Error("Could not read this file.")),r.readAsText(e)})}function Nh(e,i,a="text/plain"){const r=new Blob([i],{type:a}),o=URL.createObjectURL(r),u=document.createElement("a");u.href=o,u.download=e,u.click(),URL.revokeObjectURL(o)}function bl({size:e=28,className:i,spin:a=!1}){return c.jsx("span",{className:W("inline-flex shrink-0 items-center justify-center text-accent",i),style:{width:e,height:e},"aria-hidden":"true",children:c.jsxs("svg",{viewBox:"0 0 32 32",width:e,height:e,fill:"none",className:W(a&&"animate-spin-slow"),children:[c.jsx("circle",{cx:"16",cy:"16",r:"5.1",fill:"currentColor"}),c.jsx("circle",{cx:"16",cy:"16",r:"8.4",stroke:"currentColor",strokeWidth:"0.9",opacity:"0.22"}),c.jsxs("g",{stroke:"currentColor",strokeWidth:"2.15",strokeLinecap:"round",children:[c.jsx("path",{d:"M16 4.4a11.6 11.6 0 0 1 9.7 5.5"}),c.jsx("path",{d:"M27.6 16a11.6 11.6 0 0 1-5.5 9.7",opacity:"0.6"}),c.jsx("path",{d:"M16 27.6a11.6 11.6 0 0 1-9.7-5.5",opacity:"0.32"}),c.jsx("path",{d:"M4.4 16a11.6 11.6 0 0 1 5.5-9.7",opacity:"0.8"})]}),c.jsx("g",{stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",children:c.jsx("path",{d:"M16 1.5v2.2M30.5 16h-2.2M16 30.5v-2.2M1.5 16h2.2",opacity:"0.9"})})]})})}function hM({compact:e=!1}){return c.jsxs("div",{className:"group/logo flex items-center gap-2",children:[c.jsx(bl,{size:e?20:22,className:"transition-transform duration-500 ease-out group-hover/logo:rotate-90"}),!e&&c.jsxs("span",{className:"text-[15px] font-semibold leading-none tracking-[-0.025em] text-ink",children:["Open",c.jsx("span",{className:"text-accent",children:"Sol"})]})]})}function gM(){return c.jsxs("p",{className:"text-[11px] tracking-[0.01em] text-faint",children:["OpenSol ",c.jsx("span",{className:"px-1 text-line",children:"/"})," by OpenSoftX"]})}function xM(e){return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}function bM(){const e=Ve(Q=>Q.sessions),i=Ve(Q=>Q.activeId),a=Ve(Q=>Q.setActive),r=Ve(Q=>Q.newChat),o=Ve(Q=>Q.renameSession),u=Ve(Q=>Q.deleteSession),d=Me(),p=Be(Q=>Q.info),h=Be(Q=>Q.addWorkspace),g=Be(Q=>Q.removeWorkspace),x=me(Q=>Q.sidebarCollapsed),b=me(Q=>Q.toggleSidebar),y=me(Q=>Q.mobileSidebarOpen),v=me(Q=>Q.setMobileSidebarOpen),w=me(Q=>Q.openSettings),T=me(Q=>Q.setWorkspaceOpen),E=me(Q=>Q.setDeployOpen),N=me(Q=>Q.setMcpOpen),j=me(Q=>Q.askConfirm),A=me(Q=>Q.notify),R=me(Q=>Q.focusComposer),$=Ra(Q=>Q.streaming),z=Ra(Q=>Q.titling),[C,L]=B.useState(""),[q,M]=B.useState(null),[H,Z]=B.useState(null),[he,se]=B.useState(""),[ae,O]=B.useState(""),ee=B.useMemo(()=>{const Q=C.trim().toLowerCase();return Q?e.filter(Pe=>Pe.title.toLowerCase().includes(Q)):e},[e,C]),te=B.useMemo(()=>fM(ee),[ee]),be=B.useMemo(()=>[...p.workspaces].sort((Q,Pe)=>Pe.lastOpened-Q.lastOpened),[p.workspaces]),S=hl(d),ve=(d.daemon?.home??"").split(/[\\/]/).filter(Boolean).pop()||p.name||"Local",ce=()=>{r(),v(!1),M(null),R()},D=Q=>{a(Q),v(!1),M(null)},U=async Q=>{if(Q===p.root){T(!0),v(!1);return}O(Q);try{await h(Q),v(!1)}catch(Pe){A(Pe instanceof Error?Pe.message:"Could not open that folder.","error")}finally{O("")}},re=async(Q,Pe)=>{if(await j({title:"Remove this workspace?",body:`“${Pe}” is removed from OpenSol's list. The folder and its files stay on your disk; conversations started there are kept.`,confirmLabel:"Remove workspace",tone:"danger"}))try{await g(Q),A(`Removed ${Pe} from your workspaces.`,"success")}catch(et){A(et instanceof Error?et.message:"Could not remove that workspace.","error")}},ge=async Q=>{M(null),await Yt.titles?.generate(Q,{force:!0})||A("The model could not suggest a title right now.","error")},_e=(Q,Pe)=>{Z(Q),se(Pe),M(null)},Ue=()=>{H&&(he.trim()&&o(H,he),Z(null),se(""))},de=async(Q,Pe)=>{M(null),await j({title:"Delete this conversation?",body:`“${Pe}” and its messages will be removed from this computer. This cannot be undone.`,confirmLabel:"Delete conversation",tone:"danger"})&&(nd(Q),u(Q))},Ne=Q=>{const Pe=e.find(et=>et.id===Q);if(!Pe)return;M(null);const ne=Pe.messages.flatMap(et=>et.role==="user"?[`## You
|
|
206
|
+
|
|
207
|
+
${et.content}`]:et.role==="assistant"&&et.content.trim()?[`## OpenSol
|
|
208
|
+
|
|
209
|
+
${et.content.trim()}`]:[]).join(`
|
|
210
|
+
|
|
211
|
+
`);Nh(`opensol-${Pe.title.toLowerCase().replace(/[^a-z0-9]+/g,"-").slice(0,40)||"conversation"}.md`,`# ${Pe.title}
|
|
212
|
+
|
|
213
|
+
${ne}
|
|
214
|
+
`,"text/markdown"),A("Conversation exported as Markdown.","success")},ye=Q=>{const Pe=e.find(ne=>ne.id===Q);Pe&&(M(null),Nh(`opensol-${Pe.title.toLowerCase().replace(/[^a-z0-9]+/g,"-").slice(0,40)||"conversation"}.json`,JSON.stringify({app:"OpenSol",exportedAt:new Date().toISOString(),session:Pe},null,2),"application/json"),A("Conversation exported.","success"))};return c.jsxs("aside",{className:W("fixed inset-y-0 left-0 z-50 flex h-dvh w-[264px] shrink-0 flex-col bg-canvas shadow-float transition-transform duration-300 ease-out lg:static lg:z-auto lg:shadow-none",y?"translate-x-0":"-translate-x-full lg:translate-x-0",x&&"lg:hidden"),children:[c.jsxs("div",{className:"flex h-12 items-center gap-1 pl-3 pr-2",children:[c.jsx(hM,{}),c.jsx("button",{type:"button",className:"icon-button ml-auto hidden lg:inline-flex",onClick:b,title:"Collapse sidebar (Ctrl B)","aria-label":"Collapse sidebar",children:c.jsx(YT,{size:16,strokeWidth:1.7})}),c.jsx("button",{type:"button",className:"icon-button ml-auto lg:hidden",onClick:()=>v(!1),"aria-label":"Close menu",children:c.jsx(Ni,{size:17})})]}),c.jsxs("nav",{className:"space-y-0.5 px-2 pt-1",children:[c.jsxs("button",{type:"button",onClick:ce,className:"group/new mb-2 flex h-9 w-full items-center gap-2 rounded-lg border border-line bg-panel px-2.5 text-left text-[13px] font-medium text-ink shadow-pill transition-all duration-150 hover:border-accent/40 hover:shadow-composer active:scale-[0.985]",children:[c.jsx(ns,{size:15,strokeWidth:2,className:"text-accent transition-transform duration-300 group-hover/new:rotate-90"}),"New chat"]}),c.jsxs("button",{type:"button",onClick:()=>{v(!1),w("skills")},className:"nav-item",children:[c.jsx(Wn,{size:15,strokeWidth:1.7,className:"shrink-0 text-faint"}),"Skills"]}),c.jsxs("button",{type:"button",disabled:!0,title:"Plugins are disabled for maintenance",className:"nav-item cursor-not-allowed opacity-45",children:[c.jsx(eg,{size:15,strokeWidth:1.7,className:"shrink-0 text-faint"}),"Plugins",c.jsx("span",{className:"ml-auto rounded bg-raised px-1.5 py-0.5 text-[8.5px] font-medium text-faint",children:"maintenance"})]}),c.jsxs("button",{type:"button",onClick:()=>{v(!1),N(!0)},className:"nav-item",children:[c.jsx(tg,{size:15,strokeWidth:1.7,className:"shrink-0 text-faint"}),"MCP"]}),c.jsxs("button",{type:"button",onClick:()=>{v(!1),E(!0)},className:"nav-item",children:[c.jsx(vr,{size:15,strokeWidth:1.7,className:"shrink-0 text-faint"}),"Deploy"]}),c.jsxs("div",{className:"relative",children:[c.jsx(os,{size:15,strokeWidth:1.7,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-faint"}),c.jsx("input",{value:C,onChange:Q=>L(Q.target.value),placeholder:"Search",className:"mt-1 h-8 w-full rounded-lg border border-transparent bg-transparent pl-[34px] pr-2.5 text-[13px] text-ink outline-none transition-colors placeholder:text-muted hover:bg-raised/80 focus:border-line focus:bg-panel","aria-label":"Search conversations"})]})]}),c.jsxs("div",{className:"thin-scroll min-h-0 flex-1 overflow-y-auto px-2 pb-2 pt-5",children:[c.jsxs("div",{className:"mb-5",children:[c.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-1.5",children:[c.jsx("p",{className:"eyebrow",children:"Workspaces"}),c.jsx("button",{type:"button",onClick:()=>{v(!1),T(!0)},className:"flex h-6 w-6 items-center justify-center rounded-md text-faint transition-colors hover:bg-raised hover:text-ink",title:"Open another folder","aria-label":"Open another folder",children:c.jsx(ns,{size:13})})]}),be.length===0?c.jsxs("button",{type:"button",onClick:()=>{v(!1),T(!0)},className:"flex w-full items-center gap-2 rounded-lg border border-dashed border-line px-2.5 py-2.5 text-left text-[13px] text-muted transition-colors hover:border-faint/50 hover:text-ink",children:[c.jsx(Ro,{size:15,strokeWidth:1.6,className:"text-faint"}),"Open a project folder"]}):c.jsx("div",{className:"space-y-0.5",children:be.map(Q=>{const Pe=Q.path===p.root;return c.jsxs("div",{className:"group/ws relative",children:[c.jsxs("button",{type:"button",onClick:()=>{U(Q.path)},title:Q.path,className:W("flex h-8 w-full items-center gap-2.5 rounded-lg px-2.5 pr-8 text-left text-[13px] transition-all duration-150 active:scale-[0.985]",Pe?"bg-raised text-ink":"text-muted hover:bg-raised/80 hover:text-ink"),children:[c.jsx(Ro,{size:15,strokeWidth:1.6,className:W("shrink-0 transition-transform duration-200 group-hover/ws:-rotate-6 group-hover/ws:scale-110",Pe?"text-accent":"text-faint")}),c.jsx("span",{className:"min-w-0 flex-1 truncate",children:Q.name}),ae===Q.path?c.jsx(Qh,{size:11,className:"shrink-0 animate-spin text-faint"}):Pe?c.jsx(Cn,{size:11,className:"shrink-0 text-accent"}):c.jsx("span",{className:"shrink-0 text-[10px] tabular-nums text-faint transition-opacity group-hover/ws:opacity-0",children:id(Q.lastOpened)})]}),c.jsx("button",{type:"button",onClick:()=>{re(Q.path,Q.name)},className:"absolute right-1 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-md text-faint opacity-0 transition-all hover:bg-danger/10 hover:text-danger focus:opacity-100 group-hover/ws:opacity-100",title:"Remove workspace from the list","aria-label":`Remove workspace ${Q.name}`,children:c.jsx(la,{size:12})})]},Q.path)})})]}),c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-1.5",children:[c.jsx("p",{className:"eyebrow",children:"Recents"}),c.jsx("span",{className:"text-[11px] tabular-nums text-faint",children:ee.length})]}),te.length===0&&c.jsxs("div",{className:"px-2 py-7 text-center",children:[c.jsx("p",{className:"text-[13px] font-medium text-muted",children:C?"No conversations match":"No conversations yet"}),c.jsx("p",{className:"mt-1 text-[11.5px] leading-relaxed text-faint",children:C?"Try a shorter search.":"Start with a task, a question or a file."})]}),te.map((Q,Pe)=>c.jsxs("div",{className:"mb-3",children:[c.jsx("p",{className:"px-2.5 pb-1 pt-1 text-[11px] font-medium text-faint/80",children:Q.label}),c.jsx("div",{className:"space-y-0.5",children:Q.items.map((ne,et)=>c.jsx("div",{className:"group/item relative animate-slideleft",style:{animationDelay:`${Math.min(Pe*40+et*18,320)}ms`},children:H===ne.id?c.jsx("input",{value:he,onChange:Ae=>se(Ae.target.value),onBlur:Ue,onKeyDown:Ae=>{Ae.key==="Enter"&&Ue(),Ae.key==="Escape"&&(Z(null),se(""))},autoFocus:!0,className:"h-8 w-full rounded-lg border border-accent/50 bg-panel px-2.5 text-[13px] text-ink outline-none","aria-label":"Rename conversation"}):c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",onClick:()=>D(ne.id),onDoubleClick:()=>_e(ne.id,ne.title),title:`${ne.title} · ${id(ne.updatedAt)}`,className:W("sidebar-item pr-9",i===ne.id&&"sidebar-item-active"),children:[c.jsx("span",{className:W("min-w-0 flex-1 truncate",z[ne.id]&&"text-shimmer"),children:ne.title}),$[ne.id]&&c.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-[10.5px] font-medium text-accent group-hover/item:hidden",title:"Agent is running",children:[c.jsx("span",{className:"h-1.5 w-1.5 animate-breathe rounded-full bg-accent"}),"running"]})]}),c.jsx("button",{type:"button",onClick:Ae=>{if(Ae.stopPropagation(),q?.id===ne.id){M(null);return}const rt=Ae.currentTarget.getBoundingClientRect(),Ke=176,It=166,jn=Math.max(8,Math.min(rt.right-Ke,window.innerWidth-Ke-8)),xn=rt.bottom+It+8>window.innerHeight?Math.max(8,rt.top-It-4):rt.bottom+4;M({id:ne.id,x:jn,y:xn})},className:W("absolute right-1 top-1/2 flex h-7 w-7 -translate-y-1/2 items-center justify-center rounded-md text-faint transition-all hover:bg-panel hover:text-ink",q?.id===ne.id?"flex bg-panel text-ink opacity-100":"opacity-0 group-hover/item:opacity-100 focus:opacity-100"),"aria-label":`Actions for ${ne.title}`,title:"Conversation actions",children:c.jsx(U2,{size:14})})]})},ne.id))})]},Q.label))]})]}),c.jsx("div",{className:"p-2",children:c.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg px-1.5 py-1.5 transition-colors hover:bg-raised/80",children:[c.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-ink text-[12px] font-semibold text-panel",children:ve.charAt(0).toUpperCase()}),c.jsxs("button",{type:"button",onClick:()=>{v(!1),w("models")},className:"min-w-0 flex-1 text-left",children:[c.jsx("p",{className:"truncate text-[13px] font-medium leading-tight text-ink",children:ve}),c.jsx("p",{className:"mt-0.5 truncate text-[11px] leading-tight text-faint",children:S?`${sg(d.provider)}${d.provider==="ollama"?" · local":" · your key"}`:"Add a provider key"})]}),c.jsx("button",{type:"button",className:"icon-button h-8 w-8",onClick:()=>{v(!1),w("appearance")},title:"Preferences","aria-label":"Preferences",children:c.jsx(dw,{size:16,strokeWidth:1.7})})]})}),q&&c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",tabIndex:-1,"aria-label":"Close conversation menu",className:"fixed inset-0 z-[60] cursor-default bg-transparent",onClick:()=>M(null)}),c.jsx("div",{className:"surface-lift fixed z-[70] w-[184px] overflow-hidden rounded-xl border border-line p-1 shadow-float",style:{left:q.x,top:q.y},children:(()=>{const Q=e.find(Pe=>Pe.id===q.id);return Q?c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",onClick:()=>_e(Q.id,Q.title),className:"flex h-7 w-full items-center gap-2 rounded-md px-2 text-left text-[11.5px] text-muted hover:bg-raised hover:text-ink",children:[c.jsx(Fo,{size:12})," Rename"]}),c.jsxs("button",{type:"button",onClick:()=>{ge(Q.id)},className:"flex h-7 w-full items-center gap-2 rounded-md px-2 text-left text-[11.5px] text-muted hover:bg-raised hover:text-ink",children:[c.jsx(Wn,{size:12})," Name with AI"]}),c.jsxs("button",{type:"button",onClick:()=>ye(Q.id),className:"flex h-7 w-full items-center gap-2 rounded-md px-2 text-left text-[11.5px] text-muted hover:bg-raised hover:text-ink",children:[c.jsx(iw,{size:12})," Export JSON"]}),c.jsxs("button",{type:"button",onClick:()=>Ne(Q.id),className:"flex h-7 w-full items-center gap-2 rounded-md px-2 text-left text-[11.5px] text-muted hover:bg-raised hover:text-ink",children:[c.jsx(Pn,{size:12})," Export Markdown"]}),c.jsx("div",{className:"my-1 border-t border-line"}),c.jsxs("button",{type:"button",onClick:()=>{de(Q.id,Q.title)},className:"flex h-7 w-full items-center gap-2 rounded-md px-2 text-left text-[11.5px] text-danger hover:bg-danger/[0.06]",children:[c.jsx(la,{size:12})," Delete"]}),c.jsxs("p",{className:"px-2 pb-1 pt-1.5 text-[9px] text-faint",children:["Updated ",xM(Q.updatedAt)]})]}):null})()})]})]})}const yM={wave:"Ready when you are",idle:"Standing by",thinking:"Thinking it through…",working:"Running tools…",typing:"Writing the answer…",happy:"Answer ready",alert:"Needs your approval",error:"Hit a snag",sleepy:"Waiting for the next turn",party:"All steps finished"};function vM(e,i){if(e.length===0)return"wave";const a=e[e.length-1];return a.role==="tool"?a.status==="awaiting"?"alert":a.status==="error"?"error":i||a.status==="running"?"working":"party":a.role==="assistant"?a.error?"error":i?a.reasoning.trim()&&!a.content.trim()?"thinking":"typing":a.stopped?"sleepy":a.content.trim()?"happy":"idle":i?"working":"idle"}const mk=864e5,C1=26;function gg(e){const i=new Date(e);return i.setHours(0,0,0,0),i.getTime()}function hk(e){const i=new Date(e);return`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`}function wM(e,i){return e==="all"?0:gg(i)-(e==="7d"?6:29)*mk}function j1(e,i){return typeof e.createdAt=="number"?e.createdAt:i}function kM(e){if(e.role!=="assistant")return 0;const i=e.usage;if(i&&(i.input||i.output))return(i.input??0)+(i.output??0);const a=`${e.content??""}${e.reasoning??""}`;return a.trim()?Math.ceil(a.length/4):0}function NM(e){return e===0?"12 AM":e===12?"12 PM":e<12?`${e} AM`:`${e-12} PM`}function EM(e,i,a=Date.now()){const r=wM(i,a),o=e.filter(N=>N.updatedAt>=r),u=[];for(const N of o)for(const j of N.messages)j1(j,N.updatedAt)>=r&&u.push({message:j,session:N});const d=new Array(24).fill(0),p=new Map,h=new Map;let g=0,x=0;for(const{message:N,session:j}of u){const A=j1(N,j.updatedAt),R=hk(A),$=p.get(R);if($?$.count+=1:p.set(R,{key:R,count:1,date:gg(A)}),d[new Date(A).getHours()]+=1,N.role!=="assistant")continue;const z=kM(N);g+=z,typeof N.usage?.cost=="number"&&Number.isFinite(N.usage.cost)&&(x+=Math.max(0,N.usage.cost));const C=typeof N.model=="string"?N.model.trim():"";if(!C)continue;const L=h.get(C)??{model:C,messages:0,tokens:0};L.messages+=1,L.tokens+=z,h.set(C,L)}const b=[...h.values()].sort((N,j)=>j.tokens-N.tokens||j.messages-N.messages||N.model.localeCompare(j.model)),y=b[0],v=u.filter(N=>N.message.role==="assistant").length;let w=0;for(let N=1;N<24;N+=1)d[N]>d[w]&&(w=N);const T=_M(p,a),E=T.reduce((N,j)=>Math.max(N,j.count),0);return{sessions:o.length,messages:u.length,tokens:g,credits:x,activeDays:p.size,peakHour:u.length?NM(w):"—",favoriteModel:y?.model??"—",favoriteShare:y&&v?Math.round(y.messages/v*100):0,models:b,heatmap:T,busiestDay:E}}function _M(e,i){const a=new Date(gg(i)),r=new Date(a);r.setDate(r.getDate()-r.getDay()-(C1-1)*7);const o=[];for(let u=0;u<C1*7;u+=1){const d=r.getTime()+u*mk,p=hk(d);o.push(e.get(p)??{key:p,count:0,date:d})}return o}function jo(e){return e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:1)}M`:e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}k`:String(e)}function A1(e){return e?e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(2)}`:"—"}function Tm(e){if(!e||e==="—")return e;const i=e.split("/");return i[i.length-1]||e}function SM(e){return!!(e.content.trim()||e.reasoning.trim()||e.error||e.stopped)}function TM(e){const i=[];let a=null,r=[];const o=()=>{r.length>0&&a?.segments.push({kind:"tools",tools:r}),r=[]};for(const u of e){if(u.role==="tool"){if(!a)continue;r.push(u);continue}if(u.role==="user"){o(),a={id:u.id,user:u,segments:[]},i.push(a);continue}!SM(u)&&u.toolCalls.length>0||(a||(a={id:u.id,segments:[]},i.push(a)),o(),a.segments.push({kind:"assistant",message:u}))}return o(),i}function O1(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}k`:String(e)}function CM({messages:e,model:i,sessionId:a}){const r=B.useMemo(()=>lk(e,i),[e,i]),o=a?ak(a):!1;if(e.length===0)return null;const{pct:u,used:d,limit:p}=r,h=u>=ok*100,g=u>=70&&!h;return c.jsx("div",{className:W("hidden items-baseline gap-1.5 text-[11.5px] tabular-nums text-muted sm:flex",g&&"text-warning",h&&"text-danger"),title:`Context window: ~${d.toLocaleString()} of ${p.toLocaleString()} tokens used (${u}%)`,children:o?c.jsx("span",{className:"text-shimmer",children:"Compacting…"}):c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-ink/80",children:O1(d)}),c.jsxs("span",{className:"text-faint",children:["/ ",O1(p)," tokens"]}),c.jsx("span",{className:"text-faint",children:"·"}),c.jsxs("span",{children:[u,"%"]})]})})}var Vo=ew();function Ko({open:e,onClose:i,children:a,className:r,labelledBy:o,wide:u=!1}){const d=B.useRef(null),p=B.useRef(null),h=B.useRef(i);return h.current=i,B.useEffect(()=>{if(!e)return;p.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const g=d.current,x=()=>Array.from(g?.querySelectorAll('button:not([disabled]), a[href], input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])')??[]).filter(w=>w.offsetParent!==null),b=window.setTimeout(()=>{(g?.querySelector("[data-autofocus]")??x()[0]??g)?.focus()},30),y=w=>{if(w.key==="Escape"){w.preventDefault(),h.current();return}if(w.key!=="Tab")return;const T=x();if(T.length===0)return;const E=T[0],N=T[T.length-1];w.shiftKey&&document.activeElement===E?(w.preventDefault(),N.focus()):!w.shiftKey&&document.activeElement===N&&(w.preventDefault(),E.focus())};document.addEventListener("keydown",y);const v=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.clearTimeout(b),document.removeEventListener("keydown",y),document.body.style.overflow=v,p.current?.focus()}},[e]),e?Vo.createPortal(c.jsxs("div",{className:"fixed inset-0 z-[80] flex items-end justify-center p-0 sm:items-center sm:p-6",children:[c.jsx("button",{type:"button","aria-label":"Close dialog",tabIndex:-1,onClick:i,className:"modal-scrim absolute inset-0 cursor-default bg-black/35 backdrop-blur-[3px] dark:bg-black/60"}),c.jsx("div",{ref:d,role:"dialog","aria-modal":"true","aria-labelledby":o,tabIndex:-1,className:W("modal-panel relative flex max-h-[92dvh] w-full flex-col overflow-hidden rounded-t-2xl border border-line surface-lift shadow-float sm:max-h-[86dvh] sm:rounded-xl",u?"sm:w-[min(920px,94vw)]":"sm:w-[min(760px,94vw)]",r),children:a})]}),document.body):null}function jM({title:e,description:i,onClose:a,id:r,actions:o}){return c.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-line px-5 py-4 sm:px-6",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("h2",{id:r,className:"text-[15px] font-semibold tracking-[-0.02em] text-ink",children:e}),i&&c.jsx("p",{className:"mt-1 text-[12.5px] leading-relaxed text-muted",children:i})]}),c.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[o,c.jsx("button",{type:"button",className:"icon-button",onClick:a,"aria-label":"Close",children:c.jsx(Ni,{size:16})})]})]})}function Pt({size:e=14,className:i}){return c.jsx(Qh,{size:e,className:W("animate-spin text-current",i),"aria-hidden":"true"})}function Hi({checked:e,onChange:i,label:a,disabled:r=!1}){return c.jsx("button",{type:"button",role:"switch","aria-label":a,"aria-checked":e,disabled:r,onClick:()=>i(!e),className:W("relative inline-flex h-[22px] w-[38px] shrink-0 items-center rounded-full border transition-colors duration-200 disabled:opacity-40",e?"border-accent bg-accent":"border-line bg-raised"),children:c.jsx("span",{className:W("pointer-events-none block h-[16px] w-[16px] rounded-full bg-white shadow-sm transition-transform duration-300 ease-spring",e?"translate-x-[19px]":"translate-x-[3px]")})})}function xg({options:e,value:i,onChange:a,disabled:r,className:o,size:u="sm"}){return c.jsx("div",{className:W("inline-flex items-center rounded-lg bg-raised p-0.5",u==="md"?"text-[12.5px]":"text-[11.5px]",r&&"opacity-50",o),children:e.map(d=>c.jsx("button",{type:"button",title:d.title,disabled:r,onClick:()=>a(d.value),className:W("rounded-md font-medium transition-all duration-200 disabled:cursor-not-allowed",u==="md"?"px-3 py-1.5":"px-2.5 py-1",i===d.value?"bg-panel text-ink shadow-[0_1px_2px_rgba(20,22,30,0.08)]":"text-muted hover:text-ink"),children:d.label},d.value))})}const AM={info:{icon:Kh,className:"text-accent"},success:{icon:_2,className:"text-success"},error:{icon:T2,className:"text-danger"}};function OM(){const e=me(o=>o.toast),i=me(o=>o.dismissToast);if(B.useEffect(()=>{if(!e)return;const o=window.setTimeout(()=>i(e.id),4500);return()=>window.clearTimeout(o)},[e,i]),!e)return null;const a=AM[e.tone],r=a.icon;return Vo.createPortal(c.jsxs("div",{className:"pointer-events-none fixed bottom-56 left-1/2 z-[100] flex w-[min(92vw,440px)] -translate-x-1/2 animate-scalein items-start gap-2.5 rounded-xl border border-line surface-lift px-3.5 py-3 text-[12.5px] text-ink shadow-float sm:bottom-48",role:"status",children:[c.jsx(r,{size:16,className:W("mt-0.5 shrink-0",a.className)}),c.jsx("p",{className:"flex-1 leading-relaxed",children:e.message}),c.jsx("button",{type:"button",className:"pointer-events-auto icon-button -mr-1 -mt-1 h-6 w-6",onClick:()=>i(e.id),"aria-label":"Dismiss",children:c.jsx(Ni,{size:13})})]}),document.body)}function MM(){const e=me(r=>r.confirm),i=me(r=>r.resolveConfirm),a=e?.tone==="danger";return c.jsx(Ko,{open:!!e,onClose:()=>i(!1),className:"sm:w-[420px]",children:c.jsxs("div",{className:"p-5 sm:p-6",children:[c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("span",{className:W("mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-full",a?"bg-danger/10 text-danger":"bg-accent-soft text-accent"),children:c.jsx(OC,{size:17})}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("h2",{className:"text-[15px] font-semibold tracking-[-0.01em]",children:e?.title}),c.jsx("p",{className:"mt-1.5 text-[12.5px] leading-relaxed text-muted",children:e?.body})]})]}),c.jsxs("div",{className:"mt-6 flex justify-end gap-2",children:[c.jsx("button",{type:"button",className:"chip",onClick:()=>i(!1),children:"Cancel"}),c.jsxs("button",{type:"button","data-autofocus":!0,onClick:()=>i(!0),className:W("inline-flex h-8 items-center gap-1.5 rounded-lg px-3 text-[12.5px] font-medium text-on-accent transition-all active:scale-95",a?"bg-danger hover:bg-danger/90":"bg-accent hover:bg-accent/90"),children:[c.jsx(Cn,{size:14}),e?.confirmLabel??"Confirm"]})]})]})})}const RM=[{id:"shared",label:"Shared prompt",hint:"The general prompt from Settings → Models."},{id:"workspace",label:"This workspace",hint:"Applies to every session opened in this folder."},{id:"session",label:"This session",hint:"Only this conversation. Overrides the workspace prompt."}];function DM({session:e,open:i,onClose:a}){const r=Me(),o=Me(j=>j.update),u=Ve(j=>j.updateSession),d=me(j=>j.notify),p=Be(j=>j.root),h=e?.workspace||p||"",g=h?r.workspacePrompts[h]??"":"",x=e?.systemPrompt??"",b=x.trim()?"session":g.trim()?"workspace":"shared",[y,v]=B.useState(b),[w,T]=B.useState("");B.useEffect(()=>{i&&(v(b),T(b==="session"?x:b==="workspace"?g:""))},[i,b,x,g]);const E=y==="shared"?r.systemPrompt:w,N=()=>{if(y==="shared"){e&&u(e.id,{systemPrompt:""}),h&&o({workspacePrompts:{...r.workspacePrompts,[h]:""}}),d("Using the shared system prompt.","success"),a();return}if(y==="workspace"){if(!h){d("Open a workspace folder before saving a workspace prompt.","error");return}const A=w.trim();if(!A){d("Write a prompt or choose the shared prompt.","error");return}o({workspacePrompts:{...r.workspacePrompts,[h]:A}}),e&&u(e.id,{systemPrompt:""}),d("Workspace system prompt saved.","success"),a();return}if(!e)return;const j=w.trim();if(!j){d("Write a prompt or choose the shared prompt.","error");return}u(e.id,{systemPrompt:j}),d("Session system prompt saved.","success"),a()};return c.jsxs(Ko,{open:i,onClose:a,labelledBy:"system-prompt-title",children:[c.jsx(jM,{id:"system-prompt-title",title:"System prompt",description:"Choose what the model is told before this conversation. Session overrides workspace, which overrides the shared prompt.",onClose:a}),c.jsxs("div",{className:"thin-scroll min-h-0 flex-1 overflow-y-auto p-5",children:[c.jsx("div",{className:"grid gap-1.5 sm:grid-cols-3",children:RM.map(j=>{const A=y===j.id,R=j.id==="workspace"&&!h;return c.jsxs("button",{type:"button",disabled:R,onClick:()=>{v(j.id),T(j.id==="workspace"?g:j.id==="session"?x:"")},className:W("rounded-xl border px-3 py-2.5 text-left transition-colors disabled:cursor-not-allowed disabled:opacity-40",A?"border-accent/40 bg-accent-soft":"border-line bg-panel hover:bg-raised/60"),children:[c.jsxs("span",{className:W("flex items-center gap-1.5 text-[11.5px] font-medium",A?"text-accent":"text-ink"),children:[c.jsx(ow,{size:11}),j.label]}),c.jsx("span",{className:"mt-1 block text-[9.5px] leading-relaxed text-faint",children:j.hint})]},j.id)})}),c.jsxs("div",{className:"mt-4",children:[c.jsxs("div",{className:"mb-1 flex items-center justify-between gap-3",children:[c.jsx("span",{className:"text-[10.5px] font-medium text-muted",children:y==="shared"?"Shared prompt (edited in Settings → Models)":y==="workspace"?`Workspace prompt · ${h}`:"Session prompt"}),y!=="shared"&&c.jsxs("button",{type:"button",onClick:()=>T(Lo),className:"inline-flex items-center gap-1 text-[9.5px] font-medium text-faint hover:text-ink",children:[c.jsx(ng,{size:10})," Start from default"]})]}),c.jsx("textarea",{value:E,onChange:j=>{y==="shared"?o({systemPrompt:j.target.value}):T(j.target.value)},readOnly:y==="shared",rows:11,spellCheck:!1,"data-autofocus":!0,className:"thin-scroll w-full resize-y rounded-xl border border-line bg-canvas/50 px-3 py-2.5 font-mono text-[10.5px] leading-relaxed text-ink outline-none focus:border-accent/50 read-only:opacity-70",placeholder:"You are a focused React reviewer…"}),c.jsx("p",{className:"mt-1.5 text-[9px] leading-relaxed text-faint",children:"Workspace context, project instructions, skills and tool rules are appended after this prompt. A custom prompt replaces the shared one."})]})]}),c.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-2 border-t border-line px-5 py-3",children:[c.jsx("button",{type:"button",onClick:a,className:"chip h-8 px-3 text-[11px]",children:"Cancel"}),c.jsxs("button",{type:"button",onClick:N,className:"inline-flex h-8 items-center gap-1.5 rounded-lg bg-accent px-3 text-[11px] font-medium text-on-accent hover:bg-accent/90",children:[c.jsx(Cn,{size:12})," Save"]})]})]})}const zM=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform);function LM({session:e,view:i,onViewChange:a}){const r=Me(),o=Me(C=>C.update),u=me(C=>C.sidebarCollapsed),d=me(C=>C.toggleSidebar),p=me(C=>C.setMobileSidebarOpen),h=me(C=>C.setPaletteOpen),g=me(C=>C.openSettings),x=me(C=>C.workspaceOpen),b=me(C=>C.setWorkspaceOpen),y=me(C=>C.setDeployOpen),v=Be(C=>C.info),w=Be(C=>C.root),T=Ad(),[E,N]=B.useState(!1),j=e?.workspace||w||"",A=!!(e?.systemPrompt?.trim()||j&&r.workspacePrompts[j]?.trim()),R=ch(r.theme,typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches),$=!!(e&&e.messages.length>0),z=e?.messages.filter(C=>C.role==="user").length??0;return c.jsxs("header",{className:"relative flex h-12 shrink-0 items-center gap-2 border-b border-line/60 bg-panel/80 px-3 backdrop-blur-xl sm:px-4",children:[c.jsx("button",{type:"button",className:"icon-button lg:hidden",onClick:()=>p(!0),"aria-label":"Open menu",children:c.jsx(LT,{size:18})}),u&&c.jsx("button",{type:"button",className:"icon-button hidden lg:inline-flex",onClick:d,title:"Expand sidebar","aria-label":"Expand sidebar",children:c.jsx(KT,{size:17})}),c.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[!e&&c.jsx(bl,{size:19,className:"lg:hidden"}),v.available&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hidden max-w-[120px] shrink-0 truncate text-[13px] text-faint md:inline",children:v.name}),c.jsx("span",{className:"hidden text-faint/50 md:inline",children:"/"})]}),c.jsx("h1",{className:"min-w-0 truncate text-[13.5px] font-medium tracking-[-0.01em] text-ink",children:e?.title??"New conversation"}),$&&c.jsxs("span",{className:"hidden shrink-0 items-center gap-1 rounded-md border border-line bg-canvas px-1.5 py-0.5 text-[10.5px] font-medium text-muted sm:inline-flex",children:[r.mode==="plan"?c.jsx(Zh,{size:11}):c.jsx(Wn,{size:11}),r.mode==="plan"?"Plan mode":"Build mode"]}),$&&c.jsxs("span",{className:"hidden shrink-0 text-[11.5px] tabular-nums text-faint md:inline",children:[z," turn",z===1?"":"s"]})]}),$&&c.jsx("div",{className:"absolute left-1/2 hidden -translate-x-1/2 items-center rounded-lg bg-raised p-0.5 md:inline-flex",children:["chat","trajectory"].map(C=>c.jsx("button",{type:"button",onClick:()=>a(C),"aria-pressed":i===C,className:W("h-6 rounded-md px-3 text-[11.5px] font-medium capitalize transition-all duration-200",i===C?"bg-panel text-ink shadow-pill":"text-muted hover:text-ink"),children:C},C))}),c.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[$&&c.jsx("div",{className:"mr-3 hidden sm:block",children:c.jsx(CM,{messages:e?.messages??[],model:T,sessionId:e?.id??null})}),c.jsxs("button",{type:"button",className:W("icon-button relative hidden sm:inline-flex",A&&"text-accent"),onClick:()=>N(!0),disabled:!e,title:A?"Custom system prompt for this session or workspace":"Edit the system prompt for this session","aria-label":"Edit system prompt",children:[c.jsx(ow,{size:16}),A&&c.jsx("span",{className:"absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-accent"})]}),c.jsxs("button",{type:"button",onClick:()=>b(!x),title:v.available?v.root:"Choose a workspace folder",className:W("mr-1 hidden min-w-0 items-center gap-1.5 rounded-lg border px-2.5 py-1 text-[12px] transition-all duration-150 sm:inline-flex",x?"border-accent/30 bg-accent-soft text-accent":"border-line text-muted hover:bg-raised/60 hover:text-ink"),children:[c.jsx(ls,{size:13,className:"shrink-0"}),c.jsx("span",{className:"max-w-[140px] truncate",children:v.available?v.name:"No folder"})]}),c.jsx("button",{type:"button",className:"icon-button hidden sm:inline-flex",onClick:()=>y(!0),title:"Deploy the open workspace or another project","aria-label":"Deploy",children:c.jsx(vr,{size:16,strokeWidth:1.7})}),c.jsx("button",{type:"button",className:"icon-button",onClick:()=>h(!0),title:`Search and commands (${zM?"⌘":"Ctrl"} K)`,"aria-label":"Open search and commands",children:c.jsx(os,{size:16})}),c.jsx("button",{type:"button",className:"icon-button hidden sm:inline-flex",onClick:()=>o({theme:R?"light":"dark"}),title:R?"Switch to light theme":"Switch to dark theme","aria-label":"Toggle theme",children:R?c.jsx(ag,{size:16}):c.jsx(Wh,{size:16})}),c.jsx("button",{type:"button",className:"icon-button",onClick:()=>g("general"),title:"Settings","aria-label":"Open settings",children:c.jsx(dw,{size:16})})]}),c.jsx(DM,{session:e,open:E,onClose:()=>N(!1)})]})}const bg=[{value:"ask",label:"Ask first",description:"Confirm shell commands, edits and git changes before they run."},{value:"accept-edits",label:"Accept edits",description:"Apply file edits automatically; still confirm shell and git."},{value:"full",label:"Full access",description:"Run every enabled tool without asking. Use only in trusted folders."}],Eh=["write_file","edit_file","rewrite_file"],_h=["shell","git","subagent","skill"];function gk(e){const i=Eh.every(r=>e[r]?.approval==="auto"),a=_h.every(r=>e[r]?.approval==="auto");return i&&a?"full":i?"accept-edits":"ask"}function xk(e,i){const a={};for(const r of Object.keys(e)){const o=Eh.includes(r)||_h.includes(r),u=i==="full"?"auto":i==="accept-edits"?Eh.includes(r)?"auto":_h.includes(r)?"ask":e[r].approval:o?"ask":e[r].approval;a[r]={...e[r],approval:u}}return a}function IM(e){return bg.find(i=>i.value===e)?.label??"Ask first"}function UM(e,i,a=!0,r){const o=B.useRef(i);o.current=i,B.useEffect(()=>{if(!a)return;const u=p=>{const h=e.current;if(!h)return;const g=p.target;g instanceof Node&&(h.contains(g)||r?.current?.contains(g)||o.current())},d=p=>{p.key==="Escape"&&o.current()};return document.addEventListener("pointerdown",u,!0),document.addEventListener("keydown",d),()=>{document.removeEventListener("pointerdown",u,!0),document.removeEventListener("keydown",d)}},[a,e,r])}const BM=[];function M1(e){return wd(Me.getState(),e)}function Cm(e){return e?e>=1e6?`${(e/1e6).toFixed(e%1e6?1:0)}M`:`${Math.round(e/1e3)}k`:""}function $M(e){return e?Math.max(.06,Math.min(1,Math.log10(e/4e3)/Math.log10(2e6/4e3))):0}function PM(e){const i=e.split(/[\s/.-]+/).filter(Boolean);return(i.length>1?i[0][0]+i[1][0]:e.slice(0,2)).toUpperCase()}function HM({efforts:e,value:i,className:a}){const r=Math.max(0,e.indexOf(i));return c.jsx("span",{className:W("flex h-3.5 items-end gap-[2px]",a),"aria-hidden":!0,children:e.map((o,u)=>c.jsx("span",{style:{height:`${38+u/Math.max(1,e.length-1)*62}%`},className:W("w-[3px] rounded-[1px] transition-all duration-300 ease-spring",u<=r?"bg-accent":"bg-line")},o))})}function FM({efforts:e,value:i,onChange:a,disabled:r}){const o=B.useRef(null),[u,d]=B.useState(!1),p=Math.max(1,e.length-1),h=Math.max(0,e.indexOf(i)),g=h/p*100,x=B.useCallback(b=>{const y=o.current?.getBoundingClientRect();if(!y||e.length===0)return;const v=1-Math.min(1,Math.max(0,(b-y.top)/y.height)),w=e[Math.round(v*p)];w&&w!==i&&a(w)},[e,p,a,i]);return c.jsxs("div",{className:W("relative flex h-[280px] gap-4 select-none",r&&"pointer-events-none opacity-40"),children:[c.jsxs("div",{ref:o,role:"slider",tabIndex:r?-1:0,"aria-label":"Reasoning effort","aria-valuemin":0,"aria-valuemax":e.length-1,"aria-valuenow":h,"aria-valuetext":Xu(i),onKeyDown:b=>{b.key==="ArrowUp"||b.key==="ArrowRight"?(b.preventDefault(),a(e[Math.min(e.length-1,h+1)])):(b.key==="ArrowDown"||b.key==="ArrowLeft")&&(b.preventDefault(),a(e[Math.max(0,h-1)]))},onPointerDown:b=>{b.currentTarget.setPointerCapture(b.pointerId),d(!0),x(b.clientY)},onPointerMove:b=>u&&x(b.clientY),onPointerUp:()=>d(!1),onPointerCancel:()=>d(!1),className:"relative w-9 shrink-0 cursor-grab touch-none rounded-full outline-none focus-visible:ring-2 focus-visible:ring-accent/50 active:cursor-grabbing",children:[c.jsx("div",{className:"absolute inset-x-[13px] inset-y-1 rounded-full bg-raised shadow-[inset_0_1px_3px_rgba(0,0,0,0.12)]"}),c.jsx("div",{className:"absolute inset-x-[13px] bottom-1 rounded-full bg-gradient-to-t from-accent/40 via-accent to-accent transition-[height] duration-500 ease-spring",style:{height:`calc((100% - 8px) * ${g/100})`}}),e.map((b,y)=>c.jsx("span",{className:W("absolute left-1/2 h-[7px] w-[7px] -translate-x-1/2 translate-y-1/2 rounded-full border transition-colors duration-300",y<=h?"border-on-accent/40 bg-on-accent/80":"border-line bg-panel"),style:{bottom:`calc(4px + (100% - 8px) * ${y/p})`}},b)),c.jsx("span",{className:W("throttle-knob absolute left-1/2 h-6 w-6 -translate-x-1/2 translate-y-1/2 rounded-full border-2 border-accent bg-panel shadow-float transition-[bottom] duration-500 ease-spring",u&&"scale-110 !duration-75"),style:{bottom:`calc(4px + (100% - 8px) * ${h/p})`},children:c.jsx("span",{className:"absolute inset-[5px] rounded-full bg-accent"})})]}),c.jsx("div",{className:"relative min-w-0 flex-1",children:e.map((b,y)=>{const v=y===h;return c.jsxs("button",{type:"button",onClick:()=>a(b),className:W("absolute left-0 flex -translate-y-1/2 flex-col items-start text-left transition-all duration-300",v?"text-ink":"text-faint hover:text-ink"),style:{top:`calc(4px + (100% - 8px) * ${1-y/p})`},children:[c.jsx("span",{className:W("font-mono text-[10.5px] uppercase tracking-[0.14em]",v&&"text-accent"),children:Xu(b)}),c.jsx("span",{className:W("overflow-hidden text-[10.5px] leading-tight text-muted transition-all duration-300",v?"mt-0.5 max-h-8 opacity-100":"max-h-0 opacity-0"),children:lg[b]?.description})]},b)})})]})}function qM({open:e,onClose:i}){const a=Me(),r=Me(S=>S.selectModel),o=Me(S=>S.update),u=me(S=>S.openSettings),[d,p]=B.useState(""),[h,g]=B.useState(""),[x,b]=B.useState(!1),[y,v]=B.useState(0),w=B.useRef(!0),T=B.useRef(null),E=B.useRef(null),N=B.useRef(null),j=a.provider,A=On(S=>S.byProvider[j])??BM,R=On(S=>!!S.loading[j]),$=On(S=>S.errors[j]??""),z=On(S=>S.notes[j]??""),C=On(S=>S.fetchModels),L=ui(a),q=A.find(S=>S.id===L)??null,M=M1(j),H=!!sa[j]?.keyless||j==="custom",Z=zo(q);B.useEffect(()=>{e&&(M||H)&&C(j)},[e,j,M,H,C]),B.useEffect(()=>{if(!e){p(""),b(!1);return}const S=window.setTimeout(()=>E.current?.focus(),60),ve=document.activeElement,ce=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.clearTimeout(S),document.body.style.overflow=ce,ve?.focus?.()}},[e]);const he=B.useMemo(()=>{const S=d.trim().toLowerCase();return S?A.filter(ve=>ve.name.toLowerCase().includes(S)||ve.id.toLowerCase().includes(S)):A},[A,d]);B.useLayoutEffect(()=>{w.current=!0,v(0)},[d,j]),B.useEffect(()=>{w.current&&T.current?.querySelector(`[data-row="${y}"]`)?.scrollIntoView({block:"nearest"})},[y]);const se=S=>{const ve=zo(S),ce=ve.length>0?ml(a.effort,S):a.effort;r(j,S.id,ve.length>0&&!ve.includes(ce)?Ew(S):ce)},ae=S=>{S?.preventDefault();const ve=h.trim();ve&&(r(j,ve,a.effort),g(""),b(!1))},O=S=>{S!==j&&(o({provider:S,model:""}),p(""),C(S))},ee=S=>{if(S.key==="ArrowDown")S.preventDefault(),w.current=!0,v(ve=>Math.min(he.length-1,ve+1));else if(S.key==="ArrowUp")S.preventDefault(),w.current=!0,v(ve=>Math.max(0,ve-1));else if(S.key==="Enter"){S.preventDefault();const ve=he[y];ve&&ve.id!==L?se(ve):i()}};if(B.useEffect(()=>{if(!e)return;const S=ve=>{ve.key==="Escape"&&(ve.preventDefault(),i())};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[e,i]),B.useEffect(()=>{if(!e)return;const S=requestAnimationFrame(()=>N.current?.querySelector('[aria-pressed="true"]')?.scrollIntoView({block:"center"}));return()=>cancelAnimationFrame(S)},[e,j]),!e)return null;const te=!M&&!H,be=Math.max(0,Ku.findIndex(S=>S.id===j));return Vo.createPortal(c.jsxs("div",{className:"fixed inset-0 z-[90] flex items-end justify-center sm:items-center sm:p-6",children:[c.jsx("button",{type:"button","aria-label":"Close model deck",tabIndex:-1,onClick:i,className:"deck-scrim absolute inset-0 cursor-default bg-black/40 backdrop-blur-[6px] dark:bg-black/65"}),c.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Model deck",className:"deck-panel relative flex h-[min(92dvh,640px)] w-full flex-col overflow-hidden rounded-t-[28px] border border-line bg-panel shadow-float sm:w-[min(920px,96vw)] sm:rounded-[28px]",children:[c.jsx("div",{className:"deck-aurora pointer-events-none absolute inset-x-0 top-0 h-40"}),c.jsxs("header",{className:"relative flex shrink-0 items-end gap-4 px-6 pb-4 pt-5",children:[c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.22em] text-faint",children:"Model deck"}),c.jsx("h2",{className:"mt-1 truncate font-display text-[26px] font-semibold leading-none tracking-[-0.03em] text-ink",children:q?.name||L||"Pick a model"}),c.jsxs("p",{className:"mt-1.5 flex items-center gap-2 text-[11.5px] text-muted",children:[c.jsx("span",{children:sa[j]?.name??j}),Z.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-faint",children:"·"}),c.jsxs("span",{className:"text-accent",children:[Xu(a.effort)," effort"]})]}),q?.context?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-faint",children:"·"}),c.jsxs("span",{children:[Cm(q.context)," context"]})]}):null]})]}),c.jsx("button",{type:"button",className:"icon-button h-8 w-8",onClick:()=>{C(j,!0)},disabled:R||te,title:"Refresh live models","aria-label":"Refresh live models",children:c.jsx(Bi,{size:14,className:W(R&&"animate-spin")})}),c.jsx("button",{type:"button",className:"icon-button h-8 w-8",onClick:()=>{i(),u("models")},title:"Provider settings","aria-label":"Provider settings",children:c.jsx(fw,{size:14})}),c.jsx("button",{type:"button",className:"icon-button h-8 w-8",onClick:i,"aria-label":"Close",children:c.jsx(Ni,{size:15})})]}),c.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col border-t border-line md:flex-row",children:[c.jsxs("nav",{ref:N,"aria-label":"Providers",className:"thin-scroll relative flex shrink-0 gap-1.5 overflow-x-auto border-b border-line bg-canvas/70 p-2 md:w-[78px] md:flex-col md:overflow-y-auto md:overflow-x-hidden md:border-b-0 md:border-r md:p-2.5",children:[c.jsx("span",{"aria-hidden":!0,className:"deck-rail-glow pointer-events-none absolute left-2.5 top-2.5 hidden h-[46px] w-[calc(100%-20px)] rounded-2xl bg-accent-soft ring-1 ring-accent/40 transition-transform duration-500 ease-spring md:block",style:{transform:`translateY(${be*52}px)`}}),Ku.map(S=>{const ve=M1(S.id)||S.keyless||S.id==="custom",ce=S.id===j;return c.jsxs("button",{type:"button",onClick:()=>O(S.id),disabled:!ve,title:`${S.name}${ve?"":" · connect to enable"}`,"aria-pressed":ce,className:W("relative flex h-[46px] min-w-[58px] shrink-0 flex-col items-center justify-center gap-0.5 rounded-2xl transition-colors disabled:cursor-not-allowed disabled:opacity-40 md:min-w-0",ce?"text-accent max-md:bg-accent-soft":"text-muted hover:bg-raised hover:text-ink"),children:[c.jsx("span",{className:"font-display text-[13px] font-semibold tracking-tight",children:PM(S.name)}),c.jsx("span",{className:"max-w-full truncate px-1 text-[8.5px] leading-none text-faint",children:S.name.split(" ")[0]}),c.jsx("span",{className:W("absolute right-1.5 top-1.5 h-1.5 w-1.5 rounded-full",ve?"bg-success":"bg-warning/70")})]},S.id)})]}),c.jsx("section",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:te?c.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 px-8 text-center",children:[c.jsx("span",{className:"deck-pop flex h-12 w-12 items-center justify-center rounded-2xl bg-warning/10 text-warning",children:c.jsx(Ho,{size:20})}),c.jsxs("p",{className:"font-display text-[16px] font-semibold text-ink",children:["Connect ",sa[j]?.name??j]}),c.jsx("p",{className:"max-w-[320px] text-[12px] leading-relaxed text-muted",children:"Keys are encrypted by the local daemon before they touch disk and never come back to this page."}),c.jsx("button",{type:"button",onClick:()=>{i(),u("models")},className:"mt-1 inline-flex h-9 items-center gap-1.5 rounded-full bg-ink px-5 text-[12px] font-medium text-panel transition-transform active:scale-95",children:"Add API key"})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"shrink-0 px-4 pb-2 pt-3.5",children:[c.jsxs("div",{className:"relative",children:[c.jsx(os,{size:14,className:"pointer-events-none absolute left-3.5 top-1/2 -translate-y-1/2 text-faint"}),c.jsx("input",{ref:E,value:d,onChange:S=>p(S.target.value),onKeyDown:ee,placeholder:A.length>0?`Search ${A.length} models…`:"Search models…",className:"h-10 w-full rounded-full border border-line bg-canvas/70 pl-10 pr-14 text-[13px] text-ink outline-none transition-all placeholder:text-faint focus:border-accent/50 focus:bg-panel focus:shadow-[0_0_0_4px_rgb(var(--accent)/0.10)]","aria-label":"Search models"}),c.jsx("kbd",{className:"absolute right-3 top-1/2 -translate-y-1/2 rounded-md border border-line bg-panel px-1.5 py-0.5 font-mono text-[9.5px] text-faint",children:"↑↓ ↵"})]}),$&&c.jsxs("div",{className:"mt-2 flex items-start gap-1.5 rounded-lg border border-danger/20 bg-danger/[0.04] px-2.5 py-2",children:[c.jsx(md,{size:12,className:"mt-0.5 shrink-0 text-danger"}),c.jsx("p",{className:"min-w-0 flex-1 text-[11px] leading-relaxed text-danger",children:$}),c.jsx("button",{type:"button",onClick:()=>{C(j,!0)},className:"text-[11px] font-medium text-danger",children:"Retry"})]}),z&&!$&&c.jsx("p",{className:"mt-1.5 px-1 text-[10.5px] leading-relaxed text-faint",children:z})]}),c.jsxs("div",{ref:T,className:"thin-scroll min-h-0 flex-1 overflow-y-auto px-2.5 pb-3",children:[R&&A.length===0&&c.jsxs("p",{className:"flex items-center gap-2 px-3 py-4 text-[12px] text-faint",children:[c.jsx(Pt,{size:12})," Loading live models…"]}),he.map((S,ve)=>{const ce=S.id===L,D=ve===y,U=S.reasoningOptions.length>0;return c.jsxs("button",{type:"button","data-row":ve,onClick:()=>{v(ve),se(S)},onMouseEnter:()=>{D||(w.current=!1,v(ve))},style:{animationDelay:`${Math.min(ve*22,260)}ms`},className:W("deck-row group/row relative mb-1 flex w-full items-center gap-3 overflow-hidden rounded-2xl px-3 py-2.5 text-left transition-colors",ce?"bg-accent-soft":D?"bg-raised":"hover:bg-raised/70"),children:[c.jsx("span",{className:W("flex h-8 w-8 shrink-0 items-center justify-center rounded-xl transition-all duration-300",ce?"scale-100 bg-accent text-on-accent":"bg-raised text-faint group-hover/row:bg-panel"),children:ce?c.jsx(Cn,{size:14,strokeWidth:2.4}):c.jsx(HC,{size:13})}),c.jsxs("span",{className:"min-w-0 flex-1",children:[c.jsxs("span",{className:"flex items-center gap-2",children:[c.jsx("span",{className:W("truncate text-[13px] font-medium",ce?"text-accent":"text-ink"),children:S.name||S.id}),S.free&&c.jsx("span",{className:"rounded-full bg-success/10 px-1.5 py-px text-[9px] font-medium text-success",children:"free"}),!S.toolCall&&c.jsx("span",{className:"rounded-full bg-warning/10 px-1.5 py-px text-[9px] font-medium text-warning",children:"no tools"})]}),c.jsx("span",{className:"mt-0.5 block truncate font-mono text-[10px] text-faint",children:S.id})]}),c.jsxs("span",{className:"hidden shrink-0 items-center gap-2.5 text-faint sm:flex",children:[U&&c.jsx(i1,{size:12,className:"text-accent/80","aria-label":"reasoning"}),S.vision&&c.jsx(Vh,{size:12,"aria-label":"vision"}),S.context?c.jsxs("span",{className:"flex w-[74px] flex-col items-end gap-1",children:[c.jsx("span",{className:"font-mono text-[10px] tabular-nums",children:Cm(S.context)}),c.jsx("span",{className:"h-[3px] w-full overflow-hidden rounded-full bg-line",children:c.jsx("span",{className:W("block h-full rounded-full",ce?"bg-accent":"bg-faint/60"),style:{width:`${$M(S.context)*100}%`}})})]}):null]})]},S.id)}),!R&&he.length===0&&A.length>0&&c.jsxs("p",{className:"px-3 py-6 text-center text-[12px] text-faint",children:["No model matches “",d,"”."]}),!R&&A.length===0&&!$&&c.jsx("p",{className:"px-3 py-6 text-center text-[12px] text-faint",children:"This provider returned no usable chat models."}),x?c.jsxs("form",{onSubmit:ae,className:"deck-row mt-1 flex items-center gap-2 px-1",children:[c.jsx("input",{autoFocus:!0,value:h,onChange:S=>g(S.target.value),placeholder:"model-id",className:"h-9 min-w-0 flex-1 rounded-full border border-line bg-panel px-4 font-mono text-[11.5px] outline-none focus:border-accent/50","aria-label":"Model ID"}),c.jsx("button",{type:"submit",disabled:!h.trim(),className:"h-9 rounded-full bg-ink px-4 text-[11.5px] font-medium text-panel transition-opacity disabled:opacity-40",children:"Use"})]}):c.jsxs("button",{type:"button",onClick:()=>b(!0),className:"mt-1 flex w-full items-center gap-2 rounded-2xl px-3 py-2.5 text-left text-[12px] text-faint transition-colors hover:bg-raised/70 hover:text-ink",children:[c.jsx(ns,{size:13})," Use a model ID that is not listed"]})]})]})}),c.jsxs("aside",{className:"deck-throttle relative shrink-0 border-t border-line bg-canvas/70 px-6 py-5 md:w-[258px] md:border-l md:border-t-0",children:[c.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[c.jsx(i1,{size:13,className:"text-accent"}),c.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-muted",children:"Reasoning"})]}),Z.length>1?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"hidden md:block",children:c.jsx(FM,{efforts:Z,value:ml(a.effort,q),onChange:S=>q&&r(j,q.id,S),disabled:!q})}),c.jsx("div",{className:"flex gap-1 rounded-full bg-raised p-1 md:hidden",children:Z.map(S=>c.jsx("button",{type:"button",onClick:()=>q&&r(j,q.id,S),className:W("h-8 min-w-0 flex-1 rounded-full text-[10.5px] font-medium transition-all",a.effort===S?"bg-accent text-on-accent shadow-pill":"text-muted"),children:Xu(S)},S))})]}):c.jsxs("div",{className:"flex h-[120px] flex-col justify-center rounded-2xl border border-dashed border-line px-4 text-center md:h-[280px]",children:[c.jsx("p",{className:"text-[12px] font-medium text-ink",children:q?"No effort dial":"Pick a model"}),c.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted",children:oh(q)})]}),Z.length>1&&c.jsx("p",{className:"mt-4 hidden text-[10.5px] leading-relaxed text-faint md:block",children:oh(q)})]})]}),c.jsxs("footer",{className:"relative flex shrink-0 items-center gap-3 border-t border-line px-6 py-3 text-[10.5px] text-faint",children:[q?.maxOutput?c.jsxs("span",{children:["max output ",Cm(q.maxOutput)]}):null,q?.apiKind?c.jsx("span",{className:"rounded-md border border-line px-1.5 py-px font-mono",children:q.apiKind}):null,c.jsx("span",{className:"ml-auto hidden sm:inline",children:"Esc to close"}),c.jsx("button",{type:"button",onClick:i,className:"inline-flex h-8 items-center rounded-full bg-ink px-5 text-[12px] font-medium text-panel transition-transform active:scale-95",children:"Done"})]})]})]}),document.body)}function GM({label:e,open:i,disabled:a,onClick:r,triggerRef:o,efforts:u,effort:d,title:p}){return c.jsxs("button",{ref:o,type:"button",disabled:a,onClick:r,"aria-haspopup":"dialog","aria-expanded":i,title:p,className:W("deck-trigger group/deck flex h-8 max-w-[200px] items-center gap-2 rounded-full border border-transparent pl-2.5 pr-2.5 text-[11px] font-medium text-muted transition-all duration-200 hover:border-line hover:bg-raised hover:text-ink active:scale-[0.97] disabled:cursor-not-allowed disabled:opacity-45 sm:max-w-[270px]",i&&"border-accent/40 bg-accent-soft text-accent"),children:[c.jsx("span",{className:"truncate",children:e}),u.length>1&&c.jsx(HM,{efforts:u,value:d})]})}const na={outline:"#6b3410",body:"#fbbf24",shade:"#f59e0b",highlight:"#fef3c7",ray:"#f59e0b",eye:"#1a0f06",mark:"#4a2508",blush:"#fb7185",sweat:"#38bdf8",mint:"#34d399",sky:"#60a5fa",rose:"#fb7185"},YM={wave:"animate-bob",idle:"animate-float-slow",thinking:"animate-float",working:"animate-bob-fast",typing:"animate-bob",happy:"animate-pop",alert:"animate-bounce",error:"animate-shake",sleepy:"animate-float-slow",party:"animate-pop"},VM=new Set(["thinking","working","typing","party","wave"]),bk=[[4,6,9],[5,5,10],[6,4,11],[7,4,11],[8,4,11],[9,4,11],[10,5,10],[11,6,9]],il=new Set;for(const[e,i,a]of bk)for(let r=i;r<=a;r++)il.add(`${r},${e}`);const yk=[];for(let e=2;e<=13;e++)for(let i=2;i<=13;i++){if(il.has(`${i},${e}`))continue;(il.has(`${i-1},${e}`)||il.has(`${i+1},${e}`)||il.has(`${i},${e-1}`)||il.has(`${i},${e+1}`))&&yk.push([i,e])}const KM=[[7,0,2,2,"ray"],[7,14,2,2,"ray"],[0,7,2,2,"ray"],[14,7,2,2,"ray"]],XM=[[2,2,1,1,"ray"],[13,2,1,1,"ray"],[2,13,1,1,"ray"],[13,13,1,1,"ray"],[3,3,1,1,"ray"],[12,3,1,1,"ray"],[3,12,1,1,"ray"],[12,12,1,1,"ray"]];function ia(e,i=0,a=0){const[r,o]=e==="sm"?[1,1]:e==="md"?[1,2]:e==="lg"?[2,2]:[2,1],u=(e==="sm"||e==="flat"?8:7)+a;return[[(e==="lg"||e==="flat"?5:6)+i,u,r,o,"eye"],[9+i,u,r,o,"eye"]]}const R1=[[4,9,1,1,"blush"],[11,9,1,1,"blush"]];function ZM(e){switch(e){case"wave":return{eyes:ia("md"),extras:R1,eyeClass:"pxs-blink"};case"happy":return{eyes:ia("lg"),extras:[...R1,[13,1,1,3,"ray"],[12,2,3,1,"ray"]],clearCorner:!0};case"party":return{eyes:ia("lg"),extras:[[1,3,1,1,"rose"],[14,2,1,1,"mint"],[0,11,1,1,"sky"],[15,12,1,1,"rose"],[4,0,1,1,"mint"],[11,0,1,1,"sky"],[2,14,1,1,"mint"],[13,14,1,1,"rose"]],clearCorner:!0};case"thinking":return{eyes:ia("md",1,-1),extras:[[10,1,1,1,"mark"],[12,1,1,1,"mark"],[14,1,1,1,"mark"]],clearCorner:!0};case"working":return{eyes:ia("sm",0,1),extras:[],eyeClass:"pxs-scan"};case"typing":return{eyes:ia("md",0,1),extras:[],eyeClass:"pxs-scan"};case"alert":return{eyes:ia("lg"),extras:[[13,0,1,3,"mark"],[13,4,1,1,"mark"]],clearCorner:!0};case"error":return{eyes:ia("sm",0,1),extras:[[12,3,1,1,"sweat"],[12,4,1,2,"sweat"]],clearCorner:!0};case"sleepy":return{eyes:ia("flat"),extras:[[12,1,4,1,"mark"],[14,2,1,1,"mark"],[13,3,1,1,"mark"],[12,4,4,1,"mark"]],clearCorner:!0};default:return{eyes:ia("md"),extras:[],eyeClass:"pxs-blink"}}}function vk({mood:e="idle",size:i=40,className:a,animate:r=!0}){const o=yM[e],u=r&&VM.has(e),d=ZM(e);return c.jsx("span",{className:W("inline-flex shrink-0 select-none",r&&YM[e],a),role:"img","aria-label":`PixleSol — ${o}`,title:`PixleSol — ${o}`,children:c.jsxs("svg",{viewBox:"0 0 16 16",width:i,height:i,shapeRendering:"crispEdges","aria-hidden":"true",children:[c.jsx("g",{className:u?"pxs-a":void 0,children:KM.map(([p,h,g,x,b],y)=>c.jsx("rect",{x:p,y:h,width:g,height:x,fill:na[b]},y))}),c.jsx("g",{className:u?"pxs-b":void 0,opacity:d.clearCorner?.35:void 0,children:XM.map(([p,h,g,x,b],y)=>c.jsx("rect",{x:p,y:h,width:g,height:x,fill:na[b]},y))}),yk.map(([p,h])=>c.jsx("rect",{x:p,y:h,width:1,height:1,fill:na.outline},`o${p},${h}`)),bk.map(([p,h,g])=>c.jsx("rect",{x:h,y:p,width:g-h+1,height:1,fill:na.body},`b${p}`)),c.jsx("rect",{x:5,y:11,width:6,height:1,fill:na.shade}),c.jsx("rect",{x:9,y:10,width:2,height:1,fill:na.shade}),c.jsx("rect",{x:6,y:4,width:2,height:1,fill:na.highlight}),c.jsx("rect",{x:5,y:5,width:1,height:1,fill:na.highlight}),c.jsx("g",{className:r?d.eyeClass:void 0,children:d.eyes.map(([p,h,g,x,b],y)=>c.jsx("rect",{x:p,y:h,width:g,height:x,fill:na[b]},y))}),d.extras.map(([p,h,g,x,b],y)=>c.jsx("rect",{x:p,y:h,width:g,height:x,fill:na[b]},`x${y}`))]})})}const QM=/\.(txt|md|markdown|ts|tsx|js|jsx|mjs|cjs|json|css|scss|html|vue|svelte|py|go|rs|rb|java|kt|cs|c|h|cpp|hpp|php|swift|sh|bash|zsh|yml|yaml|toml|ini|sql|csv|xml|gitignore|env)$/i,jm=6,JM=5*1024*1024,WM=512*1024,Am=[{name:"search",usage:"/search <query>",description:"Search the web and answer with sources",takesArgs:!0},{name:"plan",usage:"/plan [task]",description:"Read-only investigation, then a plan",takesArgs:!1},{name:"build",usage:"/build [task]",description:"Allow edits and commands",takesArgs:!1},{name:"new",usage:"/new",description:"Start a new conversation",takesArgs:!1},{name:"workspace",usage:"/workspace",description:"Open the folder panel",takesArgs:!1},{name:"deploy",usage:"/deploy",description:"Deploy a project folder",takesArgs:!1},{name:"settings",usage:"/settings",description:"Open settings",takesArgs:!1},{name:"clear",usage:"/clear",description:"Clear this conversation",takesArgs:!1}];function D1(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`}function z1({value:e,onChange:i,onSend:a,onStop:r,onCommand:o,streaming:u,hints:d=!1,autoFocus:p=!1,placeholder:h="How can I help you today?",contextPct:g,contextTitle:x,pixleMood:b}){const y=Me(),v=Me(fe=>fe.update),w=Me(fe=>fe.setMode),T=me(fe=>fe.notify),E=me(fe=>fe.openSettings),N=me(fe=>fe.composerFocus),j=me(fe=>fe.setWorkspaceOpen),A=Be(fe=>fe.info),[R,$]=B.useState([]),[z,C]=B.useState(!1),[L,q]=B.useState(!1),[M,H]=B.useState(!1),[Z,he]=B.useState(!1),[se,ae]=B.useState(!1),[O,ee]=B.useState(0),te=B.useRef(null),be=B.useRef(null),S=B.useRef(null),ve=B.useRef(null),ce=B.useRef(null);B.useEffect(()=>{const fe=Ge=>{(Ge.metaKey||Ge.ctrlKey)&&!Ge.shiftKey&&!Ge.altKey&&Ge.key.toLowerCase()==="m"&&(Ge.preventDefault(),H(ht=>!ht))};return window.addEventListener("keydown",fe),()=>window.removeEventListener("keydown",fe)},[]),UM(ve,()=>he(!1),Z,ce);const D=ui(y),U=AA(y.provider),re=Ad(),ge=hl(y),_e=zo(re),Ue=y.skills.filter(fe=>fe.enabled).length,de=gk(y.tools),Ne=ge?D?U.find(fe=>fe.id===D)?.name??D:"Select model":"No provider",ye=B.useMemo(()=>{if(!e.startsWith("/")||e.includes(`
|
|
215
|
+
`))return null;const fe=e.slice(1).split(/\s/)[0];return e.slice(1).includes(" ")?null:fe.toLowerCase()},[e]),Q=B.useMemo(()=>ye===null?[]:Am.filter(fe=>fe.name.startsWith(ye)),[ye]);B.useEffect(()=>{ee(0)},[ye]),B.useLayoutEffect(()=>{const fe=te.current;fe&&(fe.style.height="auto",fe.style.height=`${Math.min(Math.max(fe.scrollHeight,52),220)}px`)},[e]),B.useEffect(()=>{if(!p||!window.matchMedia("(pointer: fine)").matches)return;const fe=window.setTimeout(()=>te.current?.focus(),80);return()=>window.clearTimeout(fe)},[p]),B.useEffect(()=>{N>0&&te.current?.focus()},[N]),B.useEffect(()=>{ge||H(!1)},[ge]),B.useEffect(()=>{re&&!_e.length&&v({effort:"medium"})},[re,_e.length,v]);const Pe=async fe=>{if(fe.length===0)return;let Ge=jm-R.length;if(Ge<=0){T(`You can attach up to ${jm} files per message.`,"error");return}const ht=[];for(const xt of fe){if(Ge<=0){T(`Only ${jm} attachments were added.`,"info");break}const ln=/^image\/(png|jpeg|webp|gif)$/i.test(xt.type),ie=xt.type.startsWith("text/")||QM.test(xt.name);if(ln){if(xt.size>JM){T(`${xt.name} is larger than 5 MB.`,"error");continue}ht.push({id:D1(),name:xt.name,kind:"image",mime:xt.type,dataUrl:await pM(xt),size:xt.size}),Ge-=1}else if(ie){if(xt.size>WM){T(`${xt.name} is larger than 512 KB.`,"error");continue}ht.push({id:D1(),name:xt.name,kind:"text",mime:xt.type||"text/plain",text:await mM(xt),size:xt.size}),Ge-=1}else T(`Can't attach ${xt.name}. Use an image, text or code file.`,"error")}ht.length>0&&$(xt=>[...xt,...ht])},ne=async()=>{if(u||se)return;const fe=e.trim();if(!(!fe&&R.length===0)){if(fe.startsWith("/")&&!R.length){const[Ge,...ht]=fe.slice(1).split(/\s+/),xt=Am.find(ln=>ln.name===Ge.toLowerCase());if(xt){const ln=ht.join(" ").trim();if(o){ae(!0);try{await o(xt.name,ln)&&(i(""),requestAnimationFrame(()=>te.current?.focus()))}catch(ie){T(ie instanceof Error?ie.message:"That command failed.","error")}finally{ae(!1)}return}}}ae(!0),H(!1);try{await a(e,R)&&(i(""),$([]),requestAnimationFrame(()=>te.current?.focus()))}catch(Ge){T(Ge instanceof Error?Ge.message:"The message could not be sent.","error")}finally{ae(!1)}}},et=(fe,Ge)=>{if(Ge){i(`/${fe} `),te.current?.focus();return}i(`/${fe}`),window.setTimeout(()=>{Ae(`/${fe}`)},0)},Ae=async fe=>{const[Ge]=fe.slice(1).split(/\s+/),ht=Am.find(xt=>xt.name===Ge.toLowerCase());if(!(!ht||!o)){ae(!0);try{await o(ht.name,fe.slice(1).split(/\s+/).slice(1).join(" "))&&i("")}finally{ae(!1)}}},rt=fe=>{if(Q.length>0){if(fe.key==="ArrowDown"){fe.preventDefault(),ee(Ge=>(Ge+1)%Q.length);return}if(fe.key==="ArrowUp"){fe.preventDefault(),ee(Ge=>(Ge-1+Q.length)%Q.length);return}if(fe.key==="Enter"&&!fe.shiftKey&&!fe.nativeEvent.isComposing){fe.preventDefault();const Ge=Q[O];Ge&&et(Ge.name,Ge.takesArgs);return}if(fe.key==="Escape"){fe.preventDefault(),i("");return}}if(fe.key==="Enter"&&!fe.shiftKey&&!fe.nativeEvent.isComposing){if(fe.preventDefault(),u)return;ne()}fe.key==="Escape"&&H(!1)},Ke=fe=>{const Ge=Array.from(fe.clipboardData.files);Ge.length>0&&(fe.preventDefault(),Pe(Ge))},It=fe=>{fe.preventDefault(),q(!1),Pe(Array.from(fe.dataTransfer.files))},jn=!e.trim()&&R.length===0||se||u,xn=g===void 0?"":g>=95?"text-danger":g>=70?"text-warning":"text-faint";return c.jsxs("div",{className:"relative w-full",children:[c.jsx(qM,{open:M&&ge,onClose:()=>H(!1)}),Q.length>0&&c.jsxs("div",{className:"absolute bottom-[calc(100%+8px)] left-0 z-40 w-[min(94vw,360px)] overflow-hidden rounded-xl border border-line surface-lift shadow-float",children:[c.jsxs("div",{className:"flex items-center gap-1.5 border-b border-line px-3 py-2 text-[10px] font-medium uppercase tracking-[0.12em] text-faint",children:[c.jsx(xC,{size:10})," Commands"]}),Q.map((fe,Ge)=>c.jsxs("button",{type:"button",onMouseDown:ht=>ht.preventDefault(),onClick:()=>et(fe.name,fe.takesArgs),className:W("flex w-full items-center gap-2 px-3 py-2 text-left",Ge===O?"bg-accent-soft":"hover:bg-raised"),children:[c.jsx("span",{className:W("font-mono text-[10.5px]",Ge===O?"text-accent":"text-ink"),children:fe.usage}),c.jsx("span",{className:"min-w-0 flex-1 truncate text-[10px] text-faint",children:fe.description})]},fe.name))]}),c.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-1.5",children:[c.jsxs("button",{type:"button",onClick:()=>j(!0),className:"chip h-7 max-w-[220px] gap-1.5 px-2.5 text-[11px]",title:A.available?A.root:"Choose a project folder",children:[c.jsx(ls,{size:12,className:"shrink-0 text-faint"}),c.jsx("span",{className:"truncate",children:A.available?A.name:"No folder"})]}),c.jsxs("button",{type:"button",onClick:()=>w(y.mode==="plan"?"build":"plan"),className:"chip h-7 gap-1.5 px-2.5 text-[11px]",title:y.mode==="plan"?"Switch to Build mode":"Switch to Plan mode (read-only)",children:[y.mode==="plan"?c.jsx(Zh,{size:12,className:"text-faint"}):c.jsx(Wn,{size:12,className:"text-faint"}),y.mode==="plan"?"Plan mode":"Build mode"]}),c.jsxs("button",{type:"button",onClick:()=>v({webSearchEnabled:!y.webSearchEnabled}),className:W("chip h-7 gap-1.5 px-2.5 text-[11px]",y.webSearchEnabled&&"chip-active"),title:"Allow OpenSol to search the web and read pages","aria-pressed":y.webSearchEnabled,children:[c.jsx(ss,{size:12}),"Search"]}),Ue>0&&c.jsxs("button",{type:"button",onClick:()=>E("skills"),className:"chip h-7 gap-1 px-2.5 text-[11px]",title:"Manage loaded skills",children:[Ue," skill",Ue===1?"":"s"]})]}),c.jsxs("div",{onDragOver:fe=>{fe.dataTransfer.types.includes("Files")&&(fe.preventDefault(),q(!0))},onDragLeave:fe=>{fe.currentTarget.contains(fe.relatedTarget)||q(!1)},onDrop:It,className:W("surface-lift composer-shadow relative rounded-2xl border transition-all duration-200",z||L?"border-accent/35":"border-line",u&&"composer-glow border-accent/30",L&&"ring-4 ring-accent/10"),children:[z&&!L&&c.jsx("div",{className:"pointer-events-none absolute inset-0 rounded-2xl ring-4 ring-accent/[0.03]","aria-hidden":"true"}),c.jsxs("div",{className:"relative px-3.5 pb-1 pt-3",children:[R.length>0&&c.jsx("div",{className:"flex flex-wrap gap-2 px-1 pb-2",children:R.map(fe=>fe.kind==="image"?c.jsxs("div",{className:"relative",children:[c.jsx("img",{src:fe.dataUrl,alt:fe.name,className:"h-14 w-14 rounded-lg border border-line object-cover"}),c.jsx("button",{type:"button",onClick:()=>$(Ge=>Ge.filter(ht=>ht.id!==fe.id)),className:"absolute -right-1.5 -top-1.5 flex h-[18px] w-[18px] items-center justify-center rounded-full border border-line bg-panel text-muted shadow-sm transition-colors hover:text-ink","aria-label":`Remove ${fe.name}`,children:c.jsx(Ni,{size:10})})]},fe.id):c.jsxs("span",{className:"inline-flex h-8 max-w-[220px] items-center gap-1.5 rounded-lg border border-line bg-raised/70 pl-2 pr-1 text-[10.5px] text-muted",children:[c.jsx(Pn,{size:11,className:"shrink-0"}),c.jsx("span",{className:"min-w-0 flex-1 truncate",children:fe.name}),c.jsx("span",{className:"shrink-0 text-faint",children:xl(fe.size)}),c.jsx("button",{type:"button",onClick:()=>$(Ge=>Ge.filter(ht=>ht.id!==fe.id)),className:"flex h-5 w-5 shrink-0 items-center justify-center rounded text-faint hover:bg-panel hover:text-ink","aria-label":`Remove ${fe.name}`,children:c.jsx(Ni,{size:10})})]},fe.id))}),c.jsx("textarea",{ref:te,value:e,onChange:fe=>i(fe.target.value),onKeyDown:rt,onPaste:Ke,onFocus:()=>C(!0),onBlur:()=>C(!1),placeholder:h,rows:1,"aria-label":"Message OpenSol",className:"block w-full resize-none bg-transparent px-2 py-1.5 text-[15.5px] leading-[1.6] text-ink outline-none placeholder:text-faint",style:{minHeight:52,maxHeight:220}})]}),c.jsxs("div",{className:"flex items-end justify-between gap-2 px-2.5 pb-2 pt-1",children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-0.5",children:[c.jsxs("div",{className:"relative",children:[c.jsxs("button",{ref:ce,type:"button",onClick:()=>he(fe=>!fe),className:"flex h-8 items-center gap-1.5 rounded-lg px-2 text-[11px] font-medium text-muted transition-colors hover:bg-raised hover:text-ink",title:"Choose how much OpenSol can do without asking","aria-expanded":Z,children:[c.jsx(wr,{size:13,className:"text-faint"}),IM(de),c.jsx(Po,{size:11,className:W("text-faint transition-transform",Z&&"rotate-180")})]}),Z&&c.jsxs("div",{ref:ve,className:"surface-lift absolute bottom-[calc(100%+8px)] left-0 z-40 w-[290px] overflow-hidden rounded-2xl border border-line p-1.5 shadow-float",children:[c.jsx("p",{className:"px-2 pb-1 pt-1.5 text-[10px] font-medium uppercase tracking-[0.1em] text-faint",children:"Permissions"}),bg.map(fe=>c.jsxs("button",{type:"button",onClick:()=>{v({tools:xk(y.tools,fe.value)}),he(!1)},className:"flex w-full items-start gap-2 rounded-lg px-2 py-1.5 text-left transition-colors hover:bg-raised",children:[c.jsx("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center",children:de===fe.value?c.jsx(Cn,{size:12,className:"text-accent"}):c.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-line"})}),c.jsxs("span",{className:"min-w-0",children:[c.jsx("span",{className:"block text-[11.5px] font-medium text-ink",children:fe.label}),c.jsx("span",{className:"mt-0.5 block text-[10px] leading-relaxed text-faint",children:fe.description})]})]},fe.value))]})]}),c.jsx("button",{type:"button",className:"icon-button h-8 w-8",onClick:()=>be.current?.click(),title:"Attach images or text files","aria-label":"Attach files",children:c.jsx(ZT,{size:15})}),c.jsx("input",{ref:be,type:"file",multiple:!0,accept:"image/png,image/jpeg,image/webp,image/gif,.md,.markdown,.txt,.ts,.tsx,.js,.jsx,.json,.css,.html,.py,.go,.rs,.rb,.java,.cs,.sh,.yml,.yaml,.toml,.sql",className:"hidden",onChange:fe=>{fe.target.files&&Pe(Array.from(fe.target.files)),fe.target.value=""}})]}),c.jsxs("div",{className:"flex min-w-0 shrink-0 items-center gap-1",children:[g!==void 0&&c.jsxs("span",{className:W("hidden items-center gap-1 px-1 text-[10.5px] tabular-nums sm:flex",xn),title:x,children:[c.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current"}),g,"%"]}),c.jsx(GM,{triggerRef:S,label:Ne,open:M,disabled:!ge,onClick:()=>H(fe=>!fe),efforts:_e,effort:y.effort,title:ge?"Model deck: choose model and reasoning effort (Ctrl M)":"Add a provider key in Settings first"}),u?c.jsx("button",{type:"button",onClick:r,className:"flex h-8 w-8 items-center justify-center rounded-full bg-ink text-panel transition-opacity hover:opacity-85","aria-label":"Stop generating",title:"Stop",children:c.jsx(ig,{size:11,fill:"currentColor"})}):c.jsx("button",{type:"button",onClick:()=>{ne()},disabled:jn,className:W("flex h-8 w-8 items-center justify-center rounded-full transition-all duration-150",jn?"cursor-not-allowed bg-raised text-faint":"bg-accent text-on-accent hover:brightness-110"),"aria-label":"Send message",title:"Send (Enter)",children:se?c.jsx("span",{className:"h-3 w-3 animate-spin rounded-full border border-current border-t-transparent"}):c.jsx(e5,{})})]})]}),L&&c.jsxs("div",{className:"absolute inset-0 z-20 flex flex-col items-center justify-center gap-1.5 rounded-2xl border-2 border-dashed border-accent/45 bg-panel/95",children:[c.jsx(rg,{size:18,className:"text-accent"}),c.jsx("p",{className:"text-[12px] font-medium text-ink",children:"Drop files to attach"}),c.jsx("p",{className:"text-[10.5px] text-faint",children:"Images up to 5 MB · text up to 512 KB"})]}),b&&c.jsx(vk,{mood:b,size:44,className:"pointer-events-none absolute -top-[34px] right-4 z-10 hidden sm:inline-flex"})]}),d&&c.jsxs("div",{className:"mt-2.5 flex items-center justify-between gap-4 px-2 text-[11px] text-faint",children:[c.jsx("span",{className:"hidden sm:inline",children:"Enter to send · Shift + Enter for a new line · / for commands"}),c.jsxs("span",{className:"flex items-center gap-1 sm:ml-auto",children:[c.jsx(wr,{size:11}),"Local daemon · keys encrypted at rest"]})]})]})}function e5(){return c.jsx("svg",{viewBox:"0 0 16 16",width:"15",height:"15",fill:"none","aria-hidden":"true",children:c.jsx("path",{d:"M8 12.5V3.5M4.2 7.2L8 3.4l3.8 3.8",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function t5(e,i){const a={};return(e[e.length-1]===""?[...e,""]:e).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}const n5=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,i5=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,a5={};function L1(e,i){return(a5.jsx?i5:n5).test(e)}const r5=/[ \t\n\f\r]/g;function s5(e){return typeof e=="object"?e.type==="text"?I1(e.value):!1:I1(e)}function I1(e){return e.replace(r5,"")===""}class Xo{constructor(i,a,r){this.normal=a,this.property=i,r&&(this.space=r)}}Xo.prototype.normal={};Xo.prototype.property={};Xo.prototype.space=void 0;function wk(e,i){const a={},r={};for(const o of e)Object.assign(a,o.property),Object.assign(r,o.normal);return new Xo(a,r,i)}function Sh(e){return e.toLowerCase()}class ei{constructor(i,a){this.attribute=a,this.property=i}}ei.prototype.attribute="";ei.prototype.booleanish=!1;ei.prototype.boolean=!1;ei.prototype.commaOrSpaceSeparated=!1;ei.prototype.commaSeparated=!1;ei.prototype.defined=!1;ei.prototype.mustUseProperty=!1;ei.prototype.number=!1;ei.prototype.overloadedBoolean=!1;ei.prototype.property="";ei.prototype.spaceSeparated=!1;ei.prototype.space=void 0;let l5=0;const We=cs(),sn=cs(),Th=cs(),we=cs(),zt=cs(),ts=cs(),ci=cs();function cs(){return 2**++l5}const Ch=Object.freeze(Object.defineProperty({__proto__:null,boolean:We,booleanish:sn,commaOrSpaceSeparated:ci,commaSeparated:ts,number:we,overloadedBoolean:Th,spaceSeparated:zt},Symbol.toStringTag,{value:"Module"})),Om=Object.keys(Ch);class yg extends ei{constructor(i,a,r,o){let u=-1;if(super(i,a),U1(this,"space",o),typeof r=="number")for(;++u<Om.length;){const d=Om[u];U1(this,Om[u],(r&Ch[d])===Ch[d])}}}yg.prototype.defined=!0;function U1(e,i,a){a&&(e[i]=a)}function yl(e){const i={},a={};for(const[r,o]of Object.entries(e.properties)){const u=new yg(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(u.mustUseProperty=!0),i[r]=u,a[Sh(r)]=r,a[Sh(u.attribute)]=r}return new Xo(i,a,e.space)}const kk=yl({properties:{ariaActiveDescendant:null,ariaAtomic:sn,ariaAutoComplete:null,ariaBusy:sn,ariaChecked:sn,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:zt,ariaCurrent:null,ariaDescribedBy:zt,ariaDetails:null,ariaDisabled:sn,ariaDropEffect:zt,ariaErrorMessage:null,ariaExpanded:sn,ariaFlowTo:zt,ariaGrabbed:sn,ariaHasPopup:null,ariaHidden:sn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:zt,ariaLevel:we,ariaLive:null,ariaModal:sn,ariaMultiLine:sn,ariaMultiSelectable:sn,ariaOrientation:null,ariaOwns:zt,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:sn,ariaReadOnly:sn,ariaRelevant:null,ariaRequired:sn,ariaRoleDescription:zt,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:sn,ariaSetSize:we,ariaSort:null,ariaValueMax:we,ariaValueMin:we,ariaValueNow:we,ariaValueText:null,role:null},transform(e,i){return i==="role"?i:"aria-"+i.slice(4).toLowerCase()}});function Nk(e,i){return i in e?e[i]:i}function Ek(e,i){return Nk(e,i.toLowerCase())}const o5=yl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ts,acceptCharset:zt,accessKey:zt,action:null,allow:null,allowFullScreen:We,allowPaymentRequest:We,allowUserMedia:We,alpha:We,alt:null,as:null,async:We,autoCapitalize:null,autoComplete:zt,autoFocus:We,autoPlay:We,blocking:zt,capture:null,charSet:null,checked:We,cite:null,className:zt,closedBy:null,colorSpace:null,cols:we,colSpan:we,command:null,commandFor:null,content:null,contentEditable:sn,controls:We,controlsList:zt,coords:we|ts,crossOrigin:null,data:null,dateTime:null,decoding:null,default:We,defer:We,dir:null,dirName:null,disabled:We,download:Th,draggable:sn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:We,formTarget:null,headers:zt,height:we,hidden:Th,high:we,href:null,hrefLang:null,htmlFor:zt,httpEquiv:zt,id:null,imageSizes:null,imageSrcSet:null,inert:We,inputMode:null,integrity:null,is:null,isMap:We,itemId:null,itemProp:zt,itemRef:zt,itemScope:We,itemType:zt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:We,low:we,manifest:null,max:null,maxLength:we,media:null,method:null,min:null,minLength:we,multiple:We,muted:We,name:null,nonce:null,noModule:We,noValidate:We,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:We,optimum:we,pattern:null,ping:zt,placeholder:null,playsInline:We,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:We,referrerPolicy:null,rel:zt,required:We,reversed:We,rows:we,rowSpan:we,sandbox:zt,scope:null,scoped:We,seamless:We,selected:We,shadowRootClonable:We,shadowRootCustomElementRegistry:We,shadowRootDelegatesFocus:We,shadowRootMode:null,shadowRootSerializable:We,shape:null,size:we,sizes:null,slot:null,span:we,spellCheck:sn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:we,step:null,style:null,tabIndex:we,target:null,title:null,translate:null,type:null,typeMustMatch:We,useMap:null,value:sn,width:we,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:zt,axis:null,background:null,bgColor:null,border:we,borderColor:null,bottomMargin:we,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:We,declare:We,event:null,face:null,frame:null,frameBorder:null,hSpace:we,leftMargin:we,link:null,longDesc:null,lowSrc:null,marginHeight:we,marginWidth:we,noResize:We,noHref:We,noShade:We,noWrap:We,object:null,profile:null,prompt:null,rev:null,rightMargin:we,rules:null,scheme:null,scrolling:sn,standby:null,summary:null,text:null,topMargin:we,valueType:null,version:null,vAlign:null,vLink:null,vSpace:we,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:We,disablePictureInPicture:We,disableRemotePlayback:We,exportParts:ts,part:zt,prefix:null,property:null,results:we,security:null,unselectable:null},space:"html",transform:Ek}),c5=yl({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:ci,accentHeight:we,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:we,amplitude:we,arabicForm:null,ascent:we,attributeName:null,attributeType:null,azimuth:we,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:we,by:null,calcMode:null,capHeight:we,className:zt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:we,diffuseConstant:we,direction:null,display:null,dur:null,divisor:we,dominantBaseline:null,download:We,dx:null,dy:null,edgeMode:null,editable:null,elevation:we,enableBackground:null,end:null,event:null,exponent:we,externalResourcesRequired:null,fill:null,fillOpacity:we,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ts,g2:ts,glyphName:ts,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:we,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:we,horizOriginX:we,horizOriginY:we,id:null,ideographic:we,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:we,k:we,k1:we,k2:we,k3:we,k4:we,kernelMatrix:ci,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:we,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:we,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:we,overlineThickness:we,paintOrder:null,panose1:null,path:null,pathLength:we,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:zt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:we,pointsAtY:we,pointsAtZ:we,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ci,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ci,rev:ci,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ci,requiredFeatures:ci,requiredFonts:ci,requiredFormats:ci,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:we,specularExponent:we,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:we,strikethroughThickness:we,string:null,stroke:null,strokeDashArray:ci,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:we,strokeOpacity:we,strokeWidth:null,style:null,surfaceScale:we,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ci,tabIndex:we,tableValues:null,target:null,targetX:we,targetY:we,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ci,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:we,underlineThickness:we,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:we,values:null,vAlphabetic:we,vMathematical:we,vectorEffect:null,vHanging:we,vIdeographic:we,version:null,vertAdvY:we,vertOriginX:we,vertOriginY:we,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:we,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Nk}),_k=yl({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,i){return"xlink:"+i.slice(5).toLowerCase()}}),Sk=yl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Ek}),Tk=yl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,i){return"xml:"+i.slice(3).toLowerCase()}}),u5={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},d5=/[A-Z]/g,B1=/-[a-z]/g,f5=/^data[-\w.:]+$/i;function p5(e,i){const a=Sh(i);let r=i,o=ei;if(a in e.normal)return e.property[e.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&f5.test(i)){if(i.charAt(4)==="-"){const u=i.slice(5).replace(B1,h5);r="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=i.slice(4);if(!B1.test(u)){let d=u.replace(d5,m5);d.charAt(0)!=="-"&&(d="-"+d),i="data"+d}}o=yg}return new o(r,i)}function m5(e){return"-"+e.toLowerCase()}function h5(e){return e.charAt(1).toUpperCase()}const g5=wk([kk,o5,_k,Sk,Tk],"html"),vg=wk([kk,c5,_k,Sk,Tk],"svg");function x5(e){return e.join(" ").trim()}var tl={},Mm,$1;function b5(){if($1)return Mm;$1=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,i=/\n/g,a=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d=/^[;\s]*/,p=/^\s+|\s+$/g,h=`
|
|
216
|
+
`,g="/",x="*",b="",y="comment",v="declaration";function w(E,N){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];N=N||{};var j=1,A=1;function R(se){var ae=se.match(i);ae&&(j+=ae.length);var O=se.lastIndexOf(h);A=~O?se.length-O:A+se.length}function $(){var se={line:j,column:A};return function(ae){return ae.position=new z(se),q(),ae}}function z(se){this.start=se,this.end={line:j,column:A},this.source=N.source}z.prototype.content=E;function C(se){var ae=new Error(N.source+":"+j+":"+A+": "+se);if(ae.reason=se,ae.filename=N.source,ae.line=j,ae.column=A,ae.source=E,!N.silent)throw ae}function L(se){var ae=se.exec(E);if(ae){var O=ae[0];return R(O),E=E.slice(O.length),ae}}function q(){L(a)}function M(se){var ae;for(se=se||[];ae=H();)ae!==!1&&se.push(ae);return se}function H(){var se=$();if(!(g!=E.charAt(0)||x!=E.charAt(1))){for(var ae=2;b!=E.charAt(ae)&&(x!=E.charAt(ae)||g!=E.charAt(ae+1));)++ae;if(ae+=2,b===E.charAt(ae-1))return C("End of comment missing");var O=E.slice(2,ae-2);return A+=2,R(O),E=E.slice(ae),A+=2,se({type:y,comment:O})}}function Z(){var se=$(),ae=L(r);if(ae){if(H(),!L(o))return C("property missing ':'");var O=L(u),ee=se({type:v,property:T(ae[0].replace(e,b)),value:O?T(O[0].replace(e,b)):b});return L(d),ee}}function he(){var se=[];M(se);for(var ae;ae=Z();)ae!==!1&&(se.push(ae),M(se));return se}return q(),he()}function T(E){return E?E.replace(p,b):b}return Mm=w,Mm}var P1;function y5(){if(P1)return tl;P1=1;var e=tl&&tl.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(tl,"__esModule",{value:!0}),tl.default=a;const i=e(b5());function a(r,o){let u=null;if(!r||typeof r!="string")return u;const d=(0,i.default)(r),p=typeof o=="function";return d.forEach(h=>{if(h.type!=="declaration")return;const{property:g,value:x}=h;p?o(g,x,h):x&&(u=u||{},u[g]=x)}),u}return tl}var yo={},H1;function v5(){if(H1)return yo;H1=1,Object.defineProperty(yo,"__esModule",{value:!0}),yo.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,i=/-([a-z])/g,a=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,u=function(g){return!g||a.test(g)||e.test(g)},d=function(g,x){return x.toUpperCase()},p=function(g,x){return"".concat(x,"-")},h=function(g,x){return x===void 0&&(x={}),u(g)?g:(g=g.toLowerCase(),x.reactCompat?g=g.replace(o,p):g=g.replace(r,p),g.replace(i,d))};return yo.camelCase=h,yo}var vo,F1;function w5(){if(F1)return vo;F1=1;var e=vo&&vo.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},i=e(y5()),a=v5();function r(o,u){var d={};return!o||typeof o!="string"||(0,i.default)(o,function(p,h){p&&h&&(d[(0,a.camelCase)(p,u)]=h)}),d}return r.default=r,vo=r,vo}var k5=w5();const N5=fd(k5),Ck=jk("end"),wg=jk("start");function jk(e){return i;function i(a){const r=a&&a.position&&a.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function E5(e){const i=wg(e),a=Ck(e);if(i&&a)return{start:i,end:a}}function Ao(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?q1(e.position):"start"in e||"end"in e?q1(e):"line"in e||"column"in e?jh(e):""}function jh(e){return G1(e&&e.line)+":"+G1(e&&e.column)}function q1(e){return jh(e&&e.start)+"-"+jh(e&&e.end)}function G1(e){return e&&typeof e=="number"?e:1}class Dn extends Error{constructor(i,a,r){super(),typeof a=="string"&&(r=a,a=void 0);let o="",u={},d=!1;if(a&&("line"in a&&"column"in a?u={place:a}:"start"in a&&"end"in a?u={place:a}:"type"in a?u={ancestors:[a],place:a.position}:u={...a}),typeof i=="string"?o=i:!u.cause&&i&&(d=!0,o=i.message,u.cause=i),!u.ruleId&&!u.source&&typeof r=="string"){const h=r.indexOf(":");h===-1?u.ruleId=r:(u.source=r.slice(0,h),u.ruleId=r.slice(h+1))}if(!u.place&&u.ancestors&&u.ancestors){const h=u.ancestors[u.ancestors.length-1];h&&(u.place=h.position)}const p=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=p?p.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=p?p.line:void 0,this.name=Ao(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=d&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Dn.prototype.file="";Dn.prototype.name="";Dn.prototype.reason="";Dn.prototype.message="";Dn.prototype.stack="";Dn.prototype.column=void 0;Dn.prototype.line=void 0;Dn.prototype.ancestors=void 0;Dn.prototype.cause=void 0;Dn.prototype.fatal=void 0;Dn.prototype.place=void 0;Dn.prototype.ruleId=void 0;Dn.prototype.source=void 0;const kg={}.hasOwnProperty,_5=new Map,S5=/[A-Z]/g,T5=new Set(["table","tbody","thead","tfoot","tr"]),C5=new Set(["td","th"]),Ak="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function j5(e,i){if(!i||i.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const a=i.filePath||void 0;let r;if(i.development){if(typeof i.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=I5(a,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");r=L5(a,i.jsx,i.jsxs)}const o={Fragment:i.Fragment,ancestors:[],components:i.components||{},create:r,elementAttributeNameCase:i.elementAttributeNameCase||"react",evaluater:i.createEvaluater?i.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:i.ignoreInvalidStyle||!1,passKeys:i.passKeys!==!1,passNode:i.passNode||!1,schema:i.space==="svg"?vg:g5,stylePropertyNameCase:i.stylePropertyNameCase||"dom",tableCellAlignToStyle:i.tableCellAlignToStyle!==!1},u=Ok(o,e,void 0);return u&&typeof u!="string"?u:o.create(e,o.Fragment,{children:u||void 0},void 0)}function Ok(e,i,a){if(i.type==="element")return A5(e,i,a);if(i.type==="mdxFlowExpression"||i.type==="mdxTextExpression")return O5(e,i);if(i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement")return R5(e,i,a);if(i.type==="mdxjsEsm")return M5(e,i);if(i.type==="root")return D5(e,i,a);if(i.type==="text")return z5(e,i)}function A5(e,i,a){const r=e.schema;let o=r;i.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=vg,e.schema=o),e.ancestors.push(i);const u=Rk(e,i.tagName,!1),d=U5(e,i);let p=Eg(e,i);return T5.has(i.tagName)&&(p=p.filter(function(h){return typeof h=="string"?!s5(h):!0})),Mk(e,d,u,i),Ng(d,p),e.ancestors.pop(),e.schema=r,e.create(i,u,d,a)}function O5(e,i){if(i.data&&i.data.estree&&e.evaluater){const r=i.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}$o(e,i.position)}function M5(e,i){if(i.data&&i.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(i.data.estree);$o(e,i.position)}function R5(e,i,a){const r=e.schema;let o=r;i.name==="svg"&&r.space==="html"&&(o=vg,e.schema=o),e.ancestors.push(i);const u=i.name===null?e.Fragment:Rk(e,i.name,!0),d=B5(e,i),p=Eg(e,i);return Mk(e,d,u,i),Ng(d,p),e.ancestors.pop(),e.schema=r,e.create(i,u,d,a)}function D5(e,i,a){const r={};return Ng(r,Eg(e,i)),e.create(i,e.Fragment,r,a)}function z5(e,i){return i.value}function Mk(e,i,a,r){typeof a!="string"&&a!==e.Fragment&&e.passNode&&(i.node=r)}function Ng(e,i){if(i.length>0){const a=i.length>1?i:i[0];a&&(e.children=a)}}function L5(e,i,a){return r;function r(o,u,d,p){const g=Array.isArray(d.children)?a:i;return p?g(u,d,p):g(u,d)}}function I5(e,i){return a;function a(r,o,u,d){const p=Array.isArray(u.children),h=wg(r);return i(o,u,d,p,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function U5(e,i){const a={};let r,o;for(o in i.properties)if(o!=="children"&&kg.call(i.properties,o)){const u=$5(e,o,i.properties[o]);if(u){const[d,p]=u;e.tableCellAlignToStyle&&d==="align"&&typeof p=="string"&&C5.has(i.tagName)?r=p:a[d]=p}}if(r){const u=a.style||(a.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return a}function B5(e,i){const a={};for(const r of i.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const u=r.data.estree.body[0];u.type;const d=u.expression;d.type;const p=d.properties[0];p.type,Object.assign(a,e.evaluater.evaluateExpression(p.argument))}else $o(e,i.position);else{const o=r.name;let u;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const p=r.value.data.estree.body[0];p.type,u=e.evaluater.evaluateExpression(p.expression)}else $o(e,i.position);else u=r.value===null?!0:r.value;a[o]=u}return a}function Eg(e,i){const a=[];let r=-1;const o=e.passKeys?new Map:_5;for(;++r<i.children.length;){const u=i.children[r];let d;if(e.passKeys){const h=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(h){const g=o.get(h)||0;d=h+"-"+g,o.set(h,g+1)}}const p=Ok(e,u,d);p!==void 0&&a.push(p)}return a}function $5(e,i,a){const r=p5(e.schema,i);if(!(a==null||typeof a=="number"&&Number.isNaN(a))){if(Array.isArray(a)&&(a=r.commaSeparated?t5(a):x5(a)),r.property==="style"){let o=typeof a=="object"?a:P5(e,String(a));return e.stylePropertyNameCase==="css"&&(o=H5(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?u5[r.property]||r.property:r.attribute,a]}}function P5(e,i){try{return N5(i,{reactCompat:!0})}catch(a){if(e.ignoreInvalidStyle)return{};const r=a,o=new Dn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=Ak+"#cannot-parse-style-attribute",o}}function Rk(e,i,a){let r;if(!a)r={type:"Literal",value:i};else if(i.includes(".")){const o=i.split(".");let u=-1,d;for(;++u<o.length;){const p=L1(o[u])?{type:"Identifier",name:o[u]}:{type:"Literal",value:o[u]};d=d?{type:"MemberExpression",object:d,property:p,computed:!!(u&&p.type==="Literal"),optional:!1}:p}r=d}else r=L1(i)&&!/^[a-z]/.test(i)?{type:"Identifier",name:i}:{type:"Literal",value:i};if(r.type==="Literal"){const o=r.value;return kg.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);$o(e)}function $o(e,i){const a=new Dn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:i,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=Ak+"#cannot-handle-mdx-estrees-without-createevaluater",a}function H5(e){const i={};let a;for(a in e)kg.call(e,a)&&(i[F5(a)]=e[a]);return i}function F5(e){let i=e.replace(S5,q5);return i.slice(0,3)==="ms-"&&(i="-"+i),i}function q5(e){return"-"+e.toLowerCase()}const Rm={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},G5={};function _g(e,i){const a=G5,r=typeof a.includeImageAlt=="boolean"?a.includeImageAlt:!0,o=typeof a.includeHtml=="boolean"?a.includeHtml:!0;return Dk(e,r,o)}function Dk(e,i,a){if(Y5(e)){if("value"in e)return e.type==="html"&&!a?"":e.value;if(i&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Y1(e.children,i,a)}return Array.isArray(e)?Y1(e,i,a):""}function Y1(e,i,a){const r=[];let o=-1;for(;++o<e.length;)r[o]=Dk(e[o],i,a);return r.join("")}function Y5(e){return!!(e&&typeof e=="object")}const V1=document.createElement("i");function Sg(e){const i="&"+e+";";V1.innerHTML=i;const a=V1.textContent;return a.charCodeAt(a.length-1)===59&&e!=="semi"||a===i?!1:a}function $i(e,i,a,r){const o=e.length;let u=0,d;if(i<0?i=-i>o?0:o+i:i=i>o?o:i,a=a>0?a:0,r.length<1e4)d=Array.from(r),d.unshift(i,a),e.splice(...d);else for(a&&e.splice(i,a);u<r.length;)d=r.slice(u,u+1e4),d.unshift(i,0),e.splice(...d),u+=1e4,i+=1e4}function ki(e,i){return e.length>0?($i(e,e.length,0,i),e):i}const K1={}.hasOwnProperty;function zk(e){const i={};let a=-1;for(;++a<e.length;)V5(i,e[a]);return i}function V5(e,i){let a;for(a in i){const o=(K1.call(e,a)?e[a]:void 0)||(e[a]={}),u=i[a];let d;if(u)for(d in u){K1.call(o,d)||(o[d]=[]);const p=u[d];K5(o[d],Array.isArray(p)?p:p?[p]:[])}}}function K5(e,i){let a=-1;const r=[];for(;++a<i.length;)(i[a].add==="after"?e:r).push(i[a]);$i(e,0,0,r)}function Lk(e,i){const a=Number.parseInt(e,i);return a<9||a===11||a>13&&a<32||a>126&&a<160||a>55295&&a<57344||a>64975&&a<65008||(a&65535)===65535||(a&65535)===65534||a>1114111?"�":String.fromCodePoint(a)}function Pi(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Hn=Er(/[A-Za-z]/),Mn=Er(/[\dA-Za-z]/),X5=Er(/[#-'*+\--9=?A-Z^-~]/);function ad(e){return e!==null&&(e<32||e===127)}const Ah=Er(/\d/),Z5=Er(/[\dA-Fa-f]/),Q5=Er(/[!-/:-@[-`{-~]/);function Fe(e){return e!==null&&e<-2}function Lt(e){return e!==null&&(e<0||e===32)}function lt(e){return e===-2||e===-1||e===32}const Od=Er(/\p{P}|\p{S}/u),as=Er(/\s/);function Er(e){return i;function i(a){return a!==null&&a>-1&&e.test(String.fromCharCode(a))}}function vl(e){const i=[];let a=-1,r=0,o=0;for(;++a<e.length;){const u=e.charCodeAt(a);let d="";if(u===37&&Mn(e.charCodeAt(a+1))&&Mn(e.charCodeAt(a+2)))o=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(d=String.fromCharCode(u));else if(u>55295&&u<57344){const p=e.charCodeAt(a+1);u<56320&&p>56319&&p<57344?(d=String.fromCharCode(u,p),o=1):d="�"}else d=String.fromCharCode(u);d&&(i.push(e.slice(r,a),encodeURIComponent(d)),r=a+o+1,d=""),o&&(a+=o,o=0)}return i.join("")+e.slice(r)}function bt(e,i,a,r){const o=r?r-1:1/0;let u=0;return d;function d(h){return lt(h)?(e.enter(a),p(h)):i(h)}function p(h){return lt(h)&&u++<o?(e.consume(h),p):(e.exit(a),i(h))}}function Ik(e,i,a,r,o,u){let d=0;return p;function p(x){return lt(x)?(e.enter(r),h(x)):g(x)}function h(x){return lt(x)&&d<u?(e.consume(x),d++,h):(e.exit(r),g(x))}function g(x){return d>=o?i(x):a(x)}}const J5={tokenize:W5};function W5(e){const i=e.attempt(this.parser.constructs.contentInitial,r,o);let a;return i;function r(p){if(p===null){e.consume(p);return}return e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),bt(e,i,"linePrefix")}function o(p){return e.enter("paragraph"),u(p)}function u(p){const h=e.enter("chunkText",{contentType:"text",previous:a});return a&&(a.next=h),a=h,d(p)}function d(p){if(p===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(p);return}return Fe(p)?(e.consume(p),e.exit("chunkText"),u):(e.consume(p),d)}}let rd=class{constructor(){this.index=new Map,this.map=[]}add(i,a,r){X1(this,i,a,r,!1)}addBefore(i,a,r){X1(this,i,a,r,!0)}consume(i){if(this.map.sort(function(u,d){return u[0]-d[0]}),this.map.length===0)return;let a=this.map.length;const r=[];for(;a>0;)a-=1,r.push(i.slice(this.map[a][0]+this.map[a][1]),this.map[a][2]),i.length=this.map[a][0];r.push(i.slice()),i.length=0;let o=r.pop();for(;o;){for(const u of o)i.push(u);o=r.pop()}this.map.length=0,this.index.clear()}};function X1(e,i,a,r,o){if(a===0&&r.length===0)return;const u=e.index.get(i);if(u){u[1]+=a,o?(r.push(...u[2]),u[2]=r):u[2].push(...r);return}const d=[i,a,r];e.map.push(d),e.index.set(i,d)}const eR={tokenize:tR},Z1={tokenize:nR};function tR(e){const i=this,a=[];let r=0,o,u,d;return p;function p(A){if(r<a.length){const R=a[r];return i.containerState=R[1],e.attempt(R[0].continuation,h,g)(A)}return g(A)}function h(A){if(r++,i.containerState._closeFlow){i.containerState._closeFlow=void 0,o&&j();const R=i.events.length;let $=R,z;for(;$--;)if(i.events[$][0]==="exit"&&i.events[$][1].type==="chunkFlow"){z=i.events[$][1].end;break}N(r);let C=R;for(;C<i.events.length;)i.events[C][1].end={...z},C++;const L=new rd;return L.add($+1,0,i.events.slice(R)),L.add(R,C-R,[]),L.consume(i.events),g(A)}return p(A)}function g(A){if(r===a.length){if(!o)return y(A);if(o.currentConstruct&&o.currentConstruct.concrete)return w(A);i.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return i.containerState={},e.check(Z1,x,b)(A)}function x(A){return o&&j(),N(r),y(A)}function b(A){return i.parser.lazy[i.now().line]=r!==a.length,d=i.now().offset,w(A)}function y(A){return i.containerState={},e.attempt(Z1,v,w)(A)}function v(A){return r++,a.push([i.currentConstruct,i.containerState]),y(A)}function w(A){if(A===null){o&&j(),N(0),e.consume(A);return}return o=o||i.parser.flow(i.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:u}),T(A)}function T(A){if(A===null){E(e.exit("chunkFlow"),!0),N(0),e.consume(A);return}return Fe(A)?(e.consume(A),E(e.exit("chunkFlow")),r=0,i.interrupt=void 0,p):(e.consume(A),T)}function E(A,R){const $=i.sliceStream(A);if(R&&$.push(null),A.previous=u,u&&(u.next=A),u=A,o.defineSkip(A.start),o.write($),i.parser.lazy[A.start.line]){let z=o.events.length;for(;z--;)if(o.events[z][1].start.offset<d&&(!o.events[z][1].end||o.events[z][1].end.offset>d))return;const C=i.events.length;let L=C,q,M;for(;L--;)if(i.events[L][0]==="exit"&&i.events[L][1].type==="chunkFlow"){if(q){M=i.events[L][1].end;break}q=!0}for(N(r),z=C;z<i.events.length;)i.events[z][1].end={...M},z++;const H=new rd;H.add(L+1,0,i.events.slice(C)),H.add(C,z-C,[]),H.consume(i.events)}}function N(A){let R=a.length;for(;R-- >A;){const $=a[R];i.containerState=$[1],$[0].exit.call(i,e)}a.length=A}function j(){o.write([null]),u=void 0,o=void 0,i.containerState._closeFlow=void 0}}function nR(e,i,a){return bt(e,e.attempt(this.parser.constructs.document,i,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function sd(e){if(e===null||Lt(e)||as(e))return 1;if(Od(e))return 2}function Md(e,i,a){const r=[];let o=-1;for(;++o<e.length;){const u=e[o].resolveAll;u&&!r.includes(u)&&(i=u(i,a),r.push(u))}return i}const Oh={name:"attention",resolveAll:iR,tokenize:aR};function iR(e,i){let a=-1,r;for(;++a<e.length;)if(e[a][0]==="enter"&&e[a][1].type==="attentionSequence"&&e[a][1]._close){let o=a;for(;o--;)if(e[o][0]==="exit"&&e[o][1].type==="attentionSequence"&&e[o][1]._open&&i.sliceSerialize(e[o][1]).charCodeAt(0)===i.sliceSerialize(e[a][1]).charCodeAt(0)){if((e[o][1]._close||e[a][1]._open)&&(e[a][1].end.offset-e[a][1].start.offset)%3&&!((e[o][1].end.offset-e[o][1].start.offset+e[a][1].end.offset-e[a][1].start.offset)%3))continue;const u=e[o][1].end.offset-e[o][1].start.offset>1&&e[a][1].end.offset-e[a][1].start.offset>1?2:1,d={...e[o][1].end},p={...e[a][1].start};Q1(d,-u),Q1(p,u);const h={type:u>1?"strongSequence":"emphasisSequence",start:d,end:{...e[o][1].end}},g={type:u>1?"strongSequence":"emphasisSequence",start:{...e[a][1].start},end:p},x={type:u>1?"strongText":"emphasisText",start:{...e[o][1].end},end:{...e[a][1].start}},b={type:u>1?"strong":"emphasis",start:{...h.start},end:{...g.end}};e[o][1].end={...h.start},e[a][1].start={...g.end},r=[],e[o][1].end.offset-e[o][1].start.offset&&(r=ki(r,[["enter",e[o][1],i],["exit",e[o][1],i]])),r=ki(r,[["enter",b,i],["enter",h,i],["exit",h,i],["enter",x,i]]),r=ki(r,Md(i.parser.constructs.insideSpan.null,e.slice(o+1,a),i)),r=ki(r,[["exit",x,i],["enter",g,i],["exit",g,i],["exit",b,i]]);let y=0;e[a][1].end.offset-e[a][1].start.offset&&(y=2,r=ki(r,[["enter",e[a][1],i],["exit",e[a][1],i]])),$i(e,o-1,a-o+3,r),a=o+r.length-y-2;break}}for(a=-1;++a<e.length;)e[a][1].type==="attentionSequence"&&(e[a][1].type="data");return e}function aR(e,i){const a=this.parser.constructs.attentionMarkers.null,r=this.previous,o=sd(r);let u;return d;function d(h){return u=h,e.enter("attentionSequence"),p(h)}function p(h){if(h===u)return e.consume(h),p;const g=e.exit("attentionSequence"),x=sd(h),b=!x||x===2&&o||a.includes(h)&&h!==42&&h!==95,y=!o||o===2&&x||a.includes(r)&&r!==42&&r!==95;return g._open=!!(u===42?b:b&&(o||!y)),g._close=!!(u===42?y:y&&(x||!b)),i(h)}}function Q1(e,i){e.column+=i,e.offset+=i,e._bufferIndex+=i}const rR={name:"autolink",tokenize:sR};function sR(e,i,a){let r=0;return o;function o(v){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(v){return Hn(v)?(e.consume(v),d):v===64?a(v):g(v)}function d(v){return v===43||v===45||v===46||Mn(v)?(r=1,p(v)):g(v)}function p(v){return v===58?(e.consume(v),r=0,h):(v===43||v===45||v===46||Mn(v))&&r++<32?(e.consume(v),p):(r=0,g(v))}function h(v){return v===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),i):v===null||v===32||v===60||ad(v)?a(v):(e.consume(v),h)}function g(v){return v===64?(e.consume(v),x):X5(v)?(e.consume(v),g):a(v)}function x(v){return Mn(v)?b(v):a(v)}function b(v){return v===46?(e.consume(v),r=0,x):v===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),i):y(v)}function y(v){if((v===45||Mn(v))&&r++<63){const w=v===45?y:b;return e.consume(v),w}return a(v)}}const Zo={partial:!0,tokenize:lR};function lR(e,i,a){return r;function r(u){return lt(u)?bt(e,o,"linePrefix")(u):o(u)}function o(u){return u===null||Fe(u)?i(u):a(u)}}const Uk={continuation:{tokenize:cR},exit:uR,name:"blockQuote",tokenize:oR};function oR(e,i,a){const r=this;return o;function o(d){if(d===62){const p=r.containerState;return p.open||(e.enter("blockQuote",{_container:!0}),p.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(d),e.exit("blockQuoteMarker"),u}return a(d)}function u(d){return lt(d)?(e.enter("blockQuotePrefixWhitespace"),e.consume(d),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),i):(e.exit("blockQuotePrefix"),i(d))}}function cR(e,i,a){const r=this;return o;function o(d){return lt(d)?bt(e,u,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):u(d)}function u(d){return e.attempt(Uk,i,a)(d)}}function uR(e){e.exit("blockQuote")}const Bk={name:"characterEscape",tokenize:dR};function dR(e,i,a){return r;function r(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),o}function o(u){return Q5(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),i):a(u)}}const $k={name:"characterReference",tokenize:fR};function fR(e,i,a){const r=this;let o=0,u,d;return p;function p(b){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(b),e.exit("characterReferenceMarker"),h}function h(b){return b===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(b),e.exit("characterReferenceMarkerNumeric"),g):(e.enter("characterReferenceValue"),u=31,d=Mn,x(b))}function g(b){return b===88||b===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(b),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,d=Z5,x):(e.enter("characterReferenceValue"),u=7,d=Ah,x(b))}function x(b){if(b===59&&o){const y=e.exit("characterReferenceValue");return d===Mn&&!Sg(r.sliceSerialize(y))?a(b):(e.enter("characterReferenceMarker"),e.consume(b),e.exit("characterReferenceMarker"),e.exit("characterReference"),i)}return d(b)&&o++<u?(e.consume(b),x):a(b)}}const Mh={partial:!0,tokenize:pR};function pR(e,i,a){const r=this;return o;function o(d){return d===null?a(d):(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u)}function u(d){return r.parser.lazy[r.now().line]?a(d):i(d)}}const J1={concrete:!0,name:"codeFenced",tokenize:mR};function mR(e,i,a){const r=this,o={partial:!0,tokenize:$};let u=0,d=0,p;return h;function h(z){return g(z)}function g(z){const C=r.events[r.events.length-1];return u=C&&C[1].type==="linePrefix"?C[2].sliceSerialize(C[1],!0).length:0,p=z,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),x(z)}function x(z){return z===p?(d++,e.consume(z),x):d<3?a(z):(e.exit("codeFencedFenceSequence"),lt(z)?bt(e,b,"whitespace")(z):b(z))}function b(z){return z===null||Fe(z)?(e.exit("codeFencedFence"),r.interrupt?i(z):e.check(Mh,T,R)(z)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(z))}function y(z){return z===null||Fe(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),b(z)):lt(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),bt(e,v,"whitespace")(z)):z===96&&z===p?a(z):(e.consume(z),y)}function v(z){return z===null||Fe(z)?b(z):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),w(z))}function w(z){return z===null||Fe(z)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),b(z)):z===96&&z===p?a(z):(e.consume(z),w)}function T(z){return e.attempt(o,R,E)(z)}function E(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),N}function N(z){return u>0&<(z)?bt(e,j,"linePrefix",u+1)(z):j(z)}function j(z){return z===null||Fe(z)?e.check(Mh,T,R)(z):(e.enter("codeFlowValue"),A(z))}function A(z){return z===null||Fe(z)?(e.exit("codeFlowValue"),j(z)):(e.consume(z),A)}function R(z){return e.exit("codeFenced"),i(z)}function $(z,C,L){let q=0;return M;function M(ae){return z.enter("lineEnding"),z.consume(ae),z.exit("lineEnding"),H}function H(ae){return z.enter("codeFencedFence"),lt(ae)?bt(z,Z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(ae):Z(ae)}function Z(ae){return ae===p?(z.enter("codeFencedFenceSequence"),he(ae)):L(ae)}function he(ae){return ae===p?(q++,z.consume(ae),he):q>=d?(z.exit("codeFencedFenceSequence"),lt(ae)?bt(z,se,"whitespace")(ae):se(ae)):L(ae)}function se(ae){return ae===null||Fe(ae)?(z.exit("codeFencedFence"),C(ae)):L(ae)}}}const Dm={name:"codeIndented",tokenize:gR},hR={partial:!0,tokenize:xR};function gR(e,i,a){return r;function r(p){return e.enter("codeIndented"),Ik(e,o,a,"linePrefix",4,4)(p)}function o(p){return p===null?d(p):Fe(p)?e.attempt(hR,o,d)(p):(e.enter("codeFlowValue"),u(p))}function u(p){return p===null||Fe(p)?(e.exit("codeFlowValue"),o(p)):(e.consume(p),u)}function d(p){return e.exit("codeIndented"),i(p)}}function xR(e,i,a){const r=this;return o;function o(d){return r.parser.lazy[r.now().line]?a(d):Fe(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),o):Ik(e,i,u,"linePrefix",4,4)(d)}function u(d){return Fe(d)?o(d):a(d)}}const bR={name:"codeText",previous:vR,resolve:yR,tokenize:wR};function yR(e){let i=e.length-4,a=3,r,o;if((e[a][1].type==="lineEnding"||e[a][1].type==="space")&&(e[i][1].type==="lineEnding"||e[i][1].type==="space")){for(r=a;++r<i;)if(e[r][1].type==="codeTextData"){e[a][1].type="codeTextPadding",e[i][1].type="codeTextPadding",a+=2,i-=2;break}}for(r=a-1,i++;++r<=i;)o===void 0?r!==i&&e[r][1].type!=="lineEnding"&&(o=r):(r===i||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),i-=r-o-2,r=o+2),o=void 0);return e}function vR(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function wR(e,i,a){let r=0,o,u;return d;function d(b){return e.enter("codeText"),e.enter("codeTextSequence"),p(b)}function p(b){return b===96?(e.consume(b),r++,p):(e.exit("codeTextSequence"),h(b))}function h(b){return b===null?a(b):b===32?(e.enter("space"),e.consume(b),e.exit("space"),h):b===96?(u=e.enter("codeTextSequence"),o=0,x(b)):Fe(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),h):(e.enter("codeTextData"),g(b))}function g(b){return b===null||b===32||b===96||Fe(b)?(e.exit("codeTextData"),h(b)):(e.consume(b),g)}function x(b){return b===96?(e.consume(b),o++,x):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),i(b)):(u.type="codeTextData",g(b))}}class kR{constructor(i){this.left=i?[...i]:[],this.right=[]}get(i){if(i<0||i>=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 i<this.left.length?this.left[i]:this.right[this.right.length-i+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(i,a){const r=a??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(i,r):i>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-i+this.left.length).reverse():this.left.slice(i).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(i,a,r){const o=a||0;this.setCursor(Math.trunc(i));const u=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&wo(this.left,r),u.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),wo(this.left,i)}unshift(i){this.setCursor(0),this.right.push(i)}unshiftMany(i){this.setCursor(0),wo(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<this.left.length){const a=this.left.splice(i,Number.POSITIVE_INFINITY);wo(this.right,a.reverse())}else{const a=this.right.splice(this.left.length+this.right.length-i,Number.POSITIVE_INFINITY);wo(this.left,a.reverse())}}}function wo(e,i){let a=0;if(i.length<1e4)e.push(...i);else for(;a<i.length;)e.push(...i.slice(a,a+1e4)),a+=1e4}function Pk(e){const i={};let a=-1,r,o,u,d,p,h,g;const x=new kR(e);for(;++a<x.length;){for(;a in i;)a=i[a];if(r=x.get(a),a&&r[1].type==="chunkFlow"&&x.get(a-1)[1].type==="listItemPrefix"&&(h=r[1]._tokenizer.events,u=0,u<h.length&&h[u][1].type==="lineEndingBlank"&&(u+=2),u<h.length&&h[u][1].type==="content"))for(;++u<h.length&&h[u][1].type!=="content";)h[u][1].type==="chunkText"&&(h[u][1]._isInFirstContentOfListItem=!0,u++);if(r[0]==="enter")r[1].contentType&&(Object.assign(i,NR(x,a)),a=i[a],g=!0);else if(r[1]._container){for(u=a,o=void 0;u--;)if(d=x.get(u),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(o&&(x.get(o)[1].type="lineEndingBlank"),d[1].type="lineEnding",o=u);else if(!(d[1].type==="linePrefix"||d[1].type==="listItemIndent"))break;o&&(r[1].end={...x.get(o)[1].start},p=x.slice(o,a),p.unshift(r),x.splice(o,a-o+1,p))}}return $i(e,0,Number.POSITIVE_INFINITY,x.slice(0)),!g}function NR(e,i){const a=e.get(i)[1],r=e.get(i)[2];let o=i-1;const u=[];let d=a._tokenizer;d||(d=r.parser[a.contentType](a.start),a._contentTypeTextTrailing&&(d._contentTypeTextTrailing=!0));const p=d.events,h=[],g={};let x,b,y=-1,v=a,w=0,T=0;const E=[T];for(;v;){for(;e.get(++o)[1]!==v;);u.push(o),v._tokenizer||(x=r.sliceStream(v),v.next||x.push(null),b&&d.defineSkip(v.start),v._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(x),v._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=void 0)),b=v,v=v.next}for(v=a;++y<p.length;)p[y][0]==="exit"&&p[y-1][0]==="enter"&&p[y][1].type===p[y-1][1].type&&p[y][1].start.line!==p[y][1].end.line&&(T=y+1,E.push(T),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(d.events=[],v?(v._tokenizer=void 0,v.previous=void 0):E.pop(),y=E.length;y--;){const N=p.slice(E[y],E[y+1]),j=u.pop();h.push([j,j+N.length-1]),e.splice(j,2,N)}for(h.reverse(),y=-1;++y<h.length;)g[w+h[y][0]]=w+h[y][1],w+=h[y][1]-h[y][0]-1;return g}const ER={resolve:SR,tokenize:TR},_R={partial:!0,tokenize:CR};function SR(e){return Pk(e),e}function TR(e,i){let a;return r;function r(p){return e.enter("content"),a=e.enter("chunkContent",{contentType:"content"}),o(p)}function o(p){return p===null?u(p):Fe(p)?e.check(_R,d,u)(p):(e.consume(p),o)}function u(p){return e.exit("chunkContent"),e.exit("content"),i(p)}function d(p){return e.consume(p),e.exit("chunkContent"),a.next=e.enter("chunkContent",{contentType:"content",previous:a}),a=a.next,o}}function CR(e,i,a){const r=this;return o;function o(d){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),bt(e,u,"linePrefix")}function u(d){if(d===null||Fe(d))return a(d);const p=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?i(d):e.interrupt(r.parser.constructs.flow,a,i)(d)}}function Hk(e,i,a,r,o,u,d,p,h){const g=h||Number.POSITIVE_INFINITY;let x=0;return b;function b(N){return N===60?(e.enter(r),e.enter(o),e.enter(u),e.consume(N),e.exit(u),y):N===null||N===32||N===41||ad(N)?a(N):(e.enter(r),e.enter(d),e.enter(p),e.enter("chunkString",{contentType:"string"}),T(N))}function y(N){return N===62?(e.enter(u),e.consume(N),e.exit(u),e.exit(o),e.exit(r),i):(e.enter(p),e.enter("chunkString",{contentType:"string"}),v(N))}function v(N){return N===62?(e.exit("chunkString"),e.exit(p),y(N)):N===null||N===60||Fe(N)?a(N):(e.consume(N),N===92?w:v)}function w(N){return N===60||N===62||N===92?(e.consume(N),v):v(N)}function T(N){return!x&&(N===null||N===41||Lt(N))?(e.exit("chunkString"),e.exit(p),e.exit(d),e.exit(r),i(N)):x<g&&N===40?(e.consume(N),x++,T):N===41?(e.consume(N),x--,T):N===null||N===32||N===40||ad(N)?a(N):(e.consume(N),N===92?E:T)}function E(N){return N===40||N===41||N===92?(e.consume(N),T):T(N)}}function Fk(e,i,a,r,o,u){const d=this;let p=0,h;return g;function g(v){return e.enter(r),e.enter(o),e.consume(v),e.exit(o),e.enter(u),x}function x(v){return p>999||v===null||v===91||v===93&&!h||v===94&&!p&&"_hiddenFootnoteSupport"in d.parser.constructs?a(v):v===93?(e.exit(u),e.enter(o),e.consume(v),e.exit(o),e.exit(r),i):Fe(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),x):(e.enter("chunkString",{contentType:"string"}),b(v))}function b(v){return v===null||v===91||v===93||Fe(v)||p++>999?(e.exit("chunkString"),x(v)):(e.consume(v),h||(h=!lt(v)),v===92?y:b)}function y(v){return v===91||v===92||v===93?(e.consume(v),p++,b):b(v)}}function qk(e,i,a,r,o,u){let d;return p;function p(y){return y===34||y===39||y===40?(e.enter(r),e.enter(o),e.consume(y),e.exit(o),d=y===40?41:y,h):a(y)}function h(y){return y===d?(e.enter(o),e.consume(y),e.exit(o),e.exit(r),i):(e.enter(u),g(y))}function g(y){return y===d?(e.exit(u),h(d)):y===null?a(y):Fe(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),bt(e,g,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),x(y))}function x(y){return y===d||y===null||Fe(y)?(e.exit("chunkString"),g(y)):(e.consume(y),y===92?b:x)}function b(y){return y===d||y===92?(e.consume(y),x):x(y)}}function Oo(e,i){let a;return r;function r(o){return Fe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a=!0,r):lt(o)?bt(e,r,a?"linePrefix":"lineSuffix")(o):i(o)}}const jR={name:"definition",tokenize:OR},AR={partial:!0,tokenize:MR};function OR(e,i,a){const r=this;let o;return u;function u(v){return e.enter("definition"),d(v)}function d(v){return Fk.call(r,e,p,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function p(v){return o=Pi(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),h):a(v)}function h(v){return Lt(v)?Oo(e,g)(v):g(v)}function g(v){return Hk(e,x,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function x(v){return e.attempt(AR,b,b)(v)}function b(v){return lt(v)?bt(e,y,"whitespace")(v):y(v)}function y(v){return v===null||Fe(v)?(e.exit("definition"),r.parser.defined.push(o),i(v)):a(v)}}function MR(e,i,a){return r;function r(p){return Lt(p)?Oo(e,o)(p):a(p)}function o(p){return qk(e,u,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(p)}function u(p){return lt(p)?bt(e,d,"whitespace")(p):d(p)}function d(p){return p===null||Fe(p)?i(p):a(p)}}const RR={name:"hardBreakEscape",tokenize:DR};function DR(e,i,a){return r;function r(u){return e.enter("hardBreakEscape"),e.consume(u),o}function o(u){return Fe(u)?(e.exit("hardBreakEscape"),i(u)):a(u)}}const zR={name:"headingAtx",resolve:LR,tokenize:IR};function LR(e,i){let a=e.length-2,r=3;if(e[r][1].type==="whitespace"&&(r+=2),a-2>r&&e[a][1].type==="whitespace"&&(a-=2),e[a][1].type==="atxHeadingSequence"&&(r===a-1||a-4>r&&e[a-2][1].type==="whitespace")&&(a-=r+1===a?2:4),a>r){const o={type:"atxHeadingText",start:e[r][1].start,end:e[a][1].end},u={type:"chunkText",start:e[r][1].start,end:e[a][1].end,contentType:"text"};$i(e,r,a-r+1,[["enter",o,i],["enter",u,i],["exit",u,i],["exit",o,i]])}return e}function IR(e,i,a){let r=0;return o;function o(x){return e.enter("atxHeading"),u(x)}function u(x){return e.enter("atxHeadingSequence"),d(x)}function d(x){return x===35&&r++<6?(e.consume(x),d):x===null||Lt(x)?(e.exit("atxHeadingSequence"),p(x)):a(x)}function p(x){return x===35?(e.enter("atxHeadingSequence"),h(x)):x===null||Fe(x)?(e.exit("atxHeading"),i(x)):lt(x)?bt(e,p,"whitespace")(x):(e.enter("atxHeadingText"),g(x))}function h(x){return x===35?(e.consume(x),h):(e.exit("atxHeadingSequence"),p(x))}function g(x){return x===null||x===35||Lt(x)?(e.exit("atxHeadingText"),p(x)):(e.consume(x),g)}}const UR=["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"],W1=["pre","script","style","textarea"],BR={concrete:!0,name:"htmlFlow",resolveTo:PR,tokenize:HR},$R={partial:!0,tokenize:FR};function PR(e){let i=e.length;for(;i--&&!(e[i][0]==="enter"&&e[i][1].type==="htmlFlow"););return i>1&&e[i-2][1].type==="linePrefix"&&(e[i][1].start=e[i-2][1].start,e[i+1][1].start=e[i-2][1].start,e.splice(i-2,2)),e}function HR(e,i,a){const r=this;let o,u,d,p,h;return g;function g(D){return x(D)}function x(D){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(D),b}function b(D){return D===33?(e.consume(D),y):D===47?(e.consume(D),u=!0,T):D===63?(e.consume(D),o=3,r.interrupt?i:S):Hn(D)?(e.consume(D),d=String.fromCharCode(D),E):a(D)}function y(D){return D===45?(e.consume(D),o=2,v):D===91?(e.consume(D),o=5,p=0,w):Hn(D)?(e.consume(D),o=4,r.interrupt?i:S):a(D)}function v(D){return D===45?(e.consume(D),r.interrupt?i:S):a(D)}function w(D){const U="CDATA[";return D===U.charCodeAt(p++)?(e.consume(D),p===U.length?r.interrupt?i:Z:w):a(D)}function T(D){return Hn(D)?(e.consume(D),d=String.fromCharCode(D),E):a(D)}function E(D){if(D===null||D===47||D===62||Lt(D)){const U=D===47,re=d.toLowerCase();return!U&&!u&&W1.includes(re)?(o=1,r.interrupt?i(D):Z(D)):UR.includes(d.toLowerCase())?(o=6,U?(e.consume(D),N):r.interrupt?i(D):Z(D)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?a(D):u?j(D):A(D))}return D===45||Mn(D)?(e.consume(D),d+=String.fromCharCode(D),E):a(D)}function N(D){return D===62?(e.consume(D),r.interrupt?i:Z):a(D)}function j(D){return lt(D)?(e.consume(D),j):M(D)}function A(D){return D===47?(e.consume(D),M):D===58||D===95||Hn(D)?(e.consume(D),R):lt(D)?(e.consume(D),A):M(D)}function R(D){return D===45||D===46||D===58||D===95||Mn(D)?(e.consume(D),R):$(D)}function $(D){return D===61?(e.consume(D),z):lt(D)?(e.consume(D),$):A(D)}function z(D){return D===null||D===60||D===61||D===62||D===96?a(D):D===34||D===39?(e.consume(D),h=D,C):lt(D)?(e.consume(D),z):L(D)}function C(D){return D===h?(e.consume(D),h=null,q):D===null||Fe(D)?a(D):(e.consume(D),C)}function L(D){return D===null||D===34||D===39||D===47||D===60||D===61||D===62||D===96||Lt(D)?$(D):(e.consume(D),L)}function q(D){return D===47||D===62||lt(D)?A(D):a(D)}function M(D){return D===62?(e.consume(D),H):a(D)}function H(D){return D===null||Fe(D)?Z(D):lt(D)?(e.consume(D),H):a(D)}function Z(D){return D===45&&o===2?(e.consume(D),O):D===60&&o===1?(e.consume(D),ee):D===62&&o===4?(e.consume(D),ve):D===63&&o===3?(e.consume(D),S):D===93&&o===5?(e.consume(D),be):Fe(D)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check($R,ce,he)(D)):D===null||Fe(D)?(e.exit("htmlFlowData"),he(D)):(e.consume(D),Z)}function he(D){return e.check(Mh,se,ce)(D)}function se(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),ae}function ae(D){return D===null||Fe(D)?he(D):(e.enter("htmlFlowData"),Z(D))}function O(D){return D===45?(e.consume(D),S):Z(D)}function ee(D){return D===47?(e.consume(D),d="",te):Z(D)}function te(D){if(D===62){const U=d.toLowerCase();return W1.includes(U)?(e.consume(D),ve):Z(D)}return Hn(D)&&d.length<8?(e.consume(D),d+=String.fromCharCode(D),te):Z(D)}function be(D){return D===93?(e.consume(D),S):Z(D)}function S(D){return D===62?(e.consume(D),ve):D===45&&o===2?(e.consume(D),S):Z(D)}function ve(D){return D===null||Fe(D)?(e.exit("htmlFlowData"),ce(D)):(e.consume(D),ve)}function ce(D){return e.exit("htmlFlow"),i(D)}}function FR(e,i,a){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(Zo,i,a)}}const qR={name:"htmlText",tokenize:GR};function GR(e,i,a){const r=this;let o,u,d;return p;function p(S){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(S),h}function h(S){return S===33?(e.consume(S),g):S===47?(e.consume(S),$):S===63?(e.consume(S),A):Hn(S)?(e.consume(S),L):a(S)}function g(S){return S===45?(e.consume(S),x):S===91?(e.consume(S),u=0,w):Hn(S)?(e.consume(S),j):a(S)}function x(S){return S===45?(e.consume(S),v):a(S)}function b(S){return S===null?a(S):S===45?(e.consume(S),y):Fe(S)?(d=b,ee(S)):(e.consume(S),b)}function y(S){return S===45?(e.consume(S),v):b(S)}function v(S){return S===62?O(S):S===45?y(S):b(S)}function w(S){const ve="CDATA[";return S===ve.charCodeAt(u++)?(e.consume(S),u===ve.length?T:w):a(S)}function T(S){return S===null?a(S):S===93?(e.consume(S),E):Fe(S)?(d=T,ee(S)):(e.consume(S),T)}function E(S){return S===93?(e.consume(S),N):T(S)}function N(S){return S===62?O(S):S===93?(e.consume(S),N):T(S)}function j(S){return S===null||S===62?O(S):Fe(S)?(d=j,ee(S)):(e.consume(S),j)}function A(S){return S===null?a(S):S===63?(e.consume(S),R):Fe(S)?(d=A,ee(S)):(e.consume(S),A)}function R(S){return S===62?O(S):A(S)}function $(S){return Hn(S)?(e.consume(S),z):a(S)}function z(S){return S===45||Mn(S)?(e.consume(S),z):C(S)}function C(S){return Fe(S)?(d=C,ee(S)):lt(S)?(e.consume(S),C):O(S)}function L(S){return S===45||Mn(S)?(e.consume(S),L):S===47||S===62||Lt(S)?q(S):a(S)}function q(S){return S===47?(e.consume(S),O):S===58||S===95||Hn(S)?(e.consume(S),M):Fe(S)?(d=q,ee(S)):lt(S)?(e.consume(S),q):O(S)}function M(S){return S===45||S===46||S===58||S===95||Mn(S)?(e.consume(S),M):H(S)}function H(S){return S===61?(e.consume(S),Z):Fe(S)?(d=H,ee(S)):lt(S)?(e.consume(S),H):q(S)}function Z(S){return S===null||S===60||S===61||S===62||S===96?a(S):S===34||S===39?(e.consume(S),o=S,he):Fe(S)?(d=Z,ee(S)):lt(S)?(e.consume(S),Z):(e.consume(S),se)}function he(S){return S===o?(e.consume(S),o=void 0,ae):S===null?a(S):Fe(S)?(d=he,ee(S)):(e.consume(S),he)}function se(S){return S===null||S===34||S===39||S===60||S===61||S===96?a(S):S===47||S===62||Lt(S)?q(S):(e.consume(S),se)}function ae(S){return S===47||S===62||Lt(S)?q(S):a(S)}function O(S){return S===62?(e.consume(S),e.exit("htmlTextData"),e.exit("htmlText"),i):a(S)}function ee(S){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),te}function te(S){return lt(S)?bt(e,be,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):be(S)}function be(S){return e.enter("htmlTextData"),d(S)}}const Tg={name:"labelEnd",resolveAll:XR,resolveTo:ZR,tokenize:QR},YR={tokenize:JR},VR={tokenize:WR},KR={tokenize:e3};function XR(e){let i=-1;const a=[];for(;++i<e.length;){const r=e[i][1];if(a.push(e[i]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const o=r.type==="labelImage"?4:2;r.type="data",i+=o}}return e.length!==a.length&&$i(e,0,e.length,a),e}function ZR(e,i){let a=e.length,r=0,o,u,d;for(;a--;){const x=e[a][1];if(o){if(x.type==="link"||x.type==="labelLink"&&x._inactive)break;e[a][0]==="enter"&&x.type==="labelLink"&&(x._inactive=!0)}else if(u){if(e[a][0]==="enter"&&(x.type==="labelImage"||x.type==="labelLink")&&!x._balanced&&(o=a,x.type!=="labelLink")){r=2;break}}else x.type==="labelEnd"&&(u=a)}const p={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[o][1].start},end:{...e[u][1].end}},g={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[u-2][1].start}};return d=[["enter",p,i],["enter",h,i]],d=ki(d,e.slice(o+1,o+r+3)),d=ki(d,[["enter",g,i]]),d=ki(d,Md(i.parser.constructs.insideSpan.null,e.slice(o+r+4,u-3),i)),d=ki(d,[["exit",g,i],e[u-2],e[u-1],["exit",h,i]]),d=ki(d,e.slice(u+1)),d=ki(d,[["exit",p,i]]),$i(e,o,e.length,d),e}function QR(e,i,a){const r=this,o=r._labelStarts;let u,d;if(o){for(;o.length>0&&o[o.length-1]._balanced;)o.pop();u=o[o.length-1]}return p;function p(y){return u?u._inactive?b(y):(d=r.parser.defined.includes(Pi(r.sliceSerialize({start:u.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),h):a(y)}function h(y){return y===40?e.attempt(YR,x,d?x:b)(y):y===91?e.attempt(VR,x,d?g:b)(y):d?x(y):b(y)}function g(y){return e.attempt(KR,x,b)(y)}function x(y){return o.pop(),i(y)}function b(y){return u._balanced=!0,a(y)}}function JR(e,i,a){return r;function r(b){return e.enter("resource"),e.enter("resourceMarker"),e.consume(b),e.exit("resourceMarker"),o}function o(b){return Lt(b)?Oo(e,u)(b):u(b)}function u(b){return b===41?x(b):Hk(e,d,p,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(b)}function d(b){return Lt(b)?Oo(e,h)(b):x(b)}function p(b){return a(b)}function h(b){return b===34||b===39||b===40?qk(e,g,a,"resourceTitle","resourceTitleMarker","resourceTitleString")(b):x(b)}function g(b){return Lt(b)?Oo(e,x)(b):x(b)}function x(b){return b===41?(e.enter("resourceMarker"),e.consume(b),e.exit("resourceMarker"),e.exit("resource"),i):a(b)}}function WR(e,i,a){const r=this;return o;function o(p){return Fk.call(r,e,u,d,"reference","referenceMarker","referenceString")(p)}function u(p){return r.parser.defined.includes(Pi(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?i(p):a(p)}function d(p){return a(p)}}function e3(e,i,a){return r;function r(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),o}function o(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),i):a(u)}}const t3={name:"labelStartImage",resolveAll:Tg.resolveAll,tokenize:n3};function n3(e,i,a){const r=this;let o;return u;function u(h){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(h),e.exit("labelImageMarker"),d}function d(h){return h===91?(e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),o=e.exit("labelImage"),p):a(h)}function p(h){return h===94&&"_hiddenFootnoteSupport"in r.parser.constructs?a(h):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(o),i(h))}}const i3={name:"labelStartLink",resolveAll:Tg.resolveAll,tokenize:a3};function a3(e,i,a){const r=this;let o;return u;function u(p){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),o=e.exit("labelLink"),d}function d(p){return p===94&&"_hiddenFootnoteSupport"in r.parser.constructs?a(p):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(o),i(p))}}const zm={name:"lineEnding",tokenize:r3};function r3(e,i){return a;function a(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),bt(e,i,"linePrefix")}}const Fu={name:"thematicBreak",tokenize:s3};function s3(e,i,a){let r=0,o;return u;function u(g){return e.enter("thematicBreak"),d(g)}function d(g){return o=g,p(g)}function p(g){return g===o?(e.enter("thematicBreakSequence"),h(g)):r>=3&&(g===null||Fe(g))?(e.exit("thematicBreak"),i(g)):a(g)}function h(g){return g===o?(e.consume(g),r++,h):(e.exit("thematicBreakSequence"),lt(g)?bt(e,p,"whitespace")(g):p(g))}}const Jn={continuation:{tokenize:u3},exit:f3,name:"list",tokenize:c3},l3={partial:!0,tokenize:p3},o3={partial:!0,tokenize:d3};function c3(e,i,a){const r=this,o=r.events[r.events.length-1];let u=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,d=0;return p;function p(v){const w=r.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!r.containerState.marker||v===r.containerState.marker:Ah(v)){if(r.containerState.type||(r.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(Fu,a,g)(v):g(v);if(!r.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),h(v)}return a(v)}function h(v){return Ah(v)&&++d<10?(e.consume(v),h):(!r.interrupt||d<2)&&(r.containerState.marker?v===r.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),g(v)):a(v)}function g(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||v,e.check(Zo,r.interrupt?a:x,e.attempt(l3,y,b))}function x(v){return r.containerState.initialBlankLine=!0,u++,y(v)}function b(v){return lt(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),y):a(v)}function y(v){return r.containerState.size=u+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,i(v)}}function u3(e,i,a){const r=this;return r.containerState._closeFlow=void 0,e.check(Zo,o,u);function o(p){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,bt(e,i,"listItemIndent",r.containerState.size+1)(p)}function u(p){return r.containerState.furtherBlankLines||!lt(p)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,d(p)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(o3,i,d)(p))}function d(p){return r.containerState._closeFlow=!0,r.interrupt=void 0,bt(e,e.attempt(Jn,i,a),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(p)}}function d3(e,i,a){const r=this;return bt(e,o,"listItemIndent",r.containerState.size+1);function o(u){const d=r.events[r.events.length-1];return d&&d[1].type==="listItemIndent"&&d[2].sliceSerialize(d[1],!0).length===r.containerState.size?i(u):a(u)}}function f3(e){e.exit(this.containerState.type)}function p3(e,i,a){const r=this;return bt(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(u){const d=r.events[r.events.length-1];return!lt(u)&&d&&d[1].type==="listItemPrefixWhitespace"?i(u):a(u)}}const ev={name:"setextUnderline",resolveTo:m3,tokenize:h3};function m3(e,i){const a=new rd;let r=e.length,o,u,d;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){o=r;break}e[r][1].type==="paragraph"&&(u=r)}else e[r][1].type==="content"&&a.add(r,1,[]),!d&&e[r][1].type==="definition"&&(d=r);const p={type:"setextHeading",start:{...e[o][1].start},end:{...e[e.length-1][1].end}};return e[u][1].type="setextHeadingText",d?(a.add(u,0,[["enter",p,i]]),a.add(d+1,0,[["exit",e[o][1],i]]),e[o][1].end={...e[d][1].end}):e[o][1]=p,a.add(e.length,0,[["exit",p,i]]),a.consume(e),e}function h3(e,i,a){const r=this;let o;return u;function u(g){let x=r.events.length,b;for(;x--;)if(r.events[x][1].type!=="lineEnding"&&r.events[x][1].type!=="linePrefix"&&r.events[x][1].type!=="content"){b=r.events[x][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||b)?(e.enter("setextHeadingLine"),o=g,d(g)):a(g)}function d(g){return e.enter("setextHeadingLineSequence"),p(g)}function p(g){return g===o?(e.consume(g),p):(e.exit("setextHeadingLineSequence"),lt(g)?bt(e,h,"lineSuffix")(g):h(g))}function h(g){return g===null||Fe(g)?(e.exit("setextHeadingLine"),i(g)):a(g)}}const g3={tokenize:x3};function x3(e){const i=this,a=e.attempt(Zo,r,e.attempt(this.parser.constructs.flowInitial,o,bt(e,e.attempt(this.parser.constructs.flow,o,e.attempt(ER,o)),"linePrefix")));return a;function r(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),i.currentConstruct=void 0,a}function o(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),i.currentConstruct=void 0,a}}const b3={resolveAll:Yk()},y3=Gk("string"),v3=Gk("text");function Gk(e){return{resolveAll:Yk(e==="text"?w3:void 0),tokenize:i};function i(a){const r=this,o=this.parser.constructs[e],u=a.attempt(o,d,p);return d;function d(x){return g(x)?u(x):p(x)}function p(x){if(x===null){a.consume(x);return}return a.enter("data"),a.consume(x),h}function h(x){return g(x)?(a.exit("data"),u(x)):(a.consume(x),h)}function g(x){if(x===null)return!0;const b=o[x];let y=-1;if(b)for(;++y<b.length;){const v=b[y];if(!v.previous||v.previous.call(r,r.previous))return!0}return!1}}}function Yk(e){return i;function i(a,r){let o=-1,u;for(;++o<=a.length;)u===void 0?a[o]&&a[o][1].type==="data"&&(u=o,o++):(!a[o]||a[o][1].type!=="data")&&(o!==u+2&&(a[u][1].end=a[o-1][1].end,a.splice(u+2,o-u-2),o=u+2),u=void 0);return e?e(a,r):a}}function w3(e,i){const a=new rd;let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const o=e[r-1][1],u=i.sliceStream(o);let d=u.length,p=-1,h=0,g;for(;d--;){const x=u[d];if(typeof x=="string"){for(p=x.length;x.charCodeAt(p-1)===32;)h++,p--;if(p)break;p=-1}else if(x===-2)g=!0,h++;else if(x!==-1){d++;break}}if(i._contentTypeTextTrailing&&r===e.length&&(h=0),h){const x={type:r===e.length||g||h<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:d?p:o.start._bufferIndex+p,_index:o.start._index+d,line:o.end.line,column:o.end.column-h,offset:o.end.offset-h},end:{...o.end}};o.end={...x.start},o.start.offset===o.end.offset?Object.assign(o,x):a.add(r,0,[["enter",x,i],["exit",x,i]])}r++}return a.consume(e),e}const k3={42:Jn,43:Jn,45:Jn,48:Jn,49:Jn,50:Jn,51:Jn,52:Jn,53:Jn,54:Jn,55:Jn,56:Jn,57:Jn,62:Uk},N3={91:jR},E3={[-2]:Dm,[-1]:Dm,32:Dm},_3={35:zR,42:Fu,45:[ev,Fu],60:BR,61:ev,95:Fu,96:J1,126:J1},S3={38:$k,92:Bk},T3={[-5]:zm,[-4]:zm,[-3]:zm,33:t3,38:$k,42:Oh,60:[rR,qR],91:i3,92:[RR,Bk],93:Tg,95:Oh,96:bR},C3={null:[Oh,b3]},j3={null:[42,95]},A3={null:[]},O3=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:j3,contentInitial:N3,disable:A3,document:k3,flow:_3,flowInitial:E3,insideSpan:C3,string:S3,text:T3},Symbol.toStringTag,{value:"Module"}));function M3(e,i,a){let r={_bufferIndex:-1,_index:0,line:a&&a.line||1,column:a&&a.column||1,offset:a&&a.offset||0};const o={},u=[];let d=[],p=[];const h={attempt:C($),check:C(z),consume:j,enter:A,exit:R,interrupt:C(z,{interrupt:!0})},g={code:null,containerState:{},defineSkip:T,events:[],now:w,parser:e,previous:null,sliceSerialize:y,sliceStream:v,write:b};let x=i.tokenize.call(g,h);return i.resolveAll&&u.push(i),g;function b(H){return d=ki(d,H),E(),d[d.length-1]!==null?[]:(L(i,0),g.events=Md(u,g.events,g),g.events)}function y(H,Z){return D3(v(H),Z)}function v(H){return R3(d,H)}function w(){const{_bufferIndex:H,_index:Z,line:he,column:se,offset:ae}=r;return{_bufferIndex:H,_index:Z,line:he,column:se,offset:ae}}function T(H){o[H.line]=H.column,M()}function E(){for(;r._index<d.length;){const H=d[r._index];if(typeof H=="string"){const Z=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===Z&&r._bufferIndex<H.length;)N(H.charCodeAt(r._bufferIndex))}else N(H)}}function N(H){x=x(H)}function j(H){Fe(H)?(r.line++,r.column=1,r.offset+=H===-3?2:1,M()):H!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===d[r._index].length&&(r._bufferIndex=-1,r._index++)),g.previous=H}function A(H,Z){const he=Z||{};return he.type=H,he.start=w(),g.events.push(["enter",he,g]),p.push(he),he}function R(H){const Z=p.pop();return Z.end=w(),g.events.push(["exit",Z,g]),Z}function $(H,Z){L(H,Z.from)}function z(H,Z){Z.restore()}function C(H,Z){return he;function he(se,ae,O){let ee,te,be,S;return Array.isArray(se)?ce(se):"tokenize"in se?ce([se]):ve(se);function ve(ge){return _e;function _e(Ue){const de=Ue!==null&&ge[Ue],Ne=Ue!==null&&ge.null,ye=[...Array.isArray(de)?de:de?[de]:[],...Array.isArray(Ne)?Ne:Ne?[Ne]:[]];return ce(ye)(Ue)}}function ce(ge){return ee=ge,te=0,ge.length===0?O:D(ge[te])}function D(ge){return _e;function _e(Ue){return S=q(),be=ge,ge.partial||(g.currentConstruct=ge),ge.name&&g.parser.constructs.disable.null.includes(ge.name)?re():ge.tokenize.call(Z?Object.assign(Object.create(g),Z):g,h,U,re)(Ue)}}function U(ge){return H(be,S),ae}function re(ge){return S.restore(),++te<ee.length?D(ee[te]):O}}}function L(H,Z){H.resolveAll&&!u.includes(H)&&u.push(H),H.resolve&&$i(g.events,Z,g.events.length-Z,H.resolve(g.events.slice(Z),g)),H.resolveTo&&(g.events=H.resolveTo(g.events,g))}function q(){const H=w(),Z=g.previous,he=g.currentConstruct,se=g.events.length,ae=Array.from(p);return{from:se,restore:O};function O(){r=H,g.previous=Z,g.currentConstruct=he,g.events.length=se,p=ae,M()}}function M(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function R3(e,i){const a=i.start._index,r=i.start._bufferIndex,o=i.end._index,u=i.end._bufferIndex;let d;if(a===o)d=[e[a].slice(r,u)];else{if(d=e.slice(a,o),r>-1){const p=d[0];typeof p=="string"?d[0]=p.slice(r):d.shift()}u>0&&d.push(e[o].slice(0,u))}return d}function D3(e,i){let a=-1;const r=[];let o;for(;++a<e.length;){const u=e[a];let d;if(typeof u=="string")d=u;else switch(u){case-5:{d="\r";break}case-4:{d=`
|
|
217
|
+
`;break}case-3:{d=`\r
|
|
218
|
+
`;break}case-2:{d=i?" ":" ";break}case-1:{if(!i&&o)continue;d=" ";break}default:d=String.fromCharCode(u)}o=u===-2,r.push(d)}return r.join("")}function z3(e){const r={constructs:zk([O3,...(e||{}).extensions||[]]),content:o(J5),defined:[],document:o(eR),flow:o(g3),lazy:{},string:o(y3),text:o(v3)};return r;function o(u){return d;function d(p){return M3(r,u,p)}}}function L3(e){for(;!Pk(e););return e}const tv=/[\0\t\n\r]/g;function I3(){let e=1,i="",a=!0,r;return o;function o(u,d,p){u=i+(typeof u=="string"?u.toString():new TextDecoder(d||void 0).decode(u));const h=[];let g=0;for(i="",a&&(u.charCodeAt(0)===65279&&g++,a=void 0);g<u.length;){tv.lastIndex=g;const x=tv.exec(u),b=x&&x.index!==void 0?x.index:u.length,y=u.charCodeAt(b);if(!x){i=u.slice(g);break}if(y===10&&g===b&&r)h.push(-3),r=void 0;else switch(r&&(h.push(-5),r=void 0),g<b&&(h.push(u.slice(g,b)),e+=b-g),y){case 0:{h.push(65533),e++;break}case 9:{const v=Math.ceil(e/4)*4;for(h.push(-2);e++<v;)h.push(-1);break}case 10:{h.push(-4),e=1;break}default:r=!0,e=1}g=b+1}return p&&(r&&h.push(-5),i&&h.push(i),h.push(null)),h}}const U3=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function B3(e){return e.replace(U3,$3)}function $3(e,i,a){if(i)return i;if(a.charCodeAt(0)===35){const o=a.charCodeAt(1),u=o===120||o===88;return Lk(a.slice(u?2:1),u?16:10)}return Sg(a)||e}const Vk={}.hasOwnProperty;function P3(e,i,a){return i&&typeof i=="object"&&(a=i,i=void 0),H3(a)(L3(z3(a).document().write(I3()(e,i,!0))))}function H3(e){const i={afterExit:[],beforeEnter:[],transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:d(jn),autolinkProtocol:M,autolinkEmail:M,atxHeading:d(Ae),blockQuote:d(ye),characterEscape:M,characterReference:M,codeFenced:d(Q),codeFencedFenceInfo:p,codeFencedFenceMeta:p,codeIndented:d(Q,p),codeText:d(Pe,p),codeTextData:M,data:M,codeFlowValue:M,definition:d(ne),definitionDestinationString:p,definitionLabelString:p,definitionTitleString:p,emphasis:d(et),hardBreakEscape:d(rt),hardBreakTrailing:d(rt),htmlFlow:d(Ke,p),htmlFlowData:M,htmlText:d(Ke,p),htmlTextData:M,image:d(It),label:p,link:d(jn),listItem:d(fe),listItemValue:v,listOrdered:d(xn,y),listUnordered:d(xn),paragraph:d(Ge),reference:U,referenceString:p,resourceDestinationString:p,resourceTitleString:p,setextHeading:d(Ae),strong:d(ht),thematicBreak:d(ln)},exit:{atxHeading:g(),atxHeadingSequence:z,autolink:g(),autolinkEmail:Ne,autolinkProtocol:de,blockQuote:g(),characterEscapeValue:H,characterReferenceMarkerHexadecimal:ge,characterReferenceMarkerNumeric:ge,characterReferenceValue:_e,characterReference:Ue,codeFenced:g(N),codeFencedFence:E,codeFencedFenceInfo:w,codeFencedFenceMeta:T,codeFlowValue:H,codeIndented:g(j),codeText:g(O),codeTextData:H,data:H,definition:g(),definitionDestinationString:$,definitionLabelString:A,definitionTitleString:R,emphasis:g(),hardBreakEscape:g(he),hardBreakTrailing:g(he),htmlFlow:g(se),htmlFlowData:H,htmlText:g(ae),htmlTextData:H,image:g(te),label:S,labelText:be,lineEnding:Z,link:g(ee),listItem:g(),listOrdered:g(),listUnordered:g(),paragraph:g(),referenceString:re,resourceDestinationString:ve,resourceTitleString:ce,resource:D,setextHeading:g(q),setextHeadingLineSequence:L,setextHeadingText:C,strong:g(),thematicBreak:g()}};Kk(i,(e||{}).mdastExtensions||[]);const a={};return r;function r(ie){let ke={type:"root",children:[],position:void 0};const He={stack:[ke],tokenStack:[],config:i,enter:h,exit:x,buffer:p,resume:b,data:a},Xe=[],Zt=[];let Et=-1;for(;++Et<ie.length;)if(Zt.push(ie[Et]),ie[Et][1].type==="listOrdered"||ie[Et][1].type==="listUnordered")if(ie[Et][0]==="enter")Xe.push(Zt.length-1);else{const on=Xe.pop();u(Zt,on)}for(ie=Zt,Et=-1;++Et<ie.length;){const on=i[ie[Et][0]];ie[Et][0]==="enter"&&i.beforeEnter.length>0&&o(i.beforeEnter,{...He,sliceSerialize:ie[Et][2].sliceSerialize},ie[Et][1]),Vk.call(on,ie[Et][1].type)&&on[ie[Et][1].type].call({...He,sliceSerialize:ie[Et][2].sliceSerialize},ie[Et][1]),ie[Et][0]==="exit"&&i.afterExit.length>0&&o(i.afterExit,{...He,sliceSerialize:ie[Et][2].sliceSerialize},ie[Et][1])}if(He.tokenStack.length>0){const on=He.tokenStack[He.tokenStack.length-1];(on[1]||nv).call(He,void 0,on[0])}for(ke.position={start:gr(ie.length>0?ie[0][1].start:{line:1,column:1,offset:0}),end:gr(ie.length>0?ie[ie.length-2][1].end:{line:1,column:1,offset:0})},Et=-1;++Et<i.transforms.length;)ke=i.transforms[Et](ke)||ke;return ke}function o(ie,ke,He){let Xe=-1;for(;++Xe<ie.length;)ie[Xe].call(ke,He)}function u(ie,ke){const He=ie.length-1;let Xe=ke-1,Zt=-1,Et=!1,on,bn,_i,Si;const ca=[];for(;++Xe<=He;){const dn=ie[Xe];switch(dn[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{dn[0]==="enter"?Zt++:Zt--,Si=void 0;break}case"lineEndingBlank":{dn[0]==="enter"&&(on&&!Si&&!Zt&&!_i&&(_i=Xe),Si=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Si=void 0}if(!Zt&&dn[0]==="enter"&&dn[1].type==="listItemPrefix"||Zt===-1&&dn[0]==="exit"&&(dn[1].type==="listUnordered"||dn[1].type==="listOrdered")){if(on){let Ti=Xe;for(bn=void 0;Ti--;){const zn=ie[Ti];if(zn[1].type==="lineEnding"||zn[1].type==="lineEndingBlank"){if(zn[0]==="exit")continue;bn&&(ie[bn][1].type="lineEndingBlank",Et=!0),zn[1].type="lineEnding",bn=Ti}else if(!(zn[1].type==="linePrefix"||zn[1].type==="blockQuotePrefix"||zn[1].type==="blockQuotePrefixWhitespace"||zn[1].type==="blockQuoteMarker"||zn[1].type==="listItemIndent"))break}_i&&(!bn||_i<bn)&&(on._spread=!0),on.end=Object.assign({},bn?ie[bn][1].start:dn[1].end),ca.push({at:bn||Xe,event:["exit",on,dn[2]]})}if(dn[1].type==="listItemPrefix"){const Ti={type:"listItem",_spread:!1,start:Object.assign({},dn[1].start),end:void 0};on=Ti,ca.push({at:Xe,event:["enter",Ti,dn[2]]}),_i=void 0,Si=!0}}}const La=ie.splice(ke);let Qt=0;for(Xe=-1;++Xe<La.length;){for(;Qt<ca.length&&ca[Qt].at===ke+Xe;)ie.push(ca[Qt++].event);ie.push(La[Xe])}ie[ke][1]._spread=Et}function d(ie,ke){return He;function He(Xe){h.call(this,ie(Xe),Xe),ke&&ke.call(this,Xe)}}function p(){this.stack.push({type:"fragment",children:[]})}function h(ie,ke,He){this.stack[this.stack.length-1].children.push(ie),this.stack.push(ie),this.tokenStack.push([ke,He||void 0]),ie.position={start:gr(ke.start),end:void 0}}function g(ie){return ke;function ke(He){ie&&ie.call(this,He),x.call(this,He)}}function x(ie,ke){const He=this.stack.pop(),Xe=this.tokenStack.pop();if(!Xe)throw new Error("Cannot close `"+ie.type+"` ("+Ao({start:ie.start,end:ie.end})+"): it’s not open");Xe[0].type!==ie.type&&(ke?ke.call(this,ie,Xe[0]):(Xe[1]||nv).call(this,ie,Xe[0])),He.position.end=gr(ie.end)}function b(){return _g(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function v(ie){if(this.data.expectingFirstListItemValue){const ke=this.stack[this.stack.length-2];ke.start=Number.parseInt(this.sliceSerialize(ie),10),this.data.expectingFirstListItemValue=void 0}}function w(){const ie=this.resume(),ke=this.stack[this.stack.length-1];ke.lang=ie}function T(){const ie=this.resume(),ke=this.stack[this.stack.length-1];ke.meta=ie}function E(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function N(){const ie=this.resume(),ke=this.stack[this.stack.length-1];ke.value=ie.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function j(){const ie=this.resume(),ke=this.stack[this.stack.length-1];ke.value=ie.replace(/(\r?\n|\r)$/g,"")}function A(ie){const ke=this.resume(),He=this.stack[this.stack.length-1];He.label=ke,He.identifier=Pi(this.sliceSerialize(ie)).toLowerCase()}function R(){const ie=this.resume(),ke=this.stack[this.stack.length-1];ke.title=ie}function $(){const ie=this.resume(),ke=this.stack[this.stack.length-1];ke.url=ie}function z(ie){const ke=this.stack[this.stack.length-1];if(!ke.depth){const He=this.sliceSerialize(ie).length;ke.depth=He}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function L(ie){const ke=this.stack[this.stack.length-1];ke.depth=this.sliceSerialize(ie).codePointAt(0)===61?1:2}function q(){this.data.setextHeadingSlurpLineEnding=void 0}function M(ie){const He=this.stack[this.stack.length-1].children;let Xe=He[He.length-1];(!Xe||Xe.type!=="text")&&(Xe=xt(),Xe.position={start:gr(ie.start),end:void 0},He.push(Xe)),this.stack.push(Xe)}function H(ie){const ke=this.stack.pop();ke.value+=this.sliceSerialize(ie),ke.position.end=gr(ie.end)}function Z(ie){const ke=this.stack[this.stack.length-1];if(this.data.atHardBreak){const He=ke.children[ke.children.length-1];He.position.end=gr(ie.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&i.canContainEols.includes(ke.type)&&(M.call(this,ie),H.call(this,ie))}function he(){this.data.atHardBreak=!0}function se(){const ie=this.resume(),ke=this.stack[this.stack.length-1];ke.value=ie}function ae(){const ie=this.resume(),ke=this.stack[this.stack.length-1];ke.value=ie}function O(){const ie=this.resume(),ke=this.stack[this.stack.length-1];ke.value=ie}function ee(){const ie=this.stack[this.stack.length-1];if(this.data.inReference){const ke=this.data.referenceType||"shortcut";ie.type+="Reference",ie.referenceType=ke,delete ie.url,delete ie.title}else delete ie.identifier,delete ie.label;this.data.referenceType=void 0}function te(){const ie=this.stack[this.stack.length-1];if(this.data.inReference){const ke=this.data.referenceType||"shortcut";ie.type+="Reference",ie.referenceType=ke,delete ie.url,delete ie.title}else delete ie.identifier,delete ie.label;this.data.referenceType=void 0}function be(ie){const ke=this.sliceSerialize(ie),He=this.stack[this.stack.length-2];He.label=B3(ke),He.identifier=Pi(ke).toLowerCase()}function S(){const ie=this.stack[this.stack.length-1],ke=this.resume(),He=this.stack[this.stack.length-1];if(this.data.inReference=!0,He.type==="link"){const Xe=ie.children;He.children=Xe}else He.alt=ke}function ve(){const ie=this.resume(),ke=this.stack[this.stack.length-1];ke.url=ie}function ce(){const ie=this.resume(),ke=this.stack[this.stack.length-1];ke.title=ie}function D(){this.data.inReference=void 0}function U(){this.data.referenceType="collapsed"}function re(ie){const ke=this.resume(),He=this.stack[this.stack.length-1];He.label=ke,He.identifier=Pi(this.sliceSerialize(ie)).toLowerCase(),this.data.referenceType="full"}function ge(ie){this.data.characterReferenceType=ie.type}function _e(ie){const ke=this.sliceSerialize(ie),He=this.data.characterReferenceType;let Xe;He?(Xe=Lk(ke,He==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Xe=Sg(ke);const Zt=this.stack[this.stack.length-1];Zt.value+=Xe}function Ue(ie){const ke=this.stack.pop();ke.position.end=gr(ie.end)}function de(ie){H.call(this,ie);const ke=this.stack[this.stack.length-1];ke.url=this.sliceSerialize(ie)}function Ne(ie){H.call(this,ie);const ke=this.stack[this.stack.length-1];ke.url="mailto:"+this.sliceSerialize(ie)}function ye(){return{type:"blockquote",children:[],position:void 0}}function Q(){return{type:"code",lang:null,meta:null,value:"",position:void 0}}function Pe(){return{type:"inlineCode",value:"",position:void 0}}function ne(){return{type:"definition",identifier:"",label:null,title:null,url:"",position:void 0}}function et(){return{type:"emphasis",children:[],position:void 0}}function Ae(){return{type:"heading",depth:0,children:[],position:void 0}}function rt(){return{type:"break",position:void 0}}function Ke(){return{type:"html",value:"",position:void 0}}function It(){return{type:"image",title:null,url:"",alt:null,position:void 0}}function jn(){return{type:"link",title:null,url:"",children:[],position:void 0}}function xn(ie){return{type:"list",ordered:ie.type==="listOrdered",start:null,spread:ie._spread,children:[],position:void 0}}function fe(ie){return{type:"listItem",spread:ie._spread,checked:null,children:[],position:void 0}}function Ge(){return{type:"paragraph",children:[],position:void 0}}function ht(){return{type:"strong",children:[],position:void 0}}function xt(){return{type:"text",value:"",position:void 0}}function ln(){return{type:"thematicBreak",position:void 0}}}function gr(e){return{line:e.line,column:e.column,offset:e.offset}}function Kk(e,i){let a=-1;for(;++a<i.length;){const r=i[a];Array.isArray(r)?Kk(e,r):F3(e,r)}}function F3(e,i){let a;for(a in i)if(Vk.call(i,a))switch(a){case"canContainEols":{const r=i[a];r&&e[a].push(...r);break}case"transforms":{const r=i[a];r&&e[a].push(...r);break}case"afterExit":case"beforeEnter":{const r=i[a];r&&e[a].push(r);break}case"enter":case"exit":{const r=i[a];r&&Object.assign(e[a],r);break}}}function nv(e,i){throw e?new Error("Cannot close `"+e.type+"` ("+Ao({start:e.start,end:e.end})+"): a different token (`"+i.type+"`, "+Ao({start:i.start,end:i.end})+") is open"):new Error("Cannot close document, a token (`"+i.type+"`, "+Ao({start:i.start,end:i.end})+") is still open")}function q3(e){const i=this;i.parser=a;function a(r){return P3(r,{...i.data("settings"),...e,extensions:i.data("micromarkExtensions")||[],mdastExtensions:i.data("fromMarkdownExtensions")||[]})}}function G3(e,i){const a={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(i),!0)};return e.patch(i,a),e.applyData(i,a)}function Y3(e,i){const a={type:"element",tagName:"br",properties:{},children:[]};return e.patch(i,a),[e.applyData(i,a),{type:"text",value:`
|
|
219
|
+
`}]}function V3(e,i){const a=i.value?i.value+`
|
|
220
|
+
`:"",r={},o=i.lang?i.lang.split(/\s+/):[];o.length>0&&(r.className=["language-"+o[0]]);let u={type:"element",tagName:"code",properties:r,children:[{type:"text",value:a}]};return i.meta&&(u.data={meta:i.meta}),e.patch(i,u),u=e.applyData(i,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(i,u),u}function K3(e,i){const a={type:"element",tagName:"del",properties:{},children:e.all(i)};return e.patch(i,a),e.applyData(i,a)}function X3(e,i){const a={type:"element",tagName:"em",properties:{},children:e.all(i)};return e.patch(i,a),e.applyData(i,a)}function Z3(e,i){const a=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(i.identifier).toUpperCase(),o=vl(r.toLowerCase()),u=e.footnoteOrder.indexOf(r);let d,p=e.footnoteCounts.get(r);p===void 0?(p=0,e.footnoteOrder.push(r),d=e.footnoteOrder.length):d=u+1,p+=1,e.footnoteCounts.set(r,p);const h={type:"element",tagName:"a",properties:{href:"#"+a+"fn-"+o,id:a+"fnref-"+o+(p>1?"-"+p:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(d)}]};e.patch(i,h);const g={type:"element",tagName:"sup",properties:{},children:[h]};return e.patch(i,g),e.applyData(i,g)}function Q3(e,i){const a={type:"element",tagName:"h"+i.depth,properties:{},children:e.all(i)};return e.patch(i,a),e.applyData(i,a)}function J3(e,i){if(e.options.allowDangerousHtml){const a={type:"raw",value:i.value};return e.patch(i,a),e.applyData(i,a)}}function Xk(e,i){const a=i.referenceType;let r="]";if(a==="collapsed"?r+="[]":a==="full"&&(r+="["+(i.label||i.identifier)+"]"),i.type==="imageReference")return[{type:"text",value:"!["+i.alt+r}];const o=e.all(i),u=o[0];u&&u.type==="text"?u.value="["+u.value:o.unshift({type:"text",value:"["});const d=o[o.length-1];return d&&d.type==="text"?d.value+=r:o.push({type:"text",value:r}),o}function W3(e,i){const a=String(i.identifier).toUpperCase(),r=e.definitionById.get(a);if(!r)return Xk(e,i);const o={src:vl(r.url||""),alt:i.alt};r.title!==null&&r.title!==void 0&&(o.title=r.title);const u={type:"element",tagName:"img",properties:o,children:[]};return e.patch(i,u),e.applyData(i,u)}function e4(e,i){const a={src:vl(i.url)};i.alt!==null&&i.alt!==void 0&&(a.alt=i.alt),i.title!==null&&i.title!==void 0&&(a.title=i.title);const r={type:"element",tagName:"img",properties:a,children:[]};return e.patch(i,r),e.applyData(i,r)}function t4(e,i){const a={type:"text",value:i.value.replace(/\r?\n|\r/g," ")};e.patch(i,a);const r={type:"element",tagName:"code",properties:{},children:[a]};return e.patch(i,r),e.applyData(i,r)}function n4(e,i){const a=String(i.identifier).toUpperCase(),r=e.definitionById.get(a);if(!r)return Xk(e,i);const o={href:vl(r.url||"")};r.title!==null&&r.title!==void 0&&(o.title=r.title);const u={type:"element",tagName:"a",properties:o,children:e.all(i)};return e.patch(i,u),e.applyData(i,u)}function i4(e,i){const a={href:vl(i.url)};i.title!==null&&i.title!==void 0&&(a.title=i.title);const r={type:"element",tagName:"a",properties:a,children:e.all(i)};return e.patch(i,r),e.applyData(i,r)}function a4(e,i,a){const r=e.all(i),o=a?r4(a):Zk(i),u={},d=[];if(typeof i.checked=="boolean"){const x=r[0];let b;x&&x.type==="element"&&x.tagName==="p"?b=x:(b={type:"element",tagName:"p",properties:{},children:[]},r.unshift(b)),b.children.length>0&&b.children.unshift({type:"text",value:" "}),b.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:i.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let p=-1;for(;++p<r.length;){const x=r[p];(o||p!==0||x.type!=="element"||x.tagName!=="p")&&d.push({type:"text",value:`
|
|
221
|
+
`}),x.type==="element"&&x.tagName==="p"&&!o?d.push(...x.children):d.push(x)}const h=r[r.length-1];h&&(o||h.type!=="element"||h.tagName!=="p")&&d.push({type:"text",value:`
|
|
222
|
+
`});const g={type:"element",tagName:"li",properties:u,children:d};return e.patch(i,g),e.applyData(i,g)}function r4(e){let i=!1;if(e.type==="list"){i=e.spread||!1;const a=e.children;let r=-1;for(;!i&&++r<a.length;)i=Zk(a[r])}return i}function Zk(e){const i=e.spread;return i??e.children.length>1}function s4(e,i){const a={},r=e.all(i);let o=-1;for(typeof i.start=="number"&&i.start!==1&&(a.start=i.start);++o<r.length;){const d=r[o];if(d.type==="element"&&d.tagName==="li"&&d.properties&&Array.isArray(d.properties.className)&&d.properties.className.includes("task-list-item")){a.className=["contains-task-list"];break}}const u={type:"element",tagName:i.ordered?"ol":"ul",properties:a,children:e.wrap(r,!0)};return e.patch(i,u),e.applyData(i,u)}function l4(e,i){const a={type:"element",tagName:"p",properties:{},children:e.all(i)};return e.patch(i,a),e.applyData(i,a)}function o4(e,i){const a={type:"root",children:e.wrap(e.all(i))};return e.patch(i,a),e.applyData(i,a)}function c4(e,i){const a={type:"element",tagName:"strong",properties:{},children:e.all(i)};return e.patch(i,a),e.applyData(i,a)}function u4(e,i){const a=e.all(i),r=a.shift(),o=[];if(r){const d={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(i.children[0],d),o.push(d)}if(a.length>0){const d={type:"element",tagName:"tbody",properties:{},children:e.wrap(a,!0)},p=wg(i.children[1]),h=Ck(i.children[i.children.length-1]);p&&h&&(d.position={start:p,end:h}),o.push(d)}const u={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(i,u),e.applyData(i,u)}function d4(e,i,a){const r=a?a.children:void 0,u=(r?r.indexOf(i):1)===0?"th":"td",d=a&&a.type==="table"?a.align:void 0,p=d?d.length:i.children.length;let h=-1;const g=[];for(;++h<p;){const b=i.children[h],y={},v=d?d[h]:void 0;v&&(y.align=v);let w={type:"element",tagName:u,properties:y,children:[]};b&&(w.children=e.all(b),e.patch(b,w),w=e.applyData(b,w)),g.push(w)}const x={type:"element",tagName:"tr",properties:{},children:e.wrap(g,!0)};return e.patch(i,x),e.applyData(i,x)}function f4(e,i){const a={type:"element",tagName:"td",properties:{},children:e.all(i)};return e.patch(i,a),e.applyData(i,a)}const iv=9,av=32;function p4(e){const i=String(e),a=/\r?\n|\r/g;let r=a.exec(i),o=0;const u=[];for(;r;)u.push(rv(i.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=a.exec(i);return u.push(rv(i.slice(o),o>0,!1)),u.join("")}function rv(e,i,a){let r=0,o=e.length;if(i){let u=e.codePointAt(r);for(;u===iv||u===av;)r++,u=e.codePointAt(r)}if(a){let u=e.codePointAt(o-1);for(;u===iv||u===av;)o--,u=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}function m4(e,i){const a={type:"text",value:p4(String(i.value))};return e.patch(i,a),e.applyData(i,a)}function h4(e,i){const a={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(i,a),e.applyData(i,a)}const g4={blockquote:G3,break:Y3,code:V3,delete:K3,emphasis:X3,footnoteReference:Z3,heading:Q3,html:J3,imageReference:W3,image:e4,inlineCode:t4,linkReference:n4,link:i4,listItem:a4,list:s4,paragraph:l4,root:o4,strong:c4,table:u4,tableCell:f4,tableRow:d4,text:m4,thematicBreak:h4,toml:Cu,yaml:Cu,definition:Cu,footnoteDefinition:Cu};function Cu(){}const Qk=-1,Rd=0,Mo=1,ld=2,Cg=3,jg=4,Ag=5,Og=6,Jk=7,Wk=8,{defineProperty:x4}=Object,eN=typeof self=="object"?self:globalThis,sv=(e,i)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new eN[e](i)},b4=(e,i)=>{const a=(o,u)=>(e.set(u,o),o),r=o=>{if(e.has(o))return e.get(o);const[u,d]=i[o];switch(u){case Rd:case Qk:return a(d,o);case Mo:{const p=a([],o);for(const h of d)p.push(r(h));return p}case ld:{const p=a({},o);for(const[h,g]of d){const x=r(h),b=r(g);x==="__proto__"?x4(p,x,{value:b,configurable:!0,enumerable:!0,writable:!0}):p[x]=b}return p}case Cg:return a(new Date(d),o);case jg:{const{source:p,flags:h}=d;return a(new RegExp(p,h),o)}case Ag:{const p=a(new Map,o);for(const[h,g]of d)p.set(r(h),r(g));return p}case Og:{const p=a(new Set,o);for(const h of d)p.add(r(h));return p}case Jk:{const{name:p,message:h}=d;return a(typeof eN[p]=="function"?sv(p,h):new Error(h),o)}case Wk:return a(BigInt(d),o);case"BigInt":return a(Object(BigInt(d)),o);case"ArrayBuffer":return a(new Uint8Array(d).buffer,d);case"DataView":{const{buffer:p}=new Uint8Array(d);return a(new DataView(p),d)}case"-0":return-0}return a(sv(u,d),o)};return r},lv=e=>b4(new Map,e)(0),Qr="",{toString:y4}={},{keys:v4,is:w4}=Object,ko=e=>{const i=typeof e;if(i!=="object"||!e)return[Rd,i];const a=y4.call(e).slice(8,-1);switch(a){case"Array":return[Mo,Qr];case"Object":return[ld,Qr];case"Date":return[Cg,Qr];case"RegExp":return[jg,Qr];case"Map":return[Ag,Qr];case"Set":return[Og,Qr];case"DataView":return[Mo,a]}return a.includes("Array")?[Mo,a]:e instanceof Error?[Jk,e.name||"Error"]:[ld,a]},ju=([e,i])=>e===Rd&&(i==="function"||i==="symbol"),k4=(e,i,a,r)=>{const o=(d,p)=>{const h=r.push(d)-1;return a.set(p,h),h},u=d=>{if(a.has(d))return a.get(d);let[p,h]=ko(d);switch(p){case Rd:{let x=d;switch(h){case"bigint":p=Wk,x=d.toString();break;case"number":if(!d&&w4(d,-0))return r.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+h);x=null;break;case"undefined":return o([Qk],d)}return o([p,x],d)}case Mo:{if(h){let y=d;return h==="DataView"?y=new Uint8Array(d.buffer):h==="ArrayBuffer"&&(y=new Uint8Array(d)),o([h,[...y]],d)}const x=[],b=o([p,x],d);for(const y of d)x.push(u(y));return b}case ld:{if(h)switch(h){case"BigInt":return o([h,d.toString()],d);case"Boolean":case"Number":case"String":return o([h,d.valueOf()],d)}if(i&&"toJSON"in d)return u(d.toJSON());const x=[],b=o([p,x],d);for(const y of v4(d))(e||!ju(ko(d[y])))&&x.push([u(y),u(d[y])]);return b}case Cg:return o([p,isNaN(d.getTime())?Qr:d.toISOString()],d);case jg:{const{source:x,flags:b}=d;return o([p,{source:x,flags:b}],d)}case Ag:{const x=[],b=o([p,x],d);for(const[y,v]of d)(e||!(ju(ko(y))||ju(ko(v))))&&x.push([u(y),u(v)]);return b}case Og:{const x=[],b=o([p,x],d);for(const y of d)(e||!ju(ko(y)))&&x.push(u(y));return b}}const{message:g}=d;return o([p,{name:h,message:g}],d)};return u},ov=(e,{json:i,lossy:a}={})=>{const r=[];return k4(!(i||a),!!i,new Map,r)(e),r},od=typeof structuredClone=="function"?(e,i)=>i&&("json"in i||"lossy"in i)?lv(ov(e,i)):structuredClone(e):(e,i)=>lv(ov(e,i));function N4(e,i){const a=[{type:"text",value:"↩"}];return i>1&&a.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(i)}]}),a}function E4(e,i){return"Back to reference "+(e+1)+(i>1?"-"+i:"")}function _4(e){const i=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=e.options.footnoteBackContent||N4,r=e.options.footnoteBackLabel||E4,o=e.options.footnoteLabel||"Footnotes",u=e.options.footnoteLabelTagName||"h2",d=e.options.footnoteLabelProperties||{className:["sr-only"]},p=[];let h=-1;for(;++h<e.footnoteOrder.length;){const g=e.footnoteById.get(e.footnoteOrder[h]);if(!g)continue;const x=e.all(g),b=String(g.identifier).toUpperCase(),y=vl(b.toLowerCase());let v=0;const w=[],T=e.footnoteCounts.get(b);for(;T!==void 0&&++v<=T;){w.length>0&&w.push({type:"text",value:" "});let j=typeof a=="string"?a:a(h,v);typeof j=="string"&&(j={type:"text",value:j}),w.push({type:"element",tagName:"a",properties:{href:"#"+i+"fnref-"+y+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(h,v),className:["data-footnote-backref"]},children:Array.isArray(j)?j:[j]})}const E=x[x.length-1];if(E&&E.type==="element"&&E.tagName==="p"){const j=E.children[E.children.length-1];j&&j.type==="text"?j.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(...w)}else x.push(...w);const N={type:"element",tagName:"li",properties:{id:i+"fn-"+y},children:e.wrap(x,!0)};e.patch(g,N),p.push(N)}if(p.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...od(d),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
223
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(p,!0)},{type:"text",value:`
|
|
224
|
+
`}]}}const Qo=(function(e){if(e==null)return j4;if(typeof e=="function")return Dd(e);if(typeof e=="object")return Array.isArray(e)?S4(e):T4(e);if(typeof e=="string")return C4(e);throw new Error("Expected function, string, or object as test")});function S4(e){const i=[];let a=-1;for(;++a<e.length;)i[a]=Qo(e[a]);return Dd(r);function r(...o){let u=-1;for(;++u<i.length;)if(i[u].apply(this,o))return!0;return!1}}function T4(e){const i=e;return Dd(a);function a(r){const o=r;let u;for(u in e)if(o[u]!==i[u])return!1;return!0}}function C4(e){return Dd(i);function i(a){return a&&a.type===e}}function Dd(e){return i;function i(a,r,o){return!!(A4(a)&&e.call(this,a,typeof r=="number"?r:void 0,o||void 0))}}function j4(){return!0}function A4(e){return e!==null&&typeof e=="object"&&"type"in e}const tN=[],O4=!0,Rh=!1,M4="skip";function nN(e,i,a,r){let o;typeof i=="function"&&typeof a!="function"?(r=a,a=i):o=i;const u=Qo(o),d=r?-1:1;p(e,void 0,[])();function p(h,g,x){const b=h&&typeof h=="object"?h:{};if(typeof b.type=="string"){const v=typeof b.tagName=="string"?b.tagName:typeof b.name=="string"?b.name:void 0;Object.defineProperty(y,"name",{value:"node ("+(h.type+(v?"<"+v+">":""))+")"})}return y;function y(){let v=tN,w,T,E;if((!i||u(h,g,x[x.length-1]||void 0))&&(v=R4(a(h,x)),v[0]===Rh))return v;if("children"in h&&h.children){const N=h;if(N.children&&v[0]!==M4)for(T=(r?N.children.length:-1)+d,E=x.concat(N);T>-1&&T<N.children.length;){const j=N.children[T];if(w=p(j,T,E)(),w[0]===Rh)return w;T=typeof w[1]=="number"?w[1]:T+d}}return v}}}function R4(e){return Array.isArray(e)?e:typeof e=="number"?[O4,e]:e==null?tN:[e]}function zd(e,i,a,r){let o,u,d;typeof i=="function"&&typeof a!="function"?(u=void 0,d=i,o=a):(u=i,d=a,o=r),nN(e,u,p,o);function p(h,g){const x=g[g.length-1],b=x?x.children.indexOf(h):void 0;return d(h,b,x)}}const Dh={}.hasOwnProperty,D4={};function z4(e,i){const a=i||D4,r=new Map,o=new Map,u=new Map,d={...g4,...a.handlers},p={all:g,applyData:I4,definitionById:r,footnoteById:o,footnoteCounts:u,footnoteOrder:[],handlers:d,one:h,options:a,patch:L4,wrap:B4};return zd(e,function(x){if(x.type==="definition"||x.type==="footnoteDefinition"){const b=x.type==="definition"?r:o,y=String(x.identifier).toUpperCase();b.has(y)||b.set(y,x)}}),p;function h(x,b){const y=x.type,v=p.handlers[y];if(Dh.call(p.handlers,y)&&v)return v(p,x,b);if(p.options.passThrough&&p.options.passThrough.includes(y)){if("children"in x){const{children:T,...E}=x,N=od(E);return N.children=p.all(x),N}return od(x)}return(p.options.unknownHandler||U4)(p,x,b)}function g(x){const b=[];if("children"in x){const y=x.children;let v=-1;for(;++v<y.length;){const w=p.one(y[v],x);if(w){if(v&&y[v-1].type==="break"&&(!Array.isArray(w)&&w.type==="text"&&(w.value=cv(w.value)),!Array.isArray(w)&&w.type==="element")){const T=w.children[0];T&&T.type==="text"&&(T.value=cv(T.value))}Array.isArray(w)?b.push(...w):b.push(w)}}}return b}}function L4(e,i){e.position&&(i.position=E5(e))}function I4(e,i){let a=i;if(e&&e.data){const r=e.data.hName,o=e.data.hChildren,u=e.data.hProperties;if(typeof r=="string")if(a.type==="element")a.tagName=r;else{const d="children"in a?a.children:[a];a={type:"element",tagName:r,properties:{},children:d}}a.type==="element"&&u&&Object.assign(a.properties,od(u)),"children"in a&&a.children&&o!==null&&o!==void 0&&(a.children=o)}return a}function U4(e,i){const a=i.data||{},r="value"in i&&!(Dh.call(a,"hProperties")||Dh.call(a,"hChildren"))?{type:"text",value:i.value}:{type:"element",tagName:"div",properties:{},children:e.all(i)};return e.patch(i,r),e.applyData(i,r)}function B4(e,i){const a=[];let r=-1;for(i&&a.push({type:"text",value:`
|
|
225
|
+
`});++r<e.length;)r&&a.push({type:"text",value:`
|
|
226
|
+
`}),a.push(e[r]);return i&&e.length>0&&a.push({type:"text",value:`
|
|
227
|
+
`}),a}function cv(e){let i=0,a=e.charCodeAt(i);for(;a===9||a===32;)i++,a=e.charCodeAt(i);return e.slice(i)}function uv(e,i){const a=z4(e,i),r=a.one(e,void 0),o=_4(a),u=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&u.children.push({type:"text",value:`
|
|
228
|
+
`},o),u}function $4(e,i){return e&&"run"in e?async function(a,r){const o=uv(a,{file:r,...i});await e.run(o,r)}:function(a,r){return uv(a,{file:r,...e||i})}}function dv(e){if(e)throw e}var Lm,fv;function P4(){if(fv)return Lm;fv=1;var e=Object.prototype.hasOwnProperty,i=Object.prototype.toString,a=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=function(g){return typeof Array.isArray=="function"?Array.isArray(g):i.call(g)==="[object Array]"},u=function(g){if(!g||i.call(g)!=="[object Object]")return!1;var x=e.call(g,"constructor"),b=g.constructor&&g.constructor.prototype&&e.call(g.constructor.prototype,"isPrototypeOf");if(g.constructor&&!x&&!b)return!1;var y;for(y in g);return typeof y>"u"||e.call(g,y)},d=function(g,x){a&&x.name==="__proto__"?a(g,x.name,{enumerable:!0,configurable:!0,value:x.newValue,writable:!0}):g[x.name]=x.newValue},p=function(g,x){if(x==="__proto__")if(e.call(g,x)){if(r)return r(g,x).value}else return;return g[x]};return Lm=function h(){var g,x,b,y,v,w,T=arguments[0],E=1,N=arguments.length,j=!1;for(typeof T=="boolean"&&(j=T,T=arguments[1]||{},E=2),(T==null||typeof T!="object"&&typeof T!="function")&&(T={});E<N;++E)if(g=arguments[E],g!=null)for(x in g)b=p(T,x),y=p(g,x),T!==y&&(j&&y&&(u(y)||(v=o(y)))?(v?(v=!1,w=b&&o(b)?b:[]):w=b&&u(b)?b:{},d(T,{name:x,newValue:h(j,w,y)})):typeof y<"u"&&d(T,{name:x,newValue:y}));return T},Lm}var H4=P4();const Im=fd(H4);function zh(e){if(typeof e!="object"||e===null)return!1;const i=Object.getPrototypeOf(e);return(i===null||i===Object.prototype||Object.getPrototypeOf(i)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function F4(){const e=[],i={run:a,use:r};return i;function a(...o){let u=-1;const d=o.pop();if(typeof d!="function")throw new TypeError("Expected function as last argument, not "+d);p(null,...o);function p(h,...g){const x=e[++u];let b=-1;if(h){d(h);return}for(;++b<o.length;)(g[b]===null||g[b]===void 0)&&(g[b]=o[b]);o=g,x?q4(x,p)(...g):d(null,...g)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),i}}function q4(e,i){let a;return r;function r(...d){const p=e.length>d.length;let h;p&&d.push(o);try{h=e.apply(this,d)}catch(g){const x=g;if(p&&a)throw x;return o(x)}p||(h&&h.then&&typeof h.then=="function"?h.then(u,o):h instanceof Error?o(h):u(h))}function o(d,...p){a||(a=!0,i(d,...p))}function u(d){o(null,d)}}const ra={basename:G4,dirname:Y4,extname:V4,join:K4,sep:"/"};function G4(e,i){if(i!==void 0&&typeof i!="string")throw new TypeError('"ext" argument must be a string');Jo(e);let a=0,r=-1,o=e.length,u;if(i===void 0||i.length===0||i.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(u){a=o+1;break}}else r<0&&(u=!0,r=o+1);return r<0?"":e.slice(a,r)}if(i===e)return"";let d=-1,p=i.length-1;for(;o--;)if(e.codePointAt(o)===47){if(u){a=o+1;break}}else d<0&&(u=!0,d=o+1),p>-1&&(e.codePointAt(o)===i.codePointAt(p--)?p<0&&(r=o):(p=-1,r=d));return a===r?r=d:r<0&&(r=e.length),e.slice(a,r)}function Y4(e){if(Jo(e),e.length===0)return".";let i=-1,a=e.length,r;for(;--a;)if(e.codePointAt(a)===47){if(r){i=a;break}}else r||(r=!0);return i<0?e.codePointAt(0)===47?"/":".":i===1&&e.codePointAt(0)===47?"//":e.slice(0,i)}function V4(e){Jo(e);let i=e.length,a=-1,r=0,o=-1,u=0,d;for(;i--;){const p=e.codePointAt(i);if(p===47){if(d){r=i+1;break}continue}a<0&&(d=!0,a=i+1),p===46?o<0?o=i:u!==1&&(u=1):o>-1&&(u=-1)}return o<0||a<0||u===0||u===1&&o===a-1&&o===r+1?"":e.slice(o,a)}function K4(...e){let i=-1,a;for(;++i<e.length;)Jo(e[i]),e[i]&&(a=a===void 0?e[i]:a+"/"+e[i]);return a===void 0?".":X4(a)}function X4(e){Jo(e);const i=e.codePointAt(0)===47;let a=Z4(e,!i);return a.length===0&&!i&&(a="."),a.length>0&&e.codePointAt(e.length-1)===47&&(a+="/"),i?"/"+a:a}function Z4(e,i){let a="",r=0,o=-1,u=0,d=-1,p,h;for(;++d<=e.length;){if(d<e.length)p=e.codePointAt(d);else{if(p===47)break;p=47}if(p===47){if(!(o===d-1||u===1))if(o!==d-1&&u===2){if(a.length<2||r!==2||a.codePointAt(a.length-1)!==46||a.codePointAt(a.length-2)!==46){if(a.length>2){if(h=a.lastIndexOf("/"),h!==a.length-1){h<0?(a="",r=0):(a=a.slice(0,h),r=a.length-1-a.lastIndexOf("/")),o=d,u=0;continue}}else if(a.length>0){a="",r=0,o=d,u=0;continue}}i&&(a=a.length>0?a+"/..":"..",r=2)}else a.length>0?a+="/"+e.slice(o+1,d):a=e.slice(o+1,d),r=d-o-1;o=d,u=0}else p===46&&u>-1?u++:u=-1}return a}function Jo(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Q4={cwd:J4};function J4(){return"/"}function Lh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function W4(e){if(typeof e=="string")e=new URL(e);else if(!Lh(e)){const i=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw i.code="ERR_INVALID_ARG_TYPE",i}if(e.protocol!=="file:"){const i=new TypeError("The URL must be of scheme file");throw i.code="ERR_INVALID_URL_SCHEME",i}return eD(e)}function eD(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const i=e.pathname;let a=-1;for(;++a<i.length;)if(i.codePointAt(a)===37&&i.codePointAt(a+1)===50){const r=i.codePointAt(a+2);if(r===70||r===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(i)}const Um=["history","path","basename","stem","extname","dirname"];class iN{constructor(i){let a;i?Lh(i)?a={path:i}:typeof i=="string"||tD(i)?a={value:i}:a=i:a={},this.cwd="cwd"in a?"":Q4.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Um.length;){const u=Um[r];u in a&&a[u]!==void 0&&a[u]!==null&&(this[u]=u==="history"?[...a[u]]:a[u])}let o;for(o in a)Um.includes(o)||(this[o]=a[o])}get basename(){return typeof this.path=="string"?ra.basename(this.path):void 0}set basename(i){$m(i,"basename"),Bm(i,"basename"),this.path=ra.join(this.dirname||"",i)}get dirname(){return typeof this.path=="string"?ra.dirname(this.path):void 0}set dirname(i){pv(this.basename,"dirname"),this.path=ra.join(i||"",this.basename)}get extname(){return typeof this.path=="string"?ra.extname(this.path):void 0}set extname(i){if(Bm(i,"extname"),pv(this.dirname,"extname"),i){if(i.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(i.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ra.join(this.dirname,this.stem+(i||""))}get path(){return this.history[this.history.length-1]}set path(i){Lh(i)&&(i=W4(i)),$m(i,"path"),this.path!==i&&this.history.push(i)}get stem(){return typeof this.path=="string"?ra.basename(this.path,this.extname):void 0}set stem(i){$m(i,"stem"),Bm(i,"stem"),this.path=ra.join(this.dirname||"",i+(this.extname||""))}fail(i,a,r){const o=this.message(i,a,r);throw o.fatal=!0,o}info(i,a,r){const o=this.message(i,a,r);return o.fatal=void 0,o}message(i,a,r){const o=new Dn(i,a,r);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(i){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(i||void 0).decode(this.value)}}function Bm(e,i){if(e&&e.includes(ra.sep))throw new Error("`"+i+"` cannot be a path: did not expect `"+ra.sep+"`")}function $m(e,i){if(!e)throw new Error("`"+i+"` cannot be empty")}function pv(e,i){if(!e)throw new Error("Setting `"+i+"` requires `path` to be set too")}function tD(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const nD=(function(e){const r=this.constructor.prototype,o=r[e],u=function(){return o.apply(u,arguments)};return Object.setPrototypeOf(u,r),u}),iD={}.hasOwnProperty;class Mg extends nD{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=F4()}copy(){const i=new Mg;let a=-1;for(;++a<this.attachers.length;){const r=this.attachers[a];i.use(...r)}return i.data(Im(!0,{},this.namespace)),i}data(i,a){return typeof i=="string"?arguments.length===2?(Fm("data",this.frozen),this.namespace[i]=a,this):iD.call(this.namespace,i)&&this.namespace[i]||void 0:i?(Fm("data",this.frozen),this.namespace=i,this):this.namespace}freeze(){if(this.frozen)return this;const i=this;for(;++this.freezeIndex<this.attachers.length;){const[a,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const o=a.call(i,...r);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(i){this.freeze();const a=Au(i),r=this.parser||this.Parser;return Pm("parse",r),r(String(a),a)}process(i,a){const r=this;return this.freeze(),Pm("process",this.parser||this.Parser),Hm("process",this.compiler||this.Compiler),a?o(void 0,a):new Promise(o);function o(u,d){const p=Au(i),h=r.parse(p);r.run(h,p,function(x,b,y){if(x||!b||!y)return g(x);const v=b,w=r.stringify(v,y);sD(w)?y.value=w:y.result=w,g(x,y)});function g(x,b){x||!b?d(x):u?u(b):a(void 0,b)}}}processSync(i){let a=!1,r;return this.freeze(),Pm("processSync",this.parser||this.Parser),Hm("processSync",this.compiler||this.Compiler),this.process(i,o),hv("processSync","process",a),r;function o(u,d){a=!0,dv(u),r=d}}run(i,a,r){mv(i),this.freeze();const o=this.transformers;return!r&&typeof a=="function"&&(r=a,a=void 0),r?u(void 0,r):new Promise(u);function u(d,p){const h=Au(a);o.run(i,h,g);function g(x,b,y){const v=b||i;x?p(x):d?d(v):r(void 0,v,y)}}}runSync(i,a){let r=!1,o;return this.run(i,a,u),hv("runSync","run",r),o;function u(d,p){dv(d),o=p,r=!0}}stringify(i,a){this.freeze();const r=Au(a),o=this.compiler||this.Compiler;return Hm("stringify",o),mv(i),o(i,r)}use(i,...a){const r=this.attachers,o=this.namespace;if(Fm("use",this.frozen),i!=null)if(typeof i=="function")h(i,a);else if(typeof i=="object")Array.isArray(i)?p(i):d(i);else throw new TypeError("Expected usable value, not `"+i+"`");return this;function u(g){if(typeof g=="function")h(g,[]);else if(typeof g=="object")if(Array.isArray(g)){const[x,...b]=g;h(x,b)}else d(g);else throw new TypeError("Expected usable value, not `"+g+"`")}function d(g){if(!("plugins"in g)&&!("settings"in g))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");p(g.plugins),g.settings&&(o.settings=Im(!0,o.settings,g.settings))}function p(g){let x=-1;if(g!=null)if(Array.isArray(g))for(;++x<g.length;){const b=g[x];u(b)}else throw new TypeError("Expected a list of plugins, not `"+g+"`")}function h(g,x){let b=-1,y=-1;for(;++b<r.length;)if(r[b][0]===g){y=b;break}if(y===-1)r.push([g,...x]);else if(x.length>0){let[v,...w]=x;const T=r[y][1];zh(T)&&zh(v)&&(v=Im(!0,T,v)),r[y]=[g,v,...w]}}}}const aD=new Mg().freeze();function Pm(e,i){if(typeof i!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Hm(e,i){if(typeof i!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Fm(e,i){if(i)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function mv(e){if(!zh(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function hv(e,i,a){if(!a)throw new Error("`"+e+"` finished async. Use `"+i+"` instead")}function Au(e){return rD(e)?e:new iN(e)}function rD(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function sD(e){return typeof e=="string"||lD(e)}function lD(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const oD="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",gv=[],xv={allowDangerousHtml:!0},cD=/^(https?|ircs?|mailto|xmpp)$/i,uD=[{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 dD(e){const i=fD(e),a=pD(e);return mD(i.runSync(i.parse(a),a),e)}function fD(e){const i=e.rehypePlugins||gv,a=e.remarkPlugins||gv,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...xv}:xv;return aD().use(q3).use(a).use($4,r).use(i)}function pD(e){const i=e.children||"",a=new iN;return typeof i=="string"&&(a.value=i),a}function mD(e,i){const a=i.allowedElements,r=i.allowElement,o=i.components,u=i.disallowedElements,d=i.skipHtml,p=i.unwrapDisallowed,h=i.urlTransform||hD;for(const x of uD)Object.hasOwn(i,x.from)&&(""+x.from+(x.to?"use `"+x.to+"` instead":"remove it")+oD+x.id,void 0);return zd(e,g),j5(e,{Fragment:c.Fragment,components:o,ignoreInvalidStyle:!0,jsx:c.jsx,jsxs:c.jsxs,passKeys:!0,passNode:!0});function g(x,b,y){if(x.type==="raw"&&y&&typeof b=="number")return d?y.children.splice(b,1):y.children[b]={type:"text",value:x.value},b;if(x.type==="element"){let v;for(v in Rm)if(Object.hasOwn(Rm,v)&&Object.hasOwn(x.properties,v)){const w=x.properties[v],T=Rm[v];(T===null||T.includes(x.tagName))&&(x.properties[v]=h(String(w||""),v,x))}}if(x.type==="element"){let v=a?!a.includes(x.tagName):u?u.includes(x.tagName):!1;if(!v&&r&&typeof b=="number"&&(v=!r(x,b,y)),v&&y&&typeof b=="number")return p&&x.children?y.children.splice(b,1,...x.children):y.children.splice(b,1),b}}}function hD(e){const i=e.indexOf(":"),a=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return i===-1||o!==-1&&i>o||a!==-1&&i>a||r!==-1&&i>r||cD.test(e.slice(0,i))?e:""}function bv(e,i){const a=String(e);if(typeof i!="string")throw new TypeError("Expected character");let r=0,o=a.indexOf(i);for(;o!==-1;)r++,o=a.indexOf(i,o+i.length);return r}function gD(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function xD(e,i,a){const o=Qo((a||{}).ignore||[]),u=bD(i);let d=-1;for(;++d<u.length;)nN(e,"text",p);function p(g,x){let b=-1,y;for(;++b<x.length;){const v=x[b],w=y?y.children:void 0;if(o(v,w?w.indexOf(v):void 0,y))return;y=v}if(y)return h(g,x)}function h(g,x){const b=x[x.length-1],y=u[d][0],v=u[d][1];let w=0;const E=b.children.indexOf(g);let N=!1,j=[];y.lastIndex=0;let A=y.exec(g.value);for(;A;){const $=A.index,z={index:A.index,input:A.input,stack:[...x,g]};let C=v(...A,z);if(typeof C=="string"&&(C=C.length>0?{type:"text",value:C}:void 0),C===!1)y.lastIndex=$+1;else{if(w!==$&&R({type:"text",value:g.value.slice(w,$)}),Array.isArray(C))for(const L of C)R(L);else C&&R(C);w=$+A[0].length,N=!0}if(!y.global)break;A=y.exec(g.value)}return N?(w<g.value.length&&R({type:"text",value:g.value.slice(w)}),b.children.splice(E,1,...j)):j=[g],E+j.length;function R($){const z=j[j.length-1];z&&z.type==="text"&&$.type==="text"?z.value+=$.value:j.push($)}}}function bD(e){if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const i=[],a=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<a.length;){const o=a[r];i.push([yD(o[0]),vD(o[1])])}return i}function yD(e){return typeof e=="string"?new RegExp(gD(e),"g"):e}function vD(e){return typeof e=="function"?e:function(){return e}}const qm="phrasing",Gm=["autolink","link","image","label"];function wD(){return{transforms:[CD],enter:{literalAutolink:ND,literalAutolinkEmail:Ym,literalAutolinkHttp:Ym,literalAutolinkWww:Ym},exit:{literalAutolink:TD,literalAutolinkEmail:SD,literalAutolinkHttp:ED,literalAutolinkWww:_D}}}function kD(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:qm,notInConstruct:Gm},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:qm,notInConstruct:Gm},{character:":",before:"[ps]",after:"\\/",inConstruct:qm,notInConstruct:Gm}]}}function ND(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Ym(e){this.config.enter.autolinkProtocol.call(this,e)}function ED(e){this.config.exit.autolinkProtocol.call(this,e)}function _D(e){this.config.exit.data.call(this,e);const i=this.stack[this.stack.length-1];i.type,i.url="http://"+this.sliceSerialize(e)}function SD(e){this.config.exit.autolinkEmail.call(this,e)}function TD(e){this.exit(e)}function CD(e){xD(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,jD],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,AD]],{ignore:["link","linkReference"]})}function jD(e,i,a,r,o){let u="";if(!aN(o)||(/^w/i.test(i)&&(a=i+a,i="",u="http://"),!OD(a)))return!1;const d=MD(a+r);if(!d[0])return!1;const p={type:"link",title:null,url:u+i+d[0],children:[{type:"text",value:i+d[0]}]};return d[1]?[p,{type:"text",value:d[1]}]:p}function AD(e,i,a,r){return!aN(r,!0)||/[-\d_]$/.test(a)?!1:{type:"link",title:null,url:"mailto:"+i+"@"+a,children:[{type:"text",value:i+"@"+a}]}}function OD(e){const i=e.split(".");return!(i.length<2||i[i.length-1]&&(/_/.test(i[i.length-1])||!/[a-zA-Z\d]/.test(i[i.length-1]))||i[i.length-2]&&(/_/.test(i[i.length-2])||!/[a-zA-Z\d]/.test(i[i.length-2])))}function MD(e){const i=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!i)return[e,void 0];e=e.slice(0,i.index);let a=i[0],r=a.indexOf(")");const o=bv(e,"(");let u=bv(e,")");for(;r!==-1&&o>u;)e+=a.slice(0,r+1),a=a.slice(r+1),r=a.indexOf(")"),u++;return[e,a]}function aN(e,i){const a=e.input.charCodeAt(e.index-1);return(e.index===0||as(a)||Od(a))&&(!i||a!==47)}rN.peek=PD;function RD(){this.buffer()}function DD(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function zD(){this.buffer()}function LD(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function ID(e){const i=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=Pi(this.sliceSerialize(e)).toLowerCase(),a.label=i}function UD(e){this.exit(e)}function BD(e){const i=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=Pi(this.sliceSerialize(e)).toLowerCase(),a.label=i}function $D(e){this.exit(e)}function PD(){return"["}function rN(e,i,a,r){const o=a.createTracker(r);let u=o.move("[^");const d=a.enter("footnoteReference"),p=a.enter("reference");return u+=o.move(a.safe(a.associationId(e),{after:"]",before:u})),p(),d(),u+=o.move("]"),u}function HD(){return{enter:{gfmFootnoteCallString:RD,gfmFootnoteCall:DD,gfmFootnoteDefinitionLabelString:zD,gfmFootnoteDefinition:LD},exit:{gfmFootnoteCallString:ID,gfmFootnoteCall:UD,gfmFootnoteDefinitionLabelString:BD,gfmFootnoteDefinition:$D}}}function FD(e){let i=!1;return e&&e.firstLineBlank&&(i=!0),{handlers:{footnoteDefinition:a,footnoteReference:rN},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function a(r,o,u,d){const p=u.createTracker(d);let h=p.move("[^");const g=u.enter("footnoteDefinition"),x=u.enter("label");return h+=p.move(u.safe(u.associationId(r),{before:h,after:"]"})),x(),h+=p.move("]:"),r.children&&r.children.length>0&&(p.shift(4),h+=p.move((i?`
|
|
229
|
+
`:" ")+u.indentLines(u.containerFlow(r,p.current()),i?sN:qD))),g(),h}}function qD(e,i,a){return i===0?e:sN(e,i,a)}function sN(e,i,a){return(a?"":" ")+e}const GD=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Rg.attention=ZD;Rg.peek=QD;function YD(){return{canContainEols:["delete"],enter:{strikethrough:KD},exit:{strikethrough:XD}}}function VD(){return{handlers:{delete:Rg},unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:GD}]}}function KD(e){this.enter({type:"delete",children:[],position:void 0},e)}function XD(e){this.exit(e)}function Rg(e,i,a,r){const o=a.createTracker(r),u=a.stack.includes("strikethrough")?"~":"~~",d=a.enter("strikethrough");let p=o.move(u);return p+=a.containerPhrasing(e,{...o.current(),before:p,after:"~"}),p+=o.move(u),d(),p}function ZD(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function QD(){return"~"}function JD(e){return e.length}function WD(e,i){const a=i||{},r=(a.align||[]).concat(),o=a.stringLength||JD,u=[],d=[],p=[],h=[];let g=0,x=-1;for(;++x<e.length;){const T=[],E=[];let N=-1;for(e[x].length>g&&(g=e[x].length);++N<e[x].length;){const j=ez(e[x][N]);if(a.alignDelimiters!==!1){const A=o(j);E[N]=A,(h[N]===void 0||A>h[N])&&(h[N]=A)}T.push(j)}d[x]=T,p[x]=E}let b=-1;if(typeof r=="object"&&"length"in r)for(;++b<g;)u[b]=yv(r[b]);else{const T=yv(r);for(;++b<g;)u[b]=T}b=-1;const y=[],v=[];for(;++b<g;){const T=u[b];let E="",N="";T===99?(E=":",N=":"):T===108?E=":":T===114&&(N=":");let j=a.alignDelimiters===!1?1:Math.max(1,h[b]-E.length-N.length);const A=E+"-".repeat(j)+N;a.alignDelimiters!==!1&&(j=E.length+j+N.length,j>h[b]&&(h[b]=j),v[b]=j),y[b]=A}d.splice(1,0,y),p.splice(1,0,v),x=-1;const w=[];for(;++x<d.length;){const T=d[x],E=p[x];b=-1;const N=[];for(;++b<g;){const j=T[b]||"";let A="",R="";if(a.alignDelimiters!==!1){const $=h[b]-(E[b]||0),z=u[b];z===114?A=" ".repeat($):z===99?$%2?(A=" ".repeat($/2+.5),R=" ".repeat($/2-.5)):(A=" ".repeat($/2),R=A):R=" ".repeat($)}a.delimiterStart!==!1&&!b&&N.push("|"),a.padding!==!1&&!(a.alignDelimiters===!1&&j==="")&&(a.delimiterStart!==!1||b)&&N.push(" "),a.alignDelimiters!==!1&&N.push(A),N.push(j),a.alignDelimiters!==!1&&N.push(R),a.padding!==!1&&N.push(" "),(a.delimiterEnd!==!1||b!==g-1)&&N.push("|")}w.push(a.delimiterEnd===!1?N.join("").replace(/ +$/,""):N.join(""))}return w.join(`
|
|
230
|
+
`)}function ez(e){return e==null?"":String(e)}function yv(e){const i=typeof e=="string"?e.codePointAt(0):0;return i===67||i===99?99:i===76||i===108?108:i===82||i===114?114:0}const tz=Qo(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function nz(e,i,a,r){const o=a.enter("blockquote"),u=a.createTracker(r);u.move("> "),u.shift(2);const d=a.indentLines(a.containerFlow(e,u.current()),iz);return o(),d}function iz(e,i,a){return">"+(a?"":" ")+e}function az(e,i){return vv(e,i.inConstruct,!0)&&!vv(e,i.notInConstruct,!1)}function vv(e,i,a){if(typeof i=="string"&&(i=[i]),!i||i.length===0)return a;let r=-1;for(;++r<i.length;)if(e.includes(i[r]))return!0;return!1}function wv(e,i,a,r){let o=-1;for(;++o<a.unsafe.length;){const u=a.unsafe[o];if(u.character===`
|
|
231
|
+
`&&!u.before&&!u.after&&az(a.stack,u))return/[\t ]/.test(r.before)?"":" "}return`\\
|
|
232
|
+
`}function rz(e,i){const a=String(e);let r=a.indexOf(i),o=r,u=0,d=0;if(typeof i!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===o?++u>d&&(d=u):u=1,o=r+i.length,r=a.indexOf(i,o);return d}function sz(e,i){return!!(i.options.fences===!1&&e.value&&!e.lang&&/[^\n\r ]/.test(e.value)&&!/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(e.value))}function lz(e){const i=e.options.fence||"`";if(i!=="`"&&i!=="~")throw new Error("Cannot serialize code with `"+i+"` for `options.fence`, expected `` ` `` or `~`");return i}function oz(e,i,a,r){const o=lz(a),u=e.value||"";if(sz(e,a)){const b=a.enter("codeIndented"),y=a.indentLines(u,cz);return b(),y}const d=a.createTracker(r),p=o.repeat(Math.max(rz(u,o)+1,3)),h=a.enter("codeFenced"),g=o==="`"?"GraveAccent":"Tilde";let x=d.move(p);if(e.lang){const b=a.enter(`codeFencedLang${g}`);x+=d.move(a.safe(e.lang,{before:x,after:" ",encode:["`"],...d.current()})),b()}if(e.lang&&e.meta){const b=a.enter(`codeFencedMeta${g}`);x+=d.move(" "),x+=d.move(a.safe(e.meta,{before:x,after:`
|
|
233
|
+
`,encode:["`"],...d.current()})),b()}return x+=d.move(`
|
|
234
|
+
`),u&&(x+=d.move(u+`
|
|
235
|
+
`)),x+=d.move(p),h(),x}function cz(e,i,a){return(a?"":" ")+e}function Dg(e){const i=e.options.quote||'"';if(i!=='"'&&i!=="'")throw new Error("Cannot serialize title with `"+i+"` for `options.quote`, expected `\"`, or `'`");return i}function uz(e,i,a,r){const o=Dg(a),u=o==='"'?"Quote":"Apostrophe",d=a.enter("definition");let p=a.enter("label");const h=a.createTracker(r);let g=h.move("[");return g+=h.move(a.safe(a.associationId(e),{before:g,after:"]",...h.current()})),g+=h.move("]: "),p(),!e.url||/[\0- \u007F]/.test(e.url)?(p=a.enter("destinationLiteral"),g+=h.move("<"),g+=h.move(a.safe(e.url,{before:g,after:">",...h.current()})),g+=h.move(">")):(p=a.enter("destinationRaw"),g+=h.move(a.safe(e.url,{before:g,after:e.title?" ":`
|
|
236
|
+
`,...h.current()}))),p(),e.title&&(p=a.enter(`title${u}`),g+=h.move(" "+o),g+=h.move(a.safe(e.title,{before:g,after:o,...h.current()})),g+=h.move(o),p()),d(),g}function dz(e){const i=e.options.emphasis||"*";if(i!=="*"&&i!=="_")throw new Error("Cannot serialize emphasis with `"+i+"` for `options.emphasis`, expected `*`, or `_`");return i}zg.attention=fz;zg.peek=pz;function zg(e,i,a,r){const o=a.enter("phrasing"),u=a.containerPhrasing({type:"root",children:[e]},r);return o(),u}function fz(e,i){return{construct:"emphasis",markers:dz(i)==="*"?["*","_"]:["_","*"],sizes:[1]}}function pz(e,i,a){return a.options.emphasis||"*"}function mz(e){return"&#x"+e.toString(16).toUpperCase()+";"}function hz(e,i){let a=!1;return zd(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return a=!0,Rh}),!!((!e.depth||e.depth<3)&&_g(e)&&(i.options.setext||a))}function gz(e,i,a,r){const o=Math.max(Math.min(6,e.depth||1),1),u=a.createTracker(r);if(hz(e,a)){const b=a.enter("headingSetext"),y=a.enter("phrasing"),v=a.containerPhrasing(e,{...u.current(),before:`
|
|
237
|
+
`,after:`
|
|
238
|
+
`});return y(),b(),v+`
|
|
239
|
+
`+(o===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.lastIndexOf(`
|
|
240
|
+
`))+1))}const d="#".repeat(o),p=a.enter("headingAtx"),h=a.enter("phrasing");u.move(d+" ");let g=a.containerPhrasing(e,{before:"# ",after:`
|
|
241
|
+
`,...u.current()});const x=g.charCodeAt(0);return(x===9||x===32)&&(g=mz(x)+g.slice(1)),g=g?d+" "+g:d,a.options.closeAtx&&(g+=" "+d),h(),p(),g}lN.peek=xz;function lN(e){return e.value||""}function xz(){return"<"}oN.peek=bz;function oN(e,i,a,r){const o=Dg(a),u=o==='"'?"Quote":"Apostrophe",d=a.enter("image");let p=a.enter("label");const h=a.createTracker(r);let g=h.move("![");return g+=h.move(a.safe(e.alt,{before:g,after:"]",...h.current()})),g+=h.move("]("),p(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(p=a.enter("destinationLiteral"),g+=h.move("<"),g+=h.move(a.safe(e.url,{before:g,after:">",...h.current()})),g+=h.move(">")):(p=a.enter("destinationRaw"),g+=h.move(a.safe(e.url,{before:g,after:e.title?" ":")",...h.current()}))),p(),e.title&&(p=a.enter(`title${u}`),g+=h.move(" "+o),g+=h.move(a.safe(e.title,{before:g,after:o,...h.current()})),g+=h.move(o),p()),g+=h.move(")"),d(),g}function bz(){return"!"}cN.peek=yz;function cN(e,i,a,r){const o=e.referenceType,u=a.enter("imageReference");let d=a.enter("label");const p=a.createTracker(r);let h=p.move("![");const g=a.safe(e.alt,{before:h,after:"]",...p.current()});h+=p.move(g+"]["),d();const x=a.stack;a.stack=x.filter(function(y){return y!=="phrasing"}),d=a.enter("reference");const b=a.safe(a.associationId(e),{before:h,after:"]",...p.current()});return d(),a.stack=x,u(),o==="full"||!g||g!==b?h+=p.move(b+"]"):o==="shortcut"?h=h.slice(0,-1):h+=p.move("]"),h}function yz(){return"!"}uN.peek=vz;function uN(e,i,a){let r=e.value||"",o="`",u=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(r);)o+="`";for(/[^\n\r ]/.test(r)&&(/^[\n\r ]/.test(r)&&/[\n\r ]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++u<a.unsafe.length;){const d=a.unsafe[u],p=a.compilePattern(d);if(!d.atBreak)continue;let h;for(;h=p.exec(r);){let g=h.index;r.charCodeAt(g)===10&&r.charCodeAt(g-1)===13&&g--,r=r.slice(0,g)+" "+r.slice(h.index+1)}}return o+r+o}function vz(){return"`"}function dN(e,i){const a=_g(e);return!!(!i.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(a===e.url||"mailto:"+a===e.url)&&/^[a-z][+\-.a-z]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}fN.peek=wz;function fN(e,i,a,r){const o=Dg(a),u=o==='"'?"Quote":"Apostrophe",d=a.createTracker(r);if(dN(e,a)){const x=a.stack;a.stack=x.filter(function(v){return v!=="phrasing"});const b=a.enter("autolink");let y=d.move("<");return y+=d.move(a.containerPhrasing(e,{before:y,after:">",...d.current()})),y+=d.move(">"),b(),a.stack=x,y}const p=a.enter("link");let h=a.enter("label"),g=d.move("[");return g+=d.move(a.containerPhrasing(e,{before:g,after:"](",...d.current()})),g+=d.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=a.enter("destinationLiteral"),g+=d.move("<"),g+=d.move(a.safe(e.url,{before:g,after:">",...d.current()})),g+=d.move(">")):(h=a.enter("destinationRaw"),g+=d.move(a.safe(e.url,{before:g,after:e.title?" ":")",...d.current()}))),h(),e.title&&(h=a.enter(`title${u}`),g+=d.move(" "+o),g+=d.move(a.safe(e.title,{before:g,after:o,...d.current()})),g+=d.move(o),h()),g+=d.move(")"),p(),g}function wz(e,i,a){return dN(e,a)?"<":"["}pN.peek=kz;function pN(e,i,a,r){const o=e.referenceType,u=a.enter("linkReference");let d=a.enter("label");const p=a.createTracker(r);let h=p.move("[");const g=a.containerPhrasing(e,{before:h,after:"]",...p.current()});h+=p.move(g+"]["),d();const x=a.stack;a.stack=x.filter(function(y){return y!=="phrasing"}),d=a.enter("reference");const b=a.safe(a.associationId(e),{before:h,after:"]",...p.current()});return d(),a.stack=x,u(),o==="full"||!g||g!==b?h+=p.move(b+"]"):o==="shortcut"?h=h.slice(0,-1):h+=p.move("]"),h}function kz(){return"["}function Lg(e){const i=e.options.bullet||"*";if(i!=="*"&&i!=="+"&&i!=="-")throw new Error("Cannot serialize items with `"+i+"` for `options.bullet`, expected `*`, `+`, or `-`");return i}function Nz(e){const i=Lg(e),a=e.options.bulletOther;if(!a)return i==="*"?"-":"*";if(a!=="*"&&a!=="+"&&a!=="-")throw new Error("Cannot serialize items with `"+a+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(a===i)throw new Error("Expected `bullet` (`"+i+"`) and `bulletOther` (`"+a+"`) to be different");return a}function Ez(e){const i=e.options.bulletOrdered||".";if(i!=="."&&i!==")")throw new Error("Cannot serialize items with `"+i+"` for `options.bulletOrdered`, expected `.` or `)`");return i}function mN(e){const i=e.options.rule||"*";if(i!=="*"&&i!=="-"&&i!=="_")throw new Error("Cannot serialize rules with `"+i+"` for `options.rule`, expected `*`, `-`, or `_`");return i}function _z(e,i,a,r){const o=a.enter("list"),u=a.bulletCurrent;let d=e.ordered?Ez(a):Lg(a);const p=e.ordered?d==="."?")":".":Nz(a);let h=i&&a.bulletLastUsed?d===a.bulletLastUsed:!1;if(!e.ordered){const x=e.children?e.children[0]:void 0;if((d==="*"||d==="-")&&x&&(!x.children||!x.children[0])&&a.stack[a.stack.length-1]==="list"&&a.stack[a.stack.length-2]==="listItem"&&a.stack[a.stack.length-3]==="list"&&a.stack[a.stack.length-4]==="listItem"&&a.indexStack[a.indexStack.length-1]===0&&a.indexStack[a.indexStack.length-2]===0&&a.indexStack[a.indexStack.length-3]===0&&(h=!0),mN(a)===d&&x){let b=-1;for(;++b<e.children.length;){const y=e.children[b];if(y&&y.type==="listItem"&&y.children&&y.children[0]&&y.children[0].type==="thematicBreak"){h=!0;break}}}}h&&(d=p),a.bulletCurrent=d;const g=a.containerFlow(e,r);return a.bulletLastUsed=d,a.bulletCurrent=u,o(),g}function Sz(e){const i=e.options.listItemIndent||"one";if(i!=="tab"&&i!=="one"&&i!=="mixed")throw new Error("Cannot serialize items with `"+i+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return i}function Tz(e,i,a,r){const o=Sz(a);let u=a.bulletCurrent||Lg(a);i&&i.type==="list"&&i.ordered&&(u=(typeof i.start=="number"&&i.start>-1?i.start:1)+(a.options.incrementListMarker===!1?0:i.children.indexOf(e))+u);let d=u.length+1;(o==="tab"||o==="mixed"&&(i&&i.type==="list"&&i.spread||e.spread))&&(d=Math.ceil(d/4)*4);const p=a.createTracker(r);p.move(u+" ".repeat(d-u.length)),p.shift(d);const h=a.enter("listItem"),g=a.indentLines(a.containerFlow(e,p.current()),x);return h(),g;function x(b,y,v){return y?(v?"":" ".repeat(d))+b:(v?u:u+" ".repeat(d-u.length))+b}}function Cz(e,i,a,r){const o=a.enter("paragraph"),u=a.enter("phrasing"),d=a.containerPhrasing(e,r);return u(),o(),d}function jz(e,i,a,r){if(!e.children.some(function(p){return tz(p)}))return a.containerFlow(e,r);const u=a.enter("phrasing"),d=a.containerPhrasing(e,r);return u(),d}function Az(e){const i=e.options.strong||"*";if(i!=="*"&&i!=="_")throw new Error("Cannot serialize strong with `"+i+"` for `options.strong`, expected `*`, or `_`");return i}Ig.attention=Oz;Ig.peek=Mz;function Ig(e,i,a,r){const o=a.enter("phrasing"),u=a.containerPhrasing({type:"root",children:[e]},r);return o(),u}function Oz(e,i){return{construct:"strong",markers:Az(i)==="*"?["*","_"]:["_","*"],sizes:[2]}}function Mz(e,i,a){return a.options.strong||"*"}function Rz(e,i,a,r){const o=i?i.children:[],u=o.indexOf(e);return a.safe(e.value,{...r,afterNode:o[u+1],beforeNode:o[u-1]})}function Dz(e){const i=e.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 zz(e,i,a){const r=(mN(a)+(a.options.ruleSpaces?" ":"")).repeat(Dz(a));return a.options.ruleSpaces?r.slice(0,-1):r}const hN={blockquote:nz,break:wv,code:oz,definition:uz,emphasis:zg,hardBreak:wv,heading:gz,html:lN,image:oN,imageReference:cN,inlineCode:uN,link:fN,linkReference:pN,list:_z,listItem:Tz,paragraph:Cz,root:jz,strong:Ig,text:Rz,thematicBreak:zz};function Lz(){return{enter:{table:Iz,tableData:kv,tableHeader:kv,tableRow:Bz},exit:{codeText:$z,table:Uz,tableData:Vm,tableHeader:Vm,tableRow:Vm}}}function Iz(e){const i=e._align;this.enter({type:"table",align:i.map(function(a){return a==="none"?null:a}),children:[]},e),this.data.inTable=!0}function Uz(e){this.exit(e),this.data.inTable=void 0}function Bz(e){this.enter({type:"tableRow",children:[]},e)}function Vm(e){this.exit(e)}function kv(e){this.enter({type:"tableCell",children:[]},e)}function $z(e){let i=this.resume();this.data.inTable&&(i=i.replace(/\\([\\|])/g,Pz));const a=this.stack[this.stack.length-1];a.type,a.value=i,this.exit(e)}function Pz(e,i){return i==="|"?i:e}function Hz(e){const i=e||{},a=i.tableCellPadding,r=i.tablePipeAlign,o=i.stringLength,u=a?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
242
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:y,table:d,tableCell:h,tableRow:p}};function d(v,w,T,E){return g(x(v,T,E),v.align)}function p(v,w,T,E){const N=b(v,T,E),j=g([N]);return j.slice(0,j.indexOf(`
|
|
243
|
+
`))}function h(v,w,T,E){const N=T.enter("tableCell"),j=T.enter("phrasing"),A=T.containerPhrasing(v,{...E,before:u,after:u});return j(),N(),A}function g(v,w){return WD(v,{align:w,alignDelimiters:r,padding:a,stringLength:o})}function x(v,w,T){const E=v.children;let N=-1;const j=[],A=w.enter("table");for(;++N<E.length;)j[N]=b(E[N],w,T);return A(),j}function b(v,w,T){const E=v.children;let N=-1;const j=[],A=w.enter("tableRow");for(;++N<E.length;)j[N]=h(E[N],v,w,T);return A(),j}function y(v,w,T){let E=hN.inlineCode(v,w,T);return T.stack.includes("tableCell")&&(E=E.replace(/\|/g,"\\$&")),E}}function Fz(){return{exit:{taskListCheckValueChecked:Nv,taskListCheckValueUnchecked:Nv,paragraph:Gz}}}function qz(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Yz}}}function Nv(e){const i=this.stack[this.stack.length-2];i.type,i.checked=e.type==="taskListCheckValueChecked"}function Gz(e){const i=this.stack[this.stack.length-2];if(i&&i.type==="listItem"&&typeof i.checked=="boolean"){const a=this.stack[this.stack.length-1];a.type;const r=a.children[0];if(r&&r.type==="text"){const o=i.children;let u=-1,d;for(;++u<o.length;){const p=o[u];if(p.type==="paragraph"){d=p;break}}d===a&&(r.value=r.value.slice(1),r.value.length===0?a.children.shift():a.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,a.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function Yz(e,i,a,r){const o=e.children[0],u=typeof e.checked=="boolean"&&o&&o.type==="paragraph",d="["+(e.checked?"x":" ")+"] ",p=a.createTracker(r);u&&p.move(d);let h=hN.listItem(e,i,a,{...r,...p.current()});return u&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,g)),h;function g(x){return x+d}}function Vz(){return[wD(),HD(),YD(),Lz(),Fz()]}function Kz(e){return{extensions:[kD(),FD(e),VD(),Hz(e),qz()]}}const Xz={tokenize:tL,partial:!0},gN={tokenize:nL,partial:!0},xN={tokenize:iL,partial:!0},bN={tokenize:aL,partial:!0},Zz={tokenize:rL,partial:!0},yN={name:"wwwAutolink",tokenize:Wz,previous:wN},vN={name:"protocolAutolink",tokenize:eL,previous:kN},za={name:"emailAutolink",tokenize:Jz,previous:NN},oa={};function Qz(){return{text:oa}}let Xr=48;for(;Xr<123;)oa[Xr]=za,Xr++,Xr===58?Xr=65:Xr===91&&(Xr=97);oa[43]=za;oa[45]=za;oa[46]=za;oa[95]=za;oa[72]=[za,vN];oa[104]=[za,vN];oa[87]=[za,yN];oa[119]=[za,yN];function Jz(e,i,a){const r=this;let o,u;return d;function d(b){return!Ih(b)||!NN.call(r,r.previous)||Ug(r.events)?a(b):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),p(b))}function p(b){return Ih(b)?(e.consume(b),p):b===64?(e.consume(b),h):a(b)}function h(b){return b===46?e.check(Zz,x,g)(b):b===45||b===95||Mn(b)?(u=!0,e.consume(b),h):x(b)}function g(b){return e.consume(b),o=!0,h}function x(b){return u&&o&&Hn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),i(b)):a(b)}}function Wz(e,i,a){const r=this;return o;function o(d){return d!==87&&d!==119||!wN.call(r,r.previous)||Ug(r.events)?a(d):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Xz,e.attempt(gN,e.attempt(xN,u),a),a)(d))}function u(d){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),i(d)}}function eL(e,i,a){const r=this;let o="",u=!1;return d;function d(b){return(b===72||b===104)&&kN.call(r,r.previous)&&!Ug(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(b),e.consume(b),p):a(b)}function p(b){if(Hn(b)&&o.length<5)return o+=String.fromCodePoint(b),e.consume(b),p;if(b===58){const y=o.toLowerCase();if(y==="http"||y==="https")return e.consume(b),h}return a(b)}function h(b){return b===47?(e.consume(b),u?g:(u=!0,h)):a(b)}function g(b){return b===null||ad(b)||Lt(b)||as(b)||Od(b)?a(b):e.attempt(gN,e.attempt(xN,x),a)(b)}function x(b){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),i(b)}}function tL(e,i,a){let r=0;return o;function o(d){return(d===87||d===119)&&r<3?(r++,e.consume(d),o):d===46&&r===3?(e.consume(d),u):a(d)}function u(d){return d===null?a(d):i(d)}}function nL(e,i,a){let r,o,u;return d;function d(g){return g===46||g===95?e.check(bN,h,p)(g):g===null||Lt(g)||as(g)||g!==45&&Od(g)?h(g):(u=!0,e.consume(g),d)}function p(g){return g===95?r=!0:(o=r,r=void 0),e.consume(g),d}function h(g){return o||r||!u?a(g):i(g)}}function iL(e,i){let a=0,r=0;return o;function o(d){return d===40?(a++,e.consume(d),o):d===41&&r<a?u(d):d===33||d===34||d===38||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===60||d===63||d===93||d===95||d===126?e.check(bN,i,u)(d):d===null||Lt(d)||as(d)?i(d):(e.consume(d),o)}function u(d){return d===41&&r++,e.consume(d),o}}function aL(e,i,a){return r;function r(p){return p===33||p===34||p===39||p===41||p===42||p===44||p===46||p===58||p===59||p===63||p===95||p===126?(e.consume(p),r):p===38?(e.consume(p),u):p===93?(e.consume(p),o):p===60||p===null||Lt(p)||as(p)?i(p):a(p)}function o(p){return p===null||p===40||p===91||Lt(p)||as(p)?i(p):r(p)}function u(p){return Hn(p)?d(p):a(p)}function d(p){return p===59?(e.consume(p),r):Hn(p)?(e.consume(p),d):a(p)}}function rL(e,i,a){return r;function r(u){return e.consume(u),o}function o(u){return Mn(u)?a(u):i(u)}}function wN(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Lt(e)}function kN(e){return!Hn(e)}function NN(e){return!(e===47||Ih(e))}function Ih(e){return e===43||e===45||e===46||e===95||Mn(e)}function Ug(e){let i=e.length,a=!1;for(;i--;){const r=e[i][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){a=!0;break}if(r._gfmAutolinkLiteralWalkedInto){a=!1;break}}return e.length>0&&!a&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),a}const sL={tokenize:mL,partial:!0};function lL(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:dL,continuation:{tokenize:fL},exit:pL}},text:{91:{name:"gfmFootnoteCall",tokenize:uL},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:oL,resolveTo:cL}}}}function oL(e,i,a){const r=this;let o=r.events.length;const u=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let d;for(;o--;){const h=r.events[o][1];if(h.type==="labelImage"){d=h;break}if(h.type==="gfmFootnoteCall"||h.type==="labelLink"||h.type==="label"||h.type==="image"||h.type==="link")break}return p;function p(h){if(!d||!d._balanced)return a(h);const g=Pi(r.sliceSerialize({start:d.end,end:r.now()}));return g.codePointAt(0)!==94||!u.includes(g.slice(1))?a(h):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),i(h))}}function cL(e,i){let a=e.length;for(;a--;)if(e[a][1].type==="labelImage"&&e[a][0]==="enter"){e[a][1];break}e[a+1][1].type="data",e[a+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[a+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[a+3][1].end),end:Object.assign({},e[a+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},d={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},p=[e[a+1],e[a+2],["enter",r,i],e[a+3],e[a+4],["enter",o,i],["exit",o,i],["enter",u,i],["enter",d,i],["exit",d,i],["exit",u,i],e[e.length-2],e[e.length-1],["exit",r,i]];return e.splice(a,e.length-a+1,...p),e}function uL(e,i,a){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let u=0,d;return p;function p(b){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(b),e.exit("gfmFootnoteCallLabelMarker"),h}function h(b){return b!==94?a(b):(e.enter("gfmFootnoteCallMarker"),e.consume(b),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",g)}function g(b){if(u>999||b===93&&!d||b===null||b===91||Lt(b))return a(b);if(b===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return o.includes(Pi(r.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(b),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),i):a(b)}return Lt(b)||(d=!0),u++,e.consume(b),b===92?x:g}function x(b){return b===91||b===92||b===93?(e.consume(b),u++,g):g(b)}}function dL(e,i,a){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let u,d=0,p;return h;function h(w){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),g}function g(w){return w===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",x):a(w)}function x(w){if(d>999||w===93&&!p||w===null||w===91||Lt(w))return a(w);if(w===93){e.exit("chunkString");const T=e.exit("gfmFootnoteDefinitionLabelString");return u=Pi(r.sliceSerialize(T)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return Lt(w)||(p=!0),d++,e.consume(w),w===92?b:x}function b(w){return w===91||w===92||w===93?(e.consume(w),d++,x):x(w)}function y(w){return w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),o.includes(u)||o.push(u),bt(e,v,"gfmFootnoteDefinitionWhitespace")):a(w)}function v(w){return i(w)}}function fL(e,i,a){return e.check(Zo,i,e.attempt(sL,i,a))}function pL(e){e.exit("gfmFootnoteDefinition")}function mL(e,i,a){const r=this;return bt(e,o,"gfmFootnoteDefinitionIndent",5);function o(u){const d=r.events[r.events.length-1];return d&&d[1].type==="gfmFootnoteDefinitionIndent"&&d[2].sliceSerialize(d[1],!0).length===4?i(u):a(u)}}function hL(e){let a=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:u,resolveAll:o};return a==null&&(a=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function o(d,p){let h=-1;for(;++h<d.length;)if(d[h][0]==="enter"&&d[h][1].type==="strikethroughSequenceTemporary"&&d[h][1]._close){let g=h;for(;g--;)if(d[g][0]==="exit"&&d[g][1].type==="strikethroughSequenceTemporary"&&d[g][1]._open&&d[h][1].end.offset-d[h][1].start.offset===d[g][1].end.offset-d[g][1].start.offset){d[h][1].type="strikethroughSequence",d[g][1].type="strikethroughSequence";const x={type:"strikethrough",start:Object.assign({},d[g][1].start),end:Object.assign({},d[h][1].end)},b={type:"strikethroughText",start:Object.assign({},d[g][1].end),end:Object.assign({},d[h][1].start)},y=[["enter",x,p],["enter",d[g][1],p],["exit",d[g][1],p],["enter",b,p]],v=p.parser.constructs.insideSpan.null;v&&$i(y,y.length,0,Md(v,d.slice(g+1,h),p)),$i(y,y.length,0,[["exit",b,p],["enter",d[h][1],p],["exit",d[h][1],p],["exit",x,p]]),$i(d,g-1,h-g+3,y),h=g+y.length-2;break}}for(h=-1;++h<d.length;)d[h][1].type==="strikethroughSequenceTemporary"&&(d[h][1].type="data");return d}function u(d,p,h){const g=this.previous,x=this.events;let b=0;return y;function y(w){return g===126&&x[x.length-1][1].type!=="characterEscape"?h(w):(d.enter("strikethroughSequenceTemporary"),v(w))}function v(w){const T=sd(g);if(w===126)return b>1?h(w):(d.consume(w),b++,v);if(b<2&&!a)return h(w);const E=d.exit("strikethroughSequenceTemporary"),N=sd(w);return E._open=!N||N===2&&!!T,E._close=!T||T===2&&!!N,p(w)}}}class gL{constructor(){this.map=[],this.index=new Map}add(i,a,r){xL(this,i,a,r)}consume(i){if(this.map.sort(function(u,d){return u[0]-d[0]}),this.map.length===0)return;let a=this.map.length;const r=[];for(;a>0;)a-=1,r.push(i.slice(this.map[a][0]+this.map[a][1]),this.map[a][2]),i.length=this.map[a][0];r.push(i.slice()),i.length=0;let o=r.pop();for(;o;){for(const u of o)i.push(u);o=r.pop()}this.map.length=0,this.index.clear()}}function xL(e,i,a,r){if(a===0&&r.length===0)return;const o=e.index.get(i);if(o){o[1]+=a,o[2].push(...r);return}const u=[i,a,r];e.map.push(u),e.index.set(i,u)}function bL(e,i){let a=!1;const r=[];for(;i<e.length;){const o=e[i];if(a){if(o[0]==="enter")o[1].type==="tableContent"&&r.push(e[i+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[i-1][1].type==="tableDelimiterMarker"){const u=r.length-1;r[u]=r[u]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(a=!0);i+=1}return r}function yL(){return{flow:{null:{name:"table",tokenize:vL,resolveAll:wL}}}}function vL(e,i,a){const r=this;let o=0,u=0,d;return p;function p(M){let H=r.events.length-1;for(;H>-1;){const{type:se}=r.events[H][1];if(se==="lineEnding"||se==="linePrefix")H--;else break}const Z=H>-1?r.events[H][1].type:null,he=Z==="tableHead"||Z==="tableRow"?z:h;return he===z&&r.parser.lazy[r.now().line]?a(M):he(M)}function h(M){return e.enter("tableHead"),e.enter("tableRow"),g(M)}function g(M){return M===124||(d=!0,u+=1),x(M)}function x(M){return M===null?a(M):Fe(M)?u>1?(u=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),v):a(M):lt(M)?bt(e,x,"whitespace")(M):(u+=1,d&&(d=!1,o+=1),M===124?(e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),d=!0,x):(e.enter("data"),b(M)))}function b(M){return M===null||M===124||Lt(M)?(e.exit("data"),x(M)):(e.consume(M),M===92?y:b)}function y(M){return M===92||M===124?(e.consume(M),b):b(M)}function v(M){return r.interrupt=!1,r.parser.lazy[r.now().line]?a(M):(e.enter("tableDelimiterRow"),d=!1,lt(M)?bt(e,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):w(M))}function w(M){return M===45||M===58?E(M):M===124?(d=!0,e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),T):$(M)}function T(M){return lt(M)?bt(e,E,"whitespace")(M):E(M)}function E(M){return M===58?(u+=1,d=!0,e.enter("tableDelimiterMarker"),e.consume(M),e.exit("tableDelimiterMarker"),N):M===45?(u+=1,N(M)):M===null||Fe(M)?R(M):$(M)}function N(M){return M===45?(e.enter("tableDelimiterFiller"),j(M)):$(M)}function j(M){return M===45?(e.consume(M),j):M===58?(d=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(M),e.exit("tableDelimiterMarker"),A):(e.exit("tableDelimiterFiller"),A(M))}function A(M){return lt(M)?bt(e,R,"whitespace")(M):R(M)}function R(M){return M===124?w(M):M===null||Fe(M)?!d||o!==u?$(M):(e.exit("tableDelimiterRow"),e.exit("tableHead"),i(M)):$(M)}function $(M){return a(M)}function z(M){return e.enter("tableRow"),C(M)}function C(M){return M===124?(e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),C):M===null||Fe(M)?(e.exit("tableRow"),i(M)):lt(M)?bt(e,C,"whitespace")(M):(e.enter("data"),L(M))}function L(M){return M===null||M===124||Lt(M)?(e.exit("data"),C(M)):(e.consume(M),M===92?q:L)}function q(M){return M===92||M===124?(e.consume(M),L):L(M)}}function wL(e,i){let a=-1,r=!0,o=0,u=[0,0,0,0],d=[0,0,0,0],p=!1,h=0,g,x,b;const y=new gL;for(;++a<e.length;){const v=e[a],w=v[1];v[0]==="enter"?w.type==="tableHead"?(p=!1,h!==0&&(Ev(y,i,h,g,x),x=void 0,h=0),g={type:"table",start:Object.assign({},w.start),end:Object.assign({},w.end)},y.add(a,0,[["enter",g,i]])):w.type==="tableRow"||w.type==="tableDelimiterRow"?(r=!0,b=void 0,u=[0,0,0,0],d=[0,a+1,0,0],p&&(p=!1,x={type:"tableBody",start:Object.assign({},w.start),end:Object.assign({},w.end)},y.add(a,0,[["enter",x,i]])),o=w.type==="tableDelimiterRow"?2:x?3:1):o&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")?(r=!1,d[2]===0&&(u[1]!==0&&(d[0]=d[1],b=Ou(y,i,u,o,void 0,b),u=[0,0,0,0]),d[2]=a)):w.type==="tableCellDivider"&&(r?r=!1:(u[1]!==0&&(d[0]=d[1],b=Ou(y,i,u,o,void 0,b)),u=d,d=[u[1],a,0,0])):w.type==="tableHead"?(p=!0,h=a):w.type==="tableRow"||w.type==="tableDelimiterRow"?(h=a,u[1]!==0?(d[0]=d[1],b=Ou(y,i,u,o,a,b)):d[1]!==0&&(b=Ou(y,i,d,o,a,b)),o=0):o&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")&&(d[3]=a)}for(h!==0&&Ev(y,i,h,g,x),y.consume(i.events),a=-1;++a<i.events.length;){const v=i.events[a];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=bL(i.events,a))}return e}function Ou(e,i,a,r,o,u){const d=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",p="tableContent";a[0]!==0&&(u.end=Object.assign({},al(i.events,a[0])),e.add(a[0],0,[["exit",u,i]]));const h=al(i.events,a[1]);if(u={type:d,start:Object.assign({},h),end:Object.assign({},h)},e.add(a[1],0,[["enter",u,i]]),a[2]!==0){const g=al(i.events,a[2]),x=al(i.events,a[3]),b={type:p,start:Object.assign({},g),end:Object.assign({},x)};if(e.add(a[2],0,[["enter",b,i]]),r!==2){const y=i.events[a[2]],v=i.events[a[3]];if(y[1].end=Object.assign({},v[1].end),y[1].type="chunkText",y[1].contentType="text",a[3]>a[2]+1){const w=a[2]+1,T=a[3]-a[2]-1;e.add(w,T,[])}}e.add(a[3]+1,0,[["exit",b,i]])}return o!==void 0&&(u.end=Object.assign({},al(i.events,o)),e.add(o,0,[["exit",u,i]]),u=void 0),u}function Ev(e,i,a,r,o){const u=[],d=al(i.events,a);o&&(o.end=Object.assign({},d),u.push(["exit",o,i])),r.end=Object.assign({},d),u.push(["exit",r,i]),e.add(a+1,0,u)}function al(e,i){const a=e[i],r=a[0]==="enter"?"start":"end";return a[1][r]}const kL={name:"tasklistCheck",tokenize:EL};function NL(){return{text:{91:kL}}}function EL(e,i,a){const r=this;return o;function o(h){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?a(h):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),u)}function u(h){return Lt(h)?(e.enter("taskListCheckValueUnchecked"),e.consume(h),e.exit("taskListCheckValueUnchecked"),d):h===88||h===120?(e.enter("taskListCheckValueChecked"),e.consume(h),e.exit("taskListCheckValueChecked"),d):a(h)}function d(h){return h===93?(e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),p):a(h)}function p(h){return Fe(h)?i(h):lt(h)?e.check({tokenize:_L},i,a)(h):a(h)}}function _L(e,i,a){return bt(e,r,"whitespace");function r(o){return o===null?a(o):i(o)}}function SL(e){return zk([Qz(),lL(),hL(e),yL(),NL()])}const TL={};function CL(e){const i=this,a=e||TL,r=i.data(),o=r.micromarkExtensions||(r.micromarkExtensions=[]),u=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),d=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);o.push(SL(a)),u.push(Vz()),d.push(Kz(a))}const _v=(function(e,i,a){const r=Qo(a);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof i=="number"){if(i<0||i===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(i=e.children.indexOf(i),i<0)throw new Error("Expected child node or index");for(;++i<e.children.length;)if(r(e.children[i],i,e))return e.children[i]}),us=(function(e){if(e==null)return OL;if(typeof e=="string")return AL(e);if(typeof e=="object")return jL(e);if(typeof e=="function")return Bg(e);throw new Error("Expected function, string, or array as `test`")});function jL(e){const i=[];let a=-1;for(;++a<e.length;)i[a]=us(e[a]);return Bg(r);function r(...o){let u=-1;for(;++u<i.length;)if(i[u].apply(this,o))return!0;return!1}}function AL(e){return Bg(i);function i(a){return a.tagName===e}}function Bg(e){return i;function i(a,r,o){return!!(ML(a)&&e.call(this,a,typeof r=="number"?r:void 0,o||void 0))}}function OL(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function ML(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const Sv=/\n/g,Tv=/[\t ]+/g,Uh=us("br"),Cv=us($L),RL=us("p"),jv=us("tr"),DL=us(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",BL,PL]),EN=us(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function zL(e,i){const a=i||{},r="children"in e?e.children:[],o=EN(e),u=TN(e,{whitespace:a.whitespace||"normal"}),d=[];(e.type==="text"||e.type==="comment")&&d.push(...SN(e,{breakBefore:!0,breakAfter:!0}));let p=-1;for(;++p<r.length;)d.push(..._N(r[p],e,{whitespace:u,breakBefore:p?void 0:o,breakAfter:p<r.length-1?Uh(r[p+1]):o}));const h=[];let g;for(p=-1;++p<d.length;){const x=d[p];typeof x=="number"?g!==void 0&&x>g&&(g=x):x&&(g!==void 0&&g>-1&&h.push(`
|
|
244
|
+
`.repeat(g)||" "),g=-1,h.push(x))}return h.join("")}function _N(e,i,a){return e.type==="element"?LL(e,i,a):e.type==="text"?a.whitespace==="normal"?SN(e,a):IL(e):[]}function LL(e,i,a){const r=TN(e,a),o=e.children||[];let u=-1,d=[];if(DL(e))return d;let p,h;for(Uh(e)||jv(e)&&_v(i,e,jv)?h=`
|
|
245
|
+
`:RL(e)?(p=2,h=2):EN(e)&&(p=1,h=1);++u<o.length;)d=d.concat(_N(o[u],e,{whitespace:r,breakBefore:u?void 0:p,breakAfter:u<o.length-1?Uh(o[u+1]):h}));return Cv(e)&&_v(i,e,Cv)&&d.push(" "),p&&d.unshift(p),h&&d.push(h),d}function SN(e,i){const a=String(e.value),r=[],o=[];let u=0;for(;u<=a.length;){Sv.lastIndex=u;const h=Sv.exec(a),g=h&&"index"in h?h.index:a.length;r.push(UL(a.slice(u,g).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),u===0?i.breakBefore:!0,g===a.length?i.breakAfter:!0)),u=g+1}let d=-1,p;for(;++d<r.length;)r[d].charCodeAt(r[d].length-1)===8203||d<r.length-1&&r[d+1].charCodeAt(0)===8203?(o.push(r[d]),p=void 0):r[d]?(typeof p=="number"&&o.push(p),o.push(r[d]),p=0):(d===0||d===r.length-1)&&o.push(0);return o}function IL(e){return[String(e.value)]}function UL(e,i,a){const r=[];let o=0,u;for(;o<e.length;){Tv.lastIndex=o;const d=Tv.exec(e);u=d?d.index:e.length,!o&&!u&&d&&!i&&r.push(""),o!==u&&r.push(e.slice(o,u)),o=d?u+d[0].length:u}return o!==u&&!a&&r.push(""),r.join(" ")}function TN(e,i){if(e.type==="element"){const a=e.properties||{};switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return a.wrap?"pre-wrap":"pre";case"td":case"th":return a.noWrap?"nowrap":i.whitespace;case"textarea":return"pre-wrap"}}return i.whitespace}function BL(e){return!!(e.properties||{}).hidden}function $L(e){return e.tagName==="td"||e.tagName==="th"}function PL(e){return e.tagName==="dialog"&&!(e.properties||{}).open}function HL(e){const i=e.regex,a=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",o="[a-zA-Z_]\\w*::",d="(?!struct)("+r+"|"+i.optional(o)+"[a-zA-Z_]\\w*"+i.optional("<[^<>]+>")+")",p={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},g={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},x={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},b={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(g,{className:"string"}),{className:"string",begin:/<.*?>/},a,e.C_BLOCK_COMMENT_MODE]},y={className:"title",begin:i.optional(o)+e.IDENT_RE,relevance:0},v=i.optional(o)+e.IDENT_RE+"\\s*\\(",w=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],T=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],E=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],N=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],R={type:T,keyword:w,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:E},$={className:"function.dispatch",relevance:0,keywords:{_hint:N},begin:i.concat(/\b/,`(?!${w.join("|")})`,e.IDENT_RE,i.lookahead(/(<[^<>]+>|)\s*\(/))},z=[$,b,p,a,e.C_BLOCK_COMMENT_MODE,x,g],C={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:R,contains:z.concat([{begin:/\(/,end:/\)/,keywords:R,contains:z.concat(["self"]),relevance:0}]),relevance:0},L={className:"function",begin:"("+d+"[\\*&\\s]+)+"+v,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:R,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:R,relevance:0},{begin:v,returnBegin:!0,contains:[y],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[g,x]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:R,relevance:0,contains:[a,e.C_BLOCK_COMMENT_MODE,g,x,p,{begin:/\(/,end:/\)/,keywords:R,relevance:0,contains:["self",a,e.C_BLOCK_COMMENT_MODE,g,x,p]}]},p,a,e.C_BLOCK_COMMENT_MODE,b]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:R,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(C,L,$,z,[b,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:R,contains:["self",p]},{begin:e.IDENT_RE+"::",keywords:R},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function FL(e){const i={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},a=HL(e),r=a.keywords;return r.type=[...r.type,...i.type],r.literal=[...r.literal,...i.literal],r.built_in=[...r.built_in,...i.built_in],r._hints=i._hints,a.name="Arduino",a.aliases=["ino"],a.supersetOf="cpp",a}function qL(e){const i=e.regex,a={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[a]}]};Object.assign(a,{className:"variable",variants:[{begin:i.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const o={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},u=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),d={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},p={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,a,o]};o.contains.push(p);const h={match:/\\"/},g={className:"string",begin:/'/,end:/'/},x={match:/\\'/},b={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,a]},y=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],v=e.SHEBANG({binary:`(${y.join("|")})`,relevance:10}),w={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},T=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],E=["true","false"],N={match:/(\/[a-z._-]+)+/},j=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],A=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],R=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],$=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:T,literal:E,built_in:[...j,...A,"set","shopt",...R,...$]},contains:[v,e.SHEBANG(),w,b,u,d,N,p,h,g,x,a]}}function GL(e){const i=e.regex,a=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",o="[a-zA-Z_]\\w*::",d="("+r+"|"+i.optional(o)+"[a-zA-Z_]\\w*"+i.optional("<[^<>]+>")+")",p={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},g={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},x={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},b={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(g,{className:"string"}),{className:"string",begin:/<.*?>/},a,e.C_BLOCK_COMMENT_MODE]},y={className:"title",begin:i.optional(o)+e.IDENT_RE,relevance:0},v=i.optional(o)+e.IDENT_RE+"\\s*\\(",E={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},N=[b,p,a,e.C_BLOCK_COMMENT_MODE,x,g],j={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:E,contains:N.concat([{begin:/\(/,end:/\)/,keywords:E,contains:N.concat(["self"]),relevance:0}]),relevance:0},A={begin:"("+d+"[\\*&\\s]+)+"+v,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:E,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:E,relevance:0},{begin:v,returnBegin:!0,contains:[e.inherit(y,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:E,relevance:0,contains:[a,e.C_BLOCK_COMMENT_MODE,g,x,p,{begin:/\(/,end:/\)/,keywords:E,relevance:0,contains:["self",a,e.C_BLOCK_COMMENT_MODE,g,x,p]}]},p,a,e.C_BLOCK_COMMENT_MODE,b]};return{name:"C",aliases:["h"],keywords:E,disableAutodetect:!0,illegal:"</",contains:[].concat(j,A,N,[b,{begin:e.IDENT_RE+"::",keywords:E},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:b,strings:g,keywords:E}}}function YL(e){const i=e.regex,a=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",o="[a-zA-Z_]\\w*::",d="(?!struct)("+r+"|"+i.optional(o)+"[a-zA-Z_]\\w*"+i.optional("<[^<>]+>")+")",p={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},g={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},x={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},b={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(g,{className:"string"}),{className:"string",begin:/<.*?>/},a,e.C_BLOCK_COMMENT_MODE]},y={className:"title",begin:i.optional(o)+e.IDENT_RE,relevance:0},v=i.optional(o)+e.IDENT_RE+"\\s*\\(",w=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],T=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],E=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],N=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],R={type:T,keyword:w,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:E},$={className:"function.dispatch",relevance:0,keywords:{_hint:N},begin:i.concat(/\b/,`(?!${w.join("|")})`,e.IDENT_RE,i.lookahead(/(<[^<>]+>|)\s*\(/))},z=[$,b,p,a,e.C_BLOCK_COMMENT_MODE,x,g],C={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:R,contains:z.concat([{begin:/\(/,end:/\)/,keywords:R,contains:z.concat(["self"]),relevance:0}]),relevance:0},L={className:"function",begin:"("+d+"[\\*&\\s]+)+"+v,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:R,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:R,relevance:0},{begin:v,returnBegin:!0,contains:[y],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[g,x]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:R,relevance:0,contains:[a,e.C_BLOCK_COMMENT_MODE,g,x,p,{begin:/\(/,end:/\)/,keywords:R,relevance:0,contains:["self",a,e.C_BLOCK_COMMENT_MODE,g,x,p]}]},p,a,e.C_BLOCK_COMMENT_MODE,b]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:R,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(C,L,$,z,[b,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:R,contains:["self",p]},{begin:e.IDENT_RE+"::",keywords:R},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function VL(e){const i=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],a=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],o=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],u=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],d={keyword:o.concat(u),built_in:i,literal:r},p=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),h={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9'_]+|(\\b[\\d'_]+(\\.[\\d'_]*)?|\\.[\\d'_]+)([eE][-+]?[\\d'_]+)?)"}],relevance:0},g={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},x={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},b=e.inherit(x,{illegal:/\n/}),y={className:"subst",begin:/\{/,end:/\}/,keywords:d},v=e.inherit(y,{illegal:/\n/}),w={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,v]},T={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},y]},E=e.inherit(T,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},v]});y.contains=[T,w,x,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,e.C_BLOCK_COMMENT_MODE],v.contains=[E,w,b,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const N={variants:[g,T,w,x,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},j={begin:"<",end:">",contains:[{beginKeywords:"in out"},p]},A=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",R={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:d,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},N,h,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},p,j,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[p,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[p,j,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+A+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:d,contains:[{beginKeywords:a.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,j],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,relevance:0,contains:[N,h,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},R]}}const KL=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},UNICODE_RANGE:{scope:"number",begin:/\b[Uu]\+[0-9A-Fa-f][0-9A-Fa-f?]{0,4}(-[0-9A-Fa-f][0-9A-Fa-f]{0,4})?/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),XL=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],ZL=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],QL=[...XL,...ZL],JL=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),WL=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),e6=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),t6=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","unicode-range","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function n6(e){const i=e.regex,a=KL(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},o="and or not only",u=/@-?\w[\w]*(-\w+)*/,d="[a-zA-Z-][a-zA-Z0-9_-]*",p=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[a.BLOCK_COMMENT,r,a.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+d,relevance:0},a.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+WL.join("|")+")"},{begin:":(:)?("+e6.join("|")+")"}]},a.CSS_VARIABLE,{className:"attribute",begin:"\\b("+t6.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[a.BLOCK_COMMENT,a.HEXCOLOR,a.IMPORTANT,a.CSS_NUMBER_MODE,a.UNICODE_RANGE,...p,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...p,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},a.FUNCTION_DISPATCH]},{begin:i.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:u},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:o,attribute:JL.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...p,a.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+QL.join("|")+")\\b"}]}}function i6(e){const i=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:i.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^@@ +-\d+ +\+\d+,\d+ +@@/,/^@@ +-\d+,\d+ +\+\d+ +@@/,/^@@ +-\d+ +\+\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:i.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function a6(e){const u={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:u,illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"string",variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[e.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:u,illegal:/["']/}]}]}}function r6(e){const i=e.regex,a=/[_A-Za-z][_0-9A-Za-z]*/;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:i.concat(a,i.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function s6(e){const i=e.regex,a={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}]},r=e.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const o={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},u={className:"literal",begin:/\bon|off|true|false|yes|no\b/},d={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},p={begin:/\[/,end:/\]/,contains:[r,u,o,d,a,"self"],relevance:0},h=/[A-Za-z0-9_-]+/,g=/"(\\"|[^"])*"/,x=/'[^']*'/,b=i.either(h,g,x),y=i.concat(b,"(\\s*\\.\\s*",b,")*",i.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[r,{className:"section",begin:/\[+/,end:/\]+/},{begin:y,className:"attr",starts:{end:/$/,contains:[r,p,u,o,d,a]}}]}}var rl="[0-9](_*[0-9])*",Mu=`\\.(${rl})`,Ru="[0-9a-fA-F](_*[0-9a-fA-F])*",Av={className:"number",variants:[{begin:`(\\b(${rl})((${Mu})|\\.)?|(${Mu}))[eE][+-]?(${rl})[fFdD]?\\b`},{begin:`\\b(${rl})((${Mu})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Mu})[fFdD]?\\b`},{begin:`\\b(${rl})[fFdD]\\b`},{begin:`\\b0[xX]((${Ru})\\.?|(${Ru})?\\.(${Ru}))[pP][+-]?(${rl})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Ru})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function CN(e,i,a){return a===-1?"":e.replace(i,r=>CN(e,i,a-1))}function l6(e){const i=e.regex,a="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=a+CN("(?:<"+a+"~~~(?:\\s*,\\s*"+a+"~~~)*>)?",/~~~/g,2),h={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},g={className:"meta",begin:"@"+a,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},x={className:"params",begin:/\(/,end:/\)/,keywords:h,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:h,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,a],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[i.concat(/(?!else)/,a),/\s+/,a,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,a],className:{1:"keyword",3:"title.class"},contains:[x,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:h,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:h,relevance:0,contains:[g,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,Av,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},Av,g]}}const Ov="[A-Za-z$_][0-9A-Za-z$_]*",o6=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],c6=["true","false","null","undefined","NaN","Infinity"],jN=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],AN=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],ON=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],u6=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],d6=[].concat(ON,jN,AN);function f6(e){const i=e.regex,a=(te,{after:be})=>{const S="</"+te[0].slice(1);return te.input.indexOf(S,be)!==-1},r=Ov,o={begin:"<>",end:"</>"},u=/<[A-Za-z0-9\\._:-]+\s*\/>/,d={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(te,be)=>{const S=te[0].length+te.index,ve=te.input[S];if(ve==="<"||ve===","){be.ignoreMatch();return}ve===">"&&(a(te,{after:S})||be.ignoreMatch());let ce;const D=te.input.substring(S);if(ce=D.match(/^\s*=/)){be.ignoreMatch();return}if((ce=D.match(/^\s+extends\s+/))&&ce.index===0){be.ignoreMatch();return}}},p={$pattern:Ov,keyword:o6,literal:c6,built_in:d6,"variable.language":u6},h="[0-9](_?[0-9])*",g=`\\.(${h})`,x="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",b={className:"number",variants:[{begin:`(\\b(${x})((${g})|\\.)?|(${g}))[eE][+-]?(${h})\\b`},{begin:`\\b(${x})\\b((${g})\\b|\\.)?|(${g})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},y={className:"subst",begin:"\\$\\{",end:"\\}",keywords:p,contains:[]},v={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"xml"}},w={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"css"}},T={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"graphql"}},E={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,y]},j={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},A=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,v,w,T,E,{match:/\$\d+/},b];y.contains=A.concat({begin:/\{/,end:/\}/,keywords:p,contains:["self"].concat(A)});const R=[].concat(j,y.contains),$=R.concat([{begin:/(\s*)\(/,end:/\)/,keywords:p,contains:["self"].concat(R)}]),z={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:p,contains:$},C={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,i.concat(r,"(",i.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},L={relevance:0,match:i.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...jN,...AN]}},q={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},M={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[z],illegal:/%/},H={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function Z(te){return i.concat("(?!",te.join("|"),")")}const he={match:i.concat(/\b/,Z([...ON,"super","import","await"].map(te=>`${te}\\s*\\(`)),r,i.lookahead(/\s*\(/)),className:"title.function",relevance:0},se={begin:i.concat(/\./,i.lookahead(i.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},ae={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},z]},O="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",ee={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,i.lookahead(O)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[z]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:p,exports:{PARAMS_CONTAINS:$,CLASS_REFERENCE:L},illegal:/#(?![$_A-Za-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),q,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,v,w,T,E,j,{match:/\$\d+/},b,L,{scope:"attr",match:r+i.lookahead(":"),relevance:0},ee,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[j,e.REGEXP_MODE,{className:"function",begin:O,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:p,contains:$}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:o.begin,end:o.end},{match:u},{begin:d.begin,"on:begin":d.isTrulyOpeningTag,end:d.end}],subLanguage:"xml",contains:[{begin:d.begin,end:d.end,skip:!0,contains:["self"]}]}]},M,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[z,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},se,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[z]},he,H,C,ae,{match:/\$[(.]/}]}}const p6="([-+]?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)|NaN|[-+]?Infinity",m6={scope:"number",match:p6,relevance:0};function h6(e){const i={className:"attr",begin:/(("(\\.|[^\\"\r\n])*")|('(\\.|[^\\'\r\n])*'))(?=\s*:)/,relevance:1.01},a={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],o={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc","json5"],keywords:{literal:r},contains:[i,a,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,o,m6,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var sl="[0-9](_*[0-9])*",Du=`\\.(${sl})`,zu="[0-9a-fA-F](_*[0-9a-fA-F])*",g6={className:"number",variants:[{begin:`(\\b(${sl})((${Du})|\\.)?|(${Du}))[eE][+-]?(${sl})[fFdD]?\\b`},{begin:`\\b(${sl})((${Du})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Du})[fFdD]?\\b`},{begin:`\\b(${sl})[fFdD]\\b`},{begin:`\\b0[xX]((${zu})\\.?|(${zu})?\\.(${zu}))[pP][+-]?(${sl})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${zu})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function x6(e){const i={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},a={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},o={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},u={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},d={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[u,o]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,u,o]}]};o.contains.push(d);const p={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},h={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(d,{className:"string"}),"self"]}]},g=g6,x=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),b={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},y=b;return y.variants[1].contains=[b],b.variants[1].contains=[y],{name:"Kotlin",aliases:["kt","kts"],keywords:i,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,x,a,r,p,h,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:i,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:i,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[b,e.C_LINE_COMMENT_MODE,x],relevance:0},e.C_LINE_COMMENT_MODE,x,p,h,d,e.C_NUMBER_MODE]},x]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},p,h]},d,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
|
|
246
|
+
`},g]}}const b6=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},UNICODE_RANGE:{scope:"number",begin:/\b[Uu]\+[0-9A-Fa-f][0-9A-Fa-f?]{0,4}(-[0-9A-Fa-f][0-9A-Fa-f]{0,4})?/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),y6=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],v6=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],w6=[...y6,...v6],k6=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),MN=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),RN=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),N6=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","unicode-range","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),E6=MN.concat(RN).sort().reverse();function _6(e){const i=b6(e),a=E6,r="and or not only",o="[\\w-]+",u="("+o+"|@\\{"+o+"\\})",d=[],p=[],h=function(A){return{className:"string",begin:"~?"+A+".*?"+A}},g=function(A,R,$){return{className:A,begin:R,relevance:$}},x={$pattern:/[a-z-]+/,keyword:r,attribute:k6.join(" ")},b={begin:"\\(",end:"\\)",contains:p,keywords:x,relevance:0};p.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,h("'"),h('"'),i.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},i.UNICODE_RANGE,i.HEXCOLOR,b,g("variable","@@?"+o,10),g("variable","@\\{"+o+"\\}"),g("built_in","~?`[^`]*?`"),{className:"attribute",begin:o+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},i.IMPORTANT,{beginKeywords:"and not"},i.FUNCTION_DISPATCH);const y=p.concat({begin:/\{/,end:/\}/,contains:d}),v={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(p)},w={begin:u+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},i.CSS_VARIABLE,{className:"attribute",begin:"\\b("+N6.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:p}}]},T={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:x,returnEnd:!0,contains:p,relevance:0}},E={className:"variable",variants:[{begin:"@"+o+"\\s*:",relevance:15},{begin:"@"+o}],starts:{end:"[;}]",returnEnd:!0,contains:y}},N={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:u,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,v,g("keyword","all\\b"),g("variable","@\\{"+o+"\\}"),{begin:"\\b("+w6.join("|")+")\\b",className:"selector-tag"},i.CSS_NUMBER_MODE,g("selector-tag",u,0),g("selector-id","#"+u),g("selector-class","\\."+u,0),g("selector-tag","&",0),i.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+MN.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+RN.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:y},{begin:"!important"},i.FUNCTION_DISPATCH]},j={begin:o+`:(:)?(${a.join("|")})`,returnBegin:!0,contains:[N]};return d.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,T,E,j,w,N,v,i.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:d}}function S6(e){const i="\\[=*\\[",a="\\]=*\\]",r={begin:i,end:a,contains:["self"]},o=[e.COMMENT("--(?!"+i+")","$"),e.COMMENT("--"+i,a,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:o.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:o}].concat(o)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:i,end:a,contains:[r],relevance:5}])}}function T6(e){const i={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},a={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,i]},r={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[i,a]},o={begin:"^"+e.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},u={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},d={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[i]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[e.HASH_COMMENT_MODE,i,a,r,o,u,d]}}function C6(e){const i=e.regex,a={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},o={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},u={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},d={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},p=/[A-Za-z][A-Za-z0-9+.-]*/,h={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:i.concat(/\[.+?\]\(/,p,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},g={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},x={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},b=e.inherit(g,{contains:[]}),y=e.inherit(x,{contains:[]});g.contains.push(y),x.contains.push(b);let v=[a,h];return[g,x,b,y].forEach(N=>{N.contains=N.contains.concat(v)}),v=v.concat(g,x),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:v},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:v}]}]},a,u,g,x,{className:"quote",begin:"^>\\s+",contains:v,end:"$"},o,r,h,d,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function j6(e){const i={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},a=/[a-zA-Z@][a-zA-Z0-9_]*/,p={"variable.language":["this","super"],$pattern:a,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},h={$pattern:a,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:p,illegal:"</",contains:[i,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.C_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+h.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:h,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function A6(e){const i=e.regex,a=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,o={$pattern:/[\w.]+/,keyword:a.join(" ")},u={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:o},d={begin:/->\{/,end:/\}/},p={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},h={scope:"variable",variants:[{begin:/\$\d/},{begin:i.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[p]},g={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},x=[e.BACKSLASH_ESCAPE,u,h],b=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],y=(T,E,N="\\1")=>{const j=N==="\\1"?N:i.concat(N,E);return i.concat(i.concat("(?:",T,")"),E,/(?:\\.|[^\\\/])*?/,j,/(?:\\.|[^\\\/])*?/,N,r)},v=(T,E,N)=>i.concat(i.concat("(?:",T,")"),E,/(?:\\.|[^\\\/])*?/,N,r),w=[h,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),d,{className:"string",contains:x,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},g,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:y("s|tr|y",i.either(...b,{capture:!0}))},{begin:y("s|tr|y","\\(","\\)")},{begin:y("s|tr|y","\\[","\\]")},{begin:y("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:v("(?:m|qr)?",/\//,/\//)},{begin:v("m|qr",i.either(...b,{capture:!0}),/\1/)},{begin:v("m|qr",/\(/,/\)/)},{begin:v("m|qr",/\[/,/\]/)},{begin:v("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,p]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,p,g]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return u.contains=w,d.contains=w,{name:"Perl",aliases:["pl","pm"],keywords:o,contains:w}}function O6(e){const i=e.regex,a=/(?![A-Za-z0-9])(?![$])/,r=i.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,a),o=i.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,a),u=i.concat(/[A-Z]+/,a),d={scope:"variable",match:"\\$+"+r},p={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},h={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},g=e.inherit(e.APOS_STRING_MODE,{illegal:null}),x=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(h)}),b={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(h),"on:begin":(se,ae)=>{ae.data._beginMatch=se[1]||se[2]},"on:end":(se,ae)=>{ae.data._beginMatch!==se[1]&&ae.ignoreMatch()}},y=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),v=`[
|
|
247
|
+
]`,w={scope:"string",variants:[x,g,b,y]},T={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},E=["false","null","true"],N=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],j=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],R={keyword:N,literal:(se=>{const ae=[];return se.forEach(O=>{ae.push(O),O.toLowerCase()===O?ae.push(O.toUpperCase()):ae.push(O.toLowerCase())}),ae})(E),built_in:j},$=se=>se.map(ae=>ae.replace(/\|\d+$/,"")),z={variants:[{match:[/new/,i.concat(v,"+"),i.concat("(?!",$(j).join("\\b|"),"\\b)"),o],scope:{1:"keyword",4:"title.class"}}]},C=i.concat(r,"\\b(?!\\()"),L={variants:[{match:[i.concat(/::/,i.lookahead(/(?!class\b)/)),C],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[o,i.concat(/::/,i.lookahead(/(?!class\b)/)),C],scope:{1:"title.class",3:"variable.constant"}},{match:[o,i.concat("::",i.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[o,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},q={scope:"attr",match:i.concat(r,i.lookahead(":"),i.lookahead(/(?!::)/))},M={relevance:0,begin:/\(/,end:/\)/,keywords:R,contains:[q,d,L,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.HASH_COMMENT_MODE,w,T,z]},H={relevance:0,match:[/\b/,i.concat("(?!fn\\b|function\\b|",$(N).join("\\b|"),"|",$(j).join("\\b|"),"\\b)"),r,i.concat(v,"*"),i.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[M]};M.contains.push(H);const Z=[q,L,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.HASH_COMMENT_MODE,w,T,z],he={begin:i.concat(/#\[\s*\\?/,i.either(o,u)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:E,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:E,keyword:["new","array"]},contains:["self",...Z]},...Z,{scope:"meta",variants:[{match:o},{match:u}]}]};return{case_insensitive:!1,keywords:R,contains:[he,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},p,{scope:"variable.language",match:/\$this\b/},d,H,L,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},z,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:R,contains:["self",he,d,L,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.HASH_COMMENT_MODE,w,T]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},w,T]}}function M6(e){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function R6(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function D6(e){const i=e.regex,a=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],p={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},h={className:"meta",begin:/^(>>>|\.\.\.) /},g={className:"subst",begin:/\{/,end:/\}/,keywords:p,illegal:/#/},x={begin:/\{\{/,relevance:0},b={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,h],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,h],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,h,x,g]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,h,x,g]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,x,g]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,x,g]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},y="[0-9](_?[0-9])*",v=`(\\b(${y}))?\\.(${y})|\\b(${y})\\.`,w=`\\b|${r.join("|")}`,T={className:"number",relevance:0,variants:[{begin:`(\\b(${y})|(${v}))[eE][+-]?(${y})[jJ]?(?=${w})`},{begin:`(${v})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${w})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${w})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${w})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${w})`},{begin:`\\b(${y})[jJ](?=${w})`}]},E={className:"comment",begin:i.lookahead(/# type:/),end:/$/,keywords:p,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},N={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:p,contains:["self",h,T,b,e.HASH_COMMENT_MODE]}]};return g.contains=[b,T,h],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:p,illegal:/(<\/|\?)|=>/,contains:[h,T,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},b,E,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,a],scope:{1:"keyword",3:"title.function"},contains:[N]},{variants:[{match:[/\bclass/,/\s+/,a,/\s*/,/\(\s*/,a,/\s*\)/]},{match:[/\bclass/,/\s+/,a]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[T,N,b]}]}}function z6(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function L6(e){const i=e.regex,a=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=i.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),o=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,u=i.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:a,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:i.lookahead(i.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:a},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[o,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[u,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[a,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:o},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:u},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function I6(e){const i=e.regex,a="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=i.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),o=i.concat(r,/(::\w+)*/),d={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},p={className:"doctag",begin:"@[A-Za-z]+"},h={begin:"#<",end:">"},g=[e.COMMENT("#","$",{contains:[p]}),e.COMMENT("^=begin","^=end",{contains:[p],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],x={className:"subst",begin:/#\{/,end:/\}/,keywords:d},b={className:"string",contains:[e.BACKSLASH_ESCAPE,x],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:i.concat(/<<[-~]?'?/,i.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,x]})]}]},y="[1-9](_?[0-9])*|0",v="[0-9](_?[0-9])*",w={className:"number",relevance:0,variants:[{begin:`\\b(${y})(\\.(${v}))?([eE][+-]?(${v})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},T={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:d}]},z=[b,{variants:[{match:[/class\s+/,o,/\s+<\s+/,o]},{match:[/\b(class|module)\s+/,o]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:d},{match:[/(include|extend)\s+/,o],scope:{2:"title.class"},keywords:d},{relevance:0,match:[o,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,a],scope:{1:"keyword",3:"title.function"},contains:[T]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[b,{begin:a}],relevance:0},w,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:d},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,x],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(h,g),relevance:0}].concat(h,g);x.contains=z,T.contains=z;const M=[{begin:/^\s*=>/,starts:{end:"$",contains:z}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:d,contains:z}}];return g.unshift(h),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:d,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(M).concat(g).concat(z)}}function U6(e){const i=e.regex,a=/(r#)?/,r=i.concat(a,e.UNDERSCORE_IDENT_RE),o=i.concat(a,e.IDENT_RE),u={className:"title.function.invoke",relevance:0,begin:i.concat(/\b/,/(?!let|for|while|if|else|match\b)/,o,i.lookahead(/\s*\(/))},d="([ui](8|16|32|64|128|size)|f(32|64))?",p=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],h=["true","false","Some","None","Ok","Err"],g=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],x=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:x,keyword:p,literal:h,built_in:g},illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.COMMENT("/\\*","\\*/",{contains:["self"]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+d},{begin:"\\b0o([0-7_]+)"+d},{begin:"\\b0x([A-Fa-f0-9_]+)"+d},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+d}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:e.IDENT_RE+"::",keywords:{keyword:"Self",built_in:g,type:x}},{className:"punctuation",begin:"->"},u]}}const B6=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},UNICODE_RANGE:{scope:"number",begin:/\b[Uu]\+[0-9A-Fa-f][0-9A-Fa-f?]{0,4}(-[0-9A-Fa-f][0-9A-Fa-f]{0,4})?/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),$6=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],P6=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],H6=[...$6,...P6],F6=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),q6=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),G6=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Y6=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","unicode-range","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function V6(e){const i=B6(e),a=G6,r=q6,o="@[a-z-]+",u="and or not only",p={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,i.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},i.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+H6.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+a.join("|")+")"},p,{begin:/\(/,end:/\)/,contains:[i.CSS_NUMBER_MODE]},i.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Y6.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[i.BLOCK_COMMENT,p,i.HEXCOLOR,i.CSS_NUMBER_MODE,i.UNICODE_RANGE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,i.IMPORTANT,i.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:o,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:u,attribute:F6.join(" ")},contains:[{begin:o,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},p,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,i.HEXCOLOR,i.CSS_NUMBER_MODE]},i.FUNCTION_DISPATCH]}}function K6(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function X6(e){const i=e.regex,a=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},o={begin:/"/,end:/"/,contains:[{match:/""/}]},u=["true","false","unknown"],d=["double precision","large object","with timezone","without timezone"],p=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],h=["add","asc","collation","desc","final","first","last","view"],g=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],x=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],b=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],y=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],v=x,w=[...g,...h].filter($=>!x.includes($)),T={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},E={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},N={match:i.concat(/\b/,i.either(...v),/\s*\(/),relevance:0,keywords:{built_in:v}};function j($){return i.concat(/\b/,i.either(...$.map(z=>z.replace(/\s+/,"\\s+"))),/\b/)}const A={scope:"keyword",match:j(y),relevance:0};function R($,{exceptions:z,when:C}={}){const L=C;return z=z||[],$.map(q=>q.match(/\|\d+$/)||z.includes(q)?q:L(q)?`${q}|0`:q)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:R(w,{when:$=>$.length<3}),literal:u,type:p,built_in:b},contains:[{scope:"type",match:j(d)},A,N,T,r,o,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,a,E]}}function DN(e){return e?typeof e=="string"?e:e.source:null}function No(e){return Ot("(?=",e,")")}function Ot(...e){return e.map(a=>DN(a)).join("")}function Z6(e){const i=e[e.length-1];return typeof i=="object"&&i.constructor===Object?(e.splice(e.length-1,1),i):{}}function $n(...e){return"("+(Z6(e).capture?"":"?:")+e.map(r=>DN(r)).join("|")+")"}const $g=e=>Ot(/\b/,e,/\w$/.test(e)?/\b/:/\B/),Q6=["Protocol","Type"].map($g),Mv=["init","self"].map($g),J6=["Any","Self"],Km=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],Rv=["false","nil","true"],W6=["assignment","associativity","higherThan","left","lowerThan","none","right"],e9=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],Dv=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],zN=$n(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),LN=$n(zN,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),Xm=Ot(zN,LN,"*"),IN=$n(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),cd=$n(IN,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),aa=Ot(IN,cd,"*"),Lu=Ot(/[A-Z]/,cd,"*"),t9=["attached","autoclosure",Ot(/convention\(/,$n("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Ot(/objc\(/,aa,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],n9=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function i9(e){const i={match:/\s+/,relevance:0},a=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,a],o={match:[/\./,$n(...Q6,...Mv)],className:{2:"keyword"}},u={match:Ot(/\./,$n(...Km)),relevance:0},d=Km.filter(Ae=>typeof Ae=="string").concat(["_|0"]),p=Km.filter(Ae=>typeof Ae!="string").concat(J6).map($g),h={variants:[{className:"keyword",match:$n(...p,...Mv)}]},g={$pattern:$n(/\b\w+/,/#\w+/),keyword:d.concat(e9),literal:Rv},x=[o,u,h],b={match:Ot(/\./,$n(...Dv)),relevance:0},y={className:"built_in",match:Ot(/\b/,$n(...Dv),/(?=\()/)},v=[b,y],w={match:/->/,relevance:0},T={className:"operator",relevance:0,variants:[{match:Xm},{match:`\\.(\\.|${LN})+`}]},E=[w,T],N="([0-9]_*)+",j="([0-9a-fA-F]_*)+",A={className:"number",relevance:0,variants:[{match:`\\b(${N})(\\.(${N}))?([eE][+-]?(${N}))?\\b`},{match:`\\b0x(${j})(\\.(${j}))?([pP][+-]?(${N}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},R=(Ae="")=>({className:"subst",variants:[{match:Ot(/\\/,Ae,/[0\\tnr"']/)},{match:Ot(/\\/,Ae,/u\{[0-9a-fA-F]{1,8}\}/)}]}),$=(Ae="")=>({className:"subst",match:Ot(/\\/,Ae,/[\t ]*(?:[\r\n]|\r\n)/)}),z=(Ae="")=>({className:"subst",label:"interpol",begin:Ot(/\\/,Ae,/\(/),end:/\)/}),C=(Ae="")=>({begin:Ot(Ae,/"""/),end:Ot(/"""/,Ae),contains:[R(Ae),$(Ae),z(Ae)]}),L=(Ae="")=>({begin:Ot(Ae,/"/),end:Ot(/"/,Ae),contains:[R(Ae),z(Ae)]}),q={className:"string",variants:[C(),C("#"),C("##"),C("###"),L(),L("#"),L("##"),L("###")]},M=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],H={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:M},Z=Ae=>{const rt=Ot(Ae,/\//),Ke=Ot(/\//,Ae);return{begin:rt,end:Ke,contains:[...M,{scope:"comment",begin:`#(?!.*${Ke})`,end:/$/}]}},he={scope:"regexp",variants:[Z("###"),Z("##"),Z("#"),H]},se={match:Ot(/`/,aa,/`/)},ae={className:"variable",match:/\$\d+/},O={className:"variable",match:`\\$${cd}+`},ee=[se,ae,O],te={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:n9,contains:[...E,A,q]}]}},be={scope:"keyword",match:Ot(/@/,$n(...t9),No($n(/\(/,/\s+/)))},S={scope:"meta",match:Ot(/@/,aa)},ve=[te,be,S],ce={match:No(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Ot(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,cd,"+")},{className:"type",match:Lu,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Ot(/\s+&\s+/,No(Lu)),relevance:0}]},D={begin:/</,end:/>/,keywords:g,contains:[...r,...x,...ve,w,ce]};ce.contains.push(D);const U={match:Ot(aa,/\s*:/),keywords:"_|0",relevance:0},re={begin:/\(/,end:/\)/,relevance:0,keywords:g,contains:["self",U,...r,he,...x,...v,...E,A,q,...ee,...ve,ce]},ge={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,ce]},_e={begin:$n(No(Ot(aa,/\s*:/)),No(Ot(aa,/\s+/,aa,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:aa}]},Ue={begin:/\(/,end:/\)/,keywords:g,contains:[_e,...r,...x,...E,A,q,...ve,ce,re],endsParent:!0,illegal:/["']/},de={match:[/(func|macro)/,/\s+/,$n(se.match,aa,Xm)],className:{1:"keyword",3:"title.function"},contains:[ge,Ue,i],illegal:[/\[/,/%/]},Ne={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[ge,Ue,i],illegal:/\[|%/},ye={match:[/operator/,/\s+/,Xm],className:{1:"keyword",3:"title"}},Q={begin:[/precedencegroup/,/\s+/,Lu],className:{1:"keyword",3:"title"},contains:[ce],keywords:[...W6,...Rv],end:/}/},Pe={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},ne={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},et={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,aa,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:g,contains:[ge,...x,{begin:/:/,end:/\{/,keywords:g,contains:[{scope:"title.class.inherited",match:Lu},...x],relevance:0}]};for(const Ae of q.variants){const rt=Ae.contains.find(It=>It.label==="interpol");rt.keywords=g;const Ke=[...x,...v,...E,A,q,...ee];rt.contains=[...Ke,{begin:/\(/,end:/\)/,contains:["self",...Ke]}]}return{name:"Swift",keywords:g,contains:[...r,de,Ne,Pe,ne,et,ye,Q,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},he,...x,...v,...E,A,q,...ee,...ve,ce,re]}}const ud="[A-Za-z$_][0-9A-Za-z$_]*",UN=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],BN=["true","false","null","undefined","NaN","Infinity"],$N=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],PN=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],HN=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],FN=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],qN=[].concat(HN,$N,PN);function a9(e){const i=e.regex,a=(te,{after:be})=>{const S="</"+te[0].slice(1);return te.input.indexOf(S,be)!==-1},r=ud,o={begin:"<>",end:"</>"},u=/<[A-Za-z0-9\\._:-]+\s*\/>/,d={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(te,be)=>{const S=te[0].length+te.index,ve=te.input[S];if(ve==="<"||ve===","){be.ignoreMatch();return}ve===">"&&(a(te,{after:S})||be.ignoreMatch());let ce;const D=te.input.substring(S);if(ce=D.match(/^\s*=/)){be.ignoreMatch();return}if((ce=D.match(/^\s+extends\s+/))&&ce.index===0){be.ignoreMatch();return}}},p={$pattern:ud,keyword:UN,literal:BN,built_in:qN,"variable.language":FN},h="[0-9](_?[0-9])*",g=`\\.(${h})`,x="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",b={className:"number",variants:[{begin:`(\\b(${x})((${g})|\\.)?|(${g}))[eE][+-]?(${h})\\b`},{begin:`\\b(${x})\\b((${g})\\b|\\.)?|(${g})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},y={className:"subst",begin:"\\$\\{",end:"\\}",keywords:p,contains:[]},v={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"xml"}},w={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"css"}},T={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"graphql"}},E={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,y]},j={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},A=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,v,w,T,E,{match:/\$\d+/},b];y.contains=A.concat({begin:/\{/,end:/\}/,keywords:p,contains:["self"].concat(A)});const R=[].concat(j,y.contains),$=R.concat([{begin:/(\s*)\(/,end:/\)/,keywords:p,contains:["self"].concat(R)}]),z={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:p,contains:$},C={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,i.concat(r,"(",i.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},L={relevance:0,match:i.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...$N,...PN]}},q={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},M={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[z],illegal:/%/},H={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function Z(te){return i.concat("(?!",te.join("|"),")")}const he={match:i.concat(/\b/,Z([...HN,"super","import","await"].map(te=>`${te}\\s*\\(`)),r,i.lookahead(/\s*\(/)),className:"title.function",relevance:0},se={begin:i.concat(/\./,i.lookahead(i.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},ae={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},z]},O="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",ee={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,i.lookahead(O)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[z]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:p,exports:{PARAMS_CONTAINS:$,CLASS_REFERENCE:L},illegal:/#(?![$_A-Za-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),q,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,v,w,T,E,j,{match:/\$\d+/},b,L,{scope:"attr",match:r+i.lookahead(":"),relevance:0},ee,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[j,e.REGEXP_MODE,{className:"function",begin:O,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:p,contains:$}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:o.begin,end:o.end},{match:u},{begin:d.begin,"on:begin":d.isTrulyOpeningTag,end:d.end}],subLanguage:"xml",contains:[{begin:d.begin,end:d.end,skip:!0,contains:["self"]}]}]},M,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[z,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},se,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[z]},he,H,C,ae,{match:/\$[(.]/}]}}function r9(e){const i=e.regex,a=a9(e),r=ud,o=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],u={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},d={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:o},contains:[a.exports.CLASS_REFERENCE]},p={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},h=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],g={$pattern:ud,keyword:UN.concat(h),literal:BN,built_in:qN.concat(o),"variable.language":FN},x={className:"meta",begin:"@"+r},b=(T,E,N)=>{const j=T.contains.findIndex(A=>A.label===E);if(j===-1)throw new Error("can not find mode to replace");T.contains.splice(j,1,N)};Object.assign(a.keywords,g),a.exports.PARAMS_CONTAINS.push(x);const y=a.contains.find(T=>T.scope==="attr"),v=Object.assign({},y,{match:i.concat(r,i.lookahead(/\s*\?:/))});a.exports.PARAMS_CONTAINS.push([a.exports.CLASS_REFERENCE,y,v]),a.contains=a.contains.concat([x,u,d,v]),b(a,"shebang",e.SHEBANG()),b(a,"use_strict",p);const w=a.contains.find(T=>T.label==="func.def");return w.relevance=0,Object.assign(a,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),a}function s9(e){const i=e.regex,a={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},o=/\d{1,2}\/\d{1,2}\/\d{4}/,u=/\d{4}-\d{1,2}-\d{1,2}/,d=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,p=/\d{1,2}(:\d{1,2}){1,2}/,h={className:"literal",variants:[{begin:i.concat(/# */,i.either(u,o),/ *#/)},{begin:i.concat(/# */,p,/ *#/)},{begin:i.concat(/# */,d,/ *#/)},{begin:i.concat(/# */,i.either(u,o),/ +/,i.either(d,p),/ *#/)}]},g={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},x={className:"label",begin:/^\w+:/},b=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),y=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[a,r,h,g,x,b,y,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[y]}]}}function l9(e){e.regex;const i=e.COMMENT(/\(;/,/;\)/);i.contains.push("self");const a=e.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],o={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},u={className:"variable",begin:/\$[\w_]+/},d={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},p={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},h={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},g={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[a,i,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},u,d,o,e.QUOTE_STRING_MODE,h,g,p]}}function o9(e){const i=e.regex,a=i.concat(/[\p{L}_]/u,i.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,o={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},u={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},d=e.inherit(u,{begin:/\(/,end:/\)/}),p=e.inherit(e.APOS_STRING_MODE,{className:"string"}),h=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),g={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[o]},{begin:/'/,end:/'/,contains:[o]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[u,h,p,d,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[u,d,h,p]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},o,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[h]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[g],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[g],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:i.concat(/</,i.lookahead(i.concat(a,i.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:a,relevance:0,starts:g}]},{className:"tag",begin:i.concat(/<\//,i.lookahead(i.concat(a,/>/))),contains:[{className:"name",begin:a,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function c9(e){const i="true false yes no null",a="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},o={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},u={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},d={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,o]},p=e.inherit(d,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),y={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},v={end:",",endsWithParent:!0,excludeEnd:!0,keywords:i,relevance:0},w={begin:/\{/,end:/\}/,contains:[v],illegal:"\\n",relevance:0},T={begin:"\\[",end:"\\]",contains:[v],illegal:"\\n",relevance:0},E=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+a},{className:"type",begin:"!<"+a+">"},{className:"type",begin:"!"+a},{className:"type",begin:"!!"+a},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:i,keywords:{literal:i}},y,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},w,T,u,d],N=[...E];return N.pop(),N.push(p),v.contains=N,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:E}}const u9={arduino:FL,bash:qL,c:GL,cpp:YL,csharp:VL,css:n6,diff:i6,go:a6,graphql:r6,ini:s6,java:l6,javascript:f6,json:h6,kotlin:x6,less:_6,lua:S6,makefile:T6,markdown:C6,objectivec:j6,perl:A6,php:O6,"php-template":M6,plaintext:R6,python:D6,"python-repl":z6,r:L6,ruby:I6,rust:U6,scss:V6,shell:K6,sql:X6,swift:i9,typescript:r9,vbnet:s9,wasm:l9,xml:o9,yaml:c9};var Zm,zv;function d9(){if(zv)return Zm;zv=1;function e(P){return P instanceof Map?P.clear=P.delete=P.set=function(){throw new Error("map is read-only")}:P instanceof Set&&(P.add=P.clear=P.delete=function(){throw new Error("set is read-only")}),Object.freeze(P),Object.getOwnPropertyNames(P).forEach(ue=>{const Ce=P[ue],Ze=typeof Ce;(Ze==="object"||Ze==="function")&&!Object.isFrozen(Ce)&&e(Ce)}),P}class i{constructor(ue){ue.data===void 0&&(ue.data={}),this.data=ue.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function a(P){return P.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function r(P,...ue){const Ce=Object.create(null);for(const Ze in P)Ce[Ze]=P[Ze];return ue.forEach(function(Ze){for(const Rt in Ze)Ce[Rt]=Ze[Rt]}),Ce}const o="</span>",u=P=>!!P.scope,d=(P,{prefix:ue})=>{if(P.startsWith("language:"))return P.replace("language:","language-");if(P.includes(".")){const Ce=P.split(".");return[`${ue}${Ce.shift()}`,...Ce.map((Ze,Rt)=>`${Ze}${"_".repeat(Rt+1)}`)].join(" ")}return`${ue}${P}`};class p{constructor(ue,Ce){this.buffer="",this.classPrefix=Ce.classPrefix,ue.walk(this)}addText(ue){this.buffer+=a(ue)}openNode(ue){if(!u(ue))return;const Ce=d(ue.scope,{prefix:this.classPrefix});this.span(Ce)}closeNode(ue){u(ue)&&(this.buffer+=o)}value(){return this.buffer}span(ue){this.buffer+=`<span class="${ue}">`}}const h=(P={})=>{const ue={children:[]};return Object.assign(ue,P),ue};class g{constructor(){this.rootNode=h(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(ue){this.top.children.push(ue)}openNode(ue){const Ce=h({scope:ue});this.add(Ce),this.stack.push(Ce)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(ue){return this.constructor._walk(ue,this.rootNode)}static _walk(ue,Ce){return typeof Ce=="string"?ue.addText(Ce):Ce.children&&(ue.openNode(Ce),Ce.children.forEach(Ze=>this._walk(ue,Ze)),ue.closeNode(Ce)),ue}static _collapse(ue){typeof ue!="string"&&ue.children&&(ue.children.every(Ce=>typeof Ce=="string")?ue.children=[ue.children.join("")]:ue.children.forEach(Ce=>{g._collapse(Ce)}))}}class x extends g{constructor(ue){super(),this.options=ue}addText(ue){ue!==""&&this.add(ue)}startScope(ue){this.openNode(ue)}endScope(){this.closeNode()}__addSublanguage(ue,Ce){const Ze=ue.root;Ce&&(Ze.scope=`language:${Ce}`),this.add(Ze)}toHTML(){return new p(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function b(P){return P?typeof P=="string"?P:P.source:null}function y(P){return T("(?=",P,")")}function v(P){return T("(?:",P,")*")}function w(P){return T("(?:",P,")?")}function T(...P){return P.map(Ce=>b(Ce)).join("")}function E(P){const ue=P[P.length-1];return typeof ue=="object"&&ue.constructor===Object?(P.splice(P.length-1,1),ue):{}}function N(...P){return"("+(E(P).capture?"":"?:")+P.map(Ze=>b(Ze)).join("|")+")"}function j(P){return new RegExp(P.toString()+"|").exec("").length-1}function A(P,ue){const Ce=P&&P.exec(ue);return Ce&&Ce.index===0}const R=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function $(P,{joinWith:ue}){let Ce=0;return P.map(Ze=>{Ce+=1;const Rt=Ce;let pt=b(Ze),Oe="";for(;pt.length>0;){const Te=R.exec(pt);if(!Te){Oe+=pt;break}Oe+=pt.substring(0,Te.index),pt=pt.substring(Te.index+Te[0].length),Te[0][0]==="\\"&&Te[1]?Oe+="\\"+String(Number(Te[1])+Rt):(Oe+=Te[0],Te[0]==="("&&Ce++)}return Oe}).map(Ze=>`(${Ze})`).join(ue)}const z=/\b\B/,C="[a-zA-Z]\\w*",L="[a-zA-Z_]\\w*",q="\\b\\d+(\\.\\d+)?",M="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",H="\\b(0b[01]+)",Z="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",he=(P={})=>{const ue=/^#![ ]*\//;return P.binary&&(P.begin=T(ue,/.*\b/,P.binary,/\b.*/)),r({scope:"meta",begin:ue,end:/$/,relevance:0,"on:begin":(Ce,Ze)=>{Ce.index!==0&&Ze.ignoreMatch()}},P)},se={begin:"\\\\[\\s\\S]",relevance:0},ae={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[se]},O={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[se]},ee={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},te=function(P,ue,Ce={}){const Ze=r({scope:"comment",begin:P,end:ue,contains:[]},Ce);Ze.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const Rt=N("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return Ze.contains.push({begin:T(/[ ]+/,"(",Rt,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Ze},be=te("//","$"),S=te("/\\*","\\*/"),ve=te("#","$"),ce={scope:"number",begin:q,relevance:0},D={scope:"number",begin:M,relevance:0},U={scope:"number",begin:H,relevance:0},re={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[se,{begin:/\[/,end:/\]/,relevance:0,contains:[se]}]},ge={scope:"title",begin:C,relevance:0},_e={scope:"title",begin:L,relevance:0},Ue={begin:"\\.\\s*"+L,relevance:0};var Ne=Object.freeze({__proto__:null,APOS_STRING_MODE:ae,BACKSLASH_ESCAPE:se,BINARY_NUMBER_MODE:U,BINARY_NUMBER_RE:H,COMMENT:te,C_BLOCK_COMMENT_MODE:S,C_LINE_COMMENT_MODE:be,C_NUMBER_MODE:D,C_NUMBER_RE:M,END_SAME_AS_BEGIN:function(P){return Object.assign(P,{"on:begin":(ue,Ce)=>{Ce.data._beginMatch=ue[1]},"on:end":(ue,Ce)=>{Ce.data._beginMatch!==ue[1]&&Ce.ignoreMatch()}})},HASH_COMMENT_MODE:ve,IDENT_RE:C,MATCH_NOTHING_RE:z,METHOD_GUARD:Ue,NUMBER_MODE:ce,NUMBER_RE:q,PHRASAL_WORDS_MODE:ee,QUOTE_STRING_MODE:O,REGEXP_MODE:re,RE_STARTERS_RE:Z,SHEBANG:he,TITLE_MODE:ge,UNDERSCORE_IDENT_RE:L,UNDERSCORE_TITLE_MODE:_e});function ye(P,ue){P.input[P.index-1]==="."&&ue.ignoreMatch()}function Q(P,ue){P.className!==void 0&&(P.scope=P.className,delete P.className)}function Pe(P,ue){ue&&P.beginKeywords&&(P.begin="\\b("+P.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",P.__beforeBegin=ye,P.keywords=P.keywords||P.beginKeywords,delete P.beginKeywords,P.relevance===void 0&&(P.relevance=0))}function ne(P,ue){Array.isArray(P.illegal)&&(P.illegal=N(...P.illegal))}function et(P,ue){if(P.match){if(P.begin||P.end)throw new Error("begin & end are not supported with match");P.begin=P.match,delete P.match}}function Ae(P,ue){P.relevance===void 0&&(P.relevance=1)}const rt=(P,ue)=>{if(!P.beforeMatch)return;if(P.starts)throw new Error("beforeMatch cannot be used with starts");const Ce=Object.assign({},P);Object.keys(P).forEach(Ze=>{delete P[Ze]}),P.keywords=Ce.keywords,P.begin=T(Ce.beforeMatch,y(Ce.begin)),P.starts={relevance:0,contains:[Object.assign(Ce,{endsParent:!0})]},P.relevance=0,delete Ce.beforeMatch},Ke=["of","and","for","in","not","or","if","then","parent","list","value"],It="keyword";function jn(P,ue,Ce=It){const Ze=Object.create(null);return typeof P=="string"?Rt(Ce,P.split(" ")):Array.isArray(P)?Rt(Ce,P):Object.keys(P).forEach(function(pt){Object.assign(Ze,jn(P[pt],ue,pt))}),Ze;function Rt(pt,Oe){ue&&(Oe=Oe.map(Te=>Te.toLowerCase())),Oe.forEach(function(Te){const Ye=Te.split("|");Ze[Ye[0]]=[pt,xn(Ye[0],Ye[1])]})}}function xn(P,ue){return ue?Number(ue):fe(P)?0:1}function fe(P){return Ke.includes(P.toLowerCase())}const Ge={},ht=P=>{console.error(P)},xt=(P,...ue)=>{console.log(`WARN: ${P}`,...ue)},ln=(P,ue)=>{Ge[`${P}/${ue}`]||(console.log(`Deprecated as of ${P}. ${ue}`),Ge[`${P}/${ue}`]=!0)},ie=new Error;function ke(P,ue,{key:Ce}){let Ze=0;const Rt=P[Ce],pt={},Oe={};for(let Te=1;Te<=ue.length;Te++)Oe[Te+Ze]=Rt[Te],pt[Te+Ze]=!0,Ze+=j(ue[Te-1]);P[Ce]=Oe,P[Ce]._emit=pt,P[Ce]._multi=!0}function He(P){if(Array.isArray(P.begin)){if(P.skip||P.excludeBegin||P.returnBegin)throw ht("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ie;if(typeof P.beginScope!="object"||P.beginScope===null)throw ht("beginScope must be object"),ie;ke(P,P.begin,{key:"beginScope"}),P.begin=$(P.begin,{joinWith:""})}}function Xe(P){if(Array.isArray(P.end)){if(P.skip||P.excludeEnd||P.returnEnd)throw ht("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ie;if(typeof P.endScope!="object"||P.endScope===null)throw ht("endScope must be object"),ie;ke(P,P.end,{key:"endScope"}),P.end=$(P.end,{joinWith:""})}}function Zt(P){P.scope&&typeof P.scope=="object"&&P.scope!==null&&(P.beginScope=P.scope,delete P.scope)}function Et(P){Zt(P),typeof P.beginScope=="string"&&(P.beginScope={_wrap:P.beginScope}),typeof P.endScope=="string"&&(P.endScope={_wrap:P.endScope}),He(P),Xe(P)}function on(P){function ue(Oe,Te){return new RegExp(b(Oe),"m"+(P.case_insensitive?"i":"")+(P.unicodeRegex?"u":"")+(Te?"g":""))}class Ce{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Te,Ye){Ye.position=this.position++,this.matchIndexes[this.matchAt]=Ye,this.regexes.push([Ye,Te]),this.matchAt+=j(Te)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Te=this.regexes.map(Ye=>Ye[1]);this.matcherRe=ue($(Te,{joinWith:"|"}),!0),this.lastIndex=0}exec(Te){this.matcherRe.lastIndex=this.lastIndex;const Ye=this.matcherRe.exec(Te);if(!Ye)return null;const Jt=Ye.findIndex((Fi,Ia)=>Ia>0&&Fi!==void 0),Ft=this.matchIndexes[Jt];return Ye.splice(0,Jt),Object.assign(Ye,Ft)}}class Ze{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Te){if(this.multiRegexes[Te])return this.multiRegexes[Te];const Ye=new Ce;return this.rules.slice(Te).forEach(([Jt,Ft])=>Ye.addRule(Jt,Ft)),Ye.compile(),this.multiRegexes[Te]=Ye,Ye}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Te,Ye){this.rules.push([Te,Ye]),Ye.type==="begin"&&this.count++}exec(Te){const Ye=this.getMatcher(this.regexIndex);Ye.lastIndex=this.lastIndex;let Jt=Ye.exec(Te);if(this.resumingScanAtSamePosition()&&!(Jt&&Jt.index===this.lastIndex)){const Ft=this.getMatcher(0);Ft.lastIndex=this.lastIndex+1,Jt=Ft.exec(Te)}return Jt&&(this.regexIndex+=Jt.position+1,this.regexIndex===this.count&&this.considerAll()),Jt}}function Rt(Oe){const Te=new Ze;return Oe.contains.forEach(Ye=>Te.addRule(Ye.begin,{rule:Ye,type:"begin"})),Oe.terminatorEnd&&Te.addRule(Oe.terminatorEnd,{type:"end"}),Oe.illegal&&Te.addRule(Oe.illegal,{type:"illegal"}),Te}function pt(Oe,Te){const Ye=Oe;if(Oe.isCompiled)return Ye;[Q,et,Et,rt].forEach(Ft=>Ft(Oe,Te)),P.compilerExtensions.forEach(Ft=>Ft(Oe,Te)),Oe.__beforeBegin=null,[Pe,ne,Ae].forEach(Ft=>Ft(Oe,Te)),Oe.isCompiled=!0;let Jt=null;return typeof Oe.keywords=="object"&&Oe.keywords.$pattern&&(Oe.keywords=Object.assign({},Oe.keywords),Jt=Oe.keywords.$pattern,delete Oe.keywords.$pattern),Jt=Jt||/\w+/,Oe.keywords&&(Oe.keywords=jn(Oe.keywords,P.case_insensitive)),Ye.keywordPatternRe=ue(Jt,!0),Te&&(Oe.begin||(Oe.begin=/\B|\b/),Ye.beginRe=ue(Ye.begin),!Oe.end&&!Oe.endsWithParent&&(Oe.end=/\B|\b/),Oe.end&&(Ye.endRe=ue(Ye.end)),Ye.terminatorEnd=b(Ye.end)||"",Oe.endsWithParent&&Te.terminatorEnd&&(Ye.terminatorEnd+=(Oe.end?"|":"")+Te.terminatorEnd)),Oe.illegal&&(Ye.illegalRe=ue(Oe.illegal)),Oe.contains||(Oe.contains=[]),Oe.contains=[].concat(...Oe.contains.map(function(Ft){return _i(Ft==="self"?Oe:Ft)})),Oe.contains.forEach(function(Ft){pt(Ft,Ye)}),Oe.starts&&pt(Oe.starts,Te),Ye.matcher=Rt(Ye),Ye}if(P.compilerExtensions||(P.compilerExtensions=[]),P.contains&&P.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return P.classNameAliases=r(P.classNameAliases||{}),pt(P)}function bn(P){return P?P.endsWithParent||bn(P.starts):!1}function _i(P){return P.variants&&!P.cachedVariants&&(P.cachedVariants=P.variants.map(function(ue){return r(P,{variants:null},ue)})),P.cachedVariants?P.cachedVariants:bn(P)?r(P,{starts:P.starts?r(P.starts):null}):Object.isFrozen(P)?r(P):P}var Si="11.11.2";class ca extends Error{constructor(ue,Ce){super(ue),this.name="HTMLInjectionError",this.html=Ce}}const La=a,Qt=r,dn=Symbol("nomatch"),Ti=7,zn=function(P){const ue=Object.create(null),Ce=Object.create(null),Ze=[];let Rt=!0;const pt="Could not find the language '{}', did you forget to load/include a language module?",Oe={disableAutodetect:!0,name:"Plain text",contains:[]};let Te={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:x};function Ye(xe){return Te.noHighlightRe.test(xe)}function Jt(xe){let Le=xe.className+" ";Le+=xe.parentNode?xe.parentNode.className:"";const ot=Te.languageDetectRe.exec(Le);if(ot){const jt=ji(ot[1]);return jt||(xt(pt.replace("{}",ot[1])),xt("Falling back to no-highlight mode for this block.",xe)),jt?ot[1]:"no-highlight"}return Le.split(/\s+/).find(jt=>Ye(jt)||ji(jt))}function Ft(xe,Le,ot){let jt="",Vt="";typeof Le=="object"?(jt=xe,ot=Le.ignoreIllegals,Vt=Le.language):(ln("10.7.0","highlight(lang, code, ...args) has been deprecated."),ln("10.7.0",`Please use highlight(code, options) instead.
|
|
248
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),Vt=xe,jt=Le),ot===void 0&&(ot=!0);const qn={code:jt,language:Vt};Fn("before:highlight",qn);const Gn=qn.result?qn.result:Fi(qn.language,qn.code,ot);return Gn.code=qn.code,Fn("after:highlight",Gn),Gn}function Fi(xe,Le,ot,jt){const Vt=Object.create(null);function qn(je,Ie){return je.keywords[Ie]}function Gn(){if(!Je.keywords){en.addText(yt);return}let je=0;Je.keywordPatternRe.lastIndex=0;let Ie=Je.keywordPatternRe.exec(yt),nt="";for(;Ie;){nt+=yt.substring(je,Ie.index);const vt=fi.case_insensitive?Ie[0].toLowerCase():Ie[0],_t=qn(Je,vt);if(_t){const[ti,lc]=_t;if(en.addText(nt),nt="",Vt[vt]=(Vt[vt]||0)+1,Vt[vt]<=Ti&&(ha+=lc),ti.startsWith("_"))nt+=Ie[0];else{const El=fi.classNameAliases[ti]||ti;pn(Ie[0],El)}}else nt+=Ie[0];je=Je.keywordPatternRe.lastIndex,Ie=Je.keywordPatternRe.exec(yt)}nt+=yt.substring(je),en.addText(nt)}function da(){if(yt==="")return;let je=null;if(typeof Je.subLanguage=="string"){if(!ue[Je.subLanguage]){en.addText(yt);return}je=Fi(Je.subLanguage,yt,!0,mt[Je.subLanguage]),mt[Je.subLanguage]=je._top}else je=Ua(yt,Je.subLanguage.length?Je.subLanguage:null);Je.relevance>0&&(ha+=je.relevance),en.__addSublanguage(je._emitter,je.language)}function fn(){Je.subLanguage!=null?da():Gn(),yt=""}function pn(je,Ie){je!==""&&(en.startScope(Ie),en.addText(je),en.endScope())}function fa(je,Ie){let nt=1;const vt=Ie.length-1;for(;nt<=vt;){if(!je._emit[nt]){nt++;continue}const _t=fi.classNameAliases[je[nt]]||je[nt],ti=Ie[nt];_t?pn(ti,_t):(yt=ti,Gn(),yt=""),nt++}}function Pa(je,Ie){return je.scope&&typeof je.scope=="string"&&en.openNode(fi.classNameAliases[je.scope]||je.scope),je.beginScope&&(je.beginScope._wrap?(pn(yt,fi.classNameAliases[je.beginScope._wrap]||je.beginScope._wrap),yt=""):je.beginScope._multi&&(fa(je.beginScope,Ie),yt="")),Je=Object.create(je,{parent:{value:Je}}),Je}function pa(je,Ie,nt){let vt=A(je.endRe,nt);if(vt){if(je["on:end"]){const _t=new i(je);je["on:end"](Ie,_t),_t.isMatchIgnored&&(vt=!1)}if(vt){for(;je.endsParent&&je.parent;)je=je.parent;return je}}if(je.endsWithParent)return pa(je.parent,Ie,nt)}function Wt(je){return Je.matcher.regexIndex===0?(yt+=je[0],1):(ps=!0,0)}function ic(je){const Ie=je[0],nt=je.rule,vt=new i(nt),_t=[nt.__beforeBegin,nt["on:begin"]];for(const ti of _t)if(ti&&(ti(je,vt),vt.isMatchIgnored))return Wt(Ie);return nt.skip?yt+=Ie:(nt.excludeBegin&&(yt+=Ie),fn(),!nt.returnBegin&&!nt.excludeBegin&&(yt=Ie)),Pa(nt,je),nt.returnBegin?0:Ie.length}function ac(je){const Ie=je[0],nt=Le.substring(je.index),vt=pa(Je,je,nt);if(!vt)return dn;const _t=Je;Je.endScope&&Je.endScope._wrap?(fn(),pn(Ie,Je.endScope._wrap)):Je.endScope&&Je.endScope._multi?(fn(),fa(Je.endScope,je)):_t.skip?yt+=Ie:(_t.returnEnd||_t.excludeEnd||(yt+=Ie),fn(),_t.excludeEnd&&(yt=Ie));do Je.scope&&en.closeNode(),!Je.skip&&!Je.subLanguage&&(ha+=Je.relevance),Je=Je.parent;while(Je!==vt.parent);return vt.starts&&Pa(vt.starts,je),_t.returnEnd?0:Ie.length}function rc(){const je=[];for(let Ie=Je;Ie!==fi;Ie=Ie.parent)Ie.scope&&je.unshift(Ie.scope);je.forEach(Ie=>en.openNode(Ie))}let di={};function ma(je,Ie){const nt=Ie&&Ie[0];if(yt+=je,nt==null)return fn(),0;if(di.type==="begin"&&Ie.type==="end"&&di.index===Ie.index&&nt===""){if(yt+=Le.slice(Ie.index,Ie.index+1),!Rt){const vt=new Error(`0 width match regex (${xe})`);throw vt.languageName=xe,vt.badRule=di.rule,vt}return 1}if(di=Ie,Ie.type==="begin")return ic(Ie);if(Ie.type==="illegal"&&!ot){const vt=new Error('Illegal lexeme "'+nt+'" for mode "'+(Je.scope||"<unnamed>")+'"');throw vt.mode=Je,vt}else if(Ie.type==="end"){const vt=ac(Ie);if(vt!==dn)return vt}if(Ie.type==="illegal"&&nt==="")return Ie.index===Le.length||(yt+=`
|
|
249
|
+
`),1;if(vn>1e5&&vn>Ie.index*3)throw new Error("potential infinite loop, way more iterations than matches");return yt+=nt,nt.length}const fi=ji(xe);if(!fi)throw ht(pt.replace("{}",xe)),new Error('Unknown language: "'+xe+'"');const sc=on(fi);let fs="",Je=jt||sc;const mt={},en=new Te.__emitter(Te);rc();let yt="",ha=0,yn=0,vn=0,ps=!1;try{if(fi.__emitTokens)fi.__emitTokens(Le,en);else{for(Je.matcher.considerAll();;){vn++,ps?ps=!1:Je.matcher.considerAll(),Je.matcher.lastIndex=yn;const je=Je.matcher.exec(Le);if(!je)break;const Ie=Le.substring(yn,je.index),nt=ma(Ie,je);yn=je.index+nt}ma(Le.substring(yn))}return en.finalize(),fs=en.toHTML(),{language:xe,value:fs,relevance:ha,illegal:!1,_emitter:en,_top:Je}}catch(je){if(je.message&&je.message.includes("Illegal"))return{language:xe,value:La(Le),illegal:!0,relevance:0,_illegalBy:{message:je.message,index:yn,context:Le.slice(yn-100,yn+100),mode:je.mode,resultSoFar:fs},_emitter:en};if(Rt)return{language:xe,value:La(Le),illegal:!1,relevance:0,errorRaised:je,_emitter:en,_top:Je};throw je}}function Ia(xe){const Le={value:La(xe),illegal:!1,relevance:0,_top:Oe,_emitter:new Te.__emitter(Te)};return Le._emitter.addText(xe),Le}function Ua(xe,Le){Le=Le||Te.languages||Object.keys(ue);const ot=Ia(xe),jt=Le.filter(ji).filter(ds).map(fn=>Fi(fn,xe,!1));jt.unshift(ot);const Vt=jt.sort((fn,pn)=>{if(fn.relevance!==pn.relevance)return pn.relevance-fn.relevance;if(fn.language&&pn.language){if(ji(fn.language).supersetOf===pn.language)return 1;if(ji(pn.language).supersetOf===fn.language)return-1}return 0}),[qn,Gn]=Vt,da=qn;return da.secondBest=Gn,da}function ua(xe,Le,ot){const jt=Le&&Ce[Le]||ot;xe.classList.add("hljs"),xe.classList.add(`language-${jt}`)}function Ba(xe){let Le=null;const ot=Jt(xe);if(Ye(ot))return;if(Fn("before:highlightElement",{el:xe,language:ot}),xe.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",xe);return}if(xe.children.length>0&&(Te.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(xe)),Te.throwUnescapedHTML))throw new ca("One of your code blocks includes unescaped HTML.",xe.innerHTML);Le=xe;const jt=Le.textContent,Vt=ot?Ft(jt,{language:ot,ignoreIllegals:!0}):Ua(jt);xe.innerHTML=Vt.value,xe.dataset.highlighted="yes",ua(xe,ot,Vt.language),xe.result={language:Vt.language,re:Vt.relevance,relevance:Vt.relevance},Vt.secondBest&&(xe.secondBest={language:Vt.secondBest.language,relevance:Vt.secondBest.relevance}),Fn("after:highlightElement",{el:xe,result:Vt,text:jt})}function _r(xe){Te=Qt(Te,xe)}const Wo=()=>{$a(),ln("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Id(){$a(),ln("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let wl=!1;function $a(){function xe(){$a()}if(document.readyState==="loading"){wl||window.addEventListener("DOMContentLoaded",xe,!1),wl=!0;return}document.querySelectorAll(Te.cssSelector).forEach(Ba)}function Sr(xe,Le){let ot=null;try{ot=Le(P)}catch(jt){if(ht("Language definition for '{}' could not be registered.".replace("{}",xe)),Rt)ht(jt);else throw jt;ot=Oe}ot.name||(ot.name=xe),ue[xe]=ot,ot.rawDefinition=Le.bind(null,P),ot.aliases&&kl(ot.aliases,{languageName:xe})}function Ud(xe){delete ue[xe];for(const Le of Object.keys(Ce))Ce[Le]===xe&&delete Ce[Le]}function ec(){return Object.keys(ue)}function ji(xe){return xe=(xe||"").toLowerCase(),ue[xe]||ue[Ce[xe]]}function kl(xe,{languageName:Le}){typeof xe=="string"&&(xe=[xe]),xe.forEach(ot=>{Ce[ot.toLowerCase()]=Le})}function ds(xe){const Le=ji(xe);return Le&&!Le.disableAutodetect}function Nl(xe){xe["before:highlightBlock"]&&!xe["before:highlightElement"]&&(xe["before:highlightElement"]=Le=>{xe["before:highlightBlock"](Object.assign({block:Le.el},Le))}),xe["after:highlightBlock"]&&!xe["after:highlightElement"]&&(xe["after:highlightElement"]=Le=>{xe["after:highlightBlock"](Object.assign({block:Le.el},Le))})}function tc(xe){Nl(xe),Ze.push(xe)}function nc(xe){const Le=Ze.indexOf(xe);Le!==-1&&Ze.splice(Le,1)}function Fn(xe,Le){const ot=xe;Ze.forEach(function(jt){jt[ot]&&jt[ot](Le)})}function cn(xe){return ln("10.7.0","highlightBlock will be removed entirely in v12.0"),ln("10.7.0","Please use highlightElement now."),Ba(xe)}Object.assign(P,{highlight:Ft,highlightAuto:Ua,highlightAll:$a,highlightElement:Ba,highlightBlock:cn,configure:_r,initHighlighting:Wo,initHighlightingOnLoad:Id,registerLanguage:Sr,unregisterLanguage:Ud,listLanguages:ec,getLanguage:ji,registerAliases:kl,autoDetection:ds,inherit:Qt,addPlugin:tc,removePlugin:nc}),P.debugMode=function(){Rt=!1},P.safeMode=function(){Rt=!0},P.versionString=Si,P.regex={concat:T,lookahead:y,either:N,optional:w,anyNumberOfTimes:v};for(const xe in Ne)typeof Ne[xe]=="object"&&e(Ne[xe]);return Object.assign(P,Ne),P},Ci=zn({});return Ci.newInstance=()=>zn({}),Zm=Ci,Ci.HighlightJS=Ci,Ci.default=Ci,Zm}var f9=d9();const p9=fd(f9),Lv={},m9="hljs-";function h9(e){const i=p9.newInstance();return e&&u(e),{highlight:a,highlightAuto:r,listLanguages:o,register:u,registerAlias:d,registered:p};function a(h,g,x){const b=x||Lv,y=typeof b.prefix=="string"?b.prefix:m9;if(!i.getLanguage(h))throw new Error("Unknown language: `"+h+"` is not registered");i.configure({__emitter:g9,classPrefix:y});const v=i.highlight(g,{ignoreIllegals:!0,language:h});if(v.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:v.errorRaised});const w=v._emitter.root,T=w.data;return T.language=v.language,T.relevance=v.relevance,w}function r(h,g){const b=(g||Lv).subset||o();let y=-1,v=0,w;for(;++y<b.length;){const T=b[y];if(!i.getLanguage(T))continue;const E=a(T,h,g);E.data&&E.data.relevance!==void 0&&E.data.relevance>v&&(v=E.data.relevance,w=E)}return w||{type:"root",children:[],data:{language:void 0,relevance:v}}}function o(){return i.listLanguages()}function u(h,g){if(typeof h=="string")i.registerLanguage(h,g);else{let x;for(x in h)Object.hasOwn(h,x)&&i.registerLanguage(x,h[x])}}function d(h,g){if(typeof h=="string")i.registerAliases(typeof g=="string"?g:[...g],{languageName:h});else{let x;for(x in h)if(Object.hasOwn(h,x)){const b=h[x];i.registerAliases(typeof b=="string"?b:[...b],{languageName:x})}}}function p(h){return!!i.getLanguage(h)}}class g9{constructor(i){this.options=i,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(i){if(i==="")return;const a=this.stack[this.stack.length-1],r=a.children[a.children.length-1];r&&r.type==="text"?r.value+=i:a.children.push({type:"text",value:i})}startScope(i){this.openNode(String(i))}endScope(){this.closeNode()}__addSublanguage(i,a){const r=this.stack[this.stack.length-1],o=i.root.children;a?r.children.push({type:"element",tagName:"span",properties:{className:[a]},children:o}):r.children.push(...o)}openNode(i){const a=this,r=i.split(".").map(function(d,p){return p?d+"_".repeat(p):a.options.classPrefix+d}),o=this.stack[this.stack.length-1],u={type:"element",tagName:"span",properties:{className:r},children:[]};o.children.push(u),this.stack.push(u)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const x9={};function b9(e){const i=e||x9,a=i.aliases,r=i.detect||!1,o=i.languages||u9,u=i.plainText,d=i.prefix,p=i.subset;let h="hljs";const g=h9(o);if(a&&g.registerAlias(a),d){const x=d.indexOf("-");h=x===-1?d:d.slice(0,x)}return function(x,b){zd(x,"element",function(y,v,w){if(y.tagName!=="code"||!w||w.type!=="element"||w.tagName!=="pre")return;const T=y9(y);if(T===!1||!T&&!r||T&&u&&u.includes(T))return;Array.isArray(y.properties.className)||(y.properties.className=[]),y.properties.className.includes(h)||y.properties.className.unshift(h);const E=zL(y,{whitespace:"pre"});let N;try{N=T?g.highlight(T,E,{prefix:d}):g.highlightAuto(E,{prefix:d,subset:p})}catch(j){const A=j;if(T&&/Unknown language/.test(A.message)){b.message("Cannot highlight as `"+T+"`, it’s not registered",{ancestors:[w,y],cause:A,place:y.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw A}!T&&N.data&&N.data.language&&y.properties.className.push("language-"+N.data.language),N.children.length>0&&(y.children=N.children)})}}function y9(e){const i=e.properties.className;let a=-1;if(!Array.isArray(i))return;let r;for(;++a<i.length;){const o=String(i[a]);if(o==="no-highlight"||o==="nohighlight")return!1;!r&&o.slice(0,5)==="lang-"&&(r=o.slice(5)),!r&&o.slice(0,9)==="language-"&&(r=o.slice(9))}return r}function v9(e){const i=Array.isArray(e)?e[0]:e;if(i&&typeof i=="object"&&"props"in i){const a=i.props,r=/language-([\w-]+)/.exec(a?.className??"");if(r)return r[1]}return""}function Bh(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(Bh).join(""):B.isValidElement(e)?Bh(e.props.children):""}function w9(e,i){return e==="svg"?/<svg[\s>]/i.test(i):e==="html"||e==="htm"?/<(html|body|canvas|script|style|svg|main|section|div|h1|button)\b/i.test(i):!1}function k9(e,i){if(/<!doctype|<html[\s>]/i.test(i))return i;const a='<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">';return e==="svg"?`${a}<style>html,body{margin:0;min-height:100%}body{display:grid;place-items:center;background:#fff}svg{max-width:100%;height:auto}</style></head><body>${i}</body></html>`:`${a}</head><body>${i}</body></html>`}function GN({html:e,reloadKey:i,className:a}){const r=B.useRef(null);return B.useEffect(()=>{const o=r.current;if(!o)return;const u=d=>{d.source===o.contentWindow&&d.data?.type==="maxcode-preview-ready"&&o.contentWindow?.postMessage({type:"maxcode-preview",html:e},"*")};return window.addEventListener("message",u),()=>window.removeEventListener("message",u)},[e,i]),c.jsx("iframe",{ref:r,src:"/preview-host.html",title:"Live preview",sandbox:"allow-scripts allow-pointer-lock allow-forms allow-modals",allow:"fullscreen",className:W("block h-full w-full border-0 bg-white",a)},i)}function N9({html:e,onClose:i}){const[a,r]=B.useState(0);return B.useEffect(()=>{const o=u=>{u.key==="Escape"&&i()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[i]),Vo.createPortal(c.jsxs("div",{className:"fixed inset-0 z-[90] flex flex-col bg-canvas/95 p-3 backdrop-blur-sm sm:p-5",role:"dialog","aria-label":"Live preview",children:[c.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[c.jsx("p",{className:"text-[13.5px] font-medium text-ink",children:"Live preview"}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{type:"button",className:"icon-button",onClick:()=>r(o=>o+1),title:"Restart","aria-label":"Restart preview",children:c.jsx(uw,{size:16})}),c.jsx("button",{type:"button",className:"icon-button",onClick:i,title:"Close (Esc)","aria-label":"Close preview",children:c.jsx(Ni,{size:18})})]})]}),c.jsx("div",{className:"min-h-0 flex-1 overflow-hidden rounded-2xl border border-line bg-white shadow-float",children:c.jsx(GN,{html:e,reloadKey:a})})]}),document.body)}function E9({children:e,streaming:i}){const[a,r]=B.useState(!1),[o,u]=B.useState("code"),[d,p]=B.useState(0),[h,g]=B.useState(!1),x=v9(e)||"text",b=B.useMemo(()=>Bh(e),[e]),y=!i&&w9(x,b),v=B.useMemo(()=>y?k9(x,b):"",[y,x,b]),w=y&&o==="preview",T=async()=>{try{await navigator.clipboard.writeText(b),r(!0),window.setTimeout(()=>r(!1),1600)}catch{}};return c.jsxs("div",{className:"code-shell group/code",children:[c.jsxs("div",{className:"code-head",children:[y?c.jsx("div",{className:"inline-flex items-center rounded-lg bg-raised/80 p-0.5",role:"tablist","aria-label":"Code or preview",children:["code","preview"].map(E=>c.jsx("button",{type:"button",role:"tab","aria-selected":o===E,onClick:()=>u(E),className:W("h-6 rounded-md px-2.5 text-[11.5px] font-medium capitalize transition-colors",o===E?"bg-panel text-ink shadow-pill":"text-muted hover:text-ink"),children:E},E))}):c.jsx("span",{className:"code-lang",children:x}),c.jsxs("div",{className:"flex items-center gap-0.5",children:[w&&c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>p(E=>E+1),className:"inline-flex h-7 w-7 items-center justify-center rounded-md text-faint transition-colors hover:bg-panel hover:text-ink",title:"Restart","aria-label":"Restart preview",children:c.jsx(uw,{size:13})}),c.jsx("button",{type:"button",onClick:()=>g(!0),className:"inline-flex h-7 w-7 items-center justify-center rounded-md text-faint transition-colors hover:bg-panel hover:text-ink",title:"Full screen","aria-label":"Open preview full screen",children:c.jsx(DT,{size:13})})]}),y&&c.jsx("button",{type:"button",onClick:()=>Nh(x==="svg"?"image.svg":"index.html",x==="svg"?b:v,x==="svg"?"image/svg+xml":"text/html"),className:"inline-flex h-7 w-7 items-center justify-center rounded-md text-faint transition-colors hover:bg-panel hover:text-ink",title:"Download file","aria-label":"Download file",children:c.jsx(iw,{size:13})}),c.jsxs("button",{type:"button",onClick:T,className:"inline-flex h-7 items-center gap-1 rounded-md px-1.5 text-[11.5px] font-medium text-faint transition-colors hover:bg-panel hover:text-ink","aria-label":"Copy code",children:[a?c.jsx(Cn,{size:13}):c.jsx(hd,{size:13}),a?"Copied":"Copy"]})]})]}),w?c.jsx("div",{className:"h-[420px] min-h-[220px] resize-y overflow-hidden border-t border-line/60 bg-white",children:c.jsx(GN,{html:v,reloadKey:d})}):c.jsx("pre",{className:"code-pre thin-scroll",children:e}),h&&c.jsx(N9,{html:v,onClose:()=>g(!1)})]})}function _9({content:e,streaming:i}){return c.jsx("div",{className:W("md",i&&"is-streaming"),children:c.jsx(dD,{remarkPlugins:[CL],rehypePlugins:[[b9,{detect:!0,ignoreMissing:!0}]],components:{pre:({children:a})=>c.jsx(E9,{streaming:i,children:a}),a:({children:a,href:r})=>c.jsx("a",{href:r,target:"_blank",rel:"noreferrer noopener",children:a})},children:e})})}const YN=B.memo(_9);function Iv(e,i){Yt.approval?Yt.approval.resolveApproval(e,i):Vw(e,i)}function VN(e,i){const a=e===""?[]:e.split(`
|
|
250
|
+
`),r=i===""?[]:i.split(`
|
|
251
|
+
`);let o=0;for(;o<a.length&&o<r.length&&a[o]===r[o];)o+=1;let u=a.length,d=r.length;for(;u>o&&d>o&&a[u-1]===r[d-1];)u-=1,d-=1;const p=a.slice(o,u),h=r.slice(o,d),g=a.slice(0,o).map(x=>({type:"ctx",text:x}));if(p.length*h.length>2e6)p.forEach(x=>g.push({type:"del",text:x})),h.forEach(x=>g.push({type:"add",text:x}));else{const x=Array.from({length:p.length+1},()=>new Uint32Array(h.length+1));for(let v=p.length-1;v>=0;v-=1)for(let w=h.length-1;w>=0;w-=1)x[v][w]=p[v]===h[w]?x[v+1][w+1]+1:Math.max(x[v+1][w],x[v][w+1]);let b=0,y=0;for(;b<p.length&&y<h.length;)p[b]===h[y]?(g.push({type:"ctx",text:p[b]}),b+=1,y+=1):x[b+1][y]>=x[b][y+1]?(g.push({type:"del",text:p[b]}),b+=1):(g.push({type:"add",text:h[y]}),y+=1);for(;b<p.length;)g.push({type:"del",text:p[b++]});for(;y<h.length;)g.push({type:"add",text:h[y++]})}return a.slice(u).forEach(x=>g.push({type:"ctx",text:x})),g}function S9(e){let i=0,a=0;for(const r of e)r.type==="add"?i+=1:r.type==="del"&&(a+=1);return{added:i,removed:a}}const Qm=120;function T9({before:e,after:i,startLine:a=1}){const r=B.useMemo(()=>{const u=VN(e,i),d=new Array(u.length).fill(!1);u.forEach((b,y)=>{if(b.type!=="ctx")for(let v=Math.max(0,y-2);v<=Math.min(u.length-1,y+2);v+=1)d[v]=!0});let p=a,h=a;const g=[];let x=!1;return u.forEach((b,y)=>{const v=b.type==="add"?h:p;if(b.type!=="add"&&(p+=1),b.type!=="del"&&(h+=1),!d[y]){x=!0;return}x&&g.length>0&&g.push({key:-y,type:"gap",text:"",no:null,gap:!0}),x=!1,g.push({key:y,type:b.type,text:b.text,no:v})}),g},[e,i,a]),o=r.slice(0,Qm);return c.jsxs("div",{className:"diff-view thin-scroll max-h-64 overflow-auto rounded-lg border border-line bg-canvas/60 font-mono text-[11px] leading-[1.6]",children:[o.map((u,d)=>u.gap?c.jsx("div",{className:"px-2 text-center text-[10px] text-faint",children:"⋯"},u.key):c.jsxs("div",{style:{animationDelay:`${Math.min(d*14,260)}ms`},className:W("diff-row flex min-w-max",u.type==="add"&&"bg-success/[0.11] text-ink",u.type==="del"&&"bg-danger/[0.10] text-ink",u.type==="ctx"&&"text-faint"),children:[c.jsx("span",{className:"w-9 shrink-0 select-none pr-2 text-right text-[10px] tabular-nums text-faint/70",children:u.no}),c.jsx("span",{className:W("w-4 shrink-0 select-none text-center",u.type==="add"&&"text-success",u.type==="del"&&"text-danger"),children:u.type==="add"?"+":u.type==="del"?"−":" "}),c.jsx("span",{className:"whitespace-pre pr-3",children:u.text||" "})]},u.key)),r.length>Qm&&c.jsxs("div",{className:"px-3 py-1 text-[10px] text-faint",children:["… ",r.length-Qm," more rows"]})]})}function Pg({added:e,removed:i,line:a,column:r,className:o}){return c.jsxs("span",{className:W("diff-badge inline-flex items-center gap-1.5 font-mono text-[11px] tabular-nums",o),children:[c.jsxs("span",{className:"text-success",children:["+",e]}),c.jsxs("span",{className:"text-danger",children:["−",i]}),a?c.jsxs("span",{className:"text-faint",children:["L",a,r?`:${r}`:""]}):null]})}const C9=new Set(["write_file","edit_file","rewrite_file"]);function KN(e){if(e.diff)return e.diff;if(e.status!=="done"||e.call.name!=="edit_file")return;const{oldText:i,newText:a}=e.call.args;if(!(typeof i!="string"||typeof a!="string"))return S9(VN(i,a))}function j9(e){switch(e){case"awaiting":return{label:"Needs approval",className:"text-warning",dot:"bg-warning"};case"running":return{label:"Running",className:"text-accent",dot:"bg-accent"};case"done":return{label:"Done",className:"text-success",dot:"bg-success"};case"denied":return{label:"Denied",className:"text-muted",dot:"bg-faint"};default:return{label:"Failed",className:"text-danger",dot:"bg-danger"}}}function A9(e){return e===void 0?"":e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function O9(e){switch(e){case"shell":return"OpenSol wants to run this command in the open workspace.";case"write_file":return"OpenSol wants to create or overwrite this file on disk.";case"edit_file":case"rewrite_file":return"OpenSol wants to change this file on disk.";case"git":return"OpenSol wants to change the Git state of this repository.";case"subagent":return"OpenSol wants to start a read-only subagent to investigate.";case"web_search":return"OpenSol wants to search the web.";case"read_url":return"OpenSol wants to read this public page.";default:return"OpenSol wants to use this tool."}}function XN({message:e,compact:i=!1}){const[a,r]=B.useState(!i&&e.status==="awaiting"||e.status==="error"),[o,u]=B.useState(!1),d=me(E=>E.notify),p=j9(e.status),h=Xw(e.call.name,e.call.args),g=e.call.args,x=KN(e),b=C9.has(e.call.name),y=typeof g.command=="string"?g.command:"",v=typeof g.content=="string"?g.content:typeof g.newText=="string"?g.newText:typeof g.oldText=="string"?g.oldText:"";B.useEffect(()=>{(e.status==="awaiting"||e.status==="error")&&r(!0)},[e.status]);const w=async()=>{try{await navigator.clipboard.writeText(e.result??""),u(!0),window.setTimeout(()=>u(!1),1600)}catch{d("Clipboard access was blocked by the browser.","error")}},T=e.status==="done"&&e.durationMs!==void 0?A9(e.durationMs):e.status==="done"?"":p.label.toLowerCase();return c.jsxs("div",{className:"animate-slideleft text-[12.5px]",children:[c.jsxs("button",{type:"button",onClick:()=>r(E=>!E),className:"group/row flex w-full min-w-0 items-baseline gap-1.5 py-[3px] text-left","aria-expanded":a,children:[c.jsx(pd,{size:12,strokeWidth:2,className:W("relative top-[1px] shrink-0 self-center text-faint transition-transform duration-200 ease-out group-hover/row:text-ink",a&&"rotate-90")}),c.jsx("span",{className:"shrink-0 font-medium text-ink",children:mg(e.call.name)}),c.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[11.5px] text-muted",children:h||"—"}),b&&x&&e.status==="done"?c.jsx(Pg,{added:x.added,removed:x.removed,line:x.line,column:x.column,className:"shrink-0"}):T&&c.jsx("span",{className:W("shrink-0 text-[11px]",e.status==="running"?"text-shimmer":e.status==="done"?"text-faint":p.className),children:T})]}),e.status==="awaiting"&&c.jsxs("div",{className:"animate-fade py-1 pl-[18px]",children:[c.jsx("p",{className:"text-[12px] leading-relaxed text-warning",children:O9(e.call.name)}),c.jsxs("p",{className:"mt-1 flex items-center gap-4 text-[12px] font-medium",children:[c.jsx("button",{type:"button",onClick:()=>Iv(e.call.id,!0),className:"text-ink underline decoration-ink/30 underline-offset-[3px] transition-colors hover:decoration-ink",children:"Allow once →"}),c.jsx("button",{type:"button",onClick:()=>Iv(e.call.id,!1),className:"text-muted transition-colors hover:text-ink",children:"Deny"})]})]}),a&&c.jsxs("div",{className:"animate-fade space-y-2 pb-1.5 pl-[18px] pt-0.5",children:[y&&c.jsxs("pre",{className:"thin-scroll max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-[11.5px] leading-relaxed text-ink",children:["$ ",y]}),e.call.name==="edit_file"&&typeof g.oldText=="string"&&typeof g.newText=="string"&&c.jsx(T9,{before:g.oldText,after:g.newText,startLine:x?.line??1}),v&&e.call.name!=="edit_file"&&c.jsx("pre",{className:"thin-scroll max-h-48 overflow-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed text-muted",children:v.length>4e3?`${v.slice(0,4e3)}
|
|
252
|
+
… ${v.length-4e3} more characters`:v}),e.result!==void 0&&c.jsxs("div",{children:[c.jsxs("p",{className:"mb-1 flex items-center gap-3 text-[11px] text-faint",children:[c.jsx("span",{children:e.status==="error"?"Error":"Output"}),c.jsx("button",{type:"button",onClick:w,className:"transition-colors hover:text-ink",children:o?"Copied":"Copy"})]}),c.jsx("pre",{className:W("thin-scroll max-h-72 overflow-auto whitespace-pre-wrap break-words font-mono text-[11.5px] leading-[1.65]",e.status==="error"?"text-danger":"text-muted"),children:e.result||"(no output)"})]}),e.result===void 0&&!y&&!v&&e.status!=="awaiting"&&c.jsx("p",{className:"text-[11.5px] text-muted",children:e.status==="running"?"Working…":"No result was recorded."})]})]})}function Jm(e){return e?e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e):""}function Wm({message:e,sessionId:i,canEdit:a}){const[r,o]=B.useState(!1),[u,d]=B.useState(e.content),p=()=>{const x=u.trim();if(!x)return;const b=Ve.getState().sessions.find(w=>w.id===i),y=b?.messages.findIndex(w=>w.id===e.id)??-1;if(!b||y<0)return;const v=Ui("msg");Ve.getState().updateSession(i,{messages:b.messages.slice(0,y)}),Ve.getState().addMessage(i,{...e,id:v,content:x,createdAt:Date.now()}),o(!1),fk(i,v)},h=(e.attachments??[]).filter(x=>x.kind==="image"),g=(e.attachments??[]).filter(x=>x.kind==="text");return r?c.jsx("div",{className:"flex justify-end",children:c.jsxs("div",{className:"w-full max-w-[88%] rounded-2xl border border-accent/40 bg-canvas p-2.5 sm:max-w-[82%]",children:[c.jsx("textarea",{value:u,onChange:x=>d(x.target.value),onKeyDown:x=>{x.key==="Enter"&&!x.shiftKey&&!x.nativeEvent.isComposing&&(x.preventDefault(),p()),x.key==="Escape"&&o(!1)},autoFocus:!0,rows:Math.min(10,Math.max(2,u.split(`
|
|
253
|
+
`).length)),className:"chat-text block w-full resize-none bg-transparent px-2 py-1 leading-[1.65] text-ink outline-none","aria-label":"Edit message"}),c.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2 px-1",children:[c.jsx("p",{className:"text-[11.5px] text-faint",children:"Sending replaces the reply below."}),c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx("button",{type:"button",onClick:()=>o(!1),className:"h-8 rounded-full px-3 text-[12.5px] text-muted transition-colors hover:text-ink",children:"Cancel"}),c.jsx("button",{type:"button",onClick:p,disabled:!u.trim(),className:"h-8 rounded-full bg-accent px-3.5 text-[12.5px] font-medium text-on-accent transition hover:brightness-110 disabled:opacity-40",children:"Send"})]})]})]})}):c.jsxs("div",{className:"group/user flex items-start justify-end gap-1.5",children:[a&&e.content&&c.jsx("button",{type:"button",onClick:()=>{d(e.content),o(!0)},className:"mt-2 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-lg text-faint opacity-0 transition hover:bg-raised hover:text-ink focus-visible:opacity-100 group-hover/user:opacity-100",title:"Edit and resend","aria-label":"Edit and resend message",children:c.jsx(Fo,{size:14,strokeWidth:1.7})}),c.jsxs("div",{className:"max-w-[88%] sm:max-w-[82%]",children:[h.length>0&&c.jsx("div",{className:W("mb-2 grid gap-2",h.length>1?"grid-cols-2":"grid-cols-1"),children:h.map(x=>c.jsx("img",{src:x.dataUrl,alt:x.name,className:"max-h-52 w-full rounded-xl border border-line object-cover"},x.id))}),c.jsxs("div",{className:"rounded-2xl rounded-br-md border border-line/70 bg-canvas px-4 py-2.5",children:[g.length>0&&c.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5",children:g.map(x=>c.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-md border border-line bg-panel px-2 py-1 text-[10.5px] text-muted",children:[c.jsx(Pn,{size:11}),c.jsx("span",{className:"max-w-[180px] truncate",children:x.name}),c.jsx("span",{className:"text-faint",children:xl(x.size)})]},x.id))}),e.content&&c.jsx("p",{className:"chat-text whitespace-pre-wrap break-words leading-[1.65] text-ink",children:e.content})]})]})]})}const ZN=new Set(["write_file","rewrite_file","edit_file"]);function Uv(e){const i=new Set;for(const a of e){if(a.status!=="done"||!ZN.has(a.call.name))continue;const r=a.call.args.path;typeof r=="string"&&r&&i.add(r)}return[...i]}function M9({turnId:e,files:i,diff:a}){const r=me(x=>x.askConfirm),o=me(x=>x.notify),[u,d]=B.useState("idle"),p=i.slice(0,2).join(", "),h=i.length-2,g=async()=>{if(await r({title:"Undo these file changes?",body:`${i.length===1?"This file goes":`These ${i.length} files go`} back to how ${i.length===1?"it was":"they were"} before this answer. Changes made through shell commands are not affected.`,confirmLabel:"Undo changes"})){d("working");try{const b=await Sj(e),y=[b.restored.length?`restored ${b.restored.length}`:"",b.removed.length?`removed ${b.removed.length}`:"",b.skipped.length?`${b.skipped.length} too large to restore`:""].filter(Boolean);o(`Undone: ${y.join(", ")||"nothing to change"}.`,"success"),d("undone"),await Be.getState().refresh().catch(()=>{})}catch(b){d("idle"),o(b instanceof Error?b.message:"Could not undo those changes.","error")}}};return c.jsxs("p",{className:"flex items-baseline gap-2 text-[12.5px] text-muted",children:[c.jsx("span",{className:"min-w-0 truncate",children:u==="undone"?"Changes undone":`Changed ${p}${h>0?` and ${h} more`:""}`}),u!=="undone"&&a&&c.jsx(Pg,{added:a.added,removed:a.removed,className:"shrink-0"}),u!=="undone"&&c.jsx("button",{type:"button",onClick:()=>{g()},disabled:u==="working",className:"shrink-0 font-medium text-ink underline decoration-ink/30 underline-offset-[3px] transition-colors hover:decoration-ink disabled:opacity-50",children:u==="working"?"Undoing…":"Undo"})]})}function R9({text:e}){const[i,a]=B.useState(!1);return c.jsxs("div",{children:[c.jsxs("button",{type:"button",onClick:()=>a(r=>!r),className:"group/think flex max-w-full items-baseline gap-1.5 py-0.5 text-left text-[12px]","aria-expanded":i,children:[c.jsx(pd,{size:11,strokeWidth:2,className:W("relative top-[1px] shrink-0 self-center text-faint transition-transform duration-200 ease-out",i&&"rotate-90")}),c.jsx("span",{className:"shrink-0 font-medium text-muted group-hover/think:text-ink",children:"Thought"}),!i&&c.jsx("span",{className:"min-w-0 truncate text-[11px] text-faint",children:e.replace(/\s+/g," ").trim().slice(0,100)})]}),i&&c.jsx("div",{className:"thin-scroll animate-fade max-h-40 overflow-y-auto whitespace-pre-wrap pl-[17px] font-mono text-[11px] leading-relaxed text-faint",children:e})]})}function QN(e){let i=0,a=0,r=!1;for(const o of e){if(!ZN.has(o.call.name))continue;const u=KN(o);u&&(r=!0,i+=u.added,a+=u.removed)}return r?{added:i,removed:a}:null}function D9({tools:e,intermediateMessages:i=[],streaming:a=!1}){const[r,o]=B.useState(!1),u=B.useRef(!1),d=Me(w=>w.autoCollapseWork),p=Me(w=>w.workDetail==="detailed"),h=e.some(w=>w.status==="awaiting"),g=a||e.some(w=>w.status==="running");if(B.useEffect(()=>{h?o(!0):g?(u.current=!0,o(!0)):u.current&&d&&(u.current=!1,o(!1))},[g,h,d]),e.length===0&&i.length===0)return null;const x=[...new Set(e.map(w=>mg(w.call.name)))],b=e.filter(w=>w.status==="error"||w.status==="denied").length,y=x.length<=3?x.join(" · "):`${x.slice(0,3).join(" · ")} +${x.length-3}`,v=[...e.map(w=>({kind:"tool",tool:w,time:w.createdAt})),...i.map(w=>({kind:"assistant",message:w,time:w.createdAt}))].sort((w,T)=>w.time-T.time);return c.jsxs("div",{className:"my-1",children:[c.jsxs("button",{type:"button",onClick:()=>{u.current=!1,o(w=>!w)},className:"group/task flex max-w-full items-baseline gap-1.5 py-0.5 text-left text-[13px]","aria-expanded":r,children:[c.jsx(pd,{size:13,strokeWidth:2,className:W("relative top-[1px] shrink-0 self-center text-faint transition-transform duration-200 ease-out group-hover/task:text-ink",r&&"rotate-90")}),c.jsx("span",{className:W("shrink-0 font-medium transition-colors",h?"text-warning":g?"text-shimmer":"text-ink/80 group-hover/task:text-ink"),children:h?"Action required":g?"Running task…":"Task completed"}),c.jsxs("span",{className:"min-w-0 truncate text-[12px] text-faint",children:[e.length>0&&`Used ${e.length} tool${e.length===1?"":"s"}`,y?` (${y})`:""]}),b>0&&c.jsxs("span",{className:"shrink-0 text-[12px] text-danger",children:["· ",b," failed"]}),(()=>{const w=QN(e);return w?c.jsx(Pg,{added:w.added,removed:w.removed,className:"shrink-0 text-[11.5px]"}):null})()]}),r&&c.jsx("div",{className:"animate-fade space-y-0.5 pb-1 pl-[19px] pt-1",children:v.map(w=>w.kind==="tool"?c.jsx(XN,{message:w.tool,compact:!p},w.tool.id):c.jsxs("div",{className:"py-1",children:[w.message.reasoning.trim()&&c.jsx(R9,{text:w.message.reasoning}),w.message.content.trim()&&c.jsx("div",{className:"mt-1 text-[12.5px] leading-relaxed text-muted",children:c.jsx(YN,{content:w.message.content})})]},w.message.id))})]})}function eh({message:e,sessionId:i,streaming:a,isLastAssistant:r,showHeader:o,turnUsage:u}){const d=me(z=>z.notify),p=me(z=>z.openSettings),h=Me(z=>z.showTokenEstimate),g=On(z=>e.provider?z.byProvider[e.provider]:void 0),[x,b]=B.useState(!1),[y,v]=B.useState(!1),w=!!(e.content.trim()||e.reasoning.trim()||e.error),T=g?.find(z=>z.id===e.model)?.name??e.model??"",E=!!(e.error&&/api key|base url|settings|credential|403|401/i.test(e.error)),N=[],j=u?.input||e.usage?.input,A=u?.output||e.usage?.output;j&&N.push(`${Jm(j)} in`),A?N.push(`${Jm(A)} out`):h&&e.content.trim()&&N.push(`~${Jm(Math.ceil(e.content.length/4))} out`);const R=[T,...N,e.durationMs?`${(e.durationMs/1e3).toFixed(1)}s`:""].filter(Boolean).join(" · "),$=async()=>{try{await navigator.clipboard.writeText(e.content),b(!0),window.setTimeout(()=>b(!1),1600)}catch{d("Clipboard access was blocked by the browser.","error")}};return!w&&!a?c.jsx("div",{className:"group",children:c.jsxs("div",{className:"min-w-0",children:[o&&c.jsxs("div",{className:"flex items-center gap-2 text-[12px] font-semibold text-ink",children:["OpenSol",T&&c.jsx("span",{className:"font-normal text-faint",children:T})]}),c.jsx("p",{className:"mt-2 text-[13px] text-muted",children:"The model returned an empty response."}),r&&c.jsxs("button",{type:"button",onClick:()=>Sm(i),className:"mt-2 inline-flex items-center gap-1.5 text-[11.5px] font-medium text-accent hover:underline",children:[c.jsx(Bi,{size:12})," Try again"]})]})}):c.jsx("div",{className:"group",children:c.jsxs("div",{className:"min-w-0",children:[(o||e.stopped)&&c.jsxs("div",{className:"flex min-h-[22px] items-center gap-1.5",children:[o&&c.jsxs(c.Fragment,{children:[c.jsx(bl,{size:15}),c.jsx("span",{className:"text-[12px] font-medium text-muted",children:"OpenSol"}),T&&c.jsx("span",{className:"truncate text-[11.5px] text-faint",children:T})]}),e.stopped&&c.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-line px-1.5 py-0.5 text-[9.5px] font-medium text-muted",children:[c.jsx(ig,{size:7,fill:"currentColor"}),"Stopped"]})]}),e.reasoning.trim()&&c.jsxs("div",{className:"mt-1",children:[c.jsxs("button",{type:"button",onClick:()=>v(z=>!z),className:"group/think flex max-w-full items-baseline gap-1.5 py-0.5 text-left text-[12.5px]","aria-expanded":y,children:[c.jsx(pd,{size:12,strokeWidth:2,className:W("relative top-[1px] shrink-0 self-center text-faint transition-transform duration-200 ease-out group-hover/think:text-ink",y&&"rotate-90")}),c.jsx("span",{className:W("shrink-0 font-medium",a?"text-shimmer":"text-muted group-hover/think:text-ink"),children:a?"Thinking…":"Thought"}),!y&&c.jsx("span",{className:"min-w-0 truncate text-[11.5px] text-faint",children:e.reasoning.replace(/\s+/g," ").trim().slice(0,120)})]}),y&&c.jsx("div",{className:"thin-scroll animate-fade max-h-72 overflow-y-auto whitespace-pre-wrap break-words py-1 pl-[18px] font-mono text-[11px] leading-[1.65] text-faint",children:e.reasoning})]}),e.content&&c.jsx("div",{className:"mt-1.5",children:c.jsx(YN,{content:e.content,streaming:a})}),a&&!e.content&&!e.reasoning&&c.jsxs("div",{className:"mt-2 flex items-center gap-2 text-[13px] text-muted",children:[c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx("span",{className:"h-1.5 w-1.5 animate-breathe rounded-full bg-accent"}),c.jsx("span",{className:"h-1.5 w-1.5 animate-breathe rounded-full bg-accent [animation-delay:160ms]"}),c.jsx("span",{className:"h-1.5 w-1.5 animate-breathe rounded-full bg-accent [animation-delay:320ms]"})]}),"Working"]}),e.error&&c.jsx("div",{className:"mt-3 rounded-xl border border-danger/25 bg-danger/[0.045] px-3.5 py-3",children:c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx(md,{size:15,className:"mt-0.5 shrink-0 text-danger"}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("p",{className:"text-[12px] font-medium text-ink",children:"The request did not finish"}),c.jsx("p",{className:"mt-1 whitespace-pre-wrap text-[11.5px] leading-relaxed text-muted",children:e.error}),c.jsxs("div",{className:"mt-2.5 flex flex-wrap items-center gap-2",children:[E&&c.jsxs("button",{type:"button",onClick:()=>p("models"),className:"inline-flex h-7 items-center gap-1.5 rounded-lg border border-line bg-panel px-2.5 text-[11.5px] font-medium text-ink hover:bg-raised",children:[c.jsx(fw,{size:12}),"Open model settings"]}),r&&c.jsxs("button",{type:"button",onClick:()=>Sm(i),className:"inline-flex h-7 items-center gap-1.5 rounded-lg border border-line bg-panel px-2.5 text-[11.5px] font-medium text-ink hover:bg-raised",children:[c.jsx(Bi,{size:12}),"Try again"]})]})]})]})}),w&&!a&&c.jsxs("div",{className:"mt-2 flex min-h-[28px] flex-wrap items-center gap-0.5 text-[11.5px] text-faint",children:[e.content&&c.jsx("button",{type:"button",onClick:$,className:"inline-flex h-7 w-7 items-center justify-center rounded-lg transition-colors hover:bg-raised hover:text-ink","aria-label":"Copy response",title:x?"Copied":"Copy",children:x?c.jsx(Cn,{size:14,className:"text-success"}):c.jsx(hd,{size:14,strokeWidth:1.7})}),r&&c.jsx("button",{type:"button",onClick:()=>Sm(i),className:"inline-flex h-7 w-7 items-center justify-center rounded-lg transition-colors hover:bg-raised hover:text-ink","aria-label":"Regenerate response",title:"Regenerate",children:c.jsx(Bi,{size:14,strokeWidth:1.7})}),c.jsx("span",{className:"ml-2 tabular-nums text-muted",children:R})]})]})})}function z9({turn:e,sessionId:i,streaming:a,lastAssistantId:r,activeTurn:o=!1}){const u=[],d=[];for(const y of e.segments)y.kind==="tools"?u.push(...y.tools):y.kind==="assistant"&&d.push(y.message);const p=u.length>0,h=d[0]?.id,g=d[d.length-1]??null;if(o&&p)return c.jsxs("div",{className:"flex flex-col gap-2.5",children:[e.user&&c.jsx(Wm,{message:e.user,sessionId:i,canEdit:!a}),e.segments.map((y,v)=>y.kind==="tools"?c.jsx("div",{className:"space-y-0.5",children:y.tools.map(w=>c.jsx(XN,{message:w},w.id))},`tools-${v}`):c.jsx(eh,{message:y.message,sessionId:i,streaming:a&&y.message.id===r,isLastAssistant:y.message.id===r,showHeader:y.message.id===h},y.message.id))]});if(!p){let y=0;return c.jsxs("div",{className:"flex flex-col gap-2.5",children:[e.user&&c.jsx(Wm,{message:e.user,sessionId:i,canEdit:!a}),d.map(v=>c.jsx(eh,{message:v,sessionId:i,streaming:a&&v.id===r,isLastAssistant:v.id===r,showHeader:y++===0},v.id))]})}const x=d.slice(0,-1),b=d.reduce((y,v)=>({input:y.input+(v.usage?.input??0),output:y.output+(v.usage?.output??0)}),{input:0,output:0});return c.jsxs("div",{className:"flex flex-col gap-2.5",children:[e.user&&c.jsx(Wm,{message:e.user,sessionId:i,canEdit:!a}),c.jsx(D9,{tools:u,intermediateMessages:x}),g&&c.jsx(eh,{message:g,sessionId:i,streaming:!1,isLastAssistant:g.id===r,showHeader:!0,turnUsage:b},g.id),e.user&&Uv(u).length>0&&c.jsx(M9,{turnId:e.user.id,files:Uv(u),diff:QN(u)})]})}const L9=[{value:"all",label:"All"},{value:"30d",label:"30d"},{value:"7d",label:"7d"}],I9=["bg-raised","bg-accent/20","bg-accent/35","bg-accent/55","bg-accent/80"];function U9(e,i){return e<=0?0:i<=1?2:Math.min(4,1+Math.floor(e/i*3))}function Zr({icon:e,label:i,value:a}){return c.jsxs("div",{className:"min-w-0 rounded-lg border border-line/70 bg-canvas px-3 py-2.5",children:[c.jsxs("p",{className:"flex items-center gap-1.5 text-[11.5px] text-muted",children:[c.jsx(e,{size:12,className:"shrink-0 text-faint"}),c.jsx("span",{className:"truncate",children:i})]}),c.jsx("p",{className:"mt-0.5 truncate text-[20px] font-semibold tracking-[-0.03em] text-ink",title:a,children:a})]})}function B9(){const e=Me(o=>o.daemon),i=Be(o=>o.info),r=(e?.home??"").split(/[\\/]/).filter(Boolean).pop()||i.name||"there";return c.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[c.jsxs("div",{className:"relative",children:[c.jsx("span",{className:"absolute inset-0 -z-10 m-auto h-16 w-16 rounded-full bg-accent/20 blur-2xl","aria-hidden":"true"}),c.jsx(vk,{mood:"wave",size:60})]}),c.jsxs("h1",{className:"text-[28px] font-semibold leading-tight tracking-[-0.035em] text-ink sm:text-[34px]",children:["What should we build, ",c.jsx("span",{className:"text-solar",children:r}),"?"]}),c.jsx("p",{className:"-mt-2 text-[13.5px] text-muted",children:"Local-first agent. Your folder, your keys, your machine."})]})}function $9(){const e=Ve(h=>h.sessions),[i,a]=B.useState("30d"),[r,o]=B.useState("overview"),u=B.useMemo(()=>EM(e,i),[e,i]),d=B.useMemo(()=>{const h=[];for(let g=0;g<u.heatmap.length;g+=7)h.push(u.heatmap.slice(g,g+7));return h},[u.heatmap]),p=u.models[0]?.tokens??0;return c.jsx("div",{className:"relative w-full",children:c.jsxs("section",{className:"relative overflow-hidden rounded-xl border border-line bg-panel",children:[c.jsxs("div",{className:"relative flex flex-wrap items-center justify-between gap-2 border-b border-line/70 px-3 py-2.5",children:[c.jsx("div",{className:"inline-flex items-center rounded-lg bg-raised p-0.5",children:["overview","models"].map(h=>c.jsx("button",{type:"button",onClick:()=>o(h),className:W("h-6 rounded-md px-2.5 text-[11.5px] font-medium capitalize transition-colors",r===h?"bg-panel text-ink shadow-pill":"text-muted hover:text-ink"),children:h},h))}),c.jsx("div",{className:"inline-flex items-center gap-0.5 rounded-lg bg-raised p-0.5",children:L9.map(h=>c.jsx("button",{type:"button",onClick:()=>a(h.value),className:W("h-6 rounded-md px-2.5 text-[11.5px] font-medium transition-colors",i===h.value?"bg-panel text-ink shadow-pill":"text-muted hover:text-ink"),children:h.label},h.value))})]}),r==="overview"?c.jsxs("div",{className:"relative p-3",children:[c.jsxs("div",{className:"grid grid-cols-2 gap-1.5 sm:grid-cols-3",children:[c.jsx(Zr,{icon:t2,label:"Sessions",value:String(u.sessions)}),c.jsx(Zr,{icon:cw,label:"Messages",value:String(u.messages)}),c.jsx(Zr,{icon:Wn,label:"Total tokens",value:u.tokens?jo(u.tokens):"0"}),c.jsx(Zr,{icon:D2,label:"Credits spent",value:A1(u.credits)}),c.jsx(Zr,{icon:x2,label:"Active days",value:String(u.activeDays)}),c.jsx(Zr,{icon:j2,label:"Peak hour",value:u.peakHour}),c.jsx(Zr,{icon:Yu,label:"Favorite model",value:Tm(u.favoriteModel)})]}),c.jsx("div",{className:"mt-3 overflow-x-auto",children:c.jsx("div",{className:"flex w-max gap-[3px]",children:d.map((h,g)=>c.jsx("div",{className:"grid grid-rows-7 gap-[3px]",children:h.map(x=>c.jsx("span",{className:W("h-[11px] w-[11px] rounded-[2px]",I9[U9(x.count,u.busiestDay)]),title:`${x.key} · ${x.count} message${x.count===1?"":"s"}`},x.key))},g))})}),c.jsxs("p",{className:"mt-2.5 text-[11px] leading-relaxed text-muted",children:[u.messages===0?"No activity in this range yet. Send a message to start the graph.":`You've used ~${jo(u.tokens)} tokens across ${u.messages} messages.`,u.credits>0&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"px-1.5 text-line",children:"·"}),A1(u.credits)," in provider credits"]}),u.favoriteModel!=="—"&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"px-1.5 text-line",children:"·"}),u.favoriteShare,"% on ",Tm(u.favoriteModel)]})]})]}):c.jsx("div",{className:"relative p-3",children:u.models.length===0?c.jsxs("div",{className:"rounded-xl border border-dashed border-line px-4 py-8 text-center",children:[c.jsx(Yu,{size:18,className:"mx-auto text-faint"}),c.jsx("p",{className:"mt-2 text-[12px] font-medium text-ink",children:"No model usage yet"}),c.jsx("p",{className:"mt-1 text-[11px] text-muted",children:"Models appear here after you send a message."})]}):c.jsx("div",{className:"space-y-2.5",children:u.models.slice(0,6).map(h=>c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[c.jsx("span",{className:"min-w-0 truncate text-[12px] font-medium text-ink",title:h.model,children:Tm(h.model)}),c.jsxs("span",{className:"shrink-0 text-[10.5px] tabular-nums text-faint",children:[jo(h.tokens)," · ",h.messages," msg"]})]}),c.jsx("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-raised",children:c.jsx("div",{className:"h-full rounded-full bg-accent/70",style:{width:`${p?Math.max(4,h.tokens/p*100):4}%`}})})]},h.model))})})]})})}function Bv(e){return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}function $v(e,i=180){const a=e.replace(/\s+/g," ").trim();return a.length>i?`${a.slice(0,i)}…`:a}function P9(e){switch(e.status){case"running":return{label:"Running",className:"text-accent",dot:"bg-accent animate-pulse"};case"awaiting":return{label:"Needs approval",className:"text-warning",dot:"bg-warning"};case"done":return{label:"Done",className:"text-success",dot:"bg-success"};case"denied":return{label:"Denied",className:"text-muted",dot:"bg-faint"};default:return{label:"Failed",className:"text-danger",dot:"bg-danger"}}}function H9({session:e}){const i=B.useMemo(()=>e.messages,[e.messages]),a=i.filter(r=>r.role==="tool").length;return i.length===0?c.jsx("div",{className:"flex h-full items-center justify-center px-6",children:c.jsxs("div",{className:"text-center",children:[c.jsx(Do,{size:20,className:"mx-auto text-faint"}),c.jsx("p",{className:"mt-2 text-[13px] font-medium text-ink",children:"No trajectory yet"}),c.jsx("p",{className:"mt-1 text-[11.5px] text-muted",children:"Send a message to see every step here."})]})}):c.jsx("div",{className:"thin-scroll h-full overflow-y-auto",children:c.jsxs("div",{className:"mx-auto w-full max-w-[800px] px-4 pb-12 pt-7 sm:px-6",children:[c.jsxs("div",{className:"mb-5 flex items-center justify-between gap-3 border-b border-line pb-3",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-[13px] font-medium text-ink",children:"Trajectory"}),c.jsxs("p",{className:"mt-0.5 text-[11px] text-muted",children:[i.length," step",i.length===1?"":"s"," · ",a," tool call",a===1?"":"s"]})]}),c.jsx("span",{className:"rounded-full border border-line px-2 py-0.5 text-[10px] text-faint",children:"Read-only view"})]}),c.jsxs("div",{className:"relative",children:[c.jsx("span",{className:"absolute bottom-3 left-[13px] top-3 w-px bg-line","aria-hidden":"true"}),c.jsx("div",{className:"space-y-4",children:i.map(r=>{if(r.role==="user")return c.jsxs("div",{className:"relative flex gap-3",children:[c.jsx("span",{className:"relative z-10 flex h-7 w-7 shrink-0 items-center justify-center rounded-full border border-line bg-panel text-muted",children:c.jsx(UC,{size:13})}),c.jsxs("div",{className:"min-w-0 flex-1 rounded-xl border border-line bg-panel px-3 py-2",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"text-[11.5px] font-medium text-ink",children:"You"}),c.jsx("span",{className:"text-[9.5px] tabular-nums text-faint",children:Bv(r.createdAt)})]}),c.jsx("p",{className:"mt-1 line-clamp-3 text-[12px] leading-relaxed text-muted",children:r.content||"Attachment only"})]})]},r.id);if(r.role==="assistant"){const h=!!(r.content.trim()||r.reasoning.trim());return c.jsxs("div",{className:"relative flex gap-3",children:[c.jsx("span",{className:"relative z-10 flex h-7 w-7 shrink-0 items-center justify-center rounded-full border border-line bg-panel",children:c.jsx(bl,{size:15})}),c.jsxs("div",{className:"min-w-0 flex-1 rounded-xl border border-line bg-panel px-3 py-2",children:[c.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[c.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[11.5px] font-medium text-ink",children:["OpenSol",r.model&&c.jsx("span",{className:"truncate text-[10px] font-normal text-faint",children:r.model})]}),c.jsxs("span",{className:"flex items-center gap-1.5 text-[9.5px] tabular-nums text-faint",children:[r.stopped&&c.jsx("span",{className:"text-muted",children:"Stopped"}),Bv(r.createdAt)]})]}),h?c.jsx("p",{className:"mt-1 line-clamp-4 whitespace-pre-wrap text-[12px] leading-relaxed text-muted",children:$v(r.content||r.reasoning)}):c.jsx("p",{className:"mt-1 text-[11px] italic text-faint",children:"Model turn with no text."}),r.error&&c.jsxs("p",{className:"mt-1.5 flex items-start gap-1.5 text-[11px] leading-relaxed text-danger",children:[c.jsx(md,{size:11,className:"mt-0.5 shrink-0"}),r.error]}),r.toolCalls.length>0&&c.jsxs("p",{className:"mt-1.5 text-[10px] text-faint",children:[r.toolCalls.length," tool call",r.toolCalls.length===1?"":"s"," in this round"]})]})]},r.id)}const o=P9(r),u=r.call.name==="shell",d=["read_file","write_file","edit_file","rewrite_file"].includes(r.call.name),p=u?pw:d?Pn:Do;return c.jsxs("div",{className:"relative flex gap-3",children:[c.jsx("span",{className:"relative z-10 flex h-7 w-7 shrink-0 items-center justify-center rounded-full border border-line bg-panel text-muted",children:c.jsx(p,{size:12})}),c.jsxs("div",{className:"min-w-0 flex-1 rounded-xl border border-line/80 bg-raised/25 px-3 py-2",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx("span",{className:"text-[11.5px] font-medium text-ink",children:mg(r.call.name)}),c.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[10.5px] text-muted",children:Xw(r.call.name,r.call.args)||"—"}),c.jsxs("span",{className:W("flex shrink-0 items-center gap-1 text-[10px] font-medium",o.className),children:[r.status==="done"?c.jsx(Cn,{size:10}):c.jsx("span",{className:W("h-1.5 w-1.5 rounded-full",o.dot)}),o.label,r.durationMs!==void 0&&r.status==="done"?` · ${r.durationMs<1e3?`${r.durationMs}ms`:`${(r.durationMs/1e3).toFixed(1)}s`}`:""]})]}),r.result&&c.jsx("p",{className:"mt-1.5 line-clamp-2 whitespace-pre-wrap break-words font-mono text-[10.5px] leading-relaxed text-faint",children:$v(r.result,160)})]})]},r.id)})})]}),c.jsxs("p",{className:"mt-6 flex items-center justify-center gap-1 text-[10px] text-faint",children:["End of trajectory ",c.jsx(nw,{size:10})]})]})})}const F9=[{icon:gT,label:"Build a game",prompt:"Build a small browser game as one self-contained index.html (canvas, no build step). Make it playable with keyboard and touch, with a score and a restart button. Put the whole file in a single html code block so I can preview it."},{icon:ST,label:"Design a landing page",prompt:"Design a polished, responsive landing page for a small indie game studio. Choose a distinctive typographic style, keep it to one file, and put everything in a single html code block so I can preview it."},{icon:h2,label:"Trace a bug",prompt:"Inspect this workspace for a real bug. Explain the root cause, make the smallest correct fix, and run the project checks."},{icon:fT,label:"Audit this folder",prompt:"Audit this workspace. Read the key files first, then list the three most important improvements with file references and a short plan."},{icon:lT,label:"Write tests",prompt:"Find the least-tested, highest-risk module in this workspace, write focused tests for it, run them, and fix anything they reveal."},{icon:ss,label:"Research with sources",prompt:"Search the web for the current release notes of the main framework in this project, then summarise what matters and cite the pages you read."}];function q9(){const e=Ve(ce=>ce.sessions),i=Ve(ce=>ce.activeId),a=e.find(ce=>ce.id===i)??null,r=Ra(ce=>i?!!ce.streaming[i]:!1),o=Me(),u=Me(ce=>ce.setMode),d=Me(ce=>ce.update),p=me(ce=>ce.notify),h=me(ce=>ce.openSettings),g=me(ce=>ce.focusComposer),x=me(ce=>ce.setWorkspaceOpen),b=me(ce=>ce.setDeployOpen),y=me(ce=>ce.askConfirm),v=Be(ce=>ce.info),w=Be(ce=>ce.git),T=Ad(),[E,N]=B.useState(""),[j,A]=B.useState("chat"),R=B.useRef(null),[$,z]=B.useState(!0),C=B.useRef(i),L=B.useRef(null),q=a?.messages??[],M=q[q.length-1],H=[...q].reverse().find(ce=>ce.role==="assistant")?.id,Z=hl(o),he=ui(o),se=o.skills.filter(ce=>ce.enabled).length,ae=TM(q),O=lk(q,T),ee=vM(q,r),te=(ce="auto")=>{const D=R.current;D&&D.scrollTo({top:D.scrollHeight,behavior:ce})};B.useEffect(()=>{if(C.current!==i){C.current=i,z(!0),A("chat"),requestAnimationFrame(()=>te("auto"));const ce=Ve.getState().sessions.find(D=>D.id===i);ce?.mode&&u(ce.mode)}},[i,u]),B.useEffect(()=>{M&&(M.id!==L.current?(L.current=M.id,M.role==="user"?(z(!0),requestAnimationFrame(()=>te("auto"))):$&&requestAnimationFrame(()=>te("auto"))):$&&te("auto"))},[M,$]),B.useEffect(()=>{if(!$)return;const ce=window.setTimeout(()=>te("auto"),40);return()=>window.clearTimeout(ce)},[q,$]);const be=async(ce,D)=>{const U=Me.getState();if(!hl(U))return p(U.provider==="custom"?"Add a base URL for your custom endpoint in Settings → Models.":`Add an API key for ${sg(U.provider)} in Settings → Models.`,"error"),h("models"),!1;const re=ui(U);if(!re)return p("Choose a model before sending a message.","error"),h("models"),!1;let ge=i;(!ge||!Ve.getState().sessions.some(de=>de.id===ge))&&(ge=Ve.getState().createSession(U.provider,re,U.mode));const _e=ce.trim(),Ue=Ui("msg");return Ve.getState().addMessage(ge,{id:Ue,role:"user",content:_e,attachments:D.length>0?D:void 0,createdAt:Date.now()}),Ve.getState().updateSession(ge,{mode:U.mode}),N(""),z(!0),fk(ge,Ue),!0},S=ce=>{N(ce),g()},ve=async(ce,D)=>{switch(ce){case"search":return D.trim()?(d({webSearchEnabled:!0}),be(`Use the web to research this: ${D.trim()}
|
|
254
|
+
|
|
255
|
+
Read the most useful sources, cite the URLs you actually opened, and answer for this workspace.`,[])):(N("/search "),p("Type what you want OpenSol to research.","info"),g(),!1);case"plan":return u("plan"),D.trim()?be(D.trim(),[]):(p("Plan mode is on: investigation only until you switch to Build.","info"),g(),!0);case"build":return u("build"),D.trim()?be(D.trim(),[]):(p("Build mode is on: OpenSol can edit files and run commands.","info"),g(),!0);case"new":return Ve.getState().newChat(),g(),!0;case"workspace":return x(!0),!0;case"deploy":return b(!0),!0;case"settings":return h("models"),!0;case"clear":{const U=Ve.getState().sessions.find(ge=>ge.id===i);return!U||U.messages.length===0||!await y({title:"Clear this conversation?",body:"The messages in this conversation will be removed from your local history. The workspace files are not touched.",confirmLabel:"Clear conversation",tone:"danger"})||(nd(U.id),Ve.getState().updateSession(U.id,{messages:[]}),Ve.getState().updateSession(U.id,{title:"New conversation"}),p("Conversation cleared.","success")),!0}default:return!1}};return c.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col bg-panel",children:[c.jsx(LM,{session:a,view:j,onViewChange:A}),!a||q.length===0?c.jsxs("div",{className:"thin-scroll relative min-h-0 flex-1 overflow-y-auto",children:[c.jsx("div",{className:"hero-wash pointer-events-none absolute inset-0","aria-hidden":"true"}),c.jsx("div",{className:"bg-dots pointer-events-none absolute inset-0 opacity-70","aria-hidden":"true"}),c.jsxs("div",{className:"relative mx-auto flex min-h-full w-full max-w-[720px] flex-col justify-center px-4 py-10 sm:px-6",children:[c.jsx("div",{className:"animate-blurin",children:c.jsx(B9,{})}),c.jsxs("div",{className:"mt-8 w-full animate-rise [animation-delay:120ms]",children:[(!Z||!he)&&c.jsxs("button",{type:"button",onClick:()=>h("models"),className:"mb-3 flex w-full items-center gap-2 rounded-xl border border-accent/30 bg-accent-soft px-4 py-2.5 text-left text-[12.5px] font-medium text-accent transition-all hover:border-accent/50",children:[c.jsx(Ho,{size:14,className:"shrink-0"}),c.jsx("span",{className:"flex-1",children:Z?"Choose a model to start":"Connect a provider to start"}),c.jsx("span",{className:"text-[11px] font-normal opacity-70",children:"Open settings →"})]}),c.jsx(z1,{value:E,onChange:N,onSend:be,onStop:()=>{},onCommand:ve,streaming:!1,hints:!0,autoFocus:!0,placeholder:Z?"How can I help you today?":"Add a provider key to start",pixleMood:Z?"idle":"sleepy"}),c.jsx("div",{className:"stagger mt-5 grid grid-cols-2 gap-2 sm:grid-cols-3",children:F9.slice(0,6).map(ce=>c.jsxs("button",{type:"button",onClick:()=>S(ce.prompt),className:"card-lift group/starter flex items-center gap-2.5 rounded-xl border border-line bg-panel px-3 py-2.5 text-left text-[12.5px] font-medium text-muted hover:text-ink",children:[c.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-raised text-faint transition-colors duration-200 group-hover/starter:bg-accent-soft group-hover/starter:text-accent",children:c.jsx(ce.icon,{size:14,strokeWidth:1.8})}),c.jsx("span",{className:"min-w-0 truncate",children:ce.label})]},ce.label))}),c.jsxs("div",{className:"mt-2.5 flex items-center justify-center gap-3 px-1 text-[11px] text-faint",children:[c.jsxs("span",{className:"truncate",children:[v.available?v.name:"No folder open",v.available&&w.available&&w.branch?` · ${w.branch}`:""]}),c.jsx("span",{"aria-hidden":"true",children:"·"}),c.jsxs("span",{className:"shrink-0",children:[se," skill",se===1?"":"s"," ·"," ",Z?he?"Ready":"Model needed":"Provider needed"]})]})]}),c.jsx("div",{className:"mt-10 animate-rise [animation-delay:420ms]",children:c.jsx($9,{})})]})]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"relative min-h-0 flex-1",children:j==="trajectory"?c.jsx(H9,{session:a}):c.jsxs(c.Fragment,{children:[c.jsx("div",{ref:R,onScroll:ce=>{const D=ce.currentTarget,U=D.scrollHeight-D.scrollTop-D.clientHeight;z(U<90)},className:"thin-scroll h-full overflow-y-auto",children:c.jsx("div",{className:"mx-auto w-full max-w-[760px] px-4 pb-12 pt-8 sm:px-6 sm:pt-10",children:ae.map((ce,D)=>c.jsx("div",{className:D===0?"animate-rise":"mt-10 animate-rise",children:c.jsx(z9,{turn:ce,sessionId:a.id,streaming:r,lastAssistantId:H,activeTurn:r&&D===ae.length-1})},ce.id))})}),!$&&c.jsx("button",{type:"button",onClick:()=>{z(!0),te("smooth")},className:"surface-lift absolute bottom-4 left-1/2 -translate-x-1/2 animate-scalein rounded-full border border-line px-3.5 py-1.5 text-[11.5px] font-medium text-muted shadow-composer transition-colors hover:text-ink",children:c.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[c.jsx(c2,{size:11}),"Jump to latest"]})})]})}),c.jsx("div",{className:"shrink-0 bg-panel px-3 pb-3 pt-1 sm:px-6 sm:pb-4",children:c.jsxs("div",{className:"mx-auto w-full max-w-[760px]",children:[c.jsx(z1,{value:E,onChange:N,onSend:be,onStop:()=>a&&nd(a.id),onCommand:ve,streaming:r,placeholder:Z?"How can I help you today?":"Add a provider key to start",contextPct:O.pct,contextTitle:`Context: ~${jo(O.used)} / ${jo(O.limit)} tokens`,pixleMood:ee}),c.jsxs("div",{className:"mt-2 flex items-center justify-between gap-3 px-2 text-[11px] text-faint",children:[c.jsxs("span",{className:"flex items-center gap-1",children:[o.mode==="plan"?c.jsx(Zh,{size:10}):c.jsx(Wn,{size:10}),o.mode==="plan"?"Plan mode · read-only tools":se>0?`${se} skill${se===1?"":"s"} loaded`:"Build mode · full tools"]}),c.jsx("span",{className:"hidden sm:inline",children:v.available?`Working in ${v.name}`:"No workspace open"}),c.jsx("span",{className:"sm:hidden",children:o.tools.shell.approval==="ask"?"Shell asks first":"Shell auto-runs"})]})]})})]})]})}const Pv=[{id:"desktop",label:"Desktop",icon:Jh,width:"100%"},{id:"tablet",label:"Tablet",icon:TC,width:"768px"},{id:"phone",label:"Phone",icon:wC,width:"390px"}];function G9(e){return e.includes("index.html")?"index.html":[...e].sort((i,a)=>i.split("/").length-a.split("/").length||i.localeCompare(a))[0]??""}function Y9(){const e=Be(N=>N.entries),[i,a]=B.useState(""),[r,o]=B.useState(""),[u,d]=B.useState(""),[p,h]=B.useState("desktop"),[g,x]=B.useState(0),b=B.useMemo(()=>e.filter(N=>N.type==="file"&&/\.html?$/i.test(N.path)).map(N=>N.path),[e]),y=B.useMemo(()=>{const N=e.filter(j=>j.type==="file");return`${N.length}-${N.reduce((j,A)=>Math.max(j,A.mtime),0)}`},[e]),v=b.includes(u)?u:G9(b),w=B.useCallback(async()=>{o("");try{a((await Ej()).token)}catch(N){a(""),o(N instanceof Error?N.message:"Could not start the preview.")}},[]);B.useEffect(()=>{w()},[w]);const T=i&&v?`/preview/${i}/${encodeURI(v)}?v=${y}.${g}`:"",E=Pv.find(N=>N.id===p)?.width??"100%";return b.length===0?c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-2 px-8 text-center",children:[c.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-raised text-faint",children:c.jsx(Jh,{size:18})}),c.jsx("p",{className:"text-[13px] font-medium text-ink",children:"Nothing to preview yet"}),c.jsx("p",{className:"max-w-[260px] text-[11.5px] leading-relaxed text-muted",children:"Ask OpenSol to build a page or a game. The first HTML file it writes shows up here and reloads as it changes."})]}):c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[c.jsxs("div",{className:"flex shrink-0 items-center gap-1.5 border-b border-line px-2.5 py-2",children:[c.jsx("select",{value:v,onChange:N=>d(N.target.value),className:"h-8 min-w-0 flex-1 truncate rounded-lg border border-line bg-transparent px-2 font-mono text-[11.5px] text-ink outline-none focus:border-accent/50","aria-label":"Page to preview",children:b.map(N=>c.jsx("option",{value:N,children:N},N))}),c.jsx("div",{className:"flex items-center rounded-lg bg-raised/70 p-0.5",children:Pv.map(N=>c.jsx("button",{type:"button",onClick:()=>h(N.id),"aria-pressed":p===N.id,title:N.label,"aria-label":N.label,className:W("flex h-7 w-7 items-center justify-center rounded-md transition-colors",p===N.id?"bg-panel text-ink shadow-pill":"text-muted hover:text-ink"),children:c.jsx(N.icon,{size:14,strokeWidth:1.7})},N.id))}),c.jsx("button",{type:"button",className:"icon-button h-8 w-8",onClick:()=>{w(),x(N=>N+1)},title:"Reload preview","aria-label":"Reload preview",children:c.jsx(Bi,{size:14,strokeWidth:1.7})}),c.jsx("button",{type:"button",className:"icon-button h-8 w-8",disabled:!T,onClick:()=>window.open(T,"_blank","noopener"),title:"Open in a new tab","aria-label":"Open in a new tab",children:c.jsx(Vu,{size:14,strokeWidth:1.7})})]}),c.jsxs("div",{className:"relative min-h-0 flex-1 overflow-auto bg-raised/40 p-2",children:[r&&c.jsxs("div",{className:"mx-auto mt-6 max-w-[300px] rounded-xl border border-danger/25 bg-danger/[0.05] px-3.5 py-3 text-center",children:[c.jsx("p",{className:"text-[12px] font-medium text-ink",children:"The preview could not start"}),c.jsx("p",{className:"mt-1 text-[11.5px] leading-relaxed text-muted",children:r}),c.jsx("button",{type:"button",onClick:()=>{w()},className:"mt-2 text-[11.5px] font-medium text-accent hover:underline",children:"Try again"})]}),!r&&!T&&c.jsxs("p",{className:"flex items-center justify-center gap-2 py-8 text-[11.5px] text-faint",children:[c.jsx(Pt,{size:12})," Starting preview…"]}),T&&c.jsx("iframe",{title:`Preview of ${v}`,src:T,sandbox:"allow-scripts allow-forms allow-modals allow-popups allow-pointer-lock",className:"mx-auto block h-full min-h-[320px] max-w-full rounded-lg border border-line bg-white shadow-pill",style:{width:E}},`${v}-${g}`)]}),c.jsx("p",{className:"shrink-0 border-t border-line px-3 py-1.5 text-[11px] text-faint",children:"Runs in a sandbox: it can load your files and public CDNs, but cannot reach OpenSol or your keys."})]})}function Hv(e){return e.messages.filter(i=>i.role==="user").length}function V9(e){const i=new Set;for(const a of e.messages){if(a.role!=="tool"||a.status!=="done"||!["write_file","edit_file","rewrite_file"].includes(a.call.name))continue;const r=a.call.args.path;typeof r=="string"&&i.add(r)}return i.size}function K9(){const e=Ve(C=>C.sessions),i=Ve(C=>C.activeId),a=Ve(C=>C.setActive),r=Ve(C=>C.newChat),o=Ve(C=>C.renameSession),u=Ve(C=>C.deleteSession),d=Be(C=>C.info.root),p=Ra(C=>C.streaming),h=Ra(C=>C.titling),g=me(C=>C.askConfirm),x=me(C=>C.notify),b=me(C=>C.focusComposer),[y,v]=B.useState("workspace"),[w,T]=B.useState(null),[E,N]=B.useState(""),j=B.useMemo(()=>[...y==="all"?e:e.filter(L=>L.workspace===d)].sort((L,q)=>q.updatedAt-L.updatedAt),[e,y,d]),A=e.filter(C=>!C.workspace).length,R=()=>{w&&E.trim()&&o(w,E),T(null)},$=async C=>{await g({title:"Delete this session?",body:`“${C.title}” and its messages will be removed from this computer. This cannot be undone.`,confirmLabel:"Delete session",tone:"danger"})&&(nd(C.id),u(C.id))},z=async C=>{await Yt.titles?.generate(C,{force:!0})||x("The model could not suggest a title right now.","error")};return c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[c.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-line px-3 py-2.5",children:[c.jsx("div",{className:"relative flex rounded-full bg-raised p-0.5 text-[10.5px] font-medium",children:["workspace","all"].map(C=>c.jsx("button",{type:"button",onClick:()=>v(C),className:W("relative z-10 rounded-full px-2.5 py-1 transition-colors",y===C?"bg-panel text-ink shadow-pill":"text-muted hover:text-ink"),children:C==="workspace"?"This workspace":`All · ${e.length}`},C))}),c.jsxs("button",{type:"button",onClick:()=>{r(),b()},className:"ml-auto inline-flex h-7 items-center gap-1 rounded-full bg-ink px-2.5 text-[10.5px] font-medium text-panel transition-transform active:scale-95",children:[c.jsx(ns,{size:12})," New"]})]}),c.jsx("div",{className:"thin-scroll min-h-0 flex-1 overflow-y-auto p-2",children:j.length===0?c.jsxs("div",{className:"px-4 py-10 text-center",children:[c.jsx($T,{size:22,className:"mx-auto text-faint"}),c.jsx("p",{className:"mt-2 text-[12px] font-medium text-ink",children:"No sessions here yet"}),c.jsx("p",{className:"mt-1 text-[10.5px] leading-relaxed text-faint",children:y==="workspace"&&A>0?`${A} older session${A===1?"":"s"} were started before workspaces were tracked. Switch to “All” to see them.`:"Start a conversation and it shows up here."})]}):j.map((C,L)=>{const q=!!p[C.id],M=V9(C);return c.jsxs("div",{style:{animationDelay:`${Math.min(L*30,300)}ms`},className:W("session-card group/session animate-slideleft mb-1.5 rounded-xl border px-3 py-2.5 transition-all duration-200",i===C.id?"border-accent/40 bg-accent-soft/60":"border-transparent hover:border-line hover:bg-raised/60"),children:[w===C.id?c.jsx("input",{autoFocus:!0,value:E,onChange:H=>N(H.target.value),onBlur:R,onKeyDown:H=>{H.key==="Enter"&&R(),H.key==="Escape"&&T(null)},className:"h-7 w-full rounded-md border border-accent/50 bg-panel px-2 text-[12px] text-ink outline-none","aria-label":"Rename session"}):c.jsxs("button",{type:"button",onClick:()=>a(C.id),className:"block w-full text-left",children:[c.jsxs("span",{className:"flex items-center gap-2",children:[i===C.id&&c.jsx(Cn,{size:12,className:"shrink-0 text-accent"}),c.jsx("span",{className:W("min-w-0 flex-1 truncate text-[12.5px] font-medium text-ink",h[C.id]&&"text-shimmer"),children:C.title}),q&&c.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-[10px] font-medium text-accent",children:[c.jsx("span",{className:"h-1.5 w-1.5 animate-breathe rounded-full bg-accent"})," running"]})]}),c.jsxs("span",{className:"mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[10px] text-faint",children:[c.jsx("span",{children:id(C.updatedAt)}),c.jsxs("span",{children:["· ",Hv(C)," turn",Hv(C)===1?"":"s"]}),M>0&&c.jsxs("span",{children:["· ",M," file",M===1?"":"s"," edited"]}),C.model&&c.jsxs("span",{className:"max-w-[120px] truncate font-mono",children:["· ",C.model]}),C.titleSource==="ai"&&c.jsxs("span",{className:"inline-flex items-center gap-0.5 text-accent/80",children:[c.jsx(Wn,{size:9})," AI title"]})]})]}),c.jsxs("div",{className:"mt-1.5 flex items-center gap-0.5 opacity-0 transition-opacity group-hover/session:opacity-100 focus-within:opacity-100",children:[c.jsx("button",{type:"button",className:"icon-button h-6 w-6",onClick:()=>{T(C.id),N(C.title)},title:"Rename","aria-label":"Rename session",children:c.jsx(Fo,{size:11})}),c.jsx("button",{type:"button",className:"icon-button h-6 w-6",onClick:()=>{z(C.id)},disabled:!!h[C.id]||C.messages.length===0,title:"Let the model name this session","aria-label":"Name session with AI",children:c.jsx(Wn,{size:11})}),c.jsx("button",{type:"button",className:"icon-button h-6 w-6 hover:!text-danger",onClick:()=>{$(C)},title:"Delete","aria-label":"Delete session",children:c.jsx(la,{size:11})})]})]},C.id)})})]})}const X9={ts:{icon:Qn,tone:"text-sky-500"},tsx:{icon:Qn,tone:"text-sky-500"},js:{icon:Qn,tone:"text-amber-400"},jsx:{icon:Qn,tone:"text-amber-400"},mjs:{icon:Qn,tone:"text-amber-400"},cjs:{icon:Qn,tone:"text-amber-400"},rs:{icon:Qn,tone:"text-orange-400"},go:{icon:Qn,tone:"text-cyan-400"},py:{icon:Qn,tone:"text-emerald-400"},rb:{icon:Qn,tone:"text-rose-400"},java:{icon:Qn,tone:"text-red-400"},css:{icon:ll,tone:"text-fuchsia-400"},scss:{icon:ll,tone:"text-pink-400"},sass:{icon:ll,tone:"text-pink-400"},less:{icon:ll,tone:"text-pink-400"},html:{icon:Qn,tone:"text-orange-500"},vue:{icon:Qn,tone:"text-emerald-500"},svelte:{icon:Qn,tone:"text-orange-500"},json:{icon:ah,tone:"text-yellow-500"},jsonc:{icon:ah,tone:"text-yellow-500"},yaml:{icon:Wr,tone:"text-teal-400"},yml:{icon:Wr,tone:"text-teal-400"},toml:{icon:Wr,tone:"text-teal-400"},ini:{icon:Wr,tone:"text-teal-400"},env:{icon:aw,tone:"text-amber-500"},md:{icon:Pn,tone:"text-violet-400"},mdx:{icon:Pn,tone:"text-violet-400"},txt:{icon:Pn,tone:"text-slate-400"},csv:{icon:Pn,tone:"text-emerald-400"},svg:{icon:Vr,tone:"text-purple-400"},png:{icon:Vr,tone:"text-purple-400"},jpg:{icon:Vr,tone:"text-purple-400"},jpeg:{icon:Vr,tone:"text-purple-400"},gif:{icon:Vr,tone:"text-purple-400"},webp:{icon:Vr,tone:"text-purple-400"},ico:{icon:Vr,tone:"text-purple-400"},mp3:{icon:a1,tone:"text-rose-400"},wav:{icon:a1,tone:"text-rose-400"},mp4:{icon:l1,tone:"text-rose-400"},mov:{icon:l1,tone:"text-rose-400"},zip:{icon:mm,tone:"text-amber-500"},gz:{icon:mm,tone:"text-amber-500"},tar:{icon:mm,tone:"text-amber-500"},lock:{icon:Q2,tone:"text-slate-400"},sh:{icon:cl,tone:"text-emerald-400"},bash:{icon:cl,tone:"text-emerald-400"},zsh:{icon:cl,tone:"text-emerald-400"},sql:{icon:Pn,tone:"text-cyan-400"}},Z9=[{match:/^(dockerfile|makefile|justfile)$/i,icon:Wr,tone:"text-sky-400"},{match:/^\.env/i,icon:aw,tone:"text-amber-500"},{match:/^(\.gitignore|\.gitattributes|\.npmignore|\.dockerignore)$/i,icon:Wr,tone:"text-slate-400"},{match:/^package(-lock)?\.json$/i,icon:ah,tone:"text-emerald-400"},{match:/^(vite|webpack|rollup|tsconfig|tailwind|postcss)\./i,icon:Wr,tone:"text-sky-400"},{match:/^readme/i,icon:Pn,tone:"text-violet-400"},{match:/^skill\.md$/i,icon:Pn,tone:"text-accent"}];function Q9(e){const i=e.split("/").pop()??e,a=Z9.find(o=>o.match.test(i));if(a)return{icon:a.icon,tone:a.tone};const r=/\.([a-z0-9]+)$/i.exec(i)?.[1]?.toLowerCase()??"";return X9[r]??{icon:Pn,tone:"text-faint"}}function th({path:e,type:i="file",open:a=!1,size:r=13,className:o}){if(i==="dir"){const p=a?ls:Ro;return c.jsx(p,{size:r,className:W("shrink-0 fill-amber-400/25 text-amber-500",o)})}const{icon:u,tone:d}=Q9(e);return c.jsx(u,{size:r,className:W("shrink-0",d,o)})}function J9(e){const i=new Map;for(const u of e)i.set(u.path,{entry:u,children:[]});const a=[],r=[...e].sort((u,d)=>u.path.split("/").length-d.path.split("/").length);for(const u of r){const d=i.get(u.path);if(!d)continue;const p=u.path.lastIndexOf("/"),h=p===-1?null:i.get(u.path.slice(0,p));h?h.children.push(d):a.push(d)}const o=u=>{u.sort((d,p)=>d.entry.type===p.entry.type?d.entry.name.localeCompare(p.entry.name):d.entry.type==="dir"?-1:1),u.forEach(d=>o(d.children))};return o(a),a}function W9(e){const i=/\.([a-z0-9]+)$/i.exec(e);return i?i[1].toUpperCase():"TEXT"}function eI({onDone:e}){const i=Be(R=>R.addWorkspace),a=Be(R=>R.info.workspaces),r=me(R=>R.notify),[o,u]=B.useState(""),[d,p]=B.useState(""),[h,g]=B.useState(""),[x,b]=B.useState([]),[y,v]=B.useState(!0),[w,T]=B.useState(""),[E,N]=B.useState(!1),j=async R=>{v(!0),T("");try{const $=await yj(R);u($.path),p($.parent),g($.home),b($.entries)}catch($){T($ instanceof Error?$.message:"Could not read that folder.")}finally{v(!1)}};B.useEffect(()=>{j("")},[]);const A=async R=>{N(!0);try{await i(R),e?.()}catch($){r($ instanceof Error?$.message:"Could not open that folder.","error")}finally{N(!1)}};return c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[c.jsxs("div",{className:"border-b border-line px-4 py-4",children:[c.jsx("p",{className:"font-display text-[19px] font-semibold tracking-[-0.02em] text-ink",children:"Choose a real folder"}),c.jsx("p",{className:"mt-1 text-[11.5px] leading-relaxed text-muted",children:"OpenSol works directly in this folder through the local daemon. Nothing is uploaded."})]}),c.jsxs("div",{className:"flex items-center gap-1.5 border-b border-line px-3 py-2",children:[c.jsx("button",{type:"button",className:"icon-button h-7 w-7",onClick:()=>{j(d)},disabled:!d||y,"aria-label":"Parent folder",children:c.jsx(a2,{size:13})}),c.jsx("button",{type:"button",className:"icon-button h-7 w-7",onClick:()=>{j(h)},disabled:!h||y,"aria-label":"Home folder",children:c.jsx(gd,{size:13})}),c.jsx("p",{className:"min-w-0 flex-1 truncate font-mono text-[10px] text-muted",title:o,children:o||"Home"}),y&&c.jsx(Pt,{size:12}),c.jsxs("button",{type:"button",onClick:()=>{A(o)},disabled:!o||E,className:"inline-flex h-7 items-center gap-1 rounded-lg bg-ink px-2.5 text-[10.5px] font-medium text-panel disabled:opacity-40",children:[E?c.jsx(Pt,{size:11}):c.jsx(Cn,{size:11}),"Open"]})]}),a.length>0&&c.jsxs("div",{className:"border-b border-line px-3 py-2",children:[c.jsx("p",{className:"mb-1.5 text-[9px] font-semibold uppercase tracking-[0.13em] text-faint",children:"Recent"}),c.jsx("div",{className:"flex flex-wrap gap-1",children:a.slice(0,6).map(R=>c.jsx("button",{type:"button",onClick:()=>{A(R.path)},className:"max-w-full truncate rounded-md border border-line bg-raised/60 px-2 py-1 text-left text-[10px] text-muted hover:text-ink",title:R.path,children:R.name},R.path))})]}),c.jsxs("div",{className:"thin-scroll min-h-0 flex-1 overflow-y-auto px-2 py-2",children:[w&&c.jsx("p",{className:"px-2 py-3 text-[11px] text-danger",children:w}),!y&&!w&&x.length===0&&c.jsx("p",{className:"px-2 py-4 text-[11px] text-faint",children:"This folder has no subfolders."}),x.map(R=>c.jsxs("div",{className:"group flex items-center gap-1",children:[c.jsxs("button",{type:"button",onClick:()=>{j(R.path)},className:"flex h-8 min-w-0 flex-1 items-center gap-2 rounded-md px-2 text-left text-[11.5px] text-muted transition-colors hover:bg-raised hover:text-ink",children:[c.jsx(Ro,{size:13,className:"shrink-0 text-faint"}),c.jsx("span",{className:"truncate",children:R.name})]}),c.jsx("button",{type:"button",onClick:()=>{A(R.path)},className:"hidden h-7 rounded-md px-2 text-[10px] font-medium text-accent group-hover:block",children:"Use"})]},R.path))]})]})}function tI(){const e=me(ne=>ne.workspaceOpen),i=me(ne=>ne.setWorkspaceOpen),a=me(ne=>ne.notify),r=me(ne=>ne.askConfirm),o=Be(ne=>ne.info),u=Be(ne=>ne.root),d=Be(ne=>ne.entries),p=Be(ne=>ne.loadingTree),h=Be(ne=>ne.treeError),g=Be(ne=>ne.activeFile),x=Be(ne=>ne.file),b=Be(ne=>ne.content),y=Be(ne=>ne.dirty),v=Be(ne=>ne.saving),w=Be(ne=>ne.openingFile),T=Be(ne=>ne.git),E=Be(ne=>ne.gitLoading),N=Be(ne=>ne.setActiveFile),j=Be(ne=>ne.saveFile),A=Be(ne=>ne.setContent),R=Be(ne=>ne.createEntry),$=Be(ne=>ne.renameEntry),z=Be(ne=>ne.deleteEntry),C=Be(ne=>ne.forgetWorkspace),L=Be(ne=>ne.loadGit),q=Be(ne=>ne.refresh),[M,H]=B.useState(""),[Z,he]=B.useState(new Set),se=Ve(ne=>ne.sessions.length),[ae,O]=B.useState("files"),[ee,te]=B.useState(!o.available),[be,S]=B.useState(null),[ve,ce]=B.useState(!1),D=B.useRef(null),U=B.useMemo(()=>J9(d),[d]),re=B.useMemo(()=>{const ne=M.trim().toLowerCase();return ne?d.filter(et=>et.path.toLowerCase().includes(ne)).slice(0,300):null},[d,M]),ge=b?b.split(`
|
|
256
|
+
`).length:0,_e=d.filter(ne=>ne.type==="dir").length,Ue=d.length-_e,de=B.useMemo(()=>d.filter(ne=>ne.type==="dir").map(ne=>ne.path),[d]);if(B.useEffect(()=>{be&&D.current?.focus()},[be]),B.useEffect(()=>{te(!o.available)},[o.available]),B.useEffect(()=>{const ne=et=>{!(et.metaKey||et.ctrlKey)||et.key.toLowerCase()!=="s"||!me.getState().workspaceOpen||!Be.getState().activeFile||(et.preventDefault(),Be.getState().saveFile())};return window.addEventListener("keydown",ne),()=>window.removeEventListener("keydown",ne)},[]),!e)return null;const Ne=async()=>{if(!be)return;const ne=be.value.trim().replace(/^\/+/,"");if(!ne)return S(null);try{if(be.mode==="rename"){if(!g)return;await $(g,ne)}else await R(ne,be.mode==="create-dir"?"dir":"file");S(null)}catch(et){a(et instanceof Error?et.message:"That change failed.","error")}},ye=async ne=>{if(await r({title:"Delete this path?",body:`${ne} will be deleted from disk. This cannot be undone.`,confirmLabel:"Delete",tone:"danger"}))try{await z(ne)}catch(Ae){a(Ae instanceof Error?Ae.message:"Could not delete that path.","error")}},Q=async()=>{try{await navigator.clipboard.writeText(b),ce(!0),window.setTimeout(()=>ce(!1),1500)}catch{a("Clipboard access was blocked.","error")}},Pe=(ne,et)=>{const Ae=ne.entry.path;if(ne.entry.type==="dir"){const rt=Z.has(Ae);return c.jsxs("div",{children:[c.jsxs("div",{className:"group/row relative flex h-7 items-center rounded-lg transition-colors hover:bg-raised/80",style:{paddingLeft:6+et*14},children:[c.jsxs("button",{type:"button",onClick:()=>he(Ke=>{const It=new Set(Ke);return It.has(Ae)?It.delete(Ae):It.add(Ae),It}),className:"flex min-w-0 flex-1 items-center gap-1.5 pr-1 text-left text-[11.5px] font-medium text-muted transition-colors hover:text-ink",title:Ae,"aria-expanded":!rt,children:[c.jsx(nw,{size:10,className:W("shrink-0 text-faint transition-transform duration-150",!rt&&"rotate-90")}),c.jsx(th,{path:Ae,type:"dir",open:!rt,size:13}),c.jsx("span",{className:"min-w-0 flex-1 truncate",children:ne.entry.name}),c.jsx("span",{className:"shrink-0 pr-1 font-mono text-[8.5px] tabular-nums text-faint opacity-0 transition-opacity group-hover/row:opacity-100",children:ne.children.length})]}),c.jsx("button",{type:"button",onClick:()=>{ye(Ae)},className:"mr-1 flex h-5 w-5 shrink-0 items-center justify-center rounded text-faint opacity-0 transition-all hover:bg-danger/10 hover:text-danger focus-visible:opacity-100 group-hover/row:opacity-100","aria-label":`Delete ${Ae}`,title:`Delete ${Ae}`,children:c.jsx(la,{size:10})})]}),!rt&&c.jsxs("div",{className:"relative",children:[c.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute bottom-0.5 top-0 w-px bg-line/60",style:{left:11+et*14}}),ne.children.map(Ke=>Pe(Ke,et+1))]})]},Ae)}return c.jsxs("button",{type:"button",onClick:()=>N(Ae),className:W("group/row relative flex h-7 w-full items-center gap-1.5 rounded-lg pr-1.5 text-left font-mono text-[10.5px] transition-colors",g===Ae?"bg-accent-soft/80 font-medium text-accent":"text-muted hover:bg-raised/80 hover:text-ink"),style:{paddingLeft:22+et*14},title:Ae,children:[g===Ae&&c.jsx("span",{"aria-hidden":!0,className:"absolute left-0 top-1 bottom-1 w-[2px] rounded-full bg-accent"}),c.jsx(th,{path:Ae,size:12,className:W(g===Ae&&"text-accent")}),c.jsx("span",{className:"min-w-0 flex-1 truncate",children:ne.entry.name}),ne.entry.size>0&&c.jsx("span",{className:"shrink-0 font-mono text-[8.5px] tabular-nums text-faint opacity-0 transition-opacity group-hover/row:opacity-100",children:xl(ne.entry.size)})]},Ae)};return c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button","aria-label":"Close workspace",onClick:()=>i(!1),className:"fixed inset-0 z-40 cursor-default bg-ink/20 backdrop-blur-[1px] xl:hidden"}),c.jsxs("aside",{className:W("fixed inset-y-0 right-0 z-50 flex h-dvh w-[min(96vw,440px)] flex-col border-l border-line surface-lift shadow-float transition-[width] duration-200 xl:static xl:z-auto xl:shadow-none",ae==="preview"&&o.available&&!ee?"sm:w-[min(96vw,620px)] xl:w-[560px]":"xl:w-[390px]"),children:[c.jsxs("div",{className:"flex h-14 shrink-0 items-center gap-2 border-b border-line px-3",children:[c.jsx("span",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-accent-soft text-accent",children:c.jsx(ls,{size:14})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("p",{className:"truncate text-[12px] font-semibold tracking-[-0.01em] text-ink",children:o.available?o.name:"Workspace"}),c.jsx("p",{className:"truncate text-[9px] text-faint",title:u,children:o.available?u:"No folder open"})]}),o.available&&c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:"icon-button h-7 w-7",onClick:()=>te(!0),title:"Change folder","aria-label":"Change folder",children:c.jsx(Ro,{size:14})}),c.jsx("button",{type:"button",className:"icon-button h-7 w-7",onClick:()=>{q().catch(()=>{})},title:"Refresh tree","aria-label":"Refresh tree",children:c.jsx(Bi,{size:13,className:W(p&&"animate-spin")})})]}),c.jsx("button",{type:"button",className:"icon-button h-7 w-7",onClick:()=>i(!1),title:"Close workspace","aria-label":"Close workspace",children:c.jsx(Ni,{size:15})})]}),ee||!o.available?c.jsx(eI,{onDone:()=>te(!1)}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-line px-2 py-1.5",children:[c.jsx("button",{type:"button",onClick:()=>O("files"),className:W("h-7 rounded-md px-2.5 text-[11px] font-medium",ae==="files"?"bg-raised text-ink":"text-muted hover:text-ink"),children:"Files"}),c.jsx("button",{type:"button",onClick:()=>O("preview"),className:W("h-7 rounded-md px-2.5 text-[11px] font-medium",ae==="preview"?"bg-raised text-ink":"text-muted hover:text-ink"),children:"Preview"}),c.jsxs("button",{type:"button",onClick:()=>O("sessions"),className:W("h-7 rounded-md px-2.5 text-[11px] font-medium",ae==="sessions"?"bg-raised text-ink":"text-muted hover:text-ink"),children:["Sessions ",c.jsxs("span",{className:"text-faint",children:["· ",se]})]}),c.jsxs("button",{type:"button",onClick:()=>O("git"),className:W("h-7 rounded-md px-2.5 text-[11px] font-medium",ae==="git"?"bg-raised text-ink":"text-muted hover:text-ink"),children:["Git ",T.entries.length>0&&c.jsxs("span",{className:"text-warning",children:["· ",T.entries.length]})]}),c.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[c.jsx("button",{type:"button",className:"icon-button h-7 w-7",onClick:()=>S({mode:"create-file",value:""}),title:"New file","aria-label":"New file",children:c.jsx(rw,{size:13})}),c.jsx("button",{type:"button",className:"icon-button h-7 w-7",onClick:()=>S({mode:"create-dir",value:""}),title:"New folder","aria-label":"New folder",children:c.jsx(uT,{size:13})})]})]}),ae==="files"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"shrink-0 border-b border-line px-2.5 py-2",children:[c.jsxs("div",{className:"relative",children:[c.jsx(os,{size:11,className:"pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 text-faint"}),c.jsx("input",{value:M,onChange:ne=>H(ne.target.value),placeholder:"Find a file",className:"h-7 w-full rounded-md border border-transparent bg-raised/60 pl-7 pr-2 text-[10.5px] text-ink outline-none transition-colors placeholder:text-faint focus:border-line focus:bg-panel","aria-label":"Find a file"})]}),c.jsxs("div",{className:"flex items-center justify-between gap-2 px-1 pt-1.5 text-[8.5px] text-faint",children:[c.jsx("span",{className:"truncate",children:re?`${re.length} matches`:`${Ue} files · ${_e} folders`}),!re&&_e>0&&c.jsx("button",{type:"button",onClick:()=>he(Z.size>0?new Set:new Set(de)),className:"shrink-0 font-medium hover:text-ink",children:Z.size>0?"Expand all":"Collapse all"})]}),be&&c.jsxs("div",{className:"mt-1.5 flex items-center gap-1",children:[c.jsx("input",{ref:D,value:be.value,onChange:ne=>S({...be,value:ne.target.value}),onKeyDown:ne=>{ne.key==="Enter"&&Ne(),ne.key==="Escape"&&S(null)},placeholder:be.mode==="rename"?g??"new/path":"folder/file.ts",className:"h-7 min-w-0 flex-1 rounded-md border border-accent/40 bg-panel px-2 font-mono text-[10.5px] outline-none"}),c.jsx("button",{type:"button",onClick:()=>{Ne()},className:"flex h-7 items-center rounded-md bg-ink px-2 text-[10px] font-medium text-panel",children:c.jsx(ns,{size:10})}),c.jsx("button",{type:"button",onClick:()=>S(null),className:"icon-button h-7 w-7",children:c.jsx(Ni,{size:12})})]})]}),c.jsxs("div",{className:"thin-scroll max-h-[32dvh] min-h-[92px] shrink-0 overflow-y-auto px-1.5 py-1.5 xl:max-h-[38%]",children:[h&&c.jsx("p",{className:"px-2 py-2 text-[10.5px] text-danger",children:h}),p&&d.length===0&&c.jsxs("p",{className:"flex items-center gap-1.5 px-2 py-3 text-[10.5px] text-faint",children:[c.jsx(Pt,{size:11})," Reading folder…"]}),re?c.jsxs(c.Fragment,{children:[re.map(ne=>c.jsxs("button",{type:"button",onClick:()=>ne.type==="file"&&N(ne.path),className:W("group/row relative flex h-7 w-full items-center gap-1.5 rounded-lg px-2 text-left font-mono text-[10.5px] transition-colors",g===ne.path?"bg-accent-soft/80 font-medium text-accent":"text-muted hover:bg-raised/80 hover:text-ink"),children:[g===ne.path&&c.jsx("span",{"aria-hidden":!0,className:"absolute left-0 top-1 bottom-1 w-[2px] rounded-full bg-accent"}),c.jsx(th,{path:ne.path,type:ne.type==="dir"?"dir":"file",size:12}),c.jsx("span",{className:"truncate",children:ne.path})]},ne.path)),re.length===0&&c.jsx("p",{className:"px-2 py-4 text-center text-[10.5px] text-faint",children:"No matches in this folder."})]}):U.map(ne=>Pe(ne,0)),!p&&!h&&d.length===0&&c.jsx("p",{className:"px-2 py-4 text-center text-[10.5px] text-faint",children:"This folder is empty."})]}),c.jsx("div",{className:"flex min-h-0 flex-1 flex-col border-t border-line",children:g&&x?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex shrink-0 items-center gap-1.5 border-b border-line px-3 py-2",children:[c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("p",{className:"truncate font-mono text-[10.5px] font-medium text-ink",children:g}),c.jsxs("p",{className:"mt-0.5 text-[9px] text-faint",children:[W9(g)," · ",ge," lines · ",xl(x.size),y?" · unsaved":" · saved"]})]}),w&&c.jsx(Pt,{size:11}),c.jsx("button",{type:"button",className:"icon-button h-7 w-7",onClick:()=>S({mode:"rename",value:g}),title:"Rename","aria-label":"Rename",children:c.jsx(Fo,{size:12})}),c.jsx("button",{type:"button",className:"icon-button h-7 w-7",onClick:Q,title:"Copy","aria-label":"Copy",children:ve?c.jsx(Cn,{size:12,className:"text-success"}):c.jsx(hd,{size:12})}),c.jsx("button",{type:"button",className:"icon-button h-7 w-7 hover:text-danger",onClick:()=>{ye(g)},title:"Delete","aria-label":"Delete",children:c.jsx(la,{size:12})}),c.jsxs("button",{type:"button",onClick:()=>{j()},disabled:!y||v,className:"inline-flex h-7 items-center gap-1 rounded-md bg-ink px-2 text-[10px] font-medium text-panel disabled:opacity-35",children:[v?c.jsx(Pt,{size:10}):c.jsx(cC,{size:10}),"Save"]})]}),x.binary?c.jsx("div",{className:"flex flex-1 items-center justify-center px-6 text-center text-[11px] text-faint",children:"This file is binary and cannot be edited here."}):c.jsx("textarea",{value:b,onChange:ne=>A(ne.target.value),spellCheck:!1,wrap:"off","aria-label":`Edit ${g}`,className:"thin-scroll min-h-0 flex-1 resize-none overflow-auto bg-panel p-3.5 font-mono text-[11.5px] leading-[1.75] text-ink outline-none"}),c.jsxs("div",{className:"flex h-6 shrink-0 items-center justify-between border-t border-line px-3 text-[8.5px] text-faint",children:[c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx("span",{className:W("h-1 w-1 rounded-full",y?"bg-warning":"bg-success")}),y?"Unsaved changes":"Saved to disk"]}),c.jsx("span",{children:"⌘S to save · UTF-8"})]})]}):c.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[c.jsx("span",{className:"flex h-9 w-9 items-center justify-center rounded-xl bg-raised text-faint",children:c.jsx(Pn,{size:16})}),c.jsx("p",{className:"text-[11.5px] font-medium text-ink",children:"No file selected"}),c.jsx("p",{className:"max-w-[230px] text-[10px] leading-relaxed text-faint",children:"Pick a file from the tree. The agent reads and writes these same files."})]})})]}):ae==="preview"?c.jsx(Y9,{}):ae==="sessions"?c.jsx(K9,{}):c.jsxs("div",{className:"thin-scroll min-h-0 flex-1 overflow-y-auto",children:[c.jsxs("div",{className:"flex items-center gap-2 border-b border-line px-3 py-3",children:[c.jsx(lw,{size:14,className:"text-faint"}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("p",{className:"truncate text-[11.5px] font-medium text-ink",children:T.available?T.branch||"detached HEAD":"Not a git repository"}),c.jsx("p",{className:"text-[9.5px] text-faint",children:T.available?`${T.entries.length} changed path${T.entries.length===1?"":"s"}`:T.error})]}),c.jsx("button",{type:"button",className:"icon-button h-7 w-7",onClick:()=>{L()},"aria-label":"Refresh git",children:c.jsx(Bi,{size:12,className:W(E&&"animate-spin")})})]}),T.entries.length===0?c.jsx("p",{className:"px-3 py-5 text-[10.5px] text-faint",children:"The working tree is clean."}):T.entries.map(ne=>c.jsxs("button",{type:"button",onClick:()=>N(ne.path),className:"flex w-full items-center gap-2 px-3 py-1.5 text-left font-mono text-[10px] hover:bg-raised",title:ne.path,children:[c.jsx("span",{className:"w-6 shrink-0 text-warning",children:ne.status}),c.jsx("span",{className:"truncate text-muted",children:ne.path})]},`${ne.status}-${ne.path}`)),c.jsx("div",{className:"border-t border-line p-3",children:c.jsx("button",{type:"button",onClick:async()=>{await r({title:"Forget this workspace?",body:"The folder stays on disk. OpenSol stops showing it and closes the current file.",confirmLabel:"Forget workspace"})&&await C()},className:"text-[10.5px] font-medium text-faint hover:text-danger",children:"Forget this workspace"})})]})]}),o.available&&!ee&&c.jsxs("div",{className:"flex h-8 shrink-0 items-center gap-1.5 border-t border-line px-3 text-[9px] text-faint",children:[c.jsx(Qh,{size:10,className:W(p&&"animate-spin")}),"Real folder · daemon-scoped access",c.jsxs("span",{className:"ml-auto",children:[d.length," entries"]})]})]})]})}const qu={settings:"maxcode-settings-v1",chats:"maxcode-chats-v1",workspace:"maxcode-workspace-v1"},Iu=kr()((e,i)=>({phase:"idle",error:"",startedAt:0,boot:async(a=!1)=>{if(i().phase!=="loading"&&!(i().phase==="ready"&&!a)){e({phase:"loading",error:"",startedAt:Date.now()});try{await pl();let r=await KC();const o=nI();o.found&&(r.migration?.migratedAt||(r=(await nj({settings:o.settings,chats:o.chats})).state),iI()),await JN(r),Yj(),Rj(),e({phase:"ready",error:""})}catch(r){e({phase:"error",error:r instanceof Error?r.message:"OpenSol could not reach its local daemon."})}}}}));async function JN(e){Me.getState().hydrate(e),Ve.getState().hydrate(e.chats),await Be.getState().hydrate(e.workspace)}function Fv(e){if(e)try{return JSON.parse(e)}catch{return}}function nI(){if(typeof window>"u")return{found:!1,settings:void 0,chats:void 0};let e,i,a=!1;try{e=Fv(window.localStorage.getItem(qu.settings)),i=Fv(window.localStorage.getItem(qu.chats)),a=!!(e||i||window.localStorage.getItem(qu.workspace))}catch{}return{found:a,settings:e,chats:i}}function iI(){try{for(const e of Object.values(qu))window.localStorage.removeItem(e)}catch{}}const aI=/\.(md|markdown|txt|json|ya?ml|toml|js|mjs|cjs|ts|tsx|jsx|py|sh|bash|zsh|css|html|xml|csv)$/i,rI=512*1024,sI=4*1024*1024,lI=200;function oI(e,i){const a=String(e??"").replace(/\r\n/g,`
|
|
257
|
+
`),r=/^---\n([\s\S]*?)\n---\n?/.exec(a),o={};let u=a;if(r){for(const h of r[1].split(`
|
|
258
|
+
`)){const g=/^([A-Za-z0-9_-]+)\s*:\s*(.*)$/.exec(h.trim());g&&(o[g[1].toLowerCase()]=g[2].replace(/^["']|["']$/g,"").trim())}u=a.slice(r[0].length)}const d=/^#\s+(.+)$/m.exec(u),p=u.split(/\n\s*\n/).map(h=>h.trim()).find(h=>h&&!h.startsWith("#")&&!h.startsWith("---"));return{name:o.name||d?.[1]?.trim()||i,description:(o.description||p||"Installed from a folder").replace(/[#>*`]/g,"").replace(/\s+/g," ").slice(0,200),instructions:u.trim()}}function cI(e){return e.toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"skill"}function uI(e){const i=e.filter(a=>/(^|\/)SKILL\.md$/i.test(a.path));return i.sort((a,r)=>a.path.split("/").length-r.path.split("/").length||a.path.localeCompare(r.path)),i[0]?.path??""}async function dI(e){const i=e.slice(0,lI),a=[];let r=0;for(const x of i){const b=x.webkitRelativePath||x.name;if(x.size>rI||!aI.test(b))continue;if(r+x.size>sI)break;const y=await x.text();r+=y.length,a.push({path:b,text:y})}if(a.length===0)throw new Error("That folder has no readable text files.");const o=uI(a);if(!o)throw new Error("That folder has no SKILL.md.");const d=/^(.*?)\//.exec(o)?.[1]??"",p=a.filter(x=>!d||x.path===d||x.path.startsWith(`${d}/`)).map(x=>({path:d?x.path.slice(d.length+1):x.path,text:x.text})),h=p.find(x=>/^SKILL\.md$/i.test(x.path))??p[0],g=oI(h.text,d.split("/").pop()||"skill");return{id:`skill_${cI(g.name)}`,name:g.name,description:g.description,instructions:g.instructions,enabled:!0,source:"folder",files:Object.fromEntries(p.map(x=>[x.path,x.text]))}}const fI=/^[a-z0-9][a-z0-9-]{0,47}$/;function pI(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const i=Object.getPrototypeOf(e);return i!==Object.prototype&&i!==null?!1:e.type==="ready"?Object.keys(e).length===1:e.type==="command"||e.type==="panel"?Object.keys(e).every(a=>["type","id","label"].includes(a))&&typeof e.id=="string"&&fI.test(e.id)&&typeof e.label=="string"&&e.label.trim().length>0&&e.label.length<=80:e.type==="log"||e.type==="error"?Object.keys(e).every(a=>["type","message"].includes(a))&&typeof e.message=="string"&&e.message.length<=500:!1}function mI(e,i,a){const r=`
|
|
259
|
+
const send = (message) => parent.postMessage(message, '*')
|
|
260
|
+
const api = {
|
|
261
|
+
manifest: ${JSON.stringify({id:e.id,name:e.name})},
|
|
262
|
+
command: (id, label) => send({ type: 'command', id, label }),
|
|
263
|
+
panel: (id, label) => send({ type: 'panel', id, label }),
|
|
264
|
+
log: (message) => send({ type: 'log', message: String(message).slice(0, 500) }),
|
|
265
|
+
network: () => { throw new Error('The sandboxed preview has no network access.') },
|
|
266
|
+
workspace: { list: () => [], read: () => '', write: () => {}, edit: () => false },
|
|
267
|
+
}
|
|
268
|
+
try { ;(function (maxcode) { ${i} })(api) } catch (error) {
|
|
269
|
+
send({ type: 'error', message: String(error && error.message ? error.message : error).slice(0, 500) })
|
|
270
|
+
}
|
|
271
|
+
send({ type: 'ready' })
|
|
272
|
+
`;return`<!doctype html><html><head><meta charset="utf-8"><style>${a}</style></head><body><script>${r}<\/script></body></html>`}function hI(e,i){const a=r=>{r.source===e.contentWindow&&pI(r.data)&&i(r.data)};return window.addEventListener("message",a),()=>window.removeEventListener("message",a)}const gI=5*1024*1024,xI=10*1024*1024,bI=100,yI=64*1024,vI=new Set(["workspace.list","workspace.read","workspace.write","workspace.edit","ui.commands","ui.panels","ui.themes","network.request"]),wI=new Set(["id","name","version","apiVersion","entry","stylesheet","capabilities","domains"]);function kt(e){throw new Error(`Invalid plugin package: ${e}`)}function WN(e){return typeof e=="string"?e:new TextDecoder("utf-8").decode(e)}function dd(e){return new TextEncoder().encode(e)}function kI(e,i,a){if(a===2)return;const r=WN(i),o=e.endsWith(".js")?[/\b(?:import|export)\b|\b(?:fetch|XMLHttpRequest|WebSocket|EventSource|importScripts)\s*\(|\bnavigator\s*\.\s*sendBeacon\s*\(/i,"module imports and unmanaged network calls are forbidden"]:e.endsWith(".css")?[/@import\b|url\s*\(\s*(['"]?)(?!data:image\/(?:png|jpeg|gif|webp);base64,)[^)]*\)/i,"external CSS resources and imports are forbidden"]:null;if(!o)return;const u=o[0].exec(r);if(!u)return;const d=r.slice(0,u.index).split(`
|
|
273
|
+
`).length,p=u[0].length>60?`${u[0].slice(0,60)}…`:u[0];kt(`${o[1]}: found "${p}" at ${e}:${d}`)}function $h(e){return(typeof e!="string"||!e||e.includes("\0")||e.includes("\\")||e.startsWith("/")||/^[a-zA-Z]:/.test(e)||e.split("/").some(i=>!i||i==="."||i===".."))&&kt(`unsafe path "${String(e)}"`),e}function NI(e){(typeof e!="string"||e.length>253||e.endsWith("."))&&kt("invalid domain");const i=e.split(".");return(i.length<2||i.some(a=>!/^(?=.{1,63}$)[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i.test(a)))&&kt(`invalid domain "${e}"`),e.toLowerCase()}function Ld(e){(!e||typeof e!="object"||Array.isArray(e))&&kt("manifest must be an object"),Object.keys(e).some(b=>!wI.has(b))&&kt("unknown manifest field");const{id:i,name:a,version:r,apiVersion:o,entry:u,stylesheet:d,capabilities:p,domains:h}=e;(typeof i!="string"||!/^[a-z0-9][a-z0-9-]{1,63}$/.test(i))&&kt("invalid plugin id"),(typeof a!="string"||!a.trim()||a.length>100)&&kt("invalid plugin name"),(typeof r!="string"||!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(r))&&kt("invalid plugin version"),o!==1&&o!==2&&kt("unsupported API version"),$h(u),$h(d),(!u.endsWith(".js")||!d.endsWith(".css"))&&kt("entry must be JavaScript and stylesheet must be CSS");const g=p??[];Array.isArray(g)||kt("capabilities must be an array"),o===1&&g.some(b=>!vI.has(b))&&kt("invalid capability"),h!==void 0&&!Array.isArray(h)&&kt("domains must be an array");const x=(h??[]).map(NI);return new Set(x).size!==x.length&&kt("duplicate domain"),{id:i,name:a.trim(),version:r,apiVersion:o,entry:u,stylesheet:d,capabilities:[...new Set(g)],domains:x}}function EI(e,i){(!e||typeof e!="object"||Array.isArray(e))&&kt("files must be a path-to-source object");const a=Object.keys(e);a.length>bI&&kt("too many files");const r={};let o=0;for(const u of a){const d=$h(u);d==="manifest.json"&&kt("manifest is generated from the manifest field"),/\.(?:mjs|cjs|jsx|ts|tsx)$/i.test(d)&&d!==i.entry&&kt(`undeclared executable file "${d}"`),d!==i.entry&&d!==i.stylesheet&&/\.(?:js|css)$/i.test(d)&&kt(`undeclared executable file "${d}"`);const p=e[u];typeof p!="string"&&!(p instanceof Uint8Array)&&kt(`file "${d}" must be text or bytes`);const h=typeof p=="string"?dd(p):p;o+=h.byteLength,o>xI&&kt("package is too large"),(d===i.entry||d===i.stylesheet)&&kI(d,h,i.apiVersion),r[d]=typeof p=="string"?p:WN(h)}return i.entry in r||kt("entry file is missing"),i.stylesheet in r||kt("stylesheet file is missing"),dd(r[i.entry]).byteLength>2*1024*1024&&kt("entry file is too large"),r}function _I(e){const i=Ld(e?.manifest),a=EI(e?.files,i),r=JSON.stringify(i);dd(r).byteLength>yI&&kt("manifest is too large");const u=dd(JSON.stringify({format:"cordis-plugin",manifest:i,files:a}));return u.byteLength>gI&&kt("package is too large"),u}function Hg(e){(!e||!(e instanceof Uint8Array)||e.byteLength===0)&&kt("package archive is empty or invalid");let i;try{const o=new TextDecoder("utf-8").decode(e);i=JSON.parse(o)}catch{kt("package is not a valid JSON archive")}(!i||typeof i!="object")&&kt("invalid package format");const a=Ld(i.manifest),r=i.files;return(!r||typeof r!="object")&&kt("missing package files"),{manifest:a,files:r}}const SI=/\.(?:png|jpe?g|gif|webp|ico|woff2?|ttf|otf|eot|wasm|zip|pdf|mp3|mp4)$/i;function TI(e){return SI.test(e)}function CI(e){const i=e[0]?.indexOf("/")??-1;if(i<0)return e;const a=e[0].slice(0,i+1);return e.every(r=>r.startsWith(a))?e.map(r=>r.slice(a.length)):e}function jI(e){if(typeof e!="string")throw new Error("manifest.json must be text.");let i;try{i=JSON.parse(e)}catch{throw new Error("manifest.json is not valid JSON.")}return Ld(i)}function AI(e){const i=CI(e.map(y=>y.path)),a={};let r;e.forEach((y,v)=>{const w=i[v];w==="manifest.json"?r=y.content:a[w]=y.content});const o=Object.keys(a),u=(y,v)=>y!==void 0&&y.endsWith(v)&&o.includes(y)?y:void 0,d=(y,v)=>{if(o.includes(y))return y;const w=o.filter(T=>T.endsWith(v)).sort();return w.find(T=>T.slice(T.lastIndexOf("/")+1)===y)??w[0]};let p,h;if(r!==void 0)try{p=jI(r)}catch(y){h=y instanceof Error?y.message:"manifest.json could not be read."}const g=u(p?.entry,".js")??d("main.js",".js");if(!g)throw new Error("A plugin needs one .js entry file. Pick a folder that has one.");const x=u(p?.stylesheet,".css")??d("main.css",".css")??"main.css",b=o.filter(y=>y!==g&&y!==x&&/\.(?:m?js|cjs|jsx|tsx?|css)$/i.test(y));if(b.length>0)throw new Error(`A plugin package holds one script and one stylesheet. Remove or merge: ${b.join(", ")}.`);return{entry:g,stylesheet:x,files:a,manifest:p,manifestError:h}}const OI=["workspace.list","workspace.read","workspace.write","workspace.edit","ui.commands","ui.panels","ui.themes","network.request"],MI=".js,.css,.json,.txt,.html,.svg,.png,.jpg,.jpeg,.gif,.webp,.woff,.woff2",Uu="h-8 w-full rounded-lg border border-line bg-panel px-2.5 text-[12px] text-ink outline-none transition-colors placeholder:text-faint focus:border-accent/50";async function RI(e){const i=e.webkitRelativePath||e.name;return{path:i,content:TI(i)?new Uint8Array(await e.arrayBuffer()):await e.text()}}function DI({onInstalled:e}){const i=me(C=>C.notify),[a,r]=B.useState("my-plugin"),[o,u]=B.useState("My plugin"),[d,p]=B.useState("1.0.0"),[h,g]=B.useState(1),[x,b]=B.useState(["ui.commands"]),[y,v]=B.useState(""),[w,T]=B.useState(null),E=B.useRef(null),N=B.useRef(null),j=async C=>{if(C?.length)try{const L=await Promise.all([...C].map(RI)),q=AI(L);T(q),q.manifest&&(r(q.manifest.id),u(q.manifest.name),p(q.manifest.version),g(q.manifest.apiVersion===2?2:1),b(q.manifest.capabilities),v(q.manifest.domains.join(", "))),i(q.manifestError?`Loaded ${Object.keys(q.files).length} file(s). Its manifest.json was ignored: ${q.manifestError}`:`Loaded ${Object.keys(q.files).length} file(s) — entry ${q.entry}.`,q.manifestError?"error":"info")}catch(L){T(null),i(L instanceof Error?L.message:"Those files are not a plugin folder.","error")}},A=()=>{try{if(!w)throw new Error("Load a plugin folder or its files first.");const C={id:a.trim(),name:o.trim(),version:d.trim(),apiVersion:h,entry:w.entry,stylesheet:w.stylesheet,capabilities:h===2?[]:x,domains:y.split(/[\s,]+/).map(q=>q.trim()).filter(Boolean)};Ld(C);const L={...w.files};return L[C.stylesheet]??="",{archive:_I({manifest:C,files:L})}}catch(C){return i(C instanceof Error?C.message:"That package could not be built.","error"),null}},R=()=>{const C=A();if(!C)return;const L=URL.createObjectURL(new Blob([C.archive],{type:"application/json"})),q=document.createElement("a");q.href=L,q.download=`${a.trim()||"plugin"}.plugin.json`,q.click(),URL.revokeObjectURL(L)},$=async()=>{const C=A();if(C)try{const{plugin:L}=await gw(C.archive);e?.(L),i(`${L.manifest.name} installed. It starts sandboxed and disabled.`,"success")}catch(L){i(L instanceof Error?L.message:"The daemon rejected this package.","error")}},z=w?Object.keys(w.files):[];return c.jsxs("details",{className:"rounded-xl border border-line bg-raised/20",children:[c.jsxs("summary",{className:"flex cursor-pointer items-center gap-2 px-3 py-2.5 text-[11.5px] font-medium text-ink",children:[c.jsx(wT,{size:13,className:"text-faint"}),"Build a plugin package from a folder"]}),c.jsxs("div",{className:"space-y-2.5 border-t border-line px-3 py-3",children:[c.jsxs("p",{className:"text-[10.5px] leading-relaxed text-faint",children:["Load a plugin folder, or the files themselves. One ",c.jsx("code",{className:"font-mono",children:".js"})," entry and one optional ",c.jsx("code",{className:"font-mono",children:".css"})," stylesheet become the package. A"," ",c.jsx("code",{className:"font-mono",children:"manifest.json"})," in the folder fills these fields in; the fields win."]}),c.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-line bg-panel px-2.5 py-2",children:[c.jsx(Hi,{checked:h===2,onChange:C=>g(C?2:1),label:"API v2"}),c.jsx("span",{className:"text-[10.5px] font-medium text-ink",children:"API v2 — free plugin (full app access)"}),h===2&&c.jsx("span",{className:"ml-auto text-[9.5px] text-accent",children:"ctx = Cordis kernel scope"})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsxs("button",{type:"button",onClick:()=>E.current?.click(),className:"inline-flex h-8 items-center gap-1.5 rounded-lg bg-accent px-3 text-[10.5px] font-medium text-on-accent hover:bg-accent/90",children:[c.jsx(sw,{size:12}),"Load folder"]}),c.jsxs("button",{type:"button",onClick:()=>N.current?.click(),className:"inline-flex h-8 items-center gap-1.5 rounded-lg border border-line bg-panel px-3 text-[10.5px] font-medium text-ink hover:bg-raised",children:[c.jsx(rT,{size:12}),"Load files"]}),c.jsx("input",{type:"file",multiple:!0,ref:C=>{E.current=C,C&&(C.webkitdirectory=!0)},className:"hidden",onChange:C=>{j(C.target.files),C.target.value=""}}),c.jsx("input",{ref:N,type:"file",multiple:!0,accept:MI,className:"hidden",onChange:C=>{j(C.target.files),C.target.value=""}})]}),w&&c.jsxs("div",{className:"rounded-lg border border-line bg-panel/60 px-2.5 py-2",children:[c.jsxs("p",{className:"text-[10.5px] text-muted",children:[c.jsxs("span",{className:"font-medium text-ink",children:[z.length," file(s)"]})," · entry"," ",c.jsx("code",{className:"font-mono",children:w.entry})," · stylesheet"," ",c.jsx("code",{className:"font-mono",children:w.stylesheet})]}),c.jsxs("ul",{className:"mt-1 space-y-0.5",children:[z.slice(0,6).map(C=>c.jsxs("li",{className:"truncate font-mono text-[9.5px] text-faint",children:[C," · ",xl(typeof w.files[C]=="string"?new TextEncoder().encode(w.files[C]).length:w.files[C].byteLength)]},C)),z.length>6&&c.jsxs("li",{className:"font-mono text-[9.5px] text-faint",children:["+",z.length-6," more"]})]})]}),c.jsxs("div",{className:"grid gap-2 sm:grid-cols-3",children:[c.jsxs("label",{className:"block",children:[c.jsx("span",{className:"text-[10px] font-medium text-muted",children:"Id"}),c.jsx("input",{className:Uu,value:a,onChange:C=>r(C.target.value)})]}),c.jsxs("label",{className:"block",children:[c.jsx("span",{className:"text-[10px] font-medium text-muted",children:"Name"}),c.jsx("input",{className:Uu,value:o,onChange:C=>u(C.target.value)})]}),c.jsxs("label",{className:"block",children:[c.jsx("span",{className:"text-[10px] font-medium text-muted",children:"Version"}),c.jsx("input",{className:Uu,value:d,onChange:C=>p(C.target.value)})]})]}),c.jsxs("div",{children:[c.jsx("span",{className:"text-[10px] font-medium text-muted",children:"Capabilities"}),c.jsx("div",{className:"mt-1 flex flex-wrap gap-1.5",children:h===2?c.jsx("p",{className:"text-[10px] text-faint",children:"Not needed — API v2 plugin has full access via the Cordis context."}):OI.map(C=>{const L=x.includes(C);return c.jsx("button",{type:"button",onClick:()=>b(q=>L?q.filter(M=>M!==C):[...q,C]),className:`rounded-full border px-2 py-1 font-mono text-[9.5px] ${L?"border-accent/40 bg-accent-soft text-ink":"border-line text-faint"}`,children:C},C)})})]}),c.jsxs("label",{className:"block",children:[c.jsx("span",{className:"text-[10px] font-medium text-muted",children:"Network domains (optional, comma separated)"}),c.jsx("input",{className:Uu,value:y,placeholder:"Leave empty — a plugin that needs no network declares none",onChange:C=>v(C.target.value)})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx("button",{type:"button",onClick:R,className:"inline-flex h-8 items-center gap-1.5 rounded-lg bg-accent px-3 text-[10.5px] font-medium text-on-accent hover:bg-accent/90",children:"Download plugin package"}),c.jsx("button",{type:"button",onClick:()=>{$()},className:"inline-flex h-8 items-center gap-1.5 rounded-lg border border-line bg-panel px-3 text-[10.5px] font-medium text-ink hover:bg-raised",children:"Build and install"})]})]})]})}function zI({plugin:e}){const i=me(x=>x.notify),[a,r]=B.useState(null),[o,u]=B.useState([]),d=B.useRef(null),[p,h]=B.useState(!1);B.useEffect(()=>{if(!(!d.current||!a))return hI(d.current,x=>{const b=x,y=b.type==="ready"?"Sandbox ready — no app access, no network.":`${b.type}: ${b.message??b.label??""}`;u(v=>[...v.slice(-5),y])})},[a]);const g=async()=>{h(!0);try{const x=await hw(e.id),{files:b,manifest:y}=Hg(x);u([]),r(mI(y,b[y.entry]??"",b[y.stylesheet]??""))}catch(x){i(x instanceof Error?x.message:"This plugin could not be previewed.","error")}finally{h(!1)}};return c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",disabled:p,onClick:()=>a?r(null):void g(),className:"inline-flex h-7 items-center gap-1.5 rounded-lg border border-line px-2.5 text-[10.5px] font-medium text-muted hover:text-ink disabled:opacity-40",children:[c.jsx(Vh,{size:11}),a?"Stop preview":"Preview in sandbox"]}),a&&c.jsxs("div",{className:"w-full overflow-hidden rounded-lg border border-line",children:[c.jsx("iframe",{ref:d,title:`${e.manifest.name} preview`,sandbox:"allow-scripts",srcDoc:a,className:"h-52 w-full bg-panel"}),c.jsx("div",{className:"max-h-24 overflow-y-auto border-t border-line bg-raised/40 px-2.5 py-1.5 font-mono text-[9.5px] leading-relaxed text-faint",children:o.map((x,b)=>c.jsx("p",{className:"truncate",children:x},b))})]})]})}const LI={"workspace.list":"List files in the open workspace","workspace.read":"Read workspace files","workspace.write":"Create and overwrite workspace files","workspace.edit":"Edit workspace files in place","ui.commands":"Add commands to OpenSol","ui.panels":"Add panels to OpenSol","ui.themes":"Add themes to OpenSol","network.request":"Call the HTTPS domains it declared"};function II(){const e=me(w=>w.notify),i=me(w=>w.askConfirm),[a,r]=B.useState([]),[o,u]=B.useState(!1),[d,p]=B.useState(null),h=B.useRef(null),g=async()=>{try{r((await mw()).plugins)}catch(w){e(w instanceof Error?w.message:"Could not list plugins.","error")}};B.useEffect(()=>{g()},[]);const x=w=>{r(T=>T.map(E=>E.id===w.id?w:E))},b=async w=>{u(!0);try{Hg(new Uint8Array(await w.arrayBuffer()));const{plugin:T}=await gw(new Uint8Array(await w.arrayBuffer()));r(E=>[...E.filter(N=>N.id!==T.id),T]),p(T.id),e(`${T.manifest.name} installed. It starts sandboxed and disabled.`,"success")}catch(T){e(T instanceof Error?T.message:"That file is not a valid plugin package.","error")}finally{u(!1)}},y=async(w,T,E)=>{try{x((await QC(w.id,{capabilities:T,domains:E})).plugin)}catch(N){e(N instanceof Error?N.message:"Could not save plugin permissions.","error")}},v=async w=>{if(w.safe){x((await c1(w.id,!1)).plugin);return}await i({title:`Run ${w.manifest.name} outside the sandbox?`,body:"Safe plugins run as real JavaScript inside OpenSol. They can do anything this app can, so only mark plugins you wrote or have reviewed.",confirmLabel:"Mark as Safe",tone:"danger"})&&x((await c1(w.id,!0)).plugin)};return c.jsxs(c.Fragment,{children:[c.jsxs("section",{className:"rounded-xl border border-line bg-raised/20 p-3",children:[c.jsx("h3",{className:"text-[12px] font-medium text-ink",children:"Install a local plugin"}),c.jsxs("p",{className:"mt-1 text-[10.5px] leading-relaxed text-faint",children:["OpenSol installs ",c.jsx("code",{className:"font-mono",children:".plugin.json"})," packages you pick from this machine. New plugins start sandboxed and disabled until you review them."]}),c.jsxs("div",{className:"mt-2.5 flex flex-wrap items-center gap-2",children:[c.jsxs("button",{type:"button",disabled:o,onClick:()=>h.current?.click(),className:"inline-flex h-8 items-center gap-1.5 rounded-lg bg-accent px-3 text-[10.5px] font-medium text-on-accent hover:bg-accent/90 disabled:opacity-40",children:[c.jsx(ls,{size:12}),"Choose plugin package"]}),c.jsx("input",{ref:h,type:"file",accept:".plugin.json,.pluginmax,application/json,application/zip",className:"hidden",onChange:w=>{const T=w.target.files?.[0];w.target.value="",T&&b(T)}})]})]}),a.length===0?c.jsx("p",{className:"rounded-lg border border-line bg-raised/30 px-3 py-3 text-[10.5px] text-faint",children:"No plugins installed."}):c.jsx("div",{className:"space-y-2",children:a.map(w=>{const T=d===w.id;return c.jsxs("div",{className:"overflow-hidden rounded-xl border border-line",children:[c.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[c.jsx(eg,{size:14,className:"shrink-0 text-faint"}),c.jsxs("button",{type:"button",onClick:()=>p(T?null:w.id),className:"min-w-0 flex-1 text-left",children:[c.jsx("span",{className:"block truncate text-[11.5px] font-medium text-ink",children:w.manifest.name}),c.jsxs("span",{className:"block truncate text-[9.5px] text-faint",children:[w.id," · v",w.manifest.version," ·"," ",w.safe?"Safe — runs unsandboxed":"Sandboxed"]})]}),c.jsx(Hi,{checked:w.enabled,disabled:!w.safe,label:`Enable ${w.manifest.name}`,onChange:async E=>{x((await JC(w.id,E)).plugin)}})]}),T&&c.jsxs("div",{className:"space-y-2.5 border-t border-line px-3 py-3",children:[c.jsxs("div",{className:W("flex items-start gap-2 rounded-lg px-2.5 py-2 text-[10px] leading-relaxed",w.safe?"bg-warning/10 text-ink":"bg-raised/60 text-muted"),children:[w.safe?c.jsx(mC,{size:13,className:"mt-0.5 shrink-0 text-warning"}):c.jsx(wr,{size:13,className:"mt-0.5 shrink-0 text-faint"}),c.jsx("span",{children:w.safe?"This plugin runs as real JavaScript in OpenSol with the permissions below. It is not sandboxed any more.":"This plugin is sandboxed. Mark it Safe to run its code, or preview it first."})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-[10.5px] font-medium text-ink",children:"Capabilities"}),c.jsxs("div",{className:"mt-1.5 space-y-1",children:[w.manifest.capabilities.length===0&&c.jsx("p",{className:"text-[10px] text-faint",children:"This plugin requests no capabilities."}),w.manifest.capabilities.map(E=>c.jsxs("label",{className:"flex items-center gap-2 text-[10.5px] text-muted",children:[c.jsx("input",{type:"checkbox",className:"accent-[rgb(var(--accent))]",checked:w.grants.capabilities.includes(E),onChange:N=>{y(w,N.target.checked?[...w.grants.capabilities,E]:w.grants.capabilities.filter(j=>j!==E),w.grants.domains)}}),c.jsx("span",{className:"flex-1",children:LI[E]}),c.jsx("code",{className:"font-mono text-[9.5px] text-faint",children:E})]},E))]})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-[10.5px] font-medium text-ink",children:"Network domains"}),w.manifest.domains.length===0?c.jsx("p",{className:"mt-1 text-[10px] text-faint",children:"This plugin declares no network access."}):c.jsx("div",{className:"mt-1.5 space-y-1",children:w.manifest.domains.map(E=>c.jsxs("label",{className:"flex items-center gap-2 text-[10.5px] text-muted",children:[c.jsx("input",{type:"checkbox",className:"accent-[rgb(var(--accent))]",checked:w.grants.domains.includes(E),onChange:N=>{y(w,w.grants.capabilities,N.target.checked?[...w.grants.domains,E]:w.grants.domains.filter(j=>j!==E))}}),c.jsx("code",{className:"flex-1 font-mono text-[10px]",children:E})]},E))})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-0.5",children:[c.jsx(zI,{plugin:w}),c.jsx("button",{type:"button",onClick:()=>{v(w)},className:W("inline-flex h-7 items-center gap-1.5 rounded-lg border px-2.5 text-[10.5px] font-medium",w.safe?"border-line bg-panel text-muted hover:text-ink":"border-warning/40 bg-warning/10 text-ink"),children:w.safe?"Return to sandbox":"Mark as Safe"}),c.jsxs("button",{type:"button",onClick:async()=>{await i({title:`Uninstall ${w.manifest.name}?`,body:"Its permissions, styles and commands are removed from OpenSol.",confirmLabel:"Uninstall",tone:"danger"})&&(await WC(w.id),r(N=>N.filter(j=>j.id!==w.id)))},className:"inline-flex h-7 items-center gap-1.5 rounded-lg border border-line px-2.5 text-[10.5px] font-medium text-muted hover:text-danger",children:[c.jsx(la,{size:11}),"Uninstall"]})]})]})]},w.id)})}),c.jsx(DI,{onInstalled:w=>r(T=>[...T.filter(E=>E.id!==w.id),w])})]})}const UI=/^[a-z0-9][a-z0-9-]{0,47}$/;function BI(e,i){return!!e?.capabilities.includes(i)}function $I(e,i,a){let r;try{const o=new URL(a);if(o.protocol!=="https:"||o.port&&o.port!=="443")return null;r=o.hostname.toLowerCase()}catch{return null}return!i.includes(r)||!e?.domains.includes(r)?null:r}function Ph(){return{commands:new Map,panels:new Map,themes:new Map}}function PI(e){throw new Error(`The plugin was not granted ${e}.`)}function HI(e,i,a,r=Ph()){const o=d=>{BI(i,d)||PI(d)},u=d=>{if(!UI.test(d))throw new Error("A plugin contribution id must be lowercase letters, digits and dashes.")};return{manifest:Object.freeze({...e.manifest}),version:1,registerCommand(d,p,h){if(o("ui.commands"),u(d),typeof h!="function")throw new Error("A command needs a function.");r.commands.set(d,{label:String(p).slice(0,80),run:h})},registerPanel(d,p,h){if(o("ui.panels"),u(d),typeof h!="function")throw new Error("A panel needs a render function.");r.panels.set(d,{label:String(p).slice(0,80),render:h})},registerTheme(d,p,h){if(o("ui.themes"),u(d),!h||typeof h!="object")throw new Error("A theme needs a palette.");r.themes.set(d,{label:String(p).slice(0,80),palette:{...h}})},workspace:{list:async d=>(o("workspace.list"),a.workspace.list(d)),read:async d=>(o("workspace.read"),a.workspace.read(d)),write:async(d,p)=>(o("workspace.write"),a.workspace.write(d,p)),edit:async(d,p,h)=>(o("workspace.edit"),a.workspace.edit(d,p,h))},network:{request(d,p){if(o("network.request"),!$I(i,e.manifest.domains,d))throw new Error("This plugin may only call HTTPS hosts it declared and you granted.");return a.network(e.id,{url:d,...p})}},log(d){console.info(`[plugin:${e.id}]`,d)}}}const eE=e=>`maxcode-plugin-style-${e}`,nh="plugin-";function FI(e){return Object.entries(e).filter(([i,a])=>/^[a-z][a-z0-9-]*$/.test(i)&&/^[\d\s.]+$/.test(a))}function qI(e){const i=(e.canvas??"").trim().split(/\s+/).map(Number),[a,r,o]=i.length===3?i:[255,255,255];return .2126*a+.7152*r+.0722*o<110}function GI(e,i){const a=FI(i).map(([r,o])=>`--${r}:${o.trim()}`);return a.length===0?"":`[data-theme='${e}']{${a.join(";")}}`}function tE(e){return document.getElementById(eE(e))}function qv(e,i){let a=tE(e);a||(a=document.createElement("style"),a.id=eE(e),document.head.append(a)),a.textContent=i}function YI(e){tE(e)?.remove()}async function Gv(e,i){const a=globalThis,r=URL.createObjectURL(new Blob([`const maxcode = globalThis.__maxcodePluginApi;
|
|
274
|
+
${e}
|
|
275
|
+
`],{type:"text/javascript"}));a.__maxcodePluginApi=i;try{await import(r)}finally{delete a.__maxcodePluginApi,URL.revokeObjectURL(r)}}function VI(){const e=new Map,i=new Map,a=r=>{const o=i.get(r);o&&(i.delete(r),o.dispose());const u=e.get(r);if(u)for(const d of u.themes.keys())Cw(`${nh}${r}:${d}`);e.delete(r),YI(r)};return{contributions:e,contributionsFor:r=>e.get(r)??Ph(),themes(){const r=[];for(const[o,u]of e)for(const[d,p]of u.themes)r.push({id:`${nh}${o}:${d}`,label:p.label});return r},commands(){const r=[];for(const[o,u]of e)for(const[d,p]of u.commands)r.push({pluginId:o,id:d,label:p.label,run:p.run});return r},async activate(r,o){if(a(r.id),!r.safe||!r.enabled)return;const{files:u,manifest:d}=Hg(await hw(r.id));if(d.apiVersion===2){let p,h;const g=new Promise((y,v)=>{p=y,h=v}),x=async y=>{const v=u[d.stylesheet]??"";v&&qv(r.id,v);try{await Gv(u[d.entry]??"",y),p()}catch(w){h(w)}},b=Yt.plugin(x);i.set(r.id,b);try{await g}catch(y){throw a(r.id),new Error(`Plugin ${r.id} failed to start: ${y instanceof Error?y.message:String(y)}`)}}else{const p=e.get(r.id)??Ph();e.set(r.id,p);const h=HI(r,r.grants,o,p);try{await Gv(u[d.entry]??"",Object.freeze(h));const g=[...p.themes.entries()].map(([x,b])=>{const y=`${nh}${r.id}:${x}`;return Tw({id:y,label:b.label,dark:qI(b.palette)}),GI(y,b.palette)}).join(`
|
|
276
|
+
`);qv(r.id,`${u[d.stylesheet]??""}
|
|
277
|
+
${g}`)}catch(g){throw a(r.id),new Error(`Plugin ${r.id} failed to start: ${g instanceof Error?g.message:String(g)}`)}}},deactivate:a,deactivateAll(){const r=[...new Set([...e.keys(),...i.keys()])];for(const o of r)a(o)}}}const KI={workspace:{async list(e=""){return(await bw(e)).entries.map(a=>({path:a.path,name:a.name,type:a.type}))},async read(e){return(await sh(e)).content},async write(e,i){await lh(e,i)},async edit(e,i,a){const r=await sh(e);return r.content.includes(i)?(await lh(e,r.content.replace(i,a)),!0):!1}},network:(e,i)=>ej(e,i)};let Yv=null;function nE(){return Yv??=VI(),Yv}async function XI(e){const i=new Set(e.filter(r=>r.safe&&r.enabled).map(r=>r.id)),a=nE();for(const r of[...a.contributions.keys()])i.has(r)||a.deactivate(r);for(const r of e)if(i.has(r.id))try{await a.activate(r,KI)}catch(o){console.error(o)}}const Eo=[{id:"general",label:"General",icon:yC,description:"Permissions, appearance and conversation display."},{id:"models",label:"Models",icon:Yu,description:"Providers, encrypted keys, live models and reasoning defaults."},{id:"tools",label:"Tools",icon:Do,description:"What OpenSol can do on this machine, and when it must ask."},{id:"search",label:"Search",icon:ss,description:"Give the agent current web results with your own key."},{id:"skills",label:"Skills",icon:Wn,description:"Install skill folders or npm packages. The skill tool loads SKILL.md and runs the scripts a skill ships."},{id:"plugins",label:"Plugins",icon:eg,description:"Install local plugin packages, review what they ask for, and run them once you trust the code."},{id:"mcp",label:"MCP",icon:Xh,description:"Model Context Protocol servers now have their own panel, with OAuth sign-in and local, HTTP and SSE connections."},{id:"deploy",label:"Deploy",icon:vr,description:"Hosting credentials and command-line tools."},{id:"appearance",label:"Appearance",icon:ll,description:"Theme and interface preferences."},{id:"about",label:"About",icon:Kh,description:"Local storage, history and reset controls."}],yr="h-8 w-full rounded-lg border border-line bg-panel px-2.5 text-[12px] text-ink outline-none transition-colors placeholder:text-faint focus:border-accent/50 disabled:opacity-50";function rs({children:e,hint:i}){return c.jsxs("div",{className:"mb-1 flex items-baseline justify-between gap-3",children:[c.jsx("span",{className:"text-[11px] font-medium text-ink",children:e}),i&&c.jsx("span",{className:"text-[9.5px] text-faint",children:i})]})}function Rn({title:e,description:i,children:a,action:r}){return c.jsxs("section",{className:"settings-card mx-5 my-4 sm:mx-8",children:[c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs("h3",{className:"flex items-center gap-2 font-display text-[14px] font-semibold tracking-[-0.01em] text-ink",children:[c.jsx("span",{className:"h-3.5 w-[3px] rounded-full bg-accent"}),e]}),i&&c.jsx("p",{className:"mt-1.5 max-w-[620px] text-[11.5px] leading-relaxed text-muted",children:i})]}),r&&c.jsx("div",{className:"shrink-0",children:r})]}),c.jsx("div",{className:"mt-4",children:a})]})}function Fg({value:e,onChange:i,placeholder:a,disabled:r,label:o}){const[u,d]=B.useState(!1);return c.jsxs("div",{className:"relative",children:[c.jsx("input",{type:u?"text":"password",value:e,onChange:p=>i(p.target.value),placeholder:a,disabled:r,autoComplete:"off",spellCheck:!1,"aria-label":o,className:W(yr,"pr-8 font-mono text-[11px]")}),c.jsx("button",{type:"button",onClick:()=>d(p=>!p),className:"absolute right-1.5 top-1/2 flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded text-faint hover:text-ink","aria-label":u?"Hide secret":"Show secret",tabIndex:-1,children:u?c.jsx(P2,{size:12}):c.jsx(Vh,{size:12})})]})}const ZI=[];function QI(e){return e?e>=1e3?`${Math.round(e/1e3)}k`:String(e):""}const JI={openrouter:{prefix:"sk-or-",label:"OpenRouter"},anthropic:{prefix:"sk-ant-",label:"Anthropic"},google:{prefix:"AIza",label:"Google"},groq:{prefix:"gsk_",label:"Groq"},xai:{prefix:"xai-",label:"xAI"}};function WI({providerId:e,open:i,onToggle:a}){const r=Me(),o=Me(O=>O.selectModel),u=Me(O=>O.updateProvider),d=Me(O=>O.saveProviderKey),p=me(O=>O.notify),h=me(O=>O.askConfirm),g=On(O=>O.fetchModels),x=On(O=>O.byProvider[e])??ZI,b=On(O=>!!O.loading[e]),y=On(O=>O.errors[e]??""),v=On(O=>O.notes[e]??""),w=On(O=>O.source[e]??""),[T,E]=B.useState(""),[N,j]=B.useState(""),[A,R]=B.useState(!1),$=sa[e],z=r.providerStatus.find(O=>O.id===e),C=wd(r,e),L=r.provider===e,q=r.providers[e]?.baseUrl??"",M=z?.hint??"",H=ui(r),Z=x.find(O=>O.id===H);B.useEffect(()=>{if(!i||!C)return;const O=window.setTimeout(()=>{g(e)},400);return()=>window.clearTimeout(O)},[i,C,e,q,g]);const he=async()=>{const O=T.trim();if(!O){p(`Paste a ${$.name} API key first.`,"error");return}const ee=JI[e];if(ee&&!O.startsWith(ee.prefix)){let te="";e==="openrouter"&&O.startsWith("sk-")&&(te=" (looks like a DeepSeek or OpenAI key). If you are using DeepSeek, please paste it under DeepSeek instead."),p(`A key for ${ee.label} must start with "${ee.prefix}"${te}`,"error");return}R(!0);try{await d(e,O),E(""),p(`${$.name} key saved and encrypted.`,"success"),g(e,!0)}catch(te){p(te instanceof Error?te.message:"Could not save that key.","error")}finally{R(!1)}},se=async()=>{if(await h({title:`Remove the ${$.name} key?`,body:"The encrypted key is deleted from this computer. You can add it again at any time.",confirmLabel:"Remove key",tone:"danger"}))try{await d(e,""),p(`${$.name} key removed.`,"success")}catch(ee){p(ee instanceof Error?ee.message:"Could not remove that key.","error")}},ae=async()=>{if(x.length===0){const O=await g(e,!0);O[0]?o(e,O[0].id):p("No usable model was returned by this provider.","error");return}o(e,x[0].id)};return c.jsxs("div",{className:W("rounded-xl border transition-colors",i?"border-line bg-raised/25":"border-line bg-panel"),children:[c.jsxs("button",{type:"button",onClick:a,className:"flex w-full items-center gap-3 px-3 py-2.5 text-left",children:[c.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border border-line bg-panel font-display text-[12px] font-semibold text-muted",children:$.name.slice(0,1)}),c.jsxs("span",{className:"min-w-0 flex-1",children:[c.jsxs("span",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[12px] font-medium text-ink",children:$.name}),L&&c.jsx("span",{className:"rounded bg-accent-soft px-1.5 py-0.5 text-[8.5px] font-medium text-accent",children:"Active"})]}),c.jsxs("span",{className:W("mt-0.5 flex items-center gap-1 text-[9.5px]",C?"text-success":"text-faint"),children:[c.jsx("span",{className:W("h-1 w-1 rounded-full",C?"bg-success":"bg-faint")}),C?e==="custom"?"Endpoint configured":$.keyless?"No key needed":`Connected ${M}`:$.keyless?"Local endpoint":"No key"]})]}),!i&&c.jsx("span",{className:"hidden max-w-[170px] truncate text-[9.5px] text-faint sm:block",children:L&&H?Z?.name??H:x.length?`${x.length} live models`:""}),c.jsx(Po,{size:14,className:W("shrink-0 text-faint transition-transform",i&&"rotate-180")})]}),i&&c.jsxs("div",{className:"border-t border-line px-3 pb-3 pt-3",children:[!$.keyless&&c.jsxs("div",{className:"mb-2.5",children:[c.jsx(rs,{hint:C?"Saved and encrypted":"Required",children:"API key"}),c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx("div",{className:"min-w-0 flex-1",children:c.jsx(Fg,{value:T,onChange:E,placeholder:C?`Replace key ${M}`:$.keyHint,label:`${$.name} API key`})}),c.jsxs("button",{type:"button",onClick:()=>{he()},disabled:!T.trim()||A,className:"inline-flex h-8 shrink-0 items-center gap-1 rounded-lg bg-ink px-2.5 text-[10px] font-medium text-panel disabled:opacity-40",children:[A?c.jsx(Pt,{size:10}):c.jsx(xd,{size:10}),"Save"]})]}),C&&c.jsx("button",{type:"button",onClick:()=>{se()},className:"mt-1.5 text-[9.5px] font-medium text-faint transition-colors hover:text-danger",children:"Remove saved key"})]}),c.jsxs("div",{className:"mb-2.5",children:[c.jsx(rs,{hint:e==="custom"?"Required":"Optional",children:"Base URL"}),c.jsx("input",{value:q,onChange:O=>u(e,{baseUrl:O.target.value}),placeholder:$.baseUrl||"https://example.com/v1",spellCheck:!1,className:W(yr,"font-mono text-[11px]")}),c.jsx("p",{className:"mt-1 text-[9px] leading-relaxed text-faint",children:e==="custom"?"Point this at an OpenAI-compatible endpoint or proxy you control.":`Leave blank for ${$.baseUrl||"the provider default"}. Useful for a gateway or local proxy.`})]}),$.note&&c.jsx("p",{className:"mb-2.5 text-[9.5px] leading-relaxed text-faint",children:$.note}),c.jsxs("div",{children:[c.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[c.jsx("span",{className:"text-[11px] font-medium text-ink",children:"Model"}),c.jsxs("button",{type:"button",onClick:()=>{g(e,!0)},disabled:!C||b,className:"inline-flex items-center gap-1 text-[9.5px] font-medium text-faint transition-colors hover:text-ink disabled:cursor-not-allowed disabled:opacity-40",children:[b?c.jsx(Pt,{size:10}):c.jsx(Bi,{size:10}),b?"Loading":"Refresh live models"]})]}),y&&c.jsx("p",{className:"mb-1.5 rounded-md border border-danger/20 bg-danger/[0.04] px-2 py-1.5 text-[9.5px] leading-relaxed text-danger",children:y}),v&&!y&&c.jsx("p",{className:"mb-1.5 text-[9px] leading-relaxed text-faint",children:v}),x.length>0?c.jsxs(c.Fragment,{children:[c.jsxs("select",{value:L?H:"",onChange:O=>{O.target.value&&o(e,O.target.value)},className:W(yr,"font-mono text-[11px]"),"aria-label":`${$.name} model`,children:[c.jsx("option",{value:"",children:"Choose a model…"}),L&&H&&!x.some(O=>O.id===H)&&c.jsxs("option",{value:H,children:[H," (not listed)"]}),x.map(O=>c.jsxs("option",{value:O.id,children:[O.name||O.id,O.context?` · ${QI(O.context)} ctx`:""]},O.id))]}),c.jsxs("p",{className:"mt-1 text-[9px] text-faint",children:[x.length," usable chat model",x.length===1?"":"s",w==="catalog"?" from the models.dev fallback":" loaded live from the provider","."]})]}):c.jsx("p",{className:"text-[9.5px] leading-relaxed text-faint",children:b?"Loading the provider’s current models…":C?"No usable models were returned. You can still enter an exact model ID.":e==="custom"?"Set a base URL, then refresh.":$.keyless?"Start the local server, then refresh.":"Add a key to load the provider’s current models."}),c.jsxs("div",{className:"mt-2 flex items-center gap-1.5",children:[c.jsx("input",{value:N,onChange:O=>j(O.target.value),placeholder:"or enter a model ID",spellCheck:!1,"aria-label":`${$.name} model ID`,className:W(yr,"font-mono text-[10.5px]")}),c.jsx("button",{type:"button",onClick:()=>{const O=N.trim();O&&(o(e,O),j(""))},disabled:!N.trim(),className:"inline-flex h-8 shrink-0 items-center rounded-lg border border-line px-2.5 text-[10px] font-medium text-ink disabled:opacity-40",children:"Use ID"})]})]}),c.jsxs("div",{className:"mt-2.5 flex items-center justify-between gap-3",children:[c.jsx("p",{className:"text-[9px] leading-relaxed text-faint",children:$.keyless?"No key is stored for this provider.":C?"The daemon decrypts the key only when it calls the provider.":"The key never enters the page after saving."}),C&&!L&&c.jsxs("button",{type:"button",onClick:()=>{ae()},className:"shrink-0 text-[9.5px] font-medium text-accent hover:underline",children:["Use ",$.name]})]})]})]})}function e8(){const e=Me(),i=Me(x=>x.update),a=Me(x=>x.refreshProviders),[r,o]=B.useState(e.provider),[u,d]=B.useState(!1),p=Ad(),h=zo(p),g=h.includes(e.effort)?e.effort:h[0];return c.jsxs(c.Fragment,{children:[c.jsxs(Rn,{title:"Providers",description:"Keys and base URLs are stored by the local daemon. Model lists are fetched live from the provider; the bundled catalog is only a fallback when the provider list cannot be reached.",action:c.jsxs("button",{type:"button",onClick:async()=>{d(!0);try{await a()}catch(x){me.getState().notify(x instanceof Error?x.message:"Could not refresh providers.","error")}finally{d(!1)}},className:"inline-flex h-7 items-center gap-1 rounded-lg border border-line px-2 text-[10px] font-medium text-muted hover:text-ink",children:[u?c.jsx(Pt,{size:10}):c.jsx(Bi,{size:10}),"Refresh"]}),children:[c.jsxs("div",{className:"mb-3 flex items-start gap-2 rounded-lg border border-line bg-raised/50 px-3 py-2.5",children:[c.jsx(wr,{size:14,className:"mt-0.5 shrink-0 text-success"}),c.jsxs("p",{className:"text-[10.5px] leading-relaxed text-muted",children:["Keys are encrypted with AES-256-GCM under ",c.jsx("code",{className:"font-mono text-[10px]",children:"~/.maxcode"}),". The browser only receives a masked hint; the daemon decrypts a key in memory for the provider request."]})]}),c.jsx("div",{className:"space-y-2",children:Ku.map(x=>c.jsx(WI,{providerId:x.id,open:r===x.id,onToggle:()=>o(r===x.id?null:x.id)},x.id))})]}),c.jsx(Rn,{title:"Reasoning defaults",description:"Only controls advertised by the live model are offered; an unsupported field is never sent.",children:p?c.jsx("div",{className:"space-y-2.5",children:h.length>0?c.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-lg border border-line bg-raised/30 px-3 py-2.5",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-[11.5px] font-medium text-ink",children:"Effort"}),c.jsxs("p",{className:"mt-0.5 text-[9.5px] text-faint",children:["Options come from ",p.name||p.id," · ",p.apiKind]})]}),c.jsx("select",{value:g,onChange:x=>i({effort:x.target.value}),className:"h-8 rounded-lg border border-line bg-panel px-2 text-[11px] text-ink outline-none","aria-label":"Reasoning effort",children:h.map(x=>c.jsx("option",{value:x,children:lg[x].label},x))})]}):c.jsx("p",{className:"rounded-lg border border-line bg-raised/30 px-3 py-2.5 text-[10px] leading-relaxed text-faint",children:oh(p)})}):c.jsx("p",{className:"rounded-lg border border-line bg-raised/30 px-3 py-3 text-[10.5px] leading-relaxed text-faint",children:"Choose a model in the composer to see the reasoning controls this provider actually advertises."})}),c.jsx(Rn,{title:"Advanced request settings",description:"Defaults for every provider. The adapter ignores fields the selected model cannot accept.",children:c.jsxs("details",{className:"group/advanced rounded-xl border border-line bg-raised/20",children:[c.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between px-3 py-2.5 text-[11.5px] font-medium text-ink [&::-webkit-details-marker]:hidden",children:["Request controls and system prompt",c.jsx(Po,{size:13,className:"text-faint transition-transform group-open/advanced:rotate-180"})]}),c.jsxs("div",{className:"border-t border-line px-3 py-3",children:[c.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[c.jsxs("div",{children:[c.jsx(rs,{hint:"0 – 2",children:"Temperature"}),c.jsx("input",{type:"number",min:0,max:2,step:.1,value:e.temperature,onChange:x=>{const b=Number(x.target.value);Number.isFinite(b)&&i({temperature:Math.min(2,Math.max(0,b))})},className:yr})]}),c.jsxs("div",{children:[c.jsx(rs,{hint:"256 – 200,000",children:"Max output tokens"}),c.jsx("input",{type:"number",min:256,max:2e5,step:256,value:e.maxTokens,onChange:x=>{const b=Number(x.target.value);Number.isFinite(b)&&i({maxTokens:Math.min(2e5,Math.max(256,Math.round(b)))})},className:yr})]})]}),c.jsxs("div",{className:"mt-3",children:[c.jsxs("div",{className:"mb-1 flex items-center justify-between gap-3",children:[c.jsx("span",{className:"text-[11px] font-medium text-ink",children:"System prompt"}),c.jsxs("button",{type:"button",onClick:()=>i({systemPrompt:Lo}),className:"inline-flex items-center gap-1 text-[9.5px] font-medium text-faint hover:text-ink",children:[c.jsx(ng,{size:10})," Restore default"]})]}),c.jsx("textarea",{value:e.systemPrompt,onChange:x=>i({systemPrompt:x.target.value}),rows:9,spellCheck:!1,className:"thin-scroll w-full resize-y rounded-lg border border-line bg-panel px-2.5 py-2 font-mono text-[10.5px] leading-relaxed text-ink outline-none focus:border-accent/50"}),c.jsx("p",{className:"mt-1 text-[9px] leading-relaxed text-faint",children:"This is the shared prompt. Each session and workspace can override it from the prompt button in the chat header."})]})]})]})})]})}const t8=[{title:"Workspace and shell",tools:["read_file","list_files","grep","write_file","edit_file","rewrite_file","shell","git"]},{title:"Web",tools:["web_search","read_url"]},{title:"Delegation",tools:["subagent","skill"]}],n8={shell:pw,read_file:Pn,list_files:sw,write_file:rw,edit_file:s1,rewrite_file:s1,grep:nT,web_search:ss,read_url:Xh,git:lw,subagent:d2,skill:Wn},i8={shell:{label:"Shell",description:"Run commands in the workspace root. Plan mode allows read-only commands only."},read_file:{label:"Read file",description:"Inspect a file on disk before changing it."},list_files:{label:"List files",description:"Explore the real workspace tree."},write_file:{label:"Write file",description:"Create a file or replace its complete contents."},edit_file:{label:"Edit file",description:"Replace an exact passage in a file."},rewrite_file:{label:"Rewrite file",description:"Replace the entire content of an existing file."},grep:{label:"Grep",description:"Search file contents with a regular expression."},web_search:{label:"Web search",description:"Find current pages and cite the sources."},read_url:{label:"Read URL",description:"Open a public http(s) page as plain text."},git:{label:"Git",description:"Inspect or change repository state. Plan mode is read-only."},subagent:{label:"Subagent",description:"Delegate a read-only investigation and return a concise report."},skill:{label:"Skill",description:"List installed skills, load SKILL.md, and run commands inside a skill folder."}};function a8(){const e=Me(),i=Me(r=>r.updateTool),a=me(r=>r.openSettings);return c.jsxs(Rn,{title:"Tool permissions",description:"Ask adds an approval card to the conversation. Auto runs immediately. Disabled tools are not sent to the model at all. Plan mode always hides write tools.",children:[c.jsx("div",{className:"space-y-5",children:t8.map(r=>c.jsxs("div",{children:[c.jsx("p",{className:"mb-2 text-[10px] font-medium text-faint",children:r.title}),c.jsx("div",{className:"overflow-hidden rounded-xl border border-line",children:r.tools.map((o,u)=>{const d=e.tools[o],p=n8[o],h=i8[o];return c.jsxs("div",{className:W("flex flex-col gap-2.5 px-3 py-3 sm:flex-row sm:items-center",u!==0&&"border-t border-line",!d.enabled&&"opacity-60"),children:[c.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border border-line bg-panel text-muted",children:c.jsx(p,{size:13})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("p",{className:"text-[11.5px] font-medium text-ink",children:h.label}),c.jsx("span",{className:"font-mono text-[8.5px] text-faint",children:o})]}),c.jsx("p",{className:"mt-0.5 text-[9.5px] leading-relaxed text-muted",children:h.description}),r.title==="Web"&&!e.webSearchEnabled&&c.jsx("button",{type:"button",onClick:()=>a("search"),className:"mt-1 text-[9.5px] font-medium text-warning hover:underline",children:"Web access is off. Turn it on in Search."})]}),c.jsxs("div",{className:"flex shrink-0 items-center gap-2 pl-9 sm:pl-0",children:[d.enabled&&c.jsx(xg,{value:d.approval,onChange:g=>i(o,{approval:g}),options:[{value:"auto",label:"Auto",title:"Run without asking"},{value:"ask",label:"Ask",title:"Ask before running"}]}),c.jsx(Hi,{checked:d.enabled,onChange:g=>i(o,{enabled:g}),label:`Enable ${h.label}`})]})]},o)})})]},r.title))}),c.jsxs("div",{className:"mt-3 flex items-start gap-1.5 rounded-lg border border-line bg-raised/40 px-3 py-2.5 text-[9.5px] leading-relaxed text-faint",children:[c.jsx(wr,{size:11,className:"mt-0.5 shrink-0"}),"Shell and Git approval are on by default. Approvals apply to the open workspace only; the daemon rejects paths outside it with ",c.jsx("code",{className:"font-mono",children:".."})," or absolute escapes."]})]})}const r8=[{id:"duckduckgo",name:"DuckDuckGo",description:"No key. HTML results with a Wikipedia fallback; coverage is limited.",keyless:!0},{id:"tavily",name:"Tavily",description:"Built for AI agents. Search in, clean results out."},{id:"brave",name:"Brave Search",description:"Independent web index with a free tier."},{id:"serper",name:"Serper",description:"Google results through a simple API."}];function s8(){const e=Me(),i=Me(j=>j.update),a=Me(j=>j.saveSearchKey),r=me(j=>j.notify),[o,u]=B.useState(""),[d,p]=B.useState(!1),[h,g]=B.useState(!1),[x,b]=B.useState(null),y=e.secretStatus?.search,v=e.searchProvider==="duckduckgo",w=!!y?.configured,T=async()=>{if(!o.trim()){r("Paste a search API key first.","error");return}p(!0);try{await a(o.trim()),u(""),b(null),r("Search key saved and encrypted.","success")}catch(j){r(j instanceof Error?j.message:"Could not save that key.","error")}finally{p(!1)}},E=async()=>{try{await a(""),b(null),r("Search key removed.","success")}catch(j){r(j instanceof Error?j.message:"Could not remove that key.","error")}},N=async()=>{g(!0),b(null);try{const j=await Xt("web_search",{query:"OpenSol local coding agent",provider:e.searchProvider},"build"),A=j.result&&typeof j.result=="object"?j.result:{},R=Array.isArray(A.results)?A.results:[];b({ok:R.length>0,message:R.length>0?`${R.length} results via ${String(A.provider??e.searchProvider)}.`:"No results were returned. Try another provider or query."})}catch(j){b({ok:!1,message:j instanceof Error?j.message:"Search failed."})}finally{g(!1)}};return c.jsxs(c.Fragment,{children:[c.jsx(Rn,{title:"Web access",description:"When enabled, the agent may search and read public pages. The daemon performs the requests; this page never sees the raw results.",children:c.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-lg border border-line bg-raised/30 px-3 py-2.5",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-[11.5px] font-medium text-ink",children:"Allow web tools"}),c.jsx("p",{className:"mt-0.5 text-[9.5px] text-faint",children:"Adds web_search and read_url when they are also enabled under Tools."})]}),c.jsx(Hi,{checked:e.webSearchEnabled,onChange:j=>i({webSearchEnabled:j}),label:"Allow web tools"})]})}),c.jsxs(Rn,{title:"Search provider",description:"Choose where current results come from. A key is encrypted by the daemon.",children:[c.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:r8.map(j=>{const A=e.searchProvider===j.id;return c.jsxs("button",{type:"button",onClick:()=>{i({searchProvider:j.id}),b(null)},className:W("rounded-lg border p-3 text-left transition-colors",A?"border-accent/35 bg-accent-soft/40":"border-line bg-panel hover:bg-raised/40"),children:[c.jsxs("span",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"text-[11.5px] font-medium text-ink",children:j.name}),c.jsx("span",{className:W("flex h-3.5 w-3.5 items-center justify-center rounded-full border",A?"border-accent bg-accent text-on-accent":"border-line"),children:A&&c.jsx(Cn,{size:8,strokeWidth:3})})]}),c.jsx("span",{className:"mt-1 block text-[9.5px] leading-relaxed text-muted",children:j.description}),j.keyless&&c.jsx("span",{className:"mt-1.5 inline-block rounded bg-raised px-1.5 py-0.5 text-[8.5px] font-medium text-faint",children:"No key"})]},j.id)})}),!v&&c.jsxs("div",{className:"mt-3",children:[c.jsx(rs,{hint:w?`Saved ${y?.hint??""}`:"Required",children:e.searchProvider==="tavily"?"Tavily API key":e.searchProvider==="brave"?"Brave Search API key":"Serper API key"}),c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx("div",{className:"min-w-0 flex-1",children:c.jsx(Fg,{value:o,onChange:u,placeholder:e.searchProvider==="tavily"?"tvly-…":e.searchProvider==="brave"?"BSA…":"…",label:"Search API key"})}),c.jsxs("button",{type:"button",onClick:()=>{T()},disabled:!o.trim()||d,className:"inline-flex h-8 shrink-0 items-center gap-1 rounded-lg bg-ink px-2.5 text-[10px] font-medium text-panel disabled:opacity-40",children:[d?c.jsx(Pt,{size:10}):c.jsx(xd,{size:10}),"Save"]})]}),w&&c.jsx("button",{type:"button",onClick:()=>{E()},className:"mt-1.5 text-[9.5px] font-medium text-faint hover:text-danger",children:"Remove saved key"}),c.jsx("p",{className:"mt-1 text-[9px] leading-relaxed text-faint",children:"One key is stored. If you switch providers, replace the key with one issued by the new provider."})]}),c.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[c.jsxs("button",{type:"button",onClick:()=>{N()},disabled:h||!v&&!w,className:"inline-flex h-8 items-center gap-1.5 rounded-lg border border-line bg-panel px-2.5 text-[10.5px] font-medium text-ink transition-colors hover:bg-raised disabled:cursor-not-allowed disabled:opacity-40",children:[h?c.jsx(Pt,{size:12}):c.jsx(os,{size:12}),h?"Testing…":"Test search"]}),!v&&!w&&c.jsx("span",{className:"text-[9.5px] text-faint",children:"Add a key to test."})]}),x&&c.jsx("div",{className:W("mt-2.5 rounded-lg border px-3 py-2 text-[10px] leading-relaxed",x.ok?"border-success/25 bg-success/[0.04] text-success":"border-warning/30 bg-warning/[0.04] text-warning"),children:x.message})]})]})}function l8(){const e=Me(),i=Me(E=>E.addSkill),a=Me(E=>E.updateSkill),r=Me(E=>E.removeSkill),o=me(E=>E.askConfirm),u=me(E=>E.notify),[d,p]=B.useState(""),[h,g]=B.useState(""),x=B.useRef(null),b=e.skills.filter(E=>E.enabled).length;B.useEffect(()=>{const E=x.current;E&&(E.setAttribute("webkitdirectory",""),E.setAttribute("directory",""),E.setAttribute("multiple",""))},[]);const y=(E,N)=>{Me.getState().skills.some(A=>A.id===E.id)?a(E.id,E):i(E),u(`${E.name} ${N}.`,"success")},v=async E=>{if(!(!E||E.length===0)){p("folder");try{const N=await dI(Array.from(E));y(N,"installed")}catch(N){u(N instanceof Error?N.message:"Could not read that folder.","error")}finally{p("")}}},w=async()=>{const E=h.trim();if(E){p("npm");try{const{skill:N}=await oj(E);y(N,"installed from npm"),g("")}catch(N){u(N instanceof Error?N.message:"Could not install that npm package.","error")}finally{p("")}}},T=async E=>{await o({title:"Delete this skill?",body:`“${E.name}” and its files will be removed from this computer.`,confirmLabel:"Delete skill",tone:"danger"})&&r(E.id)};return c.jsxs(Rn,{title:"Installed skills",description:`${b} of ${e.skills.length} enabled. The model sees each skill’s name and description, loads SKILL.md through the skill tool, and can run the scripts inside the skill folder.`,children:[c.jsxs("div",{className:"mb-3 grid gap-2 sm:grid-cols-[auto_minmax(0,1fr)]",children:[c.jsxs("button",{type:"button",onClick:()=>x.current?.click(),disabled:!!d,className:"inline-flex h-9 items-center justify-center gap-1.5 rounded-lg bg-ink px-3 text-[10.5px] font-medium text-panel disabled:opacity-50",children:[d==="folder"?c.jsx(Pt,{size:11}):c.jsx(rg,{size:12}),"Install folder"]}),c.jsx("input",{ref:x,type:"file",className:"hidden",onChange:E=>{v(E.target.files),E.target.value=""}}),c.jsxs("div",{className:"flex gap-1.5",children:[c.jsx("input",{value:h,onChange:E=>g(E.target.value),onKeyDown:E=>{E.key==="Enter"&&w()},placeholder:"npm package, e.g. @scope/my-skill",spellCheck:!1,className:W(yr,"font-mono text-[10.5px]")}),c.jsxs("button",{type:"button",onClick:()=>{w()},disabled:!h.trim()||!!d,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-lg border border-line bg-panel px-2.5 text-[10.5px] font-medium text-ink hover:bg-raised disabled:opacity-40",children:[d==="npm"?c.jsx(Pt,{size:11}):c.jsx(Yh,{size:12}),"Install"]})]})]}),c.jsxs("p",{className:"mb-3 text-[9.5px] leading-relaxed text-faint",children:["A skill is a folder with a ",c.jsx("span",{className:"font-mono",children:"SKILL.md"})," (name, description, instructions) plus any scripts it needs. Folder uploads are read in your browser; npm packages come from the public registry through the local daemon."]}),e.skills.length===0?c.jsxs("div",{className:"rounded-xl border border-dashed border-line px-4 py-8 text-center",children:[c.jsx(Wn,{size:17,className:"mx-auto text-faint"}),c.jsx("p",{className:"mt-2 text-[11.5px] font-medium text-ink",children:"No skills installed"}),c.jsx("p",{className:"mt-1 text-[10px] text-muted",children:"Install a skill folder or an npm package to give the agent new procedures and scripts."})]}):c.jsx("div",{className:"overflow-hidden rounded-xl border border-line",children:e.skills.map((E,N)=>c.jsx("div",{className:W("px-3 py-3",N!==0&&"border-t border-line"),children:c.jsxs("div",{className:"flex items-start gap-2.5",children:[c.jsx("span",{className:"mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-accent-soft text-accent",children:c.jsx(Wn,{size:11})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[c.jsx("p",{className:"text-[11.5px] font-medium text-ink",children:E.name}),c.jsx("span",{className:"rounded bg-raised px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-wide text-faint",children:E.source??"folder"}),E.version&&c.jsxs("span",{className:"font-mono text-[8.5px] text-faint",children:["v",E.version]}),c.jsx("span",{className:W("text-[8.5px]",E.enabled?"text-success":"text-faint"),children:E.enabled?"Enabled":"Off"})]}),c.jsx("p",{className:"mt-0.5 text-[9.5px] leading-relaxed text-muted",children:E.description}),c.jsxs("p",{className:"mt-0.5 truncate font-mono text-[8.5px] text-faint",title:E.package||E.id,children:[E.package||E.id," · ",Object.keys(E.files??{}).length," files"]}),c.jsxs("details",{className:"group/skill mt-1",children:[c.jsxs("summary",{className:"inline-flex cursor-pointer list-none items-center gap-1 text-[9px] font-medium text-faint hover:text-muted [&::-webkit-details-marker]:hidden",children:["View SKILL.md",c.jsx(Po,{size:9,className:"transition-transform group-open/skill:rotate-180"})]}),c.jsx("pre",{className:"thin-scroll mt-1.5 max-h-44 overflow-auto whitespace-pre-wrap rounded-lg border border-line bg-raised/40 p-2 font-mono text-[9.5px] leading-relaxed text-muted",children:E.instructions})]})]}),c.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[c.jsx("button",{type:"button",onClick:()=>{T(E)},className:"icon-button h-7 w-7 hover:text-danger","aria-label":`Delete ${E.name}`,title:"Delete skill",children:c.jsx(la,{size:12})}),c.jsx(Hi,{checked:E.enabled,onChange:j=>a(E.id,{enabled:j}),label:`Enable ${E.name}`})]})]})},E.id))})]})}const Gu={cloudflare:{label:"Cloudflare Pages",short:"Cloudflare",icon:rh,description:"API token + account id. Create a token with the Cloudflare Pages edit permission.",fields:[{key:"apiToken",label:"API token",secret:!0,hint:"Required",placeholder:"Cloudflare API token"},{key:"accountId",label:"Account ID",secret:!1,hint:"Required",placeholder:"a1b2c3…"}]},netlify:{label:"Netlify",short:"Netlify",icon:ss,description:"Personal access token. A new site is created when no site id is set.",fields:[{key:"authToken",label:"Personal access token",secret:!0,hint:"Required",placeholder:"nfp_…"},{key:"siteId",label:"Site ID",secret:!1,hint:"Optional",placeholder:"Existing site id"}]},vercel:{label:"Vercel",short:"Vercel",icon:rh,description:"Access token. The CLI deploys a new production build through npx when needed.",fields:[{key:"token",label:"Access token",secret:!0,hint:"Required",placeholder:"vercel token"},{key:"teamId",label:"Team / scope ID",secret:!1,hint:"Optional",placeholder:"team_…"}]}};function o8({providerId:e}){const i=Gu[e],a=Me(R=>R.deploySecrets?.[e]),r=Me(R=>R.deployTools?.[e]),o=Me(R=>R.saveDeployCredentials),u=me(R=>R.notify),d=me(R=>R.askConfirm),[p,h]=B.useState(!1),[g,x]=B.useState({}),[b,y]=B.useState(""),[v,w]=B.useState(!1),T=i.fields.filter(R=>!R.secret),E=i.fields.find(R=>R.secret);B.useEffect(()=>{const R={};for(const $ of T)R[$.key]=a?.fields?.[$.key]??"";x(R)},[a,T.length]);const N=async()=>{w(!0);try{const R={...g};b.trim()&&E&&(R[E.key]=b.trim()),await o(e,R),y(""),u(`${i.label} credentials saved and encrypted.`,"success")}catch(R){u(R instanceof Error?R.message:"Could not save those credentials.","error")}finally{w(!1)}},j=async()=>{if(await d({title:`Remove ${i.label} credentials?`,body:"The encrypted token and ids are deleted from this computer. Deployments for this host will stop until you add them again.",confirmLabel:"Remove credentials",tone:"danger"}))try{const $={};for(const z of i.fields)$[z.key]="";await o(e,$),y(""),u(`${i.label} credentials removed.`,"success")}catch($){u($ instanceof Error?$.message:"Could not remove those credentials.","error")}},A=i.icon;return c.jsxs("div",{className:"rounded-xl border border-line bg-panel",children:[c.jsxs("button",{type:"button",onClick:()=>h(R=>!R),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left",children:[c.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border border-line bg-raised/60 text-muted",children:c.jsx(A,{size:13})}),c.jsxs("span",{className:"min-w-0 flex-1",children:[c.jsxs("span",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[11.5px] font-medium text-ink",children:i.label}),a?.configured?c.jsxs("span",{className:"flex items-center gap-1 text-[9px] text-success",children:[c.jsx("span",{className:"h-1 w-1 rounded-full bg-success"})," configured"]}):c.jsx("span",{className:"text-[9px] text-faint",children:"not configured"})]}),c.jsxs("span",{className:"mt-0.5 block text-[9px] text-faint",children:[r?.installed?`${r.label} ${r.version||"installed"}`:"Uses npx on deploy",a?.hint?` · token ${a.hint}`:""]})]}),c.jsx(Po,{size:13,className:W("shrink-0 text-faint transition-transform",p&&"rotate-180")})]}),p&&c.jsxs("div",{className:"border-t border-line px-3 py-3",children:[c.jsx("p",{className:"mb-2.5 text-[9.5px] leading-relaxed text-faint",children:i.description}),E&&c.jsxs("div",{className:"mb-2.5",children:[c.jsx(rs,{hint:a?.configured?"Saved; leave blank to keep":"Required",children:E.label}),c.jsx(Fg,{value:b,onChange:y,placeholder:a?.configured?`Replace token ${a.hint}`:E.placeholder,label:`${i.label} ${E.label}`})]}),c.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:T.map(R=>c.jsxs("div",{children:[c.jsx(rs,{hint:R.hint,children:R.label}),c.jsx("input",{value:g[R.key]??"",onChange:$=>x(z=>({...z,[R.key]:$.target.value})),placeholder:R.placeholder,spellCheck:!1,className:W(yr,"font-mono text-[10.5px]")})]},R.key))}),c.jsxs("div",{className:"mt-2.5 flex items-center justify-between gap-2",children:[a?.configured?c.jsx("button",{type:"button",onClick:()=>{j()},className:"text-[9.5px] font-medium text-faint hover:text-danger",children:"Remove credentials"}):c.jsx("span",{className:"text-[9px] text-faint",children:"Values are encrypted at rest."}),c.jsxs("button",{type:"button",onClick:()=>{N()},disabled:v,className:"inline-flex h-7 items-center gap-1 rounded-lg bg-ink px-2.5 text-[10px] font-medium text-panel disabled:opacity-40",children:[v?c.jsx(Pt,{size:10}):c.jsx(Cn,{size:10}),"Save"]})]})]})]})}function c8(){const e=Me(a=>a.deployTools),i=Me(a=>a.secretsError);return c.jsxs(c.Fragment,{children:[c.jsxs(Rn,{title:"Hosting credentials",description:"Tokens are encrypted by the local daemon and passed to the deploy CLI through environment variables. They are never written to logs or returned to this page.",children:[i&&c.jsx("p",{className:"mb-3 rounded-lg border border-warning/30 bg-warning/[0.04] px-3 py-2 text-[10px] text-warning",children:i}),c.jsx("div",{className:"space-y-2",children:Object.keys(Gu).map(a=>c.jsx(o8,{providerId:a},a))})]}),c.jsxs(Rn,{title:"Command-line tools",description:"OpenSol uses an installed CLI when available and falls back to npx. Node.js must be on PATH.",children:[c.jsx("div",{className:"overflow-hidden rounded-xl border border-line",children:Object.keys(Gu).map((a,r)=>{const o=e?.[a],u=Gu[a];return c.jsxs("div",{className:W("flex items-center gap-3 px-3 py-2.5",r!==0&&"border-t border-line"),children:[c.jsx(cl,{size:13,className:"shrink-0 text-faint"}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("p",{className:"text-[11px] font-medium text-ink",children:u.short}),c.jsxs("p",{className:"truncate font-mono text-[9px] text-faint",children:[o?.bin??"—"," ",o?.installed?`· ${o.version||"installed"}`:"· not installed, uses npx"]})]}),c.jsx("span",{className:W("shrink-0 rounded-full border px-1.5 py-0.5 text-[8.5px] font-medium",o?.installed?"border-success/25 text-success":"border-line text-faint"),children:o?.installed?"installed":"npx fallback"})]},a)})}),c.jsxs("button",{type:"button",onClick:()=>me.getState().setDeployOpen(!0),className:"mt-3 inline-flex h-8 items-center gap-1.5 rounded-lg bg-accent px-3 text-[10.5px] font-medium text-on-accent hover:bg-accent/90",children:[c.jsx(vr,{size:12})," Open deploy panel"]})]})]})}function u8(){return c.jsx(Rn,{title:"Local plugins",description:"OpenSol only installs plugin packages you choose from this machine. A plugin stays sandboxed and disabled until you review its permissions and mark it Safe.",children:c.jsx(II,{})})}function d8(){const e=Me(),i=Me(p=>p.update),a=me(p=>p.openSettings),r=me(p=>p.notify),o=gk(e.tools),u=[{id:"light",label:"Light",icon:ag},{id:"dark",label:"Dark",icon:Wh},{id:"system",label:"System",icon:Jh}],d=async()=>{const p=e.daemon?.dataDir??"~/.maxcode";try{await navigator.clipboard.writeText(p),r(`Copied the data folder path: ${p}`,"success")}catch{r(`Data folder: ${p}`,"info")}};return c.jsxs("div",{className:"px-5 py-2 sm:px-7",children:[c.jsxs("div",{className:"settings-row",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("p",{className:"settings-label",children:"Permission"}),c.jsx("p",{className:"settings-hint",children:"Choose the default permission mode for new sessions."})]}),c.jsx("select",{value:o,onChange:p=>i({tools:xk(e.tools,p.target.value)}),className:W("settings-select w-full sm:w-[210px]"),"aria-label":"Default permission mode",children:bg.map(p=>c.jsx("option",{value:p.value,children:p.label},p.value))})]}),c.jsxs("div",{className:"settings-row",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("p",{className:"settings-label",children:"Appearance"}),c.jsx("p",{className:"settings-hint",children:"Follow the system or pick a fixed theme."})]}),c.jsxs("div",{className:"w-full sm:w-[360px]",children:[c.jsx("div",{className:"grid grid-cols-3 gap-2",children:u.map(p=>{const h=p.icon,g=e.theme===p.id;return c.jsxs("button",{type:"button",onClick:()=>i({theme:p.id}),className:W("flex flex-col items-center gap-1.5 rounded-xl border px-2 py-2.5 transition-colors",g?"border-accent/60 bg-panel text-ink ring-2 ring-accent/10":"border-line text-muted hover:border-faint/50 hover:text-ink"),children:[c.jsx(h,{size:16}),c.jsx("span",{className:"text-[11px] font-medium",children:p.label})]},p.id)})}),c.jsx("button",{type:"button",onClick:()=>a("appearance"),className:"mt-2 text-[11px] font-medium text-muted transition-colors hover:text-ink",children:"More themes and theme previews →"})]})]}),c.jsxs("div",{className:"settings-row",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("p",{className:"settings-label",children:"Font size"}),c.jsx("p",{className:"settings-hint",children:"Only affects conversation content."})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("select",{value:e.chatFontSize,onChange:p=>i({chatFontSize:Number(p.target.value)}),className:W("settings-select w-[84px] text-center"),"aria-label":"Conversation font size",children:Array.from({length:9},(p,h)=>h+12).map(p=>c.jsx("option",{value:p,children:p},p))}),c.jsx("span",{className:"text-[11px] text-faint",children:"px"})]})]}),c.jsxs("div",{className:"settings-row",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("p",{className:"settings-label",children:"Work details"}),c.jsx("p",{className:"settings-hint",children:"Choose how much detail to show for tool calls."})]}),c.jsxs("select",{value:e.workDetail,onChange:p=>i({workDetail:p.target.value==="concise"?"concise":"detailed"}),className:W("settings-select w-full sm:w-[180px]"),"aria-label":"Work details",children:[c.jsx("option",{value:"concise",children:"Concise"}),c.jsx("option",{value:"detailed",children:"Detailed"})]})]}),c.jsxs("div",{className:"settings-row",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("p",{className:"settings-label",children:"When to collapse work details"}),c.jsx("p",{className:"settings-hint",children:"Choose when to automatically collapse work details."})]}),c.jsxs("select",{value:e.autoCollapseWork?"completion":"never",onChange:p=>i({autoCollapseWork:p.target.value==="completion"}),className:W("settings-select w-full sm:w-[180px]"),"aria-label":"When to collapse work details",children:[c.jsx("option",{value:"completion",children:"On completion"}),c.jsx("option",{value:"never",children:"Never"})]})]}),c.jsxs("div",{className:"settings-row",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("p",{className:"settings-label",children:"Let AI name sessions"}),c.jsx("p",{className:"settings-hint",children:"After the first answer, the model writes a short title for the session. Names you type yourself are never replaced."})]}),c.jsx(Hi,{checked:e.aiSessionTitles,onChange:p=>i({aiSessionTitles:p}),label:"Let AI name sessions"})]}),c.jsxs("div",{className:"settings-row",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("p",{className:"settings-label",children:"Show token estimates"}),c.jsx("p",{className:"settings-hint",children:"When a provider does not report usage, show a rough output estimate."})]}),c.jsx(Hi,{checked:e.showTokenEstimate,onChange:p=>i({showTokenEstimate:p}),label:"Show token estimates"})]}),c.jsxs("div",{className:"settings-row",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("p",{className:"settings-label",children:"Local configuration"}),c.jsx("p",{className:"settings-hint",children:"Settings, conversations and encrypted keys live in this folder."})]}),c.jsxs("button",{type:"button",onClick:()=>{d()},className:"inline-flex h-9 shrink-0 items-center gap-1.5 rounded-lg border border-line bg-panel px-3 text-[11.5px] font-medium text-ink transition-colors hover:bg-raised",title:e.daemon?.dataDir??"~/.maxcode",children:[c.jsx(gd,{size:13}),"Copy data folder path"]})]}),c.jsx("p",{className:"py-4 text-[10.5px] text-faint",children:"Changes are saved automatically to this computer."})]})}function f8(){const e=Me(),i=Me(r=>r.update),a=[{id:"light",label:"Light",className:"bg-[#fcfcfc]",line:"bg-[#e2e2e5]"},{id:"dark",label:"Dark",className:"bg-[#09090b]",line:"bg-[#2a2a31]"},{id:"night-owl",label:"Night Owl",className:"bg-[#011627]",line:"bg-[#1a3e5a]"},{id:"claude-code",label:"Claude Code",className:"bg-[#262624]",line:"bg-[#42423e]"},{id:"flame",label:"Flame",className:"bg-[#130d0c]",line:"bg-[#3e2621]"},{id:"system",label:"System",className:"bg-gradient-to-br from-[#fcfcfc] to-[#09090b]",line:"bg-[#8a8a92]"},...nE().themes().map(r=>({id:r.id,label:r.label,className:"bg-gradient-to-br from-accent-soft to-panel",line:"bg-line"}))];return c.jsxs(c.Fragment,{children:[c.jsx(Rn,{title:"Theme",description:"System follows your OS preference and updates when it changes.",children:c.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:a.map(r=>{const o=e.theme===r.id;return c.jsxs("button",{type:"button",onClick:()=>i({theme:r.id}),className:W("rounded-xl border p-2 text-left transition-all",o?"border-accent ring-2 ring-accent/10":"border-line hover:border-faint/50"),children:[c.jsxs("span",{className:W("block h-14 w-full overflow-hidden rounded-lg border border-line/60 p-2",r.className),children:[c.jsx("span",{className:W("block h-1.5 w-8 rounded-full",r.line)}),c.jsx("span",{className:W("mt-1.5 block h-1.5 w-12 rounded-full opacity-60",r.line)}),c.jsx("span",{className:"mt-3 block h-2 w-5 rounded-full bg-accent"})]}),c.jsxs("span",{className:"mt-1.5 flex items-center justify-between px-0.5",children:[c.jsx("span",{className:"text-[10.5px] font-medium text-ink",children:r.label}),o&&c.jsx(Cn,{size:11,className:"text-accent"})]})]},r.id)})})}),c.jsx(Rn,{title:"Interface",children:c.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-lg border border-line bg-raised/30 px-3 py-2.5",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-[11.5px] font-medium text-ink",children:"Show token estimates"}),c.jsx("p",{className:"mt-0.5 text-[9.5px] text-faint",children:"When a provider does not report usage, show a rough output estimate."})]}),c.jsx(Hi,{checked:e.showTokenEstimate,onChange:r=>i({showTokenEstimate:r}),label:"Show token estimates"})]})}),c.jsx(Rn,{title:"Shortcuts",children:c.jsx("div",{className:"space-y-1.5 text-[10.5px]",children:[["Search and commands","⌘ K / Ctrl K"],["Send message","Enter"],["New line","Shift Enter"],["Save file in the editor","⌘ S / Ctrl S"]].map(([r,o])=>c.jsxs("div",{className:"flex items-center justify-between rounded-lg px-1 py-1",children:[c.jsx("span",{className:"text-muted",children:r}),c.jsx("kbd",{className:"rounded border border-line bg-raised px-1.5 py-0.5 font-sans text-[9.5px] text-faint",children:o})]},r))})})]})}function p8(){const e=Ve(v=>v.sessions),i=Me(v=>v.daemon),a=Me(v=>v.secretStatus),r=Be(v=>v.entries),o=Be(v=>v.info),u=me(v=>v.askConfirm),d=me(v=>v.notify),p=B.useRef(null),[h,g]=B.useState(""),x=e.reduce((v,w)=>v+w.messages.length,0),b=r.filter(v=>v.type==="file").length,y=async(v,w)=>{if(await u({...w,tone:"danger",confirmLabel:w.label})){g(v);try{uM();const E=await cj(v);await JN(E),d(v==="history"?"Conversation history cleared.":v==="settings"?"Settings restored to defaults.":"OpenSol was reset.","success")}catch(E){d(E instanceof Error?E.message:"Could not reset that data.","error")}finally{g("")}}};return c.jsxs(c.Fragment,{children:[c.jsxs(Rn,{title:"About",children:[c.jsxs("div",{className:"flex items-start gap-3.5",children:[c.jsx(bl,{size:46}),c.jsxs("div",{children:[c.jsxs("div",{className:"flex flex-wrap items-baseline gap-2",children:[c.jsx("h3",{className:"font-display text-[20px] font-semibold tracking-[-0.03em] text-ink",children:"OpenSol"}),c.jsxs("span",{className:"text-[10px] text-faint",children:["v",i?.version??"1.0.0"]})]}),c.jsx("p",{className:"mt-0.5 text-[10.5px] font-medium text-muted",children:"An OpenSoftX product"}),c.jsx("p",{className:"mt-2 max-w-[520px] text-[10.5px] leading-relaxed text-muted",children:"A local-first coding agent with a real workspace, shell, git, web research, subagents and deploy flows. No OpenSol account and no OpenSoftX server. Your keys never leave this machine."})]})]}),c.jsx("div",{className:"mt-4 grid grid-cols-2 gap-2 sm:grid-cols-3",children:[["Conversations",String(e.length)],["Messages",String(x)],["Workspace files",o.available?String(b):"None"]].map(([v,w])=>c.jsxs("div",{className:"rounded-lg border border-line bg-raised/30 px-3 py-2",children:[c.jsx("p",{className:"text-[9px] text-faint",children:v}),c.jsx("p",{className:"mt-0.5 text-[15px] font-semibold tracking-[-0.02em] text-ink",children:w})]},v))})]}),c.jsxs(Rn,{title:"Local data",description:"Everything is stored under ~/.maxcode. Clearing that folder removes OpenSol’s local state.",children:[c.jsxs("div",{className:"space-y-1.5 rounded-lg border border-line bg-raised/30 px-3 py-2.5 text-[10px]",children:[c.jsxs("p",{className:"flex items-center justify-between gap-3",children:[c.jsx("span",{className:"text-faint",children:"Data folder"}),c.jsx("span",{className:"min-w-0 truncate font-mono text-ink",title:i?.dataDir,children:i?.dataDir??"~/.maxcode"})]}),c.jsxs("p",{className:"flex items-center justify-between gap-3",children:[c.jsx("span",{className:"text-faint",children:"Encryption"}),c.jsx("span",{className:"text-muted",children:a?.encryption??"AES-256-GCM"})]}),c.jsxs("p",{className:"flex items-center justify-between gap-3",children:[c.jsx("span",{className:"text-faint",children:"Runtime"}),c.jsxs("span",{className:"truncate text-muted",children:[i?.platform??"—"," · Node ",i?.node??"—"]})]}),c.jsxs("p",{className:"flex items-center justify-between gap-3",children:[c.jsx("span",{className:"text-faint",children:"Workspace"}),c.jsx("span",{className:"min-w-0 truncate font-mono text-muted",title:o.root,children:o.available?o.root:"No folder open"})]})]}),c.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[c.jsxs("button",{type:"button",onClick:ww,className:"inline-flex h-8 items-center gap-1.5 rounded-lg border border-line bg-panel px-2.5 text-[10.5px] font-medium text-ink hover:bg-raised",children:[c.jsx(Yh,{size:12})," Export conversations"]}),c.jsxs("button",{type:"button",onClick:()=>p.current?.click(),className:"inline-flex h-8 items-center gap-1.5 rounded-lg border border-line bg-panel px-2.5 text-[10.5px] font-medium text-ink hover:bg-raised",children:[c.jsx(rg,{size:12})," Import conversations"]}),c.jsx("input",{ref:p,type:"file",accept:"application/json,.json",className:"hidden",onChange:v=>{const w=v.target.files?.[0];w&&(zj(w).then(T=>d(T>0?`Imported ${T} conversation${T===1?"":"s"}.`:"Those conversations are already in your history.",T>0?"success":"info")).catch(T=>d(T instanceof Error?T.message:"Could not import that file.","error")),v.target.value="")}}),c.jsxs("button",{type:"button",onClick:()=>{y("history",{title:"Clear conversation history?",body:"Every conversation saved on this computer will be deleted. Keys, skills and workspace files are kept.",label:"Clear history"})},disabled:h==="history",className:"inline-flex h-8 items-center gap-1.5 rounded-lg border border-line bg-panel px-2.5 text-[10.5px] font-medium text-ink hover:bg-raised disabled:opacity-40",children:[h==="history"?c.jsx(Pt,{size:12}):c.jsx(la,{size:12})," Clear history"]})]}),c.jsxs("p",{className:"mt-3 flex items-center gap-2 text-[9.5px] text-faint",children:[c.jsx(gd,{size:11}),xl(new Blob([JSON.stringify(e)]).size)," of conversation history",c.jsx("span",{className:"text-line",children:"·"}),c.jsx(xd,{size:10}),"secrets encrypted at rest"]})]}),c.jsx(Rn,{title:"Danger zone",children:c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex flex-col gap-2 rounded-lg border border-line px-3 py-2.5 sm:flex-row sm:items-center sm:justify-between",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-[11px] font-medium text-ink",children:"Restore default settings"}),c.jsx("p",{className:"mt-0.5 text-[9.5px] text-muted",children:"Reset prompt, modes, tool permissions and skills. Keys and chats stay."})]}),c.jsxs("button",{type:"button",onClick:()=>{y("settings",{title:"Restore default settings?",body:"Your prompt, tool permissions, skills and interface settings return to their defaults. Conversations and encrypted keys are kept.",label:"Restore defaults"})},disabled:h==="settings",className:"inline-flex h-7 shrink-0 items-center gap-1 self-start rounded-lg border border-line px-2.5 text-[10px] font-medium text-muted hover:border-warning/30 hover:text-warning disabled:opacity-40 sm:self-auto",children:[h==="settings"?c.jsx(Pt,{size:11}):c.jsx(ng,{size:11})," Restore defaults"]})]}),c.jsxs("div",{className:"flex flex-col gap-2 rounded-lg border border-danger/20 bg-danger/[0.02] px-3 py-2.5 sm:flex-row sm:items-center sm:justify-between",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-[11px] font-medium text-ink",children:"Reset OpenSol"}),c.jsx("p",{className:"mt-0.5 text-[9.5px] text-muted",children:"Delete conversations, encrypted keys, skills, settings and the remembered workspace."})]}),c.jsxs("button",{type:"button",onClick:()=>{y("all",{title:"Reset everything?",body:"Conversations, API keys, hosting credentials, skills, settings and the workspace list will be permanently removed from this computer. Files in your project folder are never deleted.",label:"Reset everything"})},disabled:h==="all",className:"inline-flex h-7 shrink-0 items-center gap-1 self-start rounded-lg bg-danger px-2.5 text-[10px] font-medium text-on-accent hover:bg-danger/90 disabled:opacity-40 sm:self-auto",children:[h==="all"?c.jsx(Pt,{size:11}):c.jsx(la,{size:11})," Reset everything"]})]})]})})]})}function m8(){const e=Tn(d=>d.servers),i=Tn(d=>d.loaded),a=Tn(d=>d.load),r=me(d=>d.setMcpOpen);B.useEffect(()=>{a()},[a]);const o=e.filter(d=>d.status==="connected").length,u=e.filter(d=>d.status==="needs_auth").length;return c.jsx("div",{className:"space-y-5 px-5 py-6 sm:px-8",children:c.jsxs("div",{className:"settings-card flex flex-wrap items-center gap-4",children:[c.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent",children:c.jsx(Xh,{size:18})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("p",{className:"settings-label",children:"MCP panel"}),c.jsx("p",{className:"settings-hint",children:i?e.length===0?"No servers yet. Add a local command or a remote URL, with OAuth where the service asks for it.":`${o} of ${e.length} server${e.length===1?"":"s"} connected${u?` · ${u} waiting for sign-in`:""}.`:"Loading…"})]}),c.jsx("button",{type:"button",onClick:()=>r(!0),className:"inline-flex h-9 shrink-0 items-center gap-1.5 rounded-full bg-ink px-4 text-[12px] font-medium text-panel transition-transform active:scale-95",children:"Open MCP panel"})]})})}function h8(){const e=me(x=>x.settingsOpen),i=me(x=>x.settingsTab),a=me(x=>x.closeSettings),r=me(x=>x.openSettings),o=me(x=>x.notify),u=Me(x=>x.daemon),d=B.useRef(null),p=Math.max(0,Eo.findIndex(x=>x.id===i)),h=Eo[p];B.useEffect(()=>{e&&d.current?.scrollTo({top:0})},[e,i]);const g=async()=>{const x=u?.dataDir??"~/.opensol";try{await navigator.clipboard.writeText(x),o(`Copied the data folder path: ${x}`,"success")}catch{o(`Data folder: ${x}`,"info")}};return c.jsx(Ko,{open:e,onClose:a,labelledBy:"settings-title",className:"settings-shell h-[94dvh] p-0 sm:h-[min(88dvh,780px)] sm:w-[min(1040px,96vw)] sm:!rounded-[28px]",children:c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col sm:flex-row",children:[c.jsxs("aside",{className:"relative hidden w-[232px] shrink-0 flex-col bg-canvas sm:flex",children:[c.jsx("div",{className:"settings-glow pointer-events-none absolute inset-x-0 top-0 h-48"}),c.jsxs("div",{className:"relative px-6 pb-4 pt-6",children:[c.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.24em] text-faint",children:"OpenSol · v3.1.0"}),c.jsx("h2",{id:"settings-title",className:"mt-1.5 font-display text-[26px] font-semibold leading-none tracking-[-0.035em] text-ink",children:"Settings"})]}),c.jsxs("nav",{className:"relative flex-1 overflow-y-auto px-3 pb-3",children:[c.jsx("span",{"aria-hidden":!0,className:"settings-pill absolute left-3 right-3 top-0 h-10 rounded-2xl bg-panel shadow-pill ring-1 ring-line transition-transform duration-500 ease-spring",style:{transform:`translateY(${p*42}px)`}}),Eo.map((x,b)=>{const y=x.icon,v=i===x.id,w=x.id==="plugins";return c.jsxs("button",{type:"button",disabled:w,onClick:()=>r(x.id),title:w?"Plugins are disabled for maintenance":x.description,className:W("group/tab relative mb-[2px] flex h-10 w-full items-center gap-3 rounded-2xl px-3 text-left text-[12.5px] transition-colors duration-200",w&&"cursor-not-allowed opacity-40",v?"font-semibold text-ink":"text-muted hover:text-ink"),children:[c.jsx("span",{className:W("w-4 font-mono text-[9.5px] tabular-nums transition-colors",v?"text-accent":"text-faint"),children:String(b+1).padStart(2,"0")}),c.jsx(y,{size:14,className:W("transition-transform duration-300 group-hover/tab:scale-110",v?"text-accent":"text-faint")}),x.label,w&&c.jsx("span",{className:"ml-auto text-[8px] text-faint",children:"off"})]},x.id)})]}),c.jsx("div",{className:"relative px-6 py-4",children:c.jsxs("p",{className:"flex items-center gap-1.5 text-[10px] text-faint",children:[c.jsx(xd,{size:10})," Keys encrypted on this machine"]})})]}),c.jsxs("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col bg-panel sm:border-l sm:border-line",children:[c.jsx("div",{className:"thin-scroll flex shrink-0 gap-1.5 overflow-x-auto border-b border-line px-3 py-2.5 sm:hidden",children:Eo.map(x=>c.jsx("button",{type:"button",onClick:()=>r(x.id),className:W("shrink-0 rounded-full px-3 py-1.5 text-[11px] font-medium transition-all duration-200",i===x.id?"bg-ink text-panel":"bg-raised text-muted"),children:x.label},x.id))}),c.jsxs("header",{className:"flex shrink-0 items-start justify-between gap-4 px-5 pb-3 pt-5 sm:px-8 sm:pt-7",children:[c.jsxs("div",{className:"settings-title-in min-w-0",children:[c.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.22em] text-accent",children:[String(p+1).padStart(2,"0")," / ",String(Eo.length).padStart(2,"0")]}),c.jsx("h3",{className:"mt-1 font-display text-[28px] font-semibold leading-none tracking-[-0.035em] text-ink",children:h.label}),c.jsx("p",{className:"mt-2 max-w-[560px] text-[12.5px] leading-relaxed text-muted",children:h.description})]},i),c.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[c.jsxs("button",{type:"button",onClick:()=>{g()},className:"hidden h-8 items-center gap-1.5 rounded-full border border-line bg-panel px-3 text-[11px] font-medium text-ink transition-all hover:bg-raised active:scale-95 sm:inline-flex",title:u?.dataDir??"~/.opensol",children:[c.jsx(gd,{size:12}),"Data folder"]}),c.jsx("button",{type:"button",className:"icon-button h-8 w-8 rounded-full",onClick:a,"aria-label":"Close settings",children:c.jsx(Ni,{size:16})})]})]}),c.jsx("div",{ref:d,className:"thin-scroll min-h-0 flex-1 overflow-y-auto pb-6",children:c.jsxs("div",{className:"settings-enter",children:[i==="general"&&c.jsx(d8,{}),i==="models"&&c.jsx(e8,{}),i==="tools"&&c.jsx(a8,{}),i==="search"&&c.jsx(s8,{}),i==="skills"&&c.jsx(l8,{}),i==="plugins"&&c.jsx(u8,{}),i==="mcp"&&c.jsx(m8,{}),i==="deploy"&&c.jsx(c8,{}),i==="appearance"&&c.jsx(f8,{}),i==="about"&&c.jsx(p8,{})]},i)})]})]})})}const ih=[{id:"cloudflare",label:"Cloudflare Pages",short:"Pages",icon:rh,blurb:"Fast global hosting with a generous free tier.",needs:"API token + account id"},{id:"netlify",label:"Netlify",short:"Netlify",icon:ss,blurb:"Create a site and publish a folder in one step.",needs:"Personal access token"},{id:"vercel",label:"Vercel",short:"Vercel",icon:RC,blurb:"Production deploys through the Vercel CLI.",needs:"Access token"}];function g8(){const e=me(de=>de.deployOpen),i=me(de=>de.setDeployOpen),a=me(de=>de.openSettings),r=me(de=>de.notify),o=Be(de=>de.root),u=Be(de=>de.info.name),d=Be(de=>de.info.available),p=Me(de=>de.deployTools),h=Me(de=>de.deploySecrets),[g,x]=B.useState("cloudflare"),[b,y]=B.useState(""),[v,w]=B.useState(""),[T,E]=B.useState(""),[N,j]=B.useState(""),[A,R]=B.useState(null),[$,z]=B.useState(!1),[C,L]=B.useState(!1),[q,M]=B.useState([]),[H,Z]=B.useState(null),[he,se]=B.useState(""),[ae,O]=B.useState(!1),ee=B.useRef(null),te=B.useRef(null),be=B.useRef(0),S=ih.find(de=>de.id===g)??ih[0],ve=p?.[g],ce=!!h?.[g]?.configured,D=h?.[g]?.fields?.lastUrl??"";B.useEffect(()=>{e&&(y(o),w(""),E(""),j(""),R(null),Z(null),se(""),M([]),L(!1),O(!1))},[e,o]);const U=async(de=b)=>{if(de.trim()){z(!0);try{const Ne=await Tj(de.trim());R(Ne),Ne.buildCommand&&E(ye=>ye||Ne.buildCommand),Ne.outputDir&&w(ye=>ye||Ne.outputDir),Ne.name&&j(ye=>ye||Ne.name)}catch(Ne){R(null),se(Ne instanceof Error?Ne.message:"Could not inspect that folder.")}finally{z(!1)}}};B.useEffect(()=>{if(!e||!b.trim())return;const de=window.setTimeout(()=>{U(b)},450);return()=>window.clearTimeout(de)},[e,b]),B.useEffect(()=>{if(!e)return;const de=te.current;de&&(de.scrollTop=de.scrollHeight)},[q,e]),B.useEffect(()=>()=>ee.current?.abort(),[]);const re=(de,Ne)=>{const ye=Ne.trimEnd();if(!ye)return;be.current+=1;const Q=be.current;M(Pe=>[...Pe.slice(-500),{id:Q,stream:de,text:ye}])},ge=()=>{ee.current?.abort(),i(!1)},_e=async()=>{if(C)return;if(!b.trim()){se("Choose the project folder to deploy.");return}L(!0),Z(null),se(""),M([]);const de=new AbortController;ee.current=de,re("meta",`Preparing ${S.label} deploy from ${b.trim()}`);try{for await(const Ne of Cj({provider:g,path:b.trim(),outputDir:v.trim()||void 0,buildCommand:T.trim()||void 0,projectName:N.trim()||void 0},de.signal))if(Ne.type==="log")re(Ne.stream,Ne.text);else if(Ne.type==="start")re("meta",`Deploying ${Ne.provider}${Ne.path?` · ${Ne.path}`:""}`);else if(Ne.type==="done"){Z(Ne.result),re("meta",`Published ${Ne.result.url}`);break}else if(Ne.type==="error"){se(Ne.message),re("stderr",Ne.message);break}}catch(Ne){if(Ne instanceof DOMException&&Ne.name==="AbortError")re("meta","Deployment stopped.");else{const ye=Ne instanceof Error?Ne.message:"The deployment failed.";se(ye),re("stderr",ye)}}finally{ee.current=null,L(!1)}},Ue=async()=>{if(H?.url)try{await navigator.clipboard.writeText(H.url),O(!0),window.setTimeout(()=>O(!1),1600)}catch{r("Clipboard access was blocked by the browser.","error")}};return c.jsxs(Ko,{open:e,onClose:ge,labelledBy:"deploy-title",wide:!0,className:"h-[92dvh] p-0 sm:h-[min(90dvh,760px)]",children:[c.jsxs("div",{className:"flex shrink-0 items-start justify-between gap-4 border-b border-line px-5 py-4 sm:px-6",children:[c.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[c.jsx("span",{className:"mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent",children:c.jsx(vr,{size:17})}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("h2",{id:"deploy-title",className:"font-display text-[20px] font-semibold tracking-[-0.02em] text-ink",children:"Deploy a site"}),c.jsx("p",{className:"mt-0.5 text-[11.5px] leading-relaxed text-muted",children:"Publish the open workspace or another project folder. Tokens stay encrypted on this machine."})]})]}),c.jsx("button",{type:"button",className:"icon-button -mr-1 shrink-0",onClick:ge,"aria-label":"Close deploy panel",children:c.jsx(Ni,{size:16})})]}),c.jsxs("div",{className:"grid min-h-0 flex-1 lg:grid-cols-[minmax(0,380px)_minmax(0,1fr)]",children:[c.jsx("div",{className:"thin-scroll min-h-0 overflow-y-auto border-b border-line lg:border-b-0 lg:border-r",children:c.jsxs("div",{className:"space-y-5 p-5",children:[c.jsxs("div",{children:[c.jsx("p",{className:"mb-2 text-[10px] font-semibold uppercase tracking-[0.14em] text-faint",children:"Host"}),c.jsx("div",{className:"grid gap-1.5",children:ih.map(de=>{const Ne=de.icon,ye=g===de.id;return c.jsxs("button",{type:"button",onClick:()=>x(de.id),disabled:C,className:W("group/host flex items-start gap-2.5 rounded-xl border px-3 py-2.5 text-left transition-all duration-200 disabled:opacity-60",ye?"border-accent/40 bg-gradient-to-br from-accent-soft/80 to-panel shadow-pill":"border-line bg-panel hover:border-line hover:bg-raised/50"),children:[c.jsx("span",{className:W("mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-lg transition-colors",ye?"bg-accent text-on-accent shadow-pill":"bg-raised text-muted group-hover/host:text-ink"),children:c.jsx(Ne,{size:13})}),c.jsxs("span",{className:"min-w-0 flex-1",children:[c.jsxs("span",{className:"flex items-center gap-2",children:[c.jsx("span",{className:W("text-[12px] font-medium",ye?"text-accent":"text-ink"),children:de.label}),h?.[de.id]?.configured?c.jsx(Cn,{size:11,className:"text-success"}):c.jsx("span",{className:"text-[9px] text-warning",children:"needs token"})]}),c.jsx("span",{className:"mt-0.5 block text-[10px] leading-relaxed text-faint",children:de.blurb})]})]},de.id)})})]}),D&&c.jsxs("a",{href:D,target:"_blank",rel:"noreferrer",className:"flex items-center gap-1.5 rounded-lg border border-line bg-raised/30 px-2.5 py-1.5 text-[9.5px] text-muted hover:text-ink",children:[c.jsx(Vu,{size:10,className:"shrink-0 text-faint"}),c.jsxs("span",{className:"truncate",children:["Last deploy: ",D]})]}),!ce&&c.jsxs("div",{className:"rounded-xl border border-warning/25 bg-warning/[0.045] p-3",children:[c.jsxs("p",{className:"flex items-start gap-1.5 text-[10.5px] leading-relaxed text-muted",children:[c.jsx(wr,{size:12,className:"mt-0.5 shrink-0 text-warning"}),S.label," needs ",S.needs,". Add it once in Settings → Deploy; it is encrypted with AES-256-GCM and never appears in the page again."]}),c.jsxs("button",{type:"button",onClick:()=>{i(!1),a("deploy")},className:"mt-2 inline-flex h-7 items-center rounded-lg bg-ink px-2.5 text-[10.5px] font-medium text-panel",children:["Add ",S.label," credentials"]})]}),c.jsxs("div",{children:[c.jsxs("div",{className:"mb-1.5 flex items-center justify-between gap-2",children:[c.jsx("label",{htmlFor:"deploy-path",className:"text-[10px] font-semibold uppercase tracking-[0.14em] text-faint",children:"Project folder"}),d&&c.jsxs("button",{type:"button",onClick:()=>y(o),disabled:C,className:"inline-flex items-center gap-1 text-[9.5px] font-medium text-accent disabled:opacity-40",children:[c.jsx(ls,{size:10}),"Use open workspace"]})]}),c.jsx("input",{id:"deploy-path",value:b,onChange:de=>y(de.target.value),disabled:C,placeholder:"/absolute/path/to/project or ~/Projects/site",spellCheck:!1,className:"h-9 w-full rounded-lg border border-line bg-panel px-2.5 font-mono text-[10.5px] text-ink outline-none transition-colors placeholder:text-faint focus:border-accent/50 disabled:opacity-60"}),c.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[c.jsxs("p",{className:"min-w-0 flex-1 truncate text-[9px] leading-relaxed text-faint",children:[d?`Open workspace: ${u}`:"No workspace open."," Any folder that already exists on this machine."]}),c.jsxs("button",{type:"button",onClick:()=>{U()},disabled:C||$||!b.trim(),className:"inline-flex h-6 shrink-0 items-center gap-1 rounded-md border border-line bg-panel px-1.5 text-[9px] font-medium text-muted hover:text-ink disabled:opacity-40",children:[$?c.jsx(Pt,{size:9}):c.jsx(Wn,{size:9}),"Detect"]})]}),A&&c.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5 rounded-lg border border-line bg-raised/40 px-2 py-1.5 text-[9px] text-muted",children:[c.jsx("span",{className:"rounded bg-panel px-1.5 py-0.5 font-medium text-ink",children:A.framework}),A.existingOutputs.length>0&&c.jsxs("span",{children:["build output: ",A.existingOutputs.join(", ")]}),!A.hasPackageJson&&c.jsx("span",{children:"static folder, no package.json"})]})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-2.5",children:[c.jsxs("div",{children:[c.jsx("label",{htmlFor:"deploy-output",className:"mb-1.5 block text-[10px] font-semibold uppercase tracking-[0.14em] text-faint",children:"Output folder"}),c.jsx("input",{id:"deploy-output",value:v,onChange:de=>w(de.target.value),disabled:C,placeholder:"auto",spellCheck:!1,className:"h-8 w-full rounded-lg border border-line bg-panel px-2 font-mono text-[10.5px] text-ink outline-none focus:border-accent/50 disabled:opacity-60"})]}),c.jsxs("div",{children:[c.jsx("label",{htmlFor:"deploy-name",className:"mb-1.5 block text-[10px] font-semibold uppercase tracking-[0.14em] text-faint",children:"Project name"}),c.jsx("input",{id:"deploy-name",value:N,onChange:de=>j(de.target.value),disabled:C,placeholder:"my-site",spellCheck:!1,className:"h-8 w-full rounded-lg border border-line bg-panel px-2 font-mono text-[10.5px] text-ink outline-none focus:border-accent/50 disabled:opacity-60"})]})]}),c.jsx("div",{className:"flex flex-wrap gap-1",children:["auto","dist","build","out","."].map(de=>c.jsx("button",{type:"button",onClick:()=>w(de),disabled:C,className:W("chip h-7 px-2 text-[9.5px]",(v||"auto")===de&&"chip-active"),children:de},de))}),c.jsxs("div",{children:[c.jsxs("label",{htmlFor:"deploy-build",className:"mb-1.5 block text-[10px] font-semibold uppercase tracking-[0.14em] text-faint",children:["Build command ",c.jsx("span",{className:"font-normal normal-case tracking-normal text-faint",children:"optional"})]}),c.jsx("input",{id:"deploy-build",value:T,onChange:de=>E(de.target.value),disabled:C,placeholder:"npm run build",spellCheck:!1,className:"h-8 w-full rounded-lg border border-line bg-panel px-2 font-mono text-[10.5px] text-ink outline-none focus:border-accent/50 disabled:opacity-60"}),c.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1",children:[["npm run build","pnpm build","yarn build"].map(de=>c.jsx("button",{type:"button",onClick:()=>E(de),disabled:C,className:"rounded-md border border-line px-1.5 py-0.5 text-[9px] text-faint transition-colors hover:text-ink",children:de},de)),T&&c.jsx("button",{type:"button",onClick:()=>E(""),disabled:C,className:"px-1.5 py-0.5 text-[9px] text-faint hover:text-danger",children:"clear"})]})]}),c.jsxs("div",{className:"flex items-start gap-1.5 rounded-lg border border-line bg-raised/40 px-2.5 py-2 text-[9.5px] leading-relaxed text-faint",children:[c.jsx(cl,{size:11,className:"mt-0.5 shrink-0"}),ve?.installed?`${ve.label} ${ve.version?`(${ve.version})`:""} is installed locally.`:`${ve?.label??S.short} CLI is not installed; OpenSol will use npx for this deploy.`]})]})}),c.jsxs("div",{className:"flex min-h-0 flex-col",children:[c.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-line px-4 py-2.5",children:[c.jsx("span",{className:W("h-1.5 w-1.5 rounded-full",C?"animate-breathe bg-accent":H?"bg-success":"bg-faint")}),c.jsx("p",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-muted",children:C?`Deploying with ${S.label}…`:H?"Deployment complete":"Deploy output"}),C&&c.jsxs("button",{type:"button",onClick:()=>ee.current?.abort(),className:"inline-flex h-7 items-center gap-1 rounded-lg border border-line px-2 text-[10px] font-medium text-muted hover:text-ink",children:[c.jsx(ig,{size:9,fill:"currentColor"})," Stop"]}),!C&&c.jsxs("button",{type:"button",onClick:()=>{_e()},disabled:!ce||!b.trim(),className:"inline-flex h-7 items-center gap-1.5 rounded-lg bg-accent px-2.5 text-[10.5px] font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-40",children:[c.jsx(WT,{size:10,fill:"currentColor"}),"Deploy"]})]}),H&&c.jsx("div",{className:"shrink-0 border-b border-line bg-success/[0.045] px-4 py-3",children:c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx(Cn,{size:14,className:"mt-0.5 shrink-0 text-success"}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("p",{className:"text-[11.5px] font-medium text-ink",children:"Published successfully"}),c.jsx("a",{href:H.url,target:"_blank",rel:"noreferrer",className:"mt-0.5 block truncate text-[11px] text-accent hover:underline",children:H.url})]}),c.jsx("button",{type:"button",onClick:Ue,className:"icon-button h-7 w-7",title:"Copy URL","aria-label":"Copy URL",children:ae?c.jsx(Cn,{size:12,className:"text-success"}):c.jsx(hd,{size:12})}),c.jsx("a",{href:H.url,target:"_blank",rel:"noreferrer",className:"icon-button h-7 w-7",title:"Open site","aria-label":"Open site",children:c.jsx(Vu,{size:12})})]})}),he&&c.jsx("div",{className:"shrink-0 border-b border-danger/20 bg-danger/[0.045] px-4 py-2.5 text-[10.5px] leading-relaxed text-danger",children:he}),c.jsx("div",{ref:te,className:"thin-scroll min-h-0 flex-1 overflow-y-auto bg-canvas/40 px-4 py-3",children:q.length===0&&!C?c.jsxs("div",{className:"flex h-full min-h-[180px] flex-col items-center justify-center gap-2 px-6 text-center",children:[c.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-raised text-faint",children:c.jsx(vr,{size:17})}),c.jsx("p",{className:"text-[11.5px] font-medium text-muted",children:"Ready when you are"}),c.jsx("p",{className:"max-w-[260px] text-[10px] leading-relaxed text-faint",children:"The build and deploy output appears here. Credentials are passed to the CLI through the environment, never printed in the log."})]}):c.jsxs("pre",{className:"whitespace-pre-wrap break-words font-mono text-[10px] leading-[1.7] text-muted",children:[q.map(de=>c.jsxs("span",{className:W("block",de.stream==="stderr"&&"text-danger",de.stream==="meta"&&"text-accent"),children:[de.stream==="meta"?"› ":"",de.text]},de.id)),C&&c.jsxs("span",{className:"mt-1 flex items-center gap-1.5 text-accent",children:[c.jsx(Pt,{size:10})," working…"]})]})}),c.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-2 border-t border-line px-4 text-[9px] text-faint",children:[c.jsx(wr,{size:10}),"Tokens encrypted at rest",c.jsx("span",{className:"ml-auto",children:b.trim()?b.trim().split(/[\\/]/).filter(Boolean).pop():"No folder"})]})]})]})]})}const Hh={name:"",transport:"stdio",command:"",args:"",env:"",url:"",headers:"",oauth:!1,clientId:"",clientSecret:"",scope:""},x8=[{label:"Filesystem",description:"Read and write files in a folder",draft:{name:"Filesystem",command:"npx",args:"-y @modelcontextprotocol/server-filesystem ."}},{label:"Memory",description:"Knowledge-graph memory",draft:{name:"Memory",command:"npx",args:"-y @modelcontextprotocol/server-memory"}},{label:"Fetch",description:"Fetch web pages as markdown",draft:{name:"Fetch",command:"uvx",args:"mcp-server-fetch"}},{label:"Linear",description:"Issues and projects · OAuth",draft:{name:"Linear",transport:"http",url:"https://mcp.linear.app/mcp",oauth:!0}},{label:"Notion",description:"Pages and databases · OAuth",draft:{name:"Notion",transport:"http",url:"https://mcp.notion.com/mcp",oauth:!0}},{label:"Sentry",description:"Errors and traces · OAuth",draft:{name:"Sentry",transport:"http",url:"https://mcp.sentry.dev/mcp",oauth:!0}},{label:"Atlassian",description:"Jira and Confluence · SSE + OAuth",draft:{name:"Atlassian",transport:"sse",url:"https://mcp.atlassian.com/v1/sse",oauth:!0}},{label:"DeepWiki",description:"Repo docs · no sign-in",draft:{name:"DeepWiki",transport:"http",url:"https://mcp.deepwiki.com/mcp"}}];function b8(e){const i=[],a=/"([^"]*)"|'([^']*)'|(\S+)/g;let r;for(;r=a.exec(e);)i.push(r[1]??r[2]??r[3]);return i}function y8(e=[]){return e.map(i=>/\s/.test(i)?`"${i}"`:i).join(" ")}function Vv(e,i){const a={};for(const r of e.split(`
|
|
278
|
+
`)){const o=r.indexOf(i);o<1||(a[r.slice(0,o).trim()]=r.slice(o+1).trim())}return a}function Kv(e,i){return Object.entries(e??{}).map(([a,r])=>`${a}${i===":"?": ":i}${r}`).join(`
|
|
279
|
+
`)}function iE(e){return{id:e.id,name:e.name,transport:e.transport,command:e.command??"",args:y8(e.args),env:Kv(e.env,"="),url:e.url??"",headers:Kv(e.headers,":"),oauth:!!e.oauth?.enabled,clientId:e.oauth?.clientId??"",clientSecret:e.oauth?.clientSecret??"",scope:e.oauth?.scope??""}}function Xv(e){return e.name.trim()?e.transport==="stdio"?!!e.command.trim():/^https?:\/\//i.test(e.url.trim()):!1}function aE(e,i){const a={...e.id?{id:e.id}:{},name:e.name.trim(),transport:e.transport,enabled:i?.enabled??!0,approval:i?.approval??"ask",disabledTools:i?.disabledTools??[]};return e.transport==="stdio"?{...a,command:e.command.trim(),args:b8(e.args),env:Vv(e.env,"=")}:{...a,url:e.url.trim(),headers:Vv(e.headers,":"),oauth:e.oauth?{enabled:!0,clientId:e.clientId.trim(),clientSecret:e.clientSecret.trim(),scope:e.scope.trim()}:null}}function nl(e){return aE(iE(e),e)}const ol=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Zv=e=>{const i={};if(ol(e))for(const[a,r]of Object.entries(e))(typeof r=="string"||typeof r=="number")&&(i[a]=String(r));return i};function v8(e,i){const a=i.disabled!==!0,r=[i.url,i.serverUrl,i.httpUrl].find(o=>typeof o=="string");if(r){const o=String(i.type??i.transport??"").toLowerCase(),u=o.includes("sse")||!o&&/\/sse\/?$/i.test(r)?"sse":"http",d=Zv(i.headers),p=Object.keys(d).some(h=>h.toLowerCase()==="authorization");return{name:e,transport:u,enabled:a,url:r,headers:d,oauth:p?null:{enabled:!0}}}if(typeof i.command=="string"&&i.command.trim()){const o=Array.isArray(i.args)?i.args.filter(u=>typeof u=="string"):[];return{name:e,transport:"stdio",enabled:a,command:i.command,args:o,env:Zv(i.env)}}return null}const Qv=e=>ol(e)&&(typeof e.command=="string"||typeof e.url=="string"||typeof e.serverUrl=="string"||typeof e.httpUrl=="string");function w8(e){let i;try{i=JSON.parse(e)}catch{throw new Error("That is not valid JSON.")}if(!ol(i))throw new Error("Expected a JSON object.");let a=null;for(const u of[i.mcpServers,i.servers,ol(i.mcp)?i.mcp.servers:void 0])if(ol(u)){a=u;break}if(a||(Qv(i)?a={Imported:i}:Object.values(i).length>0&&Object.values(i).every(Qv)&&(a=i)),!a)throw new Error('No MCP servers found. Expect {"mcpServers": {"name": {"command": …} or {"url": …}}}.');const r=[],o=[];for(const[u,d]of Object.entries(a)){const p=ol(d)?v8(u.slice(0,60),d):null;p?r.push(p):o.push(u)}if(r.length===0)throw new Error('None of those entries has a "command" or a "url".');return{servers:r,skipped:o}}const Ma="h-9 w-full rounded-xl border border-line bg-panel px-3 text-[12px] text-ink outline-none transition-all placeholder:text-faint focus:border-accent/50 focus:shadow-[0_0_0_3px_rgb(var(--accent)/0.10)] disabled:opacity-50",Fh=Ma.replace("h-9 ",""),qh=[{value:"stdio",label:"Local · stdio",hint:"Runs a command on this computer"},{value:"http",label:"Remote · HTTP",hint:"Streamable HTTP endpoint"},{value:"sse",label:"Remote · SSE",hint:"Legacy HTTP+SSE endpoint"}],k8={stdio:"stdio",http:"HTTP",sse:"SSE"};function qg({transport:e,size:i=13}){const a=e==="stdio"?cl:e==="sse"?iC:yT;return c.jsx(a,{size:i,strokeWidth:1.7})}function rE({status:e}){return c.jsx("span",{className:W("h-2 w-2 shrink-0 rounded-full",e==="connected"&&"bg-success shadow-[0_0_0_3px_rgb(var(--success)/0.18)]",e==="connecting"&&"animate-breathe bg-warning",e==="needs_auth"&&"bg-warning shadow-[0_0_0_3px_rgb(var(--warning)/0.18)]",e==="error"&&"bg-danger",(e==="disconnected"||e==="disabled")&&"bg-faint/60")})}function sE(e){switch(e.status){case"connected":return`${e.tools.length} tool${e.tools.length===1?"":"s"}${e.serverInfo?.name?` · ${e.serverInfo.name} ${e.serverInfo.version??""}`:""}`;case"connecting":return"Connecting…";case"needs_auth":return"Sign-in required";case"error":return e.error||"Connection failed";case"disabled":return"Turned off";default:return"Not connected"}}function N8(){const e=me(O=>O.mcpOpen),i=me(O=>O.setMcpOpen),a=me(O=>O.notify),r=me(O=>O.askConfirm),o=Tn(O=>O.servers),u=Tn(O=>O.loaded),d=Tn(O=>O.error),p=Tn(O=>O.load),h=Tn(O=>O.save),g=Tn(O=>O.act),x=Tn(O=>O.authorize),b=Tn(O=>O.logout),[y,v]=B.useState(null),[w,T]=B.useState(!1),[E,N]=B.useState(!1),[j,A]=B.useState(null);B.useEffect(()=>{e?p():(v(null),T(!1))},[e,p]);const R=B.useMemo(()=>y&&!(y.kind==="server"&&!o.some(O=>O.id===y.id))?y:o[0]?{kind:"server",id:o[0].id}:{kind:"new",draft:{...Hh}},[y,o]),$=R.kind==="server"?o.find(O=>O.id===R.id):void 0,z=()=>i(!1),C=O=>{v(O),T(!0)},L=async(O,ee)=>{N(!0);try{return await h(O),ee&&a(ee,"success"),!0}catch(te){return a(te instanceof Error?te.message:"Could not save MCP servers.","error"),!1}finally{N(!1)}},q=(O,ee)=>L(o.map(te=>te.id===O?{...nl(te),...ee}:nl(te))),M=async(O,ee)=>{const te=new Set(o.map(D=>D.id)),be=aE(O,o.find(D=>D.id===O.id)),S=ee?[...o.map(nl),be]:o.map(D=>D.id===O.id?be:nl(D));if(!await L(S,ee?`Added ${be.name}. Connecting…`:`Saved ${be.name}.`))return;const ve=Tn.getState().servers.find(D=>!te.has(D.id)),ce=ee?ve?.id:O.id;ce&&v({kind:"server",id:ce})},H=async O=>{const ee=new Set(o.map(S=>S.id));if(!await L([...o.map(nl),...O],`Imported ${O.length} server${O.length===1?"":"s"}.`))return;const be=Tn.getState().servers.find(S=>!ee.has(S.id));v(be?{kind:"server",id:be.id}:null)},Z=async O=>{await r({title:`Remove ${O.name}?`,body:"The server is disconnected, its saved sign-in is deleted and its tools disappear from the agent.",confirmLabel:"Remove server",tone:"danger"})&&await L(o.filter(te=>te.id!==O.id).map(nl),`Removed ${O.name}.`)&&(v(null),T(!1))},he=async O=>{A(O.id);try{await x(O.id),a(`Finish signing in to ${O.name} in the new window.`,"info")}catch(ee){a(ee instanceof Error?ee.message:"Could not start sign-in.","error")}finally{A(null)}},se=o.filter(O=>O.status==="connected").length,ae=o.reduce((O,ee)=>O+(ee.status==="connected"?ee.tools.length-ee.disabledTools.length:0),0);return c.jsxs(Ko,{open:e,onClose:z,labelledBy:"mcp-title",className:"settings-shell h-[94dvh] p-0 sm:h-[min(88dvh,780px)] sm:w-[min(1080px,96vw)] sm:!rounded-[28px]",children:[c.jsxs("header",{className:"relative flex shrink-0 items-end gap-3 border-b border-line bg-canvas px-5 pb-4 pt-5 sm:px-7",children:[c.jsx("div",{className:"settings-glow pointer-events-none absolute inset-x-0 top-0 h-32"}),c.jsxs("div",{className:"relative min-w-0 flex-1",children:[c.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.22em] text-faint",children:"Model Context Protocol"}),c.jsx("h2",{id:"mcp-title",className:"mt-1 font-display text-[26px] font-semibold leading-none tracking-[-0.035em] text-ink",children:"MCP servers"}),c.jsx("p",{className:"mt-1.5 text-[11.5px] text-muted",children:o.length===0?"Give the agent new tools from local programs or remote services.":`${se} of ${o.length} connected · ${ae} tool${ae===1?"":"s"} available to the agent`})]}),c.jsxs("div",{className:"relative flex shrink-0 items-center gap-1.5",children:[c.jsxs("button",{type:"button",className:"chip hidden h-8 rounded-full px-3.5 text-[11.5px] sm:inline-flex",onClick:()=>C({kind:"import"}),children:[c.jsx(r1,{size:13})," Import JSON"]}),c.jsxs("button",{type:"button",className:"inline-flex h-8 items-center gap-1.5 rounded-full bg-ink px-3.5 text-[11.5px] font-medium text-panel transition-transform active:scale-95",onClick:()=>C({kind:"new",draft:{...Hh}}),children:[c.jsx(ns,{size:13})," Add server"]}),c.jsx("button",{type:"button",className:"icon-button h-8 w-8 rounded-full",onClick:z,"aria-label":"Close MCP panel",children:c.jsx(Ni,{size:16})})]})]}),c.jsxs("div",{className:"flex min-h-0 flex-1",children:[c.jsxs("aside",{className:W("thin-scroll min-h-0 w-full shrink-0 overflow-y-auto bg-canvas/60 p-3 md:block md:w-[300px] md:border-r md:border-line",w?"hidden":"block"),children:[d&&c.jsx("p",{className:"mb-2 rounded-xl border border-danger/25 bg-danger/[0.05] px-3 py-2 text-[11.5px] text-danger",children:d}),!u&&c.jsxs("p",{className:"flex items-center gap-2 px-2 py-3 text-[12px] text-faint",children:[c.jsx(Pt,{size:12})," Loading servers…"]}),u&&o.length===0&&c.jsx("p",{className:"rounded-2xl border border-dashed border-line px-4 py-8 text-center text-[12px] text-muted",children:"No servers yet."}),c.jsx("ul",{className:"space-y-1",children:o.map(O=>{const ee=R.kind==="server"&&R.id===O.id;return c.jsx("li",{children:c.jsxs("button",{type:"button",onClick:()=>C({kind:"server",id:O.id}),className:W("flex w-full items-center gap-3 rounded-2xl border px-3 py-2.5 text-left transition-all",ee?"border-line bg-panel shadow-pill":"border-transparent hover:bg-raised/70"),children:[c.jsx(rE,{status:O.status}),c.jsxs("span",{className:"min-w-0 flex-1",children:[c.jsxs("span",{className:"flex items-center gap-1.5 text-[13px] font-medium text-ink",children:[c.jsx("span",{className:"truncate",children:O.name}),O.oauth?.enabled&&c.jsx(Ho,{size:11,className:W("shrink-0",O.oauth.authorized?"text-success":"text-warning"),"aria-label":"OAuth"})]}),c.jsx("span",{className:W("mt-0.5 block truncate text-[11px]",O.status==="needs_auth"?"text-warning":O.status==="error"?"text-danger":"text-muted"),children:sE(O)})]}),c.jsxs("span",{className:"flex shrink-0 items-center gap-1 rounded-full bg-raised px-2 py-0.5 font-mono text-[9.5px] text-faint",children:[c.jsx(qg,{transport:O.transport,size:10}),k8[O.transport]]})]})},O.id)})}),c.jsxs("button",{type:"button",className:"chip mt-3 h-8 w-full justify-center rounded-xl text-[11.5px] sm:hidden",onClick:()=>C({kind:"import"}),children:[c.jsx(r1,{size:13})," Import JSON"]})]}),c.jsxs("section",{className:W("min-w-0 flex-1 flex-col bg-panel md:flex",w?"flex":"hidden"),children:[c.jsxs("button",{type:"button",className:"flex h-10 shrink-0 items-center gap-1 border-b border-line px-3 text-[12px] text-muted md:hidden",onClick:()=>T(!1),children:[c.jsx(w2,{size:15})," All servers"]}),c.jsx("div",{className:"thin-scroll min-h-0 flex-1 overflow-y-auto",children:u?R.kind==="new"?c.jsx(Jv,{title:"New MCP server",initial:R.draft,busy:E,presets:!0,submitLabel:"Save and connect",onCancel:o.length>0?()=>v(null):void 0,onSubmit:O=>{M(O,!0)}},`new-${JSON.stringify(R.draft)}`):R.kind==="edit"?c.jsx(Jv,{title:`Edit ${R.draft.name}`,initial:R.draft,busy:E,submitLabel:"Save changes",onCancel:()=>v({kind:"server",id:R.draft.id??""}),onSubmit:O=>{M(O,!1)}},`edit-${R.draft.id}`):R.kind==="import"?c.jsx(_8,{busy:E,onCancel:()=>v(null),onImport:O=>{H(O)}}):$?c.jsx(E8,{server:$,signingIn:j===$.id,onEdit:()=>C({kind:"edit",draft:iE($)}),onPatch:O=>{q($.id,O)},onAct:O=>{g($.id,O)},onAuthorize:()=>{he($)},onSignOut:()=>{b($.id).catch(O=>a(O instanceof Error?O.message:"Could not sign out.","error"))},onRemove:()=>{Z($)}}):null:null})]})]})]})}function E8({server:e,signingIn:i,onEdit:a,onPatch:r,onAct:o,onAuthorize:u,onSignOut:d,onRemove:p}){const[h,g]=B.useState(""),x=e.status==="connected"||e.status==="connecting",b=e.tools.filter(v=>!h.trim()||`${v.name} ${v.description}`.toLowerCase().includes(h.trim().toLowerCase())),y=e.tools.length>0&&e.disabledTools.length>=e.tools.length;return c.jsxs("div",{className:"space-y-5 px-5 py-5 sm:px-7 sm:py-6",children:[c.jsxs("div",{className:"flex flex-wrap items-start gap-3",children:[c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("h3",{className:"flex items-center gap-2.5 font-display text-[22px] font-semibold leading-tight tracking-[-0.03em] text-ink",children:[c.jsx(rE,{status:e.status}),c.jsx("span",{className:"truncate",children:e.name})]}),c.jsx("p",{className:W("mt-1 text-[12px]",e.status==="error"?"text-danger":e.status==="needs_auth"?"text-warning":"text-muted"),children:sE(e)})]}),c.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[x?c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:"icon-button h-8 w-8",title:"Reload tools","aria-label":"Reload tools",onClick:()=>o("refresh"),children:c.jsx(Bi,{size:14,className:W(e.status==="connecting"&&"animate-spin")})}),c.jsx("button",{type:"button",className:"icon-button h-8 w-8",title:"Disconnect","aria-label":"Disconnect",onClick:()=>o("disconnect"),children:c.jsx(zC,{size:14})})]}):e.status!=="needs_auth"&&c.jsxs("button",{type:"button",className:"chip h-8 rounded-full px-3.5 text-[11.5px]",disabled:!e.enabled,onClick:()=>o("connect"),children:[c.jsx(tg,{size:13})," Connect"]}),c.jsx("button",{type:"button",className:"icon-button h-8 w-8",title:"Edit connection","aria-label":"Edit connection",onClick:a,children:c.jsx(Fo,{size:14})}),c.jsx(Hi,{checked:e.enabled,onChange:v=>r({enabled:v}),label:`Enable ${e.name}`})]})]}),e.oauth?.enabled&&c.jsxs("div",{className:W("flex flex-wrap items-center gap-3 rounded-2xl border px-4 py-3.5",e.oauth.authorized?"border-success/25 bg-success/[0.05]":"border-warning/30 bg-warning/[0.06]"),children:[c.jsx("span",{className:W("flex h-9 w-9 shrink-0 items-center justify-center rounded-xl",e.oauth.authorized?"bg-success/10 text-success":"bg-warning/10 text-warning"),children:e.oauth.authorized?c.jsx(wr,{size:17}):c.jsx(Ho,{size:17})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("p",{className:"text-[12.5px] font-medium text-ink",children:e.oauth.authorized?"Signed in with OAuth":"Sign-in required"}),c.jsx("p",{className:"mt-0.5 text-[11.5px] leading-relaxed text-muted",children:e.oauth.authorized?"Tokens are stored encrypted by the local daemon and refreshed automatically.":"Approve access in your browser. OpenSol registers itself with the server and keeps the tokens encrypted on this machine."})]}),e.oauth.authorized?c.jsxs("button",{type:"button",className:"chip h-8 rounded-full px-3.5 text-[11.5px]",onClick:d,children:[c.jsx(MT,{size:13})," Sign out"]}):c.jsxs("button",{type:"button",disabled:i||!e.enabled,onClick:u,className:"inline-flex h-8 items-center gap-1.5 rounded-full bg-accent px-4 text-[11.5px] font-medium text-on-accent transition-transform active:scale-95 disabled:opacity-40",children:[i?c.jsx(Pt,{size:12}):c.jsx(Vu,{size:12})," Authorize"]})]}),e.status==="error"&&e.error&&c.jsx("p",{className:"rounded-xl border border-danger/25 bg-danger/[0.05] px-3 py-2 text-[11.5px] leading-relaxed text-danger",children:e.error}),c.jsxs("div",{className:"grid gap-3 rounded-2xl border border-line p-4 sm:grid-cols-[1fr_auto] sm:items-center",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs("p",{className:"flex items-center gap-1.5 text-[11px] font-medium text-muted",children:[c.jsx(qg,{transport:e.transport})," ",qh.find(v=>v.value===e.transport)?.label]}),c.jsx("p",{className:"mt-1 break-all font-mono text-[11px] text-ink",children:e.transport==="stdio"?`${e.command} ${(e.args??[]).join(" ")}`:e.url})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[11px] text-muted",children:"Tool calls"}),c.jsx(xg,{options:[{value:"ask",label:"Ask first"},{value:"auto",label:"Auto-run"}],value:e.approval,onChange:v=>r({approval:v})})]})]}),e.tools.length>0&&c.jsxs("div",{children:[c.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[c.jsxs("p",{className:"mr-auto text-[12px] font-medium text-ink",children:["Tools ",c.jsxs("span",{className:"font-normal text-faint",children:[e.tools.length-e.disabledTools.length,"/",e.tools.length," on"]})]}),c.jsx("button",{type:"button",className:"text-[11px] font-medium text-muted transition-colors hover:text-ink",onClick:()=>r({disabledTools:y?[]:e.tools.map(v=>v.name)}),children:y?"Enable all":"Disable all"})]}),e.tools.length>6&&c.jsxs("div",{className:"relative mb-2",children:[c.jsx(os,{size:13,className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-faint"}),c.jsx("input",{className:W(Ma,"pl-8"),placeholder:"Filter tools",value:h,onChange:v=>g(v.target.value)})]}),c.jsxs("ul",{className:"divide-y divide-line rounded-xl border border-line",children:[b.map(v=>{const w=e.disabledTools.includes(v.name);return c.jsxs("li",{className:"flex items-center gap-3 px-3 py-2",children:[c.jsx(Do,{size:12,className:W("shrink-0",w?"text-faint":"text-accent")}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("p",{className:W("truncate font-mono text-[11.5px]",w?"text-faint line-through":"text-ink"),children:v.name}),v.description&&c.jsx("p",{className:"truncate text-[10.5px] text-muted",children:v.description})]}),v.readOnly&&c.jsx("span",{className:"rounded-full bg-success/10 px-1.5 py-px text-[9px] text-success",children:"read-only"}),c.jsx(Hi,{checked:!w,label:`Enable ${v.name}`,onChange:T=>r({disabledTools:T?e.disabledTools.filter(E=>E!==v.name):[...e.disabledTools,v.name]})})]},v.name)}),b.length===0&&c.jsx("li",{className:"px-3 py-4 text-center text-[11.5px] text-faint",children:"No tools match."})]})]}),c.jsx("div",{className:"flex justify-end",children:c.jsxs("button",{type:"button",onClick:p,className:"inline-flex items-center gap-1.5 text-[11.5px] font-medium text-faint transition-colors hover:text-danger",children:[c.jsx(la,{size:12})," Remove server"]})})]})}function Jv({title:e,initial:i,busy:a,presets:r=!1,submitLabel:o,onCancel:u,onSubmit:d}){const[p,h]=B.useState(i),[g,x]=B.useState(!!(i.clientId||i.scope)),b=p.transport!=="stdio",y=v=>h(w=>({...w,...v}));return c.jsxs("form",{className:"space-y-4 px-5 py-5 sm:px-7 sm:py-6",onSubmit:v=>{v.preventDefault(),Xv(p)&&!a&&d(p)},children:[c.jsx("h3",{className:"font-display text-[22px] font-semibold leading-tight tracking-[-0.03em] text-ink",children:e}),r&&c.jsxs("div",{children:[c.jsx("p",{className:"mb-2 text-[11px] font-medium text-muted",children:"Start from a template"}),c.jsx("div",{className:"grid grid-cols-2 gap-2 lg:grid-cols-4",children:x8.map(v=>c.jsxs("button",{type:"button",onClick:()=>h({...Hh,...v.draft}),className:"rounded-xl border border-line px-3 py-2 text-left transition-all hover:border-accent/40 hover:bg-raised/60 active:scale-[0.98]",children:[c.jsx("span",{className:"block text-[12px] font-medium text-ink",children:v.label}),c.jsx("span",{className:"mt-0.5 block truncate text-[10.5px] text-muted",children:v.description})]},v.label))})]}),c.jsxs("div",{className:"grid gap-3",children:[c.jsx("input",{"data-autofocus":!0,className:Ma,placeholder:"Name (e.g. GitHub)",value:p.name,onChange:v=>y({name:v.target.value})}),c.jsxs("div",{children:[c.jsx(xg,{options:qh.map(({value:v,label:w})=>({value:v,label:w})),value:p.transport,onChange:v=>y({transport:v}),size:"md"}),c.jsx("p",{className:"mt-1.5 text-[11px] text-faint",children:qh.find(v=>v.value===p.transport)?.hint})]})]}),b?c.jsxs(c.Fragment,{children:[c.jsx("input",{className:W(Ma,"font-mono"),placeholder:p.transport==="sse"?"https://example.com/sse":"https://example.com/mcp",value:p.url,onChange:v=>y({url:v.target.value})}),c.jsxs("div",{className:"rounded-2xl border border-line p-3.5",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent",children:c.jsx(Ho,{size:14})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("p",{className:"text-[12.5px] font-medium text-ink",children:"Sign in with OAuth"}),c.jsx("p",{className:"text-[11px] text-muted",children:"For services that ask you to approve access in the browser (Linear, Notion, Sentry…)."})]}),c.jsx(Hi,{checked:p.oauth,onChange:v=>y({oauth:v}),label:"Sign in with OAuth"})]}),p.oauth&&c.jsxs("div",{className:"mt-3 border-t border-line pt-3",children:[c.jsxs("button",{type:"button",className:"text-[11px] font-medium text-muted transition-colors hover:text-ink",onClick:()=>x(v=>!v),children:[g?"Hide":"Show"," advanced client settings"]}),g&&c.jsxs("div",{className:"mt-2.5 grid gap-2.5 sm:grid-cols-2",children:[c.jsx("input",{className:W(Ma,"font-mono"),placeholder:"Client ID (optional)",value:p.clientId,onChange:v=>y({clientId:v.target.value})}),c.jsx("input",{className:W(Ma,"font-mono"),type:"password",autoComplete:"off",placeholder:"Client secret (optional)",value:p.clientSecret,onChange:v=>y({clientSecret:v.target.value})}),c.jsx("input",{className:W(Ma,"font-mono sm:col-span-2"),placeholder:"Scopes (optional, space separated)",value:p.scope,onChange:v=>y({scope:v.target.value})}),c.jsxs("p",{className:"text-[10.5px] leading-relaxed text-faint sm:col-span-2",children:["Leave the client empty to register automatically. Redirect URI to allow: ",c.jsx("span",{className:"font-mono",children:`${window.location.origin}/oauth/mcp/callback`})]})]})]})]}),c.jsx("textarea",{className:W(Fh,"h-20 resize-none py-2 font-mono"),placeholder:`Headers, one per line (API keys, bearer tokens)
|
|
280
|
+
Authorization: Bearer …`,value:p.headers,onChange:v=>y({headers:v.target.value})})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"grid gap-3 sm:grid-cols-[160px_1fr]",children:[c.jsx("input",{className:W(Ma,"font-mono"),placeholder:"command",value:p.command,onChange:v=>y({command:v.target.value})}),c.jsx("input",{className:W(Ma,"font-mono"),placeholder:"arguments",value:p.args,onChange:v=>y({args:v.target.value})})]}),c.jsx("textarea",{className:W(Fh,"h-20 resize-none py-2 font-mono"),placeholder:`Environment, one per line
|
|
281
|
+
API_KEY=…`,value:p.env,onChange:v=>y({env:v.target.value})}),c.jsx("p",{className:"text-[11px] leading-relaxed text-faint",children:"Local servers run as a process on this computer with your permissions, so only add servers you trust."})]}),c.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[u&&c.jsx("button",{type:"button",className:"chip h-8 rounded-full px-4",onClick:u,children:"Cancel"}),c.jsxs("button",{type:"submit",disabled:a||!Xv(p),className:"inline-flex h-8 items-center gap-1.5 rounded-full bg-accent px-4 text-[11.5px] font-medium text-on-accent transition-transform active:scale-95 disabled:opacity-40",children:[a&&c.jsx(Pt,{size:11})," ",o]})]})]})}function _8({busy:e,onCancel:i,onImport:a}){const[r,o]=B.useState(""),u=B.useMemo(()=>{if(!r.trim())return null;try{return{...w8(r),error:""}}catch(d){return{servers:[],skipped:[],error:d instanceof Error?d.message:"Could not read that JSON."}}},[r]);return c.jsxs("div",{className:"space-y-4 px-5 py-5 sm:px-7 sm:py-6",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"font-display text-[22px] font-semibold leading-tight tracking-[-0.03em] text-ink",children:"Import from JSON"}),c.jsxs("p",{className:"mt-1 text-[12px] leading-relaxed text-muted",children:["Paste the ",c.jsx("span",{className:"font-mono",children:"mcpServers"})," block from Claude Desktop, Cursor or VS Code. Local commands and remote URLs (HTTP or SSE) both work."]})]}),c.jsx("textarea",{"data-autofocus":!0,className:W(Fh,"h-48 resize-none py-2.5 font-mono text-[11.5px]"),placeholder:`{
|
|
282
|
+
"mcpServers": {
|
|
283
|
+
"github": { "url": "https://api.githubcopilot.com/mcp/" },
|
|
284
|
+
"files": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "."] }
|
|
285
|
+
}
|
|
286
|
+
}`,value:r,onChange:d=>o(d.target.value),spellCheck:!1}),u?.error&&c.jsx("p",{className:"rounded-xl border border-danger/25 bg-danger/[0.05] px-3 py-2 text-[11.5px] text-danger",children:u.error}),u&&u.servers.length>0&&c.jsx("ul",{className:"divide-y divide-line rounded-xl border border-line",children:u.servers.map(d=>c.jsxs("li",{className:"flex items-center gap-3 px-3 py-2",children:[c.jsx("span",{className:"text-faint",children:c.jsx(qg,{transport:d.transport??"stdio"})}),c.jsxs("span",{className:"min-w-0 flex-1",children:[c.jsx("span",{className:"block truncate text-[12px] font-medium text-ink",children:d.name}),c.jsx("span",{className:"block truncate font-mono text-[10.5px] text-muted",children:d.transport==="stdio"?`${d.command} ${(d.args??[]).join(" ")}`:d.url})]}),d.oauth?.enabled&&c.jsx("span",{className:"rounded-full bg-accent-soft px-2 py-px text-[9.5px] text-accent",children:"OAuth"})]},d.name))}),u&&u.skipped.length>0&&c.jsxs("p",{className:"text-[11px] text-faint",children:["Skipped (no command or url): ",u.skipped.join(", ")]}),c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx("button",{type:"button",className:"chip h-8 rounded-full px-4",onClick:i,children:"Cancel"}),c.jsxs("button",{type:"button",disabled:e||!u||u.servers.length===0,onClick:()=>u&&a(u.servers),className:"inline-flex h-8 items-center gap-1.5 rounded-full bg-accent px-4 text-[11.5px] font-medium text-on-accent transition-transform active:scale-95 disabled:opacity-40",children:[e&&c.jsx(Pt,{size:11})," Import ",u&&u.servers.length>0?`${u.servers.length} server${u.servers.length===1?"":"s"}`:""]})]})]})}function S8(){const e=me(A=>A.paletteOpen),i=me(A=>A.setPaletteOpen),a=me(A=>A.openSettings),r=me(A=>A.setMcpOpen),o=me(A=>A.setWorkspaceOpen),u=me(A=>A.setDeployOpen),d=me(A=>A.focusComposer),p=me(A=>A.notify),h=Ve(A=>A.sessions),g=Be(A=>A.entries),[x,b]=B.useState(""),[y,v]=B.useState(0),w=B.useRef(null),T=B.useRef(null);B.useEffect(()=>{if(!e)return;b(""),v(0),T.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const A=document.body.style.overflow;document.body.style.overflow="hidden";const R=window.setTimeout(()=>w.current?.focus(),30);return()=>{window.clearTimeout(R),document.body.style.overflow=A,T.current?.focus()}},[e]);const E=B.useMemo(()=>{const A=document.documentElement.classList.contains("dark"),R=()=>i(!1),$=[{id:"action-new-chat",label:"New chat",hint:"Start a clean conversation",group:"Actions",icon:ns,action:()=>{Ve.getState().newChat(),d(),R()}},{id:"action-workspace",label:"Toggle workspace panel",hint:"Browse and edit files in the open folder",group:"Actions",icon:ls,action:()=>{o(!me.getState().workspaceOpen),R()}},{id:"action-deploy",label:"Deploy a page",hint:"Cloudflare Pages, Netlify or Vercel",group:"Actions",icon:vr,action:()=>{u(!0),R()}},{id:"action-theme",label:A?"Switch to light theme":"Switch to dark theme",group:"Actions",icon:A?ag:Wh,action:()=>{Me.getState().update({theme:A?"light":"dark"}),R()}},{id:"action-models",label:"Model settings",hint:"Providers, encrypted keys and reasoning",group:"Settings",icon:Yu,action:()=>{a("models"),R()}},{id:"action-tools",label:"Tool permissions",hint:"Approval and enablement",group:"Settings",icon:Do,action:()=>{a("tools"),R()}},{id:"action-search",label:"Search settings",hint:"Tavily, Brave, Serper, DuckDuckGo",group:"Settings",icon:ss,action:()=>{a("search"),R()}},{id:"action-mcp",label:"MCP servers",hint:"Connections, OAuth sign-in and tools",group:"Settings",icon:tg,action:()=>{R(),r(!0)}},{id:"action-skills",label:"Skills",hint:"Load and manage reusable instructions",group:"Settings",icon:Wn,action:()=>{a("skills"),R()}},{id:"action-deploy-settings",label:"Hosting credentials",hint:"Cloudflare, Netlify and Vercel tokens",group:"Settings",icon:vr,action:()=>{a("deploy"),R()}},{id:"action-appearance",label:"Appearance",hint:"Theme and token estimates",group:"Settings",icon:ll,action:()=>{a("appearance"),R()}},{id:"action-about",label:"About OpenSol",hint:"Local storage and reset controls",group:"Settings",icon:Kh,action:()=>{a("about"),R()}},{id:"action-export",label:"Export conversations",hint:"Download a JSON history file",group:"Actions",icon:Yh,action:()=>{ww(),p("Conversation history exported.","success"),R()}}],z=[...h].sort((L,q)=>q.updatedAt-L.updatedAt).map(L=>({id:`chat-${L.id}`,label:L.title,hint:`${L.messages.length} messages · ${id(L.updatedAt)}`,group:"Conversations",icon:cw,keywords:L.messages.filter(q=>q.role==="user").map(q=>q.content).join(" ").slice(0,1e3),action:()=>{Ve.getState().setActive(L.id),R()}})),C=g.filter(L=>L.type==="file").slice(0,1500).map(L=>({id:`file-${L.path}`,label:L.name,hint:L.path,group:"Workspace files",icon:Pn,keywords:L.path,action:()=>{Be.getState().setActiveFile(L.path),o(!0),R()}}));return[...$,...z,...C]},[h,g,d,p,a,r,i,o,u]),N=B.useMemo(()=>{const A=x.trim().toLowerCase(),R=A?40:18;if(!A){const $=new Set([...h].sort((z,C)=>C.updatedAt-z.updatedAt).slice(0,2).map(z=>`chat-${z.id}`));return E.filter(z=>z.group!=="Conversations"||$.has(z.id)).filter((z,C,L)=>L.findIndex(q=>q.id===z.id)===C).slice(0,R)}return E.filter($=>`${$.label} ${$.hint??""} ${$.keywords??""} ${$.group}`.toLowerCase().includes(A)).slice(0,R)},[E,x,h]);if(B.useEffect(()=>{v(0)},[x]),B.useEffect(()=>{if(!e)return;document.querySelector(`[data-palette-index="${y}"]`)?.scrollIntoView({block:"nearest"})},[y,e]),B.useEffect(()=>{y>N.length-1&&v(Math.max(0,N.length-1))},[N.length,y]),!e)return null;const j=A=>{const R=N[A];R&&R.action()};return Vo.createPortal(c.jsxs("div",{className:"fixed inset-0 z-[90] flex items-start justify-center px-3 pt-[10vh] sm:pt-[14vh]",children:[c.jsx("button",{type:"button","aria-label":"Close command palette",tabIndex:-1,className:"absolute inset-0 cursor-default bg-ink/20 backdrop-blur-[2px] dark:bg-black/45",onClick:()=>i(!1)}),c.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Search and commands",className:"modal-panel relative flex max-h-[min(72dvh,560px)] w-full max-w-[560px] flex-col overflow-hidden rounded-2xl border border-line surface-lift shadow-float",children:[c.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2.5 border-b border-line px-3.5",children:[c.jsx(os,{size:15,className:"shrink-0 text-faint"}),c.jsx("input",{ref:w,value:x,onChange:A=>b(A.target.value),onKeyDown:A=>{A.key==="ArrowDown"?(A.preventDefault(),N.length>0&&v(R=>Math.min(R+1,N.length-1))):A.key==="ArrowUp"?(A.preventDefault(),v(R=>Math.max(R-1,0))):A.key==="Enter"?(A.preventDefault(),j(y)):A.key==="Escape"&&i(!1)},placeholder:"Search chats, files, settings, actions…",className:"h-full min-w-0 flex-1 bg-transparent text-[13px] text-ink outline-none placeholder:text-faint",role:"combobox","aria-expanded":"true","aria-controls":"palette-results","aria-activedescendant":N[y]?`palette-${N[y].id}`:void 0}),c.jsx("kbd",{className:"hidden rounded border border-line bg-raised px-1.5 py-0.5 text-[9px] text-faint sm:block",children:"Esc"})]}),c.jsxs("div",{id:"palette-results",role:"listbox",className:"thin-scroll min-h-0 flex-1 overflow-y-auto p-1.5",children:[N.length===0&&c.jsxs("div",{className:"px-4 py-10 text-center",children:[c.jsx("p",{className:"text-[12px] font-medium text-muted",children:"No matches"}),c.jsx("p",{className:"mt-1 text-[10.5px] text-faint",children:"Try a chat title, a file name or “deploy”."})]}),N.map((A,R)=>{const $=A.icon,z=R===0||N[R-1].group!==A.group;return c.jsxs(B.Fragment,{children:[z&&c.jsx("p",{className:"px-2 pb-1 pt-2 text-[9.5px] font-medium uppercase tracking-[0.08em] text-faint",children:A.group}),c.jsxs("button",{type:"button",id:`palette-${A.id}`,"data-palette-index":R,role:"option","aria-selected":y===R,onMouseMove:()=>v(R),onClick:()=>j(R),className:W("flex w-full items-center gap-2.5 rounded-lg px-2 py-2 text-left transition-colors",y===R?"bg-raised":"hover:bg-raised/60"),children:[c.jsx("span",{className:W("flex h-6 w-6 shrink-0 items-center justify-center rounded-md border border-line bg-panel",y===R?"text-accent":"text-muted"),children:c.jsx($,{size:12})}),c.jsxs("span",{className:"min-w-0 flex-1",children:[c.jsx("span",{className:"block truncate text-[11.5px] font-medium text-ink",children:A.label}),A.hint&&c.jsx("span",{className:"mt-0.5 block truncate text-[9.5px] text-faint",children:A.hint})]}),c.jsx(l2,{size:11,className:W("shrink-0 text-faint transition-opacity",y===R?"opacity-100":"opacity-0")})]})]},A.id)})]}),c.jsxs("div",{className:"flex h-8 shrink-0 items-center justify-between border-t border-line bg-raised/30 px-3 text-[9px] text-faint",children:[c.jsxs("span",{className:"flex items-center gap-2",children:[c.jsxs("span",{children:[c.jsx("kbd",{className:"rounded border border-line bg-panel px-1",children:"↑"})," ",c.jsx("kbd",{className:"rounded border border-line bg-panel px-1",children:"↓"})," navigate"]}),c.jsxs("span",{children:[c.jsx("kbd",{className:"rounded border border-line bg-panel px-1",children:"↵"})," open"]})]}),c.jsx("span",{children:"OpenSol"})]})]})]}),document.body)}const Wv=["Waking the local daemon","Unlocking your keys","Loading workspace","Almost there"],T8=["M32 7v8","M32 49v8","M7 32h8","M49 32h8"],C8=["M14.3 14.3l5.5 5.5","M44.2 44.2l5.5 5.5","M14.3 49.7l5.5-5.5","M44.2 19.8l5.5-5.5"];function j8({size:e=64}){return c.jsxs("div",{className:"relative",style:{width:e*1.7,height:e*1.7},children:[c.jsx("span",{className:"absolute inset-0 m-auto animate-ping rounded-full bg-accent/20",style:{width:e*.7,height:e*.7}}),c.jsx("span",{className:"absolute inset-0 m-auto rounded-full bg-accent/10 blur-2xl",style:{width:e*1.4,height:e*1.4}}),c.jsxs("svg",{viewBox:"0 0 64 64",width:e,height:e,fill:"none",className:"splash-sun absolute inset-0 m-auto text-accent",children:[c.jsx("circle",{className:"core",cx:"32",cy:"32",r:"12",fill:"currentColor"}),c.jsxs("g",{className:"rays",stroke:"currentColor",strokeWidth:"4.4",strokeLinecap:"round",children:[T8.map((i,a)=>c.jsx("path",{d:i,className:"ray",pathLength:8,style:{animationDelay:`${.35+a*.07}s`}},i)),C8.map((i,a)=>c.jsx("path",{d:i,className:"ray",pathLength:8,opacity:.55,style:{animationDelay:`${.65+a*.07}s`}},i))]})]})]})}function A8({phase:e,error:i,leaving:a,onRetry:r}){const[o,u]=B.useState(0);return B.useEffect(()=>{if(e==="error")return;const d=window.setInterval(()=>u(p=>Math.min(Wv.length-1,p+1)),650);return()=>window.clearInterval(d)},[e]),c.jsxs("div",{className:W("splash",a&&"is-leaving"),role:"status","aria-live":"polite",children:[c.jsx("div",{className:"hero-wash pointer-events-none absolute inset-0","aria-hidden":"true"}),c.jsxs("div",{className:"relative flex w-full max-w-[400px] flex-col items-center px-6 text-center",children:[c.jsx(j8,{}),c.jsx("h1",{className:"splash-word -mt-1 text-[26px] font-semibold leading-none tracking-[-0.04em] text-ink","aria-label":"OpenSol",children:"OpenSol".split("").map((d,p)=>c.jsx("span",{style:{animationDelay:`${.5+p*.05}s`},className:p>=4?"text-accent":void 0,children:d},p))}),c.jsx("p",{className:"mt-2 animate-fade text-[11px] font-medium uppercase tracking-[0.22em] text-faint [animation-delay:1s]",children:"by OpenSoftX"}),e==="error"?c.jsxs("div",{className:"mt-8 w-full animate-rise",children:[c.jsxs("div",{className:"w-full rounded-xl border border-danger/25 bg-danger/[0.05] px-4 py-3 text-left",children:[c.jsxs("p",{className:"flex items-center gap-1.5 text-[12.5px] font-medium text-ink",children:[c.jsx(md,{size:14,className:"text-danger"}),"The local daemon did not answer"]}),c.jsx("p",{className:"mt-1.5 whitespace-pre-wrap break-words text-[11.5px] leading-relaxed text-muted",children:i})]}),c.jsxs("button",{type:"button",onClick:r,className:"mt-4 inline-flex h-9 items-center gap-1.5 rounded-lg bg-ink px-4 text-[12.5px] font-medium text-panel transition-all hover:opacity-85 active:scale-95",children:[c.jsx(Bi,{size:13}),"Try again"]}),c.jsxs("p",{className:"mt-3 text-[11px] leading-relaxed text-faint",children:["Start OpenSol with ",c.jsx("code",{className:"rounded bg-raised px-1 py-0.5 font-mono text-[10.5px]",children:"npm start"})," in the OpenSol folder, then reload this page."]})]}):c.jsxs("div",{className:"mt-9 flex animate-fade flex-col items-center gap-3 [animation-delay:0.8s]",children:[c.jsx("div",{className:"loading-bar h-[2px] w-32 rounded-full"}),c.jsxs("p",{className:"animate-rise text-[12px] text-muted",children:[Wv[o],"…"]},o)]}),c.jsx("div",{className:"mt-12 animate-fade [animation-delay:1.2s]",children:c.jsx(gM,{})})]})]})}const O8=1600;function M8(){const e=Iu(b=>b.phase),i=Iu(b=>b.error),a=Iu(b=>b.boot),r=Me(b=>b.theme),o=Me(b=>b.chatFontSize),u=me(b=>b.mobileSidebarOpen),d=me(b=>b.setMobileSidebarOpen),p=me(b=>b.setPaletteOpen);OA();const[h,g]=B.useState("show");B.useEffect(()=>{if(e!=="ready"||h!=="show")return;const b=Iu.getState().startedAt||Date.now(),y=Math.max(0,O8-(Date.now()-b)),v=window.setTimeout(()=>g("leaving"),y);return()=>window.clearTimeout(v)},[e,h]),B.useEffect(()=>{if(h!=="leaving")return;const b=window.setTimeout(()=>g("gone"),520);return()=>window.clearTimeout(b)},[h]),B.useEffect(()=>{a()},[a]),B.useEffect(()=>{e==="ready"&&mw().then(b=>XI(b.plugins)).catch(()=>{})},[e]),B.useEffect(()=>{const b=document.documentElement,y=window.matchMedia("(prefers-color-scheme: dark)"),v=()=>{const w=Aw(r,y.matches);b.dataset.theme=w,b.classList.toggle("dark",ch(r,y.matches)),document.querySelector('meta[name="theme-color"]')?.setAttribute("content",ch(r,y.matches)?"#141413":"#ffffff");try{localStorage.setItem("opensol.theme",r)}catch{}};if(v(),r==="system")return y.addEventListener("change",v),()=>y.removeEventListener("change",v)},[r]),B.useEffect(()=>{document.documentElement.style.setProperty("--chat-font-size",`${o}px`)},[o]),B.useEffect(()=>{const b=y=>{const v=y.metaKey||y.ctrlKey,w=y.key.toLowerCase();if(v&&w==="k"){y.preventDefault(),p(!me.getState().paletteOpen);return}if(v&&!y.shiftKey&&!y.altKey){if(w==="b"){y.preventDefault(),me.getState().toggleSidebar();return}if(w===","){y.preventDefault(),me.getState().openSettings("general");return}if(w==="."){y.preventDefault();const T=me.getState();T.setWorkspaceOpen(!T.workspaceOpen);return}}y.key==="Escape"&&me.getState().mobileSidebarOpen&&d(!1)};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[d,p]);const x=e==="ready";return c.jsxs("div",{className:"flex h-dvh min-h-0 overflow-hidden bg-canvas text-ink",children:[x&&c.jsxs(c.Fragment,{children:[c.jsx(bM,{}),u&&c.jsx("button",{type:"button","aria-label":"Close sidebar",onClick:()=>d(!1),className:"modal-scrim fixed inset-0 z-40 cursor-default bg-black/30 backdrop-blur-[2px] lg:hidden"}),c.jsxs("div",{className:"relative flex min-h-0 min-w-0 flex-1 bg-panel lg:my-1.5 lg:mr-1.5 lg:overflow-hidden lg:rounded-xl lg:border lg:border-line lg:shadow-pill",children:[c.jsx(q9,{}),c.jsx(tI,{})]}),c.jsx(h8,{}),c.jsx(N8,{}),c.jsx(g8,{}),c.jsx(S8,{}),c.jsx(MM,{})]}),c.jsx(OM,{}),h!=="gone"&&c.jsx(A8,{phase:e,error:i,leaving:h==="leaving",onRetry:()=>{a(!0)}})]})}class R8 extends B.Component{state={error:null,copied:!1};static getDerivedStateFromError(i){return{error:i,copied:!1}}componentDidCatch(i,a){console.error("[maxcode] render error",i,a.componentStack)}details(){const{error:i}=this.state;return`${i?.name}: ${i?.message}
|
|
287
|
+
|
|
288
|
+
${i?.stack??""}`}copy=async()=>{try{await navigator.clipboard.writeText(this.details()),this.setState({copied:!0})}catch{}};render(){return this.state.error?c.jsx("div",{className:"flex h-dvh items-center justify-center bg-panel px-5 text-ink",children:c.jsxs("div",{className:"w-full max-w-[460px]",children:[c.jsx(bl,{size:34}),c.jsx("h1",{className:"mt-4 font-display text-[28px] font-normal tracking-[-0.02em]",children:"Something broke on this screen"}),c.jsx("p",{className:"mt-2 text-[14px] leading-relaxed text-muted",children:"Your conversations are saved on this computer. Try the screen again, or reload the app."}),c.jsx("pre",{className:"thin-scroll mt-4 max-h-40 overflow-auto rounded-xl border border-line bg-canvas p-3 font-mono text-[11.5px] leading-relaxed text-muted",children:this.state.error.message}),c.jsxs("div",{className:"mt-5 flex flex-wrap items-center gap-2",children:[c.jsx("button",{type:"button",onClick:()=>this.setState({error:null}),className:"inline-flex h-9 items-center rounded-full bg-accent px-4 text-[13px] font-medium text-on-accent transition hover:brightness-110",children:"Try again"}),c.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"inline-flex h-9 items-center rounded-full border border-line px-4 text-[13px] font-medium text-ink transition-colors hover:bg-raised",children:"Reload app"}),c.jsx("button",{type:"button",onClick:()=>{this.copy()},className:"inline-flex h-9 items-center rounded-full px-3 text-[13px] text-muted transition-colors hover:text-ink",children:this.state.copied?"Copied":"Copy details"})]})]})}):this.props.children}}const lE=document.getElementById("root");if(!lE)throw new Error("Root element not found.");KS.createRoot(lE).render(c.jsx(B.StrictMode,{children:c.jsx(R8,{children:c.jsx(M8,{})})}));
|