lantern-harness 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/CHANGELOG.md +106 -0
  2. package/README.md +9 -9
  3. package/builtin/session/lh-nav-groups.mjs +106 -9
  4. package/builtin/session/lh-spaces.mjs +102 -0
  5. package/cli/data-root.mjs +110 -3
  6. package/cli/lantern.mjs +36 -7
  7. package/cli/server.mjs +8 -0
  8. package/cli/spaces.mjs +91 -5
  9. package/config/app.defaults.json +7 -2
  10. package/dist/500.html +19 -5
  11. package/dist/_astro/Base.C_AmDbI9.css +1 -0
  12. package/dist/_astro/{Base.astro_astro_type_script_index_0_lang.lxEwQ1R4.js → Base.astro_astro_type_script_index_0_lang.-g0SuFCa.js} +1 -1
  13. package/dist/_astro/CaseExecBoard.CNZh0sre.js +1 -0
  14. package/dist/_astro/CaseGenerateApp.BQalnGiC.js +9 -0
  15. package/dist/_astro/CasesLibrary.u7ek8rOp.js +1 -0
  16. package/dist/_astro/ChatApp.Dk5uOXr0.js +273 -0
  17. package/dist/_astro/ColumnResize.Bs6GL3DJ.js +1 -0
  18. package/dist/_astro/ConfirmDialog.Dbyjb4-6.js +1 -0
  19. package/dist/_astro/DatePicker.CMfX7F6z.js +1 -0
  20. package/dist/_astro/DocsFileBrowser.CHVgH1vj.js +1 -0
  21. package/dist/_astro/DocsPager.DaiWchhj.js +1 -0
  22. package/dist/_astro/DrawerField.KANqQwFl.js +1 -0
  23. package/dist/_astro/KnowledgeLibrary.DSxgeW4L.js +1 -0
  24. package/dist/_astro/NamePromptDialog.DZSZ5Y16.js +1 -0
  25. package/dist/_astro/NavLibraries.BN5smOBt.js +1 -0
  26. package/dist/_astro/PluginsPage.BB18crT3.js +1 -0
  27. package/dist/_astro/PluginsPage.Oh8hWup8.js +39 -0
  28. package/dist/_astro/PromptsLibrary.DWgox1du.js +1 -0
  29. package/dist/_astro/ReportsPage.BlHA_AtE.js +1 -0
  30. package/dist/_astro/RequirementsLibrary.2o-KMk7K.js +1 -0
  31. package/dist/_astro/SearchableSelect.BMl1Bp59.js +1 -0
  32. package/dist/_astro/SelectDropdown.flhHcwyd.js +1 -0
  33. package/dist/_astro/SettingsDialog.Cs8z0Hhb.js +1 -0
  34. package/dist/_astro/SpaceSwitcher.DicPqrSH.js +7 -0
  35. package/dist/_astro/TagSelect.u8DTop7v.js +1 -0
  36. package/dist/_astro/TasksBoard.dgJxOpVG.js +1 -0
  37. package/dist/_astro/TemplatesLibrary.BfC9HIuu.js +1 -0
  38. package/dist/_astro/TestStatsBoard.Dg23e0O_.js +1 -0
  39. package/dist/_astro/TodosBoard.CyvTZybr.js +1 -0
  40. package/dist/_astro/active-element-history.CeefGkFQ.js +1 -0
  41. package/dist/_astro/app-config.Crg0VdkS.js +1 -0
  42. package/dist/_astro/case-exec.HjGrOY_O.js +1 -0
  43. package/dist/_astro/doc-roots.DAJP9Svr.js +1 -0
  44. package/dist/_astro/i18n.C8FKLrB5.js +7 -0
  45. package/dist/_astro/listbox.Di-t5U37.js +1 -0
  46. package/dist/_astro/menu.Bkluqxic.js +1 -0
  47. package/dist/_astro/{open-docs-in-session.D3JCwMWB.js → open-docs-in-session.BC5D-BoF.js} +1 -1
  48. package/dist/_astro/plugins.CNOYmeAe.js +1 -0
  49. package/dist/_astro/portal.Cm9XlIPf.js +5 -0
  50. package/dist/_astro/project-docs.Cd2gKPKh.js +1 -0
  51. package/dist/_astro/report-prompt.Cmw4XzfY.js +1 -0
  52. package/dist/_astro/{settings.BoQ0e0m1.js → settings.DBIYsQY-.js} +2 -2
  53. package/dist/_astro/tasks.WhfT-DnC.js +1 -0
  54. package/dist/_astro/test-stats.BIHEJz5c.js +1 -0
  55. package/dist/_astro/use-text-value.BuY0Cm1z.js +1 -0
  56. package/dist/_astro/use-tree-walker.CfTHFX43.js +1 -0
  57. package/dist/_astro/useListAnim.CpGB1cft.js +1 -0
  58. package/dist/_astro/view-prefs.C9Mtta1E.js +1 -0
  59. package/dist/case-exec/index.html +263 -0
  60. package/dist/cases/generate/index.html +20 -6
  61. package/dist/cases/library/index.html +20 -6
  62. package/dist/docs/changelog/index.html +121 -6
  63. package/dist/docs/install/index.html +35 -11
  64. package/dist/docs/manual/index.html +149 -14
  65. package/dist/index.html +20 -6
  66. package/dist/knowledge/index.html +20 -6
  67. 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 +19 -5
  68. package/dist/plugins/index.html +20 -6
  69. package/dist/prompts/index.html +20 -6
  70. package/dist/reports/index.html +263 -0
  71. package/dist/requirements/index.html +20 -6
  72. package/dist/tasks/index.html +263 -0
  73. package/dist/templates/index.html +20 -6
  74. 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 +19 -5
  75. 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 +19 -5
  76. 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 +19 -5
  77. 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 +19 -5
  78. 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 +19 -5
  79. package/dist/test-stats/index.html +263 -0
  80. package/dist/todos/index.html +263 -0
  81. package/docs//345/205/250/345/261/200/346/217/222/344/273/266.md +2 -2
  82. package/docs//345/256/211/350/243/205/346/211/213/345/206/214.md +13 -11
  83. package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +125 -26
  84. package/lh-plugins/lh-project-docs.mjs +3 -1
  85. package/lh-plugins/lh-reports.mjs +413 -0
  86. package/lh-plugins/lh-stats.mjs +409 -0
  87. package/lh-plugins/lh-tasks.mjs +224 -0
  88. package/lh-plugins/lh-todos.mjs +295 -0
  89. package/lh-plugins/lh-work-store.mjs +81 -0
  90. package/lh-plugins/storage-domain.mjs +54 -3
  91. package/package.json +2 -1
  92. package/config/seeds//346/217/220/347/244/272/350/257/215/347/256/241/347/220/206//345/212/237/350/203/275/346/265/213/350/257/225/347/224/250/344/276/213/346/217/220/347/244/272/350/257/215v1.0.md +0 -155
  93. package/dist/_astro/Base.B9f_iFAZ.css +0 -1
  94. package/dist/_astro/CaseGenerateApp.Br4uKjun.js +0 -9
  95. package/dist/_astro/CasesLibrary.CpPoVQ4P.js +0 -1
  96. package/dist/_astro/ChatApp.CYSPlSNP.js +0 -258
  97. package/dist/_astro/ConfirmDialog.BYz4HREM.js +0 -1
  98. package/dist/_astro/DocsFileBrowser.DkE26UTR.js +0 -1
  99. package/dist/_astro/KnowledgeLibrary.DZinlAWn.js +0 -1
  100. package/dist/_astro/NamePromptDialog.DGBlDH_k.js +0 -1
  101. package/dist/_astro/NavLibraries.EayBsg5g.js +0 -1
  102. package/dist/_astro/PluginsPage.BNzpPg2H.js +0 -39
  103. package/dist/_astro/PluginsPage.CY61glLU.js +0 -1
  104. package/dist/_astro/PromptsLibrary.DfrrCjs7.js +0 -1
  105. package/dist/_astro/RequirementsLibrary.Dt0Gj6Nr.js +0 -1
  106. package/dist/_astro/SearchableSelect.DMS2XmXc.js +0 -1
  107. package/dist/_astro/SelectDropdown.Dc7QaPbH.js +0 -1
  108. package/dist/_astro/SettingsDialog.DC0e7580.js +0 -1
  109. package/dist/_astro/SpaceSwitcher.Yy2w8MDF.js +0 -7
  110. package/dist/_astro/TemplatesLibrary.uK-SjK1z.js +0 -1
  111. package/dist/_astro/app-config.CpjKWnzM.js +0 -1
  112. package/dist/_astro/i18n.BVvhz-vw.js +0 -7
  113. package/dist/_astro/listbox.DdDDDJ5Z.js +0 -1
  114. package/dist/_astro/menu.CqkL87bV.js +0 -1
  115. package/dist/_astro/plugins.CrpY8UI9.js +0 -1
  116. package/dist/_astro/portal.C3KrUREL.js +0 -5
  117. package/dist/_astro/use-text-value.C0IDspmh.js +0 -1
  118. package/dist/_astro/use-tree-walker.oRTnhHS-.js +0 -1
  119. package/dist/_astro/useListAnim.CnbC_9MC.js +0 -1
