@evandu/super-pi 0.1.155 → 0.1.157
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/agents/super-pi-task/core.ts +1 -1
- package/agents/super-pi-task/index.ts +25 -3
- package/dist/client/.super-pi-client-sources.json +3 -3
- package/dist/client/assets/{CodeMirrorEditor-DGf8TiZ5.js → CodeMirrorEditor-BB0GyCns.js} +2 -2
- package/dist/client/assets/{dist-C2L242qg.js → dist-BBvvLw1T.js} +1 -1
- package/dist/client/assets/{dist-xrtSXFwN.js → dist-BCZnYgeb.js} +1 -1
- package/dist/client/assets/{dist-BfHhQNXd.js → dist-BDxBEqt3.js} +1 -1
- package/dist/client/assets/{dist-BVkFNoQK.js → dist-BJPYIQat.js} +1 -1
- package/dist/client/assets/{dist-CHNbJU4G.js → dist-BQK5OciP.js} +1 -1
- package/dist/client/assets/{dist-DwmCtvaQ.js → dist-BQjIO_bJ.js} +1 -1
- package/dist/client/assets/{dist-DNTb20de.js → dist-BT4A5Gts.js} +1 -1
- package/dist/client/assets/{dist-tKodxnRd.js → dist-BZNEPjC8.js} +1 -1
- package/dist/client/assets/{dist-a0CnDI4Q.js → dist-BZlYaGxq.js} +1 -1
- package/dist/client/assets/{dist-CrmwJDXn.js → dist-BeCgVWwJ.js} +1 -1
- package/dist/client/assets/{dist-BlgLF_Op.js → dist-CH0-OHWZ.js} +1 -1
- package/dist/client/assets/{dist-WK6R59tK.js → dist-D4twfstd.js} +1 -1
- package/dist/client/assets/{dist-BFK3Zdz3.js → dist-D8Zpt_js.js} +1 -1
- package/dist/client/assets/{dist-gE9RBFPO.js → dist-DIgk0yLa.js} +1 -1
- package/dist/client/assets/{dist-DalOgxpu.js → dist-DSE_w05B.js} +1 -1
- package/dist/client/assets/{dist-BQiNco13.js → dist-DdCTaTc1.js} +1 -1
- package/dist/client/assets/{dist-DLvthSbR.js → dist-DndOTsBF.js} +1 -1
- package/dist/client/assets/{dist-BErJtr8L.js → dist-DuhZOzpj.js} +1 -1
- package/dist/client/assets/{dist-CLKVZWaL.js → dist-DxoyfcUP.js} +1 -1
- package/dist/client/assets/{dist-DigKGTQO.js → dist-R_rLoe1G.js} +1 -1
- package/dist/client/assets/{dist-DQlz7q1d.js → dist-W281b4I1.js} +1 -1
- package/dist/client/assets/{dist-D0KF79YG.js → dist-rXWbM1pb.js} +1 -1
- package/dist/client/assets/{index-Bntn9Qzg.js → index-C2caXFC3.js} +3 -3
- package/dist/client/assets/{index-HB8NmRIH.css → index-OdImWK16.css} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/application/project-service.d.ts +20 -1
- package/dist/server/application/project-service.js +120 -7
- package/dist/server/types.d.ts +3 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-R_rLoe1G.js","assets/dist-BQK5OciP.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var C=Array.isArray;function w(){}var T={H:null,A:null,T:null,S:null},E=Object.prototype.hasOwnProperty;function D(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function O(e,t){return D(e.type,t,e.props)}function k(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function A(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var j=/\/+/g;function M(e,t){return typeof e==`object`&&e&&e.key!=null?A(``+e.key):t.toString(36)}function N(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(w,w):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function P(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,P(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+M(e,0):a,C(o)?(i=``,c!=null&&(i=c.replace(j,`$&/`)+`/`),P(o,r,i,``,function(e){return e})):o!=null&&(k(o)&&(o=O(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(j,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(C(e))for(var u=0;u<e.length;u++)a=e[u],s=l+M(a,u),c+=P(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+M(a,u++),c+=P(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return P(N(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function F(e,t,n){if(e==null)return e;var r=[],i=0;return P(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function I(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var ee=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)};function te(e){var t=T.T,n={};n.types=t===null?null:t.types,T.T=n;try{var r=e(),i=T.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(w,ee)}catch(e){ee(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),T.T=t}}function ne(e){var t=T.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else te(ne.bind(null,e))}var L={map:F,forEach:function(e,t,n){F(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return F(e,function(){t++}),t},toArray:function(e){return F(e,function(e){return e})||[]},only:function(e){if(!k(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=L,e.Component=y,e.Fragment=r,e.Profiler=a,e.PureComponent=x,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return T.H.useMemoCache(e)}},e.addTransitionType=ne,e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=_({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!E.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return D(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)E.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return D(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=k,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:I}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=te,e.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},e.use=function(e){return T.H.use(e)},e.useActionState=function(e,t,n){return T.H.useActionState(e,t,n)},e.useCallback=function(e,t){return T.H.useCallback(e,t)},e.useContext=function(e){return T.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return T.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return T.H.useEffect(e,t)},e.useEffectEvent=function(e){return T.H.useEffectEvent(e)},e.useId=function(){return T.H.useId()},e.useImperativeHandle=function(e,t,n){return T.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return T.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return T.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return T.H.useMemo(e,t)},e.useOptimistic=function(e,t){return T.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return T.H.useReducer(e,t,n)},e.useRef=function(e){return T.H.useRef(e)},e.useState=function(e){return T.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return T.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return T.H.useTransition()},e.version=`19.3.1`})),d=o(((e,t)=>{t.exports=u()})),f=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=d();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`),o=Symbol.for(`react.recoverable`),s=Symbol.for(`react.optimistic_key`);function c(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:r===s?s:``+r,children:e,containerInfo:t,implementation:n}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.browser=function(e){return{$$typeof:o,_reason:e}},e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return c(e,t,null,r)},e.flushSync=function(e){var t=l.T,n=i.p;try{if(l.T=null,i.p=2,e)return e()}finally{l.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=u(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=u(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return l.H.useFormState(e,t,n)},e.useFormStatus=function(){return l.H.useHostTransitionStatus()},e.version=`19.3.1`})),h=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=m()})),g=o((e=>{var t=p(),n=d(),r=h();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}function m(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&m(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function g(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function _(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function v(e){var t=[null,null],n=g(e);return n===null||y(t,e,n.child,{foundSelf:!1}),t}function y(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&y(e,t,n.child,r))return!0;n=n.sibling}return!1}function b(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var x=null,S=null;function C(e,t,n){return e===n||e===t&&(x=e,!0)}function w(e,t,n){return e===n?(S=e,!1):e===t&&(S!==null&&(x=e),!0)}function T(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function E(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var D=Object.assign,O=Symbol.for(`react.element`),k=Symbol.for(`react.transitional.element`),A=Symbol.for(`react.portal`),j=Symbol.for(`react.fragment`),M=Symbol.for(`react.strict_mode`),N=Symbol.for(`react.profiler`),P=Symbol.for(`react.consumer`),F=Symbol.for(`react.context`),I=Symbol.for(`react.forward_ref`),ee=Symbol.for(`react.suspense`),te=Symbol.for(`react.suspense_list`),ne=Symbol.for(`react.memo`),L=Symbol.for(`react.lazy`),re=Symbol.for(`react.activity`),ie=Symbol.for(`react.legacy_hidden`),ae=Symbol.for(`react.memo_cache_sentinel`),oe=Symbol.for(`react.view_transition`),se=Symbol.for(`react.recoverable`),ce=Symbol.iterator;function le(e){return typeof e!=`object`||!e?null:(e=ce&&e[ce]||e[`@@iterator`],typeof e==`function`?e:null)}var ue=Symbol.for(`react.client.reference`);function de(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ue?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case j:return`Fragment`;case N:return`Profiler`;case M:return`StrictMode`;case ee:return`Suspense`;case te:return`SuspenseList`;case re:return`Activity`;case oe:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case A:return`Portal`;case F:return e.displayName||`Context`;case P:return(e._context.displayName||`Context`)+`.Consumer`;case I:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ne:return t=e.displayName||null,t===null?de(e.type)||`Memo`:t;case L:t=e._payload,e=e._init;try{return de(e(t))}catch{}}return null}var fe=Array.isArray,R=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,pe=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,me={pending:!1,data:null,method:null,action:null},he=[],ge=-1;function _e(e){return{current:e}}function ve(e){0>ge||(e.current=he[ge],he[ge]=null,ge--)}function ye(e,t){ge++,he[ge]=e.current,e.current=t}var be=_e(null),xe=_e(null),Se=_e(null),Ce=_e(null);function we(e,t){switch(ye(Se,t),ye(xe,e),ye(be,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?hp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=hp(t),e=gp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ve(be),ye(be,e)}function Te(){ve(be),ve(xe),ve(Se)}function Ee(e){var t=e.memoizedState;t!==null&&(fh._currentValue=t.memoizedState,ye(Ce,e)),t=be.current;var n=gp(t,e.type);t!==n&&(ye(xe,e),ye(be,n))}function De(e){xe.current===e&&(ve(be),ve(xe)),Ce.current===e&&(ve(Ce),fh._currentValue=me)}var Oe,ke;function Ae(e){if(Oe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Oe=t&&t[1]||``,ke=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+Oe+e+ke}var je=!1;function Me(e,t){if(!e||je)return``;je=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
@@ -45,8 +45,8 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
|
|
|
45
45
|
`)))}return{node:{type:`list`,ordered:n,start:n?Number(r[2]):1,items:a},next:o}}function dm(e){let t=e.trim();t.startsWith(`|`)&&(t=t.slice(1)),t.endsWith(`|`)&&!t.endsWith(`\\|`)&&(t=t.slice(0,-1));let n=[],r=``;for(let e=0;e<t.length;e+=1)t[e]===`\\`&&t[e+1]===`|`?(r+=`|`,e+=1):t[e]===`|`?(n.push(r.trim()),r=``):r+=t[e];return n.push(r.trim()),n}function fm(e){let t=e.startsWith(`:`),n=e.endsWith(`:`);return t&&n?`center`:n?`right`:t?`left`:null}function pm(e,t){let n=e.slice(0,t);for(;n.length<t;)n.push(``);return n}var mm={alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,varepsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,vartheta:`ϑ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,pi:`π`,varpi:`ϖ`,rho:`ρ`,varrho:`ϱ`,sigma:`σ`,varsigma:`ς`,tau:`τ`,upsilon:`υ`,phi:`φ`,varphi:`ϕ`,chi:`χ`,psi:`ψ`,omega:`ω`,Gamma:`Γ`,Delta:`Δ`,Theta:`Θ`,Lambda:`Λ`,Xi:`Ξ`,Pi:`Π`,Sigma:`Σ`,Upsilon:`Υ`,Phi:`Φ`,Psi:`Ψ`,Omega:`Ω`},hm={times:`×`,div:`÷`,pm:`±`,mp:`∓`,cdot:`·`,ast:`∗`,star:`⋆`,circ:`∘`,bullet:`∙`,leq:`≤`,le:`≤`,geq:`≥`,ge:`≥`,neq:`≠`,ne:`≠`,approx:`≈`,sim:`∼`,simeq:`≃`,equiv:`≡`,propto:`∝`,ll:`≪`,gg:`≫`,in:`∈`,notin:`∉`,ni:`∋`,subset:`⊂`,subseteq:`⊆`,supset:`⊃`,supseteq:`⊇`,cup:`∪`,cap:`∩`,setminus:`∖`,emptyset:`∅`,varnothing:`∅`,aleph:`ℵ`,hbar:`ℏ`,ell:`ℓ`,Re:`ℜ`,Im:`ℑ`,sum:`∑`,prod:`∏`,coprod:`∐`,int:`∫`,iint:`∬`,iiint:`∭`,oint:`∮`,bigcup:`⋃`,bigcap:`⋂`,to:`→`,rightarrow:`→`,leftarrow:`←`,gets:`←`,leftrightarrow:`↔`,Rightarrow:`⇒`,Leftarrow:`⇐`,Leftrightarrow:`⇔`,mapsto:`↦`,longrightarrow:`⟶`,longleftarrow:`⟵`,uparrow:`↑`,downarrow:`↓`,ldots:`…`,cdots:`⋯`,vdots:`⋮`,ddots:`⋱`,dots:`…`,therefore:`∴`,because:`∵`,angle:`∠`,triangle:`△`,perp:`⊥`,parallel:`∥`,degree:`°`,prime:`′`,lbrace:`{`,rbrace:`}`,lbrack:`[`,rbrack:`]`,langle:`⟨`,rangle:`⟩`,lfloor:`⌊`,rfloor:`⌋`,lceil:`⌈`,rceil:`⌉`,vert:`|`,Vert:`‖`,backslash:`\\`,oplus:`⊕`,ominus:`⊖`,otimes:`⊗`,oslash:`⊘`,odot:`⊙`,dagger:`†`,ddagger:`‡`,quad:` `,qquad:` `,thinspace:` `,enspace:` `,negthinspace:``},gm=new Set(`arcsin.arccos.arctan.sinh.cosh.tanh.cot.sec.csc.sin.cos.tan.log.ln.lg.exp.lim.limsup.liminf.max.min.det.dim.ker.deg.gcd.hom.arg.Pr.sup.inf`.split(`.`)),_m={C:`ℂ`,H:`ℍ`,N:`ℕ`,P:`ℙ`,Q:`ℚ`,R:`ℝ`,Z:`ℤ`},vm={B:`ℬ`,E:`ℰ`,F:`ℱ`,H:`ℋ`,I:`ℐ`,L:`ℒ`,M:`ℳ`,R:`ℛ`,e:`ℯ`,g:`ℊ`,o:`ℴ`},ym={mathbb:e=>_m[e]??e.toUpperCase(),mathcal:e=>vm[e]??e.toUpperCase(),mathscr:e=>vm[e]??e.toUpperCase()},bm=new Set([`left`,`right`,`big`,`Big`,`bigg`,`Bigg`,`bigl`,`bigr`,`Bigl`,`Bigr`,`biggl`,`biggr`,`Biggl`,`Biggr`,`middle`,`displaystyle`,`textstyle`,`scriptstyle`,`limits`,`nolimits`,`nonumber`,`notag`,`label`]),xm={hat:`^`,widehat:`^`,bar:`‾`,overline:`‾`,tilde:`~`,widetilde:`~`,vec:`→`,dot:`·`,ddot:`··`,check:`ˇ`,breve:`˘`,acute:`´`,grave:"`"},Sm=new Set([`(`,`)`,`[`,`]`,`|`,`/`,`<`,`>`]),Cm=new Set([`pmatrix`,`bmatrix`,`Bmatrix`,`vmatrix`,`Vmatrix`,`matrix`,`array`,`cases`,`aligned`,`align`,`alignat`,`split`,`gather`,`gathered`,`equation`,`smallmatrix`,`dcases`,`subarray`]);function wm(e){let t=[],n=``,r=()=>{n&&=(t.push(...Om(n)),``)},i=e=>{r(),t.push(e)};for(let a=0;a<e.length;){let o=e[a];if(o===`\\`){let t=a,r=/^\\([a-zA-Z]+|.)/.exec(e.slice(a));if(!r){n+=o,a+=1;continue}let s=r[1];if(a+=r[0].length,s===`\\`){i({type:`math-row-break`});continue}if(s===`{`||s===`}`){n+=s;continue}if(s===`,`||s===`;`||s===`:`||s===`!`||s===`&`)continue;if(s===`%`){for(;a<e.length&&e[a]!==`
|
|
46
46
|
`;)a+=1;continue}if(bm.has(s))continue;if(s===`begin`){let n=zp(e,a),r=n.content,o=`\\end{${r}}`,s=e.indexOf(o,n.next),c=s===-1?e.length:s+o.length;i({type:`math-unsupported`,value:e.slice(t,c),reason:`\\begin{${r}} 不支持`}),a=c;continue}if(s===`frac`||s===`dfrac`||s===`tfrac`||s===`cfrac`){let t=Em(e,a),n=Em(e,t.next);a=n.next,i({type:`math-fraction`,numerator:wm(t.content),denominator:wm(n.content)});continue}if(s===`sqrt`){let t,n=a;if(e[n]===`[`){let r=Tm(e,n);t=wm(r.content),n=r.next}let r=Em(e,n);a=r.next,i({type:`math-root`,...t?{index:t}:{},radicand:wm(r.content)});continue}if(s===`text`||s===`mathrm`||s===`textrm`||s===`mathbf`||s===`mathit`||s===`mathsf`||s===`mathtt`||s===`operatorname`||s===`textbf`){let t=zp(e,a);a=t.next,i({type:`math-text`,value:t.content});continue}if(s in ym){let t=Em(e,a);a=t.next;let n=ym[s];i({type:`math-text`,value:[...t.content].map(n).join(``)});continue}if(s in xm){let t=Em(e,a);a=t.next,i({type:`math-text`,value:`${km(wm(t.content))}${xm[s]}`});continue}if(s in mm){i({type:`math-identifier`,value:mm[s]});continue}if(s in hm){let e=hm[s];/^\d/.test(e)?i({type:`math-number`,value:e}):/^[A-Za-z]/.test(e)?i({type:`math-text`,value:e}):i({type:`math-operator`,value:e});continue}if(gm.has(s)){i({type:`math-function`,value:s});continue}if(Cm.has(s))continue;i({type:`math-unsupported`,value:`\\${s}`,reason:`\\${s} 不支持`})}else if(o===`{`){let n=zp(e,a);t.push(...wm(n.content)),a=n.next}else if(o===`}`||o===`&`||o===`$`)a+=1;else if(o===`^`||o===`_`){r();let n=Em(e,a+1);a=n.next,Dm(t,o===`^`?`sup`:`sub`,wm(n.content))}else Sm.has(o)?(i({type:`math-text`,value:o}),a+=1):(n+=o,a+=1)}return r(),t}function Tm(e,t){let n=e.indexOf(`]`,t+1);return n===-1?{content:``,next:e.length}:{content:e.slice(t+1,n),next:n+1}}function Em(e,t){let n=e[t];if(n===void 0)return{content:``,next:t};if(n===`{`)return zp(e,t);let r=/^\\[a-zA-Z]+/.exec(e.slice(t));return r?{content:r[0],next:t+r[0].length}:{content:n,next:t+1}}function Dm(e,t,n){let r=e.pop();if(r){if(r.type===`math-script`)t===`sub`&&!r.sub?e.push({...r,sub:n}):t===`sup`&&!r.sup?e.push({...r,sup:n}):e.push(r);else if(r.type===`math-identifier`||r.type===`math-text`){let i=[...r.value],a=i.pop()??``;i.length&&e.push({type:r.type,value:i.join(``)}),e.push({type:`math-script`,base:[{type:`math-identifier`,value:a}],...t===`sub`?{sub:n}:{sup:n}})}else e.push({type:`math-script`,base:[r],...t===`sub`?{sub:n}:{sup:n}})}}function Om(e){let t=[],n=0;for(;n<e.length;){let r=e.slice(n),i=/^\d+(?:\.\d+)?/.exec(r);if(i){t.push({type:`math-number`,value:i[0]}),n+=i[0].length;continue}let a=/^[A-Za-z]+/.exec(r);if(a){t.push(gm.has(a[0])?{type:`math-function`,value:a[0]}:{type:`math-identifier`,value:a[0]}),n+=a[0].length;continue}let o=/^[,;:!.'’|()\-+=<>/*]+/.exec(r);o?(t.push({type:`math-operator`,value:o[0]}),n+=o[0].length):(t.push({type:`math-text`,value:r[0]}),n+=1)}return t.reduce((e,t)=>{let n=e[e.length-1];return n?.type===`math-operator`&&t.type===`math-operator`?n.value+=t.value:e.push({...t}),e},[])}function km(e){return e.map(e=>{switch(e.type){case`math-text`:case`math-number`:case`math-identifier`:case`math-operator`:case`math-function`:return e.value;case`math-script`:return`${km(e.base)}${e.sub?`_{${km(e.sub)}}`:``}${e.sup?`^{${km(e.sup)}}`:``}`;case`math-fraction`:return`\\frac{${km(e.numerator)}}{${km(e.denominator)}}`;case`math-root`:return`\\sqrt{${km(e.radicand)}}`;case`math-row-break`:return`\\\\`;case`math-unsupported`:return e.value;default:return``}}).join(``)}function Am({source:e}){let t=(0,H.useMemo)(()=>cm(e),[e]);return(0,U.jsx)(`div`,{className:`md`,"data-md":`1`,children:t.map((e,t)=>Nm(e,t))})}function jm({source:e}){let t=(0,H.useMemo)(()=>Xp(e),[e]);return(0,U.jsx)(`span`,{className:`md md-inline`,children:t.map((e,t)=>Fm(e,t))})}function Mm(e){return jp(e).map((e,t)=>e.kind===`plain`?(0,U.jsx)(`span`,{children:e.text},t):(0,U.jsx)(`span`,{className:`code-token-${e.kind}`,children:e.text},t))}function Nm(e,t){switch(e.type){case`paragraph`:return(0,U.jsx)(`p`,{className:`md-p`,children:e.children.map((e,t)=>Fm(e,t))},t);case`heading`:{let n=`h${Math.min(6,Math.max(1,e.level))}`;return(0,U.jsx)(n,{className:`md-h md-h${e.level}`,children:e.children.map((e,t)=>Fm(e,t))},t)}case`code-block`:return(0,U.jsx)(`pre`,{className:`md-pre`,"data-md-lang":e.lang||void 0,children:(0,U.jsx)(`code`,{className:`md-code`,children:Mm(e.value)})},t);case`list`:{let n=e.items.map((e,t)=>(0,U.jsx)(`li`,{className:`md-li`,children:e.map((e,t)=>Nm(e,t))},t));return e.ordered?(0,U.jsx)(`ol`,{className:`md-ol`,start:e.start>1?e.start:void 0,children:n},t):(0,U.jsx)(`ul`,{className:`md-ul`,children:n},t)}case`blockquote`:return(0,U.jsx)(`blockquote`,{className:`md-quote`,children:e.children.map((e,t)=>Nm(e,t))},t);case`rule`:return(0,U.jsx)(`hr`,{className:`md-rule`},t);case`table`:return(0,U.jsx)(`div`,{className:`md-table-wrap`,children:(0,U.jsxs)(`table`,{className:`md-table`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsx)(`tr`,{children:e.head.map((t,n)=>(0,U.jsx)(`th`,{style:Pm(e.align[n]),children:t.map((e,t)=>Fm(e,t))},n))})}),(0,U.jsx)(`tbody`,{children:e.rows.map((t,n)=>(0,U.jsx)(`tr`,{children:t.map((t,n)=>(0,U.jsx)(`td`,{style:Pm(e.align[n]),children:t.map((e,t)=>Fm(e,t))},n))},n))})]})},t);case`math-block`:return(0,U.jsx)(Im,{source:e.source},t);default:return null}}var Pm=e=>e?{textAlign:e}:void 0;function Fm(e,t){switch(e.type){case`text`:return(0,U.jsx)(H.Fragment,{children:e.value},t);case`code`:return(0,U.jsx)(`code`,{className:`md-code-inline`,children:e.value},t);case`strong`:return(0,U.jsx)(`strong`,{className:`md-strong`,children:e.children.map((e,t)=>Fm(e,t))},t);case`em`:return(0,U.jsx)(`em`,{className:`md-em`,children:e.children.map((e,t)=>Fm(e,t))},t);case`del`:return(0,U.jsx)(`del`,{className:`md-del`,children:e.children.map((e,t)=>Fm(e,t))},t);case`break`:return(0,U.jsx)(`br`,{className:`md-break`},t);case`math`:return(0,U.jsx)(Lm,{source:e.source},t);case`link`:{let n=Fp(e.href);return n?(0,U.jsx)(`a`,{className:`md-link`,href:n,title:e.title,target:`_blank`,rel:`noopener noreferrer nofollow`,children:e.children.map((e,t)=>Fm(e,t))},t):(0,U.jsx)(H.Fragment,{children:e.children.map((e,t)=>Fm(e,t))},t)}default:return null}}function Im({source:e}){let t=(0,H.useMemo)(()=>wm(e),[e]);return(0,U.jsx)(`div`,{className:`md-math md-math-block`,"data-md-math":`block`,"data-md-math-source":e,children:t.map((e,t)=>Rm(e,t))})}function Lm({source:e}){let t=(0,H.useMemo)(()=>wm(e),[e]);return(0,U.jsx)(`span`,{className:`md-math md-math-inline`,"data-md-math":`inline`,"data-md-math-source":e,children:t.map((e,t)=>Rm(e,t))})}function Rm(e,t){switch(e.type){case`math-text`:return(0,U.jsx)(`span`,{className:`md-m-text`,children:e.value},t);case`math-number`:return(0,U.jsx)(`span`,{className:`md-m-number`,children:e.value},t);case`math-identifier`:return(0,U.jsx)(`i`,{className:`md-m-var`,children:e.value},t);case`math-operator`:return(0,U.jsx)(`span`,{className:`md-m-op`,children:e.value},t);case`math-function`:return(0,U.jsx)(`span`,{className:`md-m-fn`,children:e.value},t);case`math-row-break`:return(0,U.jsx)(`br`,{className:`md-m-rowbreak`},t);case`math-unsupported`:return(0,U.jsx)(`span`,{className:`md-m-unsupported`,"data-md-math-unsupported":`1`,title:e.reason,children:e.value},t);case`math-script`:return(0,U.jsxs)(`span`,{className:`md-m-script`,children:[(0,U.jsx)(`span`,{className:`md-m-base`,children:e.base.map((e,t)=>Rm(e,t))}),e.sup&&(0,U.jsx)(`sup`,{className:`md-m-sup`,children:e.sup.map((e,t)=>Rm(e,t))}),e.sub&&(0,U.jsx)(`sub`,{className:`md-m-sub`,children:e.sub.map((e,t)=>Rm(e,t))})]},t);case`math-fraction`:return(0,U.jsxs)(`span`,{className:`md-m-frac`,children:[(0,U.jsx)(`span`,{className:`md-m-num`,children:e.numerator.map((e,t)=>Rm(e,t))}),(0,U.jsx)(`span`,{className:`md-m-den`,children:e.denominator.map((e,t)=>Rm(e,t))})]},t);case`math-root`:return(0,U.jsxs)(`span`,{className:`md-m-root`,children:[(0,U.jsx)(`span`,{className:`md-m-radical`,children:`√`}),e.index&&(0,U.jsx)(`sup`,{className:`md-m-index`,children:e.index.map((e,t)=>Rm(e,t))}),(0,U.jsx)(`span`,{className:`md-m-body`,children:e.radicand.map((e,t)=>Rm(e,t))})]},t);default:return null}}var zm=[[`help`,`Show help`],[`model`,`Choose model`],[`settings`,`Open settings`],[`clear`,`Clear session`],[`compact`,`Compact context`],[`reload`,`Reload agents`],[`new`,`New session`],[`fork`,`Fork session`],[`resume`,`Resume session`],[`stop`,`Stop run`],[`skill`,`Workspace skill`]].map(([e,t])=>({id:e,label:t,description:t,scope:`builtin`})),Bm=e=>e.normalize(`NFKD`).replace(/\p{M}/gu,``).toLowerCase();function Vm(e,t){let n=Bm(t.trim());return e.examples?.find(t=>Bm(t).includes(n)&&t!==e.id)??e.id}function Hm(e,t){let n=Bm(t.trim());return n?e.filter(e=>Bm(e.id).includes(n)||Bm(e.label).includes(n)||Bm(e.description).includes(n)||e.examples?.some(e=>Bm(e).includes(n))):e}function Um({query:e,anchorRect:t,command:n,workspaceId:r,promptCatalog:i,onSelect:a,onClose:o}){let[s,c]=(0,H.useState)(0),[l,u]=(0,H.useState)(zm),d=(0,H.useRef)(null),f=(0,H.useRef)([]);(0,H.useEffect)(()=>{r&&n({type:`prompt.catalog.fetch`,workspaceId:r})},[r,n]),(0,H.useEffect)(()=>{let e=!1,t=r?`/api/skills?workspaceId=${encodeURIComponent(r)}`:`/api/skills`;return fetch(t).then(e=>e.ok?e.json():void 0).then(t=>{if(e||!Array.isArray(t?.skills))return;let n=t.skills.map(e=>{let t=e.id?.startsWith(`skill:`)?e.id:`skill:${e.name}`,n=e.description?.trim()||(e.scope===`workspace`?`工作区技能`:`技能`);return{id:t,label:n,description:n,examples:[t]}});u([...zm.filter(e=>e.id!==`skill`),...n])}).catch(()=>{}),()=>{e=!0}},[r]);let p=[{id:`start`,label:`start — 打开浏览器`,description:`在浏览器中打开 Super Pi 控制台`,action:()=>n({type:`super_pi.start`})},{id:`restart`,label:`restart — 重启 Super Pi 服务`,description:`停掉并重新启动服务,加载磁盘上的新代码`,action:()=>n({type:`super_pi.restart`})},{id:`update`,label:`update — 更新 Super Pi`,description:`运行 npm install -g @evandu/super-pi 然后重启`,action:()=>n({type:`super_pi.update`})}],m=(i&&i.workspaceId===r?i.prompts:[]).map(e=>({id:e.name,label:e.description,description:e.description,argumentHint:e.argumentHint,scope:e.scope,shadowed:[...p,...l].some(t=>t.id===e.name)})),h=Hm([...p,...l,...m],e),g=h.length===0?-1:Math.min(Math.max(s,0),h.length-1),_=e=>c(t=>h.length?Math.min(Math.max(t+e,0),h.length-1):0);(0,H.useEffect)(()=>{let e=e=>{d.current?.contains(e.target)||o()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[o]),(0,H.useEffect)(()=>{c(0)},[e]),(0,H.useLayoutEffect)(()=>{g>=0&&f.current[g]?.scrollIntoView({block:`nearest`})},[g]);let v={position:`fixed`,left:Math.max(8,Math.min(t.left,window.innerWidth-360)),bottom:Math.max(8,window.innerHeight-t.top+6),zIndex:200},y=e=>{if(e.key===`Escape`)e.preventDefault(),o();else if(e.key===`ArrowDown`)e.preventDefault(),_(1);else if(e.key===`ArrowUp`)e.preventDefault(),_(-1);else if(e.key===`Home`)e.preventDefault(),c(0);else if(e.key===`End`)e.preventDefault(),c(h.length-1);else if(e.key===`Enter`){e.preventDefault();let t=h[g];if(!t)return;t.action?(t.action(),o()):a(t)}};return(0,H.useEffect)(()=>(window.addEventListener(`keydown`,y),()=>window.removeEventListener(`keydown`,y))),(0,U.jsx)(`div`,{ref:d,className:`slash-menu`,style:v,role:`listbox`,"aria-label":`斜杠命令`,children:h.length===0?(0,U.jsxs)(`div`,{className:`slash-menu-empty`,children:[`没有匹配「`,e,`」的命令`]}):h.map((e,t)=>(0,U.jsxs)(`button`,{ref:e=>{f.current[t]=e},type:`button`,role:`option`,"aria-selected":t===g,className:`slash-menu-item${t===g?` selected`:``}`,"data-slash-command":e.id,onClick:()=>{e.action?(e.action(),o()):a(e)},onMouseEnter:()=>c(t),children:[(0,U.jsxs)(`span`,{className:`slash-menu-item-id`,children:[`/`,e.id,e.argumentHint?` `+e.argumentHint:``]}),(0,U.jsx)(`span`,{className:`slash-menu-item-sep`,"aria-hidden":`true`,children:` — `}),(0,U.jsx)(`span`,{className:`slash-menu-item-label`,children:e.label}),(0,U.jsx)(`span`,{className:`slash-menu-item-scope`,"data-slash-command-scope":e.scope??`builtin`,children:e.shadowed?`Built-in command wins`:e.scope===`project`?`Project prompt`:e.scope===`user`?`User prompt`:`Pi built-in`}),e.examples?.length?(0,U.jsx)(`span`,{className:`slash-menu-item-examples`,children:e.examples.slice(0,2).join(` · `)}):null]},e.id))})}var Wm=class extends H.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[SuperPi ErrorBoundary captured error]:`,e,t)}reset=()=>{this.setState({error:null})};render(){let{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.reset):(0,U.jsxs)(`div`,{className:`error-boundary-card`,"data-error-boundary":`1`,children:[(0,U.jsxs)(`div`,{className:`error-boundary-head`,children:[(0,U.jsx)(`span`,{className:`error-boundary-icon`,"aria-hidden":`true`,children:`⚠️`}),(0,U.jsx)(`strong`,{children:`视图渲染遇到异常`})]}),(0,U.jsx)(`p`,{className:`error-boundary-msg`,children:e.message||`未知组件错误`}),(0,U.jsx)(`button`,{type:`button`,className:`error-boundary-retry`,onClick:this.reset,children:`重试`})]}):this.props.children}};function Gm(){}Gm.prototype={diff:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.callback;typeof n==`function`&&(r=n,n={}),this.options=n;var i=this;function a(e){return r?(setTimeout(function(){r(void 0,e)},0),!0):e}e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e)),t=this.removeEmpty(this.tokenize(t));var o=t.length,s=e.length,c=1,l=o+s;n.maxEditLength&&(l=Math.min(l,n.maxEditLength));var u=n.timeout??1/0,d=Date.now()+u,f=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(f[0],t,e,0);if(f[0].oldPos+1>=s&&p+1>=o)return a([{value:this.join(t),count:t.length}]);var m=-1/0,h=1/0;function g(){for(var n=Math.max(m,-c);n<=Math.min(h,c);n+=2){var r=void 0,l=f[n-1],u=f[n+1];l&&(f[n-1]=void 0);var d=!1;if(u){var g=u.oldPos-n;d=u&&0<=g&&g<o}var _=l&&l.oldPos+1<s;if(!d&&!_)f[n]=void 0;else{if(r=!_||d&&l.oldPos+1<u.oldPos?i.addToPath(u,!0,void 0,0):i.addToPath(l,void 0,!0,1),p=i.extractCommon(r,t,e,n),r.oldPos+1>=s&&p+1>=o)return a(Km(i,r.lastComponent,t,e,i.useLongestToken));f[n]=r,r.oldPos+1>=s&&(h=Math.min(h,n-1)),p+1>=o&&(m=Math.max(m,n+1))}}c++}if(r)(function e(){setTimeout(function(){if(c>l||Date.now()>d)return r();g()||e()},0)})();else for(;c<=l&&Date.now()<=d;){var _=g();if(_)return _}},addToPath:function(e,t,n,r){var i=e.lastComponent;return i&&i.added===t&&i.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:i.count+1,added:t,removed:n,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:i}}},extractCommon:function(e,t,n,r){for(var i=t.length,a=n.length,o=e.oldPos,s=o-r,c=0;s+1<i&&o+1<a&&this.equals(t[s+1],n[o+1]);)s++,o++,c++;return c&&(e.lastComponent={count:c,previousComponent:e.lastComponent}),e.oldPos=o,s},equals:function(e,t){return this.options.comparator?this.options.comparator(e,t):e===t||this.options.ignoreCase&&e.toLowerCase()===t.toLowerCase()},removeEmpty:function(e){for(var t=[],n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t},castInput:function(e){return e},tokenize:function(e){return e.split(``)},join:function(e){return e.join(``)}};function Km(e,t,n,r,i){for(var a=[],o;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();for(var s=0,c=a.length,l=0,u=0;s<c;s++){var d=a[s];if(!d.removed){if(!d.added&&i){var f=n.slice(l,l+d.count);f=f.map(function(e,t){var n=r[u+t];return n.length>e.length?n:e}),d.value=e.join(f)}else d.value=e.join(n.slice(l,l+d.count));l+=d.count,d.added||(u+=d.count)}else if(d.value=e.join(r.slice(u,u+d.count)),u+=d.count,s&&a[s-1].added){var p=a[s-1];a[s-1]=a[s],a[s]=p}}var m=a[c-1];return c>1&&typeof m.value==`string`&&(m.added||m.removed)&&e.equals(``,m.value)&&(a[c-2].value+=m.value,a.pop()),a}new Gm;var qm=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,Jm=/\S/,Ym=new Gm;Ym.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!Jm.test(e)&&!Jm.test(t)},Ym.tokenize=function(e){for(var t=e.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;n<t.length-1;n++)!t[n+1]&&t[n+2]&&qm.test(t[n])&&qm.test(t[n+2])&&(t[n]+=t[n+2],t.splice(n+1,2),n--);return t};var Xm=new Gm;Xm.tokenize=function(e){this.options.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
47
47
|
`));var t=[],n=e.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var r=0;r<n.length;r++){var i=n[r];r%2&&!this.options.newlineIsToken?t[t.length-1]+=i:(this.options.ignoreWhitespace&&(i=i.trim()),t.push(i))}return t};function Zm(e,t,n){return Xm.diff(e,t,n)}var Qm=new Gm;Qm.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var $m=new Gm;$m.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function eh(e){"@babel/helpers - typeof";return eh=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},eh(e)}var th=Object.prototype.toString,nh=new Gm;nh.useLongestToken=!0,nh.tokenize=Xm.tokenize,nh.castInput=function(e){var t=this.options,n=t.undefinedReplacement,r=t.stringifyReplacer,i=r===void 0?function(e,t){return t===void 0?n:t}:r;return typeof e==`string`?e:JSON.stringify(rh(e,null,null,i),i,` `)},nh.equals=function(e,t){return Gm.prototype.equals.call(nh,e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`))};function rh(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i,e));for(var a=0;a<t.length;a+=1)if(t[a]===e)return n[a];var o;if(th.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=rh(e[a],t,n,r,i);return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),eh(e)===`object`&&e!==null){t.push(e),o={},n.push(o);var s=[],c;for(c in e)e.hasOwnProperty(c)&&s.push(c);for(s.sort(),a=0;a<s.length;a+=1)c=s[a],o[c]=rh(e[c],t,n,r,c);t.pop(),n.pop()}else o=e;return o}var ih=new Gm;ih.tokenize=function(e){return e.slice()},ih.join=ih.removeEmpty=function(e){return e};function ah(e,t){let n=Zm(e??``,t??``),r=[],i=0,a=0,o=1,s=1;for(let e of n){let t=e.value.split(`
|
|
48
|
-
`),n=t.length>0&&t[t.length-1]===``;n&&t.pop();for(let c=0;c<t.length;c+=1){let l=t[c],u=c===t.length-1&&!n;e.added?(r.push({kind:`added`,text:l,newLine:s,noNewline:u}),s+=1,i+=1):e.removed?(r.push({kind:`removed`,text:l,oldLine:o,noNewline:u}),o+=1,a+=1):(r.push({kind:`same`,text:l,oldLine:o,newLine:s,noNewline:u}),o+=1,s+=1)}}return{lines:r,added:i,removed:a,identical:i===0&&a===0}}function oh(e,t=3){let n=new Set;e.lines.forEach((r,i)=>{if(r.kind!==`same`)for(let r=-t;r<=t;r+=1){let t=i+r;t>=0&&t<e.lines.length&&n.add(t)}});let r=[],i=0,a=!1;return e.lines.forEach((e,t)=>{n.has(t)?(a&&=(r.push({kind:`fold`,text:`⋯ 省略未改动的行`}),!1),r.push(e)):a||(a=!0,i+=1)}),a&&r.push({kind:`fold`,text:`⋯ 省略未改动的行`}),{lines:r,folded:i}}function sh(e){return Array.isArray?Array.isArray(e):_h(e)===`[object Array]`}function ch(e){if(typeof e==`string`)return e;if(typeof e==`bigint`)return e.toString();let t=e+``;return t==`0`&&1/e==-1/0?`-0`:t}function lh(e){return e==null?``:ch(e)}function uh(e){return typeof e==`string`}function dh(e){return typeof e==`number`}function fh(e){return e===!0||e===!1||mh(e)&&_h(e)==`[object Boolean]`}function ph(e){return typeof e==`object`}function mh(e){return ph(e)&&e!==null}function hh(e){return e!=null}function gh(e){return!e.trim().length}function _h(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var vh=`Incorrect 'index' type`,yh=`Invalid doc index: must be a non-negative integer within the bounds of the docs array`,bh=e=>`Invalid value for key ${e}`,xh=e=>`Pattern length exceeds max of ${e}.`,Sh=e=>`Missing ${e} property in key`,Ch=e=>`Property 'weight' in key '${e}' must be a positive integer`,wh=`Fuse.match does not support useTokenSearch: token search requires corpus-level statistics (df, fieldCount) that a one-off string comparison does not have. Use new Fuse(...).search(...) instead.`,Th=Object.prototype.hasOwnProperty,Eh=class{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{let n=Dh(e);this._keys.push(n),this._keyMap[n.id]=n,t+=n.weight}),this._keys.forEach(e=>{e.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function Dh(e){let t=null,n=null,r=null,i=1,a=null;if(uh(e)||sh(e))r=e,t=Oh(e),n=kh(e);else{if(!Th.call(e,`name`))throw Error(Sh(`name`));let o=e.name;if(r=o,Th.call(e,`weight`)&&e.weight!==void 0&&(i=e.weight,i<=0))throw Error(Ch(kh(o)));t=Oh(o),n=kh(o),a=e.getFn??null}return{path:t,id:n,weight:i,src:r,getFn:a}}function Oh(e){return sh(e)?e:e.split(`.`)}function kh(e){return sh(e)?e.join(`.`):e}function Ah(e,t){let n=[],r=!1,i=(e,t,a,o)=>{if(hh(e)){if(!t[a])n.push(o===void 0?e:{v:e,i:o});else{let s=e[t[a]];if(!hh(s))return;if(a===t.length-1&&(uh(s)||dh(s)||fh(s)||typeof s==`bigint`))n.push(o===void 0?lh(s):{v:lh(s),i:o});else if(sh(s)){r=!0;for(let e=0,n=s.length;e<n;e+=1)i(s[e],t,a+1,e)}else t.length&&i(s,t,a+1,o)}}};return i(e,uh(t)?t.split(`.`):t,0),r?n:n[0]}var jh={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},Mh={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},Nh={location:0,threshold:.6,distance:100},Ph={useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:`any`,getFn:Ah,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},Y=Object.freeze({...Mh,...jh,...Nh,...Ph});function Fh(e){return e>=9&&e<=13||e===32||e===160}function Ih(e=1,t=3){let n=new Map,r=10**t;return{get(t){let i=0,a=!1;for(let e=0;e<t.length;e++)Fh(t.charCodeAt(e))?a=!1:a||=(i++,!0);if(i===0&&(i=1),n.has(i))return n.get(i);let o=Math.round(r/i**(.5*e))/r;return n.set(i,o),o},clear(){n.clear()}}}var Lh=class{constructor({getFn:e=Y.getFn,fieldNormWeight:t=Y.fieldNormWeight}={}){this.norm=Ih(t,3),this.getFn=e,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((e,t)=>{this._keysMap[e.id]=t})}create(){if(this.isCreated||!this.docs.length)return;this.isCreated=!0;let e=this.docs.length;this.records=Array(e);let t=0;if(uh(this.docs[0]))for(let n=0;n<e;n++){let e=this._createStringRecord(this.docs[n],n);e&&(this.records[t++]=e)}else for(let n=0;n<e;n++)this.records[t++]=this._createObjectRecord(this.docs[n],n);this.records.length=t,this.norm.clear()}add(e,t){if(!Number.isInteger(t)||t<0)throw Error(yh);if(uh(e)){let n=this._createStringRecord(e,t);return n&&this.records.push(n),n}let n=this._createObjectRecord(e,t);return this.records.push(n),n}removeAt(e){if(!Number.isInteger(e)||e<0)throw Error(yh);for(let t=0,n=this.records.length;t<n;t+=1)if(this.records[t].i===e){this.records.splice(t,1);break}for(let t=0,n=this.records.length;t<n;t+=1)this.records[t].i>e&&--this.records[t].i}removeAll(e){let t=new Set;for(let n of e)Number.isInteger(n)&&n>=0&&t.add(n);if(t.size===0)return;this.records=this.records.filter(e=>!t.has(e.i));let n=Array.from(t).sort((e,t)=>e-t);for(let e of this.records){let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e.i?t=i+1:r=i}e.i-=t}}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_createStringRecord(e,t){return!hh(e)||gh(e)?null:{v:e,i:t,n:this.norm.get(e)}}_createObjectRecord(e,t){let n={i:t,$:{}};for(let t=0,r=this.keys.length;t<r;t++){let r=this.keys[t],i=r.getFn?r.getFn(e):this.getFn(e,r.path);if(hh(i)){if(sh(i)){let e=[];for(let t=0,n=i.length;t<n;t+=1){let n=i[t];if(hh(n)){if(uh(n)){if(!gh(n)){let r={v:n,i:t,n:this.norm.get(n)};e.push(r)}}else if(hh(n.v)){let t=uh(n.v)?n.v:lh(n.v);if(!gh(t)){let r={v:t,i:n.i,n:this.norm.get(t)};e.push(r)}}}}n.$[t]=e}else if(uh(i)&&!gh(i)){let e={v:i,n:this.norm.get(i)};n.$[t]=e}}}return n}toJSON(){return{keys:this.keys.map(({getFn:e,...t})=>t),records:this.records}}};function Rh(e,t,{getFn:n=Y.getFn,fieldNormWeight:r=Y.fieldNormWeight}={}){let i=new Lh({getFn:n,fieldNormWeight:r});return i.setKeys(e.map(Dh)),i.setSources(t),i.create(),i}function zh(e,{getFn:t=Y.getFn,fieldNormWeight:n=Y.fieldNormWeight}={}){let{keys:r,records:i}=e,a=new Lh({getFn:t,fieldNormWeight:n});return a.setKeys(r),a.setIndexRecords(i),a}function Bh(e=[],t=Y.minMatchCharLength){let n=[],r=-1,i=-1,a=0;for(let o=e.length;a<o;a+=1){let o=e[a];o&&r===-1?r=a:!o&&r!==-1&&(i=a-1,i-r+1>=t&&n.push([r,i]),r=-1)}return e[a-1]&&a-r>=t&&n.push([r,a-1]),n}function Vh(e,t,n,{location:r=Y.location,distance:i=Y.distance,threshold:a=Y.threshold,findAllMatches:o=Y.findAllMatches,minMatchCharLength:s=Y.minMatchCharLength,includeMatches:c=Y.includeMatches,ignoreLocation:l=Y.ignoreLocation}={}){if(t.length>32)throw Error(xh(32));let u=t.length,d=e.length,f=Math.max(0,Math.min(r,d)),p=a,m=f,h=(e,t)=>{let n=e/u;if(l)return n;let r=Math.abs(f-t);return i?n+r/i:r?1:n},g=s>1||c,_=g?Array(d):[],v;for(;(v=e.indexOf(t,m))>-1;){let e=h(0,v);if(p=Math.min(e,p),m=v+u,g){let e=0;for(;e<u;)_[v+e]=1,e+=1}}m=-1;let y=[],b=1,x=0,S=u+d,C=1<<u-1;for(let t=0;t<u;t+=1){let r=0,i=S;for(;r<i;)h(t,f+i)<=p?r=i:S=i,i=Math.floor((S-r)/2+r);S=i;let a=Math.max(1,f-i+1),s=o?d:Math.min(f+i,d)+u,c=Array(s+2);c[s+1]=(1<<t)-1;for(let r=s;r>=a;--r){let i=r-1,o=n[e[i]];if(c[r]=(c[r+1]<<1|1)&o,t&&(c[r]|=(y[r+1]|y[r])<<1|1|y[r+1]),c[r]&C&&(b=h(t,i),b<=p)){if(p=b,m=i,x=t,m<=f)break;a=Math.max(1,2*f-m)}}if(h(t+1,f)>p)break;y=c}if(g&&m>=0){let t=Math.min(d-1,m+u-1+x);for(let r=m;r<=t;r+=1)n[e[r]]&&(_[r]=1)}let w={isMatch:m>=0,score:Math.max(.001,b)};if(g){let e=Bh(_,s);e.length?c&&(w.indices=e):w.isMatch=!1}return w}function Hh(e){let t={};for(let n=0,r=e.length;n<r;n+=1){let i=e.charAt(n);t[i]=(t[i]||0)|1<<r-n-1}return t}function Uh(e){if(e.length<=1)return e;e.sort((e,t)=>e[0]-t[0]||e[1]-t[1]);let t=[e[0]];for(let n=1,r=e.length;n<r;n+=1){let r=t[t.length-1],i=e[n];i[0]<=r[1]+1?r[1]=Math.max(r[1],i[1]):t.push(i)}return t}var Wh={ł:`l`,Ł:`L`,đ:`d`,Đ:`D`,ø:`o`,Ø:`O`,ħ:`h`,Ħ:`H`,ŧ:`t`,Ŧ:`T`,ı:`i`,ß:`ss`},Gh=RegExp(`[`+Object.keys(Wh).join(``)+`]`,`g`),Kh=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFD`).replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,``).replace(Gh,e=>Wh[e]):e=>e,qh=class{constructor(e,{location:t=Y.location,threshold:n=Y.threshold,distance:r=Y.distance,includeMatches:i=Y.includeMatches,findAllMatches:a=Y.findAllMatches,minMatchCharLength:o=Y.minMatchCharLength,isCaseSensitive:s=Y.isCaseSensitive,ignoreDiacritics:c=Y.ignoreDiacritics,ignoreLocation:l=Y.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:r,includeMatches:i,findAllMatches:a,minMatchCharLength:o,isCaseSensitive:s,ignoreDiacritics:c,ignoreLocation:l},e=s?e:e.toLowerCase(),e=c?Kh(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;let u=(e,t)=>{this.chunks.push({pattern:e,alphabet:Hh(e),startIndex:t})},d=this.pattern.length;if(d>32){let e=0,t=d%32,n=d-t;for(;e<n;)u(this.pattern.substr(e,32),e),e+=32;if(t){let e=d-32;u(this.pattern.substr(e),e)}}else u(this.pattern,0)}searchIn(e){let{isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r}=this.options;if(e=t?e:e.toLowerCase(),e=n?Kh(e):e,this.pattern===e){if(e.length<this.options.minMatchCharLength)return{isMatch:!1,score:1};let t={isMatch:!0,score:0};return r&&(t.indices=[[0,e.length-1]]),t}let{location:i,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,ignoreLocation:l}=this.options,u=[],d=0,f=!1;this.chunks.forEach(({pattern:t,alphabet:n,startIndex:p})=>{let{isMatch:m,score:h,indices:g}=Vh(e,t,n,{location:i+p,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,includeMatches:r,ignoreLocation:l});m&&(f=!0),d+=h,m&&g&&u.push(...g)});let p={isMatch:f,score:f?d/this.chunks.length:1};return f&&r&&(p.indices=Uh(u)),p}},Jh=new Set([`fuzzy`,`include`]);function Yh(e){return e.startsWith(`inverse`)}var Xh=[{type:`exact`,multiRegex:/^="(.*)"$/,singleRegex:/^=(.*)$/,create:e=>({type:`exact`,search(t){let n=t===e;return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`include`,multiRegex:/^'"(.*)"$/,singleRegex:/^'(.*)$/,create:e=>({type:`include`,search(t){let n=0,r,i=[],a=e.length;for(;(r=t.indexOf(e,n))>-1;)n=r+a,i.push([r,n-1]);let o=!!i.length;return{isMatch:o,score:+!o,indices:i}}})},{type:`prefix-exact`,multiRegex:/^\^"(.*)"$/,singleRegex:/^\^(.*)$/,create:e=>({type:`prefix-exact`,search(t){let n=t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`inverse-prefix-exact`,multiRegex:/^!\^"(.*)"$/,singleRegex:/^!\^(.*)$/,create:e=>({type:`inverse-prefix-exact`,search(t){let n=!t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`inverse-suffix-exact`,multiRegex:/^!"(.*)"\$$/,singleRegex:/^!(.*)\$$/,create:e=>({type:`inverse-suffix-exact`,search(t){let n=!t.endsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`suffix-exact`,multiRegex:/^"(.*)"\$$/,singleRegex:/^(.*)\$$/,create:e=>({type:`suffix-exact`,search(t){let n=t.endsWith(e);return{isMatch:n,score:+!n,indices:[t.length-e.length,t.length-1]}}})},{type:`inverse-exact`,multiRegex:/^!"(.*)"$/,singleRegex:/^!(.*)$/,create:e=>({type:`inverse-exact`,search(t){let n=t.indexOf(e)===-1;return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`fuzzy`,multiRegex:/^"(.*)"$/,singleRegex:/^(.*)$/,create:(e,t={})=>{let n=new qh(e,{location:t.location??Y.location,threshold:t.threshold??Y.threshold,distance:t.distance??Y.distance,includeMatches:t.includeMatches??Y.includeMatches,findAllMatches:t.findAllMatches??Y.findAllMatches,minMatchCharLength:t.minMatchCharLength??Y.minMatchCharLength,isCaseSensitive:t.isCaseSensitive??Y.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics??Y.ignoreDiacritics,ignoreLocation:t.ignoreLocation??Y.ignoreLocation});return{type:`fuzzy`,search(e){return n.searchIn(e)}}}}],Zh=Xh.length,Qh=`\0`,$h=`|`;function eg(e){let t=[],n=e.length,r=0;for(;r<n;){for(;r<n&&e[r]===` `;)r++;if(r>=n)break;let i=r;for(;i<n&&e[i]!==` `&&e[i]!==`"`;)i++;if(i<n&&e[i]===`"`){for(i++;i<n;){if(e[i]===`"`){let t=i+1;if(t>=n||e[t]===` `){i++;break}if(e[t]===`$`&&(t+1>=n||e[t+1]===` `)){i+=2;break}}i++}t.push(e.substring(r,i)),r=i}else{for(;i<n&&e[i]!==` `;)i++;t.push(e.substring(r,i)),r=i}}return t}function tg(e,t){let n=e.match(t);return n?n[1]:null}function ng(e,t={}){return e.replace(/\\\|/g,Qh).split($h).map(e=>{let n=eg(e.replace(/\u0000/g,`|`).trim()).filter(e=>e&&!!e.trim()),r=[];for(let e=0,i=n.length;e<i;e+=1){let i=n[e],a=!1,o=-1;for(;!a&&++o<Zh;){let e=Xh[o],n=tg(i,e.multiRegex);n&&(r.push(e.create(n,t)),a=!0)}if(!a)for(o=-1;++o<Zh;){let e=Xh[o],n=tg(i,e.singleRegex);if(n){r.push(e.create(n,t));break}}}return r})}var rg=class{constructor(e,{isCaseSensitive:t=Y.isCaseSensitive,ignoreDiacritics:n=Y.ignoreDiacritics,includeMatches:r=Y.includeMatches,minMatchCharLength:i=Y.minMatchCharLength,ignoreLocation:a=Y.ignoreLocation,findAllMatches:o=Y.findAllMatches,location:s=Y.location,threshold:c=Y.threshold,distance:l=Y.distance}={}){this.query=null,this.options={isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r,minMatchCharLength:i,findAllMatches:o,ignoreLocation:a,location:s,threshold:c,distance:l},e=t?e:e.toLowerCase(),e=n?Kh(e):e,this.pattern=e,this.query=ng(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){let t=this.query;if(!t)return{isMatch:!1,score:1};let{includeMatches:n,isCaseSensitive:r,ignoreDiacritics:i}=this.options;e=r?e:e.toLowerCase(),e=i?Kh(e):e;let a=0,o=[],s=0,c=!1;for(let r=0,i=t.length;r<i;r+=1){let i=t[r];o.length=0,a=0,c=!1;for(let t=0,r=i.length;t<r;t+=1){let r=i[t],{isMatch:l,indices:u,score:d}=r.search(e);if(l)a+=1,s+=d,Yh(r.type)&&(c=!0),n&&(Jh.has(r.type)?o.push(...u):o.push(u));else{s=0,a=0,o.length=0,c=!1;break}}if(a){let e={isMatch:!0,score:s/a};return c&&(e.hasInverse=!0),n&&(e.indices=Uh(o)),e}}return{isMatch:!1,score:1}}},ig=[];function ag(...e){ig.push(...e)}function og(e,t){for(let n=0,r=ig.length;n<r;n+=1){let r=ig[n];if(r.condition(e,t))return new r(e,t)}return new qh(e,t)}var sg={AND:`$and`,OR:`$or`},cg={PATH:`$path`,PATTERN:`$val`},lg=e=>!!(e[sg.AND]||e[sg.OR]),ug=e=>!!e[cg.PATH],dg=e=>!sh(e)&&ph(e)&&!lg(e),fg=e=>({[sg.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function pg(e,t,{auto:n=!0}={}){let r=e=>{if(uh(e)){let r={keyId:null,pattern:e};return n&&(r.searcher=og(e,t)),r}let i=Object.keys(e),a=ug(e);if(!a&&i.length>1&&!lg(e))return r(fg(e));if(dg(e)){let r=a?e[cg.PATH]:i[0],o=a?e[cg.PATTERN]:e[r];if(!uh(o))throw Error(bh(r));let s={keyId:kh(r),pattern:o};return n&&(s.searcher=og(o,t)),s}let o={children:[],operator:i[0]};return i.forEach(t=>{let n=e[t];sh(n)&&n.forEach(e=>{o.children.push(r(e))})}),o};return lg(e)||(e=fg(e)),r(e)}function mg(e,{ignoreFieldNorm:t=Y.ignoreFieldNorm}){let n=1;return e.forEach(({key:e,norm:r,score:i})=>{let a=e?e.weight:null;n*=(i===0&&a?2**-52:i)**+((a||1)*(t?1:r))}),n}function hg(e,{ignoreFieldNorm:t=Y.ignoreFieldNorm}){e.forEach(e=>{e.score=mg(e.matches,{ignoreFieldNorm:t})})}var gg=class{constructor(e,t){this.limit=e,this.heap=[],this.comparator=t}get size(){return this.heap.length}insert(e){this.size<this.limit?(this.heap.push(e),this._bubbleUp(this.size-1)):this.comparator(e,this.heap[0])<0&&(this.heap[0]=e,this._sinkDown(0))}extractSorted(){return this.heap.sort(this.comparator)}_bubbleUp(e){let t=this.heap;for(;e>0;){let n=e-1>>1;if(this.comparator(t[e],t[n])<=0)break;let r=t[e];t[e]=t[n],t[n]=r,e=n}}_sinkDown(e){let t=this.heap,n=t.length,r=e;do{e=r;let i=2*e+1,a=2*e+2;if(i<n&&this.comparator(t[i],t[r])>0&&(r=i),a<n&&this.comparator(t[a],t[r])>0&&(r=a),r!==e){let n=t[e];t[e]=t[r],t[r]=n}}while(r!==e)}};function _g(e){let t=[];return e.matches.forEach(e=>{if(!hh(e.indices)||!e.indices.length)return;let n={indices:e.indices,value:e.value};e.key&&(n.key=e.key.id),e.idx>-1&&(n.refIndex=e.idx),t.push(n)}),t}function vg(e,t,{includeMatches:n=Y.includeMatches,includeScore:r=Y.includeScore}={}){return e.map(e=>{let{idx:i}=e,a={item:t[i],refIndex:i};return n&&(a.matches=_g(e)),r&&(a.score=e.score),a})}var yg=/[\p{L}\p{M}\p{N}_]+/gu,bg=new WeakSet;function xg(e){bg.has(e)||(bg.add(e),console.warn(`[Fuse] tokenize regex ${e} lacks the global flag; only the first match per text will be returned. Add the 'g' flag.`))}function Sg(e){if(typeof e==`function`){let t=!1;return n=>{let r=e(n);if(!t&&(t=!0,!Array.isArray(r)||r.some(e=>typeof e!=`string`)))throw Error(`[Fuse] tokenize function must return string[]; received ${Array.isArray(r)?`array containing non-strings`:typeof r}.`);return r}}return e instanceof RegExp?(e.global||xg(e),t=>t.match(e)||[]):e=>e.match(yg)||[]}function Cg({isCaseSensitive:e=!1,ignoreDiacritics:t=!1,tokenize:n}={}){let r=Sg(n);return{tokenize(n){return e||(n=n.toLowerCase()),t&&(n=Kh(n)),r(n)}}}var wg=class{static condition(e,t){return t.useTokenSearch}constructor(e,t){this.options=t,this.analyzer=Cg({isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,tokenize:t.tokenize});let n=this.analyzer.tokenize(e),{df:r,fieldCount:i}=t._invertedIndex;this.termSearchers=[],this.idfWeights=[];for(let e of n){this.termSearchers.push(new qh(e,{location:t.location,threshold:t.threshold,distance:t.distance,includeMatches:t.includeMatches,findAllMatches:t.findAllMatches,minMatchCharLength:t.minMatchCharLength,isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,ignoreLocation:!0}));let n=r.get(e)||0,a=Math.log(1+(i-n+.5)/(n+.5));this.idfWeights.push(a)}this.combineAll=t.tokenMatch===`all`,this.numTerms=this.termSearchers.length,this.useMask=this.numTerms<=31}searchIn(e){if(!this.termSearchers.length)return{isMatch:!1,score:1};let t=[],n=0,r=0,i=0,a=0,o=this.combineAll&&!this.useMask?new Set:null;for(let s=0;s<this.termSearchers.length;s++){let c=this.termSearchers[s].searchIn(e),l=this.idfWeights[s];r+=l,c.isMatch&&(i++,n+=l*(1-c.score),c.indices&&t.push(...c.indices),this.combineAll&&(this.useMask?a|=1<<s:o.add(s)))}if(i===0)return{isMatch:!1,score:1};let s=r>0?1-n/r:0,c={isMatch:!0,score:Math.max(.001,s)};return this.options.includeMatches&&t.length&&(c.indices=Uh(t)),this.combineAll&&(this.useMask?c.matchedMask=a:c.matchedTerms=o,c.termCount=this.numTerms),c}};function Tg(e,t,n,r){let i=r.tokenize(t);if(!i.length)return;e.fieldCount++,e.docFieldCount.set(n,(e.docFieldCount.get(n)||0)+1);let a=new Set(i),o=e.docTermFieldHits.get(n);o||(o=new Map,e.docTermFieldHits.set(n,o));for(let t of a)o.set(t,(o.get(t)||0)+1),e.df.set(t,(e.df.get(t)||0)+1)}function Eg(e,t,n,r){let{i,v:a,$:o}=t;if(a!==void 0)Tg(e,a,i,r);else if(o)for(let t=0;t<n;t++){let n=o[t];if(n){if(Array.isArray(n))for(let t of n)Tg(e,t.v,i,r);else Tg(e,n.v,i,r)}}}function Dg(e,t,n){let r={fieldCount:0,df:new Map,docFieldCount:new Map,docTermFieldHits:new Map};for(let i of e)Eg(r,i,t,n);return r}function Og(e,t,n,r){Eg(e,t,n,r)}function kg(e,t){let n=e.docFieldCount.get(t);if(n===void 0)return;e.fieldCount-=n,e.docFieldCount.delete(t);let r=e.docTermFieldHits.get(t);if(r){for(let[t,n]of r){let r=(e.df.get(t)||0)-n;r<=0?e.df.delete(t):e.df.set(t,r)}e.docTermFieldHits.delete(t)}}function Ag(e,t){if(t.length===0)return;let n=Array.from(new Set(t)).sort((e,t)=>e-t);for(let t of n)kg(e,t);let r=e=>{let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e?t=i+1:r=i}return e-t},i=n[0],a=new Map;for(let[t,n]of e.docFieldCount)a.set(t>i?r(t):t,n);e.docFieldCount=a;let o=new Map;for(let[t,n]of e.docTermFieldHits)o.set(t>i?r(t):t,n);e.docTermFieldHits=o}var jg=class{constructor(e,t,n){this.options={...Y,...t},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new Eh(this.options.keys),this._docs=e,this._myIndex=null,this._invertedIndex=null,this.setCollection(e,n),this._lastQuery=null,this._lastSearcher=null}_getSearcher(e){if(this._lastQuery===e)return this._lastSearcher;let t=og(e,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=e,this._lastSearcher=t,t}setCollection(e,t){if(this._docs=e,t&&!(t instanceof Lh))throw Error(vh);if(this._myIndex=t||Rh(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){let e=Cg({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});this._invertedIndex=Dg(this._myIndex.records,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}add(e){if(!hh(e))return;this._docs.push(e);let t=this._myIndex.add(e,this._docs.length-1);if(this._invertedIndex&&t){let e=Cg({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});Og(this._invertedIndex,t,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}remove(e=()=>!1){let t=[],n=[];for(let r=0,i=this._docs.length;r<i;r+=1)e(this._docs[r],r)&&(t.push(this._docs[r]),n.push(r));if(n.length){this._invertedIndex&&Ag(this._invertedIndex,n);let e=new Set(n);this._docs=this._docs.filter((t,n)=>!e.has(n)),this._myIndex.removeAll(n),this._invalidateSearcherCache()}return t}removeAt(e){if(!Number.isInteger(e)||e<0||e>=this._docs.length)throw Error(yh);this._invertedIndex&&Ag(this._invertedIndex,[e]);let t=this._docs.splice(e,1)[0];return this._myIndex.removeAt(e),this._invalidateSearcherCache(),t}_invalidateSearcherCache(){this._lastQuery=null,this._lastSearcher=null}getIndex(){return this._myIndex}_normalizedKeys(){return this._myIndex.keys.map(e=>this._keyStore.get(e.id)||e)}search(e,t){let{limit:n=-1}=t||{},{includeMatches:r,includeScore:i,shouldSort:a,sortFn:o,ignoreFieldNorm:s}=this.options;if(uh(e)&&!e.trim()){let e=this._docs.map((e,t)=>({item:e,refIndex:t}));return dh(n)&&n>-1&&(e=e.slice(0,n)),e}let c=a&&dh(n)&&n>0&&uh(e),l=o,u=(e,t)=>l(e,t)||e.idx-t.idx,d;if(c){let t=new gg(n,u);uh(this._docs[0])?this._searchStringList(e,{heap:t,ignoreFieldNorm:s}):this._searchObjectList(e,{heap:t,ignoreFieldNorm:s}),d=t.extractSorted()}else d=uh(e)?uh(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e),hg(d,{ignoreFieldNorm:s}),a&&d.sort(uh(e)?u:l),dh(n)&&n>-1&&(d=d.slice(0,n));return vg(d,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{records:a}=this._myIndex,o=t?null:[];return a.forEach(({v:e,i:a,n:s})=>{if(!hh(e))return;let c=r.searchIn(e);if(c.isMatch){let r={score:c.score,value:e,norm:s,indices:c.indices};i&&(r.matchedMask=c.matchedMask,r.matchedTerms=c.matchedTerms,r.termCount=c.termCount);let l=[r];if(!i||this._coversAllTokens(l)){let r={item:e,idx:a,matches:l};t?(r.score=mg(r.matches,{ignoreFieldNorm:n}),t.insert(r)):o.push(r)}}}),o}_searchLogical(e){let t=pg(e,this.options),n=this._normalizedKeys(),r=(e,t,i)=>{if(!(`children`in e)){let{keyId:r,searcher:a}=e,o;return r===null?(o=[],n.forEach((e,n)=>{o.push(...this._findMatches({key:e,value:t[n],searcher:a}))})):o=this._findMatches({key:this._keyStore.get(r),value:this._myIndex.getValueForItemAtKeyId(t,r),searcher:a}),o&&o.length?[{idx:i,item:t,matches:o}]:[]}let{children:a,operator:o}=e,s=[];for(let e=0,n=a.length;e<n;e+=1){let n=a[e],c=r(n,t,i);if(c.length)s.push(...c);else if(o===sg.AND)return[]}return s},i=this._myIndex.records,a=new Map,o=[];return i.forEach(({$:e,i:n})=>{if(hh(e)){let i=r(t,e,n);i.length&&(a.has(n)||(a.set(n,{idx:n,item:e,matches:[]}),o.push(a.get(n))),i.forEach(({matches:e})=>{a.get(n).matches.push(...e)}))}}),o}_searchObjectList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{records:a}=this._myIndex,o=this._normalizedKeys(),s=t?null:[];return a.forEach(({$:e,i:a})=>{if(!hh(e))return;let c=[],l=!1,u=!1;if(o.forEach((t,n)=>{let i=this._findMatches({key:t,value:e[n],searcher:r});i.length?(c.push(...i),i[0].hasInverse&&(u=!0)):l=!0}),!(u&&l)&&c.length&&(!i||this._coversAllTokens(c))){let r={idx:a,item:e,matches:c};t?(r.score=mg(r.matches,{ignoreFieldNorm:n}),t.insert(r)):s.push(r)}}),s}_findMatches({key:e,value:t,searcher:n}){if(!hh(t))return[];let r=[];if(sh(t))t.forEach(({v:t,i,n:a})=>{if(!hh(t))return;let o=n.searchIn(t);if(o.isMatch){let n={score:o.score,key:e,value:t,idx:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(n.matchedMask=o.matchedMask,n.matchedTerms=o.matchedTerms,n.termCount=o.termCount),r.push(n)}});else{let{v:i,n:a}=t,o=n.searchIn(i);if(o.isMatch){let t={score:o.score,key:e,value:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(t.matchedMask=o.matchedMask,t.matchedTerms=o.matchedTerms,t.termCount=o.termCount),r.push(t)}}return r}_coversAllTokens(e){let t=e.length?e[0].termCount:void 0;if(t===void 0)return!0;if(t<=31){let n=0;for(let t=0;t<e.length;t++)n|=e[t].matchedMask||0;return n===2**t-1}let n=new Set;for(let t=0;t<e.length;t++){let r=e[t].matchedTerms;if(r)for(let e of r)n.add(e)}return n.size===t}};jg.version=`7.5.0`,jg.createIndex=Rh,jg.parseIndex=zh,jg.config=Y,jg.match=function(e,t,n){if(n&&n.useTokenSearch)throw Error(wh);return og(e,{...Y,...n}).searchIn(t)},jg.parseQuery=pg,ag(rg),ag(wg),jg.use=function(...e){e.forEach(e=>ag(e))};var Mg=jg,Ng=`modulepreload`,Pg=function(e){return`/`+e},Fg={},Ig=function(e){return e.pathname.endsWith(`.css`)},Lg=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},Rg=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Pg(t,n);let r=s(t),i=Ig(r);return Lg(Fg,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Ng,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},zg=class extends Error{status;body;constructor(e,t){super(t.error||`HTTP ${e}`),this.name=`BlameApiError`,this.status=e,this.body=t}},Bg=class extends Error{constructor(){super(`Blame 请求已取消`),this.name=`BlameCancelledError`}},Vg=(e,t,n=``)=>`/api/git?workspaceId=${encodeURIComponent(e)}&op=blame&path=${encodeURIComponent(t)}${n?`&cwd=${encodeURIComponent(n)}`:``}`;async function Hg(e,t,n={}){if(n.signal?.aborted)throw new Bg;let r=n.timeoutMs??15e3,i=new AbortController,a=!1,o=setTimeout(()=>{a=!0,i.abort()},r),s=()=>i.abort();n.signal?.addEventListener(`abort`,s,{once:!0});try{let r=await fetch(Vg(e,t,n.cwd),{signal:i.signal}),a;try{a=await r.json()}catch{a=void 0}if(!r.ok){let e=a??{};throw new zg(r.status,{error:e.error||`HTTP ${r.status}`,...e.code?{code:e.code}:{}})}return a}catch(e){throw n.signal?.aborted?new Bg:a?new zg(408,{error:`请求超时:${Math.round(r/1e3)} 秒内服务端没有响应`,code:`timeout`}):e}finally{clearTimeout(o),n.signal?.removeEventListener(`abort`,s)}}var Ug=`\0`,Wg=(e,t,n)=>[e,t,n??``].join(Ug),Gg=24,Kg=new Map;function qg(e){let t=Kg.get(e);if(t)return Kg.delete(e),Kg.set(e,t),t}function Jg(e,t){for(Kg.delete(e),Kg.set(e,t);Kg.size>Gg;){let e=Kg.keys().next();if(e.done)break;Kg.delete(e.value)}}var Yg={untracked:`这个文件尚未被 Git 跟踪`,binary:`二进制文件不支持 Blame`,too_large:`文件过大,未显示 Blame`,no_head:`仓库还没有提交`,not_in_revision:`这个版本里没有这个文件`},Xg=`此工作区不是 Git 仓库`;function Zg(e){return e&&Yg[e]?{code:e,text:Yg[e]}:{code:`unsupported`,text:`这个文件暂时不能显示 Blame`}}function Qg(e){return e instanceof zg&&e.body.code===`not_a_repo`?{state:`unsupported`,note:{code:`not_a_repo`,text:Xg}}:{state:`error`,note:{code:`error`,text:`读取 Blame 失败:${e instanceof Error&&e.message?e.message:`未知错误`}`}}}var $g=`${Ug}uncommitted`;function e_(e){let t=new Map,n=0;for(let r of e.lines)t.has(r.line)||t.set(r.line,r),r.line>n&&(n=r.line);let r=[],i=null,a=0;for(let e=1;e<=n;e+=1){let n=t.get(e);if(!n){r.push({line:e,kind:`missing`,data:null}),i=null,a=e;continue}let o=n.isUncommitted?$g:n.commit??`${Ug}none`,s=o===i&&e===a+1?`continuation`:n.isUncommitted?`uncommitted`:`commit`;r.push({line:e,kind:s,data:n}),i=o,a=e}if(e.truncated)for(let t=n+1;t<=e.totalLines;t+=1)r.push({line:t,kind:`truncated`,data:null});return r}function t_(e){let t=0;for(let n of e.lines)n.line>t&&(t=n.line);return t}function n_(e){switch(e.kind){case`commit`:{let t=e.data,n=t?.shortCommit??t?.commit?.slice(0,8)??`?`,r=t?.author?.trim();return r?`${n} · ${r}`:n}case`continuation`:return`│`;case`uncommitted`:return`● 未提交`;case`missing`:return`?`;case`truncated`:return`…`;default:return``}}function r_(e){if(e.kind===`uncommitted`||e.data?.isUncommitted)return[`未提交`,`这行尚不属于任何 Git 提交`];if(e.kind===`missing`)return[`没有 Blame 信息`,`这一行没有对应的提交记录`];if(e.kind===`truncated`)return[`Blame 数据已截断`,`文件太长,只显示了前面一部分的提交信息`];let t=e.data;if(!t)return[`没有 Blame 信息`];let n=t.shortCommit??t.commit?.slice(0,8)??`未知提交`,r=t.author?.trim()||`未知作者`;return[n,t.authorEmail?`${r} <${t.authorEmail}>`:r,i_(t.date),t.summary?.trim()||`(没有提交摘要)`]}function i_(e){if(!e)return`不详`;let t=new Date(e);if(!Number.isFinite(t.getTime()))return e;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function a_(e){if(e.length===0)return 0;let t=1;for(let n=0;n<e.length;n+=1)e.charCodeAt(n)===10&&(t+=1);return e.charCodeAt(e.length-1)===10&&--t,t}function o_(e,t,n=!1){return!t||!t.supported?!1:n||a_(e)!==t.totalLines}var s_=new WeakMap;function c_(e){let t=s_.get(e);if(t)return t;let n={response:e,models:e_(e),covered:t_(e)};return s_.set(e,n),n}function l_(e,t){if(!e||t<1)return null;let n=e.models[t-1];return n&&n.line===t?n:null}var u_=`a1b2c3d · Author`;async function d_(){let[e,t]=await Promise.all([Rg(()=>import(`./dist-CHNbJU4G.js`).then(e=>e.x),[]),Rg(()=>import(`./dist-DigKGTQO.js`).then(e=>e.s),__vite__mapDeps([0,1]))]),n=e.StateEffect.define(),r=e.StateField.define({create:()=>null,update:(e,t)=>{for(let e of t.effects)if(e.is(n))return e.value;return e}}),i=e.StateEffect.define(),a=e.StateField.define({create:()=>null,update:(e,t)=>{for(let e of t.effects)if(e.is(i))return e.value;return e}}),o=t.GutterMarker;class s extends o{model;constructor(e){super(),this.model=e}eq(e){let t=e.model;return t?t.line===this.model.line&&t.kind===this.model.kind&&t.data?.commit===this.model.data?.commit&&t.data?.summary===this.model.data?.summary&&t.data?.author===this.model.data?.author:!1}toDOM(){let e=document.createElement(`span`);e.className=`cm-blame-marker cm-blame-${this.model.kind}`,e.setAttribute(`data-file-blame-line`,String(this.model.line)),e.setAttribute(`data-file-blame-kind`,this.model.kind),this.model.data?.commit&&e.setAttribute(`data-file-blame-commit`,this.model.data.commit);let t=r_(this.model);return e.setAttribute(`title`,t.join(`
|
|
49
|
-
`)),e.setAttribute(`aria-label`,t.join(` · `)),e.textContent=n_(this.model),e}}class c extends o{eq(){return!0}toDOM(){let e=document.createElement(`span`);return e.className=`cm-blame-marker cm-blame-spacer`,e.textContent=u_,e}}let l=t.gutter({class:`cm-blame-gutter`,initialSpacer:()=>new c,lineMarker:(e,t)=>{let n=e.state.field(r);if(!n)return null;let i=e.state.doc.lineAt(t.from).number,a=l_(n,i);return new s(a??{line:i,kind:`missing`,data:null})},lineMarkerChange:e=>e.startState.field(r)!==e.state.field(r)}),u=t.ViewPlugin.fromClass(class{line=null;editorView;constructor(e){this.editorView=e,this.editorView.dom.addEventListener(`mousemove`,this.onMove),this.editorView.dom.addEventListener(`mouseleave`,this.onLeave)}destroy(){this.editorView.dom.removeEventListener(`mousemove`,this.onMove),this.editorView.dom.removeEventListener(`mouseleave`,this.onLeave)}update(e){e.startState.field(r)!==e.state.field(r)&&this.line!==null&&(this.line=null,this.editorView.dispatch({effects:i.of(null)}))}onMove=e=>{let t=this.lineAt(e);if(t===this.line)return;if(this.line=t,t===null){this.editorView.dispatch({effects:i.of(null)});return}let n=l_(this.editorView.state.field(r),t);if(!n){this.editorView.dispatch({effects:i.of(null)});return}let a=this.editorView.state.doc,o=a.line(Math.min(t,a.lines));this.editorView.dispatch({effects:i.of({pos:o.from,above:!0,create:()=>({dom:f_(n)})})})};onLeave=()=>{this.line=null,this.editorView.dispatch({effects:i.of(null)})};lineAt(e){let t=e.target,n=t?.closest?.(`[data-file-blame-line]`);if(n){let e=Number(n.getAttribute(`data-file-blame-line`));return Number.isInteger(e)&&e>0?e:null}if(t?.closest?.(`.cm-blame-gutter`))return null;let r=this.editorView.posAtCoords({x:e.clientX,y:e.clientY});return r==null?null:this.editorView.state.doc.lineAt(r).number}});return{field:r,setBlame:n,base:[r,a,t.showTooltip.from(a),u],gutter:l}}function f_(e){let t=document.createElement(`div`);t.className=`cm-blame-tooltip`,t.setAttribute(`data-file-blame-tooltip`,`1`),t.setAttribute(`data-file-blame-kind`,e.kind),e.data?.commit&&t.setAttribute(`data-file-blame-commit`,e.data.commit);for(let n of r_(e)){let e=document.createElement(`div`);e.className=`cm-blame-tooltip-row`,e.textContent=n,t.appendChild(e)}return t}var p_=4e3,m_=(0,H.lazy)(()=>Rg(()=>import(`./CodeMirrorEditor-
|
|
48
|
+
`),n=t.length>0&&t[t.length-1]===``;n&&t.pop();for(let c=0;c<t.length;c+=1){let l=t[c],u=c===t.length-1&&!n;e.added?(r.push({kind:`added`,text:l,newLine:s,noNewline:u}),s+=1,i+=1):e.removed?(r.push({kind:`removed`,text:l,oldLine:o,noNewline:u}),o+=1,a+=1):(r.push({kind:`same`,text:l,oldLine:o,newLine:s,noNewline:u}),o+=1,s+=1)}}return{lines:r,added:i,removed:a,identical:i===0&&a===0}}function oh(e,t=3){let n=new Set;e.lines.forEach((r,i)=>{if(r.kind!==`same`)for(let r=-t;r<=t;r+=1){let t=i+r;t>=0&&t<e.lines.length&&n.add(t)}});let r=[],i=0,a=!1;return e.lines.forEach((e,t)=>{n.has(t)?(a&&=(r.push({kind:`fold`,text:`⋯ 省略未改动的行`}),!1),r.push(e)):a||(a=!0,i+=1)}),a&&r.push({kind:`fold`,text:`⋯ 省略未改动的行`}),{lines:r,folded:i}}function sh(e){return Array.isArray?Array.isArray(e):_h(e)===`[object Array]`}function ch(e){if(typeof e==`string`)return e;if(typeof e==`bigint`)return e.toString();let t=e+``;return t==`0`&&1/e==-1/0?`-0`:t}function lh(e){return e==null?``:ch(e)}function uh(e){return typeof e==`string`}function dh(e){return typeof e==`number`}function fh(e){return e===!0||e===!1||mh(e)&&_h(e)==`[object Boolean]`}function ph(e){return typeof e==`object`}function mh(e){return ph(e)&&e!==null}function hh(e){return e!=null}function gh(e){return!e.trim().length}function _h(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var vh=`Incorrect 'index' type`,yh=`Invalid doc index: must be a non-negative integer within the bounds of the docs array`,bh=e=>`Invalid value for key ${e}`,xh=e=>`Pattern length exceeds max of ${e}.`,Sh=e=>`Missing ${e} property in key`,Ch=e=>`Property 'weight' in key '${e}' must be a positive integer`,wh=`Fuse.match does not support useTokenSearch: token search requires corpus-level statistics (df, fieldCount) that a one-off string comparison does not have. Use new Fuse(...).search(...) instead.`,Th=Object.prototype.hasOwnProperty,Eh=class{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{let n=Dh(e);this._keys.push(n),this._keyMap[n.id]=n,t+=n.weight}),this._keys.forEach(e=>{e.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function Dh(e){let t=null,n=null,r=null,i=1,a=null;if(uh(e)||sh(e))r=e,t=Oh(e),n=kh(e);else{if(!Th.call(e,`name`))throw Error(Sh(`name`));let o=e.name;if(r=o,Th.call(e,`weight`)&&e.weight!==void 0&&(i=e.weight,i<=0))throw Error(Ch(kh(o)));t=Oh(o),n=kh(o),a=e.getFn??null}return{path:t,id:n,weight:i,src:r,getFn:a}}function Oh(e){return sh(e)?e:e.split(`.`)}function kh(e){return sh(e)?e.join(`.`):e}function Ah(e,t){let n=[],r=!1,i=(e,t,a,o)=>{if(hh(e)){if(!t[a])n.push(o===void 0?e:{v:e,i:o});else{let s=e[t[a]];if(!hh(s))return;if(a===t.length-1&&(uh(s)||dh(s)||fh(s)||typeof s==`bigint`))n.push(o===void 0?lh(s):{v:lh(s),i:o});else if(sh(s)){r=!0;for(let e=0,n=s.length;e<n;e+=1)i(s[e],t,a+1,e)}else t.length&&i(s,t,a+1,o)}}};return i(e,uh(t)?t.split(`.`):t,0),r?n:n[0]}var jh={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},Mh={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},Nh={location:0,threshold:.6,distance:100},Ph={useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:`any`,getFn:Ah,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},Y=Object.freeze({...Mh,...jh,...Nh,...Ph});function Fh(e){return e>=9&&e<=13||e===32||e===160}function Ih(e=1,t=3){let n=new Map,r=10**t;return{get(t){let i=0,a=!1;for(let e=0;e<t.length;e++)Fh(t.charCodeAt(e))?a=!1:a||=(i++,!0);if(i===0&&(i=1),n.has(i))return n.get(i);let o=Math.round(r/i**(.5*e))/r;return n.set(i,o),o},clear(){n.clear()}}}var Lh=class{constructor({getFn:e=Y.getFn,fieldNormWeight:t=Y.fieldNormWeight}={}){this.norm=Ih(t,3),this.getFn=e,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((e,t)=>{this._keysMap[e.id]=t})}create(){if(this.isCreated||!this.docs.length)return;this.isCreated=!0;let e=this.docs.length;this.records=Array(e);let t=0;if(uh(this.docs[0]))for(let n=0;n<e;n++){let e=this._createStringRecord(this.docs[n],n);e&&(this.records[t++]=e)}else for(let n=0;n<e;n++)this.records[t++]=this._createObjectRecord(this.docs[n],n);this.records.length=t,this.norm.clear()}add(e,t){if(!Number.isInteger(t)||t<0)throw Error(yh);if(uh(e)){let n=this._createStringRecord(e,t);return n&&this.records.push(n),n}let n=this._createObjectRecord(e,t);return this.records.push(n),n}removeAt(e){if(!Number.isInteger(e)||e<0)throw Error(yh);for(let t=0,n=this.records.length;t<n;t+=1)if(this.records[t].i===e){this.records.splice(t,1);break}for(let t=0,n=this.records.length;t<n;t+=1)this.records[t].i>e&&--this.records[t].i}removeAll(e){let t=new Set;for(let n of e)Number.isInteger(n)&&n>=0&&t.add(n);if(t.size===0)return;this.records=this.records.filter(e=>!t.has(e.i));let n=Array.from(t).sort((e,t)=>e-t);for(let e of this.records){let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e.i?t=i+1:r=i}e.i-=t}}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_createStringRecord(e,t){return!hh(e)||gh(e)?null:{v:e,i:t,n:this.norm.get(e)}}_createObjectRecord(e,t){let n={i:t,$:{}};for(let t=0,r=this.keys.length;t<r;t++){let r=this.keys[t],i=r.getFn?r.getFn(e):this.getFn(e,r.path);if(hh(i)){if(sh(i)){let e=[];for(let t=0,n=i.length;t<n;t+=1){let n=i[t];if(hh(n)){if(uh(n)){if(!gh(n)){let r={v:n,i:t,n:this.norm.get(n)};e.push(r)}}else if(hh(n.v)){let t=uh(n.v)?n.v:lh(n.v);if(!gh(t)){let r={v:t,i:n.i,n:this.norm.get(t)};e.push(r)}}}}n.$[t]=e}else if(uh(i)&&!gh(i)){let e={v:i,n:this.norm.get(i)};n.$[t]=e}}}return n}toJSON(){return{keys:this.keys.map(({getFn:e,...t})=>t),records:this.records}}};function Rh(e,t,{getFn:n=Y.getFn,fieldNormWeight:r=Y.fieldNormWeight}={}){let i=new Lh({getFn:n,fieldNormWeight:r});return i.setKeys(e.map(Dh)),i.setSources(t),i.create(),i}function zh(e,{getFn:t=Y.getFn,fieldNormWeight:n=Y.fieldNormWeight}={}){let{keys:r,records:i}=e,a=new Lh({getFn:t,fieldNormWeight:n});return a.setKeys(r),a.setIndexRecords(i),a}function Bh(e=[],t=Y.minMatchCharLength){let n=[],r=-1,i=-1,a=0;for(let o=e.length;a<o;a+=1){let o=e[a];o&&r===-1?r=a:!o&&r!==-1&&(i=a-1,i-r+1>=t&&n.push([r,i]),r=-1)}return e[a-1]&&a-r>=t&&n.push([r,a-1]),n}function Vh(e,t,n,{location:r=Y.location,distance:i=Y.distance,threshold:a=Y.threshold,findAllMatches:o=Y.findAllMatches,minMatchCharLength:s=Y.minMatchCharLength,includeMatches:c=Y.includeMatches,ignoreLocation:l=Y.ignoreLocation}={}){if(t.length>32)throw Error(xh(32));let u=t.length,d=e.length,f=Math.max(0,Math.min(r,d)),p=a,m=f,h=(e,t)=>{let n=e/u;if(l)return n;let r=Math.abs(f-t);return i?n+r/i:r?1:n},g=s>1||c,_=g?Array(d):[],v;for(;(v=e.indexOf(t,m))>-1;){let e=h(0,v);if(p=Math.min(e,p),m=v+u,g){let e=0;for(;e<u;)_[v+e]=1,e+=1}}m=-1;let y=[],b=1,x=0,S=u+d,C=1<<u-1;for(let t=0;t<u;t+=1){let r=0,i=S;for(;r<i;)h(t,f+i)<=p?r=i:S=i,i=Math.floor((S-r)/2+r);S=i;let a=Math.max(1,f-i+1),s=o?d:Math.min(f+i,d)+u,c=Array(s+2);c[s+1]=(1<<t)-1;for(let r=s;r>=a;--r){let i=r-1,o=n[e[i]];if(c[r]=(c[r+1]<<1|1)&o,t&&(c[r]|=(y[r+1]|y[r])<<1|1|y[r+1]),c[r]&C&&(b=h(t,i),b<=p)){if(p=b,m=i,x=t,m<=f)break;a=Math.max(1,2*f-m)}}if(h(t+1,f)>p)break;y=c}if(g&&m>=0){let t=Math.min(d-1,m+u-1+x);for(let r=m;r<=t;r+=1)n[e[r]]&&(_[r]=1)}let w={isMatch:m>=0,score:Math.max(.001,b)};if(g){let e=Bh(_,s);e.length?c&&(w.indices=e):w.isMatch=!1}return w}function Hh(e){let t={};for(let n=0,r=e.length;n<r;n+=1){let i=e.charAt(n);t[i]=(t[i]||0)|1<<r-n-1}return t}function Uh(e){if(e.length<=1)return e;e.sort((e,t)=>e[0]-t[0]||e[1]-t[1]);let t=[e[0]];for(let n=1,r=e.length;n<r;n+=1){let r=t[t.length-1],i=e[n];i[0]<=r[1]+1?r[1]=Math.max(r[1],i[1]):t.push(i)}return t}var Wh={ł:`l`,Ł:`L`,đ:`d`,Đ:`D`,ø:`o`,Ø:`O`,ħ:`h`,Ħ:`H`,ŧ:`t`,Ŧ:`T`,ı:`i`,ß:`ss`},Gh=RegExp(`[`+Object.keys(Wh).join(``)+`]`,`g`),Kh=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFD`).replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,``).replace(Gh,e=>Wh[e]):e=>e,qh=class{constructor(e,{location:t=Y.location,threshold:n=Y.threshold,distance:r=Y.distance,includeMatches:i=Y.includeMatches,findAllMatches:a=Y.findAllMatches,minMatchCharLength:o=Y.minMatchCharLength,isCaseSensitive:s=Y.isCaseSensitive,ignoreDiacritics:c=Y.ignoreDiacritics,ignoreLocation:l=Y.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:r,includeMatches:i,findAllMatches:a,minMatchCharLength:o,isCaseSensitive:s,ignoreDiacritics:c,ignoreLocation:l},e=s?e:e.toLowerCase(),e=c?Kh(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;let u=(e,t)=>{this.chunks.push({pattern:e,alphabet:Hh(e),startIndex:t})},d=this.pattern.length;if(d>32){let e=0,t=d%32,n=d-t;for(;e<n;)u(this.pattern.substr(e,32),e),e+=32;if(t){let e=d-32;u(this.pattern.substr(e),e)}}else u(this.pattern,0)}searchIn(e){let{isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r}=this.options;if(e=t?e:e.toLowerCase(),e=n?Kh(e):e,this.pattern===e){if(e.length<this.options.minMatchCharLength)return{isMatch:!1,score:1};let t={isMatch:!0,score:0};return r&&(t.indices=[[0,e.length-1]]),t}let{location:i,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,ignoreLocation:l}=this.options,u=[],d=0,f=!1;this.chunks.forEach(({pattern:t,alphabet:n,startIndex:p})=>{let{isMatch:m,score:h,indices:g}=Vh(e,t,n,{location:i+p,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,includeMatches:r,ignoreLocation:l});m&&(f=!0),d+=h,m&&g&&u.push(...g)});let p={isMatch:f,score:f?d/this.chunks.length:1};return f&&r&&(p.indices=Uh(u)),p}},Jh=new Set([`fuzzy`,`include`]);function Yh(e){return e.startsWith(`inverse`)}var Xh=[{type:`exact`,multiRegex:/^="(.*)"$/,singleRegex:/^=(.*)$/,create:e=>({type:`exact`,search(t){let n=t===e;return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`include`,multiRegex:/^'"(.*)"$/,singleRegex:/^'(.*)$/,create:e=>({type:`include`,search(t){let n=0,r,i=[],a=e.length;for(;(r=t.indexOf(e,n))>-1;)n=r+a,i.push([r,n-1]);let o=!!i.length;return{isMatch:o,score:+!o,indices:i}}})},{type:`prefix-exact`,multiRegex:/^\^"(.*)"$/,singleRegex:/^\^(.*)$/,create:e=>({type:`prefix-exact`,search(t){let n=t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`inverse-prefix-exact`,multiRegex:/^!\^"(.*)"$/,singleRegex:/^!\^(.*)$/,create:e=>({type:`inverse-prefix-exact`,search(t){let n=!t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`inverse-suffix-exact`,multiRegex:/^!"(.*)"\$$/,singleRegex:/^!(.*)\$$/,create:e=>({type:`inverse-suffix-exact`,search(t){let n=!t.endsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`suffix-exact`,multiRegex:/^"(.*)"\$$/,singleRegex:/^(.*)\$$/,create:e=>({type:`suffix-exact`,search(t){let n=t.endsWith(e);return{isMatch:n,score:+!n,indices:[t.length-e.length,t.length-1]}}})},{type:`inverse-exact`,multiRegex:/^!"(.*)"$/,singleRegex:/^!(.*)$/,create:e=>({type:`inverse-exact`,search(t){let n=t.indexOf(e)===-1;return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`fuzzy`,multiRegex:/^"(.*)"$/,singleRegex:/^(.*)$/,create:(e,t={})=>{let n=new qh(e,{location:t.location??Y.location,threshold:t.threshold??Y.threshold,distance:t.distance??Y.distance,includeMatches:t.includeMatches??Y.includeMatches,findAllMatches:t.findAllMatches??Y.findAllMatches,minMatchCharLength:t.minMatchCharLength??Y.minMatchCharLength,isCaseSensitive:t.isCaseSensitive??Y.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics??Y.ignoreDiacritics,ignoreLocation:t.ignoreLocation??Y.ignoreLocation});return{type:`fuzzy`,search(e){return n.searchIn(e)}}}}],Zh=Xh.length,Qh=`\0`,$h=`|`;function eg(e){let t=[],n=e.length,r=0;for(;r<n;){for(;r<n&&e[r]===` `;)r++;if(r>=n)break;let i=r;for(;i<n&&e[i]!==` `&&e[i]!==`"`;)i++;if(i<n&&e[i]===`"`){for(i++;i<n;){if(e[i]===`"`){let t=i+1;if(t>=n||e[t]===` `){i++;break}if(e[t]===`$`&&(t+1>=n||e[t+1]===` `)){i+=2;break}}i++}t.push(e.substring(r,i)),r=i}else{for(;i<n&&e[i]!==` `;)i++;t.push(e.substring(r,i)),r=i}}return t}function tg(e,t){let n=e.match(t);return n?n[1]:null}function ng(e,t={}){return e.replace(/\\\|/g,Qh).split($h).map(e=>{let n=eg(e.replace(/\u0000/g,`|`).trim()).filter(e=>e&&!!e.trim()),r=[];for(let e=0,i=n.length;e<i;e+=1){let i=n[e],a=!1,o=-1;for(;!a&&++o<Zh;){let e=Xh[o],n=tg(i,e.multiRegex);n&&(r.push(e.create(n,t)),a=!0)}if(!a)for(o=-1;++o<Zh;){let e=Xh[o],n=tg(i,e.singleRegex);if(n){r.push(e.create(n,t));break}}}return r})}var rg=class{constructor(e,{isCaseSensitive:t=Y.isCaseSensitive,ignoreDiacritics:n=Y.ignoreDiacritics,includeMatches:r=Y.includeMatches,minMatchCharLength:i=Y.minMatchCharLength,ignoreLocation:a=Y.ignoreLocation,findAllMatches:o=Y.findAllMatches,location:s=Y.location,threshold:c=Y.threshold,distance:l=Y.distance}={}){this.query=null,this.options={isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r,minMatchCharLength:i,findAllMatches:o,ignoreLocation:a,location:s,threshold:c,distance:l},e=t?e:e.toLowerCase(),e=n?Kh(e):e,this.pattern=e,this.query=ng(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){let t=this.query;if(!t)return{isMatch:!1,score:1};let{includeMatches:n,isCaseSensitive:r,ignoreDiacritics:i}=this.options;e=r?e:e.toLowerCase(),e=i?Kh(e):e;let a=0,o=[],s=0,c=!1;for(let r=0,i=t.length;r<i;r+=1){let i=t[r];o.length=0,a=0,c=!1;for(let t=0,r=i.length;t<r;t+=1){let r=i[t],{isMatch:l,indices:u,score:d}=r.search(e);if(l)a+=1,s+=d,Yh(r.type)&&(c=!0),n&&(Jh.has(r.type)?o.push(...u):o.push(u));else{s=0,a=0,o.length=0,c=!1;break}}if(a){let e={isMatch:!0,score:s/a};return c&&(e.hasInverse=!0),n&&(e.indices=Uh(o)),e}}return{isMatch:!1,score:1}}},ig=[];function ag(...e){ig.push(...e)}function og(e,t){for(let n=0,r=ig.length;n<r;n+=1){let r=ig[n];if(r.condition(e,t))return new r(e,t)}return new qh(e,t)}var sg={AND:`$and`,OR:`$or`},cg={PATH:`$path`,PATTERN:`$val`},lg=e=>!!(e[sg.AND]||e[sg.OR]),ug=e=>!!e[cg.PATH],dg=e=>!sh(e)&&ph(e)&&!lg(e),fg=e=>({[sg.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function pg(e,t,{auto:n=!0}={}){let r=e=>{if(uh(e)){let r={keyId:null,pattern:e};return n&&(r.searcher=og(e,t)),r}let i=Object.keys(e),a=ug(e);if(!a&&i.length>1&&!lg(e))return r(fg(e));if(dg(e)){let r=a?e[cg.PATH]:i[0],o=a?e[cg.PATTERN]:e[r];if(!uh(o))throw Error(bh(r));let s={keyId:kh(r),pattern:o};return n&&(s.searcher=og(o,t)),s}let o={children:[],operator:i[0]};return i.forEach(t=>{let n=e[t];sh(n)&&n.forEach(e=>{o.children.push(r(e))})}),o};return lg(e)||(e=fg(e)),r(e)}function mg(e,{ignoreFieldNorm:t=Y.ignoreFieldNorm}){let n=1;return e.forEach(({key:e,norm:r,score:i})=>{let a=e?e.weight:null;n*=(i===0&&a?2**-52:i)**+((a||1)*(t?1:r))}),n}function hg(e,{ignoreFieldNorm:t=Y.ignoreFieldNorm}){e.forEach(e=>{e.score=mg(e.matches,{ignoreFieldNorm:t})})}var gg=class{constructor(e,t){this.limit=e,this.heap=[],this.comparator=t}get size(){return this.heap.length}insert(e){this.size<this.limit?(this.heap.push(e),this._bubbleUp(this.size-1)):this.comparator(e,this.heap[0])<0&&(this.heap[0]=e,this._sinkDown(0))}extractSorted(){return this.heap.sort(this.comparator)}_bubbleUp(e){let t=this.heap;for(;e>0;){let n=e-1>>1;if(this.comparator(t[e],t[n])<=0)break;let r=t[e];t[e]=t[n],t[n]=r,e=n}}_sinkDown(e){let t=this.heap,n=t.length,r=e;do{e=r;let i=2*e+1,a=2*e+2;if(i<n&&this.comparator(t[i],t[r])>0&&(r=i),a<n&&this.comparator(t[a],t[r])>0&&(r=a),r!==e){let n=t[e];t[e]=t[r],t[r]=n}}while(r!==e)}};function _g(e){let t=[];return e.matches.forEach(e=>{if(!hh(e.indices)||!e.indices.length)return;let n={indices:e.indices,value:e.value};e.key&&(n.key=e.key.id),e.idx>-1&&(n.refIndex=e.idx),t.push(n)}),t}function vg(e,t,{includeMatches:n=Y.includeMatches,includeScore:r=Y.includeScore}={}){return e.map(e=>{let{idx:i}=e,a={item:t[i],refIndex:i};return n&&(a.matches=_g(e)),r&&(a.score=e.score),a})}var yg=/[\p{L}\p{M}\p{N}_]+/gu,bg=new WeakSet;function xg(e){bg.has(e)||(bg.add(e),console.warn(`[Fuse] tokenize regex ${e} lacks the global flag; only the first match per text will be returned. Add the 'g' flag.`))}function Sg(e){if(typeof e==`function`){let t=!1;return n=>{let r=e(n);if(!t&&(t=!0,!Array.isArray(r)||r.some(e=>typeof e!=`string`)))throw Error(`[Fuse] tokenize function must return string[]; received ${Array.isArray(r)?`array containing non-strings`:typeof r}.`);return r}}return e instanceof RegExp?(e.global||xg(e),t=>t.match(e)||[]):e=>e.match(yg)||[]}function Cg({isCaseSensitive:e=!1,ignoreDiacritics:t=!1,tokenize:n}={}){let r=Sg(n);return{tokenize(n){return e||(n=n.toLowerCase()),t&&(n=Kh(n)),r(n)}}}var wg=class{static condition(e,t){return t.useTokenSearch}constructor(e,t){this.options=t,this.analyzer=Cg({isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,tokenize:t.tokenize});let n=this.analyzer.tokenize(e),{df:r,fieldCount:i}=t._invertedIndex;this.termSearchers=[],this.idfWeights=[];for(let e of n){this.termSearchers.push(new qh(e,{location:t.location,threshold:t.threshold,distance:t.distance,includeMatches:t.includeMatches,findAllMatches:t.findAllMatches,minMatchCharLength:t.minMatchCharLength,isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,ignoreLocation:!0}));let n=r.get(e)||0,a=Math.log(1+(i-n+.5)/(n+.5));this.idfWeights.push(a)}this.combineAll=t.tokenMatch===`all`,this.numTerms=this.termSearchers.length,this.useMask=this.numTerms<=31}searchIn(e){if(!this.termSearchers.length)return{isMatch:!1,score:1};let t=[],n=0,r=0,i=0,a=0,o=this.combineAll&&!this.useMask?new Set:null;for(let s=0;s<this.termSearchers.length;s++){let c=this.termSearchers[s].searchIn(e),l=this.idfWeights[s];r+=l,c.isMatch&&(i++,n+=l*(1-c.score),c.indices&&t.push(...c.indices),this.combineAll&&(this.useMask?a|=1<<s:o.add(s)))}if(i===0)return{isMatch:!1,score:1};let s=r>0?1-n/r:0,c={isMatch:!0,score:Math.max(.001,s)};return this.options.includeMatches&&t.length&&(c.indices=Uh(t)),this.combineAll&&(this.useMask?c.matchedMask=a:c.matchedTerms=o,c.termCount=this.numTerms),c}};function Tg(e,t,n,r){let i=r.tokenize(t);if(!i.length)return;e.fieldCount++,e.docFieldCount.set(n,(e.docFieldCount.get(n)||0)+1);let a=new Set(i),o=e.docTermFieldHits.get(n);o||(o=new Map,e.docTermFieldHits.set(n,o));for(let t of a)o.set(t,(o.get(t)||0)+1),e.df.set(t,(e.df.get(t)||0)+1)}function Eg(e,t,n,r){let{i,v:a,$:o}=t;if(a!==void 0)Tg(e,a,i,r);else if(o)for(let t=0;t<n;t++){let n=o[t];if(n){if(Array.isArray(n))for(let t of n)Tg(e,t.v,i,r);else Tg(e,n.v,i,r)}}}function Dg(e,t,n){let r={fieldCount:0,df:new Map,docFieldCount:new Map,docTermFieldHits:new Map};for(let i of e)Eg(r,i,t,n);return r}function Og(e,t,n,r){Eg(e,t,n,r)}function kg(e,t){let n=e.docFieldCount.get(t);if(n===void 0)return;e.fieldCount-=n,e.docFieldCount.delete(t);let r=e.docTermFieldHits.get(t);if(r){for(let[t,n]of r){let r=(e.df.get(t)||0)-n;r<=0?e.df.delete(t):e.df.set(t,r)}e.docTermFieldHits.delete(t)}}function Ag(e,t){if(t.length===0)return;let n=Array.from(new Set(t)).sort((e,t)=>e-t);for(let t of n)kg(e,t);let r=e=>{let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e?t=i+1:r=i}return e-t},i=n[0],a=new Map;for(let[t,n]of e.docFieldCount)a.set(t>i?r(t):t,n);e.docFieldCount=a;let o=new Map;for(let[t,n]of e.docTermFieldHits)o.set(t>i?r(t):t,n);e.docTermFieldHits=o}var jg=class{constructor(e,t,n){this.options={...Y,...t},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new Eh(this.options.keys),this._docs=e,this._myIndex=null,this._invertedIndex=null,this.setCollection(e,n),this._lastQuery=null,this._lastSearcher=null}_getSearcher(e){if(this._lastQuery===e)return this._lastSearcher;let t=og(e,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=e,this._lastSearcher=t,t}setCollection(e,t){if(this._docs=e,t&&!(t instanceof Lh))throw Error(vh);if(this._myIndex=t||Rh(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){let e=Cg({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});this._invertedIndex=Dg(this._myIndex.records,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}add(e){if(!hh(e))return;this._docs.push(e);let t=this._myIndex.add(e,this._docs.length-1);if(this._invertedIndex&&t){let e=Cg({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});Og(this._invertedIndex,t,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}remove(e=()=>!1){let t=[],n=[];for(let r=0,i=this._docs.length;r<i;r+=1)e(this._docs[r],r)&&(t.push(this._docs[r]),n.push(r));if(n.length){this._invertedIndex&&Ag(this._invertedIndex,n);let e=new Set(n);this._docs=this._docs.filter((t,n)=>!e.has(n)),this._myIndex.removeAll(n),this._invalidateSearcherCache()}return t}removeAt(e){if(!Number.isInteger(e)||e<0||e>=this._docs.length)throw Error(yh);this._invertedIndex&&Ag(this._invertedIndex,[e]);let t=this._docs.splice(e,1)[0];return this._myIndex.removeAt(e),this._invalidateSearcherCache(),t}_invalidateSearcherCache(){this._lastQuery=null,this._lastSearcher=null}getIndex(){return this._myIndex}_normalizedKeys(){return this._myIndex.keys.map(e=>this._keyStore.get(e.id)||e)}search(e,t){let{limit:n=-1}=t||{},{includeMatches:r,includeScore:i,shouldSort:a,sortFn:o,ignoreFieldNorm:s}=this.options;if(uh(e)&&!e.trim()){let e=this._docs.map((e,t)=>({item:e,refIndex:t}));return dh(n)&&n>-1&&(e=e.slice(0,n)),e}let c=a&&dh(n)&&n>0&&uh(e),l=o,u=(e,t)=>l(e,t)||e.idx-t.idx,d;if(c){let t=new gg(n,u);uh(this._docs[0])?this._searchStringList(e,{heap:t,ignoreFieldNorm:s}):this._searchObjectList(e,{heap:t,ignoreFieldNorm:s}),d=t.extractSorted()}else d=uh(e)?uh(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e),hg(d,{ignoreFieldNorm:s}),a&&d.sort(uh(e)?u:l),dh(n)&&n>-1&&(d=d.slice(0,n));return vg(d,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{records:a}=this._myIndex,o=t?null:[];return a.forEach(({v:e,i:a,n:s})=>{if(!hh(e))return;let c=r.searchIn(e);if(c.isMatch){let r={score:c.score,value:e,norm:s,indices:c.indices};i&&(r.matchedMask=c.matchedMask,r.matchedTerms=c.matchedTerms,r.termCount=c.termCount);let l=[r];if(!i||this._coversAllTokens(l)){let r={item:e,idx:a,matches:l};t?(r.score=mg(r.matches,{ignoreFieldNorm:n}),t.insert(r)):o.push(r)}}}),o}_searchLogical(e){let t=pg(e,this.options),n=this._normalizedKeys(),r=(e,t,i)=>{if(!(`children`in e)){let{keyId:r,searcher:a}=e,o;return r===null?(o=[],n.forEach((e,n)=>{o.push(...this._findMatches({key:e,value:t[n],searcher:a}))})):o=this._findMatches({key:this._keyStore.get(r),value:this._myIndex.getValueForItemAtKeyId(t,r),searcher:a}),o&&o.length?[{idx:i,item:t,matches:o}]:[]}let{children:a,operator:o}=e,s=[];for(let e=0,n=a.length;e<n;e+=1){let n=a[e],c=r(n,t,i);if(c.length)s.push(...c);else if(o===sg.AND)return[]}return s},i=this._myIndex.records,a=new Map,o=[];return i.forEach(({$:e,i:n})=>{if(hh(e)){let i=r(t,e,n);i.length&&(a.has(n)||(a.set(n,{idx:n,item:e,matches:[]}),o.push(a.get(n))),i.forEach(({matches:e})=>{a.get(n).matches.push(...e)}))}}),o}_searchObjectList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{records:a}=this._myIndex,o=this._normalizedKeys(),s=t?null:[];return a.forEach(({$:e,i:a})=>{if(!hh(e))return;let c=[],l=!1,u=!1;if(o.forEach((t,n)=>{let i=this._findMatches({key:t,value:e[n],searcher:r});i.length?(c.push(...i),i[0].hasInverse&&(u=!0)):l=!0}),!(u&&l)&&c.length&&(!i||this._coversAllTokens(c))){let r={idx:a,item:e,matches:c};t?(r.score=mg(r.matches,{ignoreFieldNorm:n}),t.insert(r)):s.push(r)}}),s}_findMatches({key:e,value:t,searcher:n}){if(!hh(t))return[];let r=[];if(sh(t))t.forEach(({v:t,i,n:a})=>{if(!hh(t))return;let o=n.searchIn(t);if(o.isMatch){let n={score:o.score,key:e,value:t,idx:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(n.matchedMask=o.matchedMask,n.matchedTerms=o.matchedTerms,n.termCount=o.termCount),r.push(n)}});else{let{v:i,n:a}=t,o=n.searchIn(i);if(o.isMatch){let t={score:o.score,key:e,value:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(t.matchedMask=o.matchedMask,t.matchedTerms=o.matchedTerms,t.termCount=o.termCount),r.push(t)}}return r}_coversAllTokens(e){let t=e.length?e[0].termCount:void 0;if(t===void 0)return!0;if(t<=31){let n=0;for(let t=0;t<e.length;t++)n|=e[t].matchedMask||0;return n===2**t-1}let n=new Set;for(let t=0;t<e.length;t++){let r=e[t].matchedTerms;if(r)for(let e of r)n.add(e)}return n.size===t}};jg.version=`7.5.0`,jg.createIndex=Rh,jg.parseIndex=zh,jg.config=Y,jg.match=function(e,t,n){if(n&&n.useTokenSearch)throw Error(wh);return og(e,{...Y,...n}).searchIn(t)},jg.parseQuery=pg,ag(rg),ag(wg),jg.use=function(...e){e.forEach(e=>ag(e))};var Mg=jg,Ng=`modulepreload`,Pg=function(e){return`/`+e},Fg={},Ig=function(e){return e.pathname.endsWith(`.css`)},Lg=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},Rg=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Pg(t,n);let r=s(t),i=Ig(r);return Lg(Fg,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Ng,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},zg=class extends Error{status;body;constructor(e,t){super(t.error||`HTTP ${e}`),this.name=`BlameApiError`,this.status=e,this.body=t}},Bg=class extends Error{constructor(){super(`Blame 请求已取消`),this.name=`BlameCancelledError`}},Vg=(e,t,n=``)=>`/api/git?workspaceId=${encodeURIComponent(e)}&op=blame&path=${encodeURIComponent(t)}${n?`&cwd=${encodeURIComponent(n)}`:``}`;async function Hg(e,t,n={}){if(n.signal?.aborted)throw new Bg;let r=n.timeoutMs??15e3,i=new AbortController,a=!1,o=setTimeout(()=>{a=!0,i.abort()},r),s=()=>i.abort();n.signal?.addEventListener(`abort`,s,{once:!0});try{let r=await fetch(Vg(e,t,n.cwd),{signal:i.signal}),a;try{a=await r.json()}catch{a=void 0}if(!r.ok){let e=a??{};throw new zg(r.status,{error:e.error||`HTTP ${r.status}`,...e.code?{code:e.code}:{}})}return a}catch(e){throw n.signal?.aborted?new Bg:a?new zg(408,{error:`请求超时:${Math.round(r/1e3)} 秒内服务端没有响应`,code:`timeout`}):e}finally{clearTimeout(o),n.signal?.removeEventListener(`abort`,s)}}var Ug=`\0`,Wg=(e,t,n)=>[e,t,n??``].join(Ug),Gg=24,Kg=new Map;function qg(e){let t=Kg.get(e);if(t)return Kg.delete(e),Kg.set(e,t),t}function Jg(e,t){for(Kg.delete(e),Kg.set(e,t);Kg.size>Gg;){let e=Kg.keys().next();if(e.done)break;Kg.delete(e.value)}}var Yg={untracked:`这个文件尚未被 Git 跟踪`,binary:`二进制文件不支持 Blame`,too_large:`文件过大,未显示 Blame`,no_head:`仓库还没有提交`,not_in_revision:`这个版本里没有这个文件`},Xg=`此工作区不是 Git 仓库`;function Zg(e){return e&&Yg[e]?{code:e,text:Yg[e]}:{code:`unsupported`,text:`这个文件暂时不能显示 Blame`}}function Qg(e){return e instanceof zg&&e.body.code===`not_a_repo`?{state:`unsupported`,note:{code:`not_a_repo`,text:Xg}}:{state:`error`,note:{code:`error`,text:`读取 Blame 失败:${e instanceof Error&&e.message?e.message:`未知错误`}`}}}var $g=`${Ug}uncommitted`;function e_(e){let t=new Map,n=0;for(let r of e.lines)t.has(r.line)||t.set(r.line,r),r.line>n&&(n=r.line);let r=[],i=null,a=0;for(let e=1;e<=n;e+=1){let n=t.get(e);if(!n){r.push({line:e,kind:`missing`,data:null}),i=null,a=e;continue}let o=n.isUncommitted?$g:n.commit??`${Ug}none`,s=o===i&&e===a+1?`continuation`:n.isUncommitted?`uncommitted`:`commit`;r.push({line:e,kind:s,data:n}),i=o,a=e}if(e.truncated)for(let t=n+1;t<=e.totalLines;t+=1)r.push({line:t,kind:`truncated`,data:null});return r}function t_(e){let t=0;for(let n of e.lines)n.line>t&&(t=n.line);return t}function n_(e){switch(e.kind){case`commit`:{let t=e.data,n=t?.shortCommit??t?.commit?.slice(0,8)??`?`,r=t?.author?.trim();return r?`${n} · ${r}`:n}case`continuation`:return`│`;case`uncommitted`:return`● 未提交`;case`missing`:return`?`;case`truncated`:return`…`;default:return``}}function r_(e){if(e.kind===`uncommitted`||e.data?.isUncommitted)return[`未提交`,`这行尚不属于任何 Git 提交`];if(e.kind===`missing`)return[`没有 Blame 信息`,`这一行没有对应的提交记录`];if(e.kind===`truncated`)return[`Blame 数据已截断`,`文件太长,只显示了前面一部分的提交信息`];let t=e.data;if(!t)return[`没有 Blame 信息`];let n=t.shortCommit??t.commit?.slice(0,8)??`未知提交`,r=t.author?.trim()||`未知作者`;return[n,t.authorEmail?`${r} <${t.authorEmail}>`:r,i_(t.date),t.summary?.trim()||`(没有提交摘要)`]}function i_(e){if(!e)return`不详`;let t=new Date(e);if(!Number.isFinite(t.getTime()))return e;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function a_(e){if(e.length===0)return 0;let t=1;for(let n=0;n<e.length;n+=1)e.charCodeAt(n)===10&&(t+=1);return e.charCodeAt(e.length-1)===10&&--t,t}function o_(e,t,n=!1){return!t||!t.supported?!1:n||a_(e)!==t.totalLines}var s_=new WeakMap;function c_(e){let t=s_.get(e);if(t)return t;let n={response:e,models:e_(e),covered:t_(e)};return s_.set(e,n),n}function l_(e,t){if(!e||t<1)return null;let n=e.models[t-1];return n&&n.line===t?n:null}var u_=`a1b2c3d · Author`;async function d_(){let[e,t]=await Promise.all([Rg(()=>import(`./dist-BQK5OciP.js`).then(e=>e.x),[]),Rg(()=>import(`./dist-R_rLoe1G.js`).then(e=>e.s),__vite__mapDeps([0,1]))]),n=e.StateEffect.define(),r=e.StateField.define({create:()=>null,update:(e,t)=>{for(let e of t.effects)if(e.is(n))return e.value;return e}}),i=e.StateEffect.define(),a=e.StateField.define({create:()=>null,update:(e,t)=>{for(let e of t.effects)if(e.is(i))return e.value;return e}}),o=t.GutterMarker;class s extends o{model;constructor(e){super(),this.model=e}eq(e){let t=e.model;return t?t.line===this.model.line&&t.kind===this.model.kind&&t.data?.commit===this.model.data?.commit&&t.data?.summary===this.model.data?.summary&&t.data?.author===this.model.data?.author:!1}toDOM(){let e=document.createElement(`span`);e.className=`cm-blame-marker cm-blame-${this.model.kind}`,e.setAttribute(`data-file-blame-line`,String(this.model.line)),e.setAttribute(`data-file-blame-kind`,this.model.kind),this.model.data?.commit&&e.setAttribute(`data-file-blame-commit`,this.model.data.commit);let t=r_(this.model);return e.setAttribute(`title`,t.join(`
|
|
49
|
+
`)),e.setAttribute(`aria-label`,t.join(` · `)),e.textContent=n_(this.model),e}}class c extends o{eq(){return!0}toDOM(){let e=document.createElement(`span`);return e.className=`cm-blame-marker cm-blame-spacer`,e.textContent=u_,e}}let l=t.gutter({class:`cm-blame-gutter`,initialSpacer:()=>new c,lineMarker:(e,t)=>{let n=e.state.field(r);if(!n)return null;let i=e.state.doc.lineAt(t.from).number,a=l_(n,i);return new s(a??{line:i,kind:`missing`,data:null})},lineMarkerChange:e=>e.startState.field(r)!==e.state.field(r)}),u=t.ViewPlugin.fromClass(class{line=null;editorView;constructor(e){this.editorView=e,this.editorView.dom.addEventListener(`mousemove`,this.onMove),this.editorView.dom.addEventListener(`mouseleave`,this.onLeave)}destroy(){this.editorView.dom.removeEventListener(`mousemove`,this.onMove),this.editorView.dom.removeEventListener(`mouseleave`,this.onLeave)}update(e){e.startState.field(r)!==e.state.field(r)&&this.line!==null&&(this.line=null,this.editorView.dispatch({effects:i.of(null)}))}onMove=e=>{let t=this.lineAt(e);if(t===this.line)return;if(this.line=t,t===null){this.editorView.dispatch({effects:i.of(null)});return}let n=l_(this.editorView.state.field(r),t);if(!n){this.editorView.dispatch({effects:i.of(null)});return}let a=this.editorView.state.doc,o=a.line(Math.min(t,a.lines));this.editorView.dispatch({effects:i.of({pos:o.from,above:!0,create:()=>({dom:f_(n)})})})};onLeave=()=>{this.line=null,this.editorView.dispatch({effects:i.of(null)})};lineAt(e){let t=e.target,n=t?.closest?.(`[data-file-blame-line]`);if(n){let e=Number(n.getAttribute(`data-file-blame-line`));return Number.isInteger(e)&&e>0?e:null}if(t?.closest?.(`.cm-blame-gutter`))return null;let r=this.editorView.posAtCoords({x:e.clientX,y:e.clientY});return r==null?null:this.editorView.state.doc.lineAt(r).number}});return{field:r,setBlame:n,base:[r,a,t.showTooltip.from(a),u],gutter:l}}function f_(e){let t=document.createElement(`div`);t.className=`cm-blame-tooltip`,t.setAttribute(`data-file-blame-tooltip`,`1`),t.setAttribute(`data-file-blame-kind`,e.kind),e.data?.commit&&t.setAttribute(`data-file-blame-commit`,e.data.commit);for(let n of r_(e)){let e=document.createElement(`div`);e.className=`cm-blame-tooltip-row`,e.textContent=n,t.appendChild(e)}return t}var p_=4e3,m_=(0,H.lazy)(()=>Rg(()=>import(`./CodeMirrorEditor-BB0GyCns.js`).then(e=>({default:e.CodeMirrorEditor})),[])),h_=class extends Error{status;body;constructor(e,t){super(t.error||`HTTP ${e}`),this.status=e,this.body=t,this.name=`ApiError`}},g_=15e3,__=e=>new h_(408,{error:`请求超时:${g_/1e3} 秒内服务端没有响应`,code:`timeout`,details:{path:e}});async function v_(e,t){let n=new AbortController,r=setTimeout(()=>n.abort(),g_);try{let r=await fetch(e,{...t,signal:n.signal}),i;try{i=await r.json()}catch{i=void 0}if(!r.ok)throw new h_(r.status,i??{error:`HTTP ${r.status}`});return i}catch(t){throw n.signal.aborted?__(e):t}finally{clearTimeout(r)}}var y_=e=>e instanceof h_?e:new h_(0,{error:e instanceof Error?e.message:`读取失败`}),b_=e=>encodeURIComponent(e),x_=e=>e?`&cwd=${b_(e)}`:``,S_=(e,t,n)=>`/api/files?workspaceId=${b_(e)}&path=${b_(t)}${x_(n)}`,C_=(e,t,n)=>`/api/file?workspaceId=${b_(e)}&path=${b_(t)}${x_(n)}`,w_=(e,t,n)=>`/api/file?workspaceId=${b_(e)}&path=${b_(t)}&meta=1${x_(n)}`,T_=(e,t,n)=>`/api/files?workspaceId=${b_(e)}&q=${b_(t)}${x_(n)}`,E_=e=>e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`,D_=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?``:new Date(e).toLocaleTimeString(`zh-CN`,{hour:`2-digit`,minute:`2-digit`})};function O_({workspaceId:e,entryPath:t,name:n,listings:r,expanded:i,toggle:a,loadDirectory:o,openPaths:s,changedDirs:c,changedPaths:l,onOpen:u,depth:d}){let f=r[t],p=i.has(t);return(0,H.useEffect)(()=>{p&&f===void 0&&o(t)},[p,t,f,o]),(0,U.jsxs)(`li`,{className:`file-node`,"data-file-dir":t,"data-file-dir-changed":c.has(t)?`1`:`0`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`file-row file-row-dir`,"data-file-dir-toggle":t,"aria-expanded":p,style:{paddingLeft:`${8+d*13}px`},title:c.has(t)?`${t} 里有 agent 改过的文件`:t,onClick:()=>a(t),children:[(0,U.jsx)(`span`,{className:`file-caret`,"aria-hidden":`true`,children:p?`▾`:`▸`}),(0,U.jsx)(cp,{category:`folder`}),(0,U.jsx)(`span`,{className:`file-name`,children:n}),c.has(t)&&(0,U.jsx)(`span`,{className:`file-badge file-badge-changed`,"data-file-dir-changed-badge":t,title:`里面有 agent 改过的文件`,children:`✎`})]}),p&&(0,U.jsx)(`ul`,{className:`file-children`,children:f===void 0?(0,U.jsx)(`li`,{className:`file-row-loading`,"data-file-loading":t,children:`读取中…`}):`error`in f?(0,U.jsx)(`li`,{className:`file-row-error`,"data-file-error":t,title:np(f.error.message),children:tp(f.error.message,`这个目录读取失败。`)}):f.entries.length===0?(0,U.jsx)(`li`,{className:`file-row-empty`,"data-file-empty":t,children:`空目录`}):(0,U.jsxs)(U.Fragment,{children:[f.truncated&&(0,U.jsx)(`li`,{className:`file-row-empty`,"data-file-truncated":t,children:`条目过多,只显示前一部分`}),f.entries.map(t=>t.kind===`directory`?(0,U.jsx)(O_,{workspaceId:e,entryPath:t.path,name:t.name,listings:r,expanded:i,toggle:a,loadDirectory:o,openPaths:s,changedDirs:c,changedPaths:l,onOpen:u,depth:d+1},t.path):(0,U.jsx)(k_,{entry:t,depth:d+1,openPaths:s,changedPaths:l,onOpen:u},t.path))]})})]})}function k_({entry:e,depth:t,openPaths:n,changedPaths:r,onOpen:i}){if(e.kind===`symlink`)return(0,U.jsx)(`li`,{className:`file-node`,"data-file-entry":e.path,"data-file-outside":e.path,children:(0,U.jsxs)(`button`,{type:`button`,className:`file-row file-row-file`,disabled:!0,title:`${e.path} 是一个指向 workspace 之外的符号链接,不能打开`,style:{paddingLeft:`${8+t*13}px`},children:[(0,U.jsx)(`span`,{className:`file-caret`,"aria-hidden":`true`}),(0,U.jsx)(`span`,{className:`file-name`,children:e.name}),(0,U.jsx)(`span`,{className:`file-badge`,"data-file-outside-badge":`1`,children:`外部链接`})]})});let a=n.has(e.path),o=r.has(e.path);return(0,U.jsx)(`li`,{className:`file-node`,"data-file-entry":e.path,"data-file-row-open":a?`1`:`0`,"data-file-row-changed":o?`1`:`0`,children:(0,U.jsxs)(`button`,{type:`button`,className:`file-row file-row-file`,"data-file-open":e.path,disabled:!e.text,title:e.text?o?`${e.path}(agent 改过这个文件,点击查看改动)`:a?`${e.path}(已经打开,点击切换到它)`:e.path:`${e.name} 是二进制文件,无法以文本打开`,style:{paddingLeft:`${8+t*13}px`},onClick:()=>i(e),children:[(0,U.jsx)(`span`,{className:`file-caret`,"aria-hidden":`true`}),(0,U.jsx)(cp,{path:e.path}),(0,U.jsx)(`span`,{className:`file-name`,children:e.name}),a&&(0,U.jsx)(`span`,{className:`file-open-mark`,"data-file-open-mark":e.path,title:`已经打开`,"aria-label":`已经打开`,children:`●`}),o&&(0,U.jsx)(`span`,{className:`file-badge file-badge-changed`,"data-file-changed":e.path,title:`agent 改过这个文件`,children:`✎ 已改`}),e.document&&(0,U.jsx)(`span`,{className:`file-badge`,"data-file-document":`1`,"aria-label":`文档文件`,children:`文档`}),!e.text&&!e.document&&(0,U.jsx)(`span`,{className:`file-badge`,"data-file-binary":`1`,"aria-label":`不支持的文件类型`,children:`不支持`})]})})}function A_({file:e,state:t,message:n,external:r,jumpToLine:i,onChange:a,onSave:o,onReload:s,onOverwrite:c,workspaceId:l,cwd:u=``}){let[d,f]=(0,H.useState)(!0),p=(0,H.useRef)(null),[m,h]=(0,H.useState)({}),[g,_]=(0,H.useState)(null),v=(0,H.useRef)(0),y=m[e.path]===!0&&!!l,b=l?u?`${l}:${u}`:l:``;(0,H.useEffect)(()=>{let t=++v.current;if(!y||!l){_(null);return}let n=new AbortController,i=Wg(b,e.path,e.etag),a=r?void 0:qg(i);if(a)_({state:a.supported?`ready`:`unsupported`,response:a,path:e.path,workspaceId:b,note:a.supported?null:Zg(a.reason)});else return _({state:`loading`,response:null,path:e.path,workspaceId:b,note:null}),Hg(l,e.path,{signal:n.signal,cwd:u}).then(n=>{t===v.current&&(r||Jg(i,n),_({state:n.supported?`ready`:`unsupported`,response:n,path:e.path,workspaceId:b,note:n.supported?null:Zg(n.reason)}))}).catch(n=>{if(t!==v.current||n instanceof Bg)return;let r=Qg(n);_({state:r.state,response:null,path:e.path,workspaceId:b,note:r.note})}),()=>{n.abort()}},[y,l,u,b,e.path,e.etag,r]);let x=g&&g.path===e.path&&g.workspaceId===b?g:null,S=y?x?.state??`loading`:`off`,C=S===`ready`&&o_(e.content,x?.response??null,e.dirty||r),w=[];x?.note&&w.push(x.note),S===`ready`&&x?.response?.truncated&&w.push({code:`truncated`,text:`Blame 数据已截断,只显示了前面一部分(共 ${x.response.totalLines} 行)`}),C&&w.push({code:`stale`,text:`内容已改动,Blame 对应的是磁盘上的版本`});let T=S===`loading`?`⌛ Blame`:S===`ready`?`✓ Blame`:S===`off`?`Blame`:`! Blame`;(0,H.useEffect)(()=>{i&&f(!1)},[e.path,i]),(0,H.useEffect)(()=>{let e=p.current;if(!i||!e)return;let t=Math.min(i.line,e.value.split(`
|
|
50
50
|
`).length),n=e.value.split(`
|
|
51
51
|
`),r=n.slice(0,t-1).reduce((e,t)=>e+t.length+1,0);e.focus(),e.setSelectionRange(r,r+n[t-1].length);let a=parseFloat(getComputedStyle(e).lineHeight);e.scrollTop=Math.max(0,(t-1)*a-e.clientHeight/2),e.scrollLeft=0;let o=e.previousElementSibling;o instanceof HTMLElement&&(o.scrollTop=e.scrollTop,o.scrollLeft=0)},[e.path,i,d]);let E=/\.md$/i.test(e.path);return(0,U.jsxs)(`div`,{className:`file-editor`,"data-file-editor":e.path,"data-save-state":t,children:[(0,U.jsxs)(`div`,{className:`file-editor-head`,children:[(0,U.jsx)(`span`,{className:`file-editor-path`,title:e.path,children:e.path}),(0,U.jsxs)(`span`,{className:`file-editor-flags`,children:[E&&(0,U.jsx)(`button`,{type:`button`,className:`file-preview-toggle`,onClick:()=>f(e=>!e),children:d?`原文`:`预览`}),(0,U.jsx)(`button`,{type:`button`,className:`file-blame-toggle`,"data-file-blame-toggle":e.path,"data-file-blame-state":S,"aria-pressed":y,"aria-label":y?`关闭 Git Blame`:`显示 Git Blame`,onClick:()=>h(t=>({...t,[e.path]:t[e.path]!==!0})),children:T}),e.dirty&&(0,U.jsx)(`span`,{className:`file-dirty`,"data-file-dirty":`1`,children:`未保存`}),(0,U.jsx)(`button`,{type:`button`,className:`file-save`,"data-file-save":e.path,onClick:o,disabled:t===`saving`,children:t===`saving`?`保存中…`:`保存`})]})]}),w.length>0&&(0,U.jsx)(`p`,{className:`file-blame-note`,"data-file-blame-reason":w.map(e=>e.code).join(` `),role:`status`,children:w.map(e=>e.text).join(`;`)}),r&&t!==`conflict`&&(0,U.jsxs)(`div`,{className:`file-conflict`,"data-file-external":e.path,role:`alert`,children:[(0,U.jsx)(`p`,{children:`这个文件在磁盘上已经被改过了,你的修改还没有覆盖它。`}),(0,U.jsxs)(`div`,{className:`file-conflict-actions`,children:[(0,U.jsx)(`button`,{type:`button`,"data-file-reload":e.path,onClick:s,children:`丢掉我的修改,读磁盘版本`}),(0,U.jsx)(`button`,{type:`button`,"data-file-overwrite":e.path,onClick:c,children:`仍然覆盖磁盘`})]})]}),t===`conflict`&&(0,U.jsxs)(`div`,{className:`file-conflict`,"data-file-conflict":e.path,role:`alert`,children:[(0,U.jsx)(`p`,{children:`保存被拒绝:这个文件在磁盘上已经被改过了,覆盖会丢掉对方的改动。`}),(0,U.jsxs)(`div`,{className:`file-conflict-actions`,children:[(0,U.jsx)(`button`,{type:`button`,"data-file-reload":e.path,onClick:s,children:`丢掉我的修改,读磁盘版本`}),(0,U.jsx)(`button`,{type:`button`,"data-file-overwrite":e.path,onClick:c,children:`仍然覆盖磁盘`})]})]}),n&&t!==`conflict`&&!r&&(0,U.jsx)(`p`,{className:`file-editor-message file-message-${t}`,"data-file-message":t,role:`status`,children:n}),E&&d?(0,U.jsx)(`div`,{className:`file-markdown-preview`,"data-file-preview":`markdown`,children:(0,U.jsx)(Am,{source:e.content})}):(0,U.jsx)(Wm,{fallback:(t,n)=>(0,U.jsxs)(`div`,{className:`file-editor-fallback`,"data-file-editor-fallback":`1`,children:[(0,U.jsxs)(`div`,{className:`file-editor-fallback-bar`,children:[(0,U.jsxs)(`span`,{children:[`⚠️ 高级编辑器加载异常(`,t.message||`未知错误`,`),已自动降级为安全模式`]}),(0,U.jsx)(`button`,{type:`button`,onClick:n,children:`重新加载`})]}),(0,U.jsx)(`textarea`,{className:`file-textarea`,value:e.content,onChange:e=>a(e.target.value),onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&e.key===`s`&&(e.preventDefault(),o())}})]}),children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(`div`,{className:`file-cm-wrap`,"data-file-text":e.path,"data-file-content":e.content,"data-file-selection":`0,0`,"data-file-editor-ready":`0`,children:(0,U.jsx)(`span`,{className:`file-cm-status`,"data-file-editor-loading":`1`,children:`⌛ 正在加载编辑器…`})}),children:(0,U.jsx)(m_,{path:e.path,value:e.content,onChange:a,jumpToLine:i,onSave:o,workspaceId:l,blame:y&&x&&!C?{state:x.state,response:x.response,path:x.path,workspaceId:l??``}:void 0})})})]})}function j_({line:e}){if(e.kind===`fold`)return(0,U.jsx)(`div`,{className:`file-diff-line file-diff-fold`,"data-diff-kind":`fold`,children:e.text});let t=e.kind===`added`?`+`:e.kind===`removed`?`-`:` `;return(0,U.jsxs)(`div`,{className:`file-diff-line file-diff-${e.kind}`,"data-diff-kind":e.kind,"data-diff-no-newline":e.noNewline?`1`:void 0,children:[(0,U.jsx)(`span`,{className:`file-diff-mark`,"aria-hidden":`true`,children:t}),(0,U.jsx)(`span`,{className:`file-diff-number`,"aria-hidden":`true`,children:e.oldLine??``}),(0,U.jsx)(`span`,{className:`file-diff-number`,"aria-hidden":`true`,children:e.newLine??``}),(0,U.jsx)(`span`,{className:`file-diff-text`,children:e.text}),e.noNewline&&(0,U.jsx)(`span`,{className:`file-diff-no-newline`,title:`这个版本的末尾没有换行`,children:`(末尾无换行)`})]})}function M_({diff:e,loading:t,error:n,bufferContent:r,mode:i,onMode:a}){if(t)return(0,U.jsx)(`div`,{className:`file-diff`,"data-file-diff-state":`loading`,children:(0,U.jsx)(`p`,{className:`rail-empty`,"data-file-diff-loading":`1`,children:`正在读取差异…`})});if(n)return(0,U.jsx)(`div`,{className:`file-diff`,"data-file-diff-state":`error`,children:(0,U.jsx)(`p`,{className:`rail-empty`,"data-file-diff-error":`1`,title:np(n),children:tp(n,`这个文件的差异读取失败。`)})});if(!e)return(0,U.jsx)(`div`,{className:`file-diff`,"data-file-diff-state":`empty`,children:(0,U.jsx)(`p`,{className:`rail-empty`,"data-file-diff-empty":`1`,children:`没有选中的差异。`})});let o=typeof r==`string`,s=i===`buffer`&&o,c=s?e.after:e.before,l=s?r:e.after,u=s?`我未保存的修改`:e.label,d=s?`buffer`:e.baseline,f=o&&e.baseline!==`none`?(0,U.jsxs)(`span`,{className:`file-diff-switch`,"data-file-diff-switch":`1`,children:[(0,U.jsx)(`button`,{type:`button`,className:`file-diff-switch-btn${s?``:` file-diff-switch-active`}`,"data-file-diff-base":`server`,"aria-pressed":!s,onClick:()=>a(`server`),children:`agent 的改动`}),(0,U.jsx)(`button`,{type:`button`,className:`file-diff-switch-btn${s?` file-diff-switch-active`:``}`,"data-file-diff-base":`buffer`,"aria-pressed":s,onClick:()=>a(`buffer`),children:`我的修改`})]}):null;if(d===`none`)return(0,U.jsxs)(`div`,{className:`file-diff`,"data-file-diff-state":`none`,"data-file-diff-baseline":d,children:[(0,U.jsxs)(`div`,{className:`file-editor-head`,children:[(0,U.jsx)(`span`,{className:`file-editor-path`,title:e.path,children:e.path}),(0,U.jsx)(`span`,{className:`file-editor-flags`,children:f})]}),(0,U.jsx)(`p`,{className:`file-diff-nobaseline`,"data-file-diff-nobaseline":`1`,children:u})]});let p=ah(c,l),m=oh(p);return(0,U.jsxs)(`div`,{className:`file-diff`,"data-file-diff-state":`ready`,"data-file-diff-baseline":d,"data-file-diff-added":p.added,"data-file-diff-removed":p.removed,children:[(0,U.jsxs)(`div`,{className:`file-editor-head`,children:[(0,U.jsx)(`span`,{className:`file-editor-path`,title:e.path,children:e.path}),(0,U.jsxs)(`span`,{className:`file-editor-flags`,children:[f,(0,U.jsx)(`span`,{className:`file-diff-baseline`,"data-file-diff-label":`1`,children:u}),(0,U.jsxs)(`span`,{className:`file-diff-count`,"data-file-diff-count":`1`,children:[`+`,p.added,` / -`,p.removed]})]})]}),e.beforeUnknown&&!s&&(0,U.jsx)(`p`,{className:`file-diff-warning`,"data-file-diff-before-unknown":`1`,role:`status`,children:`读不到改动前的版本(文件太大或无法读取),这里只显示现在的内容。`}),e.before===null&&!e.beforeUnknown&&!s&&(0,U.jsx)(`p`,{className:`file-diff-warning`,"data-file-diff-is-new":`1`,role:`status`,children:`这个文件是新建的,下面是它的全部内容。`}),p.identical?(0,U.jsx)(`p`,{className:`file-diff-nobaseline`,"data-file-diff-identical":`1`,children:`两个版本没有区别。`}):(0,U.jsx)(`div`,{className:`file-diff-body`,"data-file-diff-body":`1`,children:m.lines.map((e,t)=>(0,U.jsx)(j_,{line:e},t))})]})}function N_({error:e}){let t=e.body.code,n=typeof e.body.details?.path==`string`?e.body.details.path:``,r=t===`workspace_missing`?`missing`:t===`timeout`?`timeout`:`failed`;return(0,U.jsxs)(`div`,{className:`rail-empty file-problem`,"data-file-root-error":`1`,"data-file-error-kind":r,role:`alert`,children:[r===`missing`&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`file-problem-title`,"data-file-error-title":`1`,children:`工作区路径不存在,无法读取文件。`}),(0,U.jsx)(`p`,{className:`file-problem-hint`,children:`请确认这个路径是写错了,还是目录被移动或删除了:`}),(0,U.jsx)(`code`,{className:`file-problem-path`,"data-file-error-path":`1`,children:n||tp(e.message,`路径未知`)})]}),r===`timeout`&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`file-problem-title`,"data-file-error-title":`1`,children:`读取超时,服务端没有回应。`}),(0,U.jsxs)(`p`,{className:`file-problem-hint`,children:[`已经等了 `,g_/1e3,` 秒。如果这个工作区在网络盘上,请检查它是否已连接,然后点上面的 ↻ 重试。`]})]}),r===`failed`&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`file-problem-title`,"data-file-error-title":`1`,children:`读取失败。`}),(0,U.jsx)(`p`,{className:`file-problem-hint`,title:np(e.message),children:tp(e.message,`读取失败,请稍后重试。`)})]})]})}function P_(e,t=``){let n=t.trim().replaceAll(`\\`,`/`).replace(/^\/+|\/+$/g,``),r=e?n?`${e}:${n}`:e:void 0,i=(0,H.useRef)(r);i.current=r;let[a,o]=(0,H.useState)([]),[s,c]=(0,H.useState)(),[l,u]=(0,H.useState)(``),[d,f]=(0,H.useState)({}),[p,m]=(0,H.useState)({}),[h,g]=(0,H.useState)({}),[_,v]=(0,H.useState)(()=>new Set),[y,b]=(0,H.useState)(``),[x,S]=(0,H.useState)(null),[C,w]=(0,H.useState)(null),[T,E]=(0,H.useState)(!1),[D,O]=(0,H.useState)([]),[k,A]=(0,H.useState)(!1),[j,M]=(0,H.useState)([]),N=(0,H.useRef)(void 0),P=(0,H.useRef)(-1),F=(0,H.useRef)(!1),I=(0,H.useCallback)(e=>{N.current?N.current.buffered.push(e):!F.current||e.version<=P.current||(P.current=e.version,O(t=>{let n=new Map(t.map(e=>[e.path,e]));for(let t of e.changed)n.set(t.path,t);for(let t of e.removed)n.delete(t);return[...n.values()]}),A(e.complete),M(e.skipped))},[]),ee=(0,H.useCallback)(()=>{let e=N.current;N.current=void 0,e?.controller.abort()},[]);(0,H.useEffect)(()=>(ee(),F.current=!1,P.current=-1,O([]),A(!1),M([]),ee),[r,ee]);let te=(0,H.useCallback)((t=!1)=>{if(!e||!r||N.current?.scopeKey===r||!t&&F.current)return;let i={workspaceId:e,scopeKey:r,controller:new AbortController,buffered:[]};N.current=i,fetch(`/api/files/index?workspaceId=${encodeURIComponent(e)}${x_(n)}`,{signal:i.controller.signal}).then(e=>{if(!e.ok)throw Error(`文件索引请求失败(${e.status})`);return e.json()}).then(e=>{if(N.current!==i)return;let t=new Map((e.changed??[]).map(e=>[e.path,e]));for(let n of e.removed??[])t.delete(n);let n=e.version??-1,r=e.complete===!0,a=e.skipped??[];for(let e of i.buffered.sort((e,t)=>e.version-t.version))if(!(e.version<=n)){for(let n of e.changed)t.set(n.path,n);for(let n of e.removed)t.delete(n);n=e.version,r=e.complete,a=e.skipped}N.current=void 0,F.current=!0,P.current=n,O([...t.values()]),A(r),M(a)}).catch(()=>{N.current===i&&(N.current=void 0)})},[e,n,r]),[ne,L]=(0,H.useState)({});(0,H.useEffect)(()=>{if(o([]),c(void 0),u(``),f({}),m({}),g({}),v(new Set),S(null),w(null),b(``),E(!1),!e)return;let t=!0;return v_(S_(e,``,n)).then(e=>{t&&g({"":e})}).catch(e=>{t&&g({"":{error:y_(e)}})}),()=>{t=!1}},[e,n,r]);let re=(0,H.useRef)(void 0),[ie,ae]=(0,H.useState)(void 0);(0,H.useEffect)(()=>{if(!e||!r||re.current===r)return;re.current=r;let t=I_()[r];t&&(t.expanded.length&&v(new Set(t.expanded)),typeof t.listHeight==`number`&&S(t.listHeight),t.open.length&&(async()=>{for(let e of t.open)if(await le({path:e,name:e.split(`/`).pop()??e,text:!0}),i.current!==r)return;t.active&&i.current===r&&(c(t.active),ae(t.active))})())},[e,n,r]),(0,H.useEffect)(()=>{if(!e||!r)return;let t=setTimeout(()=>{let e=I_();e[r]={open:a.map(e=>e.path),expanded:[..._],...s?{active:s}:{},...x===null?{}:{listHeight:x}},L_(e)},400);return()=>{clearTimeout(t)}},[e,r,a,_,s,x]);let oe=(0,H.useCallback)(t=>{e&&v_(S_(e,t,n)).then(e=>{i.current===r&&g(n=>({...n,[t]:e}))}).catch(e=>{i.current===r&&g(n=>({...n,[t]:{error:y_(e)}}))})},[e,n,r]),se=(0,H.useCallback)(e=>{v(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),ce=(0,H.useCallback)(()=>{e&&(g({}),v(new Set),v_(S_(e,``,n)).then(e=>{i.current===r&&g({"":e})}).catch(e=>{i.current===r&&g({"":{error:y_(e)}})}))},[e,n,r]);(0,H.useEffect)(()=>{let t=y.trim();if(!e||!t){w(null),E(!1);return}let r=!0;E(!0);let i=setTimeout(()=>{v_(T_(e,t,n)).then(e=>{r&&(w(e),E(!1))}).catch(e=>{r&&(w({mode:`search`,query:t,hits:[],total:0,indexed:!1}),E(!1),u(`搜索失败:${e instanceof Error?e.message:`未知错误`}`))})},80);return()=>{r=!1,clearTimeout(i)}},[y,e,n]);let le=(0,H.useCallback)(async t=>{if(e){if(t.text===!1)u(`「${t.name}」不支持以文本打开(二进制文件)。`);else if(a.some(e=>e.path===t.path))c(t.path);else{u(``);try{let a=await v_(C_(e,t.path,n));if(i.current!==r)return;o(e=>e.some(e=>e.path===t.path)?e:[...e,{path:a.path,name:t.name,content:a.content,etag:a.meta.etag,dirty:!1}]),c(a.path),m(e=>({...e,[a.path]:!1}))}catch(e){i.current===r&&u(`打不开「${t.name}」:${e instanceof Error?e.message:`未知错误`}`)}}}},[e,n,r,a]),ue=(0,H.useCallback)(e=>{o(t=>{let n=t.find(t=>t.path===e);if(n?.dirty&&!window.confirm(`「${n.name}」有未保存的修改,关掉就丢了。仍然关闭?`))return t;let r=t.findIndex(t=>t.path===e),i=t.filter(t=>t.path!==e);return e===s&&c(i.length===0?void 0:i[Math.min(r,i.length-1)]?.path),i})},[s]),de=(0,H.useCallback)((e,t)=>{o(n=>n.map(n=>n.path===e?{...n,content:t,dirty:!0}:n))},[]),fe=(0,H.useRef)(a);fe.current=a,(0,H.useEffect)(()=>{if(!e||a.length===0)return;let t=!0,r=setInterval(()=>{for(let r of fe.current.map(e=>e.path))v_(w_(e,r,n)).then(e=>{if(!t)return;let n=fe.current.find(e=>e.path===r);n&&e.etag!==n.etag&&m(e=>({...e,[r]:!0}))}).catch(()=>{})},p_);return()=>{t=!1,clearInterval(r)}},[e,n,a.length]);let R=(0,H.useCallback)(async(t,s)=>{if(!e)return;let c=a.find(e=>e.path===t);if(!c)return;f(e=>({...e,[t]:{state:`saving`,message:``}}));let l=c.etag;if(s)try{l=(await v_(w_(e,t,n))).etag}catch(e){i.current===r&&f(n=>({...n,[t]:{state:`error`,message:`无法读取磁盘上的最新版本:${e instanceof Error?e.message:`未知错误`}`}}));return}let u=c.content;try{let a=await v_(C_(e,t,n),{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({path:t,content:u,baseEtag:l})});if(i.current!==r)return;let s=fe.current.find(e=>e.path===t),c=s!==void 0&&s.content!==u;o(e=>e.map(e=>e.path===t?{...e,etag:a.meta.etag,dirty:e.content!==u}:e)),m(e=>({...e,[t]:!1})),f(e=>({...e,[t]:{state:`saved`,message:c?`已保存,但你又改了;最新修改仍未保存`:`已保存 ${D_(a.meta.modifiedAt)}`}}))}catch(e){if(i.current!==r)return;let n=e instanceof h_&&e.body.code===`stale`;f(r=>({...r,[t]:{state:n?`conflict`:`error`,message:e instanceof Error?e.message:`保存失败`}})),n&&m(e=>({...e,[t]:!0}))}},[e,n,r,a]),pe=(0,H.useCallback)(async t=>{if(!e)return;let a=fe.current.find(e=>e.path===t)?.content;try{let s=await v_(C_(e,t,n));if(i.current!==r)return;let c=fe.current.find(e=>e.path===t),l=c!==void 0&&c.content!==a;o(e=>e.map(e=>e.path===t?{...e,content:l?e.content:s.content,etag:s.meta.etag,dirty:l}:e)),m(e=>({...e,[t]:!1})),f(e=>({...e,[t]:{state:`saved`,message:l?`已读取磁盘版本;你后来输入的修改仍未保存`:`已重新载入磁盘版本`}}))}catch(e){i.current===r&&f(n=>({...n,[t]:{state:`error`,message:e instanceof Error?e.message:`重新载入失败`}}))}},[e,n,r]),me=a.find(e=>e.path===s),he=(0,H.useMemo)(()=>a.map(e=>({id:e.path,label:e.name,title:e.path,closable:!0,badge:e.dirty?(0,U.jsx)(`span`,{className:`file-tab-badge`,"data-file-tab-dirty":e.path,"aria-label":`未保存`,children:`●`}):void 0})),[a]),ge=(0,H.useMemo)(()=>new Set(a.map(e=>e.path)),[a]),_e=(0,H.useCallback)((e,t,n)=>{L(r=>({...r,[e]:{changes:t,dropped:n}}))},[]),ve=e?ne[e]:void 0,ye=(0,H.useMemo)(()=>{let e=ve?.changes??[];if(!n)return e;let t=`${n}/`;return e.flatMap(e=>e.path.startsWith(t)?[{...e,path:e.path.slice(t.length)}]:[])},[ve,n]),be=ve?.dropped??0;return{open:a,activePath:s,active:me,tabItems:he,openPaths:ge,notice:l,setNotice:u,saves:d,external:p,openFile:le,setActivePath:c,closeFile:ue,updateBuffer:de,save:R,reload:pe,listings:h,expanded:_,toggleDirectory:se,loadDirectory:oe,refreshTree:ce,listHeight:x,setListHeight:S,query:y,setQuery:b,hits:C,searching:T,changed:ye,changedPaths:(0,H.useMemo)(()=>new Set(ye.map(e=>e.path)),[ye]),changedDirs:(0,H.useMemo)(()=>{let e=new Set;for(let t of ye){let n=t.path.split(`/`);for(let t=1;t<n.length;t++)e.add(n.slice(0,t).join(`/`))}return e},[ye]),changedDropped:be,setChangedFor:_e,index:D,indexComplete:k,indexSkipped:j,requestIndex:te,cancelIndexRequest:ee,setIndex:I,restoredActive:ie}}var F_=`super-pi.file-workbench.v1`;function I_(){try{if(typeof window>`u`)return{};let e=JSON.parse(window.localStorage.getItem(`super-pi.file-workbench.v1`)??`null`);if(!e||typeof e!=`object`)return{};let t={};for(let[n,r]of Object.entries(e)){if(!r||typeof r!=`object`)continue;let e=r,i=Array.isArray(e.open)?e.open.filter(e=>typeof e==`string`):[],a=Array.isArray(e.expanded)?e.expanded.filter(e=>typeof e==`string`):[],o=typeof e.listHeight==`number`&&Number.isFinite(e.listHeight)&&e.listHeight>0?Math.round(e.listHeight):void 0;t[n]={open:i,expanded:a,...typeof e.active==`string`?{active:e.active}:{},...o?{listHeight:o}:{}}}return t}catch{return{}}}function L_(e){try{typeof window<`u`&&window.localStorage.setItem(F_,JSON.stringify(e))}catch{}}function R_({height:e,onHeight:t,panelRef:n,min:r=120}){let[i,a]=(0,H.useState)(!1),o=()=>{let e=n.current?.querySelector(`.files-tree`)??null;return{list:e,height:e?.getBoundingClientRect().height??0}},s=e=>{e.preventDefault(),e.currentTarget.focus();let n=e.clientY,{height:i}=o();a(!0);let s=document.body,c=s.style.cursor,l=s.style.userSelect;s.style.cursor=`row-resize`,s.style.userSelect=`none`;let u=e=>{let a=Math.round(i+(e.clientY-n));t(Math.max(r,a))},d=()=>{s.style.cursor=c,s.style.userSelect=l,a(!1),window.removeEventListener(`mousemove`,u),window.removeEventListener(`mouseup`,d)};window.addEventListener(`mousemove`,u),window.addEventListener(`mouseup`,d)},c=e=>e.shiftKey?96:24;return(0,U.jsx)(`div`,{className:`files-splitter${i?` files-splitter-dragging`:``}`,"data-file-splitter":`1`,"data-file-splitter-dragging":i?`true`:`false`,role:`separator`,"aria-orientation":`horizontal`,"aria-label":`调整文件列表高度`,"aria-valuenow":e??void 0,"aria-valuemin":r,tabIndex:0,onMouseDown:s,onKeyDown:e=>{let i=c(e);if(e.key===`ArrowDown`){e.preventDefault();let{height:n}=o();t(Math.max(r,Math.round(n)+i))}else if(e.key===`ArrowUp`){e.preventDefault();let{height:n}=o(),a=Math.round(n)-i;t(a<=r?null:a)}else if(e.key===`Home`)e.preventDefault(),t(null);else if(e.key===`End`){e.preventDefault();let i=n.current?.querySelector(`.files-tree`)?.parentElement?.clientHeight??0;t(Math.max(r,i))}}})}function z_({workspaceId:e,files:t,onOpenFile:n,onOpenChanged:r}){let{open:i,openPaths:a,notice:o,setNotice:s,openFile:c,listings:l,expanded:u,toggleDirectory:d,loadDirectory:f,refreshTree:p,listHeight:m,setListHeight:h,query:g,setQuery:_,hits:v,searching:y,changed:b,changedPaths:x,changedDirs:S,changedDropped:C}=t,w=(0,H.useCallback)(e=>{n?n(e):c(e)},[n,c]),T=l[``],E=g.trim(),D=(0,H.useRef)(null),O=(0,H.useCallback)(e=>{let t=D.current;if(!t)return;let n=e.target?.closest(`.file-row`);if(!n)return;let r=[...t.querySelectorAll(`.file-row`)],i=r.indexOf(n);if(i<0)return;let a=e=>{let t=Math.max(0,Math.min(r.length-1,e));r[t]?.focus()};if(e.key===`ArrowDown`)e.preventDefault(),a(i+1);else if(e.key===`ArrowUp`)e.preventDefault(),a(i-1);else if(e.key===`Home`)e.preventDefault(),a(0);else if(e.key===`End`)e.preventDefault(),a(r.length-1);else if(e.key===`ArrowRight`){let t=n.getAttribute(`data-file-dir-toggle`);t&&n.getAttribute(`aria-expanded`)===`false`&&(e.preventDefault(),d(t))}else if(e.key===`ArrowLeft`){let r=n.getAttribute(`data-file-dir-toggle`);if(r&&n.getAttribute(`aria-expanded`)===`true`){e.preventDefault(),d(r);return}let i=n.getAttribute(`data-file-open`)??n.getAttribute(`data-file-hit`);if(i){e.preventDefault();let n=i.lastIndexOf(`/`),r=n<0?``:i.slice(0,n);(r?t.querySelector(`[data-file-dir-toggle="${CSS.escape(r)}"]`):null)?.focus()}}},[d]),[k,A]=(0,H.useState)(200);(0,H.useEffect)(()=>{A(200)},[E,e]);let j=(0,H.useRef)(null);(0,H.useEffect)(()=>{if(E===``)return;let e=j.current;if(!e||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&A(e=>e>=(v?.hits.length??0)?e:e+200)},{rootMargin:`200px`});return t.observe(e),()=>t.disconnect()},[E,v]);let M=(0,H.useMemo)(()=>{if(E){if(y||!v)return(0,U.jsx)(`p`,{className:`rail-empty`,"data-file-searching":`1`,children:`搜索中…`});if(v.hits.length===0)return(0,U.jsxs)(`p`,{className:`rail-empty`,"data-file-search-empty":`1`,children:[`没有匹配「`,E,`」的文件。`]});let e=v.hits.slice(0,k),t=[],n=new Map;for(let r of e){let e=n.get(r.directory);if(e)e.push(r);else{let e=[r];n.set(r.directory,e),t.push({directory:r.directory,hits:e})}}return(0,U.jsxs)(U.Fragment,{children:[t.map(e=>(0,U.jsxs)(`section`,{className:`file-group`,"data-file-search-group":e.directory,children:[(0,U.jsxs)(`h3`,{className:`file-group-head`,"data-file-search-group-head":e.directory,children:[(0,U.jsx)(`span`,{className:`file-group-name`,children:e.directory||`/`}),(0,U.jsx)(`span`,{className:`file-group-count`,children:e.hits.length})]}),(0,U.jsx)(`ul`,{className:`file-list`,children:e.hits.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,className:`file-row file-row-file`,"data-file-hit":e.path,"data-file-hit-open":a.has(e.path)?`1`:`0`,onClick:()=>w({path:e.path,name:e.name,text:!0}),children:[(0,U.jsx)(`span`,{className:`file-caret`,"aria-hidden":`true`}),(0,U.jsx)(cp,{path:e.path}),(0,U.jsx)(`span`,{className:`file-name`,children:e.name}),a.has(e.path)&&(0,U.jsx)(`span`,{className:`file-open-mark`,"data-file-open-mark":e.path,title:`已经打开`,"aria-label":`已经打开`,children:`●`})]})},e.path))})]},e.directory||`/`)),e.length<v.hits.length&&(0,U.jsx)(`div`,{ref:j,className:`file-sentinel`,"data-file-search-more":`1`,children:`正在载入更多…`})]})}return e?T===void 0?(0,U.jsx)(`p`,{className:`rail-empty`,"data-file-root-loading":`1`,children:`读取工作区…`}):`error`in T?(0,U.jsx)(N_,{error:T.error}):(0,U.jsxs)(U.Fragment,{children:[T.truncated&&(0,U.jsx)(`p`,{className:`file-search-note`,"data-file-truncated-root":`1`,children:`条目过多,只显示前一部分。`}),T.entries.length===0?(0,U.jsx)(`p`,{className:`rail-empty`,"data-file-root-empty":`1`,children:`这个工作区是空的,没有文件也没有子目录。`}):(0,U.jsx)(`ul`,{className:`file-list`,children:T.entries.map(t=>t.kind===`directory`?(0,U.jsx)(O_,{workspaceId:e,entryPath:t.path,name:t.name,listings:l,expanded:u,toggle:d,loadDirectory:f,openPaths:a,changedDirs:S,changedPaths:x,onOpen:e=>w(e),depth:0},t.path):(0,U.jsx)(k_,{entry:t,depth:0,openPaths:a,changedPaths:x,onOpen:e=>w(e)},t.path))})]}):(0,U.jsx)(`p`,{className:`rail-empty`,"data-file-no-workspace":`1`,children:`先在左侧选一个工作区,这里会显示它的文件。`})},[E,y,v,k,e,T,l,u,d,f,w,a,S,x]);return(0,U.jsxs)(`div`,{className:`files-panel`,"data-files-panel":`1`,"data-files-open-count":i.length,"data-files-changed-count":b.length,ref:D,onKeyDown:O,children:[(0,U.jsxs)(`div`,{className:`files-search`,children:[(0,U.jsx)(`span`,{className:`files-search-icon`,"aria-hidden":`true`,children:(0,U.jsxs)(`svg`,{viewBox:`0 0 16 16`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,strokeWidth:1.6,strokeLinecap:`round`,children:[(0,U.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.6`}),(0,U.jsx)(`path`,{d:`M10.4 10.4 14 14`})]})}),(0,U.jsx)(`input`,{type:`search`,className:`files-search-input`,"data-file-search-input":`1`,value:g,placeholder:`按文件名搜索…`,"aria-label":`按文件名搜索`,onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),_(``))},onChange:e=>_(e.target.value)}),(0,U.jsx)(`button`,{type:`button`,className:`files-refresh`,"data-file-refresh":`1`,title:`重新读取目录`,"aria-label":`重新读取目录`,disabled:!e,onClick:()=>p(),children:`↻`})]}),E&&v&&!y&&(0,U.jsxs)(`p`,{className:`files-count`,"data-file-search-count":`1`,role:`status`,children:[(0,U.jsx)(`b`,{children:v.total.toLocaleString(`zh-CN`)}),` 个结果`,v.indexed===!1&&(0,U.jsx)(`span`,{className:`files-count-note`,"data-file-search-indexing":`1`,children:`正在建立索引…`})]}),b.length>0&&(0,U.jsxs)(`div`,{className:`files-changed`,"data-file-changed-list":`1`,children:[(0,U.jsxs)(`p`,{className:`files-changed-head`,"data-file-changed-head":`1`,children:[`agent 改了 `,b.length,` 个文件`]}),C>0&&(0,U.jsxs)(`p`,{className:`file-search-note`,"data-file-changed-dropped":`1`,children:[`还有 `,C,` 个改动没有记录(超过保留上限)。`]}),(0,U.jsx)(`ul`,{className:`file-list`,children:b.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,className:`file-row file-row-file`,"data-file-changed-open":e.path,title:`${e.path}(点击查看改动)`,onClick:()=>r?.(e.path),children:[(0,U.jsx)(`span`,{className:`file-caret`,"aria-hidden":`true`}),(0,U.jsx)(cp,{path:e.path}),(0,U.jsx)(`span`,{className:`file-name`,children:e.path.split(`/`).pop()}),(0,U.jsx)(`span`,{className:`file-badge-path`,children:e.path.split(`/`).slice(0,-1).join(`/`)||`/`}),(0,U.jsx)(`span`,{className:`file-badge file-badge-changed`,"data-file-changed-kind":e.path,children:e.baseline===null&&!e.baselineUnknown?`新建`:`已改`})]})},e.path))})]}),o&&(0,U.jsx)(`p`,{className:`rail-empty`,"data-file-notice":`1`,children:o}),(0,U.jsxs)(`div`,{className:`files-tree`,"data-file-tree":E?`search`:`browse`,style:m===null?void 0:{height:`${m}px`,flex:`0 0 auto`},children:[(0,U.jsx)(`div`,{className:`files-tree-body`,children:M}),i.length===0&&(0,U.jsx)(`p`,{className:`rail-empty file-hint`,"data-file-none-open":`1`,children:`点一个文本文件,它会在上面的标签栏开一个标签,正文显示在中间主画面。`}),i.length>0&&(0,U.jsxs)(`p`,{className:`files-hint file-hint`,"data-file-open-hint":`1`,children:[`已打开 `,i.length,` 个文件,正文显示在中间主画面;点上面的标签切换,点这里的行切换。`]})]}),(0,U.jsx)(R_,{height:m,onHeight:h,panelRef:D}),(0,U.jsxs)(`p`,{className:`files-footnote`,"data-files-footnote":`1`,children:[`只支持纯文本(md / 代码),二进制文件不会打开。写入只允许覆盖已存在的文件,不新建,不删除。`,i.length>0&&` 当前打开 ${i.length} 个文件,占 ${E_(i.reduce((e,t)=>e+t.content.length,0))}。`]})]})}function B_({workspaceId:e,cwd:t=``,onOpen:n,onClose:r}){let[i,a]=(0,H.useState)(``),[o,s]=(0,H.useState)(null),[c,l]=(0,H.useState)(``),[u,d]=(0,H.useState)(!1),[f,p]=(0,H.useState)(0),m=(0,H.useRef)(null),h=(0,H.useRef)(null);(0,H.useEffect)(()=>{m.current?.focus()},[]),(0,H.useEffect)(()=>{h.current?.scrollIntoView({block:`nearest`})},[f]),(0,H.useEffect)(()=>{let n=i.trim();if(s(null),l(``),p(0),!e||!n){d(!1);return}let r=!0;d(!0);let a=setTimeout(()=>{v_(`/api/files/search?workspaceId=${b_(e)}&q=${b_(n)}${x_(t)}`).then(e=>{r&&(s(e),d(!1))}).catch(e=>{r&&(l(tp(e,`搜索没有完成`)),d(!1))})},220);return()=>{r=!1,clearTimeout(a)}},[i,e,t]);let g=e=>{e&&(n(e),r())},_=o?.truncated||o?.complete===!1,v={index:`索引未完整`,size:`文件超过 512KB`,depth:`目录超过 12 层`,time:`搜索超过 10 秒`,results:`达到 500 条上限`,output:`SDK 输出达到上限`,line:`长行已截断`,unreadable:`部分文件无法读取`};return(0,U.jsx)(`div`,{className:`quick-open-backdrop`,"data-content-search":`1`,role:`presentation`,onMouseDown:r,children:(0,U.jsxs)(`div`,{className:`quick-open content-search`,role:`dialog`,"aria-modal":`true`,"aria-label":`内容搜索`,onMouseDown:e=>e.stopPropagation(),children:[(0,U.jsx)(`input`,{ref:m,className:`quick-open-input`,"data-content-search-input":`1`,value:i,maxLength:256,placeholder:`内容搜索(区分大小写,按字面匹配)`,"aria-label":`内容搜索`,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),r()):e.key===`ArrowDown`?(e.preventDefault(),p(e=>Math.min(e+1,Math.max(0,(o?.hits.length??0)-1)))):e.key===`ArrowUp`?(e.preventDefault(),p(e=>Math.max(0,e-1))):e.key===`Enter`&&(e.preventDefault(),g(o?.hits[f]))}}),(0,U.jsxs)(`p`,{className:`quick-open-status`,role:`status`,"data-content-search-status":c?`error`:u?`searching`:_?`partial`:`complete`,children:[c?`✕ 搜索失败:`+c:u?`… 搜索中`:e?_?`⚠ 结果不完整`:o?`✓ 搜索完成`:`○ 输入要搜索的内容`:`○ 请先选择工作区`,o?` · ${o.hits.length} 条命中`:``,` · Esc 关闭`]}),_&&(0,U.jsxs)(`p`,{className:`quick-open-status`,"data-content-search-partial":`1`,children:[`⚠ 结果不完整:`,o?.reasons.map(e=>v[e]??e).join(`;`)]}),o&&o.skipped.length>0&&(0,U.jsxs)(`details`,{className:`quick-open-status`,"data-content-search-skipped":`1`,children:[(0,U.jsxs)(`summary`,{children:[`↷ 已跳过 `,o.skipped.length,` 个文件或目录`]}),(0,U.jsx)(`p`,{className:`content-search-skipped-paths`,children:o.skipped.join(`
|
|
52
52
|
`)})]}),o&&!u&&o.hits.length===0&&(0,U.jsx)(`p`,{className:`quick-open-status`,"data-content-search-empty":`1`,children:`○ 没有匹配的行`}),(0,U.jsx)(`ul`,{className:`quick-open-results content-search-results`,role:`listbox`,children:o?.hits.map((e,t)=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{ref:t===f?h:void 0,type:`button`,"data-content-search-result":`${e.path}:${e.line}`,className:`quick-open-result content-search-result${f===t?` quick-open-result-active`:``}`,"aria-selected":f===t,onMouseEnter:()=>p(t),onClick:()=>g(e),children:[(0,U.jsxs)(`span`,{children:[e.path,`:`,e.line]}),(0,U.jsx)(`small`,{title:e.text,children:e.text})]})},`${e.path}:${e.line}`))})]})})}function V_({entries:e,complete:t,skipped:n,onOpen:r,onClose:i}){let[a,o]=(0,H.useState)(``),[s,c]=(0,H.useState)(0),l=(0,H.useRef)(null),u=(0,H.useMemo)(()=>e.filter(e=>e.kind===`file`&&e.text!==!1),[e]),d=(0,H.useMemo)(()=>a.trim()?new Mg(u,{keys:[`path`],threshold:.38,ignoreLocation:!0}).search(a).slice(0,20).map(e=>e.item):u.slice(0,20),[u,a]);(0,H.useEffect)(()=>{l.current?.focus(),c(0)},[a]);let f=(0,H.useCallback)(e=>{e&&(r({path:e.path,name:e.path.split(`/`).pop()??e.path,text:e.text}),i())},[r,i]);return(0,U.jsx)(`div`,{className:`quick-open-backdrop`,"data-quick-open":`1`,role:`presentation`,onMouseDown:i,children:(0,U.jsxs)(`div`,{className:`quick-open`,role:`dialog`,"aria-modal":`true`,"aria-label":`快速打开`,onMouseDown:e=>e.stopPropagation(),children:[(0,U.jsx)(`input`,{ref:l,className:`quick-open-input`,"data-quick-open-input":`1`,value:a,placeholder:`快速打开:输入文件名或路径`,"aria-label":`快速打开文件路径`,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),i()):e.key===`ArrowDown`?(e.preventDefault(),c(e=>Math.min(e+1,Math.max(0,d.length-1)))):e.key===`ArrowUp`?(e.preventDefault(),c(e=>Math.max(e-1,0))):e.key===`Enter`&&(e.preventDefault(),f(d[s]))}}),(0,U.jsxs)(`p`,{className:`quick-open-status`,"data-quick-open-status":t?`complete`:`partial`,children:[t?`✓ 索引完整`:`⚠ 索引不完整`,` · `,u.length,` 个文件 · Esc 关闭`]}),n.length>0&&(0,U.jsxs)(`p`,{className:`quick-open-status`,"data-quick-open-skipped":`1`,title:n.join(`, `),children:[`↷ 已跳过:`,n.join(`, `)]}),(0,U.jsx)(`ul`,{className:`quick-open-results`,role:`listbox`,children:d.map((e,t)=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,"data-quick-open-result":e.path,className:t===s?`quick-open-result quick-open-result-active`:`quick-open-result`,"aria-selected":t===s,onMouseEnter:()=>c(t),onClick:()=>f(e),children:[(0,U.jsx)(`span`,{children:e.path.split(`/`).pop()}),(0,U.jsx)(`small`,{children:e.path})]})},e.path))})]})})}function H_(e,t,n=88,r=200){let i=Math.max(0,Math.floor(e));if(!Number.isFinite(t)||t<=0)return{perRow:Math.max(1,i),width:n};if(i===0)return{perRow:1,width:n};if(i===1)return{perRow:1,width:Math.min(r,t)};let a=t/i;if(a>=n)return{perRow:i,width:Math.min(a,r)};for(let e=2;e<=i;e+=1){let a=Math.ceil(i/e),o=t/a;if(o>=n)return{perRow:a,width:Math.min(o,r)}}return{perRow:1,width:n}}function U_(e,t){let n=Math.max(1,Math.floor(t)),r=[];for(let t=0;t<e.length;t+=n)r.push(e.slice(t,t+n));return r}function W_(e,t,n=88,r=200){let[i,a]=(0,H.useState)(()=>H_(e,0,n,r)),[o,s]=(0,H.useState)(null),c=(0,H.useCallback)(()=>{let i=H_(e,t,n,r);s({count:e,containerWidth:t}),a(e=>e.perRow===i.perRow&&e.width===i.width?e:i)},[e,t,n,r]),l=(0,H.useRef)(t);(0,H.useEffect)(()=>{t<=0||l.current!==t&&(l.current=t,c())},[t,c]);let u=(0,H.useRef)(null);return(0,H.useEffect)(()=>{let t=u.current;u.current=e,t!==null&&e>t&&c()},[e,c]),{layout:i,frozen:o!==null&&o.count!==e,recompute:c}}function G_({tabs:e,activeId:t,onSelect:n,onClose:r,onActivate:i,ariaLabel:a,minWidth:o=88,maxWidth:s=200,prefix:c=`workspace-tab`,idPrefix:l=c,className:u}){let d=(0,H.useRef)(null),[f,p]=(0,H.useState)(0),{layout:m,frozen:h,recompute:g}=W_(e.length,f,o,s);(0,H.useLayoutEffect)(()=>{let e=d.current;if(!e||typeof ResizeObserver>`u`)return;let t=()=>{let t=e.clientWidth;t>0&&p(t)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let _=U_(e,m.perRow),v=(e,t)=>t===void 0?{}:{[`data-${c}-${e}`]:t},y=e.filter(e=>e.kind===`file`).length,b=e.filter(e=>e.kind===`session`||!e.kind).length,x=t=>({[`data-${t}-strip`]:`1`,...h?{[`data-${t}-frozen`]:`1`}:{},[`data-${t}-count`]:t===`file-tab`?y:t===`session-tab`?b:e.length,[`data-${t}-min`]:o,[`data-${t}-max`]:s,[`data-${t}-per-row`]:m.perRow,[`data-${t}-width`]:Math.round(m.width*100)/100}),S=e=>{let t=e.relatedTarget;(!t||t.isConnected)&&g()},C=e=>{let t=e.relatedTarget;(!t||t.isConnected)&&g()};(0,H.useEffect)(()=>{if(!h)return;let e=d.current;if(!e)return;let t=t=>{let n=e.getBoundingClientRect();t.clientX>=n.left&&t.clientX<=n.right&&t.clientY>=n.top&&t.clientY<=n.bottom||g()};return document.addEventListener(`mousemove`,t,!0),()=>document.removeEventListener(`mousemove`,t,!0)},[h,g]);let w=[`${c}-strip`,`workspace-tab-strip`,`session-tab-strip`,`file-tab-strip`,u].filter(Boolean).join(` `);return(0,U.jsx)(`div`,{ref:d,className:w,role:`tablist`,"aria-label":a??`工作区标签页`,...v(`strip`,`1`),...x(`workspace-tab`),...x(`session-tab`),...x(`file-tab`),style:{"--tab-w":`${m.width}px`},onMouseEnter:S,onMouseLeave:C,children:_.map((a,o)=>(0,U.jsx)(`div`,{className:`${c}-row workspace-tab-row session-tab-row file-tab-row`,role:`presentation`,...v(`row`,o),children:a.map(a=>{let o=a.id===t||a.rawId!==void 0&&a.rawId===t,s=a.title??a.label,u=a.kind,d=a.rawId??a.id,f=e.findIndex(e=>e.id===a.id),p=[c,o?`${c}-active`:``,`workspace-tab`,o?`workspace-tab-active`:``,u?`${u}-tab`:``,u&&o?`${u}-tab-active`:``,a.preview?`${c}-preview`:``,a.preview?`workspace-tab-preview`:``,a.preview&&u?`${u}-tab-preview`:``].filter(Boolean).join(` `);return(0,U.jsxs)(`div`,{role:`tab`,id:`${l}-${a.id}`,"aria-selected":o,"aria-controls":`${l}-panel-${a.id}`,tabIndex:o?0:-1,className:p,...v(`id`,d),...v(`index`,f),...o?v(`active`,`1`):{},...v(`closable`,a.closable===!1?`0`:`1`),...u?{"data-tab-kind":u}:{},...a.preview?{"data-tab-preview":`1`}:{},...u===`session`||!u?{"data-session-tab-id":d,"data-session-tab-index":f,...o?{"data-session-tab-active":`1`}:{},"data-session-tab-closable":a.closable===!1?`0`:`1`,...a.preview?{"data-session-tab-preview":`1`}:{}}:{},...u===`file`?{"data-file-tab-id":d,"data-file-tab-index":f,...o?{"data-file-tab-active":`1`}:{},"data-file-tab-closable":a.closable===!1?`0`:`1`}:{},...u===`diff`?{"data-diff-tab-id":d,"data-diff-tab-index":f,...o?{"data-diff-tab-active":`1`}:{},"data-diff-tab-closable":a.closable===!1?`0`:`1`}:{},title:s,style:{width:m.width,boxSizing:`border-box`},onClick:()=>n?.(a.id),onDoubleClick:()=>{(u===`session`||u===void 0)&&i?.(a.id)},onAuxClick:e=>{e.button===1&&(e.preventDefault(),e.stopPropagation(),a.closable!==!1&&r&&r(a.id))},onMouseDown:e=>{e.button===1&&e.preventDefault()},onKeyDown:t=>{if(t.key!==`ArrowLeft`&&t.key!==`ArrowRight`)return;t.preventDefault();let r=t.key===`ArrowRight`?1:-1,i=e[(e.findIndex(e=>e.id===a.id)+r+e.length)%e.length];i&&n?.(i.id)},children:[a.icon&&(0,U.jsx)(`span`,{className:`${c}-icon workspace-tab-icon`,children:a.icon}),a.badge,(0,U.jsx)(`span`,{className:`${c}-label workspace-tab-label ${u?`${u}-tab-label`:``}`,...v(`label`,d),...u===`session`||!u?{"data-session-tab-label":d}:{},...u===`file`?{"data-file-tab-label":d}:{},...u===`diff`?{"data-diff-tab-label":d}:{},children:a.label}),a.closable!==!1&&r&&(0,U.jsx)(`button`,{type:`button`,className:`${c}-close workspace-tab-close ${u?`${u}-tab-close`:``}`,...v(`close`,d),...u===`session`||!u?{"data-session-tab-close":d}:{},...u===`file`?{"data-file-tab-close":d}:{},...u===`diff`?{"data-diff-tab-close":d}:{},onClick:e=>{e.stopPropagation(),r(a.id)},onDoubleClick:e=>{e.stopPropagation()},title:`关闭 ${s}`,"aria-label":`关闭 ${s}`,children:`×`})]},a.id)})},`row_${o}`))})}var K_={pending:`未开始`,running:`运行中`,completed:`已完成`,failed:`失败`,skipped:`已跳过`,stopped:`已停止`},q_={running:`运行中`,completed:`全部完成`,failed:`中途失败`,stopped:`已停止`},J_={pending:`○`,running:`◐`,completed:`✓`,failed:`✕`,skipped:`→`,stopped:`■`},Y_={stop:`失败即停`,skip:`失败跳过`,"retry:1":`失败重试 1 次`,"retry:2":`失败重试 2 次`,"retry:3":`失败重试 3 次`};function X_(e){let t=Math.max(0,Math.round(e/1e3)),n=t%60,r=Math.floor(t/60)%60,i=Math.floor(t/3600),a=e=>String(e).padStart(2,`0`);return i>0?`${i}h ${a(r)}:${a(n)}`:`${r}:${a(n)}`}function Z_(e){let t=e.status===`running`,[n,r]=(0,H.useState)(0);(0,H.useEffect)(()=>{if(!t)return;r(Date.now());let e=window.setInterval(()=>r(Date.now()),200);return()=>window.clearInterval(e)},[t,e.startedAt]);let i=Date.parse(e.startedAt);if(Number.isFinite(i)){if(!t){let t=Date.parse(e.finishedAt??``);return Number.isFinite(t)?t-i:void 0}return n>0?n-i:void 0}}function Q_({step:e,names:t}){let n=e.attempts.length,r=e.attempts[n-1],i=t.get(e.agentId)||e.agentId,a=e.label?.trim()||i;return(0,U.jsxs)(`li`,{className:`workflow-step workflow-step-${e.status}`,"data-workflow-step":e.index+1,"data-workflow-step-status":e.status,"data-workflow-step-agent":e.agentId,"data-workflow-step-attempts":n,children:[(0,U.jsx)(`span`,{className:`workflow-step-mark`,"aria-hidden":`true`,children:J_[e.status]}),(0,U.jsxs)(`span`,{className:`workflow-step-n`,"data-workflow-step-n":e.index+1,children:[`第 `,e.index+1,` 步`]}),(0,U.jsx)(`strong`,{className:`workflow-step-name`,"data-workflow-step-name":e.index+1,children:a}),(0,U.jsx)(`span`,{className:`workflow-step-agent`,"data-workflow-step-agent-name":e.index+1,children:i}),n>1&&(0,U.jsxs)(`span`,{className:`workflow-step-tries`,"data-workflow-step-retried":e.index+1,children:[`尝试 `,n,` 次`]}),(0,U.jsx)(`span`,{className:`workflow-step-status`,"data-workflow-step-status-text":e.index+1,children:K_[e.status]}),e.status===`failed`&&r?.error&&(0,U.jsx)(`span`,{className:`workflow-step-why`,"data-workflow-step-error":e.index+1,title:np(r.error),children:tp(r.error,`这一步没有完成。`)})]})}function $_({nodes:e,steps:t,names:n}){return(0,U.jsx)(`ol`,{className:`workflow-steps`,children:e.map((e,r)=>{if(e.kind===`step`){let r=t[e.stepIndex];return r?(0,U.jsx)(Q_,{step:r,names:n},`step-${e.stepIndex}`):null}return e.kind===`loop`?(0,U.jsxs)(`li`,{className:`workflow-node workflow-loop`,"data-workflow-loop":!0,"data-workflow-loop-rounds":e.rounds.length,"data-workflow-loop-max":e.max,"data-workflow-until":e.until,children:[(0,U.jsxs)(`div`,{className:`workflow-node-head`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`↻`}),(0,U.jsx)(`strong`,{children:`循环`}),(0,U.jsxs)(`span`,{children:[`直到「`,e.until,`」`]}),(0,U.jsxs)(`span`,{"data-workflow-loop-progress":!0,children:[`已跑 `,e.rounds.length,`/`,e.max,` 轮`]})]}),e.rounds.map(e=>(0,U.jsxs)(`section`,{className:`workflow-round`,"data-workflow-round":e.n,"data-workflow-round-met":e.untilMet?`true`:`false`,children:[(0,U.jsxs)(`div`,{className:`workflow-round-head`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,children:e.untilMet?`✓`:`○`}),`第 `,e.n,` 轮 · `,e.untilMet?`条件满足`:`条件未满足`]}),(0,U.jsx)($_,{nodes:e.nodes,steps:t,names:n})]},e.n))]},`loop-${r}`):(0,U.jsxs)(`li`,{className:`workflow-node workflow-foreach`,"data-workflow-foreach":!0,"data-workflow-foreach-count":e.items.length,children:[(0,U.jsxs)(`div`,{className:`workflow-node-head`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`≡`}),(0,U.jsx)(`strong`,{children:`逐项执行`}),(0,U.jsxs)(`span`,{children:[e.items.length,` 个由 primary 给出的项目`]})]}),e.iterations.map((e,r)=>(0,U.jsxs)(`section`,{className:`workflow-item`,"data-workflow-item":r+1,"data-workflow-item-value":e.item,children:[(0,U.jsxs)(`div`,{className:`workflow-item-head`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`→`}),`第 `,r+1,` 项 · `,e.item]}),(0,U.jsx)($_,{nodes:e.nodes,steps:t,names:n})]},`${r}-${e.item}`))]},`foreach-${r}`)})})}function ev({workflow:e,names:t,onStop:n,stopping:r}){let i=e.status===`running`,a=Z_(e),o=e.steps.filter(e=>e.status===`completed`||e.status===`skipped`).length;return(0,U.jsxs)(`article`,{className:`workflow-card workflow-${e.status}`,"data-workflow-card":e.id,"data-workflow-status":e.status,"data-workflow-steps":e.steps.length,"data-workflow-current":e.currentIndex+1,children:[(0,U.jsxs)(`div`,{className:`workflow-head`,children:[(0,U.jsx)(`span`,{className:`workflow-badge`,children:`编排`}),(0,U.jsx)(`strong`,{className:`workflow-summary`,"data-workflow-summary":e.id,children:e.summary}),(0,U.jsxs)(`span`,{className:`workflow-progress`,"data-workflow-progress":e.id,children:[o,`/`,e.steps.length]}),(0,U.jsx)(`span`,{className:`workflow-status`,"data-workflow-status-text":e.id,children:q_[e.status]??`未知状态`}),(0,U.jsx)(`span`,{className:`workflow-policy`,"data-workflow-policy":e.onFailure,children:Y_[e.onFailure]??e.onFailure}),a!==void 0&&(0,U.jsxs)(`span`,{className:`workflow-clock`,"data-workflow-elapsed":e.id,children:[i?`已运行 `:`用时 `,X_(a)]}),i&&(0,U.jsx)(`button`,{type:`button`,className:`workflow-stop`,"data-workflow-stop":e.id,disabled:r,onClick:n,children:`停止`})]}),e.nodes?(0,U.jsx)($_,{nodes:e.nodes,steps:e.steps,names:t}):(0,U.jsx)(`ol`,{className:`workflow-steps`,"data-workflow-step-count":e.steps.length,children:e.steps.map(e=>(0,U.jsx)(Q_,{step:e,names:t},e.index))})]})}var tv=[{id:`agents`,label:`智能体与创建`,icon:`🤖`,title:`Agent 智能体系统与创建指南`,description:`了解 Super Pi 的角色设定机制,以及如何一步步创建你自己的自定义 Agent。`},{id:`workspace`,label:`工作区与会话`,icon:`🗂️`,title:`工作区与多会话管理`,description:`高效管理本地代码仓库、独立会话标签页与多模态图文输入。`},{id:`subagents`,label:`子任务与编排`,icon:`⚡`,title:`子智能体委托与顺序编排使用指南`,description:`让主 Agent 安排分工、交接结果,并查看进度、处理失败与停止任务。`},{id:`model-policy`,label:`模型使用规则`,icon:`🔒`,title:`模型过滤规则(按工作区限制可用模型)`,description:`用正则规则限定哪些工作区只能用哪些模型,防止敏感代码被发到不该用的模型上。`},{id:`memory`,label:`主动记忆`,icon:`🧠`,title:`主动记忆与技能经验`,description:`让 Super Pi 在得到明确证据后保存长期事实、用户偏好和可复用工作方法。`},{id:`knowledge`,label:`知识库`,icon:`📚`,title:`工作区知识库`,description:`导入规范与设计文档,让 Agent 检索原文作答,而不是凭记忆编造。`},{id:`feishu`,label:`飞书`,icon:`📄`,title:`飞书云文档的读写`,description:`让 Agent 读一篇飞书文档、写回结论。接入方式、连接步骤与常见问题。`},{id:`tools`,label:`侧边栏工具`,icon:`🧩`,title:`全局工具:开发、导出与导入`,description:`让 Agent 写一个工具,用一个文件分享给别人,导入前先看清它会做什么。`},{id:`cli`,label:`指令与快捷键`,icon:`⌨️`,title:`Pi 终端命令与键盘快捷操作`,description:`利用 Pi 终端斜杠指令控制服务生命周期,掌握常用快捷键提升效率。`},{id:`themes`,label:`外观与主题`,icon:`🎨`,title:`界面主题与个性化显示`,description:`内置 4 款专业高对比度主题,针对不同环境提供舒适体验。`}];function nv({onClose:e}){let[t,n]=(0,H.useState)(`agents`);(0,H.useEffect)(()=>{let t=t=>{t.key===`Escape`&&!t.defaultPrevented&&e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]);let r=tv.find(e=>e.id===t)??tv[0];return(0,U.jsx)(`div`,{className:`overlay`,onClick:e,children:(0,U.jsxs)(`div`,{className:`picker settings-window help-window`,"data-help-window":`1`,onClick:e=>e.stopPropagation(),role:`dialog`,"aria-modal":`true`,"aria-labelledby":`help-window-title`,children:[(0,U.jsxs)(`div`,{className:`settings-window-head help-window-head`,children:[(0,U.jsxs)(`div`,{className:`help-head-title`,children:[(0,U.jsx)(`h2`,{id:`help-window-title`,children:`使用指南与帮助`}),(0,U.jsx)(`span`,{className:`help-badge`,children:`v0.1.x`})]}),(0,U.jsx)(`button`,{type:`button`,className:`help-close-button`,"aria-label":`关闭指南`,onClick:e,children:`✕`})]}),(0,U.jsxs)(`div`,{className:`settings-window-body help-window-body`,children:[(0,U.jsxs)(`nav`,{className:`settings-nav help-nav`,role:`tablist`,"aria-orientation":`vertical`,"aria-label":`使用指南分类`,children:[(0,U.jsx)(`div`,{className:`settings-nav-label`,children:`目录`}),tv.map(e=>(0,U.jsxs)(`button`,{type:`button`,id:`help-tab-${e.id}`,className:`settings-category help-category`,role:`tab`,"aria-selected":e.id===r.id,"aria-controls":`help-panel`,tabIndex:e.id===r.id?0:-1,onClick:()=>n(e.id),children:[(0,U.jsx)(`span`,{className:`help-tab-icon`,"aria-hidden":`true`,children:e.icon}),(0,U.jsx)(`span`,{children:e.label})]},e.id))]}),(0,U.jsxs)(`div`,{id:`help-panel`,className:`settings-panel help-panel`,role:`tabpanel`,"aria-labelledby":`help-tab-${r.id}`,children:[(0,U.jsxs)(`div`,{className:`help-panel-header`,children:[(0,U.jsx)(`h3`,{className:`help-panel-title`,children:r.title}),(0,U.jsx)(`p`,{className:`help-panel-desc`,children:r.description})]}),(0,U.jsxs)(`div`,{className:`help-panel-content`,children:[r.id===`agents`&&(0,U.jsx)(av,{}),r.id===`workspace`&&(0,U.jsx)(ov,{}),r.id===`subagents`&&(0,U.jsx)(cv,{}),r.id===`model-policy`&&(0,U.jsx)(sv,{}),r.id===`memory`&&(0,U.jsx)(rv,{}),r.id===`knowledge`&&(0,U.jsx)(iv,{}),r.id===`feishu`&&(0,U.jsx)(lv,{}),r.id===`tools`&&(0,U.jsx)(uv,{}),r.id===`cli`&&(0,U.jsx)(dv,{}),r.id===`themes`&&(0,U.jsx)(fv,{})]}),(0,U.jsx)(`div`,{className:`picker-actions help-actions`,children:(0,U.jsx)(`button`,{type:`button`,className:`picker-cancel`,onClick:e,children:`关闭`})})]})]})]})})}function rv(){return(0,U.jsxs)(`div`,{className:`help-section-group`,children:[(0,U.jsxs)(`div`,{className:`help-card highlight`,children:[(0,U.jsx)(`h4`,{children:`🧠 它会记住什么?`}),(0,U.jsx)(`p`,{children:`用户档案保存跨工作区的长期偏好;工作区事实保存环境与项目约定;技能保存已经验证过的步骤、命令和坑。临时结果、秘密和未验证的失败不会保存。`})]}),(0,U.jsxs)(`div`,{className:`help-card`,children:[(0,U.jsx)(`h4`,{children:`主动保存与后台复盘`}),(0,U.jsxs)(`ul`,{className:`help-list`,children:[(0,U.jsxs)(`li`,{children:[`主 Agent 可以使用 `,(0,U.jsx)(`code`,{children:`memory`}),` 和 `,(0,U.jsx)(`code`,{children:`skill_manage`}),` 工具主动保存;说“记住了”本身不会写入。`]}),(0,U.jsx)(`li`,{children:`每隔若干回合,系统会在独立会话中复盘最近证据。复盘不能读写工作区文件、执行命令或派发任务。`}),(0,U.jsx)(`li`,{children:`读取记忆和历史只返回带来源的参考数据,不能把记忆中的文字当作新的指令。`})]})]}),(0,U.jsxs)(`div`,{className:`help-card`,children:[(0,U.jsx)(`h4`,{children:`权限与审批`}),(0,U.jsxs)(`ul`,{className:`help-list`,children:[(0,U.jsx)(`li`,{children:`子 Agent 可以读取相关记忆,但没有写入权限。`}),(0,U.jsx)(`li`,{children:`后台复盘新增记忆可以直接保存;修改或删除旧条目会进入设置中的待审批列表。`}),(0,U.jsx)(`li`,{children:`在“设置 → 主动记忆”可以开关功能、调整复盘间隔、编辑条目和批准提案。`})]})]})]})}function iv(){return(0,U.jsxs)(`div`,{className:`help-section-group`,children:[(0,U.jsxs)(`div`,{className:`help-card highlight`,children:[(0,U.jsx)(`h4`,{children:`📚 它解决什么问题?`}),(0,U.jsx)(`p`,{children:`Agent 默认靠训练时的记忆回答项目里的问题。知识库让你把规范、设计稿、会议纪要导入工作区,Agent 在回答前检索这些文档的原文片段,而不是凭印象编造。它与“主动记忆”不同:记忆是 Agent 自己沉淀的事实和技能,知识库的内容来自工作区里真实存在的文档。`})]}),(0,U.jsxs)(`div`,{className:`help-card`,children:[(0,U.jsx)(`h4`,{children:`怎么用`}),(0,U.jsxs)(`ul`,{className:`help-list`,children:[(0,U.jsxs)(`li`,{children:[`在“设置 → 知识库”里点“浏览工作区文件…”,在弹出的浏览器里挑一个 Markdown 或文本文件,挑完即导入。也可以直接粘贴正文、手动填写相对路径,或者直接对 Agent 说“把某某文件加入知识库”——它会用 `,(0,U.jsx)(`code`,{children:`knowledge_import`}),` 导入,走的是同一条服务端校验。`]}),(0,U.jsx)(`li`,{children:`同一个文件内容改了再导入就是更新,不会留下旧版本;同样的内容换个标题再导入也不会变成两篇。`}),(0,U.jsx)(`li`,{children:`面板里的“试检索”会用和 Agent 相同的检索器回答,方便你在交给 Agent 之前先确认它找得到。`}),(0,U.jsxs)(`li`,{children:[`从下一条消息开始生效。Agent 使用 `,(0,U.jsx)(`code`,{children:`knowledge_search`}),` 检索,只拿得到片段和来源,拿不到整篇文档。`]})]})]}),(0,U.jsxs)(`div`,{className:`help-card`,children:[(0,U.jsx)(`h4`,{children:`语义检索是内置的`}),(0,U.jsxs)(`ul`,{className:`help-list`,children:[(0,U.jsxs)(`li`,{children:[`关键词检索始终可用。语义检索让“撤销购买”也能找到写着“取消订单”的段落,它靠一个`,(0,U.jsx)(`strong`,{children:`随安装包一起分发`}),`的中文模型在本机运行,不需要额外下载、不需要联网、也不会把文档发到任何服务。`]}),(0,U.jsxs)(`li`,{children:[`第一次检索时加载模型(约一秒),之后一直可用。设 `,(0,U.jsx)(`code`,{children:`SUPER_PI_KNOWLEDGE_EMBEDDINGS=0`}),` 可以彻底关闭语义检索,只保留关键词检索。`]})]})]}),(0,U.jsxs)(`div`,{className:`help-card`,children:[(0,U.jsx)(`h4`,{children:`它不知道的事`}),(0,U.jsxs)(`ul`,{className:`help-list`,children:[(0,U.jsx)(`li`,{children:`知识库只会检索它有的东西。文档里没写的,它检索出来也不会有——所以导入什么,直接决定它能回答什么。`}),(0,U.jsx)(`li`,{children:`语义检索总会返回“最接近的那一段”,即使这一段其实并不回答问题。检索结果带一个分数,低分意味着这可能只是最像的一条,Agent 会被要求先核对再使用。`}),(0,U.jsxs)(`li`,{children:[`Agent 可以按你的要求把工作区文件导入知识库(`,(0,U.jsx)(`code`,{children:`knowledge_import`}),`,只接受文本类文件),但`,(0,U.jsx)(`strong`,{children:`不能删除`}),`——删除文档只有你能在“设置 → 知识库”里做。`]})]})]})]})}function av(){return(0,U.jsxs)(`div`,{className:`help-section-group`,children:[(0,U.jsxs)(`div`,{className:`help-card highlight`,children:[(0,U.jsx)(`h4`,{children:`💡 Agent 是什么?`}),(0,U.jsxs)(`p`,{children:[`在 Super Pi 中,`,(0,U.jsx)(`strong`,{children:`Agent(智能体)`}),` 是一套独立的「角色提示词设定与能力配置」。 通过切换 Agent,模型将扮演专精工程师、系统架构师、代码审查员或规划专家等不同角色,遵循指定的原则来协助你完成任务。`]})]}),(0,U.jsxs)(`div`,{className:`help-card`,children:[(0,U.jsx)(`h4`,{children:`📁 Agent 文件存放在哪里?`}),(0,U.jsxs)(`ul`,{className:`help-list`,children:[(0,U.jsxs)(`li`,{children:[(0,U.jsx)(`strong`,{children:`内置 Agent 目录:`}),`项目根目录下的 `,(0,U.jsx)(`code`,{children:`agents/`}),` 文件夹,例如 `,(0,U.jsx)(`code`,{children:`agents/coder.md`}),`、`,(0,U.jsx)(`code`,{children:`agents/planner.md`}),`、`,(0,U.jsx)(`code`,{children:`agents/reviewer.md`}),` 等。`]}),(0,U.jsxs)(`li`,{children:[(0,U.jsx)(`strong`,{children:`用户自定义持久化目录:`}),`用户主目录下的 `,(0,U.jsx)(`code`,{children:`~/.super-pi/agents/`}),`,放入此目录的文件在所有项目和更新中均持久有效。`]})]})]}),(0,U.jsxs)(`div`,{className:`help-card`,children:[(0,U.jsx)(`h4`,{children:`🚀 如何创建一个全新的自定义 Agent?`}),(0,U.jsxs)(`div`,{className:`help-steps`,children:[(0,U.jsxs)(`div`,{className:`help-step`,children:[(0,U.jsx)(`span`,{className:`step-num`,children:`1`}),(0,U.jsxs)(`div`,{className:`step-body`,children:[(0,U.jsx)(`strong`,{children:`创建 Markdown 文件`}),(0,U.jsxs)(`p`,{children:[`在 `,(0,U.jsx)(`code`,{children:`agents/`}),` 或 `,(0,U.jsx)(`code`,{children:`~/.super-pi/agents/`}),` 目录下新建文件,例如 `,(0,U.jsx)(`code`,{children:`architect.md`}),`。`]})]})]}),(0,U.jsxs)(`div`,{className:`help-step`,children:[(0,U.jsx)(`span`,{className:`step-num`,children:`2`}),(0,U.jsxs)(`div`,{className:`step-body`,children:[(0,U.jsx)(`strong`,{children:`编写元数据与系统提示词`}),(0,U.jsx)(`p`,{children:`文件开头使用 YAML Frontmatter 声明名称和描述,正文编写设定提示词:`}),(0,U.jsx)(`pre`,{className:`help-code-block`,children:(0,U.jsx)(`code`,{children:`---
|