@jonathanleelx/meddle 0.5.0-beta.9 → 0.5.1
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/CONFIG_STRUCTURE.md +9 -2
- package/README.md +18 -0
- package/bin/commands/mock/add.js +59 -21
- package/bin/commands/mock/delete.js +16 -24
- package/bin/commands/mock/index.js +59 -25
- package/bin/commands/mock/list.js +35 -18
- package/bin/commands/mock/toggle.js +17 -27
- package/bin/commands/mock/update.js +39 -30
- package/bin/commands/route/active.js +20 -3
- package/bin/commands/route/add.js +113 -94
- package/bin/commands/route/create.js +8 -1
- package/bin/commands/route/delete.js +87 -53
- package/bin/commands/route/index.js +74 -26
- package/bin/commands/route/list.js +2 -2
- package/bin/commands/route/preview.js +2 -2
- package/bin/commands/route/show.js +12 -3
- package/bin/commands/route/update.js +135 -92
- package/bin/commands/status.js +27 -11
- package/bin/commands/update.js +4 -0
- package/bin/doctor.js +8 -4
- package/bin/index.js +11 -7
- package/bin/lib/api-client.js +14 -2
- package/bin/lib/file-access.js +234 -35
- package/bin/lib/meddle-home.js +14 -1
- package/bin/lib/output.js +30 -4
- package/bin/lib/proxy-detect.js +99 -20
- package/bin/lib/proxy-or-file.js +93 -0
- package/bin/lib/route-write-args.js +150 -0
- package/bin/lib/rule-file-edit.js +263 -0
- package/bin/lib/ruleset-readonly.js +61 -0
- package/bin/lib/update-check.js +67 -6
- package/dist/cert.d.ts +2 -0
- package/dist/cert.d.ts.map +1 -1
- package/dist/cert.js +53 -1
- package/dist/cert.js.map +1 -1
- package/dist/core/browser.d.ts +10 -1
- package/dist/core/browser.d.ts.map +1 -1
- package/dist/core/browser.js +252 -36
- package/dist/core/browser.js.map +1 -1
- package/dist/core/config-diagnostics.d.ts.map +1 -1
- package/dist/core/config-diagnostics.js +6 -1
- package/dist/core/config-diagnostics.js.map +1 -1
- package/dist/core/custom-plugin-loader.d.ts.map +1 -1
- package/dist/core/custom-plugin-loader.js +2 -0
- package/dist/core/custom-plugin-loader.js.map +1 -1
- package/dist/core/mock-handler.d.ts +63 -0
- package/dist/core/mock-handler.d.ts.map +1 -1
- package/dist/core/mock-handler.js +641 -29
- package/dist/core/mock-handler.js.map +1 -1
- package/dist/core/mock-utils.d.ts +58 -0
- package/dist/core/mock-utils.d.ts.map +1 -0
- package/dist/core/mock-utils.js +167 -0
- package/dist/core/mock-utils.js.map +1 -0
- package/dist/core/plugin-bootstrap-runner.d.ts +1 -0
- package/dist/core/plugin-bootstrap-runner.d.ts.map +1 -1
- package/dist/core/plugin-bootstrap-runner.js +37 -1
- package/dist/core/plugin-bootstrap-runner.js.map +1 -1
- package/dist/core/plugin-source.d.ts +24 -0
- package/dist/core/plugin-source.d.ts.map +1 -0
- package/dist/core/plugin-source.js +47 -0
- package/dist/core/plugin-source.js.map +1 -0
- package/dist/core/proxy-record.d.ts +14 -0
- package/dist/core/proxy-record.d.ts.map +1 -1
- package/dist/core/proxy-record.js +39 -0
- package/dist/core/proxy-record.js.map +1 -1
- package/dist/core/rule-file-edit.d.ts +81 -0
- package/dist/core/rule-file-edit.d.ts.map +1 -0
- package/dist/core/rule-file-edit.js +243 -0
- package/dist/core/rule-file-edit.js.map +1 -0
- package/dist/core/static-server.d.ts.map +1 -1
- package/dist/core/static-server.js +15 -13
- package/dist/core/static-server.js.map +1 -1
- package/dist/core/types.d.ts +15 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/plugins/builtin/mock-plugin.d.ts.map +1 -1
- package/dist/plugins/builtin/mock-plugin.js +6 -5
- package/dist/plugins/builtin/mock-plugin.js.map +1 -1
- package/dist/server/agent/tools.d.ts.map +1 -1
- package/dist/server/agent/tools.js +24 -18
- package/dist/server/agent/tools.js.map +1 -1
- package/dist/server/app-info.d.ts +33 -0
- package/dist/server/app-info.d.ts.map +1 -0
- package/dist/server/app-info.js +116 -0
- package/dist/server/app-info.js.map +1 -0
- package/dist/server/config.d.ts +1 -0
- package/dist/server/config.d.ts.map +1 -1
- package/dist/server/config.js +114 -16
- package/dist/server/config.js.map +1 -1
- package/dist/server/health.d.ts.map +1 -1
- package/dist/server/health.js +8 -0
- package/dist/server/health.js.map +1 -1
- package/dist/server/index.d.ts +16 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +10 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/json-parse-error.d.ts +7 -0
- package/dist/server/json-parse-error.d.ts.map +1 -0
- package/dist/server/json-parse-error.js +28 -0
- package/dist/server/json-parse-error.js.map +1 -0
- package/dist/server/mocks.d.ts +26 -0
- package/dist/server/mocks.d.ts.map +1 -1
- package/dist/server/mocks.js +110 -13
- package/dist/server/mocks.js.map +1 -1
- package/dist/server/plugins.d.ts.map +1 -1
- package/dist/server/plugins.js +56 -11
- package/dist/server/plugins.js.map +1 -1
- package/dist/server/rule-files.d.ts +36 -0
- package/dist/server/rule-files.d.ts.map +1 -1
- package/dist/server/rule-files.js +388 -107
- package/dist/server/rule-files.js.map +1 -1
- package/dist/server/ruleset-lock.d.ts +62 -0
- package/dist/server/ruleset-lock.d.ts.map +1 -0
- package/dist/server/ruleset-lock.js +234 -0
- package/dist/server/ruleset-lock.js.map +1 -0
- package/index.js +128 -16
- package/mcp-server.js +108 -93
- package/package.json +1 -1
- package/plugins/builtin/mock-plugin.ts +9 -5
- package/web/dist/assets/alert-B514Frte.js +1 -0
- package/web/dist/assets/arrow-right-BNum_060.js +1 -0
- package/web/dist/assets/{body-diff-view-B-4XWmL6.js → body-diff-view-SfLCLzs9.js} +2 -2
- package/web/dist/assets/button-BFNlGZ5p.js +1 -0
- package/web/dist/assets/check-BkfHQ6re.js +1 -0
- package/web/dist/assets/checkbox-CQyFsZzS.js +1 -0
- package/web/dist/assets/chevron-down-DHwUtL4O.js +1 -0
- package/web/dist/assets/{circle-alert-Q8cZk9Rv.js → circle-alert-zMagrFuI.js} +1 -1
- package/web/dist/assets/{circle-x-C9USji_R.js → circle-x-BEkinhez.js} +1 -1
- package/web/dist/assets/code-DD-AYxxu.js +1 -0
- package/web/dist/assets/{copy-BYjq1hdN.js → copy-BRnscYy1.js} +1 -1
- package/web/dist/assets/detail-panel-DZRKJG2W.js +4 -0
- package/web/dist/assets/dist-BQN0rzUS.js +1 -0
- package/web/dist/assets/{dist-CEd_wnRC.js → dist-C-E2R2jk.js} +1 -1
- package/web/dist/assets/{dist-C6eaYCUo.js → dist-CFZ4xMSF.js} +1 -1
- package/web/dist/assets/{dist-DWmDaXVN.js → dist-CRmX_NvH.js} +1 -1
- package/web/dist/assets/{dist-C8RHq5At.js → dist-DLQKRjuW.js} +1 -1
- package/web/dist/assets/{dist-Blyulj4_.js → dist-LiAcI8CK.js} +1 -1
- package/web/dist/assets/{dist-Ce4ujolc.js → dist-fzPL-8F9.js} +1 -1
- package/web/dist/assets/{dist-DoE7uybN.js → dist-wv9ebJK_.js} +1 -1
- package/web/dist/assets/editor-pane-actions-_ckwcCII.js +1 -0
- package/web/dist/assets/{es2015-DG46NGN7.js → es2015-DPJTBYa9.js} +1 -1
- package/web/dist/assets/global-panel-shell-Iir-c_pQ.js +6 -0
- package/web/dist/assets/health-panel-Dmf-EhJz.js +1 -0
- package/web/dist/assets/index-C4dIj1nT.js +21 -0
- package/web/dist/assets/index-CdYMl1M7.css +2 -0
- package/web/dist/assets/{mobile-proxy-panel-tU0NyJ3P.js → mobile-proxy-panel-CFcwa11A.js} +6 -6
- package/web/dist/assets/mock-config-CGl50MIr.js +1 -0
- package/web/dist/assets/mock-editor-panel-xcCk23oH.js +20 -0
- package/web/dist/assets/mocks-file-missing-note-CW_ONVLA.js +1 -0
- package/web/dist/assets/monaco-editor-BkP7envQ.js +11 -0
- package/web/dist/assets/pane-bar-5j9Nf7W_.js +1 -0
- package/web/dist/assets/pane-split-C0OSe365.js +1 -0
- package/web/dist/assets/panel-heading-izT5q0ZN.js +1 -0
- package/web/dist/assets/{pencil-line-Cqe41E4h.js → pencil-line-CEZ7D-de.js} +1 -1
- package/web/dist/assets/plugin-code-editor-DKE9dFEE.js +2 -0
- package/web/dist/assets/plugin-config-Cg09TsuV.js +2 -0
- package/web/dist/assets/plugin-generator-CT1f1tu0.js +2 -0
- package/web/dist/assets/plugin-test-dialog-BbLIMnkJ.js +7 -0
- package/web/dist/assets/plus-ixZQRprm.js +1 -0
- package/web/dist/assets/{refresh-cw-CG3HaiQT.js → refresh-cw-BfLoHqg5.js} +1 -1
- package/web/dist/assets/rotate-ccw-CRguJya4.js +1 -0
- package/web/dist/assets/route-preview-CKO7nF4W.js +1 -0
- package/web/dist/assets/{rule-ai-assistant-panel-DMh0F9dr.js → rule-ai-assistant-panel-CtfUqdYG.js} +2 -2
- package/web/dist/assets/rule-config-Cb4ejIXI.js +15 -0
- package/web/dist/assets/rule-overview-panel-xtHTS27O.js +1 -0
- package/web/dist/assets/{server-Cpj4KNwN.js → server-eYXq3PbE.js} +1 -1
- package/web/dist/assets/settings-panel-CpQuE6nr.js +1 -0
- package/web/dist/assets/{shield-check-OqUmVLQt.js → shield-check-hQXjdfZ7.js} +1 -1
- package/web/dist/assets/smartphone-D4Q7cQfm.js +1 -0
- package/web/dist/assets/switch-94vgsMHm.js +1 -0
- package/web/dist/assets/{syntax-highlight-Dk0-ewLI.js → syntax-highlight-BFgN_C0Y.js} +1 -1
- package/web/dist/assets/{table-2-BR5e3z8m.js → table-2-DvGHhMm4.js} +1 -1
- package/web/dist/assets/table-DaXD6jJv.js +1 -0
- package/web/dist/assets/textarea-9wB8Hsz-.js +1 -0
- package/web/dist/assets/toast-9yeTf7d9.js +1 -0
- package/web/dist/assets/use-mocks-file-status-BUIUJ4oQ.js +1 -0
- package/web/dist/assets/{wand-sparkles-CJ7fSnom.js → wand-sparkles-Bmt4dDOf.js} +1 -1
- package/web/dist/assets/{wifi-CCLKyySQ.js → wifi-Cjj_Br1u.js} +1 -1
- package/web/dist/assets/{zap-DR-xiUMe.js → zap-BuOtogAv.js} +1 -1
- package/web/dist/index.html +16 -10
- package/web/dist/assets/alert-DCvlZAiv.js +0 -1
- package/web/dist/assets/arrow-right-B4Mrlj2-.js +0 -1
- package/web/dist/assets/button-BTToMaBW.js +0 -1
- package/web/dist/assets/checkbox-D1Z9DtjF.js +0 -1
- package/web/dist/assets/chevron-down-CPngAx4M.js +0 -1
- package/web/dist/assets/chevron-right-V1DGIDbL.js +0 -1
- package/web/dist/assets/code-5_eJ_XpJ.js +0 -1
- package/web/dist/assets/code-fixer-D48sCDtp.js +0 -20
- package/web/dist/assets/detail-panel-BSFz9CUw.js +0 -4
- package/web/dist/assets/file-system-access-_og-Tg9o.js +0 -1
- package/web/dist/assets/global-panel-shell-5cJneeis.js +0 -6
- package/web/dist/assets/health-panel-BS3L2e5d.js +0 -1
- package/web/dist/assets/index-CvTR1IVi.js +0 -18
- package/web/dist/assets/index-bfV7sxx5.css +0 -2
- package/web/dist/assets/mock-config-CULJP6Vt.js +0 -1
- package/web/dist/assets/mock-editor-panel-9wlDaySA.js +0 -1
- package/web/dist/assets/monaco-editor-BttaUoOz.js +0 -11
- package/web/dist/assets/plugin-code-editor-BAIBp4lg.js +0 -2
- package/web/dist/assets/plugin-config-ButUV2SZ.js +0 -1
- package/web/dist/assets/plugin-generator-uceUPSCv.js +0 -2
- package/web/dist/assets/plugin-test-dialog-BrJ4HfRX.js +0 -7
- package/web/dist/assets/plus-tVxSydJ8.js +0 -1
- package/web/dist/assets/rotate-ccw-CAYM6Vv0.js +0 -1
- package/web/dist/assets/route-preview-C4cGrS1-.js +0 -1
- package/web/dist/assets/rule-config-BTTGNwMs.js +0 -15
- package/web/dist/assets/rule-overview-panel-SFR2OloL.js +0 -1
- package/web/dist/assets/select-aBXQ0zNa.js +0 -1
- package/web/dist/assets/settings-panel-BMReDG8b.js +0 -1
- package/web/dist/assets/smartphone-DKeDuJTU.js +0 -1
- package/web/dist/assets/switch-Bes_YiJu.js +0 -1
- package/web/dist/assets/table-nW7uQVcl.js +0 -1
- package/web/dist/assets/textarea-BSI0rnW6.js +0 -1
- /package/web/dist/assets/{babel-DCr4VA1c.js → babel-bwZm0qi3.js} +0 -0
- /package/web/dist/assets/{clipboard-VhPXNN5m.js → clipboard-Bt1qY01V.js} +0 -0
- /package/web/dist/assets/{estree-qO_m2Qaw.js → estree-MatbZDwq.js} +0 -0
- /package/web/dist/assets/{html-VDGahtyk.js → html-CCrsbFYX.js} +0 -0
- /package/web/dist/assets/{postcss-BUm8EKMw.js → postcss-BxN7Gr8n.js} +0 -0
- /package/web/dist/assets/{standalone-Bj8SSd8Q.js → standalone-DsnFnsqM.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,f as t,t as n,u as r}from"./button-BTToMaBW.js";import"./dist-C6eaYCUo.js";import{t as i}from"./refresh-cw-CG3HaiQT.js";import{t as a}from"./table-2-BR5e3z8m.js";import{$ as o,A as s,B as c,C as l,D as u,E as d,G as f,M as p,O as m,S as h,T as g,a as _,j as v,k as y,lt as ee,rt as te,w as b}from"./index-CvTR1IVi.js";import{a as x,i as S,n as C,o as w,r as T,t as E}from"./table-nW7uQVcl.js";var D=t(r(),1),O=e(),k=`border-l-2 border-l-transparent`,A=`text-muted-foreground opacity-75`;function j(e){return e.length>0?e.map(e=>`!${e}`).join(` `):`—`}function M({rules:e,activeFileName:t,onLocateRule:r,onSelectFile:M}){let[N,ne]=(0,D.useState)(null),[P,F]=(0,D.useState)(!0),[I,L]=(0,D.useState)(null),[R,z]=(0,D.useState)(`merged`),[B,V]=(0,D.useState)(``),H=(0,D.useDeferredValue)(B),U=(0,D.useCallback)(async()=>{F(!0),L(null);try{let e=await fetch(`/api/rule-files/overview`);if(!e.ok)throw Error(`加载失败(${e.status})`);ne(await e.json())}catch(e){L(e instanceof Error?e.message:`加载失败`)}finally{F(!1)}},[]);(0,D.useEffect)(()=>{U()},[U]);let W=(0,D.useMemo)(()=>N?.perFileRules.find(e=>e.name===t)??null,[N,t]),G=(0,D.useMemo)(()=>{if(!W||W.error)return!1;let t=W.rules.map(e=>({rule:e.rawRule,target:e.rawTarget,enabled:e.enabled,exclusions:e.exclusions}));return _(e)!==_(t)},[W,e]),K=(0,D.useMemo)(()=>{let e=new Map;for(let t of N?.conflicts??[])e.set(t.pattern,t);return e},[N]),q=(0,D.useCallback)(e=>{let t=H.trim().toLowerCase();return t?e.some(e=>e&&e.toLowerCase().includes(t)):!0},[H]),J=(0,D.useMemo)(()=>(N?.mergedRules??[]).map(e=>({winner:e,shadowed:K.get(e.pattern)?.shadowed??[]})).filter(({winner:e,shadowed:t})=>q([e.rawRule,e.rawTarget,e.file])||t.some(e=>q([e.rawRule,e.rawTarget,e.file]))),[N,K,q]),Y=N?.mergedRules.length??0,X=N?.conflicts.reduce((e,t)=>e+t.shadowed.length,0)??0,Z=(0,D.useMemo)(()=>(N?.perFileRules??[]).map(e=>({...e,matched:e.rules.filter(t=>q([t.rawRule,t.rawTarget,e.name]))})).filter(e=>e.error!=null||q([e.name])||e.matched.length>0),[N,q]),re=N?.perFileRules.reduce((e,t)=>e+t.rules.length,0)??0,ie=Z.reduce((e,t)=>e+t.matched.length,0),Q=(0,D.useCallback)((e,t,n)=>{r(e,t,n)},[r]),ae=(0,D.useCallback)((e,t)=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),M(t))},[M]),oe=()=>{if(P)return(0,O.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 p-2`,children:[(0,O.jsx)(p,{className:`h-8 w-full`}),(0,O.jsx)(p,{className:`h-8 w-full`}),(0,O.jsx)(p,{className:`h-8 w-3/4`})]});if(I)return(0,O.jsxs)(l,{className:`min-h-0 flex-1`,children:[(0,O.jsxs)(d,{children:[(0,O.jsx)(u,{variant:`icon`,children:(0,O.jsx)(f,{})}),(0,O.jsx)(m,{children:`加载失败`}),(0,O.jsx)(g,{children:I})]}),(0,O.jsx)(b,{children:(0,O.jsxs)(n,{variant:`outline`,onClick:()=>void U(),children:[(0,O.jsx)(i,{"data-icon":`inline-start`}),`重试`]})})]});let e=(N?.files.length??0)>0,t=N?.perFileRules.some(e=>e.rules.length>0||e.error!=null)??!1,r=H.trim().length>0;return e?t?R===`merged`&&!r&&(N?.mergedRules.length??0)===0?(0,O.jsx)(l,{className:`min-h-0 flex-1`,children:(0,O.jsxs)(d,{children:[(0,O.jsx)(u,{variant:`icon`,children:(0,O.jsx)(te,{})}),(0,O.jsx)(m,{children:`没有生效中的规则`}),(0,O.jsx)(g,{children:`规则全部被禁用,或没有启用任何规则文件;切换到「按文件」查看全部规则`})]})}):r&&R===`merged`&&J.length===0||r&&R===`files`&&Z.every(e=>e.matched.length===0&&e.error==null)?$():R===`merged`?se():ce():(0,O.jsx)(l,{className:`min-h-0 flex-1`,children:(0,O.jsxs)(d,{children:[(0,O.jsx)(u,{variant:`icon`,children:(0,O.jsx)(ee,{})}),(0,O.jsx)(m,{children:`所有规则文件都是空的`}),(0,O.jsx)(g,{children:`还没有任何路由规则,先去路由规则页添加一条吧`})]})}):(0,O.jsx)(l,{className:`min-h-0 flex-1`,children:(0,O.jsxs)(d,{children:[(0,O.jsx)(u,{variant:`icon`,children:(0,O.jsx)(a,{})}),(0,O.jsx)(m,{children:`还没有规则文件`}),(0,O.jsx)(g,{children:`在路由规则页点击「+」创建第一个规则文件`})]})})},$=()=>(0,O.jsxs)(l,{className:`min-h-0 flex-1`,children:[(0,O.jsxs)(d,{children:[(0,O.jsx)(u,{variant:`icon`,children:(0,O.jsx)(o,{})}),(0,O.jsx)(m,{children:`无匹配结果`}),(0,O.jsxs)(g,{children:[`没有找到符合「`,H.trim(),`」的规则`]})]}),(0,O.jsx)(b,{children:(0,O.jsx)(n,{variant:`outline`,onClick:()=>V(``),children:`清空筛选`})})]}),se=()=>(0,O.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-md border`,children:[(0,O.jsx)(`div`,{className:`shrink-0 overflow-x-auto bg-card`,children:(0,O.jsxs)(E,{className:`table-fixed`,children:[(0,O.jsxs)(`colgroup`,{children:[(0,O.jsx)(`col`,{style:{width:`6rem`}}),(0,O.jsx)(`col`,{}),(0,O.jsx)(`col`,{style:{width:`8rem`}}),(0,O.jsx)(`col`,{})]}),(0,O.jsx)(x,{children:(0,O.jsxs)(w,{children:[(0,O.jsx)(S,{children:`来源`}),(0,O.jsx)(S,{children:`规则`}),(0,O.jsx)(S,{className:`hidden md:table-cell`,children:`排除`}),(0,O.jsx)(S,{children:`目标`})]})})]})}),(0,O.jsx)(h,{className:`min-h-0 flex-1`,children:(0,O.jsxs)(E,{className:`table-fixed`,children:[(0,O.jsxs)(`colgroup`,{children:[(0,O.jsx)(`col`,{style:{width:`6rem`}}),(0,O.jsx)(`col`,{}),(0,O.jsx)(`col`,{style:{width:`8rem`}}),(0,O.jsx)(`col`,{})]}),(0,O.jsx)(C,{children:J.map(({winner:e,shadowed:t})=>(0,O.jsxs)(D.Fragment,{children:[(0,O.jsxs)(w,{className:`${k} cursor-pointer`,onClick:()=>Q(e.file,e.rawRule,e.rawTarget),title:`点击定位到该规则`,children:[(0,O.jsx)(T,{className:`truncate text-xs text-muted-foreground`,children:e.file}),(0,O.jsxs)(T,{className:`break-all font-mono text-xs`,children:[e.rawRule,t.length>0&&(0,O.jsx)(c,{variant:`default`,className:`ml-2 px-1 py-0 text-[10px]`,title:`同名规则最终生效的定义`,children:`生效`})]}),(0,O.jsx)(T,{className:`hidden break-all font-mono text-xs text-muted-foreground md:table-cell`,children:j(e.exclusions)}),(0,O.jsx)(T,{className:`break-all font-mono text-xs`,children:e.rawTarget})]}),t.map((t,n)=>(0,O.jsxs)(w,{className:`${k} cursor-pointer ${A}`,onClick:()=>Q(t.file,t.rawRule,t.rawTarget),title:`点击定位到该规则`,children:[(0,O.jsx)(T,{className:`truncate text-xs`,children:t.file}),(0,O.jsx)(T,{className:`break-all font-mono text-xs`,children:(0,O.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-1.5`,children:[t.rawRule,(0,O.jsx)(c,{variant:`destructive`,className:`px-1 py-0 text-[10px]`,title:`已被 ${e.file} 中的同名规则覆盖,实际不生效`,children:`已被覆盖`})]})}),(0,O.jsx)(T,{className:`hidden break-all font-mono text-xs md:table-cell`,children:`—`}),(0,O.jsx)(T,{className:`break-all font-mono text-xs`,children:t.rawTarget})]},`merged-shadowed-${n}`))]},`merged-group-${e.pattern}`))})]})})]}),ce=()=>(0,O.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-md border`,children:[(0,O.jsx)(`div`,{className:`shrink-0 overflow-x-auto bg-card`,children:(0,O.jsxs)(E,{className:`table-fixed`,children:[(0,O.jsxs)(`colgroup`,{children:[(0,O.jsx)(`col`,{style:{width:`3.5rem`}}),(0,O.jsx)(`col`,{}),(0,O.jsx)(`col`,{style:{width:`8rem`}}),(0,O.jsx)(`col`,{})]}),(0,O.jsx)(x,{children:(0,O.jsxs)(w,{children:[(0,O.jsx)(S,{children:`状态`}),(0,O.jsx)(S,{children:`规则`}),(0,O.jsx)(S,{className:`hidden md:table-cell`,children:`排除`}),(0,O.jsx)(S,{children:`目标`})]})})]})}),(0,O.jsx)(h,{className:`min-h-0 flex-1`,children:(0,O.jsxs)(E,{className:`table-fixed`,children:[(0,O.jsxs)(`colgroup`,{children:[(0,O.jsx)(`col`,{style:{width:`3.5rem`}}),(0,O.jsx)(`col`,{}),(0,O.jsx)(`col`,{style:{width:`8rem`}}),(0,O.jsx)(`col`,{})]}),(0,O.jsx)(C,{children:Z.map(e=>(0,O.jsxs)(D.Fragment,{children:[(0,O.jsx)(w,{className:`hover:bg-accent/60`,children:(0,O.jsx)(T,{colSpan:4,className:`cursor-pointer bg-muted/50 p-2 align-middle`,role:`button`,tabIndex:0,onClick:()=>M(e.name),onKeyDown:t=>ae(t,e.name),title:`点击切换到该规则文件`,children:(0,O.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 font-medium`,children:[e.name,(0,O.jsx)(c,{variant:e.enabled?`default`:`secondary`,className:`px-1 py-0 text-[10px]`,children:e.enabled?`启用`:`禁用`}),(0,O.jsx)(c,{variant:`secondary`,className:`px-1 py-0 text-[10px]`,children:e.rules.length})]})})}),e.error&&(0,O.jsx)(w,{className:`text-destructive`,children:(0,O.jsx)(T,{colSpan:4,className:`p-2 text-xs`,children:(0,O.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(f,{className:`h-3.5 w-3.5 shrink-0`}),`读取失败:`,e.error]})})}),e.matched.map((t,n)=>(0,O.jsxs)(w,{className:`cursor-pointer ${t.enabled?``:`opacity-60`}`,onClick:()=>Q(e.name,t.rawRule,t.rawTarget),title:`点击定位到该规则`,children:[(0,O.jsx)(T,{children:(0,O.jsx)(c,{variant:t.enabled?`default`:`secondary`,className:`px-1 py-0 text-[10px]`,children:t.enabled?`启用`:`禁用`})}),(0,O.jsx)(T,{className:`break-all font-mono text-xs`,children:t.rawRule}),(0,O.jsx)(T,{className:`hidden break-all font-mono text-xs text-muted-foreground md:table-cell`,children:j(t.exclusions)}),(0,O.jsx)(T,{className:`break-all font-mono text-xs ${t.enabled?``:`line-through`}`,children:t.rawTarget})]},`file-rule-${n}`))]},`file-group-${e.name}`))})]})})]}),le=R===`merged`?Y+X:re,ue=R===`merged`?J.reduce((e,t)=>e+1+t.shadowed.length,0):ie;return(0,O.jsxs)(`div`,{className:`app-panel-content flex h-full flex-col gap-3`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,O.jsxs)(y,{type:`single`,value:R,onValueChange:e=>{e&&z(e)},variant:`outline`,size:`sm`,className:`bg-background`,"aria-label":`总览视图`,children:[(0,O.jsx)(s,{value:`merged`,children:`生效规则`}),(0,O.jsx)(s,{value:`files`,children:`按文件`})]}),(0,O.jsxs)(`div`,{className:`relative min-w-40 flex-1`,children:[(0,O.jsx)(o,{className:`pointer-events-none absolute top-1/2 left-2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,O.jsx)(v,{value:B,onChange:e=>V(e.target.value),placeholder:`搜索规则 / 目标 / 文件名`,className:`h-8 pl-8`,"aria-label":`搜索规则`})]}),(0,O.jsx)(n,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:()=>void U(),disabled:P,"aria-label":`刷新总览`,title:`刷新`,children:(0,O.jsx)(i,{})})]}),G&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-800`,children:[(0,O.jsx)(f,{className:`h-3.5 w-3.5 shrink-0`}),(0,O.jsxs)(`span`,{children:[`「`,t,`」有未保存修改,此处展示的是代理当前使用的`,(0,O.jsx)(`b`,{children:`已保存内容`})]})]}),!P&&!I&&(N?.files.length??0)>0&&(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,O.jsxs)(`span`,{children:[ue,` / `,le,` 条`,R===`merged`&&H.trim()===``&&X>0?`,其中 ${X} 条被同名规则覆盖`:``]}),R===`merged`&&(0,O.jsx)(`span`,{children:`按代理实际生效顺序排列(后定义覆盖先定义)`}),R===`files`&&(0,O.jsx)(`span`,{children:`点击文件名切换到该文件`})]}),oe()]})}export{M as RuleOverviewPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,f as t,i as n,s as r,u as i}from"./button-BTToMaBW.js";import{a,c as o,n as s,o as c,r as l,t as u}from"./dist-C6eaYCUo.js";import{t as d}from"./chevron-down-CPngAx4M.js";import{n as f,t as p}from"./dist-Blyulj4_.js";import{n as m,t as h}from"./dist-CEd_wnRC.js";import{a as g,i as _,n as v,o as y,r as b,t as x}from"./es2015-DG46NGN7.js";import{n as S,t as C}from"./dist-Ce4ujolc.js";import{t as w}from"./dist-Bsv9ad5F.js";import{vt as T}from"./index-CvTR1IVi.js";var E=t(i(),1),D=e(),O=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),k=`VisuallyHidden`,A=E.forwardRef((e,t)=>(0,D.jsx)(c.span,{...e,ref:t,style:{...O,...e.style}}));A.displayName=k;var j=[`top`,`right`,`bottom`,`left`],M=Math.min,N=Math.max,P=Math.round,F=Math.floor,I=e=>({x:e,y:e}),ee={left:`right`,right:`left`,bottom:`top`,top:`bottom`},te={start:`end`,end:`start`};function ne(e,t,n){return N(e,M(t,n))}function L(e,t){return typeof e==`function`?e(t):e}function R(e){return e.split(`-`)[0]}function z(e){return e.split(`-`)[1]}function B(e){return e===`x`?`y`:`x`}function V(e){return e===`y`?`height`:`width`}var re=new Set([`top`,`bottom`]);function H(e){return re.has(R(e))?`y`:`x`}function ie(e){return B(H(e))}function ae(e,t,n){n===void 0&&(n=!1);let r=z(e),i=ie(e),a=V(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=me(o)),[o,me(o)]}function oe(e){let t=me(e);return[se(e),t,se(t)]}function se(e){return e.replace(/start|end/g,e=>te[e])}var ce=[`left`,`right`],le=[`right`,`left`],ue=[`top`,`bottom`],de=[`bottom`,`top`];function fe(e,t,n){switch(e){case`top`:case`bottom`:return n?t?le:ce:t?ce:le;case`left`:case`right`:return t?ue:de;default:return[]}}function pe(e,t,n,r){let i=z(e),a=fe(R(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(se)))),a}function me(e){return e.replace(/left|right|bottom|top/g,e=>ee[e])}function he(e){return{top:0,right:0,bottom:0,left:0,...e}}function ge(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:he(e)}function _e(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ve(e,t,n){let{reference:r,floating:i}=e,a=H(t),o=ie(t),s=V(o),c=R(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(z(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function ye(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=L(t,e),p=ge(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=_e(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=_e(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var be=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ve(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:{...o,detectOverflow:o.detectOverflow??ye},elements:{reference:e,floating:t}});u=g??u,d=_??d,p={...p,[a]:{...p[a],...v}},y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=ve(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}},xe=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=L(e,t)||{};if(l==null)return{};let d=ge(u),f={x:n,y:r},p=ie(i),m=V(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=M(d[_],T),D=M(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=ne(O,A,k),N=!c.arrow&&z(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,P=N?A<O?A-O:A-k:0;return{[p]:f[p]+P,data:{[p]:j,centerOffset:A-j-P,...N&&{alignmentOffset:P}},reset:N}}}),Se=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=L(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=R(r),_=H(o),v=R(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[me(o)]:oe(o)),x=p!==`none`;!d&&x&&b.push(...pe(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=ae(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==H(t))||T.every(e=>H(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=H(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Ce(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function we(e){return j.some(t=>e[t]>=0)}var Te=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=L(e,t);switch(i){case`referenceHidden`:{let e=Ce(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:we(e)}}}case`escaped`:{let e=Ce(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:we(e)}}}default:return{}}}}},Ee=new Set([`left`,`top`]);async function De(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=R(n),s=z(n),c=H(n)===`y`,l=Ee.has(o)?-1:1,u=a&&c?-1:1,d=L(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Oe=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await De(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},ke=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=L(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=H(R(i)),p=B(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=ne(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=ne(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Ae=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=L(e,t),u={x:n,y:r},d=H(i),f=B(d),p=u[f],m=u[d],h=L(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Ee.has(R(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},je=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=L(e,t),u=await o.detectOverflow(t,l),d=R(i),f=z(i),p=H(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=M(h-u[g],v),x=M(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=N(u.left,0),t=N(u.right,0),n=N(u.top,0),r=N(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:N(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:N(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Me(){return typeof window<`u`}function Ne(e){return Pe(e)?(e.nodeName||``).toLowerCase():`#document`}function U(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function W(e){return((Pe(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Pe(e){return Me()?e instanceof Node||e instanceof U(e).Node:!1}function G(e){return Me()?e instanceof Element||e instanceof U(e).Element:!1}function K(e){return Me()?e instanceof HTMLElement||e instanceof U(e).HTMLElement:!1}function Fe(e){return!Me()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof U(e).ShadowRoot}var Ie=new Set([`inline`,`contents`]);function Le(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=q(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Ie.has(i)}var Re=new Set([`table`,`td`,`th`]);function ze(e){return Re.has(Ne(e))}var Be=[`:popover-open`,`:modal`];function Ve(e){return Be.some(t=>{try{return e.matches(t)}catch{return!1}})}var He=[`transform`,`translate`,`scale`,`rotate`,`perspective`],Ue=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],We=[`paint`,`layout`,`strict`,`content`];function Ge(e){let t=qe(),n=G(e)?q(e):e;return He.some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||Ue.some(e=>(n.willChange||``).includes(e))||We.some(e=>(n.contain||``).includes(e))}function Ke(e){let t=J(e);for(;K(t)&&!Ye(t);){if(Ge(t))return t;if(Ve(t))return null;t=J(t)}return null}function qe(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}var Je=new Set([`html`,`body`,`#document`]);function Ye(e){return Je.has(Ne(e))}function q(e){return U(e).getComputedStyle(e)}function Xe(e){return G(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function J(e){if(Ne(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Fe(e)&&e.host||W(e);return Fe(t)?t.host:t}function Ze(e){let t=J(e);return Ye(t)?e.ownerDocument?e.ownerDocument.body:e.body:K(t)&&Le(t)?t:Ze(t)}function Qe(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ze(e),i=r===e.ownerDocument?.body,a=U(r);if(i){let e=$e(a);return t.concat(a,a.visualViewport||[],Le(r)?r:[],e&&n?Qe(e):[])}return t.concat(r,Qe(r,[],n))}function $e(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function et(e){let t=q(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=K(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=P(n)!==a||P(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function tt(e){return G(e)?e:e.contextElement}function nt(e){let t=tt(e);if(!K(t))return I(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=et(t),o=(a?P(n.width):n.width)/r,s=(a?P(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var rt=I(0);function it(e){let t=U(e);return!qe()||!t.visualViewport?rt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function at(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==U(e)?!1:t}function Y(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=tt(e),o=I(1);t&&(r?G(r)&&(o=nt(r)):o=nt(e));let s=at(a,n,r)?it(a):I(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=U(a),t=r&&G(r)?U(r):r,n=e,i=$e(n);for(;i&&r&&t!==n;){let e=nt(i),t=i.getBoundingClientRect(),r=q(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=U(i),i=$e(n)}}return _e({width:u,height:d,x:c,y:l})}function ot(e,t){let n=Xe(e).scrollLeft;return t?t.left+n:Y(W(e)).left+n}function st(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-ot(e,n),y:n.top+t.scrollTop}}function ct(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=W(r),s=t?Ve(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=I(1),u=I(0),d=K(r);if((d||!d&&!a)&&((Ne(r)!==`body`||Le(o))&&(c=Xe(r)),K(r))){let e=Y(r);l=nt(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?st(o,c):I(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function lt(e){return Array.from(e.getClientRects())}function ut(e){let t=W(e),n=Xe(e),r=e.ownerDocument.body,i=N(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=N(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+ot(e),s=-n.scrollTop;return q(r).direction===`rtl`&&(o+=N(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var dt=25;function ft(e,t){let n=U(e),r=W(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=qe();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=ot(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=dt&&(a-=o)}else l<=dt&&(a+=l);return{width:a,height:o,x:s,y:c}}var pt=new Set([`absolute`,`fixed`]);function mt(e,t){let n=Y(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=K(e)?nt(e):I(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function ht(e,t,n){let r;if(t===`viewport`)r=ft(e,n);else if(t===`document`)r=ut(W(e));else if(G(t))r=mt(t,n);else{let n=it(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return _e(r)}function gt(e,t){let n=J(e);return n===t||!G(n)||Ye(n)?!1:q(n).position===`fixed`||gt(n,t)}function _t(e,t){let n=t.get(e);if(n)return n;let r=Qe(e,[],!1).filter(e=>G(e)&&Ne(e)!==`body`),i=null,a=q(e).position===`fixed`,o=a?J(e):e;for(;G(o)&&!Ye(o);){let t=q(o),n=Ge(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&pt.has(i.position)||Le(o)&&!n&>(e,o))?r=r.filter(e=>e!==o):i=t,o=J(o)}return t.set(e,r),r}function vt(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Ve(t)?[]:_t(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=ht(t,n,i);return e.top=N(r.top,e.top),e.right=M(r.right,e.right),e.bottom=M(r.bottom,e.bottom),e.left=N(r.left,e.left),e},ht(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function yt(e){let{width:t,height:n}=et(e);return{width:t,height:n}}function bt(e,t,n){let r=K(t),i=W(t),a=n===`fixed`,o=Y(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=I(0);function l(){c.x=ot(i)}if(r||!r&&!a)if((Ne(t)!==`body`||Le(i))&&(s=Xe(t)),r){let e=Y(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?st(i,s):I(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function xt(e){return q(e).position===`static`}function St(e,t){if(!K(e)||q(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return W(e)===n&&(n=n.ownerDocument.body),n}function Ct(e,t){let n=U(e);if(Ve(e))return n;if(!K(e)){let t=J(e);for(;t&&!Ye(t);){if(G(t)&&!xt(t))return t;t=J(t)}return n}let r=St(e,t);for(;r&&ze(r)&&xt(r);)r=St(r,t);return r&&Ye(r)&&xt(r)&&!Ge(r)?n:r||Ke(e)||n}var wt=async function(e){let t=this.getOffsetParent||Ct,n=this.getDimensions,r=await n(e.floating);return{reference:bt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Tt(e){return q(e).direction===`rtl`}var Et={convertOffsetParentRelativeRectToViewportRelativeRect:ct,getDocumentElement:W,getClippingRect:vt,getOffsetParent:Ct,getElementRects:wt,getClientRects:lt,getDimensions:yt,getScale:nt,isElement:G,isRTL:Tt};function Dt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ot(e,t){let n=null,r,i=W(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=F(d),h=F(i.clientWidth-(u+f)),g=F(i.clientHeight-(d+p)),_=F(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:N(0,M(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Dt(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function kt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=tt(e),u=i||a?[...l?Qe(l):[],...Qe(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Ot(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?Y(e):null;c&&g();function g(){let t=Y(e);h&&!Dt(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var At=Oe,jt=ke,Mt=Se,Nt=je,Pt=Te,Ft=xe,It=Ae,Lt=(e,t,n)=>{let r=new Map,i={platform:Et,...n},a={...i.platform,_c:r};return be(e,t,{...i,platform:a})},Rt=t(o(),1),zt=typeof document<`u`?E.useLayoutEffect:function(){};function Bt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Bt(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Bt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Vt(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ht(e,t){let n=Vt(e);return Math.round(t*n)/n}function Ut(e){let t=E.useRef(e);return zt(()=>{t.current=e}),t}function Wt(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=E.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=E.useState(r);Bt(f,r)||p(r);let[m,h]=E.useState(null),[g,_]=E.useState(null),v=E.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=E.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=E.useRef(null),C=E.useRef(null),w=E.useRef(u),T=c!=null,D=Ut(c),O=Ut(i),k=Ut(l),A=E.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Lt(S.current,C.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!Bt(w.current,t)&&(w.current=t,Rt.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);zt(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=E.useRef(!1);zt(()=>(j.current=!0,()=>{j.current=!1}),[]),zt(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(D.current)return D.current(b,x,A);A()}},[b,x,A,D,T]);let M=E.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),N=E.useMemo(()=>({reference:b,floating:x}),[b,x]),P=E.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=Ht(N.floating,u.x),r=Ht(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Vt(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return E.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var Gt=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Ft({element:r.current,padding:i}).fn(n):r?Ft({element:r,padding:i}).fn(n):{}}}},Kt=(e,t)=>({...At(e),options:[e,t]}),qt=(e,t)=>({...jt(e),options:[e,t]}),Jt=(e,t)=>({...It(e),options:[e,t]}),Yt=(e,t)=>({...Mt(e),options:[e,t]}),Xt=(e,t)=>({...Nt(e),options:[e,t]}),Zt=(e,t)=>({...Pt(e),options:[e,t]}),Qt=(e,t)=>({...Gt(e),options:[e,t]}),$t=`Arrow`,en=E.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,D.jsx)(c.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,D.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});en.displayName=$t;var tn=en,nn=`Popper`,[rn,an]=a(nn),[on,sn]=rn(nn),cn=e=>{let{__scopePopper:t,children:n}=e,[r,i]=E.useState(null);return(0,D.jsx)(on,{scope:t,anchor:r,onAnchorChange:i,children:n})};cn.displayName=nn;var ln=`PopperAnchor`,un=E.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:i,...a}=e,o=sn(ln,n),s=E.useRef(null),l=r(t,s),u=E.useRef(null);return E.useEffect(()=>{let e=u.current;u.current=i?.current||s.current,e!==u.current&&o.onAnchorChange(u.current)}),i?null:(0,D.jsx)(c.div,{...a,ref:l})});un.displayName=ln;var dn=`PopperContent`,[fn,pn]=rn(dn),mn=E.forwardRef((e,t)=>{let{__scopePopper:n,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:l=0,arrowPadding:u=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:m=`partial`,hideWhenDetached:g=!1,updatePositionStrategy:_=`optimized`,onPlaced:v,...y}=e,b=sn(dn,n),[x,S]=E.useState(null),w=r(t,e=>S(e)),[T,O]=E.useState(null),k=C(T),A=k?.width??0,j=k?.height??0,M=i+(o===`center`?``:`-`+o),N=typeof p==`number`?p:{top:0,right:0,bottom:0,left:0,...p},P=Array.isArray(f)?f:[f],F=P.length>0,I={padding:N,boundary:P.filter(vn),altBoundary:F},{refs:ee,floatingStyles:te,placement:ne,isPositioned:L,middlewareData:R}=Wt({strategy:`fixed`,placement:M,whileElementsMounted:(...e)=>kt(...e,{animationFrame:_===`always`}),elements:{reference:b.anchor},middleware:[Kt({mainAxis:a+j,alignmentAxis:l}),d&&qt({mainAxis:!0,crossAxis:!1,limiter:m===`partial`?Jt():void 0,...I}),d&&Yt({...I}),Xt({...I,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),T&&Qt({element:T,padding:u}),yn({arrowWidth:A,arrowHeight:j}),g&&Zt({strategy:`referenceHidden`,...I})]}),[z,B]=bn(ne),V=h(v);s(()=>{L&&V?.()},[L,V]);let re=R.arrow?.x,H=R.arrow?.y,ie=R.arrow?.centerOffset!==0,[ae,oe]=E.useState();return s(()=>{x&&oe(window.getComputedStyle(x).zIndex)},[x]),(0,D.jsx)(`div`,{ref:ee.setFloating,"data-radix-popper-content-wrapper":``,style:{...te,transform:L?te.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ae,"--radix-popper-transform-origin":[R.transformOrigin?.x,R.transformOrigin?.y].join(` `),...R.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,D.jsx)(fn,{scope:n,placedSide:z,onArrowChange:O,arrowX:re,arrowY:H,shouldHideArrow:ie,children:(0,D.jsx)(c.div,{"data-side":z,"data-align":B,...y,ref:w,style:{...y.style,animation:L?void 0:`none`}})})})});mn.displayName=dn;var hn=`PopperArrow`,gn={top:`bottom`,right:`left`,bottom:`top`,left:`right`},_n=E.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=pn(hn,n),a=gn[i.placedSide];return(0,D.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,D.jsx)(tn,{...r,ref:t,style:{...r.style,display:`block`}})})});_n.displayName=hn;function vn(e){return e!==null}var yn=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=bn(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function bn(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var xn=cn,Sn=un,Cn=mn,wn=_n,Tn=[` `,`Enter`,`ArrowUp`,`ArrowDown`],En=[` `,`Enter`],X=`Select`,[Dn,On,kn]=f(X),[An,jn]=a(X,[kn,an]),Mn=an(),[Nn,Z]=An(X),[Pn,Fn]=An(X),In=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:d,autoComplete:f,disabled:h,required:g,form:_}=e,v=Mn(t),[y,b]=E.useState(null),[x,S]=E.useState(null),[C,w]=E.useState(!1),T=p(l),[O,k]=u({prop:r,defaultProp:i??!1,onChange:a,caller:X}),[A,j]=u({prop:o,defaultProp:s,onChange:c,caller:X}),M=E.useRef(null),N=y?_||!!y.closest(`form`):!0,[P,F]=E.useState(new Set),I=Array.from(P).map(e=>e.props.value).join(`;`);return(0,D.jsx)(xn,{...v,children:(0,D.jsxs)(Nn,{required:g,scope:t,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:m(),value:A,onValueChange:j,open:O,onOpenChange:k,dir:T,triggerPointerDownPosRef:M,disabled:h,children:[(0,D.jsx)(Dn.Provider,{scope:t,children:(0,D.jsx)(Pn,{scope:e.__scopeSelect,onNativeOptionAdd:E.useCallback(e=>{F(t=>new Set(t).add(e))},[]),onNativeOptionRemove:E.useCallback(e=>{F(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),N?(0,D.jsxs)(kr,{"aria-hidden":!0,required:g,tabIndex:-1,name:d,autoComplete:f,value:A,onChange:e=>j(e.target.value),disabled:h,form:_,children:[A===void 0?(0,D.jsx)(`option`,{value:``}):null,Array.from(P)]},I):null]})})};In.displayName=X;var Ln=`SelectTrigger`,Rn=E.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:i=!1,...a}=e,o=Mn(n),s=Z(Ln,n),u=s.disabled||i,d=r(t,s.onTriggerChange),f=On(n),p=E.useRef(`touch`),[m,h,g]=jr(e=>{let t=f().filter(e=>!e.disabled),n=Mr(t,e,t.find(e=>e.value===s.value));n!==void 0&&s.onValueChange(n.value)}),_=e=>{u||(s.onOpenChange(!0),g()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,D.jsx)(Sn,{asChild:!0,...o,children:(0,D.jsx)(c.button,{type:`button`,role:`combobox`,"aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":`none`,dir:s.dir,"data-state":s.open?`open`:`closed`,disabled:u,"data-disabled":u?``:void 0,"data-placeholder":Ar(s.value)?``:void 0,...a,ref:d,onClick:l(a.onClick,e=>{e.currentTarget.focus(),p.current!==`mouse`&&_(e)}),onPointerDown:l(a.onPointerDown,e=>{p.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(_(e),e.preventDefault())}),onKeyDown:l(a.onKeyDown,e=>{let t=m.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&h(e.key),!(t&&e.key===` `)&&Tn.includes(e.key)&&(_(),e.preventDefault())})})})});Rn.displayName=Ln;var zn=`SelectValue`,Bn=E.forwardRef((e,t)=>{let{__scopeSelect:n,className:i,style:a,children:o,placeholder:l=``,...u}=e,d=Z(zn,n),{onValueNodeHasChildrenChange:f}=d,p=o!==void 0,m=r(t,d.onValueNodeChange);return s(()=>{f(p)},[f,p]),(0,D.jsx)(c.span,{...u,ref:m,style:{pointerEvents:`none`},children:Ar(d.value)?(0,D.jsx)(D.Fragment,{children:l}):o})});Bn.displayName=zn;var Vn=`SelectIcon`,Hn=E.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,D.jsx)(c.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});Hn.displayName=Vn;var Un=`SelectPortal`,Wn=e=>(0,D.jsx)(_,{asChild:!0,...e});Wn.displayName=Un;var Gn=`SelectContent`,Kn=E.forwardRef((e,t)=>{let n=Z(Gn,e.__scopeSelect),[r,i]=E.useState();if(s(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Rt.createPortal((0,D.jsx)(qn,{scope:e.__scopeSelect,children:(0,D.jsx)(Dn.Slot,{scope:e.__scopeSelect,children:(0,D.jsx)(`div`,{children:e.children})})}),t):null}return(0,D.jsx)(Xn,{...e,ref:t})});Kn.displayName=Gn;var Q=10,[qn,$]=An(Gn),Jn=`SelectContentImpl`,Yn=n(`SelectContent.RemoveScroll`),Xn=E.forwardRef((e,t)=>{let{__scopeSelect:n,position:i=`item-aligned`,onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:_,hideWhenDetached:S,avoidCollisions:C,...w}=e,T=Z(Gn,n),[O,k]=E.useState(null),[A,j]=E.useState(null),M=r(t,e=>k(e)),[N,P]=E.useState(null),[F,I]=E.useState(null),ee=On(n),[te,ne]=E.useState(!1),L=E.useRef(!1);E.useEffect(()=>{if(O)return x(O)},[O]),b();let R=E.useCallback(e=>{let[t,...n]=ee().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&A&&(A.scrollTop=0),n===r&&A&&(A.scrollTop=A.scrollHeight),n?.focus(),document.activeElement!==i))return},[ee,A]),z=E.useCallback(()=>R([N,O]),[R,N,O]);E.useEffect(()=>{te&&z()},[te,z]);let{onOpenChange:B,triggerPointerDownPosRef:V}=T;E.useEffect(()=>{if(O){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(V.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(V.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():O.contains(n.target)||B(!1),document.removeEventListener(`pointermove`,t),V.current=null};return V.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[O,B,V]),E.useEffect(()=>{let e=()=>B(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[B]);let[re,H]=jr(e=>{let t=ee().filter(e=>!e.disabled),n=Mr(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ie=E.useCallback((e,t,n)=>{let r=!L.current&&!n;(T.value!==void 0&&T.value===t||r)&&(P(e),r&&(L.current=!0))},[T.value]),ae=E.useCallback(()=>O?.focus(),[O]),oe=E.useCallback((e,t,n)=>{let r=!L.current&&!n;(T.value!==void 0&&T.value===t||r)&&I(e)},[T.value]),se=i===`popper`?er:Qn,ce=se===er?{side:c,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:_,hideWhenDetached:S,avoidCollisions:C}:{};return(0,D.jsx)(qn,{scope:n,content:O,viewport:A,onViewportChange:j,itemRefCallback:ie,selectedItem:N,onItemLeave:ae,itemTextRefCallback:oe,focusSelectedItem:z,selectedItemText:F,position:i,isPositioned:te,searchRef:re,children:(0,D.jsx)(v,{as:Yn,allowPinchZoom:!0,children:(0,D.jsx)(g,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:l(a,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,D.jsx)(y,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,D.jsx)(se,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...w,...ce,onPlaced:()=>ne(!0),ref:M,style:{display:`flex`,flexDirection:`column`,outline:`none`,...w.style},onKeyDown:l(w.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&H(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=ee().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>R(t)),e.preventDefault()}})})})})})})});Xn.displayName=Jn;var Zn=`SelectItemAlignedPosition`,Qn=E.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:i,...a}=e,o=Z(Gn,n),l=$(Gn,n),[u,d]=E.useState(null),[f,p]=E.useState(null),m=r(t,e=>p(e)),h=On(n),g=E.useRef(!1),_=E.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=l,S=E.useCallback(()=>{if(o.trigger&&o.valueNode&&u&&f&&v&&y&&b){let e=o.trigger.getBoundingClientRect(),t=f.getBoundingClientRect(),n=o.valueNode.getBoundingClientRect(),r=b.getBoundingClientRect();if(o.dir!==`rtl`){let i=r.left-t.left,a=n.left-i,o=e.left-a,s=e.width+o,c=Math.max(s,t.width),l=window.innerWidth-Q,d=w(a,[Q,Math.max(Q,l-c)]);u.style.minWidth=s+`px`,u.style.left=d+`px`}else{let i=t.right-r.right,a=window.innerWidth-n.right-i,o=window.innerWidth-e.right-a,s=e.width+o,c=Math.max(s,t.width),l=window.innerWidth-Q,d=w(a,[Q,Math.max(Q,l-c)]);u.style.minWidth=s+`px`,u.style.right=d+`px`}let a=h(),s=window.innerHeight-Q*2,c=v.scrollHeight,l=window.getComputedStyle(f),d=parseInt(l.borderTopWidth,10),p=parseInt(l.paddingTop,10),m=parseInt(l.borderBottomWidth,10),_=parseInt(l.paddingBottom,10),x=d+p+c+_+m,S=Math.min(y.offsetHeight*5,x),C=window.getComputedStyle(v),T=parseInt(C.paddingTop,10),E=parseInt(C.paddingBottom,10),D=e.top+e.height/2-Q,O=s-D,k=y.offsetHeight/2,A=y.offsetTop+k,j=d+p+A,M=x-j;if(j<=D){let e=a.length>0&&y===a[a.length-1].ref.current;u.style.bottom=`0px`;let t=f.clientHeight-v.offsetTop-v.offsetHeight,n=j+Math.max(O,k+(e?E:0)+t+m);u.style.height=n+`px`}else{let e=a.length>0&&y===a[0].ref.current;u.style.top=`0px`;let t=Math.max(D,d+v.offsetTop+(e?T:0)+k)+M;u.style.height=t+`px`,v.scrollTop=j-D+v.offsetTop}u.style.margin=`${Q}px 0`,u.style.minHeight=S+`px`,u.style.maxHeight=s+`px`,i?.(),requestAnimationFrame(()=>g.current=!0)}},[h,o.trigger,o.valueNode,u,f,v,y,b,o.dir,i]);s(()=>S(),[S]);let[C,T]=E.useState();return s(()=>{f&&T(window.getComputedStyle(f).zIndex)},[f]),(0,D.jsx)(tr,{scope:n,contentWrapper:u,shouldExpandOnScrollRef:g,onScrollButtonChange:E.useCallback(e=>{e&&_.current===!0&&(S(),x?.(),_.current=!1)},[S,x]),children:(0,D.jsx)(`div`,{ref:d,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,D.jsx)(c.div,{...a,ref:m,style:{boxSizing:`border-box`,maxHeight:`100%`,...a.style}})})})});Qn.displayName=Zn;var $n=`SelectPopperPosition`,er=E.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Q,...a}=e,o=Mn(n);return(0,D.jsx)(Cn,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});er.displayName=$n;var[tr,nr]=An(Gn,{}),rr=`SelectViewport`,ir=E.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:i,...a}=e,o=$(rr,n),s=nr(rr,n),u=r(t,o.onViewportChange),d=E.useRef(0);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:i}),(0,D.jsx)(Dn.Slot,{scope:n,children:(0,D.jsx)(c.div,{"data-radix-select-viewport":``,role:`presentation`,...a,ref:u,style:{position:`relative`,flex:1,overflow:`hidden auto`,...a.style},onScroll:l(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){let e=Math.abs(d.current-t.scrollTop);if(e>0){let r=window.innerHeight-Q*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}d.current=t.scrollTop})})})]})});ir.displayName=rr;var ar=`SelectGroup`,[or,sr]=An(ar),cr=E.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=m();return(0,D.jsx)(or,{scope:n,id:i,children:(0,D.jsx)(c.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});cr.displayName=ar;var lr=`SelectLabel`,ur=E.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=sr(lr,n);return(0,D.jsx)(c.div,{id:i.id,...r,ref:t})});ur.displayName=lr;var dr=`SelectItem`,[fr,pr]=An(dr),mr=E.forwardRef((e,t)=>{let{__scopeSelect:n,value:i,disabled:a=!1,textValue:o,...s}=e,u=Z(dr,n),d=$(dr,n),f=u.value===i,[p,h]=E.useState(o??``),[g,_]=E.useState(!1),v=r(t,e=>d.itemRefCallback?.(e,i,a)),y=m(),b=E.useRef(`touch`),x=()=>{a||(u.onValueChange(i),u.onOpenChange(!1))};if(i===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,D.jsx)(fr,{scope:n,value:i,disabled:a,textId:y,isSelected:f,onItemTextChange:E.useCallback(e=>{h(t=>t||(e?.textContent??``).trim())},[]),children:(0,D.jsx)(Dn.ItemSlot,{scope:n,value:i,disabled:a,textValue:p,children:(0,D.jsx)(c.div,{role:`option`,"aria-labelledby":y,"data-highlighted":g?``:void 0,"aria-selected":f&&g,"data-state":f?`checked`:`unchecked`,"aria-disabled":a||void 0,"data-disabled":a?``:void 0,tabIndex:a?void 0:-1,...s,ref:v,onFocus:l(s.onFocus,()=>_(!0)),onBlur:l(s.onBlur,()=>_(!1)),onClick:l(s.onClick,()=>{b.current!==`mouse`&&x()}),onPointerUp:l(s.onPointerUp,()=>{b.current===`mouse`&&x()}),onPointerDown:l(s.onPointerDown,e=>{b.current=e.pointerType}),onPointerMove:l(s.onPointerMove,e=>{b.current=e.pointerType,a?d.onItemLeave?.():b.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:l(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:l(s.onKeyDown,e=>{d.searchRef?.current!==``&&e.key===` `||(En.includes(e.key)&&x(),e.key===` `&&e.preventDefault())})})})})});mr.displayName=dr;var hr=`SelectItemText`,gr=E.forwardRef((e,t)=>{let{__scopeSelect:n,className:i,style:a,...o}=e,l=Z(hr,n),u=$(hr,n),d=pr(hr,n),f=Fn(hr,n),[p,m]=E.useState(null),h=r(t,e=>m(e),d.onItemTextChange,e=>u.itemTextRefCallback?.(e,d.value,d.disabled)),g=p?.textContent,_=E.useMemo(()=>(0,D.jsx)(`option`,{value:d.value,disabled:d.disabled,children:g},d.value),[d.disabled,d.value,g]),{onNativeOptionAdd:v,onNativeOptionRemove:y}=f;return s(()=>(v(_),()=>y(_)),[v,y,_]),(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(c.span,{id:d.textId,...o,ref:h}),d.isSelected&&l.valueNode&&!l.valueNodeHasChildren?Rt.createPortal(o.children,l.valueNode):null]})});gr.displayName=hr;var _r=`SelectItemIndicator`,vr=E.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return pr(_r,n).isSelected?(0,D.jsx)(c.span,{"aria-hidden":!0,...r,ref:t}):null});vr.displayName=_r;var yr=`SelectScrollUpButton`,br=E.forwardRef((e,t)=>{let n=$(yr,e.__scopeSelect),i=nr(yr,e.__scopeSelect),[a,o]=E.useState(!1),c=r(t,i.onScrollButtonChange);return s(()=>{if(n.viewport&&n.isPositioned){let e=function(){o(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,D.jsx)(Cr,{...e,ref:c,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});br.displayName=yr;var xr=`SelectScrollDownButton`,Sr=E.forwardRef((e,t)=>{let n=$(xr,e.__scopeSelect),i=nr(xr,e.__scopeSelect),[a,o]=E.useState(!1),c=r(t,i.onScrollButtonChange);return s(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;o(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,D.jsx)(Cr,{...e,ref:c,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Sr.displayName=xr;var Cr=E.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=$(`SelectScrollButton`,n),o=E.useRef(null),u=On(n),d=E.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return E.useEffect(()=>()=>d(),[d]),s(()=>{u().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[u]),(0,D.jsx)(c.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:l(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:l(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:l(i.onPointerLeave,()=>{d()})})}),wr=`SelectSeparator`,Tr=E.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,D.jsx)(c.div,{"aria-hidden":!0,...r,ref:t})});Tr.displayName=wr;var Er=`SelectArrow`,Dr=E.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Mn(n),a=Z(Er,n),o=$(Er,n);return a.open&&o.position===`popper`?(0,D.jsx)(wn,{...i,...r,ref:t}):null});Dr.displayName=Er;var Or=`SelectBubbleInput`,kr=E.forwardRef(({__scopeSelect:e,value:t,...n},i)=>{let a=E.useRef(null),o=r(i,a),s=S(t);return E.useEffect(()=>{let e=a.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(s!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[s,t]),(0,D.jsx)(c.select,{...n,style:{...O,...n.style},ref:o,defaultValue:t})});kr.displayName=Or;function Ar(e){return e===``||e===void 0}function jr(e){let t=h(e),n=E.useRef(``),r=E.useRef(0),i=E.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=E.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return E.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function Mr(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Nr(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Nr(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Pr=In,Fr=Rn,Ir=Bn,Lr=Hn,Rr=Wn,zr=Kn,Br=ir,Vr=cr,Hr=mr,Ur=gr,Wr=vr,Gr=Pr,Kr=Vr,qr=Ir,Jr=E.forwardRef(({className:e,children:t,...n},r)=>(0,D.jsxs)(Fr,{ref:r,className:Zr(`flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,D.jsx)(Lr,{asChild:!0,children:(0,D.jsx)(d,{className:`h-4 w-4 opacity-50`})})]}));Jr.displayName=Fr.displayName;var Yr=E.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,D.jsx)(Rr,{children:(0,D.jsx)(zr,{ref:i,className:Zr(`relative z-[100] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:(0,D.jsx)(Br,{className:Zr(`p-1`,n===`popper`&&`w-full min-w-[var(--radix-select-trigger-width)]`),children:t})})}));Yr.displayName=zr.displayName;var Xr=E.forwardRef(({className:e,children:t,...n},r)=>(0,D.jsxs)(Hr,{ref:r,className:Zr(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,D.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,D.jsx)(Wr,{children:(0,D.jsx)(T,{className:`h-4 w-4`})})}),(0,D.jsx)(Ur,{children:t})]}));Xr.displayName=Hr.displayName;function Zr(...e){return e.filter(Boolean).join(` `)}export{Jr as a,Xr as i,Yr as n,qr as o,Kr as r,Gr as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,f as t,l as n,t as r,u as i}from"./button-BTToMaBW.js";import"./dist-C6eaYCUo.js";import{t as a}from"./circle-alert-Q8cZk9Rv.js";import{t as o}from"./circle-x-C9USji_R.js";import{t as s}from"./plus-tVxSydJ8.js";import{t as ee}from"./refresh-cw-CG3HaiQT.js";import{t as te}from"./rotate-ccw-CAYM6Vv0.js";import{t as c}from"./smartphone-DKeDuJTU.js";import{a as ne,i as l,n as re,o as ie,r as ae,t as oe}from"./select-aBXQ0zNa.js";import"./es2015-DG46NGN7.js";import{t as se}from"./switch-Bes_YiJu.js";import{a as u,c as ce,l as le,n as ue,o as d,r as f,s as de,t as fe}from"./ai-config-store-C8D_PUGV.js";import{A as p,B as pe,H as m,K as me,Q as he,U as ge,V as _e,W as h,Y as ve,Z as ye,_ as be,_t as g,b as _,c as xe,d as Se,et as v,f as Ce,g as we,h as Te,j as y,k as b,l as x,m as S,o as Ee,ot as De,p as C,pt as w,s as Oe,st as ke,u as T,v as Ae,vt as je,y as Me}from"./index-CvTR1IVi.js";import{n as Ne,r as Pe,t as Fe}from"./alert-DCvlZAiv.js";var Ie=n(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Le=n(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),E=n(`stethoscope`,[[`path`,{d:`M11 2v2`,key:`1539x4`}],[`path`,{d:`M5 2v2`,key:`1yf1q8`}],[`path`,{d:`M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1`,key:`rb5t3r`}],[`path`,{d:`M8 15a6 6 0 0 0 12 0v-3`,key:`x18d4x`}],[`circle`,{cx:`20`,cy:`10`,r:`2`,key:`ts1r5v`}]]),D=t(i(),1),O=e(),Re=[{value:`75`,label:`75%`,scale:.75},{value:`90`,label:`90%`,scale:.9},{value:`100`,label:`100%`,scale:1},{value:`110`,label:`110%`,scale:1.1},{value:`125`,label:`125%`,scale:1.25},{value:`150`,label:`150%`,scale:1.5}],ze=[{value:`auto`,label:`自动`,color:`linear-gradient(135deg, oklch(0.623 0.214 259.815), oklch(0.606 0.25 292.717))`},{value:`neutral`,label:`中性`,color:`oklch(0.556 0 0)`},{value:`blue`,label:`蓝色`,color:`oklch(0.623 0.214 259.815)`},{value:`violet`,label:`紫色`,color:`oklch(0.606 0.25 292.717)`},{value:`green`,label:`绿色`,color:`oklch(0.627 0.194 149.214)`},{value:`orange`,label:`橙色`,color:`oklch(0.646 0.222 41.116)`},{value:`rose`,label:`玫红`,color:`oklch(0.645 0.246 16.439)`}],k=`app-panel-content mt-0`,A=`app-field-group`,j=`app-section`,M=e=>{if(!e)return`100`;let t={small:`90`,medium:`100`,large:`110`};return e in t?t[e]:Re.some(t=>t.value===e)?e:`100`};function Be({open:e=!1,onOpenChange:t,embedded:n=!1}){let{theme:i,accentColor:Be,setTheme:Ve,setAccentColor:He,setZoom:N}=Ee(),[P,Ue]=(0,D.useState)(`preferences`),[F,I]=(0,D.useState)(()=>f()),[L,We]=(0,D.useState)(!1),[R,z]=(0,D.useState)(!1),[B,V]=(0,D.useState)(null),[Ge,H]=(0,D.useState)(``),[U,W]=(0,D.useState)(null),[G,Ke]=(0,D.useState)(``),[qe,Je]=(0,D.useState)([]),[K,q]=(0,D.useState)({}),[J,Ye]=(0,D.useState)(``),[Y,Xe]=(0,D.useState)(``),[X,Z]=(0,D.useState)(null),[Ze,Qe]=(0,D.useState)(!1),[Q,$e]=(0,D.useState)(()=>M(Oe().fontSize)),[et,tt]=(0,D.useState)(!1);(0,D.useEffect)(()=>{xe().then(e=>{let t=M(e.fontSize);$e(t),N(parseInt(t,10)/100),tt(!0)}).catch(()=>{tt(!0)})},[N]),(0,D.useEffect)(()=>{if(!et)return;let e=M(Q);N(parseInt(e,10)/100),x({fontSize:e}).catch(console.error)},[N,et,Q]),(0,D.useEffect)(()=>{(e||n)&&(xe().then(e=>{I(e.aiConfig),Ke(e.mocksFilePath||``),q(e.clientAliases||{})}).catch(()=>{I(f())}),V(null),H(``),fetch(`/api/rule-files`).then(e=>e.json()).then(e=>{Array.isArray(e)&&Je(e)}).catch(()=>{}))},[e,n]);let nt=e=>{let t=u(e);I({...F,provider:e,baseUrl:t.baseUrl,model:t.model})},rt=async()=>{z(!0);try{await x({aiConfig:F}),ce(F),V(`success`),H(`AI 配置保存成功`),T.success(`AI 配置保存成功`)}catch(e){let t=e instanceof Error?e.message:`保存失败`;V(`error`),H(t),T.error(t)}finally{z(!1)}},it=()=>{de(),I(f()),V(null),H(``)},at=async()=>{if(!d(F)){V(`error`),H(`请填写完整的配置信息`);return}z(!0),V(null),H(`测试中...`);try{let e=F.baseUrl,t={"Content-Type":`application/json`},n;F.provider===`anthropic`?(t[`x-api-key`]=F.apiKey,t[`anthropic-version`]=`2023-06-01`,n={model:F.model,max_tokens:100,system:`You are a helpful assistant.`,messages:[{role:`user`,content:`Say "test successful"`}],temperature:.3}):(t.Authorization=`Bearer ${F.apiKey}`,n={model:F.model,messages:[{role:`system`,content:`You are a helpful assistant.`},{role:`user`,content:`Say "test successful"`}],temperature:.3,max_tokens:100});let r=await fetch(e,{method:`POST`,headers:t,body:JSON.stringify(n)});if(!r.ok){let e=await r.text();throw Error(`API错误 (${r.status}): ${e}`)}let i=await r.json();if(F.provider===`anthropic`){if(!i.content?.[0]?.text)throw Error(`API响应格式不正确`)}else if(!i.choices?.[0]?.message?.content)throw Error(`API响应格式不正确`);V(`success`),H(`连接测试成功! API配置正常`)}catch(e){V(`error`),H(e instanceof Error?e.message:`测试失败`)}finally{z(!1)}},ot=(0,D.useCallback)(async()=>{try{let e=await fetch(`/api/refresh-config`,{method:`POST`});if(e.ok){let t=await e.json();V(`success`),H(t.message||`配置已刷新`),setTimeout(()=>{V(null),H(``)},2e3)}else{let t=await e.json();V(`error`),H(t.error||`刷新配置失败`),setTimeout(()=>{V(null),H(``)},2e3)}}catch(e){console.error(`刷新配置失败:`,e),V(`error`),H(`刷新配置失败`),setTimeout(()=>{V(null),H(``)},2e3)}},[]),st=(0,D.useCallback)(async()=>{Qe(!0),Z(null);try{let e=await fetch(`/api/config-doctor`);e.ok?Z(await e.json()):(V(`error`),H(`诊断失败`),setTimeout(()=>{V(null),H(``)},2e3))}catch(e){console.error(`诊断失败:`,e),V(`error`),H(`诊断失败`),setTimeout(()=>{V(null),H(``)},2e3)}finally{Qe(!1)}},[]),ct=()=>{let e=J.trim(),t=Y.trim();!e||!t||(q(n=>({...n,[e]:t})),Ye(``),Xe(``))},lt=async()=>{z(!0);try{await x({clientAliases:K}),V(`success`),H(`客户端名称已保存,新请求立即生效`),T.success(`客户端名称保存成功`)}catch(e){let t=e instanceof Error?e.message:`保存失败`;V(`error`),H(t),T.error(t)}finally{z(!1)}},ut=async()=>{z(!0);try{await x({mocksFilePath:G}),V(`success`),H(`Mock 文件路径已更新,刷新页面后生效`),T.success(`Mock 文件路径保存成功`),setTimeout(()=>{V(null),H(``)},3e3)}catch(e){let t=e instanceof Error?e.message:`保存失败`;V(`error`),H(t),T.error(t)}finally{z(!1)}};Se({active:(e||n)&&P!==`preferences`,enabled:!R,priority:Ce.panel,onSave:()=>{if(P===`config`)return ut();if(P===`clients`)return lt();if(P===`ai`)return rt()}});let $=(0,O.jsxs)(O.Fragment,{children:[!n&&(0,O.jsxs)(Ae,{className:`px-6 pt-6 pb-4`,children:[(0,O.jsxs)(Me,{className:`flex items-center gap-2`,children:[(0,O.jsx)(he,{className:`h-5 w-5`}),`系统设置`]}),(0,O.jsx)(be,{children:`管理系统偏好、配置和 AI 功能`})]}),(0,O.jsxs)(_e,{value:P,onValueChange:e=>Ue(e),orientation:`vertical`,className:`min-h-0 flex-1 gap-0`,children:[(0,O.jsxs)(ge,{"aria-label":`设置分类`,className:`h-full w-14 shrink-0 self-stretch justify-start gap-1 rounded-none border-r bg-muted/25 p-2 group-data-[orientation=vertical]/tabs:!h-full sm:w-44 sm:p-3`,children:[(0,O.jsxs)(h,{value:`preferences`,className:`h-9 w-full flex-none justify-start px-2.5 sm:px-3`,children:[(0,O.jsx)(he,{}),(0,O.jsx)(`span`,{className:`hidden sm:inline`,children:`偏好设置`})]}),(0,O.jsxs)(h,{value:`config`,className:`h-9 w-full flex-none justify-start px-2.5 sm:px-3`,children:[(0,O.jsx)(w,{}),(0,O.jsx)(`span`,{className:`hidden sm:inline`,children:`配置文件`})]}),(0,O.jsxs)(h,{value:`clients`,className:`h-9 w-full flex-none justify-start px-2.5 sm:px-3`,children:[(0,O.jsx)(c,{}),(0,O.jsx)(`span`,{className:`hidden sm:inline`,children:`客户端`})]}),(0,O.jsxs)(h,{value:`ai`,className:`h-9 w-full flex-none justify-start px-2.5 sm:px-3`,children:[(0,O.jsx)(ye,{}),(0,O.jsx)(`span`,{className:`hidden sm:inline`,children:`AI 配置`})]})]}),(0,O.jsxs)(m,{value:`preferences`,className:k,children:[(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(_,{className:`text-sm`,children:`主题`}),(0,O.jsxs)(oe,{value:i,onValueChange:e=>Ve(e),children:[(0,O.jsx)(ne,{children:(0,O.jsx)(ie,{placeholder:`选择主题`})}),(0,O.jsx)(re,{children:(0,O.jsxs)(ae,{children:[(0,O.jsx)(l,{value:`system`,children:(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(ke,{className:`size-4`}),`跟随系统`]})}),(0,O.jsx)(l,{value:`light`,children:(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(ve,{className:`size-4`}),`浅色模式`]})}),(0,O.jsx)(l,{value:`dark`,children:(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(De,{className:`size-4`}),`深色模式`]})})]})})]})]}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,O.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,O.jsx)(_,{className:`text-sm`,children:`强调色`}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`统一按钮、状态、选中项和焦点样式。自动模式会根据明暗主题选择合适的颜色。`})]}),(0,O.jsx)(b,{type:`single`,value:Be,onValueChange:e=>{e&&He(e)},variant:`outline`,spacing:1,className:`flex-wrap justify-start`,"aria-label":`强调色`,children:ze.map(e=>(0,O.jsxs)(p,{value:e.value,"aria-label":e.label,children:[e.value===`auto`?(0,O.jsx)(ye,{"data-icon":`inline-start`}):(0,O.jsx)(`span`,{className:`size-3 rounded-full border border-foreground/10`,style:{background:e.color}}),e.label]},e.value))})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(_,{className:`text-sm`,children:`缩放比例`}),(0,O.jsxs)(oe,{value:Q,onValueChange:$e,children:[(0,O.jsx)(ne,{children:(0,O.jsx)(ie,{placeholder:`选择缩放比例`})}),(0,O.jsx)(re,{children:(0,O.jsx)(ae,{children:Re.map(e=>(0,O.jsx)(l,{value:e.value,children:e.label},e.value))})})]})]}),(0,O.jsx)(S,{}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(`h3`,{className:`text-sm font-medium`,children:`关于`}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Meddle - HTTP 调试代理工具`}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`版本: 1.0.0`})]})]}),(0,O.jsxs)(m,{value:`config`,className:k,children:[(0,O.jsxs)(`div`,{className:j,children:[(0,O.jsx)(_,{className:`text-sm font-medium`,children:`路由规则文件`}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 p-3 bg-muted rounded-md`,children:[(0,O.jsx)(w,{className:`h-4 w-4 text-muted-foreground shrink-0`}),(0,O.jsx)(`span`,{className:`text-xs font-mono truncate flex-1`,children:`~/.meddle/route-rules/`})]}),qe.length>0?(0,O.jsx)(`div`,{className:`space-y-2`,children:qe.map(e=>(0,O.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border px-3 py-2.5 text-sm`,children:[(0,O.jsx)(pe,{variant:e.enabled?`default`:`secondary`,className:`text-[10px]`,children:e.enabled?`已启用`:`未启用`}),(0,O.jsxs)(`span`,{className:`flex-1 truncate text-xs`,children:[e.name,`.txt`]}),(0,O.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[e.ruleCount,` 条规则`]})]},e.name))}):(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`暂无规则文件`}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`规则文件存放于 ~/.meddle/route-rules/ 目录,纯文本格式。在"路由规则"页面管理。`})]})]}),(0,O.jsx)(S,{}),(0,O.jsxs)(`div`,{className:j,children:[(0,O.jsx)(_,{className:`text-sm font-medium`,children:`Mock 规则文件`}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 p-3 bg-muted rounded-md`,children:[(0,O.jsx)(w,{className:`h-4 w-4 text-muted-foreground shrink-0`}),(0,O.jsx)(`span`,{className:`text-xs font-mono truncate flex-1`,children:G||`默认: ~/.meddle/mocks.json`})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(_,{htmlFor:`mocksPath`,className:`text-xs text-muted-foreground`,children:`自定义 Mock 规则文件路径(留空使用默认)`}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(y,{id:`mocksPath`,value:G,onChange:e=>Ke(e.target.value),placeholder:`如: /path/to/my-mocks.json`,className:`flex-1 h-8 text-sm font-mono`}),(0,O.jsxs)(C,{variant:`outline`,size:`sm`,onClick:ut,disabled:R,className:`h-8`,children:[(0,O.jsx)(v,{"data-icon":`inline-start`,className:`h-3 w-3`}),`应用`]})]}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`必须是 JSON 格式的 Mock 规则文件`})]})]})]}),(0,O.jsx)(S,{}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(`h3`,{className:`text-sm font-medium`,children:`操作`}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsxs)(r,{variant:`outline`,size:`sm`,onClick:ot,children:[(0,O.jsx)(ee,{className:`h-4 w-4 mr-1`}),`重新加载配置`]}),(0,O.jsxs)(r,{variant:`outline`,size:`sm`,onClick:st,disabled:Ze,children:[(0,O.jsx)(E,{className:`h-4 w-4 mr-1`}),Ze?`诊断中...`:`诊断配置`]})]}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`点击重新加载可应用修改后的配置文件,点击诊断配置可检查配置有效性`})]}),X&&(0,O.jsxs)(`div`,{className:j,children:[(0,O.jsx)(S,{}),(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`h3`,{className:`mb-4 flex items-center gap-2 text-sm font-medium`,children:[(0,O.jsx)(E,{className:`h-4 w-4`}),`诊断结果`]}),(0,O.jsxs)(`div`,{className:`mb-3 p-3 rounded-md border ${X.status===`ok`?`bg-green-50 dark:bg-green-950/20 border-green-200 dark:border-green-900`:X.status===`warning`?`bg-yellow-50 dark:bg-yellow-950/20 border-yellow-200 dark:border-yellow-900`:`bg-red-50 dark:bg-red-950/20 border-red-200 dark:border-red-900`}`,children:[X.status===`ok`&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(g,{className:`h-5 w-5 text-green-600 dark:text-green-400`}),(0,O.jsx)(`span`,{className:`text-sm font-medium text-green-700 dark:text-green-300`,children:`所有检查通过!配置正常。`})]}),X.status===`warning`&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(a,{className:`h-5 w-5 text-yellow-600 dark:text-yellow-400`}),(0,O.jsxs)(`span`,{className:`text-sm font-medium text-yellow-700 dark:text-yellow-300`,children:[`发现 `,X.warnings.length,` 个警告`]})]}),X.status===`error`&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(o,{className:`h-5 w-5 text-red-600 dark:text-red-400`}),(0,O.jsxs)(`span`,{className:`text-sm font-medium text-red-700 dark:text-red-300`,children:[`发现 `,X.errors.length,` 个错误`]})]})]}),(0,O.jsx)(`div`,{className:A,children:X.checks.map((e,t)=>(0,O.jsx)(`div`,{className:`p-2 rounded border bg-card`,children:(0,O.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,O.jsx)(g,{className:`h-4 w-4 text-green-600 dark:text-green-400 mt-0.5 shrink-0`}),(0,O.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,O.jsx)(`div`,{className:`text-sm font-medium`,children:e.name}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground font-mono truncate`,children:e.path}),e.details&&(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[e.details.totalFiles!==void 0&&`${e.details.enabledFiles}/${e.details.totalFiles} 个文件已启用`,e.details.totalRules!==void 0&&` · ${e.details.totalRules} 条规则`,e.details.rules!==void 0&&`${e.details.rules} 条规则`,e.details.total!==void 0&&`${e.details.total} 条规则 (${e.details.enabled} 已启用)`,e.details.size!==void 0&&` · ${e.details.size} bytes`]})]})]})},t))}),X.warnings&&X.warnings.length>0&&(0,O.jsxs)(`div`,{className:`mt-3 space-y-1`,children:[(0,O.jsx)(`div`,{className:`text-xs font-medium text-yellow-700 dark:text-yellow-300`,children:`警告:`}),X.warnings.map((e,t)=>(0,O.jsxs)(`div`,{className:`flex items-start gap-2 text-xs text-yellow-600 dark:text-yellow-400`,children:[(0,O.jsx)(a,{className:`h-3 w-3 mt-0.5 shrink-0`}),(0,O.jsx)(`span`,{children:e})]},t))]}),X.errors&&X.errors.length>0&&(0,O.jsxs)(`div`,{className:`mt-3 space-y-1`,children:[(0,O.jsx)(`div`,{className:`text-xs font-medium text-red-700 dark:text-red-300`,children:`错误:`}),X.errors.map((e,t)=>(0,O.jsxs)(`div`,{className:`flex items-start gap-2 text-xs text-red-600 dark:text-red-400`,children:[(0,O.jsx)(o,{className:`h-3 w-3 mt-0.5 shrink-0`}),(0,O.jsx)(`span`,{children:e})]},t))]})]})]})]}),(0,O.jsxs)(m,{value:`clients`,className:k,children:[(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsxs)(`h3`,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,O.jsx)(c,{className:`h-4 w-4`}),`远程客户端名称`]}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`将日志中的客户端 IP 映射为设备名称。保存后新请求立即生效,无需重启代理。`})]}),(0,O.jsx)(`div`,{className:A,children:Object.entries(K).length===0?(0,O.jsx)(`div`,{className:`rounded-md border border-dashed p-4 text-center text-xs text-muted-foreground`,children:`尚未配置设备名称`}):Object.entries(K).map(([e,t])=>(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(y,{value:e,readOnly:!0,className:`h-8 flex-1 font-mono text-xs bg-muted/40`,"aria-label":`客户端 IP ${e}`}),(0,O.jsx)(y,{value:t,onChange:t=>{let n=t.target.value;q(t=>({...t,[e]:n}))},className:`h-8 flex-1 text-sm`,"aria-label":`${e} 的设备名称`}),(0,O.jsx)(r,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground hover:text-destructive`,onClick:()=>{q(t=>{let n={...t};return delete n[e],n})},title:`删除设备名称`,"aria-label":`删除设备名称`,children:(0,O.jsx)(me,{className:`h-4 w-4`})})]},e))}),(0,O.jsx)(S,{}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(_,{className:`text-sm`,children:`添加设备`}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(y,{value:J,onChange:e=>Ye(e.target.value),placeholder:`客户端 IP,例如 10.13.232.187`,className:`h-8 flex-1 font-mono text-xs`}),(0,O.jsx)(y,{value:Y,onChange:e=>Xe(e.target.value),onKeyDown:e=>{e.key===`Enter`&&ct()},placeholder:`设备名称,例如 iPhone`,className:`h-8 flex-1 text-sm`}),(0,O.jsxs)(r,{variant:`outline`,size:`sm`,className:`h-8`,onClick:ct,disabled:!J.trim()||!Y.trim(),children:[(0,O.jsx)(s,{className:`h-4 w-4 mr-1`}),`添加`]})]})]}),(0,O.jsxs)(C,{onClick:lt,disabled:R,children:[(0,O.jsx)(v,{"data-icon":`inline-start`,className:`h-4 w-4`}),R?`保存中...`:`保存客户端名称`]})]}),(0,O.jsxs)(m,{value:`ai`,className:k,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(_,{className:`text-sm`,children:`启用 AI 功能`}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`启用智能代码修复功能`})]}),(0,O.jsx)(se,{checked:F.enabled,onCheckedChange:e=>I({...F,enabled:e}),"aria-label":`启用 AI 功能`})]}),(0,O.jsx)(S,{}),(0,O.jsxs)(`div`,{className:j,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsx)(_,{className:`text-sm`,children:`AI 模型配置`}),(0,O.jsxs)(r,{variant:`outline`,size:`sm`,onClick:()=>{W({name:``,provider:`openai`,apiKey:``,baseUrl:`https://api.openai.com/v1/chat/completions`,model:`gpt-4o-mini`})},children:[(0,O.jsx)(s,{className:`h-4 w-4 mr-1`}),`添加模型`]})]}),(0,O.jsx)(`div`,{className:A,children:F.models&&F.models.length>0?F.models.map(e=>(0,O.jsx)(`div`,{className:`p-3 rounded-md border ${F.activeModelId===e.id?`border-primary bg-primary/5`:`border-border`}`,children:(0,O.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,O.jsxs)(`div`,{className:`flex-1`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),F.activeModelId===e.id&&(0,O.jsx)(pe,{variant:`default`,className:`text-xs`,children:`当前使用`})]}),(0,O.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[e.provider===`openai`?`OpenAI`:`Anthropic`,` - `,e.model]})]}),(0,O.jsxs)(`div`,{className:`flex gap-1`,children:[F.activeModelId!==e.id&&(0,O.jsxs)(r,{variant:`ghost`,size:`xs`,onClick:()=>I(le(F,e.id)),children:[(0,O.jsx)(je,{className:`h-3 w-3 mr-1`}),`使用`]}),(0,O.jsx)(r,{variant:`ghost`,size:`icon-sm`,onClick:()=>I(ue(F,e.id)),className:`text-destructive`,"aria-label":`删除模型`,children:(0,O.jsx)(me,{className:`h-3 w-3`})})]})]})},e.id)):(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground italic py-4 text-center`,children:`暂无模型配置,点击"添加模型"创建`})}),U&&(0,O.jsxs)(`div`,{className:`space-y-5 rounded-md border border-primary bg-primary/5 p-4`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsx)(_,{className:`text-sm font-medium`,children:`新增模型`}),(0,O.jsx)(r,{variant:`ghost`,size:`icon-xs`,onClick:()=>W(null),"aria-label":`关闭新增模型表单`,children:(0,O.jsx)(o,{className:`h-4 w-4`})})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(_,{htmlFor:`newModelName`,className:`text-xs`,children:`模型名称`}),(0,O.jsx)(y,{id:`newModelName`,value:U.name||``,onChange:e=>W({...U,name:e.target.value}),placeholder:`如:GPT-4o Mini`,className:`h-8 text-sm`})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(_,{className:`text-xs`,children:`服务商`}),(0,O.jsxs)(b,{type:`single`,value:U.provider,onValueChange:e=>{if(e===`openai`){let e=u(`openai`);W({...U,provider:`openai`,baseUrl:e.baseUrl,model:e.model})}else if(e===`anthropic`){let e=u(`anthropic`);W({...U,provider:`anthropic`,baseUrl:e.baseUrl,model:e.model})}},variant:`outline`,size:`sm`,spacing:0,children:[(0,O.jsx)(p,{value:`openai`,children:`OpenAI`}),(0,O.jsx)(p,{value:`anthropic`,children:`Anthropic`})]})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(_,{htmlFor:`newModelApiKey`,className:`text-xs`,children:`API Key`}),(0,O.jsx)(y,{id:`newModelApiKey`,type:L?`text`:`password`,value:U.apiKey||``,onChange:e=>W({...U,apiKey:e.target.value}),placeholder:`输入 API Key`,className:`h-8 text-sm`})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(_,{htmlFor:`newModelModel`,className:`text-xs`,children:`模型`}),(0,O.jsx)(y,{id:`newModelModel`,value:U.model||``,onChange:e=>W({...U,model:e.target.value}),placeholder:`模型名称`,className:`h-8 text-sm`})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(_,{htmlFor:`newModelBaseUrl`,className:`text-xs`,children:`API 端点`}),(0,O.jsx)(y,{id:`newModelBaseUrl`,value:U.baseUrl||``,onChange:e=>W({...U,baseUrl:e.target.value}),placeholder:`API 端点`,className:`h-8 text-sm`})]}),(0,O.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,O.jsx)(r,{variant:`outline`,size:`xs`,onClick:()=>W(null),children:`取消`}),(0,O.jsxs)(r,{size:`xs`,onClick:()=>{U.name&&U.apiKey&&U.model&&U.baseUrl&&(I(fe(F,U)),W(null))},disabled:!U.name||!U.apiKey||!U.model||!U.baseUrl,children:[(0,O.jsx)(s,{className:`h-3 w-3 mr-1`}),`添加`]})]})]})]}),(0,O.jsx)(S,{}),(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(_,{className:`text-sm`,children:`传统配置(向后兼容)`}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`如果未配置多模型,将使用此配置`})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(_,{className:`text-xs`,children:`AI 服务商`}),(0,O.jsxs)(b,{type:`single`,value:F.provider,onValueChange:e=>{(e===`openai`||e===`anthropic`)&&nt(e)},variant:`outline`,size:`sm`,spacing:0,children:[(0,O.jsx)(p,{value:`openai`,children:`OpenAI`}),(0,O.jsx)(p,{value:`anthropic`,children:`Anthropic`})]})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(_,{htmlFor:`apiKey`,className:`text-xs`,children:`API Key`}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(y,{id:`apiKey`,type:L?`text`:`password`,value:F.apiKey,onChange:e=>I({...F,apiKey:e.target.value}),placeholder:`输入 API Key`,className:`flex-1 h-8 text-sm`}),(0,O.jsx)(r,{variant:`outline`,size:`icon-sm`,onClick:()=>We(!L),"aria-label":L?`隐藏 API Key`:`显示 API Key`,children:L?(0,O.jsx)(Ie,{className:`h-4 w-4`}):(0,O.jsx)(Le,{className:`h-4 w-4`})})]})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(_,{htmlFor:`model`,className:`text-xs`,children:`模型`}),(0,O.jsx)(y,{id:`model`,value:F.model,onChange:e=>I({...F,model:e.target.value}),placeholder:`模型名称`,className:`h-8 text-sm`})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(_,{htmlFor:`baseUrl`,className:`text-xs`,children:`API 端点`}),(0,O.jsx)(y,{id:`baseUrl`,value:F.baseUrl,onChange:e=>I({...F,baseUrl:e.target.value}),placeholder:F.provider===`openai`?`https://api.openai.com/v1/chat/completions`:`https://api.anthropic.com/v1/messages`,className:`h-8 text-sm`})]}),Ge&&(0,O.jsxs)(Fe,{variant:B===`error`?`destructive`:`default`,children:[B===`success`?(0,O.jsx)(g,{}):B===`error`?(0,O.jsx)(o,{}):(0,O.jsx)(a,{}),(0,O.jsx)(Pe,{children:B===`success`?`操作成功`:B===`error`?`操作失败`:`处理中`}),(0,O.jsx)(Ne,{children:Ge})]}),(0,O.jsx)(S,{}),(0,O.jsxs)(`div`,{className:`flex justify-between`,children:[(0,O.jsxs)(r,{variant:`outline`,size:`sm`,onClick:it,children:[(0,O.jsx)(te,{className:`h-4 w-4 mr-1`}),`重置`]}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(r,{variant:`outline`,size:`sm`,onClick:at,disabled:!d(F)||R,children:`测试连接`}),(0,O.jsxs)(C,{size:`sm`,onClick:rt,disabled:R,children:[(0,O.jsx)(v,{"data-icon":`inline-start`,className:`h-4 w-4`}),R?`保存中...`:`保存`]})]})]})]})]})]});return n?(0,O.jsx)(`div`,{className:`flex h-full min-h-0 flex-col`,children:$}):(0,O.jsx)(Te,{open:e,onOpenChange:t,children:(0,O.jsx)(we,{className:`p-0 flex flex-col`,resizable:!0,defaultWidth:600,storageKey:`settings-panel`,children:$})})}export{Be as SettingsPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{l as e}from"./button-BTToMaBW.js";var t=e(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,f as t,n,s as r,u as i}from"./button-BTToMaBW.js";import{a,o,r as s,t as c}from"./dist-C6eaYCUo.js";import{n as l,t as u}from"./dist-Ce4ujolc.js";var d=t(i(),1),f=e(),p=`Switch`,[m,h]=a(p),[g,_]=m(p),v=d.forwardRef((e,t)=>{let{__scopeSwitch:n,name:i,checked:a,defaultChecked:l,required:u,disabled:m,value:h=`on`,onCheckedChange:_,form:v,...y}=e,[b,x]=d.useState(null),w=r(t,e=>x(e)),T=d.useRef(!1),E=b?v||!!b.closest(`form`):!0,[D,O]=c({prop:a,defaultProp:l??!1,onChange:_,caller:p});return(0,f.jsxs)(g,{scope:n,checked:D,disabled:m,children:[(0,f.jsx)(o.button,{type:`button`,role:`switch`,"aria-checked":D,"aria-required":u,"data-state":C(D),"data-disabled":m?``:void 0,disabled:m,value:h,...y,ref:w,onClick:s(e.onClick,e=>{O(e=>!e),E&&(T.current=e.isPropagationStopped(),T.current||e.stopPropagation())})}),E&&(0,f.jsx)(S,{control:b,bubbles:!T.current,name:i,value:h,checked:D,required:u,disabled:m,form:v,style:{transform:`translateX(-100%)`}})]})});v.displayName=p;var y=`SwitchThumb`,b=d.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=_(y,n);return(0,f.jsx)(o.span,{"data-state":C(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});b.displayName=y;var x=`SwitchBubbleInput`,S=d.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:i=!0,...a},o)=>{let s=d.useRef(null),c=r(s,o),p=l(n),m=u(t);return d.useEffect(()=>{let e=s.current;if(!e)return;let t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,`checked`).set;if(p!==n&&r){let t=new Event(`click`,{bubbles:i});r.call(e,n),e.dispatchEvent(t)}},[p,n,i]),(0,f.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:c,style:{...a.style,...m,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});S.displayName=x;function C(e){return e?`checked`:`unchecked`}var w=v,T=b;function E({className:e,...t}){return(0,f.jsx)(w,{"data-slot":`switch`,className:n(`peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-5 w-9 shrink-0 items-center rounded-full border-2 border-transparent shadow-xs transition-colors outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50`,e),...t,children:(0,f.jsx)(T,{"data-slot":`switch-thumb`,className:n(`bg-background pointer-events-none block size-4 rounded-full ring-0 shadow-lg transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0`)})})}export{E as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,f as t,n,u as r}from"./button-BTToMaBW.js";t(r(),1);var i=e();function a({className:e,...t}){return(0,i.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,i.jsx)(`table`,{"data-slot":`table`,className:n(`w-full caption-bottom text-sm`,e),...t})})}function o({className:e,...t}){return(0,i.jsx)(`thead`,{"data-slot":`table-header`,className:n(`[&_tr]:border-b`,e),...t})}function s({className:e,...t}){return(0,i.jsx)(`tbody`,{"data-slot":`table-body`,className:n(`[&_tr:last-child]:border-0`,e),...t})}function c({className:e,...t}){return(0,i.jsx)(`tr`,{"data-slot":`table-row`,className:n(`hover:bg-accent/60 hover:text-accent-foreground data-[state=selected]:bg-accent data-[state=selected]:text-accent-foreground border-b transition-colors`,e),...t})}function l({className:e,...t}){return(0,i.jsx)(`th`,{"data-slot":`table-head`,className:n(`text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,e),...t})}function u({className:e,...t}){return(0,i.jsx)(`td`,{"data-slot":`table-cell`,className:n(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,e),...t})}export{o as a,l as i,s as n,c as o,u as r,a as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,f as t,n,u as r}from"./button-BTToMaBW.js";t(r(),1);var i=e();function a({className:e,...t}){return(0,i.jsx)(`textarea`,{"data-slot":`textarea`,className:n(`placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input w-full min-w-0 rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,`focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]`,`aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive`,`min-h-[80px]`,e),...t})}export{a as t};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|