@xopcai/xopc 0.0.234 → 0.0.235
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CztNAQyE.js → agent-avatar-dicebear-dvh9aEm6.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-BHeLVAW5.js → agent-defaults-settings-panel-B9tkmkUj.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-B8c0U7Ze.js → agents-DTXYo-7z.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BxBMAdWc.js → app-management-settings-panel-DXFTk7x6.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DVAxCOPL.js → appearance-settings-D-FD5SOq.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-BtzXxSYK.js → apps-page-BT102W58.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-BpCKsdiO.js → attachment-load-DmBAKvsi.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-a6_hTplT.js → automations-page-BGkF6XNH.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-C7ZwZl04.js → automations-workspace-BRb45-_R.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-OqUf-uET.js → binary-plugins-B-6Ski7l.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-9OAYqVKF.js → block-editor-BgeKQN1F.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-CEHhbDj0.js → browser-settings-page-BkRWxC7D.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-CUgwXXsi.js → browser-workflows-page-D92g81lS.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-CAbI9beX.js → capabilities-settings-panel-DfT-vWTA.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-BksDnAyv.js → channels-settings-C9oGpLR0.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DB9zi_dy.js → chat-terminal-dock-C_9LUs7G.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-CnY8lcGJ.js → connectors-page-SJKV6SHT.js} +1 -1
- package/dist/gateway/static/root/assets/{cron-expression-a9Jyianb.js → cron-expression-BYmr5ZuN.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-B_l2CHWO.js → date-picker-FKL_b_S0.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-DjcEIzVJ.js → dependency-picker-BP68vqBI.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-ZCBsj8Je.js → desktop-pet-DOXjRTqK.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DJJf0EvL.js → desktop-pet-settings-CuG2qYoY.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CMXbAkx-.js → extension-debug-page-BeJ1-5ID.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-WWePedpo.js → extension-page-CncDndLS.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DjIhNJVI.js → extension-settings-page-BxxL0HqU.js} +1 -1
- package/dist/gateway/static/root/assets/{files-Dp8_uGTO.js → files-DQjhZjr2.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-BNj6srhV.js → gateway-config-api-Dc6A6HyJ.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DvlFDxhZ.js → gateway-settings-C2XcazGD.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-Dlahslof.js → heartbeat-settings-BjUEqkkC.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-DJhUd30b.js → home-page-DTSjwfAQ.js} +1 -1
- package/dist/gateway/static/root/assets/{index-CXGQihfj.js → index-DFfvY8IN.js} +40 -40
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-d12AAEaC.js → keyboard-shortcuts-settings-Cwinks_5.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-DUP0UiFY.js → local-app-workbench-page-0wntj9mK.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-_z2o0cD1.js → local-apps-page-WeKm5vZ0.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CPUaLcGH.js → logs-page-DFgJr7Zx.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-eTBfNgXU.js → management-settings-8bEvKO0R.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-7rTfQCN_.js → markdown-split-B6wQhwLV.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-BIfKo5Ow.js → media-plugins-BSEPuO76.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-dOvbZBOQ.js → notes-page-CPgbeO1u.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-DQMUpDc9.js → notes-workbench-DIXCtwhs.js} +2 -2
- package/dist/gateway/static/root/assets/{product-open-page-CgZhadZQ.js → product-open-page-DNHWn_26.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-D1HidxgT.js → project-detail-page-6jgRJg4w.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-CxwNbbud.js → projects-page-Bd4nXs4y.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-CK59rSc_.js → remote-access-hub-C_5-u9U-.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-D3PS55Yg.js → runtime-tools-settings-panel-D3TCJGy3.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-H-aeWTzM.js → schema-form-DUAlwNoO.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-C2tP7363.js → sessions-page-BqYAR86S.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-a146I0uZ.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-B9oF8Rhw.js → settings-form-section-D7nQ3Lfu.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-CazDM3n5.js → settings-loading-skeleton-CwGM9zKH.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-C6pmQNzY.js → settings-page-CMAkMc3I.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-Cn2E0G2o.js → setup-status-panel-rhaERxAL.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-XgxvE8cx.js → share-preview-page-BzkXvuH6.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-Czph0_fM.js → shares-settings-BvsM3Im5.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-DDq_QEqd.js → skill-reload-api-u7E0gqFo.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-CfNV6kgb.js → skills-page-DJRr5HFw.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-DgxGb7v7.js → skills-page.utils-DcrBe39q.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-B4W--Ukh.js → system-settings-panel-BUsykmjx.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-UY5kNWoR.js → task-detail-page-C9QgWfYG.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-DR7YWBzR.js → use-autosave-DDEypreQ.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-DnUL8kJU.js → user-context-page-Ch0cfQfI.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-BZhqoxBR.js → voice-api-key-field-BLa_vdXE.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CouKiK45.js → work-discovery-overlay-DS3w1Fyq.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CUqAESrr.js → workflow-run-setup-panel-jQl_wmYC.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-B8dJRjMJ.js → workflows-page-DyTwkdzs.js} +1 -1
- package/dist/gateway/static/root/index.html +2 -2
- package/dist/package.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/tools/create-share-tool.js +1 -1
- package/dist/src/agent/tools/publish-artifacts.js +1 -1
- package/dist/src/agent/tools/send-media.js +1 -1
- package/dist/src/agent/tools/workflow-tool.js +1 -1
- package/dist/src/agent/tools/write.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.js +4 -4
- package/dist/src/cli/commands/channels.js +1 -1
- package/dist/src/cli/commands/connectors.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/extensions/sdk/index.js +1 -1
- package/dist/src/files/file-service.d.ts +10 -2
- package/dist/src/files/file-service.js +33 -12
- package/dist/src/gateway/file-path-classifier.d.ts +30 -0
- package/dist/src/gateway/file-path-classifier.js +105 -0
- package/dist/src/gateway/file-reference-errors.d.ts +6 -0
- package/dist/src/gateway/file-reference-errors.js +21 -0
- package/dist/src/gateway/file-reference-registry.d.ts +34 -0
- package/dist/src/gateway/file-reference-registry.js +45 -0
- package/dist/src/gateway/file-space-service.d.ts +4 -0
- package/dist/src/gateway/file-space-service.js +19 -0
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/app.js +3 -1
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/file-references.d.ts +4 -0
- package/dist/src/gateway/hono/routes/file-references.js +98 -0
- package/dist/src/gateway/hono/routes/files.js +39 -17
- package/dist/src/gateway/hono/routes/html-preview.d.ts +4 -0
- package/dist/src/gateway/hono/routes/html-preview.js +45 -0
- package/dist/src/gateway/hono/routes/shares.js +18 -10
- package/dist/src/gateway/hono/routes/tasks.js +3 -3
- package/dist/src/gateway/security/csp.d.ts +1 -1
- package/dist/src/gateway/security/csp.js +2 -2
- package/dist/src/gateway/service.js +5 -5
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/infra/update-restart.js +1 -1
- package/dist/src/storage/sqlite/config-repository.d.ts +5 -0
- package/dist/src/storage/sqlite/config-repository.js +8 -1
- package/dist/src/tasks/home-query-service.js +2 -2
- package/dist/src/tasks/task-signal-service.js +1 -1
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +4 -4
- package/dist/gateway/static/root/assets/settings-advanced-gate-DlYBA2N-.js +0 -1
package/dist/gateway/static/root/assets/{projects-page-CxwNbbud.js → projects-page-Bd4nXs4y.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{n as a,r as o}from"./popover-select-3E24E65N.js";import{t as s}from"./loader-circle-CifKLtgG.js";import{t as c}from"./plus-Q2yW6OE7.js";import{t as l}from"./search-DA7gz22f.js";import{t as u}from"./x-B_N4OPjy.js";import{t as d}from"./cn-JdwAhgNB.js";import{t as f}from"./button-CSEbl4zT.js";import{t as ee}from"./messages-CoovNoMn.js";import{n as p}from"./locale-store-8k4mvYGL.js";import{a as m,i as h,n as g,o as _,r as v,s as y,t as b}from"./dist-BPoKqzeH.js";import{Bi as x,Es as S,Sl as C,Tc as w,Ts as T,Vr as E,Xi as D,Yi as O,Zi as k,ca as A,ea as j,ia as M,ja as N,ka as P,ms as F,wc as te,yl as I,zi as ne}from"./index-CXGQihfj.js";var L=n(),R=e(t(),1),z=r();function B(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:E(n)}function re(e){return[...e].sort((e,t)=>{let n=Number(!!t.pinnedAt)-Number(!!e.pinnedAt);return n===0?new Date(t.lastActiveAt??t.updatedAt).getTime()-new Date(e.lastActiveAt??e.updatedAt).getTime():n})}function ie(){let e=(0,L.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,z.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:6},V)}),e[0]=t):t=e[0],t}function V(e,t){return(0,z.jsx)(P,{className:`h-40 rounded-xl`},t)}function ae(e){let t=(0,L.c)(59),{project:n,busy:r,onTogglePin:a,onToggleArchive:o}=e,s=p(H),c,l,u,d,m,h,g,_;if(t[0]!==s||t[1]!==n.brief||t[2]!==n.description||t[3]!==n.id||t[4]!==n.lastActiveAt||t[5]!==n.name||t[6]!==n.status||t[7]!==n.updatedAt||t[8]!==n.workspaceRoot){let e=ee(s).projectsPage;c=e.management,g=`flex h-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4`;let r;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,z.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:(0,z.jsx)(w,{className:`size-4`,"aria-hidden":!0})}),t[17]=r):r=t[17];let a;t[18]===n.name?a=t[19]:(a=(0,z.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[18]=n.name,t[19]=a);let o=(0,z.jsxs)(`div`,{className:`min-w-0`,children:[a,(0,z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:e.statuses[n.status]})]}),f;t[20]===o?f=t[21]:(f=(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[r,o]}),t[20]=o,t[21]=f);let p;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,z.jsx)(I,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[22]=p):p=t[22];let v;t[23]===f?v=t[24]:(v=(0,z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[f,p]}),t[23]=f,t[24]=v),_=(0,z.jsxs)(i,{to:`/projects/${encodeURIComponent(n.id)}`,className:`group flex min-w-0 flex-1 flex-col rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[v,(0,z.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-10 text-xs leading-5 text-fg-muted`,children:n.description||n.brief||e.noDescription})]}),h=`mt-3 flex shrink-0 items-end justify-between gap-3 border-t border-edge-subtle pt-3`,d=`min-w-0 text-[11px] text-fg-subtle`,m=(0,z.jsx)(`p`,{className:`truncate`,children:n.workspaceRoot||e.agentDefault}),l=`mt-1`,u=B(n.lastActiveAt??n.updatedAt,e.never),t[0]=s,t[1]=n.brief,t[2]=n.description,t[3]=n.id,t[4]=n.lastActiveAt,t[5]=n.name,t[6]=n.status,t[7]=n.updatedAt,t[8]=n.workspaceRoot,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=m,t[14]=h,t[15]=g,t[16]=_}else c=t[9],l=t[10],u=t[11],d=t[12],m=t[13],h=t[14],g=t[15],_=t[16];let v;t[25]!==l||t[26]!==u?(v=(0,z.jsx)(`p`,{className:l,children:u}),t[25]=l,t[26]=u,t[27]=v):v=t[27];let y;t[28]!==d||t[29]!==m||t[30]!==v?(y=(0,z.jsxs)(`div`,{className:d,children:[m,v]}),t[28]=d,t[29]=m,t[30]=v,t[31]=y):y=t[31];let b=n.pinnedAt?c.unpin:c.pin,x=n.pinnedAt?c.unpin:c.pin,E;t[32]===n.pinnedAt?E=t[33]:(E=n.pinnedAt?(0,z.jsx)(T,{className:`size-4`,"aria-hidden":!0}):(0,z.jsx)(S,{className:`size-4`,"aria-hidden":!0}),t[32]=n.pinnedAt,t[33]=E);let D;t[34]!==r||t[35]!==a||t[36]!==b||t[37]!==x||t[38]!==E?(D=(0,z.jsx)(f,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:a,"aria-label":b,title:x,children:E}),t[34]=r,t[35]=a,t[36]=b,t[37]=x,t[38]=E,t[39]=D):D=t[39];let O=n.status===`archived`?c.restore:c.archive,k=n.status===`archived`?c.restore:c.archive,A;t[40]===n.status?A=t[41]:(A=n.status===`archived`?(0,z.jsx)(F,{className:`size-4`,"aria-hidden":!0}):(0,z.jsx)(C,{className:`size-4`,"aria-hidden":!0}),t[40]=n.status,t[41]=A);let j;t[42]!==r||t[43]!==o||t[44]!==O||t[45]!==k||t[46]!==A?(j=(0,z.jsx)(f,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:o,"aria-label":O,title:k,children:A}),t[42]=r,t[43]=o,t[44]=O,t[45]=k,t[46]=A,t[47]=j):j=t[47];let M;t[48]!==D||t[49]!==j?(M=(0,z.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[D,j]}),t[48]=D,t[49]=j,t[50]=M):M=t[50];let N;t[51]!==M||t[52]!==h||t[53]!==y?(N=(0,z.jsxs)(`div`,{className:h,children:[y,M]}),t[51]=M,t[52]=h,t[53]=y,t[54]=N):N=t[54];let P;return t[55]!==N||t[56]!==g||t[57]!==_?(P=(0,z.jsxs)(`article`,{className:g,children:[_,N]}),t[55]=N,t[56]=g,t[57]=_,t[58]=P):P=t[58],P}function H(e){return e.language}function U(){let e=ee(p(e=>e.language)),t=e.projectsPage,n=t.management,r=e.chat.workingDirectory,i=N(e=>e.setPageHeader),S=N(e=>e.clearPageHeader),[C,T]=(0,R.useState)([]),[E,P]=(0,R.useState)(!0),[F,I]=(0,R.useState)(null),[L,B]=(0,R.useState)(``),[V,H]=(0,R.useState)(!1),[U,oe]=(0,R.useState)(`active`),[se,W]=(0,R.useState)(null),[ce,G]=(0,R.useState)(!1),[le,K]=(0,R.useState)(null),[q,ue]=(0,R.useState)(!1),[J,de]=(0,R.useState)(``),[Y,fe]=(0,R.useState)(``),[X,pe]=(0,R.useState)(``),Z=A({initialPath:X,onPicked:pe}),Q=(0,R.useCallback)(async()=>{P(!0),I(null);try{T(re((await O({limit:100,sortBy:`updatedAt`,sortOrder:`desc`})).items))}catch(e){I(e instanceof Error?e.message:String(e))}finally{P(!1)}},[]);(0,R.useEffect)(()=>{Q()},[Q]);let $=(0,R.useMemo)(()=>{let e=L.trim().toLocaleLowerCase();return C.filter(e=>U===`all`||e.status===U).filter(t=>!e||[t.name,t.description,t.brief,t.workspaceRoot].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e)))},[U,C,L]),me=(0,R.useMemo)(()=>(0,z.jsxs)(f,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>G(!0),children:[(0,z.jsx)(c,{className:`size-4`,"aria-hidden":!0}),t.create]}),[t.create]);(0,R.useLayoutEffect)(()=>(i({startExtra:null,main:(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,z.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.subtitle})]}),end:me}),()=>S()),[S,me,n.subtitle,n.title,i]);let he=(0,R.useCallback)(async e=>{e.preventDefault();let t=J.trim(),n=X.trim();if(!(!t||!n||q)){ue(!0),K(null);try{let e=await x({name:t,...Y.trim()?{description:Y.trim()}:{},workspaceRoot:n});T(t=>[e,...t.filter(t=>t.id!==e.id)]),de(``),fe(``),pe(``),G(!1),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){K(e instanceof Error?e.message:String(e))}finally{ue(!1)}}},[q,Y,J,X]),ge=(0,R.useCallback)(async(e,t)=>{W(e.id),I(null);try{let n;n=t===`pin`?e.pinnedAt?await j(e.id):await D(e.id):e.status===`archived`?await k(e.id):await ne(e.id),T(e=>e.map(e=>e.id===n.id?n:e)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){I(e instanceof Error?e.message:String(e))}finally{W(null)}},[]),_e=[{id:`active`,label:t.statuses.active},{id:`paused`,label:t.statuses.paused},{id:`archived`,label:t.statuses.archived},{id:`all`,label:t.all}],ve=_e.find(e=>e.id===U)?.label??t.all,ye=n.resultCount.replace(`{{status}}`,ve).replace(`{{count}}`,String($.length));return(0,z.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,z.jsx)(b,{open:ce,onOpenChange:e=>{G(e),e||K(null)},children:(0,z.jsxs)(_,{children:[(0,z.jsx)(m,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,z.jsxs)(v,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,z.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,z.jsx)(y,{className:`text-base font-semibold text-fg`,children:t.createTitle}),(0,z.jsx)(h,{className:`mt-1 text-sm text-fg-muted`,children:t.createDescription})]}),(0,z.jsxs)(`form`,{onSubmit:he,className:`flex min-h-0 flex-1 flex-col`,children:[(0,z.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.projectName,(0,z.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 font-normal outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:J,onChange:e=>de(e.target.value),maxLength:160})]}),(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[n.descriptionLabel,(0,z.jsx)(`textarea`,{className:`min-h-28 resize-none rounded-lg border border-edge bg-surface-base px-3 py-2 font-normal leading-6 outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:Y,onChange:e=>fe(e.target.value),maxLength:2e3,placeholder:n.descriptionPlaceholder})]}),(0,z.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,z.jsx)(`span`,{className:`font-medium text-fg`,children:t.workspaceRoot}),(0,z.jsxs)(`button`,{type:`button`,className:`flex min-h-12 w-full items-center gap-3 rounded-lg border border-edge bg-surface-base px-3 py-2 text-left outline-none transition-colors hover:bg-surface-hover focus-visible:border-accent focus-visible:ring-2 focus-visible:ring-accent/20 disabled:cursor-not-allowed disabled:opacity-60`,onClick:Z.pick,disabled:q||Z.picking,children:[Z.picking?(0,z.jsx)(s,{className:`size-5 shrink-0 animate-spin text-accent`,"aria-hidden":!0}):(0,z.jsx)(te,{className:`size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:X?r.chooseFolder:r.selectWorkingDirectory}),(0,z.jsx)(`span`,{className:d(`mt-0.5 block truncate font-mono text-xs font-normal`,X?`text-fg-muted`:`text-fg-subtle`),title:X||void 0,children:X||t.workspaceSelectionPlaceholder})]})]}),(0,z.jsx)(`p`,{className:`text-xs font-normal text-fg-subtle`,children:t.workspaceSelectionHint})]}),le?(0,z.jsx)(`p`,{className:`rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:le}):null]}),(0,z.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,z.jsx)(g,{asChild:!0,children:(0,z.jsx)(f,{type:`button`,variant:`ghost`,children:t.cancel})}),(0,z.jsx)(f,{type:`submit`,variant:`primary`,disabled:q||!J.trim()||!X.trim(),children:q?t.home.creating:t.create})]})]})]})]})}),Z.hasNativePicker?null:(0,z.jsx)(M,{open:Z.modalOpen,onOpenChange:Z.setModalOpen,initialAbsolutePath:X||void 0,onConfirm:Z.confirmPick,wd:r}),(0,z.jsxs)(`section`,{className:`flex min-h-10 flex-wrap items-center justify-between gap-3`,"aria-label":n.filterLabel,children:[(0,z.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,"aria-live":`polite`,children:ye}),(0,z.jsxs)(`div`,{className:d(`ml-auto flex min-w-0 items-center justify-end gap-2`,V&&`w-full sm:w-auto`),children:[V?(0,z.jsxs)(`div`,{className:`relative min-w-0 flex-1 sm:w-64 sm:flex-none`,children:[(0,z.jsx)(l,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,z.jsx)(`input`,{autoFocus:!0,className:`h-9 w-full rounded-lg border border-edge bg-surface-panel pl-9 pr-9 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:L,onChange:e=>B(e.target.value),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder}),(0,z.jsx)(`button`,{type:`button`,className:`absolute right-1.5 top-1/2 flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-subtle transition-colors hover:bg-surface-hover hover:text-fg`,onClick:()=>{B(``),H(!1)},"aria-label":n.clearSearch,title:n.clearSearch,children:(0,z.jsx)(u,{className:`size-3.5`,"aria-hidden":!0})})]}):(0,z.jsx)(f,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,onClick:()=>H(!0),"aria-label":t.searchPlaceholder,title:t.searchPlaceholder,children:(0,z.jsx)(l,{className:`size-4`,"aria-hidden":!0})}),(0,z.jsx)(a,{className:`w-28 sm:w-32`,triggerClassName:`h-9 border-edge bg-surface-panel px-2.5 text-xs font-medium`,contentClassName:`min-w-36`,align:`end`,value:U,"aria-label":n.filterLabel,onChange:e=>oe(e.target.value),children:_e.map(e=>(0,z.jsx)(o,{value:e.id,children:e.label},e.id))})]})]}),F?(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,role:`alert`,children:[(0,z.jsx)(`span`,{children:F}),(0,z.jsx)(f,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void Q(),children:t.home.retry})]}):null,E?(0,z.jsx)(ie,{}):$.length?(0,z.jsx)(`section`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:$.map(e=>(0,z.jsx)(ae,{project:e,busy:se===e.id,onTogglePin:()=>void ge(e,`pin`),onToggleArchive:()=>void ge(e,`archive`)},e.id))}):(0,z.jsxs)(`section`,{className:`rounded-xl border border-dashed border-edge p-10 text-center`,children:[(0,z.jsx)(w,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,z.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.emptyTitle}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.emptyHint})]})]})}export{U as ProjectsPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{n as a,r as o}from"./popover-select-3E24E65N.js";import{t as s}from"./loader-circle-CifKLtgG.js";import{t as c}from"./plus-Q2yW6OE7.js";import{t as l}from"./search-DA7gz22f.js";import{t as u}from"./x-B_N4OPjy.js";import{t as d}from"./cn-JdwAhgNB.js";import{t as f}from"./button-CSEbl4zT.js";import{t as ee}from"./messages-CoovNoMn.js";import{n as p}from"./locale-store-8k4mvYGL.js";import{a as m,i as h,n as g,o as _,r as v,s as y,t as b}from"./dist-BPoKqzeH.js";import{Bi as x,Es as S,Sl as C,Tc as w,Ts as T,Vr as E,Xi as D,Yi as O,Zi as k,ca as A,ea as j,ia as M,ja as N,ka as P,ms as F,wc as te,yl as I,zi as ne}from"./index-DFfvY8IN.js";var L=n(),R=e(t(),1),z=r();function B(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:E(n)}function re(e){return[...e].sort((e,t)=>{let n=Number(!!t.pinnedAt)-Number(!!e.pinnedAt);return n===0?new Date(t.lastActiveAt??t.updatedAt).getTime()-new Date(e.lastActiveAt??e.updatedAt).getTime():n})}function ie(){let e=(0,L.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,z.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:6},V)}),e[0]=t):t=e[0],t}function V(e,t){return(0,z.jsx)(P,{className:`h-40 rounded-xl`},t)}function ae(e){let t=(0,L.c)(59),{project:n,busy:r,onTogglePin:a,onToggleArchive:o}=e,s=p(H),c,l,u,d,m,h,g,_;if(t[0]!==s||t[1]!==n.brief||t[2]!==n.description||t[3]!==n.id||t[4]!==n.lastActiveAt||t[5]!==n.name||t[6]!==n.status||t[7]!==n.updatedAt||t[8]!==n.workspaceRoot){let e=ee(s).projectsPage;c=e.management,g=`flex h-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4`;let r;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,z.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:(0,z.jsx)(w,{className:`size-4`,"aria-hidden":!0})}),t[17]=r):r=t[17];let a;t[18]===n.name?a=t[19]:(a=(0,z.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[18]=n.name,t[19]=a);let o=(0,z.jsxs)(`div`,{className:`min-w-0`,children:[a,(0,z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:e.statuses[n.status]})]}),f;t[20]===o?f=t[21]:(f=(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[r,o]}),t[20]=o,t[21]=f);let p;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,z.jsx)(I,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[22]=p):p=t[22];let v;t[23]===f?v=t[24]:(v=(0,z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[f,p]}),t[23]=f,t[24]=v),_=(0,z.jsxs)(i,{to:`/projects/${encodeURIComponent(n.id)}`,className:`group flex min-w-0 flex-1 flex-col rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[v,(0,z.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-10 text-xs leading-5 text-fg-muted`,children:n.description||n.brief||e.noDescription})]}),h=`mt-3 flex shrink-0 items-end justify-between gap-3 border-t border-edge-subtle pt-3`,d=`min-w-0 text-[11px] text-fg-subtle`,m=(0,z.jsx)(`p`,{className:`truncate`,children:n.workspaceRoot||e.agentDefault}),l=`mt-1`,u=B(n.lastActiveAt??n.updatedAt,e.never),t[0]=s,t[1]=n.brief,t[2]=n.description,t[3]=n.id,t[4]=n.lastActiveAt,t[5]=n.name,t[6]=n.status,t[7]=n.updatedAt,t[8]=n.workspaceRoot,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=m,t[14]=h,t[15]=g,t[16]=_}else c=t[9],l=t[10],u=t[11],d=t[12],m=t[13],h=t[14],g=t[15],_=t[16];let v;t[25]!==l||t[26]!==u?(v=(0,z.jsx)(`p`,{className:l,children:u}),t[25]=l,t[26]=u,t[27]=v):v=t[27];let y;t[28]!==d||t[29]!==m||t[30]!==v?(y=(0,z.jsxs)(`div`,{className:d,children:[m,v]}),t[28]=d,t[29]=m,t[30]=v,t[31]=y):y=t[31];let b=n.pinnedAt?c.unpin:c.pin,x=n.pinnedAt?c.unpin:c.pin,E;t[32]===n.pinnedAt?E=t[33]:(E=n.pinnedAt?(0,z.jsx)(T,{className:`size-4`,"aria-hidden":!0}):(0,z.jsx)(S,{className:`size-4`,"aria-hidden":!0}),t[32]=n.pinnedAt,t[33]=E);let D;t[34]!==r||t[35]!==a||t[36]!==b||t[37]!==x||t[38]!==E?(D=(0,z.jsx)(f,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:a,"aria-label":b,title:x,children:E}),t[34]=r,t[35]=a,t[36]=b,t[37]=x,t[38]=E,t[39]=D):D=t[39];let O=n.status===`archived`?c.restore:c.archive,k=n.status===`archived`?c.restore:c.archive,A;t[40]===n.status?A=t[41]:(A=n.status===`archived`?(0,z.jsx)(F,{className:`size-4`,"aria-hidden":!0}):(0,z.jsx)(C,{className:`size-4`,"aria-hidden":!0}),t[40]=n.status,t[41]=A);let j;t[42]!==r||t[43]!==o||t[44]!==O||t[45]!==k||t[46]!==A?(j=(0,z.jsx)(f,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:o,"aria-label":O,title:k,children:A}),t[42]=r,t[43]=o,t[44]=O,t[45]=k,t[46]=A,t[47]=j):j=t[47];let M;t[48]!==D||t[49]!==j?(M=(0,z.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[D,j]}),t[48]=D,t[49]=j,t[50]=M):M=t[50];let N;t[51]!==M||t[52]!==h||t[53]!==y?(N=(0,z.jsxs)(`div`,{className:h,children:[y,M]}),t[51]=M,t[52]=h,t[53]=y,t[54]=N):N=t[54];let P;return t[55]!==N||t[56]!==g||t[57]!==_?(P=(0,z.jsxs)(`article`,{className:g,children:[_,N]}),t[55]=N,t[56]=g,t[57]=_,t[58]=P):P=t[58],P}function H(e){return e.language}function U(){let e=ee(p(e=>e.language)),t=e.projectsPage,n=t.management,r=e.chat.workingDirectory,i=N(e=>e.setPageHeader),S=N(e=>e.clearPageHeader),[C,T]=(0,R.useState)([]),[E,P]=(0,R.useState)(!0),[F,I]=(0,R.useState)(null),[L,B]=(0,R.useState)(``),[V,H]=(0,R.useState)(!1),[U,oe]=(0,R.useState)(`active`),[se,W]=(0,R.useState)(null),[ce,G]=(0,R.useState)(!1),[le,K]=(0,R.useState)(null),[q,ue]=(0,R.useState)(!1),[J,de]=(0,R.useState)(``),[Y,fe]=(0,R.useState)(``),[X,pe]=(0,R.useState)(``),Z=A({initialPath:X,onPicked:pe}),Q=(0,R.useCallback)(async()=>{P(!0),I(null);try{T(re((await O({limit:100,sortBy:`updatedAt`,sortOrder:`desc`})).items))}catch(e){I(e instanceof Error?e.message:String(e))}finally{P(!1)}},[]);(0,R.useEffect)(()=>{Q()},[Q]);let $=(0,R.useMemo)(()=>{let e=L.trim().toLocaleLowerCase();return C.filter(e=>U===`all`||e.status===U).filter(t=>!e||[t.name,t.description,t.brief,t.workspaceRoot].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e)))},[U,C,L]),me=(0,R.useMemo)(()=>(0,z.jsxs)(f,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>G(!0),children:[(0,z.jsx)(c,{className:`size-4`,"aria-hidden":!0}),t.create]}),[t.create]);(0,R.useLayoutEffect)(()=>(i({startExtra:null,main:(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,z.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.subtitle})]}),end:me}),()=>S()),[S,me,n.subtitle,n.title,i]);let he=(0,R.useCallback)(async e=>{e.preventDefault();let t=J.trim(),n=X.trim();if(!(!t||!n||q)){ue(!0),K(null);try{let e=await x({name:t,...Y.trim()?{description:Y.trim()}:{},workspaceRoot:n});T(t=>[e,...t.filter(t=>t.id!==e.id)]),de(``),fe(``),pe(``),G(!1),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){K(e instanceof Error?e.message:String(e))}finally{ue(!1)}}},[q,Y,J,X]),ge=(0,R.useCallback)(async(e,t)=>{W(e.id),I(null);try{let n;n=t===`pin`?e.pinnedAt?await j(e.id):await D(e.id):e.status===`archived`?await k(e.id):await ne(e.id),T(e=>e.map(e=>e.id===n.id?n:e)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){I(e instanceof Error?e.message:String(e))}finally{W(null)}},[]),_e=[{id:`active`,label:t.statuses.active},{id:`paused`,label:t.statuses.paused},{id:`archived`,label:t.statuses.archived},{id:`all`,label:t.all}],ve=_e.find(e=>e.id===U)?.label??t.all,ye=n.resultCount.replace(`{{status}}`,ve).replace(`{{count}}`,String($.length));return(0,z.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,z.jsx)(b,{open:ce,onOpenChange:e=>{G(e),e||K(null)},children:(0,z.jsxs)(_,{children:[(0,z.jsx)(m,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,z.jsxs)(v,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,z.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,z.jsx)(y,{className:`text-base font-semibold text-fg`,children:t.createTitle}),(0,z.jsx)(h,{className:`mt-1 text-sm text-fg-muted`,children:t.createDescription})]}),(0,z.jsxs)(`form`,{onSubmit:he,className:`flex min-h-0 flex-1 flex-col`,children:[(0,z.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.projectName,(0,z.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 font-normal outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:J,onChange:e=>de(e.target.value),maxLength:160})]}),(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[n.descriptionLabel,(0,z.jsx)(`textarea`,{className:`min-h-28 resize-none rounded-lg border border-edge bg-surface-base px-3 py-2 font-normal leading-6 outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:Y,onChange:e=>fe(e.target.value),maxLength:2e3,placeholder:n.descriptionPlaceholder})]}),(0,z.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,z.jsx)(`span`,{className:`font-medium text-fg`,children:t.workspaceRoot}),(0,z.jsxs)(`button`,{type:`button`,className:`flex min-h-12 w-full items-center gap-3 rounded-lg border border-edge bg-surface-base px-3 py-2 text-left outline-none transition-colors hover:bg-surface-hover focus-visible:border-accent focus-visible:ring-2 focus-visible:ring-accent/20 disabled:cursor-not-allowed disabled:opacity-60`,onClick:Z.pick,disabled:q||Z.picking,children:[Z.picking?(0,z.jsx)(s,{className:`size-5 shrink-0 animate-spin text-accent`,"aria-hidden":!0}):(0,z.jsx)(te,{className:`size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:X?r.chooseFolder:r.selectWorkingDirectory}),(0,z.jsx)(`span`,{className:d(`mt-0.5 block truncate font-mono text-xs font-normal`,X?`text-fg-muted`:`text-fg-subtle`),title:X||void 0,children:X||t.workspaceSelectionPlaceholder})]})]}),(0,z.jsx)(`p`,{className:`text-xs font-normal text-fg-subtle`,children:t.workspaceSelectionHint})]}),le?(0,z.jsx)(`p`,{className:`rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:le}):null]}),(0,z.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,z.jsx)(g,{asChild:!0,children:(0,z.jsx)(f,{type:`button`,variant:`ghost`,children:t.cancel})}),(0,z.jsx)(f,{type:`submit`,variant:`primary`,disabled:q||!J.trim()||!X.trim(),children:q?t.home.creating:t.create})]})]})]})]})}),Z.hasNativePicker?null:(0,z.jsx)(M,{open:Z.modalOpen,onOpenChange:Z.setModalOpen,initialAbsolutePath:X||void 0,onConfirm:Z.confirmPick,wd:r}),(0,z.jsxs)(`section`,{className:`flex min-h-10 flex-wrap items-center justify-between gap-3`,"aria-label":n.filterLabel,children:[(0,z.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,"aria-live":`polite`,children:ye}),(0,z.jsxs)(`div`,{className:d(`ml-auto flex min-w-0 items-center justify-end gap-2`,V&&`w-full sm:w-auto`),children:[V?(0,z.jsxs)(`div`,{className:`relative min-w-0 flex-1 sm:w-64 sm:flex-none`,children:[(0,z.jsx)(l,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,z.jsx)(`input`,{autoFocus:!0,className:`h-9 w-full rounded-lg border border-edge bg-surface-panel pl-9 pr-9 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:L,onChange:e=>B(e.target.value),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder}),(0,z.jsx)(`button`,{type:`button`,className:`absolute right-1.5 top-1/2 flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-subtle transition-colors hover:bg-surface-hover hover:text-fg`,onClick:()=>{B(``),H(!1)},"aria-label":n.clearSearch,title:n.clearSearch,children:(0,z.jsx)(u,{className:`size-3.5`,"aria-hidden":!0})})]}):(0,z.jsx)(f,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,onClick:()=>H(!0),"aria-label":t.searchPlaceholder,title:t.searchPlaceholder,children:(0,z.jsx)(l,{className:`size-4`,"aria-hidden":!0})}),(0,z.jsx)(a,{className:`w-28 sm:w-32`,triggerClassName:`h-9 border-edge bg-surface-panel px-2.5 text-xs font-medium`,contentClassName:`min-w-36`,align:`end`,value:U,"aria-label":n.filterLabel,onChange:e=>oe(e.target.value),children:_e.map(e=>(0,z.jsx)(o,{value:e.id,children:e.label},e.id))})]})]}),F?(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,role:`alert`,children:[(0,z.jsx)(`span`,{children:F}),(0,z.jsx)(f,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void Q(),children:t.home.retry})]}):null,E?(0,z.jsx)(ie,{}):$.length?(0,z.jsx)(`section`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:$.map(e=>(0,z.jsx)(ae,{project:e,busy:se===e.id,onTogglePin:()=>void ge(e,`pin`),onToggleArchive:()=>void ge(e,`archive`)},e.id))}):(0,z.jsxs)(`section`,{className:`rounded-xl border border-dashed border-edge p-10 text-center`,children:[(0,z.jsx)(w,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,z.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.emptyTitle}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.emptyHint})]})]})}export{U as ProjectsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,p as a,t as o}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as s}from"./check-DUBLcKHA.js";import{t as c}from"./copy-Dv6d4Dvw.js";import{t as l}from"./external-link-DjqjBmc3.js";import{t as u}from"./globe-DSSGFWFn.js";import{t as d}from"./loader-circle-CifKLtgG.js";import{t as f}from"./cn-JdwAhgNB.js";import{t as p}from"./button-CSEbl4zT.js";import{s as m}from"./form-field-width-DJw_jULe.js";import{t as h}from"./copy-to-clipboard-HOJ79TWv.js";import{t as g}from"./messages-CoovNoMn.js";import{a as _,i as v,n as y,r as b,s as x}from"./locale-store-8k4mvYGL.js";import{i as S,o as C}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{a as w,i as T,o as E,r as D,s as O,t as k}from"./dist-BPoKqzeH.js";import{i as A}from"./vendor-swr-BIWyz7Rc.js";import{n as j,r as M}from"./gateway-config-swr-R702lNJR.js";import{a as N,n as P,r as F}from"./oauth-api-DpLONwfK.js";import{Bo as I,Di as L,Ps as R,To as z,Wc as B,Wo as V,bo as H,bs as ee,di as U,ds as W,fn as te,is as G,ka as K,ns as q,rl as J,sa as ne,sc as re,tl as ie,yl as ae}from"./index-CXGQihfj.js";import{n as oe,r as Y,t as X}from"./settings-page-layout-BRQNel6r.js";import{r as se}from"./mobile-device-api-CvjVB_TB.js";import{t as ce}from"./page-tabs-BaEQMYm_.js";import{n as le,r as ue,t as de}from"./settings-form-section-B9oF8Rhw.js";import{t as fe}from"./settings-advanced-gate-DlYBA2N-.js";import{n as pe,r as me,t as he}from"./oauth-authorization-window-Cdolr2wE.js";var Z=e(t(),1),Q=n(),$=r();function ge(e){let t=(0,Q.c)(10),{language:n,label:r,section:i,className:a}=e,o;t[0]!==n||t[1]!==i?(o=H(n,i),t[0]=n,t[1]=i,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=f(`inline-flex items-center gap-1 text-sm font-medium text-accent hover:underline`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,a),t[3]=a,t[4]=s);let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(l,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[5]=c):c=t[5];let u;return t[6]!==r||t[7]!==o||t[8]!==s?(u=(0,$.jsxs)(`a`,{href:o,target:`_blank`,rel:`noreferrer`,className:s,children:[r,c]}),t[6]=r,t[7]=o,t[8]=s,t[9]=u):u=t[9],u}async function _e(){let e=await v(`/api/exposure/status`);if(!e.ok)throw Error(`Failed to load exposure status (${e.status})`);return await e.json()}async function ve(e=`serve`){let t=await v(`/api/exposure/tailscale/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mode:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`Start failed (${t.status})`)}return await t.json()}async function ye(){let e=await v(`/api/exposure/tailscale/stop`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`Stop failed (${e.status})`)}return await e.json()}async function be(){return _(b(`/api/tunnel/status`))}async function xe(){await _(b(`/api/tunnel/consent`),{method:`POST`,body:JSON.stringify({})})}async function Se(){await _(b(`/api/tunnel/registration-key`),{method:`POST`,body:JSON.stringify({})})}async function Ce(){return _(b(`/api/tunnel/start`),{method:`POST`,body:JSON.stringify({})})}async function we(e){return _(b(`/api/tunnel/stop`),{method:`POST`,body:JSON.stringify({release:e?.release===!0})})}async function Te(){let e=(await _(b(`/api/tunnel/reveal-registration-secret`),{method:`POST`,body:JSON.stringify({})})).payload;if(!e)throw Error(`Missing reveal payload`);return{registrationSecret:e.registrationSecret??null,source:e.source===`config`?`config`:`none`}}async function Ee(e){await _(b(`/api/config`),{method:`PATCH`,body:JSON.stringify({tunnel:e})})}function De(e){switch(e){case`active`:return`bg-emerald-500/15 text-emerald-700 dark:text-emerald-400`;case`connecting`:return`bg-amber-500/15 text-amber-700 dark:text-amber-400`;default:return`bg-surface-hover text-fg-muted`}}function Oe(e){let t=(0,Q.c)(5),{label:n,kind:r}=e,i;t[0]===r?i=t[1]:(i=f(`rounded-full px-2 py-0.5 text-[11px] font-medium`,De(r)),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,$.jsx)(`span`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function ke(e){let t=(0,Q.c)(31),{onOpenTab:n}=e,r=y(je),i;t[0]===r?i=t[1]:(i=g(r),t[0]=r,t[1]=i);let a=i.remoteAccess.guide,o=!!x(Ae),s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={refreshInterval:3e4},t[2]=s):s=t[2];let{data:c}=A(o?`exposure-status`:null,_e,s),l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l={refreshInterval:15e3},t[3]=l):l=t[3];let{data:d}=A(o?`tunnel-status`:null,be,l),p=M(o);if(!o)return null;let m=c?.tailscale.active===!0,h=d?.state,_=d?.enabled&&h===`connected`,v=d?.enabled&&(h===`connecting`||h===`reconnecting`||!!d?.startProgress||!!d?.frpcDownload),b=p.data?.payload?.config,S=!!(b&&typeof b==`object`&&!Array.isArray(b)&&b.gateway?.publicUrl),C=m?`active`:`off`,w=m?a.statusActive:a.statusOff,T;t[4]!==a.tailscaleCardTitle||t[5]!==C||t[6]!==w?(T={tab:`tailscale`,icon:u,title:a.tailscaleCardTitle,kind:C,statusLabel:w},t[4]=a.tailscaleCardTitle,t[5]=C,t[6]=w,t[7]=T):T=t[7];let E=_?`active`:v?`connecting`:`off`,D=_?a.statusActive:v?a.statusConnecting:a.statusOff,O;t[8]!==a.publicCardTitle||t[9]!==E||t[10]!==D?(O={tab:`public`,icon:R,title:a.publicCardTitle,kind:E,statusLabel:D},t[8]=a.publicCardTitle,t[9]=E,t[10]=D,t[11]=O):O=t[11];let k=S?`active`:`off`,j=S?a.statusActive:a.statusOff,N;t[12]!==a.reverseProxyCardTitle||t[13]!==k||t[14]!==j?(N={tab:`reverse-proxy`,icon:G,title:a.reverseProxyCardTitle,kind:k,statusLabel:j},t[12]=a.reverseProxyCardTitle,t[13]=k,t[14]=j,t[15]=N):N=t[15];let P;t[16]!==a.sshCardStatus||t[17]!==a.sshCardTitle?(P={tab:`ssh`,icon:V,title:a.sshCardTitle,kind:`off`,statusLabel:a.sshCardStatus},t[16]=a.sshCardStatus,t[17]=a.sshCardTitle,t[18]=P):P=t[18];let F;t[19]!==a.lanCardStatus||t[20]!==a.lanCardTitle?(F={tab:`lan`,icon:W,title:a.lanCardTitle,kind:`off`,statusLabel:a.lanCardStatus},t[19]=a.lanCardStatus,t[20]=a.lanCardTitle,t[21]=F):F=t[21];let I;t[22]!==N||t[23]!==P||t[24]!==F||t[25]!==T||t[26]!==O?(I=[T,O,N,P,F],t[22]=N,t[23]=P,t[24]=F,t[25]=T,t[26]=O,t[27]=I):I=t[27];let L=I,z;return t[28]!==L||t[29]!==n?(z=(0,$.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5`,children:L.map(e=>{let t=e.icon;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e.tab),className:f(`flex items-start gap-3 rounded-xl bg-surface-base px-3 py-2.5 text-left shadow-surface transition-colors`,`hover:bg-surface-hover/50`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-hover/90 text-fg-muted`,children:(0,$.jsx)(t,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(Oe,{label:e.statusLabel,kind:e.kind})]})]},`${e.tab}-${e.title}`)})}),t[28]=L,t[29]=n,t[30]=z):z=t[30],z}function Ae(e){return e.token}function je(e){return e.language}function Me(e){let t=(0,Q.c)(26),{title:n,description:r,recommended:i,icon:a,onOpen:o,openLabel:s,recommendedLabel:c}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=f(`group flex w-full flex-col rounded-2xl bg-surface-base p-4 text-left transition-colors`,`hover:bg-surface-hover/40`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),t[0]=l):l=t[0];let u;t[1]===a?u=t[2]:(u=(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover/90 text-fg-muted`,children:(0,$.jsx)(a,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),t[1]=a,t[2]=u);let d;t[3]===n?d=t[4]:(d=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[3]=n,t[4]=d);let p;t[5]!==i||t[6]!==c?(p=i&&c?(0,$.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:c}):null,t[5]=i,t[6]=c,t[7]=p):p=t[7];let m;t[8]!==d||t[9]!==p?(m=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[d,p]}),t[8]=d,t[9]=p,t[10]=m):m=t[10];let h;t[11]===r?h=t[12]:(h=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:r}),t[11]=r,t[12]=h);let g;t[13]!==m||t[14]!==h?(g=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[m,h]}),t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(ie,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[16]=_):_=t[16];let v;t[17]!==u||t[18]!==g?(v=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[u,g,_]}),t[17]=u,t[18]=g,t[19]=v):v=t[19];let y;t[20]===s?y=t[21]:(y=(0,$.jsx)(`span`,{className:`mt-3 text-xs font-medium text-accent`,children:s}),t[20]=s,t[21]=y);let b;return t[22]!==o||t[23]!==y||t[24]!==v?(b=(0,$.jsxs)(`button`,{type:`button`,onClick:o,className:l,children:[v,y]}),t[22]=o,t[23]=y,t[24]=v,t[25]=b):b=t[25],b}function Ne(e){let t=(0,Q.c)(83),{onOpenTab:n}=e,r=y(Ie),i;t[0]===r?i=t[1]:(i=g(r),t[0]=r,t[1]=i);let a=i.remoteAccess,o=a.guide,s=!!x(Fe),c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c={refreshInterval:3e4},t[2]=c):c=t[2];let{data:l}=A(s?`exposure-status`:null,_e,c),d;t[3]===l?.conflicts?d=t[4]:(d=l?.conflicts??[],t[3]=l?.conflicts,t[4]=d);let f=d;if(!s){let e;return t[5]===o.needToken?e=t[6]:(e=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.needToken}),t[5]=o.needToken,t[6]=e),e}let p;t[7]===n?p=t[8]:(p=(0,$.jsx)(ke,{onOpenTab:n}),t[7]=n,t[8]=p);let m;t[9]!==f||t[10]!==o.conflictsHint||t[11]!==o.conflictsTitle?(m=f.length>0?(0,$.jsxs)(`div`,{className:`rounded-xl border border-amber-500/30 bg-amber-500/5 px-4 py-3 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:o.conflictsTitle}),(0,$.jsx)(`p`,{className:`mt-1`,children:o.conflictsHint}),(0,$.jsx)(`ul`,{className:`mt-2 list-inside list-disc text-xs`,children:f.map(Pe)})]}):null,t[9]=f,t[10]=o.conflictsHint,t[11]=o.conflictsTitle,t[12]=m):m=t[12];let h;t[13]===o.pickMethod?h=t[14]:(h=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:o.pickMethod}),t[13]=o.pickMethod,t[14]=h);let _;t[15]===n?_=t[16]:(_=()=>n(`tailscale`),t[15]=n,t[16]=_);let v;t[17]!==o.configure||t[18]!==o.recommended||t[19]!==o.tailscaleCardDesc||t[20]!==o.tailscaleCardTitle||t[21]!==_?(v=(0,$.jsx)(Me,{icon:u,title:o.tailscaleCardTitle,description:o.tailscaleCardDesc,recommended:!0,recommendedLabel:o.recommended,openLabel:o.configure,onOpen:_}),t[17]=o.configure,t[18]=o.recommended,t[19]=o.tailscaleCardDesc,t[20]=o.tailscaleCardTitle,t[21]=_,t[22]=v):v=t[22];let b;t[23]===n?b=t[24]:(b=()=>n(`public`),t[23]=n,t[24]=b);let S;t[25]!==o.configure||t[26]!==o.publicCardDesc||t[27]!==o.publicCardTitle||t[28]!==b?(S=(0,$.jsx)(Me,{icon:R,title:o.publicCardTitle,description:o.publicCardDesc,openLabel:o.configure,onOpen:b}),t[25]=o.configure,t[26]=o.publicCardDesc,t[27]=o.publicCardTitle,t[28]=b,t[29]=S):S=t[29];let C;t[30]===n?C=t[31]:(C=()=>n(`reverse-proxy`),t[30]=n,t[31]=C);let w;t[32]!==o.configure||t[33]!==o.reverseProxyCardDesc||t[34]!==o.reverseProxyCardTitle||t[35]!==C?(w=(0,$.jsx)(Me,{icon:G,title:o.reverseProxyCardTitle,description:o.reverseProxyCardDesc,openLabel:o.configure,onOpen:C}),t[32]=o.configure,t[33]=o.reverseProxyCardDesc,t[34]=o.reverseProxyCardTitle,t[35]=C,t[36]=w):w=t[36];let T;t[37]===n?T=t[38]:(T=()=>n(`ssh`),t[37]=n,t[38]=T);let E;t[39]!==o.configure||t[40]!==o.sshCardDesc||t[41]!==o.sshCardTitle||t[42]!==T?(E=(0,$.jsx)(Me,{icon:V,title:o.sshCardTitle,description:o.sshCardDesc,openLabel:o.configure,onOpen:T}),t[39]=o.configure,t[40]=o.sshCardDesc,t[41]=o.sshCardTitle,t[42]=T,t[43]=E):E=t[43];let D;t[44]===n?D=t[45]:(D=()=>n(`lan`),t[44]=n,t[45]=D);let O;t[46]!==o.configure||t[47]!==o.lanCardDesc||t[48]!==o.lanCardTitle||t[49]!==D?(O=(0,$.jsx)(Me,{icon:W,title:o.lanCardTitle,description:o.lanCardDesc,openLabel:o.configure,onOpen:D}),t[46]=o.configure,t[47]=o.lanCardDesc,t[48]=o.lanCardTitle,t[49]=D,t[50]=O):O=t[50];let k;t[51]!==S||t[52]!==w||t[53]!==E||t[54]!==O||t[55]!==v?(k=(0,$.jsxs)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:[v,S,w,E,O]}),t[51]=S,t[52]=w,t[53]=E,t[54]=O,t[55]=v,t[56]=k):k=t[56];let j;t[57]!==k||t[58]!==h?(j=(0,$.jsxs)(`div`,{children:[h,k]}),t[57]=k,t[58]=h,t[59]=j):j=t[59];let M;t[60]===o.oneAtATimeHint?M=t[61]:(M=(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:o.oneAtATimeHint}),t[60]=o.oneAtATimeHint,t[61]=M);let N;t[62]===a.advanced.proxyTitle?N=t[63]:(N=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.advanced.proxyTitle}),t[62]=a.advanced.proxyTitle,t[63]=N);let P;t[64]===a.advanced.proxyBody?P=t[65]:(P=(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:a.advanced.proxyBody}),t[64]=a.advanced.proxyBody,t[65]=P);let F;t[66]!==r||t[67]!==a.advanced.proxyDocs?(F=(0,$.jsx)(ge,{language:r,label:a.advanced.proxyDocs,section:`advanced`,className:`mt-2`}),t[66]=r,t[67]=a.advanced.proxyDocs,t[68]=F):F=t[68];let I;t[69]!==N||t[70]!==P||t[71]!==F?(I=(0,$.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-4 py-3`,children:[N,P,F]}),t[69]=N,t[70]=P,t[71]=F,t[72]=I):I=t[72];let L;t[73]!==o.docsLink||t[74]!==r?(L=(0,$.jsx)(ge,{language:r,label:o.docsLink}),t[73]=o.docsLink,t[74]=r,t[75]=L):L=t[75];let z;return t[76]!==j||t[77]!==M||t[78]!==I||t[79]!==L||t[80]!==p||t[81]!==m?(z=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[p,m,j,M,I,L]}),t[76]=j,t[77]=M,t[78]=I,t[79]=L,t[80]=p,t[81]=m,t[82]=z):z=t[82],z}function Pe(e){return(0,$.jsx)(`li`,{children:e.message},e.code)}function Fe(e){return e.token}function Ie(e){return e.language}function Le(){let e=(0,Q.c)(16),t=y(Re),n;e[0]===t?n=e[1]:(n=g(t),e[0]=t,e[1]=n);let r=n.remoteAccess.lan,i;e[2]!==r.subtitle||e[3]!==r.title?(i=(0,$.jsx)(le,{icon:W,title:r.title,subtitle:r.subtitle}),e[2]=r.subtitle,e[3]=r.title,e[4]=i):i=e[4];let a;e[5]===r.body?a=e[6]:(a=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.body}),e[5]=r.body,e[6]=a);let s;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),e[7]=s):s=e[7];let c;e[8]===r.link?c=e[9]:(c=(0,$.jsxs)(o,{to:`/settings/gateway`,className:`inline-flex items-center gap-1.5 text-sm font-medium text-accent hover:underline`,children:[r.link,s]}),e[8]=r.link,e[9]=c);let u;e[10]!==a||e[11]!==c?(u=(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[a,c]}),e[10]=a,e[11]=c,e[12]=u):u=e[12];let d;return e[13]!==i||e[14]!==u?(d=(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,$.jsxs)(de,{children:[i,u]})}),e[13]=i,e[14]=u,e[15]=d):d=e[15],d}function Re(e){return e.language}function ze(e){let t=(0,Q.c)(30),{embedded:n}=e,r=n===void 0?!1:n,i=y(Be),a;t[0]===i?a=t[1]:(a=g(i),t[0]=i,t[1]=a);let o=a.remoteAccess.ssh,[s,l]=(0,Z.useState)(!1),u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=async()=>{await h(`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`)&&(l(!0),setTimeout(()=>l(!1),2e3))},t[2]=u):u=t[2];let d=u,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`pre`,{className:`overflow-x-auto rounded-lg border border-edge bg-surface px-3 py-2 text-xs text-fg-muted`,children:`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`}),t[3]=f):f=t[3];let m,_;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>void d(),_=(0,$.jsx)(c,{className:`mr-1 size-4`}),t[4]=m,t[5]=_):(m=t[4],_=t[5]);let v=s?o.copied:o.copy,b;t[6]===v?b=t[7]:(b=(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsxs)(p,{type:`button`,variant:`ghost`,onClick:m,children:[_,v]})}),t[6]=v,t[7]=b);let x;t[8]!==r||t[9]!==o.hint?(x=r?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:o.hint}):null,t[8]=r,t[9]=o.hint,t[10]=x):x=t[10];let S;t[11]!==b||t[12]!==x?(S=(0,$.jsxs)($.Fragment,{children:[f,b,x]}),t[11]=b,t[12]=x,t[13]=S):S=t[13];let C=S;if(r){let e;t[14]!==o.subtitle||t[15]!==o.title?(e=(0,$.jsx)(le,{icon:V,title:o.title,subtitle:o.subtitle}),t[14]=o.subtitle,t[15]=o.title,t[16]=e):e=t[16];let n;t[17]===C?n=t[18]:(n=(0,$.jsx)(`div`,{className:`mt-4 space-y-2`,children:C}),t[17]=C,t[18]=n);let r;return t[19]!==e||t[20]!==n?(r=(0,$.jsxs)(de,{children:[e,n]}),t[19]=e,t[20]=n,t[21]=r):r=t[21],r}let w;t[22]!==o.subtitle||t[23]!==o.title?(w=(0,$.jsx)(le,{icon:V,title:o.title,subtitle:o.subtitle}),t[22]=o.subtitle,t[23]=o.title,t[24]=w):w=t[24];let T;t[25]===C?T=t[26]:(T=(0,$.jsx)(`div`,{className:`mt-4`,children:C}),t[25]=C,t[26]=T);let E;return t[27]!==w||t[28]!==T?(E=(0,$.jsxs)(de,{children:[w,T]}),t[27]=w,t[28]=T,t[29]=E):E=t[29],E}function Be(e){return e.language}function Ve(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(ze,{embedded:!0}),e[0]=t):t=e[0],t}var He=[`guide`,`tailscale`,`public`,`reverse-proxy`,`ssh`,`lan`];function Ue(e){return e&&He.includes(e)?e:`guide`}async function We(e){let t=await v(b(`/api/tunnel/probe-public`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e})});if(!t.ok&&t.status!==400)throw Error(`Probe failed (${t.status})`);return await t.json()}async function Ge(e){await _(b(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{publicUrl:e??null}})})}function Ke(e){let t=e.split(`.`).map(e=>Number.parseInt(e,10));if(t.length!==4||t.some(e=>!Number.isFinite(e)))return!1;let[n,r]=t;return n===10||n===127||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168||n===100&&r>=64&&r<=127}function qe(){return(0,Z.useMemo)(()=>{if(typeof window>`u`)return null;let{protocol:e,hostname:t,origin:n}=window.location;if(e!==`https:`&&e!==`http:`)return null;let r=t.toLowerCase();return!r||r===`localhost`||r===`127.0.0.1`||r===`::1`||r===`[::1]`||r.endsWith(`.local`)||r.endsWith(`.localhost`)||Ke(r)?null:n.toLowerCase().replace(/\/+$/,``)},[])}function Je(){return f(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,m,`dark:border-edge`)}function Ye(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.gateway;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.publicUrl;return typeof n==`string`&&n.trim()?n.trim():null}function Xe(){let e=(0,Q.c)(85),t=y(Qe),n;e[0]===t?n=e[1]:(n=g(t),e[0]=t,e[1]=n);let r=n.remoteAccess.reverseProxy,i=!!x(Ze),a=qe(),o=M(i).data?.payload?.config,s;e[2]===o?s=e[3]:(s=Ye(o),e[2]=o,e[3]=s);let c=s,[l,m]=(0,Z.useState)(``),h;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(h={busy:!1,result:null},e[4]=h):h=e[4];let[_,v]=(0,Z.useState)(h),b;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(b={busy:!1,error:null},e[5]=b):b=e[5];let[S,C]=(0,Z.useState)(b),w,T;e[6]!==c||e[7]!==a||e[8]!==l?(w=()=>{l||(c?m(c):a&&m(a))},T=[c,a,l],e[6]=c,e[7]=a,e[8]=l,e[9]=w,e[10]=T):(w=e[9],T=e[10]),(0,Z.useEffect)(w,T);let E;bb0:{let t;e[11]===l?t=e[12]:(t=l.trim(),e[11]=l,e[12]=t);let n=t;if(n){E=n;break bb0}E=c??a??``}let D=E,O=!c&&!!a&&D===a,k;e[13]!==l||e[14]!==D?(k=async()=>{let e=l.trim()||D;if(e){v({busy:!0,result:null});try{v({busy:!1,result:await We(e)})}catch(e){let t=e;v({busy:!1,result:{ok:!1,code:`NETWORK_ERROR`,message:t instanceof Error?t.message:String(t)}})}}},e[13]=l,e[14]=D,e[15]=k):k=e[15];let A=k,N;e[16]===D?N=e[17]:(N=async()=>{let e=D.trim();if(e){C({busy:!0,error:null});try{await Ge(e),await j(),C({busy:!1,error:null})}catch(e){let t=e;C({busy:!1,error:t instanceof Error?t.message:String(t)})}}},e[16]=D,e[17]=N);let P=N,F;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(F=async()=>{C({busy:!0,error:null});try{await Ge(null),await j(),m(``),v({busy:!1,result:null}),C({busy:!1,error:null})}catch(e){let t=e;C({busy:!1,error:t instanceof Error?t.message:String(t)})}},e[18]=F):F=e[18];let I=F;if(!i)return null;let L;e[19]!==r.subtitle||e[20]!==r.title?(L=(0,$.jsx)(le,{icon:u,title:r.title,subtitle:r.subtitle}),e[19]=r.subtitle,e[20]=r.title,e[21]=L):L=e[21];let R;e[22]===r.urlLabel?R=e[23]:(R=(0,$.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`reverse-proxy-url`,children:r.urlLabel}),e[22]=r.urlLabel,e[23]=R);let z;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(z=f(Je(),`font-mono text-xs sm:flex-1 sm:min-w-0 sm:w-auto`),e[24]=z):z=e[24];let B;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(B=e=>{m(e.target.value),v({busy:!1,result:null})},e[25]=B):B=e[25];let V;e[26]!==l||e[27]!==r.urlPlaceholder||e[28]!==z?(V=(0,$.jsx)(`input`,{id:`reverse-proxy-url`,className:z,type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:r.urlPlaceholder,value:l,onChange:B}),e[26]=l,e[27]=r.urlPlaceholder,e[28]=z,e[29]=V):V=e[29];let H;e[30]===A?H=e[31]:(H=()=>void A(),e[30]=A,e[31]=H);let ee;e[32]!==l||e[33]!==_.busy?(ee=_.busy||!l.trim(),e[32]=l,e[33]=_.busy,e[34]=ee):ee=e[34];let U;e[35]===_.busy?U=e[36]:(U=_.busy?(0,$.jsx)(d,{className:`size-3.5 animate-spin`}):null,e[35]=_.busy,e[36]=U);let W=_.busy?r.probing:r.probeButton,te;e[37]!==H||e[38]!==ee||e[39]!==U||e[40]!==W?(te=(0,$.jsxs)(p,{type:`button`,variant:`secondary`,className:`shrink-0 whitespace-nowrap`,onClick:H,disabled:ee,children:[U,W]}),e[37]=H,e[38]=ee,e[39]=U,e[40]=W,e[41]=te):te=e[41];let G;e[42]!==V||e[43]!==te?(G=(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch`,children:[V,te]}),e[42]=V,e[43]=te,e[44]=G):G=e[44];let K;e[45]===r.urlHint?K=e[46]:(K=(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.urlHint}),e[45]=r.urlHint,e[46]=K);let q;e[47]!==a||e[48]!==O||e[49]!==r.autoDetectedHint||e[50]!==r.autoDetectedTitle?(q=O&&a?(0,$.jsxs)(`div`,{className:`rounded-lg border border-accent/40 bg-accent-soft/50 px-3 py-2 text-xs leading-relaxed text-accent-fg`,children:[(0,$.jsx)(`div`,{className:`font-medium`,children:r.autoDetectedTitle}),(0,$.jsx)(`div`,{className:`mt-1 break-all font-mono text-[11px]`,children:a}),(0,$.jsx)(`p`,{className:`mt-1`,children:r.autoDetectedHint})]}):null,e[47]=a,e[48]=O,e[49]=r.autoDetectedHint,e[50]=r.autoDetectedTitle,e[51]=q):q=e[51];let J;e[52]!==_.result||e[53]!==r.probeStatus?(J=_.result?(0,$.jsx)($e,{result:_.result,labels:r.probeStatus}):null,e[52]=_.result,e[53]=r.probeStatus,e[54]=J):J=e[54];let ne;e[55]!==c||e[56]!==D||e[57]!==P||e[58]!==r.saveAsDefault||e[59]!==r.saving||e[60]!==S.busy?(ne=D&&c!==D?(0,$.jsxs)(p,{type:`button`,onClick:()=>void P(),disabled:S.busy,children:[S.busy?(0,$.jsx)(d,{className:`size-3.5 animate-spin`}):null,S.busy?r.saving:r.saveAsDefault]}):null,e[55]=c,e[56]=D,e[57]=P,e[58]=r.saveAsDefault,e[59]=r.saving,e[60]=S.busy,e[61]=ne):ne=e[61];let re;e[62]!==c||e[63]!==r.clear||e[64]!==S.busy?(re=c?(0,$.jsx)(p,{type:`button`,variant:`ghost`,onClick:()=>void I(),disabled:S.busy,children:r.clear}):null,e[62]=c,e[63]=r.clear,e[64]=S.busy,e[65]=re):re=e[65];let ie;e[66]!==ne||e[67]!==re?(ie=(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[ne,re]}),e[66]=ne,e[67]=re,e[68]=ie):ie=e[68];let ae;e[69]===S.error?ae=e[70]:(ae=S.error?(0,$.jsx)(`p`,{className:`text-xs text-red-800 dark:text-red-200`,children:S.error}):null,e[69]=S.error,e[70]=ae);let oe;e[71]===r.certWarning?oe=e[72]:(oe=(0,$.jsx)(`div`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs leading-relaxed text-amber-950 dark:border-amber-800/60 dark:bg-amber-950/30 dark:text-amber-100`,children:r.certWarning}),e[71]=r.certWarning,e[72]=oe);let Y;e[73]!==R||e[74]!==G||e[75]!==K||e[76]!==q||e[77]!==J||e[78]!==ie||e[79]!==ae||e[80]!==oe?(Y=(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[R,G,K,q,J,ie,ae,oe]}),e[73]=R,e[74]=G,e[75]=K,e[76]=q,e[77]=J,e[78]=ie,e[79]=ae,e[80]=oe,e[81]=Y):Y=e[81];let X;return e[82]!==L||e[83]!==Y?(X=(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,$.jsxs)(de,{children:[L,Y]})}),e[82]=L,e[83]=Y,e[84]=X):X=e[84],X}function Ze(e){return e.token}function Qe(e){return e.language}function $e(e){let t=(0,Q.c)(18),{result:n,labels:r}=e;if(n.ok){let e;t[0]===r.ok?e=t[1]:(e=(0,$.jsx)(`span`,{className:`font-medium`,children:r.ok}),t[0]=r.ok,t[1]=e);let i;t[2]===n.latencyMs?i=t[3]:(i=(0,$.jsxs)(`span`,{className:`font-mono`,children:[n.latencyMs,`ms`]}),t[2]=n.latencyMs,t[3]=i);let a;t[4]!==r.gatewayReady||t[5]!==n.gatewayReady?(a=n.gatewayReady?(0,$.jsxs)($.Fragment,{children:[` · `,(0,$.jsx)(`span`,{children:r.gatewayReady})]}):null,t[4]=r.gatewayReady,t[5]=n.gatewayReady,t[6]=a):a=t[6];let o;return t[7]!==e||t[8]!==i||t[9]!==a?(o=(0,$.jsxs)(`div`,{className:`rounded-lg border border-emerald-200 bg-emerald-50 px-3 py-2 text-xs text-emerald-900 dark:border-emerald-800/60 dark:bg-emerald-950/30 dark:text-emerald-100`,children:[e,` · `,i,a]}),t[7]=e,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}let i=r[`code_${n.code}`]??r.codeUnknown,a;t[11]===i?a=t[12]:(a=(0,$.jsx)(`span`,{className:`font-medium`,children:i}),t[11]=i,t[12]=a);let o;t[13]===n.message?o=t[14]:(o=n.message?(0,$.jsxs)($.Fragment,{children:[` — `,(0,$.jsx)(`span`,{className:`font-mono break-all`,children:n.message})]}):null,t[13]=n.message,t[14]=o);let s;return t[15]!==a||t[16]!==o?(s=(0,$.jsxs)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-900 dark:border-red-800/60 dark:bg-red-950/30 dark:text-red-100`,children:[a,o]}),t[15]=a,t[16]=o,t[17]=s):s=t[17],s}var et=`https://tailscale.com/download`;function tt(e){let t=(0,Q.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`a`,{href:et,target:`_blank`,rel:`noreferrer`,className:`font-medium text-accent hover:underline`,children:n}),t[0]=n,t[1]=r),r}function nt({embedded:e=!1}){let t=y(e=>e.language),n=g(t).remoteAccess.tailscale,r=(0,Z.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:g(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]),i=!!x(e=>e.token),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(null),{data:l,mutate:f,isLoading:m}=A(i?`exposure-status`:null,_e,{refreshInterval:3e4}),h=l?.tailscale.hostname,_=l?.tailscale.active===!0,v=l?.tailscale.cliAvailable!==!1,b=h?`https://${h}/`:null,S=(0,Z.useCallback)(async()=>{o(!0),c(null);try{await ve(`serve`),await f()}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}},[f]),C=(0,Z.useCallback)(async()=>{o(!0),c(null);try{await ye(),await f()}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}},[f]);if(!i)return null;let w=(0,$.jsxs)(`div`,{className:e?`space-y-4`:`mt-4 space-y-3`,children:[e?(0,$.jsxs)(`ol`,{className:`space-y-3 text-sm text-fg-muted`,children:[(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`1`}),(0,$.jsxs)(`span`,{children:[n.stepInstallBefore,(0,$.jsx)(tt,{label:n.stepInstallLink}),n.stepInstallAfter]})]}),(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`2`}),(0,$.jsx)(`span`,{children:n.stepEnable})]}),(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`3`}),(0,$.jsx)(`span`,{children:n.stepCopy})]})]}):null,e&&l?.tailscale.cliAvailable===!1?(0,$.jsxs)(`p`,{className:`rounded-lg border border-amber-500/25 bg-amber-500/5 px-3 py-2 text-sm text-fg-muted`,children:[n.cliMissingIntro,` `,(0,$.jsx)(tt,{label:n.cliMissingDownloadLink}),n.cliMissingSuffix]}):null,m&&!l?(0,$.jsxs)(`div`,{className:`grid gap-3`,"aria-busy":`true`,children:[(0,$.jsx)(K,{className:`h-20 rounded-lg`}),(0,$.jsx)(K,{className:`h-20 rounded-lg`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(de,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.statusLabel}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:_?n.statusActive:n.statusOff}),b?(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(U,{text:b,labels:r})}):null,s?(0,$.jsx)(`p`,{className:`mt-2 text-sm text-red-600 dark:text-red-400`,children:s}):null,(0,$.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:_?(0,$.jsxs)(p,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>void C(),children:[a?(0,$.jsx)(d,{className:`mr-1 size-4 animate-spin`}):null,n.disableServe]}):(0,$.jsxs)(p,{type:`button`,disabled:a||!v,onClick:()=>void S(),children:[a?(0,$.jsx)(d,{className:`mr-1 size-4 animate-spin`}):(0,$.jsx)(ee,{className:`mr-1 size-4`}),n.enableServe]})})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.hint}),(0,$.jsx)(ge,{language:t,label:n.docsLink,section:`tailscale-serve`,className:`mt-2`})]})]});return e?w:(0,$.jsxs)(de,{children:[(0,$.jsx)(le,{icon:u,title:n.title,subtitle:n.subtitle}),w]})}function rt(e){let t=(0,Q.c)(26),{showLabel:n,hideLabel:r,icon:i,hint:a,children:o,className:s,defaultOpen:c,advancedOnly:l}=e,u=l===void 0?!1:l,[d,p]=(0,Z.useState)(c??!1),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=e=>p(e.currentTarget.open),t[0]=m):m=t[0];let h;t[1]===s?h=t[2]:(h=f(`group rounded-2xl bg-surface-base open:pb-1`,s),t[1]=s,t[2]=h);let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(J,{className:`size-4 shrink-0 text-fg-muted transition-transform group-open:rotate-180`,"aria-hidden":!0}),t[3]=g):g=t[3];let _;t[4]===i?_=t[5]:(_=i?(0,$.jsx)(i,{className:`size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}):null,t[4]=i,t[5]=_);let v;t[6]===n?v=t[7]:(v=(0,$.jsx)(`span`,{className:`group-open:hidden`,children:n}),t[6]=n,t[7]=v);let y;t[8]===r?y=t[9]:(y=(0,$.jsx)(`span`,{className:`hidden group-open:inline`,children:r}),t[8]=r,t[9]=y);let b;t[10]!==_||t[11]!==v||t[12]!==y?(b=(0,$.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 rounded-2xl px-4 py-3.5 text-sm font-medium text-fg transition-colors hover:text-fg group-open:rounded-b-none [&::-webkit-details-marker]:hidden`,children:[g,_,v,y]}),t[10]=_,t[11]=v,t[12]=y,t[13]=b):b=t[13];let x;t[14]===a?x=t[15]:(x=a?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:a}):null,t[14]=a,t[15]=x);let S;t[16]!==o||t[17]!==x?(S=(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 px-4 pb-4 pt-1`,children:[x,o]}),t[16]=o,t[17]=x,t[18]=S):S=t[18];let C;t[19]!==d||t[20]!==S||t[21]!==h||t[22]!==b?(C=(0,$.jsxs)(`details`,{open:d,onToggle:m,className:h,children:[b,S]}),t[19]=d,t[20]=S,t[21]=h,t[22]=b,t[23]=C):C=t[23];let w=C;if(u){let e;return t[24]===w?e=t[25]:(e=(0,$.jsx)(fe,{children:w}),t[24]=w,t[25]=e),e}return w}function it(e){let t=(0,Q.c)(40),{open:n,title:r,intro:i,bullets:a,checkboxLabel:o,confirmLabel:s,cancelLabel:c,onConfirm:l,onCancel:u}=e,[d,m]=(0,Z.useState)(!1),h;t[0]===u?h=t[1]:(h=e=>{e||(m(!1),u())},t[0]=u,t[1]=h);let g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(w,{className:f(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,C)}),t[2]=g):g=t[2];let _;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=f(`fixed left-1/2 top-1/2 max-h-[min(90vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-y-auto rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`,S),t[3]=_):_=t[3];let v;t[4]===r?v=t[5]:(v=(0,$.jsx)(O,{className:`text-base font-semibold text-fg`,children:r}),t[4]=r,t[5]=v);let y;t[6]===i?y=t[7]:(y=(0,$.jsx)(T,{className:`mt-2 text-sm text-fg-muted`,children:i}),t[6]=i,t[7]=y);let b;t[8]===a?b=t[9]:(b=a.map(at),t[8]=a,t[9]=b);let x;t[10]===b?x=t[11]:(x=(0,$.jsx)(`ul`,{className:`mt-4 list-disc space-y-2 pl-5 text-sm text-fg-muted`,children:b}),t[10]=b,t[11]=x);let A;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>m(e.target.checked),t[12]=A):A=t[12];let j;t[13]===d?j=t[14]:(j=(0,$.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 shrink-0 rounded border-edge accent-accent`,checked:d,onChange:A}),t[13]=d,t[14]=j);let M;t[15]===o?M=t[16]:(M=(0,$.jsx)(`span`,{children:o}),t[15]=o,t[16]=M);let N;t[17]!==M||t[18]!==j?(N=(0,$.jsxs)(`label`,{className:`mt-5 flex cursor-pointer items-start gap-3 text-sm text-fg`,children:[j,M]}),t[17]=M,t[18]=j,t[19]=N):N=t[19];let P;t[20]!==c||t[21]!==u?(P=(0,$.jsx)(p,{type:`button`,variant:`secondary`,onClick:u,children:c}),t[20]=c,t[21]=u,t[22]=P):P=t[22];let F=!d,I;t[23]!==s||t[24]!==l||t[25]!==F?(I=(0,$.jsx)(p,{type:`button`,disabled:F,onClick:l,children:s}),t[23]=s,t[24]=l,t[25]=F,t[26]=I):I=t[26];let L;t[27]!==P||t[28]!==I?(L=(0,$.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[P,I]}),t[27]=P,t[28]=I,t[29]=L):L=t[29];let R;t[30]!==N||t[31]!==L||t[32]!==v||t[33]!==y||t[34]!==x?(R=(0,$.jsxs)(E,{children:[g,(0,$.jsxs)(D,{className:_,onOpenAutoFocus:ot,children:[v,y,x,N,L]})]}),t[30]=N,t[31]=L,t[32]=v,t[33]=y,t[34]=x,t[35]=R):R=t[35];let z;return t[36]!==n||t[37]!==h||t[38]!==R?(z=(0,$.jsx)(k,{open:n,onOpenChange:h,children:R}),t[36]=n,t[37]=h,t[38]=R,t[39]=z):z=t[39],z}function at(e){return(0,$.jsx)(`li`,{children:e},e)}function ot(e){return e.preventDefault()}function st(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var ct=[`preparing_frpc`,`registering`,`starting_frpc`];function lt(e){return e?e===`reconnecting_frpc`?ct.indexOf(`starting_frpc`):ct.indexOf(e):-1}function ut(e,t){if(t.state===`connected`)return`done`;let n=t.startProgress?.phase,r=ct.indexOf(e),i=lt(n);return i<0?t.state===`connecting`||t.state===`reconnecting`?`active`:`pending`:r<i?`done`:r===i?`active`:`pending`}function dt(e,t,n){let r=n.startProgress;return ut(t,n)===`active`?t===`preparing_frpc`&&n.frpcDownload?n.frpcDownload.phase===`extracting`?e.frpcExtracting:n.frpcDownload.percent==null?e.frpcDownloading:e.frpcDownloadingPercent.replace(`{{percent}}`,String(n.frpcDownload.percent)):t===`registering`&&r?.publicUrl?e.stepRegisterDetail:t===`starting_frpc`?r?.phase===`reconnecting_frpc`?e.stepReconnectDetail:e.stepFrpcDetail:null:null}function ft(e,t){switch(t){case`preparing_frpc`:return e.stepPrepareFrpc;case`registering`:return e.stepRegister;case`starting_frpc`:return e.stepFrpcLogin}}function pt(e){if(!e)return null;let t=Math.max(0,Math.floor((Date.now()-new Date(e).getTime())/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function mt(e){let t=(0,Q.c)(31),{status:n,t:r}=e,[,i]=(0,Z.useState)(0),a;t[0]!==i||t[1]!==n.state?(a=()=>{if(n.state!==`connecting`&&n.state!==`reconnecting`)return;let e=window.setInterval(()=>i(ht),1e3);return()=>window.clearInterval(e)},t[0]=i,t[1]=n.state,t[2]=a):a=t[2];let o=n.startProgress?.startedAt,c;if(t[3]!==n.state||t[4]!==o?(c=[n.state,o],t[3]=n.state,t[4]=o,t[5]=c):c=t[5],(0,Z.useEffect)(a,c),!(n.state===`connecting`||n.state===`reconnecting`||n.state===`connected`&&n.startProgress))return null;let l,u,p,m,h;if(t[6]!==n||t[7]!==r){let e=pt(n.startProgress?.startedAt);l=!!n.publicUrl&&n.state!==`connected`&&n.startProgress?.phase!==`registering`,u=`mt-3 space-y-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface`;let i;t[13]===r.startProgressTitle?i=t[14]:(i=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:r.startProgressTitle}),t[13]=r.startProgressTitle,t[14]=i);let a;t[15]===r.startProgressHint?a=t[16]:(a=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.startProgressHint}),t[15]=r.startProgressHint,t[16]=a),t[17]!==i||t[18]!==a?(p=(0,$.jsxs)(`div`,{children:[i,a]}),t[17]=i,t[18]=a,t[19]=p):p=t[19];let o=ct.map(e=>{let t=ut(e,n),i=dt(r,e,n);return(0,$.jsxs)(`li`,{className:`flex gap-2 text-xs`,children:[(0,$.jsx)(`span`,{className:`mt-0.5 shrink-0 text-fg-subtle`,"aria-hidden":!0,children:t===`done`?(0,$.jsx)(s,{className:`size-3.5 text-emerald-600 dark:text-emerald-400`}):t===`active`?(0,$.jsx)(d,{className:`size-3.5 animate-spin text-accent`}):(0,$.jsx)(B,{className:`size-3.5`})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:f(`font-medium`,t===`active`?`text-fg`:t===`done`?`text-fg-muted`:`text-fg-subtle`),children:ft(r,e)}),i?(0,$.jsx)(`div`,{className:`mt-0.5 text-fg-muted`,children:i}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload&&n.frpcDownload.phase===`downloading`?(0,$.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[(0,$.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-surface-panel`,children:(0,$.jsx)(`div`,{className:f(`h-full rounded-full bg-accent transition-[width] duration-300`,n.frpcDownload.percent==null&&`w-1/3 animate-pulse`),style:n.frpcDownload.percent==null?void 0:{width:`${n.frpcDownload.percent}%`}})}),n.frpcDownload.bytesReceived!=null&&n.frpcDownload.totalBytes?(0,$.jsxs)(`p`,{className:`text-fg-subtle`,children:[st(n.frpcDownload.bytesReceived),` /`,` `,st(n.frpcDownload.totalBytes)]}):null]}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload?.url?(0,$.jsxs)(`p`,{className:`mt-2 text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`font-sans`,children:[r.frpcDownloadingUrlLabel,`: `]}),(0,$.jsx)(`a`,{href:n.frpcDownload.url,target:`_blank`,rel:`noopener noreferrer`,className:`break-all font-mono text-[11px] text-accent hover:underline`,children:n.frpcDownload.url})]}):null]})]},e)});t[20]===o?m=t[21]:(m=(0,$.jsx)(`ol`,{className:`space-y-2`,children:o}),t[20]=o,t[21]=m),h=e&&n.startProgress?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.startProgressElapsed.replace(`{{elapsed}}`,e)}):null,t[6]=n,t[7]=r,t[8]=l,t[9]=u,t[10]=p,t[11]=m,t[12]=h}else l=t[8],u=t[9],p=t[10],m=t[11],h=t[12];let g;t[22]!==l||t[23]!==r.publicUrlPendingNotice?(g=l?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.publicUrlPendingNotice}):null,t[22]=l,t[23]=r.publicUrlPendingNotice,t[24]=g):g=t[24];let _;return t[25]!==u||t[26]!==p||t[27]!==m||t[28]!==h||t[29]!==g?(_=(0,$.jsxs)(`div`,{className:u,children:[p,m,h,g]}),t[25]=u,t[26]=p,t[27]=m,t[28]=h,t[29]=g,t[30]=_):_=t[30],_}function ht(e){return e+1}function gt(e,t){return t.state===`connected`?e.statusConnected:t.state===`error`?e.statusError:t.startProgress?.phase===`reconnecting_frpc`?e.statusReconnecting:t.startProgress?.phase===`starting_frpc`?e.statusStartingFrpc:t.startProgress?.phase===`registering`?e.statusRegistering:t.startProgress?.phase===`preparing_frpc`||t.frpcDownload?e.statusPreparingFrpc:t.state===`connecting`||t.state===`reconnecting`?e.statusConnecting:e.statusOff}function _t(e){return e.state===`connected`?`connected`:e.state===`error`?`error`:e.state===`connecting`||e.state===`reconnecting`||e.startProgress||e.frpcDownload?`progress`:`off`}function vt(e){switch(e){case`connected`:return`bg-emerald-500/15 text-emerald-700 dark:text-emerald-400`;case`progress`:return`bg-amber-500/15 text-amber-700 dark:text-amber-400`;case`error`:return`bg-red-500/15 text-red-700 dark:text-red-400`;default:return`bg-surface-hover text-fg-muted`}}function yt(e){if(!e)return`—`;let t=Date.now()-new Date(e).getTime();if(t<0)return`—`;let n=Math.floor(t/6e4);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function bt(e){let t=(0,Q.c)(61),{t:n,status:r,isLoading:i,statusErr:a,starting:o,stopping:s,showConsentExpired:c,copyLabels:l,startDisabled:m,startDisabledReason:h,stepLabel:g,onStart:_,onStop:v}=e,y=m===void 0?!1:m,b,x,S,C,w,T,E;t[0]!==r||t[1]!==o?(E=_t(r),b=r.enabled||o,x=o||r.state===`connecting`||r.state===`reconnecting`||!!r.startProgress||!!r.frpcDownload,t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=f(ue(),`space-y-4`),t[9]=T):T=t[9],w=`flex flex-wrap items-start justify-between gap-3`,C=`flex items-center gap-2`,S=f(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium`,vt(E)),t[0]=r,t[1]=o,t[2]=b,t[3]=x,t[4]=S,t[5]=C,t[6]=w,t[7]=T,t[8]=E):(b=t[2],x=t[3],S=t[4],C=t[5],w=t[6],T=t[7],E=t[8]);let D=E===`connected`&&`bg-emerald-500`,O=E===`progress`&&`bg-amber-500 animate-pulse`,k=E===`error`&&`bg-red-500`,A=E===`off`&&`bg-fg-subtle`,j;t[10]!==D||t[11]!==O||t[12]!==k||t[13]!==A?(j=f(`size-1.5 rounded-full`,D,O,k,A),t[10]=D,t[11]=O,t[12]=k,t[13]=A,t[14]=j):j=t[14];let M;t[15]===j?M=t[16]:(M=(0,$.jsx)(`span`,{className:j,"aria-hidden":!0}),t[15]=j,t[16]=M);let N;t[17]!==i||t[18]!==r||t[19]!==n?(N=i&&!r.enabled?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block h-3 w-16 animate-pulse rounded-full bg-surface-hover/70 motion-reduce:animate-none`}):gt(n,r),t[17]=i,t[18]=r,t[19]=n,t[20]=N):N=t[20];let P;t[21]!==M||t[22]!==N||t[23]!==S?(P=(0,$.jsxs)(`span`,{className:S,children:[M,N]}),t[21]=M,t[22]=N,t[23]=S,t[24]=P):P=t[24];let F;t[25]!==r.connectedSince||t[26]!==r.state||t[27]!==n.uptime?(F=r.connectedSince&&r.state===`connected`?(0,$.jsxs)(`span`,{className:`text-xs text-fg-subtle`,children:[n.uptime,` `,yt(r.connectedSince)]}):null,t[25]=r.connectedSince,t[26]=r.state,t[27]=n.uptime,t[28]=F):F=t[28];let L;t[29]!==P||t[30]!==F||t[31]!==C?(L=(0,$.jsxs)(`div`,{className:C,children:[P,F]}),t[29]=P,t[30]=F,t[31]=C,t[32]=L):L=t[32];let R;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(u,{className:`size-4 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[33]=R):R=t[33];let z;t[34]!==L||t[35]!==w?(z=(0,$.jsxs)(`div`,{className:w,children:[L,R]}),t[34]=L,t[35]=w,t[36]=z):z=t[36];let B;t[37]===a?B=t[38]:(B=a?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:a instanceof Error?a.message:String(a)}):null,t[37]=a,t[38]=B);let V;t[39]!==c||t[40]!==n.consentExpiredBanner?(V=c?(0,$.jsx)(`p`,{className:`rounded-lg border border-amber-500/25 bg-amber-500/5 px-3 py-2 text-xs text-fg-muted`,children:n.consentExpiredBanner}):null,t[39]=c,t[40]=n.consentExpiredBanner,t[41]=V):V=t[41];let H;t[42]!==b||t[43]!==l||t[44]!==_||t[45]!==v||t[46]!==x||t[47]!==r||t[48]!==y||t[49]!==h||t[50]!==o||t[51]!==g||t[52]!==s||t[53]!==n?(H=b?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[r.publicUrl?(0,$.jsx)(`div`,{className:`rounded-xl bg-surface-panel/80 p-3 shadow-surface`,children:(0,$.jsx)(U,{label:n.publicUrlLabel,text:r.publicUrl,labels:l})}):null,x?(0,$.jsx)(mt,{status:r,t:n}):null,r.lastError&&r.state===`error`?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:r.lastError}):null,(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.enabled?(0,$.jsxs)(p,{type:`button`,variant:`secondary`,disabled:s,onClick:v,children:[s?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,n.stop]}):(0,$.jsxs)(p,{type:`button`,disabled:o,onClick:_,children:[o?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(ee,{className:`size-4`}),n.start]})})]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[g?(0,$.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:g}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.emptyStateTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:n.emptyStateBody})]}),(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-amber-500/25 bg-amber-500/5 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,$.jsx)(I,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-400`}),(0,$.jsx)(`p`,{children:n.riskBannerBody})]}),y&&h?(0,$.jsx)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200`,children:h}):null,(0,$.jsxs)(p,{type:`button`,disabled:o||y,onClick:_,className:`w-full sm:w-auto`,children:[o?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(ee,{className:`size-4`}),n.start]})]}),t[42]=b,t[43]=l,t[44]=_,t[45]=v,t[46]=x,t[47]=r,t[48]=y,t[49]=h,t[50]=o,t[51]=g,t[52]=s,t[53]=n,t[54]=H):H=t[54];let W;return t[55]!==z||t[56]!==B||t[57]!==V||t[58]!==H||t[59]!==T?(W=(0,$.jsxs)(`section`,{className:T,children:[z,B,V,H]}),t[55]=z,t[56]=B,t[57]=V,t[58]=H,t[59]=T,t[60]=W):W=t[60],W}var xt=`https://console.xopc.ai/access/client`,St={reconfiguring:!1};function Ct(e){let t=(0,Q.c)(89),{t:n,brokerSecretReady:r,brokerSecretConfiguredInConfig:i,brokerSecretMaskedValue:a,brokerSecretDraft:o,savingBrokerSecret:c,authorizingBrokerSecret:u,brokerSecretAuthorizationUrl:m,brokerSecretNotice:h,copyFailedLabel:g,onDraftChange:_,onSave:v,onAuthorize:y,onClear:b,sectionRef:x}=e,S=(0,Z.useId)(),C=r,w=!C,[T,E]=(0,Z.useReducer)(ne,St),{reconfiguring:D}=T,O;t[0]!==i||t[1]!==o||t[2]!==D?(O=i&&!D&&!o.trim(),t[0]=i,t[1]=o,t[2]=D,t[3]=O):O=t[3];let k=O,A;t[4]!==n.copied||t[5]!==n.copyKey||t[6]!==n.hideKey||t[7]!==n.showKey?(A={show:n.showKey,hide:n.hideKey,copy:n.copyKey,copied:n.copied},t[4]=n.copied,t[5]=n.copyKey,t[6]=n.hideKey,t[7]=n.showKey,t[8]=A):A=t[8];let j=A,M;t[9]===o?M=t[10]:(M=o.trim().length>0&&!te(o.trim()),t[9]=o,t[10]=M);let N=M,P;t[11]===_?P=t[12]:(P=()=>{E({type:`patch`,patch:{reconfiguring:!1}}),_(``)},t[11]=_,t[12]=P);let F=P,I=w&&`ring-1 ring-amber-500/30`,L;t[13]===I?L=t[14]:(L=f(I),t[13]=I,t[14]=L);let R=C?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:w?`bg-amber-500/10 text-amber-700 dark:text-amber-400`:`bg-surface-hover text-fg-muted`,B;t[15]===R?B=t[16]:(B=f(`flex size-9 shrink-0 items-center justify-center rounded-lg`,R),t[15]=R,t[16]=B);let V;t[17]===C?V=t[18]:(V=C?(0,$.jsx)(s,{className:`size-4`,strokeWidth:2,"aria-hidden":!0}):(0,$.jsx)(re,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[17]=C,t[18]=V);let H;t[19]!==B||t[20]!==V?(H=(0,$.jsx)(`span`,{className:B,children:V}),t[19]=B,t[20]=V,t[21]=H):H=t[21];let ee=C?n.brokerSecretReadyTitle:n.brokerSecretStepTitle,U;t[22]===ee?U=t[23]:(U=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:ee}),t[22]=ee,t[23]=U);let W=C?n.brokerSecretReadyHint:n.brokerSecretHint,G;t[24]===W?G=t[25]:(G=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:W}),t[24]=W,t[25]=G);let K;t[26]!==w||t[27]!==n.brokerSecretMissingHint?(K=w?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-amber-800 dark:text-amber-200`,children:n.brokerSecretMissingHint}):null,t[26]=w,t[27]=n.brokerSecretMissingHint,t[28]=K):K=t[28];let q;t[29]!==U||t[30]!==G||t[31]!==K?(q=(0,$.jsxs)(`div`,{children:[U,G,K]}),t[29]=U,t[30]=G,t[31]=K,t[32]=q):q=t[32];let J;t[33]!==u||t[34]!==w||t[35]!==y||t[36]!==D||t[37]!==c||t[38]!==n.brokerSecretAuthorize||t[39]!==n.brokerSecretAuthorizing||t[40]!==n.brokerSecretConsoleLink?(J=w||D?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(p,{type:`button`,disabled:c||u,onClick:y,children:[u?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,u?n.brokerSecretAuthorizing:n.brokerSecretAuthorize]}),(0,$.jsxs)(`a`,{href:xt,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[n.brokerSecretConsoleLink,(0,$.jsx)(l,{className:`size-3`,"aria-hidden":!0})]})]}):null,t[33]=u,t[34]=w,t[35]=y,t[36]=D,t[37]=c,t[38]=n.brokerSecretAuthorize,t[39]=n.brokerSecretAuthorizing,t[40]=n.brokerSecretConsoleLink,t[41]=J):J=t[41];let ie;t[42]!==u||t[43]!==m||t[44]!==n.brokerSecretOpenAuthorization?(ie=u&&m?(0,$.jsxs)(`a`,{href:m,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,children:[n.brokerSecretOpenAuthorization,(0,$.jsx)(l,{className:`size-3`,"aria-hidden":!0})]}):null,t[42]=u,t[43]=m,t[44]=n.brokerSecretOpenAuthorization,t[45]=ie):ie=t[45];let ae;t[46]!==i||t[47]!==o||t[48]!==a||t[49]!==N||t[50]!==F||t[51]!==g||t[52]!==S||t[53]!==w||t[54]!==b||t[55]!==_||t[56]!==v||t[57]!==D||t[58]!==c||t[59]!==j||t[60]!==k||t[61]!==n.brokerSecretCancelReconfigure||t[62]!==n.brokerSecretClear||t[63]!==n.brokerSecretMaskedHelp||t[64]!==n.brokerSecretNotInConfigFile||t[65]!==n.brokerSecretPlaceholder||t[66]!==n.brokerSecretReconfigure||t[67]!==n.brokerSecretRevealFailed||t[68]!==n.brokerSecretSave||t[69]!==n.brokerSecretSaveAndContinue||t[70]!==n.brokerSecretTitle?(ae=k?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:S,children:n.brokerSecretTitle}),(0,$.jsx)(z,{id:S,value:a,labels:j,reveal:wt,loadFailedLabel:g||n.brokerSecretRevealFailed,maskedHelp:n.brokerSecretMaskedHelp,notInConfigFile:n.brokerSecretNotInConfigFile,readOnly:!0}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(p,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>{E({type:`patch`,patch:{reconfiguring:!0}})},children:n.brokerSecretReconfigure}),(0,$.jsx)(p,{type:`button`,variant:`ghost`,disabled:c,onClick:b,children:n.brokerSecretClear})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:S,children:n.brokerSecretTitle}),(0,$.jsx)(z,{id:S,value:o,onChange:_,placeholder:n.brokerSecretPlaceholder,labels:j,disabled:c}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(p,{type:`button`,disabled:c||!N,onClick:v,children:[c?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,w?n.brokerSecretSaveAndContinue:n.brokerSecretSave]}),i?(0,$.jsx)(p,{type:`button`,variant:`ghost`,disabled:c,onClick:b,children:n.brokerSecretClear}):null,D?(0,$.jsx)(p,{type:`button`,variant:`ghost`,disabled:c,onClick:F,children:n.brokerSecretCancelReconfigure}):null]})]}),t[46]=i,t[47]=o,t[48]=a,t[49]=N,t[50]=F,t[51]=g,t[52]=S,t[53]=w,t[54]=b,t[55]=_,t[56]=v,t[57]=D,t[58]=c,t[59]=j,t[60]=k,t[61]=n.brokerSecretCancelReconfigure,t[62]=n.brokerSecretClear,t[63]=n.brokerSecretMaskedHelp,t[64]=n.brokerSecretNotInConfigFile,t[65]=n.brokerSecretPlaceholder,t[66]=n.brokerSecretReconfigure,t[67]=n.brokerSecretRevealFailed,t[68]=n.brokerSecretSave,t[69]=n.brokerSecretSaveAndContinue,t[70]=n.brokerSecretTitle,t[71]=ae):ae=t[71];let oe;t[72]===h?oe=t[73]:(oe=h?(0,$.jsx)(`p`,{className:`text-xs text-emerald-700 dark:text-emerald-400`,children:h}):null,t[72]=h,t[73]=oe);let Y;t[74]!==q||t[75]!==J||t[76]!==ie||t[77]!==ae||t[78]!==oe?(Y=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[q,J,ie,ae,oe]}),t[74]=q,t[75]=J,t[76]=ie,t[77]=ae,t[78]=oe,t[79]=Y):Y=t[79];let X;t[80]!==H||t[81]!==Y?(X=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[H,Y]}),t[80]=H,t[81]=Y,t[82]=X):X=t[82];let se;t[83]!==X||t[84]!==L?(se=(0,$.jsx)(de,{className:L,children:X}),t[83]=X,t[84]=L,t[85]=se):se=t[85];let ce;return t[86]!==x||t[87]!==se?(ce=(0,$.jsx)(`div`,{ref:x,id:`tunnel-broker-secret-setup`,children:se}),t[86]=x,t[87]=se,t[88]=ce):ce=t[88],ce}function wt(){return Te().then(Tt)}function Tt(e){return e.registrationSecret??null}var Et={actionError:null,starting:!1,stopping:!1,savingAutoStart:!1,consentOpen:!1,autoStartConfirmOpen:!1,releaseConfirmOpen:!1,releasing:!1,brokerSecretDraft:``,savingBrokerSecret:!1,authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null};function Dt({embedded:e=!1}){let t=y(e=>e.language),n=g(t).tunnelSettings,r=!!x(e=>e.token),[i,a]=(0,Z.useReducer)(ne,Et),{actionError:o,starting:s,stopping:c,savingAutoStart:l,consentOpen:m,autoStartConfirmOpen:h,releaseConfirmOpen:_,releasing:v,brokerSecretDraft:b,savingBrokerSecret:S,authorizingBrokerSecret:C,brokerSecretAuthorizationUrl:w,brokerSecretNotice:T}=i,E=(0,Z.useRef)(null),{data:D}=M(r),{data:O,error:k,isLoading:I,mutate:R}=A(r?`tunnel-status`:null,be,{refreshInterval:e=>s?1e3:e?.frpcDownload||e?.state===`connecting`||e?.state===`reconnecting`?2e3:6e4}),z=(0,Z.useMemo)(()=>{let e=D?.payload?.config;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.tunnel;if(t&&typeof t==`object`&&!Array.isArray(t)&&t.autoStart===!0)return!0}return O?.config?.autoStart===!0},[D,O?.config?.autoStart]),B=(0,Z.useMemo)(()=>{let e=D?.payload?.config;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.tunnel;if(t&&typeof t==`object`&&!Array.isArray(t)){let e=t.registrationSecret;if(typeof e==`string`)return e}}return``},[D]),V=te(B),H=O?.registrationSecret?.configured??V;(0,Z.useEffect)(()=>{let e=()=>{R()};return window.addEventListener(`tunnel-status`,e),()=>window.removeEventListener(`tunnel-status`,e)},[R]);let ee=(0,Z.useMemo)(()=>[n.consentBullet1,n.consentBullet2,n.consentBullet3],[n.consentBullet1,n.consentBullet2,n.consentBullet3]),U=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{starting:!0}});try{await Ce(),await R(),j()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{starting:!1}})}},[R]),W=(0,Z.useCallback)(()=>{if(!H){a({type:`patch`,patch:{actionError:n.brokerSecretRequiredBeforeStart}}),E.current?.scrollIntoView({behavior:`smooth`,block:`start`});return}if(O?.consentRequired){a({type:`patch`,patch:{consentOpen:!0}});return}U()},[H,O?.consentRequired,U,n.brokerSecretRequiredBeforeStart]),G=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{consentOpen:!1}}),a({type:`patch`,patch:{actionError:null}});try{await xe(),await Promise.all([R(),U()])}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}},[R,U]),K=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{stopping:!0}});try{await we(),await R(),j()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{stopping:!1}})}},[R]),q=(0,Z.useCallback)(async e=>{a({type:`patch`,patch:{savingAutoStart:!0}}),a({type:`patch`,patch:{actionError:null}});try{await Ee({autoStart:e}),j()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingAutoStart:!1}})}},[]),J=(0,Z.useCallback)(()=>{if(z){q(!1);return}if(O?.consentRequired){a({type:`patch`,patch:{actionError:n.consentExpiredBanner}});return}if(!O?.canAutoStart){a({type:`patch`,patch:{actionError:n.autoStartHint}});return}a({type:`patch`,patch:{autoStartConfirmOpen:!0}})},[q,O?.canAutoStart,O?.consentRequired,n,z]),re=(0,Z.useCallback)(async()=>{let e=b.trim();if(e){a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await Ee({registrationSecret:e}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretSaved}}),j(),await R(),a({type:`patch`,patch:{actionError:null}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingBrokerSecret:!1}})}}},[b,R,n.brokerSecretSaved]),ie=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await Ee({registrationSecret:null}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretCleared}}),j(),await R()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingBrokerSecret:!1}})}},[R,n.brokerSecretCleared]),ae=(0,Z.useCallback)(async()=>{let e=me(),t=null,r=null;a({type:`patch`,patch:{authorizingBrokerSecret:!0,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null,actionError:null}});try{for(t=(await N(`xopc-tunnel`)).sessionId;;){await new Promise(e=>window.setTimeout(e,1e3));let i=await F(t);if(i.authUrl&&i.authUrl!==r&&(r=i.authUrl,a({type:`patch`,patch:{brokerSecretAuthorizationUrl:i.authUrl}}),await pe(i.authUrl,e)),i.status===`failed`||i.status===`cancelled`)throw Error(i.error??i.message??`OAuth authorization failed`);if(i.status===`completed`){await Se(),await Promise.all([R(),j()]),a({type:`patch`,patch:{brokerSecretNotice:n.brokerSecretSaved,brokerSecretDraft:``}});return}}}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{he(e),t&&P(t).catch(()=>void 0),a({type:`patch`,patch:{authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null}})}},[R,n.brokerSecretSaved]),oe=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{releaseConfirmOpen:!1,actionError:null,releasing:!0}});try{await we({release:!0}),await R(),j()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{releasing:!1}})}},[R]),Y=(0,Z.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:g(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]);if(!r)return(0,$.jsx)(`div`,{className:e?void 0:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})});let X=O??{enabled:!1,state:`disconnected`,subdomain:null,publicUrl:null,connectedSince:null,frpcPid:null,lastHeartbeatAt:null,lastError:null,consentRequired:!0,config:{autoStart:z,brokerUrl:`https://frp.xopc.ai/api`}},se=O?.consentRequired&&(X.enabled||z||O?.consent?.acceptedAt),ce=(0,$.jsx)(Ct,{t:n,brokerSecretReady:H,brokerSecretConfiguredInConfig:V,brokerSecretMaskedValue:V?B:``,brokerSecretDraft:b,savingBrokerSecret:S,authorizingBrokerSecret:C,brokerSecretAuthorizationUrl:w,brokerSecretNotice:T,copyFailedLabel:g(t).clipboard.copyFailed,onDraftChange:e=>a({type:`patch`,patch:{brokerSecretDraft:e}}),onSave:()=>void re(),onAuthorize:()=>void ae(),onClear:()=>void ie(),sectionRef:E}),le=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(it,{open:m,title:n.consentTitle,intro:n.consentIntro,bullets:ee,checkboxLabel:n.consentCheckbox,confirmLabel:se?n.consentReconfirm:n.consentConfirm,cancelLabel:n.consentCancel,onConfirm:()=>void G(),onCancel:()=>a({type:`patch`,patch:{consentOpen:!1}})},m?`consent-open`:`consent-closed`),(0,$.jsx)(L,{open:h,title:n.autoStartConfirmTitle,description:n.autoStartConfirmBody,confirmLabel:n.autoStartConfirmLabel,cancelLabel:n.consentCancel,onConfirm:()=>{a({type:`patch`,patch:{autoStartConfirmOpen:!1}}),q(!0)},onCancel:()=>a({type:`patch`,patch:{autoStartConfirmOpen:!1}})}),(0,$.jsx)(L,{open:_,title:n.releaseConfirmTitle,description:n.releaseConfirmBody,confirmLabel:n.releaseConfirmLabel,cancelLabel:n.consentCancel,destructive:!0,onConfirm:()=>void oe(),onCancel:()=>a({type:`patch`,patch:{releaseConfirmOpen:!1}})})]});return e?(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o}):null,ce,(0,$.jsx)(bt,{t:n,status:X,isLoading:I,statusErr:k,starting:s,stopping:c,showConsentExpired:!!se,copyLabels:Y,startDisabled:!H,startDisabledReason:H?void 0:n.brokerSecretRequiredBeforeStart,stepLabel:n.flowStepStart,onStart:W,onStop:()=>void K()}),(0,$.jsxs)(rt,{showLabel:n.showOptions,hideLabel:n.hideOptions,children:[(0,$.jsxs)(`label`,{className:f(`flex items-center gap-3 text-sm text-fg`,!z&&!O?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:z,disabled:l||!z&&!O?.canAutoStart,onChange:J}),n.autoStart]}),!O?.canAutoStart&&!z?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.autoStartHint}):null,X.subdomain||X.publicUrl?(0,$.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle pt-4`,children:[(0,$.jsxs)(p,{type:`button`,variant:`secondary`,disabled:v||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[v?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,n.release]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint})]}):null]}),(0,$.jsx)(rt,{showLabel:n.showAdvanced,hideLabel:n.hideAdvanced,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-edge-subtle pt-4 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(ge,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]})}),le]}):(0,$.jsxs)(`div`,{className:e?`flex w-full flex-col gap-6`:`flex w-full flex-col gap-6 px-3 py-8 sm:px-5 xl:px-6`,children:[e?null:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:n.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.subtitle})]}),o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o}):null,ce,(0,$.jsx)(bt,{t:n,status:X,isLoading:I,statusErr:k,starting:s,stopping:c,showConsentExpired:!!se,copyLabels:Y,startDisabled:!H,startDisabledReason:H?void 0:n.brokerSecretRequiredBeforeStart,onStart:W,onStop:()=>void K()}),X.subdomain||X.publicUrl?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,$.jsxs)(p,{type:`button`,variant:`secondary`,disabled:v||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[v?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,n.release]})}):null,X.subdomain||X.publicUrl?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint}):null,(0,$.jsxs)(de,{children:[(0,$.jsx)(`h2`,{className:`mb-3 text-sm font-semibold text-fg`,children:n.optionsTitle}),(0,$.jsxs)(`label`,{className:f(`flex items-center gap-3 text-sm text-fg`,!z&&!O?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:z,disabled:l||!z&&!O?.canAutoStart,onChange:J}),n.autoStart]}),!O?.canAutoStart&&!z?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n.autoStartHint}):null]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 text-xs text-fg-subtle shadow-surface`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(ge,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]}),le]})}function Ot(e,t){return e.tabs[t]}function kt(e,t){return e.tabIntro[t]}function At(e){switch(e){case`tailscale`:return`tailscale-serve`;case`public`:return`public-tunnel`;case`reverse-proxy`:return`reverse-proxy`;case`ssh`:return`ssh-tunnel`;case`lan`:return`lan`;default:return}}function jt(e){let t=(0,Q.c)(7),{tab:n,onOpenTab:r}=e;switch(n){case`guide`:{let e;return t[0]===r?e=t[1]:(e=(0,$.jsx)(Ne,{onOpenTab:r}),t[0]=r,t[1]=e),e}case`tailscale`:{let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(nt,{embedded:!0}),t[2]=e):e=t[2],e}case`public`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Dt,{embedded:!0}),t[3]=e):e=t[3],e}case`reverse-proxy`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Xe,{}),t[4]=e):e=t[4],e}case`ssh`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ve,{}),t[5]=e):e=t[5],e}case`lan`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Le,{}),t[6]=e):e=t[6],e}}}function Mt(){let e=(0,Q.c)(3),t=i(),n=y(Pt),r=g(n).remoteAccess,o=!!x(Nt),[s,c]=a(),l=Ue(s.get(`tab`)),u=s.get(`intent`)===`mobile-pairing`,d;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(d={refreshInterval:2e3},e[0]=d):d=e[0];let f=A(u?`mobile-pairing-readiness`:null,se,d),m;e[1]===c?m=e[2]:(m=e=>{c(t=>{let n=new URLSearchParams(t);return e===`guide`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[1]=c,e[2]=m);let h=m,_=kt(r,l),v=He.map(e=>({id:e,label:Ot(r,e)}));return(0,$.jsxs)(Y,{children:[(0,$.jsx)(oe,{title:r.pageTitle,subtitle:r.pageSubtitle,meta:(0,$.jsx)(ge,{language:n,label:r.docsLink,section:At(l),className:`mt-1`})}),o?(0,$.jsxs)($.Fragment,{children:[u?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl border border-accent/25 bg-accent-soft px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(q,{className:`mt-0.5 size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.mobilePairingFlow.title}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:f.data?.ready?r.mobilePairingFlow.ready:r.mobilePairingFlow.hint})]})]}),(0,$.jsxs)(p,{variant:`primary`,disabled:!f.data?.ready,onClick:()=>t(`/settings/devices?startMobilePairing=1`),children:[f.data?.ready?r.mobilePairingFlow.continue:r.mobilePairingFlow.waiting,(0,$.jsx)(ae,{className:`size-4`,"aria-hidden":!0})]})]}):null,(0,$.jsx)(ce,{items:v,activeTab:l,onChange:h,ariaLabel:r.tabsAria,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`}),(0,$.jsx)(X,{id:l,activeTab:l,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`,title:Ot(r,l),hint:l===`public`?void 0:_,children:(0,$.jsx)(jt,{tab:l,onOpenTab:h})})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.guide.needToken})]})}function Nt(e){return e.token}function Pt(e){return e.language}export{Mt as RemoteAccessHub};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,p as a,t as o}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as s}from"./check-DUBLcKHA.js";import{t as c}from"./copy-Dv6d4Dvw.js";import{t as l}from"./external-link-DjqjBmc3.js";import{t as u}from"./globe-DSSGFWFn.js";import{t as d}from"./loader-circle-CifKLtgG.js";import{t as f}from"./cn-JdwAhgNB.js";import{t as p}from"./button-CSEbl4zT.js";import{s as m}from"./form-field-width-DJw_jULe.js";import{t as h}from"./copy-to-clipboard-HOJ79TWv.js";import{t as g}from"./messages-CoovNoMn.js";import{a as _,i as v,n as y,r as b,s as x}from"./locale-store-8k4mvYGL.js";import{i as S,o as C}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{a as w,i as T,o as E,r as D,s as O,t as k}from"./dist-BPoKqzeH.js";import{i as A}from"./vendor-swr-BIWyz7Rc.js";import{n as j,r as M}from"./gateway-config-swr-R702lNJR.js";import{a as N,n as P,r as F}from"./oauth-api-DpLONwfK.js";import{Bo as I,Di as L,Ps as R,To as z,Wc as B,Wo as V,bo as H,bs as ee,di as U,ds as W,fn as te,is as G,ka as K,ns as q,rl as J,sa as ne,sc as re,tl as ie,yl as ae}from"./index-DFfvY8IN.js";import{n as oe,r as Y,t as X}from"./settings-page-layout-BRQNel6r.js";import{r as se}from"./mobile-device-api-CvjVB_TB.js";import{t as ce}from"./page-tabs-BaEQMYm_.js";import{n as le,r as ue,t as de}from"./settings-form-section-D7nQ3Lfu.js";import{t as fe}from"./settings-advanced-gate-a146I0uZ.js";import{n as pe,r as me,t as he}from"./oauth-authorization-window-Cdolr2wE.js";var Z=e(t(),1),Q=n(),$=r();function ge(e){let t=(0,Q.c)(10),{language:n,label:r,section:i,className:a}=e,o;t[0]!==n||t[1]!==i?(o=H(n,i),t[0]=n,t[1]=i,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=f(`inline-flex items-center gap-1 text-sm font-medium text-accent hover:underline`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,a),t[3]=a,t[4]=s);let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(l,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[5]=c):c=t[5];let u;return t[6]!==r||t[7]!==o||t[8]!==s?(u=(0,$.jsxs)(`a`,{href:o,target:`_blank`,rel:`noreferrer`,className:s,children:[r,c]}),t[6]=r,t[7]=o,t[8]=s,t[9]=u):u=t[9],u}async function _e(){let e=await v(`/api/exposure/status`);if(!e.ok)throw Error(`Failed to load exposure status (${e.status})`);return await e.json()}async function ve(e=`serve`){let t=await v(`/api/exposure/tailscale/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mode:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`Start failed (${t.status})`)}return await t.json()}async function ye(){let e=await v(`/api/exposure/tailscale/stop`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`Stop failed (${e.status})`)}return await e.json()}async function be(){return _(b(`/api/tunnel/status`))}async function xe(){await _(b(`/api/tunnel/consent`),{method:`POST`,body:JSON.stringify({})})}async function Se(){await _(b(`/api/tunnel/registration-key`),{method:`POST`,body:JSON.stringify({})})}async function Ce(){return _(b(`/api/tunnel/start`),{method:`POST`,body:JSON.stringify({})})}async function we(e){return _(b(`/api/tunnel/stop`),{method:`POST`,body:JSON.stringify({release:e?.release===!0})})}async function Te(){let e=(await _(b(`/api/tunnel/reveal-registration-secret`),{method:`POST`,body:JSON.stringify({})})).payload;if(!e)throw Error(`Missing reveal payload`);return{registrationSecret:e.registrationSecret??null,source:e.source===`config`?`config`:`none`}}async function Ee(e){await _(b(`/api/config`),{method:`PATCH`,body:JSON.stringify({tunnel:e})})}function De(e){switch(e){case`active`:return`bg-emerald-500/15 text-emerald-700 dark:text-emerald-400`;case`connecting`:return`bg-amber-500/15 text-amber-700 dark:text-amber-400`;default:return`bg-surface-hover text-fg-muted`}}function Oe(e){let t=(0,Q.c)(5),{label:n,kind:r}=e,i;t[0]===r?i=t[1]:(i=f(`rounded-full px-2 py-0.5 text-[11px] font-medium`,De(r)),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,$.jsx)(`span`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function ke(e){let t=(0,Q.c)(31),{onOpenTab:n}=e,r=y(je),i;t[0]===r?i=t[1]:(i=g(r),t[0]=r,t[1]=i);let a=i.remoteAccess.guide,o=!!x(Ae),s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={refreshInterval:3e4},t[2]=s):s=t[2];let{data:c}=A(o?`exposure-status`:null,_e,s),l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l={refreshInterval:15e3},t[3]=l):l=t[3];let{data:d}=A(o?`tunnel-status`:null,be,l),p=M(o);if(!o)return null;let m=c?.tailscale.active===!0,h=d?.state,_=d?.enabled&&h===`connected`,v=d?.enabled&&(h===`connecting`||h===`reconnecting`||!!d?.startProgress||!!d?.frpcDownload),b=p.data?.payload?.config,S=!!(b&&typeof b==`object`&&!Array.isArray(b)&&b.gateway?.publicUrl),C=m?`active`:`off`,w=m?a.statusActive:a.statusOff,T;t[4]!==a.tailscaleCardTitle||t[5]!==C||t[6]!==w?(T={tab:`tailscale`,icon:u,title:a.tailscaleCardTitle,kind:C,statusLabel:w},t[4]=a.tailscaleCardTitle,t[5]=C,t[6]=w,t[7]=T):T=t[7];let E=_?`active`:v?`connecting`:`off`,D=_?a.statusActive:v?a.statusConnecting:a.statusOff,O;t[8]!==a.publicCardTitle||t[9]!==E||t[10]!==D?(O={tab:`public`,icon:R,title:a.publicCardTitle,kind:E,statusLabel:D},t[8]=a.publicCardTitle,t[9]=E,t[10]=D,t[11]=O):O=t[11];let k=S?`active`:`off`,j=S?a.statusActive:a.statusOff,N;t[12]!==a.reverseProxyCardTitle||t[13]!==k||t[14]!==j?(N={tab:`reverse-proxy`,icon:G,title:a.reverseProxyCardTitle,kind:k,statusLabel:j},t[12]=a.reverseProxyCardTitle,t[13]=k,t[14]=j,t[15]=N):N=t[15];let P;t[16]!==a.sshCardStatus||t[17]!==a.sshCardTitle?(P={tab:`ssh`,icon:V,title:a.sshCardTitle,kind:`off`,statusLabel:a.sshCardStatus},t[16]=a.sshCardStatus,t[17]=a.sshCardTitle,t[18]=P):P=t[18];let F;t[19]!==a.lanCardStatus||t[20]!==a.lanCardTitle?(F={tab:`lan`,icon:W,title:a.lanCardTitle,kind:`off`,statusLabel:a.lanCardStatus},t[19]=a.lanCardStatus,t[20]=a.lanCardTitle,t[21]=F):F=t[21];let I;t[22]!==N||t[23]!==P||t[24]!==F||t[25]!==T||t[26]!==O?(I=[T,O,N,P,F],t[22]=N,t[23]=P,t[24]=F,t[25]=T,t[26]=O,t[27]=I):I=t[27];let L=I,z;return t[28]!==L||t[29]!==n?(z=(0,$.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5`,children:L.map(e=>{let t=e.icon;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e.tab),className:f(`flex items-start gap-3 rounded-xl bg-surface-base px-3 py-2.5 text-left shadow-surface transition-colors`,`hover:bg-surface-hover/50`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-hover/90 text-fg-muted`,children:(0,$.jsx)(t,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(Oe,{label:e.statusLabel,kind:e.kind})]})]},`${e.tab}-${e.title}`)})}),t[28]=L,t[29]=n,t[30]=z):z=t[30],z}function Ae(e){return e.token}function je(e){return e.language}function Me(e){let t=(0,Q.c)(26),{title:n,description:r,recommended:i,icon:a,onOpen:o,openLabel:s,recommendedLabel:c}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=f(`group flex w-full flex-col rounded-2xl bg-surface-base p-4 text-left transition-colors`,`hover:bg-surface-hover/40`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),t[0]=l):l=t[0];let u;t[1]===a?u=t[2]:(u=(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover/90 text-fg-muted`,children:(0,$.jsx)(a,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),t[1]=a,t[2]=u);let d;t[3]===n?d=t[4]:(d=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[3]=n,t[4]=d);let p;t[5]!==i||t[6]!==c?(p=i&&c?(0,$.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:c}):null,t[5]=i,t[6]=c,t[7]=p):p=t[7];let m;t[8]!==d||t[9]!==p?(m=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[d,p]}),t[8]=d,t[9]=p,t[10]=m):m=t[10];let h;t[11]===r?h=t[12]:(h=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:r}),t[11]=r,t[12]=h);let g;t[13]!==m||t[14]!==h?(g=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[m,h]}),t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(ie,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[16]=_):_=t[16];let v;t[17]!==u||t[18]!==g?(v=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[u,g,_]}),t[17]=u,t[18]=g,t[19]=v):v=t[19];let y;t[20]===s?y=t[21]:(y=(0,$.jsx)(`span`,{className:`mt-3 text-xs font-medium text-accent`,children:s}),t[20]=s,t[21]=y);let b;return t[22]!==o||t[23]!==y||t[24]!==v?(b=(0,$.jsxs)(`button`,{type:`button`,onClick:o,className:l,children:[v,y]}),t[22]=o,t[23]=y,t[24]=v,t[25]=b):b=t[25],b}function Ne(e){let t=(0,Q.c)(83),{onOpenTab:n}=e,r=y(Ie),i;t[0]===r?i=t[1]:(i=g(r),t[0]=r,t[1]=i);let a=i.remoteAccess,o=a.guide,s=!!x(Fe),c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c={refreshInterval:3e4},t[2]=c):c=t[2];let{data:l}=A(s?`exposure-status`:null,_e,c),d;t[3]===l?.conflicts?d=t[4]:(d=l?.conflicts??[],t[3]=l?.conflicts,t[4]=d);let f=d;if(!s){let e;return t[5]===o.needToken?e=t[6]:(e=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.needToken}),t[5]=o.needToken,t[6]=e),e}let p;t[7]===n?p=t[8]:(p=(0,$.jsx)(ke,{onOpenTab:n}),t[7]=n,t[8]=p);let m;t[9]!==f||t[10]!==o.conflictsHint||t[11]!==o.conflictsTitle?(m=f.length>0?(0,$.jsxs)(`div`,{className:`rounded-xl border border-amber-500/30 bg-amber-500/5 px-4 py-3 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:o.conflictsTitle}),(0,$.jsx)(`p`,{className:`mt-1`,children:o.conflictsHint}),(0,$.jsx)(`ul`,{className:`mt-2 list-inside list-disc text-xs`,children:f.map(Pe)})]}):null,t[9]=f,t[10]=o.conflictsHint,t[11]=o.conflictsTitle,t[12]=m):m=t[12];let h;t[13]===o.pickMethod?h=t[14]:(h=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:o.pickMethod}),t[13]=o.pickMethod,t[14]=h);let _;t[15]===n?_=t[16]:(_=()=>n(`tailscale`),t[15]=n,t[16]=_);let v;t[17]!==o.configure||t[18]!==o.recommended||t[19]!==o.tailscaleCardDesc||t[20]!==o.tailscaleCardTitle||t[21]!==_?(v=(0,$.jsx)(Me,{icon:u,title:o.tailscaleCardTitle,description:o.tailscaleCardDesc,recommended:!0,recommendedLabel:o.recommended,openLabel:o.configure,onOpen:_}),t[17]=o.configure,t[18]=o.recommended,t[19]=o.tailscaleCardDesc,t[20]=o.tailscaleCardTitle,t[21]=_,t[22]=v):v=t[22];let b;t[23]===n?b=t[24]:(b=()=>n(`public`),t[23]=n,t[24]=b);let S;t[25]!==o.configure||t[26]!==o.publicCardDesc||t[27]!==o.publicCardTitle||t[28]!==b?(S=(0,$.jsx)(Me,{icon:R,title:o.publicCardTitle,description:o.publicCardDesc,openLabel:o.configure,onOpen:b}),t[25]=o.configure,t[26]=o.publicCardDesc,t[27]=o.publicCardTitle,t[28]=b,t[29]=S):S=t[29];let C;t[30]===n?C=t[31]:(C=()=>n(`reverse-proxy`),t[30]=n,t[31]=C);let w;t[32]!==o.configure||t[33]!==o.reverseProxyCardDesc||t[34]!==o.reverseProxyCardTitle||t[35]!==C?(w=(0,$.jsx)(Me,{icon:G,title:o.reverseProxyCardTitle,description:o.reverseProxyCardDesc,openLabel:o.configure,onOpen:C}),t[32]=o.configure,t[33]=o.reverseProxyCardDesc,t[34]=o.reverseProxyCardTitle,t[35]=C,t[36]=w):w=t[36];let T;t[37]===n?T=t[38]:(T=()=>n(`ssh`),t[37]=n,t[38]=T);let E;t[39]!==o.configure||t[40]!==o.sshCardDesc||t[41]!==o.sshCardTitle||t[42]!==T?(E=(0,$.jsx)(Me,{icon:V,title:o.sshCardTitle,description:o.sshCardDesc,openLabel:o.configure,onOpen:T}),t[39]=o.configure,t[40]=o.sshCardDesc,t[41]=o.sshCardTitle,t[42]=T,t[43]=E):E=t[43];let D;t[44]===n?D=t[45]:(D=()=>n(`lan`),t[44]=n,t[45]=D);let O;t[46]!==o.configure||t[47]!==o.lanCardDesc||t[48]!==o.lanCardTitle||t[49]!==D?(O=(0,$.jsx)(Me,{icon:W,title:o.lanCardTitle,description:o.lanCardDesc,openLabel:o.configure,onOpen:D}),t[46]=o.configure,t[47]=o.lanCardDesc,t[48]=o.lanCardTitle,t[49]=D,t[50]=O):O=t[50];let k;t[51]!==S||t[52]!==w||t[53]!==E||t[54]!==O||t[55]!==v?(k=(0,$.jsxs)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:[v,S,w,E,O]}),t[51]=S,t[52]=w,t[53]=E,t[54]=O,t[55]=v,t[56]=k):k=t[56];let j;t[57]!==k||t[58]!==h?(j=(0,$.jsxs)(`div`,{children:[h,k]}),t[57]=k,t[58]=h,t[59]=j):j=t[59];let M;t[60]===o.oneAtATimeHint?M=t[61]:(M=(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:o.oneAtATimeHint}),t[60]=o.oneAtATimeHint,t[61]=M);let N;t[62]===a.advanced.proxyTitle?N=t[63]:(N=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.advanced.proxyTitle}),t[62]=a.advanced.proxyTitle,t[63]=N);let P;t[64]===a.advanced.proxyBody?P=t[65]:(P=(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:a.advanced.proxyBody}),t[64]=a.advanced.proxyBody,t[65]=P);let F;t[66]!==r||t[67]!==a.advanced.proxyDocs?(F=(0,$.jsx)(ge,{language:r,label:a.advanced.proxyDocs,section:`advanced`,className:`mt-2`}),t[66]=r,t[67]=a.advanced.proxyDocs,t[68]=F):F=t[68];let I;t[69]!==N||t[70]!==P||t[71]!==F?(I=(0,$.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-4 py-3`,children:[N,P,F]}),t[69]=N,t[70]=P,t[71]=F,t[72]=I):I=t[72];let L;t[73]!==o.docsLink||t[74]!==r?(L=(0,$.jsx)(ge,{language:r,label:o.docsLink}),t[73]=o.docsLink,t[74]=r,t[75]=L):L=t[75];let z;return t[76]!==j||t[77]!==M||t[78]!==I||t[79]!==L||t[80]!==p||t[81]!==m?(z=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[p,m,j,M,I,L]}),t[76]=j,t[77]=M,t[78]=I,t[79]=L,t[80]=p,t[81]=m,t[82]=z):z=t[82],z}function Pe(e){return(0,$.jsx)(`li`,{children:e.message},e.code)}function Fe(e){return e.token}function Ie(e){return e.language}function Le(){let e=(0,Q.c)(16),t=y(Re),n;e[0]===t?n=e[1]:(n=g(t),e[0]=t,e[1]=n);let r=n.remoteAccess.lan,i;e[2]!==r.subtitle||e[3]!==r.title?(i=(0,$.jsx)(le,{icon:W,title:r.title,subtitle:r.subtitle}),e[2]=r.subtitle,e[3]=r.title,e[4]=i):i=e[4];let a;e[5]===r.body?a=e[6]:(a=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.body}),e[5]=r.body,e[6]=a);let s;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),e[7]=s):s=e[7];let c;e[8]===r.link?c=e[9]:(c=(0,$.jsxs)(o,{to:`/settings/gateway`,className:`inline-flex items-center gap-1.5 text-sm font-medium text-accent hover:underline`,children:[r.link,s]}),e[8]=r.link,e[9]=c);let u;e[10]!==a||e[11]!==c?(u=(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[a,c]}),e[10]=a,e[11]=c,e[12]=u):u=e[12];let d;return e[13]!==i||e[14]!==u?(d=(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,$.jsxs)(de,{children:[i,u]})}),e[13]=i,e[14]=u,e[15]=d):d=e[15],d}function Re(e){return e.language}function ze(e){let t=(0,Q.c)(30),{embedded:n}=e,r=n===void 0?!1:n,i=y(Be),a;t[0]===i?a=t[1]:(a=g(i),t[0]=i,t[1]=a);let o=a.remoteAccess.ssh,[s,l]=(0,Z.useState)(!1),u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=async()=>{await h(`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`)&&(l(!0),setTimeout(()=>l(!1),2e3))},t[2]=u):u=t[2];let d=u,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`pre`,{className:`overflow-x-auto rounded-lg border border-edge bg-surface px-3 py-2 text-xs text-fg-muted`,children:`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`}),t[3]=f):f=t[3];let m,_;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>void d(),_=(0,$.jsx)(c,{className:`mr-1 size-4`}),t[4]=m,t[5]=_):(m=t[4],_=t[5]);let v=s?o.copied:o.copy,b;t[6]===v?b=t[7]:(b=(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsxs)(p,{type:`button`,variant:`ghost`,onClick:m,children:[_,v]})}),t[6]=v,t[7]=b);let x;t[8]!==r||t[9]!==o.hint?(x=r?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:o.hint}):null,t[8]=r,t[9]=o.hint,t[10]=x):x=t[10];let S;t[11]!==b||t[12]!==x?(S=(0,$.jsxs)($.Fragment,{children:[f,b,x]}),t[11]=b,t[12]=x,t[13]=S):S=t[13];let C=S;if(r){let e;t[14]!==o.subtitle||t[15]!==o.title?(e=(0,$.jsx)(le,{icon:V,title:o.title,subtitle:o.subtitle}),t[14]=o.subtitle,t[15]=o.title,t[16]=e):e=t[16];let n;t[17]===C?n=t[18]:(n=(0,$.jsx)(`div`,{className:`mt-4 space-y-2`,children:C}),t[17]=C,t[18]=n);let r;return t[19]!==e||t[20]!==n?(r=(0,$.jsxs)(de,{children:[e,n]}),t[19]=e,t[20]=n,t[21]=r):r=t[21],r}let w;t[22]!==o.subtitle||t[23]!==o.title?(w=(0,$.jsx)(le,{icon:V,title:o.title,subtitle:o.subtitle}),t[22]=o.subtitle,t[23]=o.title,t[24]=w):w=t[24];let T;t[25]===C?T=t[26]:(T=(0,$.jsx)(`div`,{className:`mt-4`,children:C}),t[25]=C,t[26]=T);let E;return t[27]!==w||t[28]!==T?(E=(0,$.jsxs)(de,{children:[w,T]}),t[27]=w,t[28]=T,t[29]=E):E=t[29],E}function Be(e){return e.language}function Ve(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(ze,{embedded:!0}),e[0]=t):t=e[0],t}var He=[`guide`,`tailscale`,`public`,`reverse-proxy`,`ssh`,`lan`];function Ue(e){return e&&He.includes(e)?e:`guide`}async function We(e){let t=await v(b(`/api/tunnel/probe-public`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e})});if(!t.ok&&t.status!==400)throw Error(`Probe failed (${t.status})`);return await t.json()}async function Ge(e){await _(b(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{publicUrl:e??null}})})}function Ke(e){let t=e.split(`.`).map(e=>Number.parseInt(e,10));if(t.length!==4||t.some(e=>!Number.isFinite(e)))return!1;let[n,r]=t;return n===10||n===127||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168||n===100&&r>=64&&r<=127}function qe(){return(0,Z.useMemo)(()=>{if(typeof window>`u`)return null;let{protocol:e,hostname:t,origin:n}=window.location;if(e!==`https:`&&e!==`http:`)return null;let r=t.toLowerCase();return!r||r===`localhost`||r===`127.0.0.1`||r===`::1`||r===`[::1]`||r.endsWith(`.local`)||r.endsWith(`.localhost`)||Ke(r)?null:n.toLowerCase().replace(/\/+$/,``)},[])}function Je(){return f(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,m,`dark:border-edge`)}function Ye(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.gateway;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.publicUrl;return typeof n==`string`&&n.trim()?n.trim():null}function Xe(){let e=(0,Q.c)(85),t=y(Qe),n;e[0]===t?n=e[1]:(n=g(t),e[0]=t,e[1]=n);let r=n.remoteAccess.reverseProxy,i=!!x(Ze),a=qe(),o=M(i).data?.payload?.config,s;e[2]===o?s=e[3]:(s=Ye(o),e[2]=o,e[3]=s);let c=s,[l,m]=(0,Z.useState)(``),h;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(h={busy:!1,result:null},e[4]=h):h=e[4];let[_,v]=(0,Z.useState)(h),b;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(b={busy:!1,error:null},e[5]=b):b=e[5];let[S,C]=(0,Z.useState)(b),w,T;e[6]!==c||e[7]!==a||e[8]!==l?(w=()=>{l||(c?m(c):a&&m(a))},T=[c,a,l],e[6]=c,e[7]=a,e[8]=l,e[9]=w,e[10]=T):(w=e[9],T=e[10]),(0,Z.useEffect)(w,T);let E;bb0:{let t;e[11]===l?t=e[12]:(t=l.trim(),e[11]=l,e[12]=t);let n=t;if(n){E=n;break bb0}E=c??a??``}let D=E,O=!c&&!!a&&D===a,k;e[13]!==l||e[14]!==D?(k=async()=>{let e=l.trim()||D;if(e){v({busy:!0,result:null});try{v({busy:!1,result:await We(e)})}catch(e){let t=e;v({busy:!1,result:{ok:!1,code:`NETWORK_ERROR`,message:t instanceof Error?t.message:String(t)}})}}},e[13]=l,e[14]=D,e[15]=k):k=e[15];let A=k,N;e[16]===D?N=e[17]:(N=async()=>{let e=D.trim();if(e){C({busy:!0,error:null});try{await Ge(e),await j(),C({busy:!1,error:null})}catch(e){let t=e;C({busy:!1,error:t instanceof Error?t.message:String(t)})}}},e[16]=D,e[17]=N);let P=N,F;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(F=async()=>{C({busy:!0,error:null});try{await Ge(null),await j(),m(``),v({busy:!1,result:null}),C({busy:!1,error:null})}catch(e){let t=e;C({busy:!1,error:t instanceof Error?t.message:String(t)})}},e[18]=F):F=e[18];let I=F;if(!i)return null;let L;e[19]!==r.subtitle||e[20]!==r.title?(L=(0,$.jsx)(le,{icon:u,title:r.title,subtitle:r.subtitle}),e[19]=r.subtitle,e[20]=r.title,e[21]=L):L=e[21];let R;e[22]===r.urlLabel?R=e[23]:(R=(0,$.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`reverse-proxy-url`,children:r.urlLabel}),e[22]=r.urlLabel,e[23]=R);let z;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(z=f(Je(),`font-mono text-xs sm:flex-1 sm:min-w-0 sm:w-auto`),e[24]=z):z=e[24];let B;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(B=e=>{m(e.target.value),v({busy:!1,result:null})},e[25]=B):B=e[25];let V;e[26]!==l||e[27]!==r.urlPlaceholder||e[28]!==z?(V=(0,$.jsx)(`input`,{id:`reverse-proxy-url`,className:z,type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:r.urlPlaceholder,value:l,onChange:B}),e[26]=l,e[27]=r.urlPlaceholder,e[28]=z,e[29]=V):V=e[29];let H;e[30]===A?H=e[31]:(H=()=>void A(),e[30]=A,e[31]=H);let ee;e[32]!==l||e[33]!==_.busy?(ee=_.busy||!l.trim(),e[32]=l,e[33]=_.busy,e[34]=ee):ee=e[34];let U;e[35]===_.busy?U=e[36]:(U=_.busy?(0,$.jsx)(d,{className:`size-3.5 animate-spin`}):null,e[35]=_.busy,e[36]=U);let W=_.busy?r.probing:r.probeButton,te;e[37]!==H||e[38]!==ee||e[39]!==U||e[40]!==W?(te=(0,$.jsxs)(p,{type:`button`,variant:`secondary`,className:`shrink-0 whitespace-nowrap`,onClick:H,disabled:ee,children:[U,W]}),e[37]=H,e[38]=ee,e[39]=U,e[40]=W,e[41]=te):te=e[41];let G;e[42]!==V||e[43]!==te?(G=(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch`,children:[V,te]}),e[42]=V,e[43]=te,e[44]=G):G=e[44];let K;e[45]===r.urlHint?K=e[46]:(K=(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.urlHint}),e[45]=r.urlHint,e[46]=K);let q;e[47]!==a||e[48]!==O||e[49]!==r.autoDetectedHint||e[50]!==r.autoDetectedTitle?(q=O&&a?(0,$.jsxs)(`div`,{className:`rounded-lg border border-accent/40 bg-accent-soft/50 px-3 py-2 text-xs leading-relaxed text-accent-fg`,children:[(0,$.jsx)(`div`,{className:`font-medium`,children:r.autoDetectedTitle}),(0,$.jsx)(`div`,{className:`mt-1 break-all font-mono text-[11px]`,children:a}),(0,$.jsx)(`p`,{className:`mt-1`,children:r.autoDetectedHint})]}):null,e[47]=a,e[48]=O,e[49]=r.autoDetectedHint,e[50]=r.autoDetectedTitle,e[51]=q):q=e[51];let J;e[52]!==_.result||e[53]!==r.probeStatus?(J=_.result?(0,$.jsx)($e,{result:_.result,labels:r.probeStatus}):null,e[52]=_.result,e[53]=r.probeStatus,e[54]=J):J=e[54];let ne;e[55]!==c||e[56]!==D||e[57]!==P||e[58]!==r.saveAsDefault||e[59]!==r.saving||e[60]!==S.busy?(ne=D&&c!==D?(0,$.jsxs)(p,{type:`button`,onClick:()=>void P(),disabled:S.busy,children:[S.busy?(0,$.jsx)(d,{className:`size-3.5 animate-spin`}):null,S.busy?r.saving:r.saveAsDefault]}):null,e[55]=c,e[56]=D,e[57]=P,e[58]=r.saveAsDefault,e[59]=r.saving,e[60]=S.busy,e[61]=ne):ne=e[61];let re;e[62]!==c||e[63]!==r.clear||e[64]!==S.busy?(re=c?(0,$.jsx)(p,{type:`button`,variant:`ghost`,onClick:()=>void I(),disabled:S.busy,children:r.clear}):null,e[62]=c,e[63]=r.clear,e[64]=S.busy,e[65]=re):re=e[65];let ie;e[66]!==ne||e[67]!==re?(ie=(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[ne,re]}),e[66]=ne,e[67]=re,e[68]=ie):ie=e[68];let ae;e[69]===S.error?ae=e[70]:(ae=S.error?(0,$.jsx)(`p`,{className:`text-xs text-red-800 dark:text-red-200`,children:S.error}):null,e[69]=S.error,e[70]=ae);let oe;e[71]===r.certWarning?oe=e[72]:(oe=(0,$.jsx)(`div`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs leading-relaxed text-amber-950 dark:border-amber-800/60 dark:bg-amber-950/30 dark:text-amber-100`,children:r.certWarning}),e[71]=r.certWarning,e[72]=oe);let Y;e[73]!==R||e[74]!==G||e[75]!==K||e[76]!==q||e[77]!==J||e[78]!==ie||e[79]!==ae||e[80]!==oe?(Y=(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[R,G,K,q,J,ie,ae,oe]}),e[73]=R,e[74]=G,e[75]=K,e[76]=q,e[77]=J,e[78]=ie,e[79]=ae,e[80]=oe,e[81]=Y):Y=e[81];let X;return e[82]!==L||e[83]!==Y?(X=(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,$.jsxs)(de,{children:[L,Y]})}),e[82]=L,e[83]=Y,e[84]=X):X=e[84],X}function Ze(e){return e.token}function Qe(e){return e.language}function $e(e){let t=(0,Q.c)(18),{result:n,labels:r}=e;if(n.ok){let e;t[0]===r.ok?e=t[1]:(e=(0,$.jsx)(`span`,{className:`font-medium`,children:r.ok}),t[0]=r.ok,t[1]=e);let i;t[2]===n.latencyMs?i=t[3]:(i=(0,$.jsxs)(`span`,{className:`font-mono`,children:[n.latencyMs,`ms`]}),t[2]=n.latencyMs,t[3]=i);let a;t[4]!==r.gatewayReady||t[5]!==n.gatewayReady?(a=n.gatewayReady?(0,$.jsxs)($.Fragment,{children:[` · `,(0,$.jsx)(`span`,{children:r.gatewayReady})]}):null,t[4]=r.gatewayReady,t[5]=n.gatewayReady,t[6]=a):a=t[6];let o;return t[7]!==e||t[8]!==i||t[9]!==a?(o=(0,$.jsxs)(`div`,{className:`rounded-lg border border-emerald-200 bg-emerald-50 px-3 py-2 text-xs text-emerald-900 dark:border-emerald-800/60 dark:bg-emerald-950/30 dark:text-emerald-100`,children:[e,` · `,i,a]}),t[7]=e,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}let i=r[`code_${n.code}`]??r.codeUnknown,a;t[11]===i?a=t[12]:(a=(0,$.jsx)(`span`,{className:`font-medium`,children:i}),t[11]=i,t[12]=a);let o;t[13]===n.message?o=t[14]:(o=n.message?(0,$.jsxs)($.Fragment,{children:[` — `,(0,$.jsx)(`span`,{className:`font-mono break-all`,children:n.message})]}):null,t[13]=n.message,t[14]=o);let s;return t[15]!==a||t[16]!==o?(s=(0,$.jsxs)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-900 dark:border-red-800/60 dark:bg-red-950/30 dark:text-red-100`,children:[a,o]}),t[15]=a,t[16]=o,t[17]=s):s=t[17],s}var et=`https://tailscale.com/download`;function tt(e){let t=(0,Q.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`a`,{href:et,target:`_blank`,rel:`noreferrer`,className:`font-medium text-accent hover:underline`,children:n}),t[0]=n,t[1]=r),r}function nt({embedded:e=!1}){let t=y(e=>e.language),n=g(t).remoteAccess.tailscale,r=(0,Z.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:g(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]),i=!!x(e=>e.token),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(null),{data:l,mutate:f,isLoading:m}=A(i?`exposure-status`:null,_e,{refreshInterval:3e4}),h=l?.tailscale.hostname,_=l?.tailscale.active===!0,v=l?.tailscale.cliAvailable!==!1,b=h?`https://${h}/`:null,S=(0,Z.useCallback)(async()=>{o(!0),c(null);try{await ve(`serve`),await f()}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}},[f]),C=(0,Z.useCallback)(async()=>{o(!0),c(null);try{await ye(),await f()}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}},[f]);if(!i)return null;let w=(0,$.jsxs)(`div`,{className:e?`space-y-4`:`mt-4 space-y-3`,children:[e?(0,$.jsxs)(`ol`,{className:`space-y-3 text-sm text-fg-muted`,children:[(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`1`}),(0,$.jsxs)(`span`,{children:[n.stepInstallBefore,(0,$.jsx)(tt,{label:n.stepInstallLink}),n.stepInstallAfter]})]}),(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`2`}),(0,$.jsx)(`span`,{children:n.stepEnable})]}),(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`3`}),(0,$.jsx)(`span`,{children:n.stepCopy})]})]}):null,e&&l?.tailscale.cliAvailable===!1?(0,$.jsxs)(`p`,{className:`rounded-lg border border-amber-500/25 bg-amber-500/5 px-3 py-2 text-sm text-fg-muted`,children:[n.cliMissingIntro,` `,(0,$.jsx)(tt,{label:n.cliMissingDownloadLink}),n.cliMissingSuffix]}):null,m&&!l?(0,$.jsxs)(`div`,{className:`grid gap-3`,"aria-busy":`true`,children:[(0,$.jsx)(K,{className:`h-20 rounded-lg`}),(0,$.jsx)(K,{className:`h-20 rounded-lg`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(de,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.statusLabel}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:_?n.statusActive:n.statusOff}),b?(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(U,{text:b,labels:r})}):null,s?(0,$.jsx)(`p`,{className:`mt-2 text-sm text-red-600 dark:text-red-400`,children:s}):null,(0,$.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:_?(0,$.jsxs)(p,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>void C(),children:[a?(0,$.jsx)(d,{className:`mr-1 size-4 animate-spin`}):null,n.disableServe]}):(0,$.jsxs)(p,{type:`button`,disabled:a||!v,onClick:()=>void S(),children:[a?(0,$.jsx)(d,{className:`mr-1 size-4 animate-spin`}):(0,$.jsx)(ee,{className:`mr-1 size-4`}),n.enableServe]})})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.hint}),(0,$.jsx)(ge,{language:t,label:n.docsLink,section:`tailscale-serve`,className:`mt-2`})]})]});return e?w:(0,$.jsxs)(de,{children:[(0,$.jsx)(le,{icon:u,title:n.title,subtitle:n.subtitle}),w]})}function rt(e){let t=(0,Q.c)(26),{showLabel:n,hideLabel:r,icon:i,hint:a,children:o,className:s,defaultOpen:c,advancedOnly:l}=e,u=l===void 0?!1:l,[d,p]=(0,Z.useState)(c??!1),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=e=>p(e.currentTarget.open),t[0]=m):m=t[0];let h;t[1]===s?h=t[2]:(h=f(`group rounded-2xl bg-surface-base open:pb-1`,s),t[1]=s,t[2]=h);let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(J,{className:`size-4 shrink-0 text-fg-muted transition-transform group-open:rotate-180`,"aria-hidden":!0}),t[3]=g):g=t[3];let _;t[4]===i?_=t[5]:(_=i?(0,$.jsx)(i,{className:`size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}):null,t[4]=i,t[5]=_);let v;t[6]===n?v=t[7]:(v=(0,$.jsx)(`span`,{className:`group-open:hidden`,children:n}),t[6]=n,t[7]=v);let y;t[8]===r?y=t[9]:(y=(0,$.jsx)(`span`,{className:`hidden group-open:inline`,children:r}),t[8]=r,t[9]=y);let b;t[10]!==_||t[11]!==v||t[12]!==y?(b=(0,$.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 rounded-2xl px-4 py-3.5 text-sm font-medium text-fg transition-colors hover:text-fg group-open:rounded-b-none [&::-webkit-details-marker]:hidden`,children:[g,_,v,y]}),t[10]=_,t[11]=v,t[12]=y,t[13]=b):b=t[13];let x;t[14]===a?x=t[15]:(x=a?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:a}):null,t[14]=a,t[15]=x);let S;t[16]!==o||t[17]!==x?(S=(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 px-4 pb-4 pt-1`,children:[x,o]}),t[16]=o,t[17]=x,t[18]=S):S=t[18];let C;t[19]!==d||t[20]!==S||t[21]!==h||t[22]!==b?(C=(0,$.jsxs)(`details`,{open:d,onToggle:m,className:h,children:[b,S]}),t[19]=d,t[20]=S,t[21]=h,t[22]=b,t[23]=C):C=t[23];let w=C;if(u){let e;return t[24]===w?e=t[25]:(e=(0,$.jsx)(fe,{children:w}),t[24]=w,t[25]=e),e}return w}function it(e){let t=(0,Q.c)(40),{open:n,title:r,intro:i,bullets:a,checkboxLabel:o,confirmLabel:s,cancelLabel:c,onConfirm:l,onCancel:u}=e,[d,m]=(0,Z.useState)(!1),h;t[0]===u?h=t[1]:(h=e=>{e||(m(!1),u())},t[0]=u,t[1]=h);let g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(w,{className:f(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,C)}),t[2]=g):g=t[2];let _;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=f(`fixed left-1/2 top-1/2 max-h-[min(90vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-y-auto rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`,S),t[3]=_):_=t[3];let v;t[4]===r?v=t[5]:(v=(0,$.jsx)(O,{className:`text-base font-semibold text-fg`,children:r}),t[4]=r,t[5]=v);let y;t[6]===i?y=t[7]:(y=(0,$.jsx)(T,{className:`mt-2 text-sm text-fg-muted`,children:i}),t[6]=i,t[7]=y);let b;t[8]===a?b=t[9]:(b=a.map(at),t[8]=a,t[9]=b);let x;t[10]===b?x=t[11]:(x=(0,$.jsx)(`ul`,{className:`mt-4 list-disc space-y-2 pl-5 text-sm text-fg-muted`,children:b}),t[10]=b,t[11]=x);let A;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>m(e.target.checked),t[12]=A):A=t[12];let j;t[13]===d?j=t[14]:(j=(0,$.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 shrink-0 rounded border-edge accent-accent`,checked:d,onChange:A}),t[13]=d,t[14]=j);let M;t[15]===o?M=t[16]:(M=(0,$.jsx)(`span`,{children:o}),t[15]=o,t[16]=M);let N;t[17]!==M||t[18]!==j?(N=(0,$.jsxs)(`label`,{className:`mt-5 flex cursor-pointer items-start gap-3 text-sm text-fg`,children:[j,M]}),t[17]=M,t[18]=j,t[19]=N):N=t[19];let P;t[20]!==c||t[21]!==u?(P=(0,$.jsx)(p,{type:`button`,variant:`secondary`,onClick:u,children:c}),t[20]=c,t[21]=u,t[22]=P):P=t[22];let F=!d,I;t[23]!==s||t[24]!==l||t[25]!==F?(I=(0,$.jsx)(p,{type:`button`,disabled:F,onClick:l,children:s}),t[23]=s,t[24]=l,t[25]=F,t[26]=I):I=t[26];let L;t[27]!==P||t[28]!==I?(L=(0,$.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[P,I]}),t[27]=P,t[28]=I,t[29]=L):L=t[29];let R;t[30]!==N||t[31]!==L||t[32]!==v||t[33]!==y||t[34]!==x?(R=(0,$.jsxs)(E,{children:[g,(0,$.jsxs)(D,{className:_,onOpenAutoFocus:ot,children:[v,y,x,N,L]})]}),t[30]=N,t[31]=L,t[32]=v,t[33]=y,t[34]=x,t[35]=R):R=t[35];let z;return t[36]!==n||t[37]!==h||t[38]!==R?(z=(0,$.jsx)(k,{open:n,onOpenChange:h,children:R}),t[36]=n,t[37]=h,t[38]=R,t[39]=z):z=t[39],z}function at(e){return(0,$.jsx)(`li`,{children:e},e)}function ot(e){return e.preventDefault()}function st(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var ct=[`preparing_frpc`,`registering`,`starting_frpc`];function lt(e){return e?e===`reconnecting_frpc`?ct.indexOf(`starting_frpc`):ct.indexOf(e):-1}function ut(e,t){if(t.state===`connected`)return`done`;let n=t.startProgress?.phase,r=ct.indexOf(e),i=lt(n);return i<0?t.state===`connecting`||t.state===`reconnecting`?`active`:`pending`:r<i?`done`:r===i?`active`:`pending`}function dt(e,t,n){let r=n.startProgress;return ut(t,n)===`active`?t===`preparing_frpc`&&n.frpcDownload?n.frpcDownload.phase===`extracting`?e.frpcExtracting:n.frpcDownload.percent==null?e.frpcDownloading:e.frpcDownloadingPercent.replace(`{{percent}}`,String(n.frpcDownload.percent)):t===`registering`&&r?.publicUrl?e.stepRegisterDetail:t===`starting_frpc`?r?.phase===`reconnecting_frpc`?e.stepReconnectDetail:e.stepFrpcDetail:null:null}function ft(e,t){switch(t){case`preparing_frpc`:return e.stepPrepareFrpc;case`registering`:return e.stepRegister;case`starting_frpc`:return e.stepFrpcLogin}}function pt(e){if(!e)return null;let t=Math.max(0,Math.floor((Date.now()-new Date(e).getTime())/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function mt(e){let t=(0,Q.c)(31),{status:n,t:r}=e,[,i]=(0,Z.useState)(0),a;t[0]!==i||t[1]!==n.state?(a=()=>{if(n.state!==`connecting`&&n.state!==`reconnecting`)return;let e=window.setInterval(()=>i(ht),1e3);return()=>window.clearInterval(e)},t[0]=i,t[1]=n.state,t[2]=a):a=t[2];let o=n.startProgress?.startedAt,c;if(t[3]!==n.state||t[4]!==o?(c=[n.state,o],t[3]=n.state,t[4]=o,t[5]=c):c=t[5],(0,Z.useEffect)(a,c),!(n.state===`connecting`||n.state===`reconnecting`||n.state===`connected`&&n.startProgress))return null;let l,u,p,m,h;if(t[6]!==n||t[7]!==r){let e=pt(n.startProgress?.startedAt);l=!!n.publicUrl&&n.state!==`connected`&&n.startProgress?.phase!==`registering`,u=`mt-3 space-y-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface`;let i;t[13]===r.startProgressTitle?i=t[14]:(i=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:r.startProgressTitle}),t[13]=r.startProgressTitle,t[14]=i);let a;t[15]===r.startProgressHint?a=t[16]:(a=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.startProgressHint}),t[15]=r.startProgressHint,t[16]=a),t[17]!==i||t[18]!==a?(p=(0,$.jsxs)(`div`,{children:[i,a]}),t[17]=i,t[18]=a,t[19]=p):p=t[19];let o=ct.map(e=>{let t=ut(e,n),i=dt(r,e,n);return(0,$.jsxs)(`li`,{className:`flex gap-2 text-xs`,children:[(0,$.jsx)(`span`,{className:`mt-0.5 shrink-0 text-fg-subtle`,"aria-hidden":!0,children:t===`done`?(0,$.jsx)(s,{className:`size-3.5 text-emerald-600 dark:text-emerald-400`}):t===`active`?(0,$.jsx)(d,{className:`size-3.5 animate-spin text-accent`}):(0,$.jsx)(B,{className:`size-3.5`})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:f(`font-medium`,t===`active`?`text-fg`:t===`done`?`text-fg-muted`:`text-fg-subtle`),children:ft(r,e)}),i?(0,$.jsx)(`div`,{className:`mt-0.5 text-fg-muted`,children:i}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload&&n.frpcDownload.phase===`downloading`?(0,$.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[(0,$.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-surface-panel`,children:(0,$.jsx)(`div`,{className:f(`h-full rounded-full bg-accent transition-[width] duration-300`,n.frpcDownload.percent==null&&`w-1/3 animate-pulse`),style:n.frpcDownload.percent==null?void 0:{width:`${n.frpcDownload.percent}%`}})}),n.frpcDownload.bytesReceived!=null&&n.frpcDownload.totalBytes?(0,$.jsxs)(`p`,{className:`text-fg-subtle`,children:[st(n.frpcDownload.bytesReceived),` /`,` `,st(n.frpcDownload.totalBytes)]}):null]}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload?.url?(0,$.jsxs)(`p`,{className:`mt-2 text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`font-sans`,children:[r.frpcDownloadingUrlLabel,`: `]}),(0,$.jsx)(`a`,{href:n.frpcDownload.url,target:`_blank`,rel:`noopener noreferrer`,className:`break-all font-mono text-[11px] text-accent hover:underline`,children:n.frpcDownload.url})]}):null]})]},e)});t[20]===o?m=t[21]:(m=(0,$.jsx)(`ol`,{className:`space-y-2`,children:o}),t[20]=o,t[21]=m),h=e&&n.startProgress?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.startProgressElapsed.replace(`{{elapsed}}`,e)}):null,t[6]=n,t[7]=r,t[8]=l,t[9]=u,t[10]=p,t[11]=m,t[12]=h}else l=t[8],u=t[9],p=t[10],m=t[11],h=t[12];let g;t[22]!==l||t[23]!==r.publicUrlPendingNotice?(g=l?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.publicUrlPendingNotice}):null,t[22]=l,t[23]=r.publicUrlPendingNotice,t[24]=g):g=t[24];let _;return t[25]!==u||t[26]!==p||t[27]!==m||t[28]!==h||t[29]!==g?(_=(0,$.jsxs)(`div`,{className:u,children:[p,m,h,g]}),t[25]=u,t[26]=p,t[27]=m,t[28]=h,t[29]=g,t[30]=_):_=t[30],_}function ht(e){return e+1}function gt(e,t){return t.state===`connected`?e.statusConnected:t.state===`error`?e.statusError:t.startProgress?.phase===`reconnecting_frpc`?e.statusReconnecting:t.startProgress?.phase===`starting_frpc`?e.statusStartingFrpc:t.startProgress?.phase===`registering`?e.statusRegistering:t.startProgress?.phase===`preparing_frpc`||t.frpcDownload?e.statusPreparingFrpc:t.state===`connecting`||t.state===`reconnecting`?e.statusConnecting:e.statusOff}function _t(e){return e.state===`connected`?`connected`:e.state===`error`?`error`:e.state===`connecting`||e.state===`reconnecting`||e.startProgress||e.frpcDownload?`progress`:`off`}function vt(e){switch(e){case`connected`:return`bg-emerald-500/15 text-emerald-700 dark:text-emerald-400`;case`progress`:return`bg-amber-500/15 text-amber-700 dark:text-amber-400`;case`error`:return`bg-red-500/15 text-red-700 dark:text-red-400`;default:return`bg-surface-hover text-fg-muted`}}function yt(e){if(!e)return`—`;let t=Date.now()-new Date(e).getTime();if(t<0)return`—`;let n=Math.floor(t/6e4);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function bt(e){let t=(0,Q.c)(61),{t:n,status:r,isLoading:i,statusErr:a,starting:o,stopping:s,showConsentExpired:c,copyLabels:l,startDisabled:m,startDisabledReason:h,stepLabel:g,onStart:_,onStop:v}=e,y=m===void 0?!1:m,b,x,S,C,w,T,E;t[0]!==r||t[1]!==o?(E=_t(r),b=r.enabled||o,x=o||r.state===`connecting`||r.state===`reconnecting`||!!r.startProgress||!!r.frpcDownload,t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=f(ue(),`space-y-4`),t[9]=T):T=t[9],w=`flex flex-wrap items-start justify-between gap-3`,C=`flex items-center gap-2`,S=f(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium`,vt(E)),t[0]=r,t[1]=o,t[2]=b,t[3]=x,t[4]=S,t[5]=C,t[6]=w,t[7]=T,t[8]=E):(b=t[2],x=t[3],S=t[4],C=t[5],w=t[6],T=t[7],E=t[8]);let D=E===`connected`&&`bg-emerald-500`,O=E===`progress`&&`bg-amber-500 animate-pulse`,k=E===`error`&&`bg-red-500`,A=E===`off`&&`bg-fg-subtle`,j;t[10]!==D||t[11]!==O||t[12]!==k||t[13]!==A?(j=f(`size-1.5 rounded-full`,D,O,k,A),t[10]=D,t[11]=O,t[12]=k,t[13]=A,t[14]=j):j=t[14];let M;t[15]===j?M=t[16]:(M=(0,$.jsx)(`span`,{className:j,"aria-hidden":!0}),t[15]=j,t[16]=M);let N;t[17]!==i||t[18]!==r||t[19]!==n?(N=i&&!r.enabled?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block h-3 w-16 animate-pulse rounded-full bg-surface-hover/70 motion-reduce:animate-none`}):gt(n,r),t[17]=i,t[18]=r,t[19]=n,t[20]=N):N=t[20];let P;t[21]!==M||t[22]!==N||t[23]!==S?(P=(0,$.jsxs)(`span`,{className:S,children:[M,N]}),t[21]=M,t[22]=N,t[23]=S,t[24]=P):P=t[24];let F;t[25]!==r.connectedSince||t[26]!==r.state||t[27]!==n.uptime?(F=r.connectedSince&&r.state===`connected`?(0,$.jsxs)(`span`,{className:`text-xs text-fg-subtle`,children:[n.uptime,` `,yt(r.connectedSince)]}):null,t[25]=r.connectedSince,t[26]=r.state,t[27]=n.uptime,t[28]=F):F=t[28];let L;t[29]!==P||t[30]!==F||t[31]!==C?(L=(0,$.jsxs)(`div`,{className:C,children:[P,F]}),t[29]=P,t[30]=F,t[31]=C,t[32]=L):L=t[32];let R;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(u,{className:`size-4 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[33]=R):R=t[33];let z;t[34]!==L||t[35]!==w?(z=(0,$.jsxs)(`div`,{className:w,children:[L,R]}),t[34]=L,t[35]=w,t[36]=z):z=t[36];let B;t[37]===a?B=t[38]:(B=a?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:a instanceof Error?a.message:String(a)}):null,t[37]=a,t[38]=B);let V;t[39]!==c||t[40]!==n.consentExpiredBanner?(V=c?(0,$.jsx)(`p`,{className:`rounded-lg border border-amber-500/25 bg-amber-500/5 px-3 py-2 text-xs text-fg-muted`,children:n.consentExpiredBanner}):null,t[39]=c,t[40]=n.consentExpiredBanner,t[41]=V):V=t[41];let H;t[42]!==b||t[43]!==l||t[44]!==_||t[45]!==v||t[46]!==x||t[47]!==r||t[48]!==y||t[49]!==h||t[50]!==o||t[51]!==g||t[52]!==s||t[53]!==n?(H=b?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[r.publicUrl?(0,$.jsx)(`div`,{className:`rounded-xl bg-surface-panel/80 p-3 shadow-surface`,children:(0,$.jsx)(U,{label:n.publicUrlLabel,text:r.publicUrl,labels:l})}):null,x?(0,$.jsx)(mt,{status:r,t:n}):null,r.lastError&&r.state===`error`?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:r.lastError}):null,(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.enabled?(0,$.jsxs)(p,{type:`button`,variant:`secondary`,disabled:s,onClick:v,children:[s?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,n.stop]}):(0,$.jsxs)(p,{type:`button`,disabled:o,onClick:_,children:[o?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(ee,{className:`size-4`}),n.start]})})]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[g?(0,$.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:g}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.emptyStateTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:n.emptyStateBody})]}),(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-amber-500/25 bg-amber-500/5 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,$.jsx)(I,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-400`}),(0,$.jsx)(`p`,{children:n.riskBannerBody})]}),y&&h?(0,$.jsx)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200`,children:h}):null,(0,$.jsxs)(p,{type:`button`,disabled:o||y,onClick:_,className:`w-full sm:w-auto`,children:[o?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(ee,{className:`size-4`}),n.start]})]}),t[42]=b,t[43]=l,t[44]=_,t[45]=v,t[46]=x,t[47]=r,t[48]=y,t[49]=h,t[50]=o,t[51]=g,t[52]=s,t[53]=n,t[54]=H):H=t[54];let W;return t[55]!==z||t[56]!==B||t[57]!==V||t[58]!==H||t[59]!==T?(W=(0,$.jsxs)(`section`,{className:T,children:[z,B,V,H]}),t[55]=z,t[56]=B,t[57]=V,t[58]=H,t[59]=T,t[60]=W):W=t[60],W}var xt=`https://console.xopc.ai/access/client`,St={reconfiguring:!1};function Ct(e){let t=(0,Q.c)(89),{t:n,brokerSecretReady:r,brokerSecretConfiguredInConfig:i,brokerSecretMaskedValue:a,brokerSecretDraft:o,savingBrokerSecret:c,authorizingBrokerSecret:u,brokerSecretAuthorizationUrl:m,brokerSecretNotice:h,copyFailedLabel:g,onDraftChange:_,onSave:v,onAuthorize:y,onClear:b,sectionRef:x}=e,S=(0,Z.useId)(),C=r,w=!C,[T,E]=(0,Z.useReducer)(ne,St),{reconfiguring:D}=T,O;t[0]!==i||t[1]!==o||t[2]!==D?(O=i&&!D&&!o.trim(),t[0]=i,t[1]=o,t[2]=D,t[3]=O):O=t[3];let k=O,A;t[4]!==n.copied||t[5]!==n.copyKey||t[6]!==n.hideKey||t[7]!==n.showKey?(A={show:n.showKey,hide:n.hideKey,copy:n.copyKey,copied:n.copied},t[4]=n.copied,t[5]=n.copyKey,t[6]=n.hideKey,t[7]=n.showKey,t[8]=A):A=t[8];let j=A,M;t[9]===o?M=t[10]:(M=o.trim().length>0&&!te(o.trim()),t[9]=o,t[10]=M);let N=M,P;t[11]===_?P=t[12]:(P=()=>{E({type:`patch`,patch:{reconfiguring:!1}}),_(``)},t[11]=_,t[12]=P);let F=P,I=w&&`ring-1 ring-amber-500/30`,L;t[13]===I?L=t[14]:(L=f(I),t[13]=I,t[14]=L);let R=C?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:w?`bg-amber-500/10 text-amber-700 dark:text-amber-400`:`bg-surface-hover text-fg-muted`,B;t[15]===R?B=t[16]:(B=f(`flex size-9 shrink-0 items-center justify-center rounded-lg`,R),t[15]=R,t[16]=B);let V;t[17]===C?V=t[18]:(V=C?(0,$.jsx)(s,{className:`size-4`,strokeWidth:2,"aria-hidden":!0}):(0,$.jsx)(re,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[17]=C,t[18]=V);let H;t[19]!==B||t[20]!==V?(H=(0,$.jsx)(`span`,{className:B,children:V}),t[19]=B,t[20]=V,t[21]=H):H=t[21];let ee=C?n.brokerSecretReadyTitle:n.brokerSecretStepTitle,U;t[22]===ee?U=t[23]:(U=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:ee}),t[22]=ee,t[23]=U);let W=C?n.brokerSecretReadyHint:n.brokerSecretHint,G;t[24]===W?G=t[25]:(G=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:W}),t[24]=W,t[25]=G);let K;t[26]!==w||t[27]!==n.brokerSecretMissingHint?(K=w?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-amber-800 dark:text-amber-200`,children:n.brokerSecretMissingHint}):null,t[26]=w,t[27]=n.brokerSecretMissingHint,t[28]=K):K=t[28];let q;t[29]!==U||t[30]!==G||t[31]!==K?(q=(0,$.jsxs)(`div`,{children:[U,G,K]}),t[29]=U,t[30]=G,t[31]=K,t[32]=q):q=t[32];let J;t[33]!==u||t[34]!==w||t[35]!==y||t[36]!==D||t[37]!==c||t[38]!==n.brokerSecretAuthorize||t[39]!==n.brokerSecretAuthorizing||t[40]!==n.brokerSecretConsoleLink?(J=w||D?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(p,{type:`button`,disabled:c||u,onClick:y,children:[u?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,u?n.brokerSecretAuthorizing:n.brokerSecretAuthorize]}),(0,$.jsxs)(`a`,{href:xt,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[n.brokerSecretConsoleLink,(0,$.jsx)(l,{className:`size-3`,"aria-hidden":!0})]})]}):null,t[33]=u,t[34]=w,t[35]=y,t[36]=D,t[37]=c,t[38]=n.brokerSecretAuthorize,t[39]=n.brokerSecretAuthorizing,t[40]=n.brokerSecretConsoleLink,t[41]=J):J=t[41];let ie;t[42]!==u||t[43]!==m||t[44]!==n.brokerSecretOpenAuthorization?(ie=u&&m?(0,$.jsxs)(`a`,{href:m,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,children:[n.brokerSecretOpenAuthorization,(0,$.jsx)(l,{className:`size-3`,"aria-hidden":!0})]}):null,t[42]=u,t[43]=m,t[44]=n.brokerSecretOpenAuthorization,t[45]=ie):ie=t[45];let ae;t[46]!==i||t[47]!==o||t[48]!==a||t[49]!==N||t[50]!==F||t[51]!==g||t[52]!==S||t[53]!==w||t[54]!==b||t[55]!==_||t[56]!==v||t[57]!==D||t[58]!==c||t[59]!==j||t[60]!==k||t[61]!==n.brokerSecretCancelReconfigure||t[62]!==n.brokerSecretClear||t[63]!==n.brokerSecretMaskedHelp||t[64]!==n.brokerSecretNotInConfigFile||t[65]!==n.brokerSecretPlaceholder||t[66]!==n.brokerSecretReconfigure||t[67]!==n.brokerSecretRevealFailed||t[68]!==n.brokerSecretSave||t[69]!==n.brokerSecretSaveAndContinue||t[70]!==n.brokerSecretTitle?(ae=k?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:S,children:n.brokerSecretTitle}),(0,$.jsx)(z,{id:S,value:a,labels:j,reveal:wt,loadFailedLabel:g||n.brokerSecretRevealFailed,maskedHelp:n.brokerSecretMaskedHelp,notInConfigFile:n.brokerSecretNotInConfigFile,readOnly:!0}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(p,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>{E({type:`patch`,patch:{reconfiguring:!0}})},children:n.brokerSecretReconfigure}),(0,$.jsx)(p,{type:`button`,variant:`ghost`,disabled:c,onClick:b,children:n.brokerSecretClear})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:S,children:n.brokerSecretTitle}),(0,$.jsx)(z,{id:S,value:o,onChange:_,placeholder:n.brokerSecretPlaceholder,labels:j,disabled:c}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(p,{type:`button`,disabled:c||!N,onClick:v,children:[c?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,w?n.brokerSecretSaveAndContinue:n.brokerSecretSave]}),i?(0,$.jsx)(p,{type:`button`,variant:`ghost`,disabled:c,onClick:b,children:n.brokerSecretClear}):null,D?(0,$.jsx)(p,{type:`button`,variant:`ghost`,disabled:c,onClick:F,children:n.brokerSecretCancelReconfigure}):null]})]}),t[46]=i,t[47]=o,t[48]=a,t[49]=N,t[50]=F,t[51]=g,t[52]=S,t[53]=w,t[54]=b,t[55]=_,t[56]=v,t[57]=D,t[58]=c,t[59]=j,t[60]=k,t[61]=n.brokerSecretCancelReconfigure,t[62]=n.brokerSecretClear,t[63]=n.brokerSecretMaskedHelp,t[64]=n.brokerSecretNotInConfigFile,t[65]=n.brokerSecretPlaceholder,t[66]=n.brokerSecretReconfigure,t[67]=n.brokerSecretRevealFailed,t[68]=n.brokerSecretSave,t[69]=n.brokerSecretSaveAndContinue,t[70]=n.brokerSecretTitle,t[71]=ae):ae=t[71];let oe;t[72]===h?oe=t[73]:(oe=h?(0,$.jsx)(`p`,{className:`text-xs text-emerald-700 dark:text-emerald-400`,children:h}):null,t[72]=h,t[73]=oe);let Y;t[74]!==q||t[75]!==J||t[76]!==ie||t[77]!==ae||t[78]!==oe?(Y=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[q,J,ie,ae,oe]}),t[74]=q,t[75]=J,t[76]=ie,t[77]=ae,t[78]=oe,t[79]=Y):Y=t[79];let X;t[80]!==H||t[81]!==Y?(X=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[H,Y]}),t[80]=H,t[81]=Y,t[82]=X):X=t[82];let se;t[83]!==X||t[84]!==L?(se=(0,$.jsx)(de,{className:L,children:X}),t[83]=X,t[84]=L,t[85]=se):se=t[85];let ce;return t[86]!==x||t[87]!==se?(ce=(0,$.jsx)(`div`,{ref:x,id:`tunnel-broker-secret-setup`,children:se}),t[86]=x,t[87]=se,t[88]=ce):ce=t[88],ce}function wt(){return Te().then(Tt)}function Tt(e){return e.registrationSecret??null}var Et={actionError:null,starting:!1,stopping:!1,savingAutoStart:!1,consentOpen:!1,autoStartConfirmOpen:!1,releaseConfirmOpen:!1,releasing:!1,brokerSecretDraft:``,savingBrokerSecret:!1,authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null};function Dt({embedded:e=!1}){let t=y(e=>e.language),n=g(t).tunnelSettings,r=!!x(e=>e.token),[i,a]=(0,Z.useReducer)(ne,Et),{actionError:o,starting:s,stopping:c,savingAutoStart:l,consentOpen:m,autoStartConfirmOpen:h,releaseConfirmOpen:_,releasing:v,brokerSecretDraft:b,savingBrokerSecret:S,authorizingBrokerSecret:C,brokerSecretAuthorizationUrl:w,brokerSecretNotice:T}=i,E=(0,Z.useRef)(null),{data:D}=M(r),{data:O,error:k,isLoading:I,mutate:R}=A(r?`tunnel-status`:null,be,{refreshInterval:e=>s?1e3:e?.frpcDownload||e?.state===`connecting`||e?.state===`reconnecting`?2e3:6e4}),z=(0,Z.useMemo)(()=>{let e=D?.payload?.config;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.tunnel;if(t&&typeof t==`object`&&!Array.isArray(t)&&t.autoStart===!0)return!0}return O?.config?.autoStart===!0},[D,O?.config?.autoStart]),B=(0,Z.useMemo)(()=>{let e=D?.payload?.config;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.tunnel;if(t&&typeof t==`object`&&!Array.isArray(t)){let e=t.registrationSecret;if(typeof e==`string`)return e}}return``},[D]),V=te(B),H=O?.registrationSecret?.configured??V;(0,Z.useEffect)(()=>{let e=()=>{R()};return window.addEventListener(`tunnel-status`,e),()=>window.removeEventListener(`tunnel-status`,e)},[R]);let ee=(0,Z.useMemo)(()=>[n.consentBullet1,n.consentBullet2,n.consentBullet3],[n.consentBullet1,n.consentBullet2,n.consentBullet3]),U=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{starting:!0}});try{await Ce(),await R(),j()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{starting:!1}})}},[R]),W=(0,Z.useCallback)(()=>{if(!H){a({type:`patch`,patch:{actionError:n.brokerSecretRequiredBeforeStart}}),E.current?.scrollIntoView({behavior:`smooth`,block:`start`});return}if(O?.consentRequired){a({type:`patch`,patch:{consentOpen:!0}});return}U()},[H,O?.consentRequired,U,n.brokerSecretRequiredBeforeStart]),G=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{consentOpen:!1}}),a({type:`patch`,patch:{actionError:null}});try{await xe(),await Promise.all([R(),U()])}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}},[R,U]),K=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{stopping:!0}});try{await we(),await R(),j()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{stopping:!1}})}},[R]),q=(0,Z.useCallback)(async e=>{a({type:`patch`,patch:{savingAutoStart:!0}}),a({type:`patch`,patch:{actionError:null}});try{await Ee({autoStart:e}),j()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingAutoStart:!1}})}},[]),J=(0,Z.useCallback)(()=>{if(z){q(!1);return}if(O?.consentRequired){a({type:`patch`,patch:{actionError:n.consentExpiredBanner}});return}if(!O?.canAutoStart){a({type:`patch`,patch:{actionError:n.autoStartHint}});return}a({type:`patch`,patch:{autoStartConfirmOpen:!0}})},[q,O?.canAutoStart,O?.consentRequired,n,z]),re=(0,Z.useCallback)(async()=>{let e=b.trim();if(e){a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await Ee({registrationSecret:e}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretSaved}}),j(),await R(),a({type:`patch`,patch:{actionError:null}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingBrokerSecret:!1}})}}},[b,R,n.brokerSecretSaved]),ie=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await Ee({registrationSecret:null}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretCleared}}),j(),await R()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingBrokerSecret:!1}})}},[R,n.brokerSecretCleared]),ae=(0,Z.useCallback)(async()=>{let e=me(),t=null,r=null;a({type:`patch`,patch:{authorizingBrokerSecret:!0,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null,actionError:null}});try{for(t=(await N(`xopc-tunnel`)).sessionId;;){await new Promise(e=>window.setTimeout(e,1e3));let i=await F(t);if(i.authUrl&&i.authUrl!==r&&(r=i.authUrl,a({type:`patch`,patch:{brokerSecretAuthorizationUrl:i.authUrl}}),await pe(i.authUrl,e)),i.status===`failed`||i.status===`cancelled`)throw Error(i.error??i.message??`OAuth authorization failed`);if(i.status===`completed`){await Se(),await Promise.all([R(),j()]),a({type:`patch`,patch:{brokerSecretNotice:n.brokerSecretSaved,brokerSecretDraft:``}});return}}}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{he(e),t&&P(t).catch(()=>void 0),a({type:`patch`,patch:{authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null}})}},[R,n.brokerSecretSaved]),oe=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{releaseConfirmOpen:!1,actionError:null,releasing:!0}});try{await we({release:!0}),await R(),j()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{releasing:!1}})}},[R]),Y=(0,Z.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:g(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]);if(!r)return(0,$.jsx)(`div`,{className:e?void 0:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})});let X=O??{enabled:!1,state:`disconnected`,subdomain:null,publicUrl:null,connectedSince:null,frpcPid:null,lastHeartbeatAt:null,lastError:null,consentRequired:!0,config:{autoStart:z,brokerUrl:`https://frp.xopc.ai/api`}},se=O?.consentRequired&&(X.enabled||z||O?.consent?.acceptedAt),ce=(0,$.jsx)(Ct,{t:n,brokerSecretReady:H,brokerSecretConfiguredInConfig:V,brokerSecretMaskedValue:V?B:``,brokerSecretDraft:b,savingBrokerSecret:S,authorizingBrokerSecret:C,brokerSecretAuthorizationUrl:w,brokerSecretNotice:T,copyFailedLabel:g(t).clipboard.copyFailed,onDraftChange:e=>a({type:`patch`,patch:{brokerSecretDraft:e}}),onSave:()=>void re(),onAuthorize:()=>void ae(),onClear:()=>void ie(),sectionRef:E}),le=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(it,{open:m,title:n.consentTitle,intro:n.consentIntro,bullets:ee,checkboxLabel:n.consentCheckbox,confirmLabel:se?n.consentReconfirm:n.consentConfirm,cancelLabel:n.consentCancel,onConfirm:()=>void G(),onCancel:()=>a({type:`patch`,patch:{consentOpen:!1}})},m?`consent-open`:`consent-closed`),(0,$.jsx)(L,{open:h,title:n.autoStartConfirmTitle,description:n.autoStartConfirmBody,confirmLabel:n.autoStartConfirmLabel,cancelLabel:n.consentCancel,onConfirm:()=>{a({type:`patch`,patch:{autoStartConfirmOpen:!1}}),q(!0)},onCancel:()=>a({type:`patch`,patch:{autoStartConfirmOpen:!1}})}),(0,$.jsx)(L,{open:_,title:n.releaseConfirmTitle,description:n.releaseConfirmBody,confirmLabel:n.releaseConfirmLabel,cancelLabel:n.consentCancel,destructive:!0,onConfirm:()=>void oe(),onCancel:()=>a({type:`patch`,patch:{releaseConfirmOpen:!1}})})]});return e?(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o}):null,ce,(0,$.jsx)(bt,{t:n,status:X,isLoading:I,statusErr:k,starting:s,stopping:c,showConsentExpired:!!se,copyLabels:Y,startDisabled:!H,startDisabledReason:H?void 0:n.brokerSecretRequiredBeforeStart,stepLabel:n.flowStepStart,onStart:W,onStop:()=>void K()}),(0,$.jsxs)(rt,{showLabel:n.showOptions,hideLabel:n.hideOptions,children:[(0,$.jsxs)(`label`,{className:f(`flex items-center gap-3 text-sm text-fg`,!z&&!O?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:z,disabled:l||!z&&!O?.canAutoStart,onChange:J}),n.autoStart]}),!O?.canAutoStart&&!z?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.autoStartHint}):null,X.subdomain||X.publicUrl?(0,$.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle pt-4`,children:[(0,$.jsxs)(p,{type:`button`,variant:`secondary`,disabled:v||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[v?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,n.release]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint})]}):null]}),(0,$.jsx)(rt,{showLabel:n.showAdvanced,hideLabel:n.hideAdvanced,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-edge-subtle pt-4 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(ge,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]})}),le]}):(0,$.jsxs)(`div`,{className:e?`flex w-full flex-col gap-6`:`flex w-full flex-col gap-6 px-3 py-8 sm:px-5 xl:px-6`,children:[e?null:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:n.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.subtitle})]}),o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o}):null,ce,(0,$.jsx)(bt,{t:n,status:X,isLoading:I,statusErr:k,starting:s,stopping:c,showConsentExpired:!!se,copyLabels:Y,startDisabled:!H,startDisabledReason:H?void 0:n.brokerSecretRequiredBeforeStart,onStart:W,onStop:()=>void K()}),X.subdomain||X.publicUrl?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,$.jsxs)(p,{type:`button`,variant:`secondary`,disabled:v||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[v?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,n.release]})}):null,X.subdomain||X.publicUrl?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint}):null,(0,$.jsxs)(de,{children:[(0,$.jsx)(`h2`,{className:`mb-3 text-sm font-semibold text-fg`,children:n.optionsTitle}),(0,$.jsxs)(`label`,{className:f(`flex items-center gap-3 text-sm text-fg`,!z&&!O?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:z,disabled:l||!z&&!O?.canAutoStart,onChange:J}),n.autoStart]}),!O?.canAutoStart&&!z?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n.autoStartHint}):null]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 text-xs text-fg-subtle shadow-surface`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(ge,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]}),le]})}function Ot(e,t){return e.tabs[t]}function kt(e,t){return e.tabIntro[t]}function At(e){switch(e){case`tailscale`:return`tailscale-serve`;case`public`:return`public-tunnel`;case`reverse-proxy`:return`reverse-proxy`;case`ssh`:return`ssh-tunnel`;case`lan`:return`lan`;default:return}}function jt(e){let t=(0,Q.c)(7),{tab:n,onOpenTab:r}=e;switch(n){case`guide`:{let e;return t[0]===r?e=t[1]:(e=(0,$.jsx)(Ne,{onOpenTab:r}),t[0]=r,t[1]=e),e}case`tailscale`:{let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(nt,{embedded:!0}),t[2]=e):e=t[2],e}case`public`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Dt,{embedded:!0}),t[3]=e):e=t[3],e}case`reverse-proxy`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Xe,{}),t[4]=e):e=t[4],e}case`ssh`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ve,{}),t[5]=e):e=t[5],e}case`lan`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Le,{}),t[6]=e):e=t[6],e}}}function Mt(){let e=(0,Q.c)(3),t=i(),n=y(Pt),r=g(n).remoteAccess,o=!!x(Nt),[s,c]=a(),l=Ue(s.get(`tab`)),u=s.get(`intent`)===`mobile-pairing`,d;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(d={refreshInterval:2e3},e[0]=d):d=e[0];let f=A(u?`mobile-pairing-readiness`:null,se,d),m;e[1]===c?m=e[2]:(m=e=>{c(t=>{let n=new URLSearchParams(t);return e===`guide`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[1]=c,e[2]=m);let h=m,_=kt(r,l),v=He.map(e=>({id:e,label:Ot(r,e)}));return(0,$.jsxs)(Y,{children:[(0,$.jsx)(oe,{title:r.pageTitle,subtitle:r.pageSubtitle,meta:(0,$.jsx)(ge,{language:n,label:r.docsLink,section:At(l),className:`mt-1`})}),o?(0,$.jsxs)($.Fragment,{children:[u?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl border border-accent/25 bg-accent-soft px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(q,{className:`mt-0.5 size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.mobilePairingFlow.title}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:f.data?.ready?r.mobilePairingFlow.ready:r.mobilePairingFlow.hint})]})]}),(0,$.jsxs)(p,{variant:`primary`,disabled:!f.data?.ready,onClick:()=>t(`/settings/devices?startMobilePairing=1`),children:[f.data?.ready?r.mobilePairingFlow.continue:r.mobilePairingFlow.waiting,(0,$.jsx)(ae,{className:`size-4`,"aria-hidden":!0})]})]}):null,(0,$.jsx)(ce,{items:v,activeTab:l,onChange:h,ariaLabel:r.tabsAria,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`}),(0,$.jsx)(X,{id:l,activeTab:l,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`,title:Ot(r,l),hint:l===`public`?void 0:_,children:(0,$.jsx)(jt,{tab:l,onOpenTab:h})})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.guide.needToken})]})}function Nt(e){return e.token}function Pt(e){return e.language}export{Mt as RemoteAccessHub};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r,r as i}from"./popover-select-3E24E65N.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./download-Dk-ZjtO6.js";import{t as s}from"./button-CSEbl4zT.js";import{t as c}from"./messages-CoovNoMn.js";import{a as l,i as u,n as d,r as f}from"./locale-store-8k4mvYGL.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{$c as m,hs as h,ms as g}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r,r as i}from"./popover-select-3E24E65N.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./download-Dk-ZjtO6.js";import{t as s}from"./button-CSEbl4zT.js";import{t as c}from"./messages-CoovNoMn.js";import{a as l,i as u,n as d,r as f}from"./locale-store-8k4mvYGL.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{$c as m,hs as h,ms as g}from"./index-DFfvY8IN.js";import{n as _,r as v}from"./settings-page-layout-BRQNel6r.js";import{n as y}from"./settings-loading-skeleton-CwGM9zKH.js";var b=e(t(),1);async function x(e){await l(f(`/api/runtime-tools/config`),{method:`PATCH`,body:JSON.stringify(e)})}async function S(){return(await l(f(`/api/runtime-tools/prune`),{method:`POST`})).payload}async function C(e){let t=await u(f(`/api/runtime-tools/${e.runtime}/${e.action}/stream`),{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify({version:e.version})});if(!t.ok||!t.body)throw Error(`HTTP ${t.status}`);let n=t.body.getReader(),r=new TextDecoder,i=``,a=!1;try{for(;!a;){let{done:t,value:o}=await n.read();if(t)break;i+=r.decode(o,{stream:!0}).replace(/\r\n/g,`
|
|
2
2
|
`);let s=i.split(`
|
|
3
3
|
|
|
4
4
|
`);i=s.pop()??``;for(let t of s){let n=``,r=``;for(let e of t.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r,r as i}from"./popover-select-3E24E65N.js";import{t as a}from"./cn-JdwAhgNB.js";import{So as o,To as s}from"./index-CXGQihfj.js";var c=t();e();var l=n();function u(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function d(e){let t=e[`x-order`];return typeof t==`number`&&!Number.isNaN(t)?t:999}function f(e){let t=e[`x-group`];return typeof t==`string`&&t.length>0?t:``}function p(e){return e[`x-hidden`]===!0}function m(e){let t=e.properties;if(!u(t))return[];let n=[];for(let[e,r]of Object.entries(t))u(r)&&(p(r)||n.push({key:e,sub:r,order:d(r),group:f(r),hidden:!1}));return n.sort((e,t)=>e.order-t.order||e.key.localeCompare(t.key)),n}function h(e){let t=new Map;for(let n of e){let e=n.group;t.has(e)||t.set(e,[]),t.get(e).push(n)}return t}function g(e){let t=(0,c.c)(38),{name:n,s:i,value:a,onChange:u,disabled:d}=e,f=typeof i.description==`string`?i.description:void 0,p=(typeof i[`x-placeholder`]==`string`?i[`x-placeholder`]:null)||f,m=i.format;if(Array.isArray(i.enum)&&i.enum.every(v)){let e;t[0]===f?e=t[1]:(e=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[0]=f,t[1]=e);let o;t[2]===u?o=t[3]:(o=e=>u(e.target.value),t[2]=u,t[3]=o);let s;t[4]===i.enum?s=t[5]:(s=i.enum.map(_),t[4]=i.enum,t[5]=s);let c;t[6]!==d||t[7]!==n||t[8]!==o||t[9]!==s||t[10]!==a?(c=(0,l.jsx)(r,{name:n,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:a,disabled:d,onChange:o,children:s}),t[6]=d,t[7]=n,t[8]=o,t[9]=s,t[10]=a,t[11]=c):c=t[11];let p;return t[12]!==e||t[13]!==c?(p=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,c]}),t[12]=e,t[13]=c,t[14]=p):p=t[14],p}if(m===`password`){let e;t[15]===f?e=t[16]:(e=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[15]=f,t[16]=e);let n;t[17]!==d||t[18]!==u||t[19]!==p||t[20]!==a?(n=(0,l.jsx)(s,{value:a,onChange:u,placeholder:p,labels:o,disabled:d,inputClassName:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`}),t[17]=d,t[18]=u,t[19]=p,t[20]=a,t[21]=n):n=t[21];let r;return t[22]!==e||t[23]!==n?(r=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,n]}),t[22]=e,t[23]=n,t[24]=r):r=t[24],r}let h;t[25]===f?h=t[26]:(h=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[25]=f,t[26]=h);let g;t[27]===u?g=t[28]:(g=e=>u(e.target.value),t[27]=u,t[28]=g);let y;t[29]!==d||t[30]!==n||t[31]!==p||t[32]!==g||t[33]!==a?(y=(0,l.jsx)(`input`,{name:n,type:`text`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`,value:a,placeholder:p,disabled:d,onChange:g}),t[29]=d,t[30]=n,t[31]=p,t[32]=g,t[33]=a,t[34]=y):y=t[34];let b;return t[35]!==h||t[36]!==y?(b=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[h,y]}),t[35]=h,t[36]=y,t[37]=b):b=t[37],b}function _(e){return(0,l.jsx)(i,{value:e,children:e},e)}function v(e){return typeof e==`string`}function y(e){let t=(0,c.c)(11),{s:n,value:r,onChange:i,disabled:a}=e,o=typeof n.description==`string`?n.description:void 0,s;t[0]===o?s=t[1]:(s=o?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:o}):null,t[0]=o,t[1]=s);let u=Number.isFinite(r)?r:0,d;t[2]===i?d=t[3]:(d=e=>i(Number(e.target.value)),t[2]=i,t[3]=d);let f;t[4]!==a||t[5]!==u||t[6]!==d?(f=(0,l.jsx)(`input`,{type:`number`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg`,value:u,disabled:a,onChange:d}),t[4]=a,t[5]=u,t[6]=d,t[7]=f):f=t[7];let p;return t[8]!==s||t[9]!==f?(p=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s,f]}),t[8]=s,t[9]=f,t[10]=p):p=t[10],p}function b(e){let t=(0,c.c)(11),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=(typeof n.description==`string`?n.description:void 0)??(typeof n.title==`string`&&n.title.length>0?n.title:o?.defaultBooleanLabel??`Enable`),u;t[0]===i?u=t[1]:(u=e=>i(e.target.checked),t[0]=i,t[1]=u);let d;t[2]!==a||t[3]!==u||t[4]!==r?(d=(0,l.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border border-edge`,checked:r,disabled:a,onChange:u}),t[2]=a,t[3]=u,t[4]=r,t[5]=d):d=t[5];let f;t[6]===s?f=t[7]:(f=(0,l.jsx)(`span`,{children:s}),t[6]=s,t[7]=f);let p;return t[8]!==d||t[9]!==f?(p=(0,l.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[d,f]}),t[8]=d,t[9]=f,t[10]=p):p=t[10],p}function x(e){let t=(0,c.c)(27),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=typeof n.description==`string`?n.description:void 0,d=n.items,f=u(d)?d.type:void 0;if(!(f===`string`||Array.isArray(f)&&f.includes(`string`))){let e=o?.unsupportedArrayType??`Unsupported array type`,n;return t[0]===e?n=t[1]:(n=(0,l.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e}),t[0]=e,t[1]=n),n}let p,m,h,g,_;if(t[2]!==s||t[3]!==a||t[4]!==i||t[5]!==r){let e=r.map(String);p=t=>{let n=t.trim();!n||e.includes(n)||i([...e,n])},g=`flex flex-col gap-1.5`,t[11]===s?_=t[12]:(_=s?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:s}):null,t[11]=s,t[12]=_),m=`flex flex-wrap gap-1`,h=e.map(t=>(0,l.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-sm`,children:[t,(0,l.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,disabled:a,onClick:()=>i(e.filter(e=>e!==t)),children:`×`})]},t)),t[2]=s,t[3]=a,t[4]=i,t[5]=r,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_}else p=t[6],m=t[7],h=t[8],g=t[9],_=t[10];let v;t[13]!==m||t[14]!==h?(v=(0,l.jsx)(`div`,{className:m,children:h}),t[13]=m,t[14]=h,t[15]=v):v=t[15];let y=o?.arrayAddPlaceholder??`Add and press Enter`,b;t[16]===p?b=t[17]:(b=e=>{e.key===`Enter`&&(e.preventDefault(),p(e.target.value),e.target.value=``)},t[16]=p,t[17]=b);let x;t[18]!==a||t[19]!==y||t[20]!==b?(x=(0,l.jsx)(`input`,{className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm`,disabled:a,placeholder:y,onKeyDown:b}),t[18]=a,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;return t[22]!==g||t[23]!==_||t[24]!==v||t[25]!==x?(S=(0,l.jsxs)(`div`,{className:g,children:[_,v,x]}),t[22]=g,t[23]=_,t[24]=v,t[25]=x,t[26]=S):S=t[26],S}function S(e){let t=(0,c.c)(66),{k:n,sub:r,value:i,onValue:a,disabled:o,labels:s}=e,d=r.type,f=(typeof r.title==`string`&&r.title.length>0?r.title:null)??n;if(d===`boolean`){let e;t[0]===f?e=t[1]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[0]=f,t[1]=e);let n=i===!0,c;t[2]===a?c=t[3]:(c=e=>a(e),t[2]=a,t[3]=c);let u;t[4]!==o||t[5]!==s||t[6]!==r||t[7]!==n||t[8]!==c?(u=(0,l.jsx)(b,{s:r,value:n,disabled:o,onChange:c,labels:s}),t[4]=o,t[5]=s,t[6]=r,t[7]=n,t[8]=c,t[9]=u):u=t[9];let d;return t[10]!==e||t[11]!==u?(d=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,u]}),t[10]=e,t[11]=u,t[12]=d):d=t[12],d}if(d===`number`||d===`integer`){let e;t[13]===f?e=t[14]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[13]=f,t[14]=e);let n=typeof i==`number`?i:0,s;t[15]!==o||t[16]!==a||t[17]!==r||t[18]!==n?(s=(0,l.jsx)(y,{s:r,value:n,disabled:o,onChange:a}),t[15]=o,t[16]=a,t[17]=r,t[18]=n,t[19]=s):s=t[19];let c;return t[20]!==e||t[21]!==s?(c=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,s]}),t[20]=e,t[21]=s,t[22]=c):c=t[22],c}if(d===`string`){let e;t[23]===f?e=t[24]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[23]=f,t[24]=e);let s=typeof i==`string`?i:``,c;t[25]!==o||t[26]!==n||t[27]!==a||t[28]!==r||t[29]!==s?(c=(0,l.jsx)(g,{name:n,s:r,value:s,disabled:o,onChange:a}),t[25]=o,t[26]=n,t[27]=a,t[28]=r,t[29]=s,t[30]=c):c=t[30];let u;return t[31]!==e||t[32]!==c?(u=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[31]=e,t[32]=c,t[33]=u):u=t[33],u}if(d===`array`){let e=r.items,n=u(e)?e.type:void 0;if(n===`string`||Array.isArray(n)&&n.includes(`string`)){let e;t[34]===f?e=t[35]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[34]=f,t[35]=e);let n;t[36]===i?n=t[37]:(n=Array.isArray(i)&&i.every(C)?i.map(String):[],t[36]=i,t[37]=n);let c;t[38]!==o||t[39]!==s||t[40]!==a||t[41]!==r||t[42]!==n?(c=(0,l.jsx)(x,{s:r,value:n,disabled:o,onChange:a,labels:s}),t[38]=o,t[39]=s,t[40]=a,t[41]=r,t[42]=n,t[43]=c):c=t[43];let u;return t[44]!==e||t[45]!==c?(u=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[44]=e,t[45]=c,t[46]=u):u=t[46],u}}if(d===`object`){let e;t[47]===i?e=t[48]:(e=u(i)?i:{},t[47]=i,t[48]=e);let n=e,c;t[49]===f?c=t[50]:(c=(0,l.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:f}),t[49]=f,t[50]=c);let d;t[51]!==o||t[52]!==s||t[53]!==n||t[54]!==a||t[55]!==r?(d=(0,l.jsx)(`div`,{className:`border-t border-edge p-3`,children:(0,l.jsx)(w,{schema:r,values:n,onChange:a,disabled:o,labels:s})}),t[51]=o,t[52]=s,t[53]=n,t[54]=a,t[55]=r,t[56]=d):d=t[56];let p;return t[57]!==c||t[58]!==d?(p=(0,l.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[c,d]}),t[57]=c,t[58]=d,t[59]=p):p=t[59],p}let p;t[60]!==s||t[61]!==d||t[62]!==f?(p=s?.unsupportedFieldType?.(f,typeof d==`string`?d:void 0)??`${f}: unsupported field type${typeof d==`string`?` (${d})`:``}`,t[60]=s,t[61]=d,t[62]=f,t[63]=p):p=t[63];let m;return t[64]===p?m=t[65]:(m=(0,l.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[64]=p,t[65]=m),m}function C(e){return typeof e==`string`||typeof e==`number`}function w(e){let t=(0,c.c)(28),{schema:n,values:r,onChange:i,disabled:o,className:s,labels:d}=e,f=o===void 0?!1:o,p;bb0:{if(n.type!==`object`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],p=e;break bb0}let e;t[1]===n?e=t[2]:(e=m(n),t[1]=n,t[2]=e),p=e}let g=p,_;bb1:{if(g.length===0){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=new Map,t[3]=e):e=t[3],_=e;break bb1}let e;t[4]===g?e=t[5]:(e=h(g),t[4]=g,t[5]=e),_=e}let v=_,y;t[6]!==i||t[7]!==r?(y=(e,t)=>{i({...r,[e]:t})},t[6]=i,t[7]=r,t[8]=y):y=t[8];let b=y;if(n.type!==`object`||!u(n.properties)||g.length===0)return null;let x,C;if(t[9]!==s||t[10]!==f||t[11]!==v||t[12]!==d||t[13]!==b||t[14]!==r){let e=Array.from(v.keys()).sort(T);t[17]===s?x=t[18]:(x=a(`flex flex-col gap-4`,s),t[17]=s,t[18]=x);let n;t[19]!==f||t[20]!==v||t[21]!==d||t[22]!==b||t[23]!==r?(n=e=>{let t=(v.get(e)??[]).map(e=>(0,l.jsx)(S,{k:e.key,sub:e.sub,value:r[e.key],onValue:t=>b(e.key,t),disabled:f,labels:d},e.key));return e===``?(0,l.jsx)(`div`,{children:t},`default`):(0,l.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[(0,l.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:e}),(0,l.jsx)(`div`,{className:`space-y-4 border-t border-edge p-3`,children:t})]},e)},t[19]=f,t[20]=v,t[21]=d,t[22]=b,t[23]=r,t[24]=n):n=t[24],C=e.map(n),t[9]=s,t[10]=f,t[11]=v,t[12]=d,t[13]=b,t[14]=r,t[15]=x,t[16]=C}else x=t[15],C=t[16];let w;return t[25]!==x||t[26]!==C?(w=(0,l.jsx)(`div`,{className:x,children:C}),t[25]=x,t[26]=C,t[27]=w):w=t[27],w}function T(e,t){return e===``?-1:t===``?1:e.localeCompare(t)}export{w as t};
|
|
1
|
+
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r,r as i}from"./popover-select-3E24E65N.js";import{t as a}from"./cn-JdwAhgNB.js";import{So as o,To as s}from"./index-DFfvY8IN.js";var c=t();e();var l=n();function u(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function d(e){let t=e[`x-order`];return typeof t==`number`&&!Number.isNaN(t)?t:999}function f(e){let t=e[`x-group`];return typeof t==`string`&&t.length>0?t:``}function p(e){return e[`x-hidden`]===!0}function m(e){let t=e.properties;if(!u(t))return[];let n=[];for(let[e,r]of Object.entries(t))u(r)&&(p(r)||n.push({key:e,sub:r,order:d(r),group:f(r),hidden:!1}));return n.sort((e,t)=>e.order-t.order||e.key.localeCompare(t.key)),n}function h(e){let t=new Map;for(let n of e){let e=n.group;t.has(e)||t.set(e,[]),t.get(e).push(n)}return t}function g(e){let t=(0,c.c)(38),{name:n,s:i,value:a,onChange:u,disabled:d}=e,f=typeof i.description==`string`?i.description:void 0,p=(typeof i[`x-placeholder`]==`string`?i[`x-placeholder`]:null)||f,m=i.format;if(Array.isArray(i.enum)&&i.enum.every(v)){let e;t[0]===f?e=t[1]:(e=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[0]=f,t[1]=e);let o;t[2]===u?o=t[3]:(o=e=>u(e.target.value),t[2]=u,t[3]=o);let s;t[4]===i.enum?s=t[5]:(s=i.enum.map(_),t[4]=i.enum,t[5]=s);let c;t[6]!==d||t[7]!==n||t[8]!==o||t[9]!==s||t[10]!==a?(c=(0,l.jsx)(r,{name:n,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:a,disabled:d,onChange:o,children:s}),t[6]=d,t[7]=n,t[8]=o,t[9]=s,t[10]=a,t[11]=c):c=t[11];let p;return t[12]!==e||t[13]!==c?(p=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,c]}),t[12]=e,t[13]=c,t[14]=p):p=t[14],p}if(m===`password`){let e;t[15]===f?e=t[16]:(e=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[15]=f,t[16]=e);let n;t[17]!==d||t[18]!==u||t[19]!==p||t[20]!==a?(n=(0,l.jsx)(s,{value:a,onChange:u,placeholder:p,labels:o,disabled:d,inputClassName:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`}),t[17]=d,t[18]=u,t[19]=p,t[20]=a,t[21]=n):n=t[21];let r;return t[22]!==e||t[23]!==n?(r=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,n]}),t[22]=e,t[23]=n,t[24]=r):r=t[24],r}let h;t[25]===f?h=t[26]:(h=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[25]=f,t[26]=h);let g;t[27]===u?g=t[28]:(g=e=>u(e.target.value),t[27]=u,t[28]=g);let y;t[29]!==d||t[30]!==n||t[31]!==p||t[32]!==g||t[33]!==a?(y=(0,l.jsx)(`input`,{name:n,type:`text`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`,value:a,placeholder:p,disabled:d,onChange:g}),t[29]=d,t[30]=n,t[31]=p,t[32]=g,t[33]=a,t[34]=y):y=t[34];let b;return t[35]!==h||t[36]!==y?(b=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[h,y]}),t[35]=h,t[36]=y,t[37]=b):b=t[37],b}function _(e){return(0,l.jsx)(i,{value:e,children:e},e)}function v(e){return typeof e==`string`}function y(e){let t=(0,c.c)(11),{s:n,value:r,onChange:i,disabled:a}=e,o=typeof n.description==`string`?n.description:void 0,s;t[0]===o?s=t[1]:(s=o?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:o}):null,t[0]=o,t[1]=s);let u=Number.isFinite(r)?r:0,d;t[2]===i?d=t[3]:(d=e=>i(Number(e.target.value)),t[2]=i,t[3]=d);let f;t[4]!==a||t[5]!==u||t[6]!==d?(f=(0,l.jsx)(`input`,{type:`number`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg`,value:u,disabled:a,onChange:d}),t[4]=a,t[5]=u,t[6]=d,t[7]=f):f=t[7];let p;return t[8]!==s||t[9]!==f?(p=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s,f]}),t[8]=s,t[9]=f,t[10]=p):p=t[10],p}function b(e){let t=(0,c.c)(11),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=(typeof n.description==`string`?n.description:void 0)??(typeof n.title==`string`&&n.title.length>0?n.title:o?.defaultBooleanLabel??`Enable`),u;t[0]===i?u=t[1]:(u=e=>i(e.target.checked),t[0]=i,t[1]=u);let d;t[2]!==a||t[3]!==u||t[4]!==r?(d=(0,l.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border border-edge`,checked:r,disabled:a,onChange:u}),t[2]=a,t[3]=u,t[4]=r,t[5]=d):d=t[5];let f;t[6]===s?f=t[7]:(f=(0,l.jsx)(`span`,{children:s}),t[6]=s,t[7]=f);let p;return t[8]!==d||t[9]!==f?(p=(0,l.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[d,f]}),t[8]=d,t[9]=f,t[10]=p):p=t[10],p}function x(e){let t=(0,c.c)(27),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=typeof n.description==`string`?n.description:void 0,d=n.items,f=u(d)?d.type:void 0;if(!(f===`string`||Array.isArray(f)&&f.includes(`string`))){let e=o?.unsupportedArrayType??`Unsupported array type`,n;return t[0]===e?n=t[1]:(n=(0,l.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e}),t[0]=e,t[1]=n),n}let p,m,h,g,_;if(t[2]!==s||t[3]!==a||t[4]!==i||t[5]!==r){let e=r.map(String);p=t=>{let n=t.trim();!n||e.includes(n)||i([...e,n])},g=`flex flex-col gap-1.5`,t[11]===s?_=t[12]:(_=s?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:s}):null,t[11]=s,t[12]=_),m=`flex flex-wrap gap-1`,h=e.map(t=>(0,l.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-sm`,children:[t,(0,l.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,disabled:a,onClick:()=>i(e.filter(e=>e!==t)),children:`×`})]},t)),t[2]=s,t[3]=a,t[4]=i,t[5]=r,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_}else p=t[6],m=t[7],h=t[8],g=t[9],_=t[10];let v;t[13]!==m||t[14]!==h?(v=(0,l.jsx)(`div`,{className:m,children:h}),t[13]=m,t[14]=h,t[15]=v):v=t[15];let y=o?.arrayAddPlaceholder??`Add and press Enter`,b;t[16]===p?b=t[17]:(b=e=>{e.key===`Enter`&&(e.preventDefault(),p(e.target.value),e.target.value=``)},t[16]=p,t[17]=b);let x;t[18]!==a||t[19]!==y||t[20]!==b?(x=(0,l.jsx)(`input`,{className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm`,disabled:a,placeholder:y,onKeyDown:b}),t[18]=a,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;return t[22]!==g||t[23]!==_||t[24]!==v||t[25]!==x?(S=(0,l.jsxs)(`div`,{className:g,children:[_,v,x]}),t[22]=g,t[23]=_,t[24]=v,t[25]=x,t[26]=S):S=t[26],S}function S(e){let t=(0,c.c)(66),{k:n,sub:r,value:i,onValue:a,disabled:o,labels:s}=e,d=r.type,f=(typeof r.title==`string`&&r.title.length>0?r.title:null)??n;if(d===`boolean`){let e;t[0]===f?e=t[1]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[0]=f,t[1]=e);let n=i===!0,c;t[2]===a?c=t[3]:(c=e=>a(e),t[2]=a,t[3]=c);let u;t[4]!==o||t[5]!==s||t[6]!==r||t[7]!==n||t[8]!==c?(u=(0,l.jsx)(b,{s:r,value:n,disabled:o,onChange:c,labels:s}),t[4]=o,t[5]=s,t[6]=r,t[7]=n,t[8]=c,t[9]=u):u=t[9];let d;return t[10]!==e||t[11]!==u?(d=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,u]}),t[10]=e,t[11]=u,t[12]=d):d=t[12],d}if(d===`number`||d===`integer`){let e;t[13]===f?e=t[14]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[13]=f,t[14]=e);let n=typeof i==`number`?i:0,s;t[15]!==o||t[16]!==a||t[17]!==r||t[18]!==n?(s=(0,l.jsx)(y,{s:r,value:n,disabled:o,onChange:a}),t[15]=o,t[16]=a,t[17]=r,t[18]=n,t[19]=s):s=t[19];let c;return t[20]!==e||t[21]!==s?(c=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,s]}),t[20]=e,t[21]=s,t[22]=c):c=t[22],c}if(d===`string`){let e;t[23]===f?e=t[24]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[23]=f,t[24]=e);let s=typeof i==`string`?i:``,c;t[25]!==o||t[26]!==n||t[27]!==a||t[28]!==r||t[29]!==s?(c=(0,l.jsx)(g,{name:n,s:r,value:s,disabled:o,onChange:a}),t[25]=o,t[26]=n,t[27]=a,t[28]=r,t[29]=s,t[30]=c):c=t[30];let u;return t[31]!==e||t[32]!==c?(u=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[31]=e,t[32]=c,t[33]=u):u=t[33],u}if(d===`array`){let e=r.items,n=u(e)?e.type:void 0;if(n===`string`||Array.isArray(n)&&n.includes(`string`)){let e;t[34]===f?e=t[35]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[34]=f,t[35]=e);let n;t[36]===i?n=t[37]:(n=Array.isArray(i)&&i.every(C)?i.map(String):[],t[36]=i,t[37]=n);let c;t[38]!==o||t[39]!==s||t[40]!==a||t[41]!==r||t[42]!==n?(c=(0,l.jsx)(x,{s:r,value:n,disabled:o,onChange:a,labels:s}),t[38]=o,t[39]=s,t[40]=a,t[41]=r,t[42]=n,t[43]=c):c=t[43];let u;return t[44]!==e||t[45]!==c?(u=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[44]=e,t[45]=c,t[46]=u):u=t[46],u}}if(d===`object`){let e;t[47]===i?e=t[48]:(e=u(i)?i:{},t[47]=i,t[48]=e);let n=e,c;t[49]===f?c=t[50]:(c=(0,l.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:f}),t[49]=f,t[50]=c);let d;t[51]!==o||t[52]!==s||t[53]!==n||t[54]!==a||t[55]!==r?(d=(0,l.jsx)(`div`,{className:`border-t border-edge p-3`,children:(0,l.jsx)(w,{schema:r,values:n,onChange:a,disabled:o,labels:s})}),t[51]=o,t[52]=s,t[53]=n,t[54]=a,t[55]=r,t[56]=d):d=t[56];let p;return t[57]!==c||t[58]!==d?(p=(0,l.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[c,d]}),t[57]=c,t[58]=d,t[59]=p):p=t[59],p}let p;t[60]!==s||t[61]!==d||t[62]!==f?(p=s?.unsupportedFieldType?.(f,typeof d==`string`?d:void 0)??`${f}: unsupported field type${typeof d==`string`?` (${d})`:``}`,t[60]=s,t[61]=d,t[62]=f,t[63]=p):p=t[63];let m;return t[64]===p?m=t[65]:(m=(0,l.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[64]=p,t[65]=m),m}function C(e){return typeof e==`string`||typeof e==`number`}function w(e){let t=(0,c.c)(28),{schema:n,values:r,onChange:i,disabled:o,className:s,labels:d}=e,f=o===void 0?!1:o,p;bb0:{if(n.type!==`object`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],p=e;break bb0}let e;t[1]===n?e=t[2]:(e=m(n),t[1]=n,t[2]=e),p=e}let g=p,_;bb1:{if(g.length===0){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=new Map,t[3]=e):e=t[3],_=e;break bb1}let e;t[4]===g?e=t[5]:(e=h(g),t[4]=g,t[5]=e),_=e}let v=_,y;t[6]!==i||t[7]!==r?(y=(e,t)=>{i({...r,[e]:t})},t[6]=i,t[7]=r,t[8]=y):y=t[8];let b=y;if(n.type!==`object`||!u(n.properties)||g.length===0)return null;let x,C;if(t[9]!==s||t[10]!==f||t[11]!==v||t[12]!==d||t[13]!==b||t[14]!==r){let e=Array.from(v.keys()).sort(T);t[17]===s?x=t[18]:(x=a(`flex flex-col gap-4`,s),t[17]=s,t[18]=x);let n;t[19]!==f||t[20]!==v||t[21]!==d||t[22]!==b||t[23]!==r?(n=e=>{let t=(v.get(e)??[]).map(e=>(0,l.jsx)(S,{k:e.key,sub:e.sub,value:r[e.key],onValue:t=>b(e.key,t),disabled:f,labels:d},e.key));return e===``?(0,l.jsx)(`div`,{children:t},`default`):(0,l.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[(0,l.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:e}),(0,l.jsx)(`div`,{className:`space-y-4 border-t border-edge p-3`,children:t})]},e)},t[19]=f,t[20]=v,t[21]=d,t[22]=b,t[23]=r,t[24]=n):n=t[24],C=e.map(n),t[9]=s,t[10]=f,t[11]=v,t[12]=d,t[13]=b,t[14]=r,t[15]=x,t[16]=C}else x=t[15],C=t[16];let w;return t[25]!==x||t[26]!==C?(w=(0,l.jsx)(`div`,{className:x,children:C}),t[25]=x,t[26]=C,t[27]=w):w=t[27],w}function T(e,t){return e===``?-1:t===``?1:e.localeCompare(t)}export{w as t};
|