lantern-harness 0.1.9 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +82 -0
- package/README.md +6 -6
- package/builtin/session/lh-fs.mjs +32 -14
- package/dist/500.html +258 -22
- package/dist/_astro/Base.BOY6F0mi.css +1 -0
- package/dist/_astro/Base.astro_astro_type_script_index_0_lang.C30xtpc6.js +1 -0
- package/dist/_astro/CaseExecBoard.Dttqp0wg.js +1 -0
- package/dist/_astro/CaseGenerateApp.DqW_nWMc.js +9 -0
- package/dist/_astro/CasesLibrary.8aMUUGp_.js +1 -0
- package/dist/_astro/ChatApp.BLxf0h1d.js +219 -0
- package/dist/_astro/ColumnResize.BEkEW7qw.js +1 -0
- package/dist/_astro/{ConfirmDialog.CBVsDJ8f.js → ConfirmDialog.BZzZWDci.js} +1 -1
- package/dist/_astro/{DashboardBoard.DCtfrrJz.js → DashboardBoard.CkSbhEDI.js} +3 -3
- package/dist/_astro/DatePicker.Bkl71M49.js +1 -0
- package/dist/_astro/DocsFileBrowser.MKVCfZrE.js +1 -0
- package/dist/_astro/DocsPager.DJY4foYL.js +1 -0
- package/dist/_astro/{DrawerField.CWMLhcPX.js → DrawerField.CHRg77LG.js} +1 -1
- package/dist/_astro/{ExcelFieldTags.B_XMwNNx.js → ExcelFieldTags.DXMeaDa5.js} +4 -4
- package/dist/_astro/KnowledgeLibrary.B-p1aoQN.js +1 -0
- package/dist/_astro/NamePromptDialog.Wa9O530a.js +1 -0
- package/dist/_astro/NavLibraries.C6LImMO_.js +1 -0
- package/dist/_astro/OverflowHint.D6v4Uj2N.js +1 -0
- package/dist/_astro/PluginsPage.-97n3x2U.js +39 -0
- package/dist/_astro/PluginsPage.DkmRPfbU.js +1 -0
- package/dist/_astro/PmBugsBoard.CMT4-eoB.js +1 -0
- package/dist/_astro/PmIterationsBoard.BQM_dzdZ.js +1 -0
- package/dist/_astro/PmProjectDetail.CzU80pat.js +1 -0
- package/dist/_astro/PmProjectsBoard.Cxsa7SYQ.js +1 -0
- package/dist/_astro/PmRequirementsBoard.4_JMDDN0.js +1 -0
- package/dist/_astro/PmRequirementsBoard.B8HL07cw.js +1 -0
- package/dist/_astro/PmShared.Ca2Ao7v_.js +1 -0
- package/dist/_astro/PromptsLibrary.C9BcIxKK.js +1 -0
- package/dist/_astro/ReportsPage.Fh5DRKLT.js +1 -0
- package/dist/_astro/RequirementsLibrary.CBkuWE8X.js +1 -0
- package/dist/_astro/SearchableSelect.DnjoSslK.js +1 -0
- package/dist/_astro/SelectDropdown.CuuDHa8s.js +1 -0
- package/dist/_astro/SettingsDialog.CJvBRcs9.js +1 -0
- package/dist/_astro/SlideOverDrawer.B7B5Wu8I.js +1 -0
- package/dist/_astro/{SpaceSwitcher.CI3KDBOA.js → SpaceSwitcher.BVQLt_tL.js} +2 -2
- package/dist/_astro/TagSelect.CuN5RdF4.js +1 -0
- package/dist/_astro/TasksBoard.Bu-fpIZ7.js +1 -0
- package/dist/_astro/TemplatesLibrary.DSylQGlN.js +1 -0
- package/dist/_astro/TestStatsBoard.CPyKW4wc.js +1 -0
- package/dist/_astro/Toast.R8_2OWRX.js +1 -0
- package/dist/_astro/TodosBoard.8kvRTEW-.js +1 -0
- package/dist/_astro/UiAutoBoard.DFTiDqCp.js +9 -0
- package/dist/_astro/active-element-history.CED-m1Zp.js +1 -0
- package/dist/_astro/app-config.BUPzGl9f.js +1 -0
- package/dist/_astro/{client.Be_SakrB.js → client.BHNTqLjv.js} +3 -3
- package/dist/_astro/dialog.BAPTk9a_.js +1 -0
- package/dist/_astro/hydrate-cache.BXX604Bw.js +1 -0
- package/dist/_astro/{i18n.B52gLzii.js → i18n.BGPnP1Bg.js} +1 -1
- package/dist/_astro/index.astro_astro_type_script_index_0_lang.LPL9mPQY.js +1 -0
- package/dist/_astro/jsx-runtime.DUg_B_vD.js +1 -0
- package/dist/_astro/{lib.DJNDi_Ht.js → lib.CgXLzMMd.js} +15 -15
- package/dist/_astro/listbox.C96OCanh.js +1 -0
- package/dist/_astro/markdown-client.DRva7DS9.js +58 -0
- package/dist/_astro/menu.IPWdRoNM.js +1 -0
- package/dist/_astro/{open-docs-in-session.Xg3OSOfc.js → open-docs-in-session.CyFNgh1I.js} +1 -1
- package/dist/_astro/{plugins.BDZqJNOy.js → plugins.C2BMfzv1.js} +1 -1
- package/dist/_astro/{pm.Bl3hz9fF.js → pm.CagBA-ht.js} +2 -2
- package/dist/_astro/{portal.Cm9XlIPf.js → portal.C0hAhXDF.js} +2 -2
- package/dist/_astro/prompts-meta.Bua-j14I.js +2 -0
- package/dist/_astro/react-dom.DLW9pGCF.js +1 -0
- package/dist/_astro/{react-dom.CqAxpHMt.js → react.Blvh0GOs.js} +1 -1
- package/dist/_astro/report-prompt.CAfZ6RIo.js +1 -0
- package/dist/_astro/{settings.C6NWuiFO.js → settings.Ceefeil5.js} +2 -2
- package/dist/_astro/{spaces-client.k_ciWMai.js → spaces-client.BocUabwy.js} +1 -1
- package/dist/_astro/ui-auto-prompt.CX8fju7r.js +3 -0
- package/dist/_astro/ui-auto.BmC9JJ_X.js +1 -0
- package/dist/_astro/update.CvfIVwnq.js +1 -0
- package/dist/_astro/use-text-value.DBQvHeNl.js +1 -0
- package/dist/_astro/use-tree-walker.DFU2AaAP.js +1 -0
- package/dist/_astro/useListAnim.BoerpmsB.js +1 -0
- package/dist/_astro/{view-prefs.Dyu_lmN2.js → view-prefs.BEAZRcxF.js} +1 -1
- package/dist/case-exec/index.html +458 -22
- package/dist/cases/generate/index.html +258 -22
- package/dist/cases/library/index.html +458 -22
- package/dist/dashboard/index.html +458 -22
- package/dist/docs/changelog/index.html +367 -23
- package/dist/docs/install/index.html +258 -22
- package/dist/docs/manual/index.html +314 -35
- package/dist/index.html +2 -281
- package/dist/knowledge/index.html +458 -22
- 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 +258 -22
- package/dist/plugins/index.html +258 -22
- package/dist/pm/bugs/index.html +458 -22
- package/dist/pm/iterations/index.html +458 -22
- package/dist/pm/projects/detail/index.html +458 -22
- package/dist/pm/projects/index.html +458 -22
- package/dist/pm/requirements/index.html +458 -22
- package/dist/prompts/index.html +458 -22
- package/dist/reports/index.html +458 -22
- package/dist/requirements/index.html +458 -22
- package/dist/tasks/index.html +458 -22
- package/dist/templates/index.html +458 -22
- 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 +258 -22
- 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 +258 -22
- 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 +258 -22
- 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 +258 -22
- 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 +258 -22
- package/dist/test-automation/index.html +717 -0
- package/dist/test-stats/index.html +458 -22
- package/dist/todos/index.html +458 -22
- package/dist/workbench/index.html +517 -0
- package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +80 -43
- package/lh-plugins/lh-project-docs.mjs +14 -0
- package/lh-plugins/lh-uiauto.mjs +1445 -386
- package/lh-plugins/plugin-prompts.mjs +200 -0
- package/lh-plugins/storage-domain.mjs +6 -0
- package/lh-plugins/uiauto-adapters/index.mjs +57 -0
- package/lh-plugins/uiauto-adapters/playwright.mjs +215 -0
- package/lh-plugins/uiauto-adapters/pytest.mjs +151 -0
- package/lh-plugins/uiauto-adapters/selenium.mjs +163 -0
- package/lh-plugins/uiauto-adapters/shared.mjs +371 -0
- package/lh-plugins/uiauto-adapters/tasks.mjs +369 -0
- package/lh-plugins/uiauto-explorer/apps.mjs +332 -0
- package/lh-plugins/uiauto-explorer/diff.mjs +159 -0
- package/lh-plugins/uiauto-explorer/emit-files.mjs +506 -0
- package/lh-plugins/uiauto-explorer/emit-python.mjs +160 -0
- package/lh-plugins/uiauto-explorer/emit-ts.mjs +118 -0
- package/lh-plugins/uiauto-explorer/emit.mjs +15 -0
- package/lh-plugins/uiauto-explorer/ir.mjs +114 -0
- package/lh-plugins/uiauto-explorer/locators.mjs +267 -0
- package/lh-plugins/uiauto-explorer/merge.mjs +235 -0
- package/lh-plugins/uiauto-explorer/plan.mjs +165 -0
- package/lh-plugins/uiauto-explorer/runner.mjs +370 -0
- package/lh-plugins/uiauto-explorer/sessions.mjs +1373 -0
- package/lh-plugins/uiauto-explorer/snapshot.mjs +492 -0
- package/lh-plugins/uiauto-prompt.mjs +122 -0
- package/lh-plugins/uiauto-report.mjs +111 -0
- package/package.json +1 -1
- package/dist/_astro/Base.4X_wsSoR.css +0 -1
- package/dist/_astro/Base.astro_astro_type_script_index_0_lang.Dy7fJoxu.js +0 -1
- package/dist/_astro/CaseExecBoard.DKdfW5fM.js +0 -1
- package/dist/_astro/CaseGenerateApp.Bm8AyH9s.js +0 -9
- package/dist/_astro/CasesLibrary.CvVJZ74h.js +0 -1
- package/dist/_astro/ChatApp.BS-wLBRa.js +0 -276
- package/dist/_astro/ColumnResize.Bs6GL3DJ.js +0 -1
- package/dist/_astro/DatePicker.CMfX7F6z.js +0 -1
- package/dist/_astro/DocsFileBrowser.BtRoZ787.js +0 -1
- package/dist/_astro/DocsPager.C20ue_JZ.js +0 -1
- package/dist/_astro/KnowledgeLibrary.CV4DyStj.js +0 -1
- package/dist/_astro/NamePromptDialog.Dl5kSnQI.js +0 -1
- package/dist/_astro/NavLibraries.DmD2lZBZ.js +0 -1
- package/dist/_astro/OverflowHint.lzmplP5j.js +0 -1
- package/dist/_astro/PluginsPage.B59AMDrB.js +0 -1
- package/dist/_astro/PluginsPage.BEAPymNL.js +0 -39
- package/dist/_astro/PmBugsBoard.CPEyBp0l.js +0 -1
- package/dist/_astro/PmIterationsBoard.zCeLpcBo.js +0 -1
- package/dist/_astro/PmProjectDetail.ejIam5sD.js +0 -1
- package/dist/_astro/PmProjectsBoard.DbXzir8o.js +0 -1
- package/dist/_astro/PmRequirementsBoard.CynewRfv.js +0 -1
- package/dist/_astro/PmRequirementsBoard.D9eUMJWI.js +0 -1
- package/dist/_astro/PmShared.BxTHKdjY.js +0 -1
- package/dist/_astro/PromptsLibrary.Bkruu80b.js +0 -1
- package/dist/_astro/ReportsPage.BoBQshMQ.js +0 -1
- package/dist/_astro/RequirementsLibrary.BC0A8qdk.js +0 -1
- package/dist/_astro/SearchableSelect.CXa1hiDd.js +0 -1
- package/dist/_astro/SelectDropdown.Buv7rQJ_.js +0 -1
- package/dist/_astro/SettingsDialog.Dc-9QNJI.js +0 -1
- package/dist/_astro/SlideOverDrawer.TPbGEoWn.js +0 -1
- package/dist/_astro/TagSelect.u8DTop7v.js +0 -1
- package/dist/_astro/TasksBoard.Bb--oVV8.js +0 -1
- package/dist/_astro/TemplatesLibrary.D1wZq94E.js +0 -1
- package/dist/_astro/TestStatsBoard.DlVezlXl.js +0 -1
- package/dist/_astro/TodosBoard.S84wqcWY.js +0 -1
- package/dist/_astro/UiAutoBoard.BKp9ifxg.js +0 -1
- package/dist/_astro/active-element-history.CeefGkFQ.js +0 -1
- package/dist/_astro/app-config.DUyozIL9.js +0 -1
- package/dist/_astro/dialog.DXHznyjD.js +0 -1
- package/dist/_astro/jsx-runtime.BUXbF_vF.js +0 -1
- package/dist/_astro/listbox.Di-t5U37.js +0 -1
- package/dist/_astro/menu.Bkluqxic.js +0 -1
- package/dist/_astro/prompts-meta.F4wwkjUA.js +0 -2
- package/dist/_astro/report-prompt.Cmw4XzfY.js +0 -1
- package/dist/_astro/update.Bl_HfSe6.js +0 -1
- package/dist/_astro/use-text-value.BuY0Cm1z.js +0 -1
- package/dist/_astro/use-tree-walker.CfTHFX43.js +0 -1
- package/dist/_astro/useListAnim.CpGB1cft.js +0 -1
- package/dist/ui-automation/index.html +0 -281
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{G as n,J as r,K as i,p as a,q as o,r as s,t as c,u as l}from"./app-config.BUPzGl9f.js";import{C as u,D as d,E as f,S as p,T as m,_ as h,a as g,c as _,f as v,g as y,h as b,i as x,l as S,m as C,n as w,o as T,p as E,r as D,s as O,u as k,v as A,w as j,x as M,y as ee}from"./use-text-value.DBQvHeNl.js";import{t as N}from"./react-dom.DLW9pGCF.js";import{$ as te,A as ne,B as P,F as re,J as ie,K as F,L as I,M as L,N as ae,P as oe,V as se,_t as R,c as ce,d as le,dt as z,et as B,f as ue,ft as de,h as fe,ht as pe,it as V,k as me,lt as he,m as ge,mt as _e,n as ve,nt as ye,o as be,p as xe,pt as H,rt as Se,s as Ce,st as U,u as we,ut as Te,v as Ee,x as De}from"./portal.C0hAhXDF.js";import{a as Oe,c as ke,l as Ae,o as je,s as Me,u as Ne}from"./listbox.C96OCanh.js";import{n as Pe,r as Fe,t as Ie}from"./active-element-history.CED-m1Zp.js";import{t as Le}from"./use-tree-walker.DFU2AaAP.js";import{t as Re}from"./jsx-runtime.DUg_B_vD.js";var W=e(t(),1),G=e(N(),1);function ze(e){return typeof e==`object`?e.key:e}function Be(e,t){let n=e.length;return new Proxy(e,{get(e,r,i){if(typeof r==`string`){let i=r.charCodeAt(0);if(i>=48&&i<=57){let i=+r;if(Number.isInteger(i)&&i>=0&&i<n){let n=e[i];if(typeof n!=`object`){let r=t[i*2];n=e[i]={index:i,key:n,start:r,size:t[i*2+1],end:r+t[i*2+1],lane:0}}return n}}if(r===`length`)return n}return Reflect.get(e,r,i)}})}function K(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return(o.length!==r.length||o.some((e,t)=>r[t]!==e))&&(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1),i}return o.updateDeps=e=>{r=e},o}function Ve(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var q=(e,t)=>Math.abs(e-t)<1.01,He=(e,t,n)=>{let r;return Object.assign(function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)},{cancel:()=>{e.clearTimeout(r)}})},Ue,We=()=>{if(Ue!==void 0)return Ue;if(typeof navigator>`u`)return Ue=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Ue=!0;let e=navigator.maxTouchPoints;return Ue=navigator.platform===`MacIntel`&&e!==void 0&&e>0},Ge=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Ke=e=>e,qe=e=>{let t=e.overscan*Math.max(e.lanes??1,1),n=Math.max(e.startIndex-t,0),r=Math.min(e.endIndex+t,e.count-1)-n+1,i=Array(r);for(let e=0;e<r;e++)i[e]=n+e;return i},Je=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(Ge(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(Ge(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},Ye={passive:!0},Xe=typeof window>`u`||`onscrollend`in window,Ze=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&Xe,o=0,s=a?null:He(i,()=>t(n(r),!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,Ye),a&&r.addEventListener(`scrollend`,u,Ye),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u),s?.cancel()}},Qe=(e,t)=>Ze(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),$e=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},et=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},tt=(e,t)=>e===`smooth`?t?`smoothLanded`:`smooth`:`instant`,nt=e=>e?.phase===`smooth`||e?.phase===`smoothLanded`,rt=e=>e.phase===`smooth`||e.phase===`smoothFinishing`;function it(e,t,n,r){if(t===0)return!1;let i=r(0),a=new Set,o=0;for(;o<e;){let e=n(o);if(e===i)break;a.add(e),o++}let s=e-o;if(s===0||s>=t)return!1;for(let e=0;e<s;e++)if(r(e)!==n(o+e))return!1;for(let e=s;e<t;e++)if(a.has(r(e)))return!1;return!0}var at=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this._clampedAdjustment=null,this.elementsCache=new Map,this._resizeBatch=null,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{let t=()=>{let t={sync:!1};this._resizeBatch=t;try{e.forEach(n)}finally{this._resizeBatch=null,t.notify&&(this.notify(t.sync),this._retryClampedAdjustment())}};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})),n=e=>{let t=e.target,n=this.indexFromElement(t);if(t.isConnected)this.isIndexInRange(n)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this));else{this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}}};return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Ke,rangeExtractor:qe,onChange:()=>{},measureElement:$e,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=this._singleLaneMeasurements?.items??s,l=e=>ze(c[e]),u=e>0?l(0):null,d=e>0?l(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==u||t.getItemKey(o-1)!==d)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>0&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==d)&&(o>e||it(e,o,l,t.getItemKey))&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=!1,s=0;if(r&&this.scrollOffset!==null){let[e,t]=r,n=this.getMeasurements(),{count:a,getItemKey:c}=this.options,l=0;for(;l<a&&c(l)!==e;)l++;if(l<a){let e=n[l];if(e){let n=Math.max(0,e.start+t);!i&&n!==this.scrollOffset&&(s=n-this.scrollOffset,this.scrollOffset=n,o=!0)}}}(o||i)&&(this.pendingScrollAnchor=[o?r[0]:null,o?r[1]:0,i,s])},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=K(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.isScrolling=!1,this.scrollDirection=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._clampedAdjustment=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.targetWindow=this.scrollElement&&`ownerDocument`in this.scrollElement?this.scrollElement.ownerDocument.defaultView:this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{if(t&&this._intendedScrollOffset===null&&e===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(e-this._intendedScrollOffset)<1.5?e=this._intendedScrollOffset:this.scrollState?.index!=null&&!rt(this.scrollState)&&!q(e,this.scrollState.lastTargetOffset)&&!q(e,this.getScrollStateTarget(this.scrollState))&&(this._clampedAdjustment===null||Math.abs(e-this._clampedAdjustment.maxAtWrite)>=1.5)&&(this.scrollState=null),this._intendedScrollOffset=null,this.scrollState&&(this.scrollState.writtenOffset=null),this._clampedAdjustment!==null&&Math.abs(e-this._clampedAdjustment.maxAtWrite)>=1.5&&(this._clampedAdjustment=null),this.scrollAdjustments=0;let n=this.getScrollOffset();this.scrollDirection=t?n===e?this.scrollDirection:n<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,We()&&this.targetWindow!=null&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,Ye),e.addEventListener(`touchend`,n,Ye),e.addEventListener(`touchcancel`,n,Ye),this.unsubs.push(()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchend`,n),e.removeEventListener(`touchcancel`,n),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let t=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled){let[e,n,r,i]=t;e!==null&&!r&&(We()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?i!==0&&(this._iosDeferredAdjustment+=i):nt(this.scrollState)&&!q(this.getScrollOffset()-i,this.scrollState.lastTargetOffset)||this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),r&&this.scrollToEnd({behavior:r})}this._retryClampedAdjustment()},this._retryClampedAdjustment=()=>{if(this._clampedAdjustment===null||!this.scrollElement||!this.options.enabled)return;let{target:e,maxAtWrite:t}=this._clampedAdjustment,n=this.getMaxScrollOffset();n>t+.5&&(this._clampedAdjustment=e>n+.5?{target:e,maxAtWrite:n}:null,this._scrollToOffset(e,{adjustments:void 0,behavior:void 0}))},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;if(this._iosDeferredAdjustment<0&&e>=t-1){this._iosDeferredAdjustment=0;return}let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=K(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.isIndexInRange=e=>e>=0&&e<this.options.count,this.getMeasurements=K(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let l=this.itemSizeCache;if(!i)return this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._singleLaneMeasurements?.flat;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,u*2)),a=e}let o=u===0?Array(e):this._singleLaneMeasurements.items.slice(),c;if(u===0)c=t+n;else{let e=u-1;c=a[e*2]+a[e*2+1]+s}for(let t=u;t<e;t++){let e=r(t);o[t]=e;let n=l.get(e),i=typeof n==`number`?n:this.options.estimateSize(t);a[t*2]=c,a[t*2+1]=i,c+=i+s}this._singleLaneMeasurements={flat:a,items:o};let d=Be(o,a);return this.measurementsCache=d,d}let d=this.measurementsCache.slice(0,u),f=Array(a).fill(void 0),p=new Float64Array(a),m=0;for(let e=0;e<u;e++){let t=d[e];t&&(f[t.lane]===void 0&&m++,f[t.lane]=e,p[t.lane]=t.end)}for(let i=u;i<e;i++){let e=r(i),c=this.laneAssignments.get(i),u,h,g=o===`estimate`||l.has(e);if(c!==void 0&&this.options.lanes>1){u=c;let e=f[u],r=e===void 0?void 0:d[e];h=r?r.end+s:t+n}else if(m===a){let e=0,t=p[0],n=f[0];for(let r=1;r<a;r++){let i=p[r];(i<t||i===t&&f[r]<n)&&(e=r,t=i,n=f[r])}u=e,h=t+s,g&&this.laneAssignments.set(i,u)}else u=i%this.options.lanes,h=t+n,g&&this.laneAssignments.set(i,u);let _=l.get(e),v=typeof _==`number`?_:this.options.estimateSize(i),y=h+v;d[i]={index:i,start:h,size:v,end:y,key:e,lane:u},f[u]===void 0&&m++,f[u]=i,p[u]=y}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=K(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=ct(e,t,n,r,r===1&&this._singleLaneMeasurements!==null?this._singleLaneMeasurements.flat:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=K(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t,this.options.lanes]},(e,t,n,r,i,a)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n,lanes:a}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!nt(this.scrollState))return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e);if(!this.isIndexInRange(t))return;let n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),e.isConnected&&(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{var n;if(!this.isIndexInRange(e))return;this._resizeBatch?.sync&&this.getMeasurements();let r,i,a,o=this._singleLaneMeasurements?.flat;if(this.options.lanes===1&&o!=null)a=this.options.getItemKey(e),i=o[e*2],r=o[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;a=t.key,i=t.start,r=t.size}let s=this.itemSizeCache.get(a)??r,c=t-s;if(c!==0){let o=this.options.anchorTo===`end`&&!nt(this.scrollState)&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,l=o?this.getTotalSize():0,u=this.getScrollOffset()+this.scrollAdjustments,d=this.itemSizeCache.has(a)?i+s<=u&&this.scrollDirection!==`backward`:i<u,f=!nt(this.scrollState)&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?d:this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:a,start:i,size:r,end:i+r,lane:0},c,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(a,t),this.itemSizeCacheVersion++;let p=this.scrollState?.writtenOffset!=null&&!q(this.scrollState.writtenOffset,this.getScrollOffset()+this.scrollAdjustments),m=!1;if(p||(o?m=this.applyScrollAdjustment(this.getTotalSize()-l):f&&(m=this.applyScrollAdjustment(c))),this._resizeBatch){this._resizeBatch.notify=!0,(n=this._resizeBatch).sync||(n.sync=m);return}this.notify(m),this._retryClampedAdjustment()}},this.getVirtualItems=K(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._singleLaneMeasurements?.flat,r=this.options.lanes===1&&n!=null;return Ve(t[ot(0,t.length-1,r?e=>n[e*2]:e=>Ve(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`){if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t]}if(t===`end`&&e===this.options.count-1){let e=this.getMaxScrollOffset(),n=e-this.options.paddingEnd+this.options.scrollPaddingEnd;return[Math.max(Math.min(n,e),0),t]}let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{this._iosDeferredAdjustment=0;let r=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,startedAt:i,lastTargetOffset:r,stableFrames:0,phase:tt(n,!1)},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{this._iosDeferredAdjustment=0,e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,startedAt:o,lastTargetOffset:i,stableFrames:0,phase:tt(n,q(i,this.getScrollOffset()))},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getOffsetForAlignment((this.scrollState?.writtenOffset??this.getScrollOffset())+e,`start`),r=this.now();this.scrollState={index:null,align:`start`,startedAt:r,lastTargetOffset:n,stableFrames:0,phase:tt(t,!1)},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e=`auto`}={})=>{if(this.options.count>0){this._iosDeferredAdjustment=0;let t=Math.max(this.getMaxScrollOffset(),0);this.scrollState={index:this.options.count-1,align:`end`,toEnd:!0,startedAt:this.now(),lastTargetOffset:t,stableFrames:0,phase:tt(e,q(t,this.getScrollOffset()))},this._scrollToOffset(t,{adjustments:void 0,behavior:e}),this.scheduleScrollReconcile()}else this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.cancelScroll=()=>{this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._singleLaneMeasurements?.flat;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.scrollState&&(this.scrollState.writtenOffset=n===`smooth`?null:this._intendedScrollOffset),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){if(e===0)return!1;if(We()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded))return this.scrollState?.index??(this._iosDeferredAdjustment+=e),!1;{let n=this.getScrollOffset()+this.scrollAdjustments+e,r=this.scrollElement,i=r!==null&&(`scrollHeight`in r||`document`in r)?this.getMaxScrollOffset():null;return this._clampedAdjustment=i!==null&&n>i+.5?{target:n,maxAtWrite:i}:null,this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0}}scheduleScrollReconcile(){this.targetWindow?this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}):this.scrollState=null}getScrollStateTarget(e){let t=e.toEnd?[Math.max(this.getMaxScrollOffset(),0)]:e.index==null?void 0:this.getOffsetForIndex(e.index,e.align);return t?t[0]:e.lastTargetOffset}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}this.getMeasurements();let e=this.getScrollStateTarget(this.scrollState),t=this.scrollState.index==null?1:this.options.useAnimationFrameWithResizeObserver?3:2,n=e!==this.scrollState.lastTargetOffset;if(!n&&q(e,this.getScrollOffset())){if(this.scrollState.phase===`smooth`?this.scrollState.phase=`smoothLanded`:this.scrollState.phase===`smoothFinishing`&&(this.scrollState.phase=`instant`),this.scrollState.stableFrames++,this.scrollState.stableFrames>=t){this.getScrollOffset()!==e&&this._scrollToOffset(e,{adjustments:void 0,behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let t=this.getSize()||600,n=Math.abs(e-this.getScrollOffset()),r=nt(this.scrollState)&&n>t;this.scrollState.lastTargetOffset=e,r?this.scrollState.phase=`smooth`:this.scrollState.phase===`smooth`?this.scrollState.phase=`smoothFinishing`:this.scrollState.phase===`smoothLanded`&&(this.scrollState.phase=`instant`),this._scrollToOffset(e,{adjustments:void 0,behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}},ot=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function st(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function ct(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=st(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=ot(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var lt=typeof document<`u`?W.useLayoutEffect:W.useEffect;function ut({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=W.useReducer(e=>e+1,0)[1],a=W.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=t,a.current.mode=n;let o=W.useRef(!1),s=e=>{let t=a.current;if(!t.enabled||!t.container)return;let n=e.getTotalSize();if(n!==t.lastSize){t.lastSize=n;let r=e.options.horizontal?`width`:`height`;t.container.style[r]=`${n}px`}},c=(e,t,n)=>{let r=a.current,i=!!e.options.horizontal,o=t.start-e.options.scrollMargin;r.lastPositions.get(n)!==o&&(r.lastPositions.set(n,o),r.mode===`transform`?n.style.transform=i?`translate3d(${o}px, 0, 0)`:`translate3d(0, ${o}px, 0)`:n.style[i?`left`:`top`]=`${o}px`)},l=e=>{let t=a.current;if(t.enabled&&t.container){s(e);for(let t of e.getVirtualItems()){let n=e.elementsCache.get(t.key);n&&c(e,t,n)}}},u={...r,onChange:(t,n)=>{var s;let c=a.current,u=!0;if(c.enabled){l(t);let e=t.range,n=c.prevRange;u=!n||n.isScrolling!==t.isScrolling||n.startIndex!==e?.startIndex||n.endIndex!==e?.endIndex,u&&(c.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}u&&(e&&n&&!o.current?(0,G.flushSync)(i):i()),(s=r.onChange)==null||s.call(r,t,n)}},[d]=W.useState(()=>{let e=new at(u),t=e.measureElement;return e.measureElement=n=>{o.current=!0;try{t(n)}finally{o.current=!1}let r=a.current;if(n!==null&&r.enabled&&r.container){let t=e.measurementsCache[e.indexFromElement(n)];t&&c(e,t,n)}},Object.assign(e,{containerRef:t=>{let n=a.current;n.container=t,n.lastSize=null,t!==null&&l(e)}})});return d.setOptions(u),lt(()=>d._didMount(),[]),lt(()=>(s(d),d._willUpdate())),lt(()=>{l(d)}),d}function dt(e){return ut({observeElementRect:Je,observeElementOffset:Qe,scrollToFn:et,...e})}function ft(e){let t=(0,W.useRef)({value:``,selectionStart:null,selectionEnd:null});return Fe(e,`blur`,e=>{let n=e.target;F(n)&&(t.current={value:n.value,selectionStart:n.selectionStart,selectionEnd:n.selectionEnd})}),z(()=>{if(!R(e)&&F(e)&&e.isConnected){if(e.focus({preventScroll:!0}),e.value!==t.current.value)e.setSelectionRange(e.value.length,e.value.length);else{let{selectionStart:n,selectionEnd:r}=t.current;n!==null&&r!==null&&e.setSelectionRange(n,r)}t.current={value:``,selectionStart:null,selectionEnd:null}}})}var pt=Object.defineProperty,mt=(e,t,n)=>t in e?pt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ht=(e,t,n)=>(mt(e,typeof t==`symbol`?t:t+``,n),n),J=(e=>(e[e.Open=0]=`Open`,e[e.Closed=1]=`Closed`,e))(J||{}),Y=(e=>(e[e.Single=0]=`Single`,e[e.Multi=1]=`Multi`,e))(Y||{}),X=(e=>(e[e.Pointer=0]=`Pointer`,e[e.Focus=1]=`Focus`,e[e.Other=2]=`Other`,e))(X||{}),gt=(e=>(e[e.OpenCombobox=0]=`OpenCombobox`,e[e.CloseCombobox=1]=`CloseCombobox`,e[e.GoToOption=2]=`GoToOption`,e[e.SetTyping=3]=`SetTyping`,e[e.RegisterOption=4]=`RegisterOption`,e[e.UnregisterOption=5]=`UnregisterOption`,e[e.DefaultToFirstOption=6]=`DefaultToFirstOption`,e[e.SetActivationTrigger=7]=`SetActivationTrigger`,e[e.UpdateVirtualConfiguration=8]=`UpdateVirtualConfiguration`,e[e.SetInputElement=9]=`SetInputElement`,e[e.SetButtonElement=10]=`SetButtonElement`,e[e.SetOptionsElement=11]=`SetOptionsElement`,e[e.MarkInputAsMoved=12]=`MarkInputAsMoved`,e))(gt||{});function _t(e,t=e=>e){let n=e.activeOptionIndex===null?null:e.options[e.activeOptionIndex],r=t(e.options.slice()),i=r.length>0&&r[0].dataRef.current.order!==null?r.sort((e,t)=>e.dataRef.current.order-t.dataRef.current.order):De(r,e=>e.dataRef.current.domRef.current),a=n?i.indexOf(n):null;return a===-1&&(a=null),{options:i,activeOptionIndex:a}}var vt={1(e){var t;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===1)return e;let n=e.inputElement?D.Tracked(w(e.inputElement)):e.inputPositionState;return{...e,activeOptionIndex:null,comboboxState:1,isTyping:!1,activationTrigger:2,inputPositionState:n,__demoMode:!1}},0(e){var t,n;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===0)return e;if((n=e.dataRef.current)!=null&&n.value){let t=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(t!==-1)return{...e,activeOptionIndex:t,comboboxState:0,__demoMode:!1,inputPositionState:D.Idle}}return{...e,comboboxState:0,inputPositionState:D.Idle,__demoMode:!1}},3(e,t){return e.isTyping===t.isTyping?e:{...e,isTyping:t.isTyping}},2(e,t){var n,r;if((n=e.dataRef.current)!=null&&n.disabled||e.optionsElement&&!((r=e.dataRef.current)!=null&&r.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let{options:n,disabled:r}=e.virtual,i=t.focus===g.Specific?t.idx:T(t,{resolveItems:()=>n,resolveActiveIndex:()=>e.activeOptionIndex??n.findIndex(e=>!r(e))??null,resolveDisabled:r,resolveId(){throw Error(`Function not implemented.`)}}),a=t.trigger??2;return e.activeOptionIndex===i&&e.activationTrigger===a?e:{...e,activeOptionIndex:i,activationTrigger:a,isTyping:!1,__demoMode:!1}}let i=_t(e);if(i.activeOptionIndex===null){let e=i.options.findIndex(e=>!e.dataRef.current.disabled);e!==-1&&(i.activeOptionIndex=e)}let a=t.focus===g.Specific?t.idx:T(t,{resolveItems:()=>i.options,resolveActiveIndex:()=>i.activeOptionIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled}),o=t.trigger??2;return e.activeOptionIndex===a&&e.activationTrigger===o?e:{...e,...i,isTyping:!1,activeOptionIndex:a,activationTrigger:o,__demoMode:!1}},4:(e,t)=>{var n,r,i,a;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:[...e.options,t.payload]};let o=t.payload,s=_t(e,e=>(e.push(o),e));e.activeOptionIndex===null&&(i=(r=e.dataRef.current).isSelected)!=null&&i.call(r,t.payload.dataRef.current.value)&&(s.activeOptionIndex=s.options.indexOf(o));let c={...e,...s,activationTrigger:2};return(a=e.dataRef.current)!=null&&a.__demoMode&&e.dataRef.current.value===void 0&&(c.activeOptionIndex=0),c},5:(e,t)=>{var n;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:e.options.filter(e=>e.id!==t.id)};let r=_t(e,e=>{let n=e.findIndex(e=>e.id===t.id);return n!==-1&&e.splice(n,1),e});return{...e,...r,activationTrigger:2}},6:(e,t)=>e.defaultToFirstOption===t.value?e:{...e,defaultToFirstOption:t.value},7:(e,t)=>e.activationTrigger===t.trigger?e:{...e,activationTrigger:t.trigger},8:(e,t)=>{if(e.virtual===null)return{...e,virtual:{options:t.options,disabled:t.disabled??(()=>!1)}};if(e.virtual.options===t.options&&e.virtual.disabled===t.disabled)return e;let n=e.activeOptionIndex;if(e.activeOptionIndex!==null){let r=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);n=r===-1?null:r}return{...e,activeOptionIndex:n,virtual:{options:t.options,disabled:t.disabled??(()=>!1)}}},9:(e,t)=>e.inputElement===t.element?e:{...e,inputElement:t.element},10:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},11:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},12(e){return e.inputPositionState.kind===`Tracked`?{...e,inputPositionState:D.Moved}:e}},yt=class e extends re{constructor(e){super(e),ht(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:(e,t)=>(this.send({type:4,payload:{id:e,dataRef:t}}),()=>{this.state.activeOptionIndex===this.state.dataRef.current.calculateIndex(t.current.value)&&this.send({type:6,value:!0}),this.send({type:5,id:e})}),goToOption:(e,t)=>(this.send({type:6,value:!1}),this.send({type:2,...e,trigger:t})),setIsTyping:e=>{this.send({type:3,isTyping:e})},closeCombobox:()=>{var e,t;this.send({type:1}),this.send({type:6,value:!1}),(t=(e=this.state.dataRef.current).onClose)==null||t.call(e)},openCombobox:()=>{this.send({type:0}),this.send({type:6,value:!0})},setActivationTrigger:e=>{this.send({type:7,trigger:e})},selectActiveOption:()=>{let e=this.selectors.activeOptionIndex(this.state);if(e!==null){if(this.actions.setIsTyping(!1),this.state.virtual)this.actions.onChange(this.state.virtual.options[e]);else{let{dataRef:t}=this.state.options[e];this.actions.onChange(t.current.value)}this.actions.goToOption({focus:g.Specific,idx:e})}},setInputElement:e=>{this.send({type:9,element:e})},setButtonElement:e=>{this.send({type:10,element:e})},setOptionsElement:e=>{this.send({type:11,element:e})}}),ht(this,`selectors`,{activeDescendantId:e=>{let t=this.selectors.activeOptionIndex(e);if(t!==null)return e.virtual?e.options.find(n=>!n.dataRef.current.disabled&&e.dataRef.current.compare(n.dataRef.current.value,e.virtual.options[t]))?.id:e.options[t]?.id},activeOptionIndex:e=>{if(e.defaultToFirstOption&&e.activeOptionIndex===null&&(e.virtual?e.virtual.options.length>0:e.options.length>0)){if(e.virtual){let{options:t,disabled:n}=e.virtual,r=t.findIndex(e=>{var t;return!((t=n?.(e))!=null&&t)});if(r!==-1)return r}let t=e.options.findIndex(e=>!e.dataRef.current.disabled);if(t!==-1)return t}return e.activeOptionIndex},activeOption:e=>{let t=this.selectors.activeOptionIndex(e);return t===null?null:e.virtual?e.virtual.options[t??0]:e.options[t]?.dataRef.current.value??null},isActive:(e,t,n)=>{let r=this.selectors.activeOptionIndex(e);return r===null?!1:e.virtual?r===e.dataRef.current.calculateIndex(t):e.options[r]?.id===n},shouldScrollIntoView:(e,t,n)=>!(e.virtual||e.__demoMode||e.comboboxState!==0||e.activationTrigger===0||!this.selectors.isActive(e,t,n)),didInputMove(e){return e.inputPositionState.kind===`Moved`}});{let e=this.state.id,t=oe.get(null);this.disposables.add(t.on(ae.Push,n=>{!t.selectors.isTop(n,e)&&this.state.comboboxState===0&&this.actions.closeCombobox()})),this.on(0,()=>t.actions.push(e)),this.on(1,()=>t.actions.pop(e))}this.disposables.group(e=>{this.on(1,t=>{t.inputElement&&(e.dispose(),e.add(x(t.inputElement,t.inputPositionState,()=>{this.send({type:12})})))})})}static new({id:t,virtual:n=null,__demoMode:r=!1}){return new e({id:t,dataRef:{current:{}},comboboxState:+!r,isTyping:!1,options:[],virtual:n?{options:n.options,disabled:n.disabled??(()=>!1)}:null,activeOptionIndex:null,activationTrigger:2,inputElement:null,buttonElement:null,optionsElement:null,__demoMode:r,inputPositionState:D.Idle})}reduce(e,t){return U(t.type,vt,e,t)}},bt=(0,W.createContext)(null);function xt(e){let t=(0,W.useContext)(bt);if(t===null){let t=Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,St),t}return t}function St({id:e,virtual:t=null,__demoMode:n=!1}){let r=(0,W.useMemo)(()=>yt.new({id:e,virtual:t,__demoMode:n}),[]);return be(()=>r.dispose()),r}var Ct=(0,W.createContext)(null);Ct.displayName=`ComboboxDataContext`;function Z(e){let t=(0,W.useContext)(Ct);if(t===null){let t=Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Z),t}return t}var wt=(0,W.createContext)(null);function Tt(e){let t=xt(`VirtualProvider`),{options:n}=Z(`VirtualProvider`).virtual,r=L(t,e=>e.optionsElement),[i,a]=(0,W.useMemo)(()=>{let e=r;if(!e)return[0,0];let t=window.getComputedStyle(e);return[parseFloat(t.paddingBlockStart||t.paddingTop),parseFloat(t.paddingBlockEnd||t.paddingBottom)]},[r]),o=dt({enabled:n.length!==0,scrollPaddingStart:i,scrollPaddingEnd:a,count:n.length,estimateSize(){return 40},getScrollElement(){return t.state.optionsElement},overscan:12}),[s,c]=(0,W.useState)(0);H(()=>{c(e=>e+1)},[n]);let l=o.getVirtualItems(),u=L(t,e=>e.activationTrigger===X.Pointer),d=L(t,t.selectors.activeOptionIndex);return l.length===0?null:W.createElement(wt.Provider,{value:o},W.createElement(`div`,{style:{position:`relative`,width:`100%`,height:`${o.getTotalSize()}px`},ref:e=>{e&&(u||d!==null&&n.length>d&&o.scrollToIndex(d))}},l.map(t=>W.createElement(W.Fragment,{key:t.key},W.cloneElement(e.children?.call(e,{...e.slot,option:n[t.index]}),{key:`${s}-${t.key}`,"data-index":t.index,"aria-setsize":n.length,"aria-posinset":t.index+1,style:{position:`absolute`,top:0,left:0,transform:`translateY(${t.start}px)`,overflowAnchor:`none`}})))))}var Et=W.Fragment;function Dt(e,t){let n=(0,te.useId)(),r=he(),{value:i,defaultValue:a,onChange:o,form:s,name:c,by:l,invalid:u=!1,disabled:d=r||!1,onClose:f,__demoMode:m=!1,multiple:h=!1,immediate:g=!1,virtual:_=null,nullable:v,...y}=e,b=Ae(a),[x=h?[]:void 0,S]=Ne(i,o,b),C=St({id:n,virtual:_,__demoMode:m}),w=(0,W.useRef)({static:!1,hold:!1}),T=Me(l),E=z(e=>_?l===null?_.options.indexOf(e):_.options.findIndex(t=>T(t,e)):C.state.options.findIndex(t=>T(t.dataRef.current.value,e))),D=(0,W.useCallback)(e=>U(j.mode,{[Y.Multi]:()=>x.some(t=>T(t,e)),[Y.Single]:()=>T(x,e)}),[x]),k=L(C,e=>e.virtual),A=z(()=>f?.()),j=(0,W.useMemo)(()=>({__demoMode:m,immediate:g,optionsPropsRef:w,value:x,defaultValue:b,disabled:d,invalid:u,mode:h?Y.Multi:Y.Single,virtual:_?k:null,onChange:S,isSelected:D,calculateIndex:E,compare:T,onClose:A}),[m,g,w,x,b,d,u,h,_,k,S,D,E,T,A]);H(()=>{_&&C.send({type:gt.UpdateVirtualConfiguration,options:_.options,disabled:_.disabled??null})},[_,_?.options,_?.disabled]),H(()=>{C.state.dataRef.current=j},[j]);let[M,ee,N,ne]=L(C,e=>[e.comboboxState,e.buttonElement,e.inputElement,e.optionsElement]),P=oe.get(null),re=L(P,(0,W.useCallback)(e=>P.selectors.isTop(e,n),[P,n]));fe(re,[ee,N,ne],()=>C.actions.closeCombobox());let ie=L(C,C.selectors.activeOptionIndex),F=L(C,C.selectors.activeOption),I=Te({open:M===J.Open,disabled:d,invalid:u,activeIndex:ie,activeOption:F,value:x}),[ae,se]=p(),R=t===null?{}:{ref:t},le=(0,W.useCallback)(()=>{if(b!==void 0)return S?.(b)},[S,b]),B=ye();return W.createElement(se,{value:ae,props:{htmlFor:N?.id},slot:{open:M===J.Open,disabled:d}},W.createElement(O,null,W.createElement(Ct.Provider,{value:j},W.createElement(bt.Provider,{value:C},W.createElement(Ce,{value:U(M,{[J.Open]:ce.Open,[J.Closed]:ce.Closed})},c!=null&&W.createElement(ke,{disabled:d,data:x==null?{}:{[c]:x},form:s,onReset:le}),B({ourProps:R,theirProps:y,slot:I,defaultTag:Et,name:`Combobox`}))))))}var Ot=`input`;function kt(e,t){let n=xt(`Combobox.Input`),r=Z(`Combobox.Input`),i=(0,te.useId)(),a=j(),{id:o=a||`headlessui-combobox-input-${i}`,onChange:s,displayValue:c,disabled:l=r.disabled||!1,autoFocus:u=!1,type:p=`text`,...m}=e,h=(0,W.useRef)(null),v=se(h,t,_(),n.actions.setInputElement),[y,b]=L(n,e=>[e.comboboxState,e.isTyping]),x=_e(),S=z(()=>{n.actions.onChange(null),n.state.optionsElement&&(n.state.optionsElement.scrollTop=0),n.actions.goToOption({focus:g.Nothing})}),C=(0,W.useMemo)(()=>typeof c==`function`&&r.value!==void 0?c(r.value)??``:typeof r.value==`string`?r.value:``,[r.value,c]);Pe(([e,t],[r,i])=>{if(n.state.isTyping)return;let a=h.current;a&&((i===J.Open&&t===J.Closed||e!==r)&&(a.value=e),requestAnimationFrame(()=>{if(n.state.isTyping||!a||R(a))return;let{selectionStart:e,selectionEnd:t}=a;Math.abs((t??0)-(e??0))===0&&e===0&&a.setSelectionRange(a.value.length,a.value.length)}))},[C,y,b]),Pe(([e],[t])=>{if(e===J.Open&&t===J.Closed){if(n.state.isTyping)return;let e=h.current;if(!e)return;let t=e.value,{selectionStart:r,selectionEnd:i,selectionDirection:a}=e;e.value=``,e.value=t,a===null?e.setSelectionRange(r,i):e.setSelectionRange(r,i,a)}},[y]);let w=(0,W.useRef)(!1),T=z(()=>{w.current=!0}),E=z(()=>{x.nextFrame(()=>{w.current=!1})}),D=z(e=>{switch(n.actions.setIsTyping(!0),e.key){case I.Enter:if(n.state.comboboxState!==J.Open||w.current)return;if(e.preventDefault(),e.stopPropagation(),n.selectors.activeOptionIndex(n.state)===null){n.actions.closeCombobox();return}n.actions.selectActiveOption(),r.mode===Y.Single&&n.actions.closeCombobox();break;case I.ArrowDown:return e.preventDefault(),e.stopPropagation(),U(n.state.comboboxState,{[J.Open]:()=>n.actions.goToOption({focus:g.Next}),[J.Closed]:()=>n.actions.openCombobox()});case I.ArrowUp:return e.preventDefault(),e.stopPropagation(),U(n.state.comboboxState,{[J.Open]:()=>n.actions.goToOption({focus:g.Previous}),[J.Closed]:()=>{(0,G.flushSync)(()=>n.actions.openCombobox()),r.value||n.actions.goToOption({focus:g.Last})}});case I.Home:if(n.state.comboboxState===J.Closed||e.shiftKey)break;return e.preventDefault(),e.stopPropagation(),n.actions.goToOption({focus:g.First});case I.PageUp:return e.preventDefault(),e.stopPropagation(),n.actions.goToOption({focus:g.First});case I.End:if(n.state.comboboxState===J.Closed||e.shiftKey)break;return e.preventDefault(),e.stopPropagation(),n.actions.goToOption({focus:g.Last});case I.PageDown:return e.preventDefault(),e.stopPropagation(),n.actions.goToOption({focus:g.Last});case I.Escape:return n.state.comboboxState===J.Open?(e.preventDefault(),n.state.optionsElement&&!r.optionsPropsRef.current.static&&e.stopPropagation(),r.mode===Y.Single&&r.value===null&&S(),n.actions.closeCombobox()):void 0;case I.Tab:if(n.actions.setIsTyping(!1),n.state.comboboxState!==J.Open)return;r.mode===Y.Single&&n.state.activationTrigger!==X.Focus&&n.actions.selectActiveOption(),n.actions.closeCombobox()}}),O=z(e=>{s?.(e),r.mode===Y.Single&&e.target.value===``&&S(),n.actions.openCombobox()}),k=z(e=>{var t,i;let a=e.relatedTarget??Ie.find(t=>t!==e.currentTarget);if(!((t=n.state.optionsElement)!=null&&t.contains(a))&&!((i=n.state.buttonElement)!=null&&i.contains(a))&&n.state.comboboxState===J.Open)return e.preventDefault(),r.mode===Y.Single&&r.value===null&&S(),n.actions.closeCombobox()}),A=z(e=>{var t,i;let a=e.relatedTarget??Ie.find(t=>t!==e.currentTarget);(t=n.state.buttonElement)!=null&&t.contains(a)||(i=n.state.optionsElement)!=null&&i.contains(a)||r.disabled||r.immediate&&n.state.comboboxState!==J.Open&&x.microTask(()=>{(0,G.flushSync)(()=>n.actions.openCombobox()),n.actions.setActivationTrigger(X.Focus)})}),ee=M(),N=P(),{isFocused:ne,focusProps:re}=d({autoFocus:u}),{isHovered:ie,hoverProps:F}=f({isDisabled:l}),ae=L(n,e=>e.optionsElement),oe=Te({open:y===J.Open,disabled:l,invalid:r.invalid,hover:ie,focus:ne,autofocus:u}),ce=Se({ref:v,id:o,role:`combobox`,type:p,"aria-controls":ae?.id,"aria-expanded":y===J.Open,"aria-activedescendant":L(n,n.selectors.activeDescendantId),"aria-labelledby":ee,"aria-describedby":N,"aria-autocomplete":`list`,defaultValue:e.defaultValue??(r.defaultValue===void 0?null:c?.(r.defaultValue))??r.defaultValue,disabled:l||void 0,autoFocus:u,onCompositionStart:T,onCompositionEnd:E,onKeyDown:D,onChange:O,onFocus:A,onBlur:k},re,F);return ye()({ourProps:ce,theirProps:m,slot:oe,defaultTag:Ot,name:`Combobox.Input`})}var At=`button`;function jt(e,t){let n=xt(`Combobox.Button`),r=Z(`Combobox.Button`),[i,a]=(0,W.useState)(null),o=se(t,a,n.actions.setButtonElement),s=(0,te.useId)(),{id:c=`headlessui-combobox-button-${s}`,disabled:l=r.disabled||!1,autoFocus:u=!1,...p}=e,[_,v,x]=L(n,e=>[e.comboboxState,e.inputElement,e.optionsElement]),S=ft(v),w=_===J.Open;b(w,{trigger:i,action:(0,W.useCallback)(e=>{if(i!=null&&i.contains(e.target)||v!=null&&v.contains(e.target))return y.Ignore;let t=e.target.closest(`[role="option"]:not([data-disabled])`);return ie(t)?y.Select(t):x!=null&&x.contains(e.target)?y.Ignore:y.Close},[i,v,x]),close:n.actions.closeCombobox,select:n.actions.selectActiveOption});let T=z(e=>{switch(e.key){case I.Space:case I.Enter:e.preventDefault(),e.stopPropagation(),n.state.comboboxState===J.Closed&&(0,G.flushSync)(()=>n.actions.openCombobox()),S();return;case I.ArrowDown:e.preventDefault(),e.stopPropagation(),n.state.comboboxState===J.Closed&&((0,G.flushSync)(()=>n.actions.openCombobox()),n.state.dataRef.current.value||n.actions.goToOption({focus:g.First})),S();return;case I.ArrowUp:e.preventDefault(),e.stopPropagation(),n.state.comboboxState===J.Closed&&((0,G.flushSync)(()=>n.actions.openCombobox()),n.state.dataRef.current.value||n.actions.goToOption({focus:g.Last})),S();return;case I.Escape:if(n.state.comboboxState!==J.Open)return;e.preventDefault(),n.state.optionsElement&&!r.optionsPropsRef.current.static&&e.stopPropagation(),(0,G.flushSync)(()=>n.actions.closeCombobox()),S();return;default:return}}),E=h(()=>{n.state.comboboxState===J.Open?n.actions.closeCombobox():n.actions.openCombobox(),S()}),D=M([c]),{isFocusVisible:O,focusProps:k}=d({autoFocus:u}),{isHovered:A,hoverProps:j}=f({isDisabled:l}),{pressed:ee,pressProps:N}=m({disabled:l}),ne=Te({open:_===J.Open,active:ee||_===J.Open,disabled:l,invalid:r.invalid,value:r.value,hover:A,focus:O}),P=Se({ref:o,id:c,type:C(e,i),tabIndex:-1,"aria-haspopup":`listbox`,"aria-controls":x?.id,"aria-expanded":_===J.Open,"aria-labelledby":D,disabled:l||void 0,autoFocus:u,onKeyDown:T},E,k,j,N);return ye()({ourProps:P,theirProps:p,slot:ne,defaultTag:At,name:`Combobox.Button`})}var Mt=`div`,Nt=B.RenderStrategy|B.Static;function Pt(e,t){let n=(0,te.useId)(),{id:r=`headlessui-combobox-options-${n}`,hold:i=!1,anchor:a,portal:o=!1,modal:s=!0,transition:c=!1,...l}=e,u=xt(`Combobox.Options`),d=Z(`Combobox.Options`),f=v(a);f&&(o=!0);let[p,m]=S(f),[h,g]=(0,W.useState)(null),_=k(),y=se(t,f?p:null,u.actions.setOptionsElement,g),[b,x,C,w,T]=L(u,e=>[e.comboboxState,e.inputElement,e.buttonElement,e.optionsElement,e.activationTrigger]),E=ge(x||C),D=ge(w),O=we(),[A,j]=le(c,h,O===null?b===J.Open:(O&ce.Open)===ce.Open);me(A,x,u.actions.closeCombobox);let N=!d.__demoMode&&s&&b===J.Open;xe(N,D);let P=!d.__demoMode&&s&&b===J.Open;ne(P,{allowed:(0,W.useCallback)(()=>[x,C,w],[x,C,w])});let re=!L(u,u.selectors.didInputMove)&&A;H(()=>{d.optionsPropsRef.current.static=e.static??!1},[d.optionsPropsRef,e.static]),H(()=>{d.optionsPropsRef.current.hold=i},[d.optionsPropsRef,i]),Le(b===J.Open,{container:w,accept(e){return e.getAttribute(`role`)===`option`?NodeFilter.FILTER_REJECT:e.hasAttribute(`role`)?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(e){e.setAttribute(`role`,`none`)}});let ie=M([C?.id]),F=Te({open:b===J.Open,option:void 0}),I=z(()=>{u.actions.setActivationTrigger(X.Pointer)}),ae=z(e=>{e.preventDefault(),u.actions.setActivationTrigger(X.Pointer)}),oe=Se(f?_():{},{"aria-labelledby":ie,role:`listbox`,"aria-multiselectable":d.mode===Y.Multi||void 0,id:r,ref:y,style:{...l.style,...m,"--input-width":ee(A,x,!0).width,"--button-width":ee(A,C,!0).width},onWheel:T===X.Pointer?void 0:I,onMouseDown:ae,...ue(j)}),R=A&&b===J.Closed&&!e.static,B=je(R,d.virtual?.options),de=je(R,d.value),fe=(0,W.useCallback)(e=>d.compare(de,e),[d.compare,de]),pe=(0,W.useMemo)(()=>{if(!d.virtual)return d;if(B===void 0)throw Error("Missing `options` in virtual mode");return B===d.virtual.options?d:{...d,virtual:{...d.virtual,options:B}}},[d,B,d.virtual?.options]);d.virtual&&Object.assign(l,{children:W.createElement(Ct.Provider,{value:pe},W.createElement(Tt,{slot:F},l.children))});let V=ye(),he=(0,W.useMemo)(()=>d.mode===Y.Multi?d:{...d,isSelected:fe},[d,fe]);return W.createElement(ve,{enabled:o?e.static||A:!1,ownerDocument:E},W.createElement(Ct.Provider,{value:he},V({ourProps:oe,theirProps:{...l,children:W.createElement(Oe,{freeze:R},typeof l.children==`function`?l.children?.call(l,F):l.children)},slot:F,defaultTag:Mt,features:Nt,visible:re,name:`Combobox.Options`})))}var Ft=`div`;function It(e,t){var n;let r=Z(`Combobox.Option`),i=xt(`Combobox.Option`),a=(0,te.useId)(),{id:o=`headlessui-combobox-option-${a}`,value:s,disabled:c=((n=r.virtual)?.disabled)?.call(n,s)??!1,order:l=null,...u}=e,[d]=L(i,e=>[e.inputElement]),f=ft(d),p=L(i,(0,W.useCallback)(e=>i.selectors.isActive(e,s,o),[s,o])),m=r.isSelected(s),h=(0,W.useRef)(null),_=de({disabled:c,value:s,domRef:h,order:l}),v=(0,W.useContext)(wt),y=se(t,h,v?v.measureElement:null),b=z(()=>{i.actions.setIsTyping(!1),i.actions.onChange(s)});H(()=>i.actions.registerOption(o,_),[_,o]);let x=L(i,(0,W.useCallback)(e=>i.selectors.shouldScrollIntoView(e,s,o),[s,o]));H(()=>{if(x)return pe().requestAnimationFrame(()=>{var e,t;(t=(e=h.current)?.scrollIntoView)==null||t.call(e,{block:`nearest`})})},[x,h]);let S=z(e=>{e.preventDefault(),e.button===A.Left&&(c||(b(),Ee()||requestAnimationFrame(()=>f()),r.mode===Y.Single&&i.actions.closeCombobox()))}),C=z(()=>{if(c)return i.actions.goToOption({focus:g.Nothing});let e=r.calculateIndex(s);i.actions.goToOption({focus:g.Specific,idx:e})}),w=E(),T=z(e=>w.update(e)),D=z(e=>{if(!w.wasMoved(e)||c||p&&i.state.activationTrigger===X.Pointer)return;let t=r.calculateIndex(s);i.actions.goToOption({focus:g.Specific,idx:t},X.Pointer)}),O=z(e=>{w.wasMoved(e)&&(c||p&&(r.optionsPropsRef.current.hold||i.state.activationTrigger===X.Pointer&&i.actions.goToOption({focus:g.Nothing})))}),k=Te({active:p,focus:p,selected:m,disabled:c}),j={id:o,ref:y,role:`option`,tabIndex:c===!0?void 0:-1,"aria-disabled":c===!0||void 0,"aria-selected":m,disabled:void 0,onMouseDown:S,onFocus:C,onPointerEnter:T,onMouseEnter:T,onPointerMove:D,onMouseMove:D,onPointerLeave:O,onMouseLeave:O};return ye()({ourProps:j,theirProps:u,slot:k,defaultTag:Ft,name:`Combobox.Option`})}var Lt=V(Dt),Rt=V(jt),zt=V(kt),Bt=u,Vt=V(Pt),Ht=V(It),Ut=Object.assign(Lt,{Input:zt,Button:Rt,Label:Bt,Options:Vt,Option:Ht});n.map(e=>({value:e.id,label:e.label,casesFolder:e.casesFolder,templateFolder:e.templateFolder}));function Q(){let e=s().caseTypes;return e?.length?e.map(e=>({...e})):n.map(e=>({...e}))}function Wt(e){let t=Q();return t.find(t=>t.id===e)??t[0]??n[0]}function Gt(e){let t=r(e);return l({caseTypes:t}),c(),t}function Kt(e){let t=e.trim();if(!t)throw Error(`类型名称不能为空`);if(t.length>40)throw Error(`类型名称过长(最多 40 字)`);let n=Q();if(n.some(e=>e.label===t))throw Error(`已存在「${t}」`);let r=i(t),a={id:o(),label:t,...r};return Gt([...n,a]),a}function qt(e,t){let n=t.trim();if(!n)throw Error(`类型名称不能为空`);if(n.length>40)throw Error(`类型名称过长(最多 40 字)`);let r=Q(),a=r.findIndex(t=>t.id===e);if(a<0)throw Error(`类型不存在`);if(r.some(t=>t.id!==e&&t.label===n))throw Error(`已存在「${n}」`);let o=i(n),s={...r[a],label:n,...o},c=[...r];return c[a]=s,Gt(c),s}function Jt(e){let t=Q();if(t.length<=1)throw Error(`至少保留一个用例类型`);if(!t.some(t=>t.id===e))throw Error(`类型不存在`);return Gt(t.filter(t=>t.id!==e))}var Yt=`/__tb_case_sessions`,Xt=`tw.case.sessions.v1`,Zt=!1;function Qt(){return`csess_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`}function $t(e){if(typeof e==`string`&&e.trim()){let t=e.trim();return Q().some(e=>e.id===t),t}return Q()[0]?.id??`functional`}function en(e){if(!e||!Array.isArray(e.sessions))return{sessions:[],activeId:``};let t=e.sessions.filter(e=>e&&typeof e==`object`&&e.id).map(e=>({...e,caseType:$t(e.caseType)})),n=typeof e.activeId==`string`?e.activeId:``;return t.length&&!t.some(e=>e.id===n)&&(n=t[0].id),t.length||(n=``),{sessions:t,activeId:n}}function tn(){try{let e=localStorage.getItem(a(Xt));return e?en(JSON.parse(e)):{sessions:[],activeId:``}}catch{return{sessions:[],activeId:``}}}function nn(e){try{localStorage.setItem(a(Xt),JSON.stringify(e))}catch{}}async function rn(){try{let e=await fetch(Yt,{signal:AbortSignal.timeout(2e3)});if(e.ok){let t=await e.json();Zt=!0;let n=en(t.store);return nn(n),n}}catch{}return Zt=!1,tn()}function an(){return tn()}async function on(e){if(nn(e),Zt)try{await fetch(Yt,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({store:e})})}catch{}}function sn(e){nn(e),on(e)}function cn(e){let t=Date.now(),n={id:Qt(),title:e.title?.trim()||`用例生成`,createdAt:t,updatedAt:t,caseType:e.caseType,outputFormat:e.outputFormat,reqPaths:e.reqPaths,templateId:e.templateId,templateTitle:e.templateTitle,promptPath:e.promptPath,knowledgePaths:e.knowledgePaths?.length?[...e.knowledgePaths]:void 0,messages:[]};return sn({sessions:[n,...tn().sessions],activeId:n.id}),n}function ln(e,t){let n=tn(),r=n.sessions.map(n=>n.id===e?{...n,...t,updatedAt:Date.now()}:n),i={...n,sessions:r};return sn(i),i}var $=Re();function un({options:e,values:t,onChange:n,placeholder:r=`选择…`,disabled:i=!1}){let[a,o]=(0,W.useState)(!1),s=(0,W.useRef)(null);(0,W.useEffect)(()=>{if(!a)return;function e(e){s.current?.contains(e.target)||o(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[a]);let c=e.filter(e=>t.includes(e.value)).map(e=>e.label),l=i||c.length===0?r:c.length<=2?c.join(`、`):`已选 ${c.length} 项`;function u(e){t.includes(e)?n(t.filter(t=>t!==e)):n([...t,e])}return(0,$.jsxs)(`div`,{className:`relative mt-1`,ref:s,children:[(0,$.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>o(e=>!e),className:i?`w-full h-9 flex items-center justify-between gap-2 rounded-lg border border-stone-200 bg-stone-50 px-3 text-sm text-left text-stone-400 cursor-not-allowed`:`w-full h-9 flex items-center justify-between gap-2 rounded-lg border border-stone-200 bg-white px-3 text-sm text-left text-stone-800 outline-none hover:border-stone-300 focus:ring-2 focus:ring-[#4176e6]/30`,children:[(0,$.jsx)(`span`,{className:`truncate ${i||c.length?``:`text-stone-400`}`,children:l}),(0,$.jsx)(`svg`,{className:`w-4 h-4 text-stone-400 shrink-0`,viewBox:`0 0 20 20`,fill:`currentColor`,children:(0,$.jsx)(`path`,{fillRule:`evenodd`,d:`M5.23 7.21a.75.75 0 011.06.02L10 11.17l3.71-3.94a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z`,clipRule:`evenodd`})})]}),a?(0,$.jsx)(`div`,{className:`tw-select-menu tw-popover-anim absolute z-80 mt-1 max-h-56 w-full overflow-auto rounded-lg p-1 shadow-lg ring-1 ring-stone-200`,children:e.length===0?(0,$.jsx)(`div`,{className:`px-3 py-2 text-sm text-stone-400`,children:`暂无可选项`}):e.map(e=>{let n=t.includes(e.value);return(0,$.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md px-3 py-2 text-sm text-stone-700 cursor-pointer hover:bg-stone-50`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:n,onChange:()=>u(e.value),className:`rounded border-stone-300 text-[#4176e6] focus:ring-[#4176e6]/40`}),(0,$.jsx)(`span`,{className:`truncate`,children:e.label})]},e.value)})}):null]})}function dn({options:e,value:t,onChange:n,placeholder:r=`搜索并选择…`,disabled:i=!1,allowEmpty:a=!0,emptyLabel:o=`不选择`}){let[s,c]=(0,W.useState)(``),l=(0,W.useMemo)(()=>{let t=s.trim().toLowerCase();return t?e.filter(e=>e.label.toLowerCase().includes(t)||e.value.toLowerCase().includes(t)):e},[e,s]),u=e.find(e=>e.value===t)??null;return i?(0,$.jsx)(`div`,{className:`relative mt-1`,children:(0,$.jsxs)(`button`,{type:`button`,disabled:!0,className:`w-full h-9 flex items-center justify-between gap-2 rounded-lg border border-stone-200 bg-stone-50 px-3 text-sm text-left text-stone-400 cursor-not-allowed`,children:[(0,$.jsx)(`span`,{className:`truncate`,children:r}),(0,$.jsx)(`svg`,{className:`w-4 h-4 text-stone-400 shrink-0`,viewBox:`0 0 20 20`,fill:`currentColor`,children:(0,$.jsx)(`path`,{fillRule:`evenodd`,d:`M5.23 7.21a.75.75 0 011.06.02L10 11.17l3.71-3.94a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z`,clipRule:`evenodd`})})]})}):(0,$.jsx)(Ut,{value:u,onChange:e=>{n(e?.value??``),c(``)},immediate:!0,children:(0,$.jsxs)(`div`,{className:`relative mt-1`,children:[(0,$.jsx)(zt,{className:`w-full h-9 rounded-lg border border-stone-200 bg-white px-3 pr-8 text-sm outline-none cursor-text placeholder:text-stone-400 focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6]`,displayValue:e=>e?.label??``,onChange:e=>c(e.target.value),placeholder:r}),(0,$.jsx)(Rt,{className:`absolute inset-y-0 right-0 flex items-center pr-2 text-stone-400 cursor-pointer`,children:(0,$.jsx)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 20 20`,fill:`currentColor`,children:(0,$.jsx)(`path`,{fillRule:`evenodd`,d:`M5.23 7.21a.75.75 0 011.06.02L10 11.17l3.71-3.94a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z`,clipRule:`evenodd`})})}),(0,$.jsxs)(Vt,{transition:!0,anchor:{to:`bottom start`,gap:4},className:`tw-select-menu tw-menu-anim z-80 max-h-56 w-(--input-width) overflow-auto rounded-lg p-1 shadow-lg ring-1 ring-stone-200 focus:outline-none`,children:[a?(0,$.jsx)(Ht,{value:null,className:`cursor-pointer select-none rounded-md px-3 py-2 text-sm text-stone-400 data-[focus]:bg-stone-50`,children:o}):null,l.length===0?(0,$.jsx)(`div`,{className:`px-3 py-2 text-sm text-stone-400`,children:`无匹配项`}):l.map(e=>(0,$.jsx)(Ht,{value:e,className:`cursor-pointer select-none rounded-md px-3 py-2 text-sm text-stone-700 data-[focus]:bg-stone-50 data-[selected]:font-medium`,children:e.label},e.value))]})]})})}export{an as a,Kt as c,Jt as d,qt as f,rn as i,Wt as l,un as n,sn as o,cn as r,ln as s,dn as t,Q as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n,n as r,r as i,t as a}from"./listbox.C96OCanh.js";import{t as o}from"./jsx-runtime.DUg_B_vD.js";import{t as s}from"./OverflowHint.D6v4Uj2N.js";var c=e(t(),1),l=o();function u({className:e=`w-4 h-4 text-stone-400 shrink-0`}){return(0,l.jsx)(`svg`,{className:e,viewBox:`0 0 20 20`,fill:`currentColor`,children:(0,l.jsx)(`path`,{fillRule:`evenodd`,d:`M5.23 7.21a.75.75 0 011.06.02L10 11.17l3.71-3.94a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z`,clipRule:`evenodd`})})}function d({value:e,onChange:t,placeholder:n,ariaLabel:r}){let i=(0,c.useRef)(null);return(0,c.useEffect)(()=>{i.current?.focus()},[]),(0,l.jsx)(`div`,{className:`sticky top-0 z-10 -mx-1 -mt-1 mb-1 border-b border-stone-100 bg-white px-1 pb-1.5 pt-1`,children:(0,l.jsxs)(`div`,{className:`relative`,children:[(0,l.jsxs)(`svg`,{className:`pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-stone-400`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,l.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,l.jsx)(`path`,{d:`m16.5 16.5 4 4`})]}),(0,l.jsx)(`input`,{ref:i,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{[`Escape`,`Enter`,`ArrowDown`,`ArrowUp`].includes(e.key)||e.stopPropagation()},placeholder:n,"aria-label":r,spellCheck:!1,className:`h-8 w-full rounded-md border border-stone-200 bg-stone-50 pl-7 pr-2 text-sm text-stone-700 outline-none transition-colors placeholder:text-stone-400 focus:border-[#4176e6]`})]})})}function f(){return(0,l.jsx)(`svg`,{className:`w-4 h-4 shrink-0`,viewBox:`0 0 20 20`,fill:`currentColor`,"aria-hidden":!0,children:(0,l.jsx)(`path`,{fillRule:`evenodd`,d:`M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z`,clipRule:`evenodd`})})}function p({options:e,value:t,onChange:o,disabled:p=!1,className:m=``,compact:h=!1,ariaLabel:g,showCheck:_=!1,centerContent:v=!1,unstyled:y=!1,triggerClassName:b=``,hideChevron:x=!1,flat:S=!1,menuMinWidth:C,menuMatchTrigger:w=!0,renderTrigger:T,renderOptionPrefix:E,renderOptionAction:D,searchable:O=!1,searchPlaceholder:k=`搜索…`,triggerTitle:A,hideTriggerHint:j=!1}){let M=e.find(e=>e.value===t),[N,P]=(0,c.useState)(``),F=(0,c.useMemo)(()=>{let t=N.trim().toLowerCase();return t?e.filter(e=>e.label.toLowerCase().includes(t)||e.value.toLowerCase().includes(t)):e},[e,N]),I=v?`relative justify-center`:`justify-between`,L=v?`w-4 h-4 text-stone-400 shrink-0 absolute right-2.5`:void 0,R=y?`w-full flex items-center cursor-pointer outline-none disabled:cursor-not-allowed`:h?`w-full h-8 flex items-center gap-1.5 rounded-lg border border-stone-300 bg-white px-2.5 text-sm text-left text-stone-700 outline-none cursor-pointer hover:border-stone-400 focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6] disabled:bg-stone-50 disabled:text-stone-400 disabled:cursor-not-allowed`:S?`w-full h-9 flex items-center gap-2 rounded-lg border border-stone-200 bg-white px-2.5 text-sm text-left text-stone-700 outline-none cursor-pointer hover:border-stone-300 focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6] disabled:bg-stone-50 disabled:text-stone-400 disabled:cursor-not-allowed`:`w-full h-9 flex items-center gap-2 rounded-lg border border-stone-200 bg-white px-3 text-sm text-left text-stone-800 outline-none cursor-pointer hover:border-stone-300 focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6] disabled:bg-stone-50 disabled:text-stone-400 disabled:cursor-not-allowed`;return(0,l.jsx)(i,{value:t,onChange:e=>{P(``),o(e)},disabled:p,children:(0,l.jsxs)(`div`,{className:`relative ${y?``:h?`inline-block`:S?``:`mt-1`} ${m}`,children:[(0,l.jsxs)(n,{"aria-label":g,onClick:()=>{O&&P(``)},className:`${R} ${I} ${b}`,children:[T?T(M):(0,l.jsx)(s,{text:A??M?.label??t,className:`min-w-0 flex-1 truncate`,disabled:j}),x?null:(0,l.jsx)(u,{className:L})]}),(0,l.jsxs)(a,{transition:!0,anchor:{to:`bottom start`,gap:4,padding:12},style:!w&&C?{minWidth:C}:void 0,className:`tw-select-menu tw-menu-anim z-80 max-h-64 space-y-1 overflow-auto rounded-lg p-1 pb-2 shadow-lg ring-1 ring-stone-200 [--anchor-max-height:16rem] focus:outline-none ${w?`w-max min-w-(--button-width) max-w-[360px]`:`w-max min-w-[150px] max-w-[360px]`}`,children:[O?(0,l.jsx)(d,{value:N,onChange:P,placeholder:k,ariaLabel:g?`${g}搜索`:`搜索选项`}):null,O&&F.length===0?(0,l.jsx)(`div`,{className:`px-3 py-2 text-sm text-stone-400`,children:`无匹配项`}):null,F.map(e=>(0,l.jsxs)(r,{value:e.value,disabled:e.disabled,className:`group flex select-none items-center gap-2 rounded-md px-3 py-2 text-sm leading-5 data-[focus]:bg-stone-50 data-[selected]:bg-(--tw-accent-soft) ${e.disabled?`cursor-not-allowed text-stone-300 data-[focus]:bg-transparent data-[selected]:bg-transparent data-[selected]:font-normal`:`cursor-pointer`} ${_?`text-stone-700 data-[selected]:text-stone-900`:`data-[selected]:text-(--tw-accent) data-[selected]:font-medium`} ${v&&!_&&!E?`justify-center px-2`:``}`,children:[_?(0,l.jsx)(`span`,{className:`w-4 shrink-0 text-[#4176e6] opacity-0 group-data-[selected]:opacity-100`,children:(0,l.jsx)(f,{})}):E?(0,l.jsx)(`span`,{className:`flex w-3.5 shrink-0 items-center justify-center`,children:E(e)}):null,(0,l.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,l.jsx)(s,{text:e.label,className:`min-w-0 w-full truncate`}),e.secondary?(0,l.jsx)(s,{text:e.secondary,className:`min-w-0 w-full truncate font-mono text-[10px] font-normal leading-4 text-stone-400`}):null]}),D?(0,l.jsx)(`span`,{className:`ml-0.5 flex shrink-0 items-center`,onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),e.preventDefault()},children:D(e)}):null]},e.value))]})]})})}export{p as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{a as n,i as r,n as i,r as ee,s as te}from"./app-config.BUPzGl9f.js";import{i as ne,n as re,r as ie,t as ae}from"./listbox.C96OCanh.js";import{a as oe,o as se}from"./dialog.BAPTk9a_.js";import{t as a}from"./jsx-runtime.DUg_B_vD.js";import{t as ce}from"./ConfirmDialog.BZzZWDci.js";import{i as le}from"./llm.BZEzE0x2.js";import{_ as ue,a as de,c as fe,d as pe,g as me,h as he,i as ge,l as o,n as s,o as _e,r as ve,s as ye,t as be,u as xe,v as Se}from"./settings.Ceefeil5.js";import{n as c}from"./i18n.BGPnP1Bg.js";import{n as Ce,r as we,t as l}from"./update.CvfIVwnq.js";var u=e(t(),1),d=a();function Te(e){try{return new URL(e).host}catch{return``}}var Ee=[{value:`zh-CN`,label:`中文`},{value:`en`,label:`English`}],f=`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`,p=`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 De({className:e=`w-3.5 h-3.5`}){return(0,d.jsx)(`svg`,{className:e,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,children:(0,d.jsx)(`path`,{d:`M6 8l4 4 4-4`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function Oe({className:e=`w-4 h-4`}){return(0,d.jsx)(`svg`,{className:e,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,d.jsx)(`path`,{d:`M5 10.5l3.5 3.5L15 6.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function ke({className:e=`w-4 h-4`}){return(0,d.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,d.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,d.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 Ae({className:e=`w-4 h-4`}){return(0,d.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,d.jsx)(`ellipse`,{cx:`12`,cy:`5`,rx:`8`,ry:`3`}),(0,d.jsx)(`path`,{d:`M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5`}),(0,d.jsx)(`path`,{d:`M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6`})]})}function je({kind:e}){let t=`w-5 h-5`;return e===`sun`?(0,d.jsxs)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,d.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,d.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,d.jsx)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,d.jsx)(`path`,{d:`M21 14.5A8.5 8.5 0 1 1 9.5 3a7 7 0 0 0 11.5 11.5z`})}):(0,d.jsxs)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,d.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`12`,rx:`2`}),(0,d.jsx)(`path`,{d:`M8 20h8M12 16v4`})]})}function m({title:e,description:t,control:n}){return(0,d.jsxs)(`div`,{className:`flex items-center gap-4 py-4 border-b border-stone-100 last:border-b-0`,children:[(0,d.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,d.jsx)(`div`,{className:`text-sm font-medium text-stone-800`,children:e}),t?(0,d.jsx)(`div`,{className:`mt-0.5 text-xs text-stone-400 leading-5`,children:t}):null]}),(0,d.jsx)(`div`,{className:`shrink-0`,children:n})]})}function h({value:e,options:t,onChange:n}){let r=t.find(t=>t.value===e)?.label??e;return(0,d.jsxs)(ie,{value:e,onChange:n,children:[(0,d.jsxs)(ne,{className:p,children:[(0,d.jsx)(`span`,{className:`flex-1 text-left truncate`,children:r}),(0,d.jsx)(De,{className:`w-3.5 h-3.5 text-stone-400 shrink-0`})]}),(0,d.jsx)(ae,{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,d.jsxs)(re,{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,d.jsx)(`span`,{children:e.label}),(0,d.jsx)(Oe,{className:`w-4 h-4 text-[#4176e6] opacity-0 group-data-[selected]:opacity-100 shrink-0`})]},e.value))})]})}function g(){let[e,t]=(0,u.useState)(!1),[a,p]=(0,u.useState)(`general`),[g,Me]=(0,u.useState)(()=>ee().model.providers),[Ne,_]=(0,u.useState)(()=>ee().model.activeId),[v,y]=(0,u.useState)(null),[b,x]=(0,u.useState)(``),[Pe,Fe]=(0,u.useState)(`DeepSeek`),[S,C]=(0,u.useState)(``),[w,T]=(0,u.useState)(``),[E,D]=(0,u.useState)(``),[O,Ie]=(0,u.useState)([]),[k,A]=(0,u.useState)(`idle`),[Le,j]=(0,u.useState)(!1),[Re,M]=(0,u.useState)(`readonly`),[ze,Be]=(0,u.useState)(!1),[Ve,N]=(0,u.useState)(!1),[He,P]=(0,u.useState)(null),[F,I]=(0,u.useState)({language:`zh-CN`,appearance:`system`,sessionFontSize:14,toolStepDetail:`standard`,busySendBehavior:`queue`,subagentModel:``}),[Ue,L]=(0,u.useState)(`14`),We=(0,u.useRef)(0),[R,Ge]=(0,u.useState)(null),[z,Ke]=(0,u.useState)(!1),[qe,Je]=(0,u.useState)(!1),[Ye,B]=(0,u.useState)(!1),[Xe,V]=(0,u.useState)(``),H=(0,u.useRef)(null),U=(0,u.useRef)(!1),W=v!==null,G=F.language,K=g.find(e=>e.id===Ne),q=(K?.name||``).trim(),J=R?.status??null,Ze=J?.phase===`done`&&!!J.to&&J.to===R?.current&&we!==R?.current&&Date.now()-Date.parse(J.finishedAt||``)<864e5,Qe=J?.phase===`failed`?J.error:``,Y=Ye||J?.phase===`installing`||J?.phase===`restarting`,$e=(J?.to||R?.latest||``).replace(/^v/,``),X=Qe||Xe,et=R?.checkedAt&&!Y?new Date(R.checkedAt).toLocaleTimeString():``,tt=z?``:Y?J?.phase===`restarting`?c(`settings.updateRestarting`,void 0,G):c(`settings.updateInstalling`,{v:$e},G):X?`${c(`settings.updateFailed`,void 0,G)}:${X}`:Ze?c(`settings.updateDone`,{v:J?.to||``},G):R?.mode===`dev`&&R?.hasUpdate?c(`settings.updateDevMode`,void 0,G):R?.error?`${c(`settings.updateUnavailable`,void 0,G)}:${R.error}`:R?.hasUpdate?R.mode===`npx`?c(`settings.updateNpxHint`,void 0,G):``:R?`${c(`settings.updateLatest`,void 0,G)}${et?` · ${c(`settings.updateCheckedAt`,{time:et},G)}`:``}`:qe?c(`settings.updateUnavailable`,void 0,G):``,nt=q||(G===`en`?`No model`:`未配置`),rt=q?K?.model?.trim()?`${q} · ${K.model.trim()}`:q:G===`en`?`No model configured`:`未配置模型`;function it(e=`general`){p(e),r().then(()=>{at(),t(!0)})}function at(){Be(n()),Me(fe()),_(de()),N(!!o()),I(ye()),ve(ye()),M(_e()),y(null)}function Z(){H.current!==null&&(window.clearInterval(H.current),H.current=null)}async function ot(e=!0){Ke(!0);try{let t=await l(e);t&&(Ge(t),V(``))}finally{Ke(!1),Je(!0)}}function st(e){Z();let t=Date.now()+18e4;H.current=window.setInterval(async()=>{if(!U.current){U.current=!0;try{let n=await l(!0);if(n){Ge(n);let t=n.status;if(t?.phase===`failed`){Z(),B(!1),V(t.error||c(`settings.updateFailed`,void 0,G));return}if(t?.phase===`done`||e&&n.current!==e){Z(),B(!1);return}}Date.now()>t&&(Z(),B(!1),V(c(`settings.updateTimeout`,void 0,G)))}finally{U.current=!1}}},1500)}async function ct(){let e=R?.latest||``;V(``),B(!0);let t=R?.current||we,n=await Ce(e||void 0);n.ok?st(t):(B(!1),V(n.error||c(`settings.updateFailed`,void 0,G)))}function lt(e){if(!e){let e=te();y(e),x(`DeepSeek`),Fe(`DeepSeek`),C(`https://api.deepseek.com/v1`),T(``),D(``),Ie([]),A(`idle`),j(!1);return}y(e.id),x(e.name),C(e.baseURL);let t=e.apiKey?.trim()||(e.id===de()?i().trim():``)||``;T(t),D(e.model),Ie(e.availableModels??[]),A(e.availableModels?.length?`ok`:`idle`),Fe(s.find(t=>t.baseURL===e.baseURL)?.label??`自定义`),j(!1)}(0,u.useEffect)(()=>{r().then(()=>at());let e=e=>{let n=e.detail;p(n?.tab===`model`?`model`:`general`),r().then(()=>{at(),t(!0)})};window.addEventListener(be,e);let n=pe(e=>I(e)),i=xe(e=>M(e));return()=>{window.removeEventListener(be,e),n(),i()}},[]),(0,u.useEffect)(()=>{if(e)return(async()=>{let e=await l(!1);if(Je(!0),!e)return;Ge(e);let t=e.status;(t?.phase===`installing`||t?.phase===`restarting`)&&(B(!0),st(t.from||e.current))})(),Z},[e]),(0,u.useEffect)(()=>{if(!e||a!==`model`||!W)return;let t=S.trim(),n=w.trim();if(!t||!n){A(e=>e===`ok`?`ok`:`idle`);return}A(`loading`);let r=++We.current,i=setTimeout(()=>{le(t,n).then(e=>{r===We.current&&(Ie(e),A(`ok`))}).catch(()=>{r===We.current&&A(`fail`)})},800);return()=>clearTimeout(i)},[e,a,W,S,w]);function ut(e){Fe(e);let t=s.find(t=>t.label===e);t&&(t.baseURL&&C(t.baseURL),(!b.trim()||s.some(e=>e.label===b))&&x(t.label)),D(``)}function Q(e){I(me(e))}(0,u.useEffect)(()=>{L(String(F.sessionFontSize))},[F.sessionFontSize]);function dt(){let e=Number(Ue);if(!Ue.trim()||!Number.isFinite(e)){L(String(F.sessionFontSize));return}let t=me({sessionFontSize:Math.round(e)});I(t),L(String(t.sessionFontSize))}let ft=!!(b.trim()&&S.trim()&&w.trim()&&E.trim()),$=O.length>0;function pt(){if(!ft||!v)return;let e=Se({id:v,name:b.trim(),baseURL:S.trim(),apiKey:w.trim(),model:E.trim(),availableModels:$?O:void 0},{activate:!0});Me(e),_(v),y(null),N(!!o())}function mt(e){P(e)}function ht(){let e=He;if(!e)return;P(null);let t=ge(e);Me(t),_(de()),v===e&&y(null),N(!!o())}function gt(e){ue(e),_(e),N(!!o())}let _t=[{value:`readonly`,label:c(`settings.access.readonly`,void 0,G)},{value:`readwrite`,label:c(`settings.access.readwrite`,void 0,G)},{value:`full`,label:c(`settings.access.full`,void 0,G)}],vt=[{value:`concise`,label:c(`settings.step.concise`,void 0,G)},{value:`standard`,label:c(`settings.step.standard`,void 0,G)},{value:`detailed`,label:c(`settings.step.detailed`,void 0,G)},{value:`full`,label:c(`settings.step.full`,void 0,G)}],yt=[{value:`queue`,label:c(`settings.busySend.queue`,void 0,G)},{value:`interrupt`,label:c(`settings.busySend.interrupt`,void 0,G)}],bt=[{value:`light`,label:c(`settings.appear.light`,void 0,G),icon:`sun`},{value:`dark`,label:c(`settings.appear.dark`,void 0,G),icon:`moon`},{value:`system`,label:c(`settings.appear.system`,void 0,G),icon:`monitor`}],xt=[{id:`general`,label:c(`settings.general`,void 0,G),icon:(0,d.jsx)(ke,{})},{id:`model`,label:c(`settings.model`,void 0,G),icon:(0,d.jsx)(Ae,{})}],St=a===`general`?c(`settings.general`,void 0,G):W?g.some(e=>e.id===v)?c(`settings.editProvider`,void 0,G):c(`settings.addProviderTitle`,void 0,G):c(`settings.model`,void 0,G);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`div`,{className:`tw-nav-foot-row`,children:[(0,d.jsxs)(`button`,{type:`button`,onClick:()=>it(`general`),className:`tw-nav-settings-btn`,"data-hint":Ve?`设置(已配置模型)`:`设置`,children:[(0,d.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,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`,{"data-i18n":`nav.settings`,children:c(`nav.settings`,void 0,G)})]}),(0,d.jsxs)(`button`,{type:`button`,className:`tw-nav-provider-chip${q?``:` is-empty`}`,"data-hint":rt,onClick:()=>it(`model`),children:[(0,d.jsx)(`span`,{className:`tw-nav-provider-dot`,"aria-hidden":`true`}),(0,d.jsx)(`span`,{className:`tw-nav-provider-name`,children:nt})]})]}),(0,d.jsx)(oe,{show:e,children:(0,d.jsxs)(`div`,{className:`fixed inset-0 z-110 flex items-center justify-center p-4`,children:[(0,d.jsx)(se,{children:(0,d.jsx)(`div`,{className:`tw-dialog-backdrop-anim absolute inset-0 bg-stone-950/45`,onClick:()=>t(!1),"aria-hidden":`true`})}),(0,d.jsx)(se,{children:(0,d.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,d.jsxs)(`div`,{className:`shrink-0 h-12 px-4 flex items-center justify-between border-b border-stone-100 bg-white`,children:[(0,d.jsx)(`h2`,{className:`text-sm font-semibold text-stone-800 truncate pr-3`,children:St}),(0,d.jsx)(`button`,{type:`button`,"aria-label":c(`settings.close`,void 0,G),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,d.jsx)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,d.jsx)(`path`,{d:`M5 5l10 10M15 5L5 15`,strokeLinecap:`round`})})})]}),(0,d.jsxs)(`div`,{className:`flex-1 min-h-0 flex`,children:[(0,d.jsx)(`aside`,{className:`w-38 shrink-0 border-r border-stone-100 bg-[#f4f5f7] py-3 px-2 space-y-0.5`,children:xt.map(e=>{let t=a===e.id;return(0,d.jsxs)(`button`,{type:`button`,onClick:()=>{p(e.id),e.id===`model`&&y(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,d.jsx)(`span`,{className:t?`text-[#4176e6]`:`text-stone-400`,children:e.icon}),e.label]},e.id)})}),(0,d.jsx)(`div`,{className:`flex-1 min-w-0 flex flex-col min-h-0 bg-white`,children:a===`general`?(0,d.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:[(0,d.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-1`,children:[(0,d.jsx)(m,{title:c(`settings.access`,void 0,G),description:c(`settings.accessDesc`,void 0,G),control:(0,d.jsx)(h,{value:Re,options:_t,onChange:e=>{M(e),he(e)}})}),(0,d.jsx)(m,{title:c(`settings.language`,void 0,G),control:(0,d.jsx)(h,{value:F.language,options:Ee,onChange:e=>Q({language:e})})}),(0,d.jsxs)(`div`,{className:`py-4 border-b border-stone-100`,children:[(0,d.jsx)(`div`,{className:`text-sm font-medium text-stone-800 mb-3`,children:c(`settings.appearance`,void 0,G)}),(0,d.jsx)(`div`,{className:`grid grid-cols-3 gap-2.5`,children:bt.map(e=>{let t=F.appearance===e.value;return(0,d.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,d.jsx)(je,{kind:e.icon}),(0,d.jsx)(`span`,{className:`text-xs font-medium`,children:e.label})]},e.value)})})]}),(0,d.jsx)(m,{title:c(`settings.fontSize`,void 0,G),description:c(`settings.fontSizeDesc`,void 0,G),control:(0,d.jsxs)(`div`,{className:`inline-flex items-center gap-1.5`,children:[(0,d.jsx)(`input`,{type:`number`,min:12,max:22,value:Ue,onChange:e=>L(e.target.value),onBlur:dt,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,d.jsx)(`span`,{className:`text-sm text-stone-400`,children:`px`})]})}),(0,d.jsx)(m,{title:c(`settings.toolSteps`,void 0,G),description:c(`settings.toolStepsDesc`,void 0,G),control:(0,d.jsx)(h,{value:F.toolStepDetail,options:vt,onChange:e=>Q({toolStepDetail:e})})}),(0,d.jsx)(m,{title:c(`settings.busySend`,void 0,G),description:c(`settings.busySendDesc`,void 0,G),control:(0,d.jsx)(h,{value:F.busySendBehavior,options:yt,onChange:e=>Q({busySendBehavior:e})})}),(0,d.jsx)(m,{title:c(`settings.subagentModel`,void 0,G),description:c(`settings.subagentModelDesc`,void 0,G),control:(0,d.jsx)(h,{value:F.subagentModel?.trim()?F.subagentModel:`inherit`,options:[{value:`inherit`,label:c(`settings.subagentModel.inherit`,void 0,G)},...Array.from(new Set([...K?.availableModels??[],...K?.model?[K.model]:[]])).filter(Boolean).map(e=>({value:e,label:e}))],onChange:e=>Q({subagentModel:e===`inherit`?``:e})})})]}),(0,d.jsxs)(`div`,{className:`shrink-0 px-6 py-3 border-t border-stone-100`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,d.jsxs)(`div`,{className:`min-w-0 flex items-center gap-2`,children:[(0,d.jsx)(`span`,{className:`text-sm text-stone-700 whitespace-nowrap`,children:c(`settings.platformVersion`,void 0,G)}),(0,d.jsxs)(`span`,{className:`text-sm tabular-nums text-stone-500`,children:[`v`,we]}),R?.hasUpdate&&!Y&&!Ze?(0,d.jsx)(`span`,{className:`inline-flex items-center h-[18px] px-1.5 rounded-full bg-[#edf3fe] text-[11px] font-medium text-[#4176e6] tabular-nums whitespace-nowrap`,children:`${c(`settings.updateAvailable`,void 0,G)} v${(R.latest||``).replace(/^v/,``)}`}):null]}),(0,d.jsx)(`div`,{className:`shrink-0 flex items-center gap-2`,children:Y?(0,d.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 h-8 px-3 rounded-lg text-xs text-stone-500 bg-stone-100 whitespace-nowrap`,children:[(0,d.jsx)(`span`,{className:`w-3 h-3 rounded-full border-2 border-stone-300 border-t-[#4176e6] animate-spin`}),c(`settings.updateWorking`,void 0,G)]}):Ze?(0,d.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`h-8 px-3 rounded-lg text-xs font-medium text-[#4176e6] bg-[#edf3fe] hover:bg-[#e2ecfd] whitespace-nowrap`,children:c(`settings.updateReload`,void 0,G)}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`button`,{type:`button`,disabled:z,onClick:()=>void ot(!0),className:`inline-flex items-center justify-center min-w-[76px] h-8 px-3 rounded-lg text-xs font-medium text-stone-600 bg-stone-100 hover:bg-stone-200 disabled:opacity-70 disabled:cursor-default whitespace-nowrap`,children:z?(0,d.jsxs)(d.Fragment,{children:[c(`settings.updateChecking`,void 0,G),(0,d.jsxs)(`span`,{className:`tw-dots`,"aria-hidden":`true`,children:[(0,d.jsx)(`i`,{}),(0,d.jsx)(`i`,{}),(0,d.jsx)(`i`,{})]})]}):c(`settings.updateCheck`,void 0,G)}),R?.hasUpdate?(0,d.jsx)(`button`,{type:`button`,disabled:R.mode===`dev`,onClick:()=>void ct(),className:`h-8 px-3 rounded-lg text-xs font-semibold text-white bg-[#4176e6] hover:bg-[#3566d6] disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap`,children:c(`settings.updateNow`,void 0,G)}):null]})})]}),tt?(0,d.jsx)(`div`,{className:`mt-1 text-[11px] leading-relaxed ${X?`text-red-500`:`text-stone-400`}`,children:tt}):null,X&&R?.logPath?(0,d.jsx)(`div`,{className:`mt-0.5 text-[11px] leading-relaxed text-stone-400 break-all`,children:c(`settings.updateLog`,{path:R.logPath},G)}):null]})]}):W?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`div`,{className:`shrink-0 px-5 pt-3 pb-2 flex items-center gap-2 border-b border-stone-100`,children:(0,d.jsx)(`button`,{type:`button`,onClick:()=>y(null),className:`text-sm text-stone-500 hover:text-stone-800`,children:c(`settings.back`,void 0,G)})}),(0,d.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-5 py-4 space-y-4`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:c(`settings.displayName`,void 0,G)}),(0,d.jsx)(`input`,{type:`text`,value:b,onChange:e=>x(e.target.value),placeholder:`DeepSeek`,className:f})]}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:c(`settings.preset`,void 0,G)}),(0,d.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:s.map(e=>{let t=Pe===e.label;return(0,d.jsxs)(`button`,{type:`button`,onClick:()=>ut(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,d.jsx)(`div`,{className:`text-sm ${t?`text-[#3565c7] font-medium`:`text-stone-700`}`,children:e.label}),(0,d.jsx)(`div`,{className:`text-[11px] text-stone-400 truncate`,children:e.baseURL?Te(e.baseURL):`OpenAI compatible`})]},e.label)})})]}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:c(`settings.baseUrl`,void 0,G)}),(0,d.jsx)(`input`,{type:`text`,value:S,onChange:e=>C(e.target.value),placeholder:`https://api.deepseek.com/v1`,className:f})]}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:c(`settings.apiKey`,void 0,G)}),(0,d.jsxs)(`div`,{className:`relative`,children:[(0,d.jsx)(`input`,{type:Le?`text`:`password`,value:w,onChange:e=>T(e.target.value),placeholder:`sk-...`,className:`${f} pr-14`}),(0,d.jsx)(`button`,{type:`button`,onClick:()=>j(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:Le?G===`en`?`Hide`:`隐藏`:G===`en`?`Show`:`显示`})]}),ze?(0,d.jsx)(`p`,{className:`mt-1.5 text-[11px] text-stone-400 leading-5`,children:c(`settings.keyHint`,void 0,G)}):null]}),(0,d.jsxs)(`div`,{children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5`,children:[(0,d.jsx)(`label`,{className:`text-xs font-medium text-stone-500`,children:c(`settings.modelField`,void 0,G)}),k===`loading`&&(0,d.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:c(`settings.recognizing`,void 0,G)}),$&&k===`ok`&&(0,d.jsx)(`span`,{className:`text-[11px] text-emerald-600`,children:c(`settings.recognized`,{n:O.length},G)}),k===`fail`&&!$&&(0,d.jsx)(`span`,{className:`text-[11px] text-amber-600`,children:c(`settings.recognizeFail`,void 0,G)}),k===`fail`&&$&&(0,d.jsx)(`span`,{className:`text-[11px] text-amber-600`,children:c(`settings.recognizeKeep`,void 0,G)})]}),$?(0,d.jsxs)(ie,{value:E,onChange:D,children:[(0,d.jsxs)(ne,{className:`${f} flex items-center justify-between text-left hover:border-stone-400 cursor-pointer`,children:[(0,d.jsx)(`span`,{className:`truncate text-stone-800`,children:E||(G===`en`?`Select a model`:`请选择模型`)}),(0,d.jsx)(De,{className:`w-4 h-4 shrink-0 ml-2 text-stone-400`})]}),(0,d.jsx)(ae,{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:O.map(e=>(0,d.jsxs)(re,{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,d.jsx)(`span`,{className:`truncate`,children:e}),(0,d.jsx)(Oe,{className:`w-4 h-4 text-[#4176e6] opacity-0 group-data-[selected]:opacity-100 shrink-0 ml-2`})]},e))})]}):(0,d.jsx)(`input`,{type:`text`,value:E,onChange:e=>D(e.target.value),placeholder:c(`settings.modelPlaceholder`,void 0,G),className:f})]})]}),(0,d.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,d.jsx)(`button`,{type:`button`,onClick:()=>y(null),className:`px-3.5 py-1.5 text-sm text-stone-600 hover:bg-stone-200/60 rounded-lg`,children:c(`settings.cancel`,void 0,G)}),(0,d.jsx)(`button`,{type:`button`,onClick:pt,disabled:!ft,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:c(`settings.save`,void 0,G)})]})]}):(0,d.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-5 bg-[#f4f5f7]`,children:[(0,d.jsx)(`p`,{className:`text-sm text-stone-500`,children:c(`settings.modelIntro`,void 0,G)}),(0,d.jsxs)(`div`,{className:`mt-5 space-y-2.5`,children:[g.map(e=>{let t=!!(e.apiKey?.trim()&&e.baseURL.trim()&&e.model.trim()),n=e.id===Ne;return(0,d.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,d.jsxs)(`button`,{type:`button`,"data-hint":n?G===`en`?`Active`:`当前使用`:G===`en`?`Set active`:`设为当前`,onClick:()=>gt(e.id),className:`flex-1 min-w-0 flex items-center gap-2 text-left`,children:[(0,d.jsx)(`span`,{className:`text-sm font-medium text-stone-800 truncate`,children:e.name}),t?(0,d.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0 bg-emerald-500`}):null]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,d.jsx)(`button`,{type:`button`,onClick:()=>lt(e),className:`h-8 px-3 text-sm text-stone-700 rounded-lg border border-stone-200 bg-white hover:bg-stone-50`,children:c(`settings.edit`,void 0,G)}),g.length>1?(0,d.jsx)(`button`,{type:`button`,onClick:()=>mt(e.id),className:`h-8 px-3 text-sm text-red-600 rounded-lg hover:bg-red-50`,children:c(`settings.delete`,void 0,G)}):null]})]},e.id)}),(0,d.jsx)(`button`,{type:`button`,onClick:()=>lt(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:c(`settings.addProvider`,void 0,G)})]})]})})]})]})})]})}),(0,d.jsx)(ce,{open:He!=null,title:c(`settings.delete`,void 0,G),message:c(`settings.deleteConfirm`,void 0,G),confirmLabel:c(`settings.delete`,void 0,G),cancelLabel:G===`en`?`Cancel`:`取消`,danger:!0,onClose:()=>P(null),onConfirm:ht})]})}export{g as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{t as n}from"./react-dom.DLW9pGCF.js";import{t as r}from"./jsx-runtime.DUg_B_vD.js";var i=e(t(),1),a=e(n(),1),o=r(),s=220;function c({open:e,onClose:t,title:n,closeAriaLabel:r=`关闭面板`,children:c,footer:l}){let[u,d]=(0,i.useState)(e),[f,p]=(0,i.useState)(!1);if((0,i.useEffect)(()=>{if(e){d(!0);let e=window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>p(!0))});return()=>window.cancelAnimationFrame(e)}p(!1);let t=window.setTimeout(()=>d(!1),s);return()=>window.clearTimeout(t)},[e]),(0,i.useEffect)(()=>{if(!e)return;function n(e){e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),t())}return window.addEventListener(`keydown`,n,!0),()=>window.removeEventListener(`keydown`,n,!0)},[e,t]),!u)return null;let m=(0,o.jsxs)(`div`,{className:`fixed inset-0 z-60 flex justify-end`,role:`dialog`,"aria-modal":`true`,children:[(0,o.jsx)(`button`,{type:`button`,className:`absolute inset-0 bg-stone-900/30 transition-opacity duration-200 ease-out ${f?`opacity-100`:`opacity-0`}`,"aria-label":r,onClick:t}),(0,o.jsxs)(`aside`,{className:`tw-slide-over relative w-full max-w-md h-full shadow-2xl border-l border-stone-200 flex flex-col transition-transform duration-200 ease-out will-change-transform ${f?`translate-x-0`:`translate-x-full`}`,children:[(0,o.jsxs)(`header`,{className:`shrink-0 h-12 px-4 border-b border-stone-100 flex items-center gap-2`,children:[(0,o.jsx)(`h2`,{className:`tw-slide-over-title text-sm font-semibold text-stone-800 flex-1`,children:n}),(0,o.jsx)(`button`,{type:`button`,onClick:t,className:`tw-icon-btn w-8 h-8 rounded-lg`,"data-hint":`关闭(Esc)`,children:`✕`})]}),(0,o.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto p-4 space-y-4`,children:c}),l]})]});return typeof document>`u`?m:(0,a.createPortal)(m,document.body)}export{c as t};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{E as n,f as r,i}from"./app-config.BUPzGl9f.js";import{c as a}from"./plugins.C2BMfzv1.js";import{i as o,n as s,r as c,t as l}from"./dialog.BAPTk9a_.js";import{i as ee,n as u,r as d,t as f}from"./menu.IPWdRoNM.js";import{t as p}from"./jsx-runtime.DUg_B_vD.js";import{t as m}from"./ConfirmDialog.BZzZWDci.js";import{n as h}from"./llm.BZEzE0x2.js";import{f as te}from"./project-docs.Cd2gKPKh.js";import{t as g}from"./prompts-meta.Bua-j14I.js";import{l as _}from"./settings.Ceefeil5.js";import{n as v}from"./i18n.BGPnP1Bg.js";import{a as y,c as ne,d as re,f as b,i as ie,l as ae,m as oe,n as se,o as x,p as ce,r as le,s as ue,t as de,u as fe}from"./spaces-client.BocUabwy.js";var S=e(t(),1),pe=`你是提示词作者。根据用户对这个数据空间的要求,写一份「默认提示词」正文(Markdown 纯文本,不要用代码围栏)。
|
|
2
2
|
这份提示词将作为 Lantern Harness 该空间里 AI 助手的默认人设与回答原则。
|
|
3
3
|
要求:
|
|
4
4
|
- 用「你是…」起头设定角色;
|
|
5
5
|
- 紧扣用户描述的领域与工作方式;
|
|
6
6
|
- 写几条简洁的回答原则(问什么答什么、先结论);
|
|
7
|
-
- 只输出提示词正文,不要解释、不要标题。`;function me(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 C=p();function he(e){return e instanceof DOMException&&e.name===`AbortError`||e instanceof Error&&e.name===`AbortError`}function ge({hint:e,children:t}){return e?(0,C.jsx)(`span`,{className:`inline-flex cursor-help`,"data-hint":e,"data-hint-always":``,children:t}):t}function _e(e){let{value:t,onChange:n,onGenerate:r,onStop:i,generating:a,disabled:o}=e,s=(0,S.useRef)(null);(0,S.useLayoutEffect)(()=>{let e=s.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,96)}px`)},[t]);let c=!!t.trim()&&!a&&!o;return(0,C.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,C.jsx)(`textarea`,{ref:s,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{if(e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing){if(e.preventDefault(),a){i();return}c&&r()}},placeholder:v(`space.promptBriefPlaceholder`),rows:1,disabled:o,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,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-2 px-3 pb-2 pt-1`,children:[(0,C.jsx)(`span`,{className:`flex-1`}),(0,C.jsx)(`button`,{type:`button`,onClick:()=>a?i():r(),disabled:!a&&!c,"aria-label":v(a?`space.promptStop`:`space.promptGenerate`),className:`w-7 h-7 shrink-0 rounded-full flex items-center justify-center outline-none transition-colors ${a?`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:a?(0,C.jsx)(`span`,{className:`w-2.5 h-2.5 bg-current rounded-xs`}):(0,C.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,className:`w-4 h-4`,"aria-hidden":!0,children:[(0,C.jsx)(`path`,{d:`m5 12 7-7 7 7`}),(0,C.jsx)(`path`,{d:`M12 19V5`})]})})]})]})}function ve(e){return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2 mb-1.5`,children:[(0,C.jsx)(`label`,{className:`text-xs font-medium text-stone-500`,children:v(`space.promptBodyLabel`)}),(0,C.jsx)(`span`,{className:`text-[11px] text-stone-400 font-mono truncate`,children:g})]}),(0,C.jsx)(`textarea`,{value:e.value,onChange:t=>e.onChange(t.target.value),placeholder:v(`space.promptBodyPlaceholder`),rows:8,disabled:e.disabled,className:`w-full min-h-36 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]`}),(0,C.jsx)(`p`,{className:`mt-1.5 text-[11px] text-stone-400 leading-snug`,children:e.hint??v(`space.promptHint`)})]})}function w({open:e,onClose:t,onListChanged:n}){let[a,ee]=(0,S.useState)(null),[u,d]=(0,S.useState)(null),[f,p]=(0,S.useState)(``),[b,w]=(0,S.useState)(``),[T,E]=(0,S.useState)(!1),[D,O]=(0,S.useState)(``),[k,A]=(0,S.useState)(``),[j,ye]=(0,S.useState)(``),[M,N]=(0,S.useState)(null),[P,F]=(0,S.useState)(``),[I,L]=(0,S.useState)(``),[be,R]=(0,S.useState)(``),[z,xe]=(0,S.useState)(!1),[Se,Ce]=(0,S.useState)(!1),[B,V]=(0,S.useState)(null),[H,U]=(0,S.useState)(null),[W,we]=(0,S.useState)(``),[G,K]=(0,S.useState)([]),[Te,q]=(0,S.useState)({}),Ee=(0,S.useRef)(null),De=(0,S.useRef)(null),Oe=(0,S.useRef)(null),J=(0,S.useRef)(null),[ke,Ae]=(0,S.useState)(null),Y=(0,S.useCallback)(async(e=!1)=>{e&&d(`stats`);let t=await re({stats:e});e&&d(null),t?(ee(t),n?.(t)):p(`无法读取数据空间列表(本地服务未运行?)`)},[n]),je=(0,S.useRef)(Y);(0,S.useEffect)(()=>{je.current=Y},[Y]);function X(){J.current?.abort()}(0,S.useEffect)(()=>{e?(p(``),w(``),E(!1),N(null),je.current(!1)):(X(),E(!1),N(null),Ae(null))},[e]);async function Me(e){if(ke||u!==null)return;let t=(e===`create`?k:I).trim();if(!t){p(v(`space.promptNeedReq`));return}p(``);let n=new AbortController;J.current=n,Ae(e);try{await i();let r=_();if(!r?.apiKey?.trim()||!r.model?.trim()||!r.baseURL?.trim()){p(v(`space.promptNeedModel`));return}let a=(e===`create`?D:P).trim(),o=await h(r,[{role:`system`,content:pe},{role:`user`,content:(a?`空间名称:${a}\n\n`:``)+`用户要求:\n${t}`}],n.signal);if(n.signal.aborted)return;let s=me(o);if(!s){p(v(`space.promptGenEmpty`));return}e===`create`?ye(s):R(s)}catch(e){if(he(e)||n.signal.aborted)return;p(e instanceof Error?e.message:String(e))}finally{J.current===n&&(J.current=null),Ae(null)}}function Ne(){X(),p(``),w(``),O(``),A(``),ye(``),E(!0),requestAnimationFrame(()=>De.current?.scrollIntoView({block:`nearest`}))}async function Pe(){if(u!==null)return;let e=D.trim();if(!e){p(v(`space.needName`));return}X();let t=j.trim(),n=k.trim();d(`create`),p(``);let i=await se(e,{switch:!0,...t?{systemPrompt:t}:{},...n?{promptBrief:n}:{}});if(d(null),!i.ok){p(i.error||v(`space.create`)+` 失败`);return}let a=i.space?.id;a&&r(a),window.location.reload()}async function Fe(e){X(),p(``),w(``),N(e),F(e.name),L(``),Ce(!1),R(``),xe(!0),requestAnimationFrame(()=>Oe.current?.scrollIntoView({block:`nearest`}));let t=await ne(e.id),n=``,r=``;if(t.ok)n=t.brief??``,r=t.systemPrompt??``;else if(e.isActive)try{r=(await te(`prompts`,g)).content.trim()}catch{}if(xe(!1),!t.ok&&!r){N(null),p(t.error||v(`space.detailFailed`));return}t.space&&F(t.space.name),R(r);let i=!n.trim()&&!!r;L(i?r:n),Ce(i)}async function Ie(){if(!M||u!==null)return;let e=P.trim();if(!e){p(v(`space.needName`));return}X(),d(`update`),p(``);let t=await oe(M.id,{name:e,...Se?{}:{brief:I},systemPrompt:be});if(d(null),!t.ok){p(t.error||v(`space.updateFailed`));return}let n=!!(t.space&&t.space.name!==M.name),r=M.isActive;N(null),w(v(`space.updated`,{name:t.space?.name??e})),n&&r?window.location.reload():await Y(!1)}async function Le(e){if(e.isActive||u!==null)return;d(`update`),p(``);let t=await ce(e.id);d(null),t.ok?window.location.reload():p(t.error||`切换失败`)}async function Re(){if(!H)return;let e=W.trim();if(!e)return;d(`copy`),p(``);let t=await de(H.id,e);d(null),t.ok?(U(null),w(`已复制为「${t.space?.name}」`),await Y(!1)):p(t.error||`复制失败`)}async function ze(e,t){d(`delete`),p(``);let n=await le(e.id,t);d(null),n.ok?(V(null),e.isActive?(r(`public`),window.location.reload()):(w(n.warning?n.warning:n.purged?`已删除「${e.name}」及其数据`:`已从列表移除「${e.name}」(数据保留在磁盘)`),await Y(!1))):p(n.error||`删除失败`)}async function Be(){d(`discover`),p(``),w(``),K([]);let e=await ie();if(d(null),!e.ok){p(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(v(`space.discoverAdded`,{n:t})):i.length||a.push(v(`space.discoverNone`)),n&&a.push(v(`space.discoverBackfilled`,{n})),r&&a.push(v(`space.discoverSkipped`,{n:r})),w(a.join(`;`)),K(i),q(Object.fromEntries(i.map(e=>[e.path,e.hasContent===!0]))),await Y(!1)}async function Ve(){let e=G.filter(e=>Te[e.path]).map(e=>e.path);if(!e.length){K([]),w(v(`space.candidatesIgnored`));return}d(`discover`),p(``);let t=await ie(e);if(d(null),!t.ok){p(t.error||`纳入失败`);return}K([]);let n=t.added?.length??0,r=t.skipped??[],i=[n?v(`space.candidatesAdopted`,{n}):v(`space.candidatesIgnored`)];r.length&&i.push(v(`space.candidatesRejected`,{names:r.map(e=>e.reason).join(`、`)})),w(i.join(`;`)),await Y(!1)}async function He(e){let t=e.target.files?.[0];if(e.target.value=``,!t)return;d(`import`),p(``);let n=await fe(t);d(null),n.ok?(w(`已导入为「${n.space?.name}」`),await Y(!1)):p(n.error||`导入失败`)}let Z=a?.spaces??[],Ue=new Map(Z.map((e,t)=>[e.id,t])),We=e=>e.isPublic?0:e.isActive?1:2,Ge=[...Z].sort((e,t)=>We(e)-We(t)||(Ue.get(e.id)??0)-(Ue.get(t.id)??0)),Q=a?.baseRoot,$=u!==null,Ke=ke===`create`,qe=ke===`edit`;return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(c,{open:e,onClose:t,transition:!0,className:`relative z-95`,children:[(0,C.jsx)(l,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":`true`}),(0,C.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,C.jsxs)(o,{transition:!0,className:`tw-dialog-panel-anim tw-space-dialog w-full max-w-4xl rounded-xl shadow-xl border border-stone-200 bg-white flex flex-col h-[86vh]`,children:[(0,C.jsxs)(`div`,{className:`flex items-start justify-between gap-4 px-5 pt-4 pb-3 border-b border-stone-200`,children:[(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(s,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:v(`space.manageTitle`)}),(0,C.jsx)(`p`,{className:`mt-1 text-xs text-stone-500 leading-relaxed`,children:v(`space.manageDesc`)})]}),(0,C.jsx)(`div`,{className:`shrink-0 flex items-center gap-2`,children:(0,C.jsx)(`button`,{type:`button`,onClick:t,className:`tw-confirm-cancel 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,C.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-5 py-4`,children:[f?(0,C.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,C.jsx)(`span`,{className:`flex-1 min-w-0`,children:f}),(0,C.jsx)(`button`,{type:`button`,onClick:()=>p(``),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,b?(0,C.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,C.jsx)(`span`,{className:`flex-1 min-w-0`,children:b}),(0,C.jsx)(`button`,{type:`button`,onClick:()=>w(``),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,G.length?(0,C.jsxs)(`div`,{className:`mb-3 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2.5`,children:[(0,C.jsx)(`div`,{className:`text-xs font-medium text-amber-800`,children:v(`space.candidatesTitle`,{n:G.length})}),(0,C.jsx)(`p`,{className:`mt-1 text-[11px] leading-snug text-amber-700/90`,children:v(`space.candidatesHint`)}),(0,C.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:G.map(e=>(0,C.jsxs)(`label`,{className:`flex items-start gap-2 px-2.5 py-1.5 cursor-pointer hover:bg-stone-50`,children:[(0,C.jsx)(`input`,{type:`checkbox`,checked:Te[e.path]===!0,onChange:t=>q(n=>({...n,[e.path]:t.target.checked})),className:`mt-0.5 accent-[#4176e6]`}),(0,C.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`span`,{className:`block text-xs text-stone-800 truncate`,children:e.name}),(0,C.jsx)(`span`,{className:`block text-[10px] text-stone-400 truncate font-mono`,children:Q?x(e.path,Q):e.path})]})]},e.path))}),(0,C.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,C.jsx)(`button`,{type:`button`,onClick:()=>q(Object.fromEntries(G.map(e=>[e.path,!0]))),className:`text-[11px] text-[#4176e6] hover:underline`,children:v(`space.candidatesSelectAll`)}),(0,C.jsx)(`button`,{type:`button`,onClick:()=>q({}),className:`text-[11px] text-stone-500 hover:underline`,children:v(`space.candidatesClear`)}),(0,C.jsx)(`span`,{className:`flex-1`}),(0,C.jsx)(`button`,{type:`button`,onClick:()=>{K([]),q({}),w(v(`space.candidatesIgnored`))},className:`px-2.5 py-1 text-[11px] rounded-md border border-stone-200 text-stone-600 hover:bg-stone-50`,children:v(`space.candidatesIgnore`)}),(0,C.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>void Ve(),className:`px-2.5 py-1 text-[11px] rounded-md bg-[#4176e6] text-white hover:bg-[#3565c7] disabled:opacity-40`,children:v(`space.candidatesAdopt`)})]})]}):null,T?(0,C.jsxs)(`div`,{ref:De,children:[(0,C.jsxs)(`div`,{className:`mb-2`,children:[(0,C.jsx)(`div`,{className:`text-xs font-medium text-stone-500`,children:v(`space.newTitle`)}),(0,C.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-stone-400`,children:v(`space.newDesc`)})]}),(0,C.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,C.jsx)(`input`,{autoFocus:!0,value:D,onChange:e=>O(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),Pe())},placeholder:v(`space.namePlaceholder`),className:`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`})}),a?(0,C.jsx)(`div`,{className:`mt-1.5 text-[11px] text-stone-400 truncate`,children:(0,C.jsx)(`code`,{children:x(a.dataRoot,a.baseRoot)})}):null,(0,C.jsxs)(`div`,{className:`mt-4 pt-3 border-t border-stone-200`,children:[(0,C.jsx)(`div`,{className:`text-xs font-medium text-stone-500 mb-1.5`,children:v(`space.promptBriefLabel`)}),(0,C.jsx)(_e,{value:k,onChange:A,onGenerate:()=>void Me(`create`),onStop:X,generating:Ke,disabled:$}),(0,C.jsxs)(`div`,{className:`mt-1.5 flex items-start gap-3`,children:[(0,C.jsx)(`p`,{className:`flex-1 min-w-0 text-[11px] text-stone-400 leading-snug`,children:v(`space.promptHint`)}),Ke?(0,C.jsxs)(`p`,{className:`tw-busy-status shrink-0`,"aria-live":`polite`,children:[v(`space.promptGeneratingStatus`),(0,C.jsx)(`span`,{className:`tw-busy-ellipsis`,"aria-hidden":!0})]}):null]}),(0,C.jsx)(ve,{value:j,onChange:ye,disabled:$})]})]}):M?(0,C.jsxs)(`div`,{ref:Oe,children:[(0,C.jsxs)(`div`,{className:`mb-2`,children:[(0,C.jsx)(`div`,{className:`text-xs font-medium text-stone-500`,children:v(`space.editTitle`)}),(0,C.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-stone-400 font-mono truncate`,children:Q?x(M.path,Q):M.path})]}),(0,C.jsxs)(`label`,{className:`block text-xs font-medium text-stone-500`,children:[v(`space.nameLabel`),(0,C.jsx)(`input`,{autoFocus:!0,value:P,disabled:z||M.isPublic===!0,onChange:e=>F(e.target.value),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 disabled:bg-stone-50 disabled:text-stone-400`})]}),M.isPublic?(0,C.jsx)(`p`,{className:`mt-1 text-[11px] text-stone-400`,children:v(`space.publicNameLocked`)}):null,(0,C.jsxs)(`div`,{className:`mt-4 pt-3 border-t border-stone-200`,children:[(0,C.jsx)(`div`,{className:`text-xs font-medium text-stone-500 mb-1.5`,children:v(`space.promptBriefLabel`)}),(0,C.jsx)(_e,{value:I,onChange:e=>{L(e),Ce(!1)},onGenerate:()=>void Me(`edit`),onStop:X,generating:qe,disabled:$||z}),(0,C.jsxs)(`div`,{className:`mt-1.5 flex items-start gap-3`,children:[(0,C.jsx)(`p`,{className:`flex-1 min-w-0 text-[11px] text-stone-400 leading-snug`,children:v(`space.promptBriefHint`)}),qe?(0,C.jsxs)(`p`,{className:`tw-busy-status shrink-0`,"aria-live":`polite`,children:[v(`space.promptGeneratingStatus`),(0,C.jsx)(`span`,{className:`tw-busy-ellipsis`,"aria-hidden":!0})]}):null]}),(0,C.jsx)(ve,{value:be,onChange:R,disabled:$||z,hint:v(`space.promptEditHint`)}),z?(0,C.jsx)(`p`,{className:`mt-2 text-[11px] text-stone-400`,children:v(`space.loading`)}):null]})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,C.jsxs)(`div`,{className:`text-xs font-medium text-stone-500`,children:[v(`space.listTitle`),Z.length?(0,C.jsx)(`span`,{className:`ml-1.5 text-[11px] text-stone-400 tabular-nums`,children:Z.length}):null]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,C.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>Ee.current?.click(),className:`text-xs text-[#4176e6] hover:underline disabled:opacity-40`,children:u===`import`?`…`:v(`space.import`)}),(0,C.jsx)(`input`,{ref:Ee,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:e=>void He(e)}),(0,C.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>void Be(),"data-hint":v(`space.discoverTitle`),"data-hint-always":``,className:`text-xs text-[#4176e6] hover:underline disabled:opacity-40`,children:v(u===`discover`?`space.discovering`:`space.discover`)}),(0,C.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>void Y(!0),"data-hint":v(`space.sizeTitle`),"data-hint-always":``,className:`text-xs text-[#4176e6] hover:underline disabled:opacity-40`,children:v(u===`stats`?`space.sizing`:`space.size`)})]})]}),(0,C.jsx)(`div`,{className:`rounded-lg border border-stone-200 divide-y divide-stone-100 overflow-hidden`,children:Z.length===0?(0,C.jsx)(`div`,{className:`px-3 py-8 text-center text-xs text-stone-400`,children:v(`space.empty`)}):Ge.map(e=>(0,C.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2.5`,children:[(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,C.jsx)(`span`,{className:`text-sm font-medium text-stone-800 truncate`,children:y(e)}),e.isPublic?(0,C.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-px text-[10px] bg-stone-100 text-stone-500`,children:v(`space.builtin`)}):null,e.isActive?(0,C.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-px text-[10px] bg-[#4176e6]/10 text-[#3565c7]`,children:v(`space.activeTag`)}):null,e.exists?null:(0,C.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-px text-[10px] bg-amber-50 text-amber-600`,children:v(`space.missing`)}),e.bytes==null?null:(0,C.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-px text-[10px] bg-stone-100 text-stone-500 tabular-nums`,children:ae(e.bytes)})]}),(0,C.jsx)(`div`,{className:`mt-0.5 text-[11px] text-stone-400 truncate cursor-help hover:text-stone-500`,"data-hint":Q?x(e.path,Q):e.path,"data-hint-always":``,children:Q?x(e.path,Q):e.path})]}),(0,C.jsxs)(`div`,{className:`shrink-0 flex flex-wrap justify-end items-center gap-1`,children:[!e.isActive&&e.exists?(0,C.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>void Le(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 transition-colors`,children:v(`space.switch`)}):null,(0,C.jsx)(`button`,{type:`button`,disabled:$||!e.exists,onClick:()=>void Fe(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 transition-colors`,children:v(`space.edit`)}),(0,C.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>{U(e),we(`${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:v(`space.copy`)}),(0,C.jsx)(`a`,{href:ue(e.id,`content`),"data-hint":v(`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:v(`space.exportContent`)}),(0,C.jsx)(`a`,{href:ue(e.id,`full`),"data-hint":v(`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:v(`space.exportFull`)}),(0,C.jsx)(ge,{hint:e.removable?void 0:v(`space.publicLocked`),children:(0,C.jsx)(`button`,{type:`button`,disabled:!e.removable||$,onClick:()=>V({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:v(`space.removeList`)})}),(0,C.jsx)(ge,{hint:e.removable?void 0:v(`space.publicLocked`),children:(0,C.jsx)(`button`,{type:`button`,disabled:!e.removable||$,onClick:()=>V({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:v(`space.deleteDisk`)})})]})]},e.id))})]})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2 px-5 py-3 border-t border-stone-200`,children:[(0,C.jsx)(`button`,{type:`button`,disabled:$||T||M!==null,onClick:()=>{!T&&M===null&&Ne()},className:`h-8 px-3 text-xs font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-[#4176e6] transition-colors`,children:v(`space.addNew`)}),(0,C.jsx)(`span`,{className:`flex-1`}),T||M?(0,C.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>{X(),E(!1),N(null)},className:`tw-confirm-cancel h-8 px-4 text-sm rounded-lg border border-stone-200 text-stone-600 hover:bg-stone-100 disabled:opacity-40 transition-colors`,children:v(`space.cancel`)}):null,T?(0,C.jsx)(`button`,{type:`button`,disabled:!D.trim()||$,onClick:()=>void Pe(),className:`h-8 px-4 text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40 transition-colors`,children:u===`create`?`…`:v(`space.create`)}):M?(0,C.jsx)(`button`,{type:`button`,disabled:!P.trim()||$||z,onClick:()=>void Ie(),className:`h-8 px-4 text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40 transition-colors`,children:u===`update`?`…`:v(`space.save`)}):null]})]})})]}),(0,C.jsxs)(c,{open:H!==null,onClose:()=>U(null),transition:!0,className:`relative z-96`,children:[(0,C.jsx)(l,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":`true`}),(0,C.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,C.jsxs)(o,{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,C.jsx)(s,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:v(`space.confirmCopyTitle`)}),(0,C.jsx)(`p`,{className:`tw-confirm-msg mt-3 text-sm text-stone-600 leading-relaxed`,children:v(`space.confirmCopyMsg`,{name:H?.name??``})}),(0,C.jsxs)(`label`,{className:`mt-3 block text-xs font-medium text-stone-500`,children:[v(`space.copyName`),(0,C.jsx)(`input`,{autoFocus:!0,value:W,onChange:e=>we(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),Re())},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,C.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,C.jsx)(`button`,{type:`button`,onClick:()=>U(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:v(`space.cancel`)}),(0,C.jsx)(`button`,{type:`button`,disabled:!W.trim()||$,onClick:()=>void Re(),className:`h-8 px-4 text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40 transition-colors`,children:u===`copy`?`…`:v(`space.copy`)})]})]})})]}),(0,C.jsx)(m,{open:B?.kind===`remove`,title:v(`space.confirmRemoveTitle`),message:B?.kind===`remove`?v(`space.confirmRemoveMsg`,{name:B.space.name,path:B.space.path}):``,confirmLabel:v(`space.removeList`),onClose:()=>V(null),onConfirm:()=>{B?.kind===`remove`&&ze(B.space,!1)}}),(0,C.jsx)(m,{open:B?.kind===`delete`,title:v(`space.confirmDeleteTitle`),message:B?.kind===`delete`?v(`space.confirmDeleteMsg`,{name:B.space.name,path:B.space.path}):``,confirmLabel:v(`space.deleteDisk`),danger:`solid`,onClose:()=>V(null),onConfirm:()=>{B?.kind===`delete`&&ze(B.space,!0)}})]})}var T=`tw.spaces.list.v1`;async function E(){let e=n(window.location.pathname,`/`);if(!e?.plugin)return!0;try{let t=await fetch(`/__tb_config`,{signal:AbortSignal.timeout(1500)});if(!t.ok)return!0;let n=await t.json();return a(n.config?.plugins??{})[e.plugin]!==!1}catch{return!0}}function D(){try{let e=sessionStorage.getItem(T);if(!e)return null;let t=JSON.parse(e);return t&&Array.isArray(t.spaces)?t:null}catch{return null}}function O(e){try{sessionStorage.setItem(T,JSON.stringify(e))}catch{}}function k(e){try{e?document.documentElement.dataset.spaceService=`none`:delete document.documentElement.dataset.spaceService}catch{}}function A(){let e=D(),[t,n]=(0,S.useState)(e!==null),[r,i]=(0,S.useState)(e!==null),[a,o]=(0,S.useState)(e),[s,c]=(0,S.useState)(!1),[l,p]=(0,S.useState)(!1),[m,h]=(0,S.useState)(``);(0,S.useEffect)(()=>{let e=!0;return(async()=>{let t=await b();if(!e)return;if(i(!0),!t){n(!1),k(!0);return}k(!1),n(!0);let r=await re();e&&r&&(o(r),O(r))})(),()=>{e=!1}},[]);async function te(e){if(e===a?.activeId)return;p(!0),h(``);let t=await ce(e);t.ok?(a&&O({...a,activeId:e,spaces:a.spaces.map(t=>({...t,isActive:t.id===e}))}),await E()?window.location.reload():window.location.replace(`/`)):(p(!1),h(t.error||`切换失败`))}if(!r)return null;if(!t)return(0,C.jsx)(`div`,{className:`tw-nav-space`,children:(0,C.jsxs)(`div`,{className:`tw-nav-space-btn tw-nav-space-btn--off`,children:[(0,C.jsx)(`span`,{className:`tw-nav-space-ico`,"aria-hidden":`true`,children:(0,C.jsx)(j,{})}),(0,C.jsxs)(`span`,{className:`tw-nav-space-text`,children:[(0,C.jsx)(`span`,{className:`tw-nav-space-cap`,children:v(`space.offlineCap`)}),(0,C.jsx)(`span`,{className:`tw-nav-space-name`,children:v(`space.offline`)})]})]})});let g=a?.spaces.find(e=>e.isActive),_=(a?.spaces??[]).filter(e=>!e.isActive);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`div`,{className:`tw-nav-space`,children:(0,C.jsxs)(d,{as:`div`,className:`tw-nav-space-menu`,children:[(0,C.jsxs)(f,{className:`tw-nav-space-btn`,"data-hint":v(`space.label`),children:[(0,C.jsx)(`span`,{className:`tw-nav-space-ico`,"aria-hidden":`true`,children:(0,C.jsx)(j,{})}),(0,C.jsxs)(`span`,{className:`tw-nav-space-text`,children:[(0,C.jsx)(`span`,{className:`tw-nav-space-cap`,children:v(`space.current`)}),(0,C.jsx)(`span`,{className:`tw-nav-space-name`,children:l?v(`space.switching`):g?y(g):`—`})]}),(0,C.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,C.jsx)(`path`,{d:`m6 9 6 6 6-6`})})]}),(0,C.jsxs)(ee,{transition:!0,anchor:{to:`bottom start`,gap:`0.375rem`},className:`tw-nav-space-pop tw-menu-anim`,children:[m?(0,C.jsx)(`div`,{className:`tw-nav-space-err`,role:`alert`,children:m}):null,(0,C.jsx)(`div`,{className:`tw-nav-space-group`,children:v(`space.others`)}),_.length===0?(0,C.jsx)(`p`,{className:`tw-nav-space-hint`,children:v(`space.othersEmpty`)}):_.map(e=>(0,C.jsx)(u,{children:(0,C.jsxs)(`button`,{type:`button`,className:`tw-nav-space-item`,disabled:l,onClick:()=>void te(e.id),children:[(0,C.jsx)(`span`,{className:`tw-nav-space-item-main`,children:(0,C.jsx)(`span`,{className:`tw-nav-space-item-name`,"data-hint":y(e),children:y(e)})}),(0,C.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,C.jsx)(`path`,{d:`m9 6 6 6-6 6`})})]})},e.id)),(0,C.jsx)(`div`,{className:`tw-nav-space-sep`}),(0,C.jsx)(u,{children:(0,C.jsxs)(`button`,{type:`button`,className:`tw-nav-space-item tw-nav-space-item--manage`,onClick:()=>c(!0),children:[(0,C.jsx)(`span`,{className:`tw-nav-space-item-ico`,"aria-hidden":`true`,children:(0,C.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,C.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,C.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,C.jsx)(`span`,{className:`tw-nav-space-item-main`,children:(0,C.jsx)(`span`,{className:`tw-nav-space-item-name`,children:v(`space.manage`)})}),(0,C.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,C.jsx)(`path`,{d:`m9 6 6 6-6 6`})})]})})]})]})}),(0,C.jsx)(w,{open:s,onClose:()=>c(!1),onListChanged:e=>{o(e),O(e)}})]})}function j(){return(0,C.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`15`,height:`15`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,C.jsx)(`path`,{d:`M3 7.5 12 3l9 4.5-9 4.5-9-4.5Z`}),(0,C.jsx)(`path`,{d:`m3 12.5 9 4.5 9-4.5`}),(0,C.jsx)(`path`,{d:`m3 17 9 4.5 9-4.5`})]})}export{A as default};
|
|
7
|
+
- 只输出提示词正文,不要解释、不要标题。`;function me(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 C=p();function he(e){return e instanceof DOMException&&e.name===`AbortError`||e instanceof Error&&e.name===`AbortError`}function ge({hint:e,children:t}){return e?(0,C.jsx)(`span`,{className:`inline-flex cursor-help`,"data-hint":e,"data-hint-always":``,children:t}):t}function _e(e){let{value:t,onChange:n,onGenerate:r,onStop:i,generating:a,disabled:o}=e,s=(0,S.useRef)(null);(0,S.useLayoutEffect)(()=>{let e=s.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,96)}px`)},[t]);let c=!!t.trim()&&!a&&!o;return(0,C.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,C.jsx)(`textarea`,{ref:s,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{if(e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing){if(e.preventDefault(),a){i();return}c&&r()}},placeholder:v(`space.promptBriefPlaceholder`),rows:1,disabled:o,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,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-2 px-3 pb-2 pt-1`,children:[(0,C.jsx)(`span`,{className:`flex-1`}),(0,C.jsx)(`button`,{type:`button`,onClick:()=>a?i():r(),disabled:!a&&!c,"aria-label":v(a?`space.promptStop`:`space.promptGenerate`),className:`w-7 h-7 shrink-0 rounded-full flex items-center justify-center outline-none transition-colors ${a?`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:a?(0,C.jsx)(`span`,{className:`w-2.5 h-2.5 bg-current rounded-xs`}):(0,C.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,className:`w-4 h-4`,"aria-hidden":!0,children:[(0,C.jsx)(`path`,{d:`m5 12 7-7 7 7`}),(0,C.jsx)(`path`,{d:`M12 19V5`})]})})]})]})}function ve(e){return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2 mb-1.5`,children:[(0,C.jsx)(`label`,{className:`text-xs font-medium text-stone-500`,children:v(`space.promptBodyLabel`)}),(0,C.jsx)(`span`,{className:`text-[11px] text-stone-400 font-mono truncate`,children:g})]}),(0,C.jsx)(`textarea`,{value:e.value,onChange:t=>e.onChange(t.target.value),placeholder:v(`space.promptBodyPlaceholder`),rows:8,disabled:e.disabled,className:`w-full min-h-36 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]`}),(0,C.jsx)(`p`,{className:`mt-1.5 text-[11px] text-stone-400 leading-snug`,children:e.hint??v(`space.promptHint`)})]})}function w({open:e,onClose:t,onListChanged:n}){let[a,ee]=(0,S.useState)(null),[u,d]=(0,S.useState)(null),[f,p]=(0,S.useState)(``),[b,w]=(0,S.useState)(``),[T,E]=(0,S.useState)(!1),[D,O]=(0,S.useState)(``),[k,A]=(0,S.useState)(``),[j,ye]=(0,S.useState)(``),[M,N]=(0,S.useState)(null),[P,F]=(0,S.useState)(``),[I,L]=(0,S.useState)(``),[be,R]=(0,S.useState)(``),[z,xe]=(0,S.useState)(!1),[Se,Ce]=(0,S.useState)(!1),[B,V]=(0,S.useState)(null),[H,U]=(0,S.useState)(null),[W,we]=(0,S.useState)(``),[G,K]=(0,S.useState)([]),[Te,q]=(0,S.useState)({}),Ee=(0,S.useRef)(null),De=(0,S.useRef)(null),Oe=(0,S.useRef)(null),J=(0,S.useRef)(null),[ke,Ae]=(0,S.useState)(null),Y=(0,S.useCallback)(async(e=!1)=>{e&&d(`stats`);let t=await re({stats:e});e&&d(null),t?(ee(t),n?.(t)):p(`无法读取数据空间列表(本地服务未运行?)`)},[n]),je=(0,S.useRef)(Y);(0,S.useEffect)(()=>{je.current=Y},[Y]);function X(){J.current?.abort()}(0,S.useEffect)(()=>{e?(p(``),w(``),E(!1),N(null),je.current(!1)):(X(),E(!1),N(null),Ae(null))},[e]);async function Me(e){if(ke||u!==null)return;let t=(e===`create`?k:I).trim();if(!t){p(v(`space.promptNeedReq`));return}p(``);let n=new AbortController;J.current=n,Ae(e);try{await i();let r=_();if(!r?.apiKey?.trim()||!r.model?.trim()||!r.baseURL?.trim()){p(v(`space.promptNeedModel`));return}let a=(e===`create`?D:P).trim(),o=await h(r,[{role:`system`,content:pe},{role:`user`,content:(a?`空间名称:${a}\n\n`:``)+`用户要求:\n${t}`}],n.signal);if(n.signal.aborted)return;let s=me(o);if(!s){p(v(`space.promptGenEmpty`));return}e===`create`?ye(s):R(s)}catch(e){if(he(e)||n.signal.aborted)return;p(e instanceof Error?e.message:String(e))}finally{J.current===n&&(J.current=null),Ae(null)}}function Ne(){X(),p(``),w(``),O(``),A(``),ye(``),E(!0),requestAnimationFrame(()=>De.current?.scrollIntoView({block:`nearest`}))}async function Pe(){if(u!==null)return;let e=D.trim();if(!e){p(v(`space.needName`));return}X();let t=j.trim(),n=k.trim();d(`create`),p(``);let i=await se(e,{switch:!0,...t?{systemPrompt:t}:{},...n?{promptBrief:n}:{}});if(d(null),!i.ok){p(i.error||v(`space.create`)+` 失败`);return}let a=i.space?.id;a&&r(a),window.location.reload()}async function Fe(e){X(),p(``),w(``),N(e),F(e.name),L(``),Ce(!1),R(``),xe(!0),requestAnimationFrame(()=>Oe.current?.scrollIntoView({block:`nearest`}));let t=await ne(e.id),n=``,r=``;if(t.ok)n=t.brief??``,r=t.systemPrompt??``;else if(e.isActive)try{r=(await te(`prompts`,g)).content.trim()}catch{}if(xe(!1),!t.ok&&!r){N(null),p(t.error||v(`space.detailFailed`));return}t.space&&F(t.space.name),R(r);let i=!n.trim()&&!!r;L(i?r:n),Ce(i)}async function Ie(){if(!M||u!==null)return;let e=P.trim();if(!e){p(v(`space.needName`));return}X(),d(`update`),p(``);let t=await oe(M.id,{name:e,...Se?{}:{brief:I},systemPrompt:be});if(d(null),!t.ok){p(t.error||v(`space.updateFailed`));return}let n=!!(t.space&&t.space.name!==M.name),r=M.isActive;N(null),w(v(`space.updated`,{name:t.space?.name??e})),n&&r?window.location.reload():await Y(!1)}async function Le(e){if(e.isActive||u!==null)return;d(`update`),p(``);let t=await ce(e.id);d(null),t.ok?window.location.reload():p(t.error||`切换失败`)}async function Re(){if(!H)return;let e=W.trim();if(!e)return;d(`copy`),p(``);let t=await de(H.id,e);d(null),t.ok?(U(null),w(`已复制为「${t.space?.name}」`),await Y(!1)):p(t.error||`复制失败`)}async function ze(e,t){d(`delete`),p(``);let n=await le(e.id,t);d(null),n.ok?(V(null),e.isActive?(r(`public`),window.location.reload()):(w(n.warning?n.warning:n.purged?`已删除「${e.name}」及其数据`:`已从列表移除「${e.name}」(数据保留在磁盘)`),await Y(!1))):p(n.error||`删除失败`)}async function Be(){d(`discover`),p(``),w(``),K([]);let e=await ie();if(d(null),!e.ok){p(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(v(`space.discoverAdded`,{n:t})):i.length||a.push(v(`space.discoverNone`)),n&&a.push(v(`space.discoverBackfilled`,{n})),r&&a.push(v(`space.discoverSkipped`,{n:r})),w(a.join(`;`)),K(i),q(Object.fromEntries(i.map(e=>[e.path,e.hasContent===!0]))),await Y(!1)}async function Ve(){let e=G.filter(e=>Te[e.path]).map(e=>e.path);if(!e.length){K([]),w(v(`space.candidatesIgnored`));return}d(`discover`),p(``);let t=await ie(e);if(d(null),!t.ok){p(t.error||`纳入失败`);return}K([]);let n=t.added?.length??0,r=t.skipped??[],i=[n?v(`space.candidatesAdopted`,{n}):v(`space.candidatesIgnored`)];r.length&&i.push(v(`space.candidatesRejected`,{names:r.map(e=>e.reason).join(`、`)})),w(i.join(`;`)),await Y(!1)}async function He(e){let t=e.target.files?.[0];if(e.target.value=``,!t)return;d(`import`),p(``);let n=await fe(t);d(null),n.ok?(w(`已导入为「${n.space?.name}」`),await Y(!1)):p(n.error||`导入失败`)}let Z=a?.spaces??[],Ue=new Map(Z.map((e,t)=>[e.id,t])),We=e=>e.isPublic?0:e.isActive?1:2,Ge=[...Z].sort((e,t)=>We(e)-We(t)||(Ue.get(e.id)??0)-(Ue.get(t.id)??0)),Q=a?.baseRoot,$=u!==null,Ke=ke===`create`,qe=ke===`edit`;return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(c,{open:e,onClose:t,transition:!0,className:`relative z-95`,children:[(0,C.jsx)(l,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":`true`}),(0,C.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,C.jsxs)(o,{transition:!0,className:`tw-dialog-panel-anim tw-space-dialog w-full max-w-4xl rounded-xl shadow-xl border border-stone-200 bg-white flex flex-col h-[86vh]`,children:[(0,C.jsxs)(`div`,{className:`flex items-start justify-between gap-4 px-5 pt-4 pb-3 border-b border-stone-200`,children:[(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(s,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:v(`space.manageTitle`)}),(0,C.jsx)(`p`,{className:`mt-1 text-xs text-stone-500 leading-relaxed`,children:v(`space.manageDesc`)})]}),(0,C.jsx)(`div`,{className:`shrink-0 flex items-center gap-2`,children:(0,C.jsx)(`button`,{type:`button`,onClick:t,className:`tw-confirm-cancel 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,C.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-5 py-4`,children:[f?(0,C.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,C.jsx)(`span`,{className:`flex-1 min-w-0`,children:f}),(0,C.jsx)(`button`,{type:`button`,onClick:()=>p(``),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,b?(0,C.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,C.jsx)(`span`,{className:`flex-1 min-w-0`,children:b}),(0,C.jsx)(`button`,{type:`button`,onClick:()=>w(``),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,G.length?(0,C.jsxs)(`div`,{className:`mb-3 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2.5`,children:[(0,C.jsx)(`div`,{className:`text-xs font-medium text-amber-800`,children:v(`space.candidatesTitle`,{n:G.length})}),(0,C.jsx)(`p`,{className:`mt-1 text-[11px] leading-snug text-amber-700/90`,children:v(`space.candidatesHint`)}),(0,C.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:G.map(e=>(0,C.jsxs)(`label`,{className:`flex items-start gap-2 px-2.5 py-1.5 cursor-pointer hover:bg-stone-50`,children:[(0,C.jsx)(`input`,{type:`checkbox`,checked:Te[e.path]===!0,onChange:t=>q(n=>({...n,[e.path]:t.target.checked})),className:`mt-0.5 accent-[#4176e6]`}),(0,C.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`span`,{className:`block text-xs text-stone-800 truncate`,children:e.name}),(0,C.jsx)(`span`,{className:`block text-[10px] text-stone-400 truncate font-mono`,children:Q?x(e.path,Q):e.path})]})]},e.path))}),(0,C.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,C.jsx)(`button`,{type:`button`,onClick:()=>q(Object.fromEntries(G.map(e=>[e.path,!0]))),className:`text-[11px] text-[#4176e6] hover:underline`,children:v(`space.candidatesSelectAll`)}),(0,C.jsx)(`button`,{type:`button`,onClick:()=>q({}),className:`text-[11px] text-stone-500 hover:underline`,children:v(`space.candidatesClear`)}),(0,C.jsx)(`span`,{className:`flex-1`}),(0,C.jsx)(`button`,{type:`button`,onClick:()=>{K([]),q({}),w(v(`space.candidatesIgnored`))},className:`px-2.5 py-1 text-[11px] rounded-md border border-stone-200 text-stone-600 hover:bg-stone-50`,children:v(`space.candidatesIgnore`)}),(0,C.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>void Ve(),className:`px-2.5 py-1 text-[11px] rounded-md bg-[#4176e6] text-white hover:bg-[#3565c7] disabled:opacity-40`,children:v(`space.candidatesAdopt`)})]})]}):null,T?(0,C.jsxs)(`div`,{ref:De,children:[(0,C.jsxs)(`div`,{className:`mb-2`,children:[(0,C.jsx)(`div`,{className:`text-xs font-medium text-stone-500`,children:v(`space.newTitle`)}),(0,C.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-stone-400`,children:v(`space.newDesc`)})]}),(0,C.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,C.jsx)(`input`,{autoFocus:!0,value:D,onChange:e=>O(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),Pe())},placeholder:v(`space.namePlaceholder`),className:`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`})}),a?(0,C.jsx)(`div`,{className:`mt-1.5 text-[11px] text-stone-400 truncate`,children:(0,C.jsx)(`code`,{children:x(a.dataRoot,a.baseRoot)})}):null,(0,C.jsxs)(`div`,{className:`mt-4 pt-3 border-t border-stone-200`,children:[(0,C.jsx)(`div`,{className:`text-xs font-medium text-stone-500 mb-1.5`,children:v(`space.promptBriefLabel`)}),(0,C.jsx)(_e,{value:k,onChange:A,onGenerate:()=>void Me(`create`),onStop:X,generating:Ke,disabled:$}),(0,C.jsxs)(`div`,{className:`mt-1.5 flex items-start gap-3`,children:[(0,C.jsx)(`p`,{className:`flex-1 min-w-0 text-[11px] text-stone-400 leading-snug`,children:v(`space.promptHint`)}),Ke?(0,C.jsxs)(`p`,{className:`tw-busy-status shrink-0`,"aria-live":`polite`,children:[v(`space.promptGeneratingStatus`),(0,C.jsx)(`span`,{className:`tw-busy-ellipsis`,"aria-hidden":!0})]}):null]}),(0,C.jsx)(ve,{value:j,onChange:ye,disabled:$})]})]}):M?(0,C.jsxs)(`div`,{ref:Oe,children:[(0,C.jsxs)(`div`,{className:`mb-2`,children:[(0,C.jsx)(`div`,{className:`text-xs font-medium text-stone-500`,children:v(`space.editTitle`)}),(0,C.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-stone-400 font-mono truncate`,children:Q?x(M.path,Q):M.path})]}),(0,C.jsxs)(`label`,{className:`block text-xs font-medium text-stone-500`,children:[v(`space.nameLabel`),(0,C.jsx)(`input`,{autoFocus:!0,value:P,disabled:z||M.isPublic===!0,onChange:e=>F(e.target.value),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 disabled:bg-stone-50 disabled:text-stone-400`})]}),M.isPublic?(0,C.jsx)(`p`,{className:`mt-1 text-[11px] text-stone-400`,children:v(`space.publicNameLocked`)}):null,(0,C.jsxs)(`div`,{className:`mt-4 pt-3 border-t border-stone-200`,children:[(0,C.jsx)(`div`,{className:`text-xs font-medium text-stone-500 mb-1.5`,children:v(`space.promptBriefLabel`)}),(0,C.jsx)(_e,{value:I,onChange:e=>{L(e),Ce(!1)},onGenerate:()=>void Me(`edit`),onStop:X,generating:qe,disabled:$||z}),(0,C.jsxs)(`div`,{className:`mt-1.5 flex items-start gap-3`,children:[(0,C.jsx)(`p`,{className:`flex-1 min-w-0 text-[11px] text-stone-400 leading-snug`,children:v(`space.promptBriefHint`)}),qe?(0,C.jsxs)(`p`,{className:`tw-busy-status shrink-0`,"aria-live":`polite`,children:[v(`space.promptGeneratingStatus`),(0,C.jsx)(`span`,{className:`tw-busy-ellipsis`,"aria-hidden":!0})]}):null]}),(0,C.jsx)(ve,{value:be,onChange:R,disabled:$||z,hint:v(`space.promptEditHint`)}),z?(0,C.jsx)(`p`,{className:`mt-2 text-[11px] text-stone-400`,children:v(`space.loading`)}):null]})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,C.jsxs)(`div`,{className:`text-xs font-medium text-stone-500`,children:[v(`space.listTitle`),Z.length?(0,C.jsx)(`span`,{className:`ml-1.5 text-[11px] text-stone-400 tabular-nums`,children:Z.length}):null]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,C.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>Ee.current?.click(),className:`text-xs text-[#4176e6] hover:underline disabled:opacity-40`,children:u===`import`?`…`:v(`space.import`)}),(0,C.jsx)(`input`,{ref:Ee,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:e=>void He(e)}),(0,C.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>void Be(),"data-hint":v(`space.discoverTitle`),"data-hint-always":``,className:`text-xs text-[#4176e6] hover:underline disabled:opacity-40`,children:v(u===`discover`?`space.discovering`:`space.discover`)}),(0,C.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>void Y(!0),"data-hint":v(`space.sizeTitle`),"data-hint-always":``,className:`text-xs text-[#4176e6] hover:underline disabled:opacity-40`,children:v(u===`stats`?`space.sizing`:`space.size`)})]})]}),(0,C.jsx)(`div`,{className:`rounded-lg border border-stone-200 divide-y divide-stone-100 overflow-hidden`,children:Z.length===0?(0,C.jsx)(`div`,{className:`px-3 py-8 text-center text-xs text-stone-400`,children:v(`space.empty`)}):Ge.map(e=>(0,C.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2.5`,children:[(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,C.jsx)(`span`,{className:`text-sm font-medium text-stone-800 truncate`,children:y(e)}),e.isPublic?(0,C.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-px text-[10px] bg-stone-100 text-stone-500`,children:v(`space.builtin`)}):null,e.isActive?(0,C.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-px text-[10px] bg-[#4176e6]/10 text-[#3565c7]`,children:v(`space.activeTag`)}):null,e.exists?null:(0,C.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-px text-[10px] bg-amber-50 text-amber-600`,children:v(`space.missing`)}),e.bytes==null?null:(0,C.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-px text-[10px] bg-stone-100 text-stone-500 tabular-nums`,children:ae(e.bytes)})]}),(0,C.jsx)(`div`,{className:`mt-0.5 text-[11px] text-stone-400 truncate cursor-help hover:text-stone-500`,"data-hint":Q?x(e.path,Q):e.path,"data-hint-always":``,children:Q?x(e.path,Q):e.path})]}),(0,C.jsxs)(`div`,{className:`shrink-0 flex flex-wrap justify-end items-center gap-1`,children:[!e.isActive&&e.exists?(0,C.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>void Le(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 transition-colors`,children:v(`space.switch`)}):null,(0,C.jsx)(`button`,{type:`button`,disabled:$||!e.exists,onClick:()=>void Fe(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 transition-colors`,children:v(`space.edit`)}),(0,C.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>{U(e),we(`${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:v(`space.copy`)}),(0,C.jsx)(`a`,{href:ue(e.id,`content`),"data-hint":v(`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:v(`space.exportContent`)}),(0,C.jsx)(`a`,{href:ue(e.id,`full`),"data-hint":v(`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:v(`space.exportFull`)}),(0,C.jsx)(ge,{hint:e.removable?void 0:v(`space.publicLocked`),children:(0,C.jsx)(`button`,{type:`button`,disabled:!e.removable||$,onClick:()=>V({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:v(`space.removeList`)})}),(0,C.jsx)(ge,{hint:e.removable?void 0:v(`space.publicLocked`),children:(0,C.jsx)(`button`,{type:`button`,disabled:!e.removable||$,onClick:()=>V({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:v(`space.deleteDisk`)})})]})]},e.id))})]})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2 px-5 py-3 border-t border-stone-200`,children:[(0,C.jsx)(`button`,{type:`button`,disabled:$||T||M!==null,onClick:()=>{!T&&M===null&&Ne()},className:`h-8 px-3 text-xs font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-[#4176e6] transition-colors`,children:v(`space.addNew`)}),(0,C.jsx)(`span`,{className:`flex-1`}),T||M?(0,C.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>{X(),E(!1),N(null)},className:`tw-confirm-cancel h-8 px-4 text-sm rounded-lg border border-stone-200 text-stone-600 hover:bg-stone-100 disabled:opacity-40 transition-colors`,children:v(`space.cancel`)}):null,T?(0,C.jsx)(`button`,{type:`button`,disabled:!D.trim()||$,onClick:()=>void Pe(),className:`h-8 px-4 text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40 transition-colors`,children:u===`create`?`…`:v(`space.create`)}):M?(0,C.jsx)(`button`,{type:`button`,disabled:!P.trim()||$||z,onClick:()=>void Ie(),className:`h-8 px-4 text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40 transition-colors`,children:u===`update`?`…`:v(`space.save`)}):null]})]})})]}),(0,C.jsxs)(c,{open:H!==null,onClose:()=>U(null),transition:!0,className:`relative z-96`,children:[(0,C.jsx)(l,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":`true`}),(0,C.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,C.jsxs)(o,{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,C.jsx)(s,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:v(`space.confirmCopyTitle`)}),(0,C.jsx)(`p`,{className:`tw-confirm-msg mt-3 text-sm text-stone-600 leading-relaxed`,children:v(`space.confirmCopyMsg`,{name:H?.name??``})}),(0,C.jsxs)(`label`,{className:`mt-3 block text-xs font-medium text-stone-500`,children:[v(`space.copyName`),(0,C.jsx)(`input`,{autoFocus:!0,value:W,onChange:e=>we(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),Re())},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,C.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,C.jsx)(`button`,{type:`button`,onClick:()=>U(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:v(`space.cancel`)}),(0,C.jsx)(`button`,{type:`button`,disabled:!W.trim()||$,onClick:()=>void Re(),className:`h-8 px-4 text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40 transition-colors`,children:u===`copy`?`…`:v(`space.copy`)})]})]})})]}),(0,C.jsx)(m,{open:B?.kind===`remove`,title:v(`space.confirmRemoveTitle`),message:B?.kind===`remove`?v(`space.confirmRemoveMsg`,{name:B.space.name,path:B.space.path}):``,confirmLabel:v(`space.removeList`),onClose:()=>V(null),onConfirm:()=>{B?.kind===`remove`&&ze(B.space,!1)}}),(0,C.jsx)(m,{open:B?.kind===`delete`,title:v(`space.confirmDeleteTitle`),message:B?.kind===`delete`?v(`space.confirmDeleteMsg`,{name:B.space.name,path:B.space.path}):``,confirmLabel:v(`space.deleteDisk`),danger:`solid`,onClose:()=>V(null),onConfirm:()=>{B?.kind===`delete`&&ze(B.space,!0)}})]})}var T=`tw.spaces.list.v1`;async function E(){let e=n(window.location.pathname,`/`);if(!e?.plugin)return!0;try{let t=await fetch(`/__tb_config`,{signal:AbortSignal.timeout(1500)});if(!t.ok)return!0;let n=await t.json();return a(n.config?.plugins??{})[e.plugin]!==!1}catch{return!0}}function D(){try{let e=sessionStorage.getItem(T);if(!e)return null;let t=JSON.parse(e);return t&&Array.isArray(t.spaces)?t:null}catch{return null}}function O(e){try{sessionStorage.setItem(T,JSON.stringify(e))}catch{}}function k(e){try{e?document.documentElement.dataset.spaceService=`none`:delete document.documentElement.dataset.spaceService}catch{}}function A(){let e=D(),[t,n]=(0,S.useState)(e!==null),[r,i]=(0,S.useState)(e!==null),[a,o]=(0,S.useState)(e),[s,c]=(0,S.useState)(!1),[l,p]=(0,S.useState)(!1),[m,h]=(0,S.useState)(``);(0,S.useEffect)(()=>{let e=!0;return(async()=>{let t=await b();if(!e)return;if(i(!0),!t){n(!1),k(!0);return}k(!1),n(!0);let r=await re();e&&r&&(o(r),O(r))})(),()=>{e=!1}},[]);async function te(e){if(e===a?.activeId)return;p(!0),h(``);let t=await ce(e);t.ok?(a&&O({...a,activeId:e,spaces:a.spaces.map(t=>({...t,isActive:t.id===e}))}),await E()?window.location.reload():window.location.replace(`/workbench/`)):(p(!1),h(t.error||`切换失败`))}if(!r)return null;if(!t)return(0,C.jsx)(`div`,{className:`tw-nav-space`,children:(0,C.jsxs)(`div`,{className:`tw-nav-space-btn tw-nav-space-btn--off`,children:[(0,C.jsx)(`span`,{className:`tw-nav-space-ico`,"aria-hidden":`true`,children:(0,C.jsx)(j,{})}),(0,C.jsxs)(`span`,{className:`tw-nav-space-text`,children:[(0,C.jsx)(`span`,{className:`tw-nav-space-cap`,children:v(`space.offlineCap`)}),(0,C.jsx)(`span`,{className:`tw-nav-space-name`,children:v(`space.offline`)})]})]})});let g=a?.spaces.find(e=>e.isActive),_=(a?.spaces??[]).filter(e=>!e.isActive);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`div`,{className:`tw-nav-space`,children:(0,C.jsxs)(d,{as:`div`,className:`tw-nav-space-menu`,children:[(0,C.jsxs)(f,{className:`tw-nav-space-btn`,"data-hint":v(`space.label`),children:[(0,C.jsx)(`span`,{className:`tw-nav-space-ico`,"aria-hidden":`true`,children:(0,C.jsx)(j,{})}),(0,C.jsxs)(`span`,{className:`tw-nav-space-text`,children:[(0,C.jsx)(`span`,{className:`tw-nav-space-cap`,children:v(`space.current`)}),(0,C.jsx)(`span`,{className:`tw-nav-space-name`,children:l?v(`space.switching`):g?y(g):`—`})]}),(0,C.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,C.jsx)(`path`,{d:`m6 9 6 6 6-6`})})]}),(0,C.jsxs)(ee,{transition:!0,anchor:{to:`bottom start`,gap:`0.375rem`},className:`tw-nav-space-pop tw-menu-anim`,children:[m?(0,C.jsx)(`div`,{className:`tw-nav-space-err`,role:`alert`,children:m}):null,(0,C.jsx)(`div`,{className:`tw-nav-space-group`,children:v(`space.others`)}),_.length===0?(0,C.jsx)(`p`,{className:`tw-nav-space-hint`,children:v(`space.othersEmpty`)}):_.map(e=>(0,C.jsx)(u,{children:(0,C.jsxs)(`button`,{type:`button`,className:`tw-nav-space-item`,disabled:l,onClick:()=>void te(e.id),children:[(0,C.jsx)(`span`,{className:`tw-nav-space-item-main`,children:(0,C.jsx)(`span`,{className:`tw-nav-space-item-name`,"data-hint":y(e),children:y(e)})}),(0,C.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,C.jsx)(`path`,{d:`m9 6 6 6-6 6`})})]})},e.id)),(0,C.jsx)(`div`,{className:`tw-nav-space-sep`}),(0,C.jsx)(u,{children:(0,C.jsxs)(`button`,{type:`button`,className:`tw-nav-space-item tw-nav-space-item--manage`,onClick:()=>c(!0),children:[(0,C.jsx)(`span`,{className:`tw-nav-space-item-ico`,"aria-hidden":`true`,children:(0,C.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,C.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,C.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,C.jsx)(`span`,{className:`tw-nav-space-item-main`,children:(0,C.jsx)(`span`,{className:`tw-nav-space-item-name`,children:v(`space.manage`)})}),(0,C.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,C.jsx)(`path`,{d:`m9 6 6 6-6 6`})})]})})]})]})}),(0,C.jsx)(w,{open:s,onClose:()=>c(!1),onListChanged:e=>{o(e),O(e)}})]})}function j(){return(0,C.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`15`,height:`15`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,C.jsx)(`path`,{d:`M3 7.5 12 3l9 4.5-9 4.5-9-4.5Z`}),(0,C.jsx)(`path`,{d:`m3 12.5 9 4.5 9-4.5`}),(0,C.jsx)(`path`,{d:`m3 17 9 4.5 9-4.5`})]})}export{A as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{t as n}from"./react-dom.DLW9pGCF.js";import{t as r}from"./jsx-runtime.DUg_B_vD.js";var i=e(t(),1),a=e(n(),1),o=r(),s=[{key:`blue`,className:`bg-[#d6e8ff] text-[#245bcc]`},{key:`orange`,className:`bg-[#ffe4c8] text-[#9a5b00]`},{key:`teal`,className:`bg-[#ccf1f0] text-[#0f6b6a]`},{key:`yellow`,className:`bg-[#fff3c4] text-[#7a5c00]`},{key:`green`,className:`bg-[#d3f5dd] text-[#1b6b38]`},{key:`pink`,className:`bg-[#ffd9de] text-[#a12a3a]`},{key:`purple`,className:`bg-[#e6ddff] text-[#5b3bb3]`},{key:`gray`,className:`bg-stone-100 text-stone-600`}];function c(e){let t=0;for(let n of e)t=t*31+(n.codePointAt(0)??0)>>>0;return s[t%s.length]}function l(e){let t=c(e.label),n=e.hint!==!1&&!e.wrap;return(0,o.jsxs)(`span`,{"data-tag-tone":t.key,className:`tw-tag-pill inline-flex max-w-full min-w-0 items-center gap-1 rounded px-1.5 py-0.5 text-xs font-medium ${e.muted?`bg-stone-100 text-stone-500`:t.className}`,children:[(0,o.jsx)(`span`,{className:e.wrap?`min-w-0 break-words whitespace-normal`:`truncate`,"data-hint":n?e.label:void 0,"data-hint-fit":n?``:void 0,children:e.label}),e.onRemove?(0,o.jsx)(`span`,{role:`button`,tabIndex:-1,"aria-label":`移除 ${e.label}`,onClick:t=>{t.stopPropagation(),e.onRemove?.()},className:`-mr-0.5 flex h-3.5 w-3.5 shrink-0 cursor-pointer items-center justify-center rounded-sm opacity-60 hover:bg-black/10 hover:opacity-100`,children:`×`}):null]})}function u(e){let{options:t,selected:n,creatable:r,query:a}=e,s=a.trim(),c=(0,i.useMemo)(()=>{let e=s.toLowerCase();return e?t.filter(t=>t.toLowerCase().includes(e)):[...t]},[t,s]),u=r&&s.length>0&&!t.includes(s);return(0,o.jsxs)(`div`,{className:`flex max-h-72 flex-col`,children:[(0,o.jsx)(`div`,{className:`p-1 pb-0`,children:(0,o.jsx)(`input`,{autoFocus:!0,value:a,onChange:t=>e.onQuery(t.target.value),onKeyDown:t=>{if(t.key===`Escape`){t.preventDefault(),t.stopPropagation(),e.onQuery(``),e.onClear();return}if(t.key!==`Enter`)return;if(t.preventDefault(),u){e.onPick(s);return}let n=c[0];n&&e.onPick(n)},placeholder:`查找或创建选项`,className:`h-8 w-full rounded-md border border-stone-200 bg-white px-2 text-sm text-stone-800 outline-none placeholder:text-stone-400 focus:border-[#3370ff]`})}),(0,o.jsxs)(`div`,{className:`mt-1 min-h-0 flex-1 overflow-auto p-1`,children:[u?(0,o.jsxs)(`button`,{type:`button`,onClick:()=>e.onPick(s),className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-stone-500 hover:bg-stone-50`,children:[(0,o.jsx)(`span`,{className:`text-stone-400`,children:`+`}),(0,o.jsxs)(`span`,{className:`truncate`,children:[`创建「`,s,`」`]})]}):null,c.map(t=>{let r=n.includes(t);return(0,o.jsxs)(`button`,{type:`button`,onClick:()=>e.onPick(t),className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-stone-50 ${r?`bg-stone-50`:``}`,children:[(0,o.jsx)(l,{label:t,wrap:!0}),r?(0,o.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-[#3370ff]`,children:`✓`}):null]},t)}),c.length===0&&!u?(0,o.jsx)(`div`,{className:`px-2 py-2 text-sm text-stone-400`,children:`无匹配项`}):null]})]})}function d(){let e=(0,i.useRef)(null),t=(0,i.useRef)(null),[n,r]=(0,i.useState)(!1),[a,o]=(0,i.useState)(``),[s,c]=(0,i.useState)({left:0,top:0,width:220,openUp:!1});(0,i.useEffect)(()=>{if(!n)return;let i=n=>{let i=n.target;e.current?.contains(i)||t.current?.contains(i)||(r(!1),o(``))},a=e=>{e.target instanceof Node&&t.current?.contains(e.target)||(r(!1),o(``))},s=()=>r(!1);return document.addEventListener(`mousedown`,i,!0),window.addEventListener(`scroll`,a,!0),window.addEventListener(`resize`,s),()=>{document.removeEventListener(`mousedown`,i,!0),window.removeEventListener(`scroll`,a,!0),window.removeEventListener(`resize`,s)}},[n]);function l(){if(n){r(!1),o(``);return}let t=e.current;if(!t)return;let i=t.getBoundingClientRect(),a=Math.max(i.width,240),s=Math.min(i.left,Math.max(8,window.innerWidth-a-8)),l=i.bottom+4,u=l+280>window.innerHeight&&i.top>280;c({left:s,top:u?i.top-4:l,width:a,openUp:u}),o(``),r(!0)}return{triggerRef:e,panelRef:t,open:n,setOpen:r,query:a,setQuery:o,anchor:s,toggle:l}}function f(e){return(0,o.jsx)(`div`,{role:`button`,tabIndex:0,"aria-label":e.ariaLabel,"aria-expanded":e.open,onClick:e.onClick,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),e.onClick())},className:`flex w-full cursor-pointer items-center gap-1 rounded-md border border-transparent text-sm transition-colors hover:border-stone-200 focus:border-[#3370ff] focus:outline-none ${e.compact?`min-h-8 px-1.5 py-1`:`min-h-9 px-2 py-1`}`,children:e.children})}function p(e){let t=d(),{value:n,onChange:r}=e;function i(e){r(e),t.setOpen(!1),t.setQuery(``)}let s=t.open&&typeof document<`u`?(0,a.createPortal)((0,o.jsxs)(`div`,{ref:t.panelRef,className:`tw-select-menu tw-popover-anim fixed z-[1000] rounded-lg p-1 shadow-lg ring-1 ring-stone-200`,style:{left:t.anchor.left,width:t.anchor.width,...t.anchor.openUp?{bottom:window.innerHeight-t.anchor.top}:{top:t.anchor.top}},children:[(0,o.jsx)(u,{options:e.options,selected:n?[n]:[],creatable:e.creatable!==!1,query:t.query,onQuery:t.setQuery,onPick:i,onClear:()=>t.setOpen(!1)}),n?(0,o.jsx)(`button`,{type:`button`,onClick:()=>i(``),className:`mt-1 w-full rounded-md border-t border-stone-100 px-2 py-1.5 text-left text-xs text-stone-400 hover:bg-stone-50 hover:text-stone-600`,children:`清除选择`}):null]}),document.body):null;return(0,o.jsxs)(`div`,{ref:t.triggerRef,className:e.className,children:[(0,o.jsxs)(f,{ariaLabel:e.ariaLabel,compact:e.compact,open:t.open,onClick:()=>{e.disabled||t.toggle()},children:[(0,o.jsx)(`span`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-1`,children:n?(0,o.jsx)(l,{label:n,onRemove:()=>{r(``)}}):(0,o.jsx)(`span`,{className:`truncate text-stone-300`,children:e.placeholder??`查找或创建选项`})}),(0,o.jsx)(`svg`,{className:`h-3.5 w-3.5 shrink-0 text-stone-400`,viewBox:`0 0 20 20`,fill:`currentColor`,"aria-hidden":`true`,children:(0,o.jsx)(`path`,{fillRule:`evenodd`,d:`M5.23 7.21a.75.75 0 011.06.02L10 11.17l3.71-3.94a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z`,clipRule:`evenodd`})})]}),s]})}export{p as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.BUPzGl9f.js";import{i as r,o as i,s as ee}from"./plugins.C2BMfzv1.js";import{a,n as o,o as s,r as c}from"./view-prefs.BEAZRcxF.js";import{i as l,n as u,r as d,t as f}from"./dialog.BAPTk9a_.js";import{t as p}from"./jsx-runtime.DUg_B_vD.js";import{t as m}from"./ConfirmDialog.BZzZWDci.js";import{n as h,t as g}from"./ColumnResize.BEkEW7qw.js";import{t as _}from"./DatePicker.Bkl71M49.js";import{t as v}from"./SelectDropdown.CuuDHa8s.js";import{A as y,C as b,D as x,P as te,a as S,b as C,c as w,f as ne,g as T,h as re,i as E,m as D,n as O,o as ie,p as ae,r as oe,s as se,t as k,u as ce}from"./tasks.otRBFydq.js";import{a as A,l as j,n as M,o as N,r as P,s as F,t as I}from"./DrawerField.CHRg77LG.js";var L=e(t(),1),R=p(),le=8e3,z=[{key:`title`,min:200},{key:`status`,width:104,min:80},{key:`priority`,width:104,min:88},{key:`start`,width:108,min:88},{key:`due`,width:108,min:88},{key:`cycle`,width:76,min:60},{key:`todos`,width:84,min:68},{key:`progress`,width:132,min:104},{key:`note`,width:140,min:88},{key:`action`,width:56,min:52}],ue={pool:`bg-stone-100 text-stone-600`,in_progress:`bg-[#e1eaff] text-[#1f4ec2]`,done:`bg-[#d9f5d2] text-[#1d7a12]`,closed:`bg-stone-100 text-stone-400`,cancelled:`bg-stone-100 text-stone-400 line-through`},de={urgent_important:`bg-[#f54a45] text-white`,important:`bg-[#ff8800] text-white`,urgent:`bg-[#f7ba1e] text-stone-800`,normal:`bg-stone-200 text-stone-600`,"":`bg-transparent text-stone-400`},B={pending:`bg-stone-100 text-stone-600`,in_progress:`bg-[#e1eaff] text-[#1f4ec2]`,done:`bg-[#d9f5d2] text-[#1d7a12]`,cancelled:`bg-stone-100 text-stone-400`,overdue:`bg-[#fee4e3] text-[#c02a26]`},V={pool:`bg-stone-400`,in_progress:`bg-[#3370ff]`,done:`bg-[#34c724]`,closed:`bg-stone-300`,cancelled:`bg-stone-300`},H={urgent_important:`bg-[#f54a45]`,important:`bg-[#ff8800]`,urgent:`bg-[#f7ba1e]`,normal:`bg-stone-300`,"":`border border-stone-300 bg-transparent`},U=oe.map(e=>({value:e,label:E[e]})),fe=[{value:``,label:`未设置`},...k.map(e=>({value:e,label:O[e]}))],pe=[{value:`all`,label:`全部优先级`},...k.map(e=>({value:e,label:O[e]}))],me=[{value:`all`,label:`全部`},{value:`pool`,label:`任务池`},{value:`in_progress`,label:`进行中`},{value:`done`,label:`已完成`},{value:`closed`,label:`已关闭`},{value:`cancelled`,label:`已取消`}],he=[`all`,`pool`,`in_progress`,`done`,`closed`,`cancelled`],ge=`tasks.status-tab`,_e=`tasks.priority-filter`,ve=`tasks.search`,ye=pe.map(e=>e.value);function W(e){return(0,R.jsxs)(`div`,{"data-tone":e.tone,className:`tw-stat-card flex min-w-0 flex-col gap-1 rounded-xl border px-4 py-3 ${e.tone===`urgent`?`border-red-100 bg-red-50/60`:`border-stone-200 bg-white`}`,children:[(0,R.jsx)(`span`,{className:`text-2xl font-semibold tabular-nums ${e.tone===`urgent`?`text-[#c02a26]`:`text-stone-900`}`,children:e.value}),(0,R.jsx)(`span`,{className:`truncate text-xs text-stone-500`,children:e.label})]})}function be(e){let{open:t,task:n,todos:r,onClose:i,onSaved:ee}=e,[a,o]=(0,L.useState)({title:``}),[s,c]=(0,L.useState)(``),[p,m]=(0,L.useState)(!1);(0,L.useEffect)(()=>{t&&(c(``),m(!1),o(n?{title:n.title,status:n.status,priority:n.priority,startDate:n.startDate,dueDate:n.dueDate,note:n.note}:{title:``,status:`pool`,priority:``,startDate:y(),dueDate:y()}))},[t,n]);function h(e){o(t=>({...t,...e}))}let g=D({startDate:a.startDate??``,dueDate:a.dueDate??``}),v=n?r.filter(e=>e.taskId===n.id):[],x=v.filter(e=>e.status===`done`).length,te=v.length?Math.round(x/v.length*100):0;async function w(){let e=(a.title??``).trim();if(!e)c(`请填写任务名称`);else if(a.startDate&&a.dueDate&&a.dueDate<a.startDate)c(`截止日期不能早于开始日期`);else{m(!0),c(``);try{n?await T(n.id,a):await S([{...a,title:e}],{mode:`manual`}),await ee(),i()}catch(e){c(e instanceof Error?e.message:String(e))}finally{m(!1)}}}return(0,R.jsxs)(d,{open:t,onClose:i,transition:!0,className:`relative z-100`,children:[(0,R.jsx)(f,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/25`,"aria-hidden":`true`}),(0,R.jsx)(`div`,{className:`fixed inset-0 flex justify-end`,children:(0,R.jsxs)(l,{transition:!0,className:`tw-drawer-panel-anim flex h-full w-full max-w-[520px] flex-col border-l border-stone-200 bg-white shadow-2xl`,children:[(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-stone-100 px-6 py-4`,children:[(0,R.jsx)(u,{className:`text-base font-semibold text-stone-900`,children:n?`任务详情`:`新建任务`}),(0,R.jsx)(`button`,{type:`button`,onClick:i,"aria-label":`关闭`,className:`flex h-7 w-7 items-center justify-center rounded-md text-stone-400 transition-colors hover:bg-stone-100 hover:text-stone-700`,children:`✕`})]}),(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-3`,children:[(0,R.jsx)(M,{icon:(0,R.jsx)(j,{}),label:`任务名称`,children:(0,R.jsx)(`input`,{autoFocus:!0,value:a.title,onChange:e=>h({title:e.target.value}),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),w())},placeholder:`请输入内容`,className:I})}),(0,R.jsx)(M,{icon:(0,R.jsx)(F,{}),label:`任务状态`,children:(0,R.jsx)(P,{ariaLabel:`任务状态`,menuMinWidth:140,options:U,value:a.status??`pool`,onChange:e=>h({status:e}),label:E[a.status??`pool`],optionDotClassName:e=>V[e]})}),(0,R.jsx)(M,{icon:(0,R.jsx)(F,{}),label:`紧急程度`,children:(0,R.jsx)(P,{ariaLabel:`紧急程度`,menuMinWidth:140,options:fe,value:a.priority??``,onChange:e=>h({priority:e}),label:a.priority?O[a.priority]:`未设置`,optionDotClassName:e=>H[e]})}),(0,R.jsx)(M,{icon:(0,R.jsx)(A,{}),label:`开始日期`,children:(0,R.jsx)(_,{value:a.startDate??``,onChange:e=>h({startDate:e}),className:`${I} tabular-nums`})}),(0,R.jsx)(M,{icon:(0,R.jsx)(A,{}),label:`截止日期`,children:(0,R.jsx)(_,{value:a.dueDate??``,onChange:e=>h({dueDate:e}),className:`${I} tabular-nums`})}),(0,R.jsx)(M,{icon:(0,R.jsx)(N,{}),label:`任务周期`,children:(0,R.jsx)(`div`,{className:`px-2 pt-1.5 text-sm text-stone-500`,children:g===null?`—`:`${g} 天`})}),(0,R.jsx)(M,{icon:(0,R.jsx)(N,{}),label:`待办进度`,children:(0,R.jsx)(`div`,{className:`px-2 pt-1.5 text-sm text-stone-500`,children:v.length?`${x}/${v.length} · ${te}%`:`还没有关联待办`})}),(0,R.jsx)(M,{icon:(0,R.jsx)(j,{}),label:`备注`,children:(0,R.jsx)(`textarea`,{value:a.note??``,onChange:e=>h({note:e.target.value}),rows:4,placeholder:`请输入内容`,className:`w-full resize-y rounded-md border border-transparent bg-transparent px-2 py-1.5 text-sm text-stone-800 outline-none transition-colors hover:border-stone-200 focus:border-[#3370ff] focus:bg-white placeholder:text-stone-400`})}),n&&v.length?(0,R.jsxs)(`div`,{className:`mx-6 mt-2 rounded-lg border border-stone-100 bg-stone-50/60 px-3 py-2`,children:[(0,R.jsx)(`div`,{className:`mb-1.5 text-xs font-medium text-stone-500`,children:`关联待办`}),(0,R.jsx)(`ul`,{className:`space-y-1.5`,children:v.map(e=>{let t=b(e,y());return(0,R.jsxs)(`li`,{className:`flex items-center gap-2 text-sm text-stone-700`,children:[(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),(0,R.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${B[t]}`,children:C[t]})]},e.id)})})]}):null,s?(0,R.jsx)(`div`,{className:`mx-6 mt-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700`,children:s}):null]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-stone-100 px-6 py-3`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:i,disabled:p,className:`h-8 rounded-lg border border-stone-200 px-4 text-sm text-stone-600 transition-colors hover:bg-stone-100 disabled:opacity-40`,children:`取消`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void w(),disabled:p,className:`h-8 rounded-lg bg-[#3370ff] px-4 text-sm font-medium text-white transition-colors hover:bg-[#2b5fd9] disabled:opacity-40`,children:p?`保存中…`:n?`保存`:`新建`})]})]})})]})}function xe(){let[e,t]=(0,L.useState)(!1),[l,u]=(0,L.useState)(!0),[d,f]=(0,L.useState)(!0),[p,y]=(0,L.useState)(null),[b,S]=(0,L.useState)([]),[C,oe]=(0,L.useState)([]),[k,A]=(0,L.useState)(null),[j,M]=(0,L.useState)(!1),[N,P]=(0,L.useState)(()=>c(ve)),[F,I]=(0,L.useState)(()=>o(ge,he,`all`)),[B,xe]=(0,L.useState)(()=>o(_e,ye,`all`)),[Se,G]=(0,L.useState)(null),[K,q]=(0,L.useState)(null);function Ce(e){a(ge,e),I(e)}function we(e){s(ve,e),P(e)}function Te(e){a(_e,e),xe(e)}let J=(0,L.useRef)(!0),Y=h(`lh:tasks:cols:v1`,z);(0,L.useEffect)(()=>(J.current=!0,()=>{J.current=!1}),[]);let X=(0,L.useCallback)(async()=>{try{let[e,t]=await Promise.all([ce(),d?x().catch(()=>[]):Promise.resolve([])]);if(!J.current)return;S(e),oe(t),A(null)}catch(e){if(!J.current)return;A(e instanceof Error?e.message:String(e))}},[d]);(0,L.useEffect)(()=>{let e=i(e=>{u(!!e.tasks),f(!!e.todos)});return n().then(()=>{u(r(`tasks`)),f(r(`todos`)),t(!0)}),e},[]),(0,L.useEffect)(()=>{e&&l&&(async()=>{let e=await se();J.current&&(e?(await X(),J.current&&y(!0)):y(!1))})()},[e,l,X]),(0,L.useEffect)(()=>{if(p!==!0)return;let e=window.setInterval(()=>void X(),le),t=()=>void X();return window.addEventListener(`focus`,t),()=>{window.clearInterval(e),window.removeEventListener(`focus`,t)}},[p,X]);let Ee=(0,L.useMemo)(()=>re(C),[C]),Z=(0,L.useMemo)(()=>ae(b),[b]),De=(0,L.useMemo)(()=>w(b,{status:F,priority:B,keyword:N}),[b,F,B,N]),Q=(0,L.useMemo)(()=>ne(De),[De]);async function $(e,t){S(n=>n.map(n=>n.id===e?{...n,...t}:n));try{let n=await T(e,t);if(!J.current)return;S(t=>t.map(t=>t.id===e?n:t)),A(null)}catch(e){A(e instanceof Error?e.message:String(e)),await X()}}async function Oe(){let e=K;if(e){q(null),M(!0);try{await ie([e.id]),await Promise.all(C.filter(t=>t.taskId===e.id).map(e=>te(e.id,{taskId:``,linkedTask:``}).catch(()=>null))),await X()}catch(e){A(e instanceof Error?e.message:String(e))}finally{J.current&&M(!1)}}}return e?l?p===null?(0,R.jsx)(`div`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,"aria-busy":`true`,"aria-label":`正在连接任务服务`,children:(0,R.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center`,children:(0,R.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):p?(0,R.jsxs)(`section`,{className:`flex min-h-0 flex-col gap-4`,children:[(0,R.jsxs)(`div`,{className:`grid shrink-0 grid-cols-2 gap-3 sm:grid-cols-3 xl:grid-cols-7`,children:[(0,R.jsx)(W,{label:`全部任务`,value:Z.total}),(0,R.jsx)(W,{label:`任务池`,value:Z.pool}),(0,R.jsx)(W,{label:`进行中`,value:Z.in_progress}),(0,R.jsx)(W,{label:`已完成`,value:Z.done}),(0,R.jsx)(W,{label:`已关闭`,value:Z.closed}),(0,R.jsx)(W,{label:`已取消`,value:Z.cancelled}),(0,R.jsx)(W,{label:`需要紧急`,value:Z.urgent,tone:`urgent`})]}),(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,R.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-stone-100 px-4 py-3`,children:[(0,R.jsx)(`input`,{value:N,onChange:e=>we(e.target.value),placeholder:`搜索任务…`,className:`h-9 w-52 rounded-lg border border-stone-200 px-3 text-sm text-stone-800 outline-none focus:border-[#3370ff]`}),(0,R.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg bg-stone-100/80 p-0.5`,children:me.map(e=>(0,R.jsx)(`button`,{type:`button`,onClick:()=>Ce(e.value),className:`h-8 rounded-md px-3 text-sm transition-colors ${F===e.value?`bg-white font-medium text-stone-900 shadow-sm`:`text-stone-600 hover:text-stone-900`}`,children:e.label},e.value))}),(0,R.jsx)(v,{flat:!0,className:`w-[136px]`,ariaLabel:`优先级筛选`,options:pe,value:B,onChange:e=>Te(e)}),(0,R.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>void X(),"aria-label":`刷新`,className:`flex h-9 w-9 items-center justify-center rounded-lg border border-stone-200 text-stone-500 transition-colors hover:bg-stone-50 hover:text-stone-800`,children:(0,R.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,R.jsx)(`path`,{d:`M21 12a9 9 0 1 1-3-6.7`}),(0,R.jsx)(`path`,{d:`M21 4v5h-5`})]})}),(0,R.jsx)(`button`,{type:`button`,disabled:j,onClick:()=>G({task:null}),className:`h-9 shrink-0 rounded-lg bg-[#3370ff] px-3 text-sm font-medium whitespace-nowrap text-white transition-colors hover:bg-[#2b5fd9] disabled:opacity-40`,children:`+ 新建任务`})]})]}),k?(0,R.jsxs)(`div`,{className:`mx-4 mt-3 flex shrink-0 items-start gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700`,children:[(0,R.jsx)(`span`,{className:`min-w-0 flex-1`,children:k}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>A(null),"aria-label":`关闭`,className:`-mr-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded text-red-700/70 hover:bg-red-100 hover:text-red-900`,children:`✕`})]}):null,(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,R.jsxs)(`table`,{className:`tw-task-table w-full table-fixed border-collapse text-sm`,style:Y.tableStyle,children:[(0,R.jsx)(`colgroup`,{children:z.map(e=>(0,R.jsx)(`col`,{style:Y.widthOf(e.key)?{width:Y.widthOf(e.key)}:void 0},e.key))}),(0,R.jsx)(`thead`,{className:`tw-table-head sticky top-0 z-10 text-xs text-stone-500`,children:(0,R.jsxs)(`tr`,{children:[(0,R.jsxs)(`th`,{className:`relative px-3 py-2 text-left font-medium whitespace-nowrap`,children:[`任务描述`,(0,R.jsx)(g,{...Y.resizeProps(0)})]}),(0,R.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`任务状态`,(0,R.jsx)(g,{...Y.resizeProps(1)})]}),(0,R.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`紧急程度`,(0,R.jsx)(g,{...Y.resizeProps(2)})]}),(0,R.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`开始日期`,(0,R.jsx)(g,{...Y.resizeProps(3)})]}),(0,R.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`截止日期`,(0,R.jsx)(g,{...Y.resizeProps(4)})]}),(0,R.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`任务周期`,(0,R.jsx)(g,{...Y.resizeProps(5)})]}),(0,R.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`待办数量`,(0,R.jsx)(g,{...Y.resizeProps(6)})]}),(0,R.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`完成进度`,(0,R.jsx)(g,{...Y.resizeProps(7)})]}),(0,R.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`备注`,(0,R.jsx)(g,{...Y.resizeProps(8)})]}),(0,R.jsx)(`th`,{className:`px-1 py-2 text-center font-medium whitespace-nowrap`,children:`操作`})]})}),(0,R.jsxs)(`tbody`,{children:[Q.map(e=>{let t=D(e),n=Ee[e.id]??{total:0,done:0,percent:0};return(0,R.jsxs)(`tr`,{className:`group/row border-t border-stone-100 hover:bg-[#f7f8fa]`,children:[(0,R.jsx)(`td`,{className:`px-3 py-1 align-middle`,children:(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[e.source===`ai`?(0,R.jsx)(`span`,{className:`shrink-0 rounded bg-[#e1eaff] px-1 py-px text-[10px] text-[#1f4ec2]`,children:`AI`}):null,(0,R.jsx)(`button`,{type:`button`,onClick:()=>G({task:e}),className:`min-w-0 truncate rounded-md px-1.5 py-1 text-left text-sm text-stone-800 hover:bg-stone-100`,children:e.title})]})}),(0,R.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(0,R.jsx)(v,{unstyled:!0,hideChevron:!0,centerContent:!0,ariaLabel:`任务状态`,menuMinWidth:120,options:U,value:e.status,onChange:t=>void $(e.id,{status:t}),triggerClassName:`h-7 w-full rounded-md px-2 text-center text-xs font-medium focus:ring-2 focus:ring-[#3370ff]/30 ${ue[e.status]}`,renderTrigger:()=>(0,R.jsx)(`span`,{className:`w-full truncate text-center`,children:E[e.status]}),renderOptionPrefix:e=>(0,R.jsx)(`span`,{className:`h-2 w-2 rounded-full ${V[e.value]}`})})}),(0,R.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(0,R.jsx)(v,{unstyled:!0,hideChevron:!0,centerContent:!0,ariaLabel:`紧急程度`,menuMinWidth:128,options:fe,value:e.priority,onChange:t=>void $(e.id,{priority:t}),triggerClassName:`h-7 w-full rounded-md px-2 text-center text-xs font-medium focus:ring-2 focus:ring-[#3370ff]/30 ${de[e.priority]}`,renderTrigger:()=>(0,R.jsx)(`span`,{className:`w-full truncate text-center`,children:e.priority?O[e.priority]:`未设置`}),renderOptionPrefix:e=>(0,R.jsx)(`span`,{className:`h-2 w-2 rounded-full ${H[e.value]}`})})}),(0,R.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,R.jsx)(_,{value:e.startDate,onChange:t=>void $(e.id,{startDate:t}),placeholder:`选择日期`,className:`h-8 rounded-md px-1.5 text-sm tabular-nums`})}),(0,R.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,R.jsx)(_,{value:e.dueDate,onChange:t=>void $(e.id,{dueDate:t}),placeholder:`选择日期`,className:`h-8 rounded-md px-1.5 text-sm tabular-nums`})}),(0,R.jsx)(`td`,{className:`px-2 py-1 align-middle text-xs whitespace-nowrap text-stone-500 tabular-nums`,children:t===null?`—`:`${t} 天`}),(0,R.jsx)(`td`,{className:`px-2 py-1 align-middle text-xs text-stone-500 tabular-nums`,children:d?n.total?`${n.total} 条`:`0`:(0,R.jsx)(`span`,{className:`whitespace-nowrap text-stone-400`,children:`待办事项未启用`})}),(0,R.jsx)(`td`,{className:`px-2 py-1 align-middle`,children:d?(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`h-1.5 min-w-0 flex-1 overflow-hidden rounded-full bg-stone-100`,children:(0,R.jsx)(`span`,{className:`block h-full rounded-full bg-[#3370ff] transition-[width]`,style:{width:`${n.percent}%`}})}),(0,R.jsxs)(`span`,{className:`w-9 shrink-0 text-right text-xs text-stone-500 tabular-nums`,children:[n.percent,`%`]})]}):(0,R.jsx)(`span`,{className:`whitespace-nowrap text-xs text-stone-400`,children:`待办事项未启用`})}),(0,R.jsx)(`td`,{className:`truncate px-2 py-1 align-middle text-xs text-stone-500`,children:e.note||`—`}),(0,R.jsx)(`td`,{className:`px-1 py-1 text-right align-middle`,children:(0,R.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>G({task:e}),"aria-label":`展开 ${e.title}`,className:`rounded p-1 text-stone-300 transition-colors hover:bg-stone-100 hover:text-stone-600 focus:text-stone-600`,children:(0,R.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,R.jsx)(`path`,{d:`M14 4h6v6`}),(0,R.jsx)(`path`,{d:`M20 4 13 11`}),(0,R.jsx)(`path`,{d:`M10 20H4v-6`}),(0,R.jsx)(`path`,{d:`M4 20l7-7`})]})}),(0,R.jsx)(`button`,{type:`button`,disabled:j,onClick:()=>q(e),"aria-label":`删除 ${e.title}`,className:`rounded p-1 text-stone-300 transition-colors hover:bg-red-50 hover:text-red-600 focus:text-red-600 disabled:opacity-40`,children:(0,R.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,R.jsx)(`path`,{d:`M3 6h18`}),(0,R.jsx)(`path`,{d:`M8 6V4h8v2`}),(0,R.jsx)(`path`,{d:`M19 6l-1 14H6L5 6`}),(0,R.jsx)(`path`,{d:`M10 11v6M14 11v6`})]})})]})})]},e.id)}),Q.length===0?(0,R.jsx)(`tr`,{children:(0,R.jsx)(`td`,{colSpan:10,className:`px-3 py-16 text-center text-sm text-stone-400`,children:b.length===0?`还没有任务`:`没有匹配的任务,试试调整搜索或筛选`})}):null]})]})}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-t border-stone-100 px-4 py-2.5 text-xs text-stone-500`,children:[(0,R.jsxs)(`span`,{children:[`共 `,Q.length,` 条`]}),(0,R.jsx)(`span`,{className:`ml-auto text-stone-400`,children:`任务下关联的待办可直接在「待办事项」里维护`})]})]}),(0,R.jsx)(be,{open:Se!==null,task:Se?.task??null,todos:C,onClose:()=>G(null),onSaved:X}),(0,R.jsx)(m,{open:K!=null,title:`删除任务`,message:`删除「${K?.title??``}」?已关联的待办会保留,但不再挂在该任务下。`,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>q(null),onConfirm:()=>void Oe()})]}):(0,R.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:`任务管理需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`}):(0,R.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:ee(`tasks`)}):(0,R.jsx)(`div`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,R.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center`,children:(0,R.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})})}export{xe as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.BUPzGl9f.js";import{i as r,o as i,s as a}from"./plugins.C2BMfzv1.js";import{t as o}from"./jsx-runtime.DUg_B_vD.js";import{t as s}from"./ConfirmDialog.BZzZWDci.js";import{n as c,t as ee}from"./DocsPager.DJY4foYL.js";import{a as l,i as u,r as d,t as te}from"./ExcelFieldTags.DXMeaDa5.js";import{a as ne,c as re,d as f,f as p,h as ie,i as ae,l as oe,m as se,n as ce,o as le,p as ue,r as de,s as m,t as fe,u as pe}from"./project-docs.Cd2gKPKh.js";import{n as me}from"./doc-roots.DAJP9Svr.js";import{t as he}from"./useListAnim.BoerpmsB.js";import{t as h}from"./NamePromptDialog.Wa9O530a.js";var g=e(t(),1),_=o(),ge=5;async function _e(e){let t=e.name.toLowerCase();try{if(t.endsWith(`.xlsx`)||t.endsWith(`.xls`)){let t=await f(`templates`,e.path);if(t.encoding===`base64`&&t.contentBase64)return l(t.contentBase64).headers}else if(t.endsWith(`.csv`)){let t=await p(`templates`,e.path);return d(t.content).headers}else if(t.endsWith(`.md`)||t.endsWith(`.txt`)){let t=await p(`templates`,e.path);return u(t.content).headers}}catch{}return[]}function v({className:e=`w-4 h-4`,open:t=!1}){return(0,_.jsx)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:t?(0,_.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,_.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 y({className:e=`w-3 h-3`}){return(0,_.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,_.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,_.jsx)(`path`,{d:`m15 5 4 4`})]})}function b({className:e=`w-3 h-3`}){return(0,_.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,_.jsx)(`path`,{d:`M3 6h18`}),(0,_.jsx)(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}),(0,_.jsx)(`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`}),(0,_.jsx)(`path`,{d:`M10 11v6`}),(0,_.jsx)(`path`,{d:`M14 11v6`})]})}function x({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,_.jsxs)(`div`,{children:[(0,_.jsx)(`div`,{className:`group flex items-center rounded-md ${c?`bg-[#e8f0fe]`:`hover:bg-stone-100`}`,style:{paddingLeft:8+t*12},children:(0,_.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,_.jsx)(`span`,{className:`w-3.5 shrink-0`,"aria-hidden":`true`}),(0,_.jsx)(v,{open:!!(e.children.length&&s),className:`w-3.5 h-3.5 shrink-0 text-[#4176e6]`}),(0,_.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,children:e.name}),(0,_.jsxs)(`span`,{className:`shrink-0 tabular-nums text-[11px] text-stone-400`,children:[`(`,e.fileCount??0,`)`]})]})}),(0,_.jsx)(`div`,{className:`tw-collapse ${s?`is-open`:``}`,children:(0,_.jsx)(`div`,{className:`tw-collapse-inner space-y-1`,children:e.children.map(e=>(0,_.jsx)(x,{node:e,depth:t+1,activePath:n,expanded:r,globalOpen:i,onToggle:a,onSelect:o},e.path))})})]})}function S(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,g.useState)(()=>r(`templates`)),[o,l]=(0,g.useState)(!1),[u,d]=(0,g.useState)(null),[f,p]=(0,g.useState)([]),[C,ve]=(0,g.useState)(0),[w,T]=(0,g.useState)(`.`),[E,D]=(0,g.useState)([]),[ye,be]=(0,g.useState)({}),[xe,O]=(0,g.useState)({}),[k,Se]=(0,g.useState)(!0),[A,j]=(0,g.useState)(null),[M,N]=(0,g.useState)(!1),[Ce,P]=(0,g.useState)(!1),[F,I]=(0,g.useState)(null),[L,R]=(0,g.useState)(null),[we,z]=(0,g.useState)(1),[B,Te]=c(ge),[Ee,V]=(0,g.useState)(null),H=(0,g.useRef)(null),{cls:De,play:U}=he(),W=(0,g.useCallback)(async e=>{let t={};await Promise.all(e.map(async e=>{let n=await _e(e);n.length&&(t[e.path]=n)})),be(t)},[]),G=(0,g.useCallback)(async()=>{let e=await ae(`templates`);p(e.tree),ve(e.totalFiles)},[]),K=(0,g.useCallback)(async(e=w)=>{j(null);try{let[t]=await Promise.all([m(`templates`,e),G()]);D(t.entries),T(t.path);let n=t.entries.filter(e=>e.type===`file`);await W(n)}catch(e){j(e instanceof Error?e.message:String(e))}},[w,W,G]);(0,g.useEffect)(()=>{let e=i(e=>t(!!e.templates));return n().then(()=>{t(r(`templates`)),l(!0)}),e},[]),(0,g.useEffect)(()=>{o&&e&&(async()=>{let e=await de(`templates`);if(d(e),e)try{let[e]=await Promise.all([m(`templates`,`.`),G()]);D(e.entries),T(e.path),await W(e.entries.filter(e=>e.type===`file`))}catch(e){j(e instanceof Error?e.message:String(e))}})()},[o,e,W,G]);function Oe(){Se(e=>!e),O({})}async function q(e){U(),T(e),z(1),V(null),j(null);try{let t=await m(`templates`,e);D(t.entries),await W(t.entries.filter(e=>e.type===`file`))}catch(e){j(e instanceof Error?e.message:String(e))}}async function ke(e){P(!1),N(!0),j(null);try{await re(`templates`,w,e),await K(w)}catch(e){j(e instanceof Error?e.message:String(e))}finally{N(!1)}}async function Ae(e){if(e?.length){N(!0),j(null);try{for(let t of Array.from(e))await ie(`templates`,w,t);await K(w)}catch(e){j(e instanceof Error?e.message:String(e))}finally{N(!1),H.current&&(H.current.value=``)}}}async function je(e){if(e.type===`file`){N(!0),j(null);try{await oe(`templates`,e.path)}catch(e){j(e instanceof Error?e.message:String(e))}finally{N(!1)}}}function Me(e){let t=ne(f,e.path),n=t?.fileCount??0,r=t?fe(t):0;I({...e,isDir:!0,blocked:n>0||r>0,files:n,dirs:r})}function Ne(e){I({name:e.name,path:e.path,isDir:!1})}function J(e,t){R({...e,isDir:t})}async function Y(){let e=F;if(e&&(I(null),!e.blocked)){N(!0),j(null);try{await ce(`templates`,e.path);let t=le(w,e.path)?pe(e.path):w;await K(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 se(`templates`,t.path,e);await K(ue(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(!o)return(0,_.jsx)(`div`,{className:`tw-lib-probing`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,_.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})});if(!e)return(0,_.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:a(`templates`)});if(u===null)return(0,_.jsx)(`div`,{className:`tw-lib-probing`,"aria-busy":`true`,"aria-label":`正在连接本地文档服务`,children:(0,_.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})});if(!u)return(0,_.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/B)),$=Math.min(we,Q),Ie=X.slice(($-1)*B,$*B);function Le(e){U(),Te(e),z(1)}return(0,_.jsxs)(`div`,{className:`flex gap-4 min-h-0`,children:[(0,_.jsxs)(`aside`,{className:`w-56 shrink-0 rounded-xl border border-stone-200 bg-white flex flex-col overflow-hidden`,children:[(0,_.jsxs)(`div`,{className:`px-3 py-2.5 border-b border-stone-100 flex items-center justify-between`,children:[(0,_.jsx)(`span`,{className:`text-xs font-semibold text-stone-500`,children:`文件夹`}),(0,_.jsx)(`button`,{type:`button`,disabled:M,onClick:()=>P(!0),className:`tw-mkdir-btn disabled:opacity-40`,children:`+ 新建`})]}),(0,_.jsxs)(`div`,{className:`flex-1 overflow-y-auto py-2 px-1 space-y-1`,children:[(0,_.jsx)(`div`,{className:`group flex items-center rounded-md ${w===`.`?`bg-[#e8f0fe]`:`hover:bg-stone-100`}`,style:{paddingLeft:8},children:(0,_.jsxs)(`button`,{type:`button`,onClick:()=>{q(`.`),Oe()},"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,_.jsx)(v,{open:k,className:`w-3.5 h-3.5 shrink-0 text-[#4176e6]`}),(0,_.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,children:`全部模板`}),(0,_.jsxs)(`span`,{className:`shrink-0 tabular-nums text-[11px] text-stone-400`,children:[`(`,C,`)`]})]})}),(0,_.jsx)(`div`,{className:`tw-collapse ${k?`is-open`:``}`,children:(0,_.jsx)(`div`,{className:`tw-collapse-inner space-y-1`,children:f.map(e=>(0,_.jsx)(x,{node:e,depth:0,activePath:w,expanded:xe,globalOpen:k,onToggle:e=>O(t=>({...t,[e]:!(t[e]??k)})),onSelect:e=>void q(e)},e.path))})})]})]}),(0,_.jsxs)(`section`,{className:`flex-1 min-w-0 rounded-xl border border-stone-200 bg-white flex flex-col overflow-hidden`,children:[(0,_.jsxs)(`div`,{className:`px-4 py-3 border-b border-stone-100 flex items-center gap-2 flex-wrap`,children:[(0,_.jsxs)(`div`,{className:`text-sm text-stone-600 flex-1 min-w-0 truncate`,children:[(0,_.jsx)(`span`,{className:`text-stone-400`,children:me(`templates`)}),w===`.`?``:w]}),(0,_.jsx)(`input`,{ref:H,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 Ae(e.target.files)}),(0,_.jsx)(`button`,{type:`button`,disabled:M,onClick:()=>H.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,_.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,_.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 space-y-4`,children:[Z.length>0&&(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`div`,{className:`text-xs font-medium text-stone-400 mb-2`,children:`子文件夹`}),(0,_.jsx)(`ul`,{className:`space-y-1`,children:Z.map(e=>(0,_.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg border border-stone-100 hover:bg-stone-50`,children:[(0,_.jsxs)(`button`,{type:`button`,className:`flex-1 min-w-0 flex items-center gap-2 text-left text-sm text-stone-700`,onClick:()=>void q(e.path),children:[(0,_.jsx)(v,{className:`w-4 h-4 text-[#4176e6] shrink-0`}),(0,_.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,children:e.name})]}),(0,_.jsx)(`button`,{type:`button`,disabled:M,"aria-label":`重命名 ${e.name}`,onClick:()=>J({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,_.jsx)(y,{className:`w-3.5 h-3.5`})}),(0,_.jsx)(`button`,{type:`button`,disabled:M,"aria-label":`删除 ${e.name}`,onClick:()=>Me({name:e.name,path:e.path}),className:`p-1.5 rounded text-red-600 hover:bg-red-50 disabled:opacity-40`,children:(0,_.jsx)(b,{className:`w-3.5 h-3.5`})})]},e.path))})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`div`,{className:`text-xs font-medium text-stone-400 mb-2`,children:`文件`}),X.length===0?(0,_.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,_.jsx)(`ul`,{className:`${De}space-y-1`,children:Ie.map(e=>{let t=ye[e.path]??[],n=Ee===e.path;return(0,_.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,_.jsxs)(`button`,{type:`button`,className:`flex-1 min-w-0 text-left`,disabled:M,onClick:()=>V(e.path),onDoubleClick:()=>void je(e),children:[(0,_.jsx)(`div`,{className:`text-sm text-stone-800 truncate`,"data-hint":e.name,children:e.name}),(0,_.jsx)(`div`,{className:`text-[11px] text-stone-400`,children:S(e.size)}),t.length>0?(0,_.jsx)(te,{fields:t}):null]}),(0,_.jsx)(`button`,{type:`button`,disabled:M,"aria-label":`重命名 ${e.name}`,onClick:()=>J({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,_.jsx)(y,{className:`w-3.5 h-3.5`})}),(0,_.jsx)(`button`,{type:`button`,disabled:M,"aria-label":`删除 ${e.name}`,onClick:()=>Ne(e),className:`p-1.5 rounded text-red-600 hover:bg-red-50 disabled:opacity-40 shrink-0 mt-0.5`,children:(0,_.jsx)(b,{className:`w-3.5 h-3.5`})})]},e.path)})})]})]}),X.length>0?(0,_.jsx)(ee,{page:$,totalPages:Q,pageSize:B,busy:M,onPage:e=>{U(),z(e)},onPageSize:Le}):null]}),(0,_.jsx)(h,{open:Ce,title:`新建文件夹`,onClose:()=>P(!1),onConfirm:e=>void ke(e)}),(0,_.jsx)(h,{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,_.jsx)(s,{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 Y()})]})}export{C as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.BUPzGl9f.js";import{i as r,o as i,s as a}from"./plugins.C2BMfzv1.js";import{o,r as ee}from"./view-prefs.BEAZRcxF.js";import{t as s}from"./jsx-runtime.DUg_B_vD.js";import{t as c}from"./ConfirmDialog.BZzZWDci.js";import{n as te,t as l}from"./ColumnResize.BEkEW7qw.js";import{t as ne}from"./DatePicker.Bkl71M49.js";import{n as re,t as ie}from"./DocsPager.DJY4foYL.js";import{t as ae}from"./TagSelect.CuN5RdF4.js";import{a as oe,c as u,i as d,l as f,n as se,o as ce,r as le,s as ue,t as de,u as fe}from"./test-stats.MEm3K2rB.js";var p=e(t(),1),m=s(),h=8e3,g=600,_=20,pe=`tw.test-stats.page-size.v1`,v=`test-stats.search`,y=[{key:`select`,width:32,min:28},{key:`index`,width:44,min:36},{key:`date`,width:140,min:120},{key:`dimensions`,min:240},{key:`count`,width:120,min:90},{key:`action`,width:64,min:56}],b=`h-8 w-full min-w-0 rounded-md border border-transparent bg-transparent px-1.5 text-center text-sm text-stone-800 outline-none transition-colors hover:border-stone-200 focus:border-[#3370ff] focus:bg-white placeholder:text-stone-300 tabular-nums`,x=(0,m.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,m.jsx)(`path`,{d:`M3 6h18`}),(0,m.jsx)(`path`,{d:`M8 6V4h8v2`}),(0,m.jsx)(`path`,{d:`M19 6l-1 14H6L5 6`}),(0,m.jsx)(`path`,{d:`M10 11v6M14 11v6`})]});function me(e){let[t,n]=(0,p.useState)(e.value?String(e.value):``),r=(0,p.useRef)(e.value),i=(0,p.useRef)(e.onCommit);i.current=e.onCommit,(0,p.useEffect)(()=>{e.value!==r.current&&(r.current=e.value,n(e.value?String(e.value):``))},[e.value]),(0,p.useEffect)(()=>{let e=t?u(t):0;if(e===r.current)return;let n=window.setTimeout(()=>{r.current=e,i.current(e)},g);return()=>window.clearTimeout(n)},[t]);function a(){let e=t?u(t):0;e!==r.current&&(r.current=e,i.current(e))}return(0,m.jsx)(`input`,{type:`text`,inputMode:`numeric`,"aria-label":e.ariaLabel,value:t,placeholder:e.placeholder??`0`,onChange:e=>n(e.target.value.replace(/[^\d]/g,``)),onBlur:a,onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),t.currentTarget.blur()):t.key===`Escape`&&(t.preventDefault(),r.current=e.value,n(e.value?String(e.value):``),t.currentTarget.blur())},className:b})}function S(){let[e,t]=(0,p.useState)(!1),[s,u]=(0,p.useState)(!0),[g,b]=(0,p.useState)(null),[S,C]=(0,p.useState)([]),[w,T]=(0,p.useState)([]),[E,D]=(0,p.useState)(null),[O,k]=(0,p.useState)(!1),[A,j]=(0,p.useState)(()=>ee(v)),[M,N]=(0,p.useState)({}),[P,F]=(0,p.useState)(1),[I,L]=re(_,pe),[R,z]=(0,p.useState)(null),[B,V]=(0,p.useState)(null);function H(e){o(v,e),j(e),F(1)}let U=(0,p.useRef)(!0),W=(0,p.useRef)(!1),G=te(`lh:test-stats:cols:v1`,y);(0,p.useEffect)(()=>(U.current=!0,()=>{U.current=!1}),[]);let K=(0,p.useCallback)(async()=>{try{let e=await oe();if(!U.current)return;C(e.items),T(e.dimensions),N(t=>{let n=new Set(e.items.map(e=>e.id)),r=!1,i={};for(let[e,a]of Object.entries(t))a&&(n.has(e)?i[e]=!0:r=!0);return r?i:t}),D(null)}catch(e){if(!U.current)return;D(e instanceof Error?e.message:String(e))}},[]);(0,p.useEffect)(()=>{let e=i(e=>u(!!e.testStats));return n().then(()=>{u(r(`testStats`)),t(!0)}),e},[]),(0,p.useEffect)(()=>{e&&s&&(async()=>{let e=await le();U.current&&(e?(await K(),U.current&&b(!0)):b(!1))})()},[e,s,K]),(0,p.useEffect)(()=>{if(g!==!0)return;let e=window.setInterval(()=>{W.current||K()},h),t=()=>{W.current||K()};return window.addEventListener(`focus`,t),()=>{window.clearInterval(e),window.removeEventListener(`focus`,t)}},[g,K]);let he=f(),q=(0,p.useMemo)(()=>ce(d(S,{keyword:A})),[S,A]),J=(0,p.useMemo)(()=>ue(S),[S]),Y=Math.max(1,Math.ceil(q.length/I)),X=Math.min(P,Y),Z=(0,p.useMemo)(()=>q.slice((X-1)*I,X*I),[q,X,I]),Q=(0,p.useMemo)(()=>S.filter(e=>M[e.id]),[S,M]),ge=Z.length>0&&Z.every(e=>M[e.id]);(0,p.useEffect)(()=>{if(!R)return;let e=q.findIndex(e=>e.id===R);if(e<0)return;F(Math.floor(e/I)+1);let t=window.setTimeout(()=>z(null),2e3);return()=>window.clearTimeout(t)},[R,q,I]);async function _e(){if(!O){k(!0),D(null),H(``);try{let e=await de([{date:he,dimensions:[],count:0}],{mode:`manual`});if(!U.current)return;let t=e.items[0];if(e.dimensions.length&&T(e.dimensions),await K(),!U.current||!t)return;z(t.id)}catch(e){U.current&&D(e instanceof Error?e.message:String(e))}finally{U.current&&k(!1)}}}async function $(e,t){C(n=>n.map(n=>n.id===e?{...n,...t}:n));try{let{item:n,dimensions:r}=await fe(e,t);if(!U.current)return;C(t=>t.map(t=>t.id===e?n:t)),r.length&&T(r),D(null)}catch(e){if(!U.current)return;D(e instanceof Error?e.message:String(e)),await K()}}async function ve(){let e=B;if(e&&e.length!==0){V(null),k(!0);try{if(await se(e.map(e=>e.id)),!U.current)return;N({}),D(null),await K()}catch(e){U.current&&D(e instanceof Error?e.message:String(e))}finally{U.current&&k(!1)}}}return e?s?g===null?(0,m.jsx)(`div`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,"aria-busy":`true`,"aria-label":`正在连接测试统计服务`,children:(0,m.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center`,children:(0,m.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):g?(0,m.jsxs)(`section`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,m.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-3 border-b border-stone-100 px-4 py-3`,children:[(0,m.jsxs)(`div`,{className:`text-sm text-stone-600`,children:[`共 `,(0,m.jsx)(`span`,{className:`font-medium text-stone-800`,children:J.records}),` 条`,(0,m.jsxs)(`span`,{className:`text-stone-400`,children:[` `,`· 覆盖 `,J.dimensions,` 个维度 · 数量合计 `,J.total,Q.length?` · 已选 ${Q.length} 条`:``]})]}),(0,m.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[(0,m.jsx)(`input`,{value:A,onChange:e=>H(e.target.value),placeholder:`搜索日期 / 维度…`,className:`h-9 w-44 rounded-lg border border-stone-200 px-3 text-sm text-stone-800 outline-none focus:border-[#3370ff]`}),(0,m.jsx)(`button`,{type:`button`,disabled:O||Q.length===0,onClick:()=>V(Q),className:`h-9 shrink-0 rounded-lg border border-red-200 px-3 text-sm font-medium whitespace-nowrap text-red-600 hover:bg-red-50 disabled:opacity-40`,children:`批量删除`}),(0,m.jsx)(`button`,{type:`button`,disabled:O,onClick:()=>void _e(),className:`h-9 shrink-0 rounded-lg bg-[#3370ff] px-3 text-sm font-medium whitespace-nowrap text-white hover:bg-[#2b5fd9] disabled:opacity-40`,children:`+ 添加记录`})]})]}),E?(0,m.jsxs)(`div`,{className:`mx-4 mt-3 flex shrink-0 items-start gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700`,children:[(0,m.jsx)(`span`,{className:`min-w-0 flex-1`,children:E}),(0,m.jsx)(`button`,{type:`button`,onClick:()=>D(null),"aria-label":`关闭`,className:`-mr-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded text-red-700/70 hover:bg-red-100 hover:text-red-900`,children:`✕`})]}):null,(0,m.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,onFocusCapture:()=>{W.current=!0},onBlurCapture:()=>{window.setTimeout(()=>{W.current=!!document.activeElement?.closest(`.tw-data-table`)},0)},children:(0,m.jsxs)(`table`,{className:`tw-data-table w-full table-fixed border-collapse text-sm`,style:G.tableStyle,children:[(0,m.jsx)(`colgroup`,{children:y.map(e=>(0,m.jsx)(`col`,{style:G.widthOf(e.key)?{width:G.widthOf(e.key)}:void 0},e.key))}),(0,m.jsx)(`thead`,{className:`tw-table-head sticky top-0 z-10 text-xs text-stone-500`,children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{className:`px-2 py-2 text-left font-medium`,children:(0,m.jsx)(`input`,{type:`checkbox`,"aria-label":`全选本页记录`,checked:ge,disabled:Z.length===0,onChange:e=>{let t=e.target.checked;N(e=>{let n={...e};for(let e of Z)t?n[e.id]=!0:delete n[e.id];return n})}})}),(0,m.jsx)(`th`,{className:`px-2 py-2 text-left font-medium`,"aria-label":`行号`}),(0,m.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`当前日期`,(0,m.jsx)(l,{...G.resizeProps(2)})]}),(0,m.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`测试统计维度`,(0,m.jsx)(l,{...G.resizeProps(3)})]}),(0,m.jsxs)(`th`,{className:`relative px-2 py-2 text-center font-medium whitespace-nowrap`,children:[`统计数量`,(0,m.jsx)(l,{...G.resizeProps(4)})]}),(0,m.jsx)(`th`,{className:`px-1 py-2 text-center font-medium whitespace-nowrap`,children:`操作`})]})}),(0,m.jsxs)(`tbody`,{children:[q.length===0?(0,m.jsx)(`tr`,{className:`border-t border-stone-100`,children:(0,m.jsx)(`td`,{colSpan:6,className:`px-4 py-14 text-center text-sm text-stone-400`,children:`还没有测试统计记录,点右上角「+ 添加记录」开始。`})}):null,Z.map((e,t)=>(0,m.jsxs)(`tr`,{className:`group/row border-t border-stone-100 ${e.id===R?`tw-new-row`:`hover:bg-[#f7f8fa]`}`,children:[(0,m.jsx)(`td`,{className:`px-2 py-1 align-middle`,children:(0,m.jsx)(`input`,{type:`checkbox`,"aria-label":`选择 ${e.date} ${e.dimensions.join(`/`)}`,checked:!!M[e.id],onChange:t=>N(n=>{let r={...n};return t.target.checked?r[e.id]=!0:delete r[e.id],r})})}),(0,m.jsx)(`td`,{className:`px-2 py-1 align-middle text-xs text-stone-400 tabular-nums`,children:(X-1)*I+t+1}),(0,m.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,m.jsx)(ne,{value:e.date,onChange:t=>void $(e.id,{date:t}),placeholder:`选择日期`,className:`h-8 w-full rounded-md border border-transparent px-1.5 text-sm text-stone-800 tabular-nums transition-colors hover:border-stone-200 focus:border-[#3370ff] focus:bg-white`})}),(0,m.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,m.jsx)(ae,{compact:!0,ariaLabel:`测试统计维度`,options:w,value:e.dimensions[0]??``,onChange:t=>void $(e.id,{dimensions:t?[t]:[]}),placeholder:`选择或创建维度`})}),(0,m.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,m.jsx)(me,{value:e.count,ariaLabel:`统计数量`,onCommit:t=>void $(e.id,{count:t})})}),(0,m.jsx)(`td`,{className:`px-1 py-1 text-center align-middle`,children:(0,m.jsx)(`button`,{type:`button`,disabled:O,onClick:()=>V([e]),"aria-label":`删除 ${e.date} 的记录`,className:`rounded p-1 text-stone-300 transition-colors hover:bg-red-50 hover:text-red-600 focus:text-red-600 disabled:opacity-40`,children:x})})]},e.id))]})]})}),q.length>0?(0,m.jsx)(ie,{page:X,totalPages:Y,pageSize:I,busy:O,onPage:F,onPageSize:e=>{L(e),F(1)}}):(0,m.jsx)(`div`,{className:`pb-1`}),(0,m.jsx)(c,{open:B!==null,title:`删除测试统计`,message:B&&B.length>1?`确定删除选中的 ${B.length} 条记录吗?删除后不可恢复。`:`确定删除 ${B?.[0]?.date??``} 的这条记录吗?删除后不可恢复。`,confirmLabel:`删除`,danger:!0,onClose:()=>V(null),onConfirm:()=>void ve()})]}):(0,m.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:`测试统计需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`}):(0,m.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:a(`testStats`)}):(0,m.jsx)(`div`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,m.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center`,children:(0,m.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})})}export{S as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{t as n}from"./jsx-runtime.DUg_B_vD.js";var r=e(t(),1),i=n(),a=`lantern:toast`,o={info:2600,success:2600,error:4200},s={info:{dot:`bg-stone-400`,box:`border-stone-200 bg-white`,text:`text-stone-700`},success:{dot:`bg-emerald-500`,box:`border-emerald-200 bg-white`,text:`text-emerald-700`},error:{dot:`bg-red-500`,box:`border-red-200 bg-white`,text:`text-red-600`}};function c(e,t=`info`){let n=String(e??``).trim();n&&typeof window<`u`&&window.dispatchEvent(new CustomEvent(a,{detail:{message:n,tone:t}}))}function l(){let[e,t]=(0,r.useState)(null),n=(0,r.useRef)(0),i=(0,r.useRef)(null),a=(0,r.useCallback)(()=>{i.current!=null&&(window.clearTimeout(i.current),i.current=null),t(null)},[]),s=(0,r.useCallback)((e,r=`info`)=>{let a=String(e??``).trim();a&&(i.current!=null&&window.clearTimeout(i.current),n.current+=1,t({message:a,tone:r,seq:n.current}),i.current=window.setTimeout(()=>{i.current=null,t(null)},o[r]??2600))},[]);return(0,r.useEffect)(()=>()=>{i.current!=null&&window.clearTimeout(i.current)},[]),{state:e,show:s,hide:a}}function u({state:e,onClose:t,bottomClassName:n=`bottom-6`}){if(!e)return null;let r=s[e.tone]??s.info;return(0,i.jsx)(`div`,{className:`tw-plugin-toast pointer-events-none fixed left-1/2 z-50 -translate-x-1/2 ${n}`,role:e.tone===`error`?`alert`:`status`,"aria-live":e.tone===`error`?`assertive`:`polite`,children:(0,i.jsxs)(`div`,{className:`pointer-events-auto flex max-w-[min(92vw,520px)] items-start gap-2 rounded-xl border px-3.5 py-2.5 shadow-lg ${r.box}`,children:[(0,i.jsx)(`span`,{className:`mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full ${r.dot}`,"aria-hidden":`true`}),(0,i.jsx)(`p`,{className:`text-[12px] leading-relaxed ${r.text}`,children:e.message}),(0,i.jsx)(`button`,{type:`button`,onClick:t,className:`-mr-1 ml-1 flex h-5 w-5 shrink-0 items-center justify-center rounded text-stone-400 transition-colors hover:bg-stone-100 hover:text-stone-600`,"aria-label":`关闭提示`,children:(0,i.jsx)(`svg`,{viewBox:`0 0 24 24`,width:11,height:11,fill:`none`,"aria-hidden":`true`,children:(0,i.jsx)(`path`,{d:`M5 5l14 14M19 5 5 19`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`})})})]})},e.seq)}function d(){let[e,t]=(0,r.useState)(null),n=(0,r.useRef)(0),s=(0,r.useRef)(null),c=(0,r.useCallback)(()=>{s.current!=null&&(window.clearTimeout(s.current),s.current=null),t(null)},[]);return(0,r.useEffect)(()=>{let e=e=>{let r=e.detail??{},i=String(r.message??``).trim();if(!i)return;let a=r.tone??`info`;s.current!=null&&window.clearTimeout(s.current),n.current+=1,t({message:i,tone:a,seq:n.current}),s.current=window.setTimeout(()=>{s.current=null,t(null)},o[a]??2600)};return window.addEventListener(a,e),()=>{window.removeEventListener(a,e),s.current!=null&&window.clearTimeout(s.current)}},[]),(0,i.jsx)(u,{state:e,onClose:c})}export{d as GlobalToastHost,u as ToastHost,c as showToast,l as useToast};
|