codemini-cli 0.6.5 → 0.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/codemini-web/dist/assets/{AboutDialog-BUp8EzDg.js → AboutDialog-dFkTshay.js} +1 -1
- package/codemini-web/dist/assets/{CodeWikiPanel-Fp0VKdzo.js → CodeWikiPanel-Dqup5Sen.js} +1 -1
- package/codemini-web/dist/assets/{ConfigDialog-DIpj779O.js → ConfigDialog-DTehAh2r.js} +1 -1
- package/codemini-web/dist/assets/{GitDiffDialog-ZLEuX8Qm.js → GitDiffDialog-D4uMixee.js} +1 -1
- package/codemini-web/dist/assets/{MemoryDialog-D2YbENVd.js → MemoryDialog-DJqtWamU.js} +1 -1
- package/codemini-web/dist/assets/{MessageBubble-BIgpZsLn.js → MessageBubble-BGnFIxcq.js} +1 -1
- package/codemini-web/dist/assets/{PatchDiff-CvKNaHsw.js → PatchDiff-CpHAbmv3.js} +1 -1
- package/codemini-web/dist/assets/{ProjectSelector-DXIep3lE.js → ProjectSelector-CgJDcTNL.js} +1 -1
- package/codemini-web/dist/assets/SkillDialog-D1J46nMC.js +8 -0
- package/codemini-web/dist/assets/{SoulDialog-BfIoKETs.js → SoulDialog-DIqK4utD.js} +1 -1
- package/codemini-web/dist/assets/chevron-right-BBG4s6Zh.js +1 -0
- package/codemini-web/dist/assets/{chunk-BO2N2NFS-DMUdjM9q.js → chunk-BO2N2NFS-fRXUeu1b.js} +4 -4
- package/codemini-web/dist/assets/{highlighted-body-OFNGDK62-8ch0jz7Z.js → highlighted-body-OFNGDK62-CKKvx7S1.js} +1 -1
- package/codemini-web/dist/assets/{index-DRXwJ-n_.css → index-DF9s7Tuc.css} +1 -1
- package/codemini-web/dist/assets/{index-BhMtCC8_.js → index-DyIUhlc8.js} +3 -3
- package/codemini-web/dist/assets/{input-CYpdNDlR.js → input-BKNu4DOt.js} +1 -1
- package/codemini-web/dist/assets/mermaid-GHXKKRXX-BM8yuNk5.js +1 -0
- package/codemini-web/dist/assets/{pencil-BdA2cEeE.js → pencil-C0uznNC_.js} +1 -1
- package/codemini-web/dist/assets/{refresh-cw-CJGgUGiS.js → refresh-cw-DUgU5bEu.js} +1 -1
- package/codemini-web/dist/assets/{select-BLOccU1M.js → select-J6668k2a.js} +1 -1
- package/codemini-web/dist/assets/{trash-2-CQzNOch5.js → trash-2-H0DiWqiE.js} +1 -1
- package/codemini-web/dist/index.html +2 -2
- package/codemini-web/server.js +90 -73
- package/package.json +1 -1
- package/src/commands/skill.js +188 -48
- package/src/core/agent-loop.js +67 -25
- package/src/core/chat-runtime.js +16 -13
- package/src/core/shell-profile.js +3 -2
- package/src/core/tools.js +42 -27
- package/codemini-web/dist/assets/SkillDialog-DjPF-XBx.js +0 -8
- package/codemini-web/dist/assets/chevron-right-CfNZHlyU.js +0 -1
- package/codemini-web/dist/assets/mermaid-GHXKKRXX-KBEtMEB9.js +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C44PrJ2C.js";import{O as t,P as n,_ as r,c as i,d as a,g as o,lt as s,s as c,u as l}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C44PrJ2C.js";import{O as t,P as n,_ as r,c as i,d as a,g as o,lt as s,s as c,u as l}from"./index-DyIUhlc8.js";var u=n(`brain-circuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),d=n(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),f=n(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),p=e(),m=[{icon:f,title:`aboutFeatureRuntime`,text:`aboutFeatureRuntimeDesc`},{icon:t,title:`aboutFeatureApprovals`,text:`aboutFeatureApprovalsDesc`},{icon:u,title:`aboutFeatureMemory`,text:`aboutFeatureMemoryDesc`},{icon:d,title:`aboutFeatureConfig`,text:`aboutFeatureConfigDesc`}];function h({open:e,onOpenChange:t,version:n}){return(0,p.jsx)(c,{open:e,onOpenChange:t,children:(0,p.jsxs)(i,{className:`sm:max-w-2xl max-h-[86vh] overflow-y-auto`,children:[(0,p.jsx)(l,{children:(0,p.jsx)(a,{className:`sr-only`,children:s(`aboutTitle`)})}),(0,p.jsxs)(`div`,{className:`space-y-5`,children:[(0,p.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,p.jsx)(`img`,{src:`/logos/codemini_logo.png`,alt:`Codemini`,className:`h-16 w-16 shrink-0 rounded-[14px] border border-(--border-default) bg-(--bg-secondary) p-2`}),(0,p.jsxs)(`div`,{className:`min-w-0`,children:[(0,p.jsx)(`h2`,{className:`mt-1 text-[24px] font-semibold leading-tight text-(--text-primary)`,children:`Codemini CLI`}),(0,p.jsx)(`p`,{className:`mt-2 max-w-xl text-[13px] leading-relaxed text-(--text-secondary)`,children:s(`aboutTagline`)})]})]}),(0,p.jsx)(`div`,{className:`grid grid-cols-1 gap-2.5 sm:grid-cols-2`,children:m.map(({icon:e,title:t,text:n})=>(0,p.jsxs)(`div`,{className:`rounded-md border border-(--border-default) bg-(--bg-secondary) px-3 py-3`,children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px] font-semibold text-(--text-primary)`,children:[(0,p.jsx)(e,{size:15}),(0,p.jsx)(`span`,{children:s(t)})]}),(0,p.jsx)(`p`,{className:`mt-1.5 text-[12px] leading-relaxed text-(--text-muted)`,children:s(n)})]},t))}),(0,p.jsx)(o,{className:`bg-(--border-default)`}),(0,p.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsxs)(`h3`,{className:`mb-1.5 flex items-center gap-2 text-[13px] font-semibold text-(--text-primary)`,children:[(0,p.jsx)(r,{size:14}),s(`installation`)]}),(0,p.jsx)(`pre`,{className:`bg-(--bg-secondary) rounded-md border border-(--border-default) px-3 py-2 text-[12px] font-mono overflow-x-auto`,children:`npm install -g codemini-cli`})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsxs)(`h3`,{className:`mb-1.5 flex items-center gap-2 text-[13px] font-semibold text-(--text-primary)`,children:[(0,p.jsx)(r,{size:14}),s(`startWebUI`)]}),(0,p.jsx)(`pre`,{className:`bg-(--bg-secondary) rounded-md border border-(--border-default) px-3 py-2 text-[12px] font-mono overflow-x-auto`,children:`codemini --web`})]})]}),(0,p.jsx)(o,{className:`bg-(--border-default)`}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`h3`,{className:`text-[13px] font-semibold text-(--text-primary) mb-2`,children:s(`basicUsage`)}),(0,p.jsxs)(`div`,{className:`grid gap-2 text-[12px] sm:grid-cols-2`,children:[(0,p.jsxs)(`div`,{className:`rounded-md bg-(--bg-secondary) px-3 py-2`,children:[(0,p.jsx)(`span`,{className:`font-medium text-(--text-primary)`,children:s(`newChat`)}),(0,p.jsx)(`p`,{className:`mt-1 text-(--text-muted)`,children:s(`chatUsage`)})]}),(0,p.jsxs)(`div`,{className:`rounded-md bg-(--bg-secondary) px-3 py-2`,children:[(0,p.jsx)(`span`,{className:`font-medium text-(--text-primary)`,children:s(`skills`)}),(0,p.jsx)(`p`,{className:`mt-1 text-(--text-muted)`,children:s(`skillUsage`)})]}),(0,p.jsxs)(`div`,{className:`rounded-md bg-(--bg-secondary) px-3 py-2`,children:[(0,p.jsx)(`span`,{className:`font-medium text-(--text-primary)`,children:s(`souls`)}),(0,p.jsx)(`p`,{className:`mt-1 text-(--text-muted)`,children:s(`soulUsage`)})]}),(0,p.jsxs)(`div`,{className:`rounded-md bg-(--bg-secondary) px-3 py-2`,children:[(0,p.jsx)(`span`,{className:`font-medium text-(--text-primary)`,children:s(`workspace`)}),(0,p.jsx)(`p`,{className:`mt-1 text-(--text-muted)`,children:s(`workspaceUsage`)})]})]})]}),(0,p.jsx)(o,{className:`bg-(--border-default)`}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`h3`,{className:`text-[13px] font-semibold text-(--text-primary) mb-1.5`,children:s(`configureModel`)}),(0,p.jsxs)(`pre`,{className:`bg-(--bg-secondary) rounded-md border border-(--border-default) px-3 py-2 text-[12px] font-mono overflow-x-auto`,children:[`codemini config set gateway.base_url <url>`,`
|
|
2
2
|
`,`codemini config set gateway.api_key <token>`,`
|
|
3
3
|
`,`codemini config set model.name <model-id>`]}),(0,p.jsx)(`p`,{className:`mt-1.5 text-[12px] text-(--text-muted)`,children:s(`configureModelDesc`)})]})]}),(0,p.jsxs)(`div`,{className:`text-center text-[11px] text-(--text-muted) pt-1`,children:[`Codemini CLI`,n?`@${n}`:``,` - Coding assistant An extremely restrained coding + tasks CLI. Every platform. Every terminal. Minimal by design.`]})]})})}export{h as AboutDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{a as t,r as n}from"./bundle-mjs-C44PrJ2C.js";import{t as r}from"./refresh-cw-CJGgUGiS.js";import{$ as i,H as a,M as o,P as s,S as c,T as ee,U as te,h as ne,lt as l,m as re,nt as ie,o as ae,p as oe,pt as u,t as d,v as f,z as se}from"./index-BhMtCC8_.js";import{MessageBubble as ce,t as le}from"./MessageBubble-BIgpZsLn.js";var ue=s(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),de=s(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),fe=s(`send-horizontal`,[[`path`,{d:`M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z`,key:`117uat`}],[`path`,{d:`M6 12h16`,key:`s4cdu5`}]]),p=e(t(),1),m=n(),pe=`codemini:codewiki:qa-width`,h=320,me=760,g=420,he=!1;function ge(){if(typeof window>`u`)return g;let e=Number(window.localStorage.getItem(pe));return Number.isFinite(e)?Math.min(me,Math.max(h,e)):g}function _(){return[{value:`fast`,label:l(`generationDepthFast`)},{value:`standard`,label:l(`generationDepthStandard`)},{value:`deep`,label:l(`generationDepthDeep`)}]}function _e(e){if(!e)return``;try{return new Intl.DateTimeFormat(`zh-CN`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}).format(new Date(e))}catch{return``}}function v(e){let t=Number(e||0);return!Number.isFinite(t)||t<=0?``:t<1024?`${t} B`:t<1024*1024?`${Math.round(t/1024)} KB`:`${(t/1024/1024).toFixed(1)} MB`}function y(e,t){let n=Array.isArray(e)?e:[];if(!n.length)return{done:0,total:0,pct:8,label:t||l(`startingAnalysis`),detail:l(`preparingScan`)};let r=n.filter(e=>e.status===`done`).length,i=n.find(e=>e.status===`failed`),a=n.find(e=>e.status===`running`)||n.find(e=>e.status===`in_progress`)||n.find(e=>e.status===`pending`)||n[n.length-1];return{done:r,total:n.length,pct:Math.max(8,Math.round(r/n.length*100)),label:i?l(`generationFailed`):a?.title||t||l(`generatingCodeWiki`),detail:i?i.title:`${r}/${n.length} ${l(`stepsCompleted`)}${a?.role?` · ${a.role.toUpperCase()}`:``}`}}function ve({steps:e,stageLabel:t,compact:n=!1}){let r=y(e,t);return(0,m.jsxs)(`div`,{className:u(`rounded-lg border border-(--border-default) bg-(--bg-primary) p-3 text-left`,n?`mt-3`:`mt-5 w-full max-w-md`),children:[(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,m.jsx)(`span`,{className:`truncate text-[12px] font-medium text-(--text-primary)`,children:r.label}),r.total>0&&(0,m.jsxs)(`span`,{className:`shrink-0 text-[11px] text-(--text-muted)`,children:[r.done,`/`,r.total]})]}),(0,m.jsx)(d,{value:r.pct,className:`mt-2 h-1.5`}),(0,m.jsx)(`p`,{className:`mt-2 truncate text-[11px] text-(--text-muted)`,children:r.detail})]})}function b(e,t){if(!Array.isArray(e)||e.length===0)return[{type:`tools`,cards:[t]}];let n=e[e.length-1];return n.type===`tools`?[...e.slice(0,-1),{...n,cards:[...n.cards,t]}]:[...e,{type:`tools`,cards:[t]}]}function x(e,t,n){return(Array.isArray(e)?e:[]).map(e=>{if(e.type!==`tools`)return e;let r=e.cards.findIndex(e=>e.id===t);if(r===-1)return e;let i=[...e.cards];return i[r]=n(i[r]),{...e,cards:i}})}function S(e){let t=Array.isArray(e)?e:[];return t.length===0?[{type:`text`,text:``,isStreaming:!1}]:t[t.length-1].type===`text`?t:[...t,{type:`text`,text:``,isStreaming:!1}]}function C(e,t){let n=String(t||``);if(!n)return Array.isArray(e)?e:[];let r=S(e),i=r[r.length-1];return[...r.slice(0,-1),{...i,text:`${i.text||``}${n}`,isStreaming:!0}]}function w(e,t){let n=S(e),r=n.length-1;return n.map((e,n)=>n===r&&e.type===`text`?{...e,text:t,isStreaming:!1}:e)}function T(e){return(Array.isArray(e)?e:[]).map(e=>e.type===`text`?{...e,isStreaming:!1}:e)}function ye(e,t){switch(t?.type){case`assistant:delta`:return{...e,segments:C(e.segments,t.text)};case`assistant:response`:return{...e,segments:t.text?w(e.segments,t.text):T(e.segments)};case`tool:start`:return{...e,segments:b(e.segments,{id:t.id,name:t.name,arguments:t.arguments,status:`running`,durationMs:null,summary:``,result:``})};case`tool:result`:return{...e,segments:x(e.segments,t.id,e=>({...e,result:t.content||e.result||``}))};case`tool:end`:return{...e,segments:x(e.segments,t.id,e=>({...e,status:`done`,durationMs:t.durationMs,summary:t.summary||e.summary||``}))};case`tool:error`:return{...e,segments:x(e.segments,t.id,e=>({...e,status:`error`,durationMs:t.durationMs,summary:t.summary||e.summary||``}))};case`tool:blocked`:return{...e,segments:x(e.segments,t.id,e=>({...e,status:`blocked`,summary:e.summary||`Tool blocked`}))};case`codewiki:done`:return{...e,loading:!1,segments:T(e.segments)};case`codewiki:error`:return{...e,role:`error`,loading:!1,segments:[{type:`text`,text:t.message||l(`codewikiFailed`),isStreaming:!1}]};default:return e}}function E({projectCwd:e,projectKey:t,busy:n,planSteps:s=[],stageLabel:d=``}){let[y,b]=(0,p.useState)([]),[x,S]=(0,p.useState)(``),[C,w]=(0,p.useState)(`report`),[T,E]=(0,p.useState)(!0),[be,D]=(0,p.useState)(!1),[xe,O]=(0,p.useState)(``),[Se,k]=(0,p.useState)(null),[A,j]=(0,p.useState)(!1),[Ce,M]=(0,p.useState)(``),[we,N]=(0,p.useState)(!1),[P,F]=(0,p.useState)(``),[Te,I]=(0,p.useState)(``),[L,R]=(0,p.useState)(!1),[z,B]=(0,p.useState)(null),[Ee,V]=(0,p.useState)(!1),[H,U]=(0,p.useState)(`standard`),[W,G]=(0,p.useState)([]),[K,q]=(0,p.useState)(!1),[J,De]=(0,p.useState)(ge),[Oe,ke]=(0,p.useState)(!1),Ae=(0,p.useRef)(null),Y=(0,p.useRef)({startX:0,startWidth:g}),X=(0,p.useMemo)(()=>y.find(e=>e.file===x)||null,[y,x]),je=X?`/api/codewiki/report/${encodeURIComponent(X.file)}${t?`?project=${encodeURIComponent(t)}`:``}`:``,Me=(0,p.useCallback)(async()=>{D(!0),O(``);try{let e=await te(t);k(e),e?.error&&O(e.error)}catch(e){O(e?.message||`Failed to load code graph`)}finally{D(!1)}},[t]),Z=(0,p.useCallback)(async({preferNewest:e=!1}={})=>{E(!0),M(``);try{let n=await a(t),r=[...Array.isArray(n?.reports)?n.reports:[]].sort((e,t)=>new Date(t.mtime||0)-new Date(e.mtime||0));b(r),S(t=>e&&r[0]?r[0].file:r.some(e=>e.file===t)?t:r[0]?.file||``)}catch(e){M(e?.message||l(`failedToLoad`))}finally{E(!1)}},[t]);(0,p.useEffect)(()=>{b([]),S(``),w(`report`),N(!1),F(``),I(``),G([]),q(!1),k(null),O(``),Z({preferNewest:!0})},[Z,Me,t]),(0,p.useEffect)(()=>{let e=Ae.current;e&&requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight})},[W,K]),(0,p.useEffect)(()=>{A&&n&&R(!0)},[n,A]),(0,p.useEffect)(()=>{!A||n||!L||(Z({preferNewest:!0}),j(!1),R(!1))},[n,A,Z,L]),(0,p.useEffect)(()=>{window.localStorage.setItem(pe,String(J))},[J]);let Ne=(0,p.useCallback)(e=>{e.preventDefault(),ke(!0),Y.current={startX:e.clientX,startWidth:J};let t=e=>{let t=Y.current.startX-e.clientX,n=Math.max(h,Math.min(me,window.innerWidth-720));De(Math.min(n,Math.max(h,Y.current.startWidth+t)))},n=()=>{ke(!1),document.body.style.cursor=``,document.body.style.userSelect=``,window.removeEventListener(`mousemove`,t),window.removeEventListener(`mouseup`,n)};document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,window.addEventListener(`mousemove`,t),window.addEventListener(`mouseup`,n)},[J]),Pe=async()=>{if(!(n||A)){M(``),j(!0),R(!1);try{let e=await i(H,t);e?.error&&(j(!1),M(e.message||l(`failedToStart`)))}catch(e){j(!1),M(e?.message||l(`failedToStart`))}}},Fe=async e=>{e.preventDefault();let n=P.trim();if(!n||Q||K)return;let r=Date.now(),i=`cw-assistant-${r}`;I(n),F(``),M(``),G(e=>[...e,{id:`cw-user-${r}`,role:`you`,text:n,segments:[{type:`text`,text:n,isStreaming:!1}],timestamp:new Date().toISOString()},{id:i,role:`general`,text:``,segments:[],timestamp:new Date().toISOString(),loading:!0}]),q(!0);try{await ie({question:n,reportFile:X?.file||``,project:t,onEvent:e=>{G(t=>t.map(t=>t.id===i?ye(t,e):t))}})}catch(e){G(t=>t.map(t=>t.id===i?{...t,role:`error`,loading:!1,segments:[{type:`text`,text:e?.message||l(`codewikiFailed`),isStreaming:!1}]}:t))}finally{q(!1)}},Ie=async()=>{if(z){V(!0),M(``);try{let e=await se(z.file,t);e?.error?M(e.message||l(`failedToDelete`)):(B(null),N(!1),await Z({preferNewest:!1}))}catch(e){M(e?.message||l(`failedToDelete`))}finally{V(!1)}}},Q=n||A,$=Q||K;return(0,m.jsxs)(`div`,{className:`flex-1 min-h-0 bg-(--bg-primary) rounded-[18px] border border-(--border-default) border-b-0 overflow-hidden my-1 mx-1`,children:[(0,m.jsxs)(`div`,{className:`codewiki-layout h-full min-h-0`,style:{"--codewiki-qa-width":`${J}px`},children:[(0,m.jsxs)(`aside`,{className:`border-r border-(--border-default) bg-(--bg-secondary) min-h-0 flex flex-col max-lg:hidden`,children:[(0,m.jsxs)(`div`,{className:`p-4 border-b border-(--border-default)`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2 text-(--text-primary)`,children:[(0,m.jsx)(o,{size:18}),(0,m.jsx)(`span`,{className:`font-semibold text-[15px]`,children:`CodeWiki`})]}),(0,m.jsx)(`p`,{className:`mt-2 text-[12px] leading-5 text-(--text-muted) truncate`,title:e||``,children:e||l(`currentProject`)}),(0,m.jsx)(`div`,{className:`mt-4 grid grid-cols-3 gap-1 rounded-lg border border-(--border-default) bg-(--bg-primary) p-1`,children:_().map(e=>(0,m.jsx)(`button`,{type:`button`,className:u(`h-7 rounded-md text-[12px] text-(--text-muted) hover:bg-(--bg-hover) hover:text-(--text-primary) disabled:cursor-not-allowed disabled:opacity-60`,H===e.value&&`bg-(--bg-active) text-(--text-primary)`),disabled:Q,onClick:()=>U(e.value),children:e.label},e.value))}),(0,m.jsxs)(`button`,{className:`mt-3 w-full h-9 rounded-lg border border-(--border-default) bg-(--bg-primary) text-[13px] text-(--text-primary) inline-flex items-center justify-center gap-2 hover:bg-(--bg-hover) disabled:cursor-not-allowed disabled:opacity-60`,onClick:Pe,disabled:Q,children:[A?(0,m.jsx)(c,{size:15,className:`animate-spin`}):(0,m.jsx)(f,{size:15}),l(A?`generating`:`generateNew`)]}),A&&(0,m.jsx)(ve,{steps:s,stageLabel:d,compact:!0})]}),(0,m.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3`,children:[(0,m.jsx)(`span`,{className:`text-[12px] font-medium text-(--text-muted)`,children:`Documents`}),(0,m.jsx)(`button`,{className:`inline-flex size-7 items-center justify-center rounded-md text-(--text-muted) hover:bg-(--bg-hover) hover:text-(--text-primary)`,onClick:()=>{Z({preferNewest:!0})},title:`Refresh`,"aria-label":`Refresh`,children:(0,m.jsx)(r,{size:14})})]}),(0,m.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-2 pb-4`,children:[he,T&&(0,m.jsxs)(`div`,{className:`px-3 py-6 text-[12px] text-(--text-muted) inline-flex items-center gap-2`,children:[(0,m.jsx)(c,{size:14,className:`animate-spin`}),l(`loadingReport`)]}),!T&&y.length===0&&(0,m.jsx)(`div`,{className:`mx-2 rounded-lg border border-dashed border-(--border-default) px-3 py-4 text-[12px] leading-5 text-(--text-muted)`,children:l(`noReportYet`)}),(0,m.jsx)(`div`,{className:`flex flex-col gap-1`,children:y.map(e=>(0,m.jsxs)(`div`,{className:u(`group w-full rounded-lg px-3 py-2 text-left hover:bg-(--bg-hover) cursor-pointer`,C===`report`&&x===e.file&&`bg-(--bg-active)`),onClick:()=>{w(`report`),S(e.file),N(!1)},children:[(0,m.jsxs)(`span`,{className:`flex items-start gap-2 text-[13px] text-(--text-primary)`,children:[(0,m.jsx)(le,{size:14,className:`shrink-0 mt-0.5 text-(--text-muted)`}),(0,m.jsx)(`span`,{className:`min-w-0 flex-1 break-words`,children:e.file}),(0,m.jsxs)(oe,{children:[(0,m.jsx)(ne,{asChild:!0,children:(0,m.jsx)(`button`,{type:`button`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded-md text-(--text-muted) opacity-0 hover:bg-(--bg-active) hover:text-(--text-primary) group-hover:opacity-100 focus:opacity-100`,onClick:e=>e.stopPropagation(),"aria-label":l(`reportActions`),children:(0,m.jsx)(ee,{size:14})})}),(0,m.jsx)(re,{align:`end`,className:`w-36 border-(--border-default) bg-(--bg-primary) p-1 text-(--text-primary)`,onClick:e=>e.stopPropagation(),children:(0,m.jsx)(`button`,{type:`button`,className:`w-full rounded-md px-2.5 py-2 text-left text-[13px] text-(--accent-red) hover:bg-(--accent-red-bg)`,onClick:()=>B(e),children:l(`deleteReport`)})})]})]}),(0,m.jsxs)(`span`,{className:`mt-1 block truncate pl-6 text-[11px] text-(--text-muted)`,children:[_e(e.mtime),v(e.size)?` · ${v(e.size)}`:``]})]},e.file))})]})]}),(0,m.jsxs)(`main`,{className:`min-w-0 min-h-0 flex flex-col bg-(--bg-primary)`,children:[Ce&&(0,m.jsxs)(`div`,{className:`mx-5 mt-4 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-[12px] text-red-400 inline-flex items-center gap-2`,children:[(0,m.jsx)(ue,{size:14}),Ce]}),(0,m.jsx)(`div`,{className:`flex-1 min-h-0 p-4`,children:!X&&!T?(0,m.jsxs)(`div`,{className:`h-full min-h-[420px] rounded-xl border border-dashed border-(--border-default) bg-(--bg-secondary) flex flex-col items-center justify-center text-center px-8`,children:[(0,m.jsx)(o,{size:34,className:`text-(--text-muted)`}),(0,m.jsx)(`h2`,{className:`mt-4 text-[18px] font-semibold text-(--text-primary)`,children:l(`noCodeWiki`)}),(0,m.jsx)(`p`,{className:`mt-2 max-w-md text-[13px] leading-6 text-(--text-muted)`,children:l(`reportWillShow`)}),(0,m.jsxs)(`button`,{className:`mt-5 h-10 rounded-lg bg-(--text-primary) px-4 text-[13px] font-medium text-(--bg-primary) inline-flex items-center gap-2 disabled:cursor-not-allowed disabled:opacity-60`,onClick:Pe,disabled:Q,children:[A?(0,m.jsx)(c,{size:16,className:`animate-spin`}):(0,m.jsx)(f,{size:16}),l(A?`generating`:`generateNew`)]}),(0,m.jsx)(`div`,{className:`mt-3 grid w-full max-w-xs grid-cols-3 gap-1 rounded-lg border border-(--border-default) bg-(--bg-primary) p-1`,children:_().map(e=>(0,m.jsx)(`button`,{type:`button`,className:u(`h-7 rounded-md text-[12px] text-(--text-muted) hover:bg-(--bg-hover) hover:text-(--text-primary) disabled:cursor-not-allowed disabled:opacity-60`,H===e.value&&`bg-(--bg-active) text-(--text-primary)`),disabled:Q,onClick:()=>U(e.value),children:e.label},e.value))}),A&&(0,m.jsx)(ve,{steps:s,stageLabel:d})]}):(0,m.jsx)(`div`,{className:`h-full min-h-[420px] overflow-hidden rounded-xl border border-(--border-default) bg-(--bg-secondary)`,children:we?(0,m.jsxs)(`div`,{className:`h-full flex flex-col items-center justify-center px-8 text-center`,children:[(0,m.jsx)(ue,{size:28,className:`text-(--text-muted)`}),(0,m.jsx)(`p`,{className:`mt-3 text-[13px] text-(--text-secondary)`,children:l(`reportLoadFailed`)}),(0,m.jsx)(`button`,{className:`mt-4 h-8 rounded-md border border-(--border-default) px-3 text-[12px] text-(--text-primary) hover:bg-(--bg-hover)`,onClick:()=>N(!1),children:l(`retry`)})]}):X?(0,m.jsx)(`iframe`,{title:`CodeWiki ${X.file}`,src:je,sandbox:`allow-scripts`,className:`h-full w-full border-0 bg-white`,onLoad:()=>N(!1),onError:()=>N(!0)},X.file):(0,m.jsxs)(`div`,{className:`h-full flex items-center justify-center text-[13px] text-(--text-muted)`,children:[(0,m.jsx)(c,{size:16,className:`mr-2 animate-spin`}),l(`loading`)]})})})]}),(0,m.jsx)(`div`,{className:`codewiki-resizer max-xl:hidden`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize CodeWiki Q&A panel`,title:`Drag to resize`,onMouseDown:Ne,children:(0,m.jsx)(`span`,{className:`codewiki-resizer-handle`,children:(0,m.jsx)(de,{size:14,"aria-hidden":`true`})})}),(0,m.jsxs)(`aside`,{className:`bg-(--bg-secondary) min-h-0 flex flex-col max-xl:hidden`,children:[(0,m.jsx)(`div`,{className:`p-4 border-b border-(--border-default)`,children:(0,m.jsx)(`p`,{className:`mt-2 text-[12px] leading-5 text-(--text-muted)`,children:l(A?`noQuestionsDuringGeneration`:`tempReadOnlyQa`)})}),(0,m.jsx)(`div`,{ref:Ae,className:`flex-1 min-h-0 overflow-y-auto px-4 py-3`,children:W.length===0?(0,m.jsxs)(`div`,{className:`rounded-xl border border-(--border-default) bg-(--bg-primary) p-4`,children:[(0,m.jsx)(`p`,{className:`text-[13px] font-medium text-(--text-primary)`,children:l(A?`generatingCodeWiki`:K||n?`processingQuestion`:`canAskAboutProject`)}),(0,m.jsx)(`p`,{className:`mt-2 text-[12px] leading-5 text-(--text-muted)`,children:A?l(`askAfterGeneration`):Te||l(`exampleQuestions`)})]}):(0,m.jsx)(`div`,{className:`flex flex-col`,children:W.map(e=>(0,m.jsxs)(`div`,{children:[(0,m.jsx)(ce,{message:e}),e.loading&&(!e.segments||e.segments.length===0)&&(0,m.jsxs)(`div`,{className:`mt-[-12px] mb-3 ml-1 inline-flex items-center gap-2 rounded-xl border border-(--border-default) bg-(--bg-primary) px-3 py-2 text-[12px] text-(--text-muted)`,children:[(0,m.jsx)(c,{size:14,className:`animate-spin`}),l(`answering`)]})]},e.id))})}),(0,m.jsx)(`form`,{className:`p-4 border-t border-(--border-default)`,onSubmit:Fe,children:(0,m.jsxs)(`div`,{className:`flex items-center gap-2 rounded-full border border-(--border-default) bg-(--bg-primary) px-3 py-2`,children:[(0,m.jsx)(`input`,{value:P,onChange:e=>F(e.target.value),placeholder:A?l(`generatingCodeWiki`):K||n?l(`answering`):`Ask about this repository`,disabled:$,className:`min-w-0 flex-1 border-0 bg-transparent text-[13px] text-(--text-primary) outline-none placeholder:text-(--text-muted) disabled:opacity-60`}),(0,m.jsx)(`button`,{type:`submit`,className:`inline-flex size-7 items-center justify-center rounded-full text-(--text-muted) hover:bg-(--bg-hover) hover:text-(--text-primary) disabled:cursor-not-allowed disabled:opacity-50`,disabled:$||!P.trim(),"aria-label":l(`sendingQuestion`),children:K?(0,m.jsx)(c,{size:15,className:`animate-spin`}):(0,m.jsx)(fe,{size:15})})]})})]})]}),Oe&&(0,m.jsx)(`div`,{className:`codewiki-resize-overlay`}),(0,m.jsx)(ae,{open:!!z,title:l(`deleteReportConfirm`),description:l(`deleteReportDescription`).replace(`{{report}}`,z?.title||z?.file||``),loading:Ee,onOpenChange:e=>!e&&B(null),onConfirm:Ie})]})}export{E as CodeWikiPanel};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{a as t,r as n}from"./bundle-mjs-C44PrJ2C.js";import{t as r}from"./refresh-cw-DUgU5bEu.js";import{$ as i,H as a,M as o,P as s,S as c,T as ee,U as te,h as ne,lt as l,m as re,nt as ie,o as ae,p as oe,pt as u,t as d,v as f,z as se}from"./index-DyIUhlc8.js";import{MessageBubble as ce,t as le}from"./MessageBubble-BGnFIxcq.js";var ue=s(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),de=s(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),fe=s(`send-horizontal`,[[`path`,{d:`M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z`,key:`117uat`}],[`path`,{d:`M6 12h16`,key:`s4cdu5`}]]),p=e(t(),1),m=n(),pe=`codemini:codewiki:qa-width`,h=320,me=760,g=420,he=!1;function ge(){if(typeof window>`u`)return g;let e=Number(window.localStorage.getItem(pe));return Number.isFinite(e)?Math.min(me,Math.max(h,e)):g}function _(){return[{value:`fast`,label:l(`generationDepthFast`)},{value:`standard`,label:l(`generationDepthStandard`)},{value:`deep`,label:l(`generationDepthDeep`)}]}function _e(e){if(!e)return``;try{return new Intl.DateTimeFormat(`zh-CN`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}).format(new Date(e))}catch{return``}}function v(e){let t=Number(e||0);return!Number.isFinite(t)||t<=0?``:t<1024?`${t} B`:t<1024*1024?`${Math.round(t/1024)} KB`:`${(t/1024/1024).toFixed(1)} MB`}function y(e,t){let n=Array.isArray(e)?e:[];if(!n.length)return{done:0,total:0,pct:8,label:t||l(`startingAnalysis`),detail:l(`preparingScan`)};let r=n.filter(e=>e.status===`done`).length,i=n.find(e=>e.status===`failed`),a=n.find(e=>e.status===`running`)||n.find(e=>e.status===`in_progress`)||n.find(e=>e.status===`pending`)||n[n.length-1];return{done:r,total:n.length,pct:Math.max(8,Math.round(r/n.length*100)),label:i?l(`generationFailed`):a?.title||t||l(`generatingCodeWiki`),detail:i?i.title:`${r}/${n.length} ${l(`stepsCompleted`)}${a?.role?` · ${a.role.toUpperCase()}`:``}`}}function ve({steps:e,stageLabel:t,compact:n=!1}){let r=y(e,t);return(0,m.jsxs)(`div`,{className:u(`rounded-lg border border-(--border-default) bg-(--bg-primary) p-3 text-left`,n?`mt-3`:`mt-5 w-full max-w-md`),children:[(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,m.jsx)(`span`,{className:`truncate text-[12px] font-medium text-(--text-primary)`,children:r.label}),r.total>0&&(0,m.jsxs)(`span`,{className:`shrink-0 text-[11px] text-(--text-muted)`,children:[r.done,`/`,r.total]})]}),(0,m.jsx)(d,{value:r.pct,className:`mt-2 h-1.5`}),(0,m.jsx)(`p`,{className:`mt-2 truncate text-[11px] text-(--text-muted)`,children:r.detail})]})}function b(e,t){if(!Array.isArray(e)||e.length===0)return[{type:`tools`,cards:[t]}];let n=e[e.length-1];return n.type===`tools`?[...e.slice(0,-1),{...n,cards:[...n.cards,t]}]:[...e,{type:`tools`,cards:[t]}]}function x(e,t,n){return(Array.isArray(e)?e:[]).map(e=>{if(e.type!==`tools`)return e;let r=e.cards.findIndex(e=>e.id===t);if(r===-1)return e;let i=[...e.cards];return i[r]=n(i[r]),{...e,cards:i}})}function S(e){let t=Array.isArray(e)?e:[];return t.length===0?[{type:`text`,text:``,isStreaming:!1}]:t[t.length-1].type===`text`?t:[...t,{type:`text`,text:``,isStreaming:!1}]}function C(e,t){let n=String(t||``);if(!n)return Array.isArray(e)?e:[];let r=S(e),i=r[r.length-1];return[...r.slice(0,-1),{...i,text:`${i.text||``}${n}`,isStreaming:!0}]}function w(e,t){let n=S(e),r=n.length-1;return n.map((e,n)=>n===r&&e.type===`text`?{...e,text:t,isStreaming:!1}:e)}function T(e){return(Array.isArray(e)?e:[]).map(e=>e.type===`text`?{...e,isStreaming:!1}:e)}function ye(e,t){switch(t?.type){case`assistant:delta`:return{...e,segments:C(e.segments,t.text)};case`assistant:response`:return{...e,segments:t.text?w(e.segments,t.text):T(e.segments)};case`tool:start`:return{...e,segments:b(e.segments,{id:t.id,name:t.name,arguments:t.arguments,status:`running`,durationMs:null,summary:``,result:``})};case`tool:result`:return{...e,segments:x(e.segments,t.id,e=>({...e,result:t.content||e.result||``}))};case`tool:end`:return{...e,segments:x(e.segments,t.id,e=>({...e,status:`done`,durationMs:t.durationMs,summary:t.summary||e.summary||``}))};case`tool:error`:return{...e,segments:x(e.segments,t.id,e=>({...e,status:`error`,durationMs:t.durationMs,summary:t.summary||e.summary||``}))};case`tool:blocked`:return{...e,segments:x(e.segments,t.id,e=>({...e,status:`blocked`,summary:e.summary||`Tool blocked`}))};case`codewiki:done`:return{...e,loading:!1,segments:T(e.segments)};case`codewiki:error`:return{...e,role:`error`,loading:!1,segments:[{type:`text`,text:t.message||l(`codewikiFailed`),isStreaming:!1}]};default:return e}}function E({projectCwd:e,projectKey:t,busy:n,planSteps:s=[],stageLabel:d=``}){let[y,b]=(0,p.useState)([]),[x,S]=(0,p.useState)(``),[C,w]=(0,p.useState)(`report`),[T,E]=(0,p.useState)(!0),[be,D]=(0,p.useState)(!1),[xe,O]=(0,p.useState)(``),[Se,k]=(0,p.useState)(null),[A,j]=(0,p.useState)(!1),[Ce,M]=(0,p.useState)(``),[we,N]=(0,p.useState)(!1),[P,F]=(0,p.useState)(``),[Te,I]=(0,p.useState)(``),[L,R]=(0,p.useState)(!1),[z,B]=(0,p.useState)(null),[Ee,V]=(0,p.useState)(!1),[H,U]=(0,p.useState)(`standard`),[W,G]=(0,p.useState)([]),[K,q]=(0,p.useState)(!1),[J,De]=(0,p.useState)(ge),[Oe,ke]=(0,p.useState)(!1),Ae=(0,p.useRef)(null),Y=(0,p.useRef)({startX:0,startWidth:g}),X=(0,p.useMemo)(()=>y.find(e=>e.file===x)||null,[y,x]),je=X?`/api/codewiki/report/${encodeURIComponent(X.file)}${t?`?project=${encodeURIComponent(t)}`:``}`:``,Me=(0,p.useCallback)(async()=>{D(!0),O(``);try{let e=await te(t);k(e),e?.error&&O(e.error)}catch(e){O(e?.message||`Failed to load code graph`)}finally{D(!1)}},[t]),Z=(0,p.useCallback)(async({preferNewest:e=!1}={})=>{E(!0),M(``);try{let n=await a(t),r=[...Array.isArray(n?.reports)?n.reports:[]].sort((e,t)=>new Date(t.mtime||0)-new Date(e.mtime||0));b(r),S(t=>e&&r[0]?r[0].file:r.some(e=>e.file===t)?t:r[0]?.file||``)}catch(e){M(e?.message||l(`failedToLoad`))}finally{E(!1)}},[t]);(0,p.useEffect)(()=>{b([]),S(``),w(`report`),N(!1),F(``),I(``),G([]),q(!1),k(null),O(``),Z({preferNewest:!0})},[Z,Me,t]),(0,p.useEffect)(()=>{let e=Ae.current;e&&requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight})},[W,K]),(0,p.useEffect)(()=>{A&&n&&R(!0)},[n,A]),(0,p.useEffect)(()=>{!A||n||!L||(Z({preferNewest:!0}),j(!1),R(!1))},[n,A,Z,L]),(0,p.useEffect)(()=>{window.localStorage.setItem(pe,String(J))},[J]);let Ne=(0,p.useCallback)(e=>{e.preventDefault(),ke(!0),Y.current={startX:e.clientX,startWidth:J};let t=e=>{let t=Y.current.startX-e.clientX,n=Math.max(h,Math.min(me,window.innerWidth-720));De(Math.min(n,Math.max(h,Y.current.startWidth+t)))},n=()=>{ke(!1),document.body.style.cursor=``,document.body.style.userSelect=``,window.removeEventListener(`mousemove`,t),window.removeEventListener(`mouseup`,n)};document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,window.addEventListener(`mousemove`,t),window.addEventListener(`mouseup`,n)},[J]),Pe=async()=>{if(!(n||A)){M(``),j(!0),R(!1);try{let e=await i(H,t);e?.error&&(j(!1),M(e.message||l(`failedToStart`)))}catch(e){j(!1),M(e?.message||l(`failedToStart`))}}},Fe=async e=>{e.preventDefault();let n=P.trim();if(!n||Q||K)return;let r=Date.now(),i=`cw-assistant-${r}`;I(n),F(``),M(``),G(e=>[...e,{id:`cw-user-${r}`,role:`you`,text:n,segments:[{type:`text`,text:n,isStreaming:!1}],timestamp:new Date().toISOString()},{id:i,role:`general`,text:``,segments:[],timestamp:new Date().toISOString(),loading:!0}]),q(!0);try{await ie({question:n,reportFile:X?.file||``,project:t,onEvent:e=>{G(t=>t.map(t=>t.id===i?ye(t,e):t))}})}catch(e){G(t=>t.map(t=>t.id===i?{...t,role:`error`,loading:!1,segments:[{type:`text`,text:e?.message||l(`codewikiFailed`),isStreaming:!1}]}:t))}finally{q(!1)}},Ie=async()=>{if(z){V(!0),M(``);try{let e=await se(z.file,t);e?.error?M(e.message||l(`failedToDelete`)):(B(null),N(!1),await Z({preferNewest:!1}))}catch(e){M(e?.message||l(`failedToDelete`))}finally{V(!1)}}},Q=n||A,$=Q||K;return(0,m.jsxs)(`div`,{className:`flex-1 min-h-0 bg-(--bg-primary) rounded-[18px] border border-(--border-default) border-b-0 overflow-hidden my-1 mx-1`,children:[(0,m.jsxs)(`div`,{className:`codewiki-layout h-full min-h-0`,style:{"--codewiki-qa-width":`${J}px`},children:[(0,m.jsxs)(`aside`,{className:`border-r border-(--border-default) bg-(--bg-secondary) min-h-0 flex flex-col max-lg:hidden`,children:[(0,m.jsxs)(`div`,{className:`p-4 border-b border-(--border-default)`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2 text-(--text-primary)`,children:[(0,m.jsx)(o,{size:18}),(0,m.jsx)(`span`,{className:`font-semibold text-[15px]`,children:`CodeWiki`})]}),(0,m.jsx)(`p`,{className:`mt-2 text-[12px] leading-5 text-(--text-muted) truncate`,title:e||``,children:e||l(`currentProject`)}),(0,m.jsx)(`div`,{className:`mt-4 grid grid-cols-3 gap-1 rounded-lg border border-(--border-default) bg-(--bg-primary) p-1`,children:_().map(e=>(0,m.jsx)(`button`,{type:`button`,className:u(`h-7 rounded-md text-[12px] text-(--text-muted) hover:bg-(--bg-hover) hover:text-(--text-primary) disabled:cursor-not-allowed disabled:opacity-60`,H===e.value&&`bg-(--bg-active) text-(--text-primary)`),disabled:Q,onClick:()=>U(e.value),children:e.label},e.value))}),(0,m.jsxs)(`button`,{className:`mt-3 w-full h-9 rounded-lg border border-(--border-default) bg-(--bg-primary) text-[13px] text-(--text-primary) inline-flex items-center justify-center gap-2 hover:bg-(--bg-hover) disabled:cursor-not-allowed disabled:opacity-60`,onClick:Pe,disabled:Q,children:[A?(0,m.jsx)(c,{size:15,className:`animate-spin`}):(0,m.jsx)(f,{size:15}),l(A?`generating`:`generateNew`)]}),A&&(0,m.jsx)(ve,{steps:s,stageLabel:d,compact:!0})]}),(0,m.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3`,children:[(0,m.jsx)(`span`,{className:`text-[12px] font-medium text-(--text-muted)`,children:`Documents`}),(0,m.jsx)(`button`,{className:`inline-flex size-7 items-center justify-center rounded-md text-(--text-muted) hover:bg-(--bg-hover) hover:text-(--text-primary)`,onClick:()=>{Z({preferNewest:!0})},title:`Refresh`,"aria-label":`Refresh`,children:(0,m.jsx)(r,{size:14})})]}),(0,m.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-2 pb-4`,children:[he,T&&(0,m.jsxs)(`div`,{className:`px-3 py-6 text-[12px] text-(--text-muted) inline-flex items-center gap-2`,children:[(0,m.jsx)(c,{size:14,className:`animate-spin`}),l(`loadingReport`)]}),!T&&y.length===0&&(0,m.jsx)(`div`,{className:`mx-2 rounded-lg border border-dashed border-(--border-default) px-3 py-4 text-[12px] leading-5 text-(--text-muted)`,children:l(`noReportYet`)}),(0,m.jsx)(`div`,{className:`flex flex-col gap-1`,children:y.map(e=>(0,m.jsxs)(`div`,{className:u(`group w-full rounded-lg px-3 py-2 text-left hover:bg-(--bg-hover) cursor-pointer`,C===`report`&&x===e.file&&`bg-(--bg-active)`),onClick:()=>{w(`report`),S(e.file),N(!1)},children:[(0,m.jsxs)(`span`,{className:`flex items-start gap-2 text-[13px] text-(--text-primary)`,children:[(0,m.jsx)(le,{size:14,className:`shrink-0 mt-0.5 text-(--text-muted)`}),(0,m.jsx)(`span`,{className:`min-w-0 flex-1 break-words`,children:e.file}),(0,m.jsxs)(oe,{children:[(0,m.jsx)(ne,{asChild:!0,children:(0,m.jsx)(`button`,{type:`button`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded-md text-(--text-muted) opacity-0 hover:bg-(--bg-active) hover:text-(--text-primary) group-hover:opacity-100 focus:opacity-100`,onClick:e=>e.stopPropagation(),"aria-label":l(`reportActions`),children:(0,m.jsx)(ee,{size:14})})}),(0,m.jsx)(re,{align:`end`,className:`w-36 border-(--border-default) bg-(--bg-primary) p-1 text-(--text-primary)`,onClick:e=>e.stopPropagation(),children:(0,m.jsx)(`button`,{type:`button`,className:`w-full rounded-md px-2.5 py-2 text-left text-[13px] text-(--accent-red) hover:bg-(--accent-red-bg)`,onClick:()=>B(e),children:l(`deleteReport`)})})]})]}),(0,m.jsxs)(`span`,{className:`mt-1 block truncate pl-6 text-[11px] text-(--text-muted)`,children:[_e(e.mtime),v(e.size)?` · ${v(e.size)}`:``]})]},e.file))})]})]}),(0,m.jsxs)(`main`,{className:`min-w-0 min-h-0 flex flex-col bg-(--bg-primary)`,children:[Ce&&(0,m.jsxs)(`div`,{className:`mx-5 mt-4 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-[12px] text-red-400 inline-flex items-center gap-2`,children:[(0,m.jsx)(ue,{size:14}),Ce]}),(0,m.jsx)(`div`,{className:`flex-1 min-h-0 p-4`,children:!X&&!T?(0,m.jsxs)(`div`,{className:`h-full min-h-[420px] rounded-xl border border-dashed border-(--border-default) bg-(--bg-secondary) flex flex-col items-center justify-center text-center px-8`,children:[(0,m.jsx)(o,{size:34,className:`text-(--text-muted)`}),(0,m.jsx)(`h2`,{className:`mt-4 text-[18px] font-semibold text-(--text-primary)`,children:l(`noCodeWiki`)}),(0,m.jsx)(`p`,{className:`mt-2 max-w-md text-[13px] leading-6 text-(--text-muted)`,children:l(`reportWillShow`)}),(0,m.jsxs)(`button`,{className:`mt-5 h-10 rounded-lg bg-(--text-primary) px-4 text-[13px] font-medium text-(--bg-primary) inline-flex items-center gap-2 disabled:cursor-not-allowed disabled:opacity-60`,onClick:Pe,disabled:Q,children:[A?(0,m.jsx)(c,{size:16,className:`animate-spin`}):(0,m.jsx)(f,{size:16}),l(A?`generating`:`generateNew`)]}),(0,m.jsx)(`div`,{className:`mt-3 grid w-full max-w-xs grid-cols-3 gap-1 rounded-lg border border-(--border-default) bg-(--bg-primary) p-1`,children:_().map(e=>(0,m.jsx)(`button`,{type:`button`,className:u(`h-7 rounded-md text-[12px] text-(--text-muted) hover:bg-(--bg-hover) hover:text-(--text-primary) disabled:cursor-not-allowed disabled:opacity-60`,H===e.value&&`bg-(--bg-active) text-(--text-primary)`),disabled:Q,onClick:()=>U(e.value),children:e.label},e.value))}),A&&(0,m.jsx)(ve,{steps:s,stageLabel:d})]}):(0,m.jsx)(`div`,{className:`h-full min-h-[420px] overflow-hidden rounded-xl border border-(--border-default) bg-(--bg-secondary)`,children:we?(0,m.jsxs)(`div`,{className:`h-full flex flex-col items-center justify-center px-8 text-center`,children:[(0,m.jsx)(ue,{size:28,className:`text-(--text-muted)`}),(0,m.jsx)(`p`,{className:`mt-3 text-[13px] text-(--text-secondary)`,children:l(`reportLoadFailed`)}),(0,m.jsx)(`button`,{className:`mt-4 h-8 rounded-md border border-(--border-default) px-3 text-[12px] text-(--text-primary) hover:bg-(--bg-hover)`,onClick:()=>N(!1),children:l(`retry`)})]}):X?(0,m.jsx)(`iframe`,{title:`CodeWiki ${X.file}`,src:je,sandbox:`allow-scripts`,className:`h-full w-full border-0 bg-white`,onLoad:()=>N(!1),onError:()=>N(!0)},X.file):(0,m.jsxs)(`div`,{className:`h-full flex items-center justify-center text-[13px] text-(--text-muted)`,children:[(0,m.jsx)(c,{size:16,className:`mr-2 animate-spin`}),l(`loading`)]})})})]}),(0,m.jsx)(`div`,{className:`codewiki-resizer max-xl:hidden`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize CodeWiki Q&A panel`,title:`Drag to resize`,onMouseDown:Ne,children:(0,m.jsx)(`span`,{className:`codewiki-resizer-handle`,children:(0,m.jsx)(de,{size:14,"aria-hidden":`true`})})}),(0,m.jsxs)(`aside`,{className:`bg-(--bg-secondary) min-h-0 flex flex-col max-xl:hidden`,children:[(0,m.jsx)(`div`,{className:`p-4 border-b border-(--border-default)`,children:(0,m.jsx)(`p`,{className:`mt-2 text-[12px] leading-5 text-(--text-muted)`,children:l(A?`noQuestionsDuringGeneration`:`tempReadOnlyQa`)})}),(0,m.jsx)(`div`,{ref:Ae,className:`flex-1 min-h-0 overflow-y-auto px-4 py-3`,children:W.length===0?(0,m.jsxs)(`div`,{className:`rounded-xl border border-(--border-default) bg-(--bg-primary) p-4`,children:[(0,m.jsx)(`p`,{className:`text-[13px] font-medium text-(--text-primary)`,children:l(A?`generatingCodeWiki`:K||n?`processingQuestion`:`canAskAboutProject`)}),(0,m.jsx)(`p`,{className:`mt-2 text-[12px] leading-5 text-(--text-muted)`,children:A?l(`askAfterGeneration`):Te||l(`exampleQuestions`)})]}):(0,m.jsx)(`div`,{className:`flex flex-col`,children:W.map(e=>(0,m.jsxs)(`div`,{children:[(0,m.jsx)(ce,{message:e}),e.loading&&(!e.segments||e.segments.length===0)&&(0,m.jsxs)(`div`,{className:`mt-[-12px] mb-3 ml-1 inline-flex items-center gap-2 rounded-xl border border-(--border-default) bg-(--bg-primary) px-3 py-2 text-[12px] text-(--text-muted)`,children:[(0,m.jsx)(c,{size:14,className:`animate-spin`}),l(`answering`)]})]},e.id))})}),(0,m.jsx)(`form`,{className:`p-4 border-t border-(--border-default)`,onSubmit:Fe,children:(0,m.jsxs)(`div`,{className:`flex items-center gap-2 rounded-full border border-(--border-default) bg-(--bg-primary) px-3 py-2`,children:[(0,m.jsx)(`input`,{value:P,onChange:e=>F(e.target.value),placeholder:A?l(`generatingCodeWiki`):K||n?l(`answering`):`Ask about this repository`,disabled:$,className:`min-w-0 flex-1 border-0 bg-transparent text-[13px] text-(--text-primary) outline-none placeholder:text-(--text-muted) disabled:opacity-60`}),(0,m.jsx)(`button`,{type:`submit`,className:`inline-flex size-7 items-center justify-center rounded-full text-(--text-muted) hover:bg-(--bg-hover) hover:text-(--text-primary) disabled:cursor-not-allowed disabled:opacity-50`,disabled:$||!P.trim(),"aria-label":l(`sendingQuestion`),children:K?(0,m.jsx)(c,{size:15,className:`animate-spin`}):(0,m.jsx)(fe,{size:15})})]})})]})]}),Oe&&(0,m.jsx)(`div`,{className:`codewiki-resize-overlay`}),(0,m.jsx)(ae,{open:!!z,title:l(`deleteReportConfirm`),description:l(`deleteReportDescription`).replace(`{{report}}`,z?.title||z?.file||``),loading:Ee,onOpenChange:e=>!e&&B(null),onConfirm:Ie})]})}export{E as CodeWikiPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{a as t,r as n}from"./bundle-mjs-C44PrJ2C.js";import{a as r,i,n as a,r as o,t as s}from"./select-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{a as t,r as n}from"./bundle-mjs-C44PrJ2C.js";import{a as r,i,n as a,r as o,t as s}from"./select-J6668k2a.js";import{P as c,W as l,a as u,c as d,d as f,dt as p,f as m,ft as h,g,l as _,lt as v,pt as y,s as b,tt as x,u as S,ut as C}from"./index-DyIUhlc8.js";import{t as w}from"./input-BKNu4DOt.js";var T=c(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),E=e(t(),1),D=n();function O(e,t){return t.split(`.`).reduce((e,t)=>e?.[t],e)}function k(e){let t=Array.isArray(e?.options)?e.options.map(String):[];return t.length===2&&t.includes(`true`)&&t.includes(`false`)}function A({checked:e,onClick:t,title:n}){return(0,D.jsx)(`button`,{type:`button`,onClick:t,title:n,"aria-pressed":e,className:y(`relative h-5 w-9 rounded-full border shadow-inner transition-colors`,e?`border-(--text-primary) bg-(--text-primary)`:`border-(--border-strong) bg-(--bg-hover)`),children:(0,D.jsx)(`span`,{className:y(`absolute left-0.5 top-0.5 size-3.5 rounded-full transition-transform`,e?`bg-(--bg-primary)`:`bg-(--text-muted)`,e?`translate-x-4`:`translate-x-0`)})})}function j({open:e,onOpenChange:t,status:n=null,onSaved:c}){let y=[{title:v(`gateway`),keys:[{path:`gateway.base_url`,label:v(`baseUrl`),placeholder:`http://127.0.0.1:8000/v1`},{path:`gateway.api_key`,label:v(`apiKey`),type:`password`,placeholder:`sk-...`},{path:`gateway.timeout_ms`,label:v(`timeout`),type:`number`},{path:`gateway.max_retries`,label:v(`maxRetries`),type:`number`}]},{title:v(`sdk`),keys:[{path:`sdk.provider`,label:v(`provider`),options:[`openai-compatible`,`anthropic`],optionLogos:{"openai-compatible":`/logos/openai.svg`,anthropic:`/logos/claude-color.svg`}}]},{title:v(`model`),keys:[{path:`model.name`,label:v(`modelName`),placeholder:`gpt-4.1-mini`},{path:`model.fast_name`,label:v(`fastModel`),placeholder:`fallback to Model Name when empty`},{path:`model.max_context_tokens`,label:v(`maxContextTokens`),type:`number`}]},{title:v(`execution`),keys:[{path:`execution.mode`,label:v(`mode`),options:[`normal`,`plan`],optionLabels:{normal:v(`normalExecutionMode`),plan:v(`planMode`)}},{path:`execution.approval_mode`,label:v(`approvalMode`),options:[`review`,`auto`,`full_access`],optionLabels:{review:v(`reviewMode`),auto:v(`autoMode`),full_access:v(`fullAccessMode`)}},{path:`execution.max_steps`,label:v(`maxSteps`),type:`number`},{path:`ui.reply_language`,label:v(`replyLanguage`),options:[`zh`,`en`]}]},{title:v(`context`),keys:[{path:`context.preflight_trigger_pct`,label:v(`preflightTrigger`),type:`number`,placeholder:`60`},{path:`context.hard_limit_pct`,label:v(`hardLimit`),type:`number`,placeholder:`98`},{path:`context.tool_result_max_chars`,label:v(`toolResultMaxChars`),type:`number`,placeholder:`12000`},{path:`context.microcompact_enabled`,label:v(`microcompactEnabled`),options:[`true`,`false`]},{path:`context.microcompact_keep_recent`,label:v(`microcompactKeepRecent`),type:`number`,placeholder:`5`}]},{title:v(`shell`),keys:[{path:`shell.default`,label:v(`defaultShell`),options:[`bash`,`powershell`,`zsh`,`cmd`]}]},{title:v(`policy`),keys:[{path:`policy.safe_mode`,label:v(`safeMode`),options:[`true`,`false`]},{path:`policy.allowed_paths`,label:v(`allowedPaths`),placeholder:`["D:\\\\shared-assets","E:\\\\sibling-repo"]`,help:v(`allowedPathsHelp`)},{path:`policy.allow_dangerous_commands`,label:v(`allowDangerousCommands`),options:[`false`,`true`]}]}],[j,M]=(0,E.useState)(null),[N,P]=(0,E.useState)({}),[F,I]=(0,E.useState)(!1);(0,E.useEffect)(()=>{e&&(I(!0),l().then(e=>{M(e),P({})}).catch(()=>{}).finally(()=>I(!1)))},[e]);let L=(e,t)=>{P(n=>({...n,[e]:t}))},R=e=>{if(e in N)return N[e];let t=j?O(j,e):``;return Array.isArray(t)||t&&typeof t==`object`?JSON.stringify(t):String(t??``)},z=Object.keys(N).length>0;return(0,D.jsx)(b,{open:e,onOpenChange:t,children:(0,D.jsxs)(d,{className:`sm:max-w-[640px] max-h-[80vh] flex flex-col`,children:[(0,D.jsx)(S,{className:`shrink-0`,children:(0,D.jsx)(f,{children:v(`settingsTitle`)})}),(0,D.jsxs)(`div`,{className:`space-y-5 px-3.5 py-1 overflow-y-auto flex-1 min-h-0`,children:[n?.setupRequired&&(0,D.jsxs)(`div`,{className:`rounded-md border border-(--border-default) bg-(--bg-secondary) px-3 py-2 text-[13px] text-(--text-primary)`,children:[(0,D.jsx)(`div`,{className:`font-medium`,children:v(`configRequiredTitle`)}),(0,D.jsx)(`div`,{className:`mt-1 text-(--text-secondary)`,children:v(`configRequiredDesc`)})]}),F?(0,D.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,D.jsx)(u,{})}):y.map((e,t)=>(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`text-[13px] font-semibold text-(--text-secondary) mb-2.5 uppercase tracking-[0.3px]`,children:e.title}),(0,D.jsx)(`div`,{className:`space-y-2.5`,children:e.keys.map(e=>(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,D.jsxs)(`label`,{className:`text-[13px] text-(--text-muted) w-32 shrink-0`,children:[(0,D.jsx)(`span`,{children:e.label}),e.help&&(0,D.jsxs)(C,{children:[(0,D.jsx)(h,{asChild:!0,children:(0,D.jsx)(`button`,{type:`button`,className:`ml-1 inline-flex align-[-2px] text-(--text-muted) hover:text-(--text-primary)`,"aria-label":e.help,children:(0,D.jsx)(T,{size:13,strokeWidth:1.8})})}),(0,D.jsx)(p,{side:`right`,className:`max-w-[300px] leading-relaxed`,children:e.help})]})]}),k(e)?(0,D.jsx)(`div`,{className:`flex-1 flex items-center justify-end min-h-8`,children:(0,D.jsx)(A,{checked:R(e.path)===`true`,title:e.label,onClick:()=>L(e.path,R(e.path)!==`true`)})}):e.options?(0,D.jsxs)(s,{value:R(e.path),onValueChange:t=>L(e.path,t),children:[(0,D.jsx)(i,{className:`flex-1 h-8 text-[13px]`,children:(0,D.jsx)(r,{})}),(0,D.jsx)(a,{children:e.options.map(t=>(0,D.jsx)(o,{value:t,children:(0,D.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[e.optionLogos?.[t]&&(0,D.jsx)(`img`,{src:e.optionLogos[t],alt:``,width:13,height:13,className:`shrink-0 rounded-sm object-contain`}),e.optionLabels?.[t]||(e.optionLogos?t.toUpperCase():t)]})},t))})]}):(0,D.jsx)(w,{type:e.type||`text`,value:R(e.path),onChange:t=>L(e.path,t.target.value),placeholder:e.placeholder||``,className:`flex-1 h-8 text-[13px]`})]},e.path))}),t<y.length-1&&(0,D.jsx)(g,{className:`mt-4 bg-(--border-default)`})]},e.title))]}),(0,D.jsxs)(_,{className:`gap-2 shrink-0`,children:[(0,D.jsx)(m,{variant:`outline`,onClick:()=>t(!1),className:`text-[13px]`,children:v(`cancel`)}),(0,D.jsx)(m,{onClick:async()=>{try{for(let[e,t]of Object.entries(N)){let n=y.flatMap(e=>e.keys).find(t=>t.path===e);await x(e,k(n)?t===!0||t===`true`:n?.type===`number`?Number(t):t)}await c?.(),P({}),t(!1)}catch(e){console.error(`Config save failed:`,e)}},disabled:!z,className:`text-[13px]`,children:v(`saveChanges`)})]})]})})}export{j as ConfigDialog};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{a as t,r as n}from"./bundle-mjs-C44PrJ2C.js";import{G as r,c as i,d as a,lt as o,pt as s,s as c,u as l}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{a as t,r as n}from"./bundle-mjs-C44PrJ2C.js";import{G as r,c as i,d as a,lt as o,pt as s,s as c,u as l}from"./index-DyIUhlc8.js";import{t as u}from"./PatchDiff-CpHAbmv3.js";var d=e(t(),1),f=n(),p={M:`text-amber-600 dark:text-amber-400`,A:`text-green-600 dark:text-green-400`,D:`text-red-600 dark:text-red-400`,"?":`text-(--text-muted)`};function m({open:e,onOpenChange:t}){let[n,m]=(0,d.useState)(null),[h,g]=(0,d.useState)(!1),[_,v]=(0,d.useState)(null),y=(0,d.useCallback)(()=>document.documentElement.classList.contains(`dark`)||document.documentElement.dataset.theme===`dark`,[]),[b,x]=(0,d.useState)(y);(0,d.useEffect)(()=>{if(typeof window>`u`)return;let e=new MutationObserver(()=>x(y()));return e.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`data-theme`]}),()=>e.disconnect()},[y]);let S=(0,d.useCallback)(e=>{if(!n?.patch||!e)return``;let t=n.patch.split(`
|
|
2
2
|
`),r=[],i=!1;for(let n of t)if(n.startsWith(`diff --git `)){let t=n.match(/^diff --git a\/(.+) b\/(.+)$/);t&&(t[1]===e||t[2]===e)?(i=!0,r.push(n)):i=!1}else i&&r.push(n);return r.join(`
|
|
3
3
|
`)},[n?.patch]),C=(0,d.useMemo)(()=>Array.isArray(n?.files)?n.files.filter(e=>S(e.path).trim()):[],[n?.files,S]);(0,d.useEffect)(()=>{if(!e){m(null),v(null);return}g(!0),r().then(e=>{m(e)}).finally(()=>g(!1))},[e]),(0,d.useEffect)(()=>{if(e){if(!C.length){v(null);return}(!_||!C.some(e=>e.path===_))&&v(C[0].path)}},[C,e,_]);let w=(0,d.useMemo)(()=>S(_),[S,_]);return(0,f.jsx)(c,{open:e,onOpenChange:t,children:(0,f.jsxs)(i,{className:`sm:max-w-5xl h-[80vh] flex flex-col p-0 gap-0`,children:[(0,f.jsx)(l,{className:`px-5 pt-5 pb-3 shrink-0`,children:(0,f.jsx)(a,{children:o(`gitDiffTitle`)})}),h?(0,f.jsx)(`div`,{className:`flex-1 flex items-center justify-center py-12 text-(--text-muted) text-[13px]`,children:o(`gitDiffLoading`)}):C.length?(0,f.jsxs)(`div`,{className:`flex-1 flex min-h-0 border-t border-(--border-default)`,children:[(0,f.jsx)(`div`,{className:`w-[220px] shrink-0 border-r border-(--border-default) overflow-y-auto py-1`,children:C.map(e=>(0,f.jsxs)(`button`,{onClick:()=>v(e.path),className:s(`w-full text-left px-1 m-1 py-1.5 text-[12px] rounded-md cursor-pointer flex items-center gap-2 border-0 bg-transparent`,_===e.path?`bg-(--bg-hover) text-(--text-primary)`:`text-(--text-secondary) hover:bg-(--bg-hover)`),children:[(0,f.jsx)(`span`,{className:s(`shrink-0 text-[11px] font-mono w-[14px] text-center`,p[e.status]||``),children:e.status===`?`?`U`:e.status}),(0,f.jsx)(`span`,{className:`truncate`,children:e.path})]},e.path))}),(0,f.jsx)(`div`,{className:`flex-1 overflow-auto`,children:w?(0,f.jsx)(u,{patch:w,options:{theme:{dark:`pierre-dark`,light:`pierre-light`},themeType:b?`dark`:`light`,diffStyle:`unified`}}):(0,f.jsx)(`div`,{className:`flex items-center justify-center h-full text-(--text-muted) text-[12px]`,children:o(`gitDiffNoDiffAvailable`)})})]}):(0,f.jsx)(`div`,{className:`flex-1 flex items-center justify-center py-12 text-(--text-muted) text-[13px]`,children:o(`gitDiffNoChanges`)})]})})}export{m as GitDiffDialog};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{a as t,r as n}from"./bundle-mjs-C44PrJ2C.js";import{t as r}from"./chevron-right-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{a as t,r as n}from"./bundle-mjs-C44PrJ2C.js";import{t as r}from"./chevron-right-BBG4s6Zh.js";import{t as i}from"./refresh-cw-DUgU5bEu.js";import{n as a,t as o}from"./trash-2-H0DiWqiE.js";import{K as s,Q as c,c as l,d as u,f as d,g as f,j as p,k as m,lt as h,pt as g,r as _,s as v,u as y,w as b}from"./index-DyIUhlc8.js";import{t as x}from"./input-BKNu4DOt.js";var S=e(t(),1),C=n(),w=[`user`,`project`,`global`];function T(e){let t=Date.parse(e||``);return Number.isFinite(t)?new Date(t).toLocaleString(void 0,{month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`}):``}function E(e){return h(e===`project`?`projectScope`:e===`global`?`globalScope`:`userScope`)}function D(e,t){return`${e?.projectDir||t}:${e?.id||``}`}function O(e){return e===`__codemini_general__`?h(`generalChat`):e}function k(e=[]){return Array.isArray(e)?e.map(e=>String(e||``).trim()).filter(Boolean).join(`
|
|
2
2
|
`):``}function A({memory:e,deleting:t,onDelete:n}){return(0,C.jsx)(`div`,{className:`rounded-lg border border-(--border-default) bg-(--bg-primary) p-3`,children:(0,C.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,C.jsx)(`span`,{className:`truncate text-[13px] font-medium text-(--text-primary)`,children:e.summary||e.content||h(`memory`)}),(0,C.jsx)(_,{variant:`outline`,className:`h-4 rounded-md px-1.5 py-0 text-[10px] uppercase`,children:e.kind||`note`}),e.lifecycle&&(0,C.jsx)(_,{variant:`secondary`,className:`h-4 rounded-md px-1.5 py-0 text-[10px] uppercase`,children:e.lifecycle})]}),(0,C.jsx)(`div`,{className:`mt-1 whitespace-pre-wrap break-words text-[12px] leading-5 text-(--text-secondary)`,children:e.content||h(`noPreview`)}),(0,C.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-[10px] text-(--text-muted)`,children:[(0,C.jsx)(`span`,{className:`font-mono`,children:e.id}),e.updatedAt&&(0,C.jsx)(`span`,{children:T(e.updatedAt)}),Number.isFinite(Number(e.confidence))&&(0,C.jsxs)(`span`,{children:[Math.round(Number(e.confidence)*100),`%`]}),e.pinned&&(0,C.jsx)(`span`,{children:h(`pinned`)})]})]}),(0,C.jsx)(d,{variant:`ghost`,size:`icon-xs`,onClick:()=>n(e),disabled:t,title:h(`delete`),className:`shrink-0 text-(--accent-red) hover:text-(--accent-red)`,children:(0,C.jsx)(o,{size:13})})]})})}function j({open:e,onOpenChange:t,projectDirs:n=[]}){let[o,T]=(0,S.useState)(`user`),[j,M]=(0,S.useState)(``),[N,P]=(0,S.useState)([]),[F,I]=(0,S.useState)(!1),[L,R]=(0,S.useState)(``),[z,B]=(0,S.useState)(``),[V,H]=(0,S.useState)(()=>new Set),U=j.trim(),W=k(n),G=(0,S.useMemo)(()=>W?W.split(`
|
|
3
3
|
`):[],[W]),K=(0,S.useCallback)(async()=>{I(!0),R(``);try{let e=await s({scope:o,query:U,projectDirs:G});if(e?.error)throw Error(e.message||h(`memoryLoadFailed`));P(Array.isArray(e.items)?e.items:[])}catch(e){P([]),R(e.message||h(`memoryLoadFailed`))}finally{I(!1)}},[o,U,G]);(0,S.useEffect)(()=>{e&&K()},[e,K]);let q=(0,S.useMemo)(()=>N.reduce((e,t)=>{let n=t.kind||`note`;return e[n]=(e[n]||0)+1,e},{}),[N]),J=(0,S.useMemo)(()=>{if(o!==`project`)return{regular:N,projectGroups:[]};let e=[],t=new Map;for(let n of N){let r=n.projectDir||`__current_project__`;if(!t.has(r)){let i={key:r,name:O(n.projectName||h(`projectScope`)),items:[]};t.set(r,i),e.push(i)}t.get(r).items.push(n)}return{regular:[],projectGroups:e}},[N,o]),Y=(0,S.useCallback)(e=>{H(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),X=async e=>{if(e?.id&&confirm(h(`confirmDeleteMemory`).replace(`{{summary}}`,e.summary||e.id))){B(D(e,o)),R(``);try{let t=await c(o,e.id,e.projectDir);if(t?.error)throw Error(t.message||h(`deleteFailed`));await K()}catch(e){R(e.message||h(`deleteFailed`))}finally{B(``)}}};return(0,C.jsx)(v,{open:e,onOpenChange:t,children:(0,C.jsxs)(l,{className:`sm:max-w-[760px] h-[82vh] max-h-[82vh] flex flex-col overflow-hidden`,children:[(0,C.jsx)(y,{className:`shrink-0`,children:(0,C.jsx)(u,{children:h(`memoryManagement`)})}),(0,C.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3`,children:[(0,C.jsx)(`div`,{className:`rounded-lg border border-(--border-default) bg-(--bg-secondary) p-3`,children:(0,C.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(p,{size:14,className:`text-(--text-muted)`}),(0,C.jsx)(`span`,{className:`text-[13px] font-medium text-(--text-primary)`,children:h(`memoryLibrary`)})]}),(0,C.jsx)(`div`,{className:`mt-1 text-[11px] text-(--text-muted)`,children:h(`memoryPanelHint`)})]}),(0,C.jsxs)(d,{variant:`outline`,onClick:K,disabled:F,size:`sm`,children:[(0,C.jsx)(i,{size:13,className:g(F&&`animate-spin`)}),h(`refresh`)]})]})}),(0,C.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,C.jsx)(`div`,{className:`flex shrink-0 rounded-md border border-(--border-default) p-0.5 gap-0.5`,children:w.map(e=>(0,C.jsx)(d,{type:`button`,variant:o===e?`secondary`:`ghost`,size:`xs`,onClick:()=>T(e),className:`px-2`,children:E(e)},e))}),(0,C.jsxs)(`div`,{className:`relative flex-1`,children:[(0,C.jsx)(a,{size:13,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-(--text-muted)`}),(0,C.jsx)(x,{value:j,onChange:e=>M(e.target.value),placeholder:h(`searchMemories`),className:`h-8 pl-8 text-[13px]`})]})]}),Object.keys(q).length>0&&(0,C.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:Object.entries(q).map(([e,t])=>(0,C.jsxs)(_,{variant:`outline`,className:`rounded-md px-1.5 py-0 text-[10px] uppercase`,children:[e,`: `,t]},e))}),(0,C.jsx)(f,{className:`bg-(--border-default)`}),L&&(0,C.jsx)(`div`,{className:`rounded-md border border-(--accent-red) bg-(--accent-red-bg) px-3 py-2 text-[12px] text-(--accent-red)`,children:L}),(0,C.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pr-1`,children:F?(0,C.jsxs)(`div`,{className:`py-8 text-center text-[12px] text-(--text-muted)`,children:[h(`loading`),`...`]}):N.length===0?(0,C.jsxs)(`div`,{className:`rounded-lg border border-dashed border-(--border-default) py-8 text-center`,children:[(0,C.jsx)(`div`,{className:`text-[13px] text-(--text-primary)`,children:h(U?`noMatches`:`noMemories`)}),(0,C.jsx)(`div`,{className:`mt-1 text-[11px] text-(--text-muted)`,children:h(`noMemoriesHint`)})]}):(0,C.jsxs)(`div`,{className:`grid gap-2`,children:[J.regular.map(e=>(0,C.jsx)(A,{memory:e,deleting:z===D(e,o),onDelete:X},D(e,o))),J.projectGroups.map(e=>{let t=V.has(e.key);return(0,C.jsxs)(`div`,{className:`grid gap-1`,children:[(0,C.jsxs)(`button`,{type:`button`,onClick:()=>Y(e.key),className:`flex h-8 w-full items-center gap-2 rounded-md border-0 bg-transparent px-2 text-left text-[12px] font-medium text-(--text-primary) hover:bg-(--bg-hover)`,title:e.key,children:[(0,C.jsx)(b,{size:14,className:`shrink-0 text-(--text-muted)`}),(0,C.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,C.jsx)(`span`,{className:`shrink-0 text-[12px] font-medium text-(--text-accent)`,children:e.items.length}),t?(0,C.jsx)(r,{size:13,className:`shrink-0 text-(--text-muted)`}):(0,C.jsx)(m,{size:13,className:`shrink-0 text-(--text-muted)`})]}),!t&&(0,C.jsx)(`div`,{className:`grid gap-2 pl-6`,children:e.items.map(e=>(0,C.jsx)(A,{memory:e,deleting:z===D(e,o),onDelete:X},D(e,o)))})]},e.key)})]})})]})]})})}export{j as MemoryDialog};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-Dqm-Ium4.js","assets/rolldown-runtime-S-ySWqyJ.js","assets/html-DFeJ4St6.js","assets/css-DI4Ka_1L.js","assets/javascript-DHaqiI3u.js","assets/angular-ts-DXMH5pbz.js","assets/scss-CQGBghOa.js","assets/apl-Bt--uCmj.js","assets/json-Yl_wWztW.js","assets/xml-BUsFQ36n.js","assets/java-Bb7gkEG1.js","assets/astro-ZfS8gVPQ.js","assets/postcss-C_rkJ2pP.js","assets/tsx-BPnxgPXu.js","assets/typescript-DkKrEyJv.js","assets/blade-DsiMSXb3.js","assets/html-derivative-BPYIQd1q.js","assets/sql-Bx-skccv.js","assets/bsl-CZ9gUG7G.js","assets/sdbl-Ds7t3N0Q.js","assets/c-DKLNAy6n.js","assets/cairo-CZcbsYHl.js","assets/python-DypNN-aL.js","assets/cobol-BdhxDqSp.js","assets/coffee-DYSdownS.js","assets/cpp-CmF4N5qy.js","assets/glsl-BZXoHx-5.js","assets/regexp-CEudNzRJ.js","assets/crystal-N7P3W5Mw.js","assets/shellscript-Cim6Loaj.js","assets/edge-DrMWCZ8c.js","assets/elixir-CNV7hmh2.js","assets/elm-DuNA2Kle.js","assets/erb-Cx6GPjju.js","assets/ruby-DJfS371J.js","assets/graphql-lozg2JzK.js","assets/jsx-C-BZR9Er.js","assets/haml-CvBskpbA.js","assets/lua-D82-t9Zc.js","assets/yaml--meH0-me.js","assets/erlang-3or6Qr_S.js","assets/markdown-qxcI0Ex1.js","assets/fortran-fixed-form-Hy2szps7.js","assets/fortran-free-form-Cyk1FB1e.js","assets/fsharp-CgGHW39K.js","assets/gdresource-D6abIutu.js","assets/gdscript-_NYgB0-E.js","assets/gdshader-Bhkdknye.js","assets/git-commit-DBwdkqC2.js","assets/diff-BYMwyQmB.js","assets/git-rebase-CLt-2irw.js","assets/glimmer-js-BhZXPPf_.js","assets/glimmer-ts-BZwU8tUk.js","assets/hack-BIx3oBuG.js","assets/handlebars-Ca8Ew3WT.js","assets/http-BaSHFqsp.js","assets/hurl-Cu0t_0Ag.js","assets/csv-BsMY8_5o.js","assets/hxml-IWjzRLpN.js","assets/haxe-Bnka4w1v.js","assets/jinja-Cnv9YtxF.js","assets/jison-V0queBoO.js","assets/julia-D6Tp2lkv.js","assets/r-UrwRxojO.js","assets/just-DNL8d4mn.js","assets/perl-C6Dd0zxb.js","assets/latex-BKz2_Nxu.js","assets/tex-CAFucSbn.js","assets/liquid-CnfwjcTC.js","assets/marko-BXWoQ9lL.js","assets/less-_4Z4Zbgj.js","assets/mdc-uFBHmEgm.js","assets/nextflow-S7dXFF9l.js","assets/nextflow-groovy-Dk0GcQpl.js","assets/nginx-3W9nM9y_.js","assets/nim-DWppal1v.js","assets/php-9sDqPlZW.js","assets/pug-BYheLFcw.js","assets/qml-D3LW5Eh4.js","assets/razor-wtlbOx1Y.js","assets/csharp-B1bok3CS.js","assets/rst-CUgtqtsm.js","assets/cmake-Dn2uxUrm.js","assets/sas-B3ML-BPY.js","assets/shaderlab-Ds6Ob14m.js","assets/hlsl-CblrQXA-.js","assets/shellsession-1pj9xPto.js","assets/soy-CyoIOmkE.js","assets/sparql-EV95tWuj.js","assets/turtle-Cj8ap4C4.js","assets/stata-Cxm-fX20.js","assets/surrealql-C89H8_VG.js","assets/svelte-DVuJzFhW.js","assets/templ-Dr4toWAi.js","assets/go-BF9dg2tN.js","assets/ts-tags-DXz1U_l8.js","assets/twig-BOjawstu.js","assets/vue-d4Ps-pL3.js","assets/vue-html-Cc_wxOgn.js","assets/vue-vine-BDiNGm6C.js","assets/stylus-C836DBsS.js","assets/xsl-DjgS9HxR.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{n as e,r as t}from"./rolldown-runtime-S-ySWqyJ.js";import{a as n,r}from"./bundle-mjs-C44PrJ2C.js";import{t as i}from"./chevron-right-
|
|
2
|
+
import{n as e,r as t}from"./rolldown-runtime-S-ySWqyJ.js";import{a as n,r}from"./bundle-mjs-C44PrJ2C.js";import{t as i}from"./chevron-right-BBG4s6Zh.js";import{n as a,t as o}from"./trash-2-H0DiWqiE.js";import{A as s,C as c,D as l,N as u,O as d,P as f,S as p,_ as m,a as h,at as g,dt as _,ft as v,i as y,it as ee,j as te,k as b,lt as x,o as ne,pt as S,ut as C,w as re,x as ie,y as ae}from"./index-DyIUhlc8.js";import{a as w,i as T,n as oe,o as se,r as ce,s as le,t as ue}from"./PatchDiff-CpHAbmv3.js";import{r as de}from"./chunk-BO2N2NFS-fRXUeu1b.js";var fe=f(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),pe=f(`file-pen-line`,[[`path`,{d:`M14.364 13.634a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506l4.013-4.009a1 1 0 0 0-3.004-3.004z`,key:`ukzhwg`}],[`path`,{d:`M14.487 7.858A1 1 0 0 1 14 7V2`,key:`1klhew`}],[`path`,{d:`M20 19.645V20a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l2.516 2.516`,key:`rxaxab`}],[`path`,{d:`M8 18h1`,key:`13wk12`}]]),me=f(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),he=f(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),E=t(n(),1);function ge(e){let t=Number(e);if(!Number.isFinite(t)||t<0)return``;let n=t>0?Math.max(.1,t/1e3):0;return n<60?`${n.toFixed(1)}s`:`${Math.floor(n/60)}m ${Math.floor(n%60)}s`}function _e(e){let t=typeof e==`string`?new Date(e):e,n=new Date,r=t.toDateString()===n.toDateString(),i=t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`});return r?i:t.toLocaleDateString([],{month:`short`,day:`numeric`})+` `+i}var D=r(),ve={read:me,edit:pe,write:pe,delete:o,run:m,grep:a,glob:re,list:re,web_fetch:c,web_search:a,default:he};function ye(e){let t=String(e).match(/^(\w+)/);return t?t[1]:e}function be(e,t){if(!e)return``;let n=e;if(typeof e==`string`)try{n=JSON.parse(e)}catch{return e}if(typeof n!=`object`)return String(n);let r={read:`path`,edit:`path`,write:`path`,delete:`path`,run:`command`,grep:`pattern`,glob:`pattern`,list:`path`,web_fetch:`url`,web_search:`query`}[t];if(r&&n[r]!=null)return String(n[r]);for(let e of Object.values(n))if(typeof e==`string`&&e.length>0&&e.length<200)return e;return``}function xe(e){if(typeof e!=`string`)return JSON.stringify(e,null,2);let t=e.trim();if(!t)return``;try{return JSON.stringify(JSON.parse(t),null,2)}catch{return e}}function Se(e){if(!e)return null;if(typeof e==`object`)return e;if(typeof e!=`string`)return null;try{return JSON.parse(e)}catch{return null}}function Ce(e){let t=String(e||``).replace(/\\/g,`/`);return t.split(`/`).filter(Boolean).pop()||t}function we(e){return!e||typeof e!=`object`?{}:e.edit&&typeof e.edit==`object`?e.edit:e}function Te(e){let t=String(e||``);return t.startsWith(`diff --git `)||t.includes(`
|
|
3
3
|
diff --git `)||t.includes(`
|
|
4
4
|
@@ `)}function Ee(){let e=()=>document.documentElement.classList.contains(`dark`)||document.documentElement.dataset.theme===`dark`,[t,n]=(0,E.useState)(()=>typeof document>`u`?!0:e());return(0,E.useEffect)(()=>{if(typeof document>`u`)return;let t=new MutationObserver(()=>n(e()));return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`data-theme`]}),()=>t.disconnect()},[]),t?`dark`:`light`}function De(e,t,n,r,i,a,o){if(![`edit`,`write`,`delete`].includes(e))return null;let s=Se(t)||{},c={...Se(n)||{},...a&&typeof a==`object`?a:{}},l=Array.isArray(o)&&o.length?o:i?[i]:[],u=l.find(e=>e&&typeof e==`object`)||{},d=l.map(e=>String(e?.diffPreview||``)).filter(Boolean).join(`
|
|
5
5
|
`),f=we(s),p=c.path||u.path||s.path||s.file||s.file_path||``,m=Number(c.lines_added??c.linesAdded??u.linesAdded??0),h=Number(c.lines_removed??c.linesRemoved??u.linesRemoved??0),g=e===`edit`?f.old_text??f.old_string??s.old_text:``,_=e===`edit`?f.new_text??f.new_string??f.new_content??f.content??s.new_text:``,v=Number(c.changed_line||u.changedLine||s.line||0);return{path:String(p||be(t,e)||``),action:String(c.action||u.action||(e===`write`?`write`:e)),added:m,removed:h,changedLine:v,diffPreview:String(d||u.diffPreview||c.diff_preview||``),oldText:typeof g==`string`?g:``,newText:typeof _==`string`?_:``,summary:String(r||``),backupPath:String(c.backupPath||``),backupRelativePath:String(c.backupRelativePath||``),backupCreated:c.backupCreated===!0,backupReused:c.backupReused===!0,backupSkipped:c.backupSkipped===!0,backupError:String(c.backupError||``),backupReason:String(c.backupReason||``)}}function Oe(e){if(!e)return[];let t=e.diffPreview||e.summary.split(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-BtqWAyby.js","assets/rolldown-runtime-S-ySWqyJ.js","assets/html-CCOAFbPU.js","assets/css-D2Zgfenk.js","assets/javascript-Cn8UGaJe.js","assets/angular-ts-BUlY5dZZ.js","assets/scss-By7PHVyf.js","assets/apl-B9jkvghZ.js","assets/json-BlCKYbAr.js","assets/xml-DDsJXW9N.js","assets/java-X5SW6zDn.js","assets/astro-P-Wk2Uo3.js","assets/postcss-BVVH-mhK.js","assets/tsx-Cvi8n1qy.js","assets/typescript-DESGzanZ.js","assets/blade-CxVOILUn.js","assets/html-derivative-BN80HtRR.js","assets/sql-PkTJiLTy.js","assets/bsl-9Rfj8X2G.js","assets/sdbl-CtZR2I6R.js","assets/c-Ce4Vw5YJ.js","assets/cairo-B8t0-PSB.js","assets/python-Dt6SBvxD.js","assets/cobol-C67LYEki.js","assets/coffee-C_zREOQP.js","assets/cpp-BcL70P81.js","assets/glsl-BsJMlsXZ.js","assets/regexp-PTdmEsyL.js","assets/crystal-CoqbT5f8.js","assets/shellscript-wXQ3AlcS.js","assets/edge-DytV3yX5.js","assets/elixir-BLpitXJw.js","assets/elm-C5ZqKzP8.js","assets/erb-CxvZayEs.js","assets/ruby-DQmpjmxU.js","assets/graphql-Bzui-_oF.js","assets/jsx-mn0xQF_s.js","assets/haml-BL3Pq-bL.js","assets/lua-CG2sJZNs.js","assets/yaml-CZT5eZge.js","assets/erlang-CdOz9ruD.js","assets/markdown-BObkjWCp.js","assets/fortran-fixed-form-BmD2L0UY.js","assets/fortran-free-form-Db24aQuN.js","assets/fsharp-DgKUr7h2.js","assets/gdresource-BqgTfeIa.js","assets/gdscript-CxxY7zMa.js","assets/gdshader-W85lNgcx.js","assets/git-commit-CPnaL3nl.js","assets/diff-DGLbp6Xl.js","assets/git-rebase-BVjWygdV.js","assets/glimmer-js-bG2aM9pf.js","assets/glimmer-ts-D6GU3-HZ.js","assets/hack-Dl73UNBo.js","assets/handlebars-Dl0DZ9iU.js","assets/http-BT0m2fV8.js","assets/hurl-QdCmCx_B.js","assets/csv-Cx2EO4hN.js","assets/hxml-DlOl0PEf.js","assets/haxe-DxCG7g2C.js","assets/jinja-CzKj-PyV.js","assets/jison-CMHmT6Zn.js","assets/julia-ssnM4-62.js","assets/r-70IHnSKT.js","assets/just-BYVm1Mrm.js","assets/perl-Drip2S24.js","assets/latex--PKG7pkB.js","assets/tex-C26OlX33.js","assets/liquid-CmT9c2rW.js","assets/marko-CJF04FnX.js","assets/less-Dycz37IB.js","assets/mdc-DjUuZ2FY.js","assets/nextflow-CK5HLJvq.js","assets/nextflow-groovy-CYeLXiaP.js","assets/nginx-BC64-3-i.js","assets/nim-x_81C3Qr.js","assets/php-BbiCqfrp.js","assets/pug-D4U6GWCU.js","assets/qml-C7Gvixtn.js","assets/razor-CeMDYz78.js","assets/csharp-BJRWJrkS.js","assets/rst-4NiHKVzB.js","assets/cmake-DuxpWyxB.js","assets/sas-BXFb3Byc.js","assets/shaderlab-jhHUXThs.js","assets/hlsl-CU9ay1Rj.js","assets/shellsession-mbgkQZNs.js","assets/soy-Brdxowwc.js","assets/sparql-D050l-1j.js","assets/turtle-DsCF_r1D.js","assets/stata-rcB48Bwa.js","assets/surrealql-BEIq2Ti9.js","assets/svelte-DLivETBJ.js","assets/templ-DCO78tPK.js","assets/go-B2Qj-jpc.js","assets/ts-tags-DxtnKICy.js","assets/twig-l2jHuCJP.js","assets/vue-DTExrAHq.js","assets/vue-html-DF9b1rb0.js","assets/vue-vine-A_lRwVWt.js","assets/stylus-BPw8WnNN.js","assets/xsl-TnKTzvHo.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{a as t,r as n}from"./bundle-mjs-C44PrJ2C.js";import{i as r}from"./index-BhMtCC8_.js";import{a as i,c as a,l as o,o as s,p as c,r as l,s as u,t as d,u as f}from"./lib-BXWizt13.js";var p=n(),m={position:`absolute`,top:0,bottom:0,textAlign:`center`},h={display:`contents`};function g(){return null}var _=`diffs-container`,v=/(?=^From [a-f0-9]+ .+$)/m,y=/(?=^diff --git)/gm,b=/(?=^---\s+\S)/gm,x=/(?=^@@ )/gm,ee=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: (.*))?/m,S=/(?<=\n)/,C=/^(---|\+\+\+)\s+([^\t\r\n]+)/,w=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,T=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,E=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,D=`header-prefix`,te=`header-metadata`,ne=`header-custom`,O={dark:`pierre-dark`,light:`pierre-light`},re=`data-theme-css`,ie=`data-unsafe-css`,ae={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,hunkSeparatorHeight:32,fileGap:8},oe=Object.freeze({fromStart:0,fromEnd:0}),se={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},ce={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function le(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function ue(e,t){return typeof window>`u`&&t!=null?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,p.jsx)(p.Fragment,{children:e})}var k=e(t(),1),de=(0,k.createContext)(void 0);function fe(){return(0,k.useContext)(de)}var pe=new Map,me=new Map,he=new Map,ge=new Set;function _e(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if(typeof n==`string`){if(e=pe.get(n),e==null)throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,pe.has(n)||pe.set(n,e);ge.has(n)||(ge.add(n),t.loadThemeSync(e))}}var ve=new Map,ye=new Map,be=new Map,xe=new Set;function Se(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(xe.has(n.name))continue;let e=ve.get(n.name);e??(e=n,ve.set(n.name,e)),xe.add(e.name),t.loadLanguageSync(e.data)}}function Ce(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}var A=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function we(e){return Te(e)}function Te(e){return Array.isArray(e)?Ee(e):e instanceof RegExp?e:typeof e==`object`?De(e):e}function Ee(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=Te(e[n]);return t}function De(e){let t={};for(let n in e)t[n]=Te(e[n]);return t}function Oe(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function ke(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?ke(e.substring(0,e.length-1)):e.substr(~t+1)}var Ae=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,je=class{static hasCaptures(e){return e===null?!1:(Ae.lastIndex=0,Ae.test(e))}static replaceCaptures(e,t,n){return e.replace(Ae,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function Me(e,t){return e<t?-1:+(e>t)}function Ne(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=Me(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function Pe(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function Fe(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var Ie=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},Le=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(He(e),t)}static createFromParsedTheme(e,t){return We(e,t)}_cachedMatchRoot=new Ie(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>ze(e.parent,t.parentScopes));return n?new Ve(n.fontStyle,n.foreground,n.background):null}},Re=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function ze(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!Be(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Be(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var Ve=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function He(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8;break}}let s=null;typeof i.settings.foreground==`string`&&Pe(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&Pe(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new Ue(l,u,e,o,s,c)}}return n}var Ue=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},j=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(j||{});function We(e,t){e.sort((e,t)=>{let n=Me(e.scope,t.scope);return n!==0||(n=Ne(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new Ge(t),o=new Ve(n,a.getId(r),a.getId(i)),s=new Je(new qe(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new Le(a,o,s)}var Ge=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Ke=Object.freeze([]),qe=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||Ke,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},Je=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),qe.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(Ne(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new qe(e,t,n,r,i))}},Ye=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!=0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=Ze(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function Xe(e){return e}function Ze(e){return e}function Qe(e,t){let n=[],r=et(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if($e(i)){let e=[];do e.push(i),i=r.next();while($e(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function $e(e){return!!e&&!!e.match(/[\w\.:]+/)}function et(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function tt(e){typeof e.dispose==`function`&&e.dispose()}var nt=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},rt=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},it=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},at=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new nt(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new it;for(let n of e)ot(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof nt){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function ot(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof nt?ct({baseGrammar:a,selfGrammar:i},r):st(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new nt(e))}function st(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];lt([r],t,n)}}function ct(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&<(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&<(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function lt(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?Oe({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&<(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=ht(i);switch(a.kind){case 0:ct({...t,selfGrammar:t.baseGrammar},n);break;case 1:ct(t,n);break;case 2:st(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?st(a.ruleName,i,n):ct(i,n)}else a.kind===4?n.add(new rt(a.scopeName,a.ruleName)):n.add(new nt(a.scopeName));break}}}var ut=class{kind=0},dt=class{kind=1},ft=class{constructor(e){this.ruleName=e}kind=2},pt=class{constructor(e){this.scopeName=e}kind=3},mt=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function ht(e){if(e===`$base`)return new ut;if(e===`$self`)return new dt;let t=e.indexOf(`#`);return t===-1?new pt(e):t===0?new ft(e.substring(1)):new mt(e.substring(0,t),e.substring(t+1))}var gt=/\\(\d+)/,_t=/\\(\d+)/g,vt=-1,yt=-2;function bt(e){return e}function xt(e){return e}var St=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=je.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=je.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${ke(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:je.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:je.replaceCaptures(this._contentName,e,t)}},Ct=class extends St{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},wt=class extends St{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new kt(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new At,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Tt=class extends St{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new At,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Et=class extends St{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new kt(i,this.id),this.beginCaptures=a,this._end=new kt(o||``,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new At;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},Dt=class extends St{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new kt(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new kt(o,yt),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new At;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new At,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||``),this._cachedCompiledWhilePatterns}},Ot=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new Ct(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new wt(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=Oe({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new Tt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new Dt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new Et(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=ht(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l)if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository);break}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof Tt||e instanceof Et||e instanceof Dt)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},kt=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,typeof this.source==`string`?this.hasBackReferences=gt.test(this.source):this.hasBackReferences=!1}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return _t.lastIndex=0,this.source.replace(_t,(e,t)=>Fe(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=``,t[i+1]=``,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=``,t[i+1]=`G`,n[i+1]=``,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},At=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new jt(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new jt(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},jt=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
|
|
2
|
+
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{a as t,r as n}from"./bundle-mjs-C44PrJ2C.js";import{i as r}from"./index-DyIUhlc8.js";import{a as i,c as a,l as o,o as s,p as c,r as l,s as u,t as d,u as f}from"./lib-BXWizt13.js";var p=n(),m={position:`absolute`,top:0,bottom:0,textAlign:`center`},h={display:`contents`};function g(){return null}var _=`diffs-container`,v=/(?=^From [a-f0-9]+ .+$)/m,y=/(?=^diff --git)/gm,b=/(?=^---\s+\S)/gm,x=/(?=^@@ )/gm,ee=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: (.*))?/m,S=/(?<=\n)/,C=/^(---|\+\+\+)\s+([^\t\r\n]+)/,w=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,T=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,E=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,D=`header-prefix`,te=`header-metadata`,ne=`header-custom`,O={dark:`pierre-dark`,light:`pierre-light`},re=`data-theme-css`,ie=`data-unsafe-css`,ae={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,hunkSeparatorHeight:32,fileGap:8},oe=Object.freeze({fromStart:0,fromEnd:0}),se={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},ce={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function le(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function ue(e,t){return typeof window>`u`&&t!=null?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,p.jsx)(p.Fragment,{children:e})}var k=e(t(),1),de=(0,k.createContext)(void 0);function fe(){return(0,k.useContext)(de)}var pe=new Map,me=new Map,he=new Map,ge=new Set;function _e(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if(typeof n==`string`){if(e=pe.get(n),e==null)throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,pe.has(n)||pe.set(n,e);ge.has(n)||(ge.add(n),t.loadThemeSync(e))}}var ve=new Map,ye=new Map,be=new Map,xe=new Set;function Se(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(xe.has(n.name))continue;let e=ve.get(n.name);e??(e=n,ve.set(n.name,e)),xe.add(e.name),t.loadLanguageSync(e.data)}}function Ce(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}var A=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function we(e){return Te(e)}function Te(e){return Array.isArray(e)?Ee(e):e instanceof RegExp?e:typeof e==`object`?De(e):e}function Ee(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=Te(e[n]);return t}function De(e){let t={};for(let n in e)t[n]=Te(e[n]);return t}function Oe(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function ke(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?ke(e.substring(0,e.length-1)):e.substr(~t+1)}var Ae=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,je=class{static hasCaptures(e){return e===null?!1:(Ae.lastIndex=0,Ae.test(e))}static replaceCaptures(e,t,n){return e.replace(Ae,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function Me(e,t){return e<t?-1:+(e>t)}function Ne(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=Me(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function Pe(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function Fe(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var Ie=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},Le=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(He(e),t)}static createFromParsedTheme(e,t){return We(e,t)}_cachedMatchRoot=new Ie(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>ze(e.parent,t.parentScopes));return n?new Ve(n.fontStyle,n.foreground,n.background):null}},Re=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function ze(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!Be(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Be(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var Ve=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function He(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8;break}}let s=null;typeof i.settings.foreground==`string`&&Pe(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&Pe(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new Ue(l,u,e,o,s,c)}}return n}var Ue=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},j=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(j||{});function We(e,t){e.sort((e,t)=>{let n=Me(e.scope,t.scope);return n!==0||(n=Ne(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new Ge(t),o=new Ve(n,a.getId(r),a.getId(i)),s=new Je(new qe(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new Le(a,o,s)}var Ge=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Ke=Object.freeze([]),qe=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||Ke,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},Je=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),qe.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(Ne(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new qe(e,t,n,r,i))}},Ye=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!=0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=Ze(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function Xe(e){return e}function Ze(e){return e}function Qe(e,t){let n=[],r=et(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if($e(i)){let e=[];do e.push(i),i=r.next();while($e(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function $e(e){return!!e&&!!e.match(/[\w\.:]+/)}function et(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function tt(e){typeof e.dispose==`function`&&e.dispose()}var nt=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},rt=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},it=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},at=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new nt(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new it;for(let n of e)ot(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof nt){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function ot(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof nt?ct({baseGrammar:a,selfGrammar:i},r):st(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new nt(e))}function st(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];lt([r],t,n)}}function ct(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&<(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&<(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function lt(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?Oe({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&<(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=ht(i);switch(a.kind){case 0:ct({...t,selfGrammar:t.baseGrammar},n);break;case 1:ct(t,n);break;case 2:st(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?st(a.ruleName,i,n):ct(i,n)}else a.kind===4?n.add(new rt(a.scopeName,a.ruleName)):n.add(new nt(a.scopeName));break}}}var ut=class{kind=0},dt=class{kind=1},ft=class{constructor(e){this.ruleName=e}kind=2},pt=class{constructor(e){this.scopeName=e}kind=3},mt=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function ht(e){if(e===`$base`)return new ut;if(e===`$self`)return new dt;let t=e.indexOf(`#`);return t===-1?new pt(e):t===0?new ft(e.substring(1)):new mt(e.substring(0,t),e.substring(t+1))}var gt=/\\(\d+)/,_t=/\\(\d+)/g,vt=-1,yt=-2;function bt(e){return e}function xt(e){return e}var St=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=je.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=je.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${ke(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:je.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:je.replaceCaptures(this._contentName,e,t)}},Ct=class extends St{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},wt=class extends St{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new kt(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new At,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Tt=class extends St{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new At,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Et=class extends St{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new kt(i,this.id),this.beginCaptures=a,this._end=new kt(o||``,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new At;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},Dt=class extends St{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new kt(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new kt(o,yt),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new At;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new At,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||``),this._cachedCompiledWhilePatterns}},Ot=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new Ct(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new wt(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=Oe({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new Tt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new Dt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new Et(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=ht(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l)if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository);break}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof Tt||e instanceof Et||e instanceof Dt)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},kt=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,typeof this.source==`string`?this.hasBackReferences=gt.test(this.source):this.hasBackReferences=!1}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return _t.lastIndex=0,this.source.replace(_t,(e,t)=>Fe(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=``,t[i+1]=``,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=``,t[i+1]=`G`,n[i+1]=``,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},At=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new jt(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new jt(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},jt=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
|
|
3
3
|
`)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},Mt=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Nt=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new Mt(e,8),this._embeddedLanguagesMatcher=new Pt(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new Mt(0,0);_getBasicScopeAttributes=new Ie(e=>new Mt(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case`comment`:return 1;case`string`:return 2;case`regex`:return 3;case`meta.embedded`:return 0}throw Error(`Unexpected match for standard token type!`)}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},Pt=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([e,t])=>Fe(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(`)|(`)}))($|\\.)`,``)}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};typeof process<`u`&&{}.VSCODE_TEXTMATE_DEBUG;var Ft=!1,It=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Lt(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=Rt(e,t,n,r,i,a);i=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}let d=Date.now();for(;!l;){if(s!==0&&Date.now()-d>s)return new It(i,!0);f()}return new It(i,!1);function f(){let o=zt(e,t,n,r,i,u);if(!o){a.produce(i,c),l=!0;return}let s=o.captureIndices,d=o.matchedRuleId,f=s&&s.length>0?s[0].end>r:!1;if(d===vt){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),Gt(e,t,n,i,a,o.endCaptures,s),a.produce(i,s[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!f&&d.getEnterPos()===r){i=d,a.produce(i,c),l=!0;return}}else{let o=e.getRule(d);a.produce(i,s[0].start);let p=i,m=o.getName(t.content,s),h=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,r,u,s[0].end===c,null,h,h),o instanceof Et){let r=o;Gt(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.endHasBackReferences&&(i=i.withEndRule(r.getEndWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(o instanceof Dt){let r=o;Gt(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.whileHasBackReferences&&(i=i.withEndRule(r.getWhileWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(Gt(e,t,n,i,a,o.captures,s),a.produce(i,s[0].end),i=i.pop(),!f){i=i.safePop(),a.produce(i,c),l=!0;return}}s[0].end>r&&(r=s[0].end,n=!1)}}function Rt(e,t,n,r,i,a){let o=i.beginRuleCapturedEOL?0:-1,s=[];for(let t=i;t;t=t.pop()){let n=t.getRule(e);n instanceof Dt&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=Ut(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==yt){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),Gt(e,t,n,c.stack,a,c.rule.whileCaptures,u.captureIndices),a.produce(c.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function zt(e,t,n,r,i,a){let o=Bt(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=Vt(s,e,t,n,r,i,a);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function Bt(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=Ht(i.getRule(e),e,i.endRule,n,r===a),c=o.findNextMatchSync(t,r,s);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function Vt(e,t,n,r,i,a,o){let s=Number.MAX_VALUE,c=null,l,u=0,d=a.contentNameScopesList.getScopeNames();for(let a=0,f=e.length;a<f;a++){let f=e[a];if(!f.matcher(d))continue;let{ruleScanner:p,findOptions:m}=Ht(t.getRule(f.ruleId),t,null,r,i===o),h=p.findNextMatchSync(n,i,m);if(!h)continue;let g=h.captureIndices[0].start;if(!(g>=s)&&(s=g,c=h.captureIndices,l=h.ruleId,u=f.priority,s===i))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function Ht(e,t,n,r,i){return Ft?{ruleScanner:e.compile(t,n),findOptions:Wt(r,i)}:{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function Ut(e,t,n,r,i){return Ft?{ruleScanner:e.compileWhile(t,n),findOptions:Wt(r,i)}:{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function Wt(e,t){let n=0;return e||(n|=1),t||(n|=4),n}function Gt(e,t,n,r,i,a,o){if(a.length===0)return;let s=t.content,c=Math.min(a.length,o.length),l=[],u=o[0].end;for(let t=0;t<c;t++){let c=a[t];if(c===null)continue;let d=o[t];if(d.length===0)continue;if(d.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=d.start;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?i.produceFromScopes(l[l.length-1].scopes,d.start):i.produce(r,d.start),c.retokenizeCapturedWithRuleId){let t=c.getName(s,o),a=r.contentNameScopesList.pushAttributed(t,e),l=c.getContentName(s,o),u=a.pushAttributed(l,e),f=r.push(c.retokenizeCapturedWithRuleId,d.start,-1,!1,null,a,u),p=e.createOnigString(s.substring(0,d.end));Lt(e,p,n&&d.start===0,d.start,f,i,!1,0),tt(p);continue}let f=c.getName(s,o);if(f!==null){let t=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(f,e);l.push(new Kt(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var Kt=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function qt(e,t,n,r,i,a,o,s){return new Zt(e,t,n,r,i,a,o,s)}function Jt(e,t,n,r,i){let a=Qe(t,Yt),o=Ot.getCompiledRuleId(n,r,i.repository);for(let n of a)e.push({debugSelector:t,matcher:n.matcher,ruleId:o,grammar:i,priority:n.priority})}function Yt(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let r=n;r<t.length;r++)if(Xt(t[r],e))return n=r+1,!0;return!1})}function Xt(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]===`.`}var Zt=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new Nt(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=Qt(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=Qe(e,Yt);for(let n of t)this._tokenTypeMatchers.push({matcher:n.matcher,type:i[e]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e={lookup:e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),injections:e=>this._grammarRepository.injections(e)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){let e=r.injections;if(e)for(let n in e)Jt(t,n,e[n],this,r);let i=this._grammarRepository.injections(n);i&&i.forEach(e=>{let n=this.getExternalGrammar(e);if(n){let e=n.injectionSelector;e&&Jt(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,n=e(bt(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[xt(e)]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Qt(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){let r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){let r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=Ot.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===en.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=Ye.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?$t.createRootAndLookUpScopeName(a,r,this):$t.createRoot(`unknown`,r),t=new en(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=`
|
|
4
4
|
`;let a=this.createOnigString(e),o=a.content.length,s=new nn(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Lt(this,a,i,0,t,s,!0,r);return tt(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function Qt(e,t){return e=we(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var $t=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=Re.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new Re(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new Re(null,t),o=r.themeProvider.themeMatch(a);return new e(null,a,e.mergeAttributes(n,i,o))}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(!0)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),Ye.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a);return new e(t,a,e.mergeAttributes(t.tokenAttributes,i,o))}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},en=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t===null?!1:e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?$t.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,a,o,s){return new e(this,t,n,r,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),`[`+e.join(`,`)+`]`}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:xt(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=$t.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,bt(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,$t.fromExtension(r,n.contentNameScopesList))}},tn=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):Qe(e,Yt).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>Qe(e,Yt).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},nn=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(n=Ye.set(n,0,Xe(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=Ye.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},rn=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,i){if(!this._grammars.has(e)){let a=this._rawGrammars.get(e);if(!a)return null;this._grammars.set(e,qt(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},an=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new rn(Le.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(Le.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new tn(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new at(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(e=>this._loadSingleGrammar(e.scopeName)),a.processQueue();return this._grammarForScopeName(e,t,n,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n=typeof this._options.getInjections==`function`?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,i)}},on=en.NULL,sn=/["&'<>`]/g,cn=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,ln=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,un=/[|\\{}()[\]^$+*?.]/g,dn=new WeakMap;function fn(e,t){if(e=e.replace(t.subset?pn(t.subset):sn,r),t.subset||t.escapeOnly)return e;return e.replace(cn,n).replace(ln,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function pn(e){let t=dn.get(e);return t||(t=mn(e),dn.set(e,t)),t}function mn(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(un,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var hn=/[\dA-Fa-f]/;function gn(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!hn.test(String.fromCharCode(t))?r:r+`;`}var _n=/\d/;function vn(e,t,n){let r=`&#`+String(e);return n&&t&&!_n.test(String.fromCharCode(t))?r:r+`;`}var yn=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),bn={nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:``,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,fnof:`ƒ`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,bull:`•`,hellip:`…`,prime:`′`,Prime:`″`,oline:`‾`,frasl:`⁄`,weierp:`℘`,image:`ℑ`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`,quot:`"`,amp:`&`,lt:`<`,gt:`>`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,circ:`ˆ`,tilde:`˜`,ensp:` `,emsp:` `,thinsp:` `,zwnj:``,zwj:``,lrm:``,rlm:``,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,permil:`‰`,lsaquo:`‹`,rsaquo:`›`,euro:`€`},xn=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],Sn={}.hasOwnProperty,Cn={},wn;for(wn in bn)Sn.call(bn,wn)&&(Cn[bn[wn]]=wn);var Tn=/[^\dA-Za-z]/;function En(e,t,n,r){let i=String.fromCharCode(e);if(Sn.call(Cn,i)){let e=Cn[i],a=`&`+e;return n&&yn.includes(e)&&!xn.includes(e)&&(!r||t&&t!==61&&Tn.test(String.fromCharCode(t)))?a:a+`;`}return``}function Dn(e,t,n){let r=gn(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=En(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=vn(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function On(e,t){return fn(e,Object.assign({format:Dn},t))}var kn=/^>|^->|<!--|-->|--!>|<!-$/g,An=[`>`],jn=[`<`,`>`];function Mn(e,t,n,r){return r.settings.bogusComments?`<?`+On(e.value,Object.assign({},r.settings.characterReferences,{subset:An}))+`>`:`<!--`+e.value.replace(kn,i)+`-->`;function i(e){return On(e,Object.assign({},r.settings.characterReferences,{subset:jn}))}}function Nn(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}var M=In(1),Pn=In(-1),Fn=[];function In(e){return t;function t(t,n,r){let i=t?t.children:Fn,a=(n||0)+e,o=i[a];if(!r)for(;o&&d(o);)a+=e,o=i[a];return o}}var Ln={}.hasOwnProperty;function Rn(e){return t;function t(t,n,r){return Ln.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var zn=Rn({body:Hn,caption:Bn,colgroup:Bn,dd:Kn,dt:Gn,head:Bn,html:Vn,li:Wn,optgroup:Jn,option:Yn,p:Un,rp:qn,rt:qn,tbody:Zn,td:er,tfoot:Qn,th:er,thead:Xn,tr:$n});function Bn(e,t,n){let r=M(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&d(r.value.charAt(0)))}function Vn(e,t,n){let r=M(n,t);return!r||r.type!==`comment`}function Hn(e,t,n){let r=M(n,t);return!r||r.type!==`comment`}function Un(e,t,n){let r=M(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||!(n.type===`element`&&(n.tagName===`a`||n.tagName===`audio`||n.tagName===`del`||n.tagName===`ins`||n.tagName===`map`||n.tagName===`noscript`||n.tagName===`video`))}function Wn(e,t,n){let r=M(n,t);return!r||r.type===`element`&&r.tagName===`li`}function Gn(e,t,n){let r=M(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function Kn(e,t,n){let r=M(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function qn(e,t,n){let r=M(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function Jn(e,t,n){let r=M(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function Yn(e,t,n){let r=M(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function Xn(e,t,n){let r=M(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function Zn(e,t,n){let r=M(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function Qn(e,t,n){return!M(n,t)}function $n(e,t,n){let r=M(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function er(e,t,n){let r=M(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var tr=Rn({body:ir,colgroup:ar,head:rr,html:nr,tbody:or});function nr(e){let t=M(e,-1);return!t||t.type!==`comment`}function rr(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function ir(e){let t=M(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&d(t.value.charAt(0)))&&!(t.type===`element`&&(t.tagName===`meta`||t.tagName===`link`||t.tagName===`script`||t.tagName===`style`||t.tagName===`template`))}function ar(e,t,n){let r=Pn(n,t),i=M(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&zn(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function or(e,t,n){let r=Pn(n,t),i=M(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&zn(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var sr={name:[[`
|
|
5
5
|
\f\r &/=>`.split(``),`
|
package/codemini-web/dist/assets/{ProjectSelector-DXIep3lE.js → ProjectSelector-CgJDcTNL.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{a as t,r as n}from"./bundle-mjs-C44PrJ2C.js";import{a as r,i,n as a,o,r as s,s as c,t as l}from"./select-BLOccU1M.js";import{At as u,Dt as d,Ft as f,I as p,Nt as m,Tt as h,c as g,d as _,f as v,jt as y,k as b,kt as x,lt as S,pt as C,q as w,s as T,u as E}from"./index-BhMtCC8_.js";import{t as D}from"./input-CYpdNDlR.js";var O=e(t(),1),k=n();function A(e,t){return O.useReducer((e,n)=>t[e][n]??e,e)}var j=`ScrollArea`,[M,N]=y(j),[ee,P]=M(j),F=O.forwardRef((e,t)=>{let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,l]=O.useState(null),[u,d]=O.useState(null),[p,h]=O.useState(null),[g,_]=O.useState(null),[v,y]=O.useState(null),[b,x]=O.useState(0),[S,C]=O.useState(0),[w,T]=O.useState(!1),[E,D]=O.useState(!1),A=f(t,e=>l(e)),j=c(i);return(0,k.jsx)(ee,{scope:n,type:r,dir:j,scrollHideDelay:a,scrollArea:s,viewport:u,onViewportChange:d,content:p,onContentChange:h,scrollbarX:g,onScrollbarXChange:_,scrollbarXEnabled:w,onScrollbarXEnabledChange:T,scrollbarY:v,onScrollbarYChange:y,scrollbarYEnabled:E,onScrollbarYEnabledChange:D,onCornerWidthChange:x,onCornerHeightChange:C,children:(0,k.jsx)(m.div,{dir:j,...o,ref:A,style:{position:`relative`,"--radix-scroll-area-corner-width":b+`px`,"--radix-scroll-area-corner-height":S+`px`,...e.style}})})});F.displayName=j;var I=`ScrollAreaViewport`,L=O.forwardRef((e,t)=>{let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=P(I,n),s=f(t,O.useRef(null),o.onViewportChange);return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:i}),(0,k.jsx)(m.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,k.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})});L.displayName=I;var R=`ScrollAreaScrollbar`,z=O.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=P(R,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return O.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,k.jsx)(te,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,k.jsx)(ne,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,k.jsx)(B,{...r,ref:t,forceMount:n}):i.type===`always`?(0,k.jsx)(V,{...r,ref:t}):null});z.displayName=R;var te=O.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=P(R,e.__scopeScrollArea),[a,o]=O.useState(!1);return O.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=()=>{window.clearTimeout(t),o(!0)},r=()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,k.jsx)(d,{present:n||a,children:(0,k.jsx)(B,{"data-state":a?`visible`:`hidden`,...r,ref:t})})}),ne=O.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=P(R,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=Z(()=>c(`SCROLL_END`),100),[s,c]=A(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return O.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),O.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r};return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,k.jsx)(d,{present:n||s!==`hidden`,children:(0,k.jsx)(V,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:u(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:u(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})}),B=O.forwardRef((e,t)=>{let n=P(R,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=O.useState(!1),s=e.orientation===`horizontal`,c=Z(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return Q(n.viewport,c),Q(n.content,c),(0,k.jsx)(d,{present:r||a,children:(0,k.jsx)(V,{"data-state":a?`visible`:`hidden`,...i,ref:t})})}),V=O.forwardRef((e,t)=>{let{orientation:n=`vertical`,...r}=e,i=P(R,e.__scopeScrollArea),a=O.useRef(null),o=O.useRef(0),[s,c]=O.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=Y(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:e=>a.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e};function d(e,t){return ce(e,o.current,s,t)}return n===`horizontal`?(0,k.jsx)(re,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=le(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,i.dir))}}):n===`vertical`?(0,k.jsx)(ie,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=le(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null}),re=O.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=P(R,e.__scopeScrollArea),[o,s]=O.useState(),c=O.useRef(null),l=f(t,c,a.onScrollbarXChange);return O.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,k.jsx)(U,{"data-orientation":`horizontal`,...i,ref:l,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":X(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),de(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:J(o.paddingLeft),paddingEnd:J(o.paddingRight)}})}})}),ie=O.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=P(R,e.__scopeScrollArea),[o,s]=O.useState(),c=O.useRef(null),l=f(t,c,a.onScrollbarYChange);return O.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,k.jsx)(U,{"data-orientation":`vertical`,...i,ref:l,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":X(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),de(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:J(o.paddingTop),paddingEnd:J(o.paddingBottom)}})}})}),[ae,H]=M(R),U=O.forwardRef((e,t)=>{let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:d,onResize:p,...g}=e,_=P(R,n),[v,y]=O.useState(null),b=f(t,e=>y(e)),x=O.useRef(null),S=O.useRef(``),C=_.viewport,w=r.content-r.viewport,T=h(d),E=h(c),D=Z(p,10);function A(e){x.current&&l({x:e.clientX-x.current.left,y:e.clientY-x.current.top})}return O.useEffect(()=>{let e=e=>{let t=e.target;v?.contains(t)&&T(e,w)};return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[C,v,w,T]),O.useEffect(E,[r,E]),Q(v,D),Q(_.content,D),(0,k.jsx)(ae,{scope:n,scrollbar:v,hasThumb:i,onThumbChange:h(a),onThumbPointerUp:h(o),onThumbPositionChange:E,onThumbPointerDown:h(s),children:(0,k.jsx)(m.div,{...g,ref:b,style:{position:`absolute`,...g.style},onPointerDown:u(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),x.current=v.getBoundingClientRect(),S.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,_.viewport&&(_.viewport.style.scrollBehavior=`auto`),A(e))}),onPointerMove:u(e.onPointerMove,A),onPointerUp:u(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=S.current,_.viewport&&(_.viewport.style.scrollBehavior=``),x.current=null})})})}),W=`ScrollAreaThumb`,G=O.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=H(W,e.__scopeScrollArea);return(0,k.jsx)(d,{present:n||i.hasThumb,children:(0,k.jsx)(oe,{ref:t,...r})})}),oe=O.forwardRef((e,t)=>{let{__scopeScrollArea:n,style:r,...i}=e,a=P(W,n),o=H(W,n),{onThumbPositionChange:s}=o,c=f(t,e=>o.onThumbChange(e)),l=O.useRef(void 0),d=Z(()=>{l.current&&=(l.current(),void 0)},100);return O.useEffect(()=>{let e=a.viewport;if(e){let t=()=>{d(),l.current||(l.current=fe(e,s),s())};return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,d,s]),(0,k.jsx)(m.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:u(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:u(e.onPointerUp,o.onThumbPointerUp)})});G.displayName=W;var K=`ScrollAreaCorner`,q=O.forwardRef((e,t)=>{let n=P(K,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,k.jsx)(se,{...e,ref:t}):null});q.displayName=K;var se=O.forwardRef((e,t)=>{let{__scopeScrollArea:n,...r}=e,i=P(K,n),[a,o]=O.useState(0),[s,c]=O.useState(0),l=!!(a&&s);return Q(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),Q(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),l?(0,k.jsx)(m.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null});function J(e){return e?parseInt(e,10):0}function Y(e,t){let n=e/t;return isNaN(n)?0:n}function X(e){let t=Y(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function ce(e,t,n,r=`ltr`){let i=X(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return ue([c,l],d)(e)}function le(e,t,n=`ltr`){let r=X(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,s=t.content-t.viewport,c=a-r,l=o(e,n===`ltr`?[0,s]:[s*-1,0]);return ue([0,s],[0,c])(l)}function ue(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function de(e,t){return e>0&&e<t}var fe=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)};function Z(e,t){let n=h(e),r=O.useRef(0);return O.useEffect(()=>()=>window.clearTimeout(r.current),[]),O.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Q(e,t){let n=h(t);x(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}var pe=F,me=L,he=q;function ge({className:e,children:t,...n}){return(0,k.jsxs)(pe,{"data-slot":`scroll-area`,className:C(`relative`,e),...n,children:[(0,k.jsx)(me,{"data-slot":`scroll-area-viewport`,className:`size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1`,children:t}),(0,k.jsx)(_e,{}),(0,k.jsx)(he,{})]})}function _e({className:e,orientation:t=`vertical`,...n}){return(0,k.jsx)(z,{"data-slot":`scroll-area-scrollbar`,orientation:t,className:C(`flex touch-none p-px transition-colors select-none`,t===`vertical`&&`h-full w-2.5 border-l border-l-transparent`,t===`horizontal`&&`h-2.5 flex-col border-t border-t-transparent`,e),...n,children:(0,k.jsx)(G,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-border`})})}var ve=`__codemini_general__`,$=[{value:`general`,label:S(`generalChat`)},{value:`project`,label:S(`projectTask`)}];function ye({open:e,onOpenChange:t,onOpenProject:n}){let[o,c]=(0,O.useState)(`project`),[u,d]=(0,O.useState)(!1),[f,m]=(0,O.useState)(``),[h,y]=(0,O.useState)(null),[x,A]=(0,O.useState)(``);(0,O.useEffect)(()=>{e&&w().then(e=>{let t=e.cwd||``;e.isGeneral?(c(`general`),m(``),A(``),j(``)):(c(`project`),m(t),A(t||``),j(t||``))}).catch(()=>{})},[e]);let j=async e=>{try{let t=await p(e),n=!e&&!t.path&&t.roots?.[0]?.path;if(n){let e=await p(n);y(e),A(e.path??n),m(e.path??n);return}y(t),A(t.path??e)}catch{}},M=()=>{if(o===`general`){t(!1),n(ve);return}let e=f.trim();e&&(t(!1),n(e))},N=(x||``).replace(/\\/g,`/`),ee=/^[A-Za-z]:($|\/)/.test(N),P=N.startsWith(`/`)||ee,F=N.split(`/`).filter(Boolean),I=e=>e.length?/^[A-Za-z]:$/.test(e[0])?e.length===1?`${e[0]}/`:`${e[0]}/${e.slice(1).join(`/`)}`:`${P?`/`:``}${e.join(`/`)}`:``,L=h?.roots||[],R=e=>String(e||``).replace(/\\/g,`/`).toLowerCase(),z=L.slice().sort((e,t)=>R(t.path).length-R(e.path).length).find(e=>{let t=R(e.path),n=R(x||f);return t&&(n===t||n.startsWith(t.endsWith(`/`)?t:`${t}/`))}),te=$.find(e=>e.value===o)||$[1];return(0,k.jsx)(T,{open:e,onOpenChange:t,children:(0,k.jsxs)(g,{className:`sm:max-w-lg`,children:[(0,k.jsx)(E,{children:(0,k.jsx)(_,{children:S(`selectProject`)})}),(0,k.jsxs)(`div`,{className:`relative`,children:[(0,k.jsxs)(`button`,{type:`button`,onClick:()=>d(!u),className:`w-full flex items-center justify-between h-9 px-3 rounded-lg border border-(--border-default) bg-(--bg-input) text-[13px] text-(--text-primary) cursor-pointer hover:bg-(--bg-hover)`,children:[(0,k.jsx)(`span`,{className:`font-medium`,children:te.label}),(0,k.jsx)(b,{size:14,className:`text-(--text-muted)`})]}),u&&(0,k.jsx)(`div`,{className:`absolute top-full left-0 right-0 mt-1 rounded-lg border border-(--border-default) bg-(--bg-primary) shadow-lg z-50 p-1`,children:$.map(e=>(0,k.jsx)(`button`,{className:C(`w-full text-left px-3 py-2 my-1 text-[13px] rounded-md cursor-pointer border-0`,o===e.value?`bg-(--bg-active) text-(--text-primary) font-medium`:`bg-transparent text-(--text-secondary) hover:bg-(--bg-hover)`),onClick:()=>{c(e.value),d(!1)},children:e.label},e.value))})]}),o===`general`?(0,k.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-8 text-(--text-muted) text-[13px]`,children:[(0,k.jsx)(`span`,{children:S(`generalChatDesc`)}),(0,k.jsx)(v,{onClick:M,className:`text-[13px] h-8`,children:S(`enterGeneral`)})]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:`flex gap-2`,children:[L.length>0&&(0,k.jsxs)(l,{value:z?.path||L[0]?.path,onValueChange:e=>{m(e),j(e)},children:[(0,k.jsx)(i,{className:`w-[132px] h-8 bg-(--bg-input) text-(--text-primary)`,children:(0,k.jsx)(r,{})}),(0,k.jsx)(a,{align:`start`,children:L.map(e=>(0,k.jsxs)(s,{value:e.path,children:[(0,k.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,k.jsx)(`span`,{className:`text-(--text-muted) truncate`,children:e.path})]},e.path))})]}),(0,k.jsx)(D,{value:f,onChange:e=>m(e.target.value),placeholder:S(`enterOrBrowse`),onKeyDown:e=>e.key===`Enter`&&M(),className:`flex-1 h-8 text-[13px]`}),(0,k.jsx)(v,{onClick:M,className:`text-[13px] h-8`,children:S(`select`)})]}),(0,k.jsxs)(`div`,{className:`border border-(--border-default) rounded-lg overflow-hidden`,children:[(0,k.jsx)(`div`,{className:`flex items-center gap-1 text-[12px] px-3 py-2 border-b border-(--border-default) bg-(--bg-secondary) flex-wrap text-(--text-secondary)`,children:F.map((e,t)=>{let n=I(F.slice(0,t+1));return(0,k.jsxs)(`span`,{className:`flex items-center gap-1`,children:[t>0&&(0,k.jsx)(`span`,{className:`text-(--text-muted)`,children:`/`}),(0,k.jsx)(`button`,{onClick:()=>{m(n),j(n)},className:C(`hover:underline cursor-pointer border-0 bg-transparent`,t===F.length-1?`text-(--text-primary) font-medium`:`text-(--accent-blue)`),children:e})]},t)})}),(0,k.jsx)(ge,{className:`h-[240px]`,children:h&&(0,k.jsxs)(`div`,{className:`p-2`,children:[F.length>0&&(0,k.jsx)(`button`,{className:`w-full text-left px-2 py-1.5 text-[13px] hover:bg-(--bg-hover) rounded cursor-pointer flex items-center gap-2 border-0 bg-transparent text-(--text-secondary)`,onClick:()=>{let e=I(F.slice(0,-1));m(e),j(e)},children:(0,k.jsx)(`span`,{children:`..`})}),(h.dirs||[]).map(e=>(0,k.jsxs)(`button`,{className:`w-full text-left px-2 py-1.5 text-[13px] hover:bg-(--bg-hover) rounded cursor-pointer flex items-center gap-2 border-0 bg-transparent text-(--text-secondary)`,onClick:()=>{m(e.path),j(e.path)},children:[(0,k.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),e.isGit&&(0,k.jsx)(`span`,{className:`text-[11px] text-(--text-muted) bg-(--bg-tertiary) px-1.5 py-0.5 rounded`,children:`git`})]},e.path)),!(h.roots||[]).length&&!(h.dirs||[]).length&&!h.error&&(0,k.jsx)(`div`,{className:`text-center text-[12px] text-(--text-muted) py-4`,children:S(`noSubDirs`)})]})})]})]})]})})}export{ye as ProjectSelector};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{a as t,r as n}from"./bundle-mjs-C44PrJ2C.js";import{a as r,i,n as a,o,r as s,s as c,t as l}from"./select-J6668k2a.js";import{At as u,Dt as d,Ft as f,I as p,Nt as m,Tt as h,c as g,d as _,f as v,jt as y,k as b,kt as x,lt as S,pt as C,q as w,s as T,u as E}from"./index-DyIUhlc8.js";import{t as D}from"./input-BKNu4DOt.js";var O=e(t(),1),k=n();function A(e,t){return O.useReducer((e,n)=>t[e][n]??e,e)}var j=`ScrollArea`,[M,N]=y(j),[ee,P]=M(j),F=O.forwardRef((e,t)=>{let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,l]=O.useState(null),[u,d]=O.useState(null),[p,h]=O.useState(null),[g,_]=O.useState(null),[v,y]=O.useState(null),[b,x]=O.useState(0),[S,C]=O.useState(0),[w,T]=O.useState(!1),[E,D]=O.useState(!1),A=f(t,e=>l(e)),j=c(i);return(0,k.jsx)(ee,{scope:n,type:r,dir:j,scrollHideDelay:a,scrollArea:s,viewport:u,onViewportChange:d,content:p,onContentChange:h,scrollbarX:g,onScrollbarXChange:_,scrollbarXEnabled:w,onScrollbarXEnabledChange:T,scrollbarY:v,onScrollbarYChange:y,scrollbarYEnabled:E,onScrollbarYEnabledChange:D,onCornerWidthChange:x,onCornerHeightChange:C,children:(0,k.jsx)(m.div,{dir:j,...o,ref:A,style:{position:`relative`,"--radix-scroll-area-corner-width":b+`px`,"--radix-scroll-area-corner-height":S+`px`,...e.style}})})});F.displayName=j;var I=`ScrollAreaViewport`,L=O.forwardRef((e,t)=>{let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=P(I,n),s=f(t,O.useRef(null),o.onViewportChange);return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:i}),(0,k.jsx)(m.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,k.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})});L.displayName=I;var R=`ScrollAreaScrollbar`,z=O.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=P(R,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return O.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,k.jsx)(te,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,k.jsx)(ne,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,k.jsx)(B,{...r,ref:t,forceMount:n}):i.type===`always`?(0,k.jsx)(V,{...r,ref:t}):null});z.displayName=R;var te=O.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=P(R,e.__scopeScrollArea),[a,o]=O.useState(!1);return O.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=()=>{window.clearTimeout(t),o(!0)},r=()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,k.jsx)(d,{present:n||a,children:(0,k.jsx)(B,{"data-state":a?`visible`:`hidden`,...r,ref:t})})}),ne=O.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=P(R,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=Z(()=>c(`SCROLL_END`),100),[s,c]=A(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return O.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),O.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r};return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,k.jsx)(d,{present:n||s!==`hidden`,children:(0,k.jsx)(V,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:u(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:u(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})}),B=O.forwardRef((e,t)=>{let n=P(R,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=O.useState(!1),s=e.orientation===`horizontal`,c=Z(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return Q(n.viewport,c),Q(n.content,c),(0,k.jsx)(d,{present:r||a,children:(0,k.jsx)(V,{"data-state":a?`visible`:`hidden`,...i,ref:t})})}),V=O.forwardRef((e,t)=>{let{orientation:n=`vertical`,...r}=e,i=P(R,e.__scopeScrollArea),a=O.useRef(null),o=O.useRef(0),[s,c]=O.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=Y(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:e=>a.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e};function d(e,t){return ce(e,o.current,s,t)}return n===`horizontal`?(0,k.jsx)(re,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=le(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,i.dir))}}):n===`vertical`?(0,k.jsx)(ie,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=le(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null}),re=O.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=P(R,e.__scopeScrollArea),[o,s]=O.useState(),c=O.useRef(null),l=f(t,c,a.onScrollbarXChange);return O.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,k.jsx)(U,{"data-orientation":`horizontal`,...i,ref:l,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":X(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),de(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:J(o.paddingLeft),paddingEnd:J(o.paddingRight)}})}})}),ie=O.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=P(R,e.__scopeScrollArea),[o,s]=O.useState(),c=O.useRef(null),l=f(t,c,a.onScrollbarYChange);return O.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,k.jsx)(U,{"data-orientation":`vertical`,...i,ref:l,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":X(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),de(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:J(o.paddingTop),paddingEnd:J(o.paddingBottom)}})}})}),[ae,H]=M(R),U=O.forwardRef((e,t)=>{let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:d,onResize:p,...g}=e,_=P(R,n),[v,y]=O.useState(null),b=f(t,e=>y(e)),x=O.useRef(null),S=O.useRef(``),C=_.viewport,w=r.content-r.viewport,T=h(d),E=h(c),D=Z(p,10);function A(e){x.current&&l({x:e.clientX-x.current.left,y:e.clientY-x.current.top})}return O.useEffect(()=>{let e=e=>{let t=e.target;v?.contains(t)&&T(e,w)};return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[C,v,w,T]),O.useEffect(E,[r,E]),Q(v,D),Q(_.content,D),(0,k.jsx)(ae,{scope:n,scrollbar:v,hasThumb:i,onThumbChange:h(a),onThumbPointerUp:h(o),onThumbPositionChange:E,onThumbPointerDown:h(s),children:(0,k.jsx)(m.div,{...g,ref:b,style:{position:`absolute`,...g.style},onPointerDown:u(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),x.current=v.getBoundingClientRect(),S.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,_.viewport&&(_.viewport.style.scrollBehavior=`auto`),A(e))}),onPointerMove:u(e.onPointerMove,A),onPointerUp:u(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=S.current,_.viewport&&(_.viewport.style.scrollBehavior=``),x.current=null})})})}),W=`ScrollAreaThumb`,G=O.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=H(W,e.__scopeScrollArea);return(0,k.jsx)(d,{present:n||i.hasThumb,children:(0,k.jsx)(oe,{ref:t,...r})})}),oe=O.forwardRef((e,t)=>{let{__scopeScrollArea:n,style:r,...i}=e,a=P(W,n),o=H(W,n),{onThumbPositionChange:s}=o,c=f(t,e=>o.onThumbChange(e)),l=O.useRef(void 0),d=Z(()=>{l.current&&=(l.current(),void 0)},100);return O.useEffect(()=>{let e=a.viewport;if(e){let t=()=>{d(),l.current||(l.current=fe(e,s),s())};return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,d,s]),(0,k.jsx)(m.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:u(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:u(e.onPointerUp,o.onThumbPointerUp)})});G.displayName=W;var K=`ScrollAreaCorner`,q=O.forwardRef((e,t)=>{let n=P(K,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,k.jsx)(se,{...e,ref:t}):null});q.displayName=K;var se=O.forwardRef((e,t)=>{let{__scopeScrollArea:n,...r}=e,i=P(K,n),[a,o]=O.useState(0),[s,c]=O.useState(0),l=!!(a&&s);return Q(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),Q(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),l?(0,k.jsx)(m.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null});function J(e){return e?parseInt(e,10):0}function Y(e,t){let n=e/t;return isNaN(n)?0:n}function X(e){let t=Y(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function ce(e,t,n,r=`ltr`){let i=X(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return ue([c,l],d)(e)}function le(e,t,n=`ltr`){let r=X(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,s=t.content-t.viewport,c=a-r,l=o(e,n===`ltr`?[0,s]:[s*-1,0]);return ue([0,s],[0,c])(l)}function ue(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function de(e,t){return e>0&&e<t}var fe=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)};function Z(e,t){let n=h(e),r=O.useRef(0);return O.useEffect(()=>()=>window.clearTimeout(r.current),[]),O.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Q(e,t){let n=h(t);x(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}var pe=F,me=L,he=q;function ge({className:e,children:t,...n}){return(0,k.jsxs)(pe,{"data-slot":`scroll-area`,className:C(`relative`,e),...n,children:[(0,k.jsx)(me,{"data-slot":`scroll-area-viewport`,className:`size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1`,children:t}),(0,k.jsx)(_e,{}),(0,k.jsx)(he,{})]})}function _e({className:e,orientation:t=`vertical`,...n}){return(0,k.jsx)(z,{"data-slot":`scroll-area-scrollbar`,orientation:t,className:C(`flex touch-none p-px transition-colors select-none`,t===`vertical`&&`h-full w-2.5 border-l border-l-transparent`,t===`horizontal`&&`h-2.5 flex-col border-t border-t-transparent`,e),...n,children:(0,k.jsx)(G,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-border`})})}var ve=`__codemini_general__`,$=[{value:`general`,label:S(`generalChat`)},{value:`project`,label:S(`projectTask`)}];function ye({open:e,onOpenChange:t,onOpenProject:n}){let[o,c]=(0,O.useState)(`project`),[u,d]=(0,O.useState)(!1),[f,m]=(0,O.useState)(``),[h,y]=(0,O.useState)(null),[x,A]=(0,O.useState)(``);(0,O.useEffect)(()=>{e&&w().then(e=>{let t=e.cwd||``;e.isGeneral?(c(`general`),m(``),A(``),j(``)):(c(`project`),m(t),A(t||``),j(t||``))}).catch(()=>{})},[e]);let j=async e=>{try{let t=await p(e),n=!e&&!t.path&&t.roots?.[0]?.path;if(n){let e=await p(n);y(e),A(e.path??n),m(e.path??n);return}y(t),A(t.path??e)}catch{}},M=()=>{if(o===`general`){t(!1),n(ve);return}let e=f.trim();e&&(t(!1),n(e))},N=(x||``).replace(/\\/g,`/`),ee=/^[A-Za-z]:($|\/)/.test(N),P=N.startsWith(`/`)||ee,F=N.split(`/`).filter(Boolean),I=e=>e.length?/^[A-Za-z]:$/.test(e[0])?e.length===1?`${e[0]}/`:`${e[0]}/${e.slice(1).join(`/`)}`:`${P?`/`:``}${e.join(`/`)}`:``,L=h?.roots||[],R=e=>String(e||``).replace(/\\/g,`/`).toLowerCase(),z=L.slice().sort((e,t)=>R(t.path).length-R(e.path).length).find(e=>{let t=R(e.path),n=R(x||f);return t&&(n===t||n.startsWith(t.endsWith(`/`)?t:`${t}/`))}),te=$.find(e=>e.value===o)||$[1];return(0,k.jsx)(T,{open:e,onOpenChange:t,children:(0,k.jsxs)(g,{className:`sm:max-w-lg`,children:[(0,k.jsx)(E,{children:(0,k.jsx)(_,{children:S(`selectProject`)})}),(0,k.jsxs)(`div`,{className:`relative`,children:[(0,k.jsxs)(`button`,{type:`button`,onClick:()=>d(!u),className:`w-full flex items-center justify-between h-9 px-3 rounded-lg border border-(--border-default) bg-(--bg-input) text-[13px] text-(--text-primary) cursor-pointer hover:bg-(--bg-hover)`,children:[(0,k.jsx)(`span`,{className:`font-medium`,children:te.label}),(0,k.jsx)(b,{size:14,className:`text-(--text-muted)`})]}),u&&(0,k.jsx)(`div`,{className:`absolute top-full left-0 right-0 mt-1 rounded-lg border border-(--border-default) bg-(--bg-primary) shadow-lg z-50 p-1`,children:$.map(e=>(0,k.jsx)(`button`,{className:C(`w-full text-left px-3 py-2 my-1 text-[13px] rounded-md cursor-pointer border-0`,o===e.value?`bg-(--bg-active) text-(--text-primary) font-medium`:`bg-transparent text-(--text-secondary) hover:bg-(--bg-hover)`),onClick:()=>{c(e.value),d(!1)},children:e.label},e.value))})]}),o===`general`?(0,k.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-8 text-(--text-muted) text-[13px]`,children:[(0,k.jsx)(`span`,{children:S(`generalChatDesc`)}),(0,k.jsx)(v,{onClick:M,className:`text-[13px] h-8`,children:S(`enterGeneral`)})]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:`flex gap-2`,children:[L.length>0&&(0,k.jsxs)(l,{value:z?.path||L[0]?.path,onValueChange:e=>{m(e),j(e)},children:[(0,k.jsx)(i,{className:`w-[132px] h-8 bg-(--bg-input) text-(--text-primary)`,children:(0,k.jsx)(r,{})}),(0,k.jsx)(a,{align:`start`,children:L.map(e=>(0,k.jsxs)(s,{value:e.path,children:[(0,k.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,k.jsx)(`span`,{className:`text-(--text-muted) truncate`,children:e.path})]},e.path))})]}),(0,k.jsx)(D,{value:f,onChange:e=>m(e.target.value),placeholder:S(`enterOrBrowse`),onKeyDown:e=>e.key===`Enter`&&M(),className:`flex-1 h-8 text-[13px]`}),(0,k.jsx)(v,{onClick:M,className:`text-[13px] h-8`,children:S(`select`)})]}),(0,k.jsxs)(`div`,{className:`border border-(--border-default) rounded-lg overflow-hidden`,children:[(0,k.jsx)(`div`,{className:`flex items-center gap-1 text-[12px] px-3 py-2 border-b border-(--border-default) bg-(--bg-secondary) flex-wrap text-(--text-secondary)`,children:F.map((e,t)=>{let n=I(F.slice(0,t+1));return(0,k.jsxs)(`span`,{className:`flex items-center gap-1`,children:[t>0&&(0,k.jsx)(`span`,{className:`text-(--text-muted)`,children:`/`}),(0,k.jsx)(`button`,{onClick:()=>{m(n),j(n)},className:C(`hover:underline cursor-pointer border-0 bg-transparent`,t===F.length-1?`text-(--text-primary) font-medium`:`text-(--accent-blue)`),children:e})]},t)})}),(0,k.jsx)(ge,{className:`h-[240px]`,children:h&&(0,k.jsxs)(`div`,{className:`p-2`,children:[F.length>0&&(0,k.jsx)(`button`,{className:`w-full text-left px-2 py-1.5 text-[13px] hover:bg-(--bg-hover) rounded cursor-pointer flex items-center gap-2 border-0 bg-transparent text-(--text-secondary)`,onClick:()=>{let e=I(F.slice(0,-1));m(e),j(e)},children:(0,k.jsx)(`span`,{children:`..`})}),(h.dirs||[]).map(e=>(0,k.jsxs)(`button`,{className:`w-full text-left px-2 py-1.5 text-[13px] hover:bg-(--bg-hover) rounded cursor-pointer flex items-center gap-2 border-0 bg-transparent text-(--text-secondary)`,onClick:()=>{m(e.path),j(e.path)},children:[(0,k.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),e.isGit&&(0,k.jsx)(`span`,{className:`text-[11px] text-(--text-muted) bg-(--bg-tertiary) px-1.5 py-0.5 rounded`,children:`git`})]},e.path)),!(h.roots||[]).length&&!(h.dirs||[]).length&&!h.error&&(0,k.jsx)(`div`,{className:`text-center text-[12px] text-(--text-muted) py-4`,children:S(`noSubDirs`)})]})})]})]})]})})}export{ye as ProjectSelector};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{a as t,r as n}from"./bundle-mjs-C44PrJ2C.js";import{a as r,i,n as a,r as o,t as s}from"./select-J6668k2a.js";import{t as ee}from"./chevron-right-BBG4s6Zh.js";import{n as c,t as l}from"./pencil-C0uznNC_.js";import{n as u,t as d}from"./trash-2-H0DiWqiE.js";import{B as f,J as p,L as m,P as h,Y as g,b as _,c as v,d as y,et as b,f as x,g as S,k as C,l as w,lt as T,n as E,ot as te,pt as D,r as O,rt as k,s as A,st as j,u as M,w as N}from"./index-DyIUhlc8.js";import{t as P}from"./input-BKNu4DOt.js";var F=h(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),ne=h(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),I=h(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),L=e(t(),1),R=n(),re=[`all`,`enabled`,`builtin`,`custom`],z=[`always`,`auto_attach`,`agent_requested`,`manual`];function B({checked:e,onClick:t,title:n}){return(0,R.jsx)(`button`,{type:`button`,onClick:t,title:n,"aria-pressed":e,className:D(`relative h-5 w-9 rounded-full border shadow-inner transition-colors`,e?`border-(--text-primary) bg-(--text-primary)`:`border-(--border-strong) bg-(--bg-hover)`),children:(0,R.jsx)(`span`,{className:D(`absolute left-0.5 top-0.5 size-3.5 rounded-full transition-transform`,e?`bg-(--bg-primary)`:`bg-(--text-muted)`,e?`translate-x-4`:`translate-x-0`)})})}function V(e){return T(e===`builtin`?`builtin`:e===`global`?`globalScope`:`projectScope`)}function ie(e){return`${e?.scope||`unknown`}:${e?.projectDir||``}:${e?.name||``}`}function H(e){return e===`__codemini_general__`?T(`generalChat`):e}function ae(e=[]){return Array.isArray(e)?e.map(e=>String(e||``).trim()).filter(Boolean).join(`
|
|
2
|
+
`):``}function oe(e=[],t=[]){let n=new Map;for(let t of Array.isArray(e)?e:[]){let e=String(t?.dir||t?.path||t||``).trim();!e||n.has(e)||n.set(e,{dir:e,label:t?.label||H(e.split(/[/\\]/).filter(Boolean).pop()||e)})}for(let e of Array.isArray(t)?t:[]){let t=String(e||``).trim();!t||n.has(t)||n.set(t,{dir:t,label:H(t.split(/[/\\]/).filter(Boolean).pop()||t)})}return Array.from(n.values())}function U(e){let t=String(e||``).trim();return t?`project:${t}`:``}function W(e){let t=String(e||``);return t===`global`?{scope:`global`,projectDir:``}:t.startsWith(`project:`)?{scope:`project`,projectDir:t.slice(8)}:{scope:`project`,projectDir:``}}function G(e=[]){return e[0]?.dir?U(e[0].dir):`global`}function K(e){return e?.scope===`builtin`}function q(e){return e?.enabled!==!1}function J({skill:e,projectTargets:t=[],onSave:n,onCancel:ee}){let[c,l]=(0,L.useState)(e?.name||``),[u,d]=(0,L.useState)(e?.description||``),[f,h]=(0,L.useState)(e?.scope===`global`?`global`:U(e?.projectDir)||G(t)),[g,_]=(0,L.useState)(e?.mode||`agent_requested`),[v,y]=(0,L.useState)((e?.triggers||[]).join(`, `)),[b,S]=(0,L.useState)(e?.priority??50),[C,w]=(0,L.useState)(q(e)),[D,k]=(0,L.useState)(``),[A,M]=(0,L.useState)(!1),N=!e,F=K(e);return(0,L.useEffect)(()=>{if(l(e?.name||``),d(e?.description||``),h(e?.scope===`global`?`global`:U(e?.projectDir)||G(t)),_(e?.mode||`agent_requested`),y((e?.triggers||[]).join(`, `)),S(e?.priority??50),w(q(e)),!e){k(``);return}M(!0),p(e.name,e.projectDir).then(e=>k(e.content||``)).catch(()=>{}).finally(()=>M(!1))},[e,t]),(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pr-1`,children:[(0,R.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-[13px] font-medium text-(--text-primary)`,children:T(N?`newSkill`:`editSkill`)}),(0,R.jsx)(`div`,{className:`mt-0.5 text-[11px] text-(--text-muted)`,children:T(`skillEditorHint`)})]}),(0,R.jsx)(O,{variant:`outline`,className:`rounded-md px-1.5 py-0 text-[10px]`,children:V(W(f).scope)})]}),(0,R.jsxs)(`div`,{className:`grid gap-3`,children:[(N||!K(e))&&(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(`label`,{className:`text-[12px] text-(--text-muted)`,children:T(`skillScope`)}),(0,R.jsxs)(s,{value:f,onValueChange:h,children:[(0,R.jsx)(i,{className:`h-8 w-full bg-(--bg-primary) text-[13px]`,children:(0,R.jsx)(r,{})}),(0,R.jsxs)(a,{align:`start`,children:[(0,R.jsx)(o,{value:`global`,children:T(`globalScope`)}),t.map(e=>(0,R.jsx)(o,{value:U(e.dir),children:e.label},e.dir))]})]})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(`label`,{className:`text-[12px] text-(--text-muted)`,children:T(`name`)}),(0,R.jsx)(P,{value:c,onChange:e=>l(e.target.value),disabled:!N,placeholder:`my-skill`,className:`h-8 text-[13px]`})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(`label`,{className:`text-[12px] text-(--text-muted)`,children:T(`description`)}),(0,R.jsx)(P,{value:u,onChange:e=>d(e.target.value),placeholder:T(`skillDescriptionPlaceholder`),className:`h-8 text-[13px]`})]}),(0,R.jsxs)(`div`,{className:`rounded-md border border-(--border-default) bg-(--bg-secondary) p-3`,children:[(0,R.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-[12px] font-medium text-(--text-primary)`,children:[(0,R.jsx)(I,{size:13}),T(`skillRoutingSettings`)]}),(0,R.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(`label`,{className:`text-[12px] text-(--text-muted)`,children:T(`skillMode`)}),(0,R.jsxs)(s,{value:g,onValueChange:_,children:[(0,R.jsx)(i,{className:`h-8 w-full bg-(--bg-primary) text-[13px]`,children:(0,R.jsx)(r,{})}),(0,R.jsx)(a,{align:`start`,children:z.map(e=>(0,R.jsx)(o,{value:e,children:T(`skillMode_${e}`)},e))})]})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(`label`,{className:`text-[12px] text-(--text-muted)`,children:T(`skillPriority`)}),(0,R.jsx)(P,{type:`number`,min:`0`,max:`100`,value:b,onChange:e=>S(e.target.value),className:`h-8 text-[13px]`})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5 sm:col-span-2`,children:[(0,R.jsx)(`label`,{className:`text-[12px] text-(--text-muted)`,children:T(`skillTriggers`)}),(0,R.jsx)(P,{value:v,onChange:e=>y(e.target.value),placeholder:`after_edit, before_final`,className:`h-8 text-[13px]`})]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border border-(--border-default) bg-(--bg-primary) px-2 py-1.5 sm:col-span-2`,children:[(0,R.jsx)(`span`,{className:`text-[12px] text-(--text-muted)`,children:T(C?`enabled`:`disabled`)}),(0,R.jsx)(B,{checked:C,onClick:()=>w(e=>!e),title:T(C?`disable`:`enable`)})]})]})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(`label`,{className:`text-[12px] text-(--text-muted)`,children:T(`skillContent`)}),A?(0,R.jsxs)(`div`,{className:`rounded-md border border-(--border-default) py-8 text-center text-[12px] text-(--text-muted)`,children:[T(`loading`),`...`]}):(0,R.jsx)(E,{value:D,onChange:e=>k(e.target.value),disabled:F,className:`min-h-[360px] resize-y text-[13px] font-mono leading-5`,placeholder:`---
|
|
3
|
+
name: my-skill
|
|
4
|
+
description: ...
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Skill instructions...`})]})]})]}),(0,R.jsxs)(`div`,{className:`mt-3 flex shrink-0 justify-end gap-2 border-t border-(--border-default) bg-(--bg-primary) pt-3`,children:[(0,R.jsx)(x,{variant:`outline`,onClick:ee,size:`sm`,children:T(`cancel`)}),(0,R.jsx)(x,{onClick:async()=>{let t=W(f),r={description:u,scope:t.scope,mode:g,triggers:v.split(`,`).map(e=>e.trim()).filter(Boolean),enabled:C,priority:Number(b)||0};N?(await m({name:c,description:u,content:D,scope:t.scope,projectDir:t.projectDir}),await j(c,r,t.scope===`project`?t.projectDir:void 0)):(F||await te(e.name,D,e.projectDir),await j(e.name,{...r,targetProjectDir:t.scope===`project`?t.projectDir:void 0},e.projectDir)),n()},disabled:A||!F&&!D.trim()||N&&!c.trim(),size:`sm`,children:T(N?`create`:`save`)})]})]})}function se({skill:e,projectTargets:t=[],open:n,onSave:r,onOpenChange:i}){return(0,R.jsx)(A,{open:n,onOpenChange:i,children:(0,R.jsxs)(v,{className:`sm:max-w-[760px] h-[86vh] max-h-[86vh] flex flex-col overflow-hidden`,children:[(0,R.jsx)(M,{className:`shrink-0`,children:(0,R.jsx)(y,{children:T(e?`editSkill`:`newSkill`)})}),(0,R.jsx)(J,{skill:e,projectTargets:t,onSave:r,onCancel:()=>i(!1)})]})})}function ce({skill:e,open:t,onOpenChange:n}){let[r,i]=(0,L.useState)(``),[a,o]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{!t||!e||(o(!0),p(e.name,e.projectDir).then(e=>i(e.content||``)).catch(()=>{}).finally(()=>o(!1)))},[t,e]),(0,R.jsx)(A,{open:t,onOpenChange:n,children:(0,R.jsxs)(v,{className:`sm:max-w-[720px] max-h-[82vh] flex flex-col overflow-hidden`,children:[(0,R.jsx)(M,{className:`shrink-0`,children:(0,R.jsxs)(y,{children:[e?.name,` `,T(`contentPreview`)]})}),(0,R.jsx)(`div`,{className:`flex-1 overflow-y-auto min-h-0 pr-1`,children:a?(0,R.jsxs)(`div`,{className:`py-8 text-center text-[12px] text-(--text-muted)`,children:[T(`loading`),`...`]}):(0,R.jsx)(`pre`,{className:`rounded-lg bg-(--bg-secondary) p-3 text-[13px] whitespace-pre-wrap break-words font-mono leading-5`,children:r})}),(0,R.jsx)(w,{className:`shrink-0`,children:(0,R.jsx)(x,{variant:`outline`,onClick:()=>n(!1),size:`sm`,children:T(`close`)})})]})})}function le({skill:e,onView:t,onToggle:n,onEdit:r,onDelete:i}){let a=q(e);return(0,R.jsx)(`div`,{className:D(`rounded-lg border p-3 transition-colors`,a?`border-(--border-default) bg-(--bg-primary) hover:bg-(--bg-hover)`:`border-(--border-default) bg-(--bg-secondary) opacity-75`),children:(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`truncate text-[13px] font-medium text-(--text-primary)`,children:e.name}),(0,R.jsx)(O,{variant:K(e)?`secondary`:`outline`,className:`h-4 rounded-md px-1.5 py-0 text-[10px]`,children:V(e.scope)}),(0,R.jsx)(O,{variant:a?`outline`:`secondary`,className:`h-4 rounded-md px-1.5 py-0 text-[10px]`,children:T(a?`enabled`:`disabled`)}),e.version&&e.version!==`0.0.0`&&(0,R.jsxs)(`span`,{className:`text-[10px] text-(--text-muted)`,children:[`v`,e.version]}),e.mode&&(0,R.jsx)(O,{variant:`outline`,className:`h-4 rounded-md px-1.5 py-0 text-[10px]`,children:T(`skillMode_${e.mode}`)})]}),(0,R.jsx)(`div`,{className:`mt-1 line-clamp-2 text-[11px] leading-4 text-(--text-muted)`,children:e.description||T(`noDescription`)}),e.triggers?.length>0&&(0,R.jsxs)(`div`,{className:`mt-1 truncate text-[10px] text-(--text-muted)`,children:[T(`skillTriggers`),`: `,e.triggers.join(`, `)]})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,R.jsx)(x,{variant:`ghost`,size:`icon-xs`,onClick:()=>t(e),title:T(`view`),children:(0,R.jsx)(c,{size:13})}),(0,R.jsx)(B,{checked:a,onClick:()=>n(e,!a),title:T(a?`disable`:`enable`)}),(0,R.jsx)(x,{variant:`ghost`,size:`icon-xs`,onClick:()=>r(e),title:K(e)?T(`skillRoutingSettings`):T(`edit`),children:K(e)?(0,R.jsx)(I,{size:13}):(0,R.jsx)(l,{size:13})}),!K(e)&&(0,R.jsx)(x,{variant:`ghost`,size:`icon-xs`,onClick:()=>{confirm(T(`confirmDeleteSkill`).replace(`{{name}}`,e.name))&&i(e)},title:T(`delete`),className:`text-(--accent-red) hover:text-(--accent-red)`,children:(0,R.jsx)(d,{size:13})})]})]})})}function Y({projectDirs:e=[],projectTargets:t=[]}){let[n,c]=(0,L.useState)([]),[l,d]=(0,L.useState)(!0),[p,m]=(0,L.useState)(null),[h,v]=(0,L.useState)(null),[y,w]=(0,L.useState)(()=>new Set),[E,te]=(0,L.useState)(``),[D,O]=(0,L.useState)(`all`),[A,j]=(0,L.useState)(``),M=(0,L.useMemo)(()=>oe(t,e),[t,e]),[I,z]=(0,L.useState)(``),[B,V]=(0,L.useState)(!1),[J,Y]=(0,L.useState)(``),X=ae(e),Z=(0,L.useMemo)(()=>X?X.split(`
|
|
8
|
+
`):[],[X]);(0,L.useEffect)(()=>{let e=new Set([`global`,...M.map(e=>U(e.dir))]);I&&!e.has(I)&&z(``)},[I,M]);let Q=(0,L.useCallback)(async()=>{d(!0);try{let e=await g(Z);c(Array.isArray(e)?e:[])}catch{}d(!1)},[Z]);(0,L.useEffect)(()=>{Q()},[Q]);let ue=async(e,t)=>{c(n=>n.map(n=>n.name===e.name&&n.projectDir===e.projectDir?{...n,enabled:t}:n));try{await k(e.name,t,e.projectDir)}catch{c(n=>n.map(n=>n.name===e.name&&n.projectDir===e.projectDir?{...n,enabled:!t}:n))}try{let e=await g(Z);c(Array.isArray(e)?e:[])}catch{}},de=async e=>{await f(e.name,e.projectDir),Q()},fe=()=>{m(null),Q()},pe=async()=>{let e=A.trim();if(e){V(!0),Y(``);try{let t=W(I||G(M)),n=await b({source:e,scope:t.scope,projectDir:t.projectDir});if(n?.error)throw Error(n.message||`Install failed`);j(``),await Q()}catch(e){Y(e.message||`Install failed`)}finally{V(!1)}}};n.filter(q).length,n.filter(e=>!K(e)).length;let $=(0,L.useMemo)(()=>{let e=E.trim().toLowerCase();return n.filter(t=>D===`enabled`&&!q(t)||D===`builtin`&&t.scope!==`builtin`||D===`custom`&&t.scope===`builtin`?!1:e?t.name.toLowerCase().includes(e)||String(H(t.projectName||``)).toLowerCase().includes(e):!0)},[n,E,D]),me=(0,L.useMemo)(()=>{let e=[],t=[],n=new Map;for(let r of $){if(r.scope!==`project`){e.push(r);continue}let i=r.projectDir||`__current_project__`;if(!n.has(i)){let e={key:i,name:H(r.projectName||T(`projectScope`)),items:[]};n.set(i,e),t.push(e)}n.get(i).items.push(r)}return{regular:e,projectGroups:t}},[$]),he=(0,L.useCallback)(e=>{w(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]);return l?(0,R.jsxs)(`div`,{className:`py-8 text-center text-[12px] text-(--text-muted)`,children:[T(`loading`),`...`]}):(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsx)(`div`,{className:`rounded-lg border border-(--border-default) bg-(--bg-secondary) p-3`,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(ne,{size:14,className:`text-(--text-muted)`}),(0,R.jsx)(`span`,{className:`text-[13px] font-medium text-(--text-primary)`,children:T(`skillLibrary`)})]}),(0,R.jsx)(`div`,{className:`mt-1 text-[11px] text-(--text-muted)`,children:T(`skillPanelHint`)})]}),(0,R.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,R.jsxs)(x,{onClick:()=>m(`new`),size:`sm`,children:[(0,R.jsx)(_,{size:13}),T(`addSkill`)]})})]})}),(0,R.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[1fr_auto_auto] sm:items-center`,children:[(0,R.jsx)(P,{value:A,onChange:e=>j(e.target.value),placeholder:T(`skillInstallPlaceholder`),className:`h-8 text-[13px]`}),(0,R.jsxs)(s,{value:I||G(M),onValueChange:z,children:[(0,R.jsx)(i,{className:`h-8 w-full bg-(--bg-primary) text-[13px] sm:w-[150px]`,children:(0,R.jsx)(r,{})}),(0,R.jsxs)(a,{align:`start`,children:[(0,R.jsx)(o,{value:`global`,children:T(`globalScope`)}),M.map(e=>(0,R.jsx)(o,{value:U(e.dir),children:e.label},e.dir))]})]}),(0,R.jsxs)(x,{onClick:pe,disabled:B||!A.trim(),size:`sm`,children:[(0,R.jsx)(F,{size:13}),T(B?`installing`:`installSkill`)]})]}),J&&(0,R.jsx)(`div`,{className:`mt-2 text-[11px] text-(--accent-red)`,children:J}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,R.jsxs)(`div`,{className:`relative flex-1`,children:[(0,R.jsx)(u,{size:13,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-(--text-muted)`}),(0,R.jsx)(P,{value:E,onChange:e=>te(e.target.value),placeholder:T(`searchSkills`),className:`h-8 pl-8 text-[13px]`})]}),(0,R.jsx)(`div`,{className:`flex shrink-0 rounded-md border border-(--border-default) p-0.5 gap-0.5`,children:re.map(e=>(0,R.jsx)(x,{type:`button`,variant:D===e?`secondary`:`ghost`,size:`xs`,onClick:()=>O(e),className:`px-2`,children:T(`filter_${e}`)},e))})]}),(0,R.jsx)(S,{className:`bg-(--border-default)`}),n.length===0&&!p&&(0,R.jsxs)(`div`,{className:`rounded-lg border border-dashed border-(--border-default) py-8 text-center`,children:[(0,R.jsx)(`div`,{className:`text-[13px] text-(--text-primary)`,children:T(`noSkills`)}),(0,R.jsx)(`div`,{className:`mt-1 text-[11px] text-(--text-muted)`,children:T(`noSkillsHint`)})]}),n.length>0&&$.length===0&&(0,R.jsx)(`div`,{className:`py-8 text-center text-[12px] text-(--text-muted)`,children:T(`noMatches`)}),(0,R.jsxs)(`div`,{className:`grid max-h-[420px] gap-2 overflow-y-auto pr-1`,children:[me.regular.map(e=>(0,R.jsx)(le,{skill:e,onView:v,onToggle:ue,onEdit:m,onDelete:de},ie(e))),me.projectGroups.map(e=>{let t=y.has(e.key);return(0,R.jsxs)(`div`,{className:`grid gap-1`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>he(e.key),className:`flex h-8 w-full items-center gap-2 rounded-md border-0 bg-transparent px-2 text-left text-[12px] font-medium text-(--text-primary) hover:bg-(--bg-hover)`,title:e.key,children:[(0,R.jsx)(N,{size:14,className:`shrink-0 text-(--text-muted)`}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,R.jsx)(`span`,{className:`shrink-0 text-[12px] font-medium text-(--text-accent)`,children:e.items.length}),t?(0,R.jsx)(ee,{size:13,className:`shrink-0 text-(--text-muted)`}):(0,R.jsx)(C,{size:13,className:`shrink-0 text-(--text-muted)`})]}),!t&&(0,R.jsx)(`div`,{className:`grid gap-2 pl-6`,children:e.items.map(e=>(0,R.jsx)(le,{skill:e,onView:v,onToggle:ue,onEdit:m,onDelete:de},ie(e)))})]},e.key)})]}),(0,R.jsx)(ce,{skill:h,open:!!h,onOpenChange:e=>{e||v(null)}}),(0,R.jsx)(se,{skill:p===`new`?null:p,projectTargets:M,open:!!p,onSave:fe,onOpenChange:e=>{e||m(null)}})]})}function X({open:e,onOpenChange:t,projectDirs:n=[],projectTargets:r=[]}){return(0,R.jsx)(A,{open:e,onOpenChange:t,children:(0,R.jsxs)(v,{className:`sm:max-w-[800px] max-h-[86vh] overflow-hidden flex flex-col`,children:[(0,R.jsx)(M,{children:(0,R.jsx)(y,{children:T(`skills`)})}),(0,R.jsx)(`div`,{className:`flex-1 overflow-y-auto min-h-0 pr-1`,children:(0,R.jsx)(Y,{projectDirs:n,projectTargets:r})})]})})}export{X as SkillDialog};
|