lantern-harness 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +2 -2
  3. package/cli/server.mjs +2 -0
  4. package/config/app.defaults.json +1 -0
  5. package/dist/500.html +3 -3
  6. package/dist/_astro/Base.4X_wsSoR.css +1 -0
  7. package/dist/_astro/Base.astro_astro_type_script_index_0_lang.Dy7fJoxu.js +1 -0
  8. package/dist/_astro/{CaseExecBoard.BAV4EE3o.js → CaseExecBoard.DKdfW5fM.js} +1 -1
  9. package/dist/_astro/{CaseGenerateApp.Bz4ryNJG.js → CaseGenerateApp.Bm8AyH9s.js} +1 -1
  10. package/dist/_astro/{CasesLibrary.BPifyHUA.js → CasesLibrary.CvVJZ74h.js} +1 -1
  11. package/dist/_astro/{ChatApp.DLo31SYZ.js → ChatApp.BS-wLBRa.js} +3 -3
  12. package/dist/_astro/{DashboardBoard.Bd3eUPwZ.js → DashboardBoard.DCtfrrJz.js} +1 -1
  13. package/dist/_astro/{DocsFileBrowser.D3cKurQE.js → DocsFileBrowser.BtRoZ787.js} +1 -1
  14. package/dist/_astro/{DocsPager.rzu4mnzw.js → DocsPager.C20ue_JZ.js} +1 -1
  15. package/dist/_astro/{KnowledgeLibrary.B0sO4QR1.js → KnowledgeLibrary.CV4DyStj.js} +1 -1
  16. package/dist/_astro/{NavLibraries.Cvg3wery.js → NavLibraries.DmD2lZBZ.js} +1 -1
  17. package/dist/_astro/PluginsPage.B59AMDrB.js +1 -0
  18. package/dist/_astro/{PluginsPage.DIltPILi.js → PluginsPage.BEAPymNL.js} +1 -1
  19. package/dist/_astro/PmBugsBoard.CPEyBp0l.js +1 -0
  20. package/dist/_astro/PmIterationsBoard.zCeLpcBo.js +1 -0
  21. package/dist/_astro/{PmProjectDetail.DqDoIg8a.js → PmProjectDetail.ejIam5sD.js} +1 -1
  22. package/dist/_astro/{PmProjectsBoard.nOC1Hugt.js → PmProjectsBoard.DbXzir8o.js} +1 -1
  23. package/dist/_astro/PmRequirementsBoard.CynewRfv.js +1 -0
  24. package/dist/_astro/PmRequirementsBoard.D9eUMJWI.js +1 -0
  25. package/dist/_astro/{PmShared.CZnXaUq-.js → PmShared.BxTHKdjY.js} +1 -1
  26. package/dist/_astro/{PromptsLibrary.DU9EuSim.js → PromptsLibrary.Bkruu80b.js} +1 -1
  27. package/dist/_astro/{ReportsPage.Cr88iz8c.js → ReportsPage.BoBQshMQ.js} +1 -1
  28. package/dist/_astro/{RequirementsLibrary.BwriF8F0.js → RequirementsLibrary.BC0A8qdk.js} +1 -1
  29. package/dist/_astro/{SearchableSelect.Ctg8V1Z1.js → SearchableSelect.CXa1hiDd.js} +1 -1
  30. package/dist/_astro/SettingsDialog.Dc-9QNJI.js +1 -0
  31. package/dist/_astro/{SpaceSwitcher.BEJo5KFi.js → SpaceSwitcher.CI3KDBOA.js} +1 -1
  32. package/dist/_astro/{TasksBoard.BZi_GBPG.js → TasksBoard.Bb--oVV8.js} +1 -1
  33. package/dist/_astro/{TemplatesLibrary.T4K9jUex.js → TemplatesLibrary.D1wZq94E.js} +1 -1
  34. package/dist/_astro/{TestStatsBoard.Dd1Kcmx6.js → TestStatsBoard.DlVezlXl.js} +1 -1
  35. package/dist/_astro/{TodosBoard.C4yd_JFb.js → TodosBoard.S84wqcWY.js} +1 -1
  36. package/dist/_astro/UiAutoBoard.BKp9ifxg.js +1 -0
  37. package/dist/_astro/app-config.DUyozIL9.js +1 -0
  38. package/dist/_astro/i18n.B52gLzii.js +7 -0
  39. package/dist/_astro/{open-docs-in-session.B0ZdZNj2.js → open-docs-in-session.Xg3OSOfc.js} +1 -1
  40. package/dist/_astro/{plugins.D5ypJIXn.js → plugins.BDZqJNOy.js} +1 -1
  41. package/dist/_astro/{pm.BsnTv63L.js → pm.Bl3hz9fF.js} +4 -4
  42. package/dist/_astro/{settings.CnDCvwnQ.js → settings.C6NWuiFO.js} +2 -2
  43. package/dist/_astro/{spaces-client.Cai2tHEI.js → spaces-client.k_ciWMai.js} +1 -1
  44. package/dist/_astro/update.Bl_HfSe6.js +1 -0
  45. package/dist/_astro/{view-prefs.HCowOWXL.js → view-prefs.Dyu_lmN2.js} +1 -1
  46. package/dist/case-exec/index.html +4 -4
  47. package/dist/cases/generate/index.html +4 -4
  48. package/dist/cases/library/index.html +4 -4
  49. package/dist/dashboard/index.html +4 -4
  50. package/dist/docs/changelog/index.html +26 -4
  51. package/dist/docs/install/index.html +3 -3
  52. package/dist/docs/manual/index.html +24 -6
  53. package/dist/index.html +4 -4
  54. package/dist/knowledge/index.html +4 -4
  55. package/dist/knowledge//345/212/237/350/203/275/346/265/213/350/257/225/347/224/250/344/276/213/347/274/226/345/206/231/350/247/204/350/214/203/index.html +3 -3
  56. package/dist/plugins/index.html +4 -4
  57. package/dist/pm/bugs/index.html +4 -4
  58. package/dist/pm/iterations/index.html +4 -4
  59. package/dist/pm/projects/detail/index.html +4 -4
  60. package/dist/pm/projects/index.html +4 -4
  61. package/dist/pm/requirements/index.html +4 -4
  62. package/dist/prompts/index.html +4 -4
  63. package/dist/reports/index.html +4 -4
  64. package/dist/requirements/index.html +4 -4
  65. package/dist/tasks/index.html +4 -4
  66. package/dist/templates/index.html +4 -4
  67. package/dist/templates//345/212/237/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212//345/212/237/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212/346/250/241/346/235/277/index.html +3 -3
  68. package/dist/templates//346/200/247/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212//346/200/247/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212/346/250/241/346/235/277/index.html +3 -3
  69. package/dist/templates//346/200/247/350/203/275/346/265/213/350/257/225/347/224/250/344/276/213//346/200/247/350/203/275/346/265/213/350/257/225/347/224/250/344/276/213/346/250/241/346/235/277/index.html +3 -3
  70. package/dist/templates//346/216/245/345/217/243/346/265/213/350/257/225/346/212/245/345/221/212//346/216/245/345/217/243/346/265/213/350/257/225/346/212/245/345/221/212/346/250/241/346/235/277/index.html +3 -3
  71. package/dist/templates//350/207/252/345/212/250/345/214/226/346/265/213/350/257/225/347/224/250/344/276/213//350/207/252/345/212/250/345/214/226/346/265/213/350/257/225/347/224/250/344/276/213/346/250/241/346/235/277/index.html +3 -3
  72. package/dist/test-stats/index.html +4 -4
  73. package/dist/todos/index.html +4 -4
  74. package/dist/ui-automation/index.html +281 -0
  75. package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +17 -3
  76. package/lh-plugins/lh-uiauto.mjs +1237 -0
  77. package/lh-plugins/storage-domain.mjs +7 -0
  78. package/lh-plugins/uiauto-argv-guard.cjs +41 -0
  79. package/package.json +1 -1
  80. package/dist/_astro/Base.DjIEQkT7.css +0 -1
  81. package/dist/_astro/Base.astro_astro_type_script_index_0_lang.D0snmAJ_.js +0 -1
  82. package/dist/_astro/PluginsPage.uvmSuXzi.js +0 -1
  83. package/dist/_astro/PmBugsBoard.CiaIhCHv.js +0 -1
  84. package/dist/_astro/PmIterationsBoard.H67QwKFw.js +0 -1
  85. package/dist/_astro/PmRequirementsBoard.BPjZ7khP.js +0 -1
  86. package/dist/_astro/PmRequirementsBoard.CanxvcKg.js +0 -1
  87. package/dist/_astro/SettingsDialog.DEgsVfaL.js +0 -1
  88. package/dist/_astro/app-config.DKMxjv3g.js +0 -1
  89. package/dist/_astro/i18n.BXeGGutk.js +0 -7
  90. package/dist/_astro/update.DXCPfU4a.js +0 -1
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_astro/lib.DJNDi_Ht.js","_astro/react-dom.CqAxpHMt.js","_astro/ExcelFieldTags.B_XMwNNx.js","_astro/jsx-runtime.BUXbF_vF.js"])))=>i.map(i=>d[i]);
2
- import{c as e,n as t,t as n}from"./react-dom.CqAxpHMt.js";import{B as r,H as i,U as a,V as o,W as s,i as c,p as l,r as u,t as d,u as f,z as p}from"./app-config.DKMxjv3g.js";import{a as m,i as h,o as g,r as _,t as v}from"./plugins.D5ypJIXn.js";import{a as y,n as b}from"./view-prefs.HCowOWXL.js";import{c as x,d as S,f as C,l as w,n as T,t as E,u as D}from"./SearchableSelect.Ctg8V1Z1.js";import{i as ee,n as te,r as O,t as ne}from"./menu.Bkluqxic.js";import{t as re}from"./jsx-runtime.BUXbF_vF.js";import{t as ie}from"./ConfirmDialog.CBVsDJ8f.js";import{t as k}from"./DatePicker.CMfX7F6z.js";import{t as A}from"./SelectDropdown.Buv7rQJ_.js";import{a as ae,c as j,d as M,f as oe,i as se,n as ce,o as N,r as le,s as ue,t as de,u as fe}from"./ExcelFieldTags.B_XMwNNx.js";import{a as pe,i as P,r as me,s as he,t as F}from"./llm.BZEzE0x2.js";import{_ as I,d as ge,f as L,g as _e,l as ve,r as ye,s as be}from"./project-docs.Cd2gKPKh.js";import{n as xe,t as Se}from"./doc-roots.DAJP9Svr.js";import{i as Ce,n as we,r as Te,t as Ee}from"./prompts-meta.F4wwkjUA.js";import{d as De,f as Oe,l as ke,m as Ae,o as je,p as Me,r as Ne,s as Pe,y as Fe}from"./settings.CnDCvwnQ.js";import{C as Ie,D as Le,E as Re,O as ze,S as Be,T as Ve,_ as He,a as Ue,b as We,c as Ge,d as Ke,f as qe,g as Je,h as Ye,i as Xe,l as Ze,m as Qe,n as $e,o as et,p as tt,r as nt,s as rt,u as it,v as at,w as ot,x as st,y as ct}from"./open-docs-in-session.B0ZdZNj2.js";import{n as R}from"./i18n.BXeGGutk.js";import{$ as lt,A as ut,B as dt,C as ft,D as pt,E as mt,F as ht,G as gt,H as _t,I as vt,J as yt,K as bt,L as xt,M as St,N as Ct,O as wt,P as Tt,Q as Et,R as Dt,T as Ot,U as kt,V as At,W as jt,X as Mt,Y as Nt,Z as Pt,_ as Ft,a as It,at as Lt,b as Rt,c as zt,d as Bt,et as Vt,f as Ht,g as Ut,h as Wt,i as Gt,it as Kt,j as qt,k as Jt,l as Yt,m as Xt,n as Zt,nt as Qt,o as $t,p as en,q as tn,r as nn,rt as rn,s as an,t as on,tt as sn,u as cn,v as z,w as ln,x as un,y as dn,z as fn}from"./PluginsPage.DIltPILi.js";import{C as pn,D as mn,O as hn,P as gn,S as B,T as _n,a as vn,b as yn,d as bn,g as xn,h as Sn,j as Cn,l as wn,r as Tn,s as En,t as Dn,w as On,x as kn,y as An}from"./pm.BsnTv63L.js";import{A as jn,C as V,D as Mn,N as Nn,O as Pn,P as Fn,S as In,T as Ln,_ as Rn,a as zn,b as Bn,c as Vn,d as Hn,g as Un,i as Wn,l as Gn,m as Kn,n as qn,o as Jn,r as Yn,t as Xn,u as H,v as Zn,x as Qn,y as $n}from"./tasks.otRBFydq.js";import{n as er,s as tr,t as nr}from"./report-prompt.Cmw4XzfY.js";import{t as rr}from"./SlideOverDrawer.TPbGEoWn.js";import{t as ir}from"./NamePromptDialog.Dl5kSnQI.js";var U=e(t(),1),ar=e(n(),1),or=`/__tb_sessions/runs`;async function sr(e){try{return(await fetch(or,{signal:e??AbortSignal.timeout(1500)})).ok}catch{return!1}}async function cr(e){let t=await fetch(or,{signal:e??AbortSignal.timeout(3e3)});if(!t.ok)return[];let n=await t.json();return Array.isArray(n.runs)?n.runs:[]}async function lr(e){let t=await fetch(or,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),n=await t.json().catch(()=>({}));return t.ok?{ok:!0}:{ok:!1,error:n.error||`HTTP ${t.status}`}}async function ur(e){await fetch(`${or}/${encodeURIComponent(e)}/stop`,{method:`POST`}).catch(()=>{})}async function dr(e){try{let t=await fetch(`${or}/${encodeURIComponent(e)}`,{signal:AbortSignal.timeout(3e3)});return t.status===404?{ok:!1}:t.ok?await t.json():null}catch{return null}}function fr(e){return e===`completed`||e===`stopped`||e===`error`}function pr(e,t,n,r){let i=new AbortController,a=`${or}/${encodeURIComponent(e)}/events?after=${Math.max(0,t)}`;return(async()=>{try{let e=await fetch(a,{headers:{Accept:`text/event-stream`},signal:i.signal});if(!e.ok||!e.body){r?.(Error(`SSE ${e.status}`));return}let t=e.body.getReader(),o=new TextDecoder,s=``;for(;;){let{done:e,value:a}=await t.read();if(e){i.signal.aborted||r?.(Error(`SSE disconnected`));break}s+=o.decode(a,{stream:!0});let c=s.split(`
2
+ import{c as e,n as t,t as n}from"./react-dom.CqAxpHMt.js";import{B as r,H as i,U as a,V as o,W as s,i as c,p as l,r as u,t as d,u as f,z as p}from"./app-config.DUyozIL9.js";import{a as m,i as h,o as g,r as _,t as v}from"./plugins.BDZqJNOy.js";import{a as y,n as b}from"./view-prefs.Dyu_lmN2.js";import{c as x,d as S,f as C,l as w,n as T,t as E,u as D}from"./SearchableSelect.CXa1hiDd.js";import{i as ee,n as te,r as O,t as ne}from"./menu.Bkluqxic.js";import{t as re}from"./jsx-runtime.BUXbF_vF.js";import{t as ie}from"./ConfirmDialog.CBVsDJ8f.js";import{t as k}from"./DatePicker.CMfX7F6z.js";import{t as A}from"./SelectDropdown.Buv7rQJ_.js";import{a as ae,c as j,d as M,f as oe,i as se,n as ce,o as N,r as le,s as ue,t as de,u as fe}from"./ExcelFieldTags.B_XMwNNx.js";import{a as pe,i as P,r as me,s as he,t as F}from"./llm.BZEzE0x2.js";import{_ as I,d as ge,f as L,g as _e,l as ve,r as ye,s as be}from"./project-docs.Cd2gKPKh.js";import{n as xe,t as Se}from"./doc-roots.DAJP9Svr.js";import{i as Ce,n as we,r as Te,t as Ee}from"./prompts-meta.F4wwkjUA.js";import{d as De,f as Oe,l as ke,m as Ae,o as je,p as Me,r as Ne,s as Pe,y as Fe}from"./settings.C6NWuiFO.js";import{C as Ie,D as Le,E as Re,O as ze,S as Be,T as Ve,_ as He,a as Ue,b as We,c as Ge,d as Ke,f as qe,g as Je,h as Ye,i as Xe,l as Ze,m as Qe,n as $e,o as et,p as tt,r as nt,s as rt,u as it,v as at,w as ot,x as st,y as ct}from"./open-docs-in-session.Xg3OSOfc.js";import{n as R}from"./i18n.B52gLzii.js";import{$ as lt,A as ut,B as dt,C as ft,D as pt,E as mt,F as ht,G as gt,H as _t,I as vt,J as yt,K as bt,L as xt,M as St,N as Ct,O as wt,P as Tt,Q as Et,R as Dt,T as Ot,U as kt,V as At,W as jt,X as Mt,Y as Nt,Z as Pt,_ as Ft,a as It,at as Lt,b as Rt,c as zt,d as Bt,et as Vt,f as Ht,g as Ut,h as Wt,i as Gt,it as Kt,j as qt,k as Jt,l as Yt,m as Xt,n as Zt,nt as Qt,o as $t,p as en,q as tn,r as nn,rt as rn,s as an,t as on,tt as sn,u as cn,v as z,w as ln,x as un,y as dn,z as fn}from"./PluginsPage.BEAPymNL.js";import{C as pn,D as mn,F as hn,O as gn,S as B,T as _n,a as vn,b as yn,d as bn,g as xn,h as Sn,j as Cn,l as wn,r as Tn,s as En,t as Dn,w as On,x as kn,y as An}from"./pm.Bl3hz9fF.js";import{A as jn,C as V,D as Mn,N as Nn,O as Pn,P as Fn,S as In,T as Ln,_ as Rn,a as zn,b as Bn,c as Vn,d as Hn,g as Un,i as Wn,l as Gn,m as Kn,n as qn,o as Jn,r as Yn,t as Xn,u as H,v as Zn,x as Qn,y as $n}from"./tasks.otRBFydq.js";import{n as er,s as tr,t as nr}from"./report-prompt.Cmw4XzfY.js";import{t as rr}from"./SlideOverDrawer.TPbGEoWn.js";import{t as ir}from"./NamePromptDialog.Dl5kSnQI.js";var U=e(t(),1),ar=e(n(),1),or=`/__tb_sessions/runs`;async function sr(e){try{return(await fetch(or,{signal:e??AbortSignal.timeout(1500)})).ok}catch{return!1}}async function cr(e){let t=await fetch(or,{signal:e??AbortSignal.timeout(3e3)});if(!t.ok)return[];let n=await t.json();return Array.isArray(n.runs)?n.runs:[]}async function lr(e){let t=await fetch(or,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),n=await t.json().catch(()=>({}));return t.ok?{ok:!0}:{ok:!1,error:n.error||`HTTP ${t.status}`}}async function ur(e){await fetch(`${or}/${encodeURIComponent(e)}/stop`,{method:`POST`}).catch(()=>{})}async function dr(e){try{let t=await fetch(`${or}/${encodeURIComponent(e)}`,{signal:AbortSignal.timeout(3e3)});return t.status===404?{ok:!1}:t.ok?await t.json():null}catch{return null}}function fr(e){return e===`completed`||e===`stopped`||e===`error`}function pr(e,t,n,r){let i=new AbortController,a=`${or}/${encodeURIComponent(e)}/events?after=${Math.max(0,t)}`;return(async()=>{try{let e=await fetch(a,{headers:{Accept:`text/event-stream`},signal:i.signal});if(!e.ok||!e.body){r?.(Error(`SSE ${e.status}`));return}let t=e.body.getReader(),o=new TextDecoder,s=``;for(;;){let{done:e,value:a}=await t.read();if(e){i.signal.aborted||r?.(Error(`SSE disconnected`));break}s+=o.decode(a,{stream:!0});let c=s.split(`
3
3
  `);s=c.pop()??``;for(let e of c){let t=e.trim();if(!t.startsWith(`data:`))continue;let r=t.slice(5).trim();if(r)try{n(JSON.parse(r))}catch{}}}}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;r?.(e instanceof Error?e:Error(String(e)))}})(),()=>i.abort()}function mr(e,t,n){let r=!1,i=Math.max(0,t),a=0,o=null,s,c=n.maxAttempts??10,l=()=>{r=!0,s!=null&&clearTimeout(s),s=void 0,o?.(),o=null},u=()=>{r||n.signal?.aborted||(o?.(),o=pr(e,i,e=>{typeof e.seq==`number`&&Number.isFinite(e.seq)&&(i=Math.max(i,e.seq)),n.onEvent(e),e.type===`status`&&fr(e.status)&&(n.onTerminal?.(e),l())},t=>{r||n.signal?.aborted||(async()=>{a+=1;try{let r=await dr(e);if(r?.ok&&typeof r.seq==`number`&&(i=Math.max(i,r.seq)),r?.ok&&fr(r.status)){let e={type:`status`,status:r.status,seq:r.seq,assistant:r.assistant};n.onEvent(e),n.onTerminal?.(e),l();return}if(r&&r.ok===!1){n.onGaveUp?.(Error(t.message||`run not found`)),l();return}}catch{}if(a>=c){n.onGaveUp?.(t),l();return}let r=Math.min(4e3,250*a);s=setTimeout(u,r)})()}))},d=()=>l();return n.signal?.addEventListener(`abort`,d),u(),()=>{n.signal?.removeEventListener(`abort`,d),l()}}function hr(e){for(let t of e)if(t.role===`user`&&typeof t.content==`string`){let e=t.content.trim();if(e)return e}return``}function gr(e,t){let n=(e||``).trim()||`新对话`;return n===`新对话`||n===Ie(t)}function _r(e){let t=String(e??``).trim().replace(/^["「『]+|["」』]+$/g,``).replace(/\s+/g,` `).replace(/^标题[::]\s*/i,``);return t=t.replace(/[。.!!]+$/g,``).trim(),t?t.length>28?`${t.slice(0,28)}…`:t:``}async function vr(e,t,n){let r=t.trim().slice(0,800);if(!r)return null;let i=[{role:`system`,content:`你为对话生成侧栏短标题。只输出标题本身:中文优先,不超过 16 个字,无引号、无标点收尾、无解释。`},{role:`user`,content:`用户首条消息:\n${r}\n\n请给出标题:`}];try{return _r(await me(e,i,n))||null}catch{return null}}function yr(e){let t=Array.isArray(e.messages)?e.messages:[],n=0,r=0,i=0,a=0,o=0;for(let e of t){if(!e||typeof e!=`object`)continue;let t=e;t.role===`user`?n+=1:t.role===`assistant`&&(r+=1);let s=t.usage;if(s&&typeof s==`object`){let e=s;typeof e.promptTokens==`number`&&(i+=e.promptTokens),typeof e.completionTokens==`number`&&(a+=e.completionTokens),typeof e.totalTokens==`number`?o+=e.totalTokens:(typeof e.promptTokens==`number`||typeof e.completionTokens==`number`)&&(o+=(Number(e.promptTokens)||0)+(Number(e.completionTokens)||0))}}let s=e.goal,c=!!(s&&s.status!==`cleared`&&s.text?.trim());return{sessionId:e.id,title:e.title||`新对话`,messageCount:t.length,userCount:n,assistantCount:r,promptTokens:i,completionTokens:a,totalTokens:o,createdAt:e.createdAt,updatedAt:e.updatedAt,hasGoal:c,todoCount:Array.isArray(e.todos)?e.todos.length:0}}function br(e){let t=new Date(e.createdAt).toLocaleString(),n=new Date(e.updatedAt).toLocaleString();return[`会话:${e.title}`,`消息 ${e.messageCount}(用户 ${e.userCount} / 助手 ${e.assistantCount})`,`用量≈ 输入 ${e.promptTokens} · 输出 ${e.completionTokens} · 合计 ${e.totalTokens}`,`待办 ${e.todoCount} · 目标 ${e.hasGoal?`有`:`无`}`,`创建 ${t}`,`更新 ${n}`].join(`
4
4
  `)}var xr=new Map,Sr=new Map,Cr=40;function wr(e,t,n=``){return`${e}:${t}:${n}`}function Tr(e){for(;e.size>Cr;){let t=e.keys().next().value;if(t===void 0)break;e.delete(t)}}function Er(e,t,n,r,i=``){let a=e===`outline`?xr:Sr,o=wr(t,n,i),s=a.get(t);if(s&&s.stamp===o)return s.value;let c=r();return a.set(t,{stamp:o,value:c}),Tr(a),c}var Dr=`/__tb_sessions/log`;function Or(e){let t=String(e.userContent??``).trim(),n=String(e.assistantContent??``).trim(),r=String(e.reasoning??``).trim(),i=[];if(t&&i.push({role:`user`,content:t}),n||r){let e={role:`assistant`,content:n};r&&(e.reasoning_content=r),i.push(e)}return i}async function kr(e){try{let t=await fetch(Dr,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:AbortSignal.timeout(5e3)}),n=await t.json().catch(()=>({}));return t.ok?{ok:!0,path:n.path}:{ok:!1,error:n.error||`HTTP ${t.status}`}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}function Ar(e){return String(e??``).trim()}function jr(e,t=80){let n=Ar(e).replace(/\s+/g,` `);return n?n.length>t?`${n.slice(0,t)}…`:n:``}function Mr(e,t=40){let n=[],r=null;for(let i=0;i<e.length;i++){let a=e[i];if(a.role===`user`){let e=Ar(a.content),t=jr(e);if(!t)continue;r&&n.push({index:n.length+1,userPreview:r.preview,assistantPreview:``,userText:r.text,assistantText:``,userTime:r.time,endMessageIndex:r.messageIndex}),r={text:e,preview:t,time:typeof a.time==`number`?a.time:void 0,messageIndex:i}}else if(a.role===`assistant`&&r){let e=Ar(a.content),t=Ar(a.reasoning)||void 0;n.push({index:n.length+1,userPreview:r.preview,assistantPreview:jr(e)||(t?`(含思考)`:``),userText:r.text,assistantText:e,reasoning:t,reasoningDuration:typeof a.reasoningDuration==`number`?a.reasoningDuration:void 0,userTime:r.time,assistantTime:typeof a.time==`number`?a.time:void 0,endMessageIndex:i}),r=null}if(n.length>=t)break}return r&&n.length<t&&n.push({index:n.length+1,userPreview:r.preview,assistantPreview:``,userText:r.text,assistantText:``,userTime:r.time,endMessageIndex:r.messageIndex}),n}function Nr(e,t){let n=String(t??``).trim();return!n||n===`inherit`||n===e.model?e:{...e,model:n}}var W=`/__tb_fs`,Pr=`你可以使用 office_to_pdf:优先用本机 LibreOffice 转为 PDF;若未安装,则对 docx/xlsx/pptx 降级抽取正文为同目录 .extracted.md(需写权限)。`,Fr={type:`function`,function:{name:`office_to_pdf`,description:`Convert Office docs to PDF via LibreOffice when available; otherwise extract text to .extracted.md for docx/xlsx/pptx.`,parameters:{type:`object`,properties:{path:{type:`string`,description:`Input file path relative to workspace (or absolute when allowed)`},outDir:{type:`string`,description:`Optional output directory (default: same as input)`}},required:[`path`]}}};async function Ir(e,t,n){if(e!==`office_to_pdf`)return JSON.stringify({error:`unknown tool: ${e}`});let r={};try{r=JSON.parse(t||`{}`)}catch{return JSON.stringify({ok:!1,error:`invalid JSON arguments`})}let i=String(r.path??``).trim();if(!i)return JSON.stringify({ok:!1,error:`path is required`});try{let e=await(await fetch(`${W}/office-to-pdf`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:i,outDir:typeof r.outDir==`string`?r.outDir:void 0,access:n}),signal:AbortSignal.timeout(13e4)})).json().catch(()=>({}));return JSON.stringify(e,null,2)}catch(e){return JSON.stringify({ok:!1,error:e instanceof Error?e.message:String(e)})}}var Lr=`/__tb_fs`,Rr=`你可以使用 load_workspace_dependencies:查询本机 node / npm / pnpm / python 等可执行文件绝对路径(需本地 fs 服务)。`,zr={type:`function`,function:{name:`load_workspace_dependencies`,description:`Resolve absolute paths of common runtimes/package managers on this machine (node, npm, pnpm, python, …).`,parameters:{type:`object`,properties:{}}}};async function Br(e){if(e!==`load_workspace_dependencies`)return JSON.stringify({error:`unknown tool: ${e}`});try{let e=await fetch(`${Lr}/workspace-dependencies`,{signal:AbortSignal.timeout(8e3)}),t=await e.json().catch(()=>({}));if(!e.ok){let n=typeof t==`object`&&t&&`error`in t?String(t.error):`HTTP ${e.status}`;return JSON.stringify({ok:!1,error:n})}return JSON.stringify(t,null,2)}catch(e){return JSON.stringify({ok:!1,error:e instanceof Error?e.message:String(e)})}}function Vr(e){return Array.isArray(e)}function Hr(e){return Vr(e)?e.some(e=>e.type===`image_url`):!1}function Ur(e){let t=e.filter(e=>e.type===`text`).map(e=>e.text),n=e.filter(e=>e.type===`image_url`).length,r=n>0?`[image-offload] 已卸载 ${n} 张图片(超预算,仅保留最近附图)。`:``;return[{type:`text`,text:[...t,r].filter(Boolean).join(`
5
5
  `)||r||`(图片已卸载)`}]}function Wr(e,t={}){let n=Math.max(0,Math.floor(t.keepRecentImageMessages??1)),r=[];for(let t=0;t<e.length;t++){let n=e[t];n.role===`user`&&Hr(n.content)&&r.push(t)}if(r.length<=n)return e;let i=new Set(r.slice(-n)),a=!1,o=e.map((e,t)=>e.role!==`user`||!Hr(e.content)||i.has(t)||!Vr(e.content)?e:(a=!0,{...e,content:Ur(e.content)}));return a?o:e}function Gr(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Kr=Gr();function qr(e){Kr=e}var Jr={exec:()=>null};function G(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(Yr.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Yr={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`)},Xr=/^(?:[ \t]*(?:\n|$))+/,Zr=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Qr=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,$r=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ei=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ti=/(?:[*+-]|\d{1,9}[.)])/,ni=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ri=G(ni).replace(/bull/g,ti).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),ii=G(ni).replace(/bull/g,ti).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ai=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,oi=/^[^\n]+/,si=/(?!\s*\])(?:\\.|[^\[\]\\])+/,ci=G(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,si).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),li=G(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ti).getRegex(),ui=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,di=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,fi=G(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,di).replace(`tag`,ui).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),pi=G(ai).replace(`hr`,$r).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,ui).getRegex(),mi={blockquote:G(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,pi).getRegex(),code:Zr,def:ci,fences:Qr,heading:ei,hr:$r,html:fi,lheading:ri,list:li,newline:Xr,paragraph:pi,table:Jr,text:oi},hi=G(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,$r).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,ui).getRegex(),gi={...mi,lheading:ii,table:hi,paragraph:G(ai).replace(`hr`,$r).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,hi).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,ui).getRegex()},_i={...mi,html:G(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,di).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Jr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:G(ai).replace(`hr`,$r).replace(`heading`,` *#{1,6} *[^
@@ -202,8 +202,8 @@ ${t}
202
202
  `)}var Is=`/__tb_fs`,Ls=`你可以使用 Skill 工具(本地 fs 可用时):
203
203
  - skill_list:列出工作区 / 项目根下约定目录中的 SKILL.md
204
204
  - skill_load:按 id(目录名)或 path 加载技能正文到本轮上下文
205
- - 需要遵循某技能流程时先 skill_list 再 skill_load,勿臆造技能内容`,Rs=[{type:`function`,function:{name:`skill_list`,description:`List available skills (SKILL.md) under the workspace / project (.cursor/skills, .agents/skills, skills/, or */SKILL.md).`,parameters:{type:`object`,properties:{}}}},{type:`function`,function:{name:`skill_load`,description:`Load a skill by id (directory name) or path to SKILL.md. Returns the skill markdown body (may be truncated).`,parameters:{type:`object`,properties:{name:{type:`string`,description:`Skill id / directory name from skill_list, or relative/absolute path to SKILL.md`},path:{type:`string`,description:`Optional path to SKILL.md (alias of name)`}}}}}];async function zs(e,t){if(e===`skill_list`)try{let e=await fetch(`${Is}/skills`,{signal:AbortSignal.timeout(5e3)}),t=await e.json().catch(()=>({}));return e.ok?JSON.stringify({ok:!0,count:t.count??t.skills?.length??0,skills:t.skills??[]},null,2):JSON.stringify({ok:!1,error:t.error||`HTTP ${e.status}`})}catch(e){return JSON.stringify({ok:!1,error:e instanceof Error?e.message:String(e)})}if(e===`skill_load`){let e={};try{e=JSON.parse(t||`{}`)}catch{return JSON.stringify({ok:!1,error:`invalid JSON arguments`})}let n=String(e.name??e.path??e.id??``).trim();if(!n)return JSON.stringify({ok:!1,error:`name or path is required`});try{let e=await fetch(`${Is}/skill-load`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:n}),signal:AbortSignal.timeout(8e3)}),t=await e.json().catch(()=>({}));if(!e.ok){let n=typeof t==`object`&&t&&`error`in t?String(t.error):`HTTP ${e.status}`;return JSON.stringify({ok:!1,error:n})}return JSON.stringify(t,null,2)}catch(e){return JSON.stringify({ok:!1,error:e instanceof Error?e.message:String(e)})}}return JSON.stringify({error:`unknown tool: ${e}`})}var Bs=`写操作只在用户明确要求时执行;改 / 删之前先用 list 拿到真实 id,不要臆造 id。参数可以用 id,也可以传名称(project / iteration / requirement),系统先精确再忽略大小写匹配。日期一律 YYYY-MM-DD;不确定就不要填,不要凭空猜测。`,Vs=`项目列表工具(空间级,页面在 /pm/projects/):`+Bs+`新建项目只需要 name;归档用 pm_project_update 把 status 改成 archived。删除项目会连带删掉它的迭代、需求与缺陷,执行前先向用户确认影响范围。`,Hs=`迭代管理工具(空间级,页面在 /pm/iterations/):`+Bs+`迭代必须挂在项目下;endDate 不能早于 startDate。进度按日期流逝计算,不要把它当成需求完成度。`,Us=`需求管理工具(空间级,页面在 /pm/requirements/):`+Bs+`需求必须挂在项目下,iterationId 可留空表示未排期;编号 REQ-### 由系统分配,不要自己编。acceptanceCriteria 是 [{ text, done }] 数组,仅在用户给出验收标准时填写。`,Ws=`缺陷管理工具(空间级,页面在 /pm/bugs/):`+Bs+`缺陷必须挂在项目下;iterationId / requirementId 可留空,填了就必须属于同一项目。编号 BUG-### 由系统分配,不要自己编。`,Gs={project:{type:`string`,description:`Project name (exact, then case-insensitive).`},projectId:{type:`string`,description:`Project id from pm_project_list. Prefer this.`},keyword:{type:`string`,description:`Match name / description / title.`},limit:{type:`number`,description:`Max rows, default 50.`}},Ks=[{type:`function`,function:{name:`pm_project_list`,description:`List projects in the current space with iteration / requirement / bug counts. Use before any project write to get ids.`,parameters:{type:`object`,properties:{status:{type:`string`,enum:[...En,`all`]},keyword:{type:`string`},limit:{type:`number`}}}}},{type:`function`,function:{name:`pm_project_add`,description:`Create one or more projects. Only when the user explicitly asks. name is required.`,parameters:{type:`object`,properties:{items:{type:`array`,items:{type:`object`,properties:{name:{type:`string`},description:{type:`string`},status:{type:`string`,enum:En}},required:[`name`]}}},required:[`items`]}}},{type:`function`,function:{name:`pm_project_update`,description:`Update one project by id or name. Only pass fields that change.`,parameters:{type:`object`,properties:{id:{type:`string`},project:{type:`string`,description:`Project name, used when id is omitted.`},name:{type:`string`},description:{type:`string`},status:{type:`string`,enum:En}}}}},{type:`function`,function:{name:`pm_project_delete`,description:`Delete projects by id or name. Also deletes their iterations, requirements and bugs; confirm scope with the user first.`,parameters:{type:`object`,properties:{ids:{type:`array`,items:{type:`string`}},id:{type:`string`},project:{type:`string`}}}}}],qs=[{type:`function`,function:{name:`pm_iteration_list`,description:`List iterations, optionally filtered by project / status. Includes date-based progress and overdue days.`,parameters:{type:`object`,properties:{...Gs,status:{type:`string`,enum:[...vn,`all`]}}}}},{type:`function`,function:{name:`pm_iteration_add`,description:`Create one or more iterations under a project.`,parameters:{type:`object`,properties:{project:{type:`string`,description:`Project name (exact, then case-insensitive).`},projectId:{type:`string`,description:`Project id. Prefer this.`},items:{type:`array`,items:{type:`object`,properties:{name:{type:`string`},startDate:{type:`string`,description:`YYYY-MM-DD.`},endDate:{type:`string`,description:`YYYY-MM-DD, not before startDate.`},status:{type:`string`,enum:vn},remark:{type:`string`}},required:[`name`]}}},required:[`items`]}}},{type:`function`,function:{name:`pm_iteration_update`,description:`Update one iteration by id or name. Use status "done" when the iteration is closed.`,parameters:{type:`object`,properties:{id:{type:`string`},iteration:{type:`string`,description:`Iteration name, used when id is omitted.`},project:{type:`string`},projectId:{type:`string`},name:{type:`string`},startDate:{type:`string`},endDate:{type:`string`},status:{type:`string`,enum:vn},remark:{type:`string`}}}}},{type:`function`,function:{name:`pm_iteration_delete`,description:`Delete iterations by id or name. Requirements and bugs keep existing but lose the iteration link.`,parameters:{type:`object`,properties:{ids:{type:`array`,items:{type:`string`}},id:{type:`string`},iteration:{type:`string`}}}}}],Js=[{type:`function`,function:{name:`pm_requirement_list`,description:`List requirements, optionally filtered by project / iteration / status / priority / keyword.`,parameters:{type:`object`,properties:{...Gs,iteration:{type:`string`},iterationId:{type:`string`},status:{type:`string`,enum:[...bn,`all`]},priority:{type:`string`,enum:[...wn,`all`]}}}}},{type:`function`,function:{name:`pm_requirement_add`,description:`Create one or more requirements under a project. The REQ-### code is assigned by the server.`,parameters:{type:`object`,properties:{project:{type:`string`},projectId:{type:`string`},items:{type:`array`,items:{type:`object`,properties:{title:{type:`string`,description:`需求描述(可多行)`},iterationId:{type:`string`,description:`Optional; must belong to the project.`},iteration:{type:`string`,description:`Iteration name instead of id.`},priority:{type:`string`,enum:wn},status:{type:`string`,enum:bn},description:{type:`string`},acceptanceCriteria:{type:`array`,items:{type:`object`,properties:{text:{type:`string`},done:{type:`boolean`}},required:[`text`]}},githubIssue:{type:`string`}},required:[`title`]}}},required:[`items`]}}},{type:`function`,function:{name:`pm_requirement_update`,description:`Update one requirement by id, REQ code or title. Use status "done" when it is completed.`,parameters:{type:`object`,properties:{id:{type:`string`},requirement:{type:`string`,description:`Requirement title or REQ-###.`},project:{type:`string`},projectId:{type:`string`},iteration:{type:`string`},iterationId:{type:`string`},title:{type:`string`},priority:{type:`string`,enum:wn},status:{type:`string`,enum:bn},description:{type:`string`},acceptanceCriteria:{type:`array`,items:{type:`object`,properties:{text:{type:`string`},done:{type:`boolean`}},required:[`text`]}},githubIssue:{type:`string`}}}}},{type:`function`,function:{name:`pm_requirement_delete`,description:`Delete requirements by id, REQ code or title. Linked bugs lose the link.`,parameters:{type:`object`,properties:{ids:{type:`array`,items:{type:`string`}},id:{type:`string`},requirement:{type:`string`}}}}}],Ys=[{type:`function`,function:{name:`pm_bug_list`,description:`List bugs, optionally filtered by project / iteration / status / severity / keyword.`,parameters:{type:`object`,properties:{...Gs,iteration:{type:`string`},iterationId:{type:`string`},status:{type:`string`,enum:[...Tn,`all`]},severity:{type:`string`,enum:[...Dn,`all`]}}}}},{type:`function`,function:{name:`pm_bug_add`,description:`Create one or more bugs under a project. The BUG-### code is assigned by the server.`,parameters:{type:`object`,properties:{project:{type:`string`},projectId:{type:`string`},items:{type:`array`,items:{type:`object`,properties:{title:{type:`string`},iterationId:{type:`string`},iteration:{type:`string`},requirementId:{type:`string`},requirement:{type:`string`,description:`Requirement title or REQ-###.`},severity:{type:`string`,enum:Dn},status:{type:`string`,enum:Tn},reproduceSteps:{type:`string`},expectedResult:{type:`string`},actualResult:{type:`string`},environment:{type:`string`},githubIssue:{type:`string`},attachment:{type:`string`},remark:{type:`string`}},required:[`title`]}}},required:[`items`]}}},{type:`function`,function:{name:`pm_bug_update`,description:`Update one bug by id, BUG code or title. Bug status flow: pending → todo → fixed → verifying → passed (or cancelled). Set status "verifying" after a fix is pushed and awaits the user's confirmation; only the user sets "passed".`,parameters:{type:`object`,properties:{id:{type:`string`},bug:{type:`string`,description:`Bug title or BUG-###.`},project:{type:`string`},projectId:{type:`string`},iteration:{type:`string`},iterationId:{type:`string`},requirement:{type:`string`},requirementId:{type:`string`},title:{type:`string`},severity:{type:`string`,enum:Dn},status:{type:`string`,enum:Tn},reproduceSteps:{type:`string`},expectedResult:{type:`string`},actualResult:{type:`string`},environment:{type:`string`},githubIssue:{type:`string`},attachment:{type:`string`},remark:{type:`string`}}}}},{type:`function`,function:{name:`pm_bug_delete`,description:`Delete bugs by id, BUG code or title.`,parameters:{type:`object`,properties:{ids:{type:`array`,items:{type:`string`}},id:{type:`string`},bug:{type:`string`}}}}}];function Z(e,t){let n=e[t];return typeof n==`string`?n.trim():``}function Xs(e,t){let n=Z(t,`projectId`);return n?e.projects.some(e=>e.id===n)?n:``:On(e.projects,Z(t,`project`))}function Zs(e,t,n){let r=Z(n,`iterationId`);if(r)return e.iterations.some(e=>e.id===r&&e.projectId===t)?r:``;let i=Z(n,`iteration`);if(!i)return``;let a=e.iterations.find(e=>e.projectId===t&&e.name===i);if(a)return a.id;let o=i.toLowerCase();return e.iterations.find(e=>e.projectId===t&&e.name.toLowerCase()===o)?.id??``}function Qs(e,t,n){let r=Z(n,`requirementId`);if(r)return e.requirements.some(e=>e.id===r&&e.projectId===t)?r:``;let i=Z(n,`requirement`);if(!i)return``;let a=e.requirements.filter(e=>e.projectId===t);return _n(a,i)}function $s(e,t,n,r,i){let a=Z(t,`id`);if(a)return e.some(e=>e.id===a)?{id:a}:{id:``,error:`${r}不存在:${a}`};let o=Z(t,n);if(!o)return{id:``,error:`缺少${r} id 或名称`};let s=o.toLowerCase(),c=e.find(e=>i(e)===o)??e.find(e=>i(e).toLowerCase()===s);return c?{id:c.id}:{id:``,error:`找不到${r}:${o}`}}function ec(e,t){let n={};for(let r of t){if(!(r in e))continue;let t=e[r];t!=null&&(n[r]=t)}return n}function tc(e,t){let n=Z(t,`id`);if(n)return e.requirements.find(e=>e.id===n)??null;let r=Z(t,`requirement`);if(!r)return null;let i=r.toLowerCase();return e.requirements.find(e=>e.autoId.toLowerCase()===i)??e.requirements.find(e=>e.title===r)??e.requirements.find(e=>e.title.toLowerCase()===i)??null}function nc(e,t){let n=Z(t,`id`);if(n)return e.bugs.find(e=>e.id===n)??null;let r=Z(t,`bug`);if(!r)return null;let i=r.toLowerCase();return e.bugs.find(e=>e.autoId.toLowerCase()===i)??e.bugs.find(e=>e.title===r)??e.bugs.find(e=>e.title.toLowerCase()===i)??null}function rc(e,t){let n=t[e.id];return`[${e.id}] ${e.name} | 状态=${e.status} | 迭代=${n?.iterations??0} | 需求=${n?.requirements??0} | 缺陷=${n?.bugs??0}`}function ic(e){let t=hn(e),n=mn(e);return`[${e.id}] ${e.name} | 项目=${e.projectId} | ${e.startDate||`—`} → ${e.endDate||`—`} | 状态=${e.status} | 进度=${t}%`+(n===null?``:` | 逾期${n}天`)}function ac(e){return`[${e.id}] ${e.autoId} ${e.title} | 项目=${e.projectId} | 迭代=${e.iterationId||`—`} | 优先级=${e.priority} | 状态=${e.status}`}function oc(e){return`[${e.id}] ${e.autoId} ${e.title} | 项目=${e.projectId} | 迭代=${e.iterationId||`—`} | 严重程度=${e.severity} | 状态=${e.status}`}function sc(e,t){return e.length?e.map((e,t)=>`${t+1}. ${e}`).join(`
206
- `):t}function cc(e,t,n,r){return r.map(r=>{let i=r&&typeof r==`object`?{...r}:{};if(i.projectId=n,t!==`iterations`){let t=Zs(e,n,i);(`iteration`in i||`iterationId`in i)&&(i.iterationId=t)}if(t===`bugs`){let t=Qs(e,n,i);(`requirement`in i||`requirementId`in i)&&(i.requirementId=t)}return delete i.project,delete i.iteration,delete i.requirement,i})}async function lc(e,t,n={}){let r={};try{r=JSON.parse(t||`{}`)}catch{return JSON.stringify({error:`invalid JSON arguments`})}try{let t=await An(),i=Math.max(1,Math.min(200,Number(r.limit)||50));if(e===`pm_project_list`){let e=Z(r,`status`),n=B(t.projects,{status:e||`all`,keyword:Z(r,`keyword`)}).slice(0,i),a=Cn(t);return JSON.stringify({ok:!0,total:t.projects.length,count:n.length,items:n,summary:sc(n.map(e=>rc(e,a)),`当前没有匹配的项目。`)})}if(e===`pm_project_add`){let e=(Array.isArray(r.items)?r.items:[r]).map(e=>e&&typeof e==`object`?e:{}).filter(e=>typeof e.name==`string`);if(!e.length)return JSON.stringify({error:`项目名称不能为空`});let i=await Sn(`projects`,e,{mode:`ai`,sessionId:n.sessionId});return JSON.stringify({ok:!0,count:i.length,items:i,summary:`已创建 ${i.length} 个项目:\n${sc(i.map(e=>rc(e,Cn(t))),``)}`})}if(e===`pm_project_update`){let e=$s(t.projects,r,`project`,`项目`,e=>e.name);if(e.error)return JSON.stringify({error:e.error});let n=ec(r,[`name`,`description`,`status`]);if(!Object.keys(n).length)return JSON.stringify({error:`没有可更新的字段`});let i=await gn(`projects`,e.id,n);return JSON.stringify({ok:!0,item:i,summary:`已更新项目:${i.name}`})}if(e===`pm_project_delete`){let e=Array.isArray(r.ids)?r.ids:[Z(r,`id`)||Z(r,`project`)],n=[];for(let r of e){let e=typeof r==`string`?r.trim():``;if(!e)continue;let i=t.projects.find(t=>t.id===e)??t.projects.find(t=>t.name===e);i&&n.push(i.id)}if(!n.length)return JSON.stringify({error:`缺少项目 id 或名称`});let i=await xn(`projects`,n);return JSON.stringify({ok:!0,...i,summary:`已删除 ${i.removed} 个项目,并连带删除 ${i.cascaded} 条迭代 / 需求 / 缺陷。`})}if(e===`pm_iteration_list`){let e=Xs(t,r),n=Z(r,`status`),a=kn(t.iterations,{projectId:e||`all`,status:n||`all`,keyword:Z(r,`keyword`)}).slice(0,i);return JSON.stringify({ok:!0,total:t.iterations.length,count:a.length,items:a,summary:sc(a.map(ic),`当前没有匹配的迭代。`)})}if(e===`pm_iteration_add`){let e=Xs(t,r);if(!e)return JSON.stringify({error:`请先指定项目(projectId 或 project 名称)`});let i=cc(t,`iterations`,e,Array.isArray(r.items)?r.items:[r]);if(!i.length)return JSON.stringify({error:`迭代名称不能为空`});let a=await Sn(`iterations`,i,{mode:`ai`,sessionId:n.sessionId});return JSON.stringify({ok:!0,count:a.length,items:a,summary:`已创建 ${a.length} 个迭代:\n${sc(a.map(ic),``)}`})}if(e===`pm_iteration_update`){let e=$s(t.iterations,r,`iteration`,`迭代`,e=>e.name);if(e.error)return JSON.stringify({error:e.error});let n=ec(r,[`name`,`startDate`,`endDate`,`status`,`remark`]);if(`projectId`in r||`project`in r){let e=Xs(t,r);if(!e)return JSON.stringify({error:`所属项目不存在`});n.projectId=e}if(!Object.keys(n).length)return JSON.stringify({error:`没有可更新的字段`});let i=await gn(`iterations`,e.id,n);return JSON.stringify({ok:!0,item:i,summary:`已更新迭代:${ic(i)}`})}if(e===`pm_iteration_delete`){let e=Array.isArray(r.ids)?r.ids:[Z(r,`id`)||Z(r,`iteration`)],n=[];for(let r of e){let e=typeof r==`string`?r.trim():``;if(!e)continue;let i=t.iterations.find(t=>t.id===e)??t.iterations.find(t=>t.name===e);i&&n.push(i.id)}if(!n.length)return JSON.stringify({error:`缺少迭代 id 或名称`});let i=await xn(`iterations`,n);return JSON.stringify({ok:!0,...i,summary:`已删除 ${i.removed} 个迭代;关联需求与缺陷已解除迭代关联。`})}if(e===`pm_requirement_list`){let e=Xs(t,r),n=e?Zs(t,e,r):Z(r,`iterationId`)||`all`,a=Z(r,`status`),o=Z(r,`priority`),s=pn(t.requirements,{projectId:e||`all`,iterationId:n||`all`,status:a||`all`,priority:o||`all`,keyword:Z(r,`keyword`)}).slice(0,i);return JSON.stringify({ok:!0,total:t.requirements.length,count:s.length,items:s,summary:sc(s.map(ac),`当前没有匹配的需求。`)})}if(e===`pm_requirement_add`){let e=Xs(t,r);if(!e)return JSON.stringify({error:`请先指定项目(projectId 或 project 名称)`});let i=cc(t,`requirements`,e,Array.isArray(r.items)?r.items:[r]);if(!i.length)return JSON.stringify({error:`需求描述不能为空`});let a=await Sn(`requirements`,i,{mode:`ai`,sessionId:n.sessionId});return JSON.stringify({ok:!0,count:a.length,items:a,summary:`已创建 ${a.length} 条需求:\n${sc(a.map(ac),``)}`})}if(e===`pm_requirement_update`){let e=tc(t,r);if(!e)return JSON.stringify({error:`找不到需求:请传 id、REQ-### 或标题`});let n={id:e.id},i=ec(r,[`title`,`priority`,`status`,`description`,`acceptanceCriteria`,`githubIssue`]),a=`projectId`in r||`project`in r?Xs(t,r):e.projectId;if(!a)return JSON.stringify({error:`所属项目不存在`});if(a!==e.projectId&&(i.projectId=a),(`iterationId`in r||`iteration`in r)&&(i.iterationId=Zs(t,a,r)),!Object.keys(i).length)return JSON.stringify({error:`没有可更新的字段`});let o=await gn(`requirements`,n.id,i);return JSON.stringify({ok:!0,item:o,summary:`已更新需求:${ac(o)}`})}if(e===`pm_requirement_delete`){let e=Array.isArray(r.ids)?r.ids:[Z(r,`id`)||Z(r,`requirement`)],n=[];for(let r of e){let e=typeof r==`string`?r.trim():``;if(!e)continue;let i=_n(t.requirements,e),a=t.requirements.find(t=>t.id===e)??t.requirements.find(t=>t.autoId===e)??t.requirements.find(e=>e.id===i);a&&n.push(a.id)}if(!n.length)return JSON.stringify({error:`缺少需求 id / 编号 / 名称`});let i=await xn(`requirements`,n);return JSON.stringify({ok:!0,...i,summary:`已删除 ${i.removed} 条需求;关联缺陷已解除需求关联。`})}if(e===`pm_bug_list`){let e=Xs(t,r),n=e?Zs(t,e,r):Z(r,`iterationId`)||`all`,a=Z(r,`status`),o=Z(r,`severity`),s=yn(t.bugs,{projectId:e||`all`,iterationId:n||`all`,status:a||`all`,severity:o||`all`,keyword:Z(r,`keyword`)}).slice(0,i);return JSON.stringify({ok:!0,total:t.bugs.length,count:s.length,items:s,summary:sc(s.map(oc),`当前没有匹配的缺陷。`)})}if(e===`pm_bug_add`){let e=Xs(t,r);if(!e)return JSON.stringify({error:`请先指定项目(projectId 或 project 名称)`});let i=cc(t,`bugs`,e,Array.isArray(r.items)?r.items:[r]);if(!i.length)return JSON.stringify({error:`缺陷标题不能为空`});let a=await Sn(`bugs`,i,{mode:`ai`,sessionId:n.sessionId});return JSON.stringify({ok:!0,count:a.length,items:a,summary:`已创建 ${a.length} 条缺陷:\n${sc(a.map(oc),``)}`})}if(e===`pm_bug_update`){let e=nc(t,r);if(!e)return JSON.stringify({error:`找不到缺陷:请传 id、BUG-### 或标题`});let n={id:e.id},i=ec(r,[`title`,`severity`,`status`,`reproduceSteps`,`expectedResult`,`actualResult`,`environment`,`githubIssue`,`attachment`,`remark`]),a=`projectId`in r||`project`in r?Xs(t,r):e.projectId;if(!a)return JSON.stringify({error:`所属项目不存在`});if(a!==e.projectId&&(i.projectId=a),(`iterationId`in r||`iteration`in r)&&(i.iterationId=Zs(t,a,r)),(`requirementId`in r||`requirement`in r)&&(i.requirementId=Qs(t,a,r)),!Object.keys(i).length)return JSON.stringify({error:`没有可更新的字段`});let o=await gn(`bugs`,n.id,i);return JSON.stringify({ok:!0,item:o,summary:`已更新缺陷:${oc(o)}`})}if(e===`pm_bug_delete`){let e=Array.isArray(r.ids)?r.ids:[Z(r,`id`)||Z(r,`bug`)],n=[];for(let r of e){let e=typeof r==`string`?r.trim():``;if(!e)continue;let i=t.bugs.find(t=>t.id===e)??t.bugs.find(t=>t.autoId===e)??t.bugs.find(t=>t.title===e)??t.bugs.find(t=>t.title.toLowerCase()===e.toLowerCase());i&&n.push(i.id)}if(!n.length)return JSON.stringify({error:`缺少缺陷 id / 编号 / 名称`});let i=await xn(`bugs`,n);return JSON.stringify({ok:!0,...i,summary:`已删除 ${i.removed} 条缺陷。`})}return JSON.stringify({error:`unknown pm tool: ${e}`})}catch(e){return JSON.stringify({error:e instanceof Error?e.message:String(e)})}}var uc=`待办事项工具(空间级,跨会话保留,页面在 /todos/):
205
+ - 需要遵循某技能流程时先 skill_list 再 skill_load,勿臆造技能内容`,Rs=[{type:`function`,function:{name:`skill_list`,description:`List available skills (SKILL.md) under the workspace / project (.cursor/skills, .agents/skills, skills/, or */SKILL.md).`,parameters:{type:`object`,properties:{}}}},{type:`function`,function:{name:`skill_load`,description:`Load a skill by id (directory name) or path to SKILL.md. Returns the skill markdown body (may be truncated).`,parameters:{type:`object`,properties:{name:{type:`string`,description:`Skill id / directory name from skill_list, or relative/absolute path to SKILL.md`},path:{type:`string`,description:`Optional path to SKILL.md (alias of name)`}}}}}];async function zs(e,t){if(e===`skill_list`)try{let e=await fetch(`${Is}/skills`,{signal:AbortSignal.timeout(5e3)}),t=await e.json().catch(()=>({}));return e.ok?JSON.stringify({ok:!0,count:t.count??t.skills?.length??0,skills:t.skills??[]},null,2):JSON.stringify({ok:!1,error:t.error||`HTTP ${e.status}`})}catch(e){return JSON.stringify({ok:!1,error:e instanceof Error?e.message:String(e)})}if(e===`skill_load`){let e={};try{e=JSON.parse(t||`{}`)}catch{return JSON.stringify({ok:!1,error:`invalid JSON arguments`})}let n=String(e.name??e.path??e.id??``).trim();if(!n)return JSON.stringify({ok:!1,error:`name or path is required`});try{let e=await fetch(`${Is}/skill-load`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:n}),signal:AbortSignal.timeout(8e3)}),t=await e.json().catch(()=>({}));if(!e.ok){let n=typeof t==`object`&&t&&`error`in t?String(t.error):`HTTP ${e.status}`;return JSON.stringify({ok:!1,error:n})}return JSON.stringify(t,null,2)}catch(e){return JSON.stringify({ok:!1,error:e instanceof Error?e.message:String(e)})}}return JSON.stringify({error:`unknown tool: ${e}`})}var Bs=`写操作只在用户明确要求时执行;改 / 删之前先用 list 拿到真实 id,不要臆造 id。参数可以用 id,也可以传名称(project / iteration / requirement),系统先精确再忽略大小写匹配。日期一律 YYYY-MM-DD;不确定就不要填,不要凭空猜测。`,Vs=`项目列表工具(空间级,页面在 /pm/projects/):`+Bs+`新建项目只需要 name;归档用 pm_project_update 把 status 改成 archived。删除项目会连带删掉它的迭代、需求与缺陷,执行前先向用户确认影响范围。`,Hs=`迭代管理工具(空间级,页面在 /pm/iterations/):`+Bs+`迭代必须挂在项目下;endDate 不能早于 startDate。进度按日期流逝计算,不要把它当成需求完成度。`,Us=`需求管理工具(空间级,页面在 /pm/requirements/):`+Bs+`需求必须挂在项目下,iterationId 可留空表示未排期;编号 REQ-### 由系统分配,不要自己编。acceptanceCriteria 是 [{ text, done }] 数组,仅在用户给出验收标准时填写。`,Ws=`缺陷管理工具(空间级,页面在 /pm/bugs/):`+Bs+`缺陷必须挂在项目下;iterationId / requirementId 可留空,填了就必须属于同一项目。编号 BUG-### 由系统分配,不要自己编。`,Gs={project:{type:`string`,description:`Project name (exact, then case-insensitive).`},projectId:{type:`string`,description:`Project id from pm_project_list. Prefer this.`},keyword:{type:`string`,description:`Match name / description / title.`},limit:{type:`number`,description:`Max rows, default 50.`}},Ks=[{type:`function`,function:{name:`pm_project_list`,description:`List projects in the current space with iteration / requirement / bug counts. Use before any project write to get ids.`,parameters:{type:`object`,properties:{status:{type:`string`,enum:[...En,`all`]},keyword:{type:`string`},limit:{type:`number`}}}}},{type:`function`,function:{name:`pm_project_add`,description:`Create one or more projects. Only when the user explicitly asks. name is required.`,parameters:{type:`object`,properties:{items:{type:`array`,items:{type:`object`,properties:{name:{type:`string`},description:{type:`string`},status:{type:`string`,enum:En}},required:[`name`]}}},required:[`items`]}}},{type:`function`,function:{name:`pm_project_update`,description:`Update one project by id or name. Only pass fields that change.`,parameters:{type:`object`,properties:{id:{type:`string`},project:{type:`string`,description:`Project name, used when id is omitted.`},name:{type:`string`},description:{type:`string`},status:{type:`string`,enum:En}}}}},{type:`function`,function:{name:`pm_project_delete`,description:`Delete projects by id or name. Also deletes their iterations, requirements and bugs; confirm scope with the user first.`,parameters:{type:`object`,properties:{ids:{type:`array`,items:{type:`string`}},id:{type:`string`},project:{type:`string`}}}}}],qs=[{type:`function`,function:{name:`pm_iteration_list`,description:`List iterations, optionally filtered by project / status. Includes date-based progress and overdue days.`,parameters:{type:`object`,properties:{...Gs,status:{type:`string`,enum:[...vn,`all`]}}}}},{type:`function`,function:{name:`pm_iteration_add`,description:`Create one or more iterations under a project.`,parameters:{type:`object`,properties:{project:{type:`string`,description:`Project name (exact, then case-insensitive).`},projectId:{type:`string`,description:`Project id. Prefer this.`},items:{type:`array`,items:{type:`object`,properties:{name:{type:`string`},startDate:{type:`string`,description:`YYYY-MM-DD.`},endDate:{type:`string`,description:`YYYY-MM-DD, not before startDate.`},status:{type:`string`,enum:vn},remark:{type:`string`}},required:[`name`]}}},required:[`items`]}}},{type:`function`,function:{name:`pm_iteration_update`,description:`Update one iteration by id or name. Use status "done" when the iteration is closed.`,parameters:{type:`object`,properties:{id:{type:`string`},iteration:{type:`string`,description:`Iteration name, used when id is omitted.`},project:{type:`string`},projectId:{type:`string`},name:{type:`string`},startDate:{type:`string`},endDate:{type:`string`},status:{type:`string`,enum:vn},remark:{type:`string`}}}}},{type:`function`,function:{name:`pm_iteration_delete`,description:`Delete iterations by id or name. Requirements and bugs keep existing but lose the iteration link.`,parameters:{type:`object`,properties:{ids:{type:`array`,items:{type:`string`}},id:{type:`string`},iteration:{type:`string`}}}}}],Js=[{type:`function`,function:{name:`pm_requirement_list`,description:`List requirements, optionally filtered by project / iteration / status / priority / keyword.`,parameters:{type:`object`,properties:{...Gs,iteration:{type:`string`},iterationId:{type:`string`},status:{type:`string`,enum:[...bn,`all`]},priority:{type:`string`,enum:[...wn,`all`]}}}}},{type:`function`,function:{name:`pm_requirement_add`,description:`Create one or more requirements under a project. The REQ-### code is assigned by the server.`,parameters:{type:`object`,properties:{project:{type:`string`},projectId:{type:`string`},items:{type:`array`,items:{type:`object`,properties:{title:{type:`string`,description:`需求描述(可多行)`},iterationId:{type:`string`,description:`Optional; must belong to the project.`},iteration:{type:`string`,description:`Iteration name instead of id.`},priority:{type:`string`,enum:wn},status:{type:`string`,enum:bn},description:{type:`string`},acceptanceCriteria:{type:`array`,items:{type:`object`,properties:{text:{type:`string`},done:{type:`boolean`}},required:[`text`]}},githubIssue:{type:`string`}},required:[`title`]}}},required:[`items`]}}},{type:`function`,function:{name:`pm_requirement_update`,description:`Update one requirement by id, REQ code or title. Use status "done" when it is completed.`,parameters:{type:`object`,properties:{id:{type:`string`},requirement:{type:`string`,description:`Requirement title or REQ-###.`},project:{type:`string`},projectId:{type:`string`},iteration:{type:`string`},iterationId:{type:`string`},title:{type:`string`},priority:{type:`string`,enum:wn},status:{type:`string`,enum:bn},description:{type:`string`},acceptanceCriteria:{type:`array`,items:{type:`object`,properties:{text:{type:`string`},done:{type:`boolean`}},required:[`text`]}},githubIssue:{type:`string`}}}}},{type:`function`,function:{name:`pm_requirement_delete`,description:`Delete requirements by id, REQ code or title. Linked bugs lose the link.`,parameters:{type:`object`,properties:{ids:{type:`array`,items:{type:`string`}},id:{type:`string`},requirement:{type:`string`}}}}}],Ys=[{type:`function`,function:{name:`pm_bug_list`,description:`List bugs, optionally filtered by project / iteration / status / severity / keyword.`,parameters:{type:`object`,properties:{...Gs,iteration:{type:`string`},iterationId:{type:`string`},status:{type:`string`,enum:[...Tn,`all`]},severity:{type:`string`,enum:[...Dn,`all`]}}}}},{type:`function`,function:{name:`pm_bug_add`,description:`Create one or more bugs under a project. The BUG-### code is assigned by the server.`,parameters:{type:`object`,properties:{project:{type:`string`},projectId:{type:`string`},items:{type:`array`,items:{type:`object`,properties:{title:{type:`string`},iterationId:{type:`string`},iteration:{type:`string`},requirementId:{type:`string`},requirement:{type:`string`,description:`Requirement title or REQ-###.`},severity:{type:`string`,enum:Dn},status:{type:`string`,enum:Tn},reproduceSteps:{type:`string`},expectedResult:{type:`string`},actualResult:{type:`string`},environment:{type:`string`},githubIssue:{type:`string`},attachment:{type:`string`},remark:{type:`string`}},required:[`title`]}}},required:[`items`]}}},{type:`function`,function:{name:`pm_bug_update`,description:`Update one bug by id, BUG code or title. Bug status flow: pending → todo → fixed → verifying → passed (or cancelled). Set status "verifying" after a fix is pushed and awaits the user's confirmation; only the user sets "passed".`,parameters:{type:`object`,properties:{id:{type:`string`},bug:{type:`string`,description:`Bug title or BUG-###.`},project:{type:`string`},projectId:{type:`string`},iteration:{type:`string`},iterationId:{type:`string`},requirement:{type:`string`},requirementId:{type:`string`},title:{type:`string`},severity:{type:`string`,enum:Dn},status:{type:`string`,enum:Tn},reproduceSteps:{type:`string`},expectedResult:{type:`string`},actualResult:{type:`string`},environment:{type:`string`},githubIssue:{type:`string`},attachment:{type:`string`},remark:{type:`string`}}}}},{type:`function`,function:{name:`pm_bug_delete`,description:`Delete bugs by id, BUG code or title.`,parameters:{type:`object`,properties:{ids:{type:`array`,items:{type:`string`}},id:{type:`string`},bug:{type:`string`}}}}}];function Z(e,t){let n=e[t];return typeof n==`string`?n.trim():``}function Xs(e,t){let n=Z(t,`projectId`);return n?e.projects.some(e=>e.id===n)?n:``:On(e.projects,Z(t,`project`))}function Zs(e,t,n){let r=Z(n,`iterationId`);if(r)return e.iterations.some(e=>e.id===r&&e.projectId===t)?r:``;let i=Z(n,`iteration`);if(!i)return``;let a=e.iterations.find(e=>e.projectId===t&&e.name===i);if(a)return a.id;let o=i.toLowerCase();return e.iterations.find(e=>e.projectId===t&&e.name.toLowerCase()===o)?.id??``}function Qs(e,t,n){let r=Z(n,`requirementId`);if(r)return e.requirements.some(e=>e.id===r&&e.projectId===t)?r:``;let i=Z(n,`requirement`);if(!i)return``;let a=e.requirements.filter(e=>e.projectId===t);return _n(a,i)}function $s(e,t,n,r,i){let a=Z(t,`id`);if(a)return e.some(e=>e.id===a)?{id:a}:{id:``,error:`${r}不存在:${a}`};let o=Z(t,n);if(!o)return{id:``,error:`缺少${r} id 或名称`};let s=o.toLowerCase(),c=e.find(e=>i(e)===o)??e.find(e=>i(e).toLowerCase()===s);return c?{id:c.id}:{id:``,error:`找不到${r}:${o}`}}function ec(e,t){let n={};for(let r of t){if(!(r in e))continue;let t=e[r];t!=null&&(n[r]=t)}return n}function tc(e,t){let n=Z(t,`id`);if(n)return e.requirements.find(e=>e.id===n)??null;let r=Z(t,`requirement`);if(!r)return null;let i=r.toLowerCase();return e.requirements.find(e=>e.autoId.toLowerCase()===i)??e.requirements.find(e=>e.title===r)??e.requirements.find(e=>e.title.toLowerCase()===i)??null}function nc(e,t){let n=Z(t,`id`);if(n)return e.bugs.find(e=>e.id===n)??null;let r=Z(t,`bug`);if(!r)return null;let i=r.toLowerCase();return e.bugs.find(e=>e.autoId.toLowerCase()===i)??e.bugs.find(e=>e.title===r)??e.bugs.find(e=>e.title.toLowerCase()===i)??null}function rc(e,t){let n=t[e.id];return`[${e.id}] ${e.name} | 状态=${e.status} | 迭代=${n?.iterations??0} | 需求=${n?.requirements??0} | 缺陷=${n?.bugs??0}`}function ic(e){let t=gn(e),n=mn(e);return`[${e.id}] ${e.name} | 项目=${e.projectId} | ${e.startDate||`—`} → ${e.endDate||`—`} | 状态=${e.status} | 进度=${t}%`+(n===null?``:` | 逾期${n}天`)}function ac(e){return`[${e.id}] ${e.autoId} ${e.title} | 项目=${e.projectId} | 迭代=${e.iterationId||`—`} | 优先级=${e.priority} | 状态=${e.status}`}function oc(e){return`[${e.id}] ${e.autoId} ${e.title} | 项目=${e.projectId} | 迭代=${e.iterationId||`—`} | 严重程度=${e.severity} | 状态=${e.status}`}function sc(e,t){return e.length?e.map((e,t)=>`${t+1}. ${e}`).join(`
206
+ `):t}function cc(e,t,n,r){return r.map(r=>{let i=r&&typeof r==`object`?{...r}:{};if(i.projectId=n,t!==`iterations`){let t=Zs(e,n,i);(`iteration`in i||`iterationId`in i)&&(i.iterationId=t)}if(t===`bugs`){let t=Qs(e,n,i);(`requirement`in i||`requirementId`in i)&&(i.requirementId=t)}return delete i.project,delete i.iteration,delete i.requirement,i})}async function lc(e,t,n={}){let r={};try{r=JSON.parse(t||`{}`)}catch{return JSON.stringify({error:`invalid JSON arguments`})}try{let t=await An(),i=Math.max(1,Math.min(200,Number(r.limit)||50));if(e===`pm_project_list`){let e=Z(r,`status`),n=B(t.projects,{status:e||`all`,keyword:Z(r,`keyword`)}).slice(0,i),a=Cn(t);return JSON.stringify({ok:!0,total:t.projects.length,count:n.length,items:n,summary:sc(n.map(e=>rc(e,a)),`当前没有匹配的项目。`)})}if(e===`pm_project_add`){let e=(Array.isArray(r.items)?r.items:[r]).map(e=>e&&typeof e==`object`?e:{}).filter(e=>typeof e.name==`string`);if(!e.length)return JSON.stringify({error:`项目名称不能为空`});let i=await Sn(`projects`,e,{mode:`ai`,sessionId:n.sessionId});return JSON.stringify({ok:!0,count:i.length,items:i,summary:`已创建 ${i.length} 个项目:\n${sc(i.map(e=>rc(e,Cn(t))),``)}`})}if(e===`pm_project_update`){let e=$s(t.projects,r,`project`,`项目`,e=>e.name);if(e.error)return JSON.stringify({error:e.error});let n=ec(r,[`name`,`description`,`status`]);if(!Object.keys(n).length)return JSON.stringify({error:`没有可更新的字段`});let i=await hn(`projects`,e.id,n);return JSON.stringify({ok:!0,item:i,summary:`已更新项目:${i.name}`})}if(e===`pm_project_delete`){let e=Array.isArray(r.ids)?r.ids:[Z(r,`id`)||Z(r,`project`)],n=[];for(let r of e){let e=typeof r==`string`?r.trim():``;if(!e)continue;let i=t.projects.find(t=>t.id===e)??t.projects.find(t=>t.name===e);i&&n.push(i.id)}if(!n.length)return JSON.stringify({error:`缺少项目 id 或名称`});let i=await xn(`projects`,n);return JSON.stringify({ok:!0,...i,summary:`已删除 ${i.removed} 个项目,并连带删除 ${i.cascaded} 条迭代 / 需求 / 缺陷。`})}if(e===`pm_iteration_list`){let e=Xs(t,r),n=Z(r,`status`),a=kn(t.iterations,{projectId:e||`all`,status:n||`all`,keyword:Z(r,`keyword`)}).slice(0,i);return JSON.stringify({ok:!0,total:t.iterations.length,count:a.length,items:a,summary:sc(a.map(ic),`当前没有匹配的迭代。`)})}if(e===`pm_iteration_add`){let e=Xs(t,r);if(!e)return JSON.stringify({error:`请先指定项目(projectId 或 project 名称)`});let i=cc(t,`iterations`,e,Array.isArray(r.items)?r.items:[r]);if(!i.length)return JSON.stringify({error:`迭代名称不能为空`});let a=await Sn(`iterations`,i,{mode:`ai`,sessionId:n.sessionId});return JSON.stringify({ok:!0,count:a.length,items:a,summary:`已创建 ${a.length} 个迭代:\n${sc(a.map(ic),``)}`})}if(e===`pm_iteration_update`){let e=$s(t.iterations,r,`iteration`,`迭代`,e=>e.name);if(e.error)return JSON.stringify({error:e.error});let n=ec(r,[`name`,`startDate`,`endDate`,`status`,`remark`]);if(`projectId`in r||`project`in r){let e=Xs(t,r);if(!e)return JSON.stringify({error:`所属项目不存在`});n.projectId=e}if(!Object.keys(n).length)return JSON.stringify({error:`没有可更新的字段`});let i=await hn(`iterations`,e.id,n);return JSON.stringify({ok:!0,item:i,summary:`已更新迭代:${ic(i)}`})}if(e===`pm_iteration_delete`){let e=Array.isArray(r.ids)?r.ids:[Z(r,`id`)||Z(r,`iteration`)],n=[];for(let r of e){let e=typeof r==`string`?r.trim():``;if(!e)continue;let i=t.iterations.find(t=>t.id===e)??t.iterations.find(t=>t.name===e);i&&n.push(i.id)}if(!n.length)return JSON.stringify({error:`缺少迭代 id 或名称`});let i=await xn(`iterations`,n);return JSON.stringify({ok:!0,...i,summary:`已删除 ${i.removed} 个迭代;关联需求与缺陷已解除迭代关联。`})}if(e===`pm_requirement_list`){let e=Xs(t,r),n=e?Zs(t,e,r):Z(r,`iterationId`)||`all`,a=Z(r,`status`),o=Z(r,`priority`),s=pn(t.requirements,{projectId:e||`all`,iterationId:n||`all`,status:a||`all`,priority:o||`all`,keyword:Z(r,`keyword`)}).slice(0,i);return JSON.stringify({ok:!0,total:t.requirements.length,count:s.length,items:s,summary:sc(s.map(ac),`当前没有匹配的需求。`)})}if(e===`pm_requirement_add`){let e=Xs(t,r);if(!e)return JSON.stringify({error:`请先指定项目(projectId 或 project 名称)`});let i=cc(t,`requirements`,e,Array.isArray(r.items)?r.items:[r]);if(!i.length)return JSON.stringify({error:`需求描述不能为空`});let a=await Sn(`requirements`,i,{mode:`ai`,sessionId:n.sessionId});return JSON.stringify({ok:!0,count:a.length,items:a,summary:`已创建 ${a.length} 条需求:\n${sc(a.map(ac),``)}`})}if(e===`pm_requirement_update`){let e=tc(t,r);if(!e)return JSON.stringify({error:`找不到需求:请传 id、REQ-### 或标题`});let n={id:e.id},i=ec(r,[`title`,`priority`,`status`,`description`,`acceptanceCriteria`,`githubIssue`]),a=`projectId`in r||`project`in r?Xs(t,r):e.projectId;if(!a)return JSON.stringify({error:`所属项目不存在`});if(a!==e.projectId&&(i.projectId=a),(`iterationId`in r||`iteration`in r)&&(i.iterationId=Zs(t,a,r)),!Object.keys(i).length)return JSON.stringify({error:`没有可更新的字段`});let o=await hn(`requirements`,n.id,i);return JSON.stringify({ok:!0,item:o,summary:`已更新需求:${ac(o)}`})}if(e===`pm_requirement_delete`){let e=Array.isArray(r.ids)?r.ids:[Z(r,`id`)||Z(r,`requirement`)],n=[];for(let r of e){let e=typeof r==`string`?r.trim():``;if(!e)continue;let i=_n(t.requirements,e),a=t.requirements.find(t=>t.id===e)??t.requirements.find(t=>t.autoId===e)??t.requirements.find(e=>e.id===i);a&&n.push(a.id)}if(!n.length)return JSON.stringify({error:`缺少需求 id / 编号 / 名称`});let i=await xn(`requirements`,n);return JSON.stringify({ok:!0,...i,summary:`已删除 ${i.removed} 条需求;关联缺陷已解除需求关联。`})}if(e===`pm_bug_list`){let e=Xs(t,r),n=e?Zs(t,e,r):Z(r,`iterationId`)||`all`,a=Z(r,`status`),o=Z(r,`severity`),s=yn(t.bugs,{projectId:e||`all`,iterationId:n||`all`,status:a||`all`,severity:o||`all`,keyword:Z(r,`keyword`)}).slice(0,i);return JSON.stringify({ok:!0,total:t.bugs.length,count:s.length,items:s,summary:sc(s.map(oc),`当前没有匹配的缺陷。`)})}if(e===`pm_bug_add`){let e=Xs(t,r);if(!e)return JSON.stringify({error:`请先指定项目(projectId 或 project 名称)`});let i=cc(t,`bugs`,e,Array.isArray(r.items)?r.items:[r]);if(!i.length)return JSON.stringify({error:`缺陷标题不能为空`});let a=await Sn(`bugs`,i,{mode:`ai`,sessionId:n.sessionId});return JSON.stringify({ok:!0,count:a.length,items:a,summary:`已创建 ${a.length} 条缺陷:\n${sc(a.map(oc),``)}`})}if(e===`pm_bug_update`){let e=nc(t,r);if(!e)return JSON.stringify({error:`找不到缺陷:请传 id、BUG-### 或标题`});let n={id:e.id},i=ec(r,[`title`,`severity`,`status`,`reproduceSteps`,`expectedResult`,`actualResult`,`environment`,`githubIssue`,`attachment`,`remark`]),a=`projectId`in r||`project`in r?Xs(t,r):e.projectId;if(!a)return JSON.stringify({error:`所属项目不存在`});if(a!==e.projectId&&(i.projectId=a),(`iterationId`in r||`iteration`in r)&&(i.iterationId=Zs(t,a,r)),(`requirementId`in r||`requirement`in r)&&(i.requirementId=Qs(t,a,r)),!Object.keys(i).length)return JSON.stringify({error:`没有可更新的字段`});let o=await hn(`bugs`,n.id,i);return JSON.stringify({ok:!0,item:o,summary:`已更新缺陷:${oc(o)}`})}if(e===`pm_bug_delete`){let e=Array.isArray(r.ids)?r.ids:[Z(r,`id`)||Z(r,`bug`)],n=[];for(let r of e){let e=typeof r==`string`?r.trim():``;if(!e)continue;let i=t.bugs.find(t=>t.id===e)??t.bugs.find(t=>t.autoId===e)??t.bugs.find(t=>t.title===e)??t.bugs.find(t=>t.title.toLowerCase()===e.toLowerCase());i&&n.push(i.id)}if(!n.length)return JSON.stringify({error:`缺少缺陷 id / 编号 / 名称`});let i=await xn(`bugs`,n);return JSON.stringify({ok:!0,...i,summary:`已删除 ${i.removed} 条缺陷。`})}return JSON.stringify({error:`unknown pm tool: ${e}`})}catch(e){return JSON.stringify({error:e instanceof Error?e.message:String(e)})}}var uc=`待办事项工具(空间级,跨会话保留,页面在 /todos/):
207
207
  - 只有用户明确要求把某件事记成待办时才调用 todo_add:例如「记一下 / 加个待办 / 帮我跟进 / 周五一前完成记得提醒我 / 把这件事加到待办」。
208
208
  - 用户只是在聊天里说到一件事、行程或计划,没有要你记录(没有「记 / 待办 / 跟进 / 提醒我」这类意图)时,不要调用 todo_add,也不要弹确认卡片;把内容正常聊完即可。不要从普通对话里自动「提炼」待办。
209
209
  - 不要先用 ask_user_question 逐项追问待办字段。直接调用 todo_add,把已知内容填好;系统会弹出「待办快卡」:用户确认名称,状态自动为「进行中」、日期自动取当天(开始 / 截止可在快卡里直接改成区间)、所属任务默认「日常待办」(快卡里可下拉换成已有任务,任务管理里没有「日常待办」就按 进行中 / 重要不紧急 / 当年第一天 ~ 当年最后一天 创建),紧急程度跟随所属任务,点「确认新增」才落库。
@@ -1,4 +1,4 @@
1
- import{c as e,n as t,r as n,t as r}from"./react-dom.CqAxpHMt.js";import{i}from"./app-config.DKMxjv3g.js";import{a,o,r as s}from"./plugins.D5ypJIXn.js";import{a as c,i as l,n as u,o as d,r as f,t as p}from"./view-prefs.HCowOWXL.js";import{i as m,n as h,r as g,t as _}from"./dialog.DXHznyjD.js";import{t as v}from"./jsx-runtime.BUXbF_vF.js";import{v as y,y as b}from"./pm.BsnTv63L.js";import{A as x,C as S,D as C,E as w,P as T,b as E,f as D,i as ee,k as O,n as k,s as A,u as j,v as M,w as N}from"./tasks.otRBFydq.js";import{a as te,r as ne}from"./test-stats.MEm3K2rB.js";import{d as re}from"./spaces-client.Cai2tHEI.js";function ie(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=ie(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function ae(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=ie(e))&&(r&&(r+=` `),r+=t);return r}function P(e){let{margin:t,containerPadding:n,containerWidth:r,cols:i}=e;return(r-t[0]*(i-1)-n[0]*2)/i}function F(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function oe(e,t,n,r,i,a,o){let{margin:s,containerPadding:c,rowHeight:l}=e,u=P(e),d,f,p,m;if(o?(d=Math.round(o.width),f=Math.round(o.height)):(d=F(r,u,s[0]),f=F(i,l,s[1])),a?(p=Math.round(a.top),m=Math.round(a.left)):o?(p=Math.round(o.top),m=Math.round(o.left)):(p=Math.round((l+s[1])*n+c[1]),m=Math.round((u+s[0])*t+c[0])),!a&&!o){if(Number.isFinite(r)){let e=Math.round((u+s[0])*(t+r)+c[0])-m-d;e!==s[0]&&(d+=e-s[0])}if(Number.isFinite(i)){let e=Math.round((l+s[1])*(n+i)+c[1])-p-f;e!==s[1]&&(f+=e-s[1])}}return{top:p,left:m,width:d,height:f}}function se(e,t,n,r,i){let{margin:a,containerPadding:o,cols:s,rowHeight:c,maxRows:l}=e,u=P(e),d=Math.round((n-o[0])/(u+a[0])),f=Math.round((t-o[1])/(c+a[1]));return d=L(d,0,s-r),f=L(f,0,l-i),{x:d,y:f}}function I(e,t,n){let{margin:r,containerPadding:i,rowHeight:a}=e,o=P(e);return{x:Math.round((n-i[0])/(o+r[0])),y:Math.round((t-i[1])/(a+r[1]))}}function ce(e,t,n){let{margin:r,rowHeight:i}=e,a=P(e);return{w:Math.max(1,Math.round((t+r[0])/(a+r[0]))),h:Math.max(1,Math.round((n+r[1])/(i+r[1])))}}function L(e,t,n){return Math.max(Math.min(e,n),t)}function le(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function ue(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0&&le(r,t))return r}}function de(e,t){return e.filter(e=>le(e,t))}function R(e,t){return t===`horizontal`?B(e):t===`vertical`||t===`wrap`?z(e):[...e]}function z(e){return[...e].sort((e,t)=>e.y===t.y?e.x-t.x:e.y-t.y)}function B(e){return[...e].sort((e,t)=>e.x===t.x?e.y-t.y:e.x-t.x)}function fe(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0){let e=r.y+r.h;e>t&&(t=e)}}return t}function pe(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0&&r.i===t)return r}}function V(e){return e.filter(e=>e.static===!0)}function H(e){return{i:e.i,x:e.x,y:e.y,w:e.w,h:e.h,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,constraints:e.constraints,isBounded:e.isBounded}}function U(e){let t=Array(e.length);for(let n=0;n<e.length;n++){let r=e[n];r!==void 0&&(t[n]=H(r))}return t}function me(e,t){let n=Array(e.length);for(let r=0;r<e.length;r++){let i=e[r];i!==void 0&&(t.i===i.i?n[r]=t:n[r]=i)}return n}function he(e,t,n){let r=pe(e,t);return r?(r=n(H(r)),[me(e,r),r]):[[...e],null]}function W(e,t){let n=V(e);for(let r=0;r<e.length;r++){let i=e[r];if(i!==void 0){if(i.x+i.w>t.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),i.y===1/0&&(i.y=fe(n)),!i.static)n.push(i);else for(;ue(n,i);)i.y++}}return e}function ge(e,t,n,r,i,a,o,s,c){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return[...e];let l=t.x,u=t.y;typeof n==`number`&&(t.x=n),typeof r==`number`&&(t.y=r),t.moved=!0;let d=R(e,o);(o===`vertical`&&typeof r==`number`?u>=r:o===`horizontal`&&typeof n==`number`&&l>=n)&&(d=d.reverse());let f=de(d,t),p=f.length>0;if(p&&c)return U(e);if(p&&a)return t.x=l,t.y=u,t.moved=!1,e;let m=[...e];for(let e=0;e<f.length;e++){let n=f[e];n!==void 0&&(n.moved||(m=n.static?G(m,n,t,i,o):G(m,t,n,i,o)))}return m}function G(e,t,n,r,i,a){let o=i===`horizontal`||i===`wrap`,s=i===`vertical`,c=t.static;if(r){r=!1;let a={x:o?Math.max(t.x-n.w,0):n.x,y:s?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:`-1`},l=ue(e,a),u=l!==void 0&&l.y+l.h>t.y,d=l!==void 0&&t.x+t.w>l.x;if(!l)return ge(e,n,o?a.x:void 0,s?a.y:void 0,r,c,i);if(u&&s)return ge(e,n,void 0,n.y+1,r,c,i);if(u&&i===null){let r=n.y;return t.y=r,n.y=r+t.h,[...e]}if(d&&o)return ge(e,t,n.x,void 0,r,c,i)}let l=o?n.x+1:void 0,u=s?n.y+1:void 0;return l===void 0&&u===void 0?[...e]:ge(e,n,l,u,r,c,i)}function K(e,t,n){return Math.max(t,Math.min(n,e))}var _e=[{name:`gridBounds`,constrainPosition(e,t,n,{cols:r,maxRows:i}){return{x:K(t,0,Math.max(0,r-e.w)),y:K(n,0,Math.max(0,i-e.h))}},constrainSize(e,t,n,r,{cols:i,maxRows:a}){let o=r===`w`||r===`nw`||r===`sw`?e.x+e.w:i-e.x,s=r===`n`||r===`nw`||r===`ne`?e.y+e.h:a-e.y;return{w:K(t,1,Math.max(1,o)),h:K(n,1,Math.max(1,s))}}},{name:`minMaxSize`,constrainSize(e,t,n){return{w:K(t,e.minW??1,e.maxW??1/0),h:K(n,e.minH??1,e.maxH??1/0)}}}];function ve(e,t,n,r,i){let a={x:n,y:r};for(let n of e)n.constrainPosition&&(a=n.constrainPosition(t,a.x,a.y,i));if(t.constraints)for(let e of t.constraints)e.constrainPosition&&(a=e.constrainPosition(t,a.x,a.y,i));return a}function q(e,t,n,r,i,a){let o={w:n,h:r};for(let n of e)n.constrainSize&&(o=n.constrainSize(t,o.w,o.h,i,a));if(t.constraints)for(let e of t.constraints)e.constrainSize&&(o=e.constrainSize(t,o.w,o.h,i,a));return o}function ye({top:e,left:t,width:n,height:r}){let i=`translate(${t}px,${e}px)`;return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:`${n}px`,height:`${r}px`,position:`absolute`}}function be({top:e,left:t,width:n,height:r}){return{top:`${e}px`,left:`${t}px`,width:`${n}px`,height:`${r}px`,position:`absolute`}}function xe(e){return e*100+`%`}function Se(e,t,n,r){return e+n>r?t:n}function J(e,t,n){return e<0?t:n}function Ce(e){return Math.max(0,e)}function Y(e){return Math.max(0,e)}var we=(e,t,n)=>{let{left:r,height:i,width:a}=t,o=e.top-(i-e.height);return{left:r,width:a,height:J(o,e.height,i),top:Y(o)}},Te=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{top:r,height:a,width:Se(e.left,e.width,o,n),left:Ce(i)}},Ee=(e,t,n)=>{let{top:r,height:i,width:a}=t,o=e.left+e.width-a;return o<0?{height:i,width:e.left+e.width,top:Y(r),left:0}:{height:i,width:a,top:Y(r),left:o}},De=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{width:o,left:i,height:J(r,e.height,a),top:Y(r)}},Oe={n:we,ne:(e,t,n)=>we(e,Te(e,t,n)),e:Te,se:(e,t,n)=>De(e,Te(e,t,n)),s:De,sw:(e,t,n)=>De(e,Ee(e,t)),w:Ee,nw:(e,t,n)=>we(e,Ee(e,t))};function ke(e,t,n,r){let i=Oe[e];return i?i(t,{...t,...n},r):n}var Ae={type:`transform`,scale:1,calcStyle(e){return ye(e)}},je={cols:12,rowHeight:150,margin:[10,10],containerPadding:null,maxRows:1/0},Me={enabled:!0,bounded:!1,threshold:3},Ne={enabled:!0,handles:[`se`]},Pe={enabled:!1,defaultItem:{w:1,h:1},touchEnabled:!0,touchDragSource:`[data-rgl-draggable]`};function Fe(e,t,n,r,i){let a=r===`x`?`w`:`h`;t[r]+=1;let o=e.findIndex(e=>e.i===t.i),s=i??V(e).length>0;for(let i=o+1;i<e.length;i++){let o=e[i];if(o!==void 0&&!o.static){if(!s&&o.y>t.y+t.h)break;le(t,o)&&Fe(e,o,n+t[a],r,s)}}t[r]=n}function Ie(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0),t.y=Math.min(r,t.y);t.y>0&&!ue(e,t);)t.y--;let i;for(;(i=ue(e,t))!==void 0;)Fe(n,t,i.y+i.h,`y`);return t.y=Math.max(t.y,0),t}function Le(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0);t.x>0&&!ue(e,t);)t.x--;let i;for(;(i=ue(e,t))!==void 0;)if(Fe(r,t,i.x+i.w,`x`),t.x+t.w>n)for(t.x=n-t.w,t.y++;t.x>0&&!ue(e,t);)t.x--;return t.x=Math.max(t.x,0),t}var Re={type:`vertical`,allowOverlap:!1,compact(e,t){let n=V(e),r=fe(n),i=z(e),a=Array(e.length);for(let t=0;t<i.length;t++){let o=i[t];if(o===void 0)continue;let s=H(o);s.static||(s=Ie(n,s,i,r),r=Math.max(r,s.y+s.h),n.push(s));let c=e.indexOf(o);a[c]=s,s.moved=!1}return a}},ze={type:`horizontal`,allowOverlap:!1,compact(e,t){let n=V(e),r=B(e),i=Array(e.length);for(let a=0;a<r.length;a++){let o=r[a];if(o===void 0)continue;let s=H(o);s.static||(s=Le(n,s,t,r),n.push(s));let c=e.indexOf(o);i[c]=s,s.moved=!1}return i}},Be={type:null,allowOverlap:!1,compact(e,t){return U(e)}},Ve={...Re,allowOverlap:!0,compact(e,t){return U(e)}},He={...ze,allowOverlap:!0,compact(e,t){return U(e)}},Ue={...Be,allowOverlap:!0};function We(e,t=!1,n=!1){let r;return r=t?e===`vertical`?Ve:e===`horizontal`?He:Ue:e===`vertical`?Re:e===`horizontal`?ze:Be,n?{...r,preventCollision:n}:r}function Ge(e){return Object.keys(e).sort((t,n)=>e[t]-e[n])}function Ke(e,t){let n=Ge(e),r=n[0];if(r===void 0)throw Error(`No breakpoints defined`);for(let i=1;i<n.length;i++){let a=n[i];a!==void 0&&t>e[a]&&(r=a)}return r}function qe(e,t){let n=t[e];if(n===void 0)throw Error(`ResponsiveReactGridLayout: \`cols\` entry for breakpoint ${String(e)} is missing!`);return n}function Je(e,t,n,r,i,a){let o=e[n];if(o)return U(o);let s=e[r],c=Ge(t),l=c.slice(c.indexOf(n));for(let t=0;t<l.length;t++){let n=l[t];if(n===void 0)continue;let r=e[n];if(r){s=r;break}}let u=W(U(s||[]),{cols:i});return(typeof a==`object`&&a?a:We(a)).compact(u,i)}function Ye(e,t){if(Array.isArray(e))return e;let n=e,r=n[t];if(r!==void 0)return r;let i=Object.keys(n);for(let e of i){let t=n[e];if(t!==void 0)return t}return[10,10]}var Xe=n(((e,t,n)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):(n=typeof globalThis<`u`?globalThis:n||self,r(n[`fast-equals`]={}))})(n,(function(e){function t(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function n(e){return function(t,n,r,i){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r,i);var a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);var s=e(t,n,r,i);return i.delete(t),i.delete(n),s}}function r(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n}function i(e){return e.constructor===Object||e.constructor==null}function a(e){return typeof e.then==`function`}function o(e,t){return e===t||e!==e&&t!==t}var s=Object.prototype.toString;function c(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areMapsEqual,c=e.areObjectsEqual,l=e.areRegExpsEqual,u=e.areSetsEqual,d=e.createIsNestedEqual,f=d(p);function p(e,d,p){if(e===d)return!0;if(!e||!d||typeof e!=`object`||typeof d!=`object`)return e!==e&&d!==d;if(i(e)&&i(d))return c(e,d,f,p);var m=Array.isArray(e),h=Array.isArray(d);if(m||h)return m===h&&t(e,d,f,p);var g=s.call(e);return g===s.call(d)?g===`[object Date]`?n(e,d,f,p):g===`[object RegExp]`?l(e,d,f,p):g===`[object Map]`?r(e,d,f,p):g===`[object Set]`?u(e,d,f,p):g===`[object Object]`||g===`[object Arguments]`?a(e)||a(d)?!1:c(e,d,f,p):g===`[object Boolean]`||g===`[object Number]`||g===`[object String]`?o(e.valueOf(),d.valueOf()):!1:!1}return p}function l(e,t,n,r){var i=e.length;if(t.length!==i)return!1;for(;i-->0;)if(!n(e[i],t[i],i,i,e,t,r))return!1;return!0}var u=n(l);function d(e,t){return o(e.valueOf(),t.valueOf())}function f(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={},o=0;return e.forEach(function(s,c){if(i){var l=!1,u=0;t.forEach(function(i,d){!l&&!a[u]&&(l=n(c,d,o,u,e,t,r)&&n(s,i,c,d,e,t,r))&&(a[u]=!0),u++}),o++,i=l}}),i}var p=n(f),m=`_owner`,h=Object.prototype.hasOwnProperty;function g(e,t,n,r){var i=Object.keys(e),a=i.length;if(Object.keys(t).length!==a)return!1;for(var o;a-->0;){if(o=i[a],o===m){var s=!!e.$$typeof,c=!!t.$$typeof;if((s||c)&&s!==c)return!1}if(!h.call(t,o)||!n(e[o],t[o],o,o,e,t,r))return!1}return!0}var _=n(g);function v(e,t){return e.source===t.source&&e.flags===t.flags}function y(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={};return e.forEach(function(o,s){if(i){var c=!1,l=0;t.forEach(function(i,u){!c&&!a[l]&&(c=n(o,i,s,u,e,t,r))&&(a[l]=!0),l++}),i=c}}),i}var b=n(y),x=Object.freeze({areArraysEqual:l,areDatesEqual:d,areMapsEqual:f,areObjectsEqual:g,areRegExpsEqual:v,areSetsEqual:y,createIsNestedEqual:t}),S=Object.freeze({areArraysEqual:u,areDatesEqual:d,areMapsEqual:p,areObjectsEqual:_,areRegExpsEqual:v,areSetsEqual:b,createIsNestedEqual:t}),C=c(x);function w(e,t){return C(e,t,void 0)}var T=c(r(x,{createIsNestedEqual:function(){return o}}));function E(e,t){return T(e,t,void 0)}var D=c(S);function ee(e,t){return D(e,t,new WeakMap)}var O=c(r(S,{createIsNestedEqual:function(){return o}}));function k(e,t){return O(e,t,new WeakMap)}function A(e){return c(r(x,e(x)))}function j(e){var t=c(r(S,e(S)));return(function(e,n,r){return r===void 0&&(r=new WeakMap),t(e,n,r)})}e.circularDeepEqual=ee,e.circularShallowEqual=k,e.createCustomCircularEqual=j,e.createCustomEqual=A,e.deepEqual=w,e.sameValueZeroEqual=o,e.shallowEqual=E,Object.defineProperty(e,"__esModule",{value:!0})}))})),Ze=n(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Qe=n(((e,t)=>{var n=Ze();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),$e=n(((e,t)=>{t.exports=Qe()()})),X=e(t(),1),Z=e($e(),1),et=e(r(),1);function tt(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function nt(e){return typeof e==`function`||Object.prototype.toString.call(e)===`[object Function]`}function rt(e){return typeof e==`number`&&!isNaN(e)}function Q(e){return parseInt(e,10)}function it(e,t,n){if(e[t])return Error(`Invalid prop ${t} passed to ${n} - do not set this, set it on the child.`)}var at=[`Moz`,`Webkit`,`O`,`ms`];function ot(e=`transform`){if(typeof window>`u`)return``;let t=window.document?.documentElement?.style;if(!t||e in t)return``;for(let n=0;n<at.length;n++)if(st(e,at[n])in t)return at[n];return``}function st(e,t){return t?`${t}${ct(e)}`:e}function ct(e){let t=``,n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):e[r]===`-`?n=!0:t+=e[r];return t}var lt=ot(),ut=``;function dt(e,t){ut||=tt([`matches`,`webkitMatchesSelector`,`mozMatchesSelector`,`msMatchesSelector`,`oMatchesSelector`],function(t){return nt(e[t])})??``;let n=e[ut];return nt(n)?!!n.call(e,t):!1}function ft(e,t,n){let r=e;do{if(dt(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function pt(e,t,n,r){if(!e)return;let i={capture:!0,...r},a=n;e.addEventListener?e.addEventListener(t,a,i):e.attachEvent?e.attachEvent(`on`+t,a):e[`on`+t]=a}function mt(e,t,n,r){if(!e)return;let i={capture:!0,...r},a=n;e.removeEventListener?e.removeEventListener(t,a,i):e.detachEvent?e.detachEvent(`on`+t,a):e[`on`+t]=null}function ht(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=Q(n.borderTopWidth),t+=Q(n.borderBottomWidth),t}function gt(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=Q(n.borderLeftWidth),t+=Q(n.borderRightWidth),t}function _t(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=Q(n.paddingTop),t-=Q(n.paddingBottom),t}function vt(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=Q(n.paddingLeft),t-=Q(n.paddingRight),t}function yt(e,t,n){let r=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect();return{x:(e.clientX+t.scrollLeft-r.left)/n,y:(e.clientY+t.scrollTop-r.top)/n}}function bt(e,t){let n=St(e,t,`px`);return{[st(`transform`,lt)]:n}}function xt(e,t){return St(e,t,``)}function St({x:e,y:t},n,r){let i=`translate(${e}${r},${t}${r})`;return n&&(i=`translate(${`${typeof n.x==`string`?n.x:n.x+r}`}, ${`${typeof n.y==`string`?n.y:n.y+r}`})`+i),i}function Ct(e,t){return e.targetTouches&&tt(e.targetTouches,e=>t===e.identifier)||e.changedTouches&&tt(e.changedTouches,e=>t===e.identifier)}function wt(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function Tt(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0}function Et(e,t){if(!e)return;let n=e.getElementById(`react-draggable-style-el`);if(!n){n=e.createElement(`style`),n.type=`text/css`,n.id=`react-draggable-style-el`;let r=t??Tt();r&&n.setAttribute(`nonce`,r),n.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
1
+ import{c as e,n as t,r as n,t as r}from"./react-dom.CqAxpHMt.js";import{i}from"./app-config.DUyozIL9.js";import{a,o,r as s}from"./plugins.BDZqJNOy.js";import{a as c,i as l,n as u,o as d,r as f,t as p}from"./view-prefs.Dyu_lmN2.js";import{i as m,n as h,r as g,t as _}from"./dialog.DXHznyjD.js";import{t as v}from"./jsx-runtime.BUXbF_vF.js";import{v as y,y as b}from"./pm.Bl3hz9fF.js";import{A as x,C as S,D as C,E as w,P as T,b as E,f as D,i as ee,k as O,n as k,s as A,u as j,v as M,w as N}from"./tasks.otRBFydq.js";import{a as te,r as ne}from"./test-stats.MEm3K2rB.js";import{d as re}from"./spaces-client.k_ciWMai.js";function ie(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=ie(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function ae(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=ie(e))&&(r&&(r+=` `),r+=t);return r}function P(e){let{margin:t,containerPadding:n,containerWidth:r,cols:i}=e;return(r-t[0]*(i-1)-n[0]*2)/i}function F(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function oe(e,t,n,r,i,a,o){let{margin:s,containerPadding:c,rowHeight:l}=e,u=P(e),d,f,p,m;if(o?(d=Math.round(o.width),f=Math.round(o.height)):(d=F(r,u,s[0]),f=F(i,l,s[1])),a?(p=Math.round(a.top),m=Math.round(a.left)):o?(p=Math.round(o.top),m=Math.round(o.left)):(p=Math.round((l+s[1])*n+c[1]),m=Math.round((u+s[0])*t+c[0])),!a&&!o){if(Number.isFinite(r)){let e=Math.round((u+s[0])*(t+r)+c[0])-m-d;e!==s[0]&&(d+=e-s[0])}if(Number.isFinite(i)){let e=Math.round((l+s[1])*(n+i)+c[1])-p-f;e!==s[1]&&(f+=e-s[1])}}return{top:p,left:m,width:d,height:f}}function se(e,t,n,r,i){let{margin:a,containerPadding:o,cols:s,rowHeight:c,maxRows:l}=e,u=P(e),d=Math.round((n-o[0])/(u+a[0])),f=Math.round((t-o[1])/(c+a[1]));return d=L(d,0,s-r),f=L(f,0,l-i),{x:d,y:f}}function I(e,t,n){let{margin:r,containerPadding:i,rowHeight:a}=e,o=P(e);return{x:Math.round((n-i[0])/(o+r[0])),y:Math.round((t-i[1])/(a+r[1]))}}function ce(e,t,n){let{margin:r,rowHeight:i}=e,a=P(e);return{w:Math.max(1,Math.round((t+r[0])/(a+r[0]))),h:Math.max(1,Math.round((n+r[1])/(i+r[1])))}}function L(e,t,n){return Math.max(Math.min(e,n),t)}function le(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function ue(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0&&le(r,t))return r}}function de(e,t){return e.filter(e=>le(e,t))}function R(e,t){return t===`horizontal`?B(e):t===`vertical`||t===`wrap`?z(e):[...e]}function z(e){return[...e].sort((e,t)=>e.y===t.y?e.x-t.x:e.y-t.y)}function B(e){return[...e].sort((e,t)=>e.x===t.x?e.y-t.y:e.x-t.x)}function fe(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0){let e=r.y+r.h;e>t&&(t=e)}}return t}function pe(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0&&r.i===t)return r}}function V(e){return e.filter(e=>e.static===!0)}function H(e){return{i:e.i,x:e.x,y:e.y,w:e.w,h:e.h,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,constraints:e.constraints,isBounded:e.isBounded}}function U(e){let t=Array(e.length);for(let n=0;n<e.length;n++){let r=e[n];r!==void 0&&(t[n]=H(r))}return t}function me(e,t){let n=Array(e.length);for(let r=0;r<e.length;r++){let i=e[r];i!==void 0&&(t.i===i.i?n[r]=t:n[r]=i)}return n}function he(e,t,n){let r=pe(e,t);return r?(r=n(H(r)),[me(e,r),r]):[[...e],null]}function W(e,t){let n=V(e);for(let r=0;r<e.length;r++){let i=e[r];if(i!==void 0){if(i.x+i.w>t.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),i.y===1/0&&(i.y=fe(n)),!i.static)n.push(i);else for(;ue(n,i);)i.y++}}return e}function ge(e,t,n,r,i,a,o,s,c){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return[...e];let l=t.x,u=t.y;typeof n==`number`&&(t.x=n),typeof r==`number`&&(t.y=r),t.moved=!0;let d=R(e,o);(o===`vertical`&&typeof r==`number`?u>=r:o===`horizontal`&&typeof n==`number`&&l>=n)&&(d=d.reverse());let f=de(d,t),p=f.length>0;if(p&&c)return U(e);if(p&&a)return t.x=l,t.y=u,t.moved=!1,e;let m=[...e];for(let e=0;e<f.length;e++){let n=f[e];n!==void 0&&(n.moved||(m=n.static?G(m,n,t,i,o):G(m,t,n,i,o)))}return m}function G(e,t,n,r,i,a){let o=i===`horizontal`||i===`wrap`,s=i===`vertical`,c=t.static;if(r){r=!1;let a={x:o?Math.max(t.x-n.w,0):n.x,y:s?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:`-1`},l=ue(e,a),u=l!==void 0&&l.y+l.h>t.y,d=l!==void 0&&t.x+t.w>l.x;if(!l)return ge(e,n,o?a.x:void 0,s?a.y:void 0,r,c,i);if(u&&s)return ge(e,n,void 0,n.y+1,r,c,i);if(u&&i===null){let r=n.y;return t.y=r,n.y=r+t.h,[...e]}if(d&&o)return ge(e,t,n.x,void 0,r,c,i)}let l=o?n.x+1:void 0,u=s?n.y+1:void 0;return l===void 0&&u===void 0?[...e]:ge(e,n,l,u,r,c,i)}function K(e,t,n){return Math.max(t,Math.min(n,e))}var _e=[{name:`gridBounds`,constrainPosition(e,t,n,{cols:r,maxRows:i}){return{x:K(t,0,Math.max(0,r-e.w)),y:K(n,0,Math.max(0,i-e.h))}},constrainSize(e,t,n,r,{cols:i,maxRows:a}){let o=r===`w`||r===`nw`||r===`sw`?e.x+e.w:i-e.x,s=r===`n`||r===`nw`||r===`ne`?e.y+e.h:a-e.y;return{w:K(t,1,Math.max(1,o)),h:K(n,1,Math.max(1,s))}}},{name:`minMaxSize`,constrainSize(e,t,n){return{w:K(t,e.minW??1,e.maxW??1/0),h:K(n,e.minH??1,e.maxH??1/0)}}}];function ve(e,t,n,r,i){let a={x:n,y:r};for(let n of e)n.constrainPosition&&(a=n.constrainPosition(t,a.x,a.y,i));if(t.constraints)for(let e of t.constraints)e.constrainPosition&&(a=e.constrainPosition(t,a.x,a.y,i));return a}function q(e,t,n,r,i,a){let o={w:n,h:r};for(let n of e)n.constrainSize&&(o=n.constrainSize(t,o.w,o.h,i,a));if(t.constraints)for(let e of t.constraints)e.constrainSize&&(o=e.constrainSize(t,o.w,o.h,i,a));return o}function ye({top:e,left:t,width:n,height:r}){let i=`translate(${t}px,${e}px)`;return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:`${n}px`,height:`${r}px`,position:`absolute`}}function be({top:e,left:t,width:n,height:r}){return{top:`${e}px`,left:`${t}px`,width:`${n}px`,height:`${r}px`,position:`absolute`}}function xe(e){return e*100+`%`}function Se(e,t,n,r){return e+n>r?t:n}function J(e,t,n){return e<0?t:n}function Ce(e){return Math.max(0,e)}function Y(e){return Math.max(0,e)}var we=(e,t,n)=>{let{left:r,height:i,width:a}=t,o=e.top-(i-e.height);return{left:r,width:a,height:J(o,e.height,i),top:Y(o)}},Te=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{top:r,height:a,width:Se(e.left,e.width,o,n),left:Ce(i)}},Ee=(e,t,n)=>{let{top:r,height:i,width:a}=t,o=e.left+e.width-a;return o<0?{height:i,width:e.left+e.width,top:Y(r),left:0}:{height:i,width:a,top:Y(r),left:o}},De=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{width:o,left:i,height:J(r,e.height,a),top:Y(r)}},Oe={n:we,ne:(e,t,n)=>we(e,Te(e,t,n)),e:Te,se:(e,t,n)=>De(e,Te(e,t,n)),s:De,sw:(e,t,n)=>De(e,Ee(e,t)),w:Ee,nw:(e,t,n)=>we(e,Ee(e,t))};function ke(e,t,n,r){let i=Oe[e];return i?i(t,{...t,...n},r):n}var Ae={type:`transform`,scale:1,calcStyle(e){return ye(e)}},je={cols:12,rowHeight:150,margin:[10,10],containerPadding:null,maxRows:1/0},Me={enabled:!0,bounded:!1,threshold:3},Ne={enabled:!0,handles:[`se`]},Pe={enabled:!1,defaultItem:{w:1,h:1},touchEnabled:!0,touchDragSource:`[data-rgl-draggable]`};function Fe(e,t,n,r,i){let a=r===`x`?`w`:`h`;t[r]+=1;let o=e.findIndex(e=>e.i===t.i),s=i??V(e).length>0;for(let i=o+1;i<e.length;i++){let o=e[i];if(o!==void 0&&!o.static){if(!s&&o.y>t.y+t.h)break;le(t,o)&&Fe(e,o,n+t[a],r,s)}}t[r]=n}function Ie(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0),t.y=Math.min(r,t.y);t.y>0&&!ue(e,t);)t.y--;let i;for(;(i=ue(e,t))!==void 0;)Fe(n,t,i.y+i.h,`y`);return t.y=Math.max(t.y,0),t}function Le(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0);t.x>0&&!ue(e,t);)t.x--;let i;for(;(i=ue(e,t))!==void 0;)if(Fe(r,t,i.x+i.w,`x`),t.x+t.w>n)for(t.x=n-t.w,t.y++;t.x>0&&!ue(e,t);)t.x--;return t.x=Math.max(t.x,0),t}var Re={type:`vertical`,allowOverlap:!1,compact(e,t){let n=V(e),r=fe(n),i=z(e),a=Array(e.length);for(let t=0;t<i.length;t++){let o=i[t];if(o===void 0)continue;let s=H(o);s.static||(s=Ie(n,s,i,r),r=Math.max(r,s.y+s.h),n.push(s));let c=e.indexOf(o);a[c]=s,s.moved=!1}return a}},ze={type:`horizontal`,allowOverlap:!1,compact(e,t){let n=V(e),r=B(e),i=Array(e.length);for(let a=0;a<r.length;a++){let o=r[a];if(o===void 0)continue;let s=H(o);s.static||(s=Le(n,s,t,r),n.push(s));let c=e.indexOf(o);i[c]=s,s.moved=!1}return i}},Be={type:null,allowOverlap:!1,compact(e,t){return U(e)}},Ve={...Re,allowOverlap:!0,compact(e,t){return U(e)}},He={...ze,allowOverlap:!0,compact(e,t){return U(e)}},Ue={...Be,allowOverlap:!0};function We(e,t=!1,n=!1){let r;return r=t?e===`vertical`?Ve:e===`horizontal`?He:Ue:e===`vertical`?Re:e===`horizontal`?ze:Be,n?{...r,preventCollision:n}:r}function Ge(e){return Object.keys(e).sort((t,n)=>e[t]-e[n])}function Ke(e,t){let n=Ge(e),r=n[0];if(r===void 0)throw Error(`No breakpoints defined`);for(let i=1;i<n.length;i++){let a=n[i];a!==void 0&&t>e[a]&&(r=a)}return r}function qe(e,t){let n=t[e];if(n===void 0)throw Error(`ResponsiveReactGridLayout: \`cols\` entry for breakpoint ${String(e)} is missing!`);return n}function Je(e,t,n,r,i,a){let o=e[n];if(o)return U(o);let s=e[r],c=Ge(t),l=c.slice(c.indexOf(n));for(let t=0;t<l.length;t++){let n=l[t];if(n===void 0)continue;let r=e[n];if(r){s=r;break}}let u=W(U(s||[]),{cols:i});return(typeof a==`object`&&a?a:We(a)).compact(u,i)}function Ye(e,t){if(Array.isArray(e))return e;let n=e,r=n[t];if(r!==void 0)return r;let i=Object.keys(n);for(let e of i){let t=n[e];if(t!==void 0)return t}return[10,10]}var Xe=n(((e,t,n)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):(n=typeof globalThis<`u`?globalThis:n||self,r(n[`fast-equals`]={}))})(n,(function(e){function t(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function n(e){return function(t,n,r,i){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r,i);var a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);var s=e(t,n,r,i);return i.delete(t),i.delete(n),s}}function r(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n}function i(e){return e.constructor===Object||e.constructor==null}function a(e){return typeof e.then==`function`}function o(e,t){return e===t||e!==e&&t!==t}var s=Object.prototype.toString;function c(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areMapsEqual,c=e.areObjectsEqual,l=e.areRegExpsEqual,u=e.areSetsEqual,d=e.createIsNestedEqual,f=d(p);function p(e,d,p){if(e===d)return!0;if(!e||!d||typeof e!=`object`||typeof d!=`object`)return e!==e&&d!==d;if(i(e)&&i(d))return c(e,d,f,p);var m=Array.isArray(e),h=Array.isArray(d);if(m||h)return m===h&&t(e,d,f,p);var g=s.call(e);return g===s.call(d)?g===`[object Date]`?n(e,d,f,p):g===`[object RegExp]`?l(e,d,f,p):g===`[object Map]`?r(e,d,f,p):g===`[object Set]`?u(e,d,f,p):g===`[object Object]`||g===`[object Arguments]`?a(e)||a(d)?!1:c(e,d,f,p):g===`[object Boolean]`||g===`[object Number]`||g===`[object String]`?o(e.valueOf(),d.valueOf()):!1:!1}return p}function l(e,t,n,r){var i=e.length;if(t.length!==i)return!1;for(;i-->0;)if(!n(e[i],t[i],i,i,e,t,r))return!1;return!0}var u=n(l);function d(e,t){return o(e.valueOf(),t.valueOf())}function f(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={},o=0;return e.forEach(function(s,c){if(i){var l=!1,u=0;t.forEach(function(i,d){!l&&!a[u]&&(l=n(c,d,o,u,e,t,r)&&n(s,i,c,d,e,t,r))&&(a[u]=!0),u++}),o++,i=l}}),i}var p=n(f),m=`_owner`,h=Object.prototype.hasOwnProperty;function g(e,t,n,r){var i=Object.keys(e),a=i.length;if(Object.keys(t).length!==a)return!1;for(var o;a-->0;){if(o=i[a],o===m){var s=!!e.$$typeof,c=!!t.$$typeof;if((s||c)&&s!==c)return!1}if(!h.call(t,o)||!n(e[o],t[o],o,o,e,t,r))return!1}return!0}var _=n(g);function v(e,t){return e.source===t.source&&e.flags===t.flags}function y(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={};return e.forEach(function(o,s){if(i){var c=!1,l=0;t.forEach(function(i,u){!c&&!a[l]&&(c=n(o,i,s,u,e,t,r))&&(a[l]=!0),l++}),i=c}}),i}var b=n(y),x=Object.freeze({areArraysEqual:l,areDatesEqual:d,areMapsEqual:f,areObjectsEqual:g,areRegExpsEqual:v,areSetsEqual:y,createIsNestedEqual:t}),S=Object.freeze({areArraysEqual:u,areDatesEqual:d,areMapsEqual:p,areObjectsEqual:_,areRegExpsEqual:v,areSetsEqual:b,createIsNestedEqual:t}),C=c(x);function w(e,t){return C(e,t,void 0)}var T=c(r(x,{createIsNestedEqual:function(){return o}}));function E(e,t){return T(e,t,void 0)}var D=c(S);function ee(e,t){return D(e,t,new WeakMap)}var O=c(r(S,{createIsNestedEqual:function(){return o}}));function k(e,t){return O(e,t,new WeakMap)}function A(e){return c(r(x,e(x)))}function j(e){var t=c(r(S,e(S)));return(function(e,n,r){return r===void 0&&(r=new WeakMap),t(e,n,r)})}e.circularDeepEqual=ee,e.circularShallowEqual=k,e.createCustomCircularEqual=j,e.createCustomEqual=A,e.deepEqual=w,e.sameValueZeroEqual=o,e.shallowEqual=E,Object.defineProperty(e,"__esModule",{value:!0})}))})),Ze=n(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Qe=n(((e,t)=>{var n=Ze();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),$e=n(((e,t)=>{t.exports=Qe()()})),X=e(t(),1),Z=e($e(),1),et=e(r(),1);function tt(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function nt(e){return typeof e==`function`||Object.prototype.toString.call(e)===`[object Function]`}function rt(e){return typeof e==`number`&&!isNaN(e)}function Q(e){return parseInt(e,10)}function it(e,t,n){if(e[t])return Error(`Invalid prop ${t} passed to ${n} - do not set this, set it on the child.`)}var at=[`Moz`,`Webkit`,`O`,`ms`];function ot(e=`transform`){if(typeof window>`u`)return``;let t=window.document?.documentElement?.style;if(!t||e in t)return``;for(let n=0;n<at.length;n++)if(st(e,at[n])in t)return at[n];return``}function st(e,t){return t?`${t}${ct(e)}`:e}function ct(e){let t=``,n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):e[r]===`-`?n=!0:t+=e[r];return t}var lt=ot(),ut=``;function dt(e,t){ut||=tt([`matches`,`webkitMatchesSelector`,`mozMatchesSelector`,`msMatchesSelector`,`oMatchesSelector`],function(t){return nt(e[t])})??``;let n=e[ut];return nt(n)?!!n.call(e,t):!1}function ft(e,t,n){let r=e;do{if(dt(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function pt(e,t,n,r){if(!e)return;let i={capture:!0,...r},a=n;e.addEventListener?e.addEventListener(t,a,i):e.attachEvent?e.attachEvent(`on`+t,a):e[`on`+t]=a}function mt(e,t,n,r){if(!e)return;let i={capture:!0,...r},a=n;e.removeEventListener?e.removeEventListener(t,a,i):e.detachEvent?e.detachEvent(`on`+t,a):e[`on`+t]=null}function ht(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=Q(n.borderTopWidth),t+=Q(n.borderBottomWidth),t}function gt(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=Q(n.borderLeftWidth),t+=Q(n.borderRightWidth),t}function _t(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=Q(n.paddingTop),t-=Q(n.paddingBottom),t}function vt(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=Q(n.paddingLeft),t-=Q(n.paddingRight),t}function yt(e,t,n){let r=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect();return{x:(e.clientX+t.scrollLeft-r.left)/n,y:(e.clientY+t.scrollTop-r.top)/n}}function bt(e,t){let n=St(e,t,`px`);return{[st(`transform`,lt)]:n}}function xt(e,t){return St(e,t,``)}function St({x:e,y:t},n,r){let i=`translate(${e}${r},${t}${r})`;return n&&(i=`translate(${`${typeof n.x==`string`?n.x:n.x+r}`}, ${`${typeof n.y==`string`?n.y:n.y+r}`})`+i),i}function Ct(e,t){return e.targetTouches&&tt(e.targetTouches,e=>t===e.identifier)||e.changedTouches&&tt(e.changedTouches,e=>t===e.identifier)}function wt(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function Tt(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0}function Et(e,t){if(!e)return;let n=e.getElementById(`react-draggable-style-el`);if(!n){n=e.createElement(`style`),n.type=`text/css`,n.id=`react-draggable-style-el`;let r=t??Tt();r&&n.setAttribute(`nonce`,r),n.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
2
2
  `,n.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
3
3
  `,e.getElementsByTagName(`head`)[0].appendChild(n)}e.body&&kt(e.body,`react-draggable-transparent-selection`)}function Dt(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{Ot(e)}):Ot(e)}function Ot(e){if(e)try{e.body&&At(e.body,`react-draggable-transparent-selection`);let t=e.selection;if(t)t.empty();else{let t=(e.defaultView||window).getSelection();t&&t.type!==`Caret`&&t.removeAllRanges()}}catch{}}function kt(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function At(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function jt(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:Rt(r);let i=zt(e);if(typeof r==`string`){let{ownerDocument:e}=i,t=e.defaultView;if(!t)throw Error(`Cannot resolve the owner window of the draggable node.`);let n;if(n=r===`parent`?i.parentNode:i.getRootNode().querySelector(r),!(n instanceof t.HTMLElement))throw Error(`Bounds selector "`+r+`" could not find an element.`);let a=n,o=t.getComputedStyle(i),s=t.getComputedStyle(a);r={left:-i.offsetLeft+Q(s.paddingLeft)+Q(o.marginLeft),top:-i.offsetTop+Q(s.paddingTop)+Q(o.marginTop),right:vt(a)-gt(i)-i.offsetLeft+Q(s.paddingRight)-Q(o.marginRight),bottom:_t(a)-ht(i)-i.offsetTop+Q(s.paddingBottom)-Q(o.marginBottom)}}return rt(r.right)&&(t=Math.min(t,r.right)),rt(r.bottom)&&(n=Math.min(n,r.bottom)),rt(r.left)&&(t=Math.max(t,r.left)),rt(r.top)&&(n=Math.max(n,r.top)),[t,n]}function Mt(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function Nt(e){return e.props.axis===`both`||e.props.axis===`x`}function Pt(e){return e.props.axis===`both`||e.props.axis===`y`}function Ft(e,t,n){let r=typeof t==`number`?Ct(e,t):null;if(typeof t==`number`&&!r)return null;let i=zt(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return yt(r||e,a,n.props.scale)}function It(e,t,n){let r=!rt(e.lastX),i=zt(e);return r?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:i,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function Lt(e,t){let n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function Rt(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function zt(e){let t=e.findDOMNode();if(!t)throw Error(`<DraggableCore>: Unmounted during event!`);return t}var Bt=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},Vt={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},Ht=Vt.mouse,Ut=class extends X.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&(typeof e.button==`number`&&e.button!==0||e.ctrlKey))return!1;let t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw Error(`<DraggableCore> not mounted on DragStart!`);let{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!ft(e.target,this.props.handle,t)||this.props.cancel&&ft(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=wt(e);this.touchIdentifier=r;let i=Ft(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=It(this,a,o);Bt(`DraggableCore: handleDragStart: %j`,s),Bt(`calling`,this.props.onStart),this.props.onStart(e,s)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&Et(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=o,pt(n,Ht.move,this.handleDrag),pt(n,Ht.stop,this.handleDragStop))},this.handleDrag=e=>{let t=Ft(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=Mt(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=It(this,n,r);if(Bt(`DraggableCore: handleDrag: %j`,i),this.props.onDrag(e,i)===!1||this.mounted===!1)try{this.handleDragStop(new MouseEvent(`mouseup`))}catch{let e=document.createEvent(`MouseEvents`);e.initMouseEvent(`mouseup`,!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(e)}else this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;let t=Ft(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=Mt(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=It(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&Dt(a.ownerDocument),Bt(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(Bt(`DraggableCore: Removing handlers`),mt(a.ownerDocument,Ht.move,this.handleDrag),mt(a.ownerDocument,Ht.stop,this.handleDragStop))},this.onMouseDown=e=>(Ht=Vt.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(Ht=Vt.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(Ht=Vt.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(Ht=Vt.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&pt(e,Vt.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;mt(t,Vt.mouse.move,this.handleDrag),mt(t,Vt.touch.move,this.handleDrag),mt(t,Vt.mouse.stop,this.handleDragStop),mt(t,Vt.touch.stop,this.handleDragStop),mt(e,Vt.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&Dt(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=et.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(Bt(`react-draggable: ReactDOM.findDOMNode is not available in React 19+. You must provide a nodeRef prop. See: https://github.com/react-grid-layout/react-draggable#noderef`),null)}render(){return X.cloneElement(X.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};Ut.displayName=`DraggableCore`,Ut.propTypes={allowAnyClick:Z.default.bool,allowMobileScroll:Z.default.bool,children:Z.default.node.isRequired,disabled:Z.default.bool,enableUserSelectHack:Z.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:Z.default.arrayOf(Z.default.number),handle:Z.default.string,cancel:Z.default.string,nodeRef:Z.default.object,nonce:Z.default.string,onStart:Z.default.func,onDrag:Z.default.func,onStop:Z.default.func,onMouseDown:Z.default.func,scale:Z.default.number,className:it,style:it,transform:it},Ut.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var Wt=class extends X.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(Bt(`Draggable: onDragStart: %j`,t),this.props.onStart(e,Lt(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;Bt(`Draggable: onDrag: %j`,t);let n=Lt(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){let{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;let[i,a]=jt(this,r.x,r.y);r.x=i,r.y=a,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(this.props.onDrag(e,n)===!1)return!1;this.setState(r)},this.onDragStop=(e,t)=>{if(!this.state.dragging||this.props.onStop(e,Lt(this,t))===!1)return!1;Bt(`Draggable: onDragStop: %j`,t);let n={dragging:!1,slackX:0,slackY:0};if(this.props.position){let{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)},this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}static getDerivedStateFromProps({position:e},{prevPropsPosition:t}){return e&&(!t||e.x!==t.x||e.y!==t.y)?(Bt(`Draggable: getDerivedStateFromProps %j`,{position:e,prevPropsPosition:t}),{x:e.x,y:e.y,prevPropsPosition:{...e}}):null}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=et.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):null}render(){let{axis:e,bounds:t,children:n,defaultPosition:r,defaultClassName:i,defaultClassNameDragging:a,defaultClassNameDragged:o,position:s,positionOffset:c,scale:l,...u}=this.props,d={},f=null,p=!s||this.state.dragging,m=s||r,h={x:Nt(this)&&p?this.state.x:m.x,y:Pt(this)&&p?this.state.y:m.y};this.state.isElementSVG?f=xt(h,c):d=bt(h,c);let g=X.Children.only(n),_=ae(g.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return X.createElement(Ut,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},X.cloneElement(g,{className:_,style:{...g.props.style,...d},transform:f}))}};Wt.displayName=`Draggable`,Wt.propTypes={...Ut.propTypes,axis:Z.default.oneOf([`both`,`x`,`y`,`none`]),bounds:Z.default.oneOfType([Z.default.shape({left:Z.default.number,right:Z.default.number,top:Z.default.number,bottom:Z.default.number}),Z.default.string,Z.default.oneOf([!1])]),defaultClassName:Z.default.string,defaultClassNameDragging:Z.default.string,defaultClassNameDragged:Z.default.string,defaultPosition:Z.default.shape({x:Z.default.number,y:Z.default.number}),positionOffset:Z.default.shape({x:Z.default.oneOfType([Z.default.number,Z.default.string]),y:Z.default.oneOfType([Z.default.number,Z.default.string])}),position:Z.default.shape({x:Z.default.number,y:Z.default.number}),className:it,style:it,transform:it},Wt.defaultProps={...Ut.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1};var Gt=n(((e,t)=>{function n(e){var t,r,i=``;if(typeof e==`string`||typeof e==`number`)i+=e;else if(typeof e==`object`){if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=n(e[t]))&&(i&&(i+=` `),i+=r)}else for(r in e)e[r]&&(i&&(i+=` `),i+=r)}return i}function r(){for(var e,t,r=0,i=``,a=arguments.length;r<a;r++)(e=arguments[r])&&(t=n(e))&&(i&&(i+=` `),i+=t);return i}t.exports=r,t.exports.clsx=r})),Kt=n(((e,n)=>{var i=Object.create,a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,c=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,u=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},d=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of s(t))!l.call(e,i)&&i!==n&&a(e,i,{get:()=>t[i],enumerable:!(r=o(t,i))||r.enumerable});return e},f=(e,t,n)=>(n=e==null?{}:i(c(e)),d(t||!e||!e.__esModule?a(n,`default`,{value:e,enumerable:!0}):n,e)),p=e=>d(a({},`__esModule`,{value:!0}),e),m={};u(m,{DraggableCore:()=>ve,default:()=>q}),n.exports=p(m);var h=f(t()),g=f($e()),_=f(r()),v=Gt();function y(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function b(e){return typeof e==`function`||Object.prototype.toString.call(e)===`[object Function]`}function x(e){return typeof e==`number`&&!isNaN(e)}function S(e){return parseInt(e,10)}function C(e,t,n){if(e[t])return Error(`Invalid prop ${t} passed to ${n} - do not set this, set it on the child.`)}var w=[`Moz`,`Webkit`,`O`,`ms`];function T(e=`transform`){if(typeof window>`u`)return``;let t=window.document?.documentElement?.style;if(!t||e in t)return``;for(let n=0;n<w.length;n++)if(E(e,w[n])in t)return w[n];return``}function E(e,t){return t?`${t}${D(e)}`:e}function D(e){let t=``,n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):e[r]===`-`?n=!0:t+=e[r];return t}var ee=T(),O=``;function k(e,t){O||=y([`matches`,`webkitMatchesSelector`,`mozMatchesSelector`,`msMatchesSelector`,`oMatchesSelector`],function(t){return b(e[t])})??``;let n=e[O];return b(n)?!!n.call(e,t):!1}function A(e,t,n){let r=e;do{if(k(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function j(e,t,n,r){if(!e)return;let i={capture:!0,...r},a=n;e.addEventListener?e.addEventListener(t,a,i):e.attachEvent?e.attachEvent(`on`+t,a):e[`on`+t]=a}function M(e,t,n,r){if(!e)return;let i={capture:!0,...r},a=n;e.removeEventListener?e.removeEventListener(t,a,i):e.detachEvent?e.detachEvent(`on`+t,a):e[`on`+t]=null}function N(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=S(n.borderTopWidth),t+=S(n.borderBottomWidth),t}function te(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=S(n.borderLeftWidth),t+=S(n.borderRightWidth),t}function ne(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=S(n.paddingTop),t-=S(n.paddingBottom),t}function re(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=S(n.paddingLeft),t-=S(n.paddingRight),t}function ie(e,t,n){let r=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect();return{x:(e.clientX+t.scrollLeft-r.left)/n,y:(e.clientY+t.scrollTop-r.top)/n}}function ae(e,t){let n=F(e,t,`px`);return{[E(`transform`,ee)]:n}}function P(e,t){return F(e,t,``)}function F({x:e,y:t},n,r){let i=`translate(${e}${r},${t}${r})`;return n&&(i=`translate(${`${typeof n.x==`string`?n.x:n.x+r}`}, ${`${typeof n.y==`string`?n.y:n.y+r}`})`+i),i}function oe(e,t){return e.targetTouches&&y(e.targetTouches,e=>t===e.identifier)||e.changedTouches&&y(e.changedTouches,e=>t===e.identifier)}function se(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function I(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0}function ce(e,t){if(!e)return;let n=e.getElementById(`react-draggable-style-el`);if(!n){n=e.createElement(`style`),n.type=`text/css`,n.id=`react-draggable-style-el`;let r=t??I();r&&n.setAttribute(`nonce`,r),n.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
4
4
  `,n.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
@@ -1 +1 @@
1
- import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{p as n}from"./app-config.DKMxjv3g.js";import{a as r,n as i,o as a,r as o}from"./view-prefs.HCowOWXL.js";import{t as s}from"./jsx-runtime.BUXbF_vF.js";import{n as c,t as l}from"./DocsPager.rzu4mnzw.js";import{t as u}from"./SelectDropdown.Buv7rQJ_.js";import{t as d}from"./OverflowHint.lzmplP5j.js";import{t as f}from"./useListAnim.CpGB1cft.js";var p=`tw.docs.files.v1.`;function m(e){try{let t=sessionStorage.getItem(n(p+e));if(!t)return null;let r=JSON.parse(t);return Array.isArray(r)?r:null}catch{return null}}function h(e,t){try{sessionStorage.setItem(n(p+e),JSON.stringify(t))}catch{}}var g=e(t(),1);function _(e){return e==null?`—`:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function v(e){if(!e)return`—`;try{return new Date(e).toLocaleString(`zh-CN`,{hour12:!1,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`})}catch{return`—`}}var y=s(),b=[{value:`mtime`,label:`按修改时间`},{value:`name`,label:`按文件名`}],x=b.map(e=>e.value),S=`h-8 px-3 text-sm border border-stone-300 rounded-lg bg-white text-stone-800 focus:outline-none focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6]`,C=`transition-colors duration-150 hover:bg-stone-50 hover:shadow-[inset_3px_0_0_0_var(--tw-accent)] cursor-pointer`,w=`w-38 shrink-0`,T=`w-16 shrink-0 text-left`,E=`w-40 shrink-0 text-right`,D=`text-sm text-stone-400 py-10 text-center border border-dashed border-stone-200 rounded-lg`;function O(e,t,n){let[s,l]=(0,g.useState)(()=>n?o(`docs.${n}.search`):``),[u,d]=(0,g.useState)(()=>n?i(`docs.${n}.sort`,x,`mtime`):`mtime`),[f,p]=(0,g.useState)(1),[m,h]=c(t),_=(0,g.useMemo)(()=>{let t=s.trim().toLowerCase(),n=[...t?e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)):e];return u===`name`?n.sort((e,t)=>e.name.localeCompare(t.name,`zh`)):n.sort((e,t)=>(t.mtime??0)-(e.mtime??0)),n},[e,s,u]),v=Math.max(1,Math.ceil(_.length/m)),y=Math.min(f,v);return{query:s,setQuery:e=>{l(e),n&&a(`docs.${n}.search`,e),p(1)},sortBy:u,setSortBy:e=>{d(e),n&&r(`docs.${n}.sort`,e),p(1)},page:y,setPage:p,pageSize:m,setPageSize:e=>{h(e),p(1)},filtered:_,totalPages:v,pageFiles:(0,g.useMemo)(()=>_.slice((y-1)*m,y*m),[_,y,m])}}function k({files:e,filtered:t,pageFiles:n,query:r,onQuery:i,sortBy:a,onSortBy:o,page:s,totalPages:c,pageSize:p,onPage:m,onPageSize:h,busy:g=!1,emptyText:x,searchPlaceholder:O,selectAllLabel:k=`全选本页`,renderBadge:A,renderActions:j,onRowDoubleClick:M,selectable:N,selected:P,onToggleRow:F,onSelectPage:I}){let L=N??(()=>!0),R=n.filter(L),z=R.length>0&&R.every(e=>P[e.path]),B=!z&&R.some(e=>P[e.path]),{cls:V,play:H}=f(),U=e=>{H(),i(e)};return(0,y.jsxs)(y.Fragment,{children:[e.length>0?(0,y.jsxs)(`div`,{className:`shrink-0 px-4 py-2 border-b border-stone-100 bg-stone-50/60 flex items-center gap-2 flex-wrap`,children:[(0,y.jsx)(`input`,{type:`search`,value:r,onChange:e=>U(e.target.value),placeholder:O,"aria-label":O,className:`${S} flex-1 min-w-48`}),(0,y.jsx)(u,{compact:!0,options:b,value:a,onChange:e=>{H(),o(e)},ariaLabel:`排序方式`,showCheck:!1,className:`w-34 shrink-0`})]}):null,(0,y.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto p-4`,children:e.length===0?(0,y.jsx)(`p`,{className:D,children:x}):t.length===0?(0,y.jsxs)(`p`,{className:D,children:[`没有匹配「`,r.trim(),`」的文件。`]}):(0,y.jsxs)(`ul`,{className:`${V}divide-y divide-stone-100 border border-stone-200 rounded-lg overflow-hidden`,children:[(0,y.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2 bg-stone-50 text-xs text-stone-500`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:z,ref:e=>{e&&(e.indeterminate=B)},onChange:()=>I(R.map(e=>e.path),!z),disabled:g||R.length===0,className:`rounded border-stone-300`,"aria-label":k}),(0,y.jsx)(`span`,{className:`flex-1 min-w-0`,children:`文件名`}),(0,y.jsx)(`span`,{className:w,children:`创建时间`}),(0,y.jsx)(`span`,{className:w,children:`修改时间`}),(0,y.jsx)(`span`,{className:T,children:`大小`}),(0,y.jsx)(`span`,{className:E,children:`操作`})]}),n.map(e=>{let t=L(e);return(0,y.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2.5 ${C}`,onDoubleClick:M?()=>M(e):void 0,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:!!P[e.path],disabled:g||!t,onChange:()=>F(e.path),onDoubleClick:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),className:`rounded border-stone-300`,"aria-label":`选择 ${e.name}`}),(0,y.jsxs)(`div`,{className:`flex-1 min-w-0 text-left flex items-center gap-2`,children:[(0,y.jsx)(d,{text:e.name,className:`text-sm text-stone-800 truncate`}),A?A(e):null]}),(0,y.jsx)(`span`,{className:`${w} text-[11px] text-stone-500 tabular-nums`,children:v(e.ctime??e.mtime)}),(0,y.jsx)(`span`,{className:`${w} text-[11px] text-stone-500 tabular-nums`,children:v(e.mtime)}),(0,y.jsx)(`span`,{className:`${T} text-[11px] text-stone-400`,children:_(e.size)}),(0,y.jsx)(`div`,{className:`${E} flex justify-end gap-1 flex-wrap`,onDoubleClick:e=>e.stopPropagation(),children:j(e)})]},e.path)})]})}),e.length>0?(0,y.jsx)(l,{page:s,totalPages:c,pageSize:p,busy:g,onPage:e=>{H(),m(e)},onPageSize:e=>{H(),h(e)}}):null]})}export{h as i,O as n,m as r,k as t};
1
+ import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{p as n}from"./app-config.DUyozIL9.js";import{a as r,n as i,o as a,r as o}from"./view-prefs.Dyu_lmN2.js";import{t as s}from"./jsx-runtime.BUXbF_vF.js";import{n as c,t as l}from"./DocsPager.C20ue_JZ.js";import{t as u}from"./SelectDropdown.Buv7rQJ_.js";import{t as d}from"./OverflowHint.lzmplP5j.js";import{t as f}from"./useListAnim.CpGB1cft.js";var p=`tw.docs.files.v1.`;function m(e){try{let t=sessionStorage.getItem(n(p+e));if(!t)return null;let r=JSON.parse(t);return Array.isArray(r)?r:null}catch{return null}}function h(e,t){try{sessionStorage.setItem(n(p+e),JSON.stringify(t))}catch{}}var g=e(t(),1);function _(e){return e==null?`—`:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function v(e){if(!e)return`—`;try{return new Date(e).toLocaleString(`zh-CN`,{hour12:!1,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`})}catch{return`—`}}var y=s(),b=[{value:`mtime`,label:`按修改时间`},{value:`name`,label:`按文件名`}],x=b.map(e=>e.value),S=`h-8 px-3 text-sm border border-stone-300 rounded-lg bg-white text-stone-800 focus:outline-none focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6]`,C=`transition-colors duration-150 hover:bg-stone-50 hover:shadow-[inset_3px_0_0_0_var(--tw-accent)] cursor-pointer`,w=`w-38 shrink-0`,T=`w-16 shrink-0 text-left`,E=`w-40 shrink-0 text-right`,D=`text-sm text-stone-400 py-10 text-center border border-dashed border-stone-200 rounded-lg`;function O(e,t,n){let[s,l]=(0,g.useState)(()=>n?o(`docs.${n}.search`):``),[u,d]=(0,g.useState)(()=>n?i(`docs.${n}.sort`,x,`mtime`):`mtime`),[f,p]=(0,g.useState)(1),[m,h]=c(t),_=(0,g.useMemo)(()=>{let t=s.trim().toLowerCase(),n=[...t?e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)):e];return u===`name`?n.sort((e,t)=>e.name.localeCompare(t.name,`zh`)):n.sort((e,t)=>(t.mtime??0)-(e.mtime??0)),n},[e,s,u]),v=Math.max(1,Math.ceil(_.length/m)),y=Math.min(f,v);return{query:s,setQuery:e=>{l(e),n&&a(`docs.${n}.search`,e),p(1)},sortBy:u,setSortBy:e=>{d(e),n&&r(`docs.${n}.sort`,e),p(1)},page:y,setPage:p,pageSize:m,setPageSize:e=>{h(e),p(1)},filtered:_,totalPages:v,pageFiles:(0,g.useMemo)(()=>_.slice((y-1)*m,y*m),[_,y,m])}}function k({files:e,filtered:t,pageFiles:n,query:r,onQuery:i,sortBy:a,onSortBy:o,page:s,totalPages:c,pageSize:p,onPage:m,onPageSize:h,busy:g=!1,emptyText:x,searchPlaceholder:O,selectAllLabel:k=`全选本页`,renderBadge:A,renderActions:j,onRowDoubleClick:M,selectable:N,selected:P,onToggleRow:F,onSelectPage:I}){let L=N??(()=>!0),R=n.filter(L),z=R.length>0&&R.every(e=>P[e.path]),B=!z&&R.some(e=>P[e.path]),{cls:V,play:H}=f(),U=e=>{H(),i(e)};return(0,y.jsxs)(y.Fragment,{children:[e.length>0?(0,y.jsxs)(`div`,{className:`shrink-0 px-4 py-2 border-b border-stone-100 bg-stone-50/60 flex items-center gap-2 flex-wrap`,children:[(0,y.jsx)(`input`,{type:`search`,value:r,onChange:e=>U(e.target.value),placeholder:O,"aria-label":O,className:`${S} flex-1 min-w-48`}),(0,y.jsx)(u,{compact:!0,options:b,value:a,onChange:e=>{H(),o(e)},ariaLabel:`排序方式`,showCheck:!1,className:`w-34 shrink-0`})]}):null,(0,y.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto p-4`,children:e.length===0?(0,y.jsx)(`p`,{className:D,children:x}):t.length===0?(0,y.jsxs)(`p`,{className:D,children:[`没有匹配「`,r.trim(),`」的文件。`]}):(0,y.jsxs)(`ul`,{className:`${V}divide-y divide-stone-100 border border-stone-200 rounded-lg overflow-hidden`,children:[(0,y.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2 bg-stone-50 text-xs text-stone-500`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:z,ref:e=>{e&&(e.indeterminate=B)},onChange:()=>I(R.map(e=>e.path),!z),disabled:g||R.length===0,className:`rounded border-stone-300`,"aria-label":k}),(0,y.jsx)(`span`,{className:`flex-1 min-w-0`,children:`文件名`}),(0,y.jsx)(`span`,{className:w,children:`创建时间`}),(0,y.jsx)(`span`,{className:w,children:`修改时间`}),(0,y.jsx)(`span`,{className:T,children:`大小`}),(0,y.jsx)(`span`,{className:E,children:`操作`})]}),n.map(e=>{let t=L(e);return(0,y.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2.5 ${C}`,onDoubleClick:M?()=>M(e):void 0,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:!!P[e.path],disabled:g||!t,onChange:()=>F(e.path),onDoubleClick:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),className:`rounded border-stone-300`,"aria-label":`选择 ${e.name}`}),(0,y.jsxs)(`div`,{className:`flex-1 min-w-0 text-left flex items-center gap-2`,children:[(0,y.jsx)(d,{text:e.name,className:`text-sm text-stone-800 truncate`}),A?A(e):null]}),(0,y.jsx)(`span`,{className:`${w} text-[11px] text-stone-500 tabular-nums`,children:v(e.ctime??e.mtime)}),(0,y.jsx)(`span`,{className:`${w} text-[11px] text-stone-500 tabular-nums`,children:v(e.mtime)}),(0,y.jsx)(`span`,{className:`${T} text-[11px] text-stone-400`,children:_(e.size)}),(0,y.jsx)(`div`,{className:`${E} flex justify-end gap-1 flex-wrap`,onDoubleClick:e=>e.stopPropagation(),children:j(e)})]},e.path)})]})}),e.length>0?(0,y.jsx)(l,{page:s,totalPages:c,pageSize:p,busy:g,onPage:e=>{H(),m(e)},onPageSize:e=>{H(),h(e)}}):null]})}export{h as i,O as n,m as r,k as t};
@@ -1 +1 @@
1
- import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{p as n}from"./app-config.DKMxjv3g.js";import{t as r}from"./jsx-runtime.BUXbF_vF.js";import{t as i}from"./SelectDropdown.Buv7rQJ_.js";var a=e(t(),1),o=[5,10,20,50],s=`tw.docs.page-size.v1`;function c(e){return typeof e==`number`&&o.includes(e)}function l(e,t=s){try{let r=localStorage.getItem(n(t)),i=r===null?NaN:Number(r);return c(i)?i:e}catch{return e}}function u(e,t=s){if(c(e))try{localStorage.setItem(n(t),String(e))}catch{}}var d=r(),f=`h-8 px-3 shrink-0 whitespace-nowrap text-sm text-stone-600 border border-stone-200 rounded-lg hover:bg-stone-50 disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer`,p=o.map(e=>({value:String(e),label:String(e)}));function m(e,t){let[n,r]=(0,a.useState)(()=>l(e,t));return[n,(0,a.useCallback)(e=>{c(e)&&(u(e,t),r(e))},[t])]}function h({page:e,totalPages:t,pageSize:n,busy:r=!1,onPage:a,onPageSize:o}){return(0,d.jsxs)(`div`,{className:`shrink-0 px-4 py-3 border-t border-stone-100 flex items-center justify-between gap-2 flex-wrap`,children:[(0,d.jsxs)(`span`,{className:`text-xs text-stone-500 flex items-center gap-1.5`,children:[(0,d.jsxs)(`span`,{children:[`第 `,e,` / `,t,` 页 ·`]}),(0,d.jsx)(i,{compact:!0,centerContent:!0,options:p,value:String(n),onChange:e=>o(Number(e)),disabled:r,ariaLabel:`每页条数`,showCheck:!1,className:`w-18`}),(0,d.jsx)(`span`,{children:`条`})]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,d.jsx)(`button`,{type:`button`,disabled:r||e<=1,onClick:()=>a(1),className:f,children:`首页`}),(0,d.jsx)(`button`,{type:`button`,disabled:r||e<=1,onClick:()=>a(e-1),className:f,children:`上一页`}),(0,d.jsx)(`button`,{type:`button`,disabled:r||e>=t,onClick:()=>a(e+1),className:f,children:`下一页`}),(0,d.jsx)(`button`,{type:`button`,disabled:r||e>=t,onClick:()=>a(t),className:f,children:`末页`})]})]})}export{m as n,h as t};
1
+ import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{p as n}from"./app-config.DUyozIL9.js";import{t as r}from"./jsx-runtime.BUXbF_vF.js";import{t as i}from"./SelectDropdown.Buv7rQJ_.js";var a=e(t(),1),o=[5,10,20,50],s=`tw.docs.page-size.v1`;function c(e){return typeof e==`number`&&o.includes(e)}function l(e,t=s){try{let r=localStorage.getItem(n(t)),i=r===null?NaN:Number(r);return c(i)?i:e}catch{return e}}function u(e,t=s){if(c(e))try{localStorage.setItem(n(t),String(e))}catch{}}var d=r(),f=`h-8 px-3 shrink-0 whitespace-nowrap text-sm text-stone-600 border border-stone-200 rounded-lg hover:bg-stone-50 disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer`,p=o.map(e=>({value:String(e),label:String(e)}));function m(e,t){let[n,r]=(0,a.useState)(()=>l(e,t));return[n,(0,a.useCallback)(e=>{c(e)&&(u(e,t),r(e))},[t])]}function h({page:e,totalPages:t,pageSize:n,busy:r=!1,onPage:a,onPageSize:o}){return(0,d.jsxs)(`div`,{className:`shrink-0 px-4 py-3 border-t border-stone-100 flex items-center justify-between gap-2 flex-wrap`,children:[(0,d.jsxs)(`span`,{className:`text-xs text-stone-500 flex items-center gap-1.5`,children:[(0,d.jsxs)(`span`,{children:[`第 `,e,` / `,t,` 页 ·`]}),(0,d.jsx)(i,{compact:!0,centerContent:!0,options:p,value:String(n),onChange:e=>o(Number(e)),disabled:r,ariaLabel:`每页条数`,showCheck:!1,className:`w-18`}),(0,d.jsx)(`span`,{children:`条`})]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,d.jsx)(`button`,{type:`button`,disabled:r||e<=1,onClick:()=>a(1),className:f,children:`首页`}),(0,d.jsx)(`button`,{type:`button`,disabled:r||e<=1,onClick:()=>a(e-1),className:f,children:`上一页`}),(0,d.jsx)(`button`,{type:`button`,disabled:r||e>=t,onClick:()=>a(e+1),className:f,children:`下一页`}),(0,d.jsx)(`button`,{type:`button`,disabled:r||e>=t,onClick:()=>a(t),className:f,children:`末页`})]})]})}export{m as n,h as t};
@@ -1 +1 @@
1
- import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{i as n}from"./app-config.DKMxjv3g.js";import{a as r,o as i,r as a}from"./plugins.D5ypJIXn.js";import{t as o}from"./jsx-runtime.BUXbF_vF.js";import{t as s}from"./ConfirmDialog.CBVsDJ8f.js";import{l as c,n as l,r as u,s as d}from"./project-docs.Cd2gKPKh.js";import{n as f}from"./doc-roots.DAJP9Svr.js";import{i as p,n as m,r as h,t as g}from"./DocsFileBrowser.D3cKurQE.js";import{t as _,u as v}from"./open-docs-in-session.B0ZdZNj2.js";var y=e(t(),1),b=o(),x=10;async function S(e=`.`){let{entries:t}=await d(`knowledge`,e),n=[];for(let e of t)e.type===`file`?e.name.endsWith(`.md`)&&n.push(e):n.push(...await S(e.path));return n}function C({staticCount:e=0,base:t}){let o=h(`knowledge`),[d,C]=(0,y.useState)(!1),[w,T]=(0,y.useState)(!0),[E,D]=(0,y.useState)(o?!0:null),[O,k]=(0,y.useState)(()=>o??[]),[A,j]=(0,y.useState)(null),[M,N]=(0,y.useState)(!1),[P,F]=(0,y.useState)({}),[I,L]=(0,y.useState)(null),R=m(O,x,`knowledge`),z=(0,y.useCallback)(async()=>{j(null);try{let e=await S(`.`);k(e),p(`knowledge`,e)}catch(e){j(e instanceof Error?e.message:String(e))}},[]);(0,y.useEffect)(()=>{let e=r(e=>T(!!e.knowledgeLib));return n().then(()=>{T(a(`knowledgeLib`)),C(!0)}),e},[]),(0,y.useEffect)(()=>{d&&w&&(async()=>{await u(`knowledge`)?(await v().catch(()=>null),await z(),D(!0)):D(!1)})()},[d,w,z]);let B=(0,y.useMemo)(()=>Object.keys(P).filter(e=>P[e]),[P]);function V(){a(`knowledgeGen`)?window.location.href=`${t}?plugin=knowledgeGen`:j(i(`knowledgeGen`))}async function H(e){N(!0),j(null);try{await c(`knowledge`,e.path)}catch(e){j(e instanceof Error?e.message:String(e))}finally{N(!1)}}async function U(e){N(!0),j(null);try{await _(`knowledge`,e)}catch(e){j(e instanceof Error?e.message:String(e)),N(!1)}}async function W(){let e=I;if(e){L(null),N(!0),j(null);try{if(e.kind===`one`)await l(`knowledge`,e.entry.path);else{for(let t of e.paths)await l(`knowledge`,t);F({})}await z()}catch(e){j(e instanceof Error?e.message:String(e))}finally{N(!1)}}}let G=I?.kind===`one`?`删除「${I.entry.name}」?将从 ${f(`knowledge`)} 中移除。`:I?.kind===`batch`?`确认删除已选中的 ${I.paths.length} 个知识库文件?此操作不可恢复。`:``;return d?w?E===null?(0,b.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,"aria-busy":`true`,"aria-label":`正在连接本地文档服务`,children:(0,b.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,b.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):E?(0,b.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,children:[(0,b.jsxs)(`div`,{className:`shrink-0 px-4 py-3 border-b border-stone-100 flex items-center gap-2 flex-wrap`,children:[(0,b.jsxs)(`div`,{className:`text-sm text-stone-600 flex-1 min-w-0`,children:[R.query.trim()?(0,b.jsxs)(b.Fragment,{children:[`匹配 `,(0,b.jsx)(`span`,{className:`font-medium text-stone-800`,children:R.filtered.length}),` 个`,(0,b.jsxs)(`span`,{className:`text-stone-400`,children:[` · 共 `,O.length]})]}):(0,b.jsxs)(b.Fragment,{children:[`共 `,(0,b.jsx)(`span`,{className:`font-medium text-stone-800`,children:O.length}),` 个知识库文件`]}),B.length>0?(0,b.jsxs)(`span`,{className:`text-stone-400`,children:[` · 已选 `,B.length]}):null]}),(0,b.jsx)(`button`,{type:`button`,disabled:M||B.length===0,onClick:()=>L({kind:`batch`,paths:B}),className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-red-600 border border-red-200 rounded-lg hover:bg-red-50 disabled:opacity-40`,children:`批量删除`}),(0,b.jsx)(`button`,{type:`button`,disabled:M,onClick:V,className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40`,children:`生成知识库`})]}),A?(0,b.jsx)(`div`,{className:`shrink-0 mx-4 mt-3 px-3 py-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg`,children:A}):null,(0,b.jsx)(g,{files:O,filtered:R.filtered,pageFiles:R.pageFiles,query:R.query,onQuery:R.setQuery,sortBy:R.sortBy,onSortBy:R.setSortBy,page:R.page,totalPages:R.totalPages,pageSize:R.pageSize,onPage:R.setPage,onPageSize:R.setPageSize,busy:M,emptyText:`暂无知识库文件,点击「生成知识库」前往我的工作台。`,searchPlaceholder:`搜索文件名或路径…`,selected:P,onToggleRow:e=>F(t=>({...t,[e]:!t[e]})),onSelectPage:(e,t)=>F(n=>{let r={...n};for(let n of e)t?r[n]=!0:delete r[n];return r}),onRowDoubleClick:e=>void H(e),renderBadge:e=>{let t=e.path.includes(`/`)?e.path.split(`/`)[0]:``;return t?(0,b.jsx)(`span`,{className:`shrink-0 text-[10px] px-1.5 py-0.5 rounded bg-amber-50 text-amber-800 border border-amber-100`,children:t}):null},renderActions:e=>(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`button`,{type:`button`,disabled:M,onClick:()=>void U(e),className:`text-xs whitespace-nowrap text-white bg-[#4176e6] px-2 py-1 rounded hover:bg-[#3565c7] cursor-pointer disabled:opacity-40`,children:`在会话中打开`}),(0,b.jsx)(`button`,{type:`button`,disabled:M,onClick:()=>L({kind:`one`,entry:e}),className:`text-xs whitespace-nowrap text-red-600 hover:bg-red-50 px-2 py-1 rounded cursor-pointer disabled:opacity-40`,children:`删除`})]})}),(0,b.jsx)(s,{open:I!=null,title:I?.kind===`batch`?`批量删除`:`删除知识库文件`,message:G,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>L(null),onConfirm:()=>void W()})]}):(0,b.jsxs)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:[`知识库管理需要本地文档服务,当前未就绪`,e>0?`(构建期约有 ${e} 份文档可浏览)`:``,`。`]}):(0,b.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:i(`knowledgeLib`)}):(0,b.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,b.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,b.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})})}export{C as default};
1
+ import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{i as n}from"./app-config.DUyozIL9.js";import{a as r,o as i,r as a}from"./plugins.BDZqJNOy.js";import{t as o}from"./jsx-runtime.BUXbF_vF.js";import{t as s}from"./ConfirmDialog.CBVsDJ8f.js";import{l as c,n as l,r as u,s as d}from"./project-docs.Cd2gKPKh.js";import{n as f}from"./doc-roots.DAJP9Svr.js";import{i as p,n as m,r as h,t as g}from"./DocsFileBrowser.BtRoZ787.js";import{t as _,u as v}from"./open-docs-in-session.Xg3OSOfc.js";var y=e(t(),1),b=o(),x=10;async function S(e=`.`){let{entries:t}=await d(`knowledge`,e),n=[];for(let e of t)e.type===`file`?e.name.endsWith(`.md`)&&n.push(e):n.push(...await S(e.path));return n}function C({staticCount:e=0,base:t}){let o=h(`knowledge`),[d,C]=(0,y.useState)(!1),[w,T]=(0,y.useState)(!0),[E,D]=(0,y.useState)(o?!0:null),[O,k]=(0,y.useState)(()=>o??[]),[A,j]=(0,y.useState)(null),[M,N]=(0,y.useState)(!1),[P,F]=(0,y.useState)({}),[I,L]=(0,y.useState)(null),R=m(O,x,`knowledge`),z=(0,y.useCallback)(async()=>{j(null);try{let e=await S(`.`);k(e),p(`knowledge`,e)}catch(e){j(e instanceof Error?e.message:String(e))}},[]);(0,y.useEffect)(()=>{let e=r(e=>T(!!e.knowledgeLib));return n().then(()=>{T(a(`knowledgeLib`)),C(!0)}),e},[]),(0,y.useEffect)(()=>{d&&w&&(async()=>{await u(`knowledge`)?(await v().catch(()=>null),await z(),D(!0)):D(!1)})()},[d,w,z]);let B=(0,y.useMemo)(()=>Object.keys(P).filter(e=>P[e]),[P]);function V(){a(`knowledgeGen`)?window.location.href=`${t}?plugin=knowledgeGen`:j(i(`knowledgeGen`))}async function H(e){N(!0),j(null);try{await c(`knowledge`,e.path)}catch(e){j(e instanceof Error?e.message:String(e))}finally{N(!1)}}async function U(e){N(!0),j(null);try{await _(`knowledge`,e)}catch(e){j(e instanceof Error?e.message:String(e)),N(!1)}}async function W(){let e=I;if(e){L(null),N(!0),j(null);try{if(e.kind===`one`)await l(`knowledge`,e.entry.path);else{for(let t of e.paths)await l(`knowledge`,t);F({})}await z()}catch(e){j(e instanceof Error?e.message:String(e))}finally{N(!1)}}}let G=I?.kind===`one`?`删除「${I.entry.name}」?将从 ${f(`knowledge`)} 中移除。`:I?.kind===`batch`?`确认删除已选中的 ${I.paths.length} 个知识库文件?此操作不可恢复。`:``;return d?w?E===null?(0,b.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,"aria-busy":`true`,"aria-label":`正在连接本地文档服务`,children:(0,b.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,b.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):E?(0,b.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,children:[(0,b.jsxs)(`div`,{className:`shrink-0 px-4 py-3 border-b border-stone-100 flex items-center gap-2 flex-wrap`,children:[(0,b.jsxs)(`div`,{className:`text-sm text-stone-600 flex-1 min-w-0`,children:[R.query.trim()?(0,b.jsxs)(b.Fragment,{children:[`匹配 `,(0,b.jsx)(`span`,{className:`font-medium text-stone-800`,children:R.filtered.length}),` 个`,(0,b.jsxs)(`span`,{className:`text-stone-400`,children:[` · 共 `,O.length]})]}):(0,b.jsxs)(b.Fragment,{children:[`共 `,(0,b.jsx)(`span`,{className:`font-medium text-stone-800`,children:O.length}),` 个知识库文件`]}),B.length>0?(0,b.jsxs)(`span`,{className:`text-stone-400`,children:[` · 已选 `,B.length]}):null]}),(0,b.jsx)(`button`,{type:`button`,disabled:M||B.length===0,onClick:()=>L({kind:`batch`,paths:B}),className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-red-600 border border-red-200 rounded-lg hover:bg-red-50 disabled:opacity-40`,children:`批量删除`}),(0,b.jsx)(`button`,{type:`button`,disabled:M,onClick:V,className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40`,children:`生成知识库`})]}),A?(0,b.jsx)(`div`,{className:`shrink-0 mx-4 mt-3 px-3 py-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg`,children:A}):null,(0,b.jsx)(g,{files:O,filtered:R.filtered,pageFiles:R.pageFiles,query:R.query,onQuery:R.setQuery,sortBy:R.sortBy,onSortBy:R.setSortBy,page:R.page,totalPages:R.totalPages,pageSize:R.pageSize,onPage:R.setPage,onPageSize:R.setPageSize,busy:M,emptyText:`暂无知识库文件,点击「生成知识库」前往我的工作台。`,searchPlaceholder:`搜索文件名或路径…`,selected:P,onToggleRow:e=>F(t=>({...t,[e]:!t[e]})),onSelectPage:(e,t)=>F(n=>{let r={...n};for(let n of e)t?r[n]=!0:delete r[n];return r}),onRowDoubleClick:e=>void H(e),renderBadge:e=>{let t=e.path.includes(`/`)?e.path.split(`/`)[0]:``;return t?(0,b.jsx)(`span`,{className:`shrink-0 text-[10px] px-1.5 py-0.5 rounded bg-amber-50 text-amber-800 border border-amber-100`,children:t}):null},renderActions:e=>(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`button`,{type:`button`,disabled:M,onClick:()=>void U(e),className:`text-xs whitespace-nowrap text-white bg-[#4176e6] px-2 py-1 rounded hover:bg-[#3565c7] cursor-pointer disabled:opacity-40`,children:`在会话中打开`}),(0,b.jsx)(`button`,{type:`button`,disabled:M,onClick:()=>L({kind:`one`,entry:e}),className:`text-xs whitespace-nowrap text-red-600 hover:bg-red-50 px-2 py-1 rounded cursor-pointer disabled:opacity-40`,children:`删除`})]})}),(0,b.jsx)(s,{open:I!=null,title:I?.kind===`batch`?`批量删除`:`删除知识库文件`,message:G,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>L(null),onConfirm:()=>void W()})]}):(0,b.jsxs)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:[`知识库管理需要本地文档服务,当前未就绪`,e>0?`(构建期约有 ${e} 份文档可浏览)`:``,`。`]}):(0,b.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:i(`knowledgeLib`)}):(0,b.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,b.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,b.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})})}export{C as default};
@@ -1 +1 @@
1
- import{c as e,n as t,t as n}from"./react-dom.CqAxpHMt.js";import{A as r,C as i,D as a,F as o,I as s,L as c,M as l,N as u,O as d,P as f,R as p,S as m,T as h,_ as g,a as _,b as v,g as y,h as b,i as x,j as S,k as C,m as w,p as T,r as E,t as D,u as O,v as ee,w as te,x as k,y as A}from"./app-config.DKMxjv3g.js";import{a as ne,i as re,r as j}from"./plugins.D5ypJIXn.js";import{i as M,n as N,r as P,t as F}from"./dialog.DXHznyjD.js";import{t as I}from"./jsx-runtime.BUXbF_vF.js";import{t as ie}from"./ConfirmDialog.CBVsDJ8f.js";import{n as L}from"./i18n.BXeGGutk.js";var R=e(t(),1),z=e(n(),1),B=`/__tb_nav/groups`;function ae(){return E().navGroups}function oe(){return d(E().navIcons)}function se(e,t){let n={...oe(),[e]:t};return O({navIcons:n}),D(),n}function ce(){return E().navOrder}function le(e,t){let n=a(e),r=C(t,n);return O({navGroups:n,navOrder:r}),D(),{groups:n,order:r}}function V(e,t){return JSON.stringify(e)===JSON.stringify(t)}async function ue(e){if(!_())return null;try{let t=await fetch(B,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({groups:e}),signal:AbortSignal.timeout(4e3)});if(!t.ok)return null;let n=await t.json();return a(n.groups,!1)}catch{return null}}async function de(){if(!_())return;let e=E(),t=null;try{let e=await fetch(B,{signal:AbortSignal.timeout(4e3)});e.ok&&(t=await e.json())}catch{return}if(!t)return;if(t.scanned){let n=a(t.groups,!1),r=C(e.navOrder,n);(!V(n,e.navGroups)||!V(r,e.navOrder))&&(O({navGroups:n,navOrder:r}),D());return}if(!e.navGroups.length)return;let n=await ue(e.navGroups);n&&!V(n,e.navGroups)&&(O({navGroups:n,navOrder:C(e.navOrder,n)}),D())}function H(e,t,n){let[r,i]=(0,R.useState)(null),a=(0,R.useRef)(null),o=(0,R.useRef)(e);o.current=e;let s=(0,R.useRef)(t);s.current=t;let l=(0,R.useRef)(n);l.current=n;function u(e,t){if(t.button!==0)return;t.preventDefault(),t.stopPropagation();let n=a.current;if(!n)return;i(e);let r=e=>{let t=[...n.querySelectorAll(`[data-sort-key]`)];for(let n of t){let t=n.getBoundingClientRect();if(e>=t.top&&e<=t.bottom)return n.dataset.sortKey}return null},u=t=>{let n=r(t.clientY);if(!n||n===e)return;let i=c(o.current,e,n);i.join(`|`)!==o.current.join(`|`)&&(o.current=i,s.current(i))},d=()=>{window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d),window.removeEventListener(`pointercancel`,d),i(null),l.current?.()};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d),window.addEventListener(`pointercancel`,d)}return{listRef:a,dragId:r,onPointerDown:u}}var U=I(),W=`/`;function G(e){return`${W.endsWith(`/`)?W:`${W}/`}${e.replace(/^\//,``)}`}function K(e,t){let n=W.replace(/\/$/,``),r=e.slice(n.length).replace(/^\/+/,``);return r===t||r.startsWith(`${t}/`)}function q(e){return[`tw-nav-item`,e?`is-active font-medium`:``].filter(Boolean).join(` `)}function fe(e){return T(`tw.nav.groupOpen.${e}`)}function pe(){return T(`tw.nav.docsOpen`)}function me(e,t){try{let t=localStorage.getItem(fe(e));if(t===`1`)return!0;if(t===`0`)return!1;if(e===`docs`){let e=localStorage.getItem(pe());if(e===`1`)return!0;if(e===`0`)return!1}}catch{}return t}function J(e,t){try{localStorage.setItem(fe(e),t?`1`:`0`),e===`docs`&&localStorage.setItem(pe(),t?`1`:`0`)}catch{}}function Y(e){return e.id===`docs`&&(e.name===`文档库`||e.name===`Documents`)?L(`nav.docs`):e.name}function he(e){return e.type===`group`?Y(e.group):L(v(e.id).i18n)}function X(e){return e.type===`item`?te(e.id):k(e.group.id)}function ge(){let[e,t]=(0,R.useState)(()=>window.location.pathname);return(0,R.useEffect)(()=>{let e=()=>t(window.location.pathname);return document.addEventListener(`astro:page-load`,e),document.addEventListener(`astro:after-swap`,e),window.addEventListener(`popstate`,e),()=>{document.removeEventListener(`astro:page-load`,e),document.removeEventListener(`astro:after-swap`,e),window.removeEventListener(`popstate`,e)}},[]),e}function Z({children:e}){return(0,U.jsx)(`svg`,{className:`tw-nav-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:e})}function Q({id:e,icon:t}){return(0,U.jsx)(Z,{children:_e[t??w[e]]})}var _e={dashboard:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`7`,rx:`1.5`}),(0,U.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`7`,rx:`1.5`}),(0,U.jsx)(`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1.5`}),(0,U.jsx)(`rect`,{x:`14`,y:`14`,width:`7`,height:`7`,rx:`1.5`})]}),check:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M9 11l3 3L22 4`}),(0,U.jsx)(`path`,{d:`M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11`})]}),pencil:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M12 20h9`}),(0,U.jsx)(`path`,{d:`M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z`})]}),book:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M4 19.5A2.5 2.5 0 0 1 6.5 17H20`}),(0,U.jsx)(`path`,{d:`M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z`})]}),fileText:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M14 3v5h5`}),(0,U.jsx)(`path`,{d:`M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z`}),(0,U.jsx)(`path`,{d:`M8 13h8`}),(0,U.jsx)(`path`,{d:`M8 17h6`})]}),layers:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M12 3 3 8l9 5 9-5-9-5z`}),(0,U.jsx)(`path`,{d:`m3 13 9 5 9-5`})]}),list:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M8 6h13`}),(0,U.jsx)(`path`,{d:`M8 12h13`}),(0,U.jsx)(`path`,{d:`M8 18h13`}),(0,U.jsx)(`path`,{d:`M3 6h.01`}),(0,U.jsx)(`path`,{d:`M3 12h.01`}),(0,U.jsx)(`path`,{d:`M3 18h.01`})]}),folder:(0,U.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z`}),star:(0,U.jsx)(`path`,{d:`m12 3 2.1 5.9L20 11l-5 4.3 1.7 6.2-5.7-3.9-5.7 3.9L7 15.3 2 11l5.9-2.1L12 3z`}),database:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`ellipse`,{cx:`12`,cy:`6`,rx:`8`,ry:`3`}),(0,U.jsx)(`path`,{d:`M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6`}),(0,U.jsx)(`path`,{d:`M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6`})]}),target:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8`}),(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1`})]}),code:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`m8 8-4 4 4 4`}),(0,U.jsx)(`path`,{d:`m16 8 4 4-4 4`})]}),flask:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M9 3h6`}),(0,U.jsx)(`path`,{d:`M10 3v6l-5 8a2 2 0 0 0 1.7 3h10.6a2 2 0 0 0 1.7-3l-5-8V3`}),(0,U.jsx)(`path`,{d:`M7.5 14h9`})]}),home:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M3 10.5 12 3l9 7.5`}),(0,U.jsx)(`path`,{d:`M5 9.5V20h14V9.5`})]}),clipboard:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M9 4h6v3H9z`}),(0,U.jsx)(`path`,{d:`M8 4H6a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-2`})]}),bug:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`14`,r:`5`}),(0,U.jsx)(`path`,{d:`M9 6l2 2`}),(0,U.jsx)(`path`,{d:`M15 6l-2 2`}),(0,U.jsx)(`path`,{d:`M7 11H4`}),(0,U.jsx)(`path`,{d:`M20 11h-3`}),(0,U.jsx)(`path`,{d:`M7 17H4`}),(0,U.jsx)(`path`,{d:`M20 17h-3`})]}),calendar:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`3`,y:`5`,width:`18`,height:`16`,rx:`2`}),(0,U.jsx)(`path`,{d:`M8 3v4`}),(0,U.jsx)(`path`,{d:`M16 3v4`}),(0,U.jsx)(`path`,{d:`M3 10h18`})]}),chart:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M4 20V10`}),(0,U.jsx)(`path`,{d:`M10 20V4`}),(0,U.jsx)(`path`,{d:`M16 20v-7`}),(0,U.jsx)(`path`,{d:`M2 20h20`})]}),globe:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,U.jsx)(`path`,{d:`M3 12h18`}),(0,U.jsx)(`path`,{d:`M12 3c2.5 2.5 4 5.7 4 9s-1.5 6.5-4 9c-2.5-2.5-4-5.7-4-9s1.5-6.5 4-9z`})]}),link:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M10 13a4 4 0 0 0 5.7 0l2.3-2.3a4 4 0 0 0-5.7-5.7L11 6.3`}),(0,U.jsx)(`path`,{d:`M14 11a4 4 0 0 0-5.7 0L6 13.3a4 4 0 0 0 5.7 5.7L13 17.7`})]}),users:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`9`,cy:`8`,r:`3.5`}),(0,U.jsx)(`path`,{d:`M2.5 20a6.5 6.5 0 0 1 13 0`}),(0,U.jsx)(`path`,{d:`M16 5.5a3.5 3.5 0 0 1 0 7`}),(0,U.jsx)(`path`,{d:`M18 20a6 6 0 0 0-2-4.5`})]}),terminal:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`m5 8 4 4-4 4`}),(0,U.jsx)(`path`,{d:`M13 16h6`})]}),tag:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M20.6 13.4 13.4 20.6a2 2 0 0 1-2.8 0l-7.2-7.2a2 2 0 0 1-.6-1.4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 1.4.6l6.2 6.2a2 2 0 0 1 0 2.6z`}),(0,U.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.2`})]}),flag:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M5 21V4`}),(0,U.jsx)(`path`,{d:`M5 5h11l-2 4 2 4H5z`})]}),zap:(0,U.jsx)(`path`,{d:`M13 2 4 14h6l-1 8 9-12h-6l1-8z`})};function ve(){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`svg`,{className:`tw-nav-ico tw-nav-ico--closed`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,U.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z`})}),(0,U.jsx)(`svg`,{className:`tw-nav-ico tw-nav-ico--open`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,U.jsx)(`path`,{d:`M6 14l1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`})})]})}function ye(){return(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:[(0,U.jsx)(`path`,{d:`M21 4H14`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M10 4H3`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M21 12H12`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M8 12H3`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M21 20H16`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M12 20H3`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M14 2v4`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M8 10v4`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M16 18v4`,strokeLinecap:`round`})]})}function be(){return(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,U.jsx)(`path`,{d:`M12 8v8`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M8 12h8`,strokeLinecap:`round`})]})}function xe(){return(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":!0,children:[(0,U.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1.7`}),(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.7`}),(0,U.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1.7`})]})}function Se(){return(0,U.jsx)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,U.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z`})})}function Ce(){return(0,U.jsxs)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,U.jsx)(`path`,{d:`M9 6H5a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h4`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M16 8l4 4-4 4`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,U.jsx)(`path`,{d:`M20 12H9`,strokeLinecap:`round`})]})}function we(){return(0,U.jsxs)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,U.jsx)(`circle`,{cx:`8.5`,cy:`8.5`,r:`4.5`}),(0,U.jsx)(`rect`,{x:`12`,y:`12`,width:`9`,height:`9`,rx:`2`})]})}function Te(){return(0,U.jsxs)(Z,{children:[(0,U.jsx)(`path`,{d:`M8 6v12`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M5 9l3-3 3 3`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,U.jsx)(`path`,{d:`M16 18V6`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M13 15l3 3 3-3`,strokeLinecap:`round`,strokeLinejoin:`round`})]})}function Ee(){return(0,U.jsxs)(`svg`,{className:`tw-nav-drag-grip`,viewBox:`0 0 20 20`,"aria-hidden":!0,children:[(0,U.jsx)(`circle`,{cx:`7`,cy:`5`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`13`,cy:`5`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`7`,cy:`10`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`13`,cy:`10`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`7`,cy:`15`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`13`,cy:`15`,r:`1.25`,fill:`currentColor`})]})}function $(e,t){if(i(e))return!1;let n=v(e).plugin;return!n||t[n]!==!1}function De({id:e,icon:t,pathname:n,actionOpen:r,onMenu:i}){let a=v(e),o=K(n,a.match);return(0,U.jsxs)(`div`,{className:[q(o),r?`is-action-open`:``].filter(Boolean).join(` `),"data-plugin-nav":a.plugin,children:[(0,U.jsxs)(`a`,{href:G(a.href),className:`tw-nav-item-main`,children:[(0,U.jsx)(Q,{id:e,icon:t}),(0,U.jsx)(`span`,{className:`tw-nav-label`,children:L(a.i18n)})]}),(0,U.jsx)(`button`,{type:`button`,className:`tw-nav-hover-btn`,"aria-label":L(`nav.more`),onClick:e=>{e.preventDefault(),e.stopPropagation(),i(e.currentTarget)},children:(0,U.jsx)(xe,{})})]})}function Oe(e,t,n){return e.items.some(e=>{if(i(e))return!1;let t=v(e).plugin;return(!t||j(t))&&K(n,v(e).match)})?!0:h(t,e.id).some(e=>Oe(e,t,n))}function ke(e,t){return e.items.some(e=>{if(i(e))return!1;let t=v(e).plugin;return!t||j(t)})?!0:h(t,e.id).some(e=>ke(e,t))}function Ae({group:e,groups:t,order:n,icons:r,pathname:a,openItem:o,openGroupId:s,onMenu:c,onItemMenu:l}){let u=e.items.filter(e=>{if(i(e))return!1;let t=v(e).plugin;return!t||j(t)}),d=f(t,e.id,n),p=Oe(e,t,a),[m,h]=(0,R.useState)(()=>me(e.id,!0)),[g,_]=(0,R.useState)(!1),y=(0,R.useRef)(null),b=(0,R.useRef)(null),x=(0,R.useRef)(null);if((0,R.useEffect)(()=>S,[]),!ke(e,t))return null;function S(){x.current&&y.current&&y.current.removeEventListener(`transitionend`,x.current),x.current=null,b.current!==null&&(window.clearTimeout(b.current),b.current=null)}function C(){S(),J(e.id,!0),_(!1),h(!0)}function w(t){if(t.preventDefault(),!m||g){C();return}_(!0),J(e.id,!1);let n=y.current,r=!1,i=()=>{r||(r=!0,S(),h(!1),_(!1))},a=e=>{e.target===n&&e.propertyName===`grid-template-rows`&&i()};S(),x.current=a,n?.addEventListener(`transitionend`,a),b.current=window.setTimeout(i,360)}return(0,U.jsxs)(`details`,{className:`tw-nav-details ${g?`is-closing`:``}`,open:m||g,"data-nav-group":e.id,children:[(0,U.jsxs)(`summary`,{className:[`tw-nav-item tw-nav-summary`,p?`is-branch-active`:``,s===e.id?`is-action-open`:``].filter(Boolean).join(` `),onClick:w,children:[(0,U.jsx)(ve,{}),(0,U.jsx)(`span`,{className:`tw-nav-label min-w-0 flex-1 truncate`,children:Y(e)}),(0,U.jsx)(`button`,{type:`button`,className:`tw-nav-hover-btn`,"aria-label":L(`nav.groupActions`),onClick:t=>{t.preventDefault(),t.stopPropagation(),c(e,t.currentTarget)},children:(0,U.jsx)(ye,{})}),(0,U.jsx)(`svg`,{className:`tw-nav-chevron opacity-70`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,U.jsx)(`path`,{d:`M7 5l6 5-6 5`,strokeLinecap:`round`,strokeLinejoin:`round`})})]}),(0,U.jsx)(`div`,{className:`tw-nav-subtree-anim`,ref:y,children:(0,U.jsxs)(`div`,{className:`tw-nav-subtree`,children:[u.map(e=>(0,U.jsx)(De,{id:e,icon:r[e],pathname:a,actionOpen:o===e,onMenu:t=>l(e,t)},e)),d.map(e=>(0,U.jsx)(Ae,{group:e,groups:t,order:n,icons:r,pathname:a,openItem:o,openGroupId:s,onMenu:c,onItemMenu:l},e.id))]})})]})}function je({open:e,draft:t,groups:n,plugins:r,icons:i,onClose:a,onSave:o,onDelete:s}){let[c,l]=(0,R.useState)(``),[u,d]=(0,R.useState)([]),[f,p]=(0,R.useState)(``),m=(0,R.useRef)(null),h=new Set(n.filter(e=>e.id!==t?.id).flatMap(e=>e.items)),g=b.filter(e=>$(e.id,r)&&(!h.has(e.id)||u.includes(e.id))),_=H(u,d);(0,R.useEffect)(()=>{if(!e||!t)return;l(t.name),d(t.items.filter(e=>$(e,r))),p(``);let n=window.setTimeout(()=>{m.current?.focus(),m.current?.select()},50);return()=>window.clearTimeout(n)},[e,t,r]);function v(e){d(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}function y(){let e=c.trim();if(!e){p(L(`nav.groupNameRequired`));return}if(!u.length){p(L(`nav.groupItemsRequired`));return}let n=(t?.items??[]).filter(e=>!$(e,r));o({id:t?.id,name:e,items:[...n,...u],parentId:t?.parentId})}let x=[...u.map(e=>g.find(t=>t.id===e)).filter(e=>!!e),...g.filter(e=>!u.includes(e.id))];return(0,U.jsxs)(P,{open:e,onClose:a,transition:!0,className:`relative z-110`,children:[(0,U.jsx)(F,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":!0}),(0,U.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,U.jsxs)(M,{transition:!0,className:`tw-confirm-dialog tw-dialog-panel-anim w-full max-w-sm rounded-xl shadow-xl border border-stone-200 p-5 bg-white`,children:[(0,U.jsx)(N,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:t?.id?L(`nav.editGroupTitle`):t?.parentId?L(`nav.addSubgroup`):L(`nav.createGroup`)}),(0,U.jsxs)(`label`,{className:`tw-confirm-msg mt-4 block text-xs font-medium text-stone-500`,children:[L(`nav.groupName`),(0,U.jsx)(`input`,{ref:m,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),y())},className:`mt-1.5 w-full h-9 rounded-lg border border-stone-200 px-3 text-sm text-stone-800 outline-none focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6]`})]}),(0,U.jsxs)(`div`,{className:`mt-4`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium text-stone-500`,children:L(`nav.groupItems`)}),(0,U.jsx)(`p`,{className:`mt-1 text-[11px] text-stone-400`,children:L(`nav.groupItemsHint`)}),(0,U.jsxs)(`div`,{ref:_.listRef,className:`mt-2 max-h-52 overflow-auto rounded-lg border border-stone-200 p-1`,children:[x.map(e=>{let t=u.includes(e.id);return(0,U.jsxs)(`label`,{"data-sort-key":t?e.id:void 0,className:[`flex items-center gap-2 rounded-md px-3 py-2 text-sm text-stone-700 cursor-pointer hover:bg-stone-50`,t?`tw-nav-drag-row`:``,_.dragId===e.id?`is-dragging`:``].filter(Boolean).join(` `),onPointerDown:t?t=>{t.target.closest(`input`)||_.onPointerDown(e.id,t)}:void 0,children:[t?(0,U.jsx)(Ee,{}):(0,U.jsx)(`span`,{className:`tw-nav-drag-grip`}),(0,U.jsx)(`input`,{type:`checkbox`,checked:t,onChange:()=>v(e.id),className:`rounded border-stone-300 text-[#4176e6] focus:ring-[#4176e6]/40`}),(0,U.jsx)(`span`,{className:`tw-nav-editor-ico`,children:(0,U.jsx)(Q,{id:e.id,icon:i[e.id]})}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:L(e.i18n)})]},e.id)}),x.length?null:(0,U.jsx)(`div`,{className:`px-3 py-4 text-center text-[12px] text-stone-400`,children:L(`nav.noAddableItems`)})]})]}),f?(0,U.jsx)(`p`,{className:`mt-2 text-[12px] text-red-600`,children:f}):null,(0,U.jsxs)(`div`,{className:`mt-5 flex items-center gap-2`,children:[t?.id&&s?(0,U.jsx)(`button`,{type:`button`,onClick:s,className:`h-8 px-3 text-sm rounded-lg border border-red-200 text-red-600 hover:bg-red-50`,children:L(`nav.deleteGroup`)}):null,(0,U.jsx)(`div`,{className:`flex-1`}),(0,U.jsx)(`button`,{type:`button`,onClick:a,className:`tw-confirm-cancel h-8 px-3 text-sm rounded-lg border border-stone-200 text-stone-600 hover:bg-stone-100`,children:L(`nav.groupCancel`)}),(0,U.jsx)(`button`,{type:`button`,onClick:y,className:`h-8 px-3 text-sm rounded-lg text-white bg-[#4176e6] hover:bg-[#3566d0]`,children:L(`nav.groupSave`)})]})]})})]})}function Me({ids:e,labelOf:t,onChange:n,onEnd:r,indent:i}){let a=H(e,n,r);return(0,U.jsx)(`div`,{ref:a.listRef,className:`flex flex-col`,children:e.map(e=>(0,U.jsxs)(`div`,{"data-sort-key":e,className:[`tw-nav-drag-row px-3 py-2 text-sm text-stone-700 hover:bg-stone-50`,i?`tw-nav-drag-row--nested`:``,a.dragId===e?`is-dragging`:``].filter(Boolean).join(` `),onPointerDown:t=>a.onPointerDown(e,t),children:[(0,U.jsx)(Ee,{}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t(e)})]},e))})}function Ne({open:e,focusGroupId:t,nodes:n,groups:r,order:i,visible:a,onClose:o,onCommit:s,onChildCommit:c}){let l=e=>!a||a(e),u=e=>e.items.some(l)||r.filter(t=>t.parentId===e.id).some(e=>u(e)),d=n.filter(e=>e.type===`item`?l(e.id):u(e.group)),[p,m]=(0,R.useState)(()=>d.map(X)),[h,g]=(0,R.useState)(()=>Object.fromEntries(r.map(e=>[e.id,[...e.items]]))),[_,y]=(0,R.useState)([]),b=(0,R.useRef)(p);b.current=p;let x=(0,R.useRef)(h);x.current=h;let S=(0,R.useRef)(r);S.current=r;let C=(0,R.useRef)(i);C.current=i;let w=(0,R.useRef)(d);w.current=d;let T=(0,R.useRef)(_);T.current=_;let E=()=>{let e=S.current.map(e=>({...e,items:x.current[e.id]??e.items}));s(b.current,e)},D=()=>{t&&c(t,T.current)};(0,R.useEffect)(()=>{if(!e)return;let n=w.current.map(X);b.current=n,m(n);let r=Object.fromEntries(S.current.map(e=>[e.id,[...e.items]]));x.current=r,g(r);let i=t?f(S.current,t,C.current).map(e=>e.id):[];T.current=i,y(i)},[e,t]);let O=e=>{b.current=e,m(e)},ee=e=>{T.current=e,y(e)},te=(e,t)=>{let n=(x.current[e]??[]).filter(e=>!l(e)),r={...x.current,[e]:t.length?[...t,...n]:n};x.current=r,g(r)},k=new Map(d.map(e=>[X(e),he(e)])),A=t?r.find(e=>e.id===t):void 0,ne=A?(h[A.id]??A.items).filter(l):[],re=A?f(r,A.id,i):[],j=_.length?_:re.map(e=>e.id);return(0,U.jsxs)(P,{open:e,onClose:o,transition:!0,className:`relative z-110`,children:[(0,U.jsx)(F,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":!0}),(0,U.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,U.jsxs)(M,{transition:!0,className:`tw-confirm-dialog tw-dialog-panel-anim w-full max-w-sm rounded-xl shadow-xl border border-stone-200 p-5 bg-white`,children:[(0,U.jsx)(N,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:L(`nav.sortMenuTitle`)}),(0,U.jsx)(`p`,{className:`mt-1 text-[11px] text-stone-400`,children:L(`nav.sortHint`)}),(0,U.jsx)(`div`,{className:`mt-4 max-h-80 overflow-auto rounded-lg border border-stone-200 p-1`,children:A?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Me,{ids:ne,labelOf:e=>L(v(e).i18n),onChange:e=>te(A.id,e),onEnd:E,indent:!0}),j.length?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`mt-1 border-t border-stone-100 px-3 pb-1 pt-2 text-[11px] font-medium text-stone-400`,children:L(`nav.subgroups`)}),(0,U.jsx)(Me,{ids:j,labelOf:e=>{let t=r.find(t=>t.id===e);return t?Y(t):e},onChange:ee,onEnd:D,indent:!0})]}):null]}):(0,U.jsx)(Me,{ids:p,labelOf:e=>k.get(e)??e,onChange:O,onEnd:E})})]})})]})}function Pe(e,t){let n=[];for(let r of e.filter(e=>!e.parentId)){n.push({group:r,indent:!1});for(let i of f(e,r.id,t))n.push({group:i,indent:!0})}return n}function Fe(){return(0,U.jsx)(`svg`,{className:`tw-nav-group-pop-arrow`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,U.jsx)(`path`,{d:`M7 5l5 5-5 5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}var Ie=120;function Le(){let[e,t]=(0,R.useState)(null),n=(0,R.useRef)(null),r=(0,R.useCallback)(()=>{n.current!==null&&(window.clearTimeout(n.current),n.current=null)},[]),i=(0,R.useCallback)(e=>{r(),t({value:e,closing:!1})},[r]),a=(0,R.useCallback)(()=>{r(),t(e=>e&&!e.closing?{...e,closing:!0}:e),n.current=window.setTimeout(()=>{n.current=null,t(null)},Ie)},[r]),o=(0,R.useCallback)(()=>{r(),t(null)},[r]);return(0,R.useEffect)(()=>r,[r]),{value:e?.value??null,closing:!!e?.closing,open:i,close:a,closeNow:o}}function Re(e,t){return{onMouseOver:()=>e?.(),onMouseOut:e=>{let n=e.relatedTarget;n&&e.currentTarget.contains(n)||t?.()}}}function ze({anchor:e,current:t,itemId:n,closing:r,onPick:i,onHoverEnter:a,onHoverLeave:o}){let s=(0,R.useRef)(null),[c,l]=(0,R.useState)({top:e.top,left:e.right+8});return(0,R.useEffect)(()=>{let t=s.current;if(!t)return;let n=t.offsetWidth,r=t.offsetHeight,i=e.right+8,a=e.top-6;i+n>window.innerWidth-8&&(i=Math.max(8,e.left-n-6)),a+r>window.innerHeight-8&&(a=Math.max(8,window.innerHeight-r-8)),a<8&&(a=8),l({top:a,left:i})},[e]),(0,z.createPortal)((0,U.jsxs)(`div`,{ref:s,className:[`tw-nav-group-pop`,`tw-nav-icon-pop`,r?`is-closing`:``].filter(Boolean).join(` `),style:{top:c.top,left:c.left},...Re(a,o),children:[(0,U.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:L(`nav.chooseIcon`)}),(0,U.jsx)(`div`,{className:`tw-nav-icon-grid`,children:y.map(e=>(0,U.jsx)(`button`,{type:`button`,className:[`tw-nav-icon-cell`,t===e?`is-current`:``].filter(Boolean).join(` `),onClick:()=>i(e),children:(0,U.jsx)(Q,{id:n,icon:e})},e))})]}),document.body)}function Be({rect:e,closing:t=!1,onClose:n,onHoverEnter:r,onHoverLeave:i,children:a}){let o=(0,R.useRef)(null),[s,c]=(0,R.useState)({top:e.top,left:e.right+6});return(0,R.useEffect)(()=>{let t=o.current;if(!t)return;let n=t.offsetWidth,r=t.offsetHeight,i=e.right+6,a=e.top;i+n>window.innerWidth-8&&(i=Math.max(8,e.left-n-6)),a+r>window.innerHeight-8&&(a=Math.max(8,window.innerHeight-r-8)),c({top:a,left:i})},[e]),(0,R.useEffect)(()=>{let e=e=>{let t=e.target;o.current?.contains(t)||t?.closest?.(`.tw-nav-icon-pop`)||t?.closest?.(`.tw-nav-hover-btn`)||n()},t=e=>{e.key===`Escape`&&n()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),window.addEventListener(`resize`,n),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t),window.removeEventListener(`resize`,n)}},[n]),(0,z.createPortal)((0,U.jsx)(`div`,{ref:o,className:[`tw-nav-group-pop`,t?`is-closing`:``].filter(Boolean).join(` `),style:{top:s.top,left:s.left},...Re(r,i),children:a}),document.body)}function Ve(){let e=ge(),[t,n]=(0,R.useState)(()=>ae()),[i,a]=(0,R.useState)(()=>oe()),[c,d]=(0,R.useState)(()=>ce()),[f,h]=(0,R.useState)(()=>re()),[_,y]=(0,R.useState)(null),[b,C]=(0,R.useState)(!1),[w,T]=(0,R.useState)(null),[E,D]=(0,R.useState)(!1),[O,te]=(0,R.useState)(null),k=Le(),j=Le(),M=k.value,N=j.value,P=(0,R.useRef)(null);(0,R.useEffect)(()=>()=>{P.current!==null&&window.clearTimeout(P.current)},[]);function F(e){te(e),D(!0)}function I(e){y(e),C(!0)}function z(){C(!1),T(null)}(0,R.useEffect)(()=>{let e=!0,t=ne(e=>{h({...e})});return x().then(async()=>{e&&(await de(),e&&(n(ae()),d(ce()),a(oe()),h(re())))}),()=>{e=!1,t()}},[]);let B=ee(t,c);function V(e,t){let r=le(e,t);n(r.groups),d(r.order),ue(r.groups).then(e=>{if(!e||JSON.stringify(e)===JSON.stringify(r.groups))return;let t=le(e,r.order);n(t.groups),d(t.order)})}function H(){W(),j.close(),k.close()}function W(){P.current!==null&&(window.clearTimeout(P.current),P.current=null)}function G(){W(),P.current=window.setTimeout(()=>{P.current=null,j.close()},220)}function K(e,t){W(),j.open({itemId:e,rect:t.getBoundingClientRect()})}function q(e,t){M?.kind===`itemMenu`&&M.itemId===e?H():(j.closeNow(),k.open({kind:`itemMenu`,itemId:e,rect:t.getBoundingClientRect()}))}function fe(e,t){M?.kind===`groupMenu`&&M.group.id===e.id?H():(j.closeNow(),k.open({kind:`groupMenu`,group:e,rect:t.getBoundingClientRect()}))}function pe(e,n){V(g(t,e,n),c),H()}function me(e){let{groups:n,owner:r}=o(t,e);V(n,r?S(c,e,r,n):c),H()}let J=M?.kind===`assign`||M?.kind===`itemMenu`?M.itemId:void 0,he=M?.kind===`groupMenu`?M.group.id:void 0,X=M?.kind===`itemMenu`?M:null,Z=M?.kind===`groupMenu`?M:null,Q=M?.kind===`assign`?M:null,_e=X?t.find(e=>e.items.includes(X.itemId))??null:null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`tw-nav-ready`,"aria-hidden":`true`}),B.map(n=>n.type===`item`?$(n.id,f)?(0,U.jsx)(De,{id:n.id,icon:i[n.id],pathname:e,actionOpen:J===n.id,onMenu:e=>q(n.id,e)},n.id):null:(0,U.jsx)(Ae,{group:n.group,groups:t,order:c,icons:i,pathname:e,openItem:J,openGroupId:he,onMenu:fe,onItemMenu:q},n.group.id)),X?(0,U.jsxs)(Be,{rect:X.rect,closing:k.closing,onClose:H,onHoverEnter:W,onHoverLeave:G,children:[(0,U.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:L(v(X.itemId).i18n)}),(0,U.jsxs)(`div`,{className:`tw-nav-group-pop-list`,onMouseOver:e=>{let t=e.target.closest(`.tw-nav-group-pop-item`);t&&t.getAttribute(`data-submenu`)!==`icons`&&(W(),j.close())},children:[_e?(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item is-leave`,onClick:()=>me(X.itemId),children:[(0,U.jsx)(Ce,{}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.leaveGroup`)})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>k.open({kind:`assign`,itemId:X.itemId,rect:X.rect}),children:[(0,U.jsx)(Se,{}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.assignGroup`)})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=X.itemId;H(),I({name:``,items:[e]})},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(be,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.addToGroup`)})]})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=_e?.id??null;H(),F(e)},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(Te,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.sortMenu`)})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,"data-submenu":`icons`,onMouseEnter:e=>K(X.itemId,e.currentTarget),onClick:e=>K(X.itemId,e.currentTarget),children:[(0,U.jsx)(we,{}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.chooseIcon`)}),(0,U.jsx)(Fe,{})]})]})]}):null,N&&X&&N.itemId===X.itemId?(0,U.jsx)(ze,{anchor:N.rect,itemId:N.itemId,current:i[N.itemId],closing:j.closing,onHoverEnter:W,onHoverLeave:G,onPick:e=>{a(se(N.itemId,e)),H()}}):null,Z?(0,U.jsxs)(Be,{rect:Z.rect,closing:k.closing,onClose:H,children:[(0,U.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:Y(Z.group)}),(0,U.jsxs)(`div`,{className:`tw-nav-group-pop-list`,children:[Z.group.parentId?null:(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item is-create`,onClick:()=>{let e=Z.group.id;H(),I({name:``,items:[],parentId:e})},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(be,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.addSubgroup`)})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=Z.group;H(),F(e.parentId??null)},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(Te,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.sortMenu`)})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=Z.group;H(),I({id:e.id,name:e.name,items:[...e.items],parentId:e.parentId})},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(ye,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.editGroupTitle`)})]})]})]}):null,Q?(0,U.jsxs)(Be,{rect:Q.rect,closing:k.closing,onClose:H,children:[(0,U.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:L(`nav.assignGroup`)}),(0,U.jsx)(`div`,{className:`tw-nav-group-pop-list`,children:t.length?Pe(t,c).map(({group:e,indent:t})=>{let n=e.items.includes(Q.itemId);return(0,U.jsxs)(`button`,{type:`button`,className:[`tw-nav-group-pop-item`,n?`is-current`:``,t?`is-child`:``].filter(Boolean).join(` `),onClick:()=>{n||pe(e.id,Q.itemId)},children:[(0,U.jsx)(Se,{}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:Y(e)}),n?(0,U.jsx)(`span`,{className:`tw-nav-group-pop-tag`,children:L(`nav.currentGroup`)}):null]},e.id)}):(0,U.jsx)(`div`,{className:`tw-nav-group-pop-empty`,children:L(`nav.noGroups`)})})]}):null,(0,U.jsx)(je,{open:b&&!w,draft:_,groups:t,plugins:f,icons:i,onClose:z,onSave:e=>{let n=p(t,e);V(n.groups,u(c,n.groups,n.id)),z()},onDelete:_?.id?()=>T(_.id):void 0}),(0,U.jsx)(Ne,{open:E,focusGroupId:O,nodes:B,groups:t,order:c,visible:e=>$(e,f),onClose:()=>D(!1),onCommit:(e,t)=>{let n=c.filter(e=>m(e,t));V(t,[...e,...n.filter(t=>!e.includes(t))])},onChildCommit:(e,n)=>V(t,r(c,t,e,n))}),(0,U.jsx)(ie,{open:!!w,title:L(`nav.deleteGroup`),message:t.find(e=>e.id===w)?.parentId?L(`nav.deleteSubgroupMsg`):L(`nav.deleteGroupMsg`),confirmLabel:L(`nav.deleteGroup`),cancelLabel:L(`nav.groupCancel`),danger:`outline`,onClose:()=>T(null),onConfirm:()=>{if(w){let e=t.find(e=>e.id===w),n=A(t,w),r=s(t,w);V(r,e?l(c,e,r,n):c)}z()}})]})}export{Ve as default};
1
+ import{c as e,n as t,t as n}from"./react-dom.CqAxpHMt.js";import{A as r,C as i,D as a,F as o,I as s,L as c,M as l,N as u,O as d,P as f,R as p,S as m,T as h,_ as g,a as _,b as v,g as y,h as b,i as x,j as S,k as C,m as w,p as T,r as E,t as D,u as O,v as ee,w as te,x as k,y as A}from"./app-config.DUyozIL9.js";import{a as ne,i as re,r as j}from"./plugins.BDZqJNOy.js";import{i as M,n as N,r as P,t as F}from"./dialog.DXHznyjD.js";import{t as I}from"./jsx-runtime.BUXbF_vF.js";import{t as ie}from"./ConfirmDialog.CBVsDJ8f.js";import{n as L}from"./i18n.B52gLzii.js";var R=e(t(),1),z=e(n(),1),B=`/__tb_nav/groups`;function ae(){return E().navGroups}function oe(){return d(E().navIcons)}function se(e,t){let n={...oe(),[e]:t};return O({navIcons:n}),D(),n}function ce(){return E().navOrder}function le(e,t){let n=a(e),r=C(t,n);return O({navGroups:n,navOrder:r}),D(),{groups:n,order:r}}function V(e,t){return JSON.stringify(e)===JSON.stringify(t)}async function ue(e){if(!_())return null;try{let t=await fetch(B,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({groups:e}),signal:AbortSignal.timeout(4e3)});if(!t.ok)return null;let n=await t.json();return a(n.groups,!1)}catch{return null}}async function de(){if(!_())return;let e=E(),t=null;try{let e=await fetch(B,{signal:AbortSignal.timeout(4e3)});e.ok&&(t=await e.json())}catch{return}if(!t)return;if(t.scanned){let n=a(t.groups,!1),r=C(e.navOrder,n);(!V(n,e.navGroups)||!V(r,e.navOrder))&&(O({navGroups:n,navOrder:r}),D());return}if(!e.navGroups.length)return;let n=await ue(e.navGroups);n&&!V(n,e.navGroups)&&(O({navGroups:n,navOrder:C(e.navOrder,n)}),D())}function H(e,t,n){let[r,i]=(0,R.useState)(null),a=(0,R.useRef)(null),o=(0,R.useRef)(e);o.current=e;let s=(0,R.useRef)(t);s.current=t;let l=(0,R.useRef)(n);l.current=n;function u(e,t){if(t.button!==0)return;t.preventDefault(),t.stopPropagation();let n=a.current;if(!n)return;i(e);let r=e=>{let t=[...n.querySelectorAll(`[data-sort-key]`)];for(let n of t){let t=n.getBoundingClientRect();if(e>=t.top&&e<=t.bottom)return n.dataset.sortKey}return null},u=t=>{let n=r(t.clientY);if(!n||n===e)return;let i=c(o.current,e,n);i.join(`|`)!==o.current.join(`|`)&&(o.current=i,s.current(i))},d=()=>{window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d),window.removeEventListener(`pointercancel`,d),i(null),l.current?.()};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d),window.addEventListener(`pointercancel`,d)}return{listRef:a,dragId:r,onPointerDown:u}}var U=I(),W=`/`;function G(e){return`${W.endsWith(`/`)?W:`${W}/`}${e.replace(/^\//,``)}`}function K(e,t){let n=W.replace(/\/$/,``),r=e.slice(n.length).replace(/^\/+/,``);return r===t||r.startsWith(`${t}/`)}function q(e){return[`tw-nav-item`,e?`is-active font-medium`:``].filter(Boolean).join(` `)}function fe(e){return T(`tw.nav.groupOpen.${e}`)}function pe(){return T(`tw.nav.docsOpen`)}function me(e,t){try{let t=localStorage.getItem(fe(e));if(t===`1`)return!0;if(t===`0`)return!1;if(e===`docs`){let e=localStorage.getItem(pe());if(e===`1`)return!0;if(e===`0`)return!1}}catch{}return t}function J(e,t){try{localStorage.setItem(fe(e),t?`1`:`0`),e===`docs`&&localStorage.setItem(pe(),t?`1`:`0`)}catch{}}function Y(e){return e.id===`docs`&&(e.name===`文档库`||e.name===`Documents`)?L(`nav.docs`):e.name}function he(e){return e.type===`group`?Y(e.group):L(v(e.id).i18n)}function X(e){return e.type===`item`?te(e.id):k(e.group.id)}function ge(){let[e,t]=(0,R.useState)(()=>window.location.pathname);return(0,R.useEffect)(()=>{let e=()=>t(window.location.pathname);return document.addEventListener(`astro:page-load`,e),document.addEventListener(`astro:after-swap`,e),window.addEventListener(`popstate`,e),()=>{document.removeEventListener(`astro:page-load`,e),document.removeEventListener(`astro:after-swap`,e),window.removeEventListener(`popstate`,e)}},[]),e}function Z({children:e}){return(0,U.jsx)(`svg`,{className:`tw-nav-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:e})}function Q({id:e,icon:t}){return(0,U.jsx)(Z,{children:_e[t??w[e]]})}var _e={dashboard:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`7`,rx:`1.5`}),(0,U.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`7`,rx:`1.5`}),(0,U.jsx)(`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1.5`}),(0,U.jsx)(`rect`,{x:`14`,y:`14`,width:`7`,height:`7`,rx:`1.5`})]}),check:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M9 11l3 3L22 4`}),(0,U.jsx)(`path`,{d:`M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11`})]}),pencil:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M12 20h9`}),(0,U.jsx)(`path`,{d:`M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z`})]}),book:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M4 19.5A2.5 2.5 0 0 1 6.5 17H20`}),(0,U.jsx)(`path`,{d:`M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z`})]}),fileText:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M14 3v5h5`}),(0,U.jsx)(`path`,{d:`M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z`}),(0,U.jsx)(`path`,{d:`M8 13h8`}),(0,U.jsx)(`path`,{d:`M8 17h6`})]}),layers:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M12 3 3 8l9 5 9-5-9-5z`}),(0,U.jsx)(`path`,{d:`m3 13 9 5 9-5`})]}),list:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M8 6h13`}),(0,U.jsx)(`path`,{d:`M8 12h13`}),(0,U.jsx)(`path`,{d:`M8 18h13`}),(0,U.jsx)(`path`,{d:`M3 6h.01`}),(0,U.jsx)(`path`,{d:`M3 12h.01`}),(0,U.jsx)(`path`,{d:`M3 18h.01`})]}),folder:(0,U.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z`}),star:(0,U.jsx)(`path`,{d:`m12 3 2.1 5.9L20 11l-5 4.3 1.7 6.2-5.7-3.9-5.7 3.9L7 15.3 2 11l5.9-2.1L12 3z`}),database:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`ellipse`,{cx:`12`,cy:`6`,rx:`8`,ry:`3`}),(0,U.jsx)(`path`,{d:`M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6`}),(0,U.jsx)(`path`,{d:`M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6`})]}),target:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8`}),(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1`})]}),code:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`m8 8-4 4 4 4`}),(0,U.jsx)(`path`,{d:`m16 8 4 4-4 4`})]}),flask:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M9 3h6`}),(0,U.jsx)(`path`,{d:`M10 3v6l-5 8a2 2 0 0 0 1.7 3h10.6a2 2 0 0 0 1.7-3l-5-8V3`}),(0,U.jsx)(`path`,{d:`M7.5 14h9`})]}),home:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M3 10.5 12 3l9 7.5`}),(0,U.jsx)(`path`,{d:`M5 9.5V20h14V9.5`})]}),clipboard:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M9 4h6v3H9z`}),(0,U.jsx)(`path`,{d:`M8 4H6a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-2`})]}),bug:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`14`,r:`5`}),(0,U.jsx)(`path`,{d:`M9 6l2 2`}),(0,U.jsx)(`path`,{d:`M15 6l-2 2`}),(0,U.jsx)(`path`,{d:`M7 11H4`}),(0,U.jsx)(`path`,{d:`M20 11h-3`}),(0,U.jsx)(`path`,{d:`M7 17H4`}),(0,U.jsx)(`path`,{d:`M20 17h-3`})]}),calendar:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`3`,y:`5`,width:`18`,height:`16`,rx:`2`}),(0,U.jsx)(`path`,{d:`M8 3v4`}),(0,U.jsx)(`path`,{d:`M16 3v4`}),(0,U.jsx)(`path`,{d:`M3 10h18`})]}),chart:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M4 20V10`}),(0,U.jsx)(`path`,{d:`M10 20V4`}),(0,U.jsx)(`path`,{d:`M16 20v-7`}),(0,U.jsx)(`path`,{d:`M2 20h20`})]}),globe:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,U.jsx)(`path`,{d:`M3 12h18`}),(0,U.jsx)(`path`,{d:`M12 3c2.5 2.5 4 5.7 4 9s-1.5 6.5-4 9c-2.5-2.5-4-5.7-4-9s1.5-6.5 4-9z`})]}),link:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M10 13a4 4 0 0 0 5.7 0l2.3-2.3a4 4 0 0 0-5.7-5.7L11 6.3`}),(0,U.jsx)(`path`,{d:`M14 11a4 4 0 0 0-5.7 0L6 13.3a4 4 0 0 0 5.7 5.7L13 17.7`})]}),users:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`9`,cy:`8`,r:`3.5`}),(0,U.jsx)(`path`,{d:`M2.5 20a6.5 6.5 0 0 1 13 0`}),(0,U.jsx)(`path`,{d:`M16 5.5a3.5 3.5 0 0 1 0 7`}),(0,U.jsx)(`path`,{d:`M18 20a6 6 0 0 0-2-4.5`})]}),terminal:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`m5 8 4 4-4 4`}),(0,U.jsx)(`path`,{d:`M13 16h6`})]}),tag:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M20.6 13.4 13.4 20.6a2 2 0 0 1-2.8 0l-7.2-7.2a2 2 0 0 1-.6-1.4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 1.4.6l6.2 6.2a2 2 0 0 1 0 2.6z`}),(0,U.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.2`})]}),flag:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M5 21V4`}),(0,U.jsx)(`path`,{d:`M5 5h11l-2 4 2 4H5z`})]}),zap:(0,U.jsx)(`path`,{d:`M13 2 4 14h6l-1 8 9-12h-6l1-8z`})};function ve(){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`svg`,{className:`tw-nav-ico tw-nav-ico--closed`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,U.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z`})}),(0,U.jsx)(`svg`,{className:`tw-nav-ico tw-nav-ico--open`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,U.jsx)(`path`,{d:`M6 14l1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`})})]})}function ye(){return(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:[(0,U.jsx)(`path`,{d:`M21 4H14`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M10 4H3`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M21 12H12`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M8 12H3`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M21 20H16`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M12 20H3`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M14 2v4`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M8 10v4`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M16 18v4`,strokeLinecap:`round`})]})}function be(){return(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,U.jsx)(`path`,{d:`M12 8v8`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M8 12h8`,strokeLinecap:`round`})]})}function xe(){return(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":!0,children:[(0,U.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1.7`}),(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.7`}),(0,U.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1.7`})]})}function Se(){return(0,U.jsx)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,U.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z`})})}function Ce(){return(0,U.jsxs)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,U.jsx)(`path`,{d:`M9 6H5a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h4`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M16 8l4 4-4 4`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,U.jsx)(`path`,{d:`M20 12H9`,strokeLinecap:`round`})]})}function we(){return(0,U.jsxs)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,U.jsx)(`circle`,{cx:`8.5`,cy:`8.5`,r:`4.5`}),(0,U.jsx)(`rect`,{x:`12`,y:`12`,width:`9`,height:`9`,rx:`2`})]})}function Te(){return(0,U.jsxs)(Z,{children:[(0,U.jsx)(`path`,{d:`M8 6v12`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M5 9l3-3 3 3`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,U.jsx)(`path`,{d:`M16 18V6`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M13 15l3 3 3-3`,strokeLinecap:`round`,strokeLinejoin:`round`})]})}function Ee(){return(0,U.jsxs)(`svg`,{className:`tw-nav-drag-grip`,viewBox:`0 0 20 20`,"aria-hidden":!0,children:[(0,U.jsx)(`circle`,{cx:`7`,cy:`5`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`13`,cy:`5`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`7`,cy:`10`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`13`,cy:`10`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`7`,cy:`15`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`13`,cy:`15`,r:`1.25`,fill:`currentColor`})]})}function $(e,t){if(i(e))return!1;let n=v(e).plugin;return!n||t[n]!==!1}function De({id:e,icon:t,pathname:n,actionOpen:r,onMenu:i}){let a=v(e),o=K(n,a.match);return(0,U.jsxs)(`div`,{className:[q(o),r?`is-action-open`:``].filter(Boolean).join(` `),"data-plugin-nav":a.plugin,children:[(0,U.jsxs)(`a`,{href:G(a.href),className:`tw-nav-item-main`,children:[(0,U.jsx)(Q,{id:e,icon:t}),(0,U.jsx)(`span`,{className:`tw-nav-label`,children:L(a.i18n)})]}),(0,U.jsx)(`button`,{type:`button`,className:`tw-nav-hover-btn`,"aria-label":L(`nav.more`),onClick:e=>{e.preventDefault(),e.stopPropagation(),i(e.currentTarget)},children:(0,U.jsx)(xe,{})})]})}function Oe(e,t,n){return e.items.some(e=>{if(i(e))return!1;let t=v(e).plugin;return(!t||j(t))&&K(n,v(e).match)})?!0:h(t,e.id).some(e=>Oe(e,t,n))}function ke(e,t){return e.items.some(e=>{if(i(e))return!1;let t=v(e).plugin;return!t||j(t)})?!0:h(t,e.id).some(e=>ke(e,t))}function Ae({group:e,groups:t,order:n,icons:r,pathname:a,openItem:o,openGroupId:s,onMenu:c,onItemMenu:l}){let u=e.items.filter(e=>{if(i(e))return!1;let t=v(e).plugin;return!t||j(t)}),d=f(t,e.id,n),p=Oe(e,t,a),[m,h]=(0,R.useState)(()=>me(e.id,!0)),[g,_]=(0,R.useState)(!1),y=(0,R.useRef)(null),b=(0,R.useRef)(null),x=(0,R.useRef)(null);if((0,R.useEffect)(()=>S,[]),!ke(e,t))return null;function S(){x.current&&y.current&&y.current.removeEventListener(`transitionend`,x.current),x.current=null,b.current!==null&&(window.clearTimeout(b.current),b.current=null)}function C(){S(),J(e.id,!0),_(!1),h(!0)}function w(t){if(t.preventDefault(),!m||g){C();return}_(!0),J(e.id,!1);let n=y.current,r=!1,i=()=>{r||(r=!0,S(),h(!1),_(!1))},a=e=>{e.target===n&&e.propertyName===`grid-template-rows`&&i()};S(),x.current=a,n?.addEventListener(`transitionend`,a),b.current=window.setTimeout(i,360)}return(0,U.jsxs)(`details`,{className:`tw-nav-details ${g?`is-closing`:``}`,open:m||g,"data-nav-group":e.id,children:[(0,U.jsxs)(`summary`,{className:[`tw-nav-item tw-nav-summary`,p?`is-branch-active`:``,s===e.id?`is-action-open`:``].filter(Boolean).join(` `),onClick:w,children:[(0,U.jsx)(ve,{}),(0,U.jsx)(`span`,{className:`tw-nav-label min-w-0 flex-1 truncate`,children:Y(e)}),(0,U.jsx)(`button`,{type:`button`,className:`tw-nav-hover-btn`,"aria-label":L(`nav.groupActions`),onClick:t=>{t.preventDefault(),t.stopPropagation(),c(e,t.currentTarget)},children:(0,U.jsx)(ye,{})}),(0,U.jsx)(`svg`,{className:`tw-nav-chevron opacity-70`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,U.jsx)(`path`,{d:`M7 5l6 5-6 5`,strokeLinecap:`round`,strokeLinejoin:`round`})})]}),(0,U.jsx)(`div`,{className:`tw-nav-subtree-anim`,ref:y,children:(0,U.jsxs)(`div`,{className:`tw-nav-subtree`,children:[u.map(e=>(0,U.jsx)(De,{id:e,icon:r[e],pathname:a,actionOpen:o===e,onMenu:t=>l(e,t)},e)),d.map(e=>(0,U.jsx)(Ae,{group:e,groups:t,order:n,icons:r,pathname:a,openItem:o,openGroupId:s,onMenu:c,onItemMenu:l},e.id))]})})]})}function je({open:e,draft:t,groups:n,plugins:r,icons:i,onClose:a,onSave:o,onDelete:s}){let[c,l]=(0,R.useState)(``),[u,d]=(0,R.useState)([]),[f,p]=(0,R.useState)(``),m=(0,R.useRef)(null),h=new Set(n.filter(e=>e.id!==t?.id).flatMap(e=>e.items)),g=b.filter(e=>$(e.id,r)&&(!h.has(e.id)||u.includes(e.id))),_=H(u,d);(0,R.useEffect)(()=>{if(!e||!t)return;l(t.name),d(t.items.filter(e=>$(e,r))),p(``);let n=window.setTimeout(()=>{m.current?.focus(),m.current?.select()},50);return()=>window.clearTimeout(n)},[e,t,r]);function v(e){d(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}function y(){let e=c.trim();if(!e){p(L(`nav.groupNameRequired`));return}if(!u.length){p(L(`nav.groupItemsRequired`));return}let n=(t?.items??[]).filter(e=>!$(e,r));o({id:t?.id,name:e,items:[...n,...u],parentId:t?.parentId})}let x=[...u.map(e=>g.find(t=>t.id===e)).filter(e=>!!e),...g.filter(e=>!u.includes(e.id))];return(0,U.jsxs)(P,{open:e,onClose:a,transition:!0,className:`relative z-110`,children:[(0,U.jsx)(F,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":!0}),(0,U.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,U.jsxs)(M,{transition:!0,className:`tw-confirm-dialog tw-dialog-panel-anim w-full max-w-sm rounded-xl shadow-xl border border-stone-200 p-5 bg-white`,children:[(0,U.jsx)(N,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:t?.id?L(`nav.editGroupTitle`):t?.parentId?L(`nav.addSubgroup`):L(`nav.createGroup`)}),(0,U.jsxs)(`label`,{className:`tw-confirm-msg mt-4 block text-xs font-medium text-stone-500`,children:[L(`nav.groupName`),(0,U.jsx)(`input`,{ref:m,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),y())},className:`mt-1.5 w-full h-9 rounded-lg border border-stone-200 px-3 text-sm text-stone-800 outline-none focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6]`})]}),(0,U.jsxs)(`div`,{className:`mt-4`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium text-stone-500`,children:L(`nav.groupItems`)}),(0,U.jsx)(`p`,{className:`mt-1 text-[11px] text-stone-400`,children:L(`nav.groupItemsHint`)}),(0,U.jsxs)(`div`,{ref:_.listRef,className:`mt-2 max-h-52 overflow-auto rounded-lg border border-stone-200 p-1`,children:[x.map(e=>{let t=u.includes(e.id);return(0,U.jsxs)(`label`,{"data-sort-key":t?e.id:void 0,className:[`flex items-center gap-2 rounded-md px-3 py-2 text-sm text-stone-700 cursor-pointer hover:bg-stone-50`,t?`tw-nav-drag-row`:``,_.dragId===e.id?`is-dragging`:``].filter(Boolean).join(` `),onPointerDown:t?t=>{t.target.closest(`input`)||_.onPointerDown(e.id,t)}:void 0,children:[t?(0,U.jsx)(Ee,{}):(0,U.jsx)(`span`,{className:`tw-nav-drag-grip`}),(0,U.jsx)(`input`,{type:`checkbox`,checked:t,onChange:()=>v(e.id),className:`rounded border-stone-300 text-[#4176e6] focus:ring-[#4176e6]/40`}),(0,U.jsx)(`span`,{className:`tw-nav-editor-ico`,children:(0,U.jsx)(Q,{id:e.id,icon:i[e.id]})}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:L(e.i18n)})]},e.id)}),x.length?null:(0,U.jsx)(`div`,{className:`px-3 py-4 text-center text-[12px] text-stone-400`,children:L(`nav.noAddableItems`)})]})]}),f?(0,U.jsx)(`p`,{className:`mt-2 text-[12px] text-red-600`,children:f}):null,(0,U.jsxs)(`div`,{className:`mt-5 flex items-center gap-2`,children:[t?.id&&s?(0,U.jsx)(`button`,{type:`button`,onClick:s,className:`h-8 px-3 text-sm rounded-lg border border-red-200 text-red-600 hover:bg-red-50`,children:L(`nav.deleteGroup`)}):null,(0,U.jsx)(`div`,{className:`flex-1`}),(0,U.jsx)(`button`,{type:`button`,onClick:a,className:`tw-confirm-cancel h-8 px-3 text-sm rounded-lg border border-stone-200 text-stone-600 hover:bg-stone-100`,children:L(`nav.groupCancel`)}),(0,U.jsx)(`button`,{type:`button`,onClick:y,className:`h-8 px-3 text-sm rounded-lg text-white bg-[#4176e6] hover:bg-[#3566d0]`,children:L(`nav.groupSave`)})]})]})})]})}function Me({ids:e,labelOf:t,onChange:n,onEnd:r,indent:i}){let a=H(e,n,r);return(0,U.jsx)(`div`,{ref:a.listRef,className:`flex flex-col`,children:e.map(e=>(0,U.jsxs)(`div`,{"data-sort-key":e,className:[`tw-nav-drag-row px-3 py-2 text-sm text-stone-700 hover:bg-stone-50`,i?`tw-nav-drag-row--nested`:``,a.dragId===e?`is-dragging`:``].filter(Boolean).join(` `),onPointerDown:t=>a.onPointerDown(e,t),children:[(0,U.jsx)(Ee,{}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t(e)})]},e))})}function Ne({open:e,focusGroupId:t,nodes:n,groups:r,order:i,visible:a,onClose:o,onCommit:s,onChildCommit:c}){let l=e=>!a||a(e),u=e=>e.items.some(l)||r.filter(t=>t.parentId===e.id).some(e=>u(e)),d=n.filter(e=>e.type===`item`?l(e.id):u(e.group)),[p,m]=(0,R.useState)(()=>d.map(X)),[h,g]=(0,R.useState)(()=>Object.fromEntries(r.map(e=>[e.id,[...e.items]]))),[_,y]=(0,R.useState)([]),b=(0,R.useRef)(p);b.current=p;let x=(0,R.useRef)(h);x.current=h;let S=(0,R.useRef)(r);S.current=r;let C=(0,R.useRef)(i);C.current=i;let w=(0,R.useRef)(d);w.current=d;let T=(0,R.useRef)(_);T.current=_;let E=()=>{let e=S.current.map(e=>({...e,items:x.current[e.id]??e.items}));s(b.current,e)},D=()=>{t&&c(t,T.current)};(0,R.useEffect)(()=>{if(!e)return;let n=w.current.map(X);b.current=n,m(n);let r=Object.fromEntries(S.current.map(e=>[e.id,[...e.items]]));x.current=r,g(r);let i=t?f(S.current,t,C.current).map(e=>e.id):[];T.current=i,y(i)},[e,t]);let O=e=>{b.current=e,m(e)},ee=e=>{T.current=e,y(e)},te=(e,t)=>{let n=(x.current[e]??[]).filter(e=>!l(e)),r={...x.current,[e]:t.length?[...t,...n]:n};x.current=r,g(r)},k=new Map(d.map(e=>[X(e),he(e)])),A=t?r.find(e=>e.id===t):void 0,ne=A?(h[A.id]??A.items).filter(l):[],re=A?f(r,A.id,i):[],j=_.length?_:re.map(e=>e.id);return(0,U.jsxs)(P,{open:e,onClose:o,transition:!0,className:`relative z-110`,children:[(0,U.jsx)(F,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":!0}),(0,U.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,U.jsxs)(M,{transition:!0,className:`tw-confirm-dialog tw-dialog-panel-anim w-full max-w-sm rounded-xl shadow-xl border border-stone-200 p-5 bg-white`,children:[(0,U.jsx)(N,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:L(`nav.sortMenuTitle`)}),(0,U.jsx)(`p`,{className:`mt-1 text-[11px] text-stone-400`,children:L(`nav.sortHint`)}),(0,U.jsx)(`div`,{className:`mt-4 max-h-80 overflow-auto rounded-lg border border-stone-200 p-1`,children:A?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Me,{ids:ne,labelOf:e=>L(v(e).i18n),onChange:e=>te(A.id,e),onEnd:E,indent:!0}),j.length?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`mt-1 border-t border-stone-100 px-3 pb-1 pt-2 text-[11px] font-medium text-stone-400`,children:L(`nav.subgroups`)}),(0,U.jsx)(Me,{ids:j,labelOf:e=>{let t=r.find(t=>t.id===e);return t?Y(t):e},onChange:ee,onEnd:D,indent:!0})]}):null]}):(0,U.jsx)(Me,{ids:p,labelOf:e=>k.get(e)??e,onChange:O,onEnd:E})})]})})]})}function Pe(e,t){let n=[];for(let r of e.filter(e=>!e.parentId)){n.push({group:r,indent:!1});for(let i of f(e,r.id,t))n.push({group:i,indent:!0})}return n}function Fe(){return(0,U.jsx)(`svg`,{className:`tw-nav-group-pop-arrow`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,U.jsx)(`path`,{d:`M7 5l5 5-5 5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}var Ie=120;function Le(){let[e,t]=(0,R.useState)(null),n=(0,R.useRef)(null),r=(0,R.useCallback)(()=>{n.current!==null&&(window.clearTimeout(n.current),n.current=null)},[]),i=(0,R.useCallback)(e=>{r(),t({value:e,closing:!1})},[r]),a=(0,R.useCallback)(()=>{r(),t(e=>e&&!e.closing?{...e,closing:!0}:e),n.current=window.setTimeout(()=>{n.current=null,t(null)},Ie)},[r]),o=(0,R.useCallback)(()=>{r(),t(null)},[r]);return(0,R.useEffect)(()=>r,[r]),{value:e?.value??null,closing:!!e?.closing,open:i,close:a,closeNow:o}}function Re(e,t){return{onMouseOver:()=>e?.(),onMouseOut:e=>{let n=e.relatedTarget;n&&e.currentTarget.contains(n)||t?.()}}}function ze({anchor:e,current:t,itemId:n,closing:r,onPick:i,onHoverEnter:a,onHoverLeave:o}){let s=(0,R.useRef)(null),[c,l]=(0,R.useState)({top:e.top,left:e.right+8});return(0,R.useEffect)(()=>{let t=s.current;if(!t)return;let n=t.offsetWidth,r=t.offsetHeight,i=e.right+8,a=e.top-6;i+n>window.innerWidth-8&&(i=Math.max(8,e.left-n-6)),a+r>window.innerHeight-8&&(a=Math.max(8,window.innerHeight-r-8)),a<8&&(a=8),l({top:a,left:i})},[e]),(0,z.createPortal)((0,U.jsxs)(`div`,{ref:s,className:[`tw-nav-group-pop`,`tw-nav-icon-pop`,r?`is-closing`:``].filter(Boolean).join(` `),style:{top:c.top,left:c.left},...Re(a,o),children:[(0,U.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:L(`nav.chooseIcon`)}),(0,U.jsx)(`div`,{className:`tw-nav-icon-grid`,children:y.map(e=>(0,U.jsx)(`button`,{type:`button`,className:[`tw-nav-icon-cell`,t===e?`is-current`:``].filter(Boolean).join(` `),onClick:()=>i(e),children:(0,U.jsx)(Q,{id:n,icon:e})},e))})]}),document.body)}function Be({rect:e,closing:t=!1,onClose:n,onHoverEnter:r,onHoverLeave:i,children:a}){let o=(0,R.useRef)(null),[s,c]=(0,R.useState)({top:e.top,left:e.right+6});return(0,R.useEffect)(()=>{let t=o.current;if(!t)return;let n=t.offsetWidth,r=t.offsetHeight,i=e.right+6,a=e.top;i+n>window.innerWidth-8&&(i=Math.max(8,e.left-n-6)),a+r>window.innerHeight-8&&(a=Math.max(8,window.innerHeight-r-8)),c({top:a,left:i})},[e]),(0,R.useEffect)(()=>{let e=e=>{let t=e.target;o.current?.contains(t)||t?.closest?.(`.tw-nav-icon-pop`)||t?.closest?.(`.tw-nav-hover-btn`)||n()},t=e=>{e.key===`Escape`&&n()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),window.addEventListener(`resize`,n),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t),window.removeEventListener(`resize`,n)}},[n]),(0,z.createPortal)((0,U.jsx)(`div`,{ref:o,className:[`tw-nav-group-pop`,t?`is-closing`:``].filter(Boolean).join(` `),style:{top:s.top,left:s.left},...Re(r,i),children:a}),document.body)}function Ve(){let e=ge(),[t,n]=(0,R.useState)(()=>ae()),[i,a]=(0,R.useState)(()=>oe()),[c,d]=(0,R.useState)(()=>ce()),[f,h]=(0,R.useState)(()=>re()),[_,y]=(0,R.useState)(null),[b,C]=(0,R.useState)(!1),[w,T]=(0,R.useState)(null),[E,D]=(0,R.useState)(!1),[O,te]=(0,R.useState)(null),k=Le(),j=Le(),M=k.value,N=j.value,P=(0,R.useRef)(null);(0,R.useEffect)(()=>()=>{P.current!==null&&window.clearTimeout(P.current)},[]);function F(e){te(e),D(!0)}function I(e){y(e),C(!0)}function z(){C(!1),T(null)}(0,R.useEffect)(()=>{let e=!0,t=ne(e=>{h({...e})});return x().then(async()=>{e&&(await de(),e&&(n(ae()),d(ce()),a(oe()),h(re())))}),()=>{e=!1,t()}},[]);let B=ee(t,c);function V(e,t){let r=le(e,t);n(r.groups),d(r.order),ue(r.groups).then(e=>{if(!e||JSON.stringify(e)===JSON.stringify(r.groups))return;let t=le(e,r.order);n(t.groups),d(t.order)})}function H(){W(),j.close(),k.close()}function W(){P.current!==null&&(window.clearTimeout(P.current),P.current=null)}function G(){W(),P.current=window.setTimeout(()=>{P.current=null,j.close()},220)}function K(e,t){W(),j.open({itemId:e,rect:t.getBoundingClientRect()})}function q(e,t){M?.kind===`itemMenu`&&M.itemId===e?H():(j.closeNow(),k.open({kind:`itemMenu`,itemId:e,rect:t.getBoundingClientRect()}))}function fe(e,t){M?.kind===`groupMenu`&&M.group.id===e.id?H():(j.closeNow(),k.open({kind:`groupMenu`,group:e,rect:t.getBoundingClientRect()}))}function pe(e,n){V(g(t,e,n),c),H()}function me(e){let{groups:n,owner:r}=o(t,e);V(n,r?S(c,e,r,n):c),H()}let J=M?.kind===`assign`||M?.kind===`itemMenu`?M.itemId:void 0,he=M?.kind===`groupMenu`?M.group.id:void 0,X=M?.kind===`itemMenu`?M:null,Z=M?.kind===`groupMenu`?M:null,Q=M?.kind===`assign`?M:null,_e=X?t.find(e=>e.items.includes(X.itemId))??null:null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`tw-nav-ready`,"aria-hidden":`true`}),B.map(n=>n.type===`item`?$(n.id,f)?(0,U.jsx)(De,{id:n.id,icon:i[n.id],pathname:e,actionOpen:J===n.id,onMenu:e=>q(n.id,e)},n.id):null:(0,U.jsx)(Ae,{group:n.group,groups:t,order:c,icons:i,pathname:e,openItem:J,openGroupId:he,onMenu:fe,onItemMenu:q},n.group.id)),X?(0,U.jsxs)(Be,{rect:X.rect,closing:k.closing,onClose:H,onHoverEnter:W,onHoverLeave:G,children:[(0,U.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:L(v(X.itemId).i18n)}),(0,U.jsxs)(`div`,{className:`tw-nav-group-pop-list`,onMouseOver:e=>{let t=e.target.closest(`.tw-nav-group-pop-item`);t&&t.getAttribute(`data-submenu`)!==`icons`&&(W(),j.close())},children:[_e?(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item is-leave`,onClick:()=>me(X.itemId),children:[(0,U.jsx)(Ce,{}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.leaveGroup`)})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>k.open({kind:`assign`,itemId:X.itemId,rect:X.rect}),children:[(0,U.jsx)(Se,{}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.assignGroup`)})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=X.itemId;H(),I({name:``,items:[e]})},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(be,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.addToGroup`)})]})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=_e?.id??null;H(),F(e)},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(Te,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.sortMenu`)})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,"data-submenu":`icons`,onMouseEnter:e=>K(X.itemId,e.currentTarget),onClick:e=>K(X.itemId,e.currentTarget),children:[(0,U.jsx)(we,{}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.chooseIcon`)}),(0,U.jsx)(Fe,{})]})]})]}):null,N&&X&&N.itemId===X.itemId?(0,U.jsx)(ze,{anchor:N.rect,itemId:N.itemId,current:i[N.itemId],closing:j.closing,onHoverEnter:W,onHoverLeave:G,onPick:e=>{a(se(N.itemId,e)),H()}}):null,Z?(0,U.jsxs)(Be,{rect:Z.rect,closing:k.closing,onClose:H,children:[(0,U.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:Y(Z.group)}),(0,U.jsxs)(`div`,{className:`tw-nav-group-pop-list`,children:[Z.group.parentId?null:(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item is-create`,onClick:()=>{let e=Z.group.id;H(),I({name:``,items:[],parentId:e})},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(be,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.addSubgroup`)})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=Z.group;H(),F(e.parentId??null)},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(Te,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.sortMenu`)})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=Z.group;H(),I({id:e.id,name:e.name,items:[...e.items],parentId:e.parentId})},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(ye,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.editGroupTitle`)})]})]})]}):null,Q?(0,U.jsxs)(Be,{rect:Q.rect,closing:k.closing,onClose:H,children:[(0,U.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:L(`nav.assignGroup`)}),(0,U.jsx)(`div`,{className:`tw-nav-group-pop-list`,children:t.length?Pe(t,c).map(({group:e,indent:t})=>{let n=e.items.includes(Q.itemId);return(0,U.jsxs)(`button`,{type:`button`,className:[`tw-nav-group-pop-item`,n?`is-current`:``,t?`is-child`:``].filter(Boolean).join(` `),onClick:()=>{n||pe(e.id,Q.itemId)},children:[(0,U.jsx)(Se,{}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:Y(e)}),n?(0,U.jsx)(`span`,{className:`tw-nav-group-pop-tag`,children:L(`nav.currentGroup`)}):null]},e.id)}):(0,U.jsx)(`div`,{className:`tw-nav-group-pop-empty`,children:L(`nav.noGroups`)})})]}):null,(0,U.jsx)(je,{open:b&&!w,draft:_,groups:t,plugins:f,icons:i,onClose:z,onSave:e=>{let n=p(t,e);V(n.groups,u(c,n.groups,n.id)),z()},onDelete:_?.id?()=>T(_.id):void 0}),(0,U.jsx)(Ne,{open:E,focusGroupId:O,nodes:B,groups:t,order:c,visible:e=>$(e,f),onClose:()=>D(!1),onCommit:(e,t)=>{let n=c.filter(e=>m(e,t));V(t,[...e,...n.filter(t=>!e.includes(t))])},onChildCommit:(e,n)=>V(t,r(c,t,e,n))}),(0,U.jsx)(ie,{open:!!w,title:L(`nav.deleteGroup`),message:t.find(e=>e.id===w)?.parentId?L(`nav.deleteSubgroupMsg`):L(`nav.deleteGroupMsg`),confirmLabel:L(`nav.deleteGroup`),cancelLabel:L(`nav.groupCancel`),danger:`outline`,onClose:()=>T(null),onConfirm:()=>{if(w){let e=t.find(e=>e.id===w),n=A(t,w),r=s(t,w);V(r,e?l(c,e,r,n):c)}z()}})]})}export{Ve as default};
@@ -0,0 +1 @@
1
+ export{t as default}from"./PluginsPage.BEAPymNL.js";
@@ -1,4 +1,4 @@
1
- import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{i as n}from"./app-config.DKMxjv3g.js";import{a as r,c as i,i as a,n as o,t as s}from"./plugins.D5ypJIXn.js";import{o as c}from"./case-exec.BipZCK6G.js";import{a as l,n as u}from"./view-prefs.HCowOWXL.js";import{t as d}from"./jsx-runtime.BUXbF_vF.js";import"./settings.CnDCvwnQ.js";import{t as f}from"./OverflowHint.lzmplP5j.js";import{M as p,v as m}from"./pm.BsnTv63L.js";import{s as h,w as g}from"./tasks.otRBFydq.js";import{s as _}from"./report-prompt.Cmw4XzfY.js";import{r as v}from"./test-stats.MEm3K2rB.js";var y=e(t(),1),b=`/__tb_fs`,x=`你可以使用本地文件工具(侧栏工作区已连接时):
1
+ import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{i as n}from"./app-config.DUyozIL9.js";import{a as r,c as i,i as a,n as o,t as s}from"./plugins.BDZqJNOy.js";import{o as c}from"./case-exec.BipZCK6G.js";import{a as l,n as u}from"./view-prefs.Dyu_lmN2.js";import{t as d}from"./jsx-runtime.BUXbF_vF.js";import"./settings.C6NWuiFO.js";import{t as f}from"./OverflowHint.lzmplP5j.js";import{N as p,v as m}from"./pm.Bl3hz9fF.js";import{s as h,w as g}from"./tasks.otRBFydq.js";import{s as _}from"./report-prompt.Cmw4XzfY.js";import{r as v}from"./test-stats.MEm3K2rB.js";var y=e(t(),1),b=`/__tb_fs`,x=`你可以使用本地文件工具(侧栏工作区已连接时):
2
2
  - 侧栏「工作区」决定当前目录;fs_* 默认相对该工作区
3
3
  - working_directory_get / working_directory_set:查看或切换当前工作区(已注册列表内)
4
4
  - 「仅可查看」「工作区内修改」:用工作区相对路径
@@ -0,0 +1 @@
1
+ import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{o as n}from"./plugins.BDZqJNOy.js";import{t as r}from"./jsx-runtime.BUXbF_vF.js";import{t as ee}from"./ConfirmDialog.CBVsDJ8f.js";import{n as te,t as ne}from"./DocsPager.C20ue_JZ.js";import{t as i}from"./SelectDropdown.Buv7rQJ_.js";import{A as a,F as o,I as re,M as ie,b as ae,g as oe,h as se,i as s,k as c,m as l,n as u,p as ce,r as d,t as f}from"./pm.Bl3hz9fF.js";import{D as p,E as le,O as ue,S as de,T as fe,_ as m,a as pe,c as me,d as he,f as h,g as ge,h as _e,k as ve,l as ye,m as g,n as be,p as xe,s as Se,t as Ce,u as we,y as _}from"./PmShared.BxTHKdjY.js";var v=e(t(),1),y=r(),Te=20,Ee=`tw.pm-bugs.page-size.v1`,De=[`all`,...d],Oe=[`all`,...f],ke=`pm.bugs.project`,Ae=`pm.bugs.iteration`,je=`pm.bugs.status`,Me=`pm.bugs.severity`,Ne=`pm.bugs.keyword`,b=f.map(e=>({value:e,label:u[e]})),x=d.map(e=>({value:e,label:s[e]}));function S(e=``){return{projectId:e,iterationId:``,requirementId:``,title:``,severity:`minor`,status:`pending`,reproduceSteps:``,expectedResult:``,actualResult:``,environment:``,githubIssue:``,attachment:``,remark:``}}function Pe(e){try{let t=new URL(e,`http://localhost`).searchParams.get(`p`)??``;return/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(t)}catch{return!1}}function C({scopeProjectId:e=``}={}){let t=!!e,r=ue(`bugs`),{store:d,live:f,loading:C,error:w,setError:T,reload:E}=ve(),[D,O]=p(ke,`all`),k=e||D,[A,j]=p(Ae,`all`),[M,Fe]=le(je,De,`all`),[N,Ie]=le(Me,Oe,`all`),[P,Le]=p(Ne),[Re,F]=(0,v.useState)(1),[I,ze]=te(Te,Ee),[L,R]=(0,v.useState)(null),[z,B]=(0,v.useState)(!1),[V,Be]=(0,v.useState)(!1),H=(0,v.useRef)(null),U=(0,v.useRef)(new Set),[W,G]=(0,v.useState)(null),[Ve,K]=(0,v.useState)(null),q=(0,v.useMemo)(()=>a(L?.attachment??``),[L?.attachment]);(0,v.useEffect)(()=>{for(let e of q)U.current.add(e.url)},[q]);let He=(0,v.useMemo)(()=>[{value:`all`,label:`全部项目`},...d.projects.map(e=>({value:e.id,label:e.name}))],[d.projects]),Ue=(0,v.useMemo)(()=>[{value:`all`,label:`全部迭代`},...d.iterations.filter(e=>k===`all`||e.projectId===k).map(e=>({value:e.id,label:e.name}))],[d.iterations,k]),We=(0,v.useMemo)(()=>{let e=new Map(d.projects.map(e=>[e.id,e.name]));return t=>e.get(t)??`—`},[d.projects]),Ge=(0,v.useMemo)(()=>{let e=new Map(d.iterations.map(e=>[e.id,e.name]));return t=>t?e.get(t)??`—`:`—`},[d.iterations]),J=(0,v.useMemo)(()=>ie(ae(d.bugs,{projectId:k,iterationId:A,status:M,severity:N,keyword:P})),[d.bugs,k,A,M,N,P]),Y=t?d.bugs.filter(e=>e.projectId===k).length:d.bugs.length,Ke=Math.max(1,Math.ceil(J.length/I)),X=Math.min(Re,Ke),Z=J.slice((X-1)*I,X*I);(0,v.useEffect)(()=>{t||f===!0&&D!==`all`&&!d.projects.some(e=>e.id===D)&&O(`all`)},[f,d.projects,D,O,t]),(0,v.useEffect)(()=>{f===!0&&A!==`all`&&!d.iterations.some(e=>e.id===A&&(k===`all`||e.projectId===k))&&j(`all`)},[f,d.iterations,k,A,j]);let qe=L?d.iterations.filter(e=>e.projectId===L.projectId):[],Je=L?d.requirements.filter(e=>e.projectId===L.projectId):[];async function Ye(){if(!L)return;if(!L.projectId){T(`请先选择所属项目`);return}let e=L.reproduceSteps.trim();if(!e){T(`缺陷描述不能为空`);return}let t=ce(e);B(!0);try{let n={projectId:L.projectId,iterationId:L.iterationId,requirementId:L.requirementId,title:t,severity:L.severity,status:L.status,reproduceSteps:e,expectedResult:L.expectedResult,actualResult:L.actualResult,environment:L.environment,githubIssue:L.githubIssue,attachment:L.attachment,remark:L.remark};L.id?await o(`bugs`,L.id,n):await se(`bugs`,[n]),R(null),U.current.clear(),T(``),await E(!0)}catch(e){T(e instanceof Error?e.message:String(e))}finally{B(!1)}}let Q=(0,v.useCallback)(async e=>{if(e&&e.length){Be(!0);try{let t=await re(Array.from(e));R(e=>{if(!e)return e;let n=a(e.attachment);return{...e,attachment:c([...n,...t])}}),T(``)}catch(e){T(e instanceof Error?e.message:String(e))}finally{Be(!1),H.current&&(H.current.value=``)}}},[T]),$=L!==null;(0,v.useEffect)(()=>{if(!$)return;let e=e=>{let t=Array.from(e.clipboardData?.files??[]);t.length&&(e.preventDefault(),Q(t))};return window.addEventListener(`paste`,e),()=>window.removeEventListener(`paste`,e)},[$,Q]);async function Xe(e){if(!L)return;let t=c(q.filter(t=>t.url!==e));if(L.id)try{await o(`bugs`,L.id,{attachment:t}),await E(!0)}catch(e){T(e instanceof Error?e.message:String(e));return}R(e=>e&&{...e,attachment:t}),l([e],L.id??``)}function Ze(){let e=[...U.current,...q.map(e=>e.url)];U.current.clear(),R(null),e.length&&l(e)}async function Qe(e,t){B(!0);try{await o(`bugs`,e.id,{status:t}),await E(!0)}catch(e){T(e instanceof Error?e.message:String(e))}finally{B(!1)}}async function $e(){let e=W;if(e){G(null),B(!0);try{await oe(`bugs`,[e.id]),await E(!0)}catch(e){T(e instanceof Error?e.message:String(e))}finally{B(!1)}}}if(!r.ready)return(0,y.jsx)(ge,{label:`正在读取插件开关`});if(!r.on)return(0,y.jsx)(m,{children:n(`bugs`)});if(f===null)return(0,y.jsx)(ge,{label:`正在连接项目管理服务`});if(!f)return(0,y.jsx)(m,{children:`缺陷管理需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`});if(d.projects.length===0&&!C&&!t)return(0,y.jsx)(m,{children:`还没有项目。请先在「项目列表」里新建一个项目,再回来记录缺陷。`});let et=[{value:`all`,label:`全部`},...x];return(0,y.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,y.jsxs)(`div`,{className:`text-xs text-stone-400`,children:[`共 `,(0,y.jsx)(`span`,{className:`font-medium text-stone-600`,children:Y}),` 条缺陷`,J.length===Y?``:` · 筛选出 ${J.length} 条`]}),(0,y.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[t?null:(0,y.jsx)(i,{flat:!0,showCheck:!1,ariaLabel:`按项目筛选缺陷`,className:`w-36`,options:He,value:D,onChange:e=>{O(e),j(`all`),F(1)}}),(0,y.jsx)(i,{flat:!0,showCheck:!1,ariaLabel:`按迭代筛选缺陷`,className:`w-32`,options:Ue,value:A,onChange:e=>{j(e),F(1)}}),(0,y.jsx)(i,{flat:!0,showCheck:!1,ariaLabel:`按严重程度筛选缺陷`,className:`w-32`,options:[{value:`all`,label:`全部严重程度`},...b],value:N,onChange:e=>{Ie(e),F(1)}}),(0,y.jsxs)(`label`,{className:`relative block`,children:[(0,y.jsx)(g,{name:`search`,size:14,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-stone-400`}),(0,y.jsx)(`input`,{value:P,onChange:e=>{Le(e.target.value),F(1)},placeholder:`搜索编号 / 标题…`,className:`h-9 w-48 rounded-lg border border-stone-200 bg-white pl-8 pr-3 text-sm text-stone-800 outline-none transition-colors focus:border-[#3370ff]`})]}),(0,y.jsxs)(`button`,{type:`button`,disabled:z,onClick:()=>R(S(k===`all`?``:k)),className:`inline-flex h-9 shrink-0 items-center gap-1.5 rounded-lg bg-[#3370ff] px-3 text-sm font-medium whitespace-nowrap text-white transition-colors hover:bg-[#2b5fd9] disabled:opacity-40`,children:[(0,y.jsx)(g,{name:`plus`,size:14}),`新建缺陷`]})]})]}),(0,y.jsx)(`div`,{className:`mt-3 flex shrink-0 flex-wrap items-center gap-2`,children:(0,y.jsx)(xe,{ariaLabel:`按状态筛选缺陷`,options:et,value:M,onChange:e=>{Fe(e),F(1)}})}),w?(0,y.jsx)(he,{message:w,onClose:()=>T(``)}):null,(0,y.jsxs)(`div`,{className:`mt-3 flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,y.jsxs)(`table`,{className:`tw-data-table w-full border-collapse text-sm`,children:[(0,y.jsx)(`thead`,{className:`tw-table-head sticky top-0 z-10 text-xs text-stone-500`,children:(0,y.jsxs)(`tr`,{children:[(0,y.jsx)(`th`,{className:`w-px px-4 py-2.5 text-left font-medium whitespace-nowrap`,children:`ID`}),(0,y.jsx)(`th`,{className:`px-4 py-2.5 text-left font-medium`,children:`缺陷标题`}),(0,y.jsx)(`th`,{className:`w-28 px-3 py-2.5 text-left font-medium whitespace-nowrap`,children:`严重程度`}),(0,y.jsx)(`th`,{className:`w-32 px-3 py-2.5 text-left font-medium whitespace-nowrap`,children:`缺陷状态`}),t?null:(0,y.jsx)(`th`,{className:`w-40 px-3 py-2.5 text-left font-medium whitespace-nowrap`,children:`所属项目`}),(0,y.jsx)(`th`,{className:`w-40 px-3 py-2.5 text-left font-medium whitespace-nowrap`,children:`所属迭代`}),(0,y.jsx)(`th`,{className:`w-24 px-3 py-2.5 text-center font-medium whitespace-nowrap`,children:`操作`})]})}),(0,y.jsxs)(`tbody`,{children:[C&&!d.bugs.length?(0,y.jsx)(`tr`,{children:(0,y.jsx)(`td`,{colSpan:t?6:7,className:`px-4 py-16 text-center`,children:(0,y.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):Z.length===0?(0,y.jsx)(`tr`,{children:(0,y.jsx)(`td`,{colSpan:t?6:7,children:Y?(0,y.jsx)(ye,{children:`没有符合筛选条件的缺陷。`}):(0,y.jsx)(we,{icon:`bug`,title:`暂无缺陷`,hint:`记录第一个缺陷,跟踪严重程度与修复状态。`,action:(0,y.jsxs)(`button`,{type:`button`,onClick:()=>R(S(k===`all`?``:k)),className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-stone-200 px-3 text-xs text-stone-600 transition-colors hover:bg-stone-50`,children:[(0,y.jsx)(g,{name:`plus`,size:13}),`新建缺陷`]})})})}):null,Z.map(e=>(0,y.jsxs)(`tr`,{className:`border-t border-stone-100 hover:bg-[#f7f8fa]`,children:[(0,y.jsx)(`td`,{className:`whitespace-nowrap px-4 py-2.5 font-mono text-xs text-stone-400`,children:e.autoId}),(0,y.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,y.jsx)(`button`,{type:`button`,onClick:()=>R({id:e.id,projectId:e.projectId,iterationId:e.iterationId,requirementId:e.requirementId,title:e.title,severity:e.severity,status:e.status,reproduceSteps:e.reproduceSteps||e.title,expectedResult:e.expectedResult,actualResult:e.actualResult,environment:e.environment,githubIssue:e.githubIssue,attachment:e.attachment,remark:e.remark}),className:`max-w-full truncate text-left text-stone-800 hover:text-[#3370ff]`,children:e.title})}),(0,y.jsx)(`td`,{className:`px-3 py-2.5`,children:(0,y.jsx)(de,{tone:Ce[e.severity],children:u[e.severity]})}),(0,y.jsx)(`td`,{className:`px-3 py-2.5`,children:(0,y.jsx)(i,{unstyled:!0,ariaLabel:`修改 ${e.title} 的状态`,disabled:z,options:x,value:e.status,onChange:t=>void Qe(e,t),renderOptionPrefix:e=>(0,y.jsx)(Se,{tone:be[e.value]}),renderTrigger:()=>(0,y.jsx)(de,{tone:be[e.status],children:s[e.status]})})}),t?null:(0,y.jsx)(`td`,{className:`truncate px-3 py-2.5 text-sm text-stone-600`,children:(0,y.jsx)(`a`,{href:fe(e.projectId),className:`transition-colors hover:text-[#3370ff]`,children:We(e.projectId)})}),(0,y.jsx)(`td`,{className:`truncate px-3 py-2.5 text-sm text-stone-500`,children:Ge(e.iterationId)}),(0,y.jsx)(`td`,{className:`px-3 py-2.5 text-center`,children:(0,y.jsx)(`button`,{type:`button`,"aria-label":`删除 ${e.title}`,disabled:z,onClick:()=>G(e),className:`inline-flex h-7 w-7 items-center justify-center rounded-md text-stone-300 transition-colors hover:bg-red-50 hover:text-red-600 disabled:opacity-40`,children:(0,y.jsx)(g,{name:`trash`,size:15})})})]},e.id))]})]})}),J.length>0?(0,y.jsx)(ne,{page:X,totalPages:Ke,pageSize:I,busy:z,onPage:F,onPageSize:e=>{ze(e),F(1)}}):null]}),(0,y.jsx)(me,{open:L!==null,title:L?.id?`编辑缺陷`:`新建缺陷`,busy:z,submitLabel:L?.id?`保存`:`创建`,onClose:Ze,onSubmit:()=>void Ye(),children:L?(0,y.jsxs)(`div`,{className:`space-y-1`,children:[t?null:(0,y.jsx)(h,{label:`所属项目`,required:!0,children:(0,y.jsx)(_,{ariaLabel:`所属项目`,options:d.projects.map(e=>({value:e.id,label:e.name})),value:L.projectId,onChange:e=>R({...L,projectId:e,iterationId:``,requirementId:``})})}),(0,y.jsx)(h,{label:`所属迭代`,children:(0,y.jsx)(_,{ariaLabel:`所属迭代`,options:[{value:``,label:`不关联迭代`},...qe.map(e=>({value:e.id,label:e.name}))],value:L.iterationId,onChange:e=>R({...L,iterationId:e}),disabled:qe.length===0})}),(0,y.jsx)(h,{label:`关联需求`,children:(0,y.jsx)(_,{ariaLabel:`关联需求`,options:[{value:``,label:`不关联需求`},...Je.map(e=>({value:e.id,label:`${e.autoId} ${e.title}`}))],value:L.requirementId,onChange:e=>R({...L,requirementId:e}),disabled:Je.length===0})}),(0,y.jsx)(h,{label:`缺陷描述`,required:!0,children:(0,y.jsx)(`textarea`,{autoFocus:!0,value:L.reproduceSteps,onChange:e=>R({...L,reproduceSteps:e.target.value}),placeholder:`描述问题现象、复现步骤与影响范围`,rows:5,className:pe})}),(0,y.jsx)(h,{label:`严重程度`,children:(0,y.jsx)(_,{ariaLabel:`严重程度`,options:b,value:L.severity,onChange:e=>R({...L,severity:e}),renderOptionPrefix:e=>(0,y.jsx)(Se,{tone:Ce[e.value]})})}),(0,y.jsx)(h,{label:`附件`,children:(0,y.jsxs)(`div`,{className:`space-y-2`,children:[q.length?(0,y.jsx)(`ul`,{className:`space-y-1.5`,children:q.map(e=>{let t=Pe(e.url);return(0,y.jsxs)(`li`,{className:`flex items-center gap-2 rounded-lg border border-stone-200 px-2 py-1.5`,children:[t?(0,y.jsx)(`button`,{type:`button`,onClick:()=>K(e),"aria-label":`预览附件 ${e.name}`,className:`shrink-0 cursor-zoom-in`,children:(0,y.jsx)(`img`,{src:e.url,alt:e.name,className:`h-9 w-9 rounded-md border border-stone-100 object-cover`})}):(0,y.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-stone-100 text-stone-400`,children:(0,y.jsx)(g,{name:`file`,size:15})}),t?(0,y.jsx)(`button`,{type:`button`,onClick:()=>K(e),className:`min-w-0 flex-1 truncate text-left text-sm text-stone-700 hover:text-[#3370ff]`,children:e.name}):(0,y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`min-w-0 flex-1 truncate text-sm text-stone-700 hover:text-[#3370ff]`,children:e.name}),(0,y.jsx)(`button`,{type:`button`,"aria-label":`移除附件 ${e.name}`,onClick:()=>Xe(e.url),className:`flex h-6 w-6 shrink-0 items-center justify-center rounded text-stone-300 hover:bg-red-50 hover:text-red-600`,children:`✕`})]},e.url)})}):null,(0,y.jsx)(`input`,{ref:H,type:`file`,multiple:!0,className:`hidden`,onChange:e=>void Q(e.target.files)}),(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsxs)(`button`,{type:`button`,disabled:V,onClick:()=>H.current?.click(),className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-dashed border-stone-300 px-2.5 text-xs text-stone-500 transition-colors hover:border-stone-400 hover:text-stone-700 disabled:opacity-40`,children:[(0,y.jsx)(g,{name:V?`file`:`plus`,size:13}),V?`上传中…`:`上传文件 / 图片`]}),(0,y.jsx)(`span`,{className:`text-xs text-stone-400`,children:`可直接粘贴截图 / 图片(⌘V / Ctrl+V),支持多张`})]})]})}),(0,y.jsx)(h,{label:`备注`,children:(0,y.jsx)(`textarea`,{value:L.remark,onChange:e=>R({...L,remark:e.target.value}),rows:2,className:pe})})]}):null}),(0,y.jsx)(ee,{open:W!==null,title:`删除缺陷`,message:`确定删除「${W?.title??``}」?此操作无法恢复。`,confirmLabel:`删除`,danger:`solid`,onClose:()=>G(null),onConfirm:()=>void $e()}),(0,y.jsx)(_e,{file:Ve,onClose:()=>K(null)})]})}export{C as default};