@evandu/super-pi 0.1.118 → 0.1.119

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.
Files changed (41) hide show
  1. package/dist/client/.super-pi-client-sources.json +5 -4
  2. package/dist/client/assets/CodeMirrorEditor-B3fdsbQG.js +2 -0
  3. package/dist/client/assets/diff-ChtP43wD.js +1 -0
  4. package/dist/client/assets/dist-B4olgwDY.js +6 -0
  5. package/dist/client/assets/dist-B8m4FQMw.js +1 -0
  6. package/dist/client/assets/{dist-CMRuQ4se.js → dist-BHR11vvR.js} +1 -1
  7. package/dist/client/assets/{dist-DncjdwQz.js → dist-BIrpcOlT.js} +1 -1
  8. package/dist/client/assets/dist-BtBZU3on.js +1 -0
  9. package/dist/client/assets/dist-BuPMLKmJ.js +1 -0
  10. package/dist/client/assets/dist-Bz1fhswg.js +11 -0
  11. package/dist/client/assets/{dist-D9571BVm.js → dist-C7cT_0DV.js} +1 -1
  12. package/dist/client/assets/{dist-BSBqp9tS.js → dist-CD48OxD-.js} +1 -1
  13. package/dist/client/assets/dist-CDf4yHNS.js +1 -0
  14. package/dist/client/assets/{dist-BewFlCBY.js → dist-CLUldJ0R.js} +1 -1
  15. package/dist/client/assets/{dist-COGr0kGo.js → dist-CONxa49_.js} +1 -1
  16. package/dist/client/assets/{dist-BWxNjbza.js → dist-Cd1LX9NO.js} +1 -1
  17. package/dist/client/assets/dist-D8fToNm8.js +2 -0
  18. package/dist/client/assets/{dist-BIjlwIeL.js → dist-DAzEWwEt.js} +1 -1
  19. package/dist/client/assets/dist-DibszFN4.js +9 -0
  20. package/dist/client/assets/dist-Dqm7LOtA.js +1 -0
  21. package/dist/client/assets/{dist-ClX_xXLe.js → dist-QsfOd_wT.js} +1 -1
  22. package/dist/client/assets/dist-WzVcpzPK.js +23 -0
  23. package/dist/client/assets/{dist-Boep2KRH.js → dist-hZolWrkG.js} +1 -1
  24. package/dist/client/assets/{dist-ce3zYUZG.js → dist-m3ivUNst.js} +1 -1
  25. package/dist/client/assets/{dist-BUJwJ5eB.js → dist-sAC9xLMP.js} +1 -1
  26. package/dist/client/assets/dockerfile-BDePf5PZ.js +1 -0
  27. package/dist/client/assets/{index-CF45rxGL.js → index-D1LffJmn.js} +1 -1
  28. package/dist/client/assets/{index-DGPYJzbU.css → index-Ld7rZQJu.css} +1 -1
  29. package/dist/client/assets/powershell-D8WpQPaX.js +1 -0
  30. package/dist/client/assets/properties-C357ku5U.js +1 -0
  31. package/dist/client/assets/ruby-ChfNwlCY.js +1 -0
  32. package/dist/client/assets/shell-DwuoZtxw.js +1 -0
  33. package/dist/client/assets/swift-DKB6_1j6.js +1 -0
  34. package/dist/client/assets/toml-BPTmHmyx.js +1 -0
  35. package/dist/client/index.html +2 -2
  36. package/package.json +9 -1
  37. package/dist/client/assets/CodeMirrorEditor-D9UWxggU.js +0 -2
  38. package/dist/client/assets/dist-Adu9a_hi.js +0 -6
  39. package/dist/client/assets/dist-C7waPnE-.js +0 -9
  40. package/dist/client/assets/dist-CDI2Ko-l.js +0 -11
  41. package/dist/client/assets/dist-C_eAtLLb.js +0 -23
