dns-worker 1.2.2 → 1.2.3-alpha.d1e4d05
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/README.md +11 -11
- package/dist/serverfull.mjs +310 -190
- package/dist/serverfull.mjs.map +4 -4
- package/migrations/0068_add_isp_hourly_rollups.sql +34 -0
- package/migrations/0069_drop_redundant_logs_indexes.sql +7 -0
- package/package.json +7 -7
- package/static/assets/AccountView-By7j6VKn.js +4 -0
- package/static/assets/{AnalyticsView-DtwAFAS2.js → AnalyticsView-Ds2EpUFB.js} +2 -2
- package/static/assets/DestinationMap-BjeUzHyP.js +1 -0
- package/static/assets/{FilteringView-C3o6cUlv.js → FilteringView-N3HZ9yxp.js} +1 -1
- package/static/assets/{LogsView-CB5qSS6F.js → LogsView-Pzdc6GNB.js} +4 -4
- package/static/assets/{RulesView-Br-TGI0S.js → RulesView-DjG3md-m.js} +1 -1
- package/static/assets/{SettingsView-DfNd-8A4.js → SettingsView-DBq_rykk.js} +1 -1
- package/static/assets/{SetupView-CWmyacJn.js → SetupView-Bcn8CrGb.js} +1 -1
- package/static/assets/{SystemView-C-AbCiPA.js → SystemView-BeqDBaLw.js} +1 -1
- package/static/assets/{TrendChart-CTcw6KTh.js → TrendChart-C4EOoh2o.js} +1 -1
- package/static/assets/date-DC1RIhBv.js +1 -0
- package/static/assets/index--9RzUkcE.js +17 -0
- package/static/assets/{services-OOd28yfV.js → services-CIzUk_L5.js} +1 -1
- package/static/assets/{sqlite.worker-DfuIqYyd.js → sqlite.worker-BQk-r3bK.js} +8 -4
- package/static/assets/{useLogsE2ee-BG2dwwV0.js → useLogsE2ee-BQu5eygS.js} +1 -1
- package/static/index.html +1 -1
- package/static/sw.js +1 -1
- package/static/assets/AccountView-CKn8YPlP.js +0 -4
- package/static/assets/DestinationMap-BQ-SJwVY.js +0 -1
- package/static/assets/date-CsFxSeKu.js +0 -1
- package/static/assets/index-DAjmisEt.js +0 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-C4Xdq4VV.js";import{At as t,B as n,D as r,F as i,J as a,L as o,M as s,P as c,R as l,T as u,U as d,V as f,X as p,ct as m,ft as h,it as g,kt as _,nn as v,ot as y,q as b,st as x,w as S}from"./vendor-react-DYK5a2J9.js";import{S as C,b as w}from"./vendor-icons-other-BTYC6Wvz.js";import"./vendor-i18next-DlmslyBB.js";import{B as T,C as E,E as D,F as O,H as k,I as A,N as j,P as M,R as N,V as P,a as F,d as I,f as L,i as R,j as z,k as B,n as V,o as H,r as U,v as W,z as G}from"./vendor-ui-core-CodM8CpF.js";import{_t as K,t as ee,vt as q}from"./vendor-utils-Bab4qB3W.js";import{Ct as te,H as ne,J as re,Q as ie,St as ae,U as oe,X as J,Y as se,_ as ce,a as le,et as ue,ft as de,gn as fe,h as pe,lt as me,mt as he,n as Y,t as ge}from"./index-DAjmisEt.js";import{t as _e}from"./SwipeableDrawer-UY1QWnPj.js";var X=e(C(),1),Z=e(w(),1);const ve=()=>{let{t:e}=v();return(0,Z.jsxs)(`div`,{className:`flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(z,{className:`font-bold text-gray-900 dark:text-white m-0`,children:e(`setup.title`)}),(0,Z.jsx)(`p`,{className:`bp6-text-muted m-0 mt-1`,children:e(`setup.subtitle`)})]}),(0,Z.jsx)(`div`,{className:`flex items-center`,children:(0,Z.jsx)(ge,{})})]})},ye=({isVerifying:e,verifyResult:n,handleVerify:r,isMobile:i,clientInfo:a,showIp:o,setShowIp:l,showLocation:u,setShowLocation:d,traceInfo:f,edgeLocation:m})=>{let{t:h}=v(),{isServerfull:_}=Y(),[b,S]=(0,X.useState)(!1),C=(0,Z.jsxs)(`div`,{className:q(`bg-white dark:bg-gray-900 p-4 rounded-lg border border-gray-100 dark:border-gray-800 shadow-sm flex items-start gap-3 select-none h-full transition-all`,!_),children:[(0,Z.jsx)(c,{size:18,className:`text-purple-500 mt-1 shrink-0`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`text-[10px] uppercase font-bold opacity-40`,children:_?h(`setup.serverLocation`,`服务器位置`):h(`setup.edgeServer`)}),(0,Z.jsx)(`div`,{className:`font-bold truncate`,title:_?m||``:m||f?.colo||``,children:_?m||h(`setup.detecting`):m||f?.colo||h(`setup.detecting`)})]})]});return(0,Z.jsx)(H,{title:h(`setup.verifyConnection`),icon:(0,Z.jsx)(t,{size:16}),children:(0,Z.jsx)(F,{children:(0,Z.jsxs)(`div`,{className:`flex flex-col space-y-6`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col md:flex-row items-center justify-between bg-gray-50 dark:bg-gray-800/50 p-6 rounded-xl border border-gray-100 dark:border-gray-800 gap-6`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col md:flex-row items-center gap-4 text-center md:text-left`,children:[(0,Z.jsx)(`div`,{className:`p-3 rounded-full ${n?.success?`bg-green-100 text-green-600`:n?`bg-red-100 text-red-600`:`bg-blue-100 text-blue-600`}`,children:e?(0,Z.jsx)(O,{size:24}):n?.success?(0,Z.jsx)(s,{size:24}):(0,Z.jsx)(c,{size:24})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`font-bold text-lg`,children:e?h(`setup.verifying`):n?.success?h(`setup.connected`):h(`setup.notConnected`)}),(0,Z.jsx)(`div`,{className:`text-sm opacity-60`,children:n?.success?n.profileMatch?h(`setup.profileMatch`):h(`setup.profileMismatch`):h(`setup.verifyHint`)})]})]}),(0,Z.jsx)(M,{size:`large`,intent:n?.success?k.SUCCESS:k.PRIMARY,icon:`refresh`,text:h(`setup.refreshStatus`),onClick:r,loading:e,fill:i})]}),a&&(0,Z.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4`,children:[(0,Z.jsxs)(`div`,{className:`bg-white dark:bg-gray-900 p-4 rounded-lg border border-gray-100 dark:border-gray-800 shadow-sm flex items-start gap-3`,children:[(0,Z.jsx)(g,{size:18,className:`text-blue-500 mt-1`}),(0,Z.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsx)(`div`,{className:`text-[10px] uppercase font-bold opacity-40`,children:h(`setup.egressIp`)}),(0,Z.jsx)(`button`,{onClick:()=>l(!o),className:`text-gray-400 hover:text-blue-500 transition-colors`,children:o?(0,Z.jsx)(y,{size:16}):(0,Z.jsx)(x,{size:16})})]}),(0,Z.jsx)(`div`,{className:`font-mono font-bold text-blue-600 dark:text-blue-400 truncate`,children:(0,Z.jsx)(`span`,{className:q(`transition-[filter] duration-200 inline-block`,!o&&`filter blur-[6px] select-none`),children:a.ip})})]})]}),(0,Z.jsxs)(`div`,{className:`bg-white dark:bg-gray-900 p-4 rounded-lg border border-gray-100 dark:border-gray-800 shadow-sm flex items-start gap-3`,children:[(0,Z.jsx)(p,{size:18,className:`text-red-500 mt-1`}),(0,Z.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsx)(`div`,{className:`text-[10px] uppercase font-bold opacity-40`,children:h(`setup.currentLocation`)}),(0,Z.jsx)(`button`,{onClick:()=>d(!u),className:`text-gray-400 hover:text-red-500 transition-colors`,children:u?(0,Z.jsx)(y,{size:16}):(0,Z.jsx)(x,{size:16})})]}),(0,Z.jsx)(`div`,{className:`font-bold truncate`,children:(0,Z.jsx)(`span`,{className:q(`transition-[filter] duration-200 inline-block`,!u&&`filter blur-[6px] select-none`),children:(()=>{let e=[a.city,a.region,a.country].filter(e=>!!(e&&e!==`UNKNOWN`));return e.length>0?e.join(`, `):h(`setup.detecting`)})()})})]})]}),_?C:(0,Z.jsx)(D,{isOpen:b,onInteraction:S,placement:`bottom-end`,portalClassName:`z-20000`,fill:!0,targetProps:{className:`h-full`},content:(0,Z.jsxs)(`div`,{className:`p-3 select-text w-72 sm:w-80 max-w-[85vw] space-y-2`,children:[(0,Z.jsx)(`div`,{className:`text-[11px] font-mono font-bold text-gray-500 dark:text-gray-400 tracking-wide border-b border-gray-100 dark:border-gray-800 pb-1.5`,children:`/cdn-cgi/trace`}),(0,Z.jsx)(`pre`,{className:`m-0 font-mono text-xs leading-relaxed whitespace-pre-wrap break-all overflow-x-hidden max-h-64 overflow-y-auto text-gray-800 dark:text-gray-200`,children:f?.raw||h(`setup.noTraceData`,`暂无 Trace 数据`)})]}),children:C})]})]})})})},Q=({step:e,className:t,size:n=144})=>{let r=e===1?47:50,i=e===1?45.5:45;return(0,Z.jsx)(`div`,{"aria-hidden":`true`,className:K(`absolute -top-7 -left-7 pointer-events-none select-none z-0`,`text-blue-600/[0.08] dark:text-blue-400/[0.12]`,`transition-all duration-500 ease-out`,`blur-none group-hover:blur-md group-hover:opacity-0`,t),style:{width:n,height:n},children:(0,Z.jsxs)(`svg`,{viewBox:`0 0 100 100`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,className:`w-full h-full`,children:[(0,Z.jsx)(`circle`,{cx:`50`,cy:`50`,r:`46`,stroke:`currentColor`,strokeWidth:`4`}),(0,Z.jsx)(`text`,{x:r,y:i,textAnchor:`middle`,dominantBaseline:`central`,fill:`currentColor`,fontSize:`80`,fontWeight:`900`,fontFamily:`'Helvetica Neue', Helvetica, Arial, sans-serif`,children:e})]})})},be=({accessPoints:e,selectedApId:t,onSelectAp:n,accessPointName:r,onManageAccessPoints:o,isMobile:s})=>{let{t:c}=v();return(0,Z.jsxs)(H,{title:c(`setup.accessPointsCardTitle`,`接入点`),icon:(0,Z.jsx)(a,{size:16}),className:`group relative overflow-hidden [&_.bp6-section-header]:relative [&_.bp6-section-header]:z-10 [&_.bp6-section-card]:relative [&_.bp6-section-card]:z-10`,children:[(0,Z.jsx)(Q,{step:1}),(0,Z.jsx)(F,{children:(0,Z.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 w-full sm:w-auto`,children:[(0,Z.jsx)(`span`,{className:`text-xs opacity-50 font-medium`,children:c(`setup.selectAccessPointToConfigure`)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.length>0?(0,Z.jsx)(I,{value:t||``,onChange:e=>n(e.target.value),options:e.map(e=>({label:e.name,value:e.id})),className:`font-semibold text-gray-900 dark:text-gray-100`}):(0,Z.jsx)(`div`,{className:`font-semibold text-gray-900 dark:text-gray-100 flex items-center gap-2`,children:r||c(`setup.defaultAccessPointName`,`设备-1`)}),e.length>0&&(0,Z.jsx)(U,{minimal:!0,round:!0,intent:k.PRIMARY,className:`text-xs`,children:e.length})]})]}),(0,Z.jsx)(M,{variant:`outlined`,intent:k.NONE,icon:(0,Z.jsx)(i,{size:14}),text:c(`setup.manageAccessPoints`,`管理接入点`),onClick:o,fill:s,className:`shrink-0`})]})})]})},xe=({dohUrl:e,copyToClipboard:t,isMobile:n})=>{let{t:r}=v();return(0,Z.jsxs)(H,{title:r(`setup.accessPointTitle`,`Access DoH URL`),icon:`globe`,className:`group relative overflow-hidden [&_.bp6-section-header]:relative [&_.bp6-section-header]:z-10 [&_.bp6-section-card]:relative [&_.bp6-section-card]:z-10`,rightElement:(0,Z.jsx)(D,{placement:`bottom-end`,usePortal:!0,content:(0,Z.jsxs)(`div`,{className:`p-4 max-w-sm`,children:[(0,Z.jsx)(j,{children:r(`setup.whatIsDoh`)}),(0,Z.jsx)(`p`,{className:`text-sm mb-2`,children:r(`setup.dohDesc`)}),(0,Z.jsxs)(`ul`,{className:`list-disc list-inside text-sm opacity-80 mb-3 space-y-1`,children:[(0,Z.jsx)(`li`,{children:r(`setup.dohBenefit1`)}),(0,Z.jsx)(`li`,{children:r(`setup.dohBenefit2`)})]}),(0,Z.jsx)(`div`,{className:`text-xs border-t border-gray-100 dark:border-gray-700 pt-2`,children:(0,Z.jsxs)(`a`,{href:`https://en.wikipedia.org/wiki/DNS_over_HTTPS`,target:`_blank`,rel:`noreferrer`,className:`flex items-center gap-1 text-blue-500 hover:underline`,children:[(0,Z.jsx)(m,{size:10}),` `,r(`setup.learnMore`)]})})]}),children:(0,Z.jsx)(M,{icon:`help`,variant:`minimal`,intent:k.NONE})}),children:[(0,Z.jsx)(Q,{step:2}),(0,Z.jsx)(F,{children:(0,Z.jsxs)(`div`,{className:`w-full bg-gray-100 dark:bg-gray-800 p-3 rounded-lg border border-gray-200 dark:border-gray-700 flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-3`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-blue-600 dark:text-blue-400 break-all text-xs sm:text-sm`,children:e}),(0,Z.jsx)(M,{intent:k.PRIMARY,icon:`duplicate`,text:r(`setup.copyUrl`),fill:n,onClick:()=>t(e),className:`shrink-0 whitespace-nowrap min-w-fit w-auto`})]})})]})};function Se(e){let t=e.trim();try{return new URL(t.startsWith(`http://`)||t.startsWith(`https://`)?t:`https://${t}`).hostname||t}catch{return t.replace(/^https?:\/\//,``).split(`/`)[0].split(`:`)[0]||t}}function $(e,t){let n=(e||``).trim(),r=(t||``).trim();if(!r&&n.includes(`(`)&&n.endsWith(`)`)){let e=n.match(/^(.+?)\s*\((.+?)\)$/);e&&(n=e[1].trim(),r=e[2].trim())}let i=n&&n!==`DNS Worker`?n:``,a=r&&r!==`DNS Worker`?r:``;return i&&a?i.toLowerCase()===a.toLowerCase()?i:`${i} - ${a}`:i||a||``}function Ce(e,t,n,r){let i,a,o,s;typeof e==`object`?(i=e.profileKey,a=e.profileName,o=e.accessPointName,s=e.origin):(i=e,a=t,s=n||``,o=r);let c=s.trim(),l=Se(c),u=`${c}/${i}`,d=$(a,o),f=crypto.randomUUID(),p=crypto.randomUUID(),m=d?`DNS Worker - ${l} (${d})`:`DNS Worker (${l})`,h=d?`DNS Worker DoH - ${l} (${d})`:`DNS Worker DoH - ${l}`,g=d?`DNS Worker DoH configuration profile for ${d} via ${l}`:`DNS Worker DoH configuration profile via ${l}`,_=d?`Configures encrypted DNS over HTTPS (DoH) for ${d} via ${l}`:`Configures encrypted DNS over HTTPS (DoH) via ${l}`;return ee({PayloadContent:[{DNSSettings:{DNSProtocol:`HTTPS`,ServerHTTPVersion:3,ServerURL:u},OnDemandRules:[{Action:`Connect`,InterfaceTypeMatch:`WiFi`},{Action:`Connect`,InterfaceTypeMatch:`Cellular`},{Action:`Disconnect`}],PayloadDescription:_,PayloadDisplayName:h,PayloadIdentifier:`com.apple.dnsSettings.managed.${f}`,PayloadName:h,PayloadType:`com.apple.dnsSettings.managed`,PayloadUUID:f,PayloadVersion:1}],PayloadDescription:g,PayloadDisplayName:m,PayloadIdentifier:`com.dnsworker.profile.${i}`,PayloadName:m,PayloadRemovalDisallowed:!1,PayloadType:`Configuration`,PayloadUUID:p,PayloadVersion:1},{indent:` `})}const we=({isMobile:e,copyToClipboard:t,profileKey:n,profileName:i,accessPointName:a,currentIps:o,dotDomain:s})=>{let{t:c}=v(),{isCloudflare:d}=Y();return(0,Z.jsxs)(`div`,{className:`group relative overflow-hidden rounded-xl border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shadow-sm`,children:[(0,Z.jsx)(Q,{step:3}),(0,Z.jsxs)(V,{id:`setup-tabs`,renderActiveTabPanelOnly:!0,vertical:!e,size:`large`,className:K(`p-4 md:p-6 setup-tabs-container relative z-10 bg-transparent`,e&&[`[&_.bp6-tab-list]:overflow-x-auto!`,`[&_.bp6-tab-list]:flex-nowrap!`,`[&_.bp6-tab-list]:pb-1`,`[&_.bp6-tab-list]:scrollbar-none`,`[&_.bp6-tab-list]:[-ms-overflow-style:none]`,`[&_.bp6-tab-list::-webkit-scrollbar]:hidden`,`[&_.bp6-tab]:shrink-0`]),children:[(0,Z.jsx)(R,{id:`browsers`,title:(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(g,{size:16,className:`inline mr-2`}),c(`setup.browsers`)]}),panel:(0,Z.jsxs)(`div`,{className:`space-y-4 md:ml-4 mt-4 md:mt-0`,children:[(0,Z.jsx)(j,{className:`font-bold`,children:c(`setup.browserTitle`)}),(0,Z.jsx)(`p`,{className:`text-sm`,children:c(`setup.browserSteps`)}),(0,Z.jsx)(`p`,{className:`text-[10px] opacity-50 cursor-pointer`,onClick:()=>t(`chrome://settings/security`),children:c(`setup.browserTips`,`or copy this URL to the address bar: `)+`chrome://settings/security`})]})}),(0,Z.jsx)(R,{id:`apple`,title:(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(_,{size:16,className:`inline mr-2`}),c(`setup.apple`)]}),panel:(0,Z.jsxs)(`div`,{className:`space-y-4 md:ml-4 mt-4 md:mt-0`,children:[(0,Z.jsx)(j,{className:`font-bold`,children:c(`setup.appleTitle`)}),(0,Z.jsx)(`p`,{className:`text-sm`,children:c(`setup.appleDesc`)}),(0,Z.jsx)(`p`,{className:`text-[10px] opacity-50 text-center`,children:c(`setup.appleWarning`)}),(0,Z.jsxs)(`div`,{className:`p-6 bg-gray-50 dark:bg-gray-800 rounded-xl border border-dashed border-gray-300 dark:border-gray-700 flex flex-col items-center justify-center`,children:[(0,Z.jsx)(A,{icon:`document`,size:40,className:`opacity-20 mb-4`}),(0,Z.jsx)(M,{intent:k.PRIMARY,text:c(`setup.downloadConfig`),icon:`download`,onClick:()=>{let e=Ce({profileKey:n,profileName:i,accessPointName:a,origin:window.location.origin}),t=new Blob([e],{type:`application/x-apple-aspen-config`}),r=URL.createObjectURL(t),o=document.createElement(`a`);o.href=r;let s=$(i,a),c=Se(window.location.origin);o.download=`dns_worker-${(s||c).replace(/[^a-zA-Z0-9_\-\u4e00-\u9fa5]/g,`_`).replace(/_+/g,`_`).replace(/^_|_$/g,``)}-${n}.mobileconfig`,o.click(),URL.revokeObjectURL(r)}})]}),(0,Z.jsx)(`p`,{className:`text-[10px] opacity-50 mt-4! text-center`,children:c(`setup.appleInstallHint`)})]})}),(0,Z.jsx)(R,{id:`windows`,title:(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(b,{size:16,className:`inline mr-2`}),c(`setup.windows`)]}),panel:(0,Z.jsxs)(`div`,{className:`space-y-4 md:ml-4 mt-4 md:mt-0`,children:[(0,Z.jsx)(j,{className:`font-bold`,children:c(`setup.windowsTitle`)}),(0,Z.jsxs)(`ol`,{className:`list-decimal list-inside space-y-4 text-sm leading-relaxed`,children:[(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`a`,{href:`ms-settings:network-status`,children:c(`setup.windowsStep0`)})}),(0,Z.jsx)(`li`,{children:c(`setup.windowsStep1`)}),(0,Z.jsxs)(`li`,{children:[c(`setup.windowsStep2`),(0,Z.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:o.map(e=>(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(U,{minimal:!0,interactive:!0,onClick:()=>t(e.ip),icon:`duplicate`,className:`font-mono`,children:e.ip}),(0,Z.jsx)(`span`,{className:`text-[9px] opacity-50 ml-1 font-mono`,children:e.area})]},e.ip))})]}),(0,Z.jsx)(`li`,{children:c(`setup.windowsStep3`)}),(0,Z.jsx)(`li`,{children:c(`setup.windowsStep4`)})]})]})}),(0,Z.jsx)(R,{id:`linux`,title:(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(u,{size:16,className:`inline mr-2`}),c(`setup.linux`)]}),panel:(0,Z.jsxs)(`div`,{className:`space-y-4 md:ml-4 mt-4 md:mt-0`,children:[(0,Z.jsx)(j,{className:`font-bold`,children:c(`setup.linuxTitle`)}),(0,Z.jsx)(`p`,{className:`text-sm`,children:c(`setup.linuxDesc`)}),(0,Z.jsxs)(`div`,{className:`mt-4`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-bold mb-2`,children:c(`setup.linuxStep1`)}),(0,Z.jsxs)(`div`,{className:`relative group`,children:[(0,Z.jsx)(`pre`,{className:`bg-gray-100 dark:bg-gray-800 p-4 rounded-lg overflow-x-auto text-xs font-mono border border-gray-200 dark:border-gray-700`,children:(0,Z.jsx)(`code`,{children:`curl -sL "${window.location.origin}/setup.sh?key=${n}&origin=${window.location.origin}" | sudo bash`})}),(0,Z.jsx)(M,{className:`absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity`,icon:`duplicate`,minimal:!0,small:!0,onClick:()=>{t(`curl -sL "${window.location.origin}/setup.sh?key=${n}&origin=${window.location.origin}" | sudo bash`)}})]})]}),(0,Z.jsx)(`div`,{className:`mt-4`,children:(0,Z.jsx)(`p`,{className:`text-sm font-bold`,children:c(`setup.linuxStep2`)})})]})}),(0,Z.jsx)(R,{id:`routeros`,title:(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(l,{size:16,className:`inline mr-2`}),c(`setup.routeros`)]}),panel:(0,Z.jsxs)(`div`,{className:`space-y-4 md:ml-4 mt-4 md:mt-0`,children:[(0,Z.jsx)(j,{className:`font-bold`,children:c(`setup.routerosTitle`)}),(0,Z.jsx)(`p`,{className:`text-sm`,children:c(`setup.routerosDesc`)}),(0,Z.jsxs)(`div`,{className:`mt-4`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-bold mb-2`,children:c(`setup.routerosStep1`)}),(0,Z.jsxs)(`div`,{className:`relative group`,children:[(0,Z.jsx)(`pre`,{className:`bg-gray-100 dark:bg-gray-800 p-4 rounded-lg overflow-x-auto text-xs font-mono border border-gray-200 dark:border-gray-700`,children:(0,Z.jsx)(`code`,{children:`/ip dns set use-doh-server="${window.location.origin}/${n}" verify-doh-cert=yes`})}),(0,Z.jsx)(M,{className:`absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity`,icon:`duplicate`,minimal:!0,small:!0,onClick:()=>{t(`/ip dns set use-doh-server="${window.location.origin}/${n}" verify-doh-cert=yes`)}})]})]}),(0,Z.jsx)(`p`,{className:`text-sm`,children:c(`setup.routerosNote`)}),(0,Z.jsxs)(`a`,{href:`https://help.mikrotik.com/docs/spaces/ROS/pages/37748767/DNS`,target:`_blank`,rel:`noreferrer`,className:`flex items-center gap-1 text-xs text-blue-500 hover:underline`,children:[(0,Z.jsx)(m,{size:10}),` `,c(`setup.routerosDocs`)]})]})}),(0,Z.jsx)(R,{id:`android`,title:(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(r,{size:16,className:`inline mr-2`}),c(`setup.android`)]}),panel:(0,Z.jsxs)(`div`,{className:`space-y-4 md:ml-4 mt-4 md:mt-0`,children:[(0,Z.jsx)(j,{className:`font-bold`,children:c(`setup.androidTitle`)}),(0,Z.jsx)(`p`,{className:`text-sm`,children:c(`setup.androidDesc`)}),d?(0,Z.jsxs)(E,{intent:k.WARNING,icon:`warning-sign`,className:`text-xs`,children:[(0,Z.jsx)(`div`,{className:`font-semibold mb-1`,children:c(`setup.dotUnavailableCfTitle`)}),(0,Z.jsx)(`div`,{children:c(`setup.dotUnavailableCfDesc`)})]}):(()=>{let e=/^(\d{1,3}\.){3}\d{1,3}$/.test(window.location.hostname)||window.location.hostname===`localhost`||window.location.hostname===`127.0.0.1`||window.location.hostname.includes(`:`),r=(s||``).trim().replace(/^\*\./,``),i=!J(r)&&r||(e?``:window.location.hostname);return(0,Z.jsxs)(`div`,{className:`p-4 bg-gray-50 dark:bg-gray-800/60 rounded-xl border border-gray-200 dark:border-gray-700 space-y-3`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-semibold text-gray-700 dark:text-gray-300`,children:c(`setup.androidDotTitle`,`私有 DNS (DoT / DoQ)`)}),(0,Z.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:c(`setup.androidDotDesc`,`支持 Android 原生“私有 DNS (DoT)”及各类现代 DoQ 客户端。提供商主机名:`)}),i?(0,Z.jsx)(`div`,{className:`space-y-3 pt-1`,children:(0,Z.jsx)(`div`,{className:`flex flex-col sm:flex-row sm:items-center gap-1.5 sm:gap-2`,children:(0,Z.jsx)(U,{minimal:!0,interactive:!0,onClick:()=>t(`${n}.${i}`),icon:`duplicate`,className:`font-mono text-xs sm:text-sm py-1 px-3 self-start`,intent:k.PRIMARY,children:`${n}.${i}`})})}):(0,Z.jsx)(E,{intent:k.WARNING,icon:`warning-sign`,className:`text-xs`,children:c(`setup.androidIpNotice`,`检测到当前通过 IP 或本地地址访问面板。DoT / DoQ 仅接受域名,请在 .env 中配置 SERVERFULL_DOT_DOMAIN (例如 dns.example.com) 后刷新。`)})]})})(),!d&&(0,Z.jsx)(E,{intent:k.PRIMARY,icon:`info-sign`,className:`text-xs`,children:c(`setup.androidWarning`)})]})})]})]})};function Te({profileId:e,accessPoints:t,onRefresh:n,toasterRef:r}){let{t:i}=v(),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(null),[p,m]=(0,X.useState)(``),[h,g]=(0,X.useState)(!1),[_,y]=(0,X.useState)(null),[b,x]=(0,X.useState)(null),[S,C]=(0,X.useState)(!1),[w,T]=(0,X.useState)(!1),[E,D]=(0,X.useState)(null),[O,A]=(0,X.useState)(!1),[j,M]=(0,X.useState)(``);return{isAddDialogOpen:a,setIsAddDialogOpen:o,newApName:s,setNewApName:c,isAdding:l,renameApId:d,setRenameApId:f,renameApName:p,setRenameApName:m,isRenaming:h,rotatingApId:_,deletingApId:b,newApNameFocused:S,setNewApNameFocused:C,renameApNameFocused:w,setRenameApNameFocused:T,rotateConfirmApId:E,setRotateConfirmApId:D,isSearchOpen:O,setIsSearchOpen:A,searchQuery:j,setSearchQuery:M,filteredAccessPoints:t.filter(e=>e.name.toLowerCase().includes(j.toLowerCase())||e.token.toLowerCase().includes(j.toLowerCase())),isValidApName:e=>le.test(e),handleAdd:async()=>{let a=s.trim();if(a){if(t.some(e=>e.name.toLowerCase()===a.toLowerCase())){r.current?.show({message:i(`setup.accessPointNameExists`,`Access Point name already exists`),intent:k.DANGER});return}u(!0);try{await ue(e,a),r.current?.show({message:i(`setup.accessPointCreated`),intent:k.SUCCESS}),o(!1),c(``),n()}catch(e){let t=e.message||`Failed to create access point`,n=t;if(t.startsWith(`Access point limit exceeded`)){let e=t.match(/\(max (\d+)\)/),r=e?e[1]:`100`;n=i(`setup.accessPointLimitExceeded`,{max:r,defaultValue:`Access Point limit exceeded (max ${r})`})}r.current?.show({message:n,intent:k.DANGER})}finally{u(!1)}}},handleRename:async()=>{let a=p.trim();if(!(!a||!d)){if(t.some(e=>e.id!==d&&e.name.toLowerCase()===a.toLowerCase())){r.current?.show({message:i(`setup.accessPointNameExists`,`Access Point name already exists`),intent:k.DANGER});return}g(!0);try{await ae(e,d,a),r.current?.show({message:i(`setup.accessPointRenamed`),intent:k.SUCCESS}),f(null),n()}catch(e){r.current?.show({message:e.message||`Failed to rename access point`,intent:k.DANGER})}finally{g(!1)}}},handleRotate:async t=>{y(t);try{await te(e,t),r.current?.show({message:i(`setup.tokenRotated`),intent:k.SUCCESS}),n()}catch(e){console.error(e)}finally{y(null)}},handleDelete:async t=>{if(confirm(i(`setup.deleteAccessPointConfirm`))){x(t);try{await me(e,t),r.current?.show({message:i(`setup.accessPointDeleted`),intent:k.SUCCESS}),n()}catch(e){console.error(e)}finally{x(null)}}}}}const Ee=({isOpen:e,onClose:t,newApName:n,setNewApName:r,newApNameFocused:i,setNewApNameFocused:a,handleAdd:o,isAdding:s,isValidApName:c})=>{let{t:l}=v();return(0,Z.jsxs)(B,{isOpen:e,onClose:t,title:l(`setup.addAccessPoint`),children:[(0,Z.jsx)(`div`,{className:N,children:(0,Z.jsx)(W,{content:l(`setup.accessPointNameFormatTip`,`1-30 characters, letters, numbers, hyphens and underscores allowed`),isOpen:i,position:P.TOP,intent:k.PRIMARY,className:`w-full`,children:(0,Z.jsx)(`div`,{className:`w-full block`,children:(0,Z.jsx)(L,{autoFocus:!0,large:!0,placeholder:l(`setup.accessPointName`),value:n,onChange:e=>r(e.target.value),onFocus:()=>a(!0),onBlur:()=>a(!1)})})})}),(0,Z.jsx)(`div`,{className:G,children:(0,Z.jsxs)(`div`,{className:T,children:[(0,Z.jsx)(M,{onClick:t,children:l(`common.cancel`,`Cancel`)}),(0,Z.jsx)(M,{intent:k.PRIMARY,onClick:o,loading:s,disabled:!c(n),children:l(`common.create`)})]})})]})},De=({isOpen:e,onClose:t,renameApName:n,setRenameApName:r,renameApNameFocused:i,setRenameApNameFocused:a,handleRename:o,isRenaming:s,isValidApName:c})=>{let{t:l}=v();return(0,Z.jsxs)(B,{isOpen:e,onClose:t,title:l(`setup.renameAccessPoint`),children:[(0,Z.jsx)(`div`,{className:N,children:(0,Z.jsx)(W,{content:l(`setup.accessPointNameFormatTip`,`1-30 characters, letters, numbers, hyphens and underscores allowed`),isOpen:i,position:P.TOP,intent:k.PRIMARY,className:`w-full`,children:(0,Z.jsx)(`div`,{className:`w-full block`,children:(0,Z.jsx)(L,{autoFocus:!0,large:!0,placeholder:l(`setup.accessPointName`),value:n,onChange:e=>r(e.target.value),onFocus:()=>a(!0),onBlur:()=>a(!1)})})})}),(0,Z.jsx)(`div`,{className:G,children:(0,Z.jsxs)(`div`,{className:T,children:[(0,Z.jsx)(M,{onClick:t,children:l(`common.cancel`,`Cancel`)}),(0,Z.jsx)(M,{intent:k.PRIMARY,onClick:o,loading:s,disabled:!c(n),children:l(`common.save`)})]})})]})},Oe=({ap:e,totalApCount:t,toasterRef:r,onRenameTrigger:i,rotateConfirmApId:o,setRotateConfirmApId:s,rotatingApId:c,handleRotate:l,deletingApId:u,handleDelete:f})=>{let{t:p}=v();return(0,Z.jsx)(H,{title:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(a,{size:16}),(0,Z.jsx)(`span`,{children:e.name})]}),className:`shadow-none! rounded-lg!`,children:(0,Z.jsxs)(F,{children:[(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`flex justify-between items-start gap-4`,children:[(0,Z.jsx)(`span`,{className:`text-xs opacity-50 mt-1`,children:`DoH URL`}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-mono bg-blue-50 text-blue-600 dark:bg-blue-900/20 dark:text-blue-400 px-2 py-1 rounded cursor-pointer hover:bg-blue-100 dark:hover:bg-blue-900/40 transition-colors break-all`,onClick:()=>{navigator.clipboard.writeText(`${window.location.origin}/${e.token}`),r.current?.show({message:p(`setup.copied`),intent:k.SUCCESS})},title:p(`setup.copyUrl`),children:[(0,Z.jsx)(`span`,{className:`select-all`,children:`${window.location.origin}/${e.token}`}),(0,Z.jsx)(h,{size:14,className:`shrink-0`})]})]}),(0,Z.jsxs)(`div`,{className:`flex justify-between items-start gap-4`,children:[(0,Z.jsx)(`span`,{className:`text-xs opacity-50 mt-1`,children:p(`setup.accessPointToken`)}),(0,Z.jsx)(`span`,{className:`text-sm font-mono bg-gray-100 dark:bg-gray-800 px-2 py-1 rounded select-all break-all`,children:e.token})]}),(0,Z.jsxs)(`div`,{className:`flex justify-between items-start gap-4`,children:[(0,Z.jsx)(`span`,{className:`text-xs opacity-50 mt-1`,children:`Created`}),(0,Z.jsx)(`span`,{className:`text-sm`,children:pe(new Date(e.created_at*1e3))})]})]}),(0,Z.jsxs)(`div`,{className:`mt-4 flex gap-2 flex-wrap`,children:[(0,Z.jsx)(M,{small:!0,icon:(0,Z.jsx)(d,{size:14}),text:p(`setup.renameAccessPoint`),onClick:()=>i(e.id,e.name)}),(0,Z.jsx)(D,{isOpen:o===e.id,onInteraction:e=>{e||s(null)},content:(0,Z.jsxs)(`div`,{className:`p-4 space-y-3 dark:bg-gray-800 dark:text-white max-w-xs`,children:[(0,Z.jsx)(`p`,{className:`text-xs font-semibold leading-relaxed`,children:p(`setup.rotateTokenConfirmDesc`,`Rotating the key will immediately disconnect devices using the old key. Are you sure you want to continue?`)}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Z.jsx)(M,{small:!0,minimal:!0,text:p(`common.cancel`,`Cancel`),onClick:()=>s(null)}),(0,Z.jsx)(M,{small:!0,intent:k.DANGER,text:p(`common.confirm`,`Confirm`),onClick:()=>{s(null),l(e.id)}})]})]}),placement:`top`,children:(0,Z.jsx)(M,{small:!0,icon:(0,Z.jsx)(n,{size:14}),text:p(`setup.rotateToken`),loading:c===e.id,onClick:()=>s(e.id)})}),(0,Z.jsx)(M,{small:!0,intent:k.DANGER,icon:(0,Z.jsx)(S,{size:14}),text:p(`setup.deleteAccessPoint`),loading:u===e.id,onClick:()=>f(e.id),disabled:t<=1,title:t<=1?`Cannot delete the only access point`:void 0})]})]})})},ke=({isOpen:e,onClose:t,profileId:n,isMobile:r,accessPoints:i,loading:a,onRefresh:s,toasterRef:c})=>{let{t:l}=v(),{isAddDialogOpen:u,setIsAddDialogOpen:d,newApName:p,setNewApName:m,isAdding:h,renameApId:g,setRenameApId:_,renameApName:y,setRenameApName:b,isRenaming:x,rotatingApId:S,deletingApId:C,newApNameFocused:w,setNewApNameFocused:T,renameApNameFocused:E,setRenameApNameFocused:D,rotateConfirmApId:A,setRotateConfirmApId:j,isSearchOpen:N,setIsSearchOpen:P,searchQuery:F,setSearchQuery:I,filteredAccessPoints:R,isValidApName:z,handleAdd:B,handleRename:V,handleRotate:H,handleDelete:U}=Te({profileId:n,accessPoints:i,onRefresh:s,toasterRef:c});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(_e,{isOpen:e,onClose:t,title:N?(0,Z.jsx)(L,{leftIcon:`search`,placeholder:l(`setup.searchAccessPoints`,`Search...`),value:F,onChange:e=>I(e.target.value),rightElement:(0,Z.jsx)(M,{icon:`cross`,minimal:!0,onClick:()=>{P(!1),I(``)}}),autoFocus:!0}):(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{children:l(`setup.manageAccessPoints`)}),(0,Z.jsx)(M,{icon:(0,Z.jsx)(o,{size:14}),minimal:!0,onClick:()=>P(!0),className:`opacity-50 hover:opacity-100`})]}),icon:`diagram-tree`,size:r?`100%`:`450px`,children:[(0,Z.jsx)(M,{fill:!0,intent:k.PRIMARY,icon:(0,Z.jsx)(f,{size:16}),text:l(`setup.addAccessPoint`),onClick:()=>d(!0),large:!0}),a?(0,Z.jsx)(`div`,{className:`flex justify-center p-8`,children:(0,Z.jsx)(O,{})}):(0,Z.jsx)(`div`,{className:`space-y-4 mt-4`,children:R.map(e=>(0,Z.jsx)(Oe,{ap:e,totalApCount:i.length,toasterRef:c,onRenameTrigger:(e,t)=>{_(e),b(t)},rotateConfirmApId:A,setRotateConfirmApId:j,rotatingApId:S,handleRotate:H,deletingApId:C,handleDelete:U},e.id))})]}),(0,Z.jsx)(Ee,{isOpen:u,onClose:()=>{d(!1),m(``)},newApName:p,setNewApName:m,newApNameFocused:w,setNewApNameFocused:T,handleAdd:B,isAdding:h,isValidApName:z}),(0,Z.jsx)(De,{isOpen:!!g,onClose:()=>_(null),renameApName:y,setRenameApName:b,renameApNameFocused:E,setRenameApNameFocused:D,handleRename:V,isRenaming:x,isValidApName:z})]})},Ae=({profileId:e,profileKey:t,profileName:n,toasterRef:r})=>{let i=fe(),{t:a}=v(),[o,s]=(0,X.useState)([]),[c,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(null),m=async()=>{l(!0);try{s(await de(e))}catch(e){console.error(e)}finally{l(!1)}};(0,X.useEffect)(()=>{m()},[e]);let[h,g]=(0,X.useState)(n||``);(0,X.useEffect)(()=>{n?g(n):e&&he(e).then(e=>{e?.name&&g(e.name)}).catch(()=>{})},[e,n]);let _=(0,X.useMemo)(()=>o.length===0?null:o.find(e=>e.id===f)||o[0],[o,f]),y=_?_.token:t,b=_?_.name:void 0,x=`${window.location.origin}/${y}`,[S,C]=(0,X.useState)(null),[w,T]=(0,X.useState)(!1),[E,D]=(0,X.useState)(!1),[O,A]=(0,X.useState)(!1),[j,M]=(0,X.useState)(null),[N,P]=(0,X.useState)(null),[F,I]=(0,X.useState)({ipv4:[],ipv6:[]}),[L,R]=(0,X.useState)(null),z=e=>{navigator.clipboard.writeText(e),r?.current?.show({message:a(`setup.copied`),intent:k.SUCCESS})},B=async()=>{T(!0),R(null);try{let[t,n]=await Promise.all([ne(),se()]);if(t.ip&&(t.country===`UNKNOWN`||!t.country))try{let e=await fetch(`/api/geoip?ip=${encodeURIComponent(t.ip)}`);if(e.ok){let n=await e.json();n.success&&(n.country&&(t.country=n.country),n.region&&(t.region=n.region),n.city&&(t.city=n.city),n.timezone?.id&&(t.timezone=n.timezone.id),n.connection?.org&&(t.asOrganization=n.connection.org))}}catch{}C(t),M(n),t.timezone&&t.timezone!==`UNKNOWN`&&ce(t.timezone);let r=window.location.hostname===`localhost`||window.location.hostname===`127.0.0.1`||window.location.hostname===`::1`||window.location.hostname.startsWith(`192.168.`)||window.location.hostname.startsWith(`10.`)||/^172\.(1[6-9]|2\d|3[01])\./.test(window.location.hostname),i=!!(t.dotDomain&&!J(t.dotDomain));oe(r&&i||i?t.dotDomain:window.location.hostname||``).then(e=>P(e)).catch(e=>console.warn(`Failed fetching domain geo location:`,e));let a=t.substituteDomain||`www.okx.com`;re().then(e=>{I(t=>t.ipv4.length>0||t.ipv6.length>0?t:{ipv4:e.ip?[e.ip]:[],ipv6:e.ipv6?[e.ipv6]:[]})}).catch(()=>{}),ie(a).then(e=>{(e.ipv4.length>0||e.ipv6.length>0)&&I(e)}).catch(e=>console.warn(`Failed resolving substitute domain DNS IPs:`,e)),R({success:!!t.connectedProfileId,profileMatch:t.connectedProfileId===e})}catch(e){console.error(`Verification failed`,e)}finally{T(!1)}};(0,X.useEffect)(()=>{B()},[e]);let V=(0,X.useMemo)(()=>{let e=[],t=(F.ipv4||[]).slice(0,2),n=(F.ipv6||[]).slice(0,2),r=S?.substituteDomain||`www.okx.com`;for(let n of t)e.push({ip:n,area:`${r} IPv4`});for(let t of n)e.push({ip:t,area:`${r} IPv6`});return e},[F,S?.substituteDomain]);return(0,Z.jsxs)(`div`,{className:`mx-auto space-y-8 pb-24 ${i?`p-1`:`px-8 max-w-5xl`}`,children:[(0,Z.jsx)(ve,{isMobile:i}),(0,Z.jsx)(ye,{isVerifying:w,verifyResult:L,handleVerify:B,isMobile:i,clientInfo:S,showIp:E,setShowIp:D,showLocation:O,setShowLocation:A,traceInfo:j,edgeLocation:N}),(0,Z.jsx)(be,{accessPoints:o,selectedApId:_?.id||null,onSelectAp:p,accessPointName:b,onManageAccessPoints:()=>d(!0),isMobile:i}),(0,Z.jsx)(xe,{dohUrl:x,copyToClipboard:z,isMobile:i}),(0,Z.jsx)(we,{isMobile:i,copyToClipboard:z,profileKey:y,profileName:h||void 0,accessPointName:b,currentIps:V,dotDomain:S?.dotDomain}),(0,Z.jsx)(ke,{isOpen:u,onClose:()=>d(!1),profileId:e,isMobile:i,accessPoints:o,loading:c,onRefresh:m,toasterRef:r})]})};export{Ae as SetupView};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-C4Xdq4VV.js";import{At as t,B as n,D as r,F as i,J as a,L as o,M as s,P as c,R as l,T as u,U as d,V as f,X as p,ct as m,ft as h,it as g,kt as _,nn as v,ot as y,q as b,st as x,w as S}from"./vendor-react-DYK5a2J9.js";import{S as C,b as w}from"./vendor-icons-other-BTYC6Wvz.js";import"./vendor-i18next-DlmslyBB.js";import{B as T,C as E,E as D,F as O,H as k,I as A,N as j,P as M,R as N,V as P,a as F,d as I,f as L,i as R,j as z,k as B,n as V,o as H,r as U,v as W,z as G}from"./vendor-ui-core-CodM8CpF.js";import{_t as K,t as ee,vt as q}from"./vendor-utils-Bab4qB3W.js";import{Ct as te,H as ne,J as re,Q as ie,St as ae,U as oe,X as J,Y as se,_ as ce,a as le,et as ue,ft as de,gn as fe,h as pe,lt as me,mt as he,n as Y,t as ge}from"./index--9RzUkcE.js";import{t as _e}from"./SwipeableDrawer-UY1QWnPj.js";var X=e(C(),1),Z=e(w(),1);const ve=()=>{let{t:e}=v();return(0,Z.jsxs)(`div`,{className:`flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(z,{className:`font-bold text-gray-900 dark:text-white m-0`,children:e(`setup.title`)}),(0,Z.jsx)(`p`,{className:`bp6-text-muted m-0 mt-1`,children:e(`setup.subtitle`)})]}),(0,Z.jsx)(`div`,{className:`flex items-center`,children:(0,Z.jsx)(ge,{})})]})},ye=({isVerifying:e,verifyResult:n,handleVerify:r,isMobile:i,clientInfo:a,showIp:o,setShowIp:l,showLocation:u,setShowLocation:d,traceInfo:f,edgeLocation:m})=>{let{t:h}=v(),{isServerfull:_}=Y(),[b,S]=(0,X.useState)(!1),C=(0,Z.jsxs)(`div`,{className:q(`bg-white dark:bg-gray-900 p-4 rounded-lg border border-gray-100 dark:border-gray-800 shadow-sm flex items-start gap-3 select-none h-full transition-all`,!_),children:[(0,Z.jsx)(c,{size:18,className:`text-purple-500 mt-1 shrink-0`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`text-[10px] uppercase font-bold opacity-40`,children:_?h(`setup.serverLocation`,`服务器位置`):h(`setup.edgeServer`)}),(0,Z.jsx)(`div`,{className:`font-bold truncate`,title:_?m||``:m||f?.colo||``,children:_?m||h(`setup.detecting`):m||f?.colo||h(`setup.detecting`)})]})]});return(0,Z.jsx)(H,{title:h(`setup.verifyConnection`),icon:(0,Z.jsx)(t,{size:16}),children:(0,Z.jsx)(F,{children:(0,Z.jsxs)(`div`,{className:`flex flex-col space-y-6`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col md:flex-row items-center justify-between bg-gray-50 dark:bg-gray-800/50 p-6 rounded-xl border border-gray-100 dark:border-gray-800 gap-6`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col md:flex-row items-center gap-4 text-center md:text-left`,children:[(0,Z.jsx)(`div`,{className:`p-3 rounded-full ${n?.success?`bg-green-100 text-green-600`:n?`bg-red-100 text-red-600`:`bg-blue-100 text-blue-600`}`,children:e?(0,Z.jsx)(O,{size:24}):n?.success?(0,Z.jsx)(s,{size:24}):(0,Z.jsx)(c,{size:24})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`font-bold text-lg`,children:e?h(`setup.verifying`):n?.success?h(`setup.connected`):h(`setup.notConnected`)}),(0,Z.jsx)(`div`,{className:`text-sm opacity-60`,children:n?.success?n.profileMatch?h(`setup.profileMatch`):h(`setup.profileMismatch`):h(`setup.verifyHint`)})]})]}),(0,Z.jsx)(M,{size:`large`,intent:n?.success?k.SUCCESS:k.PRIMARY,icon:`refresh`,text:h(`setup.refreshStatus`),onClick:r,loading:e,fill:i})]}),a&&(0,Z.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4`,children:[(0,Z.jsxs)(`div`,{className:`bg-white dark:bg-gray-900 p-4 rounded-lg border border-gray-100 dark:border-gray-800 shadow-sm flex items-start gap-3`,children:[(0,Z.jsx)(g,{size:18,className:`text-blue-500 mt-1`}),(0,Z.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsx)(`div`,{className:`text-[10px] uppercase font-bold opacity-40`,children:h(`setup.egressIp`)}),(0,Z.jsx)(`button`,{onClick:()=>l(!o),className:`text-gray-400 hover:text-blue-500 transition-colors`,children:o?(0,Z.jsx)(y,{size:16}):(0,Z.jsx)(x,{size:16})})]}),(0,Z.jsx)(`div`,{className:`font-mono font-bold text-blue-600 dark:text-blue-400 truncate`,children:(0,Z.jsx)(`span`,{className:q(`transition-[filter] duration-200 inline-block`,!o&&`filter blur-[6px] select-none`),children:a.ip})})]})]}),(0,Z.jsxs)(`div`,{className:`bg-white dark:bg-gray-900 p-4 rounded-lg border border-gray-100 dark:border-gray-800 shadow-sm flex items-start gap-3`,children:[(0,Z.jsx)(p,{size:18,className:`text-red-500 mt-1`}),(0,Z.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsx)(`div`,{className:`text-[10px] uppercase font-bold opacity-40`,children:h(`setup.currentLocation`)}),(0,Z.jsx)(`button`,{onClick:()=>d(!u),className:`text-gray-400 hover:text-red-500 transition-colors`,children:u?(0,Z.jsx)(y,{size:16}):(0,Z.jsx)(x,{size:16})})]}),(0,Z.jsx)(`div`,{className:`font-bold truncate`,children:(0,Z.jsx)(`span`,{className:q(`transition-[filter] duration-200 inline-block`,!u&&`filter blur-[6px] select-none`),children:(()=>{let e=[a.city,a.region,a.country].filter(e=>!!(e&&e!==`UNKNOWN`));return e.length>0?e.join(`, `):h(`setup.detecting`)})()})})]})]}),_?C:(0,Z.jsx)(D,{isOpen:b,onInteraction:S,placement:`bottom-end`,portalClassName:`z-20000`,fill:!0,targetProps:{className:`h-full`},content:(0,Z.jsxs)(`div`,{className:`p-3 select-text w-72 sm:w-80 max-w-[85vw] space-y-2`,children:[(0,Z.jsx)(`div`,{className:`text-[11px] font-mono font-bold text-gray-500 dark:text-gray-400 tracking-wide border-b border-gray-100 dark:border-gray-800 pb-1.5`,children:`/cdn-cgi/trace`}),(0,Z.jsx)(`pre`,{className:`m-0 font-mono text-xs leading-relaxed whitespace-pre-wrap break-all overflow-x-hidden max-h-64 overflow-y-auto text-gray-800 dark:text-gray-200`,children:f?.raw||h(`setup.noTraceData`,`暂无 Trace 数据`)})]}),children:C})]})]})})})},Q=({step:e,className:t,size:n=144})=>{let r=e===1?47:50,i=e===1?45.5:45;return(0,Z.jsx)(`div`,{"aria-hidden":`true`,className:K(`absolute -top-7 -left-7 pointer-events-none select-none z-0`,`text-blue-600/[0.08] dark:text-blue-400/[0.12]`,`transition-all duration-500 ease-out`,`blur-none group-hover:blur-md group-hover:opacity-0`,t),style:{width:n,height:n},children:(0,Z.jsxs)(`svg`,{viewBox:`0 0 100 100`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,className:`w-full h-full`,children:[(0,Z.jsx)(`circle`,{cx:`50`,cy:`50`,r:`46`,stroke:`currentColor`,strokeWidth:`4`}),(0,Z.jsx)(`text`,{x:r,y:i,textAnchor:`middle`,dominantBaseline:`central`,fill:`currentColor`,fontSize:`80`,fontWeight:`900`,fontFamily:`'Helvetica Neue', Helvetica, Arial, sans-serif`,children:e})]})})},be=({accessPoints:e,selectedApId:t,onSelectAp:n,accessPointName:r,onManageAccessPoints:o,isMobile:s})=>{let{t:c}=v();return(0,Z.jsxs)(H,{title:c(`setup.accessPointsCardTitle`,`接入点`),icon:(0,Z.jsx)(a,{size:16}),className:`group relative overflow-hidden [&_.bp6-section-header]:relative [&_.bp6-section-header]:z-10 [&_.bp6-section-card]:relative [&_.bp6-section-card]:z-10`,children:[(0,Z.jsx)(Q,{step:1}),(0,Z.jsx)(F,{children:(0,Z.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 w-full sm:w-auto`,children:[(0,Z.jsx)(`span`,{className:`text-xs opacity-50 font-medium`,children:c(`setup.selectAccessPointToConfigure`)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.length>0?(0,Z.jsx)(I,{value:t||``,onChange:e=>n(e.target.value),options:e.map(e=>({label:e.name,value:e.id})),className:`font-semibold text-gray-900 dark:text-gray-100`}):(0,Z.jsx)(`div`,{className:`font-semibold text-gray-900 dark:text-gray-100 flex items-center gap-2`,children:r||c(`setup.defaultAccessPointName`,`设备-1`)}),e.length>0&&(0,Z.jsx)(U,{minimal:!0,round:!0,intent:k.PRIMARY,className:`text-xs`,children:e.length})]})]}),(0,Z.jsx)(M,{variant:`outlined`,intent:k.NONE,icon:(0,Z.jsx)(i,{size:14}),text:c(`setup.manageAccessPoints`,`管理接入点`),onClick:o,fill:s,className:`shrink-0`})]})})]})},xe=({dohUrl:e,copyToClipboard:t,isMobile:n})=>{let{t:r}=v();return(0,Z.jsxs)(H,{title:r(`setup.accessPointTitle`,`Access DoH URL`),icon:`globe`,className:`group relative overflow-hidden [&_.bp6-section-header]:relative [&_.bp6-section-header]:z-10 [&_.bp6-section-card]:relative [&_.bp6-section-card]:z-10`,rightElement:(0,Z.jsx)(D,{placement:`bottom-end`,usePortal:!0,content:(0,Z.jsxs)(`div`,{className:`p-4 max-w-sm`,children:[(0,Z.jsx)(j,{children:r(`setup.whatIsDoh`)}),(0,Z.jsx)(`p`,{className:`text-sm mb-2`,children:r(`setup.dohDesc`)}),(0,Z.jsxs)(`ul`,{className:`list-disc list-inside text-sm opacity-80 mb-3 space-y-1`,children:[(0,Z.jsx)(`li`,{children:r(`setup.dohBenefit1`)}),(0,Z.jsx)(`li`,{children:r(`setup.dohBenefit2`)})]}),(0,Z.jsx)(`div`,{className:`text-xs border-t border-gray-100 dark:border-gray-700 pt-2`,children:(0,Z.jsxs)(`a`,{href:`https://en.wikipedia.org/wiki/DNS_over_HTTPS`,target:`_blank`,rel:`noreferrer`,className:`flex items-center gap-1 text-blue-500 hover:underline`,children:[(0,Z.jsx)(m,{size:10}),` `,r(`setup.learnMore`)]})})]}),children:(0,Z.jsx)(M,{icon:`help`,variant:`minimal`,intent:k.NONE})}),children:[(0,Z.jsx)(Q,{step:2}),(0,Z.jsx)(F,{children:(0,Z.jsxs)(`div`,{className:`w-full bg-gray-100 dark:bg-gray-800 p-3 rounded-lg border border-gray-200 dark:border-gray-700 flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-3`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-blue-600 dark:text-blue-400 break-all text-xs sm:text-sm`,children:e}),(0,Z.jsx)(M,{intent:k.PRIMARY,icon:`duplicate`,text:r(`setup.copyUrl`),fill:n,onClick:()=>t(e),className:`shrink-0 whitespace-nowrap min-w-fit w-auto`})]})})]})};function Se(e){let t=e.trim();try{return new URL(t.startsWith(`http://`)||t.startsWith(`https://`)?t:`https://${t}`).hostname||t}catch{return t.replace(/^https?:\/\//,``).split(`/`)[0].split(`:`)[0]||t}}function $(e,t){let n=(e||``).trim(),r=(t||``).trim();if(!r&&n.includes(`(`)&&n.endsWith(`)`)){let e=n.match(/^(.+?)\s*\((.+?)\)$/);e&&(n=e[1].trim(),r=e[2].trim())}let i=n&&n!==`DNS Worker`?n:``,a=r&&r!==`DNS Worker`?r:``;return i&&a?i.toLowerCase()===a.toLowerCase()?i:`${i} - ${a}`:i||a||``}function Ce(e,t,n,r){let i,a,o,s;typeof e==`object`?(i=e.profileKey,a=e.profileName,o=e.accessPointName,s=e.origin):(i=e,a=t,s=n||``,o=r);let c=s.trim(),l=Se(c),u=`${c}/${i}`,d=$(a,o),f=crypto.randomUUID(),p=crypto.randomUUID(),m=d?`DNS Worker - ${l} (${d})`:`DNS Worker (${l})`,h=d?`DNS Worker DoH - ${l} (${d})`:`DNS Worker DoH - ${l}`,g=d?`DNS Worker DoH configuration profile for ${d} via ${l}`:`DNS Worker DoH configuration profile via ${l}`,_=d?`Configures encrypted DNS over HTTPS (DoH) for ${d} via ${l}`:`Configures encrypted DNS over HTTPS (DoH) via ${l}`;return ee({PayloadContent:[{DNSSettings:{DNSProtocol:`HTTPS`,ServerHTTPVersion:3,ServerURL:u},OnDemandRules:[{Action:`Connect`,InterfaceTypeMatch:`WiFi`},{Action:`Connect`,InterfaceTypeMatch:`Cellular`},{Action:`Disconnect`}],PayloadDescription:_,PayloadDisplayName:h,PayloadIdentifier:`com.apple.dnsSettings.managed.${f}`,PayloadName:h,PayloadType:`com.apple.dnsSettings.managed`,PayloadUUID:f,PayloadVersion:1}],PayloadDescription:g,PayloadDisplayName:m,PayloadIdentifier:`com.dnsworker.profile.${i}`,PayloadName:m,PayloadRemovalDisallowed:!1,PayloadType:`Configuration`,PayloadUUID:p,PayloadVersion:1},{indent:` `})}const we=({isMobile:e,copyToClipboard:t,profileKey:n,profileName:i,accessPointName:a,currentIps:o,dotDomain:s})=>{let{t:c}=v(),{isCloudflare:d}=Y();return(0,Z.jsxs)(`div`,{className:`group relative overflow-hidden rounded-xl border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shadow-sm`,children:[(0,Z.jsx)(Q,{step:3}),(0,Z.jsxs)(V,{id:`setup-tabs`,renderActiveTabPanelOnly:!0,vertical:!e,size:`large`,className:K(`p-4 md:p-6 setup-tabs-container relative z-10 bg-transparent`,e&&[`[&_.bp6-tab-list]:overflow-x-auto!`,`[&_.bp6-tab-list]:flex-nowrap!`,`[&_.bp6-tab-list]:pb-1`,`[&_.bp6-tab-list]:scrollbar-none`,`[&_.bp6-tab-list]:[-ms-overflow-style:none]`,`[&_.bp6-tab-list::-webkit-scrollbar]:hidden`,`[&_.bp6-tab]:shrink-0`]),children:[(0,Z.jsx)(R,{id:`browsers`,title:(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(g,{size:16,className:`inline mr-2`}),c(`setup.browsers`)]}),panel:(0,Z.jsxs)(`div`,{className:`space-y-4 md:ml-4 mt-4 md:mt-0`,children:[(0,Z.jsx)(j,{className:`font-bold`,children:c(`setup.browserTitle`)}),(0,Z.jsx)(`p`,{className:`text-sm`,children:c(`setup.browserSteps`)}),(0,Z.jsx)(`p`,{className:`text-[10px] opacity-50 cursor-pointer`,onClick:()=>t(`chrome://settings/security`),children:c(`setup.browserTips`,`or copy this URL to the address bar: `)+`chrome://settings/security`})]})}),(0,Z.jsx)(R,{id:`apple`,title:(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(_,{size:16,className:`inline mr-2`}),c(`setup.apple`)]}),panel:(0,Z.jsxs)(`div`,{className:`space-y-4 md:ml-4 mt-4 md:mt-0`,children:[(0,Z.jsx)(j,{className:`font-bold`,children:c(`setup.appleTitle`)}),(0,Z.jsx)(`p`,{className:`text-sm`,children:c(`setup.appleDesc`)}),(0,Z.jsx)(`p`,{className:`text-[10px] opacity-50 text-center`,children:c(`setup.appleWarning`)}),(0,Z.jsxs)(`div`,{className:`p-6 bg-gray-50 dark:bg-gray-800 rounded-xl border border-dashed border-gray-300 dark:border-gray-700 flex flex-col items-center justify-center`,children:[(0,Z.jsx)(A,{icon:`document`,size:40,className:`opacity-20 mb-4`}),(0,Z.jsx)(M,{intent:k.PRIMARY,text:c(`setup.downloadConfig`),icon:`download`,onClick:()=>{let e=Ce({profileKey:n,profileName:i,accessPointName:a,origin:window.location.origin}),t=new Blob([e],{type:`application/x-apple-aspen-config`}),r=URL.createObjectURL(t),o=document.createElement(`a`);o.href=r;let s=$(i,a),c=Se(window.location.origin);o.download=`dns_worker-${(s||c).replace(/[^a-zA-Z0-9_\-\u4e00-\u9fa5]/g,`_`).replace(/_+/g,`_`).replace(/^_|_$/g,``)}-${n}.mobileconfig`,o.click(),URL.revokeObjectURL(r)}})]}),(0,Z.jsx)(`p`,{className:`text-[10px] opacity-50 mt-4! text-center`,children:c(`setup.appleInstallHint`)})]})}),(0,Z.jsx)(R,{id:`windows`,title:(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(b,{size:16,className:`inline mr-2`}),c(`setup.windows`)]}),panel:(0,Z.jsxs)(`div`,{className:`space-y-4 md:ml-4 mt-4 md:mt-0`,children:[(0,Z.jsx)(j,{className:`font-bold`,children:c(`setup.windowsTitle`)}),(0,Z.jsxs)(`ol`,{className:`list-decimal list-inside space-y-4 text-sm leading-relaxed`,children:[(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`a`,{href:`ms-settings:network-status`,children:c(`setup.windowsStep0`)})}),(0,Z.jsx)(`li`,{children:c(`setup.windowsStep1`)}),(0,Z.jsxs)(`li`,{children:[c(`setup.windowsStep2`),(0,Z.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:o.map(e=>(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(U,{minimal:!0,interactive:!0,onClick:()=>t(e.ip),icon:`duplicate`,className:`font-mono`,children:e.ip}),(0,Z.jsx)(`span`,{className:`text-[9px] opacity-50 ml-1 font-mono`,children:e.area})]},e.ip))})]}),(0,Z.jsx)(`li`,{children:c(`setup.windowsStep3`)}),(0,Z.jsx)(`li`,{children:c(`setup.windowsStep4`)})]})]})}),(0,Z.jsx)(R,{id:`linux`,title:(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(u,{size:16,className:`inline mr-2`}),c(`setup.linux`)]}),panel:(0,Z.jsxs)(`div`,{className:`space-y-4 md:ml-4 mt-4 md:mt-0`,children:[(0,Z.jsx)(j,{className:`font-bold`,children:c(`setup.linuxTitle`)}),(0,Z.jsx)(`p`,{className:`text-sm`,children:c(`setup.linuxDesc`)}),(0,Z.jsxs)(`div`,{className:`mt-4`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-bold mb-2`,children:c(`setup.linuxStep1`)}),(0,Z.jsxs)(`div`,{className:`relative group`,children:[(0,Z.jsx)(`pre`,{className:`bg-gray-100 dark:bg-gray-800 p-4 rounded-lg overflow-x-auto text-xs font-mono border border-gray-200 dark:border-gray-700`,children:(0,Z.jsx)(`code`,{children:`curl -sL "${window.location.origin}/setup.sh?key=${n}&origin=${window.location.origin}" | sudo bash`})}),(0,Z.jsx)(M,{className:`absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity`,icon:`duplicate`,minimal:!0,small:!0,onClick:()=>{t(`curl -sL "${window.location.origin}/setup.sh?key=${n}&origin=${window.location.origin}" | sudo bash`)}})]})]}),(0,Z.jsx)(`div`,{className:`mt-4`,children:(0,Z.jsx)(`p`,{className:`text-sm font-bold`,children:c(`setup.linuxStep2`)})})]})}),(0,Z.jsx)(R,{id:`routeros`,title:(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(l,{size:16,className:`inline mr-2`}),c(`setup.routeros`)]}),panel:(0,Z.jsxs)(`div`,{className:`space-y-4 md:ml-4 mt-4 md:mt-0`,children:[(0,Z.jsx)(j,{className:`font-bold`,children:c(`setup.routerosTitle`)}),(0,Z.jsx)(`p`,{className:`text-sm`,children:c(`setup.routerosDesc`)}),(0,Z.jsxs)(`div`,{className:`mt-4`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-bold mb-2`,children:c(`setup.routerosStep1`)}),(0,Z.jsxs)(`div`,{className:`relative group`,children:[(0,Z.jsx)(`pre`,{className:`bg-gray-100 dark:bg-gray-800 p-4 rounded-lg overflow-x-auto text-xs font-mono border border-gray-200 dark:border-gray-700`,children:(0,Z.jsx)(`code`,{children:`/ip dns set use-doh-server="${window.location.origin}/${n}" verify-doh-cert=yes`})}),(0,Z.jsx)(M,{className:`absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity`,icon:`duplicate`,minimal:!0,small:!0,onClick:()=>{t(`/ip dns set use-doh-server="${window.location.origin}/${n}" verify-doh-cert=yes`)}})]})]}),(0,Z.jsx)(`p`,{className:`text-sm`,children:c(`setup.routerosNote`)}),(0,Z.jsxs)(`a`,{href:`https://help.mikrotik.com/docs/spaces/ROS/pages/37748767/DNS`,target:`_blank`,rel:`noreferrer`,className:`flex items-center gap-1 text-xs text-blue-500 hover:underline`,children:[(0,Z.jsx)(m,{size:10}),` `,c(`setup.routerosDocs`)]})]})}),(0,Z.jsx)(R,{id:`android`,title:(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(r,{size:16,className:`inline mr-2`}),c(`setup.android`)]}),panel:(0,Z.jsxs)(`div`,{className:`space-y-4 md:ml-4 mt-4 md:mt-0`,children:[(0,Z.jsx)(j,{className:`font-bold`,children:c(`setup.androidTitle`)}),(0,Z.jsx)(`p`,{className:`text-sm`,children:c(`setup.androidDesc`)}),d?(0,Z.jsxs)(E,{intent:k.WARNING,icon:`warning-sign`,className:`text-xs`,children:[(0,Z.jsx)(`div`,{className:`font-semibold mb-1`,children:c(`setup.dotUnavailableCfTitle`)}),(0,Z.jsx)(`div`,{children:c(`setup.dotUnavailableCfDesc`)})]}):(()=>{let e=/^(\d{1,3}\.){3}\d{1,3}$/.test(window.location.hostname)||window.location.hostname===`localhost`||window.location.hostname===`127.0.0.1`||window.location.hostname.includes(`:`),r=(s||``).trim().replace(/^\*\./,``),i=!J(r)&&r||(e?``:window.location.hostname);return(0,Z.jsxs)(`div`,{className:`p-4 bg-gray-50 dark:bg-gray-800/60 rounded-xl border border-gray-200 dark:border-gray-700 space-y-3`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-semibold text-gray-700 dark:text-gray-300`,children:c(`setup.androidDotTitle`,`私有 DNS (DoT / DoQ)`)}),(0,Z.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:c(`setup.androidDotDesc`,`支持 Android 原生“私有 DNS (DoT)”及各类现代 DoQ 客户端。提供商主机名:`)}),i?(0,Z.jsx)(`div`,{className:`space-y-3 pt-1`,children:(0,Z.jsx)(`div`,{className:`flex flex-col sm:flex-row sm:items-center gap-1.5 sm:gap-2`,children:(0,Z.jsx)(U,{minimal:!0,interactive:!0,onClick:()=>t(`${n}.${i}`),icon:`duplicate`,className:`font-mono text-xs sm:text-sm py-1 px-3 self-start`,intent:k.PRIMARY,children:`${n}.${i}`})})}):(0,Z.jsx)(E,{intent:k.WARNING,icon:`warning-sign`,className:`text-xs`,children:c(`setup.androidIpNotice`,`检测到当前通过 IP 或本地地址访问面板。DoT / DoQ 仅接受域名,请在 .env 中配置 SERVERFULL_DOT_DOMAIN (例如 dns.example.com) 后刷新。`)})]})})(),!d&&(0,Z.jsx)(E,{intent:k.PRIMARY,icon:`info-sign`,className:`text-xs`,children:c(`setup.androidWarning`)})]})})]})]})};function Te({profileId:e,accessPoints:t,onRefresh:n,toasterRef:r}){let{t:i}=v(),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(null),[p,m]=(0,X.useState)(``),[h,g]=(0,X.useState)(!1),[_,y]=(0,X.useState)(null),[b,x]=(0,X.useState)(null),[S,C]=(0,X.useState)(!1),[w,T]=(0,X.useState)(!1),[E,D]=(0,X.useState)(null),[O,A]=(0,X.useState)(!1),[j,M]=(0,X.useState)(``);return{isAddDialogOpen:a,setIsAddDialogOpen:o,newApName:s,setNewApName:c,isAdding:l,renameApId:d,setRenameApId:f,renameApName:p,setRenameApName:m,isRenaming:h,rotatingApId:_,deletingApId:b,newApNameFocused:S,setNewApNameFocused:C,renameApNameFocused:w,setRenameApNameFocused:T,rotateConfirmApId:E,setRotateConfirmApId:D,isSearchOpen:O,setIsSearchOpen:A,searchQuery:j,setSearchQuery:M,filteredAccessPoints:t.filter(e=>e.name.toLowerCase().includes(j.toLowerCase())||e.token.toLowerCase().includes(j.toLowerCase())),isValidApName:e=>le.test(e),handleAdd:async()=>{let a=s.trim();if(a){if(t.some(e=>e.name.toLowerCase()===a.toLowerCase())){r.current?.show({message:i(`setup.accessPointNameExists`,`Access Point name already exists`),intent:k.DANGER});return}u(!0);try{await ue(e,a),r.current?.show({message:i(`setup.accessPointCreated`),intent:k.SUCCESS}),o(!1),c(``),n()}catch(e){let t=e.message||`Failed to create access point`,n=t;if(t.startsWith(`Access point limit exceeded`)){let e=t.match(/\(max (\d+)\)/),r=e?e[1]:`100`;n=i(`setup.accessPointLimitExceeded`,{max:r,defaultValue:`Access Point limit exceeded (max ${r})`})}r.current?.show({message:n,intent:k.DANGER})}finally{u(!1)}}},handleRename:async()=>{let a=p.trim();if(!(!a||!d)){if(t.some(e=>e.id!==d&&e.name.toLowerCase()===a.toLowerCase())){r.current?.show({message:i(`setup.accessPointNameExists`,`Access Point name already exists`),intent:k.DANGER});return}g(!0);try{await ae(e,d,a),r.current?.show({message:i(`setup.accessPointRenamed`),intent:k.SUCCESS}),f(null),n()}catch(e){r.current?.show({message:e.message||`Failed to rename access point`,intent:k.DANGER})}finally{g(!1)}}},handleRotate:async t=>{y(t);try{await te(e,t),r.current?.show({message:i(`setup.tokenRotated`),intent:k.SUCCESS}),n()}catch(e){console.error(e)}finally{y(null)}},handleDelete:async t=>{if(confirm(i(`setup.deleteAccessPointConfirm`))){x(t);try{await me(e,t),r.current?.show({message:i(`setup.accessPointDeleted`),intent:k.SUCCESS}),n()}catch(e){console.error(e)}finally{x(null)}}}}}const Ee=({isOpen:e,onClose:t,newApName:n,setNewApName:r,newApNameFocused:i,setNewApNameFocused:a,handleAdd:o,isAdding:s,isValidApName:c})=>{let{t:l}=v();return(0,Z.jsxs)(B,{isOpen:e,onClose:t,title:l(`setup.addAccessPoint`),children:[(0,Z.jsx)(`div`,{className:N,children:(0,Z.jsx)(W,{content:l(`setup.accessPointNameFormatTip`,`1-30 characters, letters, numbers, hyphens and underscores allowed`),isOpen:i,position:P.TOP,intent:k.PRIMARY,className:`w-full`,children:(0,Z.jsx)(`div`,{className:`w-full block`,children:(0,Z.jsx)(L,{autoFocus:!0,large:!0,placeholder:l(`setup.accessPointName`),value:n,onChange:e=>r(e.target.value),onFocus:()=>a(!0),onBlur:()=>a(!1)})})})}),(0,Z.jsx)(`div`,{className:G,children:(0,Z.jsxs)(`div`,{className:T,children:[(0,Z.jsx)(M,{onClick:t,children:l(`common.cancel`,`Cancel`)}),(0,Z.jsx)(M,{intent:k.PRIMARY,onClick:o,loading:s,disabled:!c(n),children:l(`common.create`)})]})})]})},De=({isOpen:e,onClose:t,renameApName:n,setRenameApName:r,renameApNameFocused:i,setRenameApNameFocused:a,handleRename:o,isRenaming:s,isValidApName:c})=>{let{t:l}=v();return(0,Z.jsxs)(B,{isOpen:e,onClose:t,title:l(`setup.renameAccessPoint`),children:[(0,Z.jsx)(`div`,{className:N,children:(0,Z.jsx)(W,{content:l(`setup.accessPointNameFormatTip`,`1-30 characters, letters, numbers, hyphens and underscores allowed`),isOpen:i,position:P.TOP,intent:k.PRIMARY,className:`w-full`,children:(0,Z.jsx)(`div`,{className:`w-full block`,children:(0,Z.jsx)(L,{autoFocus:!0,large:!0,placeholder:l(`setup.accessPointName`),value:n,onChange:e=>r(e.target.value),onFocus:()=>a(!0),onBlur:()=>a(!1)})})})}),(0,Z.jsx)(`div`,{className:G,children:(0,Z.jsxs)(`div`,{className:T,children:[(0,Z.jsx)(M,{onClick:t,children:l(`common.cancel`,`Cancel`)}),(0,Z.jsx)(M,{intent:k.PRIMARY,onClick:o,loading:s,disabled:!c(n),children:l(`common.save`)})]})})]})},Oe=({ap:e,totalApCount:t,toasterRef:r,onRenameTrigger:i,rotateConfirmApId:o,setRotateConfirmApId:s,rotatingApId:c,handleRotate:l,deletingApId:u,handleDelete:f})=>{let{t:p}=v();return(0,Z.jsx)(H,{title:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(a,{size:16}),(0,Z.jsx)(`span`,{children:e.name})]}),className:`shadow-none! rounded-lg!`,children:(0,Z.jsxs)(F,{children:[(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`flex justify-between items-start gap-4`,children:[(0,Z.jsx)(`span`,{className:`text-xs opacity-50 mt-1`,children:`DoH URL`}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-mono bg-blue-50 text-blue-600 dark:bg-blue-900/20 dark:text-blue-400 px-2 py-1 rounded cursor-pointer hover:bg-blue-100 dark:hover:bg-blue-900/40 transition-colors break-all`,onClick:()=>{navigator.clipboard.writeText(`${window.location.origin}/${e.token}`),r.current?.show({message:p(`setup.copied`),intent:k.SUCCESS})},title:p(`setup.copyUrl`),children:[(0,Z.jsx)(`span`,{className:`select-all`,children:`${window.location.origin}/${e.token}`}),(0,Z.jsx)(h,{size:14,className:`shrink-0`})]})]}),(0,Z.jsxs)(`div`,{className:`flex justify-between items-start gap-4`,children:[(0,Z.jsx)(`span`,{className:`text-xs opacity-50 mt-1`,children:p(`setup.accessPointToken`)}),(0,Z.jsx)(`span`,{className:`text-sm font-mono bg-gray-100 dark:bg-gray-800 px-2 py-1 rounded select-all break-all`,children:e.token})]}),(0,Z.jsxs)(`div`,{className:`flex justify-between items-start gap-4`,children:[(0,Z.jsx)(`span`,{className:`text-xs opacity-50 mt-1`,children:`Created`}),(0,Z.jsx)(`span`,{className:`text-sm`,children:pe(new Date(e.created_at*1e3))})]})]}),(0,Z.jsxs)(`div`,{className:`mt-4 flex gap-2 flex-wrap`,children:[(0,Z.jsx)(M,{small:!0,icon:(0,Z.jsx)(d,{size:14}),text:p(`setup.renameAccessPoint`),onClick:()=>i(e.id,e.name)}),(0,Z.jsx)(D,{isOpen:o===e.id,onInteraction:e=>{e||s(null)},content:(0,Z.jsxs)(`div`,{className:`p-4 space-y-3 dark:bg-gray-800 dark:text-white max-w-xs`,children:[(0,Z.jsx)(`p`,{className:`text-xs font-semibold leading-relaxed`,children:p(`setup.rotateTokenConfirmDesc`,`Rotating the key will immediately disconnect devices using the old key. Are you sure you want to continue?`)}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Z.jsx)(M,{small:!0,minimal:!0,text:p(`common.cancel`,`Cancel`),onClick:()=>s(null)}),(0,Z.jsx)(M,{small:!0,intent:k.DANGER,text:p(`common.confirm`,`Confirm`),onClick:()=>{s(null),l(e.id)}})]})]}),placement:`top`,children:(0,Z.jsx)(M,{small:!0,icon:(0,Z.jsx)(n,{size:14}),text:p(`setup.rotateToken`),loading:c===e.id,onClick:()=>s(e.id)})}),(0,Z.jsx)(M,{small:!0,intent:k.DANGER,icon:(0,Z.jsx)(S,{size:14}),text:p(`setup.deleteAccessPoint`),loading:u===e.id,onClick:()=>f(e.id),disabled:t<=1,title:t<=1?`Cannot delete the only access point`:void 0})]})]})})},ke=({isOpen:e,onClose:t,profileId:n,isMobile:r,accessPoints:i,loading:a,onRefresh:s,toasterRef:c})=>{let{t:l}=v(),{isAddDialogOpen:u,setIsAddDialogOpen:d,newApName:p,setNewApName:m,isAdding:h,renameApId:g,setRenameApId:_,renameApName:y,setRenameApName:b,isRenaming:x,rotatingApId:S,deletingApId:C,newApNameFocused:w,setNewApNameFocused:T,renameApNameFocused:E,setRenameApNameFocused:D,rotateConfirmApId:A,setRotateConfirmApId:j,isSearchOpen:N,setIsSearchOpen:P,searchQuery:F,setSearchQuery:I,filteredAccessPoints:R,isValidApName:z,handleAdd:B,handleRename:V,handleRotate:H,handleDelete:U}=Te({profileId:n,accessPoints:i,onRefresh:s,toasterRef:c});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(_e,{isOpen:e,onClose:t,title:N?(0,Z.jsx)(L,{leftIcon:`search`,placeholder:l(`setup.searchAccessPoints`,`Search...`),value:F,onChange:e=>I(e.target.value),rightElement:(0,Z.jsx)(M,{icon:`cross`,minimal:!0,onClick:()=>{P(!1),I(``)}}),autoFocus:!0}):(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{children:l(`setup.manageAccessPoints`)}),(0,Z.jsx)(M,{icon:(0,Z.jsx)(o,{size:14}),minimal:!0,onClick:()=>P(!0),className:`opacity-50 hover:opacity-100`})]}),icon:`diagram-tree`,size:r?`100%`:`450px`,children:[(0,Z.jsx)(M,{fill:!0,intent:k.PRIMARY,icon:(0,Z.jsx)(f,{size:16}),text:l(`setup.addAccessPoint`),onClick:()=>d(!0),large:!0}),a?(0,Z.jsx)(`div`,{className:`flex justify-center p-8`,children:(0,Z.jsx)(O,{})}):(0,Z.jsx)(`div`,{className:`space-y-4 mt-4`,children:R.map(e=>(0,Z.jsx)(Oe,{ap:e,totalApCount:i.length,toasterRef:c,onRenameTrigger:(e,t)=>{_(e),b(t)},rotateConfirmApId:A,setRotateConfirmApId:j,rotatingApId:S,handleRotate:H,deletingApId:C,handleDelete:U},e.id))})]}),(0,Z.jsx)(Ee,{isOpen:u,onClose:()=>{d(!1),m(``)},newApName:p,setNewApName:m,newApNameFocused:w,setNewApNameFocused:T,handleAdd:B,isAdding:h,isValidApName:z}),(0,Z.jsx)(De,{isOpen:!!g,onClose:()=>_(null),renameApName:y,setRenameApName:b,renameApNameFocused:E,setRenameApNameFocused:D,handleRename:V,isRenaming:x,isValidApName:z})]})},Ae=({profileId:e,profileKey:t,profileName:n,toasterRef:r})=>{let i=fe(),{t:a}=v(),[o,s]=(0,X.useState)([]),[c,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(null),m=async()=>{l(!0);try{s(await de(e))}catch(e){console.error(e)}finally{l(!1)}};(0,X.useEffect)(()=>{m()},[e]);let[h,g]=(0,X.useState)(n||``);(0,X.useEffect)(()=>{n?g(n):e&&he(e).then(e=>{e?.name&&g(e.name)}).catch(()=>{})},[e,n]);let _=(0,X.useMemo)(()=>o.length===0?null:o.find(e=>e.id===f)||o[0],[o,f]),y=_?_.token:t,b=_?_.name:void 0,x=`${window.location.origin}/${y}`,[S,C]=(0,X.useState)(null),[w,T]=(0,X.useState)(!1),[E,D]=(0,X.useState)(!1),[O,A]=(0,X.useState)(!1),[j,M]=(0,X.useState)(null),[N,P]=(0,X.useState)(null),[F,I]=(0,X.useState)({ipv4:[],ipv6:[]}),[L,R]=(0,X.useState)(null),z=e=>{navigator.clipboard.writeText(e),r?.current?.show({message:a(`setup.copied`),intent:k.SUCCESS})},B=async()=>{T(!0),R(null);try{let[t,n]=await Promise.all([ne(),se()]);if(t.ip&&(t.country===`UNKNOWN`||!t.country))try{let e=await fetch(`/api/geoip?ip=${encodeURIComponent(t.ip)}`);if(e.ok){let n=await e.json();n.success&&(n.country&&(t.country=n.country),n.region&&(t.region=n.region),n.city&&(t.city=n.city),n.timezone?.id&&(t.timezone=n.timezone.id),n.connection?.org&&(t.asOrganization=n.connection.org))}}catch{}C(t),M(n),t.timezone&&t.timezone!==`UNKNOWN`&&ce(t.timezone);let r=window.location.hostname===`localhost`||window.location.hostname===`127.0.0.1`||window.location.hostname===`::1`||window.location.hostname.startsWith(`192.168.`)||window.location.hostname.startsWith(`10.`)||/^172\.(1[6-9]|2\d|3[01])\./.test(window.location.hostname),i=!!(t.dotDomain&&!J(t.dotDomain));oe(r&&i||i?t.dotDomain:window.location.hostname||``).then(e=>P(e)).catch(e=>console.warn(`Failed fetching domain geo location:`,e));let a=t.substituteDomain||`www.okx.com`;re().then(e=>{I(t=>t.ipv4.length>0||t.ipv6.length>0?t:{ipv4:e.ip?[e.ip]:[],ipv6:e.ipv6?[e.ipv6]:[]})}).catch(()=>{}),ie(a).then(e=>{(e.ipv4.length>0||e.ipv6.length>0)&&I(e)}).catch(e=>console.warn(`Failed resolving substitute domain DNS IPs:`,e)),R({success:!!t.connectedProfileId,profileMatch:t.connectedProfileId===e})}catch(e){console.error(`Verification failed`,e)}finally{T(!1)}};(0,X.useEffect)(()=>{B()},[e]);let V=(0,X.useMemo)(()=>{let e=[],t=(F.ipv4||[]).slice(0,2),n=(F.ipv6||[]).slice(0,2),r=S?.substituteDomain||`www.okx.com`;for(let n of t)e.push({ip:n,area:`${r} IPv4`});for(let t of n)e.push({ip:t,area:`${r} IPv6`});return e},[F,S?.substituteDomain]);return(0,Z.jsxs)(`div`,{className:`mx-auto space-y-8 pb-24 ${i?`p-1`:`px-8 max-w-5xl`}`,children:[(0,Z.jsx)(ve,{isMobile:i}),(0,Z.jsx)(ye,{isVerifying:w,verifyResult:L,handleVerify:B,isMobile:i,clientInfo:S,showIp:E,setShowIp:D,showLocation:O,setShowLocation:A,traceInfo:j,edgeLocation:N}),(0,Z.jsx)(be,{accessPoints:o,selectedApId:_?.id||null,onSelectAp:p,accessPointName:b,onManageAccessPoints:()=>d(!0),isMobile:i}),(0,Z.jsx)(xe,{dohUrl:x,copyToClipboard:z,isMobile:i}),(0,Z.jsx)(we,{isMobile:i,copyToClipboard:z,profileKey:y,profileName:h||void 0,accessPointName:b,currentIps:V,dotDomain:S?.dotDomain}),(0,Z.jsx)(ke,{isOpen:u,onClose:()=>d(!1),profileId:e,isMobile:i,accessPoints:o,loading:c,onRefresh:m,toasterRef:r})]})};export{Ae as SetupView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-C4Xdq4VV.js";import{B as t,C as n,H as r,I as i,M as a,N as o,S as s,at as c,et as l,gt as u,ht as d,nn as f,ut as p,w as m,x as h}from"./vendor-react-DYK5a2J9.js";import{S as g,b as _}from"./vendor-icons-other-BTYC6Wvz.js";import"./vendor-i18next-DlmslyBB.js";import{C as v,E as y,H as b,M as x,N as S,P as C,S as w,U as T,_ as E,d as D,f as O,h as k,k as A,p as j,r as M,u as N}from"./vendor-ui-core-CodM8CpF.js";import{_t as P}from"./vendor-utils-Bab4qB3W.js";import{B as F,F as I,I as L,K as R,L as z,Lt as B,M as V,N as H,P as U,R as W,V as G,d as K,gn as q,h as J,l as ee,o as te,u as ne,z as Y}from"./index-DAjmisEt.js";import{t as X}from"./async-R_IFRE5c.js";var Z=e(g(),1),Q=e(_(),1);const $=({users:e,currentUserId:t,onRefresh:n,registrationEnabled:r=!0,maxUsers:i,onRefreshSettings:o,onSavingChange:s,toasterRef:c})=>{let{t:l}=f(),[u,d]=(0,Z.useState)(!1),[p,g]=(0,Z.useState)(``),[_,v]=(0,Z.useState)(``),[y,S]=(0,Z.useState)(`user`),[E,P]=(0,Z.useState)(!1),[F,I]=(0,Z.useState)(!1),[L,R]=(0,Z.useState)(r),[z,B]=(0,Z.useState)(!1),U=i!=null&&i!==``?parseInt(String(i),10):0,W=U>0&&e.length>=U;(0,Z.useEffect)(()=>{R(r)},[r]);let q=async e=>{let t=L;R(e),B(!0),s?.(!0);try{await X(G({registration_enabled:String(e)}),1e4),c?.current?.show({message:l(`common.saveSuccess`,`保存成功`),intent:b.SUCCESS,icon:`tick`}),o?.()}catch(e){console.error(e),R(t),c?.current?.show({message:e.message||l(`common.saveFailed`,`保存失败`),intent:b.DANGER,icon:`error`})}finally{B(!1),s?.(!1)}},Y=async()=>{if(!ee.test(p)){alert(l(`account.formatTipUsername`));return}if(!te.test(_)){alert(l(`account.formatTipPassword`));return}P(!0);try{await V({username:p,password:await K(_,p),role:y}),d(!1),g(``),v(``),I(!1),n()}catch(e){console.error(e),alert(ne(e,l))}finally{P(!1)}},$=async e=>{if(confirm(l(`account.confirmDeleteUser`)))try{await H(e),n()}catch(e){console.error(e)}};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(a,{size:20,className:`text-red-500`}),(0,Q.jsx)(x,{style:{margin:0},children:l(`account.userManagement`)}),U>0?(0,Q.jsxs)(M,{minimal:!0,intent:W?b.DANGER:b.PRIMARY,round:!0,children:[e.length,` / `,U]}):(0,Q.jsx)(M,{minimal:!0,round:!0,children:e.length})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-4 flex-wrap`,children:[(0,Q.jsx)(k,{label:l(`account.enableRegistration`,`开放新用户注册`),checked:L,disabled:z,onChange:e=>q(e.currentTarget.checked),className:`mb-0`}),(0,Q.jsx)(C,{className:`whitespace-nowrap`,icon:(0,Q.jsx)(h,{size:16}),intent:b.SUCCESS,text:l(`account.createUser`),disabled:W,title:W?l(`auth.maxUsersReached`,`当前系统已达到用户数量上限,无法创建新用户。`):void 0,onClick:()=>d(!0)})]})]}),(0,Q.jsx)(w,{elevation:T.ONE,className:`p-0 overflow-hidden overflow-x-auto`,children:(0,Q.jsxs)(N,{interactive:!0,striped:!0,className:`w-full whitespace-nowrap`,children:[(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`th`,{className:`whitespace-nowrap`,children:l(`account.username`)}),(0,Q.jsx)(`th`,{className:`whitespace-nowrap`,children:l(`account.role`)}),(0,Q.jsx)(`th`,{className:`whitespace-nowrap`,children:`MFA`}),(0,Q.jsx)(`th`,{className:`whitespace-nowrap`,children:`ID`}),(0,Q.jsx)(`th`,{className:`whitespace-nowrap`,children:l(`account.createdAt`)}),(0,Q.jsx)(`th`,{className:`whitespace-nowrap`,children:l(`account.lastActive`)}),(0,Q.jsx)(`th`,{className:`whitespace-nowrap`,children:l(`account.lastResolve`)}),(0,Q.jsx)(`th`,{className:`text-right whitespace-nowrap`,children:l(`account.actions`)})]})}),(0,Q.jsx)(`tbody`,{children:e.map(e=>(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`td`,{className:`font-bold whitespace-nowrap`,children:e.username}),(0,Q.jsx)(`td`,{className:`whitespace-nowrap`,children:(0,Q.jsx)(M,{minimal:!0,intent:e.role===`admin`?b.DANGER:b.NONE,className:`whitespace-nowrap`,children:e.role===`admin`?l(`account.roleAdmin`):l(`account.roleUser`)})}),(0,Q.jsx)(`td`,{className:`whitespace-nowrap`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[!!e.totp_enabled&&(0,Q.jsx)(M,{minimal:!0,intent:b.SUCCESS,className:`whitespace-nowrap`,children:`TOTP`}),!!(e.passkeys_count&&e.passkeys_count>0)&&(0,Q.jsx)(M,{minimal:!0,intent:b.PRIMARY,className:`whitespace-nowrap`,children:`Passkey`}),!e.totp_enabled&&!(e.passkeys_count&&e.passkeys_count>0)&&(0,Q.jsx)(M,{minimal:!0,intent:b.NONE,style:{color:`#8a9ba8`},className:`whitespace-nowrap`,children:l(`account.mfaNone`,`无`)})]})}),(0,Q.jsx)(`td`,{className:`whitespace-nowrap`,children:(0,Q.jsx)(`code`,{className:`text-xs`,children:e.id})}),(0,Q.jsx)(`td`,{className:`text-xs text-gray-500 whitespace-nowrap`,children:e.created_at?J(new Date(e.created_at*1e3)):`-`}),(0,Q.jsx)(`td`,{className:`text-xs text-gray-500 whitespace-nowrap`,children:e.last_active_at?J(new Date(e.last_active_at*1e3)):`-`}),(0,Q.jsx)(`td`,{className:`text-xs text-gray-500 whitespace-nowrap`,children:e.last_resolve_at?J(new Date(e.last_resolve_at*1e3)):`-`}),(0,Q.jsx)(`td`,{className:`text-right whitespace-nowrap`,children:(0,Q.jsx)(`div`,{className:`inline-flex items-center gap-1`,children:(0,Q.jsx)(C,{minimal:!0,intent:b.DANGER,icon:(0,Q.jsx)(m,{size:14}),disabled:e.id===t,onClick:()=>$(e.id)})})})]},e.id))})]})}),(0,Q.jsx)(A,{isOpen:u,onClose:()=>{d(!1),I(!1)},title:l(`account.createNewUser`),icon:`user`,children:(0,Q.jsxs)(`div`,{className:`p-6 space-y-4`,children:[(0,Q.jsx)(j,{label:l(`account.username`),children:(0,Q.jsx)(O,{value:p,onChange:e=>g(e.target.value),placeholder:l(`auth.usernamePlaceholder`)})}),(0,Q.jsx)(j,{label:l(`account.initialPassword`),children:(0,Q.jsx)(O,{type:F?`text`:`password`,value:_,onChange:e=>v(e.target.value),placeholder:l(`auth.passwordPlaceholder`),rightElement:(0,Q.jsx)(C,{minimal:!0,icon:F?`eye-open`:`eye-off`,onClick:()=>I(!F),title:F?l(`auth.hidePassword`,`Hide password`):l(`auth.showPassword`,`Show password`)})})}),(0,Q.jsx)(j,{label:l(`account.userRole`),children:(0,Q.jsx)(D,{fill:!0,value:y,onChange:e=>S(e.target.value),options:[{label:l(`account.roleUser`),value:`user`},{label:l(`account.roleAdmin`),value:`admin`}]})}),(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2 mt-6`,children:[(0,Q.jsx)(C,{text:l(`account.cancel`),onClick:()=>d(!1)}),(0,Q.jsx)(C,{intent:b.PRIMARY,text:l(`account.createNow`),loading:E,onClick:Y})]})]})})]})},re=({toasterRef:e,onSavingChange:t})=>{let{t:n}=f(),[r,a]=(0,Z.useState)(``),[o,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)([]),[g,_]=(0,Z.useState)(null),[D,k]=(0,Z.useState)(null),[A,N]=(0,Z.useState)([]),[P,F]=(0,Z.useState)(!1),[I,z]=(0,Z.useState)(null),[B,V]=(0,Z.useState)(null),H=(0,Z.useCallback)(async()=>{F(!0);try{N(await L())}catch(e){console.warn(`Failed to fetch distributed filter lists`,e)}finally{F(!1)}},[]);(0,Z.useEffect)(()=>{R().then(e=>{e&&Array.isArray(e)&&h(e.map(e=>({label:String(n(e.label,{defaultValue:e.label})),url:String(e.url||``)})))}).catch(e=>console.warn(`Failed to fetch preset filters`,e)),H()},[n,H]);let W=async()=>{let i=r.trim();if(i){p(!0),k(null),_(null),t?.(!0);try{let t=await U(i);_(t),a(``);let r=t.failedCount>0?n(`admin.distributeFilter.toastPartialSuccess`,`系统过滤列表已下发至 {{added}} 位用户,{{failed}} 位用户下发失败`,{added:t.addedCount,failed:t.failedCount}):n(`admin.distributeFilter.toastSuccess`,`系统过滤列表已成功下发至 {{count}} 位用户`,{count:t.addedCount});e?.current?.show({message:r,intent:t.failedCount>0&&t.addedCount===0?b.DANGER:t.failedCount>0?b.WARNING:b.SUCCESS,icon:t.failedCount>0&&t.addedCount===0?`error`:`tick`}),await H()}catch(t){let n=t instanceof Error?t.message:String(t);k(n),e?.current?.show({message:n,intent:b.DANGER,icon:`error`})}finally{p(!1),t?.(!1)}}},G=async r=>{z(r),V(null),t?.(!0);try{let t=await Y(r);e?.current?.show({message:n(`admin.distributeFilter.toastRevokeSuccess`,`已成功撤回系统过滤列表,移除了 {{count}} 位用户的系统规则`,{count:t.revokedCount}),intent:b.SUCCESS,icon:`tick`}),await H()}catch(t){let n=t instanceof Error?t.message:String(t);e?.current?.show({message:n,intent:b.DANGER,icon:`error`})}finally{z(null),t?.(!1)}};return(0,Q.jsxs)(w,{elevation:T.ZERO,className:`p-6 border border-gray-200 dark:border-gray-800 rounded-xl space-y-6`,children:[(0,Q.jsx)(`div`,{className:`flex items-start justify-between`,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(x,{className:`flex items-center space-x-2 text-base font-semibold`,children:[(0,Q.jsx)(i,{className:`w-5 h-5 text-indigo-500`}),(0,Q.jsx)(`span`,{children:n(`admin.distributeFilter.title`,`系统过滤列表 (管理员)`)})]}),(0,Q.jsx)(`p`,{className:`text-sm text-gray-500 dark:text-gray-400 mt-1`,children:n(`admin.distributeFilter.description`,`向系统中所有用户账号下发系统级过滤列表。规则自动继承并应用于所有用户账号,带有“系统”标签。如果用户已存在相同规则则自动跳过。`)})]})}),m.length>0&&(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`text-xs font-medium text-gray-500 dark:text-gray-400 flex items-center space-x-1`,children:[(0,Q.jsx)(c,{className:`w-3.5 h-3.5`}),(0,Q.jsx)(`span`,{children:n(`admin.distributeFilter.quickPresets`,`快捷预设`)})]}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:m.map(e=>(0,Q.jsx)(C,{minimal:!0,small:!0,className:`text-xs`,intent:r===e.url?b.PRIMARY:b.NONE,onClick:()=>a(e.url),children:e.label},e.url))})]}),(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(j,{label:n(`admin.distributeFilter.urlLabel`,`规则列表 URL`),labelFor:`distribute-filter-url`,helperText:n(`admin.distributeFilter.urlHelper`,`支持 AdGuard、Hosts、EasyList 等标准格式 URL`),children:(0,Q.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-3`,children:[(0,Q.jsx)(O,{id:`distribute-filter-url`,fill:!0,placeholder:`https://example.com/filter.txt`,value:r,onChange:e=>a(e.target.value),disabled:o,className:`font-mono text-sm`,onKeyDown:e=>{e.key===`Enter`&&r.trim()&&!o&&W()}}),(0,Q.jsx)(C,{intent:b.PRIMARY,icon:(0,Q.jsx)(i,{className:`w-4 h-4 mr-1`}),text:n(`admin.distributeFilter.submitBtn`,`立即下发`),loading:o,disabled:!r.trim(),onClick:W,className:`shrink-0`})]})}),D&&(0,Q.jsxs)(v,{intent:b.DANGER,icon:null,children:[(0,Q.jsxs)(S,{className:`flex items-center gap-2 mb-2 font-semibold`,children:[(0,Q.jsx)(d,{className:`w-4 h-4 shrink-0`}),(0,Q.jsx)(`span`,{children:n(`common.error`,`错误`)})]}),(0,Q.jsx)(`div`,{className:`text-sm`,children:D})]}),g&&(0,Q.jsxs)(v,{intent:g.failedCount>0?g.addedCount>0?b.WARNING:b.DANGER:b.SUCCESS,icon:null,children:[(0,Q.jsxs)(S,{className:`flex items-center gap-2 mb-2 font-semibold`,children:[g.failedCount>0&&g.addedCount===0?(0,Q.jsx)(d,{className:`w-4 h-4 shrink-0 text-red-500`}):(0,Q.jsx)(u,{className:`w-4 h-4 shrink-0 text-green-500`}),(0,Q.jsx)(`span`,{children:n(`admin.distributeFilter.resultTitle`,`下发执行完成`)})]}),(0,Q.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,Q.jsx)(`p`,{children:g.failedCount>0?n(`admin.distributeFilter.resultSummaryWithFailed`,`系统共 {{total}} 位用户:成功下发至 {{added}} 位用户,跳过 {{skipped}} 位已存在该规则的用户,{{failed}} 位用户下发失败。`,{total:g.totalUsers,added:g.addedCount,skipped:g.skippedCount,failed:g.failedCount}):n(`admin.distributeFilter.resultSummary`,`系统共 {{total}} 位用户:成功下发至 {{added}} 位用户,跳过 {{skipped}} 位已存在该规则的用户。`,{total:g.totalUsers,added:g.addedCount,skipped:g.skippedCount})}),g.addedUsernames.length>0&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 pt-1`,children:[(0,Q.jsxs)(`span`,{className:`text-xs font-medium text-gray-500`,children:[n(`admin.distributeFilter.addedUsers`,`下发成功用户`),`:`]}),g.addedUsernames.map(e=>(0,Q.jsx)(M,{intent:b.SUCCESS,minimal:!0,round:!0,children:e},e))]}),g.skippedUsernames.length>0&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 pt-1`,children:[(0,Q.jsxs)(`span`,{className:`text-xs font-medium text-gray-500`,children:[n(`admin.distributeFilter.skippedUsers`,`已存在规则用户`),`:`]}),g.skippedUsernames.map(e=>(0,Q.jsx)(M,{intent:b.NONE,minimal:!0,round:!0,children:e},e))]}),g.failedUsernames.length>0&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 pt-1`,children:[(0,Q.jsxs)(`span`,{className:`text-xs font-medium text-red-500 dark:text-red-400`,children:[n(`admin.distributeFilter.failedUsers`,`下发失败用户`),`:`]}),g.failedUsernames.map(e=>(0,Q.jsx)(M,{intent:b.DANGER,minimal:!0,round:!0,children:e},e))]})]})]})]}),(0,Q.jsx)(E,{}),(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsxs)(`div`,{className:`text-sm font-semibold flex items-center space-x-2`,children:[(0,Q.jsx)(l,{className:`w-4 h-4 text-indigo-500`}),(0,Q.jsx)(`span`,{children:n(`admin.distributeFilter.activeDistributedTitle`,`已下发系统规则`)})]}),A.length>0&&(0,Q.jsx)(M,{minimal:!0,round:!0,intent:b.PRIMARY,children:A.length})]}),(0,Q.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:n(`admin.distributeFilter.activeDistributedDesc`,`当前处于系统下发状态且带有“系统”标签的规则列表。撤回后将从所有用户账号中移除此系统规则,用户自建的同名规则不受影响。`)}),P?(0,Q.jsx)(`div`,{className:`text-xs text-gray-400 py-3 text-center`,children:n(`common.loading`,`加载中...`)}):A.length===0?(0,Q.jsx)(`div`,{className:`text-xs text-gray-400 dark:text-gray-500 py-4 px-3 bg-gray-50 dark:bg-gray-800/50 rounded-lg text-center border border-dashed border-gray-200 dark:border-gray-700`,children:n(`admin.distributeFilter.noDistributedFilters`,`当前系统中无已下发的系统过滤列表`)}):(0,Q.jsx)(`div`,{className:`divide-y divide-gray-100 dark:divide-gray-800 border border-gray-200 dark:border-gray-800 rounded-lg overflow-hidden`,children:A.map(e=>(0,Q.jsxs)(`div`,{className:`p-3 bg-white dark:bg-gray-900 flex flex-col sm:flex-row sm:items-center justify-between gap-3 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,Q.jsx)(`div`,{className:`font-mono text-xs text-gray-800 dark:text-gray-200 truncate select-all`,title:e.url,children:e.url}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-xs text-gray-500`,children:[(0,Q.jsx)(M,{minimal:!0,round:!0,intent:b.PRIMARY,children:n(`admin.distributeFilter.usersCount`,`{{count}} 位用户`,{count:e.userCount})}),e.usernames.length>0&&(0,Q.jsxs)(`span`,{className:`text-xs text-gray-400 truncate max-w-xs`,children:[`(`,e.usernames.join(`, `),`)`]})]})]}),(0,Q.jsx)(`div`,{className:`shrink-0`,children:(0,Q.jsx)(y,{isOpen:B===e.url,onInteraction:t=>V(t?e.url:null),placement:`top-end`,portalClassName:`z-20000`,content:(0,Q.jsxs)(`div`,{className:`p-3 space-y-3 max-w-xs`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-semibold leading-relaxed m-0 text-gray-800 dark:text-gray-200`,children:n(`admin.distributeFilter.revokeConfirm`,`确定撤回此系统过滤列表?系统将从所有用户账号中移除此系统规则,用户自建的同名规则不受影响。`)}),(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Q.jsx)(C,{small:!0,variant:`minimal`,text:n(`common.cancel`,`取消`),onClick:()=>V(null)}),(0,Q.jsx)(C,{small:!0,intent:b.DANGER,loading:I===e.url,text:n(`admin.distributeFilter.confirmRevoke`,`确认撤回`),onClick:()=>G(e.url)})]})]}),children:(0,Q.jsx)(C,{small:!0,intent:b.DANGER,minimal:!0,icon:(0,Q.jsx)(s,{className:`w-3.5 h-3.5`}),text:n(`admin.distributeFilter.revokeBtn`,`撤回`),loading:I===e.url,onClick:()=>V(e.url)})})})]},e.url))})]})]})},ie=({initialSettings:e,onRefresh:t,onSavingChange:n,toasterRef:r})=>{let{t:i}=f(),[a,s]=(0,Z.useState)(e),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1);return(0,Z.useEffect)(()=>{s(e)},[e]),(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(o,{size:20,className:`text-gray-500`}),(0,Q.jsx)(x,{style:{margin:0},children:i(`account.systemSettings`,`System Settings`)})]}),(0,Q.jsxs)(w,{elevation:T.ONE,children:[(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-x-8 gap-y-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(x,{className:`text-sm font-bold opacity-70 text-blue-500`,children:`Cloudflare Turnstile`}),(0,Q.jsx)(j,{label:`Site Key`,children:(0,Q.jsx)(O,{value:a.turnstile_site_key||``,onChange:e=>s({...a,turnstile_site_key:e.target.value}),placeholder:`0x000...`})}),(0,Q.jsx)(j,{label:`Secret Key`,children:(0,Q.jsx)(O,{type:u?`text`:`password`,value:a.turnstile_secret_key||``,onChange:e=>s({...a,turnstile_secret_key:e.target.value}),placeholder:`0x000...`,rightElement:(0,Q.jsx)(C,{minimal:!0,icon:u?`eye-open`:`eye-off`,onClick:()=>d(!u),title:u?i(`auth.hidePassword`,`Hide password`):i(`auth.showPassword`,`Show password`)})})})]}),(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(x,{className:`text-sm font-bold opacity-70 text-green-500`,children:i(`account.featureToggle`,`Feature Toggle`)}),(0,Q.jsx)(k,{label:i(`account.enableTurnstileSignup`,`Enable verification on Signup`),checked:a.turnstile_enabled_signup===`true`,onChange:e=>s({...a,turnstile_enabled_signup:String(e.currentTarget.checked)})}),(0,Q.jsx)(k,{label:i(`account.enableTurnstileLogin`,`Enable verification on Login`),checked:a.turnstile_enabled_login===`true`,onChange:e=>s({...a,turnstile_enabled_login:String(e.currentTarget.checked)})}),(0,Q.jsx)(E,{className:`my-2`}),(0,Q.jsx)(x,{className:`text-sm font-bold opacity-70 text-indigo-500`,children:i(`account.userLimits`,`User Quota`)}),(0,Q.jsx)(j,{label:i(`account.maxUsers`,`Max Users`),helperText:i(`account.maxUsersHelper`,`Maximum number of users allowed in the system (0 for unlimited).`),children:(0,Q.jsx)(O,{type:`number`,min:0,value:a.max_users||``,onChange:e=>s({...a,max_users:e.target.value}),placeholder:`0`})})]})]}),(0,Q.jsx)(E,{className:`my-4`}),(0,Q.jsx)(`div`,{className:`flex justify-end`,children:(0,Q.jsx)(C,{intent:b.PRIMARY,icon:`floppy-disk`,text:i(`common.save`,`Save`),loading:c,onClick:async()=>{l(!0),n?.(!0);try{await X(G({turnstile_site_key:a.turnstile_site_key||``,turnstile_secret_key:a.turnstile_secret_key||``,turnstile_enabled_signup:a.turnstile_enabled_signup||`false`,turnstile_enabled_login:a.turnstile_enabled_login||`false`,max_users:a.max_users||`0`}),1e4),r?.current?.show({message:i(`common.saveSuccess`,`保存成功`),intent:b.SUCCESS,icon:`tick`}),t()}catch(t){console.error(t),s(e),r?.current?.show({message:t.message||i(`common.saveFailed`,`保存失败`),intent:b.DANGER,icon:`error`})}finally{l(!1),n?.(!1)}}})})]})]})},ae=({status:e,onRefresh:n,toasterRef:i})=>{let{t:a}=f(),[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(!1),m=e?.migrations,h=m?.completed??!1;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(p,{size:20,className:`text-gray-500`}),(0,Q.jsx)(x,{style:{margin:0},children:a(`account.databaseSettings`,`数据库 (管理员)`)})]}),m?(0,Q.jsx)(M,{large:!0,round:!0,intent:h?b.SUCCESS:b.WARNING,icon:h?(0,Q.jsx)(u,{size:16}):(0,Q.jsx)(d,{size:16}),className:`whitespace-nowrap self-start sm:self-auto`,children:h?a(`account.migrationCompleted`,`迁移已完成`):a(`account.migrationPending`,`有待执行迁移`)}):(0,Q.jsx)(M,{large:!0,round:!0,intent:b.NONE,className:`whitespace-nowrap self-start sm:self-auto`,children:a(`common.loading`,`加载中...`)})]}),(0,Q.jsx)(w,{elevation:T.ONE,children:(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`span`,{className:`text-xs uppercase font-semibold text-gray-500 tracking-wider`,children:a(`account.databaseEngine`,`数据库服务`)}),(0,Q.jsx)(`div`,{className:`text-sm font-medium mt-1`,children:(e=>e===`Turso`?`Turso (libSQL)`:e===`D1`?`Cloudflare D1`:e===`File`?`SQLite (Local File)`:e||`SQLite`)(e?.databaseService)})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`span`,{className:`text-xs uppercase font-semibold text-gray-500 tracking-wider`,children:a(`account.lastAppliedMigration`,`最近应用版本`)}),(0,Q.jsx)(`div`,{className:`text-sm font-medium font-mono text-gray-700 dark:text-gray-300 mt-1 truncate`,children:m?.lastApplied||a(`account.noMigrationsApplied`,`无`)})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`span`,{className:`text-xs uppercase font-semibold text-gray-500 tracking-wider`,children:a(`account.migrationStatus`,`架构状态`)}),(0,Q.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-gray-300 mt-1`,children:m?h?a(`account.migrationCompletedDesc`,{total:m?.totalAvailable||0}):a(`account.migrationPendingDesc`,{applied:m?.appliedCount||0,total:m?.totalAvailable||0,pending:m?.pendingCount||0}):a(`common.loading`,`加载中...`)})]}),!h&&m&&m.pendingFiles.length>0&&(0,Q.jsxs)(v,{intent:b.WARNING,icon:null,children:[(0,Q.jsxs)(S,{className:`flex items-center gap-2 mb-1 text-xs font-semibold`,children:[(0,Q.jsx)(d,{className:`w-4 h-4 shrink-0`}),(0,Q.jsx)(`span`,{children:a(`account.pendingMigrationsList`,`待应用的架构迁移文件:`)})]}),(0,Q.jsx)(`ul`,{className:`list-disc list-inside text-xs font-mono space-y-0.5 text-gray-700 dark:text-gray-300 max-h-32 overflow-y-auto`,children:m.pendingFiles.map(e=>(0,Q.jsx)(`li`,{children:e},e))})]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between pt-2 border-t border-gray-100 dark:border-gray-800`,children:[(0,Q.jsx)(C,{minimal:!0,icon:(0,Q.jsx)(t,{size:14,className:c?`animate-spin`:``}),text:a(`account.checkMigration`,`刷新状态`),onClick:async()=>{l(!0);try{await n()}finally{l(!1)}},disabled:o||c}),(0,Q.jsx)(C,{intent:b.PRIMARY,icon:(0,Q.jsx)(r,{size:14}),text:o?a(`account.runningMigration`,`正在迁移...`):a(`account.runMigration`,`执行迁移`),loading:o,disabled:h||o,onClick:async()=>{s(!0);try{let e=await F();i?.current?.show({message:a(`account.migrationSuccess`,{count:e.appliedCount}),intent:b.SUCCESS,icon:`tick`}),await n()}catch(e){console.error(e),i?.current?.show({message:e.message||a(`account.migrationFailed`),intent:b.DANGER,icon:`error`})}finally{s(!1)}}})]})]})})]})},oe=({onSavingChange:e,toasterRef:t})=>{let[r,i]=(0,Z.useState)(null),[o,s]=(0,Z.useState)([]),[c,l]=(0,Z.useState)(!0),{t:u}=f(),d=q(),[p,m]=(0,Z.useState)({}),[h,g]=(0,Z.useState)(null),_=async()=>{try{s(await W())}catch(e){console.error(e)}},y=async()=>{try{m(await z())}catch(e){console.error(e)}},x=(0,Z.useCallback)(async()=>{try{g(await I())}catch(e){console.error(`Failed to fetch database status:`,e)}},[]),C=(0,Z.useCallback)(async()=>{try{let e=await B();i(e),e.role===`admin`&&(_(),y(),x())}catch(e){console.error(e)}finally{l(!1)}},[x]);return(0,Z.useEffect)(()=>{C()},[C]),c?(0,Q.jsx)(`div`,{className:`p-8 text-center`,children:u(`common.loading`,`加载中...`)}):r?.role===`admin`?(0,Q.jsxs)(`div`,{className:P(`max-w-5xl mx-auto space-y-8`,d?`p-0`:`px-8`),children:[(0,Q.jsxs)(`div`,{className:`flex justify-between items-start sm:items-end gap-3 flex-wrap sm:flex-nowrap`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`bp6-heading`,children:u(`system.title`,`系统管理`)}),(0,Q.jsx)(`p`,{className:`bp6-text-muted`,children:u(`system.subtitle`,`管理用户、系统过滤列表、系统配置与数据库维护`)})]}),(0,Q.jsx)(M,{large:!0,round:!0,intent:b.DANGER,icon:(0,Q.jsx)(a,{size:16}),className:`shrink-0 whitespace-nowrap`,children:u(`account.roleAdmin`,`管理员`)})]}),r?.jwt_secret_warning&&(0,Q.jsxs)(v,{intent:b.WARNING,icon:null,children:[(0,Q.jsxs)(S,{className:`flex items-center gap-2 mb-1 font-semibold`,children:[(0,Q.jsx)(n,{className:`w-4 h-4 shrink-0`}),(0,Q.jsx)(`span`,{children:u(`account.jwtSecretWarningTitle`)})]}),(0,Q.jsx)(`div`,{className:`text-sm leading-relaxed mt-1`,children:u(`account.jwtSecretWarningDesc`)})]}),(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsx)($,{users:o,currentUserId:r.id,onRefresh:_,registrationEnabled:p.registration_enabled!==`false`,maxUsers:p.max_users,onRefreshSettings:y,onSavingChange:e,toasterRef:t})}),(0,Q.jsx)(E,{}),(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsx)(re,{onSavingChange:e,toasterRef:t})}),(0,Q.jsx)(E,{}),(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsx)(ie,{initialSettings:p,onRefresh:y,onSavingChange:e,toasterRef:t})}),(0,Q.jsx)(E,{}),(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsx)(ae,{status:h,onRefresh:x,toasterRef:t})})]}):(0,Q.jsx)(`div`,{className:P(`max-w-5xl mx-auto space-y-6`,d?`p-0`:`px-8`),children:(0,Q.jsx)(v,{intent:b.DANGER,icon:`error`,title:u(`system.accessDenied`,`访问受限`),children:u(`system.accessDeniedDesc`,`当前页面仅限管理员访问。`)})})};export{oe as SystemView};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-C4Xdq4VV.js";import{B as t,C as n,H as r,I as i,M as a,N as o,S as s,at as c,et as l,gt as u,ht as d,nn as f,ut as p,w as m,x as h}from"./vendor-react-DYK5a2J9.js";import{S as g,b as _}from"./vendor-icons-other-BTYC6Wvz.js";import"./vendor-i18next-DlmslyBB.js";import{C as v,E as y,H as b,M as x,N as S,P as C,S as w,U as T,_ as E,d as D,f as O,h as k,k as A,p as j,r as M,u as N}from"./vendor-ui-core-CodM8CpF.js";import{_t as P}from"./vendor-utils-Bab4qB3W.js";import{B as F,F as I,I as L,K as R,L as z,Lt as B,M as V,N as H,P as U,R as W,V as G,d as K,gn as q,h as J,l as ee,o as te,u as ne,z as Y}from"./index--9RzUkcE.js";import{t as X}from"./async-R_IFRE5c.js";var Z=e(g(),1),Q=e(_(),1);const $=({users:e,currentUserId:t,onRefresh:n,registrationEnabled:r=!0,maxUsers:i,onRefreshSettings:o,onSavingChange:s,toasterRef:c})=>{let{t:l}=f(),[u,d]=(0,Z.useState)(!1),[p,g]=(0,Z.useState)(``),[_,v]=(0,Z.useState)(``),[y,S]=(0,Z.useState)(`user`),[E,P]=(0,Z.useState)(!1),[F,I]=(0,Z.useState)(!1),[L,R]=(0,Z.useState)(r),[z,B]=(0,Z.useState)(!1),U=i!=null&&i!==``?parseInt(String(i),10):0,W=U>0&&e.length>=U;(0,Z.useEffect)(()=>{R(r)},[r]);let q=async e=>{let t=L;R(e),B(!0),s?.(!0);try{await X(G({registration_enabled:String(e)}),1e4),c?.current?.show({message:l(`common.saveSuccess`,`保存成功`),intent:b.SUCCESS,icon:`tick`}),o?.()}catch(e){console.error(e),R(t),c?.current?.show({message:e.message||l(`common.saveFailed`,`保存失败`),intent:b.DANGER,icon:`error`})}finally{B(!1),s?.(!1)}},Y=async()=>{if(!ee.test(p)){alert(l(`account.formatTipUsername`));return}if(!te.test(_)){alert(l(`account.formatTipPassword`));return}P(!0);try{await V({username:p,password:await K(_,p),role:y}),d(!1),g(``),v(``),I(!1),n()}catch(e){console.error(e),alert(ne(e,l))}finally{P(!1)}},$=async e=>{if(confirm(l(`account.confirmDeleteUser`)))try{await H(e),n()}catch(e){console.error(e)}};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(a,{size:20,className:`text-red-500`}),(0,Q.jsx)(x,{style:{margin:0},children:l(`account.userManagement`)}),U>0?(0,Q.jsxs)(M,{minimal:!0,intent:W?b.DANGER:b.PRIMARY,round:!0,children:[e.length,` / `,U]}):(0,Q.jsx)(M,{minimal:!0,round:!0,children:e.length})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-4 flex-wrap`,children:[(0,Q.jsx)(k,{label:l(`account.enableRegistration`,`开放新用户注册`),checked:L,disabled:z,onChange:e=>q(e.currentTarget.checked),className:`mb-0`}),(0,Q.jsx)(C,{className:`whitespace-nowrap`,icon:(0,Q.jsx)(h,{size:16}),intent:b.SUCCESS,text:l(`account.createUser`),disabled:W,title:W?l(`auth.maxUsersReached`,`当前系统已达到用户数量上限,无法创建新用户。`):void 0,onClick:()=>d(!0)})]})]}),(0,Q.jsx)(w,{elevation:T.ONE,className:`p-0 overflow-hidden overflow-x-auto`,children:(0,Q.jsxs)(N,{interactive:!0,striped:!0,className:`w-full whitespace-nowrap`,children:[(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`th`,{className:`whitespace-nowrap`,children:l(`account.username`)}),(0,Q.jsx)(`th`,{className:`whitespace-nowrap`,children:l(`account.role`)}),(0,Q.jsx)(`th`,{className:`whitespace-nowrap`,children:`MFA`}),(0,Q.jsx)(`th`,{className:`whitespace-nowrap`,children:`ID`}),(0,Q.jsx)(`th`,{className:`whitespace-nowrap`,children:l(`account.createdAt`)}),(0,Q.jsx)(`th`,{className:`whitespace-nowrap`,children:l(`account.lastActive`)}),(0,Q.jsx)(`th`,{className:`whitespace-nowrap`,children:l(`account.lastResolve`)}),(0,Q.jsx)(`th`,{className:`text-right whitespace-nowrap`,children:l(`account.actions`)})]})}),(0,Q.jsx)(`tbody`,{children:e.map(e=>(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`td`,{className:`font-bold whitespace-nowrap`,children:e.username}),(0,Q.jsx)(`td`,{className:`whitespace-nowrap`,children:(0,Q.jsx)(M,{minimal:!0,intent:e.role===`admin`?b.DANGER:b.NONE,className:`whitespace-nowrap`,children:e.role===`admin`?l(`account.roleAdmin`):l(`account.roleUser`)})}),(0,Q.jsx)(`td`,{className:`whitespace-nowrap`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[!!e.totp_enabled&&(0,Q.jsx)(M,{minimal:!0,intent:b.SUCCESS,className:`whitespace-nowrap`,children:`TOTP`}),!!(e.passkeys_count&&e.passkeys_count>0)&&(0,Q.jsx)(M,{minimal:!0,intent:b.PRIMARY,className:`whitespace-nowrap`,children:`Passkey`}),!e.totp_enabled&&!(e.passkeys_count&&e.passkeys_count>0)&&(0,Q.jsx)(M,{minimal:!0,intent:b.NONE,style:{color:`#8a9ba8`},className:`whitespace-nowrap`,children:l(`account.mfaNone`,`无`)})]})}),(0,Q.jsx)(`td`,{className:`whitespace-nowrap`,children:(0,Q.jsx)(`code`,{className:`text-xs`,children:e.id})}),(0,Q.jsx)(`td`,{className:`text-xs text-gray-500 whitespace-nowrap`,children:e.created_at?J(new Date(e.created_at*1e3)):`-`}),(0,Q.jsx)(`td`,{className:`text-xs text-gray-500 whitespace-nowrap`,children:e.last_active_at?J(new Date(e.last_active_at*1e3)):`-`}),(0,Q.jsx)(`td`,{className:`text-xs text-gray-500 whitespace-nowrap`,children:e.last_resolve_at?J(new Date(e.last_resolve_at*1e3)):`-`}),(0,Q.jsx)(`td`,{className:`text-right whitespace-nowrap`,children:(0,Q.jsx)(`div`,{className:`inline-flex items-center gap-1`,children:(0,Q.jsx)(C,{minimal:!0,intent:b.DANGER,icon:(0,Q.jsx)(m,{size:14}),disabled:e.id===t,onClick:()=>$(e.id)})})})]},e.id))})]})}),(0,Q.jsx)(A,{isOpen:u,onClose:()=>{d(!1),I(!1)},title:l(`account.createNewUser`),icon:`user`,children:(0,Q.jsxs)(`div`,{className:`p-6 space-y-4`,children:[(0,Q.jsx)(j,{label:l(`account.username`),children:(0,Q.jsx)(O,{value:p,onChange:e=>g(e.target.value),placeholder:l(`auth.usernamePlaceholder`)})}),(0,Q.jsx)(j,{label:l(`account.initialPassword`),children:(0,Q.jsx)(O,{type:F?`text`:`password`,value:_,onChange:e=>v(e.target.value),placeholder:l(`auth.passwordPlaceholder`),rightElement:(0,Q.jsx)(C,{minimal:!0,icon:F?`eye-open`:`eye-off`,onClick:()=>I(!F),title:F?l(`auth.hidePassword`,`Hide password`):l(`auth.showPassword`,`Show password`)})})}),(0,Q.jsx)(j,{label:l(`account.userRole`),children:(0,Q.jsx)(D,{fill:!0,value:y,onChange:e=>S(e.target.value),options:[{label:l(`account.roleUser`),value:`user`},{label:l(`account.roleAdmin`),value:`admin`}]})}),(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2 mt-6`,children:[(0,Q.jsx)(C,{text:l(`account.cancel`),onClick:()=>d(!1)}),(0,Q.jsx)(C,{intent:b.PRIMARY,text:l(`account.createNow`),loading:E,onClick:Y})]})]})})]})},re=({toasterRef:e,onSavingChange:t})=>{let{t:n}=f(),[r,a]=(0,Z.useState)(``),[o,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)([]),[g,_]=(0,Z.useState)(null),[D,k]=(0,Z.useState)(null),[A,N]=(0,Z.useState)([]),[P,F]=(0,Z.useState)(!1),[I,z]=(0,Z.useState)(null),[B,V]=(0,Z.useState)(null),H=(0,Z.useCallback)(async()=>{F(!0);try{N(await L())}catch(e){console.warn(`Failed to fetch distributed filter lists`,e)}finally{F(!1)}},[]);(0,Z.useEffect)(()=>{R().then(e=>{e&&Array.isArray(e)&&h(e.map(e=>({label:String(n(e.label,{defaultValue:e.label})),url:String(e.url||``)})))}).catch(e=>console.warn(`Failed to fetch preset filters`,e)),H()},[n,H]);let W=async()=>{let i=r.trim();if(i){p(!0),k(null),_(null),t?.(!0);try{let t=await U(i);_(t),a(``);let r=t.failedCount>0?n(`admin.distributeFilter.toastPartialSuccess`,`系统过滤列表已下发至 {{added}} 位用户,{{failed}} 位用户下发失败`,{added:t.addedCount,failed:t.failedCount}):n(`admin.distributeFilter.toastSuccess`,`系统过滤列表已成功下发至 {{count}} 位用户`,{count:t.addedCount});e?.current?.show({message:r,intent:t.failedCount>0&&t.addedCount===0?b.DANGER:t.failedCount>0?b.WARNING:b.SUCCESS,icon:t.failedCount>0&&t.addedCount===0?`error`:`tick`}),await H()}catch(t){let n=t instanceof Error?t.message:String(t);k(n),e?.current?.show({message:n,intent:b.DANGER,icon:`error`})}finally{p(!1),t?.(!1)}}},G=async r=>{z(r),V(null),t?.(!0);try{let t=await Y(r);e?.current?.show({message:n(`admin.distributeFilter.toastRevokeSuccess`,`已成功撤回系统过滤列表,移除了 {{count}} 位用户的系统规则`,{count:t.revokedCount}),intent:b.SUCCESS,icon:`tick`}),await H()}catch(t){let n=t instanceof Error?t.message:String(t);e?.current?.show({message:n,intent:b.DANGER,icon:`error`})}finally{z(null),t?.(!1)}};return(0,Q.jsxs)(w,{elevation:T.ZERO,className:`p-6 border border-gray-200 dark:border-gray-800 rounded-xl space-y-6`,children:[(0,Q.jsx)(`div`,{className:`flex items-start justify-between`,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(x,{className:`flex items-center space-x-2 text-base font-semibold`,children:[(0,Q.jsx)(i,{className:`w-5 h-5 text-indigo-500`}),(0,Q.jsx)(`span`,{children:n(`admin.distributeFilter.title`,`系统过滤列表 (管理员)`)})]}),(0,Q.jsx)(`p`,{className:`text-sm text-gray-500 dark:text-gray-400 mt-1`,children:n(`admin.distributeFilter.description`,`向系统中所有用户账号下发系统级过滤列表。规则自动继承并应用于所有用户账号,带有“系统”标签。如果用户已存在相同规则则自动跳过。`)})]})}),m.length>0&&(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`text-xs font-medium text-gray-500 dark:text-gray-400 flex items-center space-x-1`,children:[(0,Q.jsx)(c,{className:`w-3.5 h-3.5`}),(0,Q.jsx)(`span`,{children:n(`admin.distributeFilter.quickPresets`,`快捷预设`)})]}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:m.map(e=>(0,Q.jsx)(C,{minimal:!0,small:!0,className:`text-xs`,intent:r===e.url?b.PRIMARY:b.NONE,onClick:()=>a(e.url),children:e.label},e.url))})]}),(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(j,{label:n(`admin.distributeFilter.urlLabel`,`规则列表 URL`),labelFor:`distribute-filter-url`,helperText:n(`admin.distributeFilter.urlHelper`,`支持 AdGuard、Hosts、EasyList 等标准格式 URL`),children:(0,Q.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-3`,children:[(0,Q.jsx)(O,{id:`distribute-filter-url`,fill:!0,placeholder:`https://example.com/filter.txt`,value:r,onChange:e=>a(e.target.value),disabled:o,className:`font-mono text-sm`,onKeyDown:e=>{e.key===`Enter`&&r.trim()&&!o&&W()}}),(0,Q.jsx)(C,{intent:b.PRIMARY,icon:(0,Q.jsx)(i,{className:`w-4 h-4 mr-1`}),text:n(`admin.distributeFilter.submitBtn`,`立即下发`),loading:o,disabled:!r.trim(),onClick:W,className:`shrink-0`})]})}),D&&(0,Q.jsxs)(v,{intent:b.DANGER,icon:null,children:[(0,Q.jsxs)(S,{className:`flex items-center gap-2 mb-2 font-semibold`,children:[(0,Q.jsx)(d,{className:`w-4 h-4 shrink-0`}),(0,Q.jsx)(`span`,{children:n(`common.error`,`错误`)})]}),(0,Q.jsx)(`div`,{className:`text-sm`,children:D})]}),g&&(0,Q.jsxs)(v,{intent:g.failedCount>0?g.addedCount>0?b.WARNING:b.DANGER:b.SUCCESS,icon:null,children:[(0,Q.jsxs)(S,{className:`flex items-center gap-2 mb-2 font-semibold`,children:[g.failedCount>0&&g.addedCount===0?(0,Q.jsx)(d,{className:`w-4 h-4 shrink-0 text-red-500`}):(0,Q.jsx)(u,{className:`w-4 h-4 shrink-0 text-green-500`}),(0,Q.jsx)(`span`,{children:n(`admin.distributeFilter.resultTitle`,`下发执行完成`)})]}),(0,Q.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,Q.jsx)(`p`,{children:g.failedCount>0?n(`admin.distributeFilter.resultSummaryWithFailed`,`系统共 {{total}} 位用户:成功下发至 {{added}} 位用户,跳过 {{skipped}} 位已存在该规则的用户,{{failed}} 位用户下发失败。`,{total:g.totalUsers,added:g.addedCount,skipped:g.skippedCount,failed:g.failedCount}):n(`admin.distributeFilter.resultSummary`,`系统共 {{total}} 位用户:成功下发至 {{added}} 位用户,跳过 {{skipped}} 位已存在该规则的用户。`,{total:g.totalUsers,added:g.addedCount,skipped:g.skippedCount})}),g.addedUsernames.length>0&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 pt-1`,children:[(0,Q.jsxs)(`span`,{className:`text-xs font-medium text-gray-500`,children:[n(`admin.distributeFilter.addedUsers`,`下发成功用户`),`:`]}),g.addedUsernames.map(e=>(0,Q.jsx)(M,{intent:b.SUCCESS,minimal:!0,round:!0,children:e},e))]}),g.skippedUsernames.length>0&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 pt-1`,children:[(0,Q.jsxs)(`span`,{className:`text-xs font-medium text-gray-500`,children:[n(`admin.distributeFilter.skippedUsers`,`已存在规则用户`),`:`]}),g.skippedUsernames.map(e=>(0,Q.jsx)(M,{intent:b.NONE,minimal:!0,round:!0,children:e},e))]}),g.failedUsernames.length>0&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 pt-1`,children:[(0,Q.jsxs)(`span`,{className:`text-xs font-medium text-red-500 dark:text-red-400`,children:[n(`admin.distributeFilter.failedUsers`,`下发失败用户`),`:`]}),g.failedUsernames.map(e=>(0,Q.jsx)(M,{intent:b.DANGER,minimal:!0,round:!0,children:e},e))]})]})]})]}),(0,Q.jsx)(E,{}),(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsxs)(`div`,{className:`text-sm font-semibold flex items-center space-x-2`,children:[(0,Q.jsx)(l,{className:`w-4 h-4 text-indigo-500`}),(0,Q.jsx)(`span`,{children:n(`admin.distributeFilter.activeDistributedTitle`,`已下发系统规则`)})]}),A.length>0&&(0,Q.jsx)(M,{minimal:!0,round:!0,intent:b.PRIMARY,children:A.length})]}),(0,Q.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:n(`admin.distributeFilter.activeDistributedDesc`,`当前处于系统下发状态且带有“系统”标签的规则列表。撤回后将从所有用户账号中移除此系统规则,用户自建的同名规则不受影响。`)}),P?(0,Q.jsx)(`div`,{className:`text-xs text-gray-400 py-3 text-center`,children:n(`common.loading`,`加载中...`)}):A.length===0?(0,Q.jsx)(`div`,{className:`text-xs text-gray-400 dark:text-gray-500 py-4 px-3 bg-gray-50 dark:bg-gray-800/50 rounded-lg text-center border border-dashed border-gray-200 dark:border-gray-700`,children:n(`admin.distributeFilter.noDistributedFilters`,`当前系统中无已下发的系统过滤列表`)}):(0,Q.jsx)(`div`,{className:`divide-y divide-gray-100 dark:divide-gray-800 border border-gray-200 dark:border-gray-800 rounded-lg overflow-hidden`,children:A.map(e=>(0,Q.jsxs)(`div`,{className:`p-3 bg-white dark:bg-gray-900 flex flex-col sm:flex-row sm:items-center justify-between gap-3 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,Q.jsx)(`div`,{className:`font-mono text-xs text-gray-800 dark:text-gray-200 truncate select-all`,title:e.url,children:e.url}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-xs text-gray-500`,children:[(0,Q.jsx)(M,{minimal:!0,round:!0,intent:b.PRIMARY,children:n(`admin.distributeFilter.usersCount`,`{{count}} 位用户`,{count:e.userCount})}),e.usernames.length>0&&(0,Q.jsxs)(`span`,{className:`text-xs text-gray-400 truncate max-w-xs`,children:[`(`,e.usernames.join(`, `),`)`]})]})]}),(0,Q.jsx)(`div`,{className:`shrink-0`,children:(0,Q.jsx)(y,{isOpen:B===e.url,onInteraction:t=>V(t?e.url:null),placement:`top-end`,portalClassName:`z-20000`,content:(0,Q.jsxs)(`div`,{className:`p-3 space-y-3 max-w-xs`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-semibold leading-relaxed m-0 text-gray-800 dark:text-gray-200`,children:n(`admin.distributeFilter.revokeConfirm`,`确定撤回此系统过滤列表?系统将从所有用户账号中移除此系统规则,用户自建的同名规则不受影响。`)}),(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Q.jsx)(C,{small:!0,variant:`minimal`,text:n(`common.cancel`,`取消`),onClick:()=>V(null)}),(0,Q.jsx)(C,{small:!0,intent:b.DANGER,loading:I===e.url,text:n(`admin.distributeFilter.confirmRevoke`,`确认撤回`),onClick:()=>G(e.url)})]})]}),children:(0,Q.jsx)(C,{small:!0,intent:b.DANGER,minimal:!0,icon:(0,Q.jsx)(s,{className:`w-3.5 h-3.5`}),text:n(`admin.distributeFilter.revokeBtn`,`撤回`),loading:I===e.url,onClick:()=>V(e.url)})})})]},e.url))})]})]})},ie=({initialSettings:e,onRefresh:t,onSavingChange:n,toasterRef:r})=>{let{t:i}=f(),[a,s]=(0,Z.useState)(e),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1);return(0,Z.useEffect)(()=>{s(e)},[e]),(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(o,{size:20,className:`text-gray-500`}),(0,Q.jsx)(x,{style:{margin:0},children:i(`account.systemSettings`,`System Settings`)})]}),(0,Q.jsxs)(w,{elevation:T.ONE,children:[(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-x-8 gap-y-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(x,{className:`text-sm font-bold opacity-70 text-blue-500`,children:`Cloudflare Turnstile`}),(0,Q.jsx)(j,{label:`Site Key`,children:(0,Q.jsx)(O,{value:a.turnstile_site_key||``,onChange:e=>s({...a,turnstile_site_key:e.target.value}),placeholder:`0x000...`})}),(0,Q.jsx)(j,{label:`Secret Key`,children:(0,Q.jsx)(O,{type:u?`text`:`password`,value:a.turnstile_secret_key||``,onChange:e=>s({...a,turnstile_secret_key:e.target.value}),placeholder:`0x000...`,rightElement:(0,Q.jsx)(C,{minimal:!0,icon:u?`eye-open`:`eye-off`,onClick:()=>d(!u),title:u?i(`auth.hidePassword`,`Hide password`):i(`auth.showPassword`,`Show password`)})})})]}),(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(x,{className:`text-sm font-bold opacity-70 text-green-500`,children:i(`account.featureToggle`,`Feature Toggle`)}),(0,Q.jsx)(k,{label:i(`account.enableTurnstileSignup`,`Enable verification on Signup`),checked:a.turnstile_enabled_signup===`true`,onChange:e=>s({...a,turnstile_enabled_signup:String(e.currentTarget.checked)})}),(0,Q.jsx)(k,{label:i(`account.enableTurnstileLogin`,`Enable verification on Login`),checked:a.turnstile_enabled_login===`true`,onChange:e=>s({...a,turnstile_enabled_login:String(e.currentTarget.checked)})}),(0,Q.jsx)(E,{className:`my-2`}),(0,Q.jsx)(x,{className:`text-sm font-bold opacity-70 text-indigo-500`,children:i(`account.userLimits`,`User Quota`)}),(0,Q.jsx)(j,{label:i(`account.maxUsers`,`Max Users`),helperText:i(`account.maxUsersHelper`,`Maximum number of users allowed in the system (0 for unlimited).`),children:(0,Q.jsx)(O,{type:`number`,min:0,value:a.max_users||``,onChange:e=>s({...a,max_users:e.target.value}),placeholder:`0`})})]})]}),(0,Q.jsx)(E,{className:`my-4`}),(0,Q.jsx)(`div`,{className:`flex justify-end`,children:(0,Q.jsx)(C,{intent:b.PRIMARY,icon:`floppy-disk`,text:i(`common.save`,`Save`),loading:c,onClick:async()=>{l(!0),n?.(!0);try{await X(G({turnstile_site_key:a.turnstile_site_key||``,turnstile_secret_key:a.turnstile_secret_key||``,turnstile_enabled_signup:a.turnstile_enabled_signup||`false`,turnstile_enabled_login:a.turnstile_enabled_login||`false`,max_users:a.max_users||`0`}),1e4),r?.current?.show({message:i(`common.saveSuccess`,`保存成功`),intent:b.SUCCESS,icon:`tick`}),t()}catch(t){console.error(t),s(e),r?.current?.show({message:t.message||i(`common.saveFailed`,`保存失败`),intent:b.DANGER,icon:`error`})}finally{l(!1),n?.(!1)}}})})]})]})},ae=({status:e,onRefresh:n,toasterRef:i})=>{let{t:a}=f(),[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(!1),m=e?.migrations,h=m?.completed??!1;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(p,{size:20,className:`text-gray-500`}),(0,Q.jsx)(x,{style:{margin:0},children:a(`account.databaseSettings`,`数据库 (管理员)`)})]}),m?(0,Q.jsx)(M,{large:!0,round:!0,intent:h?b.SUCCESS:b.WARNING,icon:h?(0,Q.jsx)(u,{size:16}):(0,Q.jsx)(d,{size:16}),className:`whitespace-nowrap self-start sm:self-auto`,children:h?a(`account.migrationCompleted`,`迁移已完成`):a(`account.migrationPending`,`有待执行迁移`)}):(0,Q.jsx)(M,{large:!0,round:!0,intent:b.NONE,className:`whitespace-nowrap self-start sm:self-auto`,children:a(`common.loading`,`加载中...`)})]}),(0,Q.jsx)(w,{elevation:T.ONE,children:(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`span`,{className:`text-xs uppercase font-semibold text-gray-500 tracking-wider`,children:a(`account.databaseEngine`,`数据库服务`)}),(0,Q.jsx)(`div`,{className:`text-sm font-medium mt-1`,children:(e=>e===`Turso`?`Turso (libSQL)`:e===`D1`?`Cloudflare D1`:e===`File`?`SQLite (Local File)`:e||`SQLite`)(e?.databaseService)})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`span`,{className:`text-xs uppercase font-semibold text-gray-500 tracking-wider`,children:a(`account.lastAppliedMigration`,`最近应用版本`)}),(0,Q.jsx)(`div`,{className:`text-sm font-medium font-mono text-gray-700 dark:text-gray-300 mt-1 truncate`,children:m?.lastApplied||a(`account.noMigrationsApplied`,`无`)})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`span`,{className:`text-xs uppercase font-semibold text-gray-500 tracking-wider`,children:a(`account.migrationStatus`,`架构状态`)}),(0,Q.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-gray-300 mt-1`,children:m?h?a(`account.migrationCompletedDesc`,{total:m?.totalAvailable||0}):a(`account.migrationPendingDesc`,{applied:m?.appliedCount||0,total:m?.totalAvailable||0,pending:m?.pendingCount||0}):a(`common.loading`,`加载中...`)})]}),!h&&m&&m.pendingFiles.length>0&&(0,Q.jsxs)(v,{intent:b.WARNING,icon:null,children:[(0,Q.jsxs)(S,{className:`flex items-center gap-2 mb-1 text-xs font-semibold`,children:[(0,Q.jsx)(d,{className:`w-4 h-4 shrink-0`}),(0,Q.jsx)(`span`,{children:a(`account.pendingMigrationsList`,`待应用的架构迁移文件:`)})]}),(0,Q.jsx)(`ul`,{className:`list-disc list-inside text-xs font-mono space-y-0.5 text-gray-700 dark:text-gray-300 max-h-32 overflow-y-auto`,children:m.pendingFiles.map(e=>(0,Q.jsx)(`li`,{children:e},e))})]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between pt-2 border-t border-gray-100 dark:border-gray-800`,children:[(0,Q.jsx)(C,{minimal:!0,icon:(0,Q.jsx)(t,{size:14,className:c?`animate-spin`:``}),text:a(`account.checkMigration`,`刷新状态`),onClick:async()=>{l(!0);try{await n()}finally{l(!1)}},disabled:o||c}),(0,Q.jsx)(C,{intent:b.PRIMARY,icon:(0,Q.jsx)(r,{size:14}),text:o?a(`account.runningMigration`,`正在迁移...`):a(`account.runMigration`,`执行迁移`),loading:o,disabled:h||o,onClick:async()=>{s(!0);try{let e=await F();i?.current?.show({message:a(`account.migrationSuccess`,{count:e.appliedCount}),intent:b.SUCCESS,icon:`tick`}),await n()}catch(e){console.error(e),i?.current?.show({message:e.message||a(`account.migrationFailed`),intent:b.DANGER,icon:`error`})}finally{s(!1)}}})]})]})})]})},oe=({onSavingChange:e,toasterRef:t})=>{let[r,i]=(0,Z.useState)(null),[o,s]=(0,Z.useState)([]),[c,l]=(0,Z.useState)(!0),{t:u}=f(),d=q(),[p,m]=(0,Z.useState)({}),[h,g]=(0,Z.useState)(null),_=async()=>{try{s(await W())}catch(e){console.error(e)}},y=async()=>{try{m(await z())}catch(e){console.error(e)}},x=(0,Z.useCallback)(async()=>{try{g(await I())}catch(e){console.error(`Failed to fetch database status:`,e)}},[]),C=(0,Z.useCallback)(async()=>{try{let e=await B();i(e),e.role===`admin`&&(_(),y(),x())}catch(e){console.error(e)}finally{l(!1)}},[x]);return(0,Z.useEffect)(()=>{C()},[C]),c?(0,Q.jsx)(`div`,{className:`p-8 text-center`,children:u(`common.loading`,`加载中...`)}):r?.role===`admin`?(0,Q.jsxs)(`div`,{className:P(`max-w-5xl mx-auto space-y-8`,d?`p-0`:`px-8`),children:[(0,Q.jsxs)(`div`,{className:`flex justify-between items-start sm:items-end gap-3 flex-wrap sm:flex-nowrap`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`bp6-heading`,children:u(`system.title`,`系统管理`)}),(0,Q.jsx)(`p`,{className:`bp6-text-muted`,children:u(`system.subtitle`,`管理用户、系统过滤列表、系统配置与数据库维护`)})]}),(0,Q.jsx)(M,{large:!0,round:!0,intent:b.DANGER,icon:(0,Q.jsx)(a,{size:16}),className:`shrink-0 whitespace-nowrap`,children:u(`account.roleAdmin`,`管理员`)})]}),r?.jwt_secret_warning&&(0,Q.jsxs)(v,{intent:b.WARNING,icon:null,children:[(0,Q.jsxs)(S,{className:`flex items-center gap-2 mb-1 font-semibold`,children:[(0,Q.jsx)(n,{className:`w-4 h-4 shrink-0`}),(0,Q.jsx)(`span`,{children:u(`account.jwtSecretWarningTitle`)})]}),(0,Q.jsx)(`div`,{className:`text-sm leading-relaxed mt-1`,children:u(`account.jwtSecretWarningDesc`)})]}),(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsx)($,{users:o,currentUserId:r.id,onRefresh:_,registrationEnabled:p.registration_enabled!==`false`,maxUsers:p.max_users,onRefreshSettings:y,onSavingChange:e,toasterRef:t})}),(0,Q.jsx)(E,{}),(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsx)(re,{onSavingChange:e,toasterRef:t})}),(0,Q.jsx)(E,{}),(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsx)(ie,{initialSettings:p,onRefresh:y,onSavingChange:e,toasterRef:t})}),(0,Q.jsx)(E,{}),(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsx)(ae,{status:h,onRefresh:x,toasterRef:t})})]}):(0,Q.jsx)(`div`,{className:P(`max-w-5xl mx-auto space-y-6`,d?`p-0`:`px-8`),children:(0,Q.jsx)(v,{intent:b.DANGER,icon:`error`,title:u(`system.accessDenied`,`访问受限`),children:u(`system.accessDeniedDesc`,`当前页面仅限管理员访问。`)})})};export{oe as SystemView};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,n as t}from"./rolldown-runtime-C4Xdq4VV.js";import{an as n,n as r,t as i}from"./vendor-react-DYK5a2J9.js";import{S as a,b as o}from"./vendor-icons-other-BTYC6Wvz.js";import{$ as s,A as c,B as l,C as u,D as d,E as f,F as p,G as m,H as h,I as g,J as _,K as v,L as y,M as b,N as x,O as S,P as C,Q as w,R as T,S as E,T as D,U as ee,V as O,W as k,X as A,Y as te,Z as ne,_ as re,_t as j,a as ie,at as ae,b as oe,c as se,ct as ce,d as le,dt as ue,et as de,f as fe,ft as pe,g as me,h as he,ht as ge,i as _e,it as ve,j as ye,k as be,l as xe,lt as Se,m as Ce,mt as we,n as Te,nt as Ee,o as De,ot as Oe,p as ke,pt as Ae,q as je,r as Me,rt as Ne,s as Pe,st as Fe,tt as Ie,u as Le,ut as Re,v as ze,w as Be,x as Ve,y as He,z as M}from"./vendor-utils-Bab4qB3W.js";import{h as Ue}from"./index-DAjmisEt.js";var We=`dangerouslySetInnerHTML.onCopy.onCopyCapture.onCut.onCutCapture.onPaste.onPasteCapture.onCompositionEnd.onCompositionEndCapture.onCompositionStart.onCompositionStartCapture.onCompositionUpdate.onCompositionUpdateCapture.onFocus.onFocusCapture.onBlur.onBlurCapture.onChange.onChangeCapture.onBeforeInput.onBeforeInputCapture.onInput.onInputCapture.onReset.onResetCapture.onSubmit.onSubmitCapture.onInvalid.onInvalidCapture.onLoad.onLoadCapture.onError.onErrorCapture.onKeyDown.onKeyDownCapture.onKeyPress.onKeyPressCapture.onKeyUp.onKeyUpCapture.onAbort.onAbortCapture.onCanPlay.onCanPlayCapture.onCanPlayThrough.onCanPlayThroughCapture.onDurationChange.onDurationChangeCapture.onEmptied.onEmptiedCapture.onEncrypted.onEncryptedCapture.onEnded.onEndedCapture.onLoadedData.onLoadedDataCapture.onLoadedMetadata.onLoadedMetadataCapture.onLoadStart.onLoadStartCapture.onPause.onPauseCapture.onPlay.onPlayCapture.onPlaying.onPlayingCapture.onProgress.onProgressCapture.onRateChange.onRateChangeCapture.onSeeked.onSeekedCapture.onSeeking.onSeekingCapture.onStalled.onStalledCapture.onSuspend.onSuspendCapture.onTimeUpdate.onTimeUpdateCapture.onVolumeChange.onVolumeChangeCapture.onWaiting.onWaitingCapture.onAuxClick.onAuxClickCapture.onClick.onClickCapture.onContextMenu.onContextMenuCapture.onDoubleClick.onDoubleClickCapture.onDrag.onDragCapture.onDragEnd.onDragEndCapture.onDragEnter.onDragEnterCapture.onDragExit.onDragExitCapture.onDragLeave.onDragLeaveCapture.onDragOver.onDragOverCapture.onDragStart.onDragStartCapture.onDrop.onDropCapture.onMouseDown.onMouseDownCapture.onMouseEnter.onMouseLeave.onMouseMove.onMouseMoveCapture.onMouseOut.onMouseOutCapture.onMouseOver.onMouseOverCapture.onMouseUp.onMouseUpCapture.onSelect.onSelectCapture.onTouchCancel.onTouchCancelCapture.onTouchEnd.onTouchEndCapture.onTouchMove.onTouchMoveCapture.onTouchStart.onTouchStartCapture.onPointerDown.onPointerDownCapture.onPointerMove.onPointerMoveCapture.onPointerUp.onPointerUpCapture.onPointerCancel.onPointerCancelCapture.onPointerEnter.onPointerEnterCapture.onPointerLeave.onPointerLeaveCapture.onPointerOver.onPointerOverCapture.onPointerOut.onPointerOutCapture.onGotPointerCapture.onGotPointerCaptureCapture.onLostPointerCapture.onLostPointerCaptureCapture.onScroll.onScrollCapture.onWheel.onWheelCapture.onAnimationStart.onAnimationStartCapture.onAnimationEnd.onAnimationEndCapture.onAnimationIteration.onAnimationIterationCapture.onTransitionEnd.onTransitionEndCapture`.split(`.`);function Ge(e){return typeof e==`string`?We.includes(e):!1}var N=e(a()),Ke=new Set(`aria-activedescendant.aria-atomic.aria-autocomplete.aria-busy.aria-checked.aria-colcount.aria-colindex.aria-colspan.aria-controls.aria-current.aria-describedby.aria-details.aria-disabled.aria-errormessage.aria-expanded.aria-flowto.aria-haspopup.aria-hidden.aria-invalid.aria-keyshortcuts.aria-label.aria-labelledby.aria-level.aria-live.aria-modal.aria-multiline.aria-multiselectable.aria-orientation.aria-owns.aria-placeholder.aria-posinset.aria-pressed.aria-readonly.aria-relevant.aria-required.aria-roledescription.aria-rowcount.aria-rowindex.aria-rowspan.aria-selected.aria-setsize.aria-sort.aria-valuemax.aria-valuemin.aria-valuenow.aria-valuetext.className.color.height.id.lang.max.media.method.min.name.style.target.width.role.tabIndex.accentHeight.accumulate.additive.alignmentBaseline.allowReorder.alphabetic.amplitude.arabicForm.ascent.attributeName.attributeType.autoReverse.azimuth.baseFrequency.baselineShift.baseProfile.bbox.begin.bias.by.calcMode.capHeight.clip.clipPath.clipPathUnits.clipRule.colorInterpolation.colorInterpolationFilters.colorProfile.colorRendering.contentScriptType.contentStyleType.cursor.cx.cy.d.decelerate.descent.diffuseConstant.direction.display.divisor.dominantBaseline.dur.dx.dy.edgeMode.elevation.enableBackground.end.exponent.externalResourcesRequired.fill.fillOpacity.fillRule.filter.filterRes.filterUnits.floodColor.floodOpacity.focusable.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.format.from.fx.fy.g1.g2.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.glyphRef.gradientTransform.gradientUnits.hanging.horizAdvX.horizOriginX.href.ideographic.imageRendering.in2.in.intercept.k1.k2.k3.k4.k.kernelMatrix.kernelUnitLength.kerning.keyPoints.keySplines.keyTimes.lengthAdjust.letterSpacing.lightingColor.limitingConeAngle.local.markerEnd.markerHeight.markerMid.markerStart.markerUnits.markerWidth.mask.maskContentUnits.maskUnits.mathematical.mode.numOctaves.offset.opacity.operator.order.orient.orientation.origin.overflow.overlinePosition.overlineThickness.paintOrder.panose1.pathLength.patternContentUnits.patternTransform.patternUnits.pointerEvents.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.r.radius.refX.refY.renderingIntent.repeatCount.repeatDur.requiredExtensions.requiredFeatures.restart.result.rotate.rx.ry.seed.shapeRendering.slope.spacing.specularConstant.specularExponent.speed.spreadMethod.startOffset.stdDeviation.stemh.stemv.stitchTiles.stopColor.stopOpacity.strikethroughPosition.strikethroughThickness.string.stroke.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.strokeMiterlimit.strokeOpacity.strokeWidth.surfaceScale.systemLanguage.tableValues.targetX.targetY.textAnchor.textDecoration.textLength.textRendering.to.transform.u1.u2.underlinePosition.underlineThickness.unicode.unicodeBidi.unicodeRange.unitsPerEm.vAlphabetic.values.vectorEffect.version.vertAdvY.vertOriginX.vertOriginY.vHanging.vIdeographic.viewTarget.visibility.vMathematical.widths.wordSpacing.writingMode.x1.x2.x.xChannelSelector.xHeight.xlinkActuate.xlinkArcrole.xlinkHref.xlinkRole.xlinkShow.xlinkTitle.xlinkType.xmlBase.xmlLang.xmlns.xmlnsXlink.xmlSpace.y1.y2.y.yChannelSelector.z.zoomAndPan.ref.key.angle`.split(`.`));function qe(e){return typeof e==`string`?Ke.has(e):!1}function Je(e){return typeof e==`string`&&e.startsWith(`data-`)}function Ye(e){if(typeof e!=`object`||!e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(qe(n)||Je(n))&&(t[n]=e[n]);return t}function Xe(e){if(e==null)return null;if((0,N.isValidElement)(e)&&typeof e.props==`object`&&e.props!==null){var t=e.props;return Ye(t)}return typeof e==`object`&&!Array.isArray(e)?Ye(e):null}function Ze(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(qe(n)||Je(n)||Ge(n))&&(t[n]=e[n]);return t}function Qe(e){return e==null?null:(0,N.isValidElement)(e)?Ze(e.props):typeof e==`object`&&!Array.isArray(e)?Ze(e):null}var $e=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function et(){return et=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},et.apply(null,arguments)}function tt(e,t){if(e==null)return{};var n,r,i=nt(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function nt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var rt=(0,N.forwardRef)((e,t)=>{var n=e.children,r=e.width,i=e.height,a=e.viewBox,o=e.className,s=e.style,c=e.title,l=e.desc,u=tt(e,$e),d=a||{width:r,height:i,x:0,y:0},f=j(`recharts-surface`,o);return N.createElement(`svg`,et({},Ze(u),{className:f,width:r,height:i,style:s,viewBox:`${d.x} ${d.y} ${d.width} ${d.height}`,ref:t}),N.createElement(`title`,null,c),N.createElement(`desc`,null,l),n)}),it=[`children`,`className`];function at(){return at=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},at.apply(null,arguments)}function ot(e,t){if(e==null)return{};var n,r,i=st(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function st(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var ct=N.forwardRef((e,t)=>{var n=e.children,r=e.className,i=ot(e,it),a=j(`recharts-layer`,r);return N.createElement(`g`,at({className:a},Ze(i),{ref:t}),n)}),lt=4;function ut(e){var t=10**(arguments.length>1&&arguments[1]!==void 0?arguments[1]:lt),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function P(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+ut(i)+n},``)}var dt=e=>e===0?0:e>0?1:-1,ft=e=>typeof e==`number`&&e!=+e,pt=e=>typeof e==`string`&&e.length>1&&e.indexOf(`%`)===e.length-1,F=e=>(typeof e==`number`||e instanceof Number)&&!ft(e),mt=e=>F(e)||typeof e==`string`,ht=0,gt=e=>{var t=++ht;return`${e||``}${t}`},_t=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!F(e)&&typeof e!=`string`)return n;var i;if(pt(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return ft(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},vt=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++)if(!n[String(e[r])])n[String(e[r])]=!0;else return!0;return!1};function yt(e,t,n){return F(e)&&F(t)?ut(e+n*(t-e)):t}function bt(e,t,n){if(!(!e||!e.length))return e.find(e=>e&&(typeof t==`function`?t(e):ge(e,t))===n)}var I=e=>e==null,xt=e=>I(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function St(e){return e!=null}function Ct(){}function wt(e){if(e)return{x:e.x,y:e.y,upperWidth:`upperWidth`in e?e.upperWidth:e.width,lowerWidth:`lowerWidth`in e?e.lowerWidth:e.width,width:e.width,height:e.height}}function Tt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Et(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Tt(Object(n),!0).forEach(function(t){Dt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Tt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Dt(e,t,n){return(t=Ot(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ot(e){var t=kt(e,`string`);return typeof t==`symbol`?t:t+``}function kt(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var At=e=>{var t=e.viewBox,n=e.position,r=e.offset,i=r===void 0?0:r,a=e.parentViewBox,o=e.clamp,s=wt(t),c=s.x,l=s.y,u=s.height,d=s.upperWidth,f=s.lowerWidth,p=c,m=c+(d-f)/2,h=(p+m)/2,g=(d+f)/2,_=p+d/2,v=u>=0?1:-1,y=v*i,b=v>0?`end`:`start`,x=v>0?`start`:`end`,S=d>=0?1:-1,C=S*i,w=S>0?`end`:`start`,T=S>0?`start`:`end`,E=a;if(n===`top`){var D={x:p+d/2,y:l-y,horizontalAnchor:`middle`,verticalAnchor:b};return o&&E&&(D.height=Math.max(l-E.y,0),D.width=d),D}if(n===`bottom`){var ee={x:m+f/2,y:l+u+y,horizontalAnchor:`middle`,verticalAnchor:x};return o&&E&&(ee.height=Math.max(E.y+E.height-(l+u),0),ee.width=f),ee}if(n===`left`){var O={x:h-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`};return o&&E&&(O.width=Math.max(O.x-E.x,0),O.height=u),O}if(n===`right`){var k={x:h+g+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`};return o&&E&&(k.width=Math.max(E.x+E.width-k.x,0),k.height=u),k}var A=o&&E?{width:g,height:u}:{};return n===`insideLeft`?Et({x:h+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`},A):n===`insideRight`?Et({x:h+g-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`},A):n===`insideTop`?Et({x:p+d/2,y:l+y,horizontalAnchor:`middle`,verticalAnchor:x},A):n===`insideBottom`?Et({x:m+f/2,y:l+u-y,horizontalAnchor:`middle`,verticalAnchor:b},A):n===`insideTopLeft`?Et({x:p+C,y:l+y,horizontalAnchor:T,verticalAnchor:x},A):n===`insideTopRight`?Et({x:p+d-C,y:l+y,horizontalAnchor:w,verticalAnchor:x},A):n===`insideBottomLeft`?Et({x:m+C,y:l+u-y,horizontalAnchor:T,verticalAnchor:b},A):n===`insideBottomRight`?Et({x:m+f-C,y:l+u-y,horizontalAnchor:w,verticalAnchor:b},A):n&&typeof n==`object`&&(F(n.x)||pt(n.x))&&(F(n.y)||pt(n.y))?Et({x:c+_t(n.x,g),y:l+_t(n.y,u),horizontalAnchor:`end`,verticalAnchor:`end`},A):Et({x:_,y:l+u/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},A)},jt=[`top`,`left`,`right`,`bottom`];function Mt(e){return e==null?!1:typeof e==`object`?!0:jt.includes(e)}var Nt=(0,N.createContext)(null),Pt=e=>`radius`in e&&`startAngle`in e&&`endAngle`in e,Ft=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,N.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{Ge(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},It=(e,t,n)=>r=>(e(t,n,r),null),Lt=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];Ge(i)&&typeof a==`function`&&(r||={},r[i]=It(a,t,n))}),r};function Rt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Rt(Object(n),!0).forEach(function(t){Bt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Bt(e,t,n){return(t=Vt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vt(e){var t=Ht(e,`string`);return typeof t==`symbol`?t:t+``}function Ht(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Ut(e,t){var n=zt({},e),r=t;return Object.keys(t).reduce((e,t)=>(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function Wt(e,t,n){return t===!0?je(e,n):typeof t==`function`?je(e,t):e}var Gt=(0,N.createContext)(null),Kt=v(),qt=e=>e,L=()=>{var e=(0,N.useContext)(Gt);return e?e.store.dispatch:qt},Jt=()=>{},Yt=()=>Jt,Xt=(e,t)=>e===t;function R(e){var t=(0,N.useContext)(Gt),n=(0,N.useMemo)(()=>t?t=>{if(t!=null)return e(t)}:Jt,[t,e]);return(0,Kt.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:Yt,t?t.store.getState:Jt,t?t.store.getState:Jt,n,Xt)}var Zt=e=>e.legend.settings,Qt=e=>e.legend.size;m([e=>e.legend.payload,Zt],(e,t)=>{var n=t.itemSorter,r=e.flat(1);return n?k(r,n):r});function $t(e,t){return an(e)||rn(e,t)||tn(e,t)||en()}function en(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
1
|
+
import{i as e,n as t}from"./rolldown-runtime-C4Xdq4VV.js";import{an as n,n as r,t as i}from"./vendor-react-DYK5a2J9.js";import{S as a,b as o}from"./vendor-icons-other-BTYC6Wvz.js";import{$ as s,A as c,B as l,C as u,D as d,E as f,F as p,G as m,H as h,I as g,J as _,K as v,L as y,M as b,N as x,O as S,P as C,Q as w,R as T,S as E,T as D,U as ee,V as O,W as k,X as A,Y as te,Z as ne,_ as re,_t as j,a as ie,at as ae,b as oe,c as se,ct as ce,d as le,dt as ue,et as de,f as fe,ft as pe,g as me,h as he,ht as ge,i as _e,it as ve,j as ye,k as be,l as xe,lt as Se,m as Ce,mt as we,n as Te,nt as Ee,o as De,ot as Oe,p as ke,pt as Ae,q as je,r as Me,rt as Ne,s as Pe,st as Fe,tt as Ie,u as Le,ut as Re,v as ze,w as Be,x as Ve,y as He,z as M}from"./vendor-utils-Bab4qB3W.js";import{h as Ue}from"./index--9RzUkcE.js";var We=`dangerouslySetInnerHTML.onCopy.onCopyCapture.onCut.onCutCapture.onPaste.onPasteCapture.onCompositionEnd.onCompositionEndCapture.onCompositionStart.onCompositionStartCapture.onCompositionUpdate.onCompositionUpdateCapture.onFocus.onFocusCapture.onBlur.onBlurCapture.onChange.onChangeCapture.onBeforeInput.onBeforeInputCapture.onInput.onInputCapture.onReset.onResetCapture.onSubmit.onSubmitCapture.onInvalid.onInvalidCapture.onLoad.onLoadCapture.onError.onErrorCapture.onKeyDown.onKeyDownCapture.onKeyPress.onKeyPressCapture.onKeyUp.onKeyUpCapture.onAbort.onAbortCapture.onCanPlay.onCanPlayCapture.onCanPlayThrough.onCanPlayThroughCapture.onDurationChange.onDurationChangeCapture.onEmptied.onEmptiedCapture.onEncrypted.onEncryptedCapture.onEnded.onEndedCapture.onLoadedData.onLoadedDataCapture.onLoadedMetadata.onLoadedMetadataCapture.onLoadStart.onLoadStartCapture.onPause.onPauseCapture.onPlay.onPlayCapture.onPlaying.onPlayingCapture.onProgress.onProgressCapture.onRateChange.onRateChangeCapture.onSeeked.onSeekedCapture.onSeeking.onSeekingCapture.onStalled.onStalledCapture.onSuspend.onSuspendCapture.onTimeUpdate.onTimeUpdateCapture.onVolumeChange.onVolumeChangeCapture.onWaiting.onWaitingCapture.onAuxClick.onAuxClickCapture.onClick.onClickCapture.onContextMenu.onContextMenuCapture.onDoubleClick.onDoubleClickCapture.onDrag.onDragCapture.onDragEnd.onDragEndCapture.onDragEnter.onDragEnterCapture.onDragExit.onDragExitCapture.onDragLeave.onDragLeaveCapture.onDragOver.onDragOverCapture.onDragStart.onDragStartCapture.onDrop.onDropCapture.onMouseDown.onMouseDownCapture.onMouseEnter.onMouseLeave.onMouseMove.onMouseMoveCapture.onMouseOut.onMouseOutCapture.onMouseOver.onMouseOverCapture.onMouseUp.onMouseUpCapture.onSelect.onSelectCapture.onTouchCancel.onTouchCancelCapture.onTouchEnd.onTouchEndCapture.onTouchMove.onTouchMoveCapture.onTouchStart.onTouchStartCapture.onPointerDown.onPointerDownCapture.onPointerMove.onPointerMoveCapture.onPointerUp.onPointerUpCapture.onPointerCancel.onPointerCancelCapture.onPointerEnter.onPointerEnterCapture.onPointerLeave.onPointerLeaveCapture.onPointerOver.onPointerOverCapture.onPointerOut.onPointerOutCapture.onGotPointerCapture.onGotPointerCaptureCapture.onLostPointerCapture.onLostPointerCaptureCapture.onScroll.onScrollCapture.onWheel.onWheelCapture.onAnimationStart.onAnimationStartCapture.onAnimationEnd.onAnimationEndCapture.onAnimationIteration.onAnimationIterationCapture.onTransitionEnd.onTransitionEndCapture`.split(`.`);function Ge(e){return typeof e==`string`?We.includes(e):!1}var N=e(a()),Ke=new Set(`aria-activedescendant.aria-atomic.aria-autocomplete.aria-busy.aria-checked.aria-colcount.aria-colindex.aria-colspan.aria-controls.aria-current.aria-describedby.aria-details.aria-disabled.aria-errormessage.aria-expanded.aria-flowto.aria-haspopup.aria-hidden.aria-invalid.aria-keyshortcuts.aria-label.aria-labelledby.aria-level.aria-live.aria-modal.aria-multiline.aria-multiselectable.aria-orientation.aria-owns.aria-placeholder.aria-posinset.aria-pressed.aria-readonly.aria-relevant.aria-required.aria-roledescription.aria-rowcount.aria-rowindex.aria-rowspan.aria-selected.aria-setsize.aria-sort.aria-valuemax.aria-valuemin.aria-valuenow.aria-valuetext.className.color.height.id.lang.max.media.method.min.name.style.target.width.role.tabIndex.accentHeight.accumulate.additive.alignmentBaseline.allowReorder.alphabetic.amplitude.arabicForm.ascent.attributeName.attributeType.autoReverse.azimuth.baseFrequency.baselineShift.baseProfile.bbox.begin.bias.by.calcMode.capHeight.clip.clipPath.clipPathUnits.clipRule.colorInterpolation.colorInterpolationFilters.colorProfile.colorRendering.contentScriptType.contentStyleType.cursor.cx.cy.d.decelerate.descent.diffuseConstant.direction.display.divisor.dominantBaseline.dur.dx.dy.edgeMode.elevation.enableBackground.end.exponent.externalResourcesRequired.fill.fillOpacity.fillRule.filter.filterRes.filterUnits.floodColor.floodOpacity.focusable.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.format.from.fx.fy.g1.g2.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.glyphRef.gradientTransform.gradientUnits.hanging.horizAdvX.horizOriginX.href.ideographic.imageRendering.in2.in.intercept.k1.k2.k3.k4.k.kernelMatrix.kernelUnitLength.kerning.keyPoints.keySplines.keyTimes.lengthAdjust.letterSpacing.lightingColor.limitingConeAngle.local.markerEnd.markerHeight.markerMid.markerStart.markerUnits.markerWidth.mask.maskContentUnits.maskUnits.mathematical.mode.numOctaves.offset.opacity.operator.order.orient.orientation.origin.overflow.overlinePosition.overlineThickness.paintOrder.panose1.pathLength.patternContentUnits.patternTransform.patternUnits.pointerEvents.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.r.radius.refX.refY.renderingIntent.repeatCount.repeatDur.requiredExtensions.requiredFeatures.restart.result.rotate.rx.ry.seed.shapeRendering.slope.spacing.specularConstant.specularExponent.speed.spreadMethod.startOffset.stdDeviation.stemh.stemv.stitchTiles.stopColor.stopOpacity.strikethroughPosition.strikethroughThickness.string.stroke.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.strokeMiterlimit.strokeOpacity.strokeWidth.surfaceScale.systemLanguage.tableValues.targetX.targetY.textAnchor.textDecoration.textLength.textRendering.to.transform.u1.u2.underlinePosition.underlineThickness.unicode.unicodeBidi.unicodeRange.unitsPerEm.vAlphabetic.values.vectorEffect.version.vertAdvY.vertOriginX.vertOriginY.vHanging.vIdeographic.viewTarget.visibility.vMathematical.widths.wordSpacing.writingMode.x1.x2.x.xChannelSelector.xHeight.xlinkActuate.xlinkArcrole.xlinkHref.xlinkRole.xlinkShow.xlinkTitle.xlinkType.xmlBase.xmlLang.xmlns.xmlnsXlink.xmlSpace.y1.y2.y.yChannelSelector.z.zoomAndPan.ref.key.angle`.split(`.`));function qe(e){return typeof e==`string`?Ke.has(e):!1}function Je(e){return typeof e==`string`&&e.startsWith(`data-`)}function Ye(e){if(typeof e!=`object`||!e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(qe(n)||Je(n))&&(t[n]=e[n]);return t}function Xe(e){if(e==null)return null;if((0,N.isValidElement)(e)&&typeof e.props==`object`&&e.props!==null){var t=e.props;return Ye(t)}return typeof e==`object`&&!Array.isArray(e)?Ye(e):null}function Ze(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(qe(n)||Je(n)||Ge(n))&&(t[n]=e[n]);return t}function Qe(e){return e==null?null:(0,N.isValidElement)(e)?Ze(e.props):typeof e==`object`&&!Array.isArray(e)?Ze(e):null}var $e=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function et(){return et=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},et.apply(null,arguments)}function tt(e,t){if(e==null)return{};var n,r,i=nt(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function nt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var rt=(0,N.forwardRef)((e,t)=>{var n=e.children,r=e.width,i=e.height,a=e.viewBox,o=e.className,s=e.style,c=e.title,l=e.desc,u=tt(e,$e),d=a||{width:r,height:i,x:0,y:0},f=j(`recharts-surface`,o);return N.createElement(`svg`,et({},Ze(u),{className:f,width:r,height:i,style:s,viewBox:`${d.x} ${d.y} ${d.width} ${d.height}`,ref:t}),N.createElement(`title`,null,c),N.createElement(`desc`,null,l),n)}),it=[`children`,`className`];function at(){return at=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},at.apply(null,arguments)}function ot(e,t){if(e==null)return{};var n,r,i=st(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function st(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var ct=N.forwardRef((e,t)=>{var n=e.children,r=e.className,i=ot(e,it),a=j(`recharts-layer`,r);return N.createElement(`g`,at({className:a},Ze(i),{ref:t}),n)}),lt=4;function ut(e){var t=10**(arguments.length>1&&arguments[1]!==void 0?arguments[1]:lt),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function P(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+ut(i)+n},``)}var dt=e=>e===0?0:e>0?1:-1,ft=e=>typeof e==`number`&&e!=+e,pt=e=>typeof e==`string`&&e.length>1&&e.indexOf(`%`)===e.length-1,F=e=>(typeof e==`number`||e instanceof Number)&&!ft(e),mt=e=>F(e)||typeof e==`string`,ht=0,gt=e=>{var t=++ht;return`${e||``}${t}`},_t=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!F(e)&&typeof e!=`string`)return n;var i;if(pt(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return ft(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},vt=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++)if(!n[String(e[r])])n[String(e[r])]=!0;else return!0;return!1};function yt(e,t,n){return F(e)&&F(t)?ut(e+n*(t-e)):t}function bt(e,t,n){if(!(!e||!e.length))return e.find(e=>e&&(typeof t==`function`?t(e):ge(e,t))===n)}var I=e=>e==null,xt=e=>I(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function St(e){return e!=null}function Ct(){}function wt(e){if(e)return{x:e.x,y:e.y,upperWidth:`upperWidth`in e?e.upperWidth:e.width,lowerWidth:`lowerWidth`in e?e.lowerWidth:e.width,width:e.width,height:e.height}}function Tt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Et(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Tt(Object(n),!0).forEach(function(t){Dt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Tt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Dt(e,t,n){return(t=Ot(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ot(e){var t=kt(e,`string`);return typeof t==`symbol`?t:t+``}function kt(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var At=e=>{var t=e.viewBox,n=e.position,r=e.offset,i=r===void 0?0:r,a=e.parentViewBox,o=e.clamp,s=wt(t),c=s.x,l=s.y,u=s.height,d=s.upperWidth,f=s.lowerWidth,p=c,m=c+(d-f)/2,h=(p+m)/2,g=(d+f)/2,_=p+d/2,v=u>=0?1:-1,y=v*i,b=v>0?`end`:`start`,x=v>0?`start`:`end`,S=d>=0?1:-1,C=S*i,w=S>0?`end`:`start`,T=S>0?`start`:`end`,E=a;if(n===`top`){var D={x:p+d/2,y:l-y,horizontalAnchor:`middle`,verticalAnchor:b};return o&&E&&(D.height=Math.max(l-E.y,0),D.width=d),D}if(n===`bottom`){var ee={x:m+f/2,y:l+u+y,horizontalAnchor:`middle`,verticalAnchor:x};return o&&E&&(ee.height=Math.max(E.y+E.height-(l+u),0),ee.width=f),ee}if(n===`left`){var O={x:h-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`};return o&&E&&(O.width=Math.max(O.x-E.x,0),O.height=u),O}if(n===`right`){var k={x:h+g+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`};return o&&E&&(k.width=Math.max(E.x+E.width-k.x,0),k.height=u),k}var A=o&&E?{width:g,height:u}:{};return n===`insideLeft`?Et({x:h+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`},A):n===`insideRight`?Et({x:h+g-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`},A):n===`insideTop`?Et({x:p+d/2,y:l+y,horizontalAnchor:`middle`,verticalAnchor:x},A):n===`insideBottom`?Et({x:m+f/2,y:l+u-y,horizontalAnchor:`middle`,verticalAnchor:b},A):n===`insideTopLeft`?Et({x:p+C,y:l+y,horizontalAnchor:T,verticalAnchor:x},A):n===`insideTopRight`?Et({x:p+d-C,y:l+y,horizontalAnchor:w,verticalAnchor:x},A):n===`insideBottomLeft`?Et({x:m+C,y:l+u-y,horizontalAnchor:T,verticalAnchor:b},A):n===`insideBottomRight`?Et({x:m+f-C,y:l+u-y,horizontalAnchor:w,verticalAnchor:b},A):n&&typeof n==`object`&&(F(n.x)||pt(n.x))&&(F(n.y)||pt(n.y))?Et({x:c+_t(n.x,g),y:l+_t(n.y,u),horizontalAnchor:`end`,verticalAnchor:`end`},A):Et({x:_,y:l+u/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},A)},jt=[`top`,`left`,`right`,`bottom`];function Mt(e){return e==null?!1:typeof e==`object`?!0:jt.includes(e)}var Nt=(0,N.createContext)(null),Pt=e=>`radius`in e&&`startAngle`in e&&`endAngle`in e,Ft=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,N.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{Ge(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},It=(e,t,n)=>r=>(e(t,n,r),null),Lt=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];Ge(i)&&typeof a==`function`&&(r||={},r[i]=It(a,t,n))}),r};function Rt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Rt(Object(n),!0).forEach(function(t){Bt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Bt(e,t,n){return(t=Vt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vt(e){var t=Ht(e,`string`);return typeof t==`symbol`?t:t+``}function Ht(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Ut(e,t){var n=zt({},e),r=t;return Object.keys(t).reduce((e,t)=>(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function Wt(e,t,n){return t===!0?je(e,n):typeof t==`function`?je(e,t):e}var Gt=(0,N.createContext)(null),Kt=v(),qt=e=>e,L=()=>{var e=(0,N.useContext)(Gt);return e?e.store.dispatch:qt},Jt=()=>{},Yt=()=>Jt,Xt=(e,t)=>e===t;function R(e){var t=(0,N.useContext)(Gt),n=(0,N.useMemo)(()=>t?t=>{if(t!=null)return e(t)}:Jt,[t,e]);return(0,Kt.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:Yt,t?t.store.getState:Jt,t?t.store.getState:Jt,n,Xt)}var Zt=e=>e.legend.settings,Qt=e=>e.legend.size;m([e=>e.legend.payload,Zt],(e,t)=>{var n=t.itemSorter,r=e.flat(1);return n?k(r,n):r});function $t(e,t){return an(e)||rn(e,t)||tn(e,t)||en()}function en(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tn(e,t){if(e){if(typeof e==`string`)return nn(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?nn(e,t):void 0}}function nn(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function rn(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function an(e){if(Array.isArray(e))return e}var on=1;function sn(e,t){return Math.abs(e.height-t.height)>on||Math.abs(e.left-t.left)>on||Math.abs(e.top-t.top)>on||Math.abs(e.width-t.width)>on}function cn(e){var t=e.getBoundingClientRect();return{height:t.height,left:t.left,top:t.top,width:t.width}}function ln(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=$t((0,N.useState)({height:0,left:0,top:0,width:0}),2),n=t[0],r=t[1],i=(0,N.useRef)(null),a=(0,N.useRef)(n);a.current=n;var o=(0,N.useCallback)(e=>{if(i.current!=null&&(i.current.disconnect(),i.current=null),e!=null){var t=cn(e);if(sn(t,a.current)&&r(t),typeof ResizeObserver<`u`){var n=new ResizeObserver(()=>{var t=cn(e);sn(t,a.current)&&r(t)});n.observe(e),i.current=n}}},[...e]);return(0,N.useEffect)(()=>()=>{var e;(e=i.current)==null||e.disconnect()},[]),[n,o]}var un=M({name:`chartLayout`,initialState:{layoutType:`horizontal`,width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){e.margin.top=t.payload.top??0,e.margin.right=t.payload.right??0,e.margin.bottom=t.payload.bottom??0,e.margin.left=t.payload.left??0},setScale(e,t){e.scale=t.payload}}}),dn=un.actions,fn=dn.setMargin,pn=dn.setLayout,mn=dn.setChartSize,hn=dn.setScale,gn=un.reducer;function _n(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function z(e){return Number.isFinite(e)}function vn(e){return typeof e==`number`&&e>0&&Number.isFinite(e)}function yn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function bn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?yn(Object(n),!0).forEach(function(t){xn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function xn(e,t,n){return(t=Sn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sn(e){var t=Cn(e,`string`);return typeof t==`symbol`?t:t+``}function Cn(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function B(e,t,n){return I(e)||I(t)?n:mt(t)?ge(e,t,n):typeof t==`function`?t(e):n}var wn=(e,t,n)=>{if(t&&n){var r=n.width,i=n.height,a=t.align,o=t.verticalAlign,s=t.layout,c=t.position,l=t.offset,u=l===void 0?0:l;if(c!=null){if(Mt(c)){if(c===`top`&&F(e.top))return bn(bn({},e),{},{top:e.top+(i||0)+u});if(c===`bottom`&&F(e.bottom))return bn(bn({},e),{},{bottom:e.bottom+(i||0)+u});if(c===`left`&&F(e.left))return bn(bn({},e),{},{left:e.left+(r||0)+u});if(c===`right`&&F(e.right))return bn(bn({},e),{},{right:e.right+(r||0)+u})}return e}if((s===`vertical`||s===`horizontal`&&o===`middle`)&&a!==`center`&&F(e[a]))return bn(bn({},e),{},{[a]:e[a]+(r||0)});if((s===`horizontal`||s===`vertical`&&a===`center`)&&o!==`middle`&&F(e[o]))return bn(bn({},e),{},{[o]:e[o]+(i||0)})}return e},Tn=(e,t)=>e===`horizontal`&&t===`xAxis`||e===`vertical`&&t===`yAxis`||e===`centric`&&t===`angleAxis`||e===`radial`&&t===`radiusAxis`,En=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},Dn=(e,t,n)=>{if(!e)return null;var r=e.duplicateDomain,i=e.type,a=e.range,o=e.scale,s=e.realScaleType,c=e.isCategorical,l=e.categoricalDomain,u=e.tickCount,d=e.ticks,f=e.niceTicks,p=e.axisType;if(!o)return null;var m=s===`scaleBand`&&o.bandwidth?o.bandwidth()/2:2,h=(t||n)&&i===`category`&&o.bandwidth?o.bandwidth()/m:0;return h=p===`angleAxis`&&a&&a.length>=2?dt(a[0]-a[1])*2*h:h,t&&(d||f)?(d||f||[]).map((e,t)=>{var n=r?r.indexOf(e):e,i=o.map(n);return z(i)?{coordinate:i+h,value:e,offset:h,index:t}:null}).filter(St):c&&l?l.map((e,t)=>{var n=o.map(e);return z(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(St):o.ticks&&!n&&u!=null?o.ticks(u).map((e,t)=>{var n=o.map(e);return z(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(St):o.domain().map((e,t)=>{var n=o.map(e);return z(n)?{coordinate:n+h,value:r?r[e]:e,index:t,offset:h}:null}).filter(St)},On={sign:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r<n;++r)for(var i=0,a=0,o=0;o<t;++o){var s=e[o]?.[r];if(s!=null){var c=s[1],l=s[0],u=ft(c)?l:c;u>=0?(s[0]=i,i+=u,s[1]=i):(s[0]=a,a+=u,s[1]=a)}}}},expand:A,none:s,silhouette:te,wiggle:_,positive:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r<n;++r)for(var i=0,a=0;a<t;++a){var o=e[a]?.[r];if(o!=null){var s=ft(o[1])?o[0]:o[1];s>=0?(o[0]=i,i+=s,o[1]=i):(o[0]=0,o[1]=0)}}}}},kn=(e,t,n)=>{var r=On[n]??s,i=ne().keys(t).value((e,t)=>Number(B(e,t,0))).order(w).offset(r)(e);return i.forEach((n,r)=>{n.forEach((n,i)=>{var a=B(e[i],t[r],0);Array.isArray(a)&&a.length===2&&F(a[0])&&F(a[1])&&(n[0]=a[0],n[1]=a[1])})}),i};function An(e){return e==null?void 0:String(e)}function jn(e){var t=e.axis,n=e.ticks,r=e.bandSize,i=e.entry,a=e.index,o=e.dataKey;if(t.type===`category`){if(!t.allowDuplicatedCategory&&t.dataKey&&!I(i[t.dataKey])){var s=bt(n,`value`,i[t.dataKey]);if(s)return s.coordinate+r/2}return n!=null&&n[a]?n[a].coordinate+r/2:null}var c=B(i,I(o)?t.dataKey:o),l=t.scale.map(c);return F(l)?l:null}var Mn=e=>{var t=e.flat(2).filter(F);return[Math.min(...t),Math.max(...t)]},Nn=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],Pn=(e,t,n)=>{if(!(e==null||Object.keys(e).length===0))return Nn(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var o=a.stackedData.reduce((e,r)=>{var i=Mn(_n(r,t,n));return!z(i[0])||!z(i[1])?e:[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(o[0],r[0]),Math.max(o[1],r[1])]},[1/0,-1/0]))},Fn=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,In=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Ln=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=k(t,e=>e.coordinate),a=[],o=0,s=1,c=i.length;s<c;s++){var l=(i[s]?.coordinate||0)-(i[s-1]?.coordinate||0);a.push(l),o=Math.max(l,o)}var u=o*1e-4,d=1/0;for(var f of a)f>u&&(d=Math.min(f,d));return d===1/0?0:d}return n?void 0:0};function Rn(e){var t=e.tooltipEntrySettings,n=e.dataKey,r=e.payload,i=e.value,a=e.name;return bn(bn({},t),{},{dataKey:n,payload:r,value:i,name:a})}function zn(e,t){if(e!=null)return String(e);if(typeof t==`string`)return t}var Bn=(e,t)=>{if(t===`horizontal`)return e.relativeX;if(t===`vertical`)return e.relativeY},Vn=(e,t)=>t===`centric`?e.angle:e.radius,Hn=e=>e.layout.width,Un=e=>e.layout.height,Wn=e=>e.layout.scale,Gn=e=>e.layout.margin,Kn=m(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),qn=m(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),Jn=`data-recharts-item-index`;function Yn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Xn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Yn(Object(n),!0).forEach(function(t){Zn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Zn(e,t,n){return(t=Qn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qn(e){var t=$n(e,`string`);return typeof t==`symbol`?t:t+``}function $n(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var er=e=>e.brush.height;function tr(e){return qn(e).reduce((e,t)=>t.orientation===`left`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function nr(e){return qn(e).reduce((e,t)=>t.orientation===`right`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function rr(e){return Kn(e).reduce((e,t)=>t.orientation===`top`&&!t.mirror&&!t.hide?e+(typeof t.height==`number`?t.height:30):e,0)}function ir(e){return Kn(e).reduce((e,t)=>t.orientation===`bottom`&&!t.mirror&&!t.hide?e+(typeof t.height==`number`?t.height:30):e,0)}var V=m([Hn,Un,Gn,er,tr,nr,rr,ir,Zt,Qt],(e,t,n,r,i,a,o,s,c,l)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=Xn(Xn({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),f=d.bottom;d.bottom+=r,d=wn(d,c,l);var p=e-d.left-d.right,m=t-d.top-d.bottom;return Xn(Xn({brushBottom:f},d),{},{width:Math.max(p,0),height:Math.max(m,0)})}),ar=m(V,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),or=m(Hn,Un,(e,t)=>({x:0,y:0,width:e,height:t})),sr=(0,N.createContext)(null),cr=()=>(0,N.useContext)(sr)!=null,lr=e=>e.brush,ur=m([lr,V,Gn],(e,t,n)=>({height:e.height,x:F(e.x)?e.x:t.left,y:F(e.y)?e.y:t.top+t.height+t.brushBottom-(n?.bottom||0),width:F(e.width)?e.width:t.width})),dr=!0,fr=function(e,t){var n=[...arguments].slice(2);if(dr&&typeof console<`u`&&console.warn&&(t===void 0&&console.warn(`LogUtils requires an error message argument`),!e))if(t===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var r=0;console.warn(t.replace(/%s/g,()=>n[r++]))}},pr={width:`100%`,height:`100%`,debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},mr=(e,t,n)=>{var r=n.width,i=r===void 0?pr.width:r,a=n.height,o=a===void 0?pr.height:a,s=n.aspect,c=n.maxHeight,l=pt(i)?e:Number(i),u=pt(o)?t:Number(o);return s&&s>0&&(l?u=l/s:u&&(l=u*s),c&&u!=null&&u>c&&(u=c)),{calculatedWidth:l,calculatedHeight:u}},hr={width:0,height:0,overflow:`visible`},gr={width:0,overflowX:`visible`},_r={height:0,overflowY:`visible`},vr={},yr=e=>{var t=e.width,n=e.height,r=pt(t),i=pt(n);return r&&i?hr:r?gr:i?_r:vr};function br(e){var t=e.width,n=e.height,r=e.aspect,i=t,a=n;return i===void 0&&a===void 0?(i=pr.width,a=pr.height):i===void 0?i=r&&r>0?void 0:pr.width:a===void 0&&(a=r&&r>0?void 0:pr.height),{width:i,height:a}}var xr=[`aspect`,`initialDimension`,`width`,`height`,`minWidth`,`minHeight`,`maxHeight`,`children`,`debounce`,`id`,`className`,`onResize`,`style`];function Sr(){return Sr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Sr.apply(null,arguments)}function Cr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function wr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Cr(Object(n),!0).forEach(function(t){Tr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Tr(e,t,n){return(t=Er(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Er(e){var t=Dr(e,`string`);return typeof t==`symbol`?t:t+``}function Dr(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Or(e,t){return Nr(e)||Mr(e,t)||Ar(e,t)||kr()}function kr(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ar(e,t){if(e){if(typeof e==`string`)return jr(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?jr(e,t):void 0}}function jr(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Mr(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Nr(e){if(Array.isArray(e))return e}function Pr(e,t){if(e==null)return{};var n,r,i=Fr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Fr(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Ir=(0,N.createContext)(pr.initialDimension);function Lr(e){return vn(e.width)&&vn(e.height)}function Rr(e){var t=e.children,n=e.width,r=e.height,i=(0,N.useMemo)(()=>({width:n,height:r}),[n,r]);return Lr(i)?N.createElement(Ir.Provider,{value:i},t):null}var zr=()=>(0,N.useContext)(Ir),Br=(0,N.forwardRef)((e,t)=>{var n=e.aspect,r=e.initialDimension,i=r===void 0?pr.initialDimension:r,a=e.width,o=e.height,s=e.minWidth,c=s===void 0?pr.minWidth:s,l=e.minHeight,u=e.maxHeight,d=e.children,f=e.debounce,p=f===void 0?pr.debounce:f,m=e.id,h=e.className,g=e.onResize,_=e.style,v=_===void 0?{}:_,y=Pr(e,xr),b=(0,N.useRef)(null),x=(0,N.useRef)();x.current=g,(0,N.useImperativeHandle)(t,()=>b.current);var S=Or((0,N.useState)({containerWidth:i.width,containerHeight:i.height}),2),w=S[0],T=S[1],E=(0,N.useCallback)((e,t)=>{T(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]);(0,N.useEffect)(()=>{if(b.current==null||typeof ResizeObserver>`u`)return Ct;var e=e=>{var t,n=e[0];if(n!=null){var r=n.contentRect,i=r.width,a=r.height;E(i,a),(t=x.current)==null||t.call(x,i,a)}};p>0&&(e=C(e,p,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),n=b.current.getBoundingClientRect(),r=n.width,i=n.height;return E(r,i),t.observe(b.current),()=>{t.disconnect()}},[E,p]);var D=w.containerWidth,ee=w.containerHeight;fr(!n||n>0,`The aspect(%s) must be greater than zero.`,n);var O=mr(D,ee,{width:a,height:o,aspect:n,maxHeight:u}),k=O.calculatedWidth,A=O.calculatedHeight;return fr(D<0||ee<0||k!=null&&k>0||A!=null&&A>0,`The width(%s) and height(%s) of chart should be greater than 0,
|
|
4
4
|
please check the style of container, or the props width(%s) and height(%s),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e,g as t,h as n}from"./index--9RzUkcE.js";export{t as setSystemLocale,e as setSystemTimeZone};
|