@@ -1 +0,0 @@
1
- import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{a as n,i as r,n as i,s as ee}from"./app-config.CpjKWnzM.js";import{i as te}from"./llm.BZEzE0x2.js";import{_ as ne,a,c as re,d as ie,g as ae,h as oe,i as se,l as o,n as s,o as ce,r as le,s as c,t as l,u as ue,v as de}from"./settings.BoQ0e0m1.js";import{t as u}from"./jsx-runtime.BUXbF_vF.js";import{i as fe,n as pe,r as me,t as he}from"./listbox.DdDDDJ5Z.js";import{o as ge,s as _e,t as ve}from"./ConfirmDialog.BYz4HREM.js";import{n as d}from"./i18n.BVvhz-vw.js";var f=e(t(),1),ye=`0.1.2`,p=u();function be(e){try{return new URL(e).host}catch{return``}}var xe=[{value:`zh-CN`,label:`中文`},{value:`en`,label:`English`}],m=`w-full px-3 py-2 text-sm border border-stone-300 rounded-lg bg-white focus:outline-none focus:ring-2 focus:ring-[#4176e6]/35 focus:border-[#4176e6] transition-colors`,h=`inline-flex items-center gap-1.5 h-9 min-w-30 px-3 rounded-lg bg-stone-100 text-sm text-stone-700 hover:bg-stone-200/80 transition-colors outline-none focus:outline-none`;function Se({className:e=`w-3.5 h-3.5`}){return(0,p.jsx)(`svg`,{className:e,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,children:(0,p.jsx)(`path`,{d:`M6 8l4 4 4-4`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function g({className:e=`w-4 h-4`}){return(0,p.jsx)(`svg`,{className:e,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,p.jsx)(`path`,{d:`M5 10.5l3.5 3.5L15 6.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function Ce({className:e=`w-4 h-4`}){return(0,p.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,p.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,p.jsx)(`path`,{d:`M12 1v2M12 21v2M4.2 4.2l1.4 1.4M18.4 18.4l1.4 1.4M1 12h2M21 12h2M4.2 19.8l1.4-1.4M18.4 5.6l1.4-1.4`})]})}function we({className:e=`w-4 h-4`}){return(0,p.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,p.jsx)(`ellipse`,{cx:`12`,cy:`5`,rx:`8`,ry:`3`}),(0,p.jsx)(`path`,{d:`M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5`}),(0,p.jsx)(`path`,{d:`M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6`})]})}function Te({kind:e}){let t=`w-5 h-5`;return e===`sun`?(0,p.jsxs)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,p.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,p.jsx)(`path`,{d:`M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4`})]}):e===`moon`?(0,p.jsx)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,p.jsx)(`path`,{d:`M21 14.5A8.5 8.5 0 1 1 9.5 3a7 7 0 0 0 11.5 11.5z`})}):(0,p.jsxs)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,p.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`12`,rx:`2`}),(0,p.jsx)(`path`,{d:`M8 20h8M12 16v4`})]})}function _({title:e,description:t,control:n}){return(0,p.jsxs)(`div`,{className:`flex items-center gap-4 py-4 border-b border-stone-100 last:border-b-0`,children:[(0,p.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,p.jsx)(`div`,{className:`text-sm font-medium text-stone-800`,children:e}),t?(0,p.jsx)(`div`,{className:`mt-0.5 text-xs text-stone-400 leading-5`,children:t}):null]}),(0,p.jsx)(`div`,{className:`shrink-0`,children:n})]})}function v({value:e,options:t,onChange:n}){let r=t.find(t=>t.value===e)?.label??e;return(0,p.jsxs)(me,{value:e,onChange:n,children:[(0,p.jsxs)(fe,{className:h,children:[(0,p.jsx)(`span`,{className:`flex-1 text-left truncate`,children:r}),(0,p.jsx)(Se,{className:`w-3.5 h-3.5 text-stone-400 shrink-0`})]}),(0,p.jsx)(he,{transition:!0,anchor:{to:`bottom end`,gap:6},className:`tw-select-menu tw-menu-anim z-60 min-w-40 rounded-xl py-1 shadow-lg ring-1 ring-stone-200 focus:outline-none`,children:t.map(e=>(0,p.jsxs)(pe,{value:e.value,className:`group cursor-pointer select-none flex items-center justify-between gap-3 px-3 py-2 text-sm text-stone-700 data-[focus]:bg-stone-50 data-[selected]:text-stone-900`,children:[(0,p.jsx)(`span`,{children:e.label}),(0,p.jsx)(g,{className:`w-4 h-4 text-[#4176e6] opacity-0 group-data-[selected]:opacity-100 shrink-0`})]},e.value))})]})}function y(){let[e,t]=(0,f.useState)(!1),[u,h]=(0,f.useState)(`general`),[y,b]=(0,f.useState)([]),[x,S]=(0,f.useState)(``),[C,w]=(0,f.useState)(null),[T,E]=(0,f.useState)(``),[Ee,D]=(0,f.useState)(`DeepSeek`),[O,k]=(0,f.useState)(``),[A,j]=(0,f.useState)(``),[M,N]=(0,f.useState)(``),[P,F]=(0,f.useState)([]),[I,L]=(0,f.useState)(`idle`),[De,R]=(0,f.useState)(!1),[Oe,z]=(0,f.useState)(`readonly`),[ke,Ae]=(0,f.useState)(!1),[je,B]=(0,f.useState)(!1),[Me,V]=(0,f.useState)(null),[H,U]=(0,f.useState)({language:`zh-CN`,appearance:`system`,sessionFontSize:14,toolStepDetail:`standard`,busySendBehavior:`queue`,subagentModel:``}),[W,G]=(0,f.useState)(`14`),K=(0,f.useRef)(0),q=C!==null,J=H.language,Y=y.find(e=>e.id===x),X=(Y?.name||``).trim(),Ne=X||(J===`en`?`No model`:`未配置`),Pe=X?Y?.model?.trim()?`${X} · ${Y.model.trim()}`:X:J===`en`?`No model configured`:`未配置模型`;function Fe(e=`general`){h(e),r().then(()=>{Z(),t(!0)})}function Z(){Ae(n()),b(re()),S(a()),B(!!o()),U(c()),le(c()),z(ce()),w(null)}function Ie(e){if(!e){let e=ee();w(e),E(`DeepSeek`),D(`DeepSeek`),k(`https://api.deepseek.com/v1`),j(``),N(``),F([]),L(`idle`),R(!1);return}w(e.id),E(e.name),k(e.baseURL);let t=e.apiKey?.trim()||(e.id===a()?i().trim():``)||``;j(t),N(e.model),F(e.availableModels??[]),L(e.availableModels?.length?`ok`:`idle`),D(s.find(t=>t.baseURL===e.baseURL)?.label??`自定义`),R(!1)}(0,f.useEffect)(()=>{r().then(()=>Z());let e=e=>{let n=e.detail;h(n?.tab===`model`?`model`:`general`),r().then(()=>{Z(),t(!0)})};window.addEventListener(l,e);let n=ie(e=>U(e)),i=ue(e=>z(e));return()=>{window.removeEventListener(l,e),n(),i()}},[]),(0,f.useEffect)(()=>{if(!e||u!==`model`||!q)return;let t=O.trim(),n=A.trim();if(!t||!n){L(e=>e===`ok`?`ok`:`idle`);return}L(`loading`);let r=++K.current,i=setTimeout(()=>{te(t,n).then(e=>{r===K.current&&(F(e),L(`ok`))}).catch(()=>{r===K.current&&L(`fail`)})},800);return()=>clearTimeout(i)},[e,u,q,O,A]);function Le(e){D(e);let t=s.find(t=>t.label===e);t&&(t.baseURL&&k(t.baseURL),(!T.trim()||s.some(e=>e.label===T))&&E(t.label)),N(``)}function Q(e){U(ae(e))}(0,f.useEffect)(()=>{G(String(H.sessionFontSize))},[H.sessionFontSize]);function Re(){let e=Number(W);if(!W.trim()||!Number.isFinite(e)){G(String(H.sessionFontSize));return}let t=ae({sessionFontSize:Math.round(e)});U(t),G(String(t.sessionFontSize))}let ze=!!(T.trim()&&O.trim()&&A.trim()&&M.trim()),$=P.length>0;function Be(){if(!ze||!C)return;let e=de({id:C,name:T.trim(),baseURL:O.trim(),apiKey:A.trim(),model:M.trim(),availableModels:$?P:void 0},{activate:!0});b(e),S(C),w(null),B(!!o())}function Ve(e){V(e)}function He(){let e=Me;if(!e)return;V(null);let t=se(e);b(t),S(a()),C===e&&w(null),B(!!o())}function Ue(e){ne(e),S(e),B(!!o())}let We=[{value:`readonly`,label:d(`settings.access.readonly`,void 0,J)},{value:`readwrite`,label:d(`settings.access.readwrite`,void 0,J)},{value:`full`,label:d(`settings.access.full`,void 0,J)}],Ge=[{value:`concise`,label:d(`settings.step.concise`,void 0,J)},{value:`standard`,label:d(`settings.step.standard`,void 0,J)},{value:`detailed`,label:d(`settings.step.detailed`,void 0,J)},{value:`full`,label:d(`settings.step.full`,void 0,J)}],Ke=[{value:`queue`,label:d(`settings.busySend.queue`,void 0,J)},{value:`interrupt`,label:d(`settings.busySend.interrupt`,void 0,J)}],qe=[{value:`light`,label:d(`settings.appear.light`,void 0,J),icon:`sun`},{value:`dark`,label:d(`settings.appear.dark`,void 0,J),icon:`moon`},{value:`system`,label:d(`settings.appear.system`,void 0,J),icon:`monitor`}],Je=[{id:`general`,label:d(`settings.general`,void 0,J),icon:(0,p.jsx)(Ce,{})},{id:`model`,label:d(`settings.model`,void 0,J),icon:(0,p.jsx)(we,{})}],Ye=u===`general`?d(`settings.general`,void 0,J):q?y.some(e=>e.id===C)?d(`settings.editProvider`,void 0,J):d(`settings.addProviderTitle`,void 0,J):d(`settings.model`,void 0,J);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`div`,{className:`tw-nav-foot-row`,children:[(0,p.jsxs)(`button`,{type:`button`,onClick:()=>Fe(`general`),className:`tw-nav-settings-btn`,"data-hint":je?`设置(已配置模型)`:`设置`,children:[(0,p.jsxs)(`svg`,{className:`tw-nav-ico w-4.5 h-4.5 shrink-0`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":`true`,children:[(0,p.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,p.jsx)(`path`,{d:`M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9c.2.6.7 1 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z`})]}),(0,p.jsx)(`span`,{"data-i18n":`nav.settings`,children:d(`nav.settings`,void 0,J)})]}),(0,p.jsxs)(`button`,{type:`button`,className:`tw-nav-provider-chip${X?``:` is-empty`}`,"data-hint":Pe,onClick:()=>Fe(`model`),children:[(0,p.jsx)(`span`,{className:`tw-nav-provider-dot`,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:`tw-nav-provider-name`,children:Ne})]})]}),(0,p.jsx)(ge,{show:e,children:(0,p.jsxs)(`div`,{className:`fixed inset-0 z-110 flex items-center justify-center p-4`,children:[(0,p.jsx)(_e,{children:(0,p.jsx)(`div`,{className:`tw-dialog-backdrop-anim absolute inset-0 bg-stone-950/45`,onClick:()=>t(!1),"aria-hidden":`true`})}),(0,p.jsx)(_e,{children:(0,p.jsxs)(`div`,{className:`tw-settings-dialog tw-dialog-panel-anim relative bg-white rounded-2xl shadow-2xl w-full max-w-3xl h-[min(92vh,720px)] overflow-hidden flex flex-col`,children:[(0,p.jsxs)(`div`,{className:`shrink-0 h-12 px-4 flex items-center justify-between border-b border-stone-100 bg-white`,children:[(0,p.jsx)(`h2`,{className:`text-sm font-semibold text-stone-800 truncate pr-3`,children:Ye}),(0,p.jsx)(`button`,{type:`button`,"aria-label":d(`settings.close`,void 0,J),onClick:()=>t(!1),className:`w-8 h-8 inline-flex items-center justify-center rounded-lg text-stone-400 hover:text-stone-700 hover:bg-stone-100 transition-colors`,children:(0,p.jsx)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,p.jsx)(`path`,{d:`M5 5l10 10M15 5L5 15`,strokeLinecap:`round`})})})]}),(0,p.jsxs)(`div`,{className:`flex-1 min-h-0 flex`,children:[(0,p.jsx)(`aside`,{className:`w-38 shrink-0 border-r border-stone-100 bg-[#f4f5f7] py-3 px-2 space-y-0.5`,children:Je.map(e=>{let t=u===e.id;return(0,p.jsxs)(`button`,{type:`button`,onClick:()=>{h(e.id),e.id===`model`&&w(null)},className:`w-full flex items-center gap-2 px-3 py-2.5 rounded-lg text-sm transition-colors ${t?`bg-[#e8f0fe] text-[#4176e6] font-medium`:`text-stone-600 hover:bg-white/70 hover:text-stone-800`}`,children:[(0,p.jsx)(`span`,{className:t?`text-[#4176e6]`:`text-stone-400`,children:e.icon}),e.label]},e.id)})}),(0,p.jsx)(`div`,{className:`flex-1 min-w-0 flex flex-col min-h-0 bg-white`,children:u===`general`?(0,p.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:[(0,p.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-1`,children:[(0,p.jsx)(_,{title:d(`settings.access`,void 0,J),description:d(`settings.accessDesc`,void 0,J),control:(0,p.jsx)(v,{value:Oe,options:We,onChange:e=>{z(e),oe(e)}})}),(0,p.jsx)(_,{title:d(`settings.language`,void 0,J),control:(0,p.jsx)(v,{value:H.language,options:xe,onChange:e=>Q({language:e})})}),(0,p.jsxs)(`div`,{className:`py-4 border-b border-stone-100`,children:[(0,p.jsx)(`div`,{className:`text-sm font-medium text-stone-800 mb-3`,children:d(`settings.appearance`,void 0,J)}),(0,p.jsx)(`div`,{className:`grid grid-cols-3 gap-2.5`,children:qe.map(e=>{let t=H.appearance===e.value;return(0,p.jsxs)(`button`,{type:`button`,onClick:()=>Q({appearance:e.value}),className:`flex flex-col items-center justify-center gap-2 h-19 rounded-xl border transition-colors ${t?`border-[#4176e6] bg-[#edf3fe] text-[#4176e6] ring-1 ring-[#4176e6]/30`:`border-stone-200 text-stone-500 hover:border-stone-300 hover:bg-stone-50`}`,children:[(0,p.jsx)(Te,{kind:e.icon}),(0,p.jsx)(`span`,{className:`text-xs font-medium`,children:e.label})]},e.value)})})]}),(0,p.jsx)(_,{title:d(`settings.fontSize`,void 0,J),description:d(`settings.fontSizeDesc`,void 0,J),control:(0,p.jsxs)(`div`,{className:`inline-flex items-center gap-1.5`,children:[(0,p.jsx)(`input`,{type:`number`,min:12,max:22,value:W,onChange:e=>G(e.target.value),onBlur:Re,onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},className:`w-14 h-9 px-2 text-sm text-center rounded-lg bg-stone-100 border-0 outline-none focus:ring-2 focus:ring-[#4176e6]/30`}),(0,p.jsx)(`span`,{className:`text-sm text-stone-400`,children:`px`})]})}),(0,p.jsx)(_,{title:d(`settings.toolSteps`,void 0,J),description:d(`settings.toolStepsDesc`,void 0,J),control:(0,p.jsx)(v,{value:H.toolStepDetail,options:Ge,onChange:e=>Q({toolStepDetail:e})})}),(0,p.jsx)(_,{title:d(`settings.busySend`,void 0,J),description:d(`settings.busySendDesc`,void 0,J),control:(0,p.jsx)(v,{value:H.busySendBehavior,options:Ke,onChange:e=>Q({busySendBehavior:e})})}),(0,p.jsx)(_,{title:d(`settings.subagentModel`,void 0,J),description:d(`settings.subagentModelDesc`,void 0,J),control:(0,p.jsx)(v,{value:H.subagentModel?.trim()?H.subagentModel:`inherit`,options:[{value:`inherit`,label:d(`settings.subagentModel.inherit`,void 0,J)},...Array.from(new Set([...Y?.availableModels??[],...Y?.model?[Y.model]:[]])).filter(Boolean).map(e=>({value:e,label:e}))],onChange:e=>Q({subagentModel:e===`inherit`?``:e})})})]}),(0,p.jsxs)(`div`,{className:`shrink-0 px-6 py-3 border-t border-stone-100 flex items-center justify-between text-[11px] text-stone-400`,children:[(0,p.jsx)(`span`,{children:d(`settings.platformVersion`,void 0,J)}),(0,p.jsxs)(`span`,{className:`tabular-nums text-stone-500`,children:[`v`,ye]})]})]}):q?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`div`,{className:`shrink-0 px-5 pt-3 pb-2 flex items-center gap-2 border-b border-stone-100`,children:(0,p.jsx)(`button`,{type:`button`,onClick:()=>w(null),className:`text-sm text-stone-500 hover:text-stone-800`,children:d(`settings.back`,void 0,J)})}),(0,p.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-5 py-4 space-y-4`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:d(`settings.displayName`,void 0,J)}),(0,p.jsx)(`input`,{type:`text`,value:T,onChange:e=>E(e.target.value),placeholder:`DeepSeek`,className:m})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:d(`settings.preset`,void 0,J)}),(0,p.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:s.map(e=>{let t=Ee===e.label;return(0,p.jsxs)(`button`,{type:`button`,onClick:()=>Le(e.label),className:`text-left px-3 py-2 rounded-lg border transition-colors ${t?`border-[#4176e6] bg-[#edf3fe] ring-1 ring-[#4176e6]/30`:`border-stone-200 hover:border-stone-300 hover:bg-stone-50`}`,children:[(0,p.jsx)(`div`,{className:`text-sm ${t?`text-[#3565c7] font-medium`:`text-stone-700`}`,children:e.label}),(0,p.jsx)(`div`,{className:`text-[11px] text-stone-400 truncate`,children:e.baseURL?be(e.baseURL):`OpenAI compatible`})]},e.label)})})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:d(`settings.baseUrl`,void 0,J)}),(0,p.jsx)(`input`,{type:`text`,value:O,onChange:e=>k(e.target.value),placeholder:`https://api.deepseek.com/v1`,className:m})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:d(`settings.apiKey`,void 0,J)}),(0,p.jsxs)(`div`,{className:`relative`,children:[(0,p.jsx)(`input`,{type:De?`text`:`password`,value:A,onChange:e=>j(e.target.value),placeholder:`sk-...`,className:`${m} pr-14`}),(0,p.jsx)(`button`,{type:`button`,onClick:()=>R(e=>!e),className:`absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-stone-400 hover:text-stone-600 px-1.5 py-1`,children:De?J===`en`?`Hide`:`隐藏`:J===`en`?`Show`:`显示`})]}),ke?(0,p.jsx)(`p`,{className:`mt-1.5 text-[11px] text-stone-400 leading-5`,children:d(`settings.keyHint`,void 0,J)}):null]}),(0,p.jsxs)(`div`,{children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5`,children:[(0,p.jsx)(`label`,{className:`text-xs font-medium text-stone-500`,children:d(`settings.modelField`,void 0,J)}),I===`loading`&&(0,p.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:d(`settings.recognizing`,void 0,J)}),$&&I===`ok`&&(0,p.jsx)(`span`,{className:`text-[11px] text-emerald-600`,children:d(`settings.recognized`,{n:P.length},J)}),I===`fail`&&!$&&(0,p.jsx)(`span`,{className:`text-[11px] text-amber-600`,children:d(`settings.recognizeFail`,void 0,J)}),I===`fail`&&$&&(0,p.jsx)(`span`,{className:`text-[11px] text-amber-600`,children:d(`settings.recognizeKeep`,void 0,J)})]}),$?(0,p.jsxs)(me,{value:M,onChange:N,children:[(0,p.jsxs)(fe,{className:`${m} flex items-center justify-between text-left hover:border-stone-400 cursor-pointer`,children:[(0,p.jsx)(`span`,{className:`truncate text-stone-800`,children:M||(J===`en`?`Select a model`:`请选择模型`)}),(0,p.jsx)(Se,{className:`w-4 h-4 shrink-0 ml-2 text-stone-400`})]}),(0,p.jsx)(he,{transition:!0,anchor:{to:`bottom start`,gap:6},className:`tw-select-menu tw-menu-anim z-60 w-(--button-width) max-h-60 overflow-auto rounded-lg py-1 shadow-lg ring-1 ring-stone-200 focus:outline-none`,children:P.map(e=>(0,p.jsxs)(pe,{value:e,className:`group cursor-pointer select-none flex items-center justify-between px-3 py-2 text-sm text-stone-700 data-[focus]:bg-[#edf3fe] data-[selected]:text-[#3565c7] data-[selected]:font-medium`,children:[(0,p.jsx)(`span`,{className:`truncate`,children:e}),(0,p.jsx)(g,{className:`w-4 h-4 text-[#4176e6] opacity-0 group-data-[selected]:opacity-100 shrink-0 ml-2`})]},e))})]}):(0,p.jsx)(`input`,{type:`text`,value:M,onChange:e=>N(e.target.value),placeholder:d(`settings.modelPlaceholder`,void 0,J),className:m})]})]}),(0,p.jsxs)(`div`,{className:`shrink-0 px-5 py-3.5 bg-stone-50 border-t border-stone-100 flex justify-end gap-2`,children:[(0,p.jsx)(`button`,{type:`button`,onClick:()=>w(null),className:`px-3.5 py-1.5 text-sm text-stone-600 hover:bg-stone-200/60 rounded-lg`,children:d(`settings.cancel`,void 0,J)}),(0,p.jsx)(`button`,{type:`button`,onClick:Be,disabled:!ze,className:`px-3.5 py-1.5 text-sm font-medium text-white bg-[#4176e6] hover:bg-[#3565c7] rounded-lg disabled:opacity-40 disabled:cursor-not-allowed`,children:d(`settings.save`,void 0,J)})]})]}):(0,p.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-5 bg-[#f4f5f7]`,children:[(0,p.jsx)(`p`,{className:`text-sm text-stone-500`,children:d(`settings.modelIntro`,void 0,J)}),(0,p.jsxs)(`div`,{className:`mt-5 space-y-2.5`,children:[y.map(e=>{let t=!!(e.apiKey?.trim()&&e.baseURL.trim()&&e.model.trim()),n=e.id===x;return(0,p.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-stone-200/90 bg-white px-4 py-3.5 shadow-[0_1px_0_rgba(15,23,42,0.02)]`,children:[(0,p.jsxs)(`button`,{type:`button`,"data-hint":n?J===`en`?`Active`:`当前使用`:J===`en`?`Set active`:`设为当前`,onClick:()=>Ue(e.id),className:`flex-1 min-w-0 flex items-center gap-2 text-left`,children:[(0,p.jsx)(`span`,{className:`text-sm font-medium text-stone-800 truncate`,children:e.name}),t?(0,p.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0 bg-emerald-500`}):null]}),(0,p.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,p.jsx)(`button`,{type:`button`,onClick:()=>Ie(e),className:`h-8 px-3 text-sm text-stone-700 rounded-lg border border-stone-200 bg-white hover:bg-stone-50`,children:d(`settings.edit`,void 0,J)}),y.length>1?(0,p.jsx)(`button`,{type:`button`,onClick:()=>Ve(e.id),className:`h-8 px-3 text-sm text-red-600 rounded-lg hover:bg-red-50`,children:d(`settings.delete`,void 0,J)}):null]})]},e.id)}),(0,p.jsx)(`button`,{type:`button`,onClick:()=>Ie(null),className:`w-full h-12 rounded-xl border border-dashed border-stone-300 bg-white/60 text-sm text-stone-600 hover:border-[#4176e6] hover:text-[#4176e6] hover:bg-[#edf3fe]/50 transition-colors`,children:d(`settings.addProvider`,void 0,J)})]})]})})]})]})})]})}),(0,p.jsx)(ve,{open:Me!=null,title:d(`settings.delete`,void 0,J),message:d(`settings.deleteConfirm`,void 0,J),confirmLabel:d(`settings.delete`,void 0,J),cancelLabel:J===`en`?`Cancel`:`取消`,danger:!0,onClose:()=>V(null),onConfirm:He})]})}export{y as default};
@@ -1,7 +0,0 @@
1
- import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{f as n,i as r}from"./app-config.CpjKWnzM.js";import{n as i}from"./llm.BZEzE0x2.js";import{t as a}from"./prompts-meta.F4wwkjUA.js";import{l as o}from"./settings.BoQ0e0m1.js";import{t as s}from"./jsx-runtime.BUXbF_vF.js";import{a as c,i as l,n as u,r as d,t as f}from"./ConfirmDialog.BYz4HREM.js";import{i as p,n as m,r as h,t as g}from"./menu.CqkL87bV.js";import{n as _}from"./i18n.BVvhz-vw.js";var v=e(t(),1),y=`/__tb_spaces`;async function b(e,t){try{let n=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})}),r=await n.json();return n.ok?r:{ok:!1,error:r?.error||`请求失败(HTTP ${n.status})`}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function x(e){try{return(await fetch(y,{signal:e??AbortSignal.timeout(2e3)})).ok}catch{return!1}}async function ee(e){try{let t=e?.stats?`${y}?stats=1`:y,r=await fetch(t);if(!r.ok)return null;let i=await r.json();return i?.activeId&&n(i.activeId),i}catch{return null}}async function S(e){let t=await b(`${y}/switch`,{id:e});return t.ok&&n(e),t}function C(e,t){return b(`${y}/create`,{name:e,managedParent:t?.managedParent,switch:t?.switch===!0,systemPrompt:t?.systemPrompt})}function te(e,t){return b(`${y}/rename`,{id:e,name:t})}function ne(e,t){return b(`${y}/copy`,{id:e,name:t})}function re(e,t){return b(`${y}/delete`,{id:e,purge:t,confirm:t===!0})}function ie(e,t=`full`){return`${y}/export?id=${encodeURIComponent(e)}${t===`content`?`&scope=content`:``}`}function w(e){return b(`${y}/discover`,Array.isArray(e)&&e.length?{adopt:e}:{})}async function ae(e,t){let n=await e.arrayBuffer(),r=new Uint8Array(n),i=``,a=32768;for(let e=0;e<r.length;e+=a)i+=String.fromCharCode(...r.subarray(e,e+a));let o=btoa(i);return b(`${y}/import`,{zipBase64:o,name:t})}function T(e){return e.isPublic?_(`space.publicName`):e.name}function E(e,t){let n=e.includes(`\\`)?`\\`:`/`,r=t.replace(/[/\\]+$/,``),i=`${r}${n}空间池`;if(e===i)return r;let a=`${i}${n}`;return e.startsWith(a)?`${r}${n}${e.slice(a.length)}`:e}function oe(e){if(!e||e<=0)return`—`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=0,r=e;for(;r>=1024&&n<t.length-1;)r/=1024,n+=1;return`${r<10&&n>0?r.toFixed(1):Math.round(r)} ${t[n]}`}var se=`你是提示词作者。根据用户对这个数据空间的要求,写一份「默认提示词」正文(Markdown 纯文本,不要用代码围栏)。
2
- 这份提示词将作为 Lantern Harness 该空间里 AI 助手的默认人设与回答原则。
3
- 要求:
4
- - 用「你是…」起头设定角色;
5
- - 紧扣用户描述的领域与工作方式;
6
- - 写几条简洁的回答原则(问什么答什么、先结论);
7
- - 只输出提示词正文,不要解释、不要标题。`;function ce(e){let t=String(e??``).replace(/^\uFEFF/,``).trim(),n=/^```(?:markdown|md|text)?\s*\n([\s\S]*?)\n```$/i.exec(t);return n&&(t=n[1].trim()),t}var D=s();function le(e){return e instanceof DOMException&&e.name===`AbortError`||e instanceof Error&&e.name===`AbortError`}function O({hint:e,children:t}){return e?(0,D.jsx)(`span`,{className:`inline-flex cursor-help`,"data-hint":e,"data-hint-always":``,children:t}):t}function k({open:e,onClose:t,onListChanged:s}){let[p,m]=(0,v.useState)(null),[h,g]=(0,v.useState)(null),[y,b]=(0,v.useState)(``),[x,S]=(0,v.useState)(``),[k,A]=(0,v.useState)(``),[j,M]=(0,v.useState)(``),[N,P]=(0,v.useState)(``),[F,I]=(0,v.useState)(null),[L,ue]=(0,v.useState)(``),[R,z]=(0,v.useState)(null),[B,V]=(0,v.useState)(null),[H,U]=(0,v.useState)(``),[W,G]=(0,v.useState)([]),[de,K]=(0,v.useState)({}),fe=(0,v.useRef)(null),pe=(0,v.useRef)(null),q=(0,v.useRef)(null),[J,me]=(0,v.useState)(!1),Y=(0,v.useCallback)(async(e=!1)=>{e&&g(`stats`);let t=await ee({stats:e});e&&g(null),t?(m(t),s?.(t)):b(`无法读取数据空间列表(本地服务未运行?)`)},[s]),he=(0,v.useRef)(Y);(0,v.useEffect)(()=>{he.current=Y},[Y]);function X(){q.current?.abort()}(0,v.useEffect)(()=>{e?(b(``),S(``),P(``),he.current(!1)):X()},[e]),(0,v.useLayoutEffect)(()=>{let e=pe.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,96)}px`)},[j,e]);async function ge(){if(J||h!==null)return;let e=j.trim();if(!e){b(_(`space.promptNeedReq`));return}b(``);let t=new AbortController;q.current=t,me(!0);try{await r();let n=o();if(!n?.apiKey?.trim()||!n.model?.trim()||!n.baseURL?.trim()){b(_(`space.promptNeedModel`));return}let a=k.trim(),s=await i(n,[{role:`system`,content:se},{role:`user`,content:(a?`空间名称:${a}\n\n`:``)+`用户要求:\n${e}`}],t.signal);if(t.signal.aborted)return;let c=ce(s);if(!c){b(_(`space.promptGenEmpty`));return}P(c)}catch(e){if(le(e)||t.signal.aborted)return;b(e instanceof Error?e.message:String(e))}finally{q.current===t&&(q.current=null),me(!1)}}async function Z(e){if(h!==null)return!1;let t=k.trim();if(!t)return b(_(`space.needName`)),!1;X();let r=N.trim();g(`create`),b(``);let i=await C(t,{switch:!0,...r?{systemPrompt:r}:{}});if(g(null),!i.ok)return b(i.error||_(`space.create`)+` 失败`),!1;let a=i.space?.id;return a&&n(a),window.location.reload(),!0}async function _e(){if($)return;let e=k.trim(),n=j.trim();!e&&!n?t():await Z({closeAfter:!0})}async function ve(){if(!F)return;let e=L.trim();if(!e)return;g(`rename`),b(``);let t=await te(F.id,e);g(null),t.ok?(I(null),await Y(!1)):b(t.error||`重命名失败`)}async function ye(){if(!B)return;let e=H.trim();if(!e)return;g(`copy`),b(``);let t=await ne(B.id,e);g(null),t.ok?(V(null),S(`已复制为「${t.space?.name}」`),await Y(!1)):b(t.error||`复制失败`)}async function be(e,t){g(`delete`),b(``);let r=await re(e.id,t);g(null),r.ok?(z(null),e.isActive?(n(`public`),window.location.reload()):(S(r.purged?`已删除「${e.name}」及其数据`:`已从列表移除「${e.name}」(数据保留在磁盘)`),await Y(!1))):b(r.error||`删除失败`)}async function xe(){g(`discover`),b(``),S(``),G([]);let e=await w();if(g(null),!e.ok){b(e.error||`扫描失败`);return}let t=e.added?.length??0,n=e.backfilled?.length??0,r=e.skipped?.length??0,i=e.candidates??[],a=[];t?a.push(_(`space.discoverAdded`,{n:t})):i.length||a.push(_(`space.discoverNone`)),n&&a.push(_(`space.discoverBackfilled`,{n})),r&&a.push(_(`space.discoverSkipped`,{n:r})),S(a.join(`;`)),G(i),K(Object.fromEntries(i.map(e=>[e.path,e.hasContent===!0]))),await Y(!1)}async function Se(){let e=W.filter(e=>de[e.path]).map(e=>e.path);if(!e.length){G([]),S(_(`space.candidatesIgnored`));return}g(`discover`),b(``);let t=await w(e);if(g(null),!t.ok){b(t.error||`纳入失败`);return}G([]);let n=t.added?.length??0,r=t.skipped??[],i=[n?_(`space.candidatesAdopted`,{n}):_(`space.candidatesIgnored`)];r.length&&i.push(_(`space.candidatesRejected`,{names:r.map(e=>e.reason).join(`、`)})),S(i.join(`;`)),await Y(!1)}async function Ce(e){let t=e.target.files?.[0];if(e.target.value=``,!t)return;g(`import`),b(``);let n=await ae(t);g(null),n.ok?(S(`已导入为「${n.space?.name}」`),await Y(!1)):b(n.error||`导入失败`)}let we=p?.spaces??[],Q=p?.baseRoot,$=h!==null,Te=!!j.trim()&&!$&&!J;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(l,{open:e,onClose:t,transition:!0,className:`relative z-95`,children:[(0,D.jsx)(u,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":`true`}),(0,D.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,D.jsxs)(c,{transition:!0,className:`tw-dialog-panel-anim tw-space-dialog w-full max-w-3xl rounded-xl shadow-xl border border-stone-200 bg-white flex flex-col max-h-[86vh]`,children:[(0,D.jsxs)(`div`,{className:`flex items-start justify-between gap-4 px-5 pt-4 pb-3 border-b border-stone-200`,children:[(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(d,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:_(`space.manageTitle`)}),(0,D.jsx)(`p`,{className:`mt-1 text-xs text-stone-500 leading-relaxed`,children:_(`space.manageDesc`)})]}),(0,D.jsx)(`button`,{type:`button`,onClick:t,className:`tw-confirm-cancel shrink-0 w-7 h-7 flex items-center justify-center rounded-md text-stone-400 hover:bg-stone-100 hover:text-stone-700 transition-colors`,"aria-label":`关闭`,children:`✕`})]}),(0,D.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-5 py-4`,children:[(0,D.jsxs)(`div`,{className:`mb-5`,children:[(0,D.jsx)(`div`,{className:`text-xs font-medium text-stone-500 mb-2`,children:_(`space.newTitle`)}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`input`,{value:k,onChange:e=>A(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),Z())},placeholder:_(`space.namePlaceholder`),className:`flex-1 min-w-0 h-9 px-3 text-sm rounded-lg border border-stone-200 text-stone-800 outline-none focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6] transition-colors`}),(0,D.jsx)(`button`,{type:`button`,disabled:!k.trim()||$,onClick:()=>void Z(),className:`h-9 px-4 text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40 transition-colors`,children:h===`create`?`…`:_(`space.create`)}),(0,D.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>fe.current?.click(),className:`h-9 px-3 text-sm rounded-lg border border-stone-200 text-stone-600 hover:bg-stone-100 disabled:opacity-40 transition-colors`,children:h===`import`?`…`:_(`space.import`)}),(0,D.jsx)(`input`,{ref:fe,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:e=>void Ce(e)})]}),p?(0,D.jsx)(`div`,{className:`mt-1.5 text-[11px] text-stone-400 truncate`,children:(0,D.jsx)(`code`,{children:E(p.dataRoot,p.baseRoot)})}):null,(0,D.jsxs)(`div`,{className:`mt-4 pt-3 border-t border-stone-200`,children:[(0,D.jsx)(`div`,{className:`text-xs font-medium text-stone-500 mb-1.5`,children:_(`space.promptBriefLabel`)}),(0,D.jsxs)(`div`,{className:`tw-space-prompt-composer pt-1 rounded-lg bg-white border border-stone-200 outline-none transition-colors focus-within:ring-2 focus-within:ring-[#4176e6]/30 focus-within:border-[#4176e6]`,children:[(0,D.jsx)(`textarea`,{ref:pe,value:j,onChange:e=>M(e.target.value),onKeyDown:e=>{if(e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing){if(e.preventDefault(),J){X();return}Te&&ge()}},placeholder:_(`space.promptBriefPlaceholder`),rows:1,disabled:$,className:`block w-full min-h-6 pl-3.5 pr-2 pt-0.5 pb-0 text-sm leading-5 text-stone-800 bg-transparent resize-none focus:outline-none placeholder:text-stone-400 disabled:opacity-60`}),(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-2 px-3 pb-2 pt-1`,children:[(0,D.jsx)(`span`,{className:`flex-1`}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>{J?X():ge()},disabled:!J&&!Te,"aria-label":_(J?`space.promptStop`:`space.promptGenerate`),className:`w-7 h-7 shrink-0 rounded-full flex items-center justify-center outline-none transition-colors ${J?`bg-stone-200 text-stone-700 hover:bg-stone-300`:`bg-[#4176e6] text-white hover:bg-[#3565c7] disabled:bg-[#a9c3ef] disabled:cursor-not-allowed`}`,children:J?(0,D.jsx)(`span`,{className:`w-2.5 h-2.5 bg-current rounded-xs`}):(0,D.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,className:`w-4 h-4`,"aria-hidden":!0,children:[(0,D.jsx)(`path`,{d:`m5 12 7-7 7 7`}),(0,D.jsx)(`path`,{d:`M12 19V5`})]})})]})]}),(0,D.jsxs)(`div`,{className:`mt-1.5 flex items-start gap-3`,children:[(0,D.jsx)(`p`,{className:`flex-1 min-w-0 text-[11px] text-stone-400 leading-snug`,children:_(`space.promptHint`)}),J?(0,D.jsxs)(`p`,{className:`tw-busy-status shrink-0`,"aria-live":`polite`,children:[_(`space.promptGeneratingStatus`),(0,D.jsx)(`span`,{className:`tw-busy-ellipsis`,"aria-hidden":!0})]}):null]}),(0,D.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2 mb-1.5`,children:[(0,D.jsx)(`label`,{className:`text-xs font-medium text-stone-500`,children:_(`space.promptBodyLabel`)}),(0,D.jsx)(`span`,{className:`text-[11px] text-stone-400 font-mono truncate`,children:a})]}),(0,D.jsx)(`textarea`,{value:N,onChange:e=>P(e.target.value),placeholder:_(`space.promptBodyPlaceholder`),rows:6,disabled:$,className:`w-full min-h-30 px-3 py-2 text-sm leading-relaxed rounded-lg border border-stone-200 text-stone-800 outline-none focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6] transition-colors resize-y font-[inherit]`})]})]}),y?(0,D.jsxs)(`div`,{className:`mb-3 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700 flex items-start gap-2`,children:[(0,D.jsx)(`span`,{className:`flex-1 min-w-0`,children:y}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>b(``),className:`shrink-0 w-5 h-5 -mr-0.5 flex items-center justify-center rounded text-red-700/70 hover:bg-red-100 hover:text-red-900`,"aria-label":`关闭`,children:`✕`})]}):null,x?(0,D.jsxs)(`div`,{className:`mb-3 rounded-lg border border-emerald-200 bg-emerald-50 px-3 py-2 text-xs text-emerald-700 flex items-start gap-2`,children:[(0,D.jsx)(`span`,{className:`flex-1 min-w-0`,children:x}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>S(``),className:`shrink-0 w-5 h-5 -mr-0.5 flex items-center justify-center rounded text-emerald-700/70 hover:bg-emerald-100 hover:text-emerald-900`,"aria-label":`关闭`,children:`✕`})]}):null,W.length?(0,D.jsxs)(`div`,{className:`mb-3 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2.5`,children:[(0,D.jsx)(`div`,{className:`text-xs font-medium text-amber-800`,children:_(`space.candidatesTitle`,{n:W.length})}),(0,D.jsx)(`p`,{className:`mt-1 text-[11px] leading-snug text-amber-700/90`,children:_(`space.candidatesHint`)}),(0,D.jsx)(`div`,{className:`mt-2 max-h-44 overflow-auto rounded-md border border-amber-200/70 bg-white divide-y divide-stone-100`,children:W.map(e=>(0,D.jsxs)(`label`,{className:`flex items-start gap-2 px-2.5 py-1.5 cursor-pointer hover:bg-stone-50`,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:de[e.path]===!0,onChange:t=>K(n=>({...n,[e.path]:t.target.checked})),className:`mt-0.5 accent-[#4176e6]`}),(0,D.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,D.jsx)(`span`,{className:`block text-xs text-stone-800 truncate`,children:e.name}),(0,D.jsx)(`span`,{className:`block text-[10px] text-stone-400 truncate font-mono`,children:Q?E(e.path,Q):e.path})]})]},e.path))}),(0,D.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,D.jsx)(`button`,{type:`button`,onClick:()=>K(Object.fromEntries(W.map(e=>[e.path,!0]))),className:`text-[11px] text-[#4176e6] hover:underline`,children:_(`space.candidatesSelectAll`)}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>K({}),className:`text-[11px] text-stone-500 hover:underline`,children:_(`space.candidatesClear`)}),(0,D.jsx)(`span`,{className:`flex-1`}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>{G([]),K({}),S(_(`space.candidatesIgnored`))},className:`px-2.5 py-1 text-[11px] rounded-md border border-stone-200 text-stone-600 hover:bg-stone-50`,children:_(`space.candidatesIgnore`)}),(0,D.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>void Se(),className:`px-2.5 py-1 text-[11px] rounded-md bg-[#4176e6] text-white hover:bg-[#3565c7] disabled:opacity-40`,children:_(`space.candidatesAdopt`)})]})]}):null,(0,D.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,D.jsx)(`div`,{className:`text-xs font-medium text-stone-500`,children:_(`space.listTitle`)}),(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,D.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>void xe(),"data-hint":_(`space.discoverTitle`),"data-hint-always":``,className:`text-xs text-[#4176e6] hover:underline disabled:opacity-40`,children:_(h===`discover`?`space.discovering`:`space.discover`)}),(0,D.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>void Y(!0),"data-hint":_(`space.sizeTitle`),"data-hint-always":``,className:`text-xs text-[#4176e6] hover:underline disabled:opacity-40`,children:_(h===`stats`?`space.sizing`:`space.size`)})]})]}),(0,D.jsx)(`div`,{className:`rounded-lg border border-stone-200 divide-y divide-stone-100 overflow-hidden`,children:we.length===0?(0,D.jsx)(`div`,{className:`px-3 py-6 text-center text-xs text-stone-400`,children:_(`space.empty`)}):we.map(e=>(0,D.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2.5`,children:[(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,D.jsx)(`span`,{className:`text-sm font-medium text-stone-800 truncate`,children:T(e)}),e.isPublic?(0,D.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-px text-[10px] bg-stone-100 text-stone-500`,children:_(`space.builtin`)}):null,e.isActive?(0,D.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-px text-[10px] bg-[#4176e6]/10 text-[#3565c7]`,children:_(`space.activeTag`)}):null,e.exists?null:(0,D.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-px text-[10px] bg-amber-50 text-amber-600`,children:_(`space.missing`)}),e.bytes==null?null:(0,D.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-px text-[10px] bg-stone-100 text-stone-500 tabular-nums`,children:oe(e.bytes)})]}),(0,D.jsx)(`div`,{className:`mt-0.5 text-[11px] text-stone-400 truncate cursor-help hover:text-stone-500`,"data-hint":Q?E(e.path,Q):e.path,"data-hint-always":``,children:Q?E(e.path,Q):e.path})]}),(0,D.jsxs)(`div`,{className:`shrink-0 flex flex-wrap justify-end items-center gap-1`,children:[(0,D.jsx)(O,{hint:e.removable?void 0:_(`space.publicLocked`),children:(0,D.jsx)(`button`,{type:`button`,disabled:!e.removable||$,onClick:()=>{I(e),ue(e.name)},className:`h-7 px-2 text-xs rounded-md border border-stone-200 text-stone-600 hover:bg-stone-100 disabled:opacity-30 disabled:cursor-not-allowed disabled:pointer-events-none transition-colors`,children:_(`space.rename`)})}),(0,D.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>{V(e),U(`${e.name}-copy`)},className:`h-7 px-2 text-xs rounded-md border border-stone-200 text-stone-600 hover:bg-stone-100 disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:_(`space.copy`)}),(0,D.jsx)(`a`,{href:ie(e.id,`content`),"data-hint":_(`space.exportContentTitle`),"data-hint-always":``,className:`h-7 px-2 text-xs rounded-md border border-stone-200 text-stone-600 hover:bg-stone-100 inline-flex items-center transition-colors`,children:_(`space.exportContent`)}),(0,D.jsx)(`a`,{href:ie(e.id,`full`),"data-hint":_(`space.exportFullTitle`),"data-hint-always":``,className:`h-7 px-2 text-xs rounded-md border border-stone-200 text-stone-600 hover:bg-stone-100 inline-flex items-center transition-colors`,children:_(`space.exportFull`)}),(0,D.jsx)(O,{hint:e.removable?void 0:_(`space.publicLocked`),children:(0,D.jsx)(`button`,{type:`button`,disabled:!e.removable||$,onClick:()=>z({kind:`remove`,space:e}),className:`h-7 px-2 text-xs rounded-md border border-stone-200 text-stone-600 hover:bg-stone-100 disabled:opacity-30 disabled:cursor-not-allowed disabled:pointer-events-none transition-colors`,children:_(`space.removeList`)})}),(0,D.jsx)(O,{hint:e.removable?void 0:_(`space.publicLocked`),children:(0,D.jsx)(`button`,{type:`button`,disabled:!e.removable||$,onClick:()=>z({kind:`delete`,space:e}),className:`h-7 px-2 text-xs rounded-md border border-red-200 text-red-600 hover:bg-red-50 disabled:opacity-30 disabled:cursor-not-allowed disabled:pointer-events-none transition-colors`,children:_(`space.deleteDisk`)})})]})]},e.id))})]}),(0,D.jsx)(`div`,{className:`flex justify-end gap-2 px-5 py-3 border-t border-stone-200`,children:(0,D.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>void _e(),className:`h-8 px-4 text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40 transition-colors`,children:h===`create`?`…`:_(`space.done`)})})]})})]}),(0,D.jsxs)(l,{open:F!==null,onClose:()=>I(null),transition:!0,className:`relative z-96`,children:[(0,D.jsx)(u,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":`true`}),(0,D.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,D.jsxs)(c,{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,D.jsx)(d,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:_(`space.rename`)}),(0,D.jsx)(`input`,{autoFocus:!0,value:L,onChange:e=>ue(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),ve())},className:`mt-4 w-full h-9 px-3 text-sm rounded-lg border border-stone-200 text-stone-800 outline-none focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6] transition-colors`}),(0,D.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,D.jsx)(`button`,{type:`button`,onClick:()=>I(null),className:`tw-confirm-cancel h-8 px-3 text-sm rounded-lg border border-stone-200 text-stone-600 hover:bg-stone-100 transition-colors`,children:`取消`}),(0,D.jsx)(`button`,{type:`button`,disabled:!L.trim()||$,onClick:()=>void ve(),className:`h-8 px-4 text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40 transition-colors`,children:h===`rename`?`…`:`确定`})]})]})})]}),(0,D.jsxs)(l,{open:B!==null,onClose:()=>V(null),transition:!0,className:`relative z-96`,children:[(0,D.jsx)(u,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":`true`}),(0,D.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,D.jsxs)(c,{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,D.jsx)(d,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:_(`space.confirmCopyTitle`)}),(0,D.jsx)(`p`,{className:`tw-confirm-msg mt-3 text-sm text-stone-600 leading-relaxed`,children:_(`space.confirmCopyMsg`,{name:B?.name??``})}),(0,D.jsxs)(`label`,{className:`mt-3 block text-xs font-medium text-stone-500`,children:[_(`space.copyName`),(0,D.jsx)(`input`,{autoFocus:!0,value:H,onChange:e=>U(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),ye())},className:`mt-1.5 w-full h-9 px-3 text-sm rounded-lg border border-stone-200 text-stone-800 outline-none focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6] transition-colors`})]}),(0,D.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,D.jsx)(`button`,{type:`button`,onClick:()=>V(null),className:`tw-confirm-cancel h-8 px-3 text-sm rounded-lg border border-stone-200 text-stone-600 hover:bg-stone-100 transition-colors`,children:`取消`}),(0,D.jsx)(`button`,{type:`button`,disabled:!H.trim()||$,onClick:()=>void ye(),className:`h-8 px-4 text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40 transition-colors`,children:h===`copy`?`…`:_(`space.copy`)})]})]})})]}),(0,D.jsx)(f,{open:R?.kind===`remove`,title:_(`space.confirmRemoveTitle`),message:R?.kind===`remove`?_(`space.confirmRemoveMsg`,{name:R.space.name,path:R.space.path}):``,confirmLabel:_(`space.removeList`),onClose:()=>z(null),onConfirm:()=>{R?.kind===`remove`&&be(R.space,!1)}}),(0,D.jsx)(f,{open:R?.kind===`delete`,title:_(`space.confirmDeleteTitle`),message:R?.kind===`delete`?_(`space.confirmDeleteMsg`,{name:R.space.name,path:R.space.path}):``,confirmLabel:_(`space.deleteDisk`),danger:`solid`,onClose:()=>z(null),onConfirm:()=>{R?.kind===`delete`&&be(R.space,!0)}})]})}var A=`tw.spaces.list.v1`;function j(){try{let e=sessionStorage.getItem(A);if(!e)return null;let t=JSON.parse(e);return t&&Array.isArray(t.spaces)?t:null}catch{return null}}function M(e){try{sessionStorage.setItem(A,JSON.stringify(e))}catch{}}function N(e){try{e?document.documentElement.dataset.spaceService=`none`:delete document.documentElement.dataset.spaceService}catch{}}function P(){let e=j(),[t,n]=(0,v.useState)(e!==null),[r,i]=(0,v.useState)(e!==null),[a,o]=(0,v.useState)(e),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(``);(0,v.useEffect)(()=>{let e=!0;return(async()=>{let t=await x();if(!e)return;if(i(!0),!t){n(!1),N(!0);return}N(!1),n(!0);let r=await ee();e&&r&&(o(r),M(r))})(),()=>{e=!1}},[]);async function y(e){if(e===a?.activeId)return;u(!0),f(``);let t=await S(e);t.ok?(a&&M({...a,activeId:e,spaces:a.spaces.map(t=>({...t,isActive:t.id===e}))}),window.location.reload()):(u(!1),f(t.error||`切换失败`))}if(!r)return null;if(!t)return(0,D.jsx)(`div`,{className:`tw-nav-space`,children:(0,D.jsxs)(`div`,{className:`tw-nav-space-btn tw-nav-space-btn--off`,children:[(0,D.jsx)(`span`,{className:`tw-nav-space-ico`,"aria-hidden":`true`,children:(0,D.jsx)(F,{})}),(0,D.jsxs)(`span`,{className:`tw-nav-space-text`,children:[(0,D.jsx)(`span`,{className:`tw-nav-space-cap`,children:_(`space.offlineCap`)}),(0,D.jsx)(`span`,{className:`tw-nav-space-name`,children:_(`space.offline`)})]})]})});let b=a?.spaces.find(e=>e.isActive),C=(a?.spaces??[]).filter(e=>!e.isActive);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`div`,{className:`tw-nav-space`,children:(0,D.jsxs)(h,{as:`div`,className:`tw-nav-space-menu`,children:[(0,D.jsxs)(g,{className:`tw-nav-space-btn`,"data-hint":_(`space.label`),children:[(0,D.jsx)(`span`,{className:`tw-nav-space-ico`,"aria-hidden":`true`,children:(0,D.jsx)(F,{})}),(0,D.jsxs)(`span`,{className:`tw-nav-space-text`,children:[(0,D.jsx)(`span`,{className:`tw-nav-space-cap`,children:_(`space.current`)}),(0,D.jsx)(`span`,{className:`tw-nav-space-name`,children:l?_(`space.switching`):b?T(b):`—`})]}),(0,D.jsx)(`svg`,{className:`tw-nav-space-caret`,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,D.jsx)(`path`,{d:`m6 9 6 6 6-6`})})]}),(0,D.jsxs)(p,{transition:!0,anchor:{to:`bottom start`,gap:`0.375rem`},className:`tw-nav-space-pop tw-menu-anim`,children:[d?(0,D.jsx)(`div`,{className:`tw-nav-space-err`,role:`alert`,children:d}):null,(0,D.jsx)(`div`,{className:`tw-nav-space-group`,children:_(`space.others`)}),C.length===0?(0,D.jsx)(`p`,{className:`tw-nav-space-hint`,children:_(`space.othersEmpty`)}):C.map(e=>(0,D.jsx)(m,{children:(0,D.jsxs)(`button`,{type:`button`,className:`tw-nav-space-item`,disabled:l,onClick:()=>void y(e.id),children:[(0,D.jsx)(`span`,{className:`tw-nav-space-item-main`,children:(0,D.jsx)(`span`,{className:`tw-nav-space-item-name`,"data-hint":T(e),children:T(e)})}),(0,D.jsx)(`svg`,{className:`tw-nav-space-item-go`,viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,D.jsx)(`path`,{d:`m9 6 6 6-6 6`})})]})},e.id)),(0,D.jsx)(`div`,{className:`tw-nav-space-sep`}),(0,D.jsx)(m,{children:(0,D.jsxs)(`button`,{type:`button`,className:`tw-nav-space-item tw-nav-space-item--manage`,onClick:()=>c(!0),children:[(0,D.jsx)(`span`,{className:`tw-nav-space-item-ico`,"aria-hidden":`true`,children:(0,D.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,D.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,D.jsx)(`path`,{d:`M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9c.2.6.7 1 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z`})]})}),(0,D.jsx)(`span`,{className:`tw-nav-space-item-main`,children:(0,D.jsx)(`span`,{className:`tw-nav-space-item-name`,children:_(`space.manage`)})}),(0,D.jsx)(`svg`,{className:`tw-nav-space-item-go`,viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,D.jsx)(`path`,{d:`m9 6 6 6-6 6`})})]})})]})]})}),(0,D.jsx)(k,{open:s,onClose:()=>c(!1),onListChanged:e=>{o(e),M(e)}})]})}function F(){return(0,D.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`15`,height:`15`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,D.jsx)(`path`,{d:`M3 7.5 12 3l9 4.5-9 4.5-9-4.5Z`}),(0,D.jsx)(`path`,{d:`m3 12.5 9 4.5 9-4.5`}),(0,D.jsx)(`path`,{d:`m3 17 9 4.5 9-4.5`})]})}export{P as default};
@@ -1 +0,0 @@
1
- import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{i as n}from"./app-config.CpjKWnzM.js";import{a as r,i,r as a,t as o}from"./ExcelFieldTags.B_XMwNNx.js";import{_ as s,a as c,c as ee,d as te,f as ne,g as l,h as u,i as re,l as ie,m as d,o as ae,p as oe,r as se,s as ce,u as f,v as le}from"./SelectDropdown.Dc7QaPbH.js";import{t as p}from"./jsx-runtime.BUXbF_vF.js";import{t as ue}from"./ConfirmDialog.BYz4HREM.js";import{a as de,o as fe,r as m}from"./plugins.CrpY8UI9.js";import{n as h,r as pe,t as me}from"./useListAnim.CnbC_9MC.js";import{t as g}from"./NamePromptDialog.DGBlDH_k.js";var _=e(t(),1),v=p(),he=5;async function ge(e){let t=e.name.toLowerCase();try{if(t.endsWith(`.xlsx`)||t.endsWith(`.xls`)){let t=await d(`templates`,e.path);if(t.encoding===`base64`&&t.contentBase64)return r(t.contentBase64).headers}else if(t.endsWith(`.csv`)){let t=await u(`templates`,e.path);return a(t.content).headers}else if(t.endsWith(`.md`)||t.endsWith(`.txt`)){let t=await u(`templates`,e.path);return i(t.content).headers}}catch{}return[]}function y({className:e=`w-4 h-4`,open:t=!1}){return(0,v.jsx)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:t?(0,v.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`}):(0,v.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 b({className:e=`w-3 h-3`}){return(0,v.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,v.jsx)(`path`,{d:`M21.17 6.81a1 1 0 0 0-3.99-3.99L3.84 16.17a2 2 0 0 0-.5.83l-1.32 4.35a.5.5 0 0 0 .62.62l4.35-1.32a2 2 0 0 0 .83-.5z`}),(0,v.jsx)(`path`,{d:`m15 5 4 4`})]})}function x({className:e=`w-3 h-3`}){return(0,v.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,v.jsx)(`path`,{d:`M3 6h18`}),(0,v.jsx)(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}),(0,v.jsx)(`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`}),(0,v.jsx)(`path`,{d:`M10 11v6`}),(0,v.jsx)(`path`,{d:`M14 11v6`})]})}function S({node:e,depth:t,activePath:n,expanded:r,globalOpen:i,onToggle:a,onSelect:o}){let s=r[e.path]??i,c=n===e.path;return(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`div`,{className:`group flex items-center rounded-md ${c?`bg-[#e8f0fe]`:`hover:bg-stone-100`}`,style:{paddingLeft:8+t*12},children:(0,v.jsxs)(`button`,{type:`button`,onClick:()=>{o(e.path),e.children.length&&a(e.path)},"aria-expanded":e.children.length?s:void 0,className:`flex-1 min-w-0 flex items-center gap-1.5 py-1.5 pr-1 text-sm text-left ${c?`text-[#4176e6]`:`text-stone-600`}`,children:[(0,v.jsx)(`span`,{className:`w-3.5 shrink-0`,"aria-hidden":`true`}),(0,v.jsx)(y,{open:!!(e.children.length&&s),className:`w-3.5 h-3.5 shrink-0 text-[#4176e6]`}),(0,v.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,children:e.name}),(0,v.jsxs)(`span`,{className:`shrink-0 tabular-nums text-[11px] text-stone-400`,children:[`(`,e.fileCount??0,`)`]})]})}),(0,v.jsx)(`div`,{className:`tw-collapse ${s?`is-open`:``}`,children:(0,v.jsx)(`div`,{className:`tw-collapse-inner`,children:e.children.map(e=>(0,v.jsx)(S,{node:e,depth:t+1,activePath:n,expanded:r,globalOpen:i,onToggle:a,onSelect:o},e.path))})})]})}function _e(e){return e==null?`—`:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function C(){let[e,t]=(0,_.useState)(()=>m(`templates`)),[r,i]=(0,_.useState)(!1),[a,u]=(0,_.useState)(null),[d,p]=(0,_.useState)([]),[C,ve]=(0,_.useState)(0),[w,T]=(0,_.useState)(`.`),[E,D]=(0,_.useState)([]),[ye,be]=(0,_.useState)({}),[xe,O]=(0,_.useState)({}),[k,Se]=(0,_.useState)(!0),[A,j]=(0,_.useState)(null),[M,N]=(0,_.useState)(!1),[Ce,P]=(0,_.useState)(!1),[F,I]=(0,_.useState)(null),[L,R]=(0,_.useState)(null),[z,B]=(0,_.useState)(1),[V,we]=pe(he),[Te,H]=(0,_.useState)(null),U=(0,_.useRef)(null),{cls:Ee,play:W}=me(),G=(0,_.useCallback)(async e=>{let t={};await Promise.all(e.map(async e=>{let n=await ge(e);n.length&&(t[e.path]=n)})),be(t)},[]),K=(0,_.useCallback)(async()=>{let e=await ce(`templates`);p(e.tree),ve(e.totalFiles)},[]),q=(0,_.useCallback)(async(e=w)=>{j(null);try{let[t]=await Promise.all([f(`templates`,e),K()]);D(t.entries),T(t.path);let n=t.entries.filter(e=>e.type===`file`);await G(n)}catch(e){j(e instanceof Error?e.message:String(e))}},[w,G,K]);(0,_.useEffect)(()=>{let e=de(e=>t(!!e.templates));return n().then(()=>{t(m(`templates`)),i(!0)}),e},[]),(0,_.useEffect)(()=>{r&&e&&(async()=>{let e=await ae(`templates`);if(u(e),e)try{let[e]=await Promise.all([f(`templates`,`.`),K()]);D(e.entries),T(e.path),await G(e.entries.filter(e=>e.type===`file`))}catch(e){j(e instanceof Error?e.message:String(e))}})()},[r,e,G,K]);function De(){Se(e=>!e),O({})}async function J(e){W(),T(e),B(1),H(null),j(null);try{let t=await f(`templates`,e);D(t.entries),await G(t.entries.filter(e=>e.type===`file`))}catch(e){j(e instanceof Error?e.message:String(e))}}async function Oe(e){P(!1),N(!0),j(null);try{await te(`templates`,w,e),await q(w)}catch(e){j(e instanceof Error?e.message:String(e))}finally{N(!1)}}async function ke(e){if(e?.length){N(!0),j(null);try{for(let t of Array.from(e))await le(`templates`,w,t);await q(w)}catch(e){j(e instanceof Error?e.message:String(e))}finally{N(!1),U.current&&(U.current.value=``)}}}async function Ae(e){if(e.type===`file`){N(!0),j(null);try{await ne(`templates`,e.path)}catch(e){j(e instanceof Error?e.message:String(e))}finally{N(!1)}}}function je(e){let t=ee(d,e.path),n=t?.fileCount??0,r=t?re(t):0;I({...e,isDir:!0,blocked:n>0||r>0,files:n,dirs:r})}function Me(e){I({name:e.name,path:e.path,isDir:!1})}function Y(e,t){R({...e,isDir:t})}async function Ne(){let e=F;if(e&&(I(null),!e.blocked)){N(!0),j(null);try{await c(`templates`,e.path);let t=ie(w,e.path)?oe(e.path):w;await q(t)}catch(e){j(e instanceof Error?e.message:String(e))}finally{N(!1)}}}async function Pe(e){let t=L;if(t&&(R(null),e!==t.name)){N(!0),j(null);try{let n=await s(`templates`,t.path,e);await q(l(w,t.path,n))}catch(e){j(e instanceof Error?e.message:String(e))}finally{N(!1)}}}let Fe=(()=>{if(!F)return``;if(!F.isDir)return`删除文件「${F.name}」?将移入系统废纸篓,可随时找回。`;if(F.blocked){let e=[];return F.files&&e.push(`${F.files} 个文件`),F.dirs&&e.push(`${F.dirs} 个子文件夹`),`文件夹「${F.name}」中还有 ${e.join(`、`)},请先清空内部内容后再删除。`}return`删除文件夹「${F.name}」?将移入系统废纸篓。`})();if(!r)return(0,v.jsx)(`div`,{className:`tw-lib-probing`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,v.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})});if(!e)return(0,v.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:fe(`templates`)});if(a===null)return(0,v.jsx)(`div`,{className:`tw-lib-probing`,"aria-busy":`true`,"aria-label":`正在连接本地文档服务`,children:(0,v.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})});if(!a)return(0,v.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:`模板库需要本地文档服务,当前未就绪。`});let X=E.filter(e=>e.type===`file`),Z=E.filter(e=>e.type===`dir`),Q=Math.max(1,Math.ceil(X.length/V)),$=Math.min(z,Q),Ie=X.slice(($-1)*V,$*V);function Le(e){W(),we(e),B(1)}return(0,v.jsxs)(`div`,{className:`flex gap-4 min-h-0`,children:[(0,v.jsxs)(`aside`,{className:`w-56 shrink-0 rounded-xl border border-stone-200 bg-white flex flex-col overflow-hidden`,children:[(0,v.jsxs)(`div`,{className:`px-3 py-2.5 border-b border-stone-100 flex items-center justify-between`,children:[(0,v.jsx)(`span`,{className:`text-xs font-semibold text-stone-500`,children:`文件夹`}),(0,v.jsx)(`button`,{type:`button`,disabled:M,onClick:()=>P(!0),className:`tw-mkdir-btn disabled:opacity-40`,children:`+ 新建`})]}),(0,v.jsxs)(`div`,{className:`flex-1 overflow-y-auto py-2 px-1`,children:[(0,v.jsx)(`div`,{className:`group flex items-center rounded-md ${w===`.`?`bg-[#e8f0fe]`:`hover:bg-stone-100`}`,style:{paddingLeft:8},children:(0,v.jsxs)(`button`,{type:`button`,onClick:()=>{J(`.`),De()},"aria-expanded":k,className:`flex-1 min-w-0 flex items-center gap-1.5 py-1.5 pr-1 text-sm text-left ${w===`.`?`text-[#4176e6]`:`text-stone-600`}`,children:[(0,v.jsx)(y,{open:k,className:`w-3.5 h-3.5 shrink-0 text-[#4176e6]`}),(0,v.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,children:`全部模板`}),(0,v.jsxs)(`span`,{className:`shrink-0 tabular-nums text-[11px] text-stone-400`,children:[`(`,C,`)`]})]})}),(0,v.jsx)(`div`,{className:`tw-collapse ${k?`is-open`:``}`,children:(0,v.jsx)(`div`,{className:`tw-collapse-inner`,children:d.map(e=>(0,v.jsx)(S,{node:e,depth:0,activePath:w,expanded:xe,globalOpen:k,onToggle:e=>O(t=>({...t,[e]:!(t[e]??k)})),onSelect:e=>void J(e)},e.path))})})]})]}),(0,v.jsxs)(`section`,{className:`flex-1 min-w-0 rounded-xl border border-stone-200 bg-white flex flex-col overflow-hidden`,children:[(0,v.jsxs)(`div`,{className:`px-4 py-3 border-b border-stone-100 flex items-center gap-2 flex-wrap`,children:[(0,v.jsxs)(`div`,{className:`text-sm text-stone-600 flex-1 min-w-0 truncate`,children:[(0,v.jsx)(`span`,{className:`text-stone-400`,children:se(`templates`)}),w===`.`?``:w]}),(0,v.jsx)(`input`,{ref:U,type:`file`,multiple:!0,accept:`.md,.txt,.docx,.xlsx,.xls,.csv,text/plain,text/markdown,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,className:`hidden`,onChange:e=>void ke(e.target.files)}),(0,v.jsx)(`button`,{type:`button`,disabled:M,onClick:()=>U.current?.click(),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,v.jsx)(`div`,{className:`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,v.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 space-y-4`,children:[Z.length>0&&(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`div`,{className:`text-xs font-medium text-stone-400 mb-2`,children:`子文件夹`}),(0,v.jsx)(`ul`,{className:`space-y-1`,children:Z.map(e=>(0,v.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg border border-stone-100 hover:bg-stone-50`,children:[(0,v.jsxs)(`button`,{type:`button`,className:`flex-1 min-w-0 flex items-center gap-2 text-left text-sm text-stone-700`,onClick:()=>void J(e.path),children:[(0,v.jsx)(y,{className:`w-4 h-4 text-[#4176e6] shrink-0`}),(0,v.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,children:e.name})]}),(0,v.jsx)(`button`,{type:`button`,disabled:M,"aria-label":`重命名 ${e.name}`,onClick:()=>Y({name:e.name,path:e.path},!0),className:`p-1.5 rounded text-stone-400 hover:text-[#4176e6] hover:bg-[#e8f0fe] disabled:opacity-40`,children:(0,v.jsx)(b,{className:`w-3.5 h-3.5`})}),(0,v.jsx)(`button`,{type:`button`,disabled:M,"aria-label":`删除 ${e.name}`,onClick:()=>je({name:e.name,path:e.path}),className:`p-1.5 rounded text-red-600 hover:bg-red-50 disabled:opacity-40`,children:(0,v.jsx)(x,{className:`w-3.5 h-3.5`})})]},e.path))})]}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`div`,{className:`text-xs font-medium text-stone-400 mb-2`,children:`文件`}),X.length===0?(0,v.jsx)(`p`,{className:`text-sm text-stone-400 py-6 text-center border border-dashed border-stone-200 rounded-lg`,children:`当前文件夹为空,点击「上传文件」添加模板(.md / .xlsx / .docx 等)`}):(0,v.jsx)(`ul`,{className:`${Ee}space-y-1`,children:Ie.map(e=>{let t=ye[e.path]??[],n=Te===e.path;return(0,v.jsxs)(`li`,{className:`flex items-start gap-2 px-3 py-2 rounded-lg border transition-colors ${n?`border-[#c7dcff] bg-[#e8f0fe]`:`border-stone-100 hover:bg-stone-50`}`,children:[(0,v.jsxs)(`button`,{type:`button`,className:`flex-1 min-w-0 text-left`,disabled:M,onClick:()=>H(e.path),onDoubleClick:()=>void Ae(e),children:[(0,v.jsx)(`div`,{className:`text-sm text-stone-800 truncate`,"data-hint":e.name,children:e.name}),(0,v.jsx)(`div`,{className:`text-[11px] text-stone-400`,children:_e(e.size)}),t.length>0?(0,v.jsx)(o,{fields:t}):null]}),(0,v.jsx)(`button`,{type:`button`,disabled:M,"aria-label":`重命名 ${e.name}`,onClick:()=>Y({name:e.name,path:e.path},!1),className:`p-1.5 rounded text-stone-400 hover:text-[#4176e6] hover:bg-[#e8f0fe] disabled:opacity-40 shrink-0 mt-0.5`,children:(0,v.jsx)(b,{className:`w-3.5 h-3.5`})}),(0,v.jsx)(`button`,{type:`button`,disabled:M,"aria-label":`删除 ${e.name}`,onClick:()=>Me(e),className:`p-1.5 rounded text-red-600 hover:bg-red-50 disabled:opacity-40 shrink-0 mt-0.5`,children:(0,v.jsx)(x,{className:`w-3.5 h-3.5`})})]},e.path)})})]})]}),X.length>0?(0,v.jsx)(h,{page:$,totalPages:Q,pageSize:V,busy:M,onPage:e=>{W(),B(e)},onPageSize:Le}):null]}),(0,v.jsx)(g,{open:Ce,title:`新建文件夹`,onClose:()=>P(!1),onConfirm:e=>void Oe(e)}),(0,v.jsx)(g,{open:L!=null,title:L?.isDir?`重命名文件夹`:`重命名文件`,label:L?.isDir?`文件夹名称`:`文件名称`,initialValue:L?.name??``,lockExtension:L!=null&&!L.isDir,confirmLabel:`保存`,onClose:()=>R(null),onConfirm:e=>void Pe(e)}),(0,v.jsx)(ue,{open:F!=null,title:F?.blocked?`无法删除文件夹`:F?.isDir?`删除文件夹`:`删除模板`,message:Fe,confirmLabel:F?.blocked?`知道了`:`删除`,cancelLabel:`取消`,danger:!F?.blocked,hideCancel:!!F?.blocked,onClose:()=>I(null),onConfirm:()=>void Ne()})]})}export{C as default};
@@ -1 +0,0 @@
1
- var e=[{id:`functional`,label:`功能测试`,casesFolder:`功能测试`,templateFolder:`功能测试用例`},{id:`api`,label:`接口测试`,casesFolder:`接口测试`,templateFolder:`接口测试用例`},{id:`performance`,label:`性能测试`,casesFolder:`性能测试`,templateFolder:`性能测试用例`},{id:`automation`,label:`自动化测试`,casesFolder:`自动化测试`,templateFolder:`自动化测试用例`}];function t(){return`ct_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`}function n(e){let t=e.trim()||`未命名类型`;return{casesFolder:t,templateFolder:`${t}用例`}}function r(e){if(!e||typeof e!=`object`)return null;let r=e,i=String(r.label??``).trim();if(!i)return null;let a=String(r.id??``).trim()||t(),o=n(i);return{id:a,label:i,casesFolder:typeof r.casesFolder==`string`&&r.casesFolder.trim()?r.casesFolder.trim():o.casesFolder,templateFolder:typeof r.templateFolder==`string`&&r.templateFolder.trim()?r.templateFolder.trim():o.templateFolder}}function i(t){if(!Array.isArray(t))return e.map(e=>({...e}));let n=[],i=new Set;for(let e of t){let t=r(e);t&&!i.has(t.id)&&(i.add(t.id),n.push(t))}return n.length?n:e.map(e=>({...e}))}function a(){return t()}var o=[`测试规范`,`方法论`,`环境约定`];function s(e){if(!Array.isArray(e))return[...o];let t=[],n=new Set;for(let r of e){let e=String(r??``).trim();!e||e.length>40||n.has(e)||(n.add(e),t.push(e))}return t.length?t:[...o]}var c=[{id:`case`,label:`用例生成提示词`,hint:`用于编写「用例生成」提示词:指导模型按需求与模板输出可入库用例;须约束 JSON 结构、字段对齐模板、步骤换行与覆盖策略,不要限定固定用例条数。`},{id:`general`,label:`通用提示词`,hint:`用于编写通用测试/工作台提示词:角色、输出风格与约束清晰,可直接作为系统或任务提示词使用。`}];function l(){return`pk_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`}function u(e){return`生成「${e.trim()||`自定义`}」类提示词:角色、输出风格与约束清晰,可直接作为系统或任务提示词使用。`}function ee(e){if(!e||typeof e!=`object`)return null;let t=e,n=String(t.label??``).trim();if(!n)return null;let r=String(t.id??``).trim()||l(),i=typeof t.hint==`string`&&t.hint.trim()?t.hint.trim():u(n);return r===`case`&&i.includes(`「测试用例生成」`)&&(i=c[0].hint),{id:r,label:n,hint:i}}function d(e){if(!Array.isArray(e))return c.map(e=>({...e}));let t=[],n=new Set;for(let r of e){let e=ee(r);e&&!n.has(e.id)&&(n.add(e.id),t.push(e))}return t.length?t:c.map(e=>({...e}))}function te(){return l()}var f=[{id:`cases`,href:`cases/library/`,i18n:`nav.caseManage`,plugin:`cases`,match:`cases`},{id:`prompts`,href:`prompts/`,i18n:`nav.prompts`,plugin:`prompts`,match:`prompts`},{id:`knowledgeLib`,href:`knowledge/`,i18n:`nav.knowledge`,plugin:`knowledgeLib`,match:`knowledge`},{id:`requirements`,href:`requirements/`,i18n:`nav.requirements`,plugin:`requirements`,match:`requirements`},{id:`templates`,href:`templates/`,i18n:`nav.templates`,plugin:`templates`,match:`templates`}],p=[],m=[`check`,`pencil`,`book`,`fileText`,`layers`,`list`,`folder`,`star`,`database`,`target`,`code`,`flask`,`home`,`clipboard`,`bug`,`calendar`,`chart`,`globe`,`link`,`users`,`terminal`,`tag`,`flag`,`zap`],h={cases:`check`,prompts:`pencil`,knowledgeLib:`book`,requirements:`fileText`,templates:`layers`};function ne(e){return typeof e==`string`&&m.includes(e)}function g(e){let t={...h};if(!e||typeof e!=`object`||Array.isArray(e))return t;for(let n of f){let r=e[n.id];ne(r)&&(t[n.id]=r)}return t}var re=new Set(f.map(e=>e.id));function _(e){return typeof e==`string`&&re.has(e)}function ie(e){return f.find(t=>t.id===e)}function v(e){return`item:${e}`}function y(e){return`group:${e}`}function b(){return`ng_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`}function ae(){return p.map(e=>({id:e.id,name:e.name,items:[...e.items]}))}function x(e,t=!0){if(e==null||!Array.isArray(e))return t?ae():[];let n=new Set,r=[],i=new Set;for(let t of e){if(!t||typeof t!=`object`)continue;let e=t,a=String(e.name??``).trim();if(!a)continue;let o=String(e.id??``).trim()||b();i.has(o)&&(o=b());let s=[];if(Array.isArray(e.items))for(let t of e.items)_(t)&&!n.has(t)&&(n.add(t),s.push(t));let c=String(e.parentId??``).trim()||void 0;i.add(o),r.push({id:o,name:a,items:s,parentId:c})}let a=new Set(r.map(e=>e.id)),o=r.map(e=>{let t=e.parentId;return(!t||t===e.id||!a.has(t))&&(t=void 0),t?{...e,parentId:t}:{id:e.id,name:e.name,items:e.items}}),s=new Map(o.map(e=>[e.id,e])),c=o.map(e=>{if(!e.parentId)return e;let t=s.get(e.parentId);if(t?.parentId){let n=t.parentId;return n&&n!==e.id&&a.has(n)?{...e,parentId:n}:{id:e.id,name:e.name,items:e.items}}return e}),l=new Set(c.map(e=>e.parentId).filter(e=>!!e));return c.filter(e=>e.items.length>0||l.has(e.id))}function S(e,t){let n=t.name.trim(),r=t.items.filter((e,t,n)=>_(e)&&n.indexOf(e)===t);if(!n||!r.length)return{groups:e,id:t.id?.trim()||``};let i=t.id?.trim()||b(),a=e.find(e=>e.id===i),o=t.parentId===void 0?a?.parentId:t.parentId.trim()||void 0;if(o===i&&(o=void 0),o){let t=e.find(e=>e.id===o);t?t.parentId&&(o=t.parentId):o=void 0}let s=new Set(r),c=e.filter(e=>e.id!==i).map(e=>({...e,items:e.items.filter(e=>!s.has(e))}));return c.push(o?{id:i,name:n,items:r,parentId:o}:{id:i,name:n,items:r}),{groups:x(c),id:i}}function C(e,t){return e.filter(e=>e.parentId===t).map(e=>e.id)}function w(e,t){return e.filter(e=>e.parentId===t)}function T(e,t){let n=e.find(e=>e.id===t);if(!n)return e;let r=e.filter(e=>e.id!==t);return n.parentId?r.map(e=>e.id===n.parentId?{...e,items:[...e.items,...n.items]}:e.parentId===t?{...e,parentId:n.parentId}:e):r.map(e=>e.parentId===t?{id:e.id,name:e.name,items:e.items}:e)}function E(e,t,n){let r=e.find(e=>e.id===t);return!r||!_(n)||r.items.includes(n)?e:S(e,{id:r.id,name:r.name,items:[...r.items,n]}).groups}function D(e,t){let n=e.find(e=>e.items.includes(t))??null;return n?{groups:e.map(e=>e.id===n.id?{...e,items:e.items.filter(e=>e!==t)}:e).filter(e=>e.items.length>0),owner:n}:{groups:e,owner:null}}function O(e,t,n,r){let i=v(t),a=y(n.id),o=r.some(e=>e.id===n.id),s=e.indexOf(a),c=e.filter(e=>e!==i&&(o||e!==a)),l=s<0?c.length:o?s+1:s;return c.splice(l,0,i),A(c,r)}function oe(e){let t=new Map(e.map(e=>[e.id,e])),n=new Map;for(let r of e){let e=r.parentId?t.get(r.parentId)??r:r;for(let t of r.items)n.set(t,e)}let r=new Set,i=[];for(let e of f){let t=n.get(e.id);if(t){if(r.has(t.id))continue;r.add(t.id),i.push({type:`group`,group:t})}else i.push({type:`item`,id:e.id})}return i}function k(e){return oe(e).map(e=>e.type===`item`?v(e.id):y(e.group.id))}function se(e){let t=new Set,n=new Set;for(let r of e){r.parentId||n.add(y(r.id));for(let e of r.items)t.add(e)}for(let e of f)t.has(e.id)||n.add(v(e.id));return n}function A(e,t){let n=se(t),r=[],i=new Set;if(Array.isArray(e))for(let t of e)typeof t==`string`&&n.has(t)&&!i.has(t)&&(i.add(t),r.push(t));for(let e of k(t))i.has(e)||r.push(e);return r}function ce(e,t){let n=new Map(e.map(e=>[e.id,e])),r=new Set(e.flatMap(e=>e.items)),i=A(t,e),a=[];for(let e of i)if(e.startsWith(`group:`)){let t=n.get(e.slice(6));t&&a.push({type:`group`,group:t})}else if(e.startsWith(`item:`)){let t=e.slice(5);_(t)&&!r.has(t)&&a.push({type:`item`,id:t})}return a}function le(e,t,n){let r=t.find(e=>e.id===n);if(!r)return A(e,t);let i=new Set(r.items.map(e=>v(e))),a=y(n),o=[...e],s=o.length;for(let e=0;e<o.length;e++){let t=o[e];if(t===a||i.has(t)){s=o.slice(0,e).filter(e=>e!==a&&!i.has(e)).length;break}}let c=o.filter(e=>e!==a&&!i.has(e));return c.splice(s,0,a),A(c,t)}function ue(e,t,n,r=[]){if(t.parentId)return A(e,n);let i=y(t.id),a=[...r.map(e=>y(e)),...t.items.map(e=>v(e))],o=e.filter(e=>e!==i);return o.push(...a),A(o,n)}function de(e,t,n){let r=e.indexOf(t),i=e.indexOf(n);if(r<0||i<0||r===i)return[...e];let a=[...e],[o]=a.splice(r,1);return o===void 0?[...e]:(a.splice(i,0,o),a)}var j=`tw.space.active-id`,fe=`tw.spaces.list.v1`;function M(e,t){try{return(e===`local`?localStorage:sessionStorage).getItem(t)?.trim()||``}catch{return``}}function N(e,t,n){try{(e===`local`?localStorage:sessionStorage).setItem(t,n)}catch{}}function pe(e){let t=String(e||``).trim();t&&(N(`session`,j,t),N(`local`,j,t))}function P(){let e=M(`session`,j);if(e)return e;let t=M(`local`,j);if(t)return t;try{let e=sessionStorage.getItem(fe);if(!e)return``;let t=JSON.parse(e);return String(t?.activeId||``).trim()}catch{return``}}function F(e){let t=P();return t?`${e}::${t}`:e}var I=`/__tb_config`,L=`tw.app.config.v1`,R=`tw.app.apikey.v1`,z=`tw.app.model.v1`,B=!1,V=null,H=``,U=!1,me={language:`zh-CN`,appearance:`system`,sessionFontSize:14,toolStepDetail:`standard`,busySendBehavior:`queue`,subagentModel:``};function W(){return`p_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`}function he(e){if(!e||typeof e!=`object`)return null;let t=String(e.name??``).trim()||`未命名提供商`,n=String(e.baseURL??``).trim(),r=String(e.model??``).trim();return{id:String(e.id??``).trim()||W(),name:t,baseURL:n,model:r,apiKey:typeof e.apiKey==`string`&&e.apiKey.trim()?e.apiKey.trim():void 0,availableModels:Array.isArray(e.availableModels)?e.availableModels.filter(e=>typeof e==`string`):void 0}}function ge(e){let t=typeof e.baseURL==`string`?e.baseURL.trim():``,n=typeof e.model==`string`?e.model.trim():``;return!t&&!n&&!e.apiKey?[]:[{id:W(),name:`默认`,baseURL:t||`https://api.deepseek.com/v1`,model:n,apiKey:typeof e.apiKey==`string`&&e.apiKey.trim()?e.apiKey.trim():void 0,availableModels:Array.isArray(e.availableModels)?e.availableModels.filter(e=>typeof e==`string`):void 0}]}function G(e){let t=e?.reasoningEffort===`low`||e?.reasoningEffort===`high`||e?.reasoningEffort===`max`?e.reasoningEffort:`high`,n=[];Array.isArray(e?.providers)&&e.providers.length?n=e.providers.map(e=>he(e)).filter(e=>!!e):e&&(e.baseURL||e.model||e.apiKey)&&(n=ge(e));let r=typeof e?.activeId==`string`?e.activeId:``;return n.length&&!n.some(e=>e.id===r)&&(r=n[0].id),n.length||(r=``),{activeId:r,reasoningEffort:t,providers:n}}function K(){return{version:1,model:{activeId:``,reasoningEffort:`high`,providers:[]},access:`readonly`,general:{...me},plugins:{cases:!1,caseGen:!1,prompts:!1,promptGen:!1,knowledgeLib:!1,knowledgeGen:!1,requirements:!1,templates:!1,knowledge:!1,memory:!1,pluginDev:!1},caseTypes:e.map(e=>({...e})),promptKinds:c.map(e=>({...e})),knowledgeCategories:[...o],navGroups:p.map(e=>({...e,items:[...e.items]})),navIcons:{...h},navOrder:k(p)}}function q(e){let t=K();if(!e||typeof e!=`object`)return t;let n=e.general&&typeof e.general==`object`?e.general:{},r={...t.plugins,...e.plugins??{}},a=x(e.navGroups);return{version:typeof e.version==`number`?e.version:1,model:G(e.model),access:e.access===`readwrite`||e.access===`full`||e.access===`readonly`?e.access:`readonly`,general:{language:n.language===`en`?`en`:`zh-CN`,appearance:n.appearance===`light`||n.appearance===`dark`||n.appearance===`system`?n.appearance:`system`,sessionFontSize:typeof n.sessionFontSize==`number`&&n.sessionFontSize>=12&&n.sessionFontSize<=22?Math.round(n.sessionFontSize):14,toolStepDetail:n.toolStepDetail===`concise`||n.toolStepDetail===`standard`||n.toolStepDetail===`detailed`||n.toolStepDetail===`full`?n.toolStepDetail:`standard`,busySendBehavior:n.busySendBehavior===`interrupt`?`interrupt`:`queue`,subagentModel:typeof n.subagentModel==`string`?n.subagentModel.trim():``},plugins:r,caseTypes:i(e.caseTypes),promptKinds:d(e.promptKinds),knowledgeCategories:s(e.knowledgeCategories),navGroups:a,navIcons:g(e.navIcons),navOrder:A(e.navOrder,a)}}function _e(){try{let e=localStorage.getItem(z);if(e)return G(JSON.parse(e))}catch{}try{let e=localStorage.getItem(F(L));if(e){let t=JSON.parse(e);if(t?.model)return G(t.model)}}catch{}return null}function ve(e){try{localStorage.setItem(z,JSON.stringify(e))}catch{}}function J(){try{let e=localStorage.getItem(F(L)),t=_e();if(!e)return t?q({...K(),model:t}):null;let n=q(JSON.parse(e));return t&&(n.model=t),n}catch{return null}}function Y(e){try{let{model:t,...n}=e;localStorage.setItem(F(L),JSON.stringify(n)),ve(t)}catch{}}function ye(){try{return localStorage.getItem(R)?.trim()||localStorage.getItem(F(R))?.trim()||``}catch{return``}}function be(e){try{e?localStorage.setItem(R,e):localStorage.removeItem(R),localStorage.removeItem(F(R))}catch{}}function xe(){try{let e=K(),t=!1,n=localStorage.getItem(`tw-llm-settings`);if(n){let r=JSON.parse(n);e.model=G({providers:[{id:W(),name:r.name||`默认`,baseURL:r.baseURL||``,model:r.model||``,apiKey:r.apiKey,availableModels:r.availableModels}],reasoningEffort:r.reasoningEffort}),e.model.providers[0]&&(e.model.activeId=e.model.providers[0].id),t=!0}let r=localStorage.getItem(`tw-access-level`);(r===`readonly`||r===`readwrite`||r===`full`)&&(e.access=r,t=!0);let i=localStorage.getItem(`tw.general.prefs.v1`);i&&(e.general=q({general:JSON.parse(i)}).general,t=!0);let a=localStorage.getItem(`tw.plugins.enabled.v1`);if(a){let n=JSON.parse(a);e.plugins={...e.plugins,...n},t=!0}return t?e:null}catch{return null}}function X(e){let t=e.model.providers;return t.length?t.find(t=>t.id===e.model.activeId)??t[0]??null:null}function Se(){return B}function Z(){return V||Ce(),V??K()}function Ce(){if(!U&&(U=!0,typeof window<`u`))try{let e=J();e&&(V=e)}catch{}}function we(){return H}function Te(){return[...V?.model.providers??[]]}async function Ee(){try{let e=await fetch(I,{signal:AbortSignal.timeout(2e3)});if(e.ok){let t=await e.json();V=q(t.config);let n=X(V),r=String(t.apiKey??``).trim();return H=r||n?.apiKey?.trim()||``,r&&n&&!n.apiKey&&(H=r),B=!0,Y(V),V}}catch{}B=!1;let e=J();return e||=xe()??K(),V=e,H=X(e)?.apiKey?.trim()||ye(),Y(V),V}var Q=null;async function $(e){if(Y(e),B)try{await fetch(I,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({config:e})})}catch{}}function De(e){let t=V??K(),n=q({...t,...e,model:e.model?{...t.model,...e.model,providers:e.model.providers??t.model.providers}:t.model,general:{...t.general,...e.general??{}},plugins:{...t.plugins,...e.plugins??{}},caseTypes:e.caseTypes??t.caseTypes,promptKinds:e.promptKinds??t.promptKinds,knowledgeCategories:e.knowledgeCategories??t.knowledgeCategories,navGroups:e.navGroups??t.navGroups,navIcons:e.navIcons??t.navIcons,navOrder:e.navOrder??t.navOrder});return V=n,H=X(n)?.apiKey?.trim()||``,Q&&clearTimeout(Q),Q=setTimeout(()=>{Q=null,$(n)},280),n}function Oe(){return Q&&=(clearTimeout(Q),null),$(V??K())}function ke(e){if(H=e.trim(),B||be(H),!V)return;let t=V.model.providers.map(e=>e.id===V.model.activeId?{...e,apiKey:H||void 0}:e);V=q({...V,model:{...V.model,providers:t}})}function Ae(){let e=V;if(!e)return null;let t=X(e);if(!t?.baseURL?.trim()||!t.model?.trim())return null;let n=(t.apiKey||H).trim();return n?{baseURL:t.baseURL.trim(),apiKey:n,model:t.model.trim(),reasoningEffort:e.model.reasoningEffort,availableModels:t.availableModels}:null}function je(){return W()}export{D as A,e as B,w as C,O as D,A as E,u as F,a as H,te as I,d as L,de as M,S as N,ue as O,c as P,o as R,v as S,g as T,i as U,n as V,E as _,Se as a,ie as b,ke as c,P as d,pe as f,m as g,f as h,Ee as i,T as j,le as k,Ae as l,h as m,we as n,Te as o,F as p,Z as r,je as s,Oe as t,De as u,ce as v,x as w,y as x,C as y,s as z};
@@ -1,7 +0,0 @@
1
- import{a as e}from"./react-dom.CqAxpHMt.js";import{s as t}from"./settings.BoQ0e0m1.js";var n=e({applyDomI18n:()=>o,t:()=>a}),r={"nav.home":`我的工作台`,"nav.requirements":`需求文档库`,"nav.caseManage":`用例管理`,"nav.cases":`用例`,"nav.templates":`测试模板库`,"nav.docs":`文档库`,"nav.createGroup":`创建分组`,"nav.createSubgroup":`创建子分组`,"nav.assignGroup":`选择分组`,"nav.more":`更多操作`,"nav.groupActions":`分组操作`,"nav.addSubgroup":`添加子分组`,"nav.addToGroup":`添加到分组`,"nav.chooseIcon":`选择图标`,"nav.leaveGroup":`取消分组`,"nav.currentGroup":`当前`,"nav.noGroups":`还没有分组`,"nav.noAddableItems":`没有可添加的菜单项`,"nav.editGroup":`编辑`,"nav.editGroupTitle":`编辑分组`,"nav.sortMenu":`排序`,"nav.sortMenuTitle":`菜单排序`,"nav.sortHint":`按住拖动调整顺序`,"nav.sortUp":`上移`,"nav.sortDown":`下移`,"nav.done":`完成`,"nav.deleteGroup":`删除分组`,"nav.deleteGroupMsg":`删除分组后,其中的菜单项会在菜单栏平铺显示。`,"nav.deleteSubgroupMsg":`删除子分组后,其中的菜单项会回到上级分组。`,"nav.groupName":`分组名称`,"nav.groupItems":`选择菜单项`,"nav.groupItemsHint":`已加入其他分组的菜单不会列出。`,"nav.groupNameRequired":`请填写分组名称`,"nav.groupItemsRequired":`请至少选择一项`,"nav.groupSave":`保存`,"nav.groupCancel":`取消`,"nav.prompts":`提示词管理`,"nav.knowledge":`知识库管理`,"nav.plugins":`我的插件`,"nav.brand":`Lantern Harness`,"nav.settings":`设置`,"nav.changelog":`变更日志`,"nav.changelogShort":`版本日志`,"nav.helpCenter":`帮助中心`,"docs.nav.title":`文档`,"docs.nav.changelog":`版本日志`,"docs.nav.manual":`操作手册`,"docs.nav.install":`安装手册`,"nav.repo":`GitHub 仓库`,"nav.repoShort":`仓库`,"nav.npm":`npm 包`,"nav.npmShort":`npm`,"nav.site":`炊烟小站`,"nav.siteShort":`小站`,"nav.board":`问题与建议`,"nav.boardShort":`问题与建议`,"space.label":`数据空间`,"space.current":`当前空间`,"space.switchTo":`切换到该空间`,"space.manage":`管理空间`,"space.others":`其他空间`,"space.manageTitle":`空间管理`,"space.manageDesc":`每个数据空间是一份相互隔离的数据目录:需求 / 用例 / 提示词 / 知识库 / 模板、会话与配置互不影响。`,"space.listTitle":`全部空间`,"space.newTitle":`新建空间`,"space.nameLabel":`空间名称`,"space.namePlaceholder":`输入空间名称`,"space.create":`新建`,"space.promptBriefLabel":`提示词要求`,"space.promptBriefPlaceholder":`描述这个空间里的助手应怎样工作,Enter 或点发送生成提示词;Shift+Enter 换行`,"space.promptGenerate":`生成提示词`,"space.promptGenerating":`生成中…`,"space.promptGeneratingStatus":`正在生成提示词`,"space.promptStop":`停止生成`,"space.promptBodyLabel":`默认提示词`,"space.promptBodyPlaceholder":`将写入该空间的 默认提示词.md`,"space.promptHint":`创建后写入该空间的提示词管理,作为默认提示词。`,"space.promptNeedReq":`请先填写提示词要求,再生成。`,"space.promptNeedBody":`请先填写默认提示词。`,"space.promptNeedModel":`请先在设置里配置可用的模型后再生成。`,"space.promptGenEmpty":`模型没有给出可用提示词,请重试或直接手写。`,"space.needName":`请先填写空间名称。`,"space.created":`已创建「{name}」`,"space.createdWithPrompt":`已创建「{name}」,默认提示词已写入该空间的提示词管理`,"space.name":`名称`,"space.location":`位置`,"space.size":`体积`,"space.sizeTitle":`统计各空间占用的磁盘大小`,"space.sizing":`统计中…`,"space.status":`状态`,"space.builtin":`默认`,"space.publicName":`公共空间`,"space.activeTag":`当前`,"space.missing":`目录不存在`,"space.rename":`重命名`,"space.copy":`复制`,"space.export":`导出`,"space.exportContent":`导出内容库`,"space.exportContentTitle":`不含密钥、会话、记忆与缓存,适合分享内容`,"space.exportFull":`导出备份`,"space.exportFullTitle":`含密钥、会话与全部本机状态,适合自己备份`,"space.discover":`扫描文件夹`,"space.discoverTitle":`扫描托管目录,纳入带 .lantern/space.json 清单的空间文件夹;其它文件夹列出来等你确认`,"space.discovering":`扫描中…`,"space.discoverAdded":`已纳入 {n} 个空间`,"space.discoverNone":`没有发现可纳入的空间文件夹`,"space.discoverBackfilled":`并为 {n} 个已有空间补写了 space.json 清单`,"space.discoverSkipped":`跳过 {n} 个(重名、名称非法或缺空间元数据)`,"space.candidatesTitle":`扫描到 {n} 个不是数据空间的文件夹,要纳入吗?`,"space.candidatesHint":`勾选后纳入列表;不会写入空间清单(.lantern/space.json),文件夹内容保持原样。`,"space.candidatesSelectAll":`全选`,"space.candidatesClear":`全不选`,"space.candidatesIgnore":`忽略`,"space.candidatesIgnored":`已忽略,未纳入任何文件夹`,"space.candidatesAdopt":`纳入所选`,"space.candidatesAdopted":`已纳入 {n} 个文件夹`,"space.candidatesRejected":`未纳入:{names}`,"space.removeList":`移出列表`,"space.deleteDisk":`删除数据`,"space.import":`导入`,"space.refresh":`刷新`,"space.empty":`还没有自定义空间,点「新建空间」开始。`,"space.newParentHint":`新建的空间会落在:`,"space.switching":`正在切换…`,"space.reloadHint":`切换后页面会自动重载。`,"space.confirmRemoveTitle":`移出列表`,"space.confirmRemoveMsg":`将从列表中移除「{name}」,磁盘数据保留在:
2
- {path}
3
- 之后可在管理界面重新纳入。`,"space.confirmDeleteTitle":`删除数据`,"space.confirmDeleteMsg":`将永久删除「{name}」及其全部数据,无法恢复:
4
- {path}`,"space.confirmCopyTitle":`复制空间`,"space.confirmCopyMsg":`将复制「{name}」的全部内容到新空间,文件较多时可能耗时较久。`,"space.done":`完成`,"space.copyName":`副本名称`,"space.importPick":`选择要导入的 zip 备份`,"space.othersEmpty":`还没有其他空间。可点下方「管理空间」新建或导入。`,"space.busyRuns":`仍有会话在运行,请先停止后再切换空间。`,"space.publicLocked":`公共空间不支持重命名或删除。`,"space.offline":`工作区不可用`,"space.offlineCap":`未连接本地服务`,"settings.general":`通用设置`,"settings.model":`模型`,"settings.close":`关闭`,"settings.access":`权限`,"settings.accessDesc":`选择新会话的默认权限模式`,"settings.language":`语言`,"settings.appearance":`外观`,"settings.appear.light":`浅色`,"settings.appear.dark":`深色`,"settings.appear.system":`跟随系统`,"settings.fontSize":`字号大小`,"settings.fontSizeDesc":`调整正文与会话内容的字号(不影响侧栏布局)`,"settings.toolSteps":`工作步骤展示`,"settings.toolStepsDesc":`选择希望看到多少工具调用细节`,"settings.busySend":`繁忙时的发送行为`,"settings.busySendDesc":`智能体运行时 Enter 键和发送按钮的行为;Cmd/Ctrl+Enter 使用另一行为`,"settings.busySend.queue":`排队发送`,"settings.busySend.interrupt":`插话发送`,"settings.subagentModel":`子代理模型`,"settings.subagentModelDesc":`子代理默认跟随主会话模型;可改为当前提供商下的其它模型`,"settings.subagentModel.inherit":`跟随主会话`,"settings.platformVersion":`平台版本`,"settings.access.readonly":`仅可查看`,"settings.access.readwrite":`工作区内修改`,"settings.access.full":`完全权限`,"settings.step.concise":`简洁`,"settings.step.standard":`标准`,"settings.step.detailed":`详细`,"settings.step.full":`完全展开`,"settings.modelIntro":`填入各提供商的 API 密钥即可使用其模型。`,"settings.edit":`编辑`,"settings.delete":`删除`,"settings.addProvider":`+ 添加模型提供商`,"settings.back":`返回`,"settings.editProvider":`编辑提供商`,"settings.addProviderTitle":`添加提供商`,"settings.cancel":`取消`,"settings.save":`保存`,"settings.displayName":`显示名称`,"settings.preset":`服务商预设`,"settings.baseUrl":`Base URL`,"settings.apiKey":`API Key`,"settings.modelField":`模型`,"settings.keyHint":`模型保存在本机 ~/.config/lantern-harness/models.json,所有空间共用,不会上传 GitHub。`,"settings.modelPlaceholder":`请输入模型名`,"settings.recognizing":`识别中…`,"settings.recognized":`已识别 {n} 个`,"settings.recognizeFail":`识别失败,可手动填模型名`,"settings.recognizeKeep":`刷新失败,沿用已有列表`,"settings.deleteConfirm":`确定删除该模型提供商?`,"chat.emptyTitle":`提灯的人不问路`,"chat.emptyNoModel":`使用前请先配置模型。`,"chat.configureModel":`配置模型`,"chat.workbench":`我的工作台`,"chat.newSession":`新会话`,"chat.workspace":`工作区`,"tool.running":`工具执行中…`,"tool.callingKind":`正在调用{kind}`,"tool.doneKind":`{kind}完成`,"tool.callingNamed":`正在调用{kind}:{name}`,"tool.doneNamed":`{kind}完成:{name}`,"tool.callingFull":`正在调用{kind}({name})…`,"tool.doneFull":`{kind}已完成({name})`,"tool.kind.kb":`知识库`,"tool.kind.fs":`本地文件`,"tool.kind.memory":`会话记忆`,"tool.kind.webSearch":`网页搜索`,"tool.kind.webFetch":`网页获取`},i={"zh-CN":r,en:{"nav.home":`My Workbench`,"nav.requirements":`Requirements`,"nav.caseManage":`Test Cases`,"nav.cases":`Cases`,"nav.templates":`Test Templates`,"nav.docs":`Documents`,"nav.createGroup":`New group`,"nav.createSubgroup":`New subgroup`,"nav.assignGroup":`Choose group`,"nav.more":`More actions`,"nav.groupActions":`Group actions`,"nav.addSubgroup":`Add subgroup`,"nav.addToGroup":`Add to group`,"nav.chooseIcon":`Choose icon`,"nav.leaveGroup":`Leave group`,"nav.currentGroup":`Current`,"nav.noGroups":`No groups yet`,"nav.noAddableItems":`Nothing to add`,"nav.editGroup":`Edit`,"nav.editGroupTitle":`Edit group`,"nav.sortMenu":`Sort`,"nav.sortMenuTitle":`Sort menu`,"nav.sortHint":`Drag to reorder`,"nav.sortUp":`Move up`,"nav.sortDown":`Move down`,"nav.done":`Done`,"nav.deleteGroup":`Delete group`,"nav.deleteGroupMsg":`Items in this group will be shown flat in the menu.`,"nav.deleteSubgroupMsg":`Items in this subgroup will return to its parent group.`,"nav.groupName":`Group name`,"nav.groupItems":`Choose menu items`,"nav.groupItemsHint":`Items already in another group are hidden.`,"nav.groupNameRequired":`Enter a group name`,"nav.groupItemsRequired":`Select at least one item`,"nav.groupSave":`Save`,"nav.groupCancel":`Cancel`,"nav.prompts":`Prompts`,"nav.knowledge":`Knowledge Mgmt`,"nav.plugins":`My Plugins`,"nav.brand":`Lantern Harness`,"nav.settings":`Settings`,"nav.changelog":`Changelog`,"nav.changelogShort":`Changelog`,"nav.helpCenter":`Help Center`,"docs.nav.title":`Docs`,"docs.nav.changelog":`Changelog`,"docs.nav.manual":`User Guide`,"docs.nav.install":`Install Guide`,"nav.repo":`GitHub`,"nav.repoShort":`Repo`,"nav.npm":`npm package`,"nav.npmShort":`npm`,"nav.site":`Yycy Docs`,"nav.siteShort":`Site`,"nav.board":`Questions & suggestions`,"nav.boardShort":`Suggestions`,"space.label":`Data space`,"space.current":`Current space`,"space.switchTo":`Switch to this space`,"space.manage":`Manage spaces`,"space.others":`Other spaces`,"space.manageTitle":`Spaces`,"space.manageDesc":`Each data space is a fully isolated data directory: requirements, cases, prompts, knowledge, templates, sessions and config never leak across spaces.`,"space.listTitle":`All spaces`,"space.newTitle":`New space`,"space.nameLabel":`Space name`,"space.namePlaceholder":`Enter a space name`,"space.create":`Create`,"space.promptBriefLabel":`Prompt requirements`,"space.promptBriefPlaceholder":`Describe how the assistant should work. Enter or send to generate; Shift+Enter for a new line`,"space.promptGenerate":`Generate prompt`,"space.promptGenerating":`Generating…`,"space.promptGeneratingStatus":`Generating prompt`,"space.promptStop":`Stop generating`,"space.promptBodyLabel":`Default prompt`,"space.promptBodyPlaceholder":`Saved as 默认提示词.md in this space`,"space.promptHint":`Saved to this space’s Prompt management as the default prompt.`,"space.promptNeedReq":`Write prompt requirements before generating.`,"space.promptNeedBody":`Fill in the default prompt first.`,"space.promptNeedModel":`Configure a working model in Settings before generating.`,"space.promptGenEmpty":`The model returned an empty prompt. Retry, or write one yourself.`,"space.needName":`Enter a space name first.`,"space.created":`Created "{name}"`,"space.createdWithPrompt":`Created "{name}". The default prompt is in Prompt management.`,"space.name":`Name`,"space.location":`Location`,"space.size":`Size`,"space.sizeTitle":`Measure disk usage for each space`,"space.sizing":`Measuring…`,"space.status":`Status`,"space.builtin":`Default`,"space.publicName":`Public space`,"space.activeTag":`Active`,"space.missing":`Directory missing`,"space.rename":`Rename`,"space.copy":`Copy`,"space.export":`Export`,"space.exportContent":`Export content`,"space.exportContentTitle":`Excludes keys, sessions, memories and caches — safe to share`,"space.exportFull":`Export backup`,"space.exportFullTitle":`Includes keys, sessions and all local state — for your own backup`,"space.discover":`Scan folder`,"space.discoverTitle":`Scan the managed folder for space folders carrying a .lantern/space.json manifest; other folders are listed for your confirmation`,"space.discovering":`Scanning…`,"space.discoverAdded":`Adopted {n} space(s)`,"space.discoverNone":`No adoptable space folder found`,"space.discoverBackfilled":`Wrote space.json manifests for {n} existing space(s)`,"space.discoverSkipped":`Skipped {n} (name conflict, invalid name, or missing space metadata)`,"space.candidatesTitle":`Found {n} folder(s) that are not spaces. Adopt them?`,"space.candidatesHint":`Checked folders are added to the list. No space manifest (.lantern/space.json) is written; folder contents stay untouched.`,"space.candidatesSelectAll":`Select all`,"space.candidatesClear":`Select none`,"space.candidatesIgnore":`Ignore`,"space.candidatesIgnored":`Ignored — nothing was adopted`,"space.candidatesAdopt":`Adopt selected`,"space.candidatesAdopted":`Adopted {n} folder(s)`,"space.candidatesRejected":`Not adopted: {names}`,"space.removeList":`Unlist`,"space.deleteDisk":`Delete data`,"space.import":`Import`,"space.refresh":`Refresh`,"space.empty":`No custom space yet — click "New space" to start.`,"space.newParentHint":`New spaces are created under:`,"space.switching":`Switching…`,"space.reloadHint":`The page reloads automatically after switching.`,"space.confirmRemoveTitle":`Remove from list`,"space.confirmRemoveMsg":`This removes "{name}" from the list but keeps its data on disk:
5
- {path}
6
- It can be added back later.`,"space.confirmDeleteTitle":`Delete data`,"space.confirmDeleteMsg":`This permanently deletes "{name}" and all of its data, with no way to undo:
7
- {path}`,"space.confirmCopyTitle":`Copy space`,"space.confirmCopyMsg":`All content of "{name}" will be copied into a new space. This can take a while for large spaces.`,"space.done":`Done`,"space.copyName":`New copy name`,"space.importPick":`Choose a zip backup to import`,"space.othersEmpty":`No other spaces yet. Open Manage spaces below to create or import one.`,"space.busyRuns":`A session is still running. Stop it before switching spaces.`,"space.publicLocked":`The built-in public space cannot be renamed or deleted.`,"space.offline":`Workspace unavailable`,"space.offlineCap":`Local service offline`,"settings.general":`General`,"settings.model":`Models`,"settings.close":`Close`,"settings.access":`Permissions`,"settings.accessDesc":`Default permission mode for new sessions`,"settings.language":`Language`,"settings.appearance":`Appearance`,"settings.appear.light":`Light`,"settings.appear.dark":`Dark`,"settings.appear.system":`System`,"settings.fontSize":`Font size`,"settings.fontSizeDesc":`Body and session text size (sidebar layout stays fixed)`,"settings.toolSteps":`Tool step detail`,"settings.toolStepsDesc":`How much tool-call detail to show`,"settings.busySend":`Send while busy`,"settings.busySendDesc":`Enter / Send while the agent is running; Cmd/Ctrl+Enter uses the other action`,"settings.busySend.queue":`Queue`,"settings.busySend.interrupt":`Interrupt`,"settings.subagentModel":`Subagent model`,"settings.subagentModelDesc":`Subagents inherit the main chat model by default; pick another from the active provider`,"settings.subagentModel.inherit":`Follow main chat`,"settings.platformVersion":`Platform version`,"settings.access.readonly":`View only`,"settings.access.readwrite":`Edit in workspace`,"settings.access.full":`Full access`,"settings.step.concise":`Concise`,"settings.step.standard":`Standard`,"settings.step.detailed":`Detailed`,"settings.step.full":`Full`,"settings.modelIntro":`Add each provider’s API key to use its models.`,"settings.edit":`Edit`,"settings.delete":`Delete`,"settings.addProvider":`+ Add model provider`,"settings.back":`Back`,"settings.editProvider":`Edit provider`,"settings.addProviderTitle":`Add provider`,"settings.cancel":`Cancel`,"settings.save":`Save`,"settings.displayName":`Display name`,"settings.preset":`Provider preset`,"settings.baseUrl":`Base URL`,"settings.apiKey":`API Key`,"settings.modelField":`Model`,"settings.keyHint":`Models are saved in ~/.config/lantern-harness/models.json and shared across spaces; never pushed to GitHub.`,"settings.modelPlaceholder":`Enter model id`,"settings.recognizing":`Detecting…`,"settings.recognized":`{n} models found`,"settings.recognizeFail":`Detection failed — enter a model id manually`,"settings.recognizeKeep":`Refresh failed — keeping previous list`,"settings.deleteConfirm":`Delete this model provider?`,"chat.emptyTitle":`Those who carry the lantern do not ask the way.`,"chat.emptyNoModel":`Configure a model to get started.`,"chat.configureModel":`Configure model`,"chat.workbench":`My Workbench`,"chat.newSession":`New chat`,"chat.workspace":`Workspace`,"tool.running":`Running tool…`,"tool.callingKind":`Calling {kind}`,"tool.doneKind":`{kind} done`,"tool.callingNamed":`Calling {kind}: {name}`,"tool.doneNamed":`{kind} done: {name}`,"tool.callingFull":`Calling {kind} ({name})…`,"tool.doneFull":`{kind} finished ({name})`,"tool.kind.kb":`knowledge base`,"tool.kind.fs":`local files`,"tool.kind.memory":`memory`,"tool.kind.webSearch":`web search`,"tool.kind.webFetch":`web fetch`}};function a(e,n,r){let a=i[r??(typeof window<`u`?t().language:`zh-CN`)]?.[e]??i[`zh-CN`][e]??e;if(n)for(let[e,t]of Object.entries(n))a=a.replaceAll(`{${e}}`,String(t));return a}function o(e){if(typeof document>`u`)return;let n=e??t().language;document.documentElement.lang=n===`en`?`en`:`zh-CN`,document.querySelectorAll(`[data-i18n]`).forEach(e=>{let t=e.dataset.i18n;t&&t in r&&(e.textContent=a(t,void 0,n))}),document.querySelectorAll(`[data-i18n-hint]`).forEach(e=>{let t=e.dataset.i18nHint;t&&t in r&&(e.dataset.hint=a(t,void 0,n))})}export{a as n,n as t};
@@ -1 +0,0 @@
1
- import{c as e,n as t,t as n}from"./react-dom.CqAxpHMt.js";import{C as r,D as i,E as a,S as o,T as s,_ as c,a as l,c as u,d,f,g as p,h as m,i as h,l as g,m as _,n as v,o as y,p as b,r as x,s as S,t as C,u as w,w as T,x as E,y as D}from"./use-text-value.C0IDspmh.js";import{$ as O,C as k,D as A,F as j,H as M,I as N,L as P,M as ee,O as F,P as I,R as L,T as te,U as R,X as ne,_ as re,_t as ie,at as ae,c as oe,ct as se,d as ce,dt as le,et as ue,ft as z,gt as de,h as fe,ht as B,it as V,j as pe,l as H,lt as U,m as me,mt as he,n as ge,nt as _e,o as ve,ot as W,p as ye,pt as G,tt as K,v as be,w as xe,yt as Se,z as q}from"./portal.C3KrUREL.js";var J=e(t(),1),Y=e(n(),1);function Ce(e,t,n){let[r,i]=(0,J.useState)(n),a=e!==void 0,o=(0,J.useRef)(a),s=(0,J.useRef)(!1),c=(0,J.useRef)(!1);return a&&!o.current&&!s.current?(s.current=!0,o.current=a,console.error(`A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.`)):!a&&o.current&&!c.current&&(c.current=!0,o.current=a,console.error(`A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.`)),[a?e:r,G(e=>(a||(0,Y.flushSync)(()=>i(e)),t?.(e)))]}function we(e){let[t]=(0,J.useState)(e);return t}function Te(e={},t=null,n=[]){for(let[r,i]of Object.entries(e))De(n,Ee(t,r),i);return n}function Ee(e,t){return e?e+`[`+t+`]`:t}function De(e,t,n){if(Array.isArray(n))for(let[r,i]of n.entries())De(e,Ee(t,r.toString()),i);else n instanceof Date?e.push([t,n.toISOString()]):typeof n==`boolean`?e.push([t,n?`1`:`0`]):typeof n==`string`?e.push([t,n]):typeof n==`number`?e.push([t,`${n}`]):n==null?e.push([t,``]):ke(n)&&!(0,J.isValidElement)(n)&&Te(n,t,e)}function Oe(e){var t;let n=e?.form??e.closest(`form`);if(n){for(let t of n.elements)if(t!==e&&(t.tagName===`INPUT`&&t.type===`submit`||t.tagName===`BUTTON`&&t.type===`submit`||t.nodeName===`INPUT`&&t.type===`image`)){t.click();return}(t=n.requestSubmit)==null||t.call(n)}}function ke(e){if(Object.prototype.toString.call(e)!==`[object Object]`)return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}var Ae=(0,J.createContext)(null);function je({children:e}){let t=(0,J.useContext)(Ae);if(!t)return J.createElement(J.Fragment,null,e);let{target:n}=t;return n?(0,Y.createPortal)(J.createElement(J.Fragment,null,e),n):null}function Me({data:e,form:t,disabled:n,onReset:r,overrides:i}){let[a,o]=(0,J.useState)(null),s=de();return(0,J.useEffect)(()=>{if(r&&a)return s.addEventListener(a,`reset`,r)},[a,t,r]),J.createElement(je,null,J.createElement(Ne,{setForm:o,formId:t}),Te(e).map(([e,r])=>J.createElement(O,{features:ue.Hidden,...se({key:e,as:`input`,type:`hidden`,hidden:!0,readOnly:!0,form:t,disabled:n,name:e,value:r,...i})})))}function Ne({setForm:e,formId:t}){return(0,J.useEffect)(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:J.createElement(O,{features:ue.Hidden,as:`input`,type:`hidden`,hidden:!0,readOnly:!0,ref:t=>{if(!t)return;let n=t.closest(`form`);n&&e(n)}})}function Pe(e,t){return e!==null&&t!==null&&typeof e==`object`&&typeof t==`object`&&`id`in e&&`id`in t?e.id===t.id:e===t}function Fe(e=Pe){return(0,J.useCallback)((t,n)=>{if(typeof e==`string`){let r=e;return t?.[r]===n?.[r]}return e(t,n)},[e])}function Ie({children:e,freeze:t},n){let r=Re(t,e);return(0,J.isValidElement)(r)?(0,J.cloneElement)(r,{ref:n}):J.createElement(J.Fragment,null,r)}var Le=J.forwardRef(Ie);function Re(e,t){let[n,r]=(0,J.useState)(t);return!e&&n!==t&&r(t),e?n:t}var ze=Object.defineProperty,Be=(e,t,n)=>t in e?ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ve=(e,t,n)=>(Be(e,typeof t==`symbol`?t:t+``,n),n),X=(e=>(e[e.Open=0]=`Open`,e[e.Closed=1]=`Closed`,e))(X||{}),Z=(e=>(e[e.Single=0]=`Single`,e[e.Multi=1]=`Multi`,e))(Z||{}),He=(e=>(e[e.Pointer=0]=`Pointer`,e[e.Other=1]=`Other`,e))(He||{}),Ue=(e=>(e[e.OpenListbox=0]=`OpenListbox`,e[e.CloseListbox=1]=`CloseListbox`,e[e.GoToOption=2]=`GoToOption`,e[e.Search=3]=`Search`,e[e.ClearSearch=4]=`ClearSearch`,e[e.SelectOption=5]=`SelectOption`,e[e.RegisterOptions=6]=`RegisterOptions`,e[e.UnregisterOptions=7]=`UnregisterOptions`,e[e.SetButtonElement=8]=`SetButtonElement`,e[e.SetOptionsElement=9]=`SetOptionsElement`,e[e.SortOptions=10]=`SortOptions`,e[e.MarkButtonAsMoved=11]=`MarkButtonAsMoved`,e))(Ue||{});function We(e,t=e=>e){let n=e.activeOptionIndex===null?null:e.options[e.activeOptionIndex],r=k(t(e.options.slice()),e=>e.dataRef.current.domRef.current),i=n?r.indexOf(n):null;return i===-1&&(i=null),{options:r,activeOptionIndex:i}}var Ge={1(e){if(e.dataRef.current.disabled||e.listboxState===1)return e;let t=e.buttonElement?x.Tracked(v(e.buttonElement)):e.buttonPositionState;return{...e,activeOptionIndex:null,pendingFocus:{focus:l.Nothing},listboxState:1,__demoMode:!1,buttonPositionState:t}},0(e,t){if(e.dataRef.current.disabled||e.listboxState===0)return e;let n=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,i=e.options.findIndex(e=>r(e.dataRef.current.value));return i!==-1&&(n=i),{...e,frozenValue:!1,pendingFocus:t.focus,listboxState:0,activeOptionIndex:n,__demoMode:!1,buttonPositionState:x.Idle}},2(e,t){if(e.dataRef.current.disabled||e.listboxState===1)return e;let n={...e,searchQuery:``,activationTrigger:t.trigger??1,__demoMode:!1};if(t.focus===l.Nothing)return{...n,activeOptionIndex:null};if(t.focus===l.Specific)return{...n,activeOptionIndex:e.options.findIndex(e=>e.id===t.id)};if(t.focus===l.Previous){let r=e.activeOptionIndex;if(r!==null){let i=e.options[r].dataRef.current.domRef,a=y(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled});if(a!==null){let t=e.options[a].dataRef.current.domRef;if(i.current?.previousElementSibling===t.current||t.current?.previousElementSibling===null)return{...n,activeOptionIndex:a}}}}else if(t.focus===l.Next){let r=e.activeOptionIndex;if(r!==null){let i=e.options[r].dataRef.current.domRef,a=y(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled});if(a!==null){let t=e.options[a].dataRef.current.domRef;if(i.current?.nextElementSibling===t.current||t.current?.nextElementSibling===null)return{...n,activeOptionIndex:a}}}}let r=We(e),i=y(t,{resolveItems:()=>r.options,resolveActiveIndex:()=>r.activeOptionIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled});return{...n,...r,activeOptionIndex:i}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=+(e.searchQuery===``),r=e.searchQuery+t.value.toLowerCase(),i=(e.activeOptionIndex===null?e.options:e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n))).find(e=>!e.dataRef.current.disabled&&e.dataRef.current.textValue?.startsWith(r)),a=i?e.options.indexOf(i):-1;return a===-1||a===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:a,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===``?e:{...e,searchQuery:``}},5(e){return e.dataRef.current.mode===0?{...e,frozenValue:!0}:{...e}},6:(e,t)=>{let n=e.options.concat(t.options),r=e.activeOptionIndex;if(e.pendingFocus.focus!==l.Nothing&&(r=y(e.pendingFocus,{resolveItems:()=>n,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled})),e.activeOptionIndex===null){let{isSelected:t}=e.dataRef.current;if(t){let e=n.findIndex(e=>t?.(e.dataRef.current.value));e!==-1&&(r=e)}}return{...e,options:n,activeOptionIndex:r,pendingFocus:{focus:l.Nothing},pendingShouldSort:!0}},7:(e,t)=>{let n=e.options,r=[],i=new Set(t.options);for(let[e,t]of n.entries())if(i.has(t.id)&&(r.push(e),i.delete(t.id),i.size===0))break;if(r.length>0){n=n.slice();for(let e of r.reverse())n.splice(e,1)}return{...e,options:n,activationTrigger:1}},8:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},9:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},10:e=>e.pendingShouldSort?{...e,...We(e),pendingShouldSort:!1}:e,11(e){return e.buttonPositionState.kind===`Tracked`?{...e,buttonPositionState:x.Moved}:e}},Ke=class e extends P{constructor(e){super(e),Ve(this,`actions`,{onChange:e=>{let{onChange:t,compare:n,mode:r,value:i}=this.state.dataRef.current;return U(r,{0:()=>t?.(e),1:()=>{let r=i.slice(),a=r.findIndex(t=>n(t,e));return a===-1?r.push(e):r.splice(a,1),t?.(r)}})},registerOption:L(()=>{let e=[],t=new Set;return[(n,r)=>{t.has(r)||(t.add(r),e.push({id:n,dataRef:r}))},()=>(t.clear(),this.send({type:6,options:e.splice(0)}))]}),unregisterOption:L(()=>{let e=[];return[t=>e.push(t),()=>{this.send({type:7,options:e.splice(0)})}]}),goToOption:L(()=>{let e=null;return[(t,n)=>{e={type:2,...t,trigger:n}},()=>e&&this.send(e)]}),closeListbox:()=>{this.send({type:1})},openListbox:e=>{this.send({type:0,focus:e})},selectActiveOption:()=>{var e;if(this.state.activeOptionIndex!==null){let{dataRef:e}=this.state.options[this.state.activeOptionIndex];this.actions.selectOption(e.current.value)}else this.state.dataRef.current.mode===0&&(this.actions.closeListbox(),(e=this.state.buttonElement)==null||e.focus({preventScroll:!0}))},selectOption:e=>{this.send({type:5,value:e})},search:e=>{this.send({type:3,value:e})},clearSearch:()=>{this.send({type:4})},setButtonElement:e=>{this.send({type:8,element:e})},setOptionsElement:e=>{this.send({type:9,element:e})}}),Ve(this,`selectors`,{activeDescendantId(e){var t;let n=e.activeOptionIndex,r=e.options;return n===null||(t=r[n])==null?void 0:t.id},isActive(e,t){let n=e.activeOptionIndex,r=e.options;return n!==null&&r[n]?.id===t},hasFrozenValue(e){return e.frozenValue},shouldScrollIntoView(e,t){return e.__demoMode||e.listboxState!==0||e.activationTrigger===0?!1:this.isActive(e,t)},didButtonMove(e){return e.buttonPositionState.kind===`Moved`}}),this.on(6,()=>{requestAnimationFrame(()=>{this.send({type:10})})});{let e=this.state.id,t=N.get(null);this.disposables.add(t.on(j.Push,n=>{!t.selectors.isTop(n,e)&&this.state.listboxState===0&&this.actions.closeListbox()})),this.on(0,()=>t.actions.push(e)),this.on(1,()=>t.actions.pop(e))}this.disposables.group(e=>{this.on(1,t=>{t.buttonElement&&(e.dispose(),e.add(h(t.buttonElement,t.buttonPositionState,()=>{this.send({type:11})})))})}),this.on(5,(e,t)=>{var n;this.actions.onChange(t.value),this.state.dataRef.current.mode===0&&(this.actions.closeListbox(),(n=this.state.buttonElement)==null||n.focus({preventScroll:!0}))})}static new({id:t,__demoMode:n=!1}){return new e({id:t,dataRef:{current:{}},listboxState:+!n,options:[],searchQuery:``,activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:l.Nothing},frozenValue:!1,__demoMode:n,buttonPositionState:x.Idle})}reduce(e,t){return U(t.type,Ge,e,t)}},qe=(0,J.createContext)(null);function Je(e){let t=(0,J.useContext)(qe);if(t===null){let t=Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Ye),t}return t}function Ye({id:e,__demoMode:t=!1}){let n=(0,J.useMemo)(()=>Ke.new({id:e,__demoMode:t}),[]);return ve(()=>n.dispose()),n}var Q=(0,J.createContext)(null);Q.displayName=`ListboxDataContext`;function $(e){let t=(0,J.useContext)(Q);if(t===null){let t=Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,$),t}return t}var Xe=J.Fragment;function Ze(e,t){let n=(0,K.useId)(),r=le(),{value:i,defaultValue:a,form:s,name:c,onChange:l,by:u,invalid:d=!1,disabled:f=r||!1,horizontal:p=!1,multiple:m=!1,__demoMode:h=!1,...g}=e,_=p?`horizontal`:`vertical`,v=R(t),y=we(a),[b=m?[]:void 0,x]=Ce(i,l,y),C=Ye({id:n,__demoMode:h}),w=(0,J.useRef)({static:!1,hold:!1}),T=(0,J.useRef)(new Map),E=Fe(u),D=(0,J.useCallback)(e=>U(O.mode,{[Z.Multi]:()=>b.some(t=>E(t,e)),[Z.Single]:()=>E(b,e)}),[b]),O=z({value:b,disabled:f,invalid:d,mode:m?Z.Multi:Z.Single,orientation:_,onChange:x,compare:E,isSelected:D,optionsPropsRef:w,listRef:T});B(()=>{C.state.dataRef.current=O},[O]);let k=I(C,e=>e.listboxState),A=N.get(null),j=I(A,(0,J.useCallback)(e=>A.selectors.isTop(e,n),[A,n])),[M,P]=I(C,e=>[e.buttonElement,e.optionsElement]);be(j,[M,P],(e,t)=>{C.send({type:Ue.CloseListbox}),xe(t,te.Loose)||(e.preventDefault(),M?.focus())});let ee=z({open:k===X.Open,disabled:f,invalid:d,value:b}),[F,L]=o({inherit:!0}),ne={ref:v},re=(0,J.useCallback)(()=>{if(y!==void 0)return x?.(y)},[x,y]),ie=V();return J.createElement(L,{value:F,props:{htmlFor:M?.id},slot:{open:k===X.Open,disabled:f}},J.createElement(S,null,J.createElement(qe.Provider,{value:C},J.createElement(Q.Provider,{value:O},J.createElement(oe,{value:U(k,{[X.Open]:H.Open,[X.Closed]:H.Closed})},c!=null&&b!=null&&J.createElement(Me,{disabled:f,data:{[c]:b},form:s,onReset:re}),ie({ourProps:ne,theirProps:g,slot:ee,defaultTag:Xe,name:`Listbox`}))))))}var Qe=`button`;function $e(e,t){let n=(0,K.useId)(),r=T(),o=$(`Listbox.Button`),f=Je(`Listbox.Button`),{id:h=r||`headlessui-listbox-button-${n}`,disabled:g=o.disabled||!1,autoFocus:v=!1,...y}=e,b=R(t,u(),f.actions.setButtonElement),x=d(),[S,C,w]=I(f,e=>[e.listboxState,e.buttonElement,e.optionsElement]),D=S===X.Open;m(D,{trigger:C,action:(0,J.useCallback)(e=>{if(C!=null&&C.contains(e.target))return p.Ignore;let t=e.target.closest(`[role="option"]:not([data-disabled])`);return ne(t)?p.Select(t):w!=null&&w.contains(e.target)?p.Ignore:p.Close},[C,w]),close:f.actions.closeListbox,select:f.actions.selectActiveOption});let O=G(e=>{switch(e.key){case q.Enter:Oe(e.currentTarget);break;case q.Space:case q.ArrowDown:e.preventDefault(),f.actions.openListbox({focus:o.value?l.Nothing:l.First});break;case q.ArrowUp:e.preventDefault(),f.actions.openListbox({focus:o.value?l.Nothing:l.Last})}}),k=G(e=>{switch(e.key){case q.Space:e.preventDefault()}}),A=c(e=>{var t;f.state.listboxState===X.Open?((0,Y.flushSync)(()=>f.actions.closeListbox()),(t=f.state.buttonElement)==null||t.focus({preventScroll:!0})):(e.preventDefault(),f.actions.openListbox({focus:l.Nothing}))}),j=G(e=>e.preventDefault()),N=E([h]),P=M(),{isFocusVisible:ee,focusProps:F}=i({autoFocus:v}),{isHovered:L,hoverProps:te}=a({isDisabled:g}),{pressed:re,pressProps:ie}=s({disabled:g}),oe=z({open:S===X.Open,active:re||S===X.Open,disabled:g,invalid:o.invalid,value:o.value,hover:L,focus:ee,autofocus:v}),se=I(f,e=>e.listboxState===X.Open),ce=ae(x(),{ref:b,id:h,type:_(e,C),"aria-haspopup":`listbox`,"aria-controls":w?.id,"aria-expanded":se,"aria-labelledby":N,"aria-describedby":P,disabled:g||void 0,autoFocus:v,onKeyDown:O,onKeyUp:k,onKeyPress:j},A,F,te,ie);return V()({ourProps:ce,theirProps:y,slot:oe,defaultTag:Qe,name:`Listbox.Button`})}var et=(0,J.createContext)(!1),tt=`div`,nt=_e.RenderStrategy|_e.Static;function rt(e,t){let n=(0,K.useId)(),{id:r=`headlessui-listbox-options-${n}`,anchor:i,portal:a=!1,modal:o=!0,transition:s=!1,...c}=e,u=f(i),[d,p]=(0,J.useState)(null);u&&(a=!0);let m=$(`Listbox.Options`),h=Je(`Listbox.Options`),[_,v,y,b]=I(h,e=>[e.listboxState,e.buttonElement,e.optionsElement,e.__demoMode]),x=re(v),S=re(y),C=ce(),[T,E]=ye(s,d,C===null?_===X.Open:(C&H.Open)===H.Open);pe(T,v,h.actions.closeListbox);let O=!b&&o&&_===X.Open;fe(O,S);let k=!b&&o&&_===X.Open;ee(k,{allowed:(0,J.useCallback)(()=>[v,y],[v,y])});let j=!I(h,h.selectors.didButtonMove)&&T,M=Re(I(h,h.selectors.hasFrozenValue)&&!e.static,m.value),N=(0,J.useCallback)(e=>m.compare(M,e),[m.compare,M]),P=I(h,e=>{var t;if(u==null||!((t=u?.to)!=null&&t.includes(`selection`)))return null;let n=e.options.findIndex(e=>N(e.dataRef.current.value));return n===-1&&(n=0),n}),L=(()=>{if(u==null)return;if(P===null)return{...u,inner:void 0};let e=Array.from(m.listRef.current.values());return{...u,inner:{listRef:{current:e},index:P}}})(),[te,ne]=g(L),ie=w(),oe=R(t,u?te:null,h.actions.setOptionsElement,p),se=de();(0,J.useEffect)(()=>{let e=y;e&&_===X.Open&&(Se(e)||e==null||e.focus({preventScroll:!0}))},[_,y]);let le=G(e=>{var t;switch(se.dispose(),e.key){case q.Space:if(h.state.searchQuery!==``)return e.preventDefault(),e.stopPropagation(),h.actions.search(e.key);case q.Enter:e.preventDefault(),e.stopPropagation(),h.actions.selectActiveOption();break;case U(m.orientation,{vertical:q.ArrowDown,horizontal:q.ArrowRight}):return e.preventDefault(),e.stopPropagation(),h.actions.goToOption({focus:l.Next});case U(m.orientation,{vertical:q.ArrowUp,horizontal:q.ArrowLeft}):return e.preventDefault(),e.stopPropagation(),h.actions.goToOption({focus:l.Previous});case q.Home:case q.PageUp:return e.preventDefault(),e.stopPropagation(),h.actions.goToOption({focus:l.First});case q.End:case q.PageDown:return e.preventDefault(),e.stopPropagation(),h.actions.goToOption({focus:l.Last});case q.Escape:e.preventDefault(),e.stopPropagation(),(0,Y.flushSync)(()=>h.actions.closeListbox()),(t=h.state.buttonElement)==null||t.focus({preventScroll:!0});return;case q.Tab:e.preventDefault(),e.stopPropagation(),(0,Y.flushSync)(()=>h.actions.closeListbox()),A(h.state.buttonElement,e.shiftKey?F.Previous:F.Next);break;default:e.key.length===1&&(h.actions.search(e.key),se.setTimeout(()=>h.actions.clearSearch(),350))}}),ue=I(h,e=>e.buttonElement?.id),B=z({open:_===X.Open}),he=ae(u?ie():{},{id:r,ref:oe,"aria-activedescendant":I(h,h.selectors.activeDescendantId),"aria-multiselectable":m.mode===Z.Multi||void 0,"aria-labelledby":ue,"aria-orientation":m.orientation,onKeyDown:le,role:`listbox`,tabIndex:_===X.Open?0:void 0,style:{...c.style,...ne,"--button-width":D(T,v,!0).width},...me(E)}),_e=V(),ve=(0,J.useMemo)(()=>m.mode===Z.Multi?m:{...m,isSelected:N},[m,N]);return J.createElement(ge,{enabled:a?e.static||T:!1,ownerDocument:x},J.createElement(Q.Provider,{value:ve},_e({ourProps:he,theirProps:c,slot:B,defaultTag:tt,features:nt,visible:j,name:`Listbox.Options`})))}var it=`div`;function at(e,t){let n=(0,K.useId)(),{id:r=`headlessui-listbox-option-${n}`,disabled:i=!1,value:a,...o}=e,s=(0,J.useContext)(et)===!0,c=$(`Listbox.Option`),u=Je(`Listbox.Option`),d=I(u,e=>u.selectors.isActive(e,r)),f=c.isSelected(a),p=(0,J.useRef)(null),m=C(p),h=he({disabled:i,value:a,domRef:p,get textValue(){return m()}}),g=R(t,p,e=>{e?c.listRef.current.set(r,e):c.listRef.current.delete(r)}),_=I(u,e=>u.selectors.shouldScrollIntoView(e,r));B(()=>{if(_)return ie().requestAnimationFrame(()=>{var e,t;(t=(e=p.current)?.scrollIntoView)==null||t.call(e,{block:`nearest`})})},[_,p]),B(()=>{if(!s)return u.actions.registerOption(r,h),()=>u.actions.unregisterOption(r)},[h,r,s]);let v=G(e=>{if(i)return e.preventDefault();u.actions.selectOption(a)}),y=G(()=>{if(i)return u.actions.goToOption({focus:l.Nothing});u.actions.goToOption({focus:l.Specific,id:r})}),x=b(),S=G(e=>x.update(e)),w=G(e=>{x.wasMoved(e)&&(i||d&&u.state.activationTrigger===He.Pointer||u.actions.goToOption({focus:l.Specific,id:r},He.Pointer))}),T=G(e=>{x.wasMoved(e)&&(i||d&&u.state.activationTrigger===He.Pointer&&u.actions.goToOption({focus:l.Nothing}))}),E=z({active:d,focus:d,selected:f,disabled:i,selectedOption:f&&s}),D=s?{}:{id:r,ref:g,role:`option`,tabIndex:i===!0?void 0:-1,"aria-disabled":i===!0||void 0,"aria-selected":f,disabled:void 0,onClick:v,onFocus:y,onPointerEnter:S,onMouseEnter:S,onPointerMove:w,onMouseMove:w,onPointerLeave:T,onMouseLeave:T},O=V();return!f&&s?null:O({ourProps:D,theirProps:o,slot:E,defaultTag:it,name:`Listbox.Option`})}var ot=J.Fragment;function st(e,t){let{options:n,placeholder:r,...i}=e,a={ref:R(t)},o=$(`ListboxSelectedOption`),s=z({}),c=o.value===void 0||o.value===null||o.mode===Z.Multi&&Array.isArray(o.value)&&o.value.length===0,l=V();return J.createElement(et.Provider,{value:!0},l({ourProps:a,theirProps:{...i,children:J.createElement(J.Fragment,null,r&&c?r:n)},slot:s,defaultTag:ot,name:`ListboxSelectedOption`}))}var ct=W(Ze),lt=W($e),ut=r,dt=W(rt),ft=W(at),pt=W(st),mt=Object.assign(ct,{Button:lt,Label:ut,Options:dt,Option:ft,SelectedOption:pt});export{Le as a,Me as c,lt as i,we as l,ft as n,Re as o,mt as r,Fe as s,dt as t,Ce as u};
@@ -1 +0,0 @@
1
- import{c as e,n as t,t as n}from"./react-dom.CqAxpHMt.js";import{D as r,E as i,S as a,T as o,_ as s,a as c,b as l,c as u,d,f,g as p,h as m,i as h,l as g,m as _,n as v,o as y,p as b,r as x,s as S,t as C,u as w,y as T}from"./use-text-value.C0IDspmh.js";import{B as E,C as D,D as O,E as k,F as A,I as j,L as M,M as ee,O as N,P,R as F,T as te,U as I,X as L,_ as ne,_t as re,at as ie,c as ae,d as oe,ft as R,gt as se,h as ce,ht as z,it as B,j as le,l as V,lt as H,m as ue,n as de,nt as U,o as fe,ot as W,p as pe,pt as G,tt as K,v as me,w as he,yt as ge,z as q}from"./portal.C3KrUREL.js";import{t as _e}from"./use-tree-walker.oRTnhHS-.js";var J=e(t(),1),Y=e(n(),1),ve=Object.defineProperty,ye=(e,t,n)=>t in e?ve(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,be=(e,t,n)=>(ye(e,typeof t==`symbol`?t:t+``,n),n),X=(e=>(e[e.Open=0]=`Open`,e[e.Closed=1]=`Closed`,e))(X||{}),Z=(e=>(e[e.Pointer=0]=`Pointer`,e[e.Other=1]=`Other`,e))(Z||{}),Q=(e=>(e[e.OpenMenu=0]=`OpenMenu`,e[e.CloseMenu=1]=`CloseMenu`,e[e.GoToItem=2]=`GoToItem`,e[e.Search=3]=`Search`,e[e.ClearSearch=4]=`ClearSearch`,e[e.RegisterItems=5]=`RegisterItems`,e[e.UnregisterItems=6]=`UnregisterItems`,e[e.SetButtonElement=7]=`SetButtonElement`,e[e.SetItemsElement=8]=`SetItemsElement`,e[e.SortItems=9]=`SortItems`,e[e.MarkButtonAsMoved=10]=`MarkButtonAsMoved`,e))(Q||{});function xe(e,t=e=>e){let n=e.activeItemIndex===null?null:e.items[e.activeItemIndex],r=D(t(e.items.slice()),e=>e.dataRef.current.domRef.current),i=n?r.indexOf(n):null;return i===-1&&(i=null),{items:r,activeItemIndex:i}}var Se={1(e){if(e.menuState===1)return e;let t=e.buttonElement?x.Tracked(v(e.buttonElement)):e.buttonPositionState;return{...e,activeItemIndex:null,pendingFocus:{focus:c.Nothing},menuState:1,buttonPositionState:t}},0(e,t){return e.menuState===0?e:{...e,__demoMode:!1,pendingFocus:t.focus,menuState:0,buttonPositionState:x.Idle}},2:(e,t)=>{if(e.menuState===1)return e;let n={...e,searchQuery:``,activationTrigger:t.trigger??1,__demoMode:!1};if(t.focus===c.Nothing)return{...n,activeItemIndex:null};if(t.focus===c.Specific)return{...n,activeItemIndex:e.items.findIndex(e=>e.id===t.id)};if(t.focus===c.Previous){let r=e.activeItemIndex;if(r!==null){let i=e.items[r].dataRef.current.domRef,a=y(t,{resolveItems:()=>e.items,resolveActiveIndex:()=>e.activeItemIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled});if(a!==null){let t=e.items[a].dataRef.current.domRef;if(i.current?.previousElementSibling===t.current||t.current?.previousElementSibling===null)return{...n,activeItemIndex:a}}}}else if(t.focus===c.Next){let r=e.activeItemIndex;if(r!==null){let i=e.items[r].dataRef.current.domRef,a=y(t,{resolveItems:()=>e.items,resolveActiveIndex:()=>e.activeItemIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled});if(a!==null){let t=e.items[a].dataRef.current.domRef;if(i.current?.nextElementSibling===t.current||t.current?.nextElementSibling===null)return{...n,activeItemIndex:a}}}}let r=xe(e),i=y(t,{resolveItems:()=>r.items,resolveActiveIndex:()=>r.activeItemIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled});return{...n,...r,activeItemIndex:i}},3:(e,t)=>{let n=+(e.searchQuery===``),r=e.searchQuery+t.value.toLowerCase(),i=(e.activeItemIndex===null?e.items:e.items.slice(e.activeItemIndex+n).concat(e.items.slice(0,e.activeItemIndex+n))).find(e=>e.dataRef.current.textValue?.startsWith(r)&&!e.dataRef.current.disabled),a=i?e.items.indexOf(i):-1;return a===-1||a===e.activeItemIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeItemIndex:a,activationTrigger:1}},4(e){return e.searchQuery===``?e:{...e,searchQuery:``,searchActiveItemIndex:null}},5:(e,t)=>{let n=e.items.concat(t.items.map(e=>e)),r=e.activeItemIndex;return e.pendingFocus.focus!==c.Nothing&&(r=y(e.pendingFocus,{resolveItems:()=>n,resolveActiveIndex:()=>e.activeItemIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled})),{...e,items:n,activeItemIndex:r,pendingFocus:{focus:c.Nothing},pendingShouldSort:!0}},6:(e,t)=>{let n=e.items,r=[],i=new Set(t.items);for(let[e,t]of n.entries())if(i.has(t.id)&&(r.push(e),i.delete(t.id),i.size===0))break;if(r.length>0){n=n.slice();for(let e of r.reverse())n.splice(e,1)}return{...e,items:n,activationTrigger:1}},7:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},8:(e,t)=>e.itemsElement===t.element?e:{...e,itemsElement:t.element},9:e=>e.pendingShouldSort?{...e,...xe(e),pendingShouldSort:!1}:e,10(e){return e.buttonPositionState.kind===`Tracked`?{...e,buttonPositionState:x.Moved}:e}},Ce=class e extends M{constructor(e){super(e),be(this,`actions`,{registerItem:F(()=>{let e=[],t=new Set;return[(n,r)=>{t.has(r)||(t.add(r),e.push({id:n,dataRef:r}))},()=>(t.clear(),this.send({type:5,items:e.splice(0)}))]}),unregisterItem:F(()=>{let e=[];return[t=>e.push(t),()=>this.send({type:6,items:e.splice(0)})]})}),be(this,`selectors`,{activeDescendantId(e){var t;let n=e.activeItemIndex,r=e.items;return n===null||(t=r[n])==null?void 0:t.id},isActive(e,t){let n=e.activeItemIndex,r=e.items;return n!==null&&r[n]?.id===t},shouldScrollIntoView(e,t){return e.__demoMode||e.menuState!==0||e.activationTrigger===0?!1:this.isActive(e,t)},didButtonMove(e){return e.buttonPositionState.kind===`Moved`}}),this.on(5,()=>{this.disposables.requestAnimationFrame(()=>{this.send({type:9})})});{let e=this.state.id,t=j.get(null);this.disposables.add(t.on(A.Push,n=>{!t.selectors.isTop(n,e)&&this.state.menuState===0&&this.send({type:1})})),this.on(0,()=>t.actions.push(e)),this.on(1,()=>t.actions.pop(e))}this.disposables.group(e=>{this.on(1,t=>{t.buttonElement&&(e.dispose(),e.add(h(t.buttonElement,t.buttonPositionState,()=>{this.send({type:10})})))})})}static new({id:t,__demoMode:n=!1}){return new e({id:t,__demoMode:n,menuState:+!n,buttonElement:null,itemsElement:null,items:[],searchQuery:``,activeItemIndex:null,activationTrigger:1,pendingShouldSort:!1,pendingFocus:{focus:c.Nothing},buttonPositionState:x.Idle})}reduce(e,t){return H(t.type,Se,e,t)}},we=(0,J.createContext)(null);function $(e){let t=(0,J.useContext)(we);if(t===null){let t=Error(`<${e} /> is missing a parent <Menu /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Te),t}return t}function Te({id:e,__demoMode:t=!1}){let n=(0,J.useMemo)(()=>Ce.new({id:e,__demoMode:t}),[]);return fe(()=>n.dispose()),n}var Ee=J.Fragment;function De(e,t){let n=(0,K.useId)(),{__demoMode:r=!1,...i}=e,a=Te({id:n,__demoMode:r}),[o,s,c]=P(a,e=>[e.menuState,e.itemsElement,e.buttonElement]),l=I(t),u=j.get(null),d=P(u,(0,J.useCallback)(e=>u.selectors.isTop(e,n),[u,n]));me(d,[c,s],(e,t)=>{var n;a.send({type:Q.CloseMenu}),he(t,te.Loose)||(e.preventDefault(),(n=a.state.buttonElement)==null||n.focus())});let f=G(()=>{a.send({type:Q.CloseMenu})}),p=R({open:o===X.Open,close:f}),m={ref:l},h=B();return J.createElement(S,null,J.createElement(we.Provider,{value:a},J.createElement(ae,{value:H(o,{[X.Open]:V.Open,[X.Closed]:V.Closed})},h({ourProps:m,theirProps:i,slot:p,defaultTag:Ee,name:`Menu`}))))}var Oe=`button`;function ke(e,t){let n=$(`Menu.Button`),a=(0,K.useId)(),{id:l=`headlessui-menu-button-${a}`,disabled:f=!1,autoFocus:h=!1,...g}=e,v=(0,J.useRef)(null),y=d(),b=I(t,v,u(),G(e=>n.send({type:Q.SetButtonElement,element:e}))),x=G(e=>{switch(e.key){case q.Space:case q.Enter:case q.ArrowDown:e.preventDefault(),e.stopPropagation(),n.send({type:Q.OpenMenu,focus:{focus:c.First}});break;case q.ArrowUp:e.preventDefault(),e.stopPropagation(),n.send({type:Q.OpenMenu,focus:{focus:c.Last}})}}),S=G(e=>{switch(e.key){case q.Space:e.preventDefault()}}),[C,w,T]=P(n,e=>[e.menuState,e.buttonElement,e.itemsElement]),E=C===X.Open;m(E,{trigger:w,action:(0,J.useCallback)(e=>{if(w!=null&&w.contains(e.target))return p.Ignore;let t=e.target.closest(`[role="menuitem"]:not([data-disabled])`);return L(t)?p.Select(t):T!=null&&T.contains(e.target)?p.Ignore:p.Close},[w,T]),close:(0,J.useCallback)(()=>n.send({type:Q.CloseMenu}),[]),select:(0,J.useCallback)(e=>e.click(),[])});let D=s(e=>{var t;f||(C===X.Open?((0,Y.flushSync)(()=>n.send({type:Q.CloseMenu})),(t=v.current)==null||t.focus({preventScroll:!0})):(e.preventDefault(),n.send({type:Q.OpenMenu,focus:{focus:c.Nothing},trigger:Z.Pointer})))}),{isFocusVisible:O,focusProps:k}=r({autoFocus:h}),{isHovered:A,hoverProps:j}=i({isDisabled:f}),{pressed:M,pressProps:ee}=o({disabled:f}),N=R({open:C===X.Open,active:M||C===X.Open,disabled:f,hover:A,focus:O,autofocus:h}),F=ie(y(),{ref:b,id:l,type:_(e,v.current),"aria-haspopup":`menu`,"aria-controls":T?.id,"aria-expanded":C===X.Open,disabled:f||void 0,autoFocus:h,onKeyDown:x,onKeyUp:S},D,k,j,ee);return B()({ourProps:F,theirProps:g,slot:N,defaultTag:Oe,name:`Menu.Button`})}var Ae=`div`,je=U.RenderStrategy|U.Static;function Me(e,t){let n=(0,K.useId)(),{id:r=`headlessui-menu-items-${n}`,anchor:i,portal:a=!1,modal:o=!0,transition:s=!1,...l}=e,u=f(i),d=$(`Menu.Items`),[p,m]=g(u),h=w(),[_,v]=(0,J.useState)(null),y=I(t,u?p:null,G(e=>d.send({type:Q.SetItemsElement,element:e})),v),[b,x]=P(d,e=>[e.menuState,e.buttonElement]),S=ne(x),C=ne(_);u&&(a=!0);let E=oe(),[D,A]=pe(s,_,E===null?b===X.Open:(E&V.Open)===V.Open);le(D,x,()=>{d.send({type:Q.CloseMenu})});let j=P(d,e=>e.__demoMode),M=!j&&o&&b===X.Open;ce(M,C);let F=!j&&o&&b===X.Open;ee(F,{allowed:(0,J.useCallback)(()=>[x,_],[x,_])});let te=!P(d,d.selectors.didButtonMove)&&D;(0,J.useEffect)(()=>{let e=_;e&&b===X.Open&&(ge(e)||e.focus({preventScroll:!0}))},[b,_]),_e(b===X.Open,{container:_,accept(e){return e.getAttribute(`role`)===`menuitem`?NodeFilter.FILTER_REJECT:e.hasAttribute(`role`)?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(e){e.setAttribute(`role`,`none`)}});let L=se(),re=G(e=>{var t,n;switch(L.dispose(),e.key){case q.Space:if(d.state.searchQuery!==``)return e.preventDefault(),e.stopPropagation(),d.send({type:Q.Search,value:e.key});case q.Enter:if(e.preventDefault(),e.stopPropagation(),d.state.activeItemIndex!==null){let{dataRef:e}=d.state.items[d.state.activeItemIndex];(t=e.current?.domRef.current)==null||t.click()}d.send({type:Q.CloseMenu}),k(d.state.buttonElement);break;case q.ArrowDown:return e.preventDefault(),e.stopPropagation(),d.send({type:Q.GoToItem,focus:c.Next});case q.ArrowUp:return e.preventDefault(),e.stopPropagation(),d.send({type:Q.GoToItem,focus:c.Previous});case q.Home:case q.PageUp:return e.preventDefault(),e.stopPropagation(),d.send({type:Q.GoToItem,focus:c.First});case q.End:case q.PageDown:return e.preventDefault(),e.stopPropagation(),d.send({type:Q.GoToItem,focus:c.Last});case q.Escape:e.preventDefault(),e.stopPropagation(),(0,Y.flushSync)(()=>d.send({type:Q.CloseMenu})),(n=d.state.buttonElement)==null||n.focus({preventScroll:!0});break;case q.Tab:e.preventDefault(),e.stopPropagation(),(0,Y.flushSync)(()=>d.send({type:Q.CloseMenu})),O(d.state.buttonElement,e.shiftKey?N.Previous:N.Next);break;default:e.key.length===1&&(d.send({type:Q.Search,value:e.key}),L.setTimeout(()=>d.send({type:Q.ClearSearch}),350))}}),ae=G(e=>{switch(e.key){case q.Space:e.preventDefault()}}),z=R({open:b===X.Open}),H=ie(u?h():{},{"aria-activedescendant":P(d,d.selectors.activeDescendantId),"aria-labelledby":P(d,e=>e.buttonElement?.id),id:r,onKeyDown:re,onKeyUp:ae,role:`menu`,tabIndex:b===X.Open?0:void 0,ref:y,style:{...l.style,...m,"--button-width":T(D,x,!0).width},...ue(A)}),U=B();return J.createElement(de,{enabled:a?e.static||D:!1,ownerDocument:S},U({ourProps:H,theirProps:l,slot:z,defaultTag:Ae,features:je,visible:te,name:`Menu.Items`}))}var Ne=J.Fragment;function Pe(e,t){let n=(0,K.useId)(),{id:r=`headlessui-menu-item-${n}`,disabled:i=!1,...o}=e,s=$(`Menu.Item`),l=P(s,e=>s.selectors.isActive(e,r)),u=(0,J.useRef)(null),d=I(t,u),f=P(s,e=>s.selectors.shouldScrollIntoView(e,r));z(()=>{if(f)return re().requestAnimationFrame(()=>{var e,t;(t=(e=u.current)?.scrollIntoView)==null||t.call(e,{block:`nearest`})})},[f,u]);let p=C(u),m=(0,J.useRef)({disabled:i,domRef:u,get textValue(){return p()}});z(()=>{m.current.disabled=i},[m,i]),z(()=>(s.actions.registerItem(r,m),()=>s.actions.unregisterItem(r)),[m,r]);let h=G(()=>{s.send({type:Q.CloseMenu})}),g=G(e=>{if(i)return e.preventDefault();s.send({type:Q.CloseMenu}),k(s.state.buttonElement)}),_=G(()=>{if(i)return s.send({type:Q.GoToItem,focus:c.Nothing});s.send({type:Q.GoToItem,focus:c.Specific,id:r})}),v=b(),y=G(e=>v.update(e)),x=G(e=>{v.wasMoved(e)&&(i||l||s.send({type:Q.GoToItem,focus:c.Specific,id:r,trigger:Z.Pointer}))}),S=G(e=>{v.wasMoved(e)&&(i||l&&s.state.activationTrigger===Z.Pointer&&s.send({type:Q.GoToItem,focus:c.Nothing}))}),[w,T]=a(),[D,O]=E(),A=R({active:l,focus:l,disabled:i,close:h}),j={id:r,ref:d,role:`menuitem`,tabIndex:i===!0?void 0:-1,"aria-disabled":i===!0||void 0,"aria-labelledby":w,"aria-describedby":D,disabled:void 0,onClick:g,onFocus:_,onPointerEnter:y,onMouseEnter:y,onPointerMove:x,onMouseMove:x,onPointerLeave:S,onMouseLeave:S},M=B();return J.createElement(T,null,J.createElement(O,null,M({ourProps:j,theirProps:o,slot:A,defaultTag:Ne,name:`Menu.Item`})))}var Fe=`div`;function Ie(e,t){let[n,r]=a(),i=e,o={ref:t,"aria-labelledby":n,role:`group`},s=B();return J.createElement(r,null,s({ourProps:o,theirProps:i,slot:{},defaultTag:Fe,name:`Menu.Section`}))}var Le=`header`;function Re(e,t){let n=(0,K.useId)(),{id:r=`headlessui-menu-heading-${n}`,...i}=e,a=l();z(()=>a.register(r),[r,a.register]);let o={id:r,ref:t,role:`presentation`,...a.props};return B()({ourProps:o,theirProps:i,slot:{},defaultTag:Le,name:`Menu.Heading`})}var ze=`div`;function Be(e,t){let n=e,r={ref:t,role:`separator`};return B()({ourProps:r,theirProps:n,slot:{},defaultTag:ze,name:`Menu.Separator`})}var Ve=W(De),He=W(ke),Ue=W(Me),We=W(Pe),Ge=W(Ie),Ke=W(Re),qe=W(Be),Je=Object.assign(Ve,{Button:He,Items:Ue,Item:We,Section:Ge,Heading:Ke,Separator:qe});export{Ue as i,We as n,Je as r,He as t};
@@ -1 +0,0 @@
1
- import{r as e,t,u as n}from"./app-config.CpjKWnzM.js";var r=[`内容库`,`生成能力`,`记忆与检索`,`开发工具`],i=[{id:`cases`,category:`内容库`,name:`用例管理`,description:`侧栏进入用例库:浏览、搜索、打开与删除用例。关闭后入口隐藏,「生成测试用例」一并关闭;磁盘文件仍保留。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1},{id:`caseGen`,category:`生成能力`,name:`生成测试用例`,description:`在工作台用「/」打开配置:选类型、模板与提示词后生成用例并写入用例库。需同时开启「用例管理」。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1,hasPanel:!0,requires:`cases`},{id:`prompts`,category:`内容库`,name:`提示词管理`,description:`侧栏进入提示词库:浏览、搜索、打开与删除提示词。关闭后入口隐藏,「生成提示词」一并关闭;磁盘文件仍保留。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1},{id:`promptGen`,category:`生成能力`,name:`生成提示词`,description:`用「/」打开配置后对话生成提示词;质检通过后写入提示词库。需同时开启「提示词管理」。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1,hasPanel:!0,requires:`prompts`},{id:`knowledgeLib`,category:`内容库`,name:`知识库管理`,description:`侧栏进入知识库:浏览、搜索、打开与删除文档。关闭后入口隐藏,「生成知识库」一并关闭;磁盘文件仍保留。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1},{id:`knowledgeGen`,category:`生成能力`,name:`生成知识库`,description:`用「/」打开配置后对话生成规范、方法论或环境约定;质检通过后写入知识库。需同时开启「知识库管理」。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1,hasPanel:!0,requires:`knowledgeLib`},{id:`requirements`,category:`内容库`,name:`需求文档库`,description:`侧栏进入需求文档库:浏览、搜索、上传与整理需求文档。关闭后入口隐藏;磁盘文件仍保留,生成用例时也不再引用。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1},{id:`templates`,category:`内容库`,name:`测试模板库`,description:`侧栏进入测试模板库:浏览、上传与整理用例 / 报告模板。关闭后入口隐藏;磁盘文件仍保留,生成用例时不再选用模板。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1},{id:`knowledge`,category:`记忆与检索`,name:`知识库检索`,description:`工作台输入「@」引用知识库与模板文档;发送后由模型按需读取。关闭后 @ 只列工作区文件。`,version:`1.4.0`,requiresDev:!1,defaultEnabled:!1},{id:`memory`,category:`记忆与检索`,name:`会话记忆`,description:`五轨记忆(用户档案 / 全局事实 / 项目关键 / 项目日志 / 每日):待确认、归档与便签,在工作台「记忆」Tab 管理。`,version:`2.0.0`,requiresDev:!0,defaultEnabled:!1},{id:`pluginDev`,category:`开发工具`,name:`插件开发`,description:`用固定提示词开发扩展插件:先评估形态与范围并用选项确认,确认后才改代码,完成后并入「扩展插件」。需要读写项目源码。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1,hasPanel:!0}];function a(e=i){return r.map(t=>({category:t,items:e.filter(e=>e.category===t)})).filter(e=>e.items.length>0)}var o=`tw-plugins-changed`;function s(){let e={};for(let t of i)e[t.id]=t.defaultEnabled;return e}function c(e,t){let n={...e};if(t){if(n[t.id]=t.enabled,t.enabled){let e=p(t.id)?.requires;e&&(n[e]=!0)}else for(let e of i)e.requires===t.id&&(n[e.id]=!1)}for(let e of i)e.requires&&!n[e.requires]&&(n[e.id]=!1);return n}function l(){let t=s(),n=e().plugins??{};for(let e of i)typeof n[e.id]==`boolean`&&(t[e.id]=n[e.id]);return c(t)}function u(e){return l()[e]}function d(e,r){let i=c(l(),{id:e,enabled:r});return n({plugins:i}),t(),typeof window<`u`&&window.dispatchEvent(new CustomEvent(o,{detail:i})),i}function f(e){if(typeof window>`u`)return()=>{};let t=t=>{let n=t.detail;e(n??l())};return window.addEventListener(o,t),()=>{window.removeEventListener(o,t)}}function p(e){return i.find(t=>t.id===e)}function m(e){let t=p(e),n=t?.name??e;return t?.requires&&!u(t.requires)?`请先在「我的插件」中启用「${p(t.requires)?.name??t.requires}」`:`请先在「我的插件」中启用「${n}」`}export{f as a,l as i,a as n,m as o,u as r,d as s,i as t};
@@ -1,5 +0,0 @@
1
- import{c as e,n as t,r as n,t as r}from"./react-dom.CqAxpHMt.js";var i=e(t(),1),a=Object.defineProperty,o=(e,t,n)=>t in e?a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,s=(e,t,n)=>(o(e,typeof t==`symbol`?t:t+``,n),n),c=new class{constructor(){s(this,`current`,this.detect()),s(this,`handoffState`,`pending`),s(this,`currentId`,0)}set(e){this.current!==e&&(this.handoffState=`pending`,this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current===`server`}get isClient(){return this.current===`client`}detect(){return typeof window>`u`||typeof document>`u`?`server`:`client`}handoff(){this.handoffState===`pending`&&(this.handoffState=`complete`)}get isHandoffComplete(){return this.handoffState===`complete`}};function l(e){return c.isServer?null:e==null?document:e?.ownerDocument??document}function u(e){return c.isServer?null:e==null?document:(e?.getRootNode)?.call(e)??document}function d(e){return u(e)?.activeElement??null}function f(e){return d(e)===e}function p(e){typeof queueMicrotask==`function`?queueMicrotask(e):Promise.resolve().then(e).catch(e=>setTimeout(()=>{throw e}))}function m(){let e=[],t={addEventListener(e,n,r,i){return e.addEventListener(n,r,i),t.add(()=>e.removeEventListener(n,r,i))},requestAnimationFrame(...e){let n=requestAnimationFrame(...e);return t.add(()=>cancelAnimationFrame(n))},nextFrame(...e){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...e))},setTimeout(...e){let n=setTimeout(...e);return t.add(()=>clearTimeout(n))},microTask(...e){let n={current:!0};return p(()=>{n.current&&e[0]()}),t.add(()=>{n.current=!1})},style(e,t,n){let r=e.style.getPropertyValue(t);return Object.assign(e.style,{[t]:n}),this.add(()=>{Object.assign(e.style,{[t]:r})})},group(e){let t=m();return e(t),this.add(()=>t.dispose())},add(t){return e.includes(t)||e.push(t),()=>{let n=e.indexOf(t);if(n>=0)for(let t of e.splice(n,1))t()}},dispose(){for(let t of e.splice(0))t()}};return t}function h(){let[e]=(0,i.useState)(m);return(0,i.useEffect)(()=>()=>e.dispose(),[e]),e}var g=(e,t)=>{c.isServer?(0,i.useEffect)(e,t):(0,i.useLayoutEffect)(e,t)};function _(e){let t=(0,i.useRef)(e);return g(()=>{t.current=e},[e]),t}var v=function(e){let t=_(e);return i.useCallback((...e)=>t.current(...e),[t])};function ee(e){return(0,i.useMemo)(()=>e,Object.values(e))}var te=(0,i.createContext)(void 0);function ne(){return(0,i.useContext)(te)}function y(...e){return Array.from(new Set(e.flatMap(e=>typeof e==`string`?e.split(` `):[]))).filter(Boolean).join(` `)}function b(e,t,...n){if(e in t){let r=t[e];return typeof r==`function`?r(...n):r}let r=Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(e=>`"${e}"`).join(`, `)}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,b),r}var re=(e=>(e[e.None=0]=`None`,e[e.RenderStrategy=1]=`RenderStrategy`,e[e.Static=2]=`Static`,e))(re||{}),ie=(e=>(e[e.Unmount=0]=`Unmount`,e[e.Hidden=1]=`Hidden`,e))(ie||{});function x(){let e=oe();return(0,i.useCallback)(t=>ae({mergeRefs:e,...t}),[e])}function ae({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:i,visible:a=!0,name:o,mergeRefs:s}){s??=se;let c=C(t,e);if(a)return S(c,n,r,o,s);let l=i??0;if(l&2){let{static:e=!1,...t}=c;if(e)return S(t,n,r,o,s)}if(l&1){let{unmount:e=!0,...t}=c;return b(+!e,{0(){return null},1(){return S({...t,hidden:!0,style:{display:`none`}},n,r,o,s)}})}return S(c,n,r,o,s)}function S(e,t={},n,r,a){let{as:o=n,children:s,refName:c=`ref`,...l}=E(e,[`unmount`,`static`]),u=e.ref===void 0?{}:{[c]:e.ref},d=typeof s==`function`?s(t):s;d=ue(d),`className`in l&&l.className&&typeof l.className==`function`&&(l.className=l.className(t)),l[`aria-labelledby`]&&l[`aria-labelledby`]===l.id&&(l[`aria-labelledby`]=void 0);let f={};if(t){let e=!1,n=[];for(let[r,i]of Object.entries(t))typeof i==`boolean`&&(e=!0),i===!0&&n.push(r.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`));if(e){f[`data-headlessui-state`]=n.join(` `);for(let e of n)f[`data-${e}`]=``}}if(D(o)&&(Object.keys(T(l)).length>0||Object.keys(T(f)).length>0)){if(!(0,i.isValidElement)(d)||Array.isArray(d)&&d.length>1||de(d)){if(Object.keys(T(l)).length>0)throw Error([`Passing props on "Fragment"!`,``,`The current component <${r} /> is rendering a "Fragment".`,`However we need to passthrough the following props:`,Object.keys(T(l)).concat(Object.keys(T(f))).map(e=>` - ${e}`).join(`
2
- `),``,`You can apply a few solutions:`,['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',`Render a single element as the child so that we can forward the props onto that element.`].map(e=>` - ${e}`).join(`
3
- `)].join(`
4
- `))}else{let e=d.props?.className,t=typeof e==`function`?(...t)=>y(e(...t),l.className):y(e,l.className),n=t?{className:t}:{},r=C(d.props,T(E(l,[`ref`])));for(let e in f)e in r&&delete f[e];return(0,i.cloneElement)(d,Object.assign({},r,f,u,{ref:a(le(d),u.ref)},n))}}return(0,i.createElement)(o,Object.assign({},E(l,[`ref`]),!D(o)&&u,!D(o)&&f),d)}function oe(){let e=(0,i.useRef)([]),t=(0,i.useCallback)(t=>{for(let n of e.current)n!=null&&(typeof n==`function`?n(t):n.current=t)},[]);return(...n)=>{if(!n.every(e=>e==null))return e.current=n,t}}function se(...e){return e.every(e=>e==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n==`function`?n(t):n.current=t)}}function C(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let e in r)e.startsWith(`on`)&&typeof r[e]==`function`?(n[e]??(n[e]=[]),n[e].push(r[e])):t[e]=r[e];if(t.disabled||t[`aria-disabled`])for(let e in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(e)&&(n[e]=[e=>(e?.preventDefault)?.call(e)]);for(let e in n)Object.assign(t,{[e](t,...r){let i=n[e];for(let e of i){if((t instanceof Event||t?.nativeEvent instanceof Event)&&t.defaultPrevented)return;e(t,...r)}}});return t}function ce(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let e in r)e.startsWith(`on`)&&typeof r[e]==`function`?(n[e]??(n[e]=[]),n[e].push(r[e])):t[e]=r[e];for(let e in n)Object.assign(t,{[e](...t){let r=n[e];for(let e of r)e?.(...t)}});return t}function w(e){return Object.assign((0,i.forwardRef)(e),{displayName:e.displayName??e.name})}function T(e){let t=Object.assign({},e);for(let e in t)t[e]===void 0&&delete t[e];return t}function E(e,t=[]){let n=Object.assign({},e);for(let e of t)e in n&&delete n[e];return n}function le(e){return`19.3.0`.split(`.`)[0]>=`19`?e.props.ref:e.ref}function ue(e){if(e!=null&&e.$$typeof===Symbol.for(`react.lazy`)){let t=e._payload;if(t!=null&&t.status===`fulfilled`)return ue(t.value)}return e}function D(e){return e===i.Fragment||e===Symbol.for(`react.fragment`)}function de(e){return D(e.type)}var fe=`span`,pe=(e=>(e[e.None=1]=`None`,e[e.Focusable=2]=`Focusable`,e[e.Hidden=4]=`Hidden`,e))(pe||{});function me(e,t){let{features:n=1,...r}=e,i={ref:t,"aria-hidden":(n&2)==2?!0:r[`aria-hidden`]??void 0,hidden:(n&4)==4||void 0,style:{position:`fixed`,top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`,...(n&4)==4&&(n&2)!=2&&{display:`none`}}};return x()({ourProps:i,theirProps:r,slot:{},defaultTag:fe,name:`Hidden`})}var he=w(me);function ge(e){return typeof e!=`object`||!e?!1:`nodeType`in e}function O(e){return ge(e)&&`tagName`in e}function k(e){return O(e)&&`accessKey`in e}function A(e){return O(e)&&`tabIndex`in e}function _e(e){return O(e)&&`style`in e}function ve(e){return k(e)&&e.nodeName===`IFRAME`}function ye(e){return k(e)&&e.nodeName===`INPUT`}function be(e){return k(e)&&e.nodeName===`LABEL`}function xe(e){return k(e)&&e.nodeName===`FIELDSET`}function Se(e){return k(e)&&e.nodeName===`LEGEND`}function Ce(e){return O(e)?e.matches(`a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]`):!1}var j=Symbol();function we(e,t=!0){return Object.assign(e,{[j]:t})}function M(...e){let t=(0,i.useRef)(e);(0,i.useEffect)(()=>{t.current=e},[e]);let n=v(e=>{for(let n of t.current)n!=null&&(typeof n==`function`?n(e):n.current=e)});return e.every(e=>e==null||e?.[j])?void 0:n}var N=(0,i.createContext)(null);N.displayName=`DescriptionContext`;function Te(){let e=(0,i.useContext)(N);if(e===null){let e=Error(`You used a <Description /> component, but it is not inside a relevant parent.`);throw Error.captureStackTrace&&Error.captureStackTrace(e,Te),e}return e}function Ee(){return(0,i.useContext)(N)?.value??void 0}function De(){let[e,t]=(0,i.useState)([]);return[e.length>0?e.join(` `):void 0,(0,i.useMemo)(()=>function(e){let n=v(e=>(t(t=>[...t,e]),()=>t(t=>{let n=t.slice(),r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}))),r=(0,i.useMemo)(()=>({register:n,slot:e.slot,name:e.name,props:e.props,value:e.value}),[n,e.slot,e.name,e.props,e.value]);return i.createElement(N.Provider,{value:r},e.children)},[t])]}var Oe=`p`;function ke(e,t){let n=(0,i.useId)(),r=ne(),{id:a=`headlessui-description-${n}`,...o}=e,s=Te(),c=M(t);g(()=>s.register(a),[a,s.register]);let l=ee({...s.slot,disabled:r||!1}),u={ref:c,...s.props,id:a};return x()({ourProps:u,theirProps:o,slot:l,defaultTag:Oe,name:s.name||`Description`})}var Ae=w(ke),je=Object.assign(Ae,{}),Me=(e=>(e.Space=` `,e.Enter=`Enter`,e.Escape=`Escape`,e.Backspace=`Backspace`,e.Delete=`Delete`,e.ArrowLeft=`ArrowLeft`,e.ArrowUp=`ArrowUp`,e.ArrowRight=`ArrowRight`,e.ArrowDown=`ArrowDown`,e.Home=`Home`,e.End=`End`,e.PageUp=`PageUp`,e.PageDown=`PageDown`,e.Tab=`Tab`,e))(Me||{}),Ne=class extends Map{constructor(e){super(),this.factory=e}get(e){let t=super.get(e);return t===void 0&&(t=this.factory(e),this.set(e,t)),t}},Pe=Object.defineProperty,Fe=(e,t,n)=>t in e?Pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ie=(e,t,n)=>(Fe(e,typeof t==`symbol`?t:t+``,n),n),Le=(e,t,n)=>{if(!t.has(e))throw TypeError(`Cannot `+n)},P=(e,t,n)=>(Le(e,t,`read from private field`),n?n.call(e):t.get(e)),F=(e,t,n)=>{if(t.has(e))throw TypeError(`Cannot add the same private member more than once`);t instanceof WeakSet?t.add(e):t.set(e,n)},Re=(e,t,n,r)=>(Le(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),I,L,R,ze=class{constructor(e){F(this,I,{}),F(this,L,new Ne(()=>new Set)),F(this,R,new Set),Ie(this,`disposables`,m()),Re(this,I,e),c.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return P(this,I)}subscribe(e,t){if(c.isServer)return()=>{};let n={selector:e,callback:t,current:e(P(this,I))};return P(this,R).add(n),this.disposables.add(()=>{P(this,R).delete(n)})}on(e,t){return c.isServer?()=>{}:(P(this,L).get(e).add(t),this.disposables.add(()=>{P(this,L).get(e).delete(t)}))}send(e){let t=this.reduce(P(this,I),e);if(t!==P(this,I)){Re(this,I,t);for(let e of P(this,R)){let t=e.selector(P(this,I));Be(e.current,t)||(e.current=t,e.callback(t))}for(let t of P(this,L).get(e.type))t(P(this,I),e)}}};I=new WeakMap,L=new WeakMap,R=new WeakMap;function Be(e,t){return Object.is(e,t)?!0:typeof e!=`object`||!e||typeof t!=`object`||!t?!1:Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&z(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size===t.size&&z(e.entries(),t.entries()):Ve(e)&&Ve(t)?z(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function z(e,t){do{let n=e.next(),r=t.next();if(n.done&&r.done)return!0;if(n.done||r.done||!Object.is(n.value,r.value))return!1}while(1)}function Ve(e){if(Object.prototype.toString.call(e)!==`[object Object]`)return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function He(e){let[t,n]=e(),r=m();return(...e)=>{t(...e),r.dispose(),r.microTask(n)}}var Ue=Object.defineProperty,We=(e,t,n)=>t in e?Ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ge=(e,t,n)=>(We(e,typeof t==`symbol`?t:t+``,n),n),Ke=(e=>(e[e.Push=0]=`Push`,e[e.Pop=1]=`Pop`,e))(Ke||{}),qe={0(e,t){let n=t.id,r=e.stack,i=e.stack.indexOf(n);if(i!==-1){let t=e.stack.slice();return t.splice(i,1),t.push(n),r=t,{...e,stack:r}}return{...e,stack:[...e.stack,n]}},1(e,t){let n=t.id,r=e.stack.indexOf(n);if(r===-1)return e;let i=e.stack.slice();return i.splice(r,1),{...e,stack:i}}},Je=class e extends ze{constructor(){super(...arguments),Ge(this,`actions`,{push:e=>this.send({type:0,id:e}),pop:e=>this.send({type:1,id:e})}),Ge(this,`selectors`,{isTop:(e,t)=>e.stack[e.stack.length-1]===t,inStack:(e,t)=>e.stack.includes(t)})}static new(){return new e({stack:[]})}reduce(e,t){return b(t.type,qe,e,t)}},Ye=new Ne(()=>Je.new()),Xe=n((e=>{var n=t();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=n.useRef,s=n.useEffect,c=n.useMemo,l=n.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Ze=n(((e,t)=>{t.exports=Xe()}))();function Qe(e,t,n=Be){return(0,Ze.useSyncExternalStoreWithSelector)(v(t=>e.subscribe($e,t)),v(()=>e.state),v(()=>e.state),v(t),n)}function $e(e){return e}function B(e,t){let n=(0,i.useId)(),r=Ye.get(t),[a,o]=Qe(r,(0,i.useCallback)(e=>[r.selectors.isTop(e,n),r.selectors.inStack(e,n)],[r,n]));return g(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?!o||a:!1}var V=new Map,H=new Map;function et(e){let t=H.get(e)??0;return H.set(e,t+1),t===0&&(V.set(e,{"aria-hidden":e.getAttribute(`aria-hidden`),inert:e.inert}),e.setAttribute(`aria-hidden`,`true`),e.inert=!0),()=>tt(e)}function tt(e){let t=H.get(e)??1;if(t===1?H.delete(e):H.set(e,t-1),t!==1)return;let n=V.get(e);n&&(n[`aria-hidden`]===null?e.removeAttribute(`aria-hidden`):e.setAttribute(`aria-hidden`,n[`aria-hidden`]),e.inert=n.inert,V.delete(e))}function nt(e,{allowed:t,disallowed:n}={}){let r=B(e,`inert-others`);g(()=>{if(!r)return;let e=m();for(let t of n?.()??[])t&&e.add(et(t));let i=t?.()??[];for(let t of i){if(!t)continue;let n=l(t);if(!n)continue;let r=t.parentElement;for(;r&&r!==n.body;){for(let t of r.children)i.some(e=>t.contains(e))||e.add(et(t));r=r.parentElement}}return e.dispose},[r,t,n])}function rt(e,t,n){let r=_(e=>{let t=e.getBoundingClientRect();t.x===0&&t.y===0&&t.width===0&&t.height===0&&n()});(0,i.useEffect)(()=>{if(!e)return;let n=t===null?null:k(t)?t:t.current;if(!n)return;let i=m();if(typeof ResizeObserver<`u`){let e=new ResizeObserver(()=>r.current(n));e.observe(n),i.add(()=>e.disconnect())}if(typeof IntersectionObserver<`u`){let e=new IntersectionObserver(()=>r.current(n));e.observe(n),i.add(()=>e.disconnect())}return()=>i.dispose()},[t,r,e])}var U=[`[contentEditable=true]`,`[tabindex]`,`a[href]`,`area[href]`,`button:not([disabled])`,`iframe`,`input:not([disabled])`,`select:not([disabled])`,`details>summary`,`textarea:not([disabled])`].map(e=>`${e}:not([tabindex='-1'])`).join(`,`),it=[`[data-autofocus]`].map(e=>`${e}:not([tabindex='-1'])`).join(`,`),at=(e=>(e[e.First=1]=`First`,e[e.Previous=2]=`Previous`,e[e.Next=4]=`Next`,e[e.Last=8]=`Last`,e[e.WrapAround=16]=`WrapAround`,e[e.NoScroll=32]=`NoScroll`,e[e.AutoFocus=64]=`AutoFocus`,e))(at||{}),ot=(e=>(e[e.Error=0]=`Error`,e[e.Overflow=1]=`Overflow`,e[e.Success=2]=`Success`,e[e.Underflow=3]=`Underflow`,e))(ot||{}),st=(e=>(e[e.Previous=-1]=`Previous`,e[e.Next=1]=`Next`,e))(st||{});function ct(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(U)).sort((e,t)=>Math.sign((e.tabIndex||2**53-1)-(t.tabIndex||2**53-1)))}function lt(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(it)).sort((e,t)=>Math.sign((e.tabIndex||2**53-1)-(t.tabIndex||2**53-1)))}var W=(e=>(e[e.Strict=0]=`Strict`,e[e.Loose=1]=`Loose`,e))(W||{});function G(e,t=0){return e!==l(e)?.body&&b(t,{0(){return e.matches(U)},1(){let t=e;for(;t!==null;){if(t.matches(U))return!0;t=t.parentElement}return!1}})}function ut(e){m().nextFrame(()=>{let t=d(e);t&&A(t)&&!G(t,0)&&ft(e)})}var dt=(e=>(e[e.Keyboard=0]=`Keyboard`,e[e.Mouse=1]=`Mouse`,e))(dt||{});typeof window<`u`&&typeof document<`u`&&(document.addEventListener(`keydown`,e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible=``)},!0),document.addEventListener(`click`,e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible=``)},!0));function ft(e){e?.focus({preventScroll:!0})}var pt=[`textarea`,`input`].join(`,`);function mt(e){return(e?.matches)?.call(e,pt)??!1}function ht(e,t=e=>e){return e.slice().sort((e,n)=>{let r=t(e),i=t(n);if(r===null||i===null)return 0;let a=r.compareDocumentPosition(i);return a&Node.DOCUMENT_POSITION_FOLLOWING?-1:a&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function gt(e,t,n=e===null?document.body:u(e)){return _t(ct(n),t,{relativeTo:e})}function _t(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:i=[]}={}){let a=Array.isArray(e)?e.length>0?u(e[0]):document:u(e),o=Array.isArray(e)?n?ht(e):e:t&64?lt(e):ct(e);i.length>0&&o.length>1&&(o=o.filter(e=>!i.some(t=>t!=null&&`current`in t?t?.current===e:t===e))),r??=a?.activeElement;let s=(()=>{if(t&5)return 1;if(t&10)return-1;throw Error(`Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last`)})(),c=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,o.indexOf(r))-1;if(t&4)return Math.max(0,o.indexOf(r))+1;if(t&8)return o.length-1;throw Error(`Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last`)})(),l=t&32?{preventScroll:!0}:{},f=0,p=o.length,m;do{if(f>=p||f+p<=0)return 0;let e=c+f;if(t&16)e=(e+p)%p;else{if(e<0)return 3;if(e>=p)return 1}m=o[e],m?.focus(l),f+=s}while(m!==d(m));return t&6&&mt(m)&&m.select(),2}function vt(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function yt(){return/Android/gi.test(window.navigator.userAgent)}function K(){return vt()||yt()}function q(e,t,n,r){let a=_(n);(0,i.useEffect)(()=>{if(!e)return;function n(e){a.current(e)}return document.addEventListener(t,n,r),()=>document.removeEventListener(t,n,r)},[e,t,r])}function bt(e,t,n,r){let a=_(n);(0,i.useEffect)(()=>{if(!e)return;function n(e){a.current(e)}return window.addEventListener(t,n,r),()=>window.removeEventListener(t,n,r)},[e,t,r])}var xt=30;function St(e,t,n){let r=_(n),a=(0,i.useCallback)(function(e,n){if(e.defaultPrevented)return;let i=n(e);if(i===null||!i.getRootNode().contains(i)||!i.isConnected)return;let a=function e(t){return typeof t==`function`?e(t()):Array.isArray(t)||t instanceof Set?t:[t]}(t);for(let t of a)if(t!==null&&(t.contains(i)||e.composed&&e.composedPath().includes(t)))return;return!G(i,W.Loose)&&i.tabIndex!==-1&&e.preventDefault(),r.current(e,i)},[r,t]),o=(0,i.useRef)(null);q(e,`pointerdown`,e=>{K()||(o.current=e.composedPath?.call(e)?.[0]||e.target)},!0),q(e,`pointerup`,e=>{if(K()||!o.current)return;let t=o.current;return o.current=null,a(e,()=>t)},!0);let s=(0,i.useRef)({x:0,y:0});q(e,`touchstart`,e=>{s.current.x=e.touches[0].clientX,s.current.y=e.touches[0].clientY},!0),q(e,`touchend`,e=>{let t={x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY};if(!(Math.abs(t.x-s.current.x)>=xt||Math.abs(t.y-s.current.y)>=xt))return a(e,()=>A(e.target)?e.target:null)},!0),bt(e,`blur`,e=>a(e,()=>ve(window.document.activeElement)?window.document.activeElement:null),!0)}var Ct=e(r(),1);function wt(...e){return(0,i.useMemo)(()=>l(...e),[...e])}function Tt(e,t,n,r){let a=_(n);(0,i.useEffect)(()=>{e??=window;function n(e){a.current(e)}return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)},[e,t,r])}function Et(e){return(0,i.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot)}function Dt(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(e){return r.add(e),()=>r.delete(e)},dispatch(e,...i){let a=t[e].call(n,...i);a&&(n=a,r.forEach(e=>e()))}}}function Ot(){let e;return{before({doc:t}){let n=t.documentElement,r=t.defaultView??window;e=Math.max(0,r.innerWidth-n.clientWidth)},after({doc:t,d:n}){let r=t.documentElement,i=Math.max(0,r.clientWidth-r.offsetWidth),a=Math.max(0,e-i);n.style(r,`paddingRight`,`${a}px`)}}}function kt(){return vt()?{before({doc:e,d:t,meta:n}){function r(e){for(let t of n().containers)for(let n of t())if(n.contains(e))return!0;return!1}t.microTask(()=>{if(window.getComputedStyle(e.documentElement).scrollBehavior!==`auto`){let n=m();n.style(e.documentElement,`scrollBehavior`,`auto`),t.add(()=>t.microTask(()=>n.dispose()))}let n=window.scrollY??window.pageYOffset,i=null;t.addEventListener(e,`click`,t=>{if(A(t.target))try{let n=t.target.closest(`a`);if(!n)return;let{hash:a}=new URL(n.href),o=e.querySelector(a);A(o)&&!r(o)&&(i=o)}catch{}},!0),t.group(n=>{t.addEventListener(e,`touchstart`,e=>{if(n.dispose(),A(e.target)&&_e(e.target)){if(r(e.target)){let t=e.target;for(;t.parentElement&&r(t.parentElement);)t=t.parentElement;n.style(t,`overscrollBehavior`,`contain`)}else n.style(e.target,`touchAction`,`none`)}})}),t.addEventListener(e,`touchmove`,e=>{if(A(e.target)){if(ye(e.target))return;if(r(e.target)){let t=e.target;for(;t.parentElement&&t.dataset.headlessuiPortal!==``&&!(t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth);)t=t.parentElement;t.dataset.headlessuiPortal===``&&e.preventDefault()}else e.preventDefault()}},{passive:!1}),t.add(()=>{let e=window.scrollY??window.pageYOffset;n!==e&&window.scrollTo(0,n),i&&i.isConnected&&(i.scrollIntoView({block:`nearest`}),i=null)})})}}:{}}function At(){return{before({doc:e,d:t}){t.style(e.documentElement,`overflow`,`hidden`)}}}function jt(e){let t={};for(let n of e)Object.assign(t,n(t));return t}var J=Dt(()=>new Map,{PUSH(e,t){let n=this.get(e)??{doc:e,count:0,d:m(),meta:new Set,computedMeta:{}};return n.count++,n.meta.add(t),n.computedMeta=jt(n.meta),this.set(e,n),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t),n.computedMeta=jt(n.meta)),this},SCROLL_PREVENT(e){let t={doc:e.doc,d:e.d,meta(){return e.computedMeta}},n=[kt(),Ot(),At()];n.forEach(({before:e})=>e?.(t)),n.forEach(({after:e})=>e?.(t))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});J.subscribe(()=>{let e=J.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let e=t.get(n.doc)===`hidden`,r=n.count!==0;(r&&!e||!r&&e)&&J.dispatch(n.count>0?`SCROLL_PREVENT`:`SCROLL_ALLOW`,n),n.count===0&&J.dispatch(`TEARDOWN`,n)}});function Mt(e,t,n=()=>({containers:[]})){let r=Et(J),i=t?r.get(t):void 0,a=i?i.count>0:!1;return g(()=>{if(t&&e)return J.dispatch(`PUSH`,t,n),()=>J.dispatch(`POP`,t,n)},[e,t]),a}function Nt(e,t,n=()=>[document.body]){Mt(B(e,`scroll-lock`),t,e=>({containers:[...e.containers??[],n]}))}function Pt(e=0){let[t,n]=(0,i.useState)(e);return{flags:t,setFlag:(0,i.useCallback)(e=>n(e),[]),addFlag:(0,i.useCallback)(e=>n(t=>t|e),[]),hasFlag:(0,i.useCallback)(e=>(t&e)===e,[t]),removeFlag:(0,i.useCallback)(e=>n(t=>t&~e),[]),toggleFlag:(0,i.useCallback)(e=>n(t=>t^e),[])}}typeof process<`u`&&typeof globalThis<`u`&&typeof Element<`u`&&(process==null?void 0:{})?.NODE_ENV===`test`&&(Element==null?void 0:Element.prototype)?.getAnimations===void 0&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.",``,`Example usage:`,"```js",`import { mockAnimationsApi } from 'jsdom-testing-mocks'`,`mockAnimationsApi()`,"```"].join(`
5
- `)),[]});var Ft=(e=>(e[e.None=0]=`None`,e[e.Closed=1]=`Closed`,e[e.Enter=2]=`Enter`,e[e.Leave=4]=`Leave`,e))(Ft||{});function It(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]=``);return t}function Lt(e,t,n,r){let[a,o]=(0,i.useState)(n),{hasFlag:s,addFlag:c,removeFlag:l}=Pt(e&&a?3:0),u=(0,i.useRef)(!1),d=(0,i.useRef)(!1);return g(()=>{var i;if(e){if(n&&o(!0),!t){n&&c(3);return}return(i=r?.start)==null||i.call(r,n),Rt(t,{inFlight:u,prepare(){d.current?d.current=!1:d.current=u.current,u.current=!0,!d.current&&(n?(c(3),l(4)):(c(4),l(2)))},run(){d.current?n?(l(3),c(4)):(l(4),c(3)):n?l(1):c(1)},done(){var e;d.current&&Vt(t)||(u.current=!1,l(7),n||o(!1),(e=r?.end)==null||e.call(r,n))}})}},[e,n,t,h()]),e?[a,{closed:s(1),enter:s(2),leave:s(4),transition:s(2)||s(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function Rt(e,{prepare:t,run:n,done:r,inFlight:i}){let a=m();return Bt(e,{prepare:t,inFlight:i}),a.nextFrame(()=>{n(),a.requestAnimationFrame(()=>{a.add(zt(e,r))})}),a.dispose}function zt(e,t){let n=m();if(!e)return n.dispose;let r=!1;n.add(()=>{r=!0});let i=e.getAnimations?.call(e).filter(e=>e instanceof CSSTransition)??[];return i.length===0?(t(),n.dispose):(Promise.allSettled(i.map(e=>e.finished)).then(()=>{r||t()}),n.dispose)}function Bt(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let r=e.style.transition;e.style.transition=`none`,n(),e.offsetHeight,e.style.transition=r}function Vt(e){return(e.getAnimations?.call(e)??[]).some(e=>e instanceof CSSTransition&&e.playState!==`finished`)}function Ht(e,t){let n=(0,i.useRef)([]),r=v(e);(0,i.useEffect)(()=>{let e=[...n.current];for(let[i,a]of t.entries())if(n.current[i]!==a){let i=r(t,e);return n.current=t,i}},[r,...t])}var Y=(0,i.createContext)(null);Y.displayName=`OpenClosedContext`;var X=(e=>(e[e.Open=1]=`Open`,e[e.Closed=2]=`Closed`,e[e.Closing=4]=`Closing`,e[e.Opening=8]=`Opening`,e))(X||{});function Ut(){return(0,i.useContext)(Y)}function Wt({value:e,children:t}){return i.createElement(Y.Provider,{value:e},t)}function Gt({children:e}){return i.createElement(Y.Provider,{value:null},e)}function Kt(e){function t(){document.readyState!==`loading`&&(e(),document.removeEventListener(`DOMContentLoaded`,t))}typeof window<`u`&&typeof document<`u`&&(document.addEventListener(`DOMContentLoaded`,t),t())}var Z=[];Kt(()=>{function e(e){if(!A(e.target)||e.target===document.body||Z[0]===e.target)return;let t=e.target;t=t.closest(U),Z.unshift(t??e.target),Z=Z.filter(e=>e!=null&&e.isConnected),Z.splice(10)}window.addEventListener(`click`,e,{capture:!0}),window.addEventListener(`mousedown`,e,{capture:!0}),window.addEventListener(`focus`,e,{capture:!0}),document.body.addEventListener(`click`,e,{capture:!0}),document.body.addEventListener(`mousedown`,e,{capture:!0}),document.body.addEventListener(`focus`,e,{capture:!0})});function qt(e){let t=v(e),n=(0,i.useRef)(!1);(0,i.useEffect)(()=>(n.current=!1,()=>{n.current=!0,p(()=>{n.current&&t()})}),[t])}function Jt(){let e=typeof document>`u`;return`useSyncExternalStore`in i&&(e=>e.useSyncExternalStore)(i)(()=>()=>{},()=>!1,()=>!e)}function Yt(){let e=Jt(),[t,n]=i.useState(c.isHandoffComplete);return t&&c.isHandoffComplete===!1&&n(!1),i.useEffect(()=>{t!==!0&&n(!0)},[t]),i.useEffect(()=>c.handoff(),[]),!e&&t}var Xt=(0,i.createContext)(!1);function Zt(){return(0,i.useContext)(Xt)}function Qt(e){return i.createElement(Xt.Provider,{value:e.force},e.children)}function $t(e){let t=Zt(),n=(0,i.useContext)(an),[r,a]=(0,i.useState)(()=>{if(!t&&n!==null)return n.current??null;if(c.isServer)return null;let r=e?.getElementById(`headlessui-portal-root`);if(r)return r;if(e===null)return null;let i=e.createElement(`div`);return i.setAttribute(`id`,`headlessui-portal-root`),e.body.appendChild(i)});return(0,i.useEffect)(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),(0,i.useEffect)(()=>{t||n!==null&&a(n.current)},[n,a,t]),r}var en=i.Fragment,tn=w(function(e,t){let{ownerDocument:n=null,...r}=e,a=(0,i.useRef)(null),o=M(we(e=>{a.current=e}),t),s=wt(a.current),c=$t(n??s),l=(0,i.useContext)(Q),u=h(),d=Yt(),f=x();return qt(()=>{var e;c&&c.childNodes.length<=0&&((e=c.parentElement)==null||e.removeChild(c))}),!c||!d?null:(0,Ct.createPortal)(i.createElement(`div`,{"data-headlessui-portal":``,ref:e=>{u.dispose(),l&&e&&u.add(l.register(e))}},f({ourProps:{ref:o},theirProps:r,slot:{},defaultTag:en,name:`Portal`})),c)});function nn(e,t){let n=M(t),{enabled:r=!0,ownerDocument:a,...o}=e,s=x();return r?i.createElement(tn,{...o,ownerDocument:a,ref:n}):s({ourProps:{ref:n},theirProps:o,slot:{},defaultTag:en,name:`Portal`})}var rn=i.Fragment,an=(0,i.createContext)(null);function on(e,t){let{target:n,...r}=e,a={ref:M(t)},o=x();return i.createElement(an.Provider,{value:n},o({ourProps:a,theirProps:r,defaultTag:rn,name:`Popover.Group`}))}var Q=(0,i.createContext)(null);function sn(){let e=(0,i.useContext)(Q),t=(0,i.useRef)([]),n=v(n=>(t.current.push(n),e&&e.register(n),()=>r(n))),r=v(n=>{let r=t.current.indexOf(n);r!==-1&&t.current.splice(r,1),e&&e.unregister(n)}),a=(0,i.useMemo)(()=>({register:n,unregister:r,portals:t}),[n,r,t]);return[t,(0,i.useMemo)(()=>function({children:e}){return i.createElement(Q.Provider,{value:a},e)},[a])]}var cn=w(nn),$=w(on),ln=Object.assign(cn,{Group:$});export{he as $,ft as A,De as B,ht as C,gt as D,ut as E,Ke as F,Ce as G,Ee as H,Ye as I,ye as J,xe as K,ze as L,nt as M,B as N,at as O,Qe as P,O as Q,He as R,ot as S,W as T,M as U,je as V,Se as W,k as X,be as Y,ge as Z,wt as _,m as _t,Yt as a,ce as at,q as b,l as bt,Wt as c,T as ct,Ut as d,ne as dt,pe as et,Ht as f,ee as ft,Tt as g,h as gt,Nt as h,g as ht,Qt as i,x as it,rt as j,_t as k,X as l,b as lt,It as m,_ as mt,ln as n,re as nt,qt as o,w as ot,Lt as p,v as pt,A as q,sn as r,ie as rt,Z as s,D as st,$ as t,i as tt,Gt as u,y as ut,St as v,p as vt,G as w,K as x,bt as y,f as yt,Me as z};
@@ -1 +0,0 @@
1
- import{c as e,n as t,t as n}from"./react-dom.CqAxpHMt.js";import{G as r,J as i,K as a,U as o,W as s,X as c,Y as l,Z as u,_t as d,b as f,bt as p,dt as m,ft as h,gt as g,ht as _,it as v,ot as y,pt as b,q as x,tt as S}from"./portal.C3KrUREL.js";var C=e=>ee(e)?e.document:te(e)?e:e?.ownerDocument??(typeof document<`u`?document:void 0),w=e=>C(e)?.defaultView??(typeof window<`u`?window:void 0);function T(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function ee(e){return typeof e==`object`&&!!e&&`window`in e&&e.window===e}function te(e){return T(e)&&e.nodeType===9}function ne(e){return T(e)&&e.nodeType===11&&`host`in e}var E=!1;function D(){return E}function O(e,t){if(!D())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!=null;){if(n===e)return!0;n=typeof n.assignedElements!=`function`&&n.assignedSlot?.parentNode?n.assignedSlot.parentNode:ne(n)?n.host:n.parentNode}return!1}var k=(e=document)=>{if(!D())return e.activeElement;let t=e.activeElement;for(;t&&`shadowRoot`in t&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t};function A(e){if(D()&&e.target instanceof Element&&e.target.shadowRoot){if(`composedPath`in e)return e.composedPath()[0]??null;if(`composedPath`in e.nativeEvent)return e.nativeEvent.composedPath()[0]??null}return e.target}function re(e){e.focus({preventScroll:!0})}var j=e(t(),1),ie=typeof document<`u`?j.useLayoutEffect:()=>{};function ae(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function oe(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function se(e){let t=(0,j.useRef)({isFocused:!1,observer:null});return ie(()=>{let e=t.current;return()=>{e.observer&&=(e.observer.disconnect(),null)}},[]),(0,j.useCallback)(n=>{let r=A(n);if(r instanceof HTMLButtonElement||r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement){t.current.isFocused=!0;let n=r;n.addEventListener(`focusout`,r=>{if(t.current.isFocused=!1,n.disabled){let t=ae(r);e?.(t)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)},{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&n.disabled){t.current.observer?.disconnect();let e=n===k()?null:k();n.dispatchEvent(new FocusEvent(`blur`,{relatedTarget:e})),n.dispatchEvent(new FocusEvent(`focusout`,{bubbles:!0,relatedTarget:e}))}}),t.current.observer.observe(n,{attributes:!0,attributeFilter:[`disabled`]})}},[e])}function ce(e){if(typeof window>`u`||window.navigator==null)return!1;let t=window.navigator.userAgentData?.brands;return Array.isArray(t)&&t.some(t=>e.test(t.brand))||e.test(window.navigator.userAgent)}function le(e){return typeof window<`u`&&window.navigator!=null&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function M(e){let t=null;return()=>(t??=e(),t)}var ue=M(function(){return le(/^Mac/i)}),de=M(function(){return le(/^iPhone/i)}),fe=M(function(){return le(/^iPad/i)||ue()&&navigator.maxTouchPoints>1}),pe=M(function(){return de()||fe()}),me=M(function(){return ce(/AppleWebKit/i)&&(pe()||!he())}),he=M(function(){return ce(/Chrome|CriOS|CrMo/i)}),ge=M(function(){return ce(/Android/i)});function _e(e){return e.pointerType===``&&e.isTrusted?!0:ge()&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function N(e,t,n=!0){let{metaKey:r,ctrlKey:i,altKey:a,shiftKey:o}=t,s=me()&&ue()&&!fe()?new KeyboardEvent(`keydown`,{keyIdentifier:`Enter`,metaKey:r,ctrlKey:i,altKey:a,shiftKey:o}):new MouseEvent(`click`,{metaKey:r,ctrlKey:i,altKey:a,shiftKey:o,detail:1,bubbles:!0,cancelable:!0});N.isOpening=n,re(e),e.dispatchEvent(s),N.isOpening=!1}N.isOpening=!1;var P=null,ve=new Set,ye=new Map,F=!1,be=!1,xe={Tab:!0,Escape:!0};function Se(e,t){for(let n of ve)n(e,t)}function Ce(e){return!(e.metaKey||!ue()&&e.altKey||e.ctrlKey||e.key===`Control`||e.key===`Shift`||e.key===`Meta`)}function we(e){F=!0,!N.isOpening&&Ce(e)&&(P=`keyboard`,Se(`keyboard`,e))}function I(e){P=`pointer`,`pointerType`in e&&e.pointerType,(e.type===`mousedown`||e.type===`pointerdown`)&&(F=!0,Se(`pointer`,e))}function Te(e){!N.isOpening&&_e(e)&&(F=!0,P=`virtual`)}function Ee(e){let t=A(e),n=w(t),r=C(t);t===n?be=!0:t!==r&&e.isTrusted&&(!F&&!be&&(P=`virtual`,Se(`virtual`,e)),F=!1,be=!1)}function De(){F=!1,be=!0}function Oe(e){let t=k(C(A(e)));queueMicrotask(()=>{k(C(A(e)))!==t&&Ne(`keyboard`)})}function ke(e){if(typeof window>`u`||typeof document>`u`)return;let t=w(e),n=C(e);if(ye.get(t))return;let r=t.HTMLElement.prototype.focus;Reflect.defineProperty(t.HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:function(){F=!0,r.apply(this,arguments)}}),n.addEventListener(`keydown`,we,!0),n.addEventListener(`keyup`,we,!0),n.addEventListener(`click`,Te,!0),n.addEventListener(`invalid`,Oe,!0),t.addEventListener(`focus`,Ee,!0),t.addEventListener(`blur`,De,!1),typeof PointerEvent<`u`&&(n.addEventListener(`pointerdown`,I,!0),n.addEventListener(`pointermove`,I,!0),n.addEventListener(`pointerup`,I,!0)),t.addEventListener(`beforeunload`,()=>{Ae(e)},{once:!0}),ye.set(t,{focus:r})}var Ae=(e,t)=>{let n=w(e),r=C(e);t&&r.removeEventListener(`DOMContentLoaded`,t),ye.has(n)&&(Reflect.defineProperty(n.HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:ye.get(n).focus}),r.removeEventListener(`keydown`,we,!0),r.removeEventListener(`keyup`,we,!0),r.removeEventListener(`click`,Te,!0),r.removeEventListener(`invalid`,Oe,!0),n.removeEventListener(`focus`,Ee,!0),n.removeEventListener(`blur`,De,!1),typeof PointerEvent<`u`&&(r.removeEventListener(`pointerdown`,I,!0),r.removeEventListener(`pointermove`,I,!0),r.removeEventListener(`pointerup`,I,!0)),ye.delete(n))};function je(e){let t=C(e),n;return t.readyState===`loading`?(n=()=>{ke(e)},t.addEventListener(`DOMContentLoaded`,n)):ke(e),()=>Ae(e,n)}typeof document<`u`&&je();function Me(){return P!==`pointer`}function Ne(e){P=e,Se(e,null)}var Pe=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function Fe(e,t,n){let r=n?A(n):void 0,i=C(r),a=w(r),o=a===void 0?HTMLInputElement:a.HTMLInputElement,s=a===void 0?HTMLTextAreaElement:a.HTMLTextAreaElement,c=a===void 0?HTMLElement:a.HTMLElement,l=a===void 0?KeyboardEvent:a.KeyboardEvent,u=k(i);return e=e||u instanceof o&&!Pe.has(u.type)||u instanceof s||u instanceof c&&u.isContentEditable,!(e&&t===`keyboard`&&n instanceof l&&!xe[n.key])}function Ie(e,t,n){ke(),(0,j.useEffect)(()=>{if(n?.enabled===!1)return;let t=(t,r)=>{Fe(!!n?.isTextInput,t,r)&&e(Me())};return ve.add(t),()=>{ve.delete(t)}},t)}function Le(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:i}=e,a=(0,j.useCallback)(e=>{if(A(e)===e.currentTarget)return r&&r(e),i&&i(!1),!0},[r,i]),o=se(a),s=(0,j.useCallback)(e=>{let t=A(e),r=C(t),a=r?k(r):k();t===e.currentTarget&&t===a&&(n&&n(e),i&&i(!0),o(e))},[i,n,o]);return{focusProps:{onFocus:!t&&(n||i||r)?s:void 0,onBlur:!t&&(r||i)?a:void 0}}}function Re(){let e=(0,j.useRef)(new Map),t=(0,j.useCallback)((t,n,r,i)=>{let a=i?.once?(...t)=>{e.current.delete(r),r(...t)}:r;e.current.set(r,{type:n,eventTarget:t,fn:a,options:i}),t.addEventListener(n,a,i)},[]),n=(0,j.useCallback)((t,n,r,i)=>{let a=e.current.get(r)?.fn||r;t.removeEventListener(n,a,i),e.current.delete(r)},[]),r=(0,j.useCallback)(()=>{e.current.forEach((e,t)=>{n(e.eventTarget,e.type,t,e.options)})},[n]);return(0,j.useEffect)(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function ze(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:i}=e,a=(0,j.useRef)({isFocusWithin:!1}),{addGlobalListener:o,removeAllGlobalListeners:s}=Re(),c=(0,j.useCallback)(e=>{O(e.currentTarget,A(e))&&a.current.isFocusWithin&&!O(e.currentTarget,e.relatedTarget)&&(a.current.isFocusWithin=!1,s(),n&&n(e),i&&i(!1))},[n,i,a,s]),l=se(c),u=(0,j.useCallback)(e=>{if(!O(e.currentTarget,A(e)))return;let t=A(e),n=C(t),s=k(n);if(!a.current.isFocusWithin&&s===t){r&&r(e),i&&i(!0),a.current.isFocusWithin=!0,l(e);let t=e.currentTarget;o(n,`focus`,e=>{let r=A(e);if(a.current.isFocusWithin&&!O(t,r)){let e=new n.defaultView.FocusEvent(`blur`,{relatedTarget:r});oe(e,t);let i=ae(e);c(i)}},{capture:!0})}},[r,i,l,o,c]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:u,onBlur:c}}}function Be(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,i=(0,j.useRef)({isFocused:!1,isFocusVisible:t||Me()}),[a,o]=(0,j.useState)(!1),[s,c]=(0,j.useState)(()=>i.current.isFocused&&i.current.isFocusVisible),l=(0,j.useCallback)(()=>c(i.current.isFocused&&i.current.isFocusVisible),[]),u=(0,j.useCallback)(e=>{i.current.isFocused=e,i.current.isFocusVisible=Me(),o(e),l()},[l]);Ie(e=>{i.current.isFocusVisible=e,l()},[n,a],{enabled:a,isTextInput:n});let{focusProps:d}=Le({isDisabled:r,onFocusChange:u}),{focusWithinProps:f}=ze({isDisabled:!r,onFocusWithinChange:u});return{isFocused:a,isFocusVisible:s,focusProps:r?f:d}}var Ve=!1,He=0;function Ue(){Ve=!0,setTimeout(()=>{Ve=!1},500)}function We(e){e.pointerType===`touch`&&Ue()}function Ge(){let e=C(null);if(e!==void 0)return He===0&&typeof PointerEvent<`u`&&e.addEventListener(`pointerup`,We),He++,()=>{He--,!(He>0)&&typeof PointerEvent<`u`&&e.removeEventListener(`pointerup`,We)}}function Ke(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:i}=e,[a,o]=(0,j.useState)(!1),s=(0,j.useRef)({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:``,target:null}).current;(0,j.useEffect)(Ge,[]);let{addGlobalListener:c,removeAllGlobalListeners:l}=Re(),{hoverProps:u,triggerHoverEnd:d}=(0,j.useMemo)(()=>{let e=(e,r)=>{if(s.pointerType=r,i||r===`touch`||s.isHovered||!O(e.currentTarget,A(e)))return;s.isHovered=!0;let l=e.currentTarget;s.target=l,c(C(A(e)),`pointerover`,e=>{s.isHovered&&s.target&&!O(s.target,A(e))&&a(e,e.pointerType)},{capture:!0}),t&&t({type:`hoverstart`,target:l,pointerType:r}),n&&n(!0),o(!0)},a=(e,t)=>{let i=s.target;s.pointerType=``,s.target=null,t!==`touch`&&s.isHovered&&i&&(s.isHovered=!1,l(),r&&r({type:`hoverend`,target:i,pointerType:t}),n&&n(!1),o(!1))},u={};return typeof PointerEvent<`u`&&(u.onPointerEnter=t=>{Ve&&t.pointerType===`mouse`||e(t,t.pointerType)},u.onPointerLeave=e=>{!i&&O(e.currentTarget,A(e))&&a(e,e.pointerType)}),{hoverProps:u,triggerHoverEnd:a}},[t,n,r,i,s,c,l]);return(0,j.useEffect)(()=>{i&&d({currentTarget:s.target},s.pointerType)},[i]),{hoverProps:u,isHovered:a}}function qe(e){let t=e.width/2,n=e.height/2;return{top:e.clientY-n,right:e.clientX+t,bottom:e.clientY+n,left:e.clientX-t}}function Je(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Ye({disabled:e=!1}={}){let t=(0,j.useRef)(null),[n,r]=(0,j.useState)(!1),i=g(),a=b(()=>{t.current=null,r(!1),i.dispose()}),o=b(e=>{if(i.dispose(),t.current===null){t.current=e.currentTarget,r(!0);{let n=p(e.currentTarget);i.addEventListener(n,`pointerup`,a,!1),i.addEventListener(n,`pointermove`,e=>{if(t.current){let n=qe(e);r(Je(n,t.current.getBoundingClientRect()))}},!1),i.addEventListener(n,`pointercancel`,a,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:o,onPointerUp:a,onClick:a}}}var Xe=(0,j.createContext)(void 0);function Ze(){return(0,j.useContext)(Xe)}function Qe(e){let t=e.parentElement,n=null;for(;t&&!a(t);)s(t)&&(n=t),t=t.parentElement;let r=t?.getAttribute(`disabled`)===``;return r&&$e(n)?!1:r}function $e(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(s(t))return!1;t=t.previousElementSibling}return!0}var et=(0,j.createContext)(null);et.displayName=`LabelContext`;function tt(){let e=(0,j.useContext)(et);if(e===null){let e=Error(`You used a <Label /> component, but it is not inside a relevant parent.`);throw Error.captureStackTrace&&Error.captureStackTrace(e,tt),e}return e}function nt(e){let t=(0,j.useContext)(et)?.value??void 0;return(e?.length??0)>0?[t,...e].filter(Boolean).join(` `):t}function rt({inherit:e=!1}={}){let t=nt(),[n,r]=(0,j.useState)([]),i=e?[t,...n].filter(Boolean):n;return[i.length>0?i.join(` `):void 0,(0,j.useMemo)(()=>function(e){let t=b(e=>(r(t=>[...t,e]),()=>r(t=>{let n=t.slice(),r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}))),n=(0,j.useMemo)(()=>({register:t,slot:e.slot,name:e.name,props:e.props,value:e.value}),[t,e.slot,e.name,e.props,e.value]);return j.createElement(et.Provider,{value:n},e.children)},[r])]}var it=`label`;function at(e,t){let n=(0,S.useId)(),a=tt(),s=Ze(),c=m(),{id:u=`headlessui-label-${n}`,htmlFor:d=s??a.props?.htmlFor,passive:f=!1,...p}=e,g=o(t);_(()=>a.register(u),[u,a.register]);let y=b(e=>{let t=e.currentTarget;if(!(e.target!==e.currentTarget&&r(e.target))&&(l(t)&&e.preventDefault(),a.props&&`onClick`in a.props&&typeof a.props.onClick==`function`&&a.props.onClick(e),l(t))){let e=document.getElementById(t.htmlFor);if(e){let t=e.getAttribute(`disabled`);if(t===`true`||t===``)return;let n=e.getAttribute(`aria-disabled`);if(n===`true`||n===``)return;(i(e)&&(e.type===`file`||e.type===`radio`||e.type===`checkbox`)||e.role===`radio`||e.role===`checkbox`||e.role===`switch`)&&e.click(),e.focus({preventScroll:!0})}}}),x=h({...a.slot,disabled:c||!1}),C={ref:g,...a.props,id:u,htmlFor:d,onClick:y};return f&&(`onClick`in C&&(delete C.htmlFor,delete C.onClick),`onClick`in p&&delete p.onClick),v()({ourProps:C,theirProps:p,slot:x,defaultTag:d?it:`div`,name:a.name||`Label`})}var ot=y(at),st=Object.assign(ot,{});function ct(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function lt(e,t,n=!1){let[r,i]=(0,j.useState)(()=>ct(t));return _(()=>{if(!t||!e)return;let n=d();return n.requestAnimationFrame(function e(){n.requestAnimationFrame(e),i(e=>{let n=ct(t);return n.width===e.width&&n.height===e.height?e:n})}),()=>{n.dispose()}},[t,e]),n?{width:`${r.width}px`,height:`${r.height}px`}:r}var ut=(e=>(e[e.Left=0]=`Left`,e[e.Right=2]=`Right`,e))(ut||{});function dt(e){let t=(0,j.useRef)(null);return{onPointerDown:b(n=>{t.current=n.pointerType,!Qe(n.currentTarget)&&n.pointerType===`mouse`&&n.button===ut.Left&&(n.preventDefault(),e(n))}),onClick:b(n=>{t.current!==`mouse`&&(Qe(n.currentTarget)||e(n))})}}var ft=(e=>(e[e.Ignore=0]=`Ignore`,e[e.Select=1]=`Select`,e[e.Close=2]=`Close`,e))(ft||{}),pt={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},mt=200,ht=5;function gt(e,{trigger:t,action:n,close:r,select:i}){let a=(0,j.useRef)(null),o=(0,j.useRef)(null),s=(0,j.useRef)(null);f(e&&t!==null,`pointerdown`,e=>{u(e?.target)&&t!=null&&t.contains(e.target)&&(o.current=e.x,s.current=e.y,a.current=e.timeStamp)}),f(e&&t!==null,`pointerup`,e=>{let t=a.current;if(t===null||(a.current=null,!x(e.target))||Math.abs(e.x-(o.current??e.x))<ht&&Math.abs(e.y-(s.current??e.y))<ht)return;let c=n(e);switch(c.kind){case 0:return;case 1:e.timeStamp-t>mt&&(i(c.target),r());break;case 2:r()}},{capture:!0})}function _t(e,t){return(0,j.useMemo)(()=>{if(e.type)return e.type;let n=e.as??`button`;if(typeof n==`string`&&n.toLowerCase()===`button`||t?.tagName===`BUTTON`&&!t.hasAttribute(`type`))return`button`},[e.type,e.as,t])}function vt(e){return[e.screenX,e.screenY]}function yt(){let e=(0,j.useRef)([-1,-1]);return{wasMoved(t){let n=vt(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=vt(t)}}}function bt(){return typeof window<`u`}function L(e){return xt(e)?(e.nodeName||``).toLowerCase():`#document`}function R(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function z(e){return((xt(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function xt(e){return bt()?e instanceof Node||e instanceof R(e).Node:!1}function B(e){return bt()?e instanceof Element||e instanceof R(e).Element:!1}function V(e){return bt()?e instanceof HTMLElement||e instanceof R(e).HTMLElement:!1}function St(e){return!bt()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof R(e).ShadowRoot}function Ct(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=U(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function wt(e){return/^(table|td|th)$/.test(L(e))}function Tt(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Et=/transform|translate|scale|rotate|perspective|filter/,Dt=/paint|layout|strict|content/,H=e=>!!e&&e!==`none`,Ot;function kt(e){let t=B(e)?U(e):e;return H(t.transform)||H(t.translate)||H(t.scale)||H(t.rotate)||H(t.perspective)||!jt()&&(H(t.backdropFilter)||H(t.filter))||Et.test(t.willChange||``)||Dt.test(t.contain||``)}function At(e){let t=W(e);for(;V(t)&&!Mt(t);){if(kt(t))return t;if(Tt(t))return null;t=W(t)}return null}function jt(){return Ot??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Ot}function Mt(e){return/^(html|body|#document)$/.test(L(e))}function U(e){return R(e).getComputedStyle(e)}function Nt(e){return B(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function W(e){if(L(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||St(e)&&e.host||z(e);return St(t)?t.host:t}function Pt(e){let t=W(e);return Mt(t)?(e.ownerDocument||e).body:V(t)&&Ct(t)?t:Pt(t)}function Ft(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Pt(e),i=r===e.ownerDocument?.body,a=R(r);if(i){let e=It(a);return t.concat(a,a.visualViewport||[],Ct(r)?r:[],e&&n?Ft(e):[])}return t.concat(r,Ft(r,[],n))}function It(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Lt(){let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(e=>{let{brand:t,version:n}=e;return t+`/`+n}).join(` `):navigator.userAgent}var G=Math.min,K=Math.max,Rt=Math.round,zt=Math.floor,q=e=>({x:e,y:e}),Bt={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Vt(e,t,n){return K(e,G(t,n))}function J(e,t){return typeof e==`function`?e(t):e}function Y(e){return e.split(`-`)[0]}function Ht(e){return e.split(`-`)[1]}function Ut(e){return e===`x`?`y`:`x`}function Wt(e){return e===`y`?`height`:`width`}function X(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Gt(e){return Ut(X(e))}function Kt(e,t,n){n===void 0&&(n=!1);let r=Ht(e),i=Gt(e),a=Wt(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=tn(o)),[o,tn(o)]}function qt(e){let t=tn(e);return[Jt(e),t,Jt(t)]}function Jt(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Yt=[`left`,`right`],Xt=[`right`,`left`],Zt=[`top`,`bottom`],Qt=[`bottom`,`top`];function $t(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Xt:Yt:t?Yt:Xt;case`left`:case`right`:return t?Zt:Qt;default:return[]}}function en(e,t,n,r){let i=Ht(e),a=$t(Y(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Jt)))),a}function tn(e){let t=Y(e);return Bt[t]+e.slice(t.length)}function nn(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function rn(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:nn(e)}function an(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}var on=e(n(),1);function sn(e,t,n){let{reference:r,floating:i}=e,a=X(t),o=Gt(t),s=Wt(o),c=Y(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=Ht(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function cn(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=J(t,e),p=rn(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=an(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=an(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var ln=50,un=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:cn},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=sn(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<ln&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=sn(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},dn=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=J(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Y(r),_=X(o),v=Y(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[tn(o)]:qt(o)),x=p!==`none`;!d&&x&&b.push(...en(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Kt(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===X(t)||T.every(e=>X(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=X(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},fn=new Set([`left`,`top`]);async function pn(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Y(n),s=Ht(n),c=X(n)===`y`,l=fn.has(o)?-1:1,u=a&&c?-1:1,d=J(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var mn=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await pn(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},hn=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=J(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=X(i),p=Ut(f),m=u[p],h=u[f],g=(e,t)=>Vt(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},gn=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=J(e,t),c=await i.detectOverflow(t,s),l=Y(n),u=Ht(n),d=X(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=G(p-c[m],g),y=G(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*K(c.left,c.right):S=p-2*K(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function _n(e){let t=U(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=V(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Rt(n)!==a||Rt(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function vn(e){return B(e)?e:e.contextElement}function Z(e){let t=vn(e);if(!V(t))return q(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=_n(t),o=(a?Rt(n.width):n.width)/r,s=(a?Rt(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var yn=q(0);function bn(e){let t=R(e);return!jt()||!t.visualViewport?yn:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function xn(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===R(e)}function Q(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=vn(e),o=q(1);t&&(r?B(r)&&(o=Z(r)):o=Z(e));let s=xn(a,n,r)?bn(a):q(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=R(a),t=B(r)?R(r):r,n=e,i=It(n);for(;i&&t!==n;){let e=Z(i),t=i.getBoundingClientRect(),r=U(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=R(i),i=It(n)}}return an({width:u,height:d,x:c,y:l})}function Sn(e,t){let n=Nt(e).scrollLeft;return t?t.left+n:Q(z(e)).left+n}function Cn(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Sn(e,n),y:n.top+t.scrollTop}}function wn(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=z(r),s=t?Tt(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=q(1),u=q(0),d=V(r);if((d||!a)&&((L(r)!==`body`||Ct(o))&&(c=Nt(r)),d)){let e=Q(r);l=Z(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Cn(o,c):q(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Tn(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function En(e){let t=Nt(e),n=e.ownerDocument.body,r=K(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=K(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Sn(e),o=-t.scrollTop;return U(n).direction===`rtl`&&(a+=K(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Dn=25;function On(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=R(e),a=z(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!jt()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Sn(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=Dn&&(s-=o)}return{width:s,height:c,x:l,y:u}}function kn(e,t){let n=Q(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Z(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function An(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=On(e,n,t);else if(t===`document`)r=En(z(e));else if(B(t))r=kn(t,n);else{let n=bn(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return an(r)}function jn(e,t){let n=t.get(e);if(n)return n;let r=Ft(e,[],!1).filter(e=>B(e)&&L(e)!==`body`),i=null,a=U(e).position===`fixed`,o=a?W(e):e;for(;B(o)&&!Mt(o);){let e=U(o),t=kt(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=W(o)}return t.set(e,r),r}function Mn(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Tt(t)?[]:jn(t,this._c):[].concat(n),r],o=An(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=An(t,a[e],i);s=K(n.top,s),c=G(n.right,c),l=G(n.bottom,l),u=K(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Nn(e){let{width:t,height:n}=_n(e);return{width:t,height:n}}function Pn(e,t,n){let r=V(t),i=z(t),a=n===`fixed`,o=Q(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=q(0);if((r||!a)&&((L(t)!==`body`||Ct(i))&&(s=Nt(t)),r)){let e=Q(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Sn(i));let l=i&&!r&&!a?Cn(i,s):q(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function Fn(e){return U(e).position===`static`}function In(e,t){if(!V(e)||U(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return z(e)===n&&(n=n.ownerDocument.body),n}function Ln(e,t){let n=R(e);if(Tt(e))return n;if(!V(e)){let t=W(e);for(;t&&!Mt(t);){if(B(t)&&!Fn(t))return t;t=W(t)}return n}let r=In(e,t);for(;r&&wt(r)&&Fn(r);)r=In(r,t);return r&&Mt(r)&&Fn(r)&&!kt(r)?n:r||At(e)||n}var Rn=async function(e){let t=this.getOffsetParent||Ln,n=this.getDimensions,r=await n(e.floating);return{reference:Pn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function zn(e){return U(e).direction===`rtl`}var Bn={convertOffsetParentRelativeRectToViewportRelativeRect:wn,getDocumentElement:z,getClippingRect:Mn,getOffsetParent:Ln,getElementRects:Rn,getClientRects:Tn,getDimensions:Nn,getScale:Z,isElement:B,isRTL:zn};function Vn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Hn(e,t,n){let r=null,i,a=z(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=zt(d),h=zt(a.clientWidth-(u+f)),g=zt(a.clientHeight-(d+p)),_=zt(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:K(0,G(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Vn(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=R(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Un(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=vn(e),u=i||a?[...l?Ft(l):[],...t?Ft(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Hn(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Q(e):null;c&&g();function g(){let t=Q(e);h&&!Vn(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Wn=cn,Gn=mn,Kn=hn,qn=dn,Jn=gn,Yn=(e,t,n)=>{let r=new Map,i=n??{},a={...Bn,...i.platform,_c:r};return un(e,t,{...i,platform:a})},Xn=typeof document<`u`?j.useLayoutEffect:function(){};function Zn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Zn(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Zn(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Qn(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function $n(e,t){let n=Qn(e);return Math.round(t*n)/n}function er(e){let t=j.useRef(e);return Xn(()=>{t.current=e}),t}function tr(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=j.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=j.useState(r);Zn(f,r)||p(r);let[m,h]=j.useState(null),[g,_]=j.useState(null),v=j.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=j.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=j.useRef(null),C=j.useRef(null),w=j.useRef(u),T=c!=null,ee=er(c),te=er(i),ne=er(l),E=j.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};te.current&&(e.platform=te.current),Yn(S.current,C.current,e).then(e=>{let t={...e,isPositioned:ne.current!==!1};D.current&&!Zn(w.current,t)&&(w.current=t,on.flushSync(()=>{d(t)}))})},[f,t,n,te,ne]);Xn(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let D=j.useRef(!1);Xn(()=>(D.current=!0,()=>{D.current=!1}),[]),Xn(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(ee.current)return ee.current(b,x,E);E()}},[b,x,E,ee,T]);let O=j.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),k=j.useMemo(()=>({reference:b,floating:x}),[b,x]),A=j.useMemo(()=>{let e={position:n,left:0,top:0};if(!k.floating)return e;let t=$n(k.floating,u.x),r=$n(k.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Qn(k.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,k.floating,u.x,u.y]);return j.useMemo(()=>({...u,update:E,refs:O,elements:k,floatingStyles:A}),[u,E,O,k,A])}var nr=(e,t)=>{let n=Gn(e);return{name:n.name,fn:n.fn,options:[e,t]}},rr=(e,t)=>{let n=Kn(e);return{name:n.name,fn:n.fn,options:[e,t]}},ir=(e,t)=>{let n=qn(e);return{name:n.name,fn:n.fn,options:[e,t]}},ar=(e,t)=>{let n=Jn(e);return{name:n.name,fn:n.fn,options:[e,t]}},or={...j},sr=or.useInsertionEffect||(e=>e());function cr(e){let t=j.useRef(()=>{});return sr(()=>{t.current=e}),j.useCallback(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}var lr=`ArrowUp`,ur=`ArrowDown`,dr=`ArrowLeft`,fr=`ArrowRight`,pr=typeof document<`u`?j.useLayoutEffect:j.useEffect,mr=[dr,fr],hr=[lr,ur];[...mr,...hr];var gr=!1,_r=0,vr=()=>`floating-ui-`+Math.random().toString(36).slice(2,6)+_r++;function yr(){let[e,t]=j.useState(()=>gr?vr():void 0);return pr(()=>{e??t(vr())},[]),j.useEffect(()=>{gr=!0},[]),e}var br=or.useId||yr;function xr(){let e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(e=>e(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,e.get(t)?.filter(e=>e!==n)||[])}}}var Sr=j.createContext(null),Cr=j.createContext(null),wr=()=>j.useContext(Sr)?.id||null,Tr=()=>j.useContext(Cr),Er=`data-floating-ui-focusable`;function Dr(e){let{open:t=!1,onOpenChange:n,elements:r}=e,i=br(),a=j.useRef({}),[o]=j.useState(()=>xr()),s=wr()!=null,[c,l]=j.useState(r.reference),u=cr((e,t,r)=>{a.current.openEvent=e?t:void 0,o.emit(`openchange`,{open:e,event:t,reason:r,nested:s}),n?.(e,t,r)}),d=j.useMemo(()=>({setPositionReference:l}),[]),f=j.useMemo(()=>({reference:c||r.reference||null,floating:r.floating||null,domReference:r.reference}),[c,r.reference,r.floating]);return j.useMemo(()=>({dataRef:a,open:t,onOpenChange:u,elements:f,events:o,floatingId:i,refs:d}),[t,u,f,o,i,d])}function Or(e){e===void 0&&(e={});let{nodeId:t}=e,n=Dr({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,i=r.elements,[a,o]=j.useState(null),[s,c]=j.useState(null),l=i?.domReference||a,u=j.useRef(null),d=Tr();pr(()=>{l&&(u.current=l)},[l]);let f=tr({...e,elements:{...i,...s&&{reference:s}}}),p=j.useCallback(e=>{let t=B(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;c(t),f.refs.setReference(t)},[f.refs]),m=j.useCallback(e=>{(B(e)||e===null)&&(u.current=e,o(e)),(B(f.refs.reference.current)||f.refs.reference.current===null||e!==null&&!B(e))&&f.refs.setReference(e)},[f.refs]),h=j.useMemo(()=>({...f.refs,setReference:m,setPositionReference:p,domReference:u}),[f.refs,m,p]),g=j.useMemo(()=>({...f.elements,domReference:l}),[f.elements,l]),_=j.useMemo(()=>({...f,...r,refs:h,elements:g,nodeId:t}),[f,h,g,t,r]);return pr(()=>{r.dataRef.current.floatingContext=_;let e=d?.nodesRef.current.find(e=>e.id===t);e&&(e.context=_)}),j.useMemo(()=>({...f,context:_,refs:h,elements:g}),[f,h,g,_])}var kr=`active`,Ar=`selected`;function jr(e,t,n){let r=new Map,i=n===`item`,a=e;if(i&&e){let{[kr]:t,[Ar]:n,...r}=e;a=r}return{...n===`floating`&&{tabIndex:-1,[Er]:``},...a,...t.map(t=>{let r=t?t[n]:null;return typeof r==`function`?e?r(e):null:r}).concat(e).reduce((e,t)=>(t&&Object.entries(t).forEach(t=>{let[n,a]=t;if(!(i&&[kr,Ar].includes(n))){if(n.indexOf(`on`)===0){if(r.has(n)||r.set(n,[]),typeof a==`function`){var o;(o=r.get(n))==null||o.push(a),e[n]=function(){var e=[...arguments];return r.get(n)?.map(t=>t(...e)).find(e=>e!==void 0)}}}else e[n]=a}}),e),{})}}function Mr(e){e===void 0&&(e=[]);let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=j.useCallback(t=>jr(t,e,`reference`),t),a=j.useCallback(t=>jr(t,e,`floating`),n),o=j.useCallback(t=>jr(t,e,`item`),r);return j.useMemo(()=>({getReferenceProps:i,getFloatingProps:a,getItemProps:o}),[i,a,o])}function Nr(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}var Pr=e=>({name:`inner`,options:e,async fn(t){let{listRef:n,overflowRef:r,onFallbackChange:i,offset:a=0,index:o=0,minItemsVisible:s=4,referenceOverflowThreshold:c=0,scrollRef:l,...u}=J(e,t),{rects:d,elements:{floating:f}}=t,p=n.current[o],m=l?.current||f,h=f.clientTop||m.clientTop,g=f.clientTop!==0,_=m.clientTop!==0,v=f===m;if(!p)return{};let y={...t,...await nr(-p.offsetTop-f.clientTop-d.reference.height/2-p.offsetHeight/2-a).fn(t)},b=await Wn(Nr(y,m.scrollHeight+h+f.clientTop),u),x=await Wn(y,{...u,elementContext:`reference`}),S=K(0,b.top),C=y.y+S,w=(m.scrollHeight>m.clientHeight?e=>e:Rt)(K(0,m.scrollHeight+(g&&v||_?h*2:0)-S-K(0,b.bottom)));if(m.style.maxHeight=w+`px`,m.scrollTop=S,i){let e=m.offsetHeight<p.offsetHeight*G(s,n.current.length)-1||x.top>=-c||x.bottom>=-c;on.flushSync(()=>i(e))}return r&&(r.current=await Wn(Nr({...y,y:C},m.offsetHeight+h+f.clientTop),u)),{y:C}}});function Fr(e,t){let{open:n,elements:r}=e,{enabled:i=!0,overflowRef:a,scrollRef:o,onChange:s}=t,c=cr(s),l=j.useRef(!1),u=j.useRef(null),d=j.useRef(null);j.useEffect(()=>{if(!i)return;function e(e){if(e.ctrlKey||!t||a.current==null)return;let n=e.deltaY,r=a.current.top>=-.5,i=a.current.bottom>=-.5,o=t.scrollHeight-t.clientHeight,s=n<0?-1:1,l=n<0?`max`:`min`;t.scrollHeight<=t.clientHeight||(!r&&n>0||!i&&n<0?(e.preventDefault(),on.flushSync(()=>{c(e=>e+Math[l](n,o*s))})):/firefox/i.test(Lt())&&(t.scrollTop+=n))}let t=o?.current||r.floating;if(n&&t)return t.addEventListener(`wheel`,e),requestAnimationFrame(()=>{u.current=t.scrollTop,a.current!=null&&(d.current={...a.current})}),()=>{u.current=null,d.current=null,t.removeEventListener(`wheel`,e)}},[i,n,r.floating,a,o,c]);let f=j.useMemo(()=>({onKeyDown(){l.current=!0},onWheel(){l.current=!1},onPointerMove(){l.current=!1},onScroll(){let e=o?.current||r.floating;if(a.current&&e&&l.current){if(u.current!==null){let t=e.scrollTop-u.current;(a.current.bottom<-.5&&t<-1||a.current.top<-.5&&t>1)&&on.flushSync(()=>c(e=>e+t))}requestAnimationFrame(()=>{u.current=e.scrollTop})}}}),[r.floating,c,a,o]);return j.useMemo(()=>i?{floating:f}:{},[i,f])}var $=(0,j.createContext)({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});$.displayName=`FloatingContext`;var Ir=(0,j.createContext)(null);Ir.displayName=`PlacementContext`;function Lr(e){return(0,j.useMemo)(()=>e?typeof e==`string`?{to:e}:e:null,[e])}function Rr(){return(0,j.useContext)($).setReference}function zr(){return(0,j.useContext)($).getReferenceProps}function Br(){let{getFloatingProps:e,slot:t}=(0,j.useContext)($);return(0,j.useCallback)((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function Vr(e=null){e===!1&&(e=null),typeof e==`string`&&(e={to:e});let t=(0,j.useContext)(Ir),n=(0,j.useMemo)(()=>e,[JSON.stringify(e,(e,t)=>t?.outerHTML??t)]);_(()=>{t?.(n??null)},[t,n]);let r=(0,j.useContext)($);return(0,j.useMemo)(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}var Hr=4;function Ur({children:e,enabled:t=!0}){let[n,r]=(0,j.useState)(null),[i,a]=(0,j.useState)(0),o=(0,j.useRef)(null),[s,l]=(0,j.useState)(null);Wr(s);let u=t&&n!==null&&s!==null,{to:d=`bottom`,gap:f=0,offset:p=0,padding:m=0,inner:h}=Gr(n,s),[g,v=`center`]=d.split(` `);_(()=>{u&&a(0)},[u]);let{refs:y,floatingStyles:x,context:S}=Or({open:u,placement:g===`selection`?v===`center`?`bottom`:`bottom-${v}`:v===`center`?`${g}`:`${g}-${v}`,strategy:`absolute`,transform:!1,middleware:[nr({mainAxis:g===`selection`?0:f,crossAxis:p}),rr({padding:m}),g!==`selection`&&ir({padding:m}),g===`selection`&&h?Pr({...h,padding:m,overflowRef:o,offset:i,minItemsVisible:Hr,referenceOverflowThreshold:m,onFallbackChange(e){if(!e)return;let t=S.elements.floating;if(!t)return;let n=parseFloat(getComputedStyle(t).scrollPaddingBottom)||0,r=Math.min(Hr,t.childElementCount),i=0,o=0;for(let e of S.elements.floating?.childNodes??[])if(c(e)){let a=e.offsetTop,s=a+e.clientHeight+n,c=t.scrollTop,l=c+t.clientHeight;if(a>=c&&s<=l)r--;else{o=Math.max(0,Math.min(s,l)-Math.max(a,c)),i=e.clientHeight;break}}r>=1&&a(e=>{let t=i*r-o+n;return e>=t?e:t})}}):null,ar({padding:m,apply({availableWidth:e,availableHeight:t,elements:n}){Object.assign(n.floating.style,{overflow:`auto`,maxWidth:`${e}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${t}px)`})}})].filter(Boolean),whileElementsMounted:Un}),[C=g,w=v]=S.placement.split(`-`);g===`selection`&&(C=`selection`);let T=(0,j.useMemo)(()=>({anchor:[C,w].filter(Boolean).join(` `)}),[C,w]),{getReferenceProps:ee,getFloatingProps:te}=Mr([Fr(S,{overflowRef:o,onChange:a})]),ne=b(e=>{l(e),y.setFloating(e)});return j.createElement(Ir.Provider,{value:r},j.createElement($.Provider,{value:{setFloating:ne,setReference:y.setReference,styles:x,getReferenceProps:ee,getFloatingProps:te,slot:T}},e))}function Wr(e){_(()=>{if(!e)return;let t=new MutationObserver(()=>{let t=window.getComputedStyle(e).maxHeight,n=parseFloat(t);if(isNaN(n))return;let r=parseInt(t);isNaN(r)||n!==r&&(e.style.maxHeight=`${Math.ceil(n)}px`)});return t.observe(e,{attributes:!0,attributeFilter:[`style`]}),()=>{t.disconnect()}},[e])}function Gr(e,t){let n=Kr(e?.gap??`var(--anchor-gap, 0)`,t),r=Kr(e?.offset??`var(--anchor-offset, 0)`,t),i=Kr(e?.padding??`var(--anchor-padding, 0)`,t);return{...e,gap:n,offset:r,padding:i}}function Kr(e,t,n=void 0){let r=g(),i=b((e,t)=>{if(e==null)return[n,null];if(typeof e==`number`)return[e,null];if(typeof e==`string`){if(!t)return[n,null];let i=Jr(e,t);return[i,n=>{let a=qr(e);{let o=a.map(e=>window.getComputedStyle(t).getPropertyValue(e));r.requestAnimationFrame(function s(){r.nextFrame(s);let c=!1;for(let[e,n]of a.entries()){let r=window.getComputedStyle(t).getPropertyValue(n);if(o[e]!==r){o[e]=r,c=!0;break}}if(!c)return;let l=Jr(e,t);i!==l&&(n(l),i=l)})}return r.dispose}]}return[n,null]}),a=(0,j.useMemo)(()=>i(e,t)[0],[e,t]),[o=a,s]=(0,j.useState)();return _(()=>{let[n,r]=i(e,t);if(s(n),r)return r(s)},[e,t]),o}function qr(e){let t=/var\((.*)\)/.exec(e);if(t){let e=t[1].indexOf(`,`);if(e===-1)return[t[1]];let n=t[1].slice(0,e).trim(),r=t[1].slice(e+1).trim();return r?[n,...qr(r)]:[n]}return[]}function Jr(e,t){let n=document.createElement(`div`);t.appendChild(n),n.style.setProperty(`margin-top`,`0px`,`important`),n.style.setProperty(`margin-top`,e,`important`);let r=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),r}function Yr(e){throw Error(`Unexpected object: `+e)}var Xr=(e=>(e[e.First=0]=`First`,e[e.Previous=1]=`Previous`,e[e.Next=2]=`Next`,e[e.Last=3]=`Last`,e[e.Specific=4]=`Specific`,e[e.Nothing=5]=`Nothing`,e))(Xr||{});function Zr(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),i=r??-1;switch(e.focus){case 0:for(let e=0;e<n.length;++e)if(!t.resolveDisabled(n[e],e,n))return e;return r;case 1:i===-1&&(i=n.length);for(let e=i-1;e>=0;--e)if(!t.resolveDisabled(n[e],e,n))return e;return r;case 2:for(let e=i+1;e<n.length;++e)if(!t.resolveDisabled(n[e],e,n))return e;return r;case 3:for(let e=n.length-1;e>=0;--e)if(!t.resolveDisabled(n[e],e,n))return e;return r;case 4:for(let r=0;r<n.length;++r)if(t.resolveId(n[r],r,n)===e.id)return r;return r;case 5:return null;default:Yr(e)}}var Qr={Idle:{kind:`Idle`},Tracked:e=>({kind:`Tracked`,position:e}),Moved:{kind:`Moved`}};function $r(e){let t=e.getBoundingClientRect();return`${t.x},${t.y}`}function ei(e,t,n){let r=d();if(t.kind===`Tracked`){let i=function(){a!==$r(e)&&(r.dispose(),n())},{position:a}=t,o=new ResizeObserver(i);o.observe(e),r.add(()=>o.disconnect()),r.addEventListener(window,`scroll`,i,{passive:!0}),r.addEventListener(window,`resize`,i)}return()=>r.dispose()}var ti=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function ni(e){let t=e.innerText??``,n=e.cloneNode(!0);if(!c(n))return t;let r=!1;for(let e of n.querySelectorAll(`[hidden],[aria-hidden],[role="img"]`))e.remove(),r=!0;let i=r?n.innerText??``:t;return ti.test(i)&&(i=i.replace(ti,``)),i}function ri(e){let t=e.getAttribute(`aria-label`);if(typeof t==`string`)return t.trim();let n=e.getAttribute(`aria-labelledby`);if(n){let e=n.split(` `).map(e=>{let t=document.getElementById(e);if(t){let e=t.getAttribute(`aria-label`);return typeof e==`string`?e.trim():ni(t).trim()}return null}).filter(Boolean);if(e.length>0)return e.join(`, `)}return ni(e).trim()}function ii(e){let t=(0,j.useRef)(``),n=(0,j.useRef)(``);return b(()=>{let r=e.current;if(!r)return``;let i=r.innerText;if(t.current===i)return n.current;let a=ri(r).trim().toLowerCase();return t.current=i,n.current=a,a})}export{st as C,Be as D,Ke as E,rt as S,Ye as T,dt as _,Xr as a,tt as b,Rr as c,zr as d,Lr as f,pt as g,gt as h,ei as i,Vr as l,_t as m,$r as n,Zr as o,yt as p,Qr as r,Ur as s,ii as t,Br as u,ut as v,Ze as w,nt as x,lt as y};
@@ -1 +0,0 @@
1
- import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{bt as n,ht as r}from"./portal.C3KrUREL.js";var i=e(t(),1);function a(e,{container:t,accept:a,walk:o}){let s=(0,i.useRef)(a),c=(0,i.useRef)(o);(0,i.useEffect)(()=>{s.current=a,c.current=o},[a,o]),r(()=>{if(!t||!e)return;let r=n(t);if(!r)return;let i=s.current,a=c.current,o=Object.assign(e=>i(e),{acceptNode:i}),l=r.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,o,!1);for(;l.nextNode();)a(l.currentNode)},[t,e,s,c])}export{a as t};
@@ -1 +0,0 @@
1
- import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{p as n}from"./app-config.CpjKWnzM.js";import{t as r}from"./SelectDropdown.Dc7QaPbH.js";import{t as i}from"./jsx-runtime.BUXbF_vF.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){try{let t=localStorage.getItem(n(s)),r=t===null?NaN:Number(t);return c(r)?r:e}catch{return e}}function u(e){if(c(e))try{localStorage.setItem(n(s),String(e))}catch{}}var d=i(),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){let[t,n]=(0,a.useState)(()=>l(e));return[t,(0,a.useCallback)(e=>{c(e)&&(u(e),n(e))},[])]}function h({page:e,totalPages:t,pageSize:n,busy:i=!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)(r,{compact:!0,centerContent:!0,options:p,value:String(n),onChange:e=>o(Number(e)),disabled:i,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:i||e<=1,onClick:()=>a(1),className:f,children:`首页`}),(0,d.jsx)(`button`,{type:`button`,disabled:i||e<=1,onClick:()=>a(e-1),className:f,children:`上一页`}),(0,d.jsx)(`button`,{type:`button`,disabled:i||e>=t,onClick:()=>a(e+1),className:f,children:`下一页`}),(0,d.jsx)(`button`,{type:`button`,disabled:i||e>=t,onClick:()=>a(t),className:f,children:`末页`})]})]})}function g(){let[e,t]=(0,a.useState)(!1),n=(0,a.useCallback)(()=>t(!0),[]);return{cls:e?`tw-anim-list `:``,play:n}}export{h as n,m as r,g as t};