@jonathanleelx/meddle 0.5.0-beta.21 → 0.5.0-beta.23
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/dist/cert.d.ts.map +1 -1
- package/dist/cert.js +43 -0
- package/dist/cert.js.map +1 -1
- package/dist/core/mock-handler.d.ts +0 -6
- package/dist/core/mock-handler.d.ts.map +1 -1
- package/dist/core/mock-handler.js +84 -11
- package/dist/core/mock-handler.js.map +1 -1
- package/package.json +1 -1
- package/web/dist/assets/{checkbox-v2kzp7K8.js → checkbox-CQyFsZzS.js} +1 -1
- package/web/dist/assets/detail-panel-D4JSaFH3.js +4 -0
- package/web/dist/assets/dist-Dk9a2sJl.js +5 -0
- package/web/dist/assets/es2015-DPJTBYa9.js +41 -0
- package/web/dist/assets/{global-panel-shell-D32I98dR.js → global-panel-shell-DXvcxmbd.js} +3 -3
- package/web/dist/assets/health-panel-Bo0eD8_R.js +1 -0
- package/web/dist/assets/index-Cbis1y9h.js +18 -0
- package/web/dist/assets/index-dKaIrLee.css +2 -0
- package/web/dist/assets/mobile-proxy-panel-FQwFQFmS.js +8 -0
- package/web/dist/assets/mock-config-CL9nXIkx.js +1 -0
- package/web/dist/assets/mock-editor-panel-kx0bzGv4.js +20 -0
- package/web/dist/assets/{mocks-file-missing-note-DmrrCBYY.js → mocks-file-missing-note-BvL7-uzS.js} +1 -1
- package/web/dist/assets/{monaco-editor-6oLiu4W6.js → monaco-editor-BLHN8gCU.js} +1 -1
- package/web/dist/assets/pane-bar-BSzN6D93.js +1 -0
- package/web/dist/assets/{pane-split-DYB05onX.js → pane-split-DfQcgd1v.js} +1 -1
- package/web/dist/assets/{panel-heading-BS8loc49.js → panel-heading-Dev_soZA.js} +1 -1
- package/web/dist/assets/plugin-code-editor-uI_-iAXY.js +2 -0
- package/web/dist/assets/plugin-config-BpfIX4Uk.js +2 -0
- package/web/dist/assets/{plugin-generator-Ba4hP5rg.js → plugin-generator-B5FRaaKc.js} +2 -2
- package/web/dist/assets/plugin-test-dialog-Cptd2bs0.js +7 -0
- package/web/dist/assets/route-preview-DEc50Y_R.js +1 -0
- package/web/dist/assets/{rule-ai-assistant-panel-CQTsZMJu.js → rule-ai-assistant-panel-BEmXPzli.js} +2 -2
- package/web/dist/assets/rule-config-DQkdF3tr.js +15 -0
- package/web/dist/assets/{rule-overview-panel-CmWdMs4I.js → rule-overview-panel-DsNEU8L1.js} +1 -1
- package/web/dist/assets/select-CFTzQ8Uy.js +1 -0
- package/web/dist/assets/settings-panel-C1v0UmZQ.js +1 -0
- package/web/dist/assets/{switch-DpLnRvOJ.js → switch-94vgsMHm.js} +1 -1
- package/web/dist/index.html +11 -12
- package/web/dist/assets/detail-panel-DK7pM43g.js +0 -4
- package/web/dist/assets/dist-BNcjMpca.js +0 -1
- package/web/dist/assets/dist-DD7AvbXP.js +0 -1
- package/web/dist/assets/dist-UcOFuoN0.js +0 -5
- package/web/dist/assets/es2015-CRmLuA2o.js +0 -41
- package/web/dist/assets/health-panel-Dw7qdFVS.js +0 -1
- package/web/dist/assets/index-CYUNdxqh.css +0 -2
- package/web/dist/assets/index-CkoYwomI.js +0 -18
- package/web/dist/assets/mobile-proxy-panel-DtiDkpAa.js +0 -8
- package/web/dist/assets/mock-config-C3jSpNNu.js +0 -1
- package/web/dist/assets/mock-editor-panel-ByCYWJjO.js +0 -20
- package/web/dist/assets/plugin-code-editor-DGzCBEpg.js +0 -2
- package/web/dist/assets/plugin-config-NVw234EF.js +0 -2
- package/web/dist/assets/plugin-test-dialog-B4ojc2_9.js +0 -7
- package/web/dist/assets/route-preview-BspvfNdW.js +0 -1
- package/web/dist/assets/rule-config-DDOeMRXa.js +0 -15
- package/web/dist/assets/settings-panel-aB0ojA9D.js +0 -1
- /package/web/dist/assets/{ai-config-store-B_VpGvwx.js → ai-config-store-C8D_PUGV.js} +0 -0
- /package/web/dist/assets/{alert-BmsRCcSL.js → alert-DFypnYT1.js} +0 -0
- /package/web/dist/assets/{babel-D1quDdNt.js → babel-DCr4VA1c.js} +0 -0
- /package/web/dist/assets/{body-diff-view-ByCHr9bv.js → body-diff-view-CCwbvDYx.js} +0 -0
- /package/web/dist/assets/{clipboard-DUgC_tNv.js → clipboard-VhPXNN5m.js} +0 -0
- /package/web/dist/assets/{dist-Bq2klZ3g.js → dist-Bsv9ad5F.js} +0 -0
- /package/web/dist/assets/{dist-BCvvYbmI.js → dist-fzPL-8F9.js} +0 -0
- /package/web/dist/assets/{dist-YM3jbhT-.js → dist-wv9ebJK_.js} +0 -0
- /package/web/dist/assets/{editor-pane-actions-DN-pxFsl.js → editor-pane-actions-BGttNlkS.js} +0 -0
- /package/web/dist/assets/{estree--Vq99DGn.js → estree-qO_m2Qaw.js} +0 -0
- /package/web/dist/assets/{html-D2PZBPnP.js → html-VDGahtyk.js} +0 -0
- /package/web/dist/assets/{postcss-DfIslWug.js → postcss-BUm8EKMw.js} +0 -0
- /package/web/dist/assets/{standalone-D-fjaAIs.js → standalone-Bj8SSd8Q.js} +0 -0
- /package/web/dist/assets/{syntax-highlight-EJCxGikd.js → syntax-highlight-Dg_CTbXd.js} +0 -0
- /package/web/dist/assets/{table-C3mgEjkP.js → table-B10JkPhg.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,d as t,p as n,t as r}from"./button-BFNlGZ5p.js";import"./dist-CFZ4xMSF.js";import{t as i}from"./refresh-cw-BfLoHqg5.js";import{t as a}from"./table-2-DvGHhMm4.js";import{G as o,H as s,J as c,K as l,U as u,W as d,at as f,bt as p,ft as m,h,it as g,kt as ee,nt as _,q as v,rt as y,tt as te,wt as b}from"./index-CkoYwomI.js";import{a as x,i as S,n as C,o as w,r as T,t as E}from"./table-C3mgEjkP.js";var D=n(t(),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:n,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 h(e)!==h(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,r)=>{n(e,t,r)},[n]),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)(f,{className:`h-8 w-full`}),(0,O.jsx)(f,{className:`h-8 w-full`}),(0,O.jsx)(f,{className:`h-8 w-3/4`})]});if(I)return(0,O.jsxs)(u,{className:`min-h-0 flex-1`,children:[(0,O.jsxs)(l,{children:[(0,O.jsx)(v,{variant:`icon`,children:(0,O.jsx)(m,{})}),(0,O.jsx)(c,{children:`加载失败`}),(0,O.jsx)(o,{children:I})]}),(0,O.jsx)(d,{children:(0,O.jsxs)(r,{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,n=H.trim().length>0;return e?t?R===`merged`&&!n&&(N?.mergedRules.length??0)===0?(0,O.jsx)(u,{className:`min-h-0 flex-1`,children:(0,O.jsxs)(l,{children:[(0,O.jsx)(v,{variant:`icon`,children:(0,O.jsx)(b,{})}),(0,O.jsx)(c,{children:`没有生效中的规则`}),(0,O.jsx)(o,{children:`规则全部被禁用,或没有启用任何规则文件;切换到「按文件」查看全部规则`})]})}):n&&R===`merged`&&J.length===0||n&&R===`files`&&Z.every(e=>e.matched.length===0&&e.error==null)?$():R===`merged`?se():ce():(0,O.jsx)(u,{className:`min-h-0 flex-1`,children:(0,O.jsxs)(l,{children:[(0,O.jsx)(v,{variant:`icon`,children:(0,O.jsx)(ee,{})}),(0,O.jsx)(c,{children:`所有规则文件都是空的`}),(0,O.jsx)(o,{children:`还没有任何路由规则,先去路由规则页添加一条吧`})]})}):(0,O.jsx)(u,{className:`min-h-0 flex-1`,children:(0,O.jsxs)(l,{children:[(0,O.jsx)(v,{variant:`icon`,children:(0,O.jsx)(a,{})}),(0,O.jsx)(c,{children:`还没有规则文件`}),(0,O.jsx)(o,{children:`在路由规则页点击「+」创建第一个规则文件`})]})})},$=()=>(0,O.jsxs)(u,{className:`min-h-0 flex-1`,children:[(0,O.jsxs)(l,{children:[(0,O.jsx)(v,{variant:`icon`,children:(0,O.jsx)(p,{})}),(0,O.jsx)(c,{children:`无匹配结果`}),(0,O.jsxs)(o,{children:[`没有找到符合「`,H.trim(),`」的规则`]})]}),(0,O.jsx)(d,{children:(0,O.jsx)(r,{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:`meddle-thin-scroll 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)(s,{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)(y,{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)(y,{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:`meddle-thin-scroll 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)(s,{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)(y,{variant:e.enabled?`default`:`secondary`,className:`px-1 py-0 text-[10px]`,children:e.enabled?`启用`:`禁用`}),(0,O.jsx)(y,{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)(m,{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)(y,{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)(te,{type:`single`,value:R,onValueChange:e=>{e&&z(e)},variant:`outline`,size:`sm`,className:`bg-background`,"aria-label":`总览视图`,children:[(0,O.jsx)(_,{value:`merged`,children:`生效规则`}),(0,O.jsx)(_,{value:`files`,children:`按文件`})]}),(0,O.jsxs)(`div`,{className:`relative min-w-40 flex-1`,children:[(0,O.jsx)(p,{className:`pointer-events-none absolute top-1/2 left-2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,O.jsx)(g,{value:B,onChange:e=>V(e.target.value),placeholder:`搜索规则 / 目标 / 文件名`,className:`h-8 pl-8`,"aria-label":`搜索规则`})]}),(0,O.jsx)(r,{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)(m,{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
|
+
import{c as e,d as t,p as n,t as r}from"./button-BFNlGZ5p.js";import"./dist-CFZ4xMSF.js";import{t as i}from"./refresh-cw-BfLoHqg5.js";import{t as ee}from"./table-2-DvGHhMm4.js";import{$ as a,Ct as o,G as s,H as c,J as l,K as u,Q as d,U as f,W as p,X as m,Y as te,Z as h,h as g,mt as _,ot as v,q as y,vt as b}from"./index-Cbis1y9h.js";import{a as x,i as S,n as C,o as w,r as T,t as E}from"./table-B10JkPhg.js";var D=n(t(),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:n,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 g(e)!==g(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,r)=>{n(e,t,r)},[n]),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)(a,{className:`h-8 w-full`}),(0,O.jsx)(a,{className:`h-8 w-full`}),(0,O.jsx)(a,{className:`h-8 w-3/4`})]});if(I)return(0,O.jsxs)(f,{className:`min-h-0 flex-1`,children:[(0,O.jsxs)(u,{children:[(0,O.jsx)(y,{variant:`icon`,children:(0,O.jsx)(v,{})}),(0,O.jsx)(l,{children:`加载失败`}),(0,O.jsx)(s,{children:I})]}),(0,O.jsx)(p,{children:(0,O.jsxs)(r,{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,n=H.trim().length>0;return e?t?R===`merged`&&!n&&(N?.mergedRules.length??0)===0?(0,O.jsx)(f,{className:`min-h-0 flex-1`,children:(0,O.jsxs)(u,{children:[(0,O.jsx)(y,{variant:`icon`,children:(0,O.jsx)(b,{})}),(0,O.jsx)(l,{children:`没有生效中的规则`}),(0,O.jsx)(s,{children:`规则全部被禁用,或没有启用任何规则文件;切换到「按文件」查看全部规则`})]})}):n&&R===`merged`&&J.length===0||n&&R===`files`&&Z.every(e=>e.matched.length===0&&e.error==null)?$():R===`merged`?se():ce():(0,O.jsx)(f,{className:`min-h-0 flex-1`,children:(0,O.jsxs)(u,{children:[(0,O.jsx)(y,{variant:`icon`,children:(0,O.jsx)(o,{})}),(0,O.jsx)(l,{children:`所有规则文件都是空的`}),(0,O.jsx)(s,{children:`还没有任何路由规则,先去路由规则页添加一条吧`})]})}):(0,O.jsx)(f,{className:`min-h-0 flex-1`,children:(0,O.jsxs)(u,{children:[(0,O.jsx)(y,{variant:`icon`,children:(0,O.jsx)(ee,{})}),(0,O.jsx)(l,{children:`还没有规则文件`}),(0,O.jsx)(s,{children:`在路由规则页点击「+」创建第一个规则文件`})]})})},$=()=>(0,O.jsxs)(f,{className:`min-h-0 flex-1`,children:[(0,O.jsxs)(u,{children:[(0,O.jsx)(y,{variant:`icon`,children:(0,O.jsx)(_,{})}),(0,O.jsx)(l,{children:`无匹配结果`}),(0,O.jsxs)(s,{children:[`没有找到符合「`,H.trim(),`」的规则`]})]}),(0,O.jsx)(p,{children:(0,O.jsx)(r,{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:`meddle-thin-scroll 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)(c,{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)(h,{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)(h,{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:`meddle-thin-scroll 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)(c,{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)(h,{variant:e.enabled?`default`:`secondary`,className:`px-1 py-0 text-[10px]`,children:e.enabled?`启用`:`禁用`}),(0,O.jsx)(h,{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)(v,{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)(h,{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)(te,{type:`single`,value:R,onValueChange:e=>{e&&z(e)},variant:`outline`,size:`sm`,className:`bg-background`,"aria-label":`总览视图`,children:[(0,O.jsx)(m,{value:`merged`,children:`生效规则`}),(0,O.jsx)(m,{value:`files`,children:`按文件`})]}),(0,O.jsxs)(`div`,{className:`relative min-w-40 flex-1`,children:[(0,O.jsx)(_,{className:`pointer-events-none absolute top-1/2 left-2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,O.jsx)(d,{value:B,onChange:e=>V(e.target.value),placeholder:`搜索规则 / 目标 / 文件名`,className:`h-8 pl-8`,"aria-label":`搜索规则`})]}),(0,O.jsx)(r,{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)(v,{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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e,d as t,o as n,p as r,r as i}from"./button-BFNlGZ5p.js";import{a,c as o,n as s,o as c,r as l,t as u}from"./dist-CFZ4xMSF.js";import{t as d}from"./check-BkfHQ6re.js";import{t as f}from"./chevron-down-DHwUtL4O.js";import{n as p,t as m}from"./dist-LiAcI8CK.js";import{n as h,t as g}from"./dist-C-E2R2jk.js";import{a as _,i as v,n as y,o as b,r as x,t as S}from"./es2015-DPJTBYa9.js";import{n as C,t as w}from"./dist-fzPL-8F9.js";import{t as T}from"./dist-Bsv9ad5F.js";var E=r(t(),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=A,M=[`top`,`right`,`bottom`,`left`],N=Math.min,P=Math.max,F=Math.round,I=Math.floor,L=e=>({x:e,y:e}),ee={left:`right`,right:`left`,bottom:`top`,top:`bottom`},te={start:`end`,end:`start`};function R(e,t,n){return P(e,N(t,n))}function z(e,t){return typeof e==`function`?e(t):e}function B(e){return e.split(`-`)[0]}function V(e){return e.split(`-`)[1]}function H(e){return e===`x`?`y`:`x`}function ne(e){return e===`y`?`height`:`width`}var re=new Set([`top`,`bottom`]);function U(e){return re.has(B(e))?`y`:`x`}function ie(e){return H(U(e))}function ae(e,t,n){n===void 0&&(n=!1);let r=V(e),i=ie(e),a=ne(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=V(e),a=fe(B(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=U(t),o=ie(t),s=ne(o),c=B(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(V(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}=z(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}=z(e,t)||{};if(l==null)return{};let d=ge(u),f={x:n,y:r},p=ie(i),m=ne(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=N(d[_],T),D=N(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=R(O,A,k),M=!c.arrow&&V(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,P=M?A<O?A-O:A-k:0;return{[p]:f[p]+P,data:{[p]:j,centerOffset:A-j-P,...M&&{alignmentOffset:P}},reset:M}}}),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}=z(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=B(r),_=U(o),v=B(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`&&_!==U(t))||T.every(e=>U(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=U(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 M.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}=z(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=B(n),s=V(n),c=U(n)===`y`,l=Ee.has(o)?-1:1,u=a&&c?-1:1,d=z(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}=z(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=U(B(i)),p=H(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=R(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=R(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}=z(e,t),u={x:n,y:r},d=U(i),f=H(d),p=u[f],m=u[d],h=z(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(B(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}=z(e,t),u=await o.detectOverflow(t,l),d=B(i),f=V(i),p=U(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=N(h-u[g],v),x=N(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=P(u.left,0),t=P(u.right,0),n=P(u.top,0),r=P(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:P(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:P(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 W(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function G(e){return((Pe(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Pe(e){return Me()?e instanceof Node||e instanceof W(e).Node:!1}function K(e){return Me()?e instanceof Element||e instanceof W(e).Element:!1}function q(e){return Me()?e instanceof HTMLElement||e instanceof W(e).HTMLElement:!1}function Fe(e){return!Me()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof W(e).ShadowRoot}var Ie=new Set([`inline`,`contents`]);function Le(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=J(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=K(e)?J(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=Y(e);for(;q(t)&&!Ye(t);){if(Ge(t))return t;if(Ve(t))return null;t=Y(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 J(e){return W(e).getComputedStyle(e)}function Xe(e){return K(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Y(e){if(Ne(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Fe(e)&&e.host||G(e);return Fe(t)?t.host:t}function Ze(e){let t=Y(e);return Ye(t)?e.ownerDocument?e.ownerDocument.body:e.body:q(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=W(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=J(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=q(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=F(n)!==a||F(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function tt(e){return K(e)?e:e.contextElement}function nt(e){let t=tt(e);if(!q(t))return L(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=et(t),o=(a?F(n.width):n.width)/r,s=(a?F(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var rt=L(0);function it(e){let t=W(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!==W(e)?!1:t}function X(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=tt(e),o=L(1);t&&(r?K(r)&&(o=nt(r)):o=nt(e));let s=at(a,n,r)?it(a):L(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=W(a),t=r&&K(r)?W(r):r,n=e,i=$e(n);for(;i&&r&&t!==n;){let e=nt(i),t=i.getBoundingClientRect(),r=J(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=W(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:X(G(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=G(r),s=t?Ve(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=L(1),u=L(0),d=q(r);if((d||!d&&!a)&&((Ne(r)!==`body`||Le(o))&&(c=Xe(r)),q(r))){let e=X(r);l=nt(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?st(o,c):L(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=G(e),n=Xe(e),r=e.ownerDocument.body,i=P(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=P(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+ot(e),s=-n.scrollTop;return J(r).direction===`rtl`&&(o+=P(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var dt=25;function ft(e,t){let n=W(e),r=G(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=X(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=q(e)?nt(e):L(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(G(e));else if(K(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=Y(e);return n===t||!K(n)||Ye(n)?!1:J(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=>K(e)&&Ne(e)!==`body`),i=null,a=J(e).position===`fixed`,o=a?Y(e):e;for(;K(o)&&!Ye(o);){let t=J(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=Y(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=P(r.top,e.top),e.right=N(r.right,e.right),e.bottom=N(r.bottom,e.bottom),e.left=P(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=q(t),i=G(t),a=n===`fixed`,o=X(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=L(0);function l(){c.x=ot(i)}if(r||!r&&!a)if((Ne(t)!==`body`||Le(i))&&(s=Xe(t)),r){let e=X(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):L(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 J(e).position===`static`}function St(e,t){if(!q(e)||J(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return G(e)===n&&(n=n.ownerDocument.body),n}function Ct(e,t){let n=W(e);if(Ve(e))return n;if(!q(e)){let t=Y(e);for(;t&&!Ye(t);){if(K(t)&&!xt(t))return t;t=Y(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 J(e).direction===`rtl`}var Et={convertOffsetParentRelativeRectToViewportRelativeRect:ct,getDocumentElement:G,getClippingRect:vt,getOffsetParent:Ct,getElementRects:wt,getClientRects:lt,getDimensions:yt,getScale:nt,isElement:K,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=G(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=I(d),h=I(i.clientWidth-(u+f)),g=I(i.clientHeight-(d+p)),_=I(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:P(0,N(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?X(e):null;c&&g();function g(){let t=X(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=r(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:r,virtualRef:i,...a}=e,o=sn(ln,r),s=E.useRef(null),l=n(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:r,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:h=!1,updatePositionStrategy:_=`optimized`,onPlaced:v,...y}=e,b=sn(dn,r),[x,S]=E.useState(null),C=n(t,e=>S(e)),[T,O]=E.useState(null),k=w(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:L,floatingStyles:ee,placement:te,isPositioned:R,middlewareData:z}=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}),h&&Zt({strategy:`referenceHidden`,...I})]}),[B,V]=bn(te),H=g(v);s(()=>{R&&H?.()},[R,H]);let ne=z.arrow?.x,re=z.arrow?.y,U=z.arrow?.centerOffset!==0,[ie,ae]=E.useState();return s(()=>{x&&ae(window.getComputedStyle(x).zIndex)},[x]),(0,D.jsx)(`div`,{ref:L.setFloating,"data-radix-popper-content-wrapper":``,style:{...ee,transform:R?ee.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ie,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(` `),...z.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,D.jsx)(fn,{scope:r,placedSide:B,onArrowChange:O,arrowX:ne,arrowY:re,shouldHideArrow:U,children:(0,D.jsx)(c.div,{"data-side":B,"data-align":V,...y,ref:C,style:{...y.style,animation:R?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`],Dn=`Select`,[On,kn,An]=p(Dn),[jn,Mn]=a(Dn,[An,an]),Nn=an(),[Pn,Z]=jn(Dn),[Fn,In]=jn(Dn),Ln=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:p,required:g,form:_}=e,v=Nn(t),[y,b]=E.useState(null),[x,S]=E.useState(null),[C,w]=E.useState(!1),T=m(l),[O,k]=u({prop:r,defaultProp:i??!1,onChange:a,caller:Dn}),[A,j]=u({prop:o,defaultProp:s,onChange:c,caller:Dn}),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)(Pn,{required:g,scope:t,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:h(),value:A,onValueChange:j,open:O,onOpenChange:k,dir:T,triggerPointerDownPosRef:M,disabled:p,children:[(0,D.jsx)(On.Provider,{scope:t,children:(0,D.jsx)(Fn,{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)(Ar,{"aria-hidden":!0,required:g,tabIndex:-1,name:d,autoComplete:f,value:A,onChange:e=>j(e.target.value),disabled:p,form:_,children:[A===void 0?(0,D.jsx)(`option`,{value:``}):null,Array.from(P)]},I):null]})})};Ln.displayName=Dn;var Rn=`SelectTrigger`,zn=E.forwardRef((e,t)=>{let{__scopeSelect:r,disabled:i=!1,...a}=e,o=Nn(r),s=Z(Rn,r),u=s.disabled||i,d=n(t,s.onTriggerChange),f=kn(r),p=E.useRef(`touch`),[m,h,g]=Mr(e=>{let t=f().filter(e=>!e.disabled),n=Nr(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":jr(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())})})})});zn.displayName=Rn;var Bn=`SelectValue`,Vn=E.forwardRef((e,t)=>{let{__scopeSelect:r,className:i,style:a,children:o,placeholder:l=``,...u}=e,d=Z(Bn,r),{onValueNodeHasChildrenChange:f}=d,p=o!==void 0,m=n(t,d.onValueNodeChange);return s(()=>{f(p)},[f,p]),(0,D.jsx)(c.span,{...u,ref:m,style:{pointerEvents:`none`},children:jr(d.value)?(0,D.jsx)(D.Fragment,{children:l}):o})});Vn.displayName=Bn;var Hn=`SelectIcon`,Un=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||`▼`})});Un.displayName=Hn;var Wn=`SelectPortal`,Gn=e=>(0,D.jsx)(v,{asChild:!0,...e});Gn.displayName=Wn;var Kn=`SelectContent`,qn=E.forwardRef((e,t)=>{let n=Z(Kn,e.__scopeSelect),[r,i]=E.useState();if(s(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Rt.createPortal((0,D.jsx)(Jn,{scope:e.__scopeSelect,children:(0,D.jsx)(On.Slot,{scope:e.__scopeSelect,children:(0,D.jsx)(`div`,{children:e.children})})}),t):null}return(0,D.jsx)(Zn,{...e,ref:t})});qn.displayName=Kn;var Q=10,[Jn,$]=jn(Kn),Yn=`SelectContentImpl`,Xn=i(`SelectContent.RemoveScroll`),Zn=E.forwardRef((e,t)=>{let{__scopeSelect:r,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:g,hideWhenDetached:v,avoidCollisions:C,...w}=e,T=Z(Kn,r),[O,k]=E.useState(null),[A,j]=E.useState(null),M=n(t,e=>k(e)),[N,P]=E.useState(null),[F,I]=E.useState(null),L=kn(r),[ee,te]=E.useState(!1),R=E.useRef(!1);E.useEffect(()=>{if(O)return S(O)},[O]),x();let z=E.useCallback(e=>{let[t,...n]=L().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},[L,A]),B=E.useCallback(()=>z([N,O]),[z,N,O]);E.useEffect(()=>{ee&&B()},[ee,B]);let{onOpenChange:V,triggerPointerDownPosRef:H}=T;E.useEffect(()=>{if(O){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(H.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(H.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():O.contains(n.target)||V(!1),document.removeEventListener(`pointermove`,t),H.current=null};return H.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,V,H]),E.useEffect(()=>{let e=()=>V(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[V]);let[ne,re]=Mr(e=>{let t=L().filter(e=>!e.disabled),n=Nr(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),U=E.useCallback((e,t,n)=>{let r=!R.current&&!n;(T.value!==void 0&&T.value===t||r)&&(P(e),r&&(R.current=!0))},[T.value]),ie=E.useCallback(()=>O?.focus(),[O]),ae=E.useCallback((e,t,n)=>{let r=!R.current&&!n;(T.value!==void 0&&T.value===t||r)&&I(e)},[T.value]),oe=i===`popper`?tr:$n,se=oe===tr?{side:c,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:C}:{};return(0,D.jsx)(Jn,{scope:r,content:O,viewport:A,onViewportChange:j,itemRefCallback:U,selectedItem:N,onItemLeave:ie,itemTextRefCallback:ae,focusSelectedItem:B,selectedItemText:F,position:i,isPositioned:ee,searchRef:ne,children:(0,D.jsx)(y,{as:Xn,allowPinchZoom:!0,children:(0,D.jsx)(_,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:l(a,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,D.jsx)(b,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,D.jsx)(oe,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...w,...se,onPlaced:()=>te(!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&&re(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=L().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(()=>z(t)),e.preventDefault()}})})})})})})});Zn.displayName=Yn;var Qn=`SelectItemAlignedPosition`,$n=E.forwardRef((e,t)=>{let{__scopeSelect:r,onPlaced:i,...a}=e,o=Z(Kn,r),l=$(Kn,r),[u,d]=E.useState(null),[f,p]=E.useState(null),m=n(t,e=>p(e)),h=kn(r),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=T(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=T(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),w=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?w: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,w]=E.useState();return s(()=>{f&&w(window.getComputedStyle(f).zIndex)},[f]),(0,D.jsx)(nr,{scope:r,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}})})})});$n.displayName=Qn;var er=`SelectPopperPosition`,tr=E.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Q,...a}=e,o=Nn(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)`}})});tr.displayName=er;var[nr,rr]=jn(Kn,{}),ir=`SelectViewport`,ar=E.forwardRef((e,t)=>{let{__scopeSelect:r,nonce:i,...a}=e,o=$(ir,r),s=rr(ir,r),u=n(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)(On.Slot,{scope:r,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})})})]})});ar.displayName=ir;var or=`SelectGroup`,[sr,cr]=jn(or),lr=E.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=h();return(0,D.jsx)(sr,{scope:n,id:i,children:(0,D.jsx)(c.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});lr.displayName=or;var ur=`SelectLabel`,dr=E.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=cr(ur,n);return(0,D.jsx)(c.div,{id:i.id,...r,ref:t})});dr.displayName=ur;var fr=`SelectItem`,[pr,mr]=jn(fr),hr=E.forwardRef((e,t)=>{let{__scopeSelect:r,value:i,disabled:a=!1,textValue:o,...s}=e,u=Z(fr,r),d=$(fr,r),f=u.value===i,[p,m]=E.useState(o??``),[g,_]=E.useState(!1),v=n(t,e=>d.itemRefCallback?.(e,i,a)),y=h(),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)(pr,{scope:r,value:i,disabled:a,textId:y,isSelected:f,onItemTextChange:E.useCallback(e=>{m(t=>t||(e?.textContent??``).trim())},[]),children:(0,D.jsx)(On.ItemSlot,{scope:r,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())})})})})});hr.displayName=fr;var gr=`SelectItemText`,_r=E.forwardRef((e,t)=>{let{__scopeSelect:r,className:i,style:a,...o}=e,l=Z(gr,r),u=$(gr,r),d=mr(gr,r),f=In(gr,r),[p,m]=E.useState(null),h=n(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]})});_r.displayName=gr;var vr=`SelectItemIndicator`,yr=E.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return mr(vr,n).isSelected?(0,D.jsx)(c.span,{"aria-hidden":!0,...r,ref:t}):null});yr.displayName=vr;var br=`SelectScrollUpButton`,xr=E.forwardRef((e,t)=>{let r=$(br,e.__scopeSelect),i=rr(br,e.__scopeSelect),[a,o]=E.useState(!1),c=n(t,i.onScrollButtonChange);return s(()=>{if(r.viewport&&r.isPositioned){let e=function(){o(t.scrollTop>0)},t=r.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[r.viewport,r.isPositioned]),a?(0,D.jsx)(wr,{...e,ref:c,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});xr.displayName=br;var Sr=`SelectScrollDownButton`,Cr=E.forwardRef((e,t)=>{let r=$(Sr,e.__scopeSelect),i=rr(Sr,e.__scopeSelect),[a,o]=E.useState(!1),c=n(t,i.onScrollButtonChange);return s(()=>{if(r.viewport&&r.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;o(Math.ceil(t.scrollTop)<e)},t=r.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[r.viewport,r.isPositioned]),a?(0,D.jsx)(wr,{...e,ref:c,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Cr.displayName=Sr;var wr=E.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=$(`SelectScrollButton`,n),o=E.useRef(null),u=kn(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()})})}),Tr=`SelectSeparator`,Er=E.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,D.jsx)(c.div,{"aria-hidden":!0,...r,ref:t})});Er.displayName=Tr;var Dr=`SelectArrow`,Or=E.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Nn(n),a=Z(Dr,n),o=$(Dr,n);return a.open&&o.position===`popper`?(0,D.jsx)(wn,{...i,...r,ref:t}):null});Or.displayName=Dr;var kr=`SelectBubbleInput`,Ar=E.forwardRef(({__scopeSelect:e,value:t,...r},i)=>{let a=E.useRef(null),o=n(i,a),s=C(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,{...r,style:{...O,...r.style},ref:o,defaultValue:t})});Ar.displayName=kr;function jr(e){return e===``||e===void 0}function Mr(e){let t=g(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 Nr(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=Pr(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 Pr(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Fr=Ln,Ir=zn,Lr=Vn,Rr=Un,zr=Gn,Br=qn,Vr=ar,Hr=lr,Ur=hr,Wr=_r,Gr=yr,Kr=Fr,qr=Hr,Jr=Lr,Yr=E.forwardRef(({className:e,children:t,...n},r)=>(0,D.jsxs)(Ir,{ref:r,className:Qr(`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)(Rr,{asChild:!0,children:(0,D.jsx)(f,{className:`h-4 w-4 opacity-50`})})]}));Yr.displayName=Ir.displayName;var Xr=E.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,D.jsx)(zr,{children:(0,D.jsx)(Br,{ref:i,className:Qr(`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)(Vr,{className:Qr(`p-1`,n===`popper`&&`w-full min-w-[var(--radix-select-trigger-width)]`),children:t})})}));Xr.displayName=Br.displayName;var Zr=E.forwardRef(({className:e,children:t,...n},r)=>(0,D.jsxs)(Ur,{ref:r,className:Qr(`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)(Gr,{children:(0,D.jsx)(d,{className:`h-4 w-4`})})}),(0,D.jsx)(Wr,{children:t})]}));Zr.displayName=Ur.displayName;function Qr(...e){return e.filter(Boolean).join(` `)}export{Yr as a,wn as c,an as d,j as f,Zr as i,Cn as l,Xr as n,Jr as o,qr as r,Sn as s,Kr as t,xn as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e,d as t,p as n,t as r,u as i}from"./button-BFNlGZ5p.js";import"./dist-CFZ4xMSF.js";import{t as ee}from"./check-BkfHQ6re.js";import{t as a}from"./circle-alert-zMagrFuI.js";import{t as o}from"./circle-x-BEkinhez.js";import{t as s}from"./plus-ixZQRprm.js";import{t as te}from"./refresh-cw-BfLoHqg5.js";import{t as ne}from"./rotate-ccw-CRguJya4.js";import{t as re}from"./smartphone-D4Q7cQfm.js";import{a as ie,i as c,n as ae,o as oe,r as se,t as ce}from"./select-CFTzQ8Uy.js";import"./es2015-DPJTBYa9.js";import{t as le}from"./switch-94vgsMHm.js";import{a as l,c as ue,l as de,n as fe,o as pe,r as u,s as me,t as he}from"./ai-config-store-C8D_PUGV.js";import{A as ge,At as d,C as f,D as _e,Dt as p,E as ve,F as ye,I as m,L as be,O as xe,Q as h,R as g,S as Se,T as _,X as v,Y as y,Z as Ce,_ as we,b,bt as Te,c as Ee,d as De,ft as Oe,g as ke,ht as x,j as S,k as Ae,l as je,pt as Me,s as Ne,st as Pe,u as Fe,ut as Ie,v as Le,x as Re,xt as ze,y as C}from"./index-Cbis1y9h.js";import{n as Be,r as Ve,t as He}from"./alert-DFypnYT1.js";import{i as Ue,o as We,r as Ge,t as Ke}from"./mocks-file-missing-note-BvL7-uzS.js";var qe=i(`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`}]]),Je=i(`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`}]]),Ye=i(`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`}]]),w=n(t(),1);async function Xe(){try{let e=await fetch(`/api/version`);if(!e.ok)return null;let t=await e.json();return t&&typeof t==`object`&&typeof t.version==`string`&&t.version.trim()||null}catch{return null}}var T=e(),Ze=[{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}],Qe=[{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)`}],E=`app-panel-content mt-0`,D=`app-field-group`,O=`app-section`,k=e=>{if(!e)return`100`;let t={small:`90`,medium:`100`,large:`110`};return e in t?t[e]:Ze.some(t=>t.value===e)?e:`100`};function $e({open:e=!1,onOpenChange:t,embedded:n=!1}){let{theme:i,accentColor:$e,setTheme:et,setAccentColor:tt,setZoom:A}=ke(),[j,nt]=(0,w.useState)(`preferences`),[M,N]=(0,w.useState)(()=>u()),[P,rt]=(0,w.useState)(!1),[F,I]=(0,w.useState)(!1),[L,R]=(0,w.useState)(null),[it,z]=(0,w.useState)(``),[B,V]=(0,w.useState)(null),[H,U]=(0,w.useState)(``),{status:W,refresh:G}=De(),[at,ot]=(0,w.useState)([]),[K,q]=(0,w.useState)({}),[J,st]=(0,w.useState)(``),[Y,X]=(0,w.useState)(``),[Z,ct]=(0,w.useState)(null),[lt,ut]=(0,w.useState)(!1),[dt,ft]=(0,w.useState)(null);(0,w.useEffect)(()=>{let e=!1;return Xe().then(t=>{e||ft(t)}),()=>{e=!0}},[]);let[Q,pt]=(0,w.useState)(()=>k(we().fontSize)),[mt,ht]=(0,w.useState)(!1);(0,w.useEffect)(()=>{Le().then(e=>{let t=k(e.fontSize);pt(t),A(parseInt(t,10)/100),ht(!0)}).catch(()=>{ht(!0)})},[A]),(0,w.useEffect)(()=>{if(!mt)return;let e=k(Q);A(parseInt(e,10)/100),C({fontSize:e}).catch(console.error)},[A,mt,Q]),(0,w.useEffect)(()=>{(e||n)&&(Le().then(e=>{N(e.aiConfig),U(e.mocksFilePath||``),q(e.clientAliases||{})}).catch(()=>{N(u())}),R(null),z(``),fetch(`/api/rule-files`).then(e=>e.json()).then(e=>{Array.isArray(e)&&ot(e)}).catch(()=>{}))},[e,n]);let gt=e=>{let t=l(e);N({...M,provider:e,baseUrl:t.baseUrl,model:t.model})},_t=async()=>{I(!0);try{await C({aiConfig:M}),ue(M),R(`success`),z(`AI 配置保存成功`),b.success(`AI 配置保存成功`)}catch(e){let t=e instanceof Error?e.message:`保存失败`;R(`error`),z(t),b.error(t)}finally{I(!1)}},vt=()=>{me(),N(u()),R(null),z(``)},yt=async()=>{if(!pe(M)){R(`error`),z(`请填写完整的配置信息`);return}I(!0),R(null),z(`测试中...`);try{let e=M.baseUrl,t={"Content-Type":`application/json`},n;M.provider===`anthropic`?(t[`x-api-key`]=M.apiKey,t[`anthropic-version`]=`2023-06-01`,n={model:M.model,max_tokens:100,system:`You are a helpful assistant.`,messages:[{role:`user`,content:`Say "test successful"`}],temperature:.3}):(t.Authorization=`Bearer ${M.apiKey}`,n={model:M.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(M.provider===`anthropic`){if(!i.content?.[0]?.text)throw Error(`API响应格式不正确`)}else if(!i.choices?.[0]?.message?.content)throw Error(`API响应格式不正确`);R(`success`),z(`连接测试成功! API配置正常`)}catch(e){R(`error`),z(e instanceof Error?e.message:`测试失败`)}finally{I(!1)}},bt=(0,w.useCallback)(async()=>{try{let e=await fetch(`/api/refresh-config`,{method:`POST`});if(e.ok){let t=await e.json();G(),R(`success`),z(t.message||`配置已刷新`),setTimeout(()=>{R(null),z(``)},2e3)}else{let t=await e.json();R(`error`),z(t.error||`刷新配置失败`),setTimeout(()=>{R(null),z(``)},2e3)}}catch(e){console.error(`刷新配置失败:`,e),R(`error`),z(`刷新配置失败`),setTimeout(()=>{R(null),z(``)},2e3)}},[G]),xt=(0,w.useCallback)(async()=>{ut(!0),ct(null);try{let e=await fetch(`/api/config-doctor`);e.ok?ct(await e.json()):(R(`error`),z(`诊断失败`),setTimeout(()=>{R(null),z(``)},2e3))}catch(e){console.error(`诊断失败:`,e),R(`error`),z(`诊断失败`),setTimeout(()=>{R(null),z(``)},2e3)}finally{ut(!1)}},[]),St=()=>{let e=J.trim(),t=Y.trim();!e||!t||(q(n=>({...n,[e]:t})),st(``),X(``))},Ct=async()=>{I(!0);try{await C({clientAliases:K}),R(`success`),z(`客户端名称已保存,新请求立即生效`),b.success(`客户端名称保存成功`)}catch(e){let t=e instanceof Error?e.message:`保存失败`;R(`error`),z(t),b.error(t)}finally{I(!1)}},wt=async()=>{I(!0);try{await C({mocksFilePath:H}),G(),R(`success`),z(`Mock 文件路径已更新,已切换到新文件`),b.success(`Mock 文件路径保存成功`),setTimeout(()=>{R(null),z(``)},3e3)}catch(e){let t=e instanceof Error?e.message:`保存失败`;R(`error`),z(t),b.error(t)}finally{I(!1)}};Re({active:(e||n)&&j!==`preferences`,enabled:!F,priority:Se.panel,onSave:()=>{if(j===`config`)return wt();if(j===`clients`)return Ct();if(j===`ai`)return _t()}});let $=(0,T.jsxs)(T.Fragment,{children:[!n&&(0,T.jsxs)(Ae,{className:`px-6 pt-6 pb-4`,children:[(0,T.jsxs)(ge,{className:`flex items-center gap-2`,children:[(0,T.jsx)(Me,{className:`h-5 w-5`}),`系统设置`]}),(0,T.jsx)(xe,{children:`管理系统偏好、配置和 AI 功能`})]}),(0,T.jsxs)(ye,{value:j,onValueChange:e=>nt(e),orientation:`vertical`,className:`min-h-0 flex-1 gap-0`,children:[(0,T.jsxs)(be,{"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,T.jsxs)(g,{value:`preferences`,className:`h-9 w-full flex-none justify-start px-2.5 sm:px-3`,children:[(0,T.jsx)(Me,{}),(0,T.jsx)(`span`,{className:`hidden sm:inline`,children:`偏好设置`})]}),(0,T.jsxs)(g,{value:`config`,className:`h-9 w-full flex-none justify-start px-2.5 sm:px-3`,children:[(0,T.jsx)(p,{}),(0,T.jsx)(`span`,{className:`hidden sm:inline`,children:`配置文件`})]}),(0,T.jsxs)(g,{value:`clients`,className:`h-9 w-full flex-none justify-start px-2.5 sm:px-3`,children:[(0,T.jsx)(re,{}),(0,T.jsx)(`span`,{className:`hidden sm:inline`,children:`客户端`})]}),(0,T.jsxs)(g,{value:`ai`,className:`h-9 w-full flex-none justify-start px-2.5 sm:px-3`,children:[(0,T.jsx)(Oe,{}),(0,T.jsx)(`span`,{className:`hidden sm:inline`,children:`AI 配置`})]})]}),(0,T.jsxs)(m,{value:`preferences`,className:E,children:[(0,T.jsxs)(`div`,{className:D,children:[(0,T.jsx)(S,{className:`text-sm`,children:`主题`}),(0,T.jsxs)(ce,{value:i,onValueChange:e=>et(e),children:[(0,T.jsx)(ie,{children:(0,T.jsx)(oe,{placeholder:`选择主题`})}),(0,T.jsx)(ae,{children:(0,T.jsxs)(se,{children:[(0,T.jsx)(c,{value:`system`,children:(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(ze,{className:`size-4`}),`跟随系统`]})}),(0,T.jsx)(c,{value:`light`,children:(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(Ie,{className:`size-4`}),`浅色模式`]})}),(0,T.jsx)(c,{value:`dark`,children:(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(Te,{className:`size-4`}),`深色模式`]})})]})})]})]}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,T.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,T.jsx)(S,{className:`text-sm`,children:`强调色`}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`统一按钮、状态、选中项和焦点样式。自动模式会根据明暗主题选择合适的颜色。`})]}),(0,T.jsx)(y,{type:`single`,value:$e,onValueChange:e=>{e&&tt(e)},variant:`outline`,spacing:1,className:`flex-wrap justify-start`,"aria-label":`强调色`,children:Qe.map(e=>(0,T.jsxs)(v,{value:e.value,"aria-label":e.label,children:[e.value===`auto`?(0,T.jsx)(Oe,{"data-icon":`inline-start`}):(0,T.jsx)(`span`,{className:`size-3 rounded-full border border-foreground/10`,style:{background:e.color}}),e.label]},e.value))})]}),(0,T.jsxs)(`div`,{className:D,children:[(0,T.jsx)(S,{className:`text-sm`,children:`缩放比例`}),(0,T.jsxs)(ce,{value:Q,onValueChange:pt,children:[(0,T.jsx)(ie,{children:(0,T.jsx)(oe,{placeholder:`选择缩放比例`})}),(0,T.jsx)(ae,{children:(0,T.jsx)(se,{children:Ze.map(e=>(0,T.jsx)(c,{value:e.value,children:e.label},e.value))})})]})]}),(0,T.jsx)(_,{}),(0,T.jsxs)(`div`,{className:D,children:[(0,T.jsx)(`h3`,{className:`text-sm font-medium`,children:`关于`}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Meddle - HTTP 调试代理工具`}),(0,T.jsxs)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`settings-app-version`,children:[`版本: `,dt??`—`]})]})]}),(0,T.jsxs)(m,{value:`config`,className:E,children:[(0,T.jsxs)(`div`,{className:O,children:[(0,T.jsx)(S,{className:`text-sm font-medium`,children:`路由规则文件`}),(0,T.jsxs)(`div`,{className:D,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2 p-3 bg-muted rounded-md`,children:[(0,T.jsx)(p,{className:`h-4 w-4 text-muted-foreground shrink-0`}),(0,T.jsx)(`span`,{className:`text-xs font-mono truncate flex-1`,children:`~/.meddle/route-rules/`})]}),at.length>0?(0,T.jsx)(`div`,{className:`space-y-2`,children:at.map(e=>(0,T.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border px-3 py-2.5 text-sm`,children:[(0,T.jsx)(Ce,{variant:e.enabled?`default`:`secondary`,className:`text-[10px]`,children:e.enabled?`已启用`:`未启用`}),(0,T.jsxs)(`span`,{className:`flex-1 truncate text-xs`,children:[e.name,`.txt`]}),(0,T.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[e.ruleCount,` 条规则`]})]},e.name))}):(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`暂无规则文件`}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`规则文件存放于 ~/.meddle/route-rules/ 目录,纯文本格式。在"路由规则"页面管理。`})]})]}),(0,T.jsx)(_,{}),(0,T.jsxs)(`div`,{className:O,children:[(0,T.jsx)(S,{className:`text-sm font-medium`,children:`Mock 规则文件`}),(0,T.jsxs)(`div`,{className:D,children:[(0,T.jsx)(`span`,{"data-testid":`settings-mocks-file-current-label`,className:`text-xs text-muted-foreground`,children:`当前使用`}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2 p-3 bg-muted rounded-md`,children:[(0,T.jsx)(p,{className:`h-4 w-4 text-muted-foreground shrink-0`}),(0,T.jsx)(`span`,{"data-testid":`settings-mocks-file-resolved`,className:`text-xs font-mono flex-1 wrap-anywhere`,title:W?.path,children:W?.path?(0,T.jsx)(Ke,{path:W.path}):H||`默认: ~/.meddle/mocks.json`})]}),(0,T.jsxs)(`div`,{className:D,children:[(0,T.jsx)(S,{htmlFor:`mocksPath`,className:`text-xs text-muted-foreground`,children:`自定义 Mock 规则文件路径(留空使用默认)`}),(0,T.jsxs)(`div`,{className:`flex gap-2`,children:[(0,T.jsx)(h,{id:`mocksPath`,value:H,onChange:e=>U(e.target.value),placeholder:`如: /path/to/my-mocks.json`,className:`flex-1 h-8 text-sm font-mono`}),(0,T.jsxs)(f,{variant:`outline`,size:`sm`,onClick:wt,disabled:F,className:`h-8`,children:[(0,T.jsx)(x,{"data-icon":`inline-start`,className:`h-3 w-3`}),`应用`]})]}),W?.legacyMocksPath?(0,T.jsx)(Ue,{oldPath:W.legacyMocksPath.oldPath,newPath:W.legacyMocksPath.newPath,visible:je(H),onUseOldPath:()=>U(W.legacyMocksPath.oldPath)}):null,(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`必须是 JSON 格式的 Mock 规则文件。支持 ~ 表示用户主目录;相对路径相对于 Meddle 配置目录。`}),Ee(W)?(0,T.jsx)(Ge,{testId:`settings-mocks-file-invalid`,location:Ne(W.parseError)}):Fe(W)&&!W.legacyMocksPath?(0,T.jsx)(We,{testId:`settings-mocks-file-missing`}):null]})]})]}),(0,T.jsx)(_,{}),(0,T.jsxs)(`div`,{className:D,children:[(0,T.jsx)(`h3`,{className:`text-sm font-medium`,children:`操作`}),(0,T.jsxs)(`div`,{className:`flex gap-2`,children:[(0,T.jsxs)(r,{variant:`outline`,size:`sm`,onClick:bt,children:[(0,T.jsx)(te,{className:`h-4 w-4 mr-1`}),`重新加载配置`]}),(0,T.jsxs)(r,{variant:`outline`,size:`sm`,onClick:xt,disabled:lt,children:[(0,T.jsx)(Ye,{className:`h-4 w-4 mr-1`}),lt?`诊断中...`:`诊断配置`]})]}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`点击重新加载可应用修改后的配置文件,点击诊断配置可检查配置有效性`})]}),Z&&(0,T.jsxs)(`div`,{className:O,children:[(0,T.jsx)(_,{}),(0,T.jsxs)(`div`,{children:[(0,T.jsxs)(`h3`,{className:`mb-4 flex items-center gap-2 text-sm font-medium`,children:[(0,T.jsx)(Ye,{className:`h-4 w-4`}),`诊断结果`]}),(0,T.jsxs)(`div`,{className:`mb-3 p-3 rounded-md border ${Z.status===`ok`?`bg-green-50 dark:bg-green-950/20 border-green-200 dark:border-green-900`:Z.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:[Z.status===`ok`&&(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(d,{className:`h-5 w-5 text-green-600 dark:text-green-400`}),(0,T.jsx)(`span`,{className:`text-sm font-medium text-green-700 dark:text-green-300`,children:`所有检查通过!配置正常。`})]}),Z.status===`warning`&&(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(a,{className:`h-5 w-5 text-yellow-600 dark:text-yellow-400`}),(0,T.jsxs)(`span`,{className:`text-sm font-medium text-yellow-700 dark:text-yellow-300`,children:[`发现 `,Z.warnings.length,` 个警告`]})]}),Z.status===`error`&&(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(o,{className:`h-5 w-5 text-red-600 dark:text-red-400`}),(0,T.jsxs)(`span`,{className:`text-sm font-medium text-red-700 dark:text-red-300`,children:[`发现 `,Z.errors.length,` 个错误`]})]})]}),(0,T.jsx)(`div`,{className:D,children:Z.checks.map((e,t)=>(0,T.jsx)(`div`,{className:`p-2 rounded border bg-card`,children:(0,T.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,T.jsx)(d,{className:`h-4 w-4 text-green-600 dark:text-green-400 mt-0.5 shrink-0`}),(0,T.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,T.jsx)(`div`,{className:`text-sm font-medium`,children:e.name}),(0,T.jsx)(`div`,{className:`text-xs text-muted-foreground font-mono truncate`,children:e.path}),e.details&&(0,T.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))}),Z.warnings&&Z.warnings.length>0&&(0,T.jsxs)(`div`,{className:`mt-3 space-y-1`,children:[(0,T.jsx)(`div`,{className:`text-xs font-medium text-yellow-700 dark:text-yellow-300`,children:`警告:`}),Z.warnings.map((e,t)=>(0,T.jsxs)(`div`,{className:`flex items-start gap-2 text-xs text-yellow-600 dark:text-yellow-400`,children:[(0,T.jsx)(a,{className:`h-3 w-3 mt-0.5 shrink-0`}),(0,T.jsx)(`span`,{children:e})]},t))]}),Z.errors&&Z.errors.length>0&&(0,T.jsxs)(`div`,{className:`mt-3 space-y-1`,children:[(0,T.jsx)(`div`,{className:`text-xs font-medium text-red-700 dark:text-red-300`,children:`错误:`}),Z.errors.map((e,t)=>(0,T.jsxs)(`div`,{className:`flex items-start gap-2 text-xs text-red-600 dark:text-red-400`,children:[(0,T.jsx)(o,{className:`h-3 w-3 mt-0.5 shrink-0`}),(0,T.jsx)(`span`,{children:e})]},t))]})]})]})]}),(0,T.jsxs)(m,{value:`clients`,className:E,children:[(0,T.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,T.jsxs)(`h3`,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,T.jsx)(re,{className:`h-4 w-4`}),`远程客户端名称`]}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`将日志中的客户端 IP 映射为设备名称。保存后新请求立即生效,无需重启代理。`})]}),(0,T.jsx)(`div`,{className:D,children:Object.entries(K).length===0?(0,T.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,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(h,{value:e,readOnly:!0,className:`h-8 flex-1 font-mono text-xs bg-muted/40`,"aria-label":`客户端 IP ${e}`}),(0,T.jsx)(h,{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,T.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,T.jsx)(Pe,{className:`h-4 w-4`})})]},e))}),(0,T.jsx)(_,{}),(0,T.jsxs)(`div`,{className:D,children:[(0,T.jsx)(S,{className:`text-sm`,children:`添加设备`}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(h,{value:J,onChange:e=>st(e.target.value),placeholder:`客户端 IP,例如 10.13.232.187`,className:`h-8 flex-1 font-mono text-xs`}),(0,T.jsx)(h,{value:Y,onChange:e=>X(e.target.value),onKeyDown:e=>{e.key===`Enter`&&St()},placeholder:`设备名称,例如 iPhone`,className:`h-8 flex-1 text-sm`}),(0,T.jsxs)(r,{variant:`outline`,size:`sm`,className:`h-8`,onClick:St,disabled:!J.trim()||!Y.trim(),children:[(0,T.jsx)(s,{className:`h-4 w-4 mr-1`}),`添加`]})]})]}),(0,T.jsxs)(f,{onClick:Ct,disabled:F,children:[(0,T.jsx)(x,{"data-icon":`inline-start`,className:`h-4 w-4`}),F?`保存中...`:`保存客户端名称`]})]}),(0,T.jsxs)(m,{value:`ai`,className:E,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,T.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,T.jsx)(S,{className:`text-sm`,children:`启用 AI 功能`}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`启用智能代码修复功能`})]}),(0,T.jsx)(le,{checked:M.enabled,onCheckedChange:e=>N({...M,enabled:e}),"aria-label":`启用 AI 功能`})]}),(0,T.jsx)(_,{}),(0,T.jsxs)(`div`,{className:O,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,T.jsx)(S,{className:`text-sm`,children:`AI 模型配置`}),(0,T.jsxs)(r,{variant:`outline`,size:`sm`,onClick:()=>{V({name:``,provider:`openai`,apiKey:``,baseUrl:`https://api.openai.com/v1/chat/completions`,model:`gpt-4o-mini`})},children:[(0,T.jsx)(s,{className:`h-4 w-4 mr-1`}),`添加模型`]})]}),(0,T.jsx)(`div`,{className:D,children:M.models&&M.models.length>0?M.models.map(e=>(0,T.jsx)(`div`,{className:`p-3 rounded-md border ${M.activeModelId===e.id?`border-primary bg-primary/5`:`border-border`}`,children:(0,T.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,T.jsxs)(`div`,{className:`flex-1`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),M.activeModelId===e.id&&(0,T.jsx)(Ce,{variant:`default`,className:`text-xs`,children:`当前使用`})]}),(0,T.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[e.provider===`openai`?`OpenAI`:`Anthropic`,` - `,e.model]})]}),(0,T.jsxs)(`div`,{className:`flex gap-1`,children:[M.activeModelId!==e.id&&(0,T.jsxs)(r,{variant:`ghost`,size:`xs`,onClick:()=>N(de(M,e.id)),children:[(0,T.jsx)(ee,{className:`h-3 w-3 mr-1`}),`使用`]}),(0,T.jsx)(r,{variant:`ghost`,size:`icon-sm`,onClick:()=>N(fe(M,e.id)),className:`text-destructive`,"aria-label":`删除模型`,children:(0,T.jsx)(Pe,{className:`h-3 w-3`})})]})]})},e.id)):(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground italic py-4 text-center`,children:`暂无模型配置,点击"添加模型"创建`})}),B&&(0,T.jsxs)(`div`,{className:`space-y-5 rounded-md border border-primary bg-primary/5 p-4`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,T.jsx)(S,{className:`text-sm font-medium`,children:`新增模型`}),(0,T.jsx)(r,{variant:`ghost`,size:`icon-xs`,onClick:()=>V(null),"aria-label":`关闭新增模型表单`,children:(0,T.jsx)(o,{className:`h-4 w-4`})})]}),(0,T.jsxs)(`div`,{className:D,children:[(0,T.jsx)(S,{htmlFor:`newModelName`,className:`text-xs`,children:`模型名称`}),(0,T.jsx)(h,{id:`newModelName`,value:B.name||``,onChange:e=>V({...B,name:e.target.value}),placeholder:`如:GPT-4o Mini`,className:`h-8 text-sm`})]}),(0,T.jsxs)(`div`,{className:D,children:[(0,T.jsx)(S,{className:`text-xs`,children:`服务商`}),(0,T.jsxs)(y,{type:`single`,value:B.provider,onValueChange:e=>{if(e===`openai`){let e=l(`openai`);V({...B,provider:`openai`,baseUrl:e.baseUrl,model:e.model})}else if(e===`anthropic`){let e=l(`anthropic`);V({...B,provider:`anthropic`,baseUrl:e.baseUrl,model:e.model})}},variant:`outline`,size:`sm`,spacing:0,children:[(0,T.jsx)(v,{value:`openai`,children:`OpenAI`}),(0,T.jsx)(v,{value:`anthropic`,children:`Anthropic`})]})]}),(0,T.jsxs)(`div`,{className:D,children:[(0,T.jsx)(S,{htmlFor:`newModelApiKey`,className:`text-xs`,children:`API Key`}),(0,T.jsx)(h,{id:`newModelApiKey`,type:P?`text`:`password`,value:B.apiKey||``,onChange:e=>V({...B,apiKey:e.target.value}),placeholder:`输入 API Key`,className:`h-8 text-sm`})]}),(0,T.jsxs)(`div`,{className:D,children:[(0,T.jsx)(S,{htmlFor:`newModelModel`,className:`text-xs`,children:`模型`}),(0,T.jsx)(h,{id:`newModelModel`,value:B.model||``,onChange:e=>V({...B,model:e.target.value}),placeholder:`模型名称`,className:`h-8 text-sm`})]}),(0,T.jsxs)(`div`,{className:D,children:[(0,T.jsx)(S,{htmlFor:`newModelBaseUrl`,className:`text-xs`,children:`API 端点`}),(0,T.jsx)(h,{id:`newModelBaseUrl`,value:B.baseUrl||``,onChange:e=>V({...B,baseUrl:e.target.value}),placeholder:`API 端点`,className:`h-8 text-sm`})]}),(0,T.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,T.jsx)(r,{variant:`outline`,size:`xs`,onClick:()=>V(null),children:`取消`}),(0,T.jsxs)(r,{size:`xs`,onClick:()=>{B.name&&B.apiKey&&B.model&&B.baseUrl&&(N(he(M,B)),V(null))},disabled:!B.name||!B.apiKey||!B.model||!B.baseUrl,children:[(0,T.jsx)(s,{className:`h-3 w-3 mr-1`}),`添加`]})]})]})]}),(0,T.jsx)(_,{}),(0,T.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,T.jsx)(S,{className:`text-sm`,children:`传统配置(向后兼容)`}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`如果未配置多模型,将使用此配置`})]}),(0,T.jsxs)(`div`,{className:D,children:[(0,T.jsx)(S,{className:`text-xs`,children:`AI 服务商`}),(0,T.jsxs)(y,{type:`single`,value:M.provider,onValueChange:e=>{(e===`openai`||e===`anthropic`)&>(e)},variant:`outline`,size:`sm`,spacing:0,children:[(0,T.jsx)(v,{value:`openai`,children:`OpenAI`}),(0,T.jsx)(v,{value:`anthropic`,children:`Anthropic`})]})]}),(0,T.jsxs)(`div`,{className:D,children:[(0,T.jsx)(S,{htmlFor:`apiKey`,className:`text-xs`,children:`API Key`}),(0,T.jsxs)(`div`,{className:`flex gap-2`,children:[(0,T.jsx)(h,{id:`apiKey`,type:P?`text`:`password`,value:M.apiKey,onChange:e=>N({...M,apiKey:e.target.value}),placeholder:`输入 API Key`,className:`flex-1 h-8 text-sm`}),(0,T.jsx)(r,{variant:`outline`,size:`icon-sm`,onClick:()=>rt(!P),"aria-label":P?`隐藏 API Key`:`显示 API Key`,children:P?(0,T.jsx)(qe,{className:`h-4 w-4`}):(0,T.jsx)(Je,{className:`h-4 w-4`})})]})]}),(0,T.jsxs)(`div`,{className:D,children:[(0,T.jsx)(S,{htmlFor:`model`,className:`text-xs`,children:`模型`}),(0,T.jsx)(h,{id:`model`,value:M.model,onChange:e=>N({...M,model:e.target.value}),placeholder:`模型名称`,className:`h-8 text-sm`})]}),(0,T.jsxs)(`div`,{className:D,children:[(0,T.jsx)(S,{htmlFor:`baseUrl`,className:`text-xs`,children:`API 端点`}),(0,T.jsx)(h,{id:`baseUrl`,value:M.baseUrl,onChange:e=>N({...M,baseUrl:e.target.value}),placeholder:M.provider===`openai`?`https://api.openai.com/v1/chat/completions`:`https://api.anthropic.com/v1/messages`,className:`h-8 text-sm`})]}),it&&(0,T.jsxs)(He,{variant:L===`error`?`destructive`:`default`,children:[L===`success`?(0,T.jsx)(d,{}):L===`error`?(0,T.jsx)(o,{}):(0,T.jsx)(a,{}),(0,T.jsx)(Ve,{children:L===`success`?`操作成功`:L===`error`?`操作失败`:`处理中`}),(0,T.jsx)(Be,{children:it})]}),(0,T.jsx)(_,{}),(0,T.jsxs)(`div`,{className:`flex justify-between`,children:[(0,T.jsxs)(r,{variant:`outline`,size:`sm`,onClick:vt,children:[(0,T.jsx)(ne,{className:`h-4 w-4 mr-1`}),`重置`]}),(0,T.jsxs)(`div`,{className:`flex gap-2`,children:[(0,T.jsx)(r,{variant:`outline`,size:`sm`,onClick:yt,disabled:!pe(M)||F,children:`测试连接`}),(0,T.jsxs)(f,{size:`sm`,onClick:_t,disabled:F,children:[(0,T.jsx)(x,{"data-icon":`inline-start`,className:`h-4 w-4`}),F?`保存中...`:`保存`]})]})]})]})]})]});return n?(0,T.jsx)(`div`,{"data-testid":`settings-fullwidth`,className:`app-workspace-content flex h-full min-h-0 w-full flex-col overflow-hidden p-0`,children:(0,T.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-md border bg-card`,children:$})}):(0,T.jsx)(ve,{open:e,onOpenChange:t,children:(0,T.jsx)(_e,{className:`p-0 flex flex-col`,resizable:!0,defaultWidth:600,storageKey:`settings-panel`,children:$})})}export{$e as SettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,d as t,l as n,o as r,p as i}from"./button-BFNlGZ5p.js";import{a,o,r as s,t as c}from"./dist-CFZ4xMSF.js";import{n as l,t as u}from"./dist-
|
|
1
|
+
import{c as e,d as t,l as n,o as r,p as i}from"./button-BFNlGZ5p.js";import{a,o,r as s,t as c}from"./dist-CFZ4xMSF.js";import{n as l,t as u}from"./dist-fzPL-8F9.js";var d=i(t(),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};
|
package/web/dist/index.html
CHANGED
|
@@ -5,23 +5,22 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>web</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-Cbis1y9h.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/button-BFNlGZ5p.js">
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-Bsv9ad5F.js">
|
|
10
11
|
<link rel="modulepreload" crossorigin href="/assets/dist-CFZ4xMSF.js">
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-C-E2R2jk.js">
|
|
12
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-BCvvYbmI.js">
|
|
13
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-DD7AvbXP.js">
|
|
14
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-Bq2klZ3g.js">
|
|
15
12
|
<link rel="modulepreload" crossorigin href="/assets/dist-LiAcI8CK.js">
|
|
16
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
17
|
-
<link rel="modulepreload" crossorigin href="/assets/es2015-
|
|
18
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
19
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-UcOFuoN0.js">
|
|
20
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-YM3jbhT-.js">
|
|
13
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-C-E2R2jk.js">
|
|
14
|
+
<link rel="modulepreload" crossorigin href="/assets/es2015-DPJTBYa9.js">
|
|
15
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-fzPL-8F9.js">
|
|
21
16
|
<link rel="modulepreload" crossorigin href="/assets/check-BkfHQ6re.js">
|
|
22
17
|
<link rel="modulepreload" crossorigin href="/assets/chevron-down-DHwUtL4O.js">
|
|
23
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
24
|
-
<link rel="
|
|
18
|
+
<link rel="modulepreload" crossorigin href="/assets/select-CFTzQ8Uy.js">
|
|
19
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-CRmX_NvH.js">
|
|
20
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-Dk9a2sJl.js">
|
|
21
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-wv9ebJK_.js">
|
|
22
|
+
<link rel="modulepreload" crossorigin href="/assets/ai-config-store-C8D_PUGV.js">
|
|
23
|
+
<link rel="stylesheet" crossorigin href="/assets/index-dKaIrLee.css">
|
|
25
24
|
</head>
|
|
26
25
|
<body>
|
|
27
26
|
<div id="root"></div>
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{c as e,d as t,p as n,t as r,u as i}from"./button-BFNlGZ5p.js";import"./dist-CFZ4xMSF.js";import{t as a}from"./arrow-right-BNum_060.js";import{t as o}from"./check-BkfHQ6re.js";import{t as s}from"./chevron-down-DHwUtL4O.js";import{t as c}from"./circle-x-BEkinhez.js";import{n as l,t as u}from"./server-eYXq3PbE.js";import{t as d}from"./copy-BRnscYy1.js";import{t as f}from"./shield-check-hQXjdfZ7.js";import{t as p}from"./wand-sparkles-DDGjzjnX.js";import"./es2015-CRmLuA2o.js";import{A as m,B as h,D as g,Dt as _,E as ee,F as v,H as y,I as b,L as x,Ot as te,Pt as S,R as C,Rt as w,St as T,T as E,V as ne,b as D,k as re,rt as O,zt as k}from"./index-CkoYwomI.js";import{n as A,t as j}from"./body-diff-view-ByCHr9bv.js";import{n as M,t as ie}from"./syntax-highlight-EJCxGikd.js";import{t as ae}from"./clipboard-DUgC_tNv.js";var N=i(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),oe=i(`corner-down-right`,[[`path`,{d:`m15 10 5 5-5 5`,key:`qqa56n`}],[`path`,{d:`M4 4v7a4 4 0 0 0 4 4h12`,key:`z08zvw`}]]),P=i(`flag`,[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]),F=i(`route`,[[`circle`,{cx:`6`,cy:`19`,r:`3`,key:`1kj8tv`}],[`path`,{d:`M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15`,key:`1d8sl`}],[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}]]),I=n(t(),1);function L(e){return Object.entries(e||{}).map(([e,t])=>`${e}: ${t}`).join(`
|
|
2
|
-
`)}var R=e(),z=2e3;function B({text:e,label:t}){let[n,i]=(0,I.useState)(!1),a=(0,I.useRef)(null);async function s(){try{await ae(e),i(!0),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>i(!1),z),D.success(`已复制${t}`)}catch{D.error(`复制${t}失败,请手动选择复制`)}}return(0,R.jsxs)(r,{variant:`ghost`,size:`xs`,className:`text-[11px] text-muted-foreground hover:text-foreground`,"aria-label":n?`复制${t}成功`:`复制${t}`,onClick:()=>void s(),children:[n?(0,R.jsx)(o,{className:`h-3 w-3 mr-1 text-green-600`}):(0,R.jsx)(d,{className:`h-3 w-3 mr-1`}),n?`已复制`:`复制`]})}function V({body:e}){let[t,n]=(0,I.useState)(`source`),r=(0,I.useMemo)(()=>ie(e||``)===`json`,[e]),i=(0,I.useMemo)(()=>{if(!r)return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}},[e,r]),a=(0,I.useMemo)(()=>M(t===`formatted`?i:e,r?`json`:void 0),[e,i,t,r]);return e?(0,R.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[r?(0,R.jsx)(v,{value:t,onValueChange:e=>n(e),className:`w-fit`,children:(0,R.jsxs)(x,{className:`h-6 px-1`,children:[(0,R.jsx)(C,{value:`source`,className:`h-6 px-2 text-[11px]`,children:`源数据`}),(0,R.jsx)(C,{value:`formatted`,className:`h-6 px-2 text-[11px]`,children:`格式化`})]})}):(0,R.jsx)(`span`,{}),(0,R.jsx)(B,{text:e,label:`Body`})]}),(0,R.jsx)(`div`,{className:`font-mono text-xs bg-muted/30 rounded p-2 overflow-x-auto`,children:(0,R.jsx)(`pre`,{className:`whitespace-pre`,children:a})})]}):(0,R.jsx)(`p`,{className:`text-sm text-muted-foreground py-2`,children:`无内容`})}function H({headers:e}){let t=Object.entries(e||{});return t.length===0?(0,R.jsx)(`p`,{className:`text-sm text-muted-foreground py-2`,children:`无头部信息`}):(0,R.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,R.jsx)(`div`,{className:`flex justify-end`,children:(0,R.jsx)(B,{text:L(e),label:`Headers`})}),(0,R.jsx)(`div`,{className:`font-mono text-xs space-y-0.5`,children:t.map(([e,t])=>(0,R.jsxs)(`div`,{className:`flex gap-2 py-0.5 hover:bg-muted/50 px-1 rounded`,children:[(0,R.jsxs)(`span`,{className:`text-purple-600 shrink-0 font-semibold`,children:[e,`:`]}),(0,R.jsx)(`span`,{className:`text-foreground/80 break-all`,children:t})]},e))})]})}function U(e){return e>=200&&e<300?`bg-green-100 text-green-800`:e>=300&&e<400?`bg-blue-100 text-blue-800`:e>=400&&e<500?`bg-amber-100 text-amber-800`:e>=500?`bg-red-100 text-red-800`:``}function W(e){switch(e){case`ok`:return`bg-green-100 text-green-800 border-green-200`;case`error`:return`bg-red-100 text-red-800 border-red-200`;case`skipped`:return`bg-amber-100 text-amber-800 border-amber-200`;case`short-circuited`:return`bg-blue-100 text-blue-800 border-blue-200`;default:return``}}function G(e){switch(e){case`ok`:return`通过`;case`error`:return`异常`;case`skipped`:return`跳过`;case`short-circuited`:return`已短路返回`;default:return e}}function K(e){switch(e){case`builtin`:return`内置`;case`custom`:return`自定义`;case`system`:return`系统`;default:return e}}function q(e){return e.replace(/^builtin\./,``).replace(/^custom\./,``)}function se(e,t){return`${t}-${e.hook}-${e.name}`}function J(e){return e===`onBeforeResponse`||e===`onAfterResponse`?`response`:`request`}function ce(e,t){return Array.from(new Set([...Object.keys(e),...Object.keys(t)])).sort().map(n=>({key:n,before:e[n]??``,after:t[n]??``})).filter(e=>e.before!==e.after)}function Y({lines:e,className:t}){return e.length===0?(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`无变更`}):(0,R.jsx)(`div`,{className:`rounded-lg border bg-muted/20 p-2 text-xs font-mono space-y-1 ${t||``}`,children:e.map((e,t)=>(0,R.jsxs)(`div`,{className:`whitespace-pre-wrap break-all px-2 py-1 rounded ${e.type===`added`?`bg-green-500/10 text-green-700 dark:text-green-300`:`bg-red-500/10 text-red-700 dark:text-red-300`}`,children:[(0,R.jsx)(`span`,{className:`mr-1`,children:e.type===`added`?`+ `:`- `}),e.text]},`${e.type}-${t}-${e.text}`))})}function X(e,t,n){let r=[];return t!==void 0&&t!==``&&r.push({type:`removed`,text:`${e} ${t}`}),n!==void 0&&n!==``&&r.push({type:`added`,text:`${e} ${n}`}),r}function le(e,t){let n=[];return e!==void 0&&e!==``&&n.push({type:`removed`,text:e}),t!==void 0&&t!==``&&n.push({type:`added`,text:t}),n}function ue(e){let t=e.replace(/\r\n/g,`
|
|
3
|
-
`).split(`
|
|
4
|
-
`);return t[t.length-1]===``&&t.pop(),t.length>0?t:[``]}function Z(e){if(!e)return!1;if(/^\(binary(?:,\s*\d+\s+bytes)?\)$/i.test(e.trim()))return!0;let t=0;for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);r===9||r===10||r===13||(r<32||r===65533)&&(t+=1)}return t>0&&t/Math.max(e.length,1)>.15}function Q({before:e,after:t}){let[n,i]=(0,I.useState)(!1),a=(0,I.useMemo)(()=>ce(e,t),[e,t]),o=(0,I.useMemo)(()=>a.flatMap(e=>X(e.key,e.before,e.after)),[a]);return o.length===0?(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`无变更`}):(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(Y,{lines:o}),(0,R.jsxs)(r,{variant:`ghost`,size:`xs`,onClick:()=>i(e=>!e),children:[n?(0,R.jsx)(s,{className:`h-3.5 w-3.5 mr-1`}):(0,R.jsx)(N,{className:`h-3.5 w-3.5 mr-1`}),n?`收起完整头部`:`展开完整头部`]}),n&&(0,R.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,R.jsxs)(`div`,{className:`rounded-lg bg-muted/50 p-2 text-xs font-mono`,children:[(0,R.jsx)(`div`,{className:`text-[11px] uppercase tracking-wide text-muted-foreground mb-1`,children:`变更前`}),(0,R.jsx)(H,{headers:e})]}),(0,R.jsxs)(`div`,{className:`rounded-lg bg-muted/50 p-2 text-xs font-mono`,children:[(0,R.jsx)(`div`,{className:`text-[11px] uppercase tracking-wide text-muted-foreground mb-1`,children:`变更后`}),(0,R.jsx)(H,{headers:t})]})]})]})}function de({before:e,after:t}){let[n,i]=(0,I.useState)(!1),a=(0,I.useMemo)(()=>A(e||``,t||``).filter(e=>e.added||e.removed),[e,t]),o=(0,I.useMemo)(()=>Z(e||``)||Z(t||``),[e,t]),c=(0,I.useMemo)(()=>o?le(e||``,t||``):a.flatMap(e=>ue(e.value).map(t=>({type:e.added?`added`:`removed`,text:t}))),[e,t,a,o]);return c.length===0?(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`无变更`}):(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(B,{text:e,label:`变更前 Body`}),(0,R.jsx)(B,{text:t,label:`变更后 Body`})]}),(0,R.jsx)(Y,{lines:c,className:`meddle-thin-scroll max-h-40 overflow-auto`}),!o&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(r,{variant:`ghost`,size:`xs`,onClick:()=>i(e=>!e),children:[n?(0,R.jsx)(s,{className:`h-3.5 w-3.5 mr-1`}):(0,R.jsx)(N,{className:`h-3.5 w-3.5 mr-1`}),n?`收起完整 Diff`:`展开完整 Diff`]}),n&&(0,R.jsx)(j,{original:e,modified:t,mode:`inline`,maxHeight:`220px`})]})]})}function fe({stage:e}){let t=e.changes;return t?(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(t.targetBefore||t.targetAfter)&&(0,R.jsxs)(`div`,{className:`rounded-lg bg-muted/50 p-2`,children:[(0,R.jsx)(`div`,{className:`text-[11px] uppercase tracking-wide text-muted-foreground mb-2`,children:`Request URL Diff`}),(0,R.jsx)(Y,{lines:X(`Request URL`,t.targetBefore,t.targetAfter||t.target)})]}),(t.requestHeadersBefore||t.requestHeadersAfter)&&(0,R.jsxs)(`div`,{className:`rounded-lg bg-muted/50 p-2`,children:[(0,R.jsx)(`div`,{className:`text-[11px] uppercase tracking-wide text-muted-foreground mb-2`,children:`Request Header Diff`}),(0,R.jsx)(Q,{before:t.requestHeadersBefore||{},after:t.requestHeadersAfter||{}})]}),(t.responseStatusCodeBefore!==void 0||t.responseStatusCodeAfter!==void 0)&&(0,R.jsxs)(`div`,{className:`rounded-lg bg-muted/50 p-2`,children:[(0,R.jsx)(`div`,{className:`text-[11px] uppercase tracking-wide text-muted-foreground mb-2`,children:`Response Status Diff`}),(0,R.jsx)(Y,{lines:X(`Response Status`,t.responseStatusCodeBefore,t.responseStatusCodeAfter??t.responseStatusCode)})]}),(t.responseHeadersBefore||t.responseHeadersAfter)&&(0,R.jsxs)(`div`,{className:`rounded-lg bg-muted/50 p-2`,children:[(0,R.jsx)(`div`,{className:`text-[11px] uppercase tracking-wide text-muted-foreground mb-2`,children:`Response Header Diff`}),(0,R.jsx)(Q,{before:t.responseHeadersBefore||{},after:t.responseHeadersAfter||{}})]}),(t.responseBodyBefore!==void 0||t.responseBodyAfter!==void 0)&&(0,R.jsxs)(`div`,{className:`rounded-lg bg-muted/50 p-2`,children:[(0,R.jsx)(`div`,{className:`text-[11px] uppercase tracking-wide text-muted-foreground mb-2`,children:`Response Body Diff`}),(0,R.jsx)(de,{before:t.responseBodyBefore||``,after:t.responseBodyAfter||t.responseBody||``})]})]}):null}function pe({stage:e,index:t,isLast:n,accentClass:i}){let[a,o]=(0,I.useState)(e.status!==`skipped`);return(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsxs)(`div`,{className:`rounded-xl border bg-background/90 p-3 space-y-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`space-y-1 min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,R.jsx)(r,{variant:`ghost`,size:`icon-xs`,onClick:()=>o(e=>!e),title:a?`收起`:`展开`,"aria-label":a?`收起`:`展开`,children:a?(0,R.jsx)(s,{className:`h-3.5 w-3.5`}):(0,R.jsx)(N,{className:`h-3.5 w-3.5`})}),(0,R.jsxs)(`span`,{className:`font-medium text-sm`,children:[t+1,`. `,q(e.name)]}),(0,R.jsx)(O,{variant:`outline`,className:`text-xs font-normal`,children:e.hook}),(0,R.jsx)(O,{variant:`outline`,className:`text-xs font-normal`,children:K(e.type)})]}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.status===`short-circuited`?`这一阶段直接生成了响应,请求不会继续往后转发。`:e.status===`error`?`这一阶段执行失败,影响了后续处理流程。`:`这一阶段执行完成,请求继续进入下一步。`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,R.jsx)(O,{className:`text-xs border ${W(e.status)}`,children:G(e.status)}),(0,R.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[e.duration,`ms`]})]})]}),a&&(0,R.jsxs)(R.Fragment,{children:[e.target&&(0,R.jsxs)(`div`,{className:`rounded-lg bg-muted/50 p-2`,children:[(0,R.jsx)(`div`,{className:`text-[11px] uppercase tracking-wide text-muted-foreground mb-1`,children:`当前 Target`}),(0,R.jsx)(`div`,{className:`font-mono text-xs break-all`,children:e.target})]}),(0,R.jsx)(fe,{stage:e}),e.error&&(0,R.jsxs)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700`,children:[`Error: `,e.error]})]})]}),!n&&(0,R.jsx)(`div`,{className:`flex justify-center py-1`,children:(0,R.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,R.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-full ${i} animate-pulse`}),(0,R.jsx)(w,{className:`h-4 w-4 ${i} animate-bounce`})]})})]})}function $({title:e,description:t,stages:n,icon:r,roleLabel:i,roleIcon:a,accentClass:o}){return(0,R.jsxs)(`div`,{className:`rounded-xl border bg-card p-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`flex items-center gap-2 mb-2`,children:(0,R.jsxs)(O,{variant:`outline`,className:`text-[11px] font-normal`,children:[(0,R.jsx)(`span`,{className:`mr-1`,children:a}),i]})}),(0,R.jsxs)(`h4`,{className:`text-sm font-semibold flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:o,children:r}),e]}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:t})]}),(0,R.jsxs)(O,{variant:`outline`,className:`text-xs`,children:[n.length,` 个阶段`]})]}),n.length===0?(0,R.jsx)(`p`,{className:`text-sm text-muted-foreground py-4 text-center`,children:`无阶段信息`}):(0,R.jsx)(`div`,{className:`space-y-3`,children:n.map(({stage:e,index:t},r)=>(0,R.jsx)(pe,{stage:e,index:t,isLast:r===n.length-1,accentClass:o},se(e,t)))})]})}function me(e){let t=[...e.stages].reverse().find(e=>e.status===`short-circuited`);if(t)return{label:`提前返回响应`,description:`在 ${q(t.name)} 阶段直接生成响应`,icon:(0,R.jsx)(oe,{className:`h-4 w-4 text-blue-500`})};let n=[...e.stages].reverse().find(e=>e.status===`error`);return n?{label:`处理过程中出现异常`,description:`${q(n.name)} 执行失败`,icon:(0,R.jsx)(c,{className:`h-4 w-4 text-red-500`})}:{label:`进入正常代理流程`,description:`请求经过检查后继续转发到目标服务`,icon:(0,R.jsx)(a,{className:`h-4 w-4 text-emerald-500`})}}function he({inspection:e}){let t=me(e),n=e.stages.map((e,t)=>({stage:e,index:t})),r=n.filter(({stage:e})=>J(e.hook)===`request`),i=n.filter(({stage:e})=>J(e.hook)===`response`);return(0,R.jsxs)(`div`,{className:`space-y-4 pt-3`,children:[(0,R.jsxs)(`div`,{className:`rounded-xl border bg-gradient-to-br from-muted/20 via-background to-muted/10 p-4 space-y-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-4 text-sm`,children:[(0,R.jsx)(O,{variant:`outline`,className:`font-mono`,children:e.method}),(0,R.jsx)(`span`,{className:`font-mono text-muted-foreground truncate flex-1`,children:e.url}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1 text-muted-foreground`,children:[(0,R.jsx)(l,{className:`h-3.5 w-3.5`}),(0,R.jsxs)(`span`,{className:`text-xs`,children:[e.totalDuration,`ms`]})]})]}),(0,R.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-3`,children:[(0,R.jsxs)(`div`,{className:`rounded-lg border bg-background/80 p-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground mb-1`,children:[(0,R.jsx)(F,{className:`h-3.5 w-3.5`}),`请求入口`]}),(0,R.jsx)(`div`,{className:`text-sm font-medium`,children:`请求进入代理`}),(0,R.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`从浏览器或客户端发起,进入 Meddle 的处理流水线`})]}),(0,R.jsxs)(`div`,{className:`rounded-lg border bg-background/80 p-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground mb-1`,children:[(0,R.jsx)(f,{className:`h-3.5 w-3.5`}),`处理阶段`]}),(0,R.jsxs)(`div`,{className:`text-sm font-medium`,children:[e.stages.length,` 个阶段`]}),(0,R.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`按实际执行顺序记录插件和系统模块对请求的处理`})]}),(0,R.jsxs)(`div`,{className:`rounded-lg border bg-background/80 p-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground mb-1`,children:[t.icon,`最终结果`]}),(0,R.jsx)(`div`,{className:`text-sm font-medium`,children:t.label}),(0,R.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:t.description})]})]})]}),e.stages.length===0?(0,R.jsx)(`p`,{className:`text-sm text-muted-foreground py-4 text-center`,children:`无处理阶段信息(插件模式可能未开启)`}):(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,R.jsx)(P,{className:`h-3.5 w-3.5`}),(0,R.jsx)(`span`,{children:`默认仅展示改动内容;跳过阶段默认折叠,可单独展开查看更多。`})]}),(0,R.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,R.jsx)($,{title:`请求阶段`,description:`客户端请求进入代理后,按顺序执行请求侧处理阶段`,stages:r,icon:(0,R.jsx)(F,{className:`h-4 w-4 text-blue-500`}),roleLabel:`客户端`,roleIcon:(0,R.jsx)(_,{className:`h-3 w-3 text-blue-500`}),accentClass:`text-blue-500`}),(0,R.jsx)($,{title:`响应阶段`,description:`服务器响应返回代理后,按顺序执行响应侧处理阶段`,stages:i,icon:(0,R.jsx)(k,{className:`h-4 w-4 text-emerald-500`}),roleLabel:`服务器`,roleIcon:(0,R.jsx)(u,{className:`h-3 w-3 text-emerald-500`}),accentClass:`text-emerald-500`})]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-center gap-2 text-xs text-muted-foreground`,children:[(0,R.jsx)(`span`,{children:`请求进入`}),(0,R.jsx)(a,{className:`h-4 w-4 animate-pulse text-blue-500`}),(0,R.jsx)(`span`,{children:`请求阶段`}),(0,R.jsx)(a,{className:`h-4 w-4 animate-pulse text-violet-500`}),(0,R.jsx)(`span`,{children:`响应阶段`}),(0,R.jsx)(a,{className:`h-4 w-4 animate-pulse text-emerald-500`}),(0,R.jsx)(`span`,{children:`最终返回`})]})]})]})}function ge(e){return e==null?`—`:e<1e3?`${e} ms`:`${(e/1e3).toFixed(1)} s`}function _e({record:e,detail:t}){let n=h(e),r=Object.entries(t.requestHeaders||{}).slice(0,6),i=n.kind===`rule`?`source: ${e.source}\ntarget: ${e.target}`:n.kind===`mock`?`mock: true · ${e.source}`:`pass · ${e.source}`;return(0,R.jsxs)(`div`,{className:`space-y-3 pt-3`,"data-testid":`detail-overview-hit`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-[72px_1fr] gap-x-3 gap-y-1.5 text-xs`,children:[(0,R.jsx)(`div`,{className:`text-muted-foreground`,children:`方法`}),(0,R.jsx)(`div`,{className:`font-mono font-medium`,children:e.method}),(0,R.jsx)(`div`,{className:`text-muted-foreground`,children:`URL`}),(0,R.jsx)(`div`,{className:`break-all font-mono`,children:e.source}),(0,R.jsx)(`div`,{className:`text-muted-foreground`,children:`状态`}),(0,R.jsxs)(`div`,{className:`font-mono`,children:[t.statusCode,` `,t.statusMessage]}),(0,R.jsx)(`div`,{className:`text-muted-foreground`,children:`延迟`}),(0,R.jsx)(`div`,{className:`font-mono tabular-nums`,children:ge(e.duration)})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h4`,{className:`mb-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`命中规则 / Mock`}),(0,R.jsx)(`div`,{className:`mb-1 text-sm font-semibold`,children:n.title}),(0,R.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:n.description}),(0,R.jsx)(`pre`,{className:`meddle-thin-scroll w-full overflow-x-auto rounded border bg-muted/30 px-2 py-1.5 font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-all`,"data-testid":`detail-hit-box`,"data-hit-kind":n.kind,children:i})]}),r.length>0&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h4`,{className:`mb-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`请求 Headers(节选)`}),(0,R.jsx)(`div`,{className:`grid grid-cols-[minmax(72px,90px)_1fr] gap-x-3 gap-y-1 text-xs`,children:r.map(([e,t])=>(0,R.jsxs)(I.Fragment,{children:[(0,R.jsx)(`div`,{className:`truncate text-muted-foreground`,title:e,children:e}),(0,R.jsx)(`div`,{className:`truncate font-mono`,title:t,children:t})]},e))})]})]})}function ve({open:e=!1,onClose:t,embedded:n=!1,detail:i,loading:a,error:o,selectedRecord:s,onCreateMock:c,onReplay:l,onJumpToRule:u}){let[d,f]=(0,I.useState)(!1),h=()=>{i&&s&&c&&c({source:s.source,responseBody:i.responseBody,statusCode:i.statusCode,responseHeaders:i.responseHeaders})},[_,w]=(0,I.useState)(null),D=(0,R.jsxs)(R.Fragment,{children:[`请求详情`,i&&(0,R.jsxs)(O,{className:`${U(i.statusCode)} border-0`,children:[i.statusCode,` `,i.statusMessage]}),s?.clientType&&(0,R.jsxs)(O,{variant:`outline`,className:`max-w-48 text-[10px] font-mono`,title:[s.clientName,s.clientIp].filter(Boolean).join(` · `),children:[s.clientName||(s.clientType===`local`?`本机`:s.clientType===`plugin`?`插件测试`:`远程设备`),s.clientIp?` · ${s.clientIp}`:``]}),s?.applicationName&&(0,R.jsxs)(O,{variant:`outline`,className:`max-w-56 gap-1.5 text-[10px]`,title:[s.applicationIdentitySource===`local-process`?`识别方式: 本机进程`:s.applicationIdentitySource===`user-agent`?`识别方式: User-Agent 推断`:s.applicationIdentitySource===`client-reported`?`识别方式: 客户端上报`:void 0,s.applicationIdentityConfidence?`可信度: ${s.applicationIdentityConfidence===`high`?`高`:s.applicationIdentityConfidence===`medium`?`中`:`低`}`:void 0,s.applicationProcess,s.applicationPid?`PID ${s.applicationPid}`:void 0,s.applicationBundleId,s.applicationPath].filter(Boolean).join(` · `),children:[(0,R.jsx)(ne,{record:s,compact:!0}),(0,R.jsx)(`span`,{className:`truncate`,children:s.applicationName}),s.applicationIdentitySource===`user-agent`&&(0,R.jsx)(`span`,{className:`shrink-0 text-[9px] text-muted-foreground`,children:`推断`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5 ml-auto`,children:[i&&l&&s?.id!=null&&(0,R.jsxs)(r,{variant:`outline`,size:`xs`,onClick:async()=>{if(s?.id!=null&&l){f(!0),w(null);try{await l(s.id)}catch(e){w(e.message||`重放失败`)}finally{f(!1)}}},disabled:d,title:`使用相同的请求参数重新发送请求`,children:[(0,R.jsx)(T,{className:`h-3.5 w-3.5 mr-1 ${d?`animate-spin`:``}`}),d?`重放中...`:`重放`]}),s&&u&&s.source!==s.target&&!s.mock&&(0,R.jsxs)(r,{variant:`outline`,size:`xs`,onClick:()=>u(s),title:`跳转到路由规则配置`,"data-testid":`detail-jump-to-rule`,children:[(0,R.jsx)(S,{className:`h-3.5 w-3.5 mr-1`}),`查看规则`]}),i&&c&&!s?.mock&&(0,R.jsxs)(r,{variant:`outline`,size:`xs`,onClick:h,"data-testid":`detail-create-mock`,children:[(0,R.jsx)(p,{className:`h-3.5 w-3.5 mr-1`}),`创建 Mock`]})]})]}),A=(0,R.jsxs)(R.Fragment,{children:[n?(0,R.jsx)(`div`,{className:`px-3 pt-2.5 pb-1.5`,"data-testid":`detail-panel-header`,children:(0,R.jsx)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-foreground`,children:D})}):(0,R.jsx)(re,{className:`px-4 pt-4 pb-2`,children:(0,R.jsx)(m,{className:`flex items-center gap-2 text-base`,children:D})}),(0,R.jsx)(E,{}),_&&(0,R.jsx)(`div`,{className:`mx-4 mt-2 px-3 py-2 rounded-md bg-red-50 border border-red-200 text-red-700 text-xs`,children:_}),o&&!a&&!i&&(0,R.jsx)(`div`,{className:`mx-4 mt-2 px-3 py-2 rounded-md bg-amber-50 border border-amber-200 text-amber-800 text-xs`,children:o}),a?(0,R.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,R.jsx)(te,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):i&&s?(0,R.jsxs)(v,{defaultValue:`overview`,className:`flex-1 flex flex-col min-h-0`,children:[(0,R.jsxs)(x,{className:`mx-4 mt-2 w-fit`,children:[(0,R.jsx)(C,{value:`overview`,"data-testid":`detail-tab-overview`,children:`概览`}),(0,R.jsx)(C,{value:`request`,children:`请求`}),(0,R.jsx)(C,{value:`response`,children:`响应`}),(0,R.jsxs)(C,{value:`inspect`,children:[(0,R.jsx)(k,{className:`h-3.5 w-3.5 mr-1`}),`Inspect`]})]}),(0,R.jsx)(b,{value:`overview`,className:`flex-1 min-h-0 mt-0`,children:(0,R.jsx)(y,{className:`h-full px-4 pb-4`,children:(0,R.jsx)(_e,{record:s,detail:i})})}),(0,R.jsx)(b,{value:`request`,className:`flex-1 min-h-0 mt-0`,children:(0,R.jsx)(y,{className:`h-full px-4 pb-4`,children:(0,R.jsxs)(`div`,{className:`space-y-3 pt-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h4`,{className:`text-xs font-semibold text-muted-foreground mb-1.5 uppercase tracking-wider`,children:`Request Headers`}),(0,R.jsx)(H,{headers:i.requestHeaders})]}),(0,R.jsx)(E,{}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h4`,{className:`text-xs font-semibold text-muted-foreground mb-1.5 uppercase tracking-wider`,children:`Request Body`}),(0,R.jsx)(V,{body:i.requestBody})]})]})})}),(0,R.jsx)(b,{value:`response`,className:`flex-1 min-h-0 mt-0`,children:(0,R.jsx)(y,{className:`h-full px-4 pb-4`,children:(0,R.jsxs)(`div`,{className:`space-y-3 pt-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h4`,{className:`text-xs font-semibold text-muted-foreground mb-1.5 uppercase tracking-wider`,children:`Response Headers`}),(0,R.jsx)(H,{headers:i.responseHeaders})]}),(0,R.jsx)(E,{}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h4`,{className:`text-xs font-semibold text-muted-foreground mb-1.5 uppercase tracking-wider`,children:`Response Body`}),(0,R.jsx)(V,{body:i.responseBody})]})]})})}),(0,R.jsx)(b,{value:`inspect`,className:`flex-1 min-h-0 mt-0`,children:(0,R.jsx)(y,{className:`h-full px-4 pb-4`,children:i.inspection?(0,R.jsx)(he,{inspection:i.inspection}):(0,R.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full py-12 text-muted-foreground`,children:[(0,R.jsx)(k,{className:`h-12 w-12 mb-4 opacity-50`}),(0,R.jsx)(`p`,{className:`text-sm`,children:`无 Inspect 信息`}),(0,R.jsx)(`p`,{className:`text-xs mt-1`,children:`需要开启插件模式(on/shadow)才能查看请求生命周期`})]})})})]}):s?(0,R.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-muted-foreground text-sm px-6 text-center`,children:(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(`div`,{children:`详情数据暂不可用`}),(0,R.jsxs)(`div`,{className:`text-xs font-mono break-all`,children:[s.method,` `,s.source]})]})}):(0,R.jsx)(`div`,{"data-testid":`detail-empty-state`,className:`flex flex-1 items-center justify-center px-6 text-center text-sm text-muted-foreground`,children:`选择左侧一条流量以查看详情 / 命中信息`})]});return n?(0,R.jsx)(`div`,{className:`flex h-full min-h-0 flex-col`,children:A}):(0,R.jsx)(ee,{open:e,onOpenChange:e=>!e&&t?.(),children:(0,R.jsx)(g,{className:`p-0 flex flex-col`,resizable:!0,defaultWidth:640,storageKey:`detail-panel`,children:A})})}export{ve as DetailPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,d as t,o as n,p as r}from"./button-BFNlGZ5p.js";import{c as i,n as a,o,r as s,s as c}from"./dist-CFZ4xMSF.js";import{t as l}from"./dist-C-E2R2jk.js";var u=r(t(),1);function d(e,t=globalThis?.document){let n=l(e);u.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var f=e(),p=`DismissableLayer`,m=`dismissableLayer.update`,h=`dismissableLayer.pointerDownOutside`,g=`dismissableLayer.focusOutside`,_,v=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),y=u.forwardRef((e,t)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:c,onInteractOutside:l,onDismiss:p,...h}=e,g=u.useContext(v),[y,b]=u.useState(null),x=y?.ownerDocument??globalThis?.document,[,T]=u.useState({}),E=n(t,e=>b(e)),D=Array.from(g.layers),[O]=[...g.layersWithOutsidePointerEventsDisabled].slice(-1),k=D.indexOf(O),A=y?D.indexOf(y):-1,j=g.layersWithOutsidePointerEventsDisabled.size>0,M=A>=k,N=S(e=>{let t=e.target,n=[...g.branches].some(e=>e.contains(t));!M||n||(a?.(e),l?.(e),e.defaultPrevented||p?.())},x),P=C(e=>{let t=e.target;[...g.branches].some(e=>e.contains(t))||(c?.(e),l?.(e),e.defaultPrevented||p?.())},x);return d(e=>{A===g.layers.size-1&&(i?.(e),!e.defaultPrevented&&p&&(e.preventDefault(),p()))},x),u.useEffect(()=>{if(y)return r&&(g.layersWithOutsidePointerEventsDisabled.size===0&&(_=x.body.style.pointerEvents,x.body.style.pointerEvents=`none`),g.layersWithOutsidePointerEventsDisabled.add(y)),g.layers.add(y),w(),()=>{r&&g.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=_)}},[y,x,r,g]),u.useEffect(()=>()=>{y&&(g.layers.delete(y),g.layersWithOutsidePointerEventsDisabled.delete(y),w())},[y,g]),u.useEffect(()=>{let e=()=>T({});return document.addEventListener(m,e),()=>document.removeEventListener(m,e)},[]),(0,f.jsx)(o.div,{...h,ref:E,style:{pointerEvents:j?M?`auto`:`none`:void 0,...e.style},onFocusCapture:s(e.onFocusCapture,P.onFocusCapture),onBlurCapture:s(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:s(e.onPointerDownCapture,N.onPointerDownCapture)})});y.displayName=p;var b=`DismissableLayerBranch`,x=u.forwardRef((e,t)=>{let r=u.useContext(v),i=u.useRef(null),a=n(t,i);return u.useEffect(()=>{let e=i.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}},[r.branches]),(0,f.jsx)(o.div,{...e,ref:a})});x.displayName=b;function S(e,t=globalThis?.document){let n=l(e),r=u.useRef(!1),i=u.useRef(()=>{});return u.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){T(h,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function C(e,t=globalThis?.document){let n=l(e),r=u.useRef(!1);return u.useEffect(()=>{let e=e=>{e.target&&!r.current&&T(g,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function w(){let e=new CustomEvent(m);document.dispatchEvent(e)}function T(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?c(i,a):i.dispatchEvent(a)}var E=r(i(),1),D=`Portal`,O=u.forwardRef((e,t)=>{let{container:n,...r}=e,[i,s]=u.useState(!1);a(()=>s(!0),[]);let c=n||i&&globalThis?.document?.body;return c?E.createPortal((0,f.jsx)(o.div,{...r,ref:t}),c):null});O.displayName=D;export{y as n,O as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,d as t,o as n,p as r}from"./button-BFNlGZ5p.js";import{a as i,c as a,n as o,o as s}from"./dist-CFZ4xMSF.js";import{t as c}from"./dist-C-E2R2jk.js";import{t as l}from"./dist-BCvvYbmI.js";var u=r(t(),1),d=e(),f=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`}),p=`VisuallyHidden`,m=u.forwardRef((e,t)=>(0,d.jsx)(s.span,{...e,ref:t,style:{...f,...e.style}}));m.displayName=p;var h=m,g=[`top`,`right`,`bottom`,`left`],_=Math.min,v=Math.max,y=Math.round,b=Math.floor,x=e=>({x:e,y:e}),S={left:`right`,right:`left`,bottom:`top`,top:`bottom`},C={start:`end`,end:`start`};function w(e,t,n){return v(e,_(t,n))}function T(e,t){return typeof e==`function`?e(t):e}function E(e){return e.split(`-`)[0]}function D(e){return e.split(`-`)[1]}function O(e){return e===`x`?`y`:`x`}function k(e){return e===`y`?`height`:`width`}var A=new Set([`top`,`bottom`]);function j(e){return A.has(E(e))?`y`:`x`}function M(e){return O(j(e))}function N(e,t,n){n===void 0&&(n=!1);let r=D(e),i=M(e),a=k(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=H(o)),[o,H(o)]}function P(e){let t=H(e);return[F(e),t,F(t)]}function F(e){return e.replace(/start|end/g,e=>C[e])}var I=[`left`,`right`],L=[`right`,`left`],R=[`top`,`bottom`],z=[`bottom`,`top`];function B(e,t,n){switch(e){case`top`:case`bottom`:return n?t?L:I:t?I:L;case`left`:case`right`:return t?R:z;default:return[]}}function V(e,t,n,r){let i=D(e),a=B(E(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(F)))),a}function H(e){return e.replace(/left|right|bottom|top/g,e=>S[e])}function ee(e){return{top:0,right:0,bottom:0,left:0,...e}}function te(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:ee(e)}function ne(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 re(e,t,n){let{reference:r,floating:i}=e,a=j(t),o=M(t),s=k(o),c=E(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(D(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 ie(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}=T(t,e),p=te(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=ne(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=ne(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 ae=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}=re(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??ie},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}=re(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}},oe=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}=T(e,t)||{};if(l==null)return{};let d=te(u),f={x:n,y:r},p=M(i),m=k(p),h=await o.getDimensions(l),g=p===`y`,v=g?`top`:`left`,y=g?`bottom`:`right`,b=g?`clientHeight`:`clientWidth`,x=a.reference[m]+a.reference[p]-f[p]-a.floating[m],S=f[p]-a.reference[p],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),E=C?C[b]:0;(!E||!await(o.isElement==null?void 0:o.isElement(C)))&&(E=s.floating[b]||a.floating[m]);let O=x/2-S/2,A=E/2-h[m]/2-1,j=_(d[v],A),N=_(d[y],A),P=j,F=E-h[m]-N,I=E/2-h[m]/2+O,L=w(P,I,F),R=!c.arrow&&D(i)!=null&&I!==L&&a.reference[m]/2-(I<P?j:N)-h[m]/2<0,z=R?I<P?I-P:I-F:0;return{[p]:f[p]+z,data:{[p]:L,centerOffset:I-L-z,...R&&{alignmentOffset:z}},reset:R}}}),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}=T(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=E(r),_=j(o),v=E(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[H(o)]:P(o)),x=p!==`none`;!d&&x&&b.push(...V(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],D=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=N(r,a,y);w.push(C[e[0]],C[e[1]])}if(D=[...D,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==j(t))||D.every(e=>j(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:D},reset:{placement:t}};let n=D.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=D.filter(e=>{if(x){let t=j(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 le(e){return g.some(t=>e[t]>=0)}var ue=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=T(e,t);switch(i){case`referenceHidden`:{let e=ce(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:le(e)}}}case`escaped`:{let e=ce(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:le(e)}}}default:return{}}}}},de=new Set([`left`,`top`]);async function fe(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=E(n),s=D(n),c=j(n)===`y`,l=de.has(o)?-1:1,u=a&&c?-1:1,d=T(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 pe=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 fe(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}}}}},me=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}=T(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=j(E(i)),p=O(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=w(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=w(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}}}}}},he=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}=T(e,t),u={x:n,y:r},d=j(i),f=O(d),p=u[f],m=u[d],h=T(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=de.has(E(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}}}},ge=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}=T(e,t),u=await o.detectOverflow(t,l),d=E(i),f=D(i),p=j(i)===`y`,{width:m,height:h}=a.floating,g,y;d===`top`||d===`bottom`?(g=d,y=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(y=d,g=f===`end`?`top`:`bottom`);let b=h-u.top-u.bottom,x=m-u.left-u.right,S=_(h-u[g],b),C=_(m-u[y],x),w=!t.middlewareData.shift,O=S,k=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(k=x),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(O=b),w&&!f){let e=v(u.left,0),t=v(u.right,0),n=v(u.top,0),r=v(u.bottom,0);p?k=m-2*(e!==0||t!==0?e+t:v(u.left,u.right)):O=h-2*(n!==0||r!==0?n+r:v(u.top,u.bottom))}await c({...t,availableWidth:k,availableHeight:O});let A=await o.getDimensions(s.floating);return m!==A.width||h!==A.height?{reset:{rects:!0}}:{}}}};function _e(){return typeof window<`u`}function U(e){return ve(e)?(e.nodeName||``).toLowerCase():`#document`}function W(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function G(e){return((ve(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ve(e){return _e()?e instanceof Node||e instanceof W(e).Node:!1}function K(e){return _e()?e instanceof Element||e instanceof W(e).Element:!1}function q(e){return _e()?e instanceof HTMLElement||e instanceof W(e).HTMLElement:!1}function ye(e){return!_e()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof W(e).ShadowRoot}var be=new Set([`inline`,`contents`]);function J(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=X(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!be.has(i)}var xe=new Set([`table`,`td`,`th`]);function Se(e){return xe.has(U(e))}var Ce=[`:popover-open`,`:modal`];function we(e){return Ce.some(t=>{try{return e.matches(t)}catch{return!1}})}var Te=[`transform`,`translate`,`scale`,`rotate`,`perspective`],Ee=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],De=[`paint`,`layout`,`strict`,`content`];function Oe(e){let t=Ae(),n=K(e)?X(e):e;return Te.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)||Ee.some(e=>(n.willChange||``).includes(e))||De.some(e=>(n.contain||``).includes(e))}function ke(e){let t=Z(e);for(;q(t)&&!Y(t);){if(Oe(t))return t;if(we(t))return null;t=Z(t)}return null}function Ae(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}var je=new Set([`html`,`body`,`#document`]);function Y(e){return je.has(U(e))}function X(e){return W(e).getComputedStyle(e)}function Me(e){return K(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Z(e){if(U(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ye(e)&&e.host||G(e);return ye(t)?t.host:t}function Ne(e){let t=Z(e);return Y(t)?e.ownerDocument?e.ownerDocument.body:e.body:q(t)&&J(t)?t:Ne(t)}function Pe(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ne(e),i=r===e.ownerDocument?.body,a=W(r);if(i){let e=Fe(a);return t.concat(a,a.visualViewport||[],J(r)?r:[],e&&n?Pe(e):[])}return t.concat(r,Pe(r,[],n))}function Fe(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ie(e){let t=X(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=q(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=y(n)!==a||y(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Le(e){return K(e)?e:e.contextElement}function Q(e){let t=Le(e);if(!q(t))return x(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Ie(t),o=(a?y(n.width):n.width)/r,s=(a?y(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Re=x(0);function ze(e){let t=W(e);return!Ae()||!t.visualViewport?Re:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Be(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==W(e)?!1:t}function $(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Le(e),o=x(1);t&&(r?K(r)&&(o=Q(r)):o=Q(e));let s=Be(a,n,r)?ze(a):x(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=W(a),t=r&&K(r)?W(r):r,n=e,i=Fe(n);for(;i&&r&&t!==n;){let e=Q(i),t=i.getBoundingClientRect(),r=X(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=W(i),i=Fe(n)}}return ne({width:u,height:d,x:c,y:l})}function Ve(e,t){let n=Me(e).scrollLeft;return t?t.left+n:$(G(e)).left+n}function He(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Ve(e,n),y:n.top+t.scrollTop}}function Ue(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=G(r),s=t?we(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=x(1),u=x(0),d=q(r);if((d||!d&&!a)&&((U(r)!==`body`||J(o))&&(c=Me(r)),q(r))){let e=$(r);l=Q(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?He(o,c):x(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 We(e){return Array.from(e.getClientRects())}function Ge(e){let t=G(e),n=Me(e),r=e.ownerDocument.body,i=v(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=v(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Ve(e),s=-n.scrollTop;return X(r).direction===`rtl`&&(o+=v(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Ke=25;function qe(e,t){let n=W(e),r=G(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Ae();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Ve(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<=Ke&&(a-=o)}else l<=Ke&&(a+=l);return{width:a,height:o,x:s,y:c}}var Je=new Set([`absolute`,`fixed`]);function Ye(e,t){let n=$(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=q(e)?Q(e):x(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Xe(e,t,n){let r;if(t===`viewport`)r=qe(e,n);else if(t===`document`)r=Ge(G(e));else if(K(t))r=Ye(t,n);else{let n=ze(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ne(r)}function Ze(e,t){let n=Z(e);return n===t||!K(n)||Y(n)?!1:X(n).position===`fixed`||Ze(n,t)}function Qe(e,t){let n=t.get(e);if(n)return n;let r=Pe(e,[],!1).filter(e=>K(e)&&U(e)!==`body`),i=null,a=X(e).position===`fixed`,o=a?Z(e):e;for(;K(o)&&!Y(o);){let t=X(o),n=Oe(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&Je.has(i.position)||J(o)&&!n&&Ze(e,o))?r=r.filter(e=>e!==o):i=t,o=Z(o)}return t.set(e,r),r}function $e(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?we(t)?[]:Qe(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=Xe(t,n,i);return e.top=v(r.top,e.top),e.right=_(r.right,e.right),e.bottom=_(r.bottom,e.bottom),e.left=v(r.left,e.left),e},Xe(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function et(e){let{width:t,height:n}=Ie(e);return{width:t,height:n}}function tt(e,t,n){let r=q(t),i=G(t),a=n===`fixed`,o=$(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=x(0);function l(){c.x=Ve(i)}if(r||!r&&!a)if((U(t)!==`body`||J(i))&&(s=Me(t)),r){let e=$(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?He(i,s):x(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 nt(e){return X(e).position===`static`}function rt(e,t){if(!q(e)||X(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return G(e)===n&&(n=n.ownerDocument.body),n}function it(e,t){let n=W(e);if(we(e))return n;if(!q(e)){let t=Z(e);for(;t&&!Y(t);){if(K(t)&&!nt(t))return t;t=Z(t)}return n}let r=rt(e,t);for(;r&&Se(r)&&nt(r);)r=rt(r,t);return r&&Y(r)&&nt(r)&&!Oe(r)?n:r||ke(e)||n}var at=async function(e){let t=this.getOffsetParent||it,n=this.getDimensions,r=await n(e.floating);return{reference:tt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ot(e){return X(e).direction===`rtl`}var st={convertOffsetParentRelativeRectToViewportRelativeRect:Ue,getDocumentElement:G,getClippingRect:$e,getOffsetParent:it,getElementRects:at,getClientRects:We,getDimensions:et,getScale:Q,isElement:K,isRTL:ot};function ct(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function lt(e,t){let n=null,r,i=G(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=b(d),h=b(i.clientWidth-(u+f)),g=b(i.clientHeight-(d+p)),y=b(u),x={rootMargin:-m+`px `+-h+`px `+-g+`px `+-y+`px`,threshold:v(0,_(1,c))||1},S=!0;function C(t){let n=t[0].intersectionRatio;if(n!==c){if(!S)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!ct(l,e.getBoundingClientRect())&&o(),S=!1}try{n=new IntersectionObserver(C,{...x,root:i.ownerDocument})}catch{n=new IntersectionObserver(C,x)}n.observe(e)}return o(!0),a}function ut(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=Le(e),u=i||a?[...l?Pe(l):[],...Pe(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?lt(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?$(e):null;c&&g();function g(){let t=$(e);h&&!ct(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 dt=pe,ft=me,pt=se,mt=ge,ht=ue,gt=oe,_t=he,vt=(e,t,n)=>{let r=new Map,i={platform:st,...n},a={...i.platform,_c:r};return ae(e,t,{...i,platform:a})},yt=r(a(),1),bt=typeof document<`u`?u.useLayoutEffect:function(){};function xt(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(!xt(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)&&!xt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function St(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ct(e,t){let n=St(e);return Math.round(t*n)/n}function wt(e){let t=u.useRef(e);return bt(()=>{t.current=e}),t}function Tt(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,[d,f]=u.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=u.useState(r);xt(p,r)||m(r);let[h,g]=u.useState(null),[_,v]=u.useState(null),y=u.useCallback(e=>{e!==C.current&&(C.current=e,g(e))},[]),b=u.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||h,S=o||_,C=u.useRef(null),w=u.useRef(null),T=u.useRef(d),E=c!=null,D=wt(c),O=wt(i),k=wt(l),A=u.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:p};O.current&&(e.platform=O.current),vt(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!xt(T.current,t)&&(T.current=t,yt.flushSync(()=>{f(t)}))})},[p,t,n,O,k]);bt(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[l]);let j=u.useRef(!1);bt(()=>(j.current=!0,()=>{j.current=!1}),[]),bt(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=u.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),N=u.useMemo(()=>({reference:x,floating:S}),[x,S]),P=u.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=Ct(N.floating,d.x),r=Ct(N.floating,d.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...St(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,d.x,d.y]);return u.useMemo(()=>({...d,update:A,refs:M,elements:N,floatingStyles:P}),[d,A,M,N,P])}var Et=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?{}:gt({element:r.current,padding:i}).fn(n):r?gt({element:r,padding:i}).fn(n):{}}}},Dt=(e,t)=>({...dt(e),options:[e,t]}),Ot=(e,t)=>({...ft(e),options:[e,t]}),kt=(e,t)=>({..._t(e),options:[e,t]}),At=(e,t)=>({...pt(e),options:[e,t]}),jt=(e,t)=>({...mt(e),options:[e,t]}),Mt=(e,t)=>({...ht(e),options:[e,t]}),Nt=(e,t)=>({...Et(e),options:[e,t]}),Pt=`Arrow`,Ft=u.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,d.jsx)(s.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`})})});Ft.displayName=Pt;var It=Ft,Lt=`Popper`,[Rt,zt]=i(Lt),[Bt,Vt]=Rt(Lt),Ht=e=>{let{__scopePopper:t,children:n}=e,[r,i]=u.useState(null);return(0,d.jsx)(Bt,{scope:t,anchor:r,onAnchorChange:i,children:n})};Ht.displayName=Lt;var Ut=`PopperAnchor`,Wt=u.forwardRef((e,t)=>{let{__scopePopper:r,virtualRef:i,...a}=e,o=Vt(Ut,r),c=u.useRef(null),l=n(t,c),f=u.useRef(null);return u.useEffect(()=>{let e=f.current;f.current=i?.current||c.current,e!==f.current&&o.onAnchorChange(f.current)}),i?null:(0,d.jsx)(s.div,{...a,ref:l})});Wt.displayName=Ut;var Gt=`PopperContent`,[Kt,qt]=Rt(Gt),Jt=u.forwardRef((e,t)=>{let{__scopePopper:r,side:i=`bottom`,sideOffset:a=0,align:f=`center`,alignOffset:p=0,arrowPadding:m=0,avoidCollisions:h=!0,collisionBoundary:g=[],collisionPadding:_=0,sticky:v=`partial`,hideWhenDetached:y=!1,updatePositionStrategy:b=`optimized`,onPlaced:x,...S}=e,C=Vt(Gt,r),[w,T]=u.useState(null),E=n(t,e=>T(e)),[D,O]=u.useState(null),k=l(D),A=k?.width??0,j=k?.height??0,M=i+(f===`center`?``:`-`+f),N=typeof _==`number`?_:{top:0,right:0,bottom:0,left:0,..._},P=Array.isArray(g)?g:[g],F=P.length>0,I={padding:N,boundary:P.filter(Qt),altBoundary:F},{refs:L,floatingStyles:R,placement:z,isPositioned:B,middlewareData:V}=Tt({strategy:`fixed`,placement:M,whileElementsMounted:(...e)=>ut(...e,{animationFrame:b===`always`}),elements:{reference:C.anchor},middleware:[Dt({mainAxis:a+j,alignmentAxis:p}),h&&Ot({mainAxis:!0,crossAxis:!1,limiter:v===`partial`?kt():void 0,...I}),h&&At({...I}),jt({...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`)}}),D&&Nt({element:D,padding:m}),$t({arrowWidth:A,arrowHeight:j}),y&&Mt({strategy:`referenceHidden`,...I})]}),[H,ee]=en(z),te=c(x);o(()=>{B&&te?.()},[B,te]);let ne=V.arrow?.x,re=V.arrow?.y,ie=V.arrow?.centerOffset!==0,[ae,oe]=u.useState();return o(()=>{w&&oe(window.getComputedStyle(w).zIndex)},[w]),(0,d.jsx)(`div`,{ref:L.setFloating,"data-radix-popper-content-wrapper":``,style:{...R,transform:B?R.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ae,"--radix-popper-transform-origin":[V.transformOrigin?.x,V.transformOrigin?.y].join(` `),...V.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,d.jsx)(Kt,{scope:r,placedSide:H,onArrowChange:O,arrowX:ne,arrowY:re,shouldHideArrow:ie,children:(0,d.jsx)(s.div,{"data-side":H,"data-align":ee,...S,ref:E,style:{...S.style,animation:B?void 0:`none`}})})})});Jt.displayName=Gt;var Yt=`PopperArrow`,Xt={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Zt=u.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=qt(Yt,n),a=Xt[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)(It,{...r,ref:t,style:{...r.style,display:`block`}})})});Zt.displayName=Yt;function Qt(e){return e!==null}var $t=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]=en(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 en(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var tn=Ht,nn=Wt,rn=Jt,an=Zt;export{zt as a,tn as i,an as n,h as o,rn as r,f as s,nn as t};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{c as e,d as t,o as n,p as r,r as i,u as a}from"./button-BFNlGZ5p.js";import{a as o,i as s,o as c,r as l,t as u}from"./dist-CFZ4xMSF.js";import{t as d}from"./dist-CRmX_NvH.js";import{n as f}from"./dist-C-E2R2jk.js";import{n as p,t as m}from"./dist-BNcjMpca.js";import{i as h,n as g,r as _,t as v}from"./es2015-CRmLuA2o.js";var y=a(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),b=r(t(),1),x=e(),S=`Dialog`,[C,ee]=o(S),[w,T]=C(S),E=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=b.useRef(null),c=b.useRef(null),[l,d]=u({prop:r,defaultProp:i??!1,onChange:a,caller:S});return(0,x.jsx)(w,{scope:t,triggerRef:s,contentRef:c,contentId:f(),titleId:f(),descriptionId:f(),open:l,onOpenChange:d,onOpenToggle:b.useCallback(()=>d(e=>!e),[d]),modal:o,children:n})};E.displayName=S;var D=`DialogTrigger`,O=b.forwardRef((e,t)=>{let{__scopeDialog:r,...i}=e,a=T(D,r),o=n(t,a.triggerRef);return(0,x.jsx)(c.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.contentId,"data-state":J(a.open),...i,ref:o,onClick:l(e.onClick,a.onOpenToggle)})});O.displayName=D;var k=`DialogPortal`,[A,j]=C(k,{forceMount:void 0}),M=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=T(k,t);return(0,x.jsx)(A,{scope:t,forceMount:n,children:b.Children.map(r,e=>(0,x.jsx)(d,{present:n||a.open,children:(0,x.jsx)(m,{asChild:!0,container:i,children:e})}))})};M.displayName=k;var N=`DialogOverlay`,P=b.forwardRef((e,t)=>{let n=j(N,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=T(N,e.__scopeDialog);return a.modal?(0,x.jsx)(d,{present:r||a.open,children:(0,x.jsx)(I,{...i,ref:t})}):null});P.displayName=N;var F=i(`DialogOverlay.RemoveScroll`),I=b.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=T(N,n);return(0,x.jsx)(g,{as:F,allowPinchZoom:!0,shards:[i.contentRef],children:(0,x.jsx)(c.div,{"data-state":J(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),L=`DialogContent`,R=b.forwardRef((e,t)=>{let n=j(L,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=T(L,e.__scopeDialog);return(0,x.jsx)(d,{present:r||a.open,children:a.modal?(0,x.jsx)(z,{...i,ref:t}):(0,x.jsx)(B,{...i,ref:t})})});R.displayName=L;var z=b.forwardRef((e,t)=>{let r=T(L,e.__scopeDialog),i=b.useRef(null),a=n(t,r.contentRef,i);return b.useEffect(()=>{let e=i.current;if(e)return v(e)},[]),(0,x.jsx)(V,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:l(e.onCloseAutoFocus,e=>{e.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:l(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:l(e.onFocusOutside,e=>e.preventDefault())})}),B=b.forwardRef((e,t)=>{let n=T(L,e.__scopeDialog),r=b.useRef(!1),i=b.useRef(!1);return(0,x.jsx)(V,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),V=b.forwardRef((e,t)=>{let{__scopeDialog:r,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,...s}=e,c=T(L,r),l=b.useRef(null),u=n(t,l);return _(),(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(h,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:a,onUnmountAutoFocus:o,children:(0,x.jsx)(p,{role:`dialog`,id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":J(c.open),...s,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(Z,{titleId:c.titleId}),(0,x.jsx)($,{contentRef:l,descriptionId:c.descriptionId})]})]})}),H=`DialogTitle`,U=b.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=T(H,n);return(0,x.jsx)(c.h2,{id:i.titleId,...r,ref:t})});U.displayName=H;var W=`DialogDescription`,G=b.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=T(W,n);return(0,x.jsx)(c.p,{id:i.descriptionId,...r,ref:t})});G.displayName=W;var K=`DialogClose`,q=b.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=T(K,n);return(0,x.jsx)(c.button,{type:`button`,...r,ref:t,onClick:l(e.onClick,()=>i.onOpenChange(!1))})});q.displayName=K;function J(e){return e?`open`:`closed`}var Y=`DialogTitleWarning`,[te,X]=s(Y,{contentName:L,titleName:H,docsSlug:`dialog`}),Z=({titleId:e})=>{let t=X(Y),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
2
|
-
|
|
3
|
-
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
4
|
-
|
|
5
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return b.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Q=`DialogDescriptionWarning`,$=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${X(Q).contentName}}.`;return b.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},ne=E,re=M,ie=P,ae=R,oe=U,se=G,ce=q;export{re as a,y as c,ie as i,ae as n,ne as o,se as r,oe as s,ce as t};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import{c as e,d as t,o as n,p as r}from"./button-BFNlGZ5p.js";import{o as i}from"./dist-CFZ4xMSF.js";import{t as a}from"./dist-C-E2R2jk.js";var o=r(t(),1),s=e(),c=`focusScope.autoFocusOnMount`,l=`focusScope.autoFocusOnUnmount`,u={bubbles:!1,cancelable:!0},d=`FocusScope`,f=o.forwardRef((e,t)=>{let{loop:r=!1,trapped:d=!1,onMountAutoFocus:f,onUnmountAutoFocus:g,..._}=e,[v,x]=o.useState(null),S=a(f),w=a(g),T=o.useRef(null),E=n(t,e=>x(e)),D=o.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;o.useEffect(()=>{if(d){let e=function(e){if(D.paused||!v)return;let t=e.target;v.contains(t)?T.current=t:y(T.current,{select:!0})},t=function(e){if(D.paused||!v)return;let t=e.relatedTarget;t!==null&&(v.contains(t)||y(T.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&y(v)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return v&&r.observe(v,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[d,v,D.paused]),o.useEffect(()=>{if(v){b.add(D);let e=document.activeElement;if(!v.contains(e)){let t=new CustomEvent(c,u);v.addEventListener(c,S),v.dispatchEvent(t),t.defaultPrevented||(p(C(h(v)),{select:!0}),document.activeElement===e&&y(v))}return()=>{v.removeEventListener(c,S),setTimeout(()=>{let t=new CustomEvent(l,u);v.addEventListener(l,w),v.dispatchEvent(t),t.defaultPrevented||y(e??document.body,{select:!0}),v.removeEventListener(l,w),b.remove(D)},0)}}},[v,S,w,D]);let O=o.useCallback(e=>{if(!r&&!d||D.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,n=document.activeElement;if(t&&n){let t=e.currentTarget,[i,a]=m(t);i&&a?!e.shiftKey&&n===a?(e.preventDefault(),r&&y(i,{select:!0})):e.shiftKey&&n===i&&(e.preventDefault(),r&&y(a,{select:!0})):n===t&&e.preventDefault()}},[r,d,D.paused]);return(0,s.jsx)(i.div,{tabIndex:-1,..._,ref:E,onKeyDown:O})});f.displayName=d;function p(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(y(r,{select:t}),document.activeElement!==n)return}function m(e){let t=h(e);return[g(t,e),g(t.reverse(),e)]}function h(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function g(e,t){for(let n of e)if(!_(n,{upTo:t}))return n}function _(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function v(e){return e instanceof HTMLInputElement&&`select`in e}function y(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&v(e)&&t&&e.select()}}var b=x();function x(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=S(e,t),e.unshift(t)},remove(t){e=S(e,t),e[0]?.resume()}}}function S(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function C(e){return e.filter(e=>e.tagName!==`A`)}var w=0;function T(){o.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??E()),document.body.insertAdjacentElement(`beforeend`,e[1]??E()),w++,()=>{w===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),w--}},[])}function E(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var D=function(){return D=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},D.apply(this,arguments)};function O(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function ee(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var k=`right-scroll-bar-position`,A=`width-before-scroll-bar`,te=`with-scroll-bars-hidden`,ne=`--removed-body-scroll-bar-size`;function j(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function re(e,t){var n=(0,o.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var ie=typeof window<`u`?o.useLayoutEffect:o.useEffect,M=new WeakMap;function ae(e,t){var n=re(t||null,function(t){return e.forEach(function(e){return j(e,t)})});return ie(function(){var t=M.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||j(e,null)}),i.forEach(function(e){r.has(e)||j(e,a)})}M.set(n,e)},[e]),n}function oe(e){return e}function se(e,t){t===void 0&&(t=oe);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function ce(e){e===void 0&&(e={});var t=se(null);return t.options=D({async:!0,ssr:!1},e),t}var N=function(e){var t=e.sideCar,n=O(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return o.createElement(r,D({},n))};N.isSideCarExport=!0;function le(e,t){return e.useMedium(t),N}var P=ce(),F=function(){},I=o.forwardRef(function(e,t){var n=o.useRef(null),r=o.useState({onScrollCapture:F,onWheelCapture:F,onTouchMoveCapture:F}),i=r[0],a=r[1],s=e.forwardProps,c=e.children,l=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,_=e.allowPinchZoom,v=e.as,y=v===void 0?`div`:v,b=e.gapMode,x=O(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=p,C=ae([n,t]),w=D(D({},x),i);return o.createElement(o.Fragment,null,d&&o.createElement(S,{sideCar:P,removeScrollBar:u,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:a,allowPinchZoom:!!_,lockRef:n,gapMode:b}),s?o.cloneElement(o.Children.only(c),D(D({},w),{ref:C})):o.createElement(y,D({},w,{className:l,ref:C}),c))});I.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},I.classNames={fullWidth:A,zeroRight:k};var L,ue=function(){if(L)return L;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function de(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=ue();return t&&e.setAttribute(`nonce`,t),e}function fe(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function pe(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var me=function(){var e=0,t=null;return{add:function(n){e==0&&(t=de())&&(fe(t,n),pe(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},he=function(){var e=me();return function(t,n){o.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},R=function(){var e=he();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},ge={left:0,top:0,right:0,gap:0},z=function(e){return parseInt(e||``,10)||0},_e=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[z(n),z(r),z(i)]},ve=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return ge;var t=_e(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},ye=R(),B=`data-scroll-locked`,be=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
2
|
-
.${te} {
|
|
3
|
-
overflow: hidden ${r};
|
|
4
|
-
padding-right: ${s}px ${r};
|
|
5
|
-
}
|
|
6
|
-
body[${B}] {
|
|
7
|
-
overflow: hidden ${r};
|
|
8
|
-
overscroll-behavior: contain;
|
|
9
|
-
${[t&&`position: relative ${r};`,n===`margin`&&`
|
|
10
|
-
padding-left: ${i}px;
|
|
11
|
-
padding-top: ${a}px;
|
|
12
|
-
padding-right: ${o}px;
|
|
13
|
-
margin-left:0;
|
|
14
|
-
margin-top:0;
|
|
15
|
-
margin-right: ${s}px ${r};
|
|
16
|
-
`,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.${k} {
|
|
20
|
-
right: ${s}px ${r};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.${A} {
|
|
24
|
-
margin-right: ${s}px ${r};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.${k} .${k} {
|
|
28
|
-
right: 0 ${r};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.${A} .${A} {
|
|
32
|
-
margin-right: 0 ${r};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
body[${B}] {
|
|
36
|
-
${ne}: ${s}px;
|
|
37
|
-
}
|
|
38
|
-
`},V=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},xe=function(){o.useEffect(function(){return document.body.setAttribute(B,(V()+1).toString()),function(){var e=V()-1;e<=0?document.body.removeAttribute(B):document.body.setAttribute(B,e.toString())}},[])},Se=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;xe();var a=o.useMemo(function(){return ve(i)},[i]);return o.createElement(ye,{styles:be(a,!t,i,n?``:`!important`)})},H=!1;if(typeof window<`u`)try{var U=Object.defineProperty({},`passive`,{get:function(){return H=!0,!0}});window.addEventListener(`test`,U,U),window.removeEventListener(`test`,U,U)}catch{H=!1}var W=H?{passive:!1}:!1,Ce=function(e){return e.tagName===`TEXTAREA`},G=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Ce(e)&&n[t]===`visible`)},we=function(e){return G(e,`overflowY`)},Te=function(e){return G(e,`overflowX`)},K=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),q(e,r)){var i=Oe(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Ee=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},De=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},q=function(e,t){return e===`v`?we(t):Te(t)},Oe=function(e,t){return e===`v`?Ee(t):De(t)},ke=function(e,t){return e===`h`&&t===`rtl`?-1:1},Ae=function(e,t,n,r,i){var a=ke(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Oe(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&q(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},J=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},je=function(e){return[e.deltaX,e.deltaY]},Me=function(e){return e&&`current`in e?e.current:e},Ne=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Pe=function(e){return`
|
|
39
|
-
.block-interactivity-${e} {pointer-events: none;}
|
|
40
|
-
.allow-interactivity-${e} {pointer-events: all;}
|
|
41
|
-
`},Fe=0,Y=[];function Ie(e){var t=o.useRef([]),n=o.useRef([0,0]),r=o.useRef(),i=o.useState(Fe++)[0],a=o.useState(R)[0],s=o.useRef(e);o.useEffect(function(){s.current=e},[e]),o.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=ee([e.lockRef.current],(e.shards||[]).map(Me),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var c=o.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!s.current.allowPinchZoom;var i=J(e),a=n.current,o=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(o)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=K(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=K(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(o||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Ae(h,t,e,h===`h`?o:c,!0)},[]),l=o.useCallback(function(e){var n=e;if(!(!Y.length||Y[Y.length-1]!==a)){var r=`deltaY`in n?je(n):J(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Ne(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var o=(s.current.shards||[]).map(Me).filter(Boolean).filter(function(e){return e.contains(n.target)});(o.length>0?c(n,o[0]):!s.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),u=o.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Le(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),d=o.useCallback(function(e){n.current=J(e),r.current=void 0},[]),f=o.useCallback(function(t){u(t.type,je(t),t.target,c(t,e.lockRef.current))},[]),p=o.useCallback(function(t){u(t.type,J(t),t.target,c(t,e.lockRef.current))},[]);o.useEffect(function(){return Y.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener(`wheel`,l,W),document.addEventListener(`touchmove`,l,W),document.addEventListener(`touchstart`,d,W),function(){Y=Y.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,l,W),document.removeEventListener(`touchmove`,l,W),document.removeEventListener(`touchstart`,d,W)}},[]);var m=e.removeScrollBar,h=e.inert;return o.createElement(o.Fragment,null,h?o.createElement(a,{styles:Pe(i)}):null,m?o.createElement(Se,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Le(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Re=le(P,Ie),ze=o.forwardRef(function(e,t){return o.createElement(I,D({},e,{ref:t,sideCar:Re}))});ze.classNames=I.classNames;var Be=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},X=new WeakMap,Z=new WeakMap,Q={},$=0,Ve=function(e){return e&&(e.host||Ve(e.parentNode))},He=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Ve(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Ue=function(e,t,n,r){var i=He(t,Array.isArray(e)?e:[e]);Q[n]||(Q[n]=new WeakMap);var a=Q[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(X.get(e)||0)+1,l=(a.get(e)||0)+1;X.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Z.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),$++,function(){o.forEach(function(e){var t=X.get(e)-1,i=a.get(e)-1;X.set(e,t),a.set(e,i),t||(Z.has(e)||e.removeAttribute(r),Z.delete(e)),i||e.removeAttribute(n)}),$--,$||(X=new WeakMap,X=new WeakMap,Z=new WeakMap,Q={})}},We=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Be(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Ue(r,i,n,`aria-hidden`)):function(){return null}};export{f as i,ze as n,T as r,We as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,d as t,l as n,p as r,t as i,u as a}from"./button-BFNlGZ5p.js";import"./dist-CFZ4xMSF.js";import{t as o}from"./circle-x-BEkinhez.js";import{n as s,t as c}from"./server-eYXq3PbE.js";import{t as l}from"./refresh-cw-BfLoHqg5.js";import{t as ee}from"./shield-check-hQXjdfZ7.js";import{t as u}from"./wifi-QkTcTrED.js";import{t as d}from"./switch-DpLnRvOJ.js";import{At as te,G as f,It as p,J as m,K as h,U as g,at as _,ct as v,dt as y,ft as b,ht as ne,lt as x,ot as S,q as C,rt as w,st as re,ut as T}from"./index-CkoYwomI.js";import{n as E,r as D,t as O}from"./alert-BmsRCcSL.js";import{a as k,i as A,n as j,o as M,r as N,t as P}from"./table-C3mgEjkP.js";var F=a(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),I=a(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),L=a(`hard-drive`,[[`line`,{x1:`22`,x2:`2`,y1:`12`,y2:`12`,key:`1y58io`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}],[`line`,{x1:`6`,x2:`6.01`,y1:`16`,y2:`16`,key:`sgf278`}],[`line`,{x1:`10`,x2:`10.01`,y1:`16`,y2:`16`,key:`1l4acy`}]]),R=a(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),z=r(t(),1),B=e(),V={ok:`正常`,degraded:`降级`,critical:`严重`},ie={cpu:`CPU`,rss:`RSS 内存`,connections:`连接数`,mitmServers:`MITM 服务`,eventLoopDelay:`事件循环延迟`,fds:`文件描述符`};function H(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.generatedAt==`number`&&typeof t.status==`string`&&typeof t.pid==`number`&&typeof t.uptimeSec==`number`&&!!t.memory&&!!t.cpu&&!!t.connections&&!!t.mitmServers&&Array.isArray(t.checks)}async function U(){let e=await fetch(`/api/health`,{cache:`no-store`});if(!e.ok)throw Error(`健康接口返回 ${e.status}`);let t=await e.json();if(!H(t))throw Error(`健康接口返回格式不正确`);return t}function W(e){if(!Number.isFinite(e))return`-`;if(e<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`,`TB`],n=e/1024,r=t[0];for(let e=1;e<t.length&&n>=1024;e+=1)n/=1024,r=t[e];return`${n>=10?n.toFixed(0):n.toFixed(1)} ${r}`}function G(e){if(!Number.isFinite(e)||e<0)return`-`;let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60),i=Math.floor(e%60);return t>0?`${t}天 ${n}小时`:n>0?`${n}小时 ${r}分钟`:r>0?`${r}分钟 ${i}秒`:`${i}秒`}function K(e){return e?new Intl.DateTimeFormat(`zh-CN`,{month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}).format(new Date(e)):`-`}function q(e,t){return t===`bytes`?W(e):t===`%`?`${e.toFixed(1)}%`:t===`ms`?`${e.toFixed(1)} ms`:String(e)}function J(e,t){return t===`bytes`?W(e):t===`%`?`${e}%`:t===`ms`?`${e} ms`:String(e)}function ae(e){if(!e||typeof e!=`object`)return null;let t=e;return Array.isArray(t.keys)?{windowMs:Number(t.windowMs)||0,maxPerWindow:Number(t.maxPerWindow)||0,keys:t.keys,suppressedTotal:Number(t.suppressedTotal)||0}:null}function Y({status:e}){return(0,B.jsxs)(w,{variant:e===`critical`?`destructive`:e===`degraded`?`secondary`:`default`,children:[e===`ok`?(0,B.jsx)(p,{}):e===`degraded`?(0,B.jsx)(b,{}):(0,B.jsx)(o,{}),V[e]]})}function oe({icon:e,label:t,value:n,detail:r}){return(0,B.jsxs)(S,{className:`gap-0 py-0 shadow-none`,children:[(0,B.jsx)(T,{className:`border-b px-[var(--ui-section-gap)] py-[var(--ui-section-gap)] [.border-b]:pb-[var(--ui-section-gap)]`,children:(0,B.jsxs)(y,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,B.jsx)(e,{}),t]})}),(0,B.jsxs)(v,{className:`flex flex-col gap-1 p-[var(--ui-page-padding)]`,children:[(0,B.jsx)(`div`,{className:`text-2xl font-semibold tracking-tight`,children:n}),(0,B.jsx)(`div`,{className:`min-h-4 truncate text-xs text-muted-foreground`,title:r,children:r})]})]})}function X({label:e,value:t}){return(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 rounded-lg border bg-background p-[var(--ui-section-gap)]`,children:[(0,B.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e}),(0,B.jsx)(`span`,{className:`truncate text-sm font-medium`,title:t,children:t})]})}function se(){return(0,B.jsxs)(`div`,{className:`app-workspace-content`,"aria-label":`正在读取健康状态`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(_,{className:`h-7 w-40`}),(0,B.jsx)(_,{className:`h-4 w-64`})]}),(0,B.jsx)(_,{className:`h-8 w-28`})]}),(0,B.jsx)(`div`,{className:`grid gap-[var(--ui-section-gap)] md:grid-cols-2 xl:grid-cols-6`,children:Array.from({length:6}).map((e,t)=>(0,B.jsx)(_,{className:`h-32 w-full`},t))}),(0,B.jsx)(_,{className:`h-80 w-full`})]})}function Z(){let[e,t]=(0,z.useState)(null),[r,a]=(0,z.useState)(!0),[o,p]=(0,z.useState)(!1),[_,V]=(0,z.useState)(``),[H,Z]=(0,z.useState)(!0),Q=(0,z.useCallback)(async(e=!1)=>{e?p(!0):a(!0),V(``);try{t(await U())}catch(e){V(e instanceof Error?e.message:`无法读取健康状态`)}finally{a(!1),p(!1)}},[]);(0,z.useEffect)(()=>{Q()},[Q]),(0,z.useEffect)(()=>{if(!H)return;let e=window.setInterval(()=>{Q(!0)},5e3);return()=>window.clearInterval(e)},[H,Q]);let $=(0,z.useMemo)(()=>ae(e?.logs),[e]);if(r&&!e)return(0,B.jsx)(se,{});if(!e)return(0,B.jsxs)(`div`,{className:`app-workspace-content`,children:[(0,B.jsxs)(O,{variant:`destructive`,children:[(0,B.jsx)(D,{children:`加载失败`}),(0,B.jsx)(E,{children:_||`无法读取健康状态`})]}),(0,B.jsxs)(i,{variant:`outline`,size:`sm`,onClick:()=>void Q(),children:[(0,B.jsx)(l,{"data-icon":`inline-start`}),`重新检测`]})]});let ce=[{icon:F,label:`CPU`,value:`${e.cpu.percent.toFixed(1)}%`,detail:`${e.cpu.cores} 核 · load ${e.cpu.loadAverage.map(e=>e.toFixed(2)).join(` / `)}`},{icon:L,label:`RSS 内存`,value:W(e.memory.rss),detail:`Heap ${W(e.memory.heapUsed)} / ${W(e.memory.heapTotal)}`},{icon:R,label:`TCP 连接`,value:String(e.connections.total),detail:`代理 ${e.connections.proxySockets} · TLS ${e.connections.mitmTlsSockets} · WS ${e.connections.webSockets}`},{icon:c,label:`MITM 服务`,value:String(e.mitmServers.count),detail:`${e.mitmServers.activeSockets} 个活跃 socket`},{icon:ne,label:`文件描述符`,value:e.process.fdCount==null?`-`:String(e.process.fdCount),detail:`handles ${e.process.activeHandles??`-`} · requests ${e.process.activeRequests??`-`}`},{icon:I,label:`事件循环`,value:`${e.eventLoop.maxMs.toFixed(1)} ms`,detail:`mean ${e.eventLoop.meanMs.toFixed(1)} ms`}];return(0,B.jsxs)(`div`,{className:`meddle-thin-scroll app-workspace-content overflow-y-auto`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight`,children:`运行健康`}),(0,B.jsx)(Y,{status:e.status})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-3 text-xs text-muted-foreground`,children:[(0,B.jsxs)(`span`,{children:[`PID `,e.pid]}),(0,B.jsxs)(`span`,{children:[`运行 `,G(e.uptimeSec)]}),(0,B.jsx)(`span`,{children:e.platform}),(0,B.jsxs)(`span`,{children:[`更新 `,K(e.generatedAt)]})]})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex h-8 items-center gap-2 rounded-md border bg-background px-3 text-sm`,children:[(0,B.jsx)(d,{checked:H,onCheckedChange:Z,"aria-label":`自动刷新健康信息`}),(0,B.jsx)(`span`,{children:`自动刷新`})]}),(0,B.jsxs)(i,{variant:`outline`,size:`sm`,onClick:()=>void Q(!0),disabled:o,children:[(0,B.jsx)(l,{"data-icon":`inline-start`,className:n(o&&`animate-spin`)}),`刷新`]})]})]}),_&&(0,B.jsxs)(O,{variant:`destructive`,children:[(0,B.jsx)(D,{children:`刷新失败`}),(0,B.jsx)(E,{children:_})]}),(0,B.jsx)(`div`,{className:`grid gap-[var(--ui-section-gap)] md:grid-cols-2 xl:grid-cols-6`,children:ce.map(e=>(0,B.jsx)(oe,{...e},e.label))}),(0,B.jsxs)(`div`,{className:`grid gap-[var(--ui-section-gap)] xl:grid-cols-[minmax(0,1.3fr)_minmax(360px,0.7fr)]`,children:[(0,B.jsxs)(S,{className:`gap-0 py-0 shadow-none`,children:[(0,B.jsxs)(T,{className:`border-b px-[var(--ui-section-gap)] py-[var(--ui-section-gap)] [.border-b]:pb-[var(--ui-section-gap)]`,children:[(0,B.jsxs)(y,{className:`flex items-center gap-2`,children:[(0,B.jsx)(te,{}),`健康检查`]}),(0,B.jsx)(x,{children:`阈值来自当前进程的 MEDDLE_WATCHDOG 配置。`})]}),(0,B.jsx)(v,{className:`p-0`,children:(0,B.jsxs)(P,{children:[(0,B.jsx)(k,{children:(0,B.jsxs)(M,{children:[(0,B.jsx)(A,{children:`项目`}),(0,B.jsx)(A,{children:`状态`}),(0,B.jsx)(A,{children:`当前值`}),(0,B.jsx)(A,{children:`阈值`})]})}),(0,B.jsx)(j,{children:e.checks.map(e=>(0,B.jsxs)(M,{children:[(0,B.jsx)(N,{className:`font-medium`,children:ie[e.name]||e.name}),(0,B.jsx)(N,{children:(0,B.jsx)(Y,{status:e.status})}),(0,B.jsx)(N,{children:q(e.value,e.unit)}),(0,B.jsx)(N,{className:`text-muted-foreground`,children:J(e.limit,e.unit)})]},e.name))})]})})]}),(0,B.jsxs)(S,{className:`gap-0 py-0 shadow-none`,children:[(0,B.jsxs)(T,{className:`border-b px-[var(--ui-section-gap)] py-[var(--ui-section-gap)] [.border-b]:pb-[var(--ui-section-gap)]`,children:[(0,B.jsxs)(y,{className:`flex items-center gap-2`,children:[(0,B.jsx)(ee,{}),`守护策略`]}),(0,B.jsx)(x,{children:`连续命中严重阈值后按策略处理。`}),(0,B.jsx)(re,{children:(0,B.jsx)(w,{variant:e.watchdog.config.enabled?`default`:`secondary`,children:e.watchdog.config.enabled?`已启用`:`已关闭`})})]}),(0,B.jsxs)(v,{className:`grid gap-[var(--ui-section-gap)] p-[var(--ui-page-padding)] sm:grid-cols-2`,children:[(0,B.jsx)(X,{label:`动作`,value:e.watchdog.config.action===`exit`?`退出重启`:`仅告警`}),(0,B.jsx)(X,{label:`检测间隔`,value:G(e.watchdog.config.intervalMs/1e3)}),(0,B.jsx)(X,{label:`最小运行时间`,value:G(e.watchdog.config.minUptimeMs/1e3)}),(0,B.jsx)(X,{label:`失败阈值`,value:`${e.watchdog.consecutiveFailures}/${e.watchdog.config.failureThreshold}`}),(0,B.jsx)(X,{label:`CPU 阈值`,value:`${e.watchdog.config.cpuPercent}%`}),(0,B.jsx)(X,{label:`RSS 阈值`,value:W(e.watchdog.config.rssBytes)}),(0,B.jsx)(X,{label:`连接阈值`,value:String(e.watchdog.config.connectionCount)}),(0,B.jsx)(X,{label:`FD 阈值`,value:String(e.watchdog.config.fdCount)}),e.watchdog.lastReason&&(0,B.jsx)(`div`,{className:`sm:col-span-2`,children:(0,B.jsxs)(O,{children:[(0,B.jsx)(b,{}),(0,B.jsx)(D,{children:`最近命中`}),(0,B.jsx)(E,{children:e.watchdog.lastReason})]})})]})]})]}),(0,B.jsxs)(`div`,{className:`grid gap-[var(--ui-section-gap)] xl:grid-cols-2`,children:[(0,B.jsxs)(S,{className:`gap-0 py-0 shadow-none`,children:[(0,B.jsxs)(T,{className:`border-b px-[var(--ui-section-gap)] py-[var(--ui-section-gap)] [.border-b]:pb-[var(--ui-section-gap)]`,children:[(0,B.jsxs)(y,{className:`flex items-center gap-2`,children:[(0,B.jsx)(u,{}),`MITM 服务池`]}),(0,B.jsxs)(x,{children:[e.mitmServers.count,` 个动态 HTTPS 服务。`]})]}),(0,B.jsx)(v,{className:`p-0`,children:e.mitmServers.items.length>0?(0,B.jsxs)(P,{children:[(0,B.jsx)(k,{children:(0,B.jsxs)(M,{children:[(0,B.jsx)(A,{children:`Host`}),(0,B.jsx)(A,{children:`端口`}),(0,B.jsx)(A,{children:`Socket`}),(0,B.jsx)(A,{children:`空闲`})]})}),(0,B.jsx)(j,{children:e.mitmServers.items.map(e=>(0,B.jsxs)(M,{children:[(0,B.jsx)(N,{className:`max-w-[260px] truncate font-medium`,title:e.host,children:e.host}),(0,B.jsx)(N,{children:e.port??`-`}),(0,B.jsxs)(N,{children:[e.activeSockets,` / `,e.webSockets,` WS`]}),(0,B.jsx)(N,{className:`text-muted-foreground`,children:e.idleForMs==null?`-`:G(e.idleForMs/1e3)})]},`${e.host}:${e.port??`dynamic`}`))})]}):(0,B.jsx)(g,{className:`border-0 py-10`,children:(0,B.jsxs)(h,{children:[(0,B.jsx)(C,{variant:`icon`,children:(0,B.jsx)(c,{})}),(0,B.jsx)(m,{children:`暂无动态 HTTPS 服务`}),(0,B.jsx)(f,{children:`当前没有活跃的 MITM 目标。`})]})})})]}),(0,B.jsxs)(S,{className:`gap-0 py-0 shadow-none`,children:[(0,B.jsxs)(T,{className:`border-b px-[var(--ui-section-gap)] py-[var(--ui-section-gap)] [.border-b]:pb-[var(--ui-section-gap)]`,children:[(0,B.jsxs)(y,{className:`flex items-center gap-2`,children:[(0,B.jsx)(s,{}),`日志限流`]}),(0,B.jsxs)(x,{children:[`已抑制 `,$?.suppressedTotal??0,` 条重复日志。`]})]}),(0,B.jsx)(v,{className:`p-0`,children:$&&$.keys.length>0?(0,B.jsxs)(P,{children:[(0,B.jsx)(k,{children:(0,B.jsxs)(M,{children:[(0,B.jsx)(A,{children:`Key`}),(0,B.jsx)(A,{children:`级别`}),(0,B.jsx)(A,{children:`输出 / 抑制`}),(0,B.jsx)(A,{children:`最近`})]})}),(0,B.jsx)(j,{children:$.keys.map(e=>(0,B.jsxs)(M,{children:[(0,B.jsx)(N,{className:`max-w-[260px] truncate font-medium`,title:e.key,children:e.key}),(0,B.jsx)(N,{children:(0,B.jsx)(w,{variant:e.level===`error`?`destructive`:e.level===`warn`?`secondary`:`outline`,children:e.level})}),(0,B.jsxs)(N,{children:[e.emitted,` / `,e.suppressed]}),(0,B.jsx)(N,{className:`text-muted-foreground`,children:K(e.lastSeenAt)})]},e.key))})]}):(0,B.jsx)(g,{className:`border-0 py-10`,children:(0,B.jsxs)(h,{children:[(0,B.jsx)(C,{variant:`icon`,children:(0,B.jsx)(s,{})}),(0,B.jsx)(m,{children:`暂无限流记录`}),(0,B.jsx)(f,{children:`当前没有被抑制的重复日志。`})]})})})]})]})]})}export{Z as HealthPanel};
|