@@ -1,2 +1,2 @@
1
- import{S as e,_ as t,a as n,d as r,i,l as a,m as o,o as s,p as c,s as l,v as u,w as d,y as f}from"./dist-BewFlCBY.js";import{a as p,c as m,g as h,h as ee,l as g,m as te,p as ne,r as _,t as v}from"./dist-COGr0kGo.js";var y=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,b=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(y(e)):y,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return t(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=d(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=u(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n,a=!0;;e++){let n=r.charCodeAt(e),o=this.match(n,i,a,this.bufferPos+this.bufferStart,e==r.length-1);if(o)return this.value=o,this;if(e==r.length-1)break;a&&e<t.length&&t.charCodeAt(e)==n?i++:a=!1}}}match(e,t,n,r,i){let a=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],o=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?a={from:n.from,to:r,precise:i&&n.precise}:(n.index++,o=!0)),o?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?a={from:t,to:r,precise:n&&i}:this.matches.push({from:t,index:1,precise:n})),a&&this.test&&!this.test(a.from,a.to,this.buffer,this.bufferStart)&&(a=null),a}};typeof Symbol<`u`&&(b.prototype[Symbol.iterator]=function(){return this});var re={from:-1,to:-1,match:/.*/.exec(``),precise:!0},x=`gm`+(/x/.unicode==null?``:`u`),S=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=re,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new T(e,t,n,r,i);this.re=new RegExp(t,x+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=E(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=E(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},C=new WeakMap,w=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=C.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return C.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),C.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},T=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=re,this.matchPos=E(e,r),this.re=new RegExp(t,x+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=w.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=E(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=w.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(S.prototype[Symbol.iterator]=T.prototype[Symbol.iterator]=function(){return this});function ie(e){try{return new RegExp(e,x),!0}catch{return!1}}function E(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var D=e=>{let t=m(e,`cm-goto-line`);if(t){let e=t.dom.querySelector(`input[type=text]`);return e&&e.select(),!0}let{state:r}=e,i=String(r.doc.lineAt(e.state.selection.main.head).number),{close:a,result:o}=te(e,{class:`cm-goto-line`,label:r.phrase(`Go to line`),input:{type:`text`,name:`line`,value:i},focus:!0,submitLabel:r.phrase(`go`)});return o.then(t=>{let i=t&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.elements.line.value);if(!i){e.dispatch({effects:a});return}let o=r.doc.lineAt(r.selection.main.head),[,s,c,l,u]=i,d=l?+l.slice(1):0,f=c?+c:o.number;if(c&&u){let e=f/100;s&&(e=e*(s==`-`?-1:1)+o.number/r.doc.lines),f=Math.round(r.doc.lines*e)}else c&&s&&(f=f*(s==`-`?-1:1)+o.number);let p=r.doc.line(Math.max(1,Math.min(r.doc.lines,f))),m=n.cursor(p.from+Math.max(0,Math.min(d,p.length)));e.dispatch({effects:[a,_.scrollIntoView(m.from,{y:`center`})],selection:m})}),!0},ae={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},O=l.define({combine(e){return f(e,ae,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function oe(e){let t=[fe,de];return e&&t.push(O.of(e)),t}var se=v.mark({class:`cm-selectionMatch`}),ce=v.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function le(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=i.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=i.Word)}function ue(e,t,n,r){return e(t.sliceDoc(n,n+1))==i.Word&&e(t.sliceDoc(r-1,r))==i.Word}var de=p.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(O),{state:n}=e,r=n.selection;if(r.ranges.length>1)return v.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return v.none;let e=n.wordAt(i.head);if(!e)return v.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return v.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(le(o,n,i.from,i.to)&&ue(o,n,i.from,i.to)))return v.none}else if(a=n.sliceDoc(i.from,i.to),!a)return v.none}let s=[];for(let r of e.visibleRanges){let e=new b(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||le(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(ce.range(r,a)):(r>=i.to||a<=i.from)&&s.push(se.range(r,a)),s.length>t.maxMatches))return v.none}}return v.set(s)}},{decorations:e=>e.decorations}),fe=_.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),pe=({state:e,dispatch:t})=>{let{selection:r}=e,i=n.create(r.ranges.map(t=>e.wordAt(t.head)||n.cursor(t.head)),r.mainIndex);return!i.eq(r)&&(t(e.update({selection:i})),!0)};function me(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new b(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new b(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var he=({state:e,dispatch:t})=>{let{ranges:r}=e.selection;if(r.some(e=>e.from===e.to))return pe({state:e,dispatch:t});let i=e.sliceDoc(r[0].from,r[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=i))return!1;let a=me(e,i);return a?(t(e.update({selection:e.selection.addRange(n.range(a.from,a.to),!1),effects:_.scrollIntoView(a.to)})),!0):!1},k=l.define({combine(e){return f(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Ne(e),scrollToMatch:e=>_.scrollIntoView(e)})}});function ge(e){return e?[k.of(e),$]:$}var A=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||ie(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
1
+ import{S as e,_ as t,a as n,d as r,i,l as a,m as o,o as s,p as c,s as l,v as u,w as d,y as f}from"./dist-CLUldJ0R.js";import{a as p,c as m,g as h,h as ee,l as g,m as te,p as ne,r as _,t as v}from"./dist-CONxa49_.js";var y=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,b=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(y(e)):y,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return t(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=d(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=u(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n,a=!0;;e++){let n=r.charCodeAt(e),o=this.match(n,i,a,this.bufferPos+this.bufferStart,e==r.length-1);if(o)return this.value=o,this;if(e==r.length-1)break;a&&e<t.length&&t.charCodeAt(e)==n?i++:a=!1}}}match(e,t,n,r,i){let a=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],o=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?a={from:n.from,to:r,precise:i&&n.precise}:(n.index++,o=!0)),o?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?a={from:t,to:r,precise:n&&i}:this.matches.push({from:t,index:1,precise:n})),a&&this.test&&!this.test(a.from,a.to,this.buffer,this.bufferStart)&&(a=null),a}};typeof Symbol<`u`&&(b.prototype[Symbol.iterator]=function(){return this});var re={from:-1,to:-1,match:/.*/.exec(``),precise:!0},x=`gm`+(/x/.unicode==null?``:`u`),S=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=re,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new T(e,t,n,r,i);this.re=new RegExp(t,x+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=E(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=E(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},C=new WeakMap,w=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=C.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return C.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),C.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},T=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=re,this.matchPos=E(e,r),this.re=new RegExp(t,x+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=w.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=E(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=w.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(S.prototype[Symbol.iterator]=T.prototype[Symbol.iterator]=function(){return this});function ie(e){try{return new RegExp(e,x),!0}catch{return!1}}function E(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var D=e=>{let t=m(e,`cm-goto-line`);if(t){let e=t.dom.querySelector(`input[type=text]`);return e&&e.select(),!0}let{state:r}=e,i=String(r.doc.lineAt(e.state.selection.main.head).number),{close:a,result:o}=te(e,{class:`cm-goto-line`,label:r.phrase(`Go to line`),input:{type:`text`,name:`line`,value:i},focus:!0,submitLabel:r.phrase(`go`)});return o.then(t=>{let i=t&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.elements.line.value);if(!i){e.dispatch({effects:a});return}let o=r.doc.lineAt(r.selection.main.head),[,s,c,l,u]=i,d=l?+l.slice(1):0,f=c?+c:o.number;if(c&&u){let e=f/100;s&&(e=e*(s==`-`?-1:1)+o.number/r.doc.lines),f=Math.round(r.doc.lines*e)}else c&&s&&(f=f*(s==`-`?-1:1)+o.number);let p=r.doc.line(Math.max(1,Math.min(r.doc.lines,f))),m=n.cursor(p.from+Math.max(0,Math.min(d,p.length)));e.dispatch({effects:[a,_.scrollIntoView(m.from,{y:`center`})],selection:m})}),!0},ae={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},O=l.define({combine(e){return f(e,ae,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function oe(e){let t=[fe,de];return e&&t.push(O.of(e)),t}var se=v.mark({class:`cm-selectionMatch`}),ce=v.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function le(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=i.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=i.Word)}function ue(e,t,n,r){return e(t.sliceDoc(n,n+1))==i.Word&&e(t.sliceDoc(r-1,r))==i.Word}var de=p.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(O),{state:n}=e,r=n.selection;if(r.ranges.length>1)return v.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return v.none;let e=n.wordAt(i.head);if(!e)return v.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return v.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(le(o,n,i.from,i.to)&&ue(o,n,i.from,i.to)))return v.none}else if(a=n.sliceDoc(i.from,i.to),!a)return v.none}let s=[];for(let r of e.visibleRanges){let e=new b(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||le(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(ce.range(r,a)):(r>=i.to||a<=i.from)&&s.push(se.range(r,a)),s.length>t.maxMatches))return v.none}}return v.set(s)}},{decorations:e=>e.decorations}),fe=_.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),pe=({state:e,dispatch:t})=>{let{selection:r}=e,i=n.create(r.ranges.map(t=>e.wordAt(t.head)||n.cursor(t.head)),r.mainIndex);return!i.eq(r)&&(t(e.update({selection:i})),!0)};function me(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new b(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new b(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var he=({state:e,dispatch:t})=>{let{ranges:r}=e.selection;if(r.some(e=>e.from===e.to))return pe({state:e,dispatch:t});let i=e.sliceDoc(r[0].from,r[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=i))return!1;let a=me(e,i);return a?(t(e.update({selection:e.selection.addRange(n.range(a.from,a.to),!1),effects:_.scrollIntoView(a.to)})),!0):!1},k=l.define({combine(e){return f(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Ne(e),scrollToMatch:e=>_.scrollIntoView(e)})}});function ge(e){return e?[k.of(e),$]:$}var A=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||ie(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
2
2
  `:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Se(this):new ye(this)}getCursor(e,t=0,n){let r=e.doc?e:s.create({doc:e});return n??=r.doc.length,this.regexp?N(this,r,t,n):M(this,r,t,n)}},j=class{constructor(e){this.spec=e}};function _e(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function M(e,t,n,r){let i;return e.wholeWord&&(i=ve(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=_e(e.test,t,i)),new b(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function ve(e,t){return(n,r,a,o)=>((o>n||o+a.length<r)&&(o=Math.max(0,n-2),a=e.sliceString(o,Math.min(e.length,r+2))),(t(P(a,n-o))!=i.Word||t(F(a,n-o))!=i.Word)&&(t(F(a,r-o))!=i.Word||t(P(a,r-o))!=i.Word))}var ye=class extends j{constructor(e){super(e)}nextMatch(e,t,n){let r=M(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=M(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=M(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=M(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=M(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function be(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function N(e,t,n,r){let i;return e.wholeWord&&(i=xe(t.charCategorizer(t.selection.main.head))),e.test&&(i=be(e.test,t,i)),new S(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function P(t,n){return t.slice(e(t,n,!1),n)}function F(t,n){return t.slice(n,e(t,n))}function xe(e){return(t,n,r)=>!r[0].length||(e(P(r.input,r.index))!=i.Word||e(F(r.input,r.index))!=i.Word)&&(e(F(r.input,r.index+r[0].length))!=i.Word||e(P(r.input,r.index+r[0].length))!=i.Word)}var Se=class extends j{nextMatch(e,t,n){let r=N(this.spec,e,n,e.doc.length).next();return r.done&&(r=N(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=N(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=N(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=N(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},I=c.define(),L=c.define(),R=o.define({create(e){return new z(G(e).create(),null)},update(e,t){for(let n of t.effects)n.is(I)?e=new z(n.value.create(),e.panel):n.is(L)&&(e=new z(e.query,n.value?W:null));return e},provide:e=>ee.from(e,e=>e.panel)});function Ce(e){let t=e.field(R,!1);return t?t.query.spec:G(e)}function we(e){return e.field(R,!1)?.panel!=null}var z=class{constructor(e,t){this.query=e,this.panel=t}},Te=v.mark({class:`cm-searchMatch`}),Ee=v.mark({class:`cm-searchMatch cm-searchMatch-selected`}),De=p.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(R))}update(e){let t=e.state.field(R);(t!=e.startState.field(R)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return v.none;let{view:n}=this,i=new r;for(let t=0,r=n.visibleRanges,a=r.length;t<a;t++){let{from:o,to:s}=r[t];for(;t<a-1&&s>r[t+1].from-500;)s=r[++t].to;e.highlight(n.state,o,s,(e,t)=>{let r=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);i.add(e,t,r?Ee:Te)})}return i.finish()}},{decorations:e=>e.decorations});function B(e){return t=>{let n=t.state.field(R,!1);return n&&n.query.spec.valid?e(t,n):q(t)}}var V=B((e,{query:t})=>{let{to:r}=e.state.selection.main,i=t.nextMatch(e.state,r,r);if(!i)return!1;let a=n.single(i.from,i.to),o=e.state.facet(k);return e.dispatch({selection:a,effects:[Q(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),je(e),!0}),H=B((e,{query:t})=>{let{state:r}=e,{from:i}=r.selection.main,a=t.prevMatch(r,i,i);if(!a)return!1;let o=n.single(a.from,a.to),s=e.state.facet(k);return e.dispatch({selection:o,effects:[Q(e,a),s.scrollToMatch(o.main,e)],userEvent:`select.search`}),je(e),!0}),Oe=B((e,{query:t})=>{let r=t.matchAll(e.state,1e3);return!r||!r.length?!1:(e.dispatch({selection:n.create(r.map(e=>n.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),ke=({state:e,dispatch:t})=>{let r=e.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:i,to:a}=r.main,o=[],s=0;for(let t=new b(e.doc,e.sliceDoc(i,a));!t.next().done;){if(o.length>1e3)return!1;t.value.from==i&&(s=o.length),o.push(n.range(t.value.from,t.value.to))}return t(e.update({selection:n.create(o,s),userEvent:`select.search.matches`})),!0},U=B((e,{query:t})=>{let{state:r}=e,{from:i,to:a}=r.selection.main;if(r.readOnly)return!1;let o=t.nextMatch(r,i,i);if(!o)return!1;let s=o,c=[],l,u,d=[];s.precise?s.from==i&&s.to==a&&(u=r.toText(t.getReplacement(s)),c.push({from:s.from,to:s.to,insert:u}),s=t.nextMatch(r,s.from,s.to),d.push(_.announce.of(r.phrase(`replaced match on line $`,r.doc.lineAt(i).number)+`.`))):s=t.nextMatch(r,s.from,s.to);let f=e.state.changes(c);return s&&(l=n.single(s.from,s.to).map(f),d.push(Q(e,s)),d.push(r.facet(k).scrollToMatch(l.main,e))),e.dispatch({changes:f,selection:l,effects:d,userEvent:`input.replace`}),!0}),Ae=B((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:e,to:i,precise:a}=r;a&&n.push({from:e,to:i,insert:t.getReplacement(r)})}if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:_.announce.of(r),userEvent:`input.replace.all`}),!0});function W(e){return e.state.facet(k).createPanel(e)}function G(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(k);return new A({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function K(e){let t=g(e,W);return t&&t.dom.querySelector(`[main-field]`)}function je(e){let t=K(e);t&&t==e.root.activeElement&&t.select()}var q=e=>{let t=e.state.field(R,!1);if(t&&t.panel){let n=K(e);if(n&&n!=e.root.activeElement){let r=G(e.state,t.query.spec);r.valid&&e.dispatch({effects:I.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[L.of(!0),t?I.of(G(e.state,t.query.spec)):c.appendConfig.of($)]});return!0},J=e=>{let t=e.state.field(R,!1);if(!t||!t.panel)return!1;let n=g(e,W);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:L.of(!1)}),!0},Me=[{key:`Mod-f`,run:q,scope:`editor search-panel`},{key:`F3`,run:V,shift:H,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:V,shift:H,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:J,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:ke},{key:`Mod-Alt-g`,run:D},{key:`Mod-d`,run:he,preventDefault:!0}],Ne=class{constructor(e){this.view=e;let t=this.query=e.state.field(R).query.spec;this.commit=this.commit.bind(this),this.searchField=h(`input`,{value:t.search,placeholder:Y(e,`Find`),"aria-label":Y(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=h(`input`,{value:t.replace,placeholder:Y(e,`Replace`),"aria-label":Y(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=h(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=h(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=h(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return h(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=h(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>V(e),[Y(e,`next`)]),n(`prev`,()=>H(e),[Y(e,`previous`)]),n(`select`,()=>Oe(e),[Y(e,`all`)]),h(`label`,null,[this.caseField,Y(e,`match case`)]),h(`label`,null,[this.reField,Y(e,`regexp`)]),h(`label`,null,[this.wordField,Y(e,`by word`)]),...e.state.readOnly?[]:[h(`br`),this.replaceField,n(`replace`,()=>U(e),[Y(e,`replace`)]),n(`replaceAll`,()=>Ae(e),[Y(e,`replace all`)])],h(`button`,{name:`close`,onclick:()=>J(e),"aria-label":Y(e,`close`),type:`button`},[`×`])])}commit(){let e=new A({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:I.of(e)}))}keydown(e){ne(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?H:V)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),U(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(I)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(k).top}};function Y(e,t){return e.state.phrase(t)}var X=30,Z=/[\s\.,:;?!]/;function Q(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-X),o=Math.min(i,n+X),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<X;e++)if(!Z.test(s[e+1])&&Z.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-X;e--)if(!Z.test(s[e-1])&&Z.test(s[e])){s=s.slice(0,e);break}}return _.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var Pe=_.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),$=[R,a.low(De),Pe];export{S as RegExpCursor,b as SearchCursor,A as SearchQuery,J as closeSearchPanel,V as findNext,H as findPrevious,Ce as getSearchQuery,D as gotoLine,oe as highlightSelectionMatches,q as openSearchPanel,Ae as replaceAll,U as replaceNext,ge as search,Me as searchKeymap,we as searchPanelOpen,Oe as selectMatches,he as selectNextOccurrence,ke as selectSelectionMatches,I as setSearchQuery};
@@ -0,0 +1 @@
1
+ function e(e){t(e,`start`);var n={},r=e.languageData||{},s=!1;for(var c in e)if(c!=r&&e.hasOwnProperty(c))for(var l=n[c]=[],u=e[c],d=0;d<u.length;d++){var f=u[d];l.push(new i(f,e)),(f.indent||f.dedent)&&(s=!0)}return{name:r.name,startState:function(){return{state:`start`,pending:null,indent:s?[]:null}},copyState:function(e){var t={state:e.state,pending:e.pending,indent:e.indent&&e.indent.slice(0)};return e.stack&&(t.stack=e.stack.slice(0)),t},token:a(n),indent:o(n,r),mergeTokens:r.mergeTokens,languageData:r}}function t(e,t){if(!e.hasOwnProperty(t))throw Error(`Undefined state `+t+` in simple mode`)}function n(e,t){if(!e)return/(?:)/;var n=``;return e instanceof RegExp?(e.ignoreCase&&(n=`i`),e.unicode&&(n+=`u`),e=e.source):e=String(e),RegExp((t===!1?``:`^`)+`(?:`+e+`)`,n)}function r(e){if(!e)return null;if(e.apply)return e;if(typeof e==`string`)return e.replace(/\./g,` `);for(var t=[],n=0;n<e.length;n++)t.push(e[n]&&e[n].replace(/\./g,` `));return t}function i(e,i){(e.next||e.push)&&t(i,e.next||e.push),this.regex=n(e.regex),this.token=r(e.token),this.data=e}function a(e){return function(t,n){if(n.pending){var r=n.pending.shift();return n.pending.length==0&&(n.pending=null),t.pos+=r.text.length,r.token}for(var i=e[n.state],a=0;a<i.length;a++){var o=i[a],s=(!o.data.sol||t.sol())&&t.match(o.regex);if(s){o.data.next?n.state=o.data.next:o.data.push?((n.stack||=[]).push(n.state),n.state=o.data.push):o.data.pop&&n.stack&&n.stack.length&&(n.state=n.stack.pop()),o.data.indent&&n.indent.push(t.indentation()+t.indentUnit),o.data.dedent&&n.indent.pop();var c=o.token;if(c&&c.apply&&(c=c(s)),s.length>2&&o.token&&typeof o.token!=`string`){n.pending=[];for(var l=2;l<s.length;l++)s[l]&&n.pending.push({text:s[l],token:o.token[l-1]});return t.backUp(s[0].length-(s[1]?s[1].length:0)),c[0]}return c&&c.join?c[0]:c}}return t.next(),null}}function o(e,t){return function(n,r){if(n.indent==null||t.dontIndentStates&&t.dontIndentStates.indexOf(n.state)>-1)return null;var i=n.indent.length-1,a=e[n.state];scan:for(;;){for(var o=0;o<a.length;o++){var s=a[o];if(s.data.dedent&&s.data.dedentIfLineStart!==!1){var c=s.regex.exec(r);if(c&&c[0]){i--,(s.next||s.push)&&(a=e[s.next||s.push]),r=r.slice(c[0].length);continue scan}}}break}return i<0?0:n.indent[i]}}var s=`from`,c=RegExp(`^(\\s*)\\b(`+s+`)\\b`,`i`),l=[`run`,`cmd`,`entrypoint`,`shell`],u=RegExp(`^(\\s*)(`+l.join(`|`)+`)(\\s+\\[)`,`i`),d=`expose`,f=RegExp(`^(\\s*)(`+d+`)(\\s+)`,`i`),p=`(`+[s,d].concat(l,[`arg`,`from`,`maintainer`,`label`,`env`,`add`,`copy`,`volume`,`user`,`workdir`,`onbuild`,`stopsignal`,`healthcheck`,`shell`]).join(`|`)+`)`,m=RegExp(`^(\\s*)`+p+`(\\s*)(#.*)?$`,`i`),h=RegExp(`^(\\s*)`+p+`(\\s+)`,`i`),g=e({start:[{regex:/^\s*#.*$/,sol:!0,token:`comment`},{regex:c,token:[null,`keyword`],sol:!0,next:`from`},{regex:m,token:[null,`keyword`,null,`error`],sol:!0},{regex:u,token:[null,`keyword`,null],sol:!0,next:`array`},{regex:f,token:[null,`keyword`,null],sol:!0,next:`expose`},{regex:h,token:[null,`keyword`,null],sol:!0,next:`arguments`},{regex:/./,token:null}],from:[{regex:/\s*$/,token:null,next:`start`},{regex:/(\s*)(#.*)$/,token:[null,`error`],next:`start`},{regex:/(\s*\S+\s+)(as)/i,token:[null,`keyword`],next:`start`},{token:null,next:`start`}],single:[{regex:/(?:[^\\']|\\.)/,token:`string`},{regex:/'/,token:`string`,pop:!0}],double:[{regex:/(?:[^\\"]|\\.)/,token:`string`},{regex:/"/,token:`string`,pop:!0}],array:[{regex:/\]/,token:null,next:`start`},{regex:/"(?:[^\\"]|\\.)*"?/,token:`string`}],expose:[{regex:/\d+$/,token:`number`,next:`start`},{regex:/[^\d]+$/,token:null,next:`start`},{regex:/\d+/,token:`number`},{regex:/[^\d]+/,token:null},{token:null,next:`start`}],arguments:[{regex:/^\s*#.*$/,sol:!0,token:`comment`},{regex:/"(?:[^\\"]|\\.)*"?$/,token:`string`,next:`start`},{regex:/"/,token:`string`,push:`double`},{regex:/'(?:[^\\']|\\.)*'?$/,token:`string`,next:`start`},{regex:/'/,token:`string`,push:`single`},{regex:/[^#"']+[\\`]$/,token:null},{regex:/[^#"']+$/,token:null,next:`start`},{regex:/[^#"']+/,token:null},{token:null,next:`start`}],languageData:{commentTokens:{line:`#`}}});export{g as dockerFile};
@@ -44,7 +44,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
44
44
  `)))}return{node:{type:`list`,ordered:n,start:n?Number(r[2]):1,items:a},next:o}}function Xp(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 Zp(e){let t=e.startsWith(`:`),n=e.endsWith(`:`);return t&&n?`center`:n?`right`:t?`left`:null}function Qp(e,t){let n=e.slice(0,t);for(;n.length<t;)n.push(``);return n}var $p={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:`Ω`},em={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:``},tm=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(`.`)),nm={C:`ℂ`,H:`ℍ`,N:`ℕ`,P:`ℙ`,Q:`ℚ`,R:`ℝ`,Z:`ℤ`},rm={B:`ℬ`,E:`ℰ`,F:`ℱ`,H:`ℋ`,I:`ℐ`,L:`ℒ`,M:`ℳ`,R:`ℛ`,e:`ℯ`,g:`ℊ`,o:`ℴ`},im={mathbb:e=>nm[e]??e.toUpperCase(),mathcal:e=>rm[e]??e.toUpperCase(),mathscr:e=>rm[e]??e.toUpperCase()},am=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`]),om={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 lm(e){let t=[],n=``,r=()=>{n&&=(t.push(...pm(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]!==`
45
45
  `;)a+=1;continue}if(am.has(s))continue;if(s===`begin`){let n=wp(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=dm(e,a),n=dm(e,t.next);a=n.next,i({type:`math-fraction`,numerator:lm(t.content),denominator:lm(n.content)});continue}if(s===`sqrt`){let t,n=a;if(e[n]===`[`){let r=um(e,n);t=lm(r.content),n=r.next}let r=dm(e,n);a=r.next,i({type:`math-root`,...t?{index:t}:{},radicand:lm(r.content)});continue}if(s===`text`||s===`mathrm`||s===`textrm`||s===`mathbf`||s===`mathit`||s===`mathsf`||s===`mathtt`||s===`operatorname`||s===`textbf`){let t=wp(e,a);a=t.next,i({type:`math-text`,value:t.content});continue}if(s in im){let t=dm(e,a);a=t.next;let n=im[s];i({type:`math-text`,value:[...t.content].map(n).join(``)});continue}if(s in om){let t=dm(e,a);a=t.next,i({type:`math-text`,value:`${mm(lm(t.content))}${om[s]}`});continue}if(s in $p){i({type:`math-identifier`,value:$p[s]});continue}if(s in em){let e=em[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(tm.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=wp(e,a);t.push(...lm(n.content)),a=n.next}else if(o===`}`||o===`&`||o===`$`)a+=1;else if(o===`^`||o===`_`){r();let n=dm(e,a+1);a=n.next,fm(t,o===`^`?`sup`:`sub`,lm(n.content))}else sm.has(o)?(i({type:`math-text`,value:o}),a+=1):(n+=o,a+=1)}return r(),t}function um(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 dm(e,t){let n=e[t];if(n===void 0)return{content:``,next:t};if(n===`{`)return wp(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 fm(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 pm(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(tm.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 mm(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`${mm(e.base)}${e.sub?`_{${mm(e.sub)}}`:``}${e.sup?`^{${mm(e.sup)}}`:``}`;case`math-fraction`:return`\\frac{${mm(e.numerator)}}{${mm(e.denominator)}}`;case`math-root`:return`\\sqrt{${mm(e.radicand)}}`;case`math-row-break`:return`\\\\`;case`math-unsupported`:return e.value;default:return``}}).join(``)}function hm({source:e}){let t=(0,B.useMemo)(()=>qp(e),[e]);return(0,V.jsx)(`div`,{className:`md`,"data-md":`1`,children:t.map((e,t)=>vm(e,t))})}function gm({source:e}){let t=(0,B.useMemo)(()=>Fp(e),[e]);return(0,V.jsx)(`span`,{className:`md md-inline`,children:t.map((e,t)=>bm(e,t))})}function _m(e){return gp(e).map((e,t)=>e.kind===`plain`?(0,V.jsx)(`span`,{children:e.text},t):(0,V.jsx)(`span`,{className:`code-token-${e.kind}`,children:e.text},t))}function vm(e,t){switch(e.type){case`paragraph`:return(0,V.jsx)(`p`,{className:`md-p`,children:e.children.map((e,t)=>bm(e,t))},t);case`heading`:{let n=`h${Math.min(6,Math.max(1,e.level))}`;return(0,V.jsx)(n,{className:`md-h md-h${e.level}`,children:e.children.map((e,t)=>bm(e,t))},t)}case`code-block`:return(0,V.jsx)(`pre`,{className:`md-pre`,"data-md-lang":e.lang||void 0,children:(0,V.jsx)(`code`,{className:`md-code`,children:_m(e.value)})},t);case`list`:{let n=e.items.map((e,t)=>(0,V.jsx)(`li`,{className:`md-li`,children:e.map((e,t)=>vm(e,t))},t));return e.ordered?(0,V.jsx)(`ol`,{className:`md-ol`,start:e.start>1?e.start:void 0,children:n},t):(0,V.jsx)(`ul`,{className:`md-ul`,children:n},t)}case`blockquote`:return(0,V.jsx)(`blockquote`,{className:`md-quote`,children:e.children.map((e,t)=>vm(e,t))},t);case`rule`:return(0,V.jsx)(`hr`,{className:`md-rule`},t);case`table`:return(0,V.jsx)(`div`,{className:`md-table-wrap`,children:(0,V.jsxs)(`table`,{className:`md-table`,children:[(0,V.jsx)(`thead`,{children:(0,V.jsx)(`tr`,{children:e.head.map((t,n)=>(0,V.jsx)(`th`,{style:ym(e.align[n]),children:t.map((e,t)=>bm(e,t))},n))})}),(0,V.jsx)(`tbody`,{children:e.rows.map((t,n)=>(0,V.jsx)(`tr`,{children:t.map((t,n)=>(0,V.jsx)(`td`,{style:ym(e.align[n]),children:t.map((e,t)=>bm(e,t))},n))},n))})]})},t);case`math-block`:return(0,V.jsx)(xm,{source:e.source},t);default:return null}}var ym=e=>e?{textAlign:e}:void 0;function bm(e,t){switch(e.type){case`text`:return(0,V.jsx)(B.Fragment,{children:e.value},t);case`code`:return(0,V.jsx)(`code`,{className:`md-code-inline`,children:e.value},t);case`strong`:return(0,V.jsx)(`strong`,{className:`md-strong`,children:e.children.map((e,t)=>bm(e,t))},t);case`em`:return(0,V.jsx)(`em`,{className:`md-em`,children:e.children.map((e,t)=>bm(e,t))},t);case`del`:return(0,V.jsx)(`del`,{className:`md-del`,children:e.children.map((e,t)=>bm(e,t))},t);case`break`:return(0,V.jsx)(`br`,{className:`md-break`},t);case`math`:return(0,V.jsx)(Sm,{source:e.source},t);case`link`:{let n=bp(e.href);return n?(0,V.jsx)(`a`,{className:`md-link`,href:n,title:e.title,target:`_blank`,rel:`noopener noreferrer nofollow`,children:e.children.map((e,t)=>bm(e,t))},t):(0,V.jsx)(B.Fragment,{children:e.children.map((e,t)=>bm(e,t))},t)}default:return null}}function xm({source:e}){let t=(0,B.useMemo)(()=>lm(e),[e]);return(0,V.jsx)(`div`,{className:`md-math md-math-block`,"data-md-math":`block`,"data-md-math-source":e,children:t.map((e,t)=>Cm(e,t))})}function Sm({source:e}){let t=(0,B.useMemo)(()=>lm(e),[e]);return(0,V.jsx)(`span`,{className:`md-math md-math-inline`,"data-md-math":`inline`,"data-md-math-source":e,children:t.map((e,t)=>Cm(e,t))})}function Cm(e,t){switch(e.type){case`math-text`:return(0,V.jsx)(`span`,{className:`md-m-text`,children:e.value},t);case`math-number`:return(0,V.jsx)(`span`,{className:`md-m-number`,children:e.value},t);case`math-identifier`:return(0,V.jsx)(`i`,{className:`md-m-var`,children:e.value},t);case`math-operator`:return(0,V.jsx)(`span`,{className:`md-m-op`,children:e.value},t);case`math-function`:return(0,V.jsx)(`span`,{className:`md-m-fn`,children:e.value},t);case`math-row-break`:return(0,V.jsx)(`br`,{className:`md-m-rowbreak`},t);case`math-unsupported`:return(0,V.jsx)(`span`,{className:`md-m-unsupported`,"data-md-math-unsupported":`1`,title:e.reason,children:e.value},t);case`math-script`:return(0,V.jsxs)(`span`,{className:`md-m-script`,children:[(0,V.jsx)(`span`,{className:`md-m-base`,children:e.base.map((e,t)=>Cm(e,t))}),e.sup&&(0,V.jsx)(`sup`,{className:`md-m-sup`,children:e.sup.map((e,t)=>Cm(e,t))}),e.sub&&(0,V.jsx)(`sub`,{className:`md-m-sub`,children:e.sub.map((e,t)=>Cm(e,t))})]},t);case`math-fraction`:return(0,V.jsxs)(`span`,{className:`md-m-frac`,children:[(0,V.jsx)(`span`,{className:`md-m-num`,children:e.numerator.map((e,t)=>Cm(e,t))}),(0,V.jsx)(`span`,{className:`md-m-den`,children:e.denominator.map((e,t)=>Cm(e,t))})]},t);case`math-root`:return(0,V.jsxs)(`span`,{className:`md-m-root`,children:[(0,V.jsx)(`span`,{className:`md-m-radical`,children:`√`}),e.index&&(0,V.jsx)(`sup`,{className:`md-m-index`,children:e.index.map((e,t)=>Cm(e,t))}),(0,V.jsx)(`span`,{className:`md-m-body`,children:e.radicand.map((e,t)=>Cm(e,t))})]},t);default:return null}}var wm=[[`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:`/${e} — ${t}`,description:t})),Tm=e=>e.normalize(`NFKD`).replace(/\p{M}/gu,``).toLowerCase();function Em(e,t){let n=Tm(t.trim());return e.examples?.find(t=>Tm(t).includes(n)&&t!==e.id)??e.id}function Dm(e,t){let n=Tm(t.trim());return n?e.filter(e=>Tm(e.id).includes(n)||Tm(e.label).includes(n)||e.examples?.some(e=>Tm(e).includes(n))):e}function Om({query:e,anchorRect:t,command:n,workspaceId:r,onSelect:i,onClose:a}){let[o,s]=(0,B.useState)(0),[c,l]=(0,B.useState)(wm),u=(0,B.useRef)(null),d=(0,B.useRef)([]);(0,B.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]}});l([...wm.filter(e=>e.id!==`skill`),...n])}).catch(()=>{}),()=>{e=!0}},[r]);let f=Dm([{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`})},...c],e),p=f.length===0?-1:Math.min(Math.max(o,0),f.length-1),m=e=>s(t=>f.length?Math.min(Math.max(t+e,0),f.length-1):0);(0,B.useEffect)(()=>{let e=e=>{u.current?.contains(e.target)||a()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[a]),(0,B.useEffect)(()=>{s(0)},[e]),(0,B.useLayoutEffect)(()=>{p>=0&&d.current[p]?.scrollIntoView({block:`nearest`})},[p]);let h={position:`fixed`,left:Math.max(8,Math.min(t.left,window.innerWidth-360)),bottom:Math.max(8,window.innerHeight-t.top+6),zIndex:200};return(0,V.jsx)(`div`,{ref:u,className:`slash-menu`,style:h,role:`listbox`,"aria-label":`斜杠命令`,onKeyDown:e=>{if(e.key===`Escape`)e.preventDefault(),a();else if(e.key===`ArrowDown`)e.preventDefault(),m(1);else if(e.key===`ArrowUp`)e.preventDefault(),m(-1);else if(e.key===`Home`)e.preventDefault(),s(0);else if(e.key===`End`)e.preventDefault(),s(f.length-1);else if(e.key===`Enter`){e.preventDefault();let t=f[p];if(!t)return;t.action?(t.action(),a()):i(t)}},children:f.length===0?(0,V.jsxs)(`div`,{className:`slash-menu-empty`,children:[`没有匹配「`,e,`」的命令`]}):f.map((e,t)=>(0,V.jsxs)(`button`,{ref:e=>{d.current[t]=e},type:`button`,role:`option`,"aria-selected":t===p,className:`slash-menu-item${t===p?` selected`:``}`,"data-slash-command":e.id,onClick:()=>{e.action?(e.action(),a()):i(e)},onMouseEnter:()=>s(t),children:[(0,V.jsxs)(`span`,{className:`slash-menu-item-id`,children:[`/`,e.id]}),(0,V.jsx)(`span`,{className:`slash-menu-item-sep`,"aria-hidden":`true`,children:` — `}),(0,V.jsx)(`span`,{className:`slash-menu-item-label`,children:e.label}),e.examples?.length?(0,V.jsx)(`span`,{className:`slash-menu-item-examples`,children:e.examples.slice(0,2).join(` · `)}):null]},e.id))})}function km(){}km.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(Am(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 Am(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 km;var jm=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,Mm=/\S/,Nm=new km;Nm.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!Mm.test(e)&&!Mm.test(t)},Nm.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]&&jm.test(t[n])&&jm.test(t[n+2])&&(t[n]+=t[n+2],t.splice(n+1,2),n--);return t};var Pm=new km;Pm.tokenize=function(e){this.options.stripTrailingCr&&(e=e.replace(/\r\n/g,`
46
46
  `));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 Fm(e,t,n){return Pm.diff(e,t,n)}var Im=new km;Im.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var Lm=new km;Lm.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function Rm(e){"@babel/helpers - typeof";return Rm=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},Rm(e)}var zm=Object.prototype.toString,Bm=new km;Bm.useLongestToken=!0,Bm.tokenize=Pm.tokenize,Bm.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(Vm(e,null,null,i),i,` `)},Bm.equals=function(e,t){return km.prototype.equals.call(Bm,e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`))};function Vm(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(zm.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=Vm(e[a],t,n,r,i);return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),Rm(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]=Vm(e[c],t,n,r,c);t.pop(),n.pop()}else o=e;return o}var Hm=new km;Hm.tokenize=function(e){return e.slice()},Hm.join=Hm.removeEmpty=function(e){return e};function Um(e,t){let n=Fm(e??``,t??``),r=[],i=0,a=0,o=1,s=1;for(let e of n){let t=e.value.split(`
47
- `),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 Wm(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 Gm(e){return Array.isArray?Array.isArray(e):th(e)===`[object Array]`}function Km(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 qm(e){return e==null?``:Km(e)}function Jm(e){return typeof e==`string`}function Ym(e){return typeof e==`number`}function Xm(e){return e===!0||e===!1||Qm(e)&&th(e)==`[object Boolean]`}function Zm(e){return typeof e==`object`}function Qm(e){return Zm(e)&&e!==null}function $m(e){return e!=null}function eh(e){return!e.trim().length}function th(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var nh=`Incorrect 'index' type`,rh=`Invalid doc index: must be a non-negative integer within the bounds of the docs array`,ih=e=>`Invalid value for key ${e}`,ah=e=>`Pattern length exceeds max of ${e}.`,oh=e=>`Missing ${e} property in key`,sh=e=>`Property 'weight' in key '${e}' must be a positive integer`,ch=`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.`,lh=Object.prototype.hasOwnProperty,uh=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(Jm(e)||Gm(e))r=e,t=fh(e),n=ph(e);else{if(!lh.call(e,`name`))throw Error(oh(`name`));let o=e.name;if(r=o,lh.call(e,`weight`)&&e.weight!==void 0&&(i=e.weight,i<=0))throw Error(sh(ph(o)));t=fh(o),n=ph(o),a=e.getFn??null}return{path:t,id:n,weight:i,src:r,getFn:a}}function fh(e){return Gm(e)?e:e.split(`.`)}function ph(e){return Gm(e)?e.join(`.`):e}function mh(e,t){let n=[],r=!1,i=(e,t,a,o)=>{if($m(e)){if(!t[a])n.push(o===void 0?e:{v:e,i:o});else{let s=e[t[a]];if(!$m(s))return;if(a===t.length-1&&(Jm(s)||Ym(s)||Xm(s)||typeof s==`bigint`))n.push(o===void 0?qm(s):{v:qm(s),i:o});else if(Gm(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,Jm(t)?t.split(`.`):t,0),r?n:n[0]}var hh={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},gh={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},_h={location:0,threshold:.6,distance:100},vh={useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:`any`,getFn:mh,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},Y=Object.freeze({...gh,...hh,..._h,...vh});function yh(e){return e>=9&&e<=13||e===32||e===160}function bh(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++)yh(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 xh=class{constructor({getFn:e=Y.getFn,fieldNormWeight:t=Y.fieldNormWeight}={}){this.norm=bh(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(Jm(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(rh);if(Jm(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(rh);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!$m(e)||eh(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($m(i)){if(Gm(i)){let e=[];for(let t=0,n=i.length;t<n;t+=1){let n=i[t];if($m(n)){if(Jm(n)){if(!eh(n)){let r={v:n,i:t,n:this.norm.get(n)};e.push(r)}}else if($m(n.v)){let t=Jm(n.v)?n.v:qm(n.v);if(!eh(t)){let r={v:t,i:n.i,n:this.norm.get(t)};e.push(r)}}}}n.$[t]=e}else if(Jm(i)&&!eh(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 Sh(e,t,{getFn:n=Y.getFn,fieldNormWeight:r=Y.fieldNormWeight}={}){let i=new xh({getFn:n,fieldNormWeight:r});return i.setKeys(e.map(dh)),i.setSources(t),i.create(),i}function Ch(e,{getFn:t=Y.getFn,fieldNormWeight:n=Y.fieldNormWeight}={}){let{keys:r,records:i}=e,a=new xh({getFn:t,fieldNormWeight:n});return a.setKeys(r),a.setIndexRecords(i),a}function wh(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 Th(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(ah(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=wh(_,s);e.length?c&&(w.indices=e):w.isMatch=!1}return w}function Eh(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 Dh(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 Oh={ł:`l`,Ł:`L`,đ:`d`,Đ:`D`,ø:`o`,Ø:`O`,ħ:`h`,Ħ:`H`,ŧ:`t`,Ŧ:`T`,ı:`i`,ß:`ss`},kh=RegExp(`[`+Object.keys(Oh).join(``)+`]`,`g`),Ah=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(kh,e=>Oh[e]):e=>e,jh=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?Ah(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;let u=(e,t)=>{this.chunks.push({pattern:e,alphabet:Eh(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?Ah(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}=Th(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=Dh(u)),p}},Mh=new Set([`fuzzy`,`include`]);function Nh(e){return e.startsWith(`inverse`)}var Ph=[{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 jh(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)}}}}],Fh=Ph.length,Ih=`\0`,Lh=`|`;function Rh(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 zh(e,t){let n=e.match(t);return n?n[1]:null}function Bh(e,t={}){return e.replace(/\\\|/g,Ih).split(Lh).map(e=>{let n=Rh(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<Fh;){let e=Ph[o],n=zh(i,e.multiRegex);n&&(r.push(e.create(n,t)),a=!0)}if(!a)for(o=-1;++o<Fh;){let e=Ph[o],n=zh(i,e.singleRegex);if(n){r.push(e.create(n,t));break}}}return r})}var Vh=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?Ah(e):e,this.pattern=e,this.query=Bh(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?Ah(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,Nh(r.type)&&(c=!0),n&&(Mh.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=Dh(o)),e}}return{isMatch:!1,score:1}}},Hh=[];function Uh(...e){Hh.push(...e)}function Wh(e,t){for(let n=0,r=Hh.length;n<r;n+=1){let r=Hh[n];if(r.condition(e,t))return new r(e,t)}return new jh(e,t)}var Gh={AND:`$and`,OR:`$or`},Kh={PATH:`$path`,PATTERN:`$val`},qh=e=>!!(e[Gh.AND]||e[Gh.OR]),Jh=e=>!!e[Kh.PATH],Yh=e=>!Gm(e)&&Zm(e)&&!qh(e),Xh=e=>({[Gh.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function Zh(e,t,{auto:n=!0}={}){let r=e=>{if(Jm(e)){let r={keyId:null,pattern:e};return n&&(r.searcher=Wh(e,t)),r}let i=Object.keys(e),a=Jh(e);if(!a&&i.length>1&&!qh(e))return r(Xh(e));if(Yh(e)){let r=a?e[Kh.PATH]:i[0],o=a?e[Kh.PATTERN]:e[r];if(!Jm(o))throw Error(ih(r));let s={keyId:ph(r),pattern:o};return n&&(s.searcher=Wh(o,t)),s}let o={children:[],operator:i[0]};return i.forEach(t=>{let n=e[t];Gm(n)&&n.forEach(e=>{o.children.push(r(e))})}),o};return qh(e)||(e=Xh(e)),r(e)}function Qh(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 $h(e,{ignoreFieldNorm:t=Y.ignoreFieldNorm}){e.forEach(e=>{e.score=Qh(e.matches,{ignoreFieldNorm:t})})}var eg=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 tg(e){let t=[];return e.matches.forEach(e=>{if(!$m(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 ng(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=tg(e)),r&&(a.score=e.score),a})}var rg=/[\p{L}\p{M}\p{N}_]+/gu,ig=new WeakSet;function ag(e){ig.has(e)||(ig.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 og(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||ag(e),t=>t.match(e)||[]):e=>e.match(rg)||[]}function sg({isCaseSensitive:e=!1,ignoreDiacritics:t=!1,tokenize:n}={}){let r=og(n);return{tokenize(n){return e||(n=n.toLowerCase()),t&&(n=Ah(n)),r(n)}}}var cg=class{static condition(e,t){return t.useTokenSearch}constructor(e,t){this.options=t,this.analyzer=sg({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 jh(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=Dh(t)),this.combineAll&&(this.useMask?c.matchedMask=a:c.matchedTerms=o,c.termCount=this.numTerms),c}};function lg(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 ug(e,t,n,r){let{i,v:a,$:o}=t;if(a!==void 0)lg(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)lg(e,t.v,i,r);else lg(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)ug(r,i,t,n);return r}function fg(e,t,n,r){ug(e,t,n,r)}function pg(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 mg(e,t){if(t.length===0)return;let n=Array.from(new Set(t)).sort((e,t)=>e-t);for(let t of n)pg(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 hg=class{constructor(e,t,n){this.options={...Y,...t},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new uh(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=Wh(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 xh))throw Error(nh);if(this._myIndex=t||Sh(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){let e=sg({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(!$m(e))return;this._docs.push(e);let t=this._myIndex.add(e,this._docs.length-1);if(this._invertedIndex&&t){let e=sg({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});fg(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&&mg(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(rh);this._invertedIndex&&mg(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(Jm(e)&&!e.trim()){let e=this._docs.map((e,t)=>({item:e,refIndex:t}));return Ym(n)&&n>-1&&(e=e.slice(0,n)),e}let c=a&&Ym(n)&&n>0&&Jm(e),l=o,u=(e,t)=>l(e,t)||e.idx-t.idx,d;if(c){let t=new eg(n,u);Jm(this._docs[0])?this._searchStringList(e,{heap:t,ignoreFieldNorm:s}):this._searchObjectList(e,{heap:t,ignoreFieldNorm:s}),d=t.extractSorted()}else d=Jm(e)?Jm(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e),$h(d,{ignoreFieldNorm:s}),a&&d.sort(Jm(e)?u:l),Ym(n)&&n>-1&&(d=d.slice(0,n));return ng(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(!$m(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=Qh(r.matches,{ignoreFieldNorm:n}),t.insert(r)):o.push(r)}}}),o}_searchLogical(e){let t=Zh(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===Gh.AND)return[]}return s},i=this._myIndex.records,a=new Map,o=[];return i.forEach(({$:e,i:n})=>{if($m(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(!$m(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=Qh(r.matches,{ignoreFieldNorm:n}),t.insert(r)):s.push(r)}}),s}_findMatches({key:e,value:t,searcher:n}){if(!$m(t))return[];let r=[];if(Gm(t))t.forEach(({v:t,i,n:a})=>{if(!$m(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}};hg.version=`7.5.0`,hg.createIndex=Sh,hg.parseIndex=Ch,hg.config=Y,hg.match=function(e,t,n){if(n&&n.useTokenSearch)throw Error(ch);return Wh(e,{...Y,...n}).searchIn(t)},hg.parseQuery=Zh,Uh(Vh),Uh(cg),hg.use=function(...e){e.forEach(e=>Uh(e))};var gg=hg;function _g(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?``:t.slice(n+1).toLowerCase()}var vg={ts:`code`,tsx:`code`,js:`code`,jsx:`code`,mjs:`code`,cjs:`code`,mts:`code`,cts:`code`,py:`code`,rb:`code`,go:`code`,rs:`code`,java:`code`,kt:`code`,kts:`code`,scala:`code`,c:`code`,h:`code`,cc:`code`,cpp:`code`,hpp:`code`,cs:`code`,swift:`code`,m:`code`,mm:`code`,php:`code`,pl:`code`,pm:`code`,lua:`code`,r:`code`,jl:`code`,ex:`code`,exs:`code`,erl:`code`,hs:`code`,dart:`code`,nim:`code`,zig:`code`,vue:`code`,svelte:`code`,astro:`code`,sh:`code`,bash:`code`,zsh:`code`,fish:`code`,ps1:`code`,bat:`code`,cmd:`code`,sql:`code`,graphql:`code`,gql:`code`,proto:`code`,tf:`code`,tfvars:`code`,hcl:`code`,sol:`code`,md:`markup`,mdx:`markup`,markdown:`markup`,txt:`markup`,text:`markup`,rst:`markup`,adoc:`markup`,org:`markup`,yaml:`config`,yml:`config`,toml:`config`,ini:`config`,cfg:`config`,conf:`config`,xml:`config`,env:`config`,properties:`config`,gitignore:`config`,editorconfig:`config`,eslintrc:`config`,prettierrc:`config`,css:`style`,scss:`style`,sass:`style`,less:`style`,stylus:`style`,pcss:`style`,postcss:`style`,png:`image`,jpg:`image`,jpeg:`image`,gif:`image`,bmp:`image`,webp:`image`,avif:`image`,ico:`image`,svg:`image`,tif:`image`,tiff:`image`,heic:`image`,psd:`image`,ai:`image`,json:`data`,jsonc:`data`,json5:`data`,csv:`data`,tsv:`data`,parquet:`data`,db:`data`,sqlite:`data`,sqlite3:`data`,ndjson:`data`,zip:`archive`,tar:`archive`,gz:`archive`,tgz:`archive`,bz2:`archive`,xz:`archive`,"7z":`archive`,rar:`archive`,zst:`archive`,jar:`archive`,war:`archive`,whl:`archive`,woff:`font`,woff2:`font`,ttf:`font`,otf:`font`,eot:`font`,exe:`binary`,dll:`binary`,so:`binary`,dylib:`binary`,bin:`binary`,o:`binary`,obj:`binary`,a:`binary`,lib:`binary`,class:`binary`,node:`binary`,pyc:`binary`,pyo:`binary`,pack:`binary`,idx:`binary`,iso:`binary`,dmg:`binary`,msi:`binary`,apk:`binary`,deb:`binary`,rpm:`binary`,pdf:`binary`,doc:`binary`,docx:`binary`,xls:`binary`,xlsx:`binary`,ppt:`binary`,pptx:`binary`,odt:`binary`,ods:`binary`,odp:`binary`,wasm:`binary`},yg={dockerfile:`config`,containerfile:`config`,makefile:`code`,cmakelists:`code`,rakefile:`code`,gemfile:`config`,procfile:`config`,license:`markup`,licence:`markup`,notice:`markup`,readme:`markup`,changelog:`markup`,authors:`markup`,contributing:`markup`,".gitignore":`config`,".gitattributes":`config`,".gitmodules":`config`,".npmrc":`config`,".nvmrc":`config`,".env":`config`};function bg(e){let t=yg[e.slice(e.lastIndexOf(`/`)+1).toLowerCase()];if(t)return t;let n=_g(e);return n?vg[n]??`generic`:`generic`}var xg={code:[`M6 4.5 2.5 8 6 11.5`,`M10 4.5 13.5 8 10 11.5`,`M9.2 3.5 6.8 12.5`],markup:[`M4 2.5h5l3 3v8a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-10a1 1 0 0 1 1-1z`,`M9 2.5v3h3`,`M5.5 8.5h5`,`M5.5 11h3.5`],config:[`M8 10.2a2.2 2.2 0 1 0 0-4.4 2.2 2.2 0 0 0 0 4.4z`,`M8 1.8v1.6`,`M8 12.6v1.6`,`M1.8 8h1.6`,`M12.6 8h1.6`,`M3.6 3.6l1.1 1.1`,`M11.3 11.3l1.1 1.1`,`M12.4 3.6l-1.1 1.1`,`M4.7 11.3l-1.1 1.1`],style:[`M8 13.5a5.5 5.5 0 1 1 0-11c3 0 5.5 2 5.5 4.5 0 1.4-1.1 2.2-2.3 2.2h-1c-.9 0-1.6.7-1.6 1.5 0 .4.2.7.4 1 .2.3.4.6.4 1a1.3 1.3 0 0 1-1.4.8z`,`M5.6 6.8h.01`,`M8.4 5.2h.01`,`M11 6.9h.01`],image:[`M2.5 4.5a1 1 0 0 1 1-1h9a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1h-9a1 1 0 0 1-1-1v-7z`,`M2.5 10.5 6 7.5l2.5 2 2-1.5 3 2.5`,`M5.8 6.4h.01`],data:[`M2.5 3.5h11v9h-11z`,`M2.5 8h11`,`M8 3.5v9`],archive:[`M2.5 5.5h11v8h-11z`,`M1.5 2.5h13v3h-13z`,`M6.8 8.5h2.4`],font:[`M3.5 13 8 3l4.5 10`,`M5.4 9.6h5.2`],binary:[`M2.5 4.5h11v7h-11z`,`M5 7h.01`,`M8 7h.01`,`M11 7h.01`,`M5 9.5h.01`,`M8 9.5h.01`],generic:[`M4 2.5h5l3 3v8a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-10a1 1 0 0 1 1-1z`,`M9 2.5v3h3`],folder:[`M2.5 4.5a1 1 0 0 1 1-1h3l1.5 2h4.5a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1h-9a1 1 0 0 1-1-1v-8z`],"folder-open":[`M2.5 12.5v-8a1 1 0 0 1 1-1h3l1.5 2h4.5a1 1 0 0 1 1 1v1`,`M2.5 12.5 4.6 6.8a1 1 0 0 1 .95-.7h8.1a.6.6 0 0 1 .55.85L12.9 12.5a1 1 0 0 1-.95.7H3.5a1 1 0 0 1-1-1z`]};function Sg({path:e,category:t,size:n=14}){let r=t??bg(e??``),i=xg[r]??xg.generic;return(0,V.jsx)(`svg`,{className:`file-icon file-icon-${r}`,"data-file-icon":r,width:n,height:n,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,focusable:`false`,children:i.map((e,t)=>(0,V.jsx)(`path`,{d:e},t))})}var Cg=`modulepreload`,wg=function(e){return`/`+e},Tg={},Eg=function(e){return e.pathname.endsWith(`.css`)},Dg=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},Og=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=wg(t,n);let r=s(t),i=Eg(r);return Dg(Tg,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`:Cg,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)})},kg=4e3,Ag=(0,B.lazy)(()=>Og(()=>import(`./CodeMirrorEditor-D9UWxggU.js`).then(e=>({default:e.CodeMirrorEditor})),[])),jg=class extends Error{status;body;constructor(e,t){super(t.error||`HTTP ${e}`),this.status=e,this.body=t,this.name=`ApiError`}},Mg=15e3,Ng=e=>new jg(408,{error:`请求超时:${Mg/1e3} 秒内服务端没有响应`,code:`timeout`,details:{path:e}});async function Pg(e,t){let n=new AbortController,r=setTimeout(()=>n.abort(),Mg);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 jg(r.status,i??{error:`HTTP ${r.status}`});return i}catch(t){throw n.signal.aborted?Ng(e):t}finally{clearTimeout(r)}}var Fg=e=>e instanceof jg?e:new jg(0,{error:e instanceof Error?e.message:`读取失败`}),Ig=e=>encodeURIComponent(e),Lg=(e,t)=>`/api/files?workspaceId=${Ig(e)}&path=${Ig(t)}`,Rg=(e,t)=>`/api/file?workspaceId=${Ig(e)}&path=${Ig(t)}`,zg=(e,t)=>`/api/file?workspaceId=${Ig(e)}&path=${Ig(t)}&meta=1`,Bg=(e,t)=>`/api/files?workspaceId=${Ig(e)}&q=${Ig(t)}`,Vg=e=>e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`,Hg=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?``:new Date(e).toLocaleTimeString(`zh-CN`,{hour:`2-digit`,minute:`2-digit`})};function Ug({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,B.useEffect)(()=>{p&&f===void 0&&o(t)},[p,t,f,o]),(0,V.jsxs)(`li`,{className:`file-node`,"data-file-dir":t,"data-file-dir-changed":c.has(t)?`1`:`0`,children:[(0,V.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,V.jsx)(`span`,{className:`file-caret`,"aria-hidden":`true`,children:p?`▾`:`▸`}),(0,V.jsx)(Sg,{category:`folder`}),(0,V.jsx)(`span`,{className:`file-name`,children:n}),c.has(t)&&(0,V.jsx)(`span`,{className:`file-badge file-badge-changed`,"data-file-dir-changed-badge":t,title:`里面有 agent 改过的文件`,children:`✎`})]}),p&&(0,V.jsx)(`ul`,{className:`file-children`,children:f===void 0?(0,V.jsx)(`li`,{className:`file-row-loading`,"data-file-loading":t,children:`读取中…`}):`error`in f?(0,V.jsx)(`li`,{className:`file-row-error`,"data-file-error":t,title:Zf(f.error.message),children:Xf(f.error.message,`这个目录读取失败。`)}):f.entries.length===0?(0,V.jsx)(`li`,{className:`file-row-empty`,"data-file-empty":t,children:`空目录`}):(0,V.jsxs)(V.Fragment,{children:[f.truncated&&(0,V.jsx)(`li`,{className:`file-row-empty`,"data-file-truncated":t,children:`条目过多,只显示前一部分`}),f.entries.map(t=>t.kind===`directory`?(0,V.jsx)(Ug,{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,V.jsx)(Wg,{entry:t,depth:d+1,openPaths:s,changedPaths:l,onOpen:u},t.path))]})})]})}function Wg({entry:e,depth:t,openPaths:n,changedPaths:r,onOpen:i}){if(e.kind===`symlink`)return(0,V.jsx)(`li`,{className:`file-node`,"data-file-entry":e.path,"data-file-outside":e.path,children:(0,V.jsxs)(`button`,{type:`button`,className:`file-row file-row-file`,disabled:!0,title:`${e.path} 是一个指向 workspace 之外的符号链接,不能打开`,style:{paddingLeft:`${8+t*13}px`},children:[(0,V.jsx)(`span`,{className:`file-caret`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`file-name`,children:e.name}),(0,V.jsx)(`span`,{className:`file-badge`,"data-file-outside-badge":`1`,children:`外部链接`})]})});let a=n.has(e.path),o=r.has(e.path);return(0,V.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,V.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,V.jsx)(`span`,{className:`file-caret`,"aria-hidden":`true`}),(0,V.jsx)(Sg,{path:e.path}),(0,V.jsx)(`span`,{className:`file-name`,children:e.name}),a&&(0,V.jsx)(`span`,{className:`file-open-mark`,"data-file-open-mark":e.path,title:`已经打开`,"aria-label":`已经打开`,children:`●`}),o&&(0,V.jsx)(`span`,{className:`file-badge file-badge-changed`,"data-file-changed":e.path,title:`agent 改过这个文件`,children:`✎ 已改`}),!e.text&&(0,V.jsx)(`span`,{className:`file-badge`,"data-file-binary":`1`,"aria-label":`不支持的文件类型`,children:`不支持`})]})})}function Gg({file:e,state:t,message:n,external:r,jumpToLine:i,onChange:a,onSave:o,onReload:s,onOverwrite:c}){let[l,u]=(0,B.useState)(!0),d=(0,B.useRef)(null);(0,B.useEffect)(()=>{i&&u(!1)},[e.path,i]),(0,B.useEffect)(()=>{let e=d.current;if(!i||!e)return;let t=Math.min(i.line,e.value.split(`
47
+ `),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 Wm(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 Gm(e){return Array.isArray?Array.isArray(e):th(e)===`[object Array]`}function Km(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 qm(e){return e==null?``:Km(e)}function Jm(e){return typeof e==`string`}function Ym(e){return typeof e==`number`}function Xm(e){return e===!0||e===!1||Qm(e)&&th(e)==`[object Boolean]`}function Zm(e){return typeof e==`object`}function Qm(e){return Zm(e)&&e!==null}function $m(e){return e!=null}function eh(e){return!e.trim().length}function th(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var nh=`Incorrect 'index' type`,rh=`Invalid doc index: must be a non-negative integer within the bounds of the docs array`,ih=e=>`Invalid value for key ${e}`,ah=e=>`Pattern length exceeds max of ${e}.`,oh=e=>`Missing ${e} property in key`,sh=e=>`Property 'weight' in key '${e}' must be a positive integer`,ch=`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.`,lh=Object.prototype.hasOwnProperty,uh=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(Jm(e)||Gm(e))r=e,t=fh(e),n=ph(e);else{if(!lh.call(e,`name`))throw Error(oh(`name`));let o=e.name;if(r=o,lh.call(e,`weight`)&&e.weight!==void 0&&(i=e.weight,i<=0))throw Error(sh(ph(o)));t=fh(o),n=ph(o),a=e.getFn??null}return{path:t,id:n,weight:i,src:r,getFn:a}}function fh(e){return Gm(e)?e:e.split(`.`)}function ph(e){return Gm(e)?e.join(`.`):e}function mh(e,t){let n=[],r=!1,i=(e,t,a,o)=>{if($m(e)){if(!t[a])n.push(o===void 0?e:{v:e,i:o});else{let s=e[t[a]];if(!$m(s))return;if(a===t.length-1&&(Jm(s)||Ym(s)||Xm(s)||typeof s==`bigint`))n.push(o===void 0?qm(s):{v:qm(s),i:o});else if(Gm(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,Jm(t)?t.split(`.`):t,0),r?n:n[0]}var hh={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},gh={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},_h={location:0,threshold:.6,distance:100},vh={useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:`any`,getFn:mh,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},Y=Object.freeze({...gh,...hh,..._h,...vh});function yh(e){return e>=9&&e<=13||e===32||e===160}function bh(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++)yh(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 xh=class{constructor({getFn:e=Y.getFn,fieldNormWeight:t=Y.fieldNormWeight}={}){this.norm=bh(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(Jm(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(rh);if(Jm(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(rh);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!$m(e)||eh(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($m(i)){if(Gm(i)){let e=[];for(let t=0,n=i.length;t<n;t+=1){let n=i[t];if($m(n)){if(Jm(n)){if(!eh(n)){let r={v:n,i:t,n:this.norm.get(n)};e.push(r)}}else if($m(n.v)){let t=Jm(n.v)?n.v:qm(n.v);if(!eh(t)){let r={v:t,i:n.i,n:this.norm.get(t)};e.push(r)}}}}n.$[t]=e}else if(Jm(i)&&!eh(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 Sh(e,t,{getFn:n=Y.getFn,fieldNormWeight:r=Y.fieldNormWeight}={}){let i=new xh({getFn:n,fieldNormWeight:r});return i.setKeys(e.map(dh)),i.setSources(t),i.create(),i}function Ch(e,{getFn:t=Y.getFn,fieldNormWeight:n=Y.fieldNormWeight}={}){let{keys:r,records:i}=e,a=new xh({getFn:t,fieldNormWeight:n});return a.setKeys(r),a.setIndexRecords(i),a}function wh(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 Th(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(ah(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=wh(_,s);e.length?c&&(w.indices=e):w.isMatch=!1}return w}function Eh(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 Dh(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 Oh={ł:`l`,Ł:`L`,đ:`d`,Đ:`D`,ø:`o`,Ø:`O`,ħ:`h`,Ħ:`H`,ŧ:`t`,Ŧ:`T`,ı:`i`,ß:`ss`},kh=RegExp(`[`+Object.keys(Oh).join(``)+`]`,`g`),Ah=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(kh,e=>Oh[e]):e=>e,jh=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?Ah(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;let u=(e,t)=>{this.chunks.push({pattern:e,alphabet:Eh(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?Ah(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}=Th(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=Dh(u)),p}},Mh=new Set([`fuzzy`,`include`]);function Nh(e){return e.startsWith(`inverse`)}var Ph=[{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 jh(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)}}}}],Fh=Ph.length,Ih=`\0`,Lh=`|`;function Rh(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 zh(e,t){let n=e.match(t);return n?n[1]:null}function Bh(e,t={}){return e.replace(/\\\|/g,Ih).split(Lh).map(e=>{let n=Rh(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<Fh;){let e=Ph[o],n=zh(i,e.multiRegex);n&&(r.push(e.create(n,t)),a=!0)}if(!a)for(o=-1;++o<Fh;){let e=Ph[o],n=zh(i,e.singleRegex);if(n){r.push(e.create(n,t));break}}}return r})}var Vh=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?Ah(e):e,this.pattern=e,this.query=Bh(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?Ah(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,Nh(r.type)&&(c=!0),n&&(Mh.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=Dh(o)),e}}return{isMatch:!1,score:1}}},Hh=[];function Uh(...e){Hh.push(...e)}function Wh(e,t){for(let n=0,r=Hh.length;n<r;n+=1){let r=Hh[n];if(r.condition(e,t))return new r(e,t)}return new jh(e,t)}var Gh={AND:`$and`,OR:`$or`},Kh={PATH:`$path`,PATTERN:`$val`},qh=e=>!!(e[Gh.AND]||e[Gh.OR]),Jh=e=>!!e[Kh.PATH],Yh=e=>!Gm(e)&&Zm(e)&&!qh(e),Xh=e=>({[Gh.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function Zh(e,t,{auto:n=!0}={}){let r=e=>{if(Jm(e)){let r={keyId:null,pattern:e};return n&&(r.searcher=Wh(e,t)),r}let i=Object.keys(e),a=Jh(e);if(!a&&i.length>1&&!qh(e))return r(Xh(e));if(Yh(e)){let r=a?e[Kh.PATH]:i[0],o=a?e[Kh.PATTERN]:e[r];if(!Jm(o))throw Error(ih(r));let s={keyId:ph(r),pattern:o};return n&&(s.searcher=Wh(o,t)),s}let o={children:[],operator:i[0]};return i.forEach(t=>{let n=e[t];Gm(n)&&n.forEach(e=>{o.children.push(r(e))})}),o};return qh(e)||(e=Xh(e)),r(e)}function Qh(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 $h(e,{ignoreFieldNorm:t=Y.ignoreFieldNorm}){e.forEach(e=>{e.score=Qh(e.matches,{ignoreFieldNorm:t})})}var eg=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 tg(e){let t=[];return e.matches.forEach(e=>{if(!$m(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 ng(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=tg(e)),r&&(a.score=e.score),a})}var rg=/[\p{L}\p{M}\p{N}_]+/gu,ig=new WeakSet;function ag(e){ig.has(e)||(ig.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 og(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||ag(e),t=>t.match(e)||[]):e=>e.match(rg)||[]}function sg({isCaseSensitive:e=!1,ignoreDiacritics:t=!1,tokenize:n}={}){let r=og(n);return{tokenize(n){return e||(n=n.toLowerCase()),t&&(n=Ah(n)),r(n)}}}var cg=class{static condition(e,t){return t.useTokenSearch}constructor(e,t){this.options=t,this.analyzer=sg({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 jh(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=Dh(t)),this.combineAll&&(this.useMask?c.matchedMask=a:c.matchedTerms=o,c.termCount=this.numTerms),c}};function lg(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 ug(e,t,n,r){let{i,v:a,$:o}=t;if(a!==void 0)lg(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)lg(e,t.v,i,r);else lg(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)ug(r,i,t,n);return r}function fg(e,t,n,r){ug(e,t,n,r)}function pg(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 mg(e,t){if(t.length===0)return;let n=Array.from(new Set(t)).sort((e,t)=>e-t);for(let t of n)pg(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 hg=class{constructor(e,t,n){this.options={...Y,...t},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new uh(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=Wh(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 xh))throw Error(nh);if(this._myIndex=t||Sh(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){let e=sg({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(!$m(e))return;this._docs.push(e);let t=this._myIndex.add(e,this._docs.length-1);if(this._invertedIndex&&t){let e=sg({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});fg(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&&mg(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(rh);this._invertedIndex&&mg(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(Jm(e)&&!e.trim()){let e=this._docs.map((e,t)=>({item:e,refIndex:t}));return Ym(n)&&n>-1&&(e=e.slice(0,n)),e}let c=a&&Ym(n)&&n>0&&Jm(e),l=o,u=(e,t)=>l(e,t)||e.idx-t.idx,d;if(c){let t=new eg(n,u);Jm(this._docs[0])?this._searchStringList(e,{heap:t,ignoreFieldNorm:s}):this._searchObjectList(e,{heap:t,ignoreFieldNorm:s}),d=t.extractSorted()}else d=Jm(e)?Jm(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e),$h(d,{ignoreFieldNorm:s}),a&&d.sort(Jm(e)?u:l),Ym(n)&&n>-1&&(d=d.slice(0,n));return ng(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(!$m(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=Qh(r.matches,{ignoreFieldNorm:n}),t.insert(r)):o.push(r)}}}),o}_searchLogical(e){let t=Zh(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===Gh.AND)return[]}return s},i=this._myIndex.records,a=new Map,o=[];return i.forEach(({$:e,i:n})=>{if($m(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(!$m(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=Qh(r.matches,{ignoreFieldNorm:n}),t.insert(r)):s.push(r)}}),s}_findMatches({key:e,value:t,searcher:n}){if(!$m(t))return[];let r=[];if(Gm(t))t.forEach(({v:t,i,n:a})=>{if(!$m(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}};hg.version=`7.5.0`,hg.createIndex=Sh,hg.parseIndex=Ch,hg.config=Y,hg.match=function(e,t,n){if(n&&n.useTokenSearch)throw Error(ch);return Wh(e,{...Y,...n}).searchIn(t)},hg.parseQuery=Zh,Uh(Vh),Uh(cg),hg.use=function(...e){e.forEach(e=>Uh(e))};var gg=hg;function _g(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?``:t.slice(n+1).toLowerCase()}var vg={ts:`code`,tsx:`code`,js:`code`,jsx:`code`,mjs:`code`,cjs:`code`,mts:`code`,cts:`code`,py:`code`,rb:`code`,go:`code`,rs:`code`,java:`code`,kt:`code`,kts:`code`,scala:`code`,c:`code`,h:`code`,cc:`code`,cpp:`code`,hpp:`code`,cs:`code`,swift:`code`,m:`code`,mm:`code`,php:`code`,pl:`code`,pm:`code`,lua:`code`,r:`code`,jl:`code`,ex:`code`,exs:`code`,erl:`code`,hs:`code`,dart:`code`,nim:`code`,zig:`code`,vue:`code`,svelte:`code`,astro:`code`,sh:`code`,bash:`code`,zsh:`code`,fish:`code`,ps1:`code`,bat:`code`,cmd:`code`,sql:`code`,graphql:`code`,gql:`code`,proto:`code`,tf:`code`,tfvars:`code`,hcl:`code`,sol:`code`,md:`markup`,mdx:`markup`,markdown:`markup`,txt:`markup`,text:`markup`,rst:`markup`,adoc:`markup`,org:`markup`,yaml:`config`,yml:`config`,toml:`config`,ini:`config`,cfg:`config`,conf:`config`,xml:`config`,env:`config`,properties:`config`,gitignore:`config`,editorconfig:`config`,eslintrc:`config`,prettierrc:`config`,css:`style`,scss:`style`,sass:`style`,less:`style`,stylus:`style`,pcss:`style`,postcss:`style`,png:`image`,jpg:`image`,jpeg:`image`,gif:`image`,bmp:`image`,webp:`image`,avif:`image`,ico:`image`,svg:`image`,tif:`image`,tiff:`image`,heic:`image`,psd:`image`,ai:`image`,json:`data`,jsonc:`data`,json5:`data`,csv:`data`,tsv:`data`,parquet:`data`,db:`data`,sqlite:`data`,sqlite3:`data`,ndjson:`data`,zip:`archive`,tar:`archive`,gz:`archive`,tgz:`archive`,bz2:`archive`,xz:`archive`,"7z":`archive`,rar:`archive`,zst:`archive`,jar:`archive`,war:`archive`,whl:`archive`,woff:`font`,woff2:`font`,ttf:`font`,otf:`font`,eot:`font`,exe:`binary`,dll:`binary`,so:`binary`,dylib:`binary`,bin:`binary`,o:`binary`,obj:`binary`,a:`binary`,lib:`binary`,class:`binary`,node:`binary`,pyc:`binary`,pyo:`binary`,pack:`binary`,idx:`binary`,iso:`binary`,dmg:`binary`,msi:`binary`,apk:`binary`,deb:`binary`,rpm:`binary`,pdf:`binary`,doc:`binary`,docx:`binary`,xls:`binary`,xlsx:`binary`,ppt:`binary`,pptx:`binary`,odt:`binary`,ods:`binary`,odp:`binary`,wasm:`binary`},yg={dockerfile:`config`,containerfile:`config`,makefile:`code`,cmakelists:`code`,rakefile:`code`,gemfile:`config`,procfile:`config`,license:`markup`,licence:`markup`,notice:`markup`,readme:`markup`,changelog:`markup`,authors:`markup`,contributing:`markup`,".gitignore":`config`,".gitattributes":`config`,".gitmodules":`config`,".npmrc":`config`,".nvmrc":`config`,".env":`config`};function bg(e){let t=yg[e.slice(e.lastIndexOf(`/`)+1).toLowerCase()];if(t)return t;let n=_g(e);return n?vg[n]??`generic`:`generic`}var xg={code:[`M6 4.5 2.5 8 6 11.5`,`M10 4.5 13.5 8 10 11.5`,`M9.2 3.5 6.8 12.5`],markup:[`M4 2.5h5l3 3v8a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-10a1 1 0 0 1 1-1z`,`M9 2.5v3h3`,`M5.5 8.5h5`,`M5.5 11h3.5`],config:[`M8 10.2a2.2 2.2 0 1 0 0-4.4 2.2 2.2 0 0 0 0 4.4z`,`M8 1.8v1.6`,`M8 12.6v1.6`,`M1.8 8h1.6`,`M12.6 8h1.6`,`M3.6 3.6l1.1 1.1`,`M11.3 11.3l1.1 1.1`,`M12.4 3.6l-1.1 1.1`,`M4.7 11.3l-1.1 1.1`],style:[`M8 13.5a5.5 5.5 0 1 1 0-11c3 0 5.5 2 5.5 4.5 0 1.4-1.1 2.2-2.3 2.2h-1c-.9 0-1.6.7-1.6 1.5 0 .4.2.7.4 1 .2.3.4.6.4 1a1.3 1.3 0 0 1-1.4.8z`,`M5.6 6.8h.01`,`M8.4 5.2h.01`,`M11 6.9h.01`],image:[`M2.5 4.5a1 1 0 0 1 1-1h9a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1h-9a1 1 0 0 1-1-1v-7z`,`M2.5 10.5 6 7.5l2.5 2 2-1.5 3 2.5`,`M5.8 6.4h.01`],data:[`M2.5 3.5h11v9h-11z`,`M2.5 8h11`,`M8 3.5v9`],archive:[`M2.5 5.5h11v8h-11z`,`M1.5 2.5h13v3h-13z`,`M6.8 8.5h2.4`],font:[`M3.5 13 8 3l4.5 10`,`M5.4 9.6h5.2`],binary:[`M2.5 4.5h11v7h-11z`,`M5 7h.01`,`M8 7h.01`,`M11 7h.01`,`M5 9.5h.01`,`M8 9.5h.01`],generic:[`M4 2.5h5l3 3v8a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-10a1 1 0 0 1 1-1z`,`M9 2.5v3h3`],folder:[`M2.5 4.5a1 1 0 0 1 1-1h3l1.5 2h4.5a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1h-9a1 1 0 0 1-1-1v-8z`],"folder-open":[`M2.5 12.5v-8a1 1 0 0 1 1-1h3l1.5 2h4.5a1 1 0 0 1 1 1v1`,`M2.5 12.5 4.6 6.8a1 1 0 0 1 .95-.7h8.1a.6.6 0 0 1 .55.85L12.9 12.5a1 1 0 0 1-.95.7H3.5a1 1 0 0 1-1-1z`]};function Sg({path:e,category:t,size:n=14}){let r=t??bg(e??``),i=xg[r]??xg.generic;return(0,V.jsx)(`svg`,{className:`file-icon file-icon-${r}`,"data-file-icon":r,width:n,height:n,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,focusable:`false`,children:i.map((e,t)=>(0,V.jsx)(`path`,{d:e},t))})}var Cg=`modulepreload`,wg=function(e){return`/`+e},Tg={},Eg=function(e){return e.pathname.endsWith(`.css`)},Dg=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},Og=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=wg(t,n);let r=s(t),i=Eg(r);return Dg(Tg,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`:Cg,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)})},kg=4e3,Ag=(0,B.lazy)(()=>Og(()=>import(`./CodeMirrorEditor-B3fdsbQG.js`).then(e=>({default:e.CodeMirrorEditor})),[])),jg=class extends Error{status;body;constructor(e,t){super(t.error||`HTTP ${e}`),this.status=e,this.body=t,this.name=`ApiError`}},Mg=15e3,Ng=e=>new jg(408,{error:`请求超时:${Mg/1e3} 秒内服务端没有响应`,code:`timeout`,details:{path:e}});async function Pg(e,t){let n=new AbortController,r=setTimeout(()=>n.abort(),Mg);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 jg(r.status,i??{error:`HTTP ${r.status}`});return i}catch(t){throw n.signal.aborted?Ng(e):t}finally{clearTimeout(r)}}var Fg=e=>e instanceof jg?e:new jg(0,{error:e instanceof Error?e.message:`读取失败`}),Ig=e=>encodeURIComponent(e),Lg=(e,t)=>`/api/files?workspaceId=${Ig(e)}&path=${Ig(t)}`,Rg=(e,t)=>`/api/file?workspaceId=${Ig(e)}&path=${Ig(t)}`,zg=(e,t)=>`/api/file?workspaceId=${Ig(e)}&path=${Ig(t)}&meta=1`,Bg=(e,t)=>`/api/files?workspaceId=${Ig(e)}&q=${Ig(t)}`,Vg=e=>e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`,Hg=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?``:new Date(e).toLocaleTimeString(`zh-CN`,{hour:`2-digit`,minute:`2-digit`})};function Ug({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,B.useEffect)(()=>{p&&f===void 0&&o(t)},[p,t,f,o]),(0,V.jsxs)(`li`,{className:`file-node`,"data-file-dir":t,"data-file-dir-changed":c.has(t)?`1`:`0`,children:[(0,V.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,V.jsx)(`span`,{className:`file-caret`,"aria-hidden":`true`,children:p?`▾`:`▸`}),(0,V.jsx)(Sg,{category:`folder`}),(0,V.jsx)(`span`,{className:`file-name`,children:n}),c.has(t)&&(0,V.jsx)(`span`,{className:`file-badge file-badge-changed`,"data-file-dir-changed-badge":t,title:`里面有 agent 改过的文件`,children:`✎`})]}),p&&(0,V.jsx)(`ul`,{className:`file-children`,children:f===void 0?(0,V.jsx)(`li`,{className:`file-row-loading`,"data-file-loading":t,children:`读取中…`}):`error`in f?(0,V.jsx)(`li`,{className:`file-row-error`,"data-file-error":t,title:Zf(f.error.message),children:Xf(f.error.message,`这个目录读取失败。`)}):f.entries.length===0?(0,V.jsx)(`li`,{className:`file-row-empty`,"data-file-empty":t,children:`空目录`}):(0,V.jsxs)(V.Fragment,{children:[f.truncated&&(0,V.jsx)(`li`,{className:`file-row-empty`,"data-file-truncated":t,children:`条目过多,只显示前一部分`}),f.entries.map(t=>t.kind===`directory`?(0,V.jsx)(Ug,{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,V.jsx)(Wg,{entry:t,depth:d+1,openPaths:s,changedPaths:l,onOpen:u},t.path))]})})]})}function Wg({entry:e,depth:t,openPaths:n,changedPaths:r,onOpen:i}){if(e.kind===`symlink`)return(0,V.jsx)(`li`,{className:`file-node`,"data-file-entry":e.path,"data-file-outside":e.path,children:(0,V.jsxs)(`button`,{type:`button`,className:`file-row file-row-file`,disabled:!0,title:`${e.path} 是一个指向 workspace 之外的符号链接,不能打开`,style:{paddingLeft:`${8+t*13}px`},children:[(0,V.jsx)(`span`,{className:`file-caret`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`file-name`,children:e.name}),(0,V.jsx)(`span`,{className:`file-badge`,"data-file-outside-badge":`1`,children:`外部链接`})]})});let a=n.has(e.path),o=r.has(e.path);return(0,V.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,V.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,V.jsx)(`span`,{className:`file-caret`,"aria-hidden":`true`}),(0,V.jsx)(Sg,{path:e.path}),(0,V.jsx)(`span`,{className:`file-name`,children:e.name}),a&&(0,V.jsx)(`span`,{className:`file-open-mark`,"data-file-open-mark":e.path,title:`已经打开`,"aria-label":`已经打开`,children:`●`}),o&&(0,V.jsx)(`span`,{className:`file-badge file-badge-changed`,"data-file-changed":e.path,title:`agent 改过这个文件`,children:`✎ 已改`}),!e.text&&(0,V.jsx)(`span`,{className:`file-badge`,"data-file-binary":`1`,"aria-label":`不支持的文件类型`,children:`不支持`})]})})}function Gg({file:e,state:t,message:n,external:r,jumpToLine:i,onChange:a,onSave:o,onReload:s,onOverwrite:c}){let[l,u]=(0,B.useState)(!0),d=(0,B.useRef)(null);(0,B.useEffect)(()=>{i&&u(!1)},[e.path,i]),(0,B.useEffect)(()=>{let e=d.current;if(!i||!e)return;let t=Math.min(i.line,e.value.split(`
48
48
  `).length),n=e.value.split(`
49
49
  `),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,l]);let f=/\.md$/i.test(e.path);return(0,V.jsxs)(`div`,{className:`file-editor`,"data-file-editor":e.path,"data-save-state":t,children:[(0,V.jsxs)(`div`,{className:`file-editor-head`,children:[(0,V.jsx)(`span`,{className:`file-editor-path`,title:e.path,children:e.path}),(0,V.jsxs)(`span`,{className:`file-editor-flags`,children:[f&&(0,V.jsx)(`button`,{type:`button`,className:`file-preview-toggle`,onClick:()=>u(e=>!e),children:l?`原文`:`预览`}),e.dirty&&(0,V.jsx)(`span`,{className:`file-dirty`,"data-file-dirty":`1`,children:`未保存`}),(0,V.jsx)(`button`,{type:`button`,className:`file-save`,"data-file-save":e.path,onClick:o,disabled:t===`saving`,children:t===`saving`?`保存中…`:`保存`})]})]}),r&&t!==`conflict`&&(0,V.jsxs)(`div`,{className:`file-conflict`,"data-file-external":e.path,role:`alert`,children:[(0,V.jsx)(`p`,{children:`这个文件在磁盘上已经被改过了,你的修改还没有覆盖它。`}),(0,V.jsxs)(`div`,{className:`file-conflict-actions`,children:[(0,V.jsx)(`button`,{type:`button`,"data-file-reload":e.path,onClick:s,children:`丢掉我的修改,读磁盘版本`}),(0,V.jsx)(`button`,{type:`button`,"data-file-overwrite":e.path,onClick:c,children:`仍然覆盖磁盘`})]})]}),t===`conflict`&&(0,V.jsxs)(`div`,{className:`file-conflict`,"data-file-conflict":e.path,role:`alert`,children:[(0,V.jsx)(`p`,{children:`保存被拒绝:这个文件在磁盘上已经被改过了,覆盖会丢掉对方的改动。`}),(0,V.jsxs)(`div`,{className:`file-conflict-actions`,children:[(0,V.jsx)(`button`,{type:`button`,"data-file-reload":e.path,onClick:s,children:`丢掉我的修改,读磁盘版本`}),(0,V.jsx)(`button`,{type:`button`,"data-file-overwrite":e.path,onClick:c,children:`仍然覆盖磁盘`})]})]}),n&&t!==`conflict`&&!r&&(0,V.jsx)(`p`,{className:`file-editor-message file-message-${t}`,"data-file-message":t,role:`status`,children:n}),f&&l?(0,V.jsx)(`div`,{className:`file-markdown-preview`,"data-file-preview":`markdown`,children:(0,V.jsx)(hm,{source:e.content})}):(0,V.jsx)(B.Suspense,{fallback:(0,V.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,V.jsx)(`span`,{className:`file-cm-status`,"data-file-editor-loading":`1`,children:`⌛ 正在加载编辑器…`})}),children:(0,V.jsx)(Ag,{path:e.path,value:e.content,onChange:a,jumpToLine:i,onSave:o})})]})}function Kg({line:e}){if(e.kind===`fold`)return(0,V.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,V.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,V.jsx)(`span`,{className:`file-diff-mark`,"aria-hidden":`true`,children:t}),(0,V.jsx)(`span`,{className:`file-diff-number`,"aria-hidden":`true`,children:e.oldLine??``}),(0,V.jsx)(`span`,{className:`file-diff-number`,"aria-hidden":`true`,children:e.newLine??``}),(0,V.jsx)(`span`,{className:`file-diff-text`,children:e.text}),e.noNewline&&(0,V.jsx)(`span`,{className:`file-diff-no-newline`,title:`这个版本的末尾没有换行`,children:`(末尾无换行)`})]})}function qg({diff:e,loading:t,error:n,bufferContent:r,mode:i,onMode:a}){if(t)return(0,V.jsx)(`div`,{className:`file-diff`,"data-file-diff-state":`loading`,children:(0,V.jsx)(`p`,{className:`rail-empty`,"data-file-diff-loading":`1`,children:`正在读取差异…`})});if(n)return(0,V.jsx)(`div`,{className:`file-diff`,"data-file-diff-state":`error`,children:(0,V.jsx)(`p`,{className:`rail-empty`,"data-file-diff-error":`1`,title:Zf(n),children:Xf(n,`这个文件的差异读取失败。`)})});if(!e)return(0,V.jsx)(`div`,{className:`file-diff`,"data-file-diff-state":`empty`,children:(0,V.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,V.jsxs)(`span`,{className:`file-diff-switch`,"data-file-diff-switch":`1`,children:[(0,V.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,V.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,V.jsxs)(`div`,{className:`file-diff`,"data-file-diff-state":`none`,"data-file-diff-baseline":d,children:[(0,V.jsxs)(`div`,{className:`file-editor-head`,children:[(0,V.jsx)(`span`,{className:`file-editor-path`,title:e.path,children:e.path}),(0,V.jsx)(`span`,{className:`file-editor-flags`,children:f})]}),(0,V.jsx)(`p`,{className:`file-diff-nobaseline`,"data-file-diff-nobaseline":`1`,children:u})]});let p=Um(c,l),m=Wm(p);return(0,V.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,V.jsxs)(`div`,{className:`file-editor-head`,children:[(0,V.jsx)(`span`,{className:`file-editor-path`,title:e.path,children:e.path}),(0,V.jsxs)(`span`,{className:`file-editor-flags`,children:[f,(0,V.jsx)(`span`,{className:`file-diff-baseline`,"data-file-diff-label":`1`,children:u}),(0,V.jsxs)(`span`,{className:`file-diff-count`,"data-file-diff-count":`1`,children:[`+`,p.added,` / -`,p.removed]})]})]}),e.beforeUnknown&&!s&&(0,V.jsx)(`p`,{className:`file-diff-warning`,"data-file-diff-before-unknown":`1`,role:`status`,children:`读不到改动前的版本(文件太大或无法读取),这里只显示现在的内容。`}),e.before===null&&!e.beforeUnknown&&!s&&(0,V.jsx)(`p`,{className:`file-diff-warning`,"data-file-diff-is-new":`1`,role:`status`,children:`这个文件是新建的,下面是它的全部内容。`}),p.identical?(0,V.jsx)(`p`,{className:`file-diff-nobaseline`,"data-file-diff-identical":`1`,children:`两个版本没有区别。`}):(0,V.jsx)(`div`,{className:`file-diff-body`,"data-file-diff-body":`1`,children:m.lines.map((e,t)=>(0,V.jsx)(Kg,{line:e},t))})]})}function Jg({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,V.jsxs)(`div`,{className:`rail-empty file-problem`,"data-file-root-error":`1`,"data-file-error-kind":r,role:`alert`,children:[r===`missing`&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{className:`file-problem-title`,"data-file-error-title":`1`,children:`工作区路径不存在,无法读取文件。`}),(0,V.jsx)(`p`,{className:`file-problem-hint`,children:`请确认这个路径是写错了,还是目录被移动或删除了:`}),(0,V.jsx)(`code`,{className:`file-problem-path`,"data-file-error-path":`1`,children:n||Xf(e.message,`路径未知`)})]}),r===`timeout`&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{className:`file-problem-title`,"data-file-error-title":`1`,children:`读取超时,服务端没有回应。`}),(0,V.jsxs)(`p`,{className:`file-problem-hint`,children:[`已经等了 `,Mg/1e3,` 秒。如果这个工作区在网络盘上,请检查它是否已连接,然后点上面的 ↻ 重试。`]})]}),r===`failed`&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{className:`file-problem-title`,"data-file-error-title":`1`,children:`读取失败。`}),(0,V.jsx)(`p`,{className:`file-problem-hint`,title:Zf(e.message),children:Xf(e.message,`读取失败,请稍后重试。`)})]})]})}function Yg(e){let[t,n]=(0,B.useState)([]),[r,i]=(0,B.useState)(),[a,o]=(0,B.useState)(``),[s,c]=(0,B.useState)({}),[l,u]=(0,B.useState)({}),[d,f]=(0,B.useState)({}),[p,m]=(0,B.useState)(()=>new Set),[h,g]=(0,B.useState)(``),[_,v]=(0,B.useState)(null),[y,b]=(0,B.useState)(null),[x,S]=(0,B.useState)(!1),[C,w]=(0,B.useState)([]),[T,E]=(0,B.useState)(!1),[D,O]=(0,B.useState)([]),k=(0,B.useCallback)((e,t)=>w(n=>{let r=new Map(n.map(e=>[e.path,e]));for(let t of e)r.set(t.path,t);for(let e of t)r.delete(e);return[...r.values()]}),[]),A=(0,B.useCallback)((e,t)=>{E(e),O(t)},[]);(0,B.useEffect)(()=>{if(w([]),E(!1),O([]),!e)return;let t=!0;return fetch(`/api/files/index?workspaceId=${encodeURIComponent(e)}`).then(e=>e.json()).then(e=>{t&&(k(e.changed??[],e.removed??[]),E(e.complete===!0),O(e.skipped??[]))}).catch(()=>void 0),()=>{t=!1}},[e,k]);let[j,M]=(0,B.useState)({});(0,B.useEffect)(()=>{if(n([]),i(void 0),o(``),c({}),u({}),f({}),m(new Set),v(null),b(null),g(``),S(!1),!e)return;let t=!0;return Pg(Lg(e,``)).then(e=>{t&&f({"":e})}).catch(e=>{t&&f({"":{error:Fg(e)}})}),()=>{t=!1}},[e]);let N=(0,B.useRef)(void 0),[P,ee]=(0,B.useState)(void 0);(0,B.useEffect)(()=>{if(!e||N.current===e)return;N.current=e;let t=Zg()[e];t&&(t.expanded.length&&m(new Set(t.expanded)),typeof t.listHeight==`number`&&v(t.listHeight),t.open.length&&(async()=>{for(let e of t.open)await ie({path:e,name:e.split(`/`).pop()??e,text:!0});t.active&&(i(t.active),ee(t.active))})())},[e]),(0,B.useEffect)(()=>{if(!e)return;let n=setTimeout(()=>{let n=Zg();n[e]={open:t.map(e=>e.path),expanded:[...p],...r?{active:r}:{},..._===null?{}:{listHeight:_}},Qg(n)},400);return()=>{clearTimeout(n)}},[e,t,p,r,_]);let te=(0,B.useCallback)(t=>{e&&Pg(Lg(e,t)).then(e=>{f(n=>({...n,[t]:e}))}).catch(e=>{f(n=>({...n,[t]:{error:Fg(e)}}))})},[e]),ne=(0,B.useCallback)(e=>{m(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),re=(0,B.useCallback)(()=>{e&&(f({}),m(new Set),Pg(Lg(e,``)).then(e=>{f({"":e})}).catch(e=>{f({"":{error:Fg(e)}})}))},[e]);(0,B.useEffect)(()=>{let t=h.trim();if(!e||!t){b(null),S(!1);return}let n=!0;S(!0);let r=setTimeout(()=>{Pg(Bg(e,t)).then(e=>{n&&(b(e),S(!1))}).catch(e=>{n&&(b({mode:`search`,query:t,hits:[],total:0,indexed:!1}),S(!1),o(`搜索失败:${e instanceof Error?e.message:`未知错误`}`))})},80);return()=>{n=!1,clearTimeout(r)}},[h,e]);let ie=(0,B.useCallback)(async r=>{if(e){if(r.text===!1)o(`「${r.name}」不支持以文本打开(二进制文件)。`);else if(t.some(e=>e.path===r.path))i(r.path);else{o(``);try{let t=await Pg(Rg(e,r.path));n(e=>e.some(e=>e.path===r.path)?e:[...e,{path:t.path,name:r.name,content:t.content,etag:t.meta.etag,dirty:!1}]),i(t.path),u(e=>({...e,[t.path]:!1}))}catch(e){o(`打不开「${r.name}」:${e instanceof Error?e.message:`未知错误`}`)}}}},[e,t]),ae=(0,B.useCallback)(e=>{n(t=>{let n=t.find(t=>t.path===e);if(n?.dirty&&!window.confirm(`「${n.name}」有未保存的修改,关掉就丢了。仍然关闭?`))return t;let a=t.findIndex(t=>t.path===e),o=t.filter(t=>t.path!==e);return e===r&&i(o.length===0?void 0:o[Math.min(a,o.length-1)]?.path),o})},[r]),oe=(0,B.useCallback)((e,t)=>{n(n=>n.map(n=>n.path===e?{...n,content:t,dirty:!0}:n))},[]);(0,B.useEffect)(()=>{if(!e||t.length===0)return;let n=!0,r=t.map(e=>e.path),i=setInterval(()=>{for(let i of r)Pg(zg(e,i)).then(e=>{if(!n)return;let r=t.find(e=>e.path===i);r&&e.etag!==r.etag&&u(e=>({...e,[i]:!0}))}).catch(()=>{})},kg);return()=>{n=!1,clearInterval(i)}},[e,t]);let se=(0,B.useCallback)(async(r,i)=>{if(!e)return;let a=t.find(e=>e.path===r);if(!a)return;c(e=>({...e,[r]:{state:`saving`,message:``}}));let o=a.etag;if(i)try{o=(await Pg(zg(e,r))).etag}catch(e){c(t=>({...t,[r]:{state:`error`,message:`无法读取磁盘上的最新版本:${e instanceof Error?e.message:`未知错误`}`}}));return}try{let t=await Pg(Rg(e,r),{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({path:r,content:a.content,baseEtag:o})});n(e=>e.map(e=>e.path===r?{...e,etag:t.meta.etag,dirty:!1}:e)),u(e=>({...e,[r]:!1})),c(e=>({...e,[r]:{state:`saved`,message:`已保存 ${Hg(t.meta.modifiedAt)}`}}))}catch(e){let t=e instanceof jg&&e.body.code===`stale`;c(n=>({...n,[r]:{state:t?`conflict`:`error`,message:e instanceof Error?e.message:`保存失败`}})),t&&u(e=>({...e,[r]:!0}))}},[e,t]),ce=(0,B.useCallback)(async t=>{if(e)try{let r=await Pg(Rg(e,t));n(e=>e.map(e=>e.path===t?{...e,content:r.content,etag:r.meta.etag,dirty:!1}:e)),u(e=>({...e,[t]:!1})),c(e=>({...e,[t]:{state:`saved`,message:`已重新载入磁盘版本`}}))}catch(e){c(n=>({...n,[t]:{state:`error`,message:e instanceof Error?e.message:`重新载入失败`}}))}},[e]),le=t.find(e=>e.path===r),ue=(0,B.useMemo)(()=>t.map(e=>({id:e.path,label:e.name,title:e.path,closable:!0,badge:e.dirty?(0,V.jsx)(`span`,{className:`file-tab-badge`,"data-file-tab-dirty":e.path,"aria-label":`未保存`,children:`●`}):void 0})),[t]),de=(0,B.useMemo)(()=>new Set(t.map(e=>e.path)),[t]),fe=(0,B.useCallback)((e,t,n)=>{M(r=>({...r,[e]:{changes:t,dropped:n}}))},[]),pe=e?j[e]:void 0,me=pe?.changes??[],he=pe?.dropped??0;return{open:t,activePath:r,active:le,tabItems:ue,openPaths:de,notice:a,setNotice:o,saves:s,external:l,openFile:ie,setActivePath:i,closeFile:ae,updateBuffer:oe,save:se,reload:ce,listings:d,expanded:p,toggleDirectory:ne,loadDirectory:te,refreshTree:re,listHeight:_,setListHeight:v,query:h,setQuery:g,hits:y,searching:x,changed:me,changedPaths:(0,B.useMemo)(()=>new Set(me.map(e=>e.path)),[me]),changedDirs:(0,B.useMemo)(()=>{let e=new Set;for(let t of me){let n=t.path.split(`/`);for(let t=1;t<n.length;t++)e.add(n.slice(0,t).join(`/`))}return e},[me]),changedDropped:he,setChangedFor:fe,index:C,indexComplete:T,indexSkipped:D,setIndex:k,setIndexStatus:A,restoredActive:P}}var Xg=`super-pi.file-workbench.v1`;function Zg(){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 Qg(e){try{typeof window<`u`&&window.localStorage.setItem(Xg,JSON.stringify(e))}catch{}}function $g({height:e,onHeight:t,panelRef:n,min:r=120}){let[i,a]=(0,B.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,V.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 e_({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,B.useCallback)(e=>{n?n(e):c(e)},[n,c]),T=l[``],E=g.trim(),D=(0,B.useRef)(null),O=(0,B.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,B.useState)(200);(0,B.useEffect)(()=>{A(200)},[E,e]);let j=(0,B.useRef)(null);(0,B.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,B.useMemo)(()=>{if(E){if(y||!v)return(0,V.jsx)(`p`,{className:`rail-empty`,"data-file-searching":`1`,children:`搜索中…`});if(v.hits.length===0)return(0,V.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,V.jsxs)(V.Fragment,{children:[t.map(e=>(0,V.jsxs)(`section`,{className:`file-group`,"data-file-search-group":e.directory,children:[(0,V.jsxs)(`h3`,{className:`file-group-head`,"data-file-search-group-head":e.directory,children:[(0,V.jsx)(`span`,{className:`file-group-name`,children:e.directory||`/`}),(0,V.jsx)(`span`,{className:`file-group-count`,children:e.hits.length})]}),(0,V.jsx)(`ul`,{className:`file-list`,children:e.hits.map(e=>(0,V.jsx)(`li`,{children:(0,V.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,V.jsx)(`span`,{className:`file-caret`,"aria-hidden":`true`}),(0,V.jsx)(Sg,{path:e.path}),(0,V.jsx)(`span`,{className:`file-name`,children:e.name}),a.has(e.path)&&(0,V.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,V.jsx)(`div`,{ref:j,className:`file-sentinel`,"data-file-search-more":`1`,children:`正在载入更多…`})]})}return e?T===void 0?(0,V.jsx)(`p`,{className:`rail-empty`,"data-file-root-loading":`1`,children:`读取工作区…`}):`error`in T?(0,V.jsx)(Jg,{error:T.error}):(0,V.jsxs)(V.Fragment,{children:[T.truncated&&(0,V.jsx)(`p`,{className:`file-search-note`,"data-file-truncated-root":`1`,children:`条目过多,只显示前一部分。`}),T.entries.length===0?(0,V.jsx)(`p`,{className:`rail-empty`,"data-file-root-empty":`1`,children:`这个工作区是空的,没有文件也没有子目录。`}):(0,V.jsx)(`ul`,{className:`file-list`,children:T.entries.map(t=>t.kind===`directory`?(0,V.jsx)(Ug,{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,V.jsx)(Wg,{entry:t,depth:0,openPaths:a,changedPaths:x,onOpen:e=>w(e)},t.path))})]}):(0,V.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,V.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,V.jsxs)(`div`,{className:`files-search`,children:[(0,V.jsx)(`span`,{className:`files-search-icon`,"aria-hidden":`true`,children:(0,V.jsxs)(`svg`,{viewBox:`0 0 16 16`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,strokeWidth:1.6,strokeLinecap:`round`,children:[(0,V.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.6`}),(0,V.jsx)(`path`,{d:`M10.4 10.4 14 14`})]})}),(0,V.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,V.jsx)(`button`,{type:`button`,className:`files-refresh`,"data-file-refresh":`1`,title:`重新读取目录`,"aria-label":`重新读取目录`,disabled:!e,onClick:()=>p(),children:`↻`})]}),E&&v&&!y&&(0,V.jsxs)(`p`,{className:`files-count`,"data-file-search-count":`1`,role:`status`,children:[(0,V.jsx)(`b`,{children:v.total.toLocaleString(`zh-CN`)}),` 个结果`,v.indexed===!1&&(0,V.jsx)(`span`,{className:`files-count-note`,"data-file-search-indexing":`1`,children:`正在建立索引…`})]}),b.length>0&&(0,V.jsxs)(`div`,{className:`files-changed`,"data-file-changed-list":`1`,children:[(0,V.jsxs)(`p`,{className:`files-changed-head`,"data-file-changed-head":`1`,children:[`agent 改了 `,b.length,` 个文件`]}),C>0&&(0,V.jsxs)(`p`,{className:`file-search-note`,"data-file-changed-dropped":`1`,children:[`还有 `,C,` 个改动没有记录(超过保留上限)。`]}),(0,V.jsx)(`ul`,{className:`file-list`,children:b.map(e=>(0,V.jsx)(`li`,{children:(0,V.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,V.jsx)(`span`,{className:`file-caret`,"aria-hidden":`true`}),(0,V.jsx)(Sg,{path:e.path}),(0,V.jsx)(`span`,{className:`file-name`,children:e.path.split(`/`).pop()}),(0,V.jsx)(`span`,{className:`file-badge-path`,children:e.path.split(`/`).slice(0,-1).join(`/`)||`/`}),(0,V.jsx)(`span`,{className:`file-badge file-badge-changed`,"data-file-changed-kind":e.path,children:e.baseline===null&&!e.baselineUnknown?`新建`:`已改`})]})},e.path))})]}),o&&(0,V.jsx)(`p`,{className:`rail-empty`,"data-file-notice":`1`,children:o}),(0,V.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,V.jsx)(`div`,{className:`files-tree-body`,children:M}),i.length===0&&(0,V.jsx)(`p`,{className:`rail-empty file-hint`,"data-file-none-open":`1`,children:`点一个文本文件,它会在上面的标签栏开一个标签,正文显示在中间主画面。`}),i.length>0&&(0,V.jsxs)(`p`,{className:`files-hint file-hint`,"data-file-open-hint":`1`,children:[`已打开 `,i.length,` 个文件,正文显示在中间主画面;点上面的标签切换,点这里的行切换。`]})]}),(0,V.jsx)($g,{height:m,onHeight:h,panelRef:D}),(0,V.jsxs)(`p`,{className:`files-footnote`,"data-files-footnote":`1`,children:[`只支持纯文本(md / 代码),二进制文件不会打开。写入只允许覆盖已存在的文件,不新建,不删除。`,i.length>0&&` 当前打开 ${i.length} 个文件,占 ${Vg(i.reduce((e,t)=>e+t.content.length,0))}。`]})]})}function t_({workspaceId:e,onOpen:t,onClose:n}){let[r,i]=(0,B.useState)(``),[a,o]=(0,B.useState)(null),[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(!1),[d,f]=(0,B.useState)(0),p=(0,B.useRef)(null),m=(0,B.useRef)(null);(0,B.useEffect)(()=>{p.current?.focus()},[]),(0,B.useEffect)(()=>{m.current?.scrollIntoView({block:`nearest`})},[d]),(0,B.useEffect)(()=>{let t=r.trim();if(o(null),c(``),f(0),!e||!t){u(!1);return}let n=!0;u(!0);let i=setTimeout(()=>{Pg(`/api/files/search?workspaceId=${Ig(e)}&q=${Ig(t)}`).then(e=>{n&&(o(e),u(!1))}).catch(e=>{n&&(c(Xf(e,`搜索没有完成`)),u(!1))})},220);return()=>{n=!1,clearTimeout(i)}},[r,e]);let h=e=>{e&&(t(e),n())},g=a?.truncated||a?.complete===!1,_={index:`索引未完整`,size:`文件超过 512KB`,depth:`目录超过 12 层`,time:`搜索超过 10 秒`,results:`达到 500 条上限`,output:`SDK 输出达到上限`,line:`长行已截断`,unreadable:`部分文件无法读取`};return(0,V.jsx)(`div`,{className:`quick-open-backdrop`,"data-content-search":`1`,role:`presentation`,onMouseDown:n,children:(0,V.jsxs)(`div`,{className:`quick-open content-search`,role:`dialog`,"aria-modal":`true`,"aria-label":`内容搜索`,onMouseDown:e=>e.stopPropagation(),children:[(0,V.jsx)(`input`,{ref:p,className:`quick-open-input`,"data-content-search-input":`1`,value:r,maxLength:256,placeholder:`内容搜索(区分大小写,按字面匹配)`,"aria-label":`内容搜索`,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),n()):e.key===`ArrowDown`?(e.preventDefault(),f(e=>Math.min(e+1,Math.max(0,(a?.hits.length??0)-1)))):e.key===`ArrowUp`?(e.preventDefault(),f(e=>Math.max(0,e-1))):e.key===`Enter`&&(e.preventDefault(),h(a?.hits[d]))}}),(0,V.jsxs)(`p`,{className:`quick-open-status`,role:`status`,"data-content-search-status":s?`error`:l?`searching`:g?`partial`:`complete`,children:[s?`✕ 搜索失败:`+s:l?`… 搜索中`:e?g?`⚠ 结果不完整`:a?`✓ 搜索完成`:`○ 输入要搜索的内容`:`○ 请先选择工作区`,a?` · ${a.hits.length} 条命中`:``,` · Esc 关闭`]}),g&&(0,V.jsxs)(`p`,{className:`quick-open-status`,"data-content-search-partial":`1`,children:[`⚠ 结果不完整:`,a?.reasons.map(e=>_[e]??e).join(`;`)]}),a&&a.skipped.length>0&&(0,V.jsxs)(`details`,{className:`quick-open-status`,"data-content-search-skipped":`1`,children:[(0,V.jsxs)(`summary`,{children:[`↷ 已跳过 `,a.skipped.length,` 个文件或目录`]}),(0,V.jsx)(`p`,{className:`content-search-skipped-paths`,children:a.skipped.join(`
50
50
  `)})]}),a&&!l&&a.hits.length===0&&(0,V.jsx)(`p`,{className:`quick-open-status`,"data-content-search-empty":`1`,children:`○ 没有匹配的行`}),(0,V.jsx)(`ul`,{className:`quick-open-results content-search-results`,role:`listbox`,children:a?.hits.map((e,t)=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(`button`,{ref:t===d?m:void 0,type:`button`,"data-content-search-result":`${e.path}:${e.line}`,className:`quick-open-result content-search-result${d===t?` quick-open-result-active`:``}`,"aria-selected":d===t,onMouseEnter:()=>f(t),onClick:()=>h(e),children:[(0,V.jsxs)(`span`,{children:[e.path,`:`,e.line]}),(0,V.jsx)(`small`,{title:e.text,children:e.text})]})},`${e.path}:${e.line}`))})]})})}function n_({entries:e,complete:t,skipped:n,onOpen:r,onClose:i}){let[a,o]=(0,B.useState)(``),[s,c]=(0,B.useState)(0),l=(0,B.useRef)(null),u=(0,B.useMemo)(()=>e.filter(e=>e.kind===`file`&&e.text!==!1),[e]),d=(0,B.useMemo)(()=>a.trim()?new gg(u,{keys:[`path`],threshold:.38,ignoreLocation:!0}).search(a).slice(0,20).map(e=>e.item):u.slice(0,20),[u,a]);(0,B.useEffect)(()=>{l.current?.focus(),c(0)},[a]);let f=(0,B.useCallback)(e=>{e&&(r({path:e.path,name:e.path.split(`/`).pop()??e.path,text:e.text}),i())},[r,i]);return(0,V.jsx)(`div`,{className:`quick-open-backdrop`,"data-quick-open":`1`,role:`presentation`,onMouseDown:i,children:(0,V.jsxs)(`div`,{className:`quick-open`,role:`dialog`,"aria-modal":`true`,"aria-label":`快速打开`,onMouseDown:e=>e.stopPropagation(),children:[(0,V.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,V.jsxs)(`p`,{className:`quick-open-status`,"data-quick-open-status":t?`complete`:`partial`,children:[t?`✓ 索引完整`:`⚠ 索引不完整`,` · `,u.length,` 个文件 · Esc 关闭`]}),n.length>0&&(0,V.jsxs)(`p`,{className:`quick-open-status`,"data-quick-open-skipped":`1`,title:n.join(`, `),children:[`↷ 已跳过:`,n.join(`, `)]}),(0,V.jsx)(`ul`,{className:`quick-open-results`,role:`listbox`,children:d.map((e,t)=>(0,V.jsx)(`li`,{children:(0,V.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,V.jsx)(`span`,{children:e.path.split(`/`).pop()}),(0,V.jsx)(`small`,{children:e.path})]})},e.path))})]})})}function r_(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 i_(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 a_(e,t,n=88,r=200){let[i,a]=(0,B.useState)(()=>r_(e,0,n,r)),[o,s]=(0,B.useState)(null),c=(0,B.useCallback)(()=>{let i=r_(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,B.useRef)(t);(0,B.useEffect)(()=>{t<=0||l.current!==t&&(l.current=t,c())},[t,c]);let u=(0,B.useRef)(null);return(0,B.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 o_({tabs:e,activeId:t,onSelect:n,onClose:r,ariaLabel:i,minWidth:a=88,maxWidth:o=200,prefix:s=`workspace-tab`,idPrefix:c=s,className:l}){let u=(0,B.useRef)(null),[d,f]=(0,B.useState)(0),{layout:p,frozen:m,recompute:h}=a_(e.length,d,a,o);(0,B.useLayoutEffect)(()=>{let e=u.current;if(!e||typeof ResizeObserver>`u`)return;let t=()=>{let t=e.clientWidth;t>0&&f(t)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let g=i_(e,p.perRow),_=(e,t)=>t===void 0?{}:{[`data-${s}-${e}`]:t},v=e.filter(e=>e.kind===`file`).length,y=e.filter(e=>e.kind===`session`||!e.kind).length,b=t=>({[`data-${t}-strip`]:`1`,...m?{[`data-${t}-frozen`]:`1`}:{},[`data-${t}-count`]:t===`file-tab`?v:t===`session-tab`?y:e.length,[`data-${t}-min`]:a,[`data-${t}-max`]:o,[`data-${t}-per-row`]:p.perRow,[`data-${t}-width`]:Math.round(p.width*100)/100}),x=e=>{let t=e.relatedTarget;(!t||t.isConnected)&&h()},S=e=>{let t=e.relatedTarget;(!t||t.isConnected)&&h()};(0,B.useEffect)(()=>{if(!m)return;let e=u.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||h()};return document.addEventListener(`mousemove`,t,!0),()=>document.removeEventListener(`mousemove`,t,!0)},[m,h]);let C=[`${s}-strip`,`workspace-tab-strip`,`session-tab-strip`,`file-tab-strip`,l].filter(Boolean).join(` `);return(0,V.jsx)(`div`,{ref:u,className:C,role:`tablist`,"aria-label":i??`工作区标签页`,..._(`strip`,`1`),...b(`workspace-tab`),...b(`session-tab`),...b(`file-tab`),style:{"--tab-w":`${p.width}px`},onMouseEnter:x,onMouseLeave:S,children:g.map((i,a)=>(0,V.jsx)(`div`,{className:`${s}-row workspace-tab-row session-tab-row file-tab-row`,role:`presentation`,..._(`row`,a),children:i.map(i=>{let a=i.id===t||i.rawId!==void 0&&i.rawId===t,o=i.title??i.label,l=i.kind,u=i.rawId??i.id,d=e.findIndex(e=>e.id===i.id),f=[s,a?`${s}-active`:``,`workspace-tab`,a?`workspace-tab-active`:``,l?`${l}-tab`:``,l&&a?`${l}-tab-active`:``].filter(Boolean).join(` `);return(0,V.jsxs)(`div`,{role:`tab`,id:`${c}-${i.id}`,"aria-selected":a,"aria-controls":`${c}-panel-${i.id}`,tabIndex:a?0:-1,className:f,..._(`id`,u),..._(`index`,d),...a?_(`active`,`1`):{},..._(`closable`,i.closable===!1?`0`:`1`),...l?{"data-tab-kind":l}:{},...l===`session`||!l?{"data-session-tab-id":u,"data-session-tab-index":d,...a?{"data-session-tab-active":`1`}:{},"data-session-tab-closable":i.closable===!1?`0`:`1`}:{},...l===`file`?{"data-file-tab-id":u,"data-file-tab-index":d,...a?{"data-file-tab-active":`1`}:{},"data-file-tab-closable":i.closable===!1?`0`:`1`}:{},title:o,style:{width:p.width,boxSizing:`border-box`},onClick:()=>n?.(i.id),onAuxClick:e=>{e.button===1&&(e.preventDefault(),e.stopPropagation(),i.closable!==!1&&r&&r(i.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,a=e[(e.findIndex(e=>e.id===i.id)+r+e.length)%e.length];a&&n?.(a.id)},children:[i.icon&&(0,V.jsx)(`span`,{className:`${s}-icon workspace-tab-icon`,children:i.icon}),i.badge,(0,V.jsx)(`span`,{className:`${s}-label workspace-tab-label ${l?`${l}-tab-label`:``}`,..._(`label`,u),...l===`session`||!l?{"data-session-tab-label":u}:{},...l===`file`?{"data-file-tab-label":u}:{},children:i.label}),i.closable!==!1&&r&&(0,V.jsx)(`button`,{type:`button`,className:`${s}-close workspace-tab-close ${l?`${l}-tab-close`:``}`,..._(`close`,u),...l===`session`||!l?{"data-session-tab-close":u}:{},...l===`file`?{"data-file-tab-close":u}:{},onClick:e=>{e.stopPropagation(),r(i.id)},title:`关闭 ${o}`,"aria-label":`关闭 ${o}`,children:`×`})]},i.id)})},`row_${a}`))})}var s_={pending:`未开始`,running:`运行中`,completed:`已完成`,failed:`失败`,skipped:`已跳过`,stopped:`已停止`},c_={running:`运行中`,completed:`全部完成`,failed:`中途失败`,stopped:`已停止`},l_={pending:`○`,running:`◐`,completed:`✓`,failed:`✕`,skipped:`→`,stopped:`■`},u_={stop:`失败即停`,skip:`失败跳过`,"retry:1":`失败重试 1 次`,"retry:2":`失败重试 2 次`,"retry:3":`失败重试 3 次`};function d_(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 f_(e){let t=e.status===`running`,[n,r]=(0,B.useState)(0);(0,B.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 p_({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,V.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,V.jsx)(`span`,{className:`workflow-step-mark`,"aria-hidden":`true`,children:l_[e.status]}),(0,V.jsxs)(`span`,{className:`workflow-step-n`,"data-workflow-step-n":e.index+1,children:[`第 `,e.index+1,` 步`]}),(0,V.jsx)(`strong`,{className:`workflow-step-name`,"data-workflow-step-name":e.index+1,children:a}),(0,V.jsx)(`span`,{className:`workflow-step-agent`,"data-workflow-step-agent-name":e.index+1,children:i}),n>1&&(0,V.jsxs)(`span`,{className:`workflow-step-tries`,"data-workflow-step-retried":e.index+1,children:[`尝试 `,n,` 次`]}),(0,V.jsx)(`span`,{className:`workflow-step-status`,"data-workflow-step-status-text":e.index+1,children:s_[e.status]}),e.status===`failed`&&r?.error&&(0,V.jsx)(`span`,{className:`workflow-step-why`,"data-workflow-step-error":e.index+1,title:Zf(r.error),children:Xf(r.error,`这一步没有完成。`)})]})}function m_({workflow:e,names:t,onStop:n,stopping:r}){let i=e.status===`running`,a=f_(e),o=e.steps.filter(e=>e.status===`completed`||e.status===`skipped`).length;return(0,V.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,V.jsxs)(`div`,{className:`workflow-head`,children:[(0,V.jsx)(`span`,{className:`workflow-badge`,children:`编排`}),(0,V.jsx)(`strong`,{className:`workflow-summary`,"data-workflow-summary":e.id,children:e.summary}),(0,V.jsxs)(`span`,{className:`workflow-progress`,"data-workflow-progress":e.id,children:[o,`/`,e.steps.length]}),(0,V.jsx)(`span`,{className:`workflow-status`,"data-workflow-status-text":e.id,children:c_[e.status]??`未知状态`}),(0,V.jsx)(`span`,{className:`workflow-policy`,"data-workflow-policy":e.onFailure,children:u_[e.onFailure]??e.onFailure}),a!==void 0&&(0,V.jsxs)(`span`,{className:`workflow-clock`,"data-workflow-elapsed":e.id,children:[i?`已运行 `:`用时 `,d_(a)]}),i&&(0,V.jsx)(`button`,{type:`button`,className:`workflow-stop`,"data-workflow-stop":e.id,disabled:r,onClick:n,children:`停止`})]}),(0,V.jsx)(`ol`,{className:`workflow-steps`,"data-workflow-step-count":e.steps.length,children:e.steps.map(e=>(0,V.jsx)(p_,{step:e,names:t},e.index))})]})}var h_=[{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:`tools`,label:`侧边栏工具`,icon:`🧩`,title:`全局工具:开发、导出与导入`,description:`让 Agent 写一个工具,用一个文件分享给别人,导入前先看清它会做什么。`},{id:`cli`,label:`指令与快捷键`,icon:`⌨️`,title:`Pi 终端命令与键盘快捷操作`,description:`利用 Pi 终端斜杠指令控制服务生命周期,掌握常用快捷键提升效率。`},{id:`themes`,label:`外观与主题`,icon:`🎨`,title:`界面主题与个性化显示`,description:`内置 4 款专业高对比度主题,针对不同环境提供舒适体验。`}];function g_({onClose:e}){let[t,n]=(0,B.useState)(`agents`);(0,B.useEffect)(()=>{let t=t=>{t.key===`Escape`&&!t.defaultPrevented&&e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]);let r=h_.find(e=>e.id===t)??h_[0];return(0,V.jsx)(`div`,{className:`overlay`,onClick:e,children:(0,V.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,V.jsxs)(`div`,{className:`settings-window-head help-window-head`,children:[(0,V.jsxs)(`div`,{className:`help-head-title`,children:[(0,V.jsx)(`h2`,{id:`help-window-title`,children:`使用指南与帮助`}),(0,V.jsx)(`span`,{className:`help-badge`,children:`v0.1.x`})]}),(0,V.jsx)(`button`,{type:`button`,className:`help-close-button`,"aria-label":`关闭指南`,onClick:e,children:`✕`})]}),(0,V.jsxs)(`div`,{className:`settings-window-body help-window-body`,children:[(0,V.jsxs)(`nav`,{className:`settings-nav help-nav`,role:`tablist`,"aria-orientation":`vertical`,"aria-label":`使用指南分类`,children:[(0,V.jsx)(`div`,{className:`settings-nav-label`,children:`目录`}),h_.map(e=>(0,V.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,V.jsx)(`span`,{className:`help-tab-icon`,"aria-hidden":`true`,children:e.icon}),(0,V.jsx)(`span`,{children:e.label})]},e.id))]}),(0,V.jsxs)(`div`,{id:`help-panel`,className:`settings-panel help-panel`,role:`tabpanel`,"aria-labelledby":`help-tab-${r.id}`,children:[(0,V.jsxs)(`div`,{className:`help-panel-header`,children:[(0,V.jsx)(`h3`,{className:`help-panel-title`,children:r.title}),(0,V.jsx)(`p`,{className:`help-panel-desc`,children:r.description})]}),(0,V.jsxs)(`div`,{className:`help-panel-content`,children:[r.id===`agents`&&(0,V.jsx)(y_,{}),r.id===`workspace`&&(0,V.jsx)(b_,{}),r.id===`subagents`&&(0,V.jsx)(S_,{}),r.id===`model-policy`&&(0,V.jsx)(x_,{}),r.id===`memory`&&(0,V.jsx)(__,{}),r.id===`knowledge`&&(0,V.jsx)(v_,{}),r.id===`tools`&&(0,V.jsx)(C_,{}),r.id===`cli`&&(0,V.jsx)(w_,{}),r.id===`themes`&&(0,V.jsx)(T_,{})]}),(0,V.jsx)(`div`,{className:`picker-actions help-actions`,children:(0,V.jsx)(`button`,{type:`button`,className:`picker-cancel`,onClick:e,children:`关闭`})})]})]})]})})}function __(){return(0,V.jsxs)(`div`,{className:`help-section-group`,children:[(0,V.jsxs)(`div`,{className:`help-card highlight`,children:[(0,V.jsx)(`h4`,{children:`🧠 它会记住什么?`}),(0,V.jsx)(`p`,{children:`用户档案保存跨工作区的长期偏好;工作区事实保存环境与项目约定;技能保存已经验证过的步骤、命令和坑。临时结果、秘密和未验证的失败不会保存。`})]}),(0,V.jsxs)(`div`,{className:`help-card`,children:[(0,V.jsx)(`h4`,{children:`主动保存与后台复盘`}),(0,V.jsxs)(`ul`,{className:`help-list`,children:[(0,V.jsxs)(`li`,{children:[`主 Agent 可以使用 `,(0,V.jsx)(`code`,{children:`memory`}),` 和 `,(0,V.jsx)(`code`,{children:`skill_manage`}),` 工具主动保存;说“记住了”本身不会写入。`]}),(0,V.jsx)(`li`,{children:`每隔若干回合,系统会在独立会话中复盘最近证据。复盘不能读写工作区文件、执行命令或派发任务。`}),(0,V.jsx)(`li`,{children:`读取记忆和历史只返回带来源的参考数据,不能把记忆中的文字当作新的指令。`})]})]}),(0,V.jsxs)(`div`,{className:`help-card`,children:[(0,V.jsx)(`h4`,{children:`权限与审批`}),(0,V.jsxs)(`ul`,{className:`help-list`,children:[(0,V.jsx)(`li`,{children:`子 Agent 可以读取相关记忆,但没有写入权限。`}),(0,V.jsx)(`li`,{children:`后台复盘新增记忆可以直接保存;修改或删除旧条目会进入设置中的待审批列表。`}),(0,V.jsx)(`li`,{children:`在“设置 → 主动记忆”可以开关功能、调整复盘间隔、编辑条目和批准提案。`})]})]})]})}function v_(){return(0,V.jsxs)(`div`,{className:`help-section-group`,children:[(0,V.jsxs)(`div`,{className:`help-card highlight`,children:[(0,V.jsx)(`h4`,{children:`📚 它解决什么问题?`}),(0,V.jsx)(`p`,{children:`Agent 默认靠训练时的记忆回答项目里的问题。知识库让你把规范、设计稿、会议纪要导入工作区,Agent 在回答前检索这些文档的原文片段,而不是凭印象编造。它与“主动记忆”不同:记忆是 Agent 自己沉淀的事实和技能,知识库只有你能写入。`})]}),(0,V.jsxs)(`div`,{className:`help-card`,children:[(0,V.jsx)(`h4`,{children:`怎么用`}),(0,V.jsxs)(`ul`,{className:`help-list`,children:[(0,V.jsx)(`li`,{children:`在“设置 → 知识库”里点“浏览工作区文件…”,在弹出的浏览器里挑一个 Markdown 或文本文件,挑完即导入。也可以直接粘贴正文,或手动填写相对路径。`}),(0,V.jsx)(`li`,{children:`同一个文件内容改了再导入就是更新,不会留下旧版本;同样的内容换个标题再导入也不会变成两篇。`}),(0,V.jsx)(`li`,{children:`面板里的“试检索”会用和 Agent 相同的检索器回答,方便你在交给 Agent 之前先确认它找得到。`}),(0,V.jsxs)(`li`,{children:[`从下一条消息开始生效。Agent 使用 `,(0,V.jsx)(`code`,{children:`knowledge_search`}),` 检索,只拿得到片段和来源,拿不到整篇文档。`]})]})]}),(0,V.jsxs)(`div`,{className:`help-card`,children:[(0,V.jsx)(`h4`,{children:`语义检索是内置的`}),(0,V.jsxs)(`ul`,{className:`help-list`,children:[(0,V.jsxs)(`li`,{children:[`关键词检索始终可用。语义检索让“撤销购买”也能找到写着“取消订单”的段落,它靠一个`,(0,V.jsx)(`strong`,{children:`随安装包一起分发`}),`的中文模型在本机运行,不需要额外下载、不需要联网、也不会把文档发到任何服务。`]}),(0,V.jsxs)(`li`,{children:[`第一次检索时加载模型(约一秒),之后一直可用。设 `,(0,V.jsx)(`code`,{children:`SUPER_PI_KNOWLEDGE_EMBEDDINGS=0`}),` 可以彻底关闭语义检索,只保留关键词检索。`]})]})]}),(0,V.jsxs)(`div`,{className:`help-card`,children:[(0,V.jsx)(`h4`,{children:`它不知道的事`}),(0,V.jsxs)(`ul`,{className:`help-list`,children:[(0,V.jsx)(`li`,{children:`知识库只会检索它有的东西。文档里没写的,它检索出来也不会有——所以导入什么,直接决定它能回答什么。`}),(0,V.jsx)(`li`,{children:`语义检索总会返回“最接近的那一段”,即使这一段其实并不回答问题。检索结果带一个分数,低分意味着这可能只是最像的一条,Agent 会被要求先核对再使用。`}),(0,V.jsx)(`li`,{children:`Agent 对知识库只读,不能写入或删除;导入和删除只有你能做。`})]})]})]})}function y_(){return(0,V.jsxs)(`div`,{className:`help-section-group`,children:[(0,V.jsxs)(`div`,{className:`help-card highlight`,children:[(0,V.jsx)(`h4`,{children:`💡 Agent 是什么?`}),(0,V.jsxs)(`p`,{children:[`在 Super Pi 中,`,(0,V.jsx)(`strong`,{children:`Agent(智能体)`}),` 是一套独立的「角色提示词设定与能力配置」。 通过切换 Agent,模型将扮演专精工程师、系统架构师、代码审查员或规划专家等不同角色,遵循指定的原则来协助你完成任务。`]})]}),(0,V.jsxs)(`div`,{className:`help-card`,children:[(0,V.jsx)(`h4`,{children:`📁 Agent 文件存放在哪里?`}),(0,V.jsxs)(`ul`,{className:`help-list`,children:[(0,V.jsxs)(`li`,{children:[(0,V.jsx)(`strong`,{children:`内置 Agent 目录:`}),`项目根目录下的 `,(0,V.jsx)(`code`,{children:`agents/`}),` 文件夹,例如 `,(0,V.jsx)(`code`,{children:`agents/coder.md`}),`、`,(0,V.jsx)(`code`,{children:`agents/planner.md`}),`、`,(0,V.jsx)(`code`,{children:`agents/reviewer.md`}),` 等。`]}),(0,V.jsxs)(`li`,{children:[(0,V.jsx)(`strong`,{children:`用户自定义持久化目录:`}),`用户主目录下的 `,(0,V.jsx)(`code`,{children:`~/.super-pi/agents/`}),`,放入此目录的文件在所有项目和更新中均持久有效。`]})]})]}),(0,V.jsxs)(`div`,{className:`help-card`,children:[(0,V.jsx)(`h4`,{children:`🚀 如何创建一个全新的自定义 Agent?`}),(0,V.jsxs)(`div`,{className:`help-steps`,children:[(0,V.jsxs)(`div`,{className:`help-step`,children:[(0,V.jsx)(`span`,{className:`step-num`,children:`1`}),(0,V.jsxs)(`div`,{className:`step-body`,children:[(0,V.jsx)(`strong`,{children:`创建 Markdown 文件`}),(0,V.jsxs)(`p`,{children:[`在 `,(0,V.jsx)(`code`,{children:`agents/`}),` 或 `,(0,V.jsx)(`code`,{children:`~/.super-pi/agents/`}),` 目录下新建文件,例如 `,(0,V.jsx)(`code`,{children:`architect.md`}),`。`]})]})]}),(0,V.jsxs)(`div`,{className:`help-step`,children:[(0,V.jsx)(`span`,{className:`step-num`,children:`2`}),(0,V.jsxs)(`div`,{className:`step-body`,children:[(0,V.jsx)(`strong`,{children:`编写元数据与系统提示词`}),(0,V.jsx)(`p`,{children:`文件开头使用 YAML Frontmatter 声明名称和描述,正文编写设定提示词:`}),(0,V.jsx)(`pre`,{className:`help-code-block`,children:(0,V.jsx)(`code`,{children:`---