@xopcai/xopc 0.0.238 → 0.0.239

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.
Files changed (79) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BCZ6T3y8.js → agent-avatar-dicebear-C1rtpjd7.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-KPtQudPf.js → agent-defaults-settings-panel-oW6wFuP9.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agents-DKQZKGCB.js → agents-V-nDPOk2.js} +1 -1
  6. package/dist/gateway/static/root/assets/{app-management-settings-panel-B_h6HVgw.js → app-management-settings-panel-CRDnRN4G.js} +1 -1
  7. package/dist/gateway/static/root/assets/{appearance-settings-D07Ew40N.js → appearance-settings-BCYZIKqQ.js} +1 -1
  8. package/dist/gateway/static/root/assets/{apps-page-_toby2SK.js → apps-page-dcvQDCvy.js} +1 -1
  9. package/dist/gateway/static/root/assets/{attachment-load-C2Ac3q6g.js → attachment-load-Bgfh7Ag2.js} +1 -1
  10. package/dist/gateway/static/root/assets/{automations-page-Bc4Is3z0.js → automations-page-BdH131M0.js} +1 -1
  11. package/dist/gateway/static/root/assets/{automations-workspace-DH-QeQ0O.js → automations-workspace-BtwzQZAR.js} +1 -1
  12. package/dist/gateway/static/root/assets/{binary-plugins-yMQJYHIQ.js → binary-plugins-BwXg9na-.js} +1 -1
  13. package/dist/gateway/static/root/assets/{block-editor-DrNzI_0p.js → block-editor-BngtUSNv.js} +1 -1
  14. package/dist/gateway/static/root/assets/{browser-settings-page-Bv8GclZd.js → browser-settings-page-kfNOKQ2x.js} +1 -1
  15. package/dist/gateway/static/root/assets/{browser-workflows-page-D_EOs50E.js → browser-workflows-page-Ael9sxrp.js} +1 -1
  16. package/dist/gateway/static/root/assets/{capabilities-settings-panel-gKLN0aaW.js → capabilities-settings-panel-DOymgkUM.js} +1 -1
  17. package/dist/gateway/static/root/assets/{channels-settings-Bh7BqWsN.js → channels-settings-YscUvFub.js} +1 -1
  18. package/dist/gateway/static/root/assets/{chat-terminal-dock-B7agEwma.js → chat-terminal-dock-DI0lYVKk.js} +1 -1
  19. package/dist/gateway/static/root/assets/{connectors-page-DifO0WX4.js → connectors-page-BtzCRQGz.js} +1 -1
  20. package/dist/gateway/static/root/assets/{cron-expression-bjxQQFdv.js → cron-expression-CLuvPZ3b.js} +1 -1
  21. package/dist/gateway/static/root/assets/{date-picker-C7ujLHll.js → date-picker-D4QS8Zzn.js} +1 -1
  22. package/dist/gateway/static/root/assets/{dependency-picker-rl8E7nXp.js → dependency-picker-DZn-RhEm.js} +1 -1
  23. package/dist/gateway/static/root/assets/{desktop-pet-D4GbYBcD.js → desktop-pet-C6KqTQas.js} +1 -1
  24. package/dist/gateway/static/root/assets/{desktop-pet-settings-Bo34tFlD.js → desktop-pet-settings-Bov3XuPO.js} +1 -1
  25. package/dist/gateway/static/root/assets/{extension-debug-page-DuPa1bVQ.js → extension-debug-page-DpeeYAjX.js} +1 -1
  26. package/dist/gateway/static/root/assets/{extension-page-CB9xF3qo.js → extension-page-Cescx_be.js} +1 -1
  27. package/dist/gateway/static/root/assets/{extension-settings-page-CovEdmGD.js → extension-settings-page-C_ubW61U.js} +1 -1
  28. package/dist/gateway/static/root/assets/{gateway-config-api-CAaoukkR.js → gateway-config-api-BM79X1jC.js} +1 -1
  29. package/dist/gateway/static/root/assets/{gateway-settings-CesXGTe3.js → gateway-settings-GV5KAj-l.js} +1 -1
  30. package/dist/gateway/static/root/assets/{heartbeat-settings-Bu5cIcNb.js → heartbeat-settings-CZ1KeXXU.js} +1 -1
  31. package/dist/gateway/static/root/assets/{home-page-sQfx98tH.js → home-page-YdVal_8I.js} +1 -1
  32. package/dist/gateway/static/root/assets/{index-C9rUND9-.css → index-7GLgmvAm.css} +1 -1
  33. package/dist/gateway/static/root/assets/{index-C73V7tJP.js → index-DKP23eMn.js} +8 -8
  34. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CpZxPmd0.js → keyboard-shortcuts-settings-Tn7xSeVT.js} +1 -1
  35. package/dist/gateway/static/root/assets/{local-app-workbench-page-DjvHSI0e.js → local-app-workbench-page-DCt7cbvK.js} +1 -1
  36. package/dist/gateway/static/root/assets/{local-apps-page-5KTZwLbX.js → local-apps-page-Co5_qKEQ.js} +1 -1
  37. package/dist/gateway/static/root/assets/{logs-page-frYgoe2x.js → logs-page-ChfSQQSV.js} +1 -1
  38. package/dist/gateway/static/root/assets/{management-settings-9iZjSpHe.js → management-settings-DE0o5c7Y.js} +1 -1
  39. package/dist/gateway/static/root/assets/{markdown-split-C4-0M8mu.js → markdown-split-CADkGbQi.js} +1 -1
  40. package/dist/gateway/static/root/assets/{media-plugins-CjMa9GMF.js → media-plugins-mHodPaFz.js} +1 -1
  41. package/dist/gateway/static/root/assets/{mobile-pairing-wizard-DikJ7HCm.js → mobile-pairing-wizard-43FyMswX.js} +1 -1
  42. package/dist/gateway/static/root/assets/{notes-page-CC45W2KR.js → notes-page-BMUyJStB.js} +1 -1
  43. package/dist/gateway/static/root/assets/{notes-workbench-BFreGbmY.js → notes-workbench-DjHIQneE.js} +2 -2
  44. package/dist/gateway/static/root/assets/{project-detail-page-53z9nB5L.js → project-detail-page-CXD2pVgQ.js} +1 -1
  45. package/dist/gateway/static/root/assets/{projects-page-DR7OvyAl.js → projects-page-cqKqkTwG.js} +1 -1
  46. package/dist/gateway/static/root/assets/{remote-access-hub-BkSGDDbn.js → remote-access-hub-UEinEd7d.js} +1 -1
  47. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DLv-QsQo.js → runtime-tools-settings-panel-ClCEmwPY.js} +1 -1
  48. package/dist/gateway/static/root/assets/{schema-form-DDW7aJWa.js → schema-form-0vcUqeqa.js} +1 -1
  49. package/dist/gateway/static/root/assets/{sessions-page-C-yaSuuQ.js → sessions-page-Cc6ve-qc.js} +1 -1
  50. package/dist/gateway/static/root/assets/settings-advanced-gate-_J5FSEYX.js +1 -0
  51. package/dist/gateway/static/root/assets/{settings-form-section-5NTg906_.js → settings-form-section-BkdLf_sS.js} +1 -1
  52. package/dist/gateway/static/root/assets/{settings-page-DgTYtrmh.js → settings-page-QBTaBpBn.js} +1 -1
  53. package/dist/gateway/static/root/assets/{setup-status-panel-Dm_gdAfm.js → setup-status-panel-bQcSMkVr.js} +1 -1
  54. package/dist/gateway/static/root/assets/{share-preview-page-BX2Ev7-I.js → share-preview-page-D_OuXnah.js} +1 -1
  55. package/dist/gateway/static/root/assets/{shares-settings-D2Zd9l04.js → shares-settings-DJfcpok3.js} +1 -1
  56. package/dist/gateway/static/root/assets/{skill-reload-api-BvND7xsL.js → skill-reload-api-Bbqp5HaH.js} +1 -1
  57. package/dist/gateway/static/root/assets/{skills-page-Cmqu9f_n.js → skills-page-BNcnmaTg.js} +1 -1
  58. package/dist/gateway/static/root/assets/{skills-page.utils-KOxLvm84.js → skills-page.utils-BWWcFShl.js} +1 -1
  59. package/dist/gateway/static/root/assets/{system-settings-panel-CS7cDwv2.js → system-settings-panel-BsH7b3B4.js} +1 -1
  60. package/dist/gateway/static/root/assets/{task-detail-page-COpgFG6K.js → task-detail-page-CcAhyw2Z.js} +1 -1
  61. package/dist/gateway/static/root/assets/{tunnel-api-D3h311_s.js → tunnel-api-D5-Hggt3.js} +1 -1
  62. package/dist/gateway/static/root/assets/{use-autosave-DvATIVb_.js → use-autosave-Dp1ycDa8.js} +1 -1
  63. package/dist/gateway/static/root/assets/{user-context-page-PKrbPu4w.js → user-context-page-Dd_oMNie.js} +1 -1
  64. package/dist/gateway/static/root/assets/{voice-api-key-field-C3BgRKG2.js → voice-api-key-field-DhrQXH3c.js} +1 -1
  65. package/dist/gateway/static/root/assets/{work-discovery-overlay-DHcQSZZD.js → work-discovery-overlay-B7zKAPrb.js} +1 -1
  66. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Nx6xmy_N.js → workflow-run-setup-panel-Cek9K48F.js} +1 -1
  67. package/dist/gateway/static/root/assets/{workflows-page-DBkP6B4E.js → workflows-page-T2q2Mx6H.js} +1 -1
  68. package/dist/gateway/static/root/index.html +2 -2
  69. package/dist/package.js +1 -1
  70. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  71. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  72. package/dist/src/extensions/update.js +1 -1
  73. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  74. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  75. package/dist/src/gateway/service/config-coordinator.js +1 -1
  76. package/dist/src/infra/update-restart.js +1 -1
  77. package/dist/src/infra/update-runner.js +1 -1
  78. package/package.json +4 -4
  79. package/dist/gateway/static/root/assets/settings-advanced-gate-CelrRPXt.js +0 -1
@@ -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-DBrVS3tZ.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-B1HDp_j8.js";import{n as p}from"./locale-store-XDFAPNNu.js";import{t as m}from"./skeleton-BwbyijEw.js";import{a as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./dist-BPoKqzeH.js";import{Aa as S,Bi as C,Cc 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 te,ps as ne,vl as M,wc as re,ws as N,xl as P,zi as ie}from"./index-C73V7tJP.js";var F=n(),I=e(t(),1),L=r();function R(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:E(n)}function ae(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 oe(){let e=(0,F.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:6},z)}),e[0]=t):t=e[0],t}function z(e,t){return(0,L.jsx)(m,{className:`h-40 rounded-xl`},t)}function se(e){let t=(0,F.c)(59),{project:n,busy:r,onTogglePin:a,onToggleArchive:o}=e,s=p(B),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,L.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:(0,L.jsx)(re,{className:`size-4`,"aria-hidden":!0})}),t[17]=r):r=t[17];let a;t[18]===n.name?a=t[19]:(a=(0,L.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[18]=n.name,t[19]=a);let o=(0,L.jsxs)(`div`,{className:`min-w-0`,children:[a,(0,L.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,L.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,L.jsx)(M,{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,L.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[f,p]}),t[23]=f,t[24]=v),_=(0,L.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,L.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,L.jsx)(`p`,{className:`truncate`,children:n.workspaceRoot||e.agentDefault}),l=`mt-1`,u=R(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,L.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,L.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,S;t[32]===n.pinnedAt?S=t[33]:(S=n.pinnedAt?(0,L.jsx)(N,{className:`size-4`,"aria-hidden":!0}):(0,L.jsx)(T,{className:`size-4`,"aria-hidden":!0}),t[32]=n.pinnedAt,t[33]=S);let C;t[34]!==r||t[35]!==a||t[36]!==b||t[37]!==x||t[38]!==S?(C=(0,L.jsx)(f,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:a,"aria-label":b,title:x,children:S}),t[34]=r,t[35]=a,t[36]=b,t[37]=x,t[38]=S,t[39]=C):C=t[39];let w=n.status===`archived`?c.restore:c.archive,E=n.status===`archived`?c.restore:c.archive,D;t[40]===n.status?D=t[41]:(D=n.status===`archived`?(0,L.jsx)(ne,{className:`size-4`,"aria-hidden":!0}):(0,L.jsx)(P,{className:`size-4`,"aria-hidden":!0}),t[40]=n.status,t[41]=D);let O;t[42]!==r||t[43]!==o||t[44]!==w||t[45]!==E||t[46]!==D?(O=(0,L.jsx)(f,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:o,"aria-label":w,title:E,children:D}),t[42]=r,t[43]=o,t[44]=w,t[45]=E,t[46]=D,t[47]=O):O=t[47];let k;t[48]!==C||t[49]!==O?(k=(0,L.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[C,O]}),t[48]=C,t[49]=O,t[50]=k):k=t[50];let A;t[51]!==k||t[52]!==h||t[53]!==y?(A=(0,L.jsxs)(`div`,{className:h,children:[y,k]}),t[51]=k,t[52]=h,t[53]=y,t[54]=A):A=t[54];let j;return t[55]!==A||t[56]!==g||t[57]!==_?(j=(0,L.jsxs)(`article`,{className:g,children:[_,A]}),t[55]=A,t[56]=g,t[57]=_,t[58]=j):j=t[58],j}function B(e){return e.language}function V(){let e=ee(p(e=>e.language)),t=e.projectsPage,n=t.management,r=e.chat.workingDirectory,i=S(e=>e.setPageHeader),m=S(e=>e.clearPageHeader),[T,E]=(0,I.useState)([]),[ne,M]=(0,I.useState)(!0),[N,P]=(0,I.useState)(null),[F,R]=(0,I.useState)(``),[z,B]=(0,I.useState)(!1),[V,ce]=(0,I.useState)(`active`),[le,H]=(0,I.useState)(null),[ue,U]=(0,I.useState)(!1),[W,G]=(0,I.useState)(null),[K,q]=(0,I.useState)(!1),[J,de]=(0,I.useState)(``),[Y,fe]=(0,I.useState)(``),[X,pe]=(0,I.useState)(``),Z=A({initialPath:X,onPicked:pe}),Q=(0,I.useCallback)(async()=>{M(!0),P(null);try{E(ae((await O({limit:100,sortBy:`updatedAt`,sortOrder:`desc`})).items))}catch(e){P(e instanceof Error?e.message:String(e))}finally{M(!1)}},[]);(0,I.useEffect)(()=>{Q()},[Q]);let $=(0,I.useMemo)(()=>{let e=F.trim().toLocaleLowerCase();return T.filter(e=>V===`all`||e.status===V).filter(t=>!e||[t.name,t.description,t.brief,t.workspaceRoot].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e)))},[V,T,F]),me=(0,I.useMemo)(()=>(0,L.jsxs)(f,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>U(!0),children:[(0,L.jsx)(c,{className:`size-4`,"aria-hidden":!0}),t.create]}),[t.create]);(0,I.useLayoutEffect)(()=>(i({startExtra:null,main:(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,L.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.subtitle})]}),end:me}),()=>m()),[m,me,n.subtitle,n.title,i]);let he=(0,I.useCallback)(async e=>{e.preventDefault();let t=J.trim(),n=X.trim();if(!(!t||!n||K)){q(!0),G(null);try{let e=await C({name:t,...Y.trim()?{description:Y.trim()}:{},workspaceRoot:n});E(t=>[e,...t.filter(t=>t.id!==e.id)]),de(``),fe(``),pe(``),U(!1),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){G(e instanceof Error?e.message:String(e))}finally{q(!1)}}},[K,Y,J,X]),ge=(0,I.useCallback)(async(e,t)=>{H(e.id),P(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 ie(e.id),E(e=>e.map(e=>e.id===n.id?n:e)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){P(e instanceof Error?e.message:String(e))}finally{H(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===V)?.label??t.all,ye=n.resultCount.replace(`{{status}}`,ve).replace(`{{count}}`,String($.length));return(0,L.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,L.jsx)(x,{open:ue,onOpenChange:e=>{U(e),e||G(null)},children:(0,L.jsxs)(v,{children:[(0,L.jsx)(h,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,L.jsxs)(y,{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,L.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,L.jsx)(b,{className:`text-base font-semibold text-fg`,children:t.createTitle}),(0,L.jsx)(g,{className:`mt-1 text-sm text-fg-muted`,children:t.createDescription})]}),(0,L.jsxs)(`form`,{onSubmit:he,className:`flex min-h-0 flex-1 flex-col`,children:[(0,L.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,L.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.projectName,(0,L.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,L.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[n.descriptionLabel,(0,L.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,L.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,L.jsx)(`span`,{className:`font-medium text-fg`,children:t.workspaceRoot}),(0,L.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:K||Z.picking,children:[Z.picking?(0,L.jsx)(s,{className:`size-5 shrink-0 animate-spin text-accent`,"aria-hidden":!0}):(0,L.jsx)(w,{className:`size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,L.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:X?r.chooseFolder:r.selectWorkingDirectory}),(0,L.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,L.jsx)(`p`,{className:`text-xs font-normal text-fg-subtle`,children:t.workspaceSelectionHint})]}),W?(0,L.jsx)(`p`,{className:`rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:W}):null]}),(0,L.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,L.jsx)(_,{asChild:!0,children:(0,L.jsx)(f,{type:`button`,variant:`ghost`,children:t.cancel})}),(0,L.jsx)(f,{type:`submit`,variant:`primary`,disabled:K||!J.trim()||!X.trim(),children:K?t.home.creating:t.create})]})]})]})]})}),Z.hasNativePicker?null:(0,L.jsx)(te,{open:Z.modalOpen,onOpenChange:Z.setModalOpen,initialAbsolutePath:X||void 0,onConfirm:Z.confirmPick,wd:r}),(0,L.jsxs)(`section`,{className:`flex min-h-10 flex-wrap items-center justify-between gap-3`,"aria-label":n.filterLabel,children:[(0,L.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,"aria-live":`polite`,children:ye}),(0,L.jsxs)(`div`,{className:d(`ml-auto flex min-w-0 items-center justify-end gap-2`,z&&`w-full sm:w-auto`),children:[z?(0,L.jsxs)(`div`,{className:`relative min-w-0 flex-1 sm:w-64 sm:flex-none`,children:[(0,L.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,L.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:F,onChange:e=>R(e.target.value),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder}),(0,L.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:()=>{R(``),B(!1)},"aria-label":n.clearSearch,title:n.clearSearch,children:(0,L.jsx)(u,{className:`size-3.5`,"aria-hidden":!0})})]}):(0,L.jsx)(f,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,onClick:()=>B(!0),"aria-label":t.searchPlaceholder,title:t.searchPlaceholder,children:(0,L.jsx)(l,{className:`size-4`,"aria-hidden":!0})}),(0,L.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:V,"aria-label":n.filterLabel,onChange:e=>ce(e.target.value),children:_e.map(e=>(0,L.jsx)(o,{value:e.id,children:e.label},e.id))})]})]}),N?(0,L.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,L.jsx)(`span`,{children:N}),(0,L.jsx)(f,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void Q(),children:t.home.retry})]}):null,ne?(0,L.jsx)(oe,{}):$.length?(0,L.jsx)(`section`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:$.map(e=>(0,L.jsx)(se,{project:e,busy:le===e.id,onTogglePin:()=>void ge(e,`pin`),onToggleArchive:()=>void ge(e,`archive`)},e.id))}):(0,L.jsxs)(`section`,{className:`rounded-xl border border-dashed border-edge p-10 text-center`,children:[(0,L.jsx)(re,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,L.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.emptyTitle}),(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.emptyHint})]})]})}export{V 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-DBrVS3tZ.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-B1HDp_j8.js";import{n as p}from"./locale-store-XDFAPNNu.js";import{t as m}from"./skeleton-BwbyijEw.js";import{a as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./dist-BPoKqzeH.js";import{Aa as S,Bi as C,Cc 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 te,ps as ne,vl as M,wc as re,ws as N,xl as P,zi as ie}from"./index-DKP23eMn.js";var F=n(),I=e(t(),1),L=r();function R(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:E(n)}function ae(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 oe(){let e=(0,F.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:6},z)}),e[0]=t):t=e[0],t}function z(e,t){return(0,L.jsx)(m,{className:`h-40 rounded-xl`},t)}function se(e){let t=(0,F.c)(59),{project:n,busy:r,onTogglePin:a,onToggleArchive:o}=e,s=p(B),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,L.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:(0,L.jsx)(re,{className:`size-4`,"aria-hidden":!0})}),t[17]=r):r=t[17];let a;t[18]===n.name?a=t[19]:(a=(0,L.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[18]=n.name,t[19]=a);let o=(0,L.jsxs)(`div`,{className:`min-w-0`,children:[a,(0,L.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,L.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,L.jsx)(M,{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,L.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[f,p]}),t[23]=f,t[24]=v),_=(0,L.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,L.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,L.jsx)(`p`,{className:`truncate`,children:n.workspaceRoot||e.agentDefault}),l=`mt-1`,u=R(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,L.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,L.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,S;t[32]===n.pinnedAt?S=t[33]:(S=n.pinnedAt?(0,L.jsx)(N,{className:`size-4`,"aria-hidden":!0}):(0,L.jsx)(T,{className:`size-4`,"aria-hidden":!0}),t[32]=n.pinnedAt,t[33]=S);let C;t[34]!==r||t[35]!==a||t[36]!==b||t[37]!==x||t[38]!==S?(C=(0,L.jsx)(f,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:a,"aria-label":b,title:x,children:S}),t[34]=r,t[35]=a,t[36]=b,t[37]=x,t[38]=S,t[39]=C):C=t[39];let w=n.status===`archived`?c.restore:c.archive,E=n.status===`archived`?c.restore:c.archive,D;t[40]===n.status?D=t[41]:(D=n.status===`archived`?(0,L.jsx)(ne,{className:`size-4`,"aria-hidden":!0}):(0,L.jsx)(P,{className:`size-4`,"aria-hidden":!0}),t[40]=n.status,t[41]=D);let O;t[42]!==r||t[43]!==o||t[44]!==w||t[45]!==E||t[46]!==D?(O=(0,L.jsx)(f,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:o,"aria-label":w,title:E,children:D}),t[42]=r,t[43]=o,t[44]=w,t[45]=E,t[46]=D,t[47]=O):O=t[47];let k;t[48]!==C||t[49]!==O?(k=(0,L.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[C,O]}),t[48]=C,t[49]=O,t[50]=k):k=t[50];let A;t[51]!==k||t[52]!==h||t[53]!==y?(A=(0,L.jsxs)(`div`,{className:h,children:[y,k]}),t[51]=k,t[52]=h,t[53]=y,t[54]=A):A=t[54];let j;return t[55]!==A||t[56]!==g||t[57]!==_?(j=(0,L.jsxs)(`article`,{className:g,children:[_,A]}),t[55]=A,t[56]=g,t[57]=_,t[58]=j):j=t[58],j}function B(e){return e.language}function V(){let e=ee(p(e=>e.language)),t=e.projectsPage,n=t.management,r=e.chat.workingDirectory,i=S(e=>e.setPageHeader),m=S(e=>e.clearPageHeader),[T,E]=(0,I.useState)([]),[ne,M]=(0,I.useState)(!0),[N,P]=(0,I.useState)(null),[F,R]=(0,I.useState)(``),[z,B]=(0,I.useState)(!1),[V,ce]=(0,I.useState)(`active`),[le,H]=(0,I.useState)(null),[ue,U]=(0,I.useState)(!1),[W,G]=(0,I.useState)(null),[K,q]=(0,I.useState)(!1),[J,de]=(0,I.useState)(``),[Y,fe]=(0,I.useState)(``),[X,pe]=(0,I.useState)(``),Z=A({initialPath:X,onPicked:pe}),Q=(0,I.useCallback)(async()=>{M(!0),P(null);try{E(ae((await O({limit:100,sortBy:`updatedAt`,sortOrder:`desc`})).items))}catch(e){P(e instanceof Error?e.message:String(e))}finally{M(!1)}},[]);(0,I.useEffect)(()=>{Q()},[Q]);let $=(0,I.useMemo)(()=>{let e=F.trim().toLocaleLowerCase();return T.filter(e=>V===`all`||e.status===V).filter(t=>!e||[t.name,t.description,t.brief,t.workspaceRoot].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e)))},[V,T,F]),me=(0,I.useMemo)(()=>(0,L.jsxs)(f,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>U(!0),children:[(0,L.jsx)(c,{className:`size-4`,"aria-hidden":!0}),t.create]}),[t.create]);(0,I.useLayoutEffect)(()=>(i({startExtra:null,main:(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,L.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.subtitle})]}),end:me}),()=>m()),[m,me,n.subtitle,n.title,i]);let he=(0,I.useCallback)(async e=>{e.preventDefault();let t=J.trim(),n=X.trim();if(!(!t||!n||K)){q(!0),G(null);try{let e=await C({name:t,...Y.trim()?{description:Y.trim()}:{},workspaceRoot:n});E(t=>[e,...t.filter(t=>t.id!==e.id)]),de(``),fe(``),pe(``),U(!1),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){G(e instanceof Error?e.message:String(e))}finally{q(!1)}}},[K,Y,J,X]),ge=(0,I.useCallback)(async(e,t)=>{H(e.id),P(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 ie(e.id),E(e=>e.map(e=>e.id===n.id?n:e)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){P(e instanceof Error?e.message:String(e))}finally{H(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===V)?.label??t.all,ye=n.resultCount.replace(`{{status}}`,ve).replace(`{{count}}`,String($.length));return(0,L.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,L.jsx)(x,{open:ue,onOpenChange:e=>{U(e),e||G(null)},children:(0,L.jsxs)(v,{children:[(0,L.jsx)(h,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,L.jsxs)(y,{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,L.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,L.jsx)(b,{className:`text-base font-semibold text-fg`,children:t.createTitle}),(0,L.jsx)(g,{className:`mt-1 text-sm text-fg-muted`,children:t.createDescription})]}),(0,L.jsxs)(`form`,{onSubmit:he,className:`flex min-h-0 flex-1 flex-col`,children:[(0,L.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,L.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.projectName,(0,L.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,L.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[n.descriptionLabel,(0,L.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,L.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,L.jsx)(`span`,{className:`font-medium text-fg`,children:t.workspaceRoot}),(0,L.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:K||Z.picking,children:[Z.picking?(0,L.jsx)(s,{className:`size-5 shrink-0 animate-spin text-accent`,"aria-hidden":!0}):(0,L.jsx)(w,{className:`size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,L.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:X?r.chooseFolder:r.selectWorkingDirectory}),(0,L.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,L.jsx)(`p`,{className:`text-xs font-normal text-fg-subtle`,children:t.workspaceSelectionHint})]}),W?(0,L.jsx)(`p`,{className:`rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:W}):null]}),(0,L.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,L.jsx)(_,{asChild:!0,children:(0,L.jsx)(f,{type:`button`,variant:`ghost`,children:t.cancel})}),(0,L.jsx)(f,{type:`submit`,variant:`primary`,disabled:K||!J.trim()||!X.trim(),children:K?t.home.creating:t.create})]})]})]})]})}),Z.hasNativePicker?null:(0,L.jsx)(te,{open:Z.modalOpen,onOpenChange:Z.setModalOpen,initialAbsolutePath:X||void 0,onConfirm:Z.confirmPick,wd:r}),(0,L.jsxs)(`section`,{className:`flex min-h-10 flex-wrap items-center justify-between gap-3`,"aria-label":n.filterLabel,children:[(0,L.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,"aria-live":`polite`,children:ye}),(0,L.jsxs)(`div`,{className:d(`ml-auto flex min-w-0 items-center justify-end gap-2`,z&&`w-full sm:w-auto`),children:[z?(0,L.jsxs)(`div`,{className:`relative min-w-0 flex-1 sm:w-64 sm:flex-none`,children:[(0,L.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,L.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:F,onChange:e=>R(e.target.value),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder}),(0,L.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:()=>{R(``),B(!1)},"aria-label":n.clearSearch,title:n.clearSearch,children:(0,L.jsx)(u,{className:`size-3.5`,"aria-hidden":!0})})]}):(0,L.jsx)(f,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,onClick:()=>B(!0),"aria-label":t.searchPlaceholder,title:t.searchPlaceholder,children:(0,L.jsx)(l,{className:`size-4`,"aria-hidden":!0})}),(0,L.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:V,"aria-label":n.filterLabel,onChange:e=>ce(e.target.value),children:_e.map(e=>(0,L.jsx)(o,{value:e.id,children:e.label},e.id))})]})]}),N?(0,L.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,L.jsx)(`span`,{children:N}),(0,L.jsx)(f,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void Q(),children:t.home.retry})]}):null,ne?(0,L.jsx)(oe,{}):$.length?(0,L.jsx)(`section`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:$.map(e=>(0,L.jsx)(se,{project:e,busy:le===e.id,onTogglePin:()=>void ge(e,`pin`),onToggleArchive:()=>void ge(e,`archive`)},e.id))}):(0,L.jsxs)(`section`,{className:`rounded-xl border border-dashed border-edge p-10 text-center`,children:[(0,L.jsx)(re,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,L.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.emptyTitle}),(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.emptyHint})]})]})}export{V 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{t as m}from"./copy-to-clipboard-HOJ79TWv.js";import{t as h}from"./messages-B1HDp_j8.js";import{n as g,s as _}from"./locale-store-XDFAPNNu.js";import{i as v,o as y}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{a as b,i as x,o as S,r as C,s as w,t as T}from"./dist-BPoKqzeH.js";import{i as E}from"./vendor-swr-BIWyz7Rc.js";import{n as D,r as O}from"./gateway-config-swr-DfMY-MLf.js";import{a as k,n as A,r as j}from"./oauth-api-B_pcOUfT.js";import{Di as M,Ns as N,Uc as P,Uo as F,di as I,el as L,fn as R,nl as z,oc as B,rs as V,sa as ee,ts as H,us as U,vl as te,wo as ne,ys as W,zo as re}from"./index-C73V7tJP.js";import{n as G,r as K,t as q}from"./settings-page-layout-BRQNel6r.js";import{a as ie,c as ae,d as J,g as oe,i as se,l as ce,n as Y,o as le,r as ue,s as de,t as fe,u as pe}from"./tunnel-api-D3h311_s.js";import{n as X,r as me,t as he}from"./settings-form-section-5NTg906_.js";import{n as ge,r as _e,t as ve}from"./oauth-authorization-window-Cdolr2wE.js";import{t as ye}from"./page-tabs-BaEQMYm_.js";import{t as be}from"./settings-advanced-gate-CelrRPXt.js";var Z=e(t(),1),Q=n(),$=r();function xe(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 Se(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`,xe(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 Ce(e){let t=(0,Q.c)(31),{onOpenTab:n}=e,r=g(Te),i;t[0]===r?i=t[1]:(i=h(r),t[0]=r,t[1]=i);let a=i.remoteAccess.guide,o=!!_(we),s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={refreshInterval:3e4},t[2]=s):s=t[2];let{data:c}=E(o?`exposure-status`:null,pe,s),l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l={refreshInterval:15e3},t[3]=l):l=t[3];let{data:d}=E(o?`tunnel-status`:null,fe,l),p=O(o);if(!o)return null;let m=c?.tailscale.active===!0,v=d?.state,y=d?.enabled&&v===`connected`,b=d?.enabled&&(v===`connecting`||v===`reconnecting`||!!d?.startProgress||!!d?.frpcDownload),x=p.data?.payload?.config,S=!!(x&&typeof x==`object`&&!Array.isArray(x)&&x.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 D=y?`active`:b?`connecting`:`off`,k=y?a.statusActive:b?a.statusConnecting:a.statusOff,A;t[8]!==a.publicCardTitle||t[9]!==D||t[10]!==k?(A={tab:`public`,icon:N,title:a.publicCardTitle,kind:D,statusLabel:k},t[8]=a.publicCardTitle,t[9]=D,t[10]=k,t[11]=A):A=t[11];let j=S?`active`:`off`,M=S?a.statusActive:a.statusOff,P;t[12]!==a.reverseProxyCardTitle||t[13]!==j||t[14]!==M?(P={tab:`reverse-proxy`,icon:V,title:a.reverseProxyCardTitle,kind:j,statusLabel:M},t[12]=a.reverseProxyCardTitle,t[13]=j,t[14]=M,t[15]=P):P=t[15];let I;t[16]!==a.sshCardStatus||t[17]!==a.sshCardTitle?(I={tab:`ssh`,icon:F,title:a.sshCardTitle,kind:`off`,statusLabel:a.sshCardStatus},t[16]=a.sshCardStatus,t[17]=a.sshCardTitle,t[18]=I):I=t[18];let L;t[19]!==a.lanCardStatus||t[20]!==a.lanCardTitle?(L={tab:`lan`,icon:U,title:a.lanCardTitle,kind:`off`,statusLabel:a.lanCardStatus},t[19]=a.lanCardStatus,t[20]=a.lanCardTitle,t[21]=L):L=t[21];let R;t[22]!==P||t[23]!==I||t[24]!==L||t[25]!==T||t[26]!==A?(R=[T,A,P,I,L],t[22]=P,t[23]=I,t[24]=L,t[25]=T,t[26]=A,t[27]=R):R=t[27];let z=R,B;return t[28]!==z||t[29]!==n?(B=(0,$.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5`,children:z.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)(Se,{label:e.statusLabel,kind:e.kind})]})]},`${e.tab}-${e.title}`)})}),t[28]=z,t[29]=n,t[30]=B):B=t[30],B}function we(e){return e.token}function Te(e){return e.language}function Ee(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)(L,{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 De(e){let t=(0,Q.c)(83),{onOpenTab:n}=e,r=g(Ae),i;t[0]===r?i=t[1]:(i=h(r),t[0]=r,t[1]=i);let a=i.remoteAccess,o=a.guide,s=!!_(ke),c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c={refreshInterval:3e4},t[2]=c):c=t[2];let{data:l}=E(s?`exposure-status`:null,pe,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)(Ce,{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(Oe)})]}):null,t[9]=f,t[10]=o.conflictsHint,t[11]=o.conflictsTitle,t[12]=m):m=t[12];let v;t[13]===o.pickMethod?v=t[14]:(v=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:o.pickMethod}),t[13]=o.pickMethod,t[14]=v);let y;t[15]===n?y=t[16]:(y=()=>n(`tailscale`),t[15]=n,t[16]=y);let b;t[17]!==o.configure||t[18]!==o.recommended||t[19]!==o.tailscaleCardDesc||t[20]!==o.tailscaleCardTitle||t[21]!==y?(b=(0,$.jsx)(Ee,{icon:u,title:o.tailscaleCardTitle,description:o.tailscaleCardDesc,recommended:!0,recommendedLabel:o.recommended,openLabel:o.configure,onOpen:y}),t[17]=o.configure,t[18]=o.recommended,t[19]=o.tailscaleCardDesc,t[20]=o.tailscaleCardTitle,t[21]=y,t[22]=b):b=t[22];let x;t[23]===n?x=t[24]:(x=()=>n(`public`),t[23]=n,t[24]=x);let S;t[25]!==o.configure||t[26]!==o.publicCardDesc||t[27]!==o.publicCardTitle||t[28]!==x?(S=(0,$.jsx)(Ee,{icon:N,title:o.publicCardTitle,description:o.publicCardDesc,openLabel:o.configure,onOpen:x}),t[25]=o.configure,t[26]=o.publicCardDesc,t[27]=o.publicCardTitle,t[28]=x,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)(Ee,{icon:V,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 D;t[39]!==o.configure||t[40]!==o.sshCardDesc||t[41]!==o.sshCardTitle||t[42]!==T?(D=(0,$.jsx)(Ee,{icon:F,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]=D):D=t[43];let O;t[44]===n?O=t[45]:(O=()=>n(`lan`),t[44]=n,t[45]=O);let k;t[46]!==o.configure||t[47]!==o.lanCardDesc||t[48]!==o.lanCardTitle||t[49]!==O?(k=(0,$.jsx)(Ee,{icon:U,title:o.lanCardTitle,description:o.lanCardDesc,openLabel:o.configure,onOpen:O}),t[46]=o.configure,t[47]=o.lanCardDesc,t[48]=o.lanCardTitle,t[49]=O,t[50]=k):k=t[50];let A;t[51]!==S||t[52]!==w||t[53]!==D||t[54]!==k||t[55]!==b?(A=(0,$.jsxs)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:[b,S,w,D,k]}),t[51]=S,t[52]=w,t[53]=D,t[54]=k,t[55]=b,t[56]=A):A=t[56];let j;t[57]!==A||t[58]!==v?(j=(0,$.jsxs)(`div`,{children:[v,A]}),t[57]=A,t[58]=v,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 P;t[62]===a.advanced.proxyTitle?P=t[63]:(P=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.advanced.proxyTitle}),t[62]=a.advanced.proxyTitle,t[63]=P);let I;t[64]===a.advanced.proxyBody?I=t[65]:(I=(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:a.advanced.proxyBody}),t[64]=a.advanced.proxyBody,t[65]=I);let L;t[66]!==r||t[67]!==a.advanced.proxyDocs?(L=(0,$.jsx)(J,{language:r,label:a.advanced.proxyDocs,section:`advanced`,className:`mt-2`}),t[66]=r,t[67]=a.advanced.proxyDocs,t[68]=L):L=t[68];let R;t[69]!==P||t[70]!==I||t[71]!==L?(R=(0,$.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-4 py-3`,children:[P,I,L]}),t[69]=P,t[70]=I,t[71]=L,t[72]=R):R=t[72];let z;t[73]!==o.docsLink||t[74]!==r?(z=(0,$.jsx)(J,{language:r,label:o.docsLink}),t[73]=o.docsLink,t[74]=r,t[75]=z):z=t[75];let B;return t[76]!==j||t[77]!==M||t[78]!==R||t[79]!==z||t[80]!==p||t[81]!==m?(B=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[p,m,j,M,R,z]}),t[76]=j,t[77]=M,t[78]=R,t[79]=z,t[80]=p,t[81]=m,t[82]=B):B=t[82],B}function Oe(e){return(0,$.jsx)(`li`,{children:e.message},e.code)}function ke(e){return e.token}function Ae(e){return e.language}function je(){let e=(0,Q.c)(16),t=g(Me),n;e[0]===t?n=e[1]:(n=h(t),e[0]=t,e[1]=n);let r=n.remoteAccess.lan,i;e[2]!==r.subtitle||e[3]!==r.title?(i=(0,$.jsx)(X,{icon:U,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)(he,{children:[i,u]})}),e[13]=i,e[14]=u,e[15]=d):d=e[15],d}function Me(e){return e.language}function Ne(e){let t=(0,Q.c)(30),{embedded:n}=e,r=n===void 0?!1:n,i=g(Pe),a;t[0]===i?a=t[1]:(a=h(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 m(`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 _,v;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>void d(),v=(0,$.jsx)(c,{className:`mr-1 size-4`}),t[4]=_,t[5]=v):(_=t[4],v=t[5]);let y=s?o.copied:o.copy,b;t[6]===y?b=t[7]:(b=(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsxs)(p,{type:`button`,variant:`ghost`,onClick:_,children:[v,y]})}),t[6]=y,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)(X,{icon:F,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)(he,{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)(X,{icon:F,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)(he,{children:[w,T]}),t[27]=w,t[28]=T,t[29]=E):E=t[29],E}function Pe(e){return e.language}function Fe(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Ne,{embedded:!0}),e[0]=t):t=e[0],t}var Ie=[`guide`,`tailscale`,`public`,`reverse-proxy`,`ssh`,`lan`];function Le(e){return e&&Ie.includes(e)?e:`guide`}function Re(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)(z,{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)(be,{children:w}),t[24]=w,t[25]=e),e}return w}function ze(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)(b,{className:f(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,y)}),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`,v),t[3]=_):_=t[3];let E;t[4]===r?E=t[5]:(E=(0,$.jsx)(w,{className:`text-base font-semibold text-fg`,children:r}),t[4]=r,t[5]=E);let D;t[6]===i?D=t[7]:(D=(0,$.jsx)(x,{className:`mt-2 text-sm text-fg-muted`,children:i}),t[6]=i,t[7]=D);let O;t[8]===a?O=t[9]:(O=a.map(Be),t[8]=a,t[9]=O);let k;t[10]===O?k=t[11]:(k=(0,$.jsx)(`ul`,{className:`mt-4 list-disc space-y-2 pl-5 text-sm text-fg-muted`,children:O}),t[10]=O,t[11]=k);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]!==E||t[33]!==D||t[34]!==k?(R=(0,$.jsxs)(S,{children:[g,(0,$.jsxs)(C,{className:_,onOpenAutoFocus:Ve,children:[E,D,k,N,L]})]}),t[30]=N,t[31]=L,t[32]=E,t[33]=D,t[34]=k,t[35]=R):R=t[35];let z;return t[36]!==n||t[37]!==h||t[38]!==R?(z=(0,$.jsx)(T,{open:n,onOpenChange:h,children:R}),t[36]=n,t[37]=h,t[38]=R,t[39]=z):z=t[39],z}function Be(e){return(0,$.jsx)(`li`,{children:e},e)}function Ve(e){return e.preventDefault()}function He(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Ue=[`preparing_frpc`,`registering`,`starting_frpc`];function We(e){return e?e===`reconnecting_frpc`?Ue.indexOf(`starting_frpc`):Ue.indexOf(e):-1}function Ge(e,t){if(t.state===`connected`)return`done`;let n=t.startProgress?.phase,r=Ue.indexOf(e),i=We(n);return i<0?t.state===`connecting`||t.state===`reconnecting`?`active`:`pending`:r<i?`done`:r===i?`active`:`pending`}function Ke(e,t,n){let r=n.startProgress;return Ge(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 qe(e,t){switch(t){case`preparing_frpc`:return e.stepPrepareFrpc;case`registering`:return e.stepRegister;case`starting_frpc`:return e.stepFrpcLogin}}function Je(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 Ye(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(Xe),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=Je(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=Ue.map(e=>{let t=Ge(e,n),i=Ke(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)(P,{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:qe(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:[He(n.frpcDownload.bytesReceived),` /`,` `,He(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 Xe(e){return e+1}function Ze(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 Qe(e){return e.state===`connected`?`connected`:e.state===`error`?`error`:e.state===`connecting`||e.state===`reconnecting`||e.startProgress||e.frpcDownload?`progress`:`off`}function $e(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 et(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 tt(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=Qe(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(me(),`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`,$e(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`}):Ze(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,` `,et(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 ee;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?(ee=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)(I,{label:n.publicUrlLabel,text:r.publicUrl,labels:l})}):null,x?(0,$.jsx)(Ye,{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)(W,{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)(re,{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)(W,{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]=ee):ee=t[54];let H;return t[55]!==z||t[56]!==B||t[57]!==V||t[58]!==ee||t[59]!==T?(H=(0,$.jsxs)(`section`,{className:T,children:[z,B,V,ee]}),t[55]=z,t[56]=B,t[57]=V,t[58]=ee,t[59]=T,t[60]=H):H=t[60],H}var nt=`https://console.xopc.ai/access/client`,rt={reconfiguring:!1};function it(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)(ee,rt),{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&&!R(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 z=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`,V;t[15]===z?V=t[16]:(V=f(`flex size-9 shrink-0 items-center justify-center rounded-lg`,z),t[15]=z,t[16]=V);let H;t[17]===C?H=t[18]:(H=C?(0,$.jsx)(s,{className:`size-4`,strokeWidth:2,"aria-hidden":!0}):(0,$.jsx)(B,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[17]=C,t[18]=H);let U;t[19]!==V||t[20]!==H?(U=(0,$.jsx)(`span`,{className:V,children:H}),t[19]=V,t[20]=H,t[21]=U):U=t[21];let te=C?n.brokerSecretReadyTitle:n.brokerSecretStepTitle,W;t[22]===te?W=t[23]:(W=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:te}),t[22]=te,t[23]=W);let re=C?n.brokerSecretReadyHint:n.brokerSecretHint,G;t[24]===re?G=t[25]:(G=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:re}),t[24]=re,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]!==W||t[30]!==G||t[31]!==K?(q=(0,$.jsxs)(`div`,{children:[W,G,K]}),t[29]=W,t[30]=G,t[31]=K,t[32]=q):q=t[32];let ie;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?(ie=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:nt,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]=ie):ie=t[41];let ae;t[42]!==u||t[43]!==m||t[44]!==n.brokerSecretOpenAuthorization?(ae=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]=ae):ae=t[45];let J;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?(J=k?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:S,children:n.brokerSecretTitle}),(0,$.jsx)(ne,{id:S,value:a,labels:j,reveal:at,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)(ne,{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]=J):J=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 se;t[74]!==q||t[75]!==ie||t[76]!==ae||t[77]!==J||t[78]!==oe?(se=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[q,ie,ae,J,oe]}),t[74]=q,t[75]=ie,t[76]=ae,t[77]=J,t[78]=oe,t[79]=se):se=t[79];let ce;t[80]!==U||t[81]!==se?(ce=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[U,se]}),t[80]=U,t[81]=se,t[82]=ce):ce=t[82];let Y;t[83]!==ce||t[84]!==L?(Y=(0,$.jsx)(he,{className:L,children:ce}),t[83]=ce,t[84]=L,t[85]=Y):Y=t[85];let le;return t[86]!==x||t[87]!==Y?(le=(0,$.jsx)(`div`,{ref:x,id:`tunnel-broker-secret-setup`,children:Y}),t[86]=x,t[87]=Y,t[88]=le):le=t[88],le}function at(){return ie().then(ot)}function ot(e){return e.registrationSecret??null}var st={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 ct({embedded:e=!1}){let t=g(e=>e.language),n=h(t).tunnelSettings,r=!!_(e=>e.token),[i,a]=(0,Z.useReducer)(ee,st),{actionError:o,starting:s,stopping:c,savingAutoStart:l,consentOpen:m,autoStartConfirmOpen:v,releaseConfirmOpen:y,releasing:b,brokerSecretDraft:x,savingBrokerSecret:S,authorizingBrokerSecret:C,brokerSecretAuthorizationUrl:w,brokerSecretNotice:T}=i,N=(0,Z.useRef)(null),{data:P}=O(r),{data:F,error:I,isLoading:L,mutate:z}=E(r?`tunnel-status`:null,fe,{refreshInterval:e=>s?1e3:e?.frpcDownload||e?.state===`connecting`||e?.state===`reconnecting`?2e3:6e4}),B=(0,Z.useMemo)(()=>{let e=P?.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 F?.config?.autoStart===!0},[P,F?.config?.autoStart]),V=(0,Z.useMemo)(()=>{let e=P?.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``},[P]),H=R(V),U=F?.registrationSecret?.configured??H;(0,Z.useEffect)(()=>{let e=()=>{z()};return window.addEventListener(`tunnel-status`,e),()=>window.removeEventListener(`tunnel-status`,e)},[z]);let te=(0,Z.useMemo)(()=>[n.consentBullet1,n.consentBullet2,n.consentBullet3],[n.consentBullet1,n.consentBullet2,n.consentBullet3]),ne=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{starting:!0}});try{await le(),await z(),D()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{starting:!1}})}},[z]),W=(0,Z.useCallback)(()=>{if(!U){a({type:`patch`,patch:{actionError:n.brokerSecretRequiredBeforeStart}}),N.current?.scrollIntoView({behavior:`smooth`,block:`start`});return}if(F?.consentRequired){a({type:`patch`,patch:{consentOpen:!0}});return}ne()},[U,F?.consentRequired,ne,n.brokerSecretRequiredBeforeStart]),re=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{consentOpen:!1}}),a({type:`patch`,patch:{actionError:null}});try{await se(),await Promise.all([z(),ne()])}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}},[z,ne]),G=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{stopping:!0}});try{await de(),await z(),D()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{stopping:!1}})}},[z]),K=(0,Z.useCallback)(async e=>{a({type:`patch`,patch:{savingAutoStart:!0}}),a({type:`patch`,patch:{actionError:null}});try{await Y({autoStart:e}),D()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingAutoStart:!1}})}},[]),q=(0,Z.useCallback)(()=>{if(B){K(!1);return}if(F?.consentRequired){a({type:`patch`,patch:{actionError:n.consentExpiredBanner}});return}if(!F?.canAutoStart){a({type:`patch`,patch:{actionError:n.autoStartHint}});return}a({type:`patch`,patch:{autoStartConfirmOpen:!0}})},[K,F?.canAutoStart,F?.consentRequired,n,B]),ie=(0,Z.useCallback)(async()=>{let e=x.trim();if(e){a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await Y({registrationSecret:e}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretSaved}}),D(),await z(),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}})}}},[x,z,n.brokerSecretSaved]),ae=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await Y({registrationSecret:null}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretCleared}}),D(),await z()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingBrokerSecret:!1}})}},[z,n.brokerSecretCleared]),oe=(0,Z.useCallback)(async()=>{let e=_e(),t=null,r=null;a({type:`patch`,patch:{authorizingBrokerSecret:!0,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null,actionError:null}});try{for(t=(await k(`xopc-tunnel`)).sessionId;;){await new Promise(e=>window.setTimeout(e,1e3));let i=await j(t);if(i.authUrl&&i.authUrl!==r&&(r=i.authUrl,a({type:`patch`,patch:{brokerSecretAuthorizationUrl:i.authUrl}}),await ge(i.authUrl,e)),i.status===`failed`||i.status===`cancelled`)throw Error(i.error??i.message??`OAuth authorization failed`);if(i.status===`completed`){await ue(),await Promise.all([z(),D()]),a({type:`patch`,patch:{brokerSecretNotice:n.brokerSecretSaved,brokerSecretDraft:``}});return}}}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{ve(e),t&&A(t).catch(()=>void 0),a({type:`patch`,patch:{authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null}})}},[z,n.brokerSecretSaved]),ce=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{releaseConfirmOpen:!1,actionError:null,releasing:!0}});try{await de({release:!0}),await z(),D()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{releasing:!1}})}},[z]),pe=(0,Z.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:h(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=F??{enabled:!1,state:`disconnected`,subdomain:null,publicUrl:null,connectedSince:null,frpcPid:null,lastHeartbeatAt:null,lastError:null,consentRequired:!0,config:{autoStart:B,brokerUrl:`https://frp.xopc.ai/api`}},me=F?.consentRequired&&(X.enabled||B||F?.consent?.acceptedAt),ye=(0,$.jsx)(it,{t:n,brokerSecretReady:U,brokerSecretConfiguredInConfig:H,brokerSecretMaskedValue:H?V:``,brokerSecretDraft:x,savingBrokerSecret:S,authorizingBrokerSecret:C,brokerSecretAuthorizationUrl:w,brokerSecretNotice:T,copyFailedLabel:h(t).clipboard.copyFailed,onDraftChange:e=>a({type:`patch`,patch:{brokerSecretDraft:e}}),onSave:()=>void ie(),onAuthorize:()=>void oe(),onClear:()=>void ae(),sectionRef:N}),be=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ze,{open:m,title:n.consentTitle,intro:n.consentIntro,bullets:te,checkboxLabel:n.consentCheckbox,confirmLabel:me?n.consentReconfirm:n.consentConfirm,cancelLabel:n.consentCancel,onConfirm:()=>void re(),onCancel:()=>a({type:`patch`,patch:{consentOpen:!1}})},m?`consent-open`:`consent-closed`),(0,$.jsx)(M,{open:v,title:n.autoStartConfirmTitle,description:n.autoStartConfirmBody,confirmLabel:n.autoStartConfirmLabel,cancelLabel:n.consentCancel,onConfirm:()=>{a({type:`patch`,patch:{autoStartConfirmOpen:!1}}),K(!0)},onCancel:()=>a({type:`patch`,patch:{autoStartConfirmOpen:!1}})}),(0,$.jsx)(M,{open:y,title:n.releaseConfirmTitle,description:n.releaseConfirmBody,confirmLabel:n.releaseConfirmLabel,cancelLabel:n.consentCancel,destructive:!0,onConfirm:()=>void ce(),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,ye,(0,$.jsx)(tt,{t:n,status:X,isLoading:L,statusErr:I,starting:s,stopping:c,showConsentExpired:!!me,copyLabels:pe,startDisabled:!U,startDisabledReason:U?void 0:n.brokerSecretRequiredBeforeStart,stepLabel:n.flowStepStart,onStart:W,onStop:()=>void G()}),(0,$.jsxs)(Re,{showLabel:n.showOptions,hideLabel:n.hideOptions,children:[(0,$.jsxs)(`label`,{className:f(`flex items-center gap-3 text-sm text-fg`,!B&&!F?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:B,disabled:l||!B&&!F?.canAutoStart,onChange:q}),n.autoStart]}),!F?.canAutoStart&&!B?(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:b||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[b?(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)(Re,{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)(J,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]})}),be]}):(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,ye,(0,$.jsx)(tt,{t:n,status:X,isLoading:L,statusErr:I,starting:s,stopping:c,showConsentExpired:!!me,copyLabels:pe,startDisabled:!U,startDisabledReason:U?void 0:n.brokerSecretRequiredBeforeStart,onStart:W,onStop:()=>void G()}),X.subdomain||X.publicUrl?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,$.jsxs)(p,{type:`button`,variant:`secondary`,disabled:b||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[b?(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)(he,{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`,!B&&!F?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:B,disabled:l||!B&&!F?.canAutoStart,onChange:q}),n.autoStart]}),!F?.canAutoStart&&!B?(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)(J,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]}),be]})}function lt(e,t){return e.tabs[t]}function ut(e,t){return e.tabIntro[t]}function dt(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 ft(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)(De,{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)(ce,{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)(ct,{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)(ae,{}),t[4]=e):e=t[4],e}case`ssh`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Fe,{}),t[5]=e):e=t[5],e}case`lan`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(je,{}),t[6]=e):e=t[6],e}}}function pt(){let e=(0,Q.c)(3),t=i(),n=g(ht),r=h(n).remoteAccess,o=!!_(mt),[s,c]=a(),l=Le(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=E(u?`mobile-pairing-readiness`:null,oe,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 v=m,y=ut(r,l),b=Ie.map(e=>({id:e,label:lt(r,e)}));return(0,$.jsxs)(K,{children:[(0,$.jsx)(G,{title:r.pageTitle,subtitle:r.pageSubtitle,meta:(0,$.jsx)(J,{language:n,label:r.docsLink,section:dt(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)(H,{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)(te,{className:`size-4`,"aria-hidden":!0})]})]}):null,(0,$.jsx)(ye,{items:b,activeTab:l,onChange:v,ariaLabel:r.tabsAria,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`}),(0,$.jsx)(q,{id:l,activeTab:l,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`,title:lt(r,l),hint:l===`public`?void 0:y,children:(0,$.jsx)(ft,{tab:l,onOpenTab:v})})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.guide.needToken})]})}function mt(e){return e.token}function ht(e){return e.language}export{pt 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{t as m}from"./copy-to-clipboard-HOJ79TWv.js";import{t as h}from"./messages-B1HDp_j8.js";import{n as g,s as _}from"./locale-store-XDFAPNNu.js";import{i as v,o as y}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{a as b,i as x,o as S,r as C,s as w,t as T}from"./dist-BPoKqzeH.js";import{i as E}from"./vendor-swr-BIWyz7Rc.js";import{n as D,r as O}from"./gateway-config-swr-DfMY-MLf.js";import{a as k,n as A,r as j}from"./oauth-api-B_pcOUfT.js";import{Di as M,Ns as N,Uc as P,Uo as F,di as I,el as L,fn as R,nl as z,oc as B,rs as V,sa as ee,ts as H,us as U,vl as te,wo as ne,ys as W,zo as re}from"./index-DKP23eMn.js";import{n as G,r as K,t as q}from"./settings-page-layout-BRQNel6r.js";import{a as ie,c as ae,d as J,g as oe,i as se,l as ce,n as Y,o as le,r as ue,s as de,t as fe,u as pe}from"./tunnel-api-D5-Hggt3.js";import{n as X,r as me,t as he}from"./settings-form-section-BkdLf_sS.js";import{n as ge,r as _e,t as ve}from"./oauth-authorization-window-Cdolr2wE.js";import{t as ye}from"./page-tabs-BaEQMYm_.js";import{t as be}from"./settings-advanced-gate-_J5FSEYX.js";var Z=e(t(),1),Q=n(),$=r();function xe(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 Se(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`,xe(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 Ce(e){let t=(0,Q.c)(31),{onOpenTab:n}=e,r=g(Te),i;t[0]===r?i=t[1]:(i=h(r),t[0]=r,t[1]=i);let a=i.remoteAccess.guide,o=!!_(we),s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={refreshInterval:3e4},t[2]=s):s=t[2];let{data:c}=E(o?`exposure-status`:null,pe,s),l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l={refreshInterval:15e3},t[3]=l):l=t[3];let{data:d}=E(o?`tunnel-status`:null,fe,l),p=O(o);if(!o)return null;let m=c?.tailscale.active===!0,v=d?.state,y=d?.enabled&&v===`connected`,b=d?.enabled&&(v===`connecting`||v===`reconnecting`||!!d?.startProgress||!!d?.frpcDownload),x=p.data?.payload?.config,S=!!(x&&typeof x==`object`&&!Array.isArray(x)&&x.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 D=y?`active`:b?`connecting`:`off`,k=y?a.statusActive:b?a.statusConnecting:a.statusOff,A;t[8]!==a.publicCardTitle||t[9]!==D||t[10]!==k?(A={tab:`public`,icon:N,title:a.publicCardTitle,kind:D,statusLabel:k},t[8]=a.publicCardTitle,t[9]=D,t[10]=k,t[11]=A):A=t[11];let j=S?`active`:`off`,M=S?a.statusActive:a.statusOff,P;t[12]!==a.reverseProxyCardTitle||t[13]!==j||t[14]!==M?(P={tab:`reverse-proxy`,icon:V,title:a.reverseProxyCardTitle,kind:j,statusLabel:M},t[12]=a.reverseProxyCardTitle,t[13]=j,t[14]=M,t[15]=P):P=t[15];let I;t[16]!==a.sshCardStatus||t[17]!==a.sshCardTitle?(I={tab:`ssh`,icon:F,title:a.sshCardTitle,kind:`off`,statusLabel:a.sshCardStatus},t[16]=a.sshCardStatus,t[17]=a.sshCardTitle,t[18]=I):I=t[18];let L;t[19]!==a.lanCardStatus||t[20]!==a.lanCardTitle?(L={tab:`lan`,icon:U,title:a.lanCardTitle,kind:`off`,statusLabel:a.lanCardStatus},t[19]=a.lanCardStatus,t[20]=a.lanCardTitle,t[21]=L):L=t[21];let R;t[22]!==P||t[23]!==I||t[24]!==L||t[25]!==T||t[26]!==A?(R=[T,A,P,I,L],t[22]=P,t[23]=I,t[24]=L,t[25]=T,t[26]=A,t[27]=R):R=t[27];let z=R,B;return t[28]!==z||t[29]!==n?(B=(0,$.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5`,children:z.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)(Se,{label:e.statusLabel,kind:e.kind})]})]},`${e.tab}-${e.title}`)})}),t[28]=z,t[29]=n,t[30]=B):B=t[30],B}function we(e){return e.token}function Te(e){return e.language}function Ee(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)(L,{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 De(e){let t=(0,Q.c)(83),{onOpenTab:n}=e,r=g(Ae),i;t[0]===r?i=t[1]:(i=h(r),t[0]=r,t[1]=i);let a=i.remoteAccess,o=a.guide,s=!!_(ke),c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c={refreshInterval:3e4},t[2]=c):c=t[2];let{data:l}=E(s?`exposure-status`:null,pe,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)(Ce,{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(Oe)})]}):null,t[9]=f,t[10]=o.conflictsHint,t[11]=o.conflictsTitle,t[12]=m):m=t[12];let v;t[13]===o.pickMethod?v=t[14]:(v=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:o.pickMethod}),t[13]=o.pickMethod,t[14]=v);let y;t[15]===n?y=t[16]:(y=()=>n(`tailscale`),t[15]=n,t[16]=y);let b;t[17]!==o.configure||t[18]!==o.recommended||t[19]!==o.tailscaleCardDesc||t[20]!==o.tailscaleCardTitle||t[21]!==y?(b=(0,$.jsx)(Ee,{icon:u,title:o.tailscaleCardTitle,description:o.tailscaleCardDesc,recommended:!0,recommendedLabel:o.recommended,openLabel:o.configure,onOpen:y}),t[17]=o.configure,t[18]=o.recommended,t[19]=o.tailscaleCardDesc,t[20]=o.tailscaleCardTitle,t[21]=y,t[22]=b):b=t[22];let x;t[23]===n?x=t[24]:(x=()=>n(`public`),t[23]=n,t[24]=x);let S;t[25]!==o.configure||t[26]!==o.publicCardDesc||t[27]!==o.publicCardTitle||t[28]!==x?(S=(0,$.jsx)(Ee,{icon:N,title:o.publicCardTitle,description:o.publicCardDesc,openLabel:o.configure,onOpen:x}),t[25]=o.configure,t[26]=o.publicCardDesc,t[27]=o.publicCardTitle,t[28]=x,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)(Ee,{icon:V,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 D;t[39]!==o.configure||t[40]!==o.sshCardDesc||t[41]!==o.sshCardTitle||t[42]!==T?(D=(0,$.jsx)(Ee,{icon:F,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]=D):D=t[43];let O;t[44]===n?O=t[45]:(O=()=>n(`lan`),t[44]=n,t[45]=O);let k;t[46]!==o.configure||t[47]!==o.lanCardDesc||t[48]!==o.lanCardTitle||t[49]!==O?(k=(0,$.jsx)(Ee,{icon:U,title:o.lanCardTitle,description:o.lanCardDesc,openLabel:o.configure,onOpen:O}),t[46]=o.configure,t[47]=o.lanCardDesc,t[48]=o.lanCardTitle,t[49]=O,t[50]=k):k=t[50];let A;t[51]!==S||t[52]!==w||t[53]!==D||t[54]!==k||t[55]!==b?(A=(0,$.jsxs)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:[b,S,w,D,k]}),t[51]=S,t[52]=w,t[53]=D,t[54]=k,t[55]=b,t[56]=A):A=t[56];let j;t[57]!==A||t[58]!==v?(j=(0,$.jsxs)(`div`,{children:[v,A]}),t[57]=A,t[58]=v,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 P;t[62]===a.advanced.proxyTitle?P=t[63]:(P=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.advanced.proxyTitle}),t[62]=a.advanced.proxyTitle,t[63]=P);let I;t[64]===a.advanced.proxyBody?I=t[65]:(I=(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:a.advanced.proxyBody}),t[64]=a.advanced.proxyBody,t[65]=I);let L;t[66]!==r||t[67]!==a.advanced.proxyDocs?(L=(0,$.jsx)(J,{language:r,label:a.advanced.proxyDocs,section:`advanced`,className:`mt-2`}),t[66]=r,t[67]=a.advanced.proxyDocs,t[68]=L):L=t[68];let R;t[69]!==P||t[70]!==I||t[71]!==L?(R=(0,$.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-4 py-3`,children:[P,I,L]}),t[69]=P,t[70]=I,t[71]=L,t[72]=R):R=t[72];let z;t[73]!==o.docsLink||t[74]!==r?(z=(0,$.jsx)(J,{language:r,label:o.docsLink}),t[73]=o.docsLink,t[74]=r,t[75]=z):z=t[75];let B;return t[76]!==j||t[77]!==M||t[78]!==R||t[79]!==z||t[80]!==p||t[81]!==m?(B=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[p,m,j,M,R,z]}),t[76]=j,t[77]=M,t[78]=R,t[79]=z,t[80]=p,t[81]=m,t[82]=B):B=t[82],B}function Oe(e){return(0,$.jsx)(`li`,{children:e.message},e.code)}function ke(e){return e.token}function Ae(e){return e.language}function je(){let e=(0,Q.c)(16),t=g(Me),n;e[0]===t?n=e[1]:(n=h(t),e[0]=t,e[1]=n);let r=n.remoteAccess.lan,i;e[2]!==r.subtitle||e[3]!==r.title?(i=(0,$.jsx)(X,{icon:U,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)(he,{children:[i,u]})}),e[13]=i,e[14]=u,e[15]=d):d=e[15],d}function Me(e){return e.language}function Ne(e){let t=(0,Q.c)(30),{embedded:n}=e,r=n===void 0?!1:n,i=g(Pe),a;t[0]===i?a=t[1]:(a=h(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 m(`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 _,v;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>void d(),v=(0,$.jsx)(c,{className:`mr-1 size-4`}),t[4]=_,t[5]=v):(_=t[4],v=t[5]);let y=s?o.copied:o.copy,b;t[6]===y?b=t[7]:(b=(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsxs)(p,{type:`button`,variant:`ghost`,onClick:_,children:[v,y]})}),t[6]=y,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)(X,{icon:F,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)(he,{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)(X,{icon:F,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)(he,{children:[w,T]}),t[27]=w,t[28]=T,t[29]=E):E=t[29],E}function Pe(e){return e.language}function Fe(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Ne,{embedded:!0}),e[0]=t):t=e[0],t}var Ie=[`guide`,`tailscale`,`public`,`reverse-proxy`,`ssh`,`lan`];function Le(e){return e&&Ie.includes(e)?e:`guide`}function Re(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)(z,{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)(be,{children:w}),t[24]=w,t[25]=e),e}return w}function ze(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)(b,{className:f(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,y)}),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`,v),t[3]=_):_=t[3];let E;t[4]===r?E=t[5]:(E=(0,$.jsx)(w,{className:`text-base font-semibold text-fg`,children:r}),t[4]=r,t[5]=E);let D;t[6]===i?D=t[7]:(D=(0,$.jsx)(x,{className:`mt-2 text-sm text-fg-muted`,children:i}),t[6]=i,t[7]=D);let O;t[8]===a?O=t[9]:(O=a.map(Be),t[8]=a,t[9]=O);let k;t[10]===O?k=t[11]:(k=(0,$.jsx)(`ul`,{className:`mt-4 list-disc space-y-2 pl-5 text-sm text-fg-muted`,children:O}),t[10]=O,t[11]=k);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]!==E||t[33]!==D||t[34]!==k?(R=(0,$.jsxs)(S,{children:[g,(0,$.jsxs)(C,{className:_,onOpenAutoFocus:Ve,children:[E,D,k,N,L]})]}),t[30]=N,t[31]=L,t[32]=E,t[33]=D,t[34]=k,t[35]=R):R=t[35];let z;return t[36]!==n||t[37]!==h||t[38]!==R?(z=(0,$.jsx)(T,{open:n,onOpenChange:h,children:R}),t[36]=n,t[37]=h,t[38]=R,t[39]=z):z=t[39],z}function Be(e){return(0,$.jsx)(`li`,{children:e},e)}function Ve(e){return e.preventDefault()}function He(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Ue=[`preparing_frpc`,`registering`,`starting_frpc`];function We(e){return e?e===`reconnecting_frpc`?Ue.indexOf(`starting_frpc`):Ue.indexOf(e):-1}function Ge(e,t){if(t.state===`connected`)return`done`;let n=t.startProgress?.phase,r=Ue.indexOf(e),i=We(n);return i<0?t.state===`connecting`||t.state===`reconnecting`?`active`:`pending`:r<i?`done`:r===i?`active`:`pending`}function Ke(e,t,n){let r=n.startProgress;return Ge(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 qe(e,t){switch(t){case`preparing_frpc`:return e.stepPrepareFrpc;case`registering`:return e.stepRegister;case`starting_frpc`:return e.stepFrpcLogin}}function Je(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 Ye(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(Xe),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=Je(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=Ue.map(e=>{let t=Ge(e,n),i=Ke(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)(P,{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:qe(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:[He(n.frpcDownload.bytesReceived),` /`,` `,He(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 Xe(e){return e+1}function Ze(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 Qe(e){return e.state===`connected`?`connected`:e.state===`error`?`error`:e.state===`connecting`||e.state===`reconnecting`||e.startProgress||e.frpcDownload?`progress`:`off`}function $e(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 et(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 tt(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=Qe(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(me(),`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`,$e(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`}):Ze(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,` `,et(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 ee;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?(ee=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)(I,{label:n.publicUrlLabel,text:r.publicUrl,labels:l})}):null,x?(0,$.jsx)(Ye,{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)(W,{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)(re,{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)(W,{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]=ee):ee=t[54];let H;return t[55]!==z||t[56]!==B||t[57]!==V||t[58]!==ee||t[59]!==T?(H=(0,$.jsxs)(`section`,{className:T,children:[z,B,V,ee]}),t[55]=z,t[56]=B,t[57]=V,t[58]=ee,t[59]=T,t[60]=H):H=t[60],H}var nt=`https://console.xopc.ai/access/client`,rt={reconfiguring:!1};function it(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)(ee,rt),{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&&!R(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 z=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`,V;t[15]===z?V=t[16]:(V=f(`flex size-9 shrink-0 items-center justify-center rounded-lg`,z),t[15]=z,t[16]=V);let H;t[17]===C?H=t[18]:(H=C?(0,$.jsx)(s,{className:`size-4`,strokeWidth:2,"aria-hidden":!0}):(0,$.jsx)(B,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[17]=C,t[18]=H);let U;t[19]!==V||t[20]!==H?(U=(0,$.jsx)(`span`,{className:V,children:H}),t[19]=V,t[20]=H,t[21]=U):U=t[21];let te=C?n.brokerSecretReadyTitle:n.brokerSecretStepTitle,W;t[22]===te?W=t[23]:(W=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:te}),t[22]=te,t[23]=W);let re=C?n.brokerSecretReadyHint:n.brokerSecretHint,G;t[24]===re?G=t[25]:(G=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:re}),t[24]=re,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]!==W||t[30]!==G||t[31]!==K?(q=(0,$.jsxs)(`div`,{children:[W,G,K]}),t[29]=W,t[30]=G,t[31]=K,t[32]=q):q=t[32];let ie;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?(ie=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:nt,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]=ie):ie=t[41];let ae;t[42]!==u||t[43]!==m||t[44]!==n.brokerSecretOpenAuthorization?(ae=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]=ae):ae=t[45];let J;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?(J=k?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:S,children:n.brokerSecretTitle}),(0,$.jsx)(ne,{id:S,value:a,labels:j,reveal:at,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)(ne,{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]=J):J=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 se;t[74]!==q||t[75]!==ie||t[76]!==ae||t[77]!==J||t[78]!==oe?(se=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[q,ie,ae,J,oe]}),t[74]=q,t[75]=ie,t[76]=ae,t[77]=J,t[78]=oe,t[79]=se):se=t[79];let ce;t[80]!==U||t[81]!==se?(ce=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[U,se]}),t[80]=U,t[81]=se,t[82]=ce):ce=t[82];let Y;t[83]!==ce||t[84]!==L?(Y=(0,$.jsx)(he,{className:L,children:ce}),t[83]=ce,t[84]=L,t[85]=Y):Y=t[85];let le;return t[86]!==x||t[87]!==Y?(le=(0,$.jsx)(`div`,{ref:x,id:`tunnel-broker-secret-setup`,children:Y}),t[86]=x,t[87]=Y,t[88]=le):le=t[88],le}function at(){return ie().then(ot)}function ot(e){return e.registrationSecret??null}var st={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 ct({embedded:e=!1}){let t=g(e=>e.language),n=h(t).tunnelSettings,r=!!_(e=>e.token),[i,a]=(0,Z.useReducer)(ee,st),{actionError:o,starting:s,stopping:c,savingAutoStart:l,consentOpen:m,autoStartConfirmOpen:v,releaseConfirmOpen:y,releasing:b,brokerSecretDraft:x,savingBrokerSecret:S,authorizingBrokerSecret:C,brokerSecretAuthorizationUrl:w,brokerSecretNotice:T}=i,N=(0,Z.useRef)(null),{data:P}=O(r),{data:F,error:I,isLoading:L,mutate:z}=E(r?`tunnel-status`:null,fe,{refreshInterval:e=>s?1e3:e?.frpcDownload||e?.state===`connecting`||e?.state===`reconnecting`?2e3:6e4}),B=(0,Z.useMemo)(()=>{let e=P?.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 F?.config?.autoStart===!0},[P,F?.config?.autoStart]),V=(0,Z.useMemo)(()=>{let e=P?.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``},[P]),H=R(V),U=F?.registrationSecret?.configured??H;(0,Z.useEffect)(()=>{let e=()=>{z()};return window.addEventListener(`tunnel-status`,e),()=>window.removeEventListener(`tunnel-status`,e)},[z]);let te=(0,Z.useMemo)(()=>[n.consentBullet1,n.consentBullet2,n.consentBullet3],[n.consentBullet1,n.consentBullet2,n.consentBullet3]),ne=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{starting:!0}});try{await le(),await z(),D()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{starting:!1}})}},[z]),W=(0,Z.useCallback)(()=>{if(!U){a({type:`patch`,patch:{actionError:n.brokerSecretRequiredBeforeStart}}),N.current?.scrollIntoView({behavior:`smooth`,block:`start`});return}if(F?.consentRequired){a({type:`patch`,patch:{consentOpen:!0}});return}ne()},[U,F?.consentRequired,ne,n.brokerSecretRequiredBeforeStart]),re=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{consentOpen:!1}}),a({type:`patch`,patch:{actionError:null}});try{await se(),await Promise.all([z(),ne()])}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}},[z,ne]),G=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{stopping:!0}});try{await de(),await z(),D()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{stopping:!1}})}},[z]),K=(0,Z.useCallback)(async e=>{a({type:`patch`,patch:{savingAutoStart:!0}}),a({type:`patch`,patch:{actionError:null}});try{await Y({autoStart:e}),D()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingAutoStart:!1}})}},[]),q=(0,Z.useCallback)(()=>{if(B){K(!1);return}if(F?.consentRequired){a({type:`patch`,patch:{actionError:n.consentExpiredBanner}});return}if(!F?.canAutoStart){a({type:`patch`,patch:{actionError:n.autoStartHint}});return}a({type:`patch`,patch:{autoStartConfirmOpen:!0}})},[K,F?.canAutoStart,F?.consentRequired,n,B]),ie=(0,Z.useCallback)(async()=>{let e=x.trim();if(e){a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await Y({registrationSecret:e}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretSaved}}),D(),await z(),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}})}}},[x,z,n.brokerSecretSaved]),ae=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await Y({registrationSecret:null}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretCleared}}),D(),await z()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingBrokerSecret:!1}})}},[z,n.brokerSecretCleared]),oe=(0,Z.useCallback)(async()=>{let e=_e(),t=null,r=null;a({type:`patch`,patch:{authorizingBrokerSecret:!0,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null,actionError:null}});try{for(t=(await k(`xopc-tunnel`)).sessionId;;){await new Promise(e=>window.setTimeout(e,1e3));let i=await j(t);if(i.authUrl&&i.authUrl!==r&&(r=i.authUrl,a({type:`patch`,patch:{brokerSecretAuthorizationUrl:i.authUrl}}),await ge(i.authUrl,e)),i.status===`failed`||i.status===`cancelled`)throw Error(i.error??i.message??`OAuth authorization failed`);if(i.status===`completed`){await ue(),await Promise.all([z(),D()]),a({type:`patch`,patch:{brokerSecretNotice:n.brokerSecretSaved,brokerSecretDraft:``}});return}}}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{ve(e),t&&A(t).catch(()=>void 0),a({type:`patch`,patch:{authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null}})}},[z,n.brokerSecretSaved]),ce=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{releaseConfirmOpen:!1,actionError:null,releasing:!0}});try{await de({release:!0}),await z(),D()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{releasing:!1}})}},[z]),pe=(0,Z.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:h(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=F??{enabled:!1,state:`disconnected`,subdomain:null,publicUrl:null,connectedSince:null,frpcPid:null,lastHeartbeatAt:null,lastError:null,consentRequired:!0,config:{autoStart:B,brokerUrl:`https://frp.xopc.ai/api`}},me=F?.consentRequired&&(X.enabled||B||F?.consent?.acceptedAt),ye=(0,$.jsx)(it,{t:n,brokerSecretReady:U,brokerSecretConfiguredInConfig:H,brokerSecretMaskedValue:H?V:``,brokerSecretDraft:x,savingBrokerSecret:S,authorizingBrokerSecret:C,brokerSecretAuthorizationUrl:w,brokerSecretNotice:T,copyFailedLabel:h(t).clipboard.copyFailed,onDraftChange:e=>a({type:`patch`,patch:{brokerSecretDraft:e}}),onSave:()=>void ie(),onAuthorize:()=>void oe(),onClear:()=>void ae(),sectionRef:N}),be=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ze,{open:m,title:n.consentTitle,intro:n.consentIntro,bullets:te,checkboxLabel:n.consentCheckbox,confirmLabel:me?n.consentReconfirm:n.consentConfirm,cancelLabel:n.consentCancel,onConfirm:()=>void re(),onCancel:()=>a({type:`patch`,patch:{consentOpen:!1}})},m?`consent-open`:`consent-closed`),(0,$.jsx)(M,{open:v,title:n.autoStartConfirmTitle,description:n.autoStartConfirmBody,confirmLabel:n.autoStartConfirmLabel,cancelLabel:n.consentCancel,onConfirm:()=>{a({type:`patch`,patch:{autoStartConfirmOpen:!1}}),K(!0)},onCancel:()=>a({type:`patch`,patch:{autoStartConfirmOpen:!1}})}),(0,$.jsx)(M,{open:y,title:n.releaseConfirmTitle,description:n.releaseConfirmBody,confirmLabel:n.releaseConfirmLabel,cancelLabel:n.consentCancel,destructive:!0,onConfirm:()=>void ce(),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,ye,(0,$.jsx)(tt,{t:n,status:X,isLoading:L,statusErr:I,starting:s,stopping:c,showConsentExpired:!!me,copyLabels:pe,startDisabled:!U,startDisabledReason:U?void 0:n.brokerSecretRequiredBeforeStart,stepLabel:n.flowStepStart,onStart:W,onStop:()=>void G()}),(0,$.jsxs)(Re,{showLabel:n.showOptions,hideLabel:n.hideOptions,children:[(0,$.jsxs)(`label`,{className:f(`flex items-center gap-3 text-sm text-fg`,!B&&!F?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:B,disabled:l||!B&&!F?.canAutoStart,onChange:q}),n.autoStart]}),!F?.canAutoStart&&!B?(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:b||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[b?(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)(Re,{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)(J,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]})}),be]}):(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,ye,(0,$.jsx)(tt,{t:n,status:X,isLoading:L,statusErr:I,starting:s,stopping:c,showConsentExpired:!!me,copyLabels:pe,startDisabled:!U,startDisabledReason:U?void 0:n.brokerSecretRequiredBeforeStart,onStart:W,onStop:()=>void G()}),X.subdomain||X.publicUrl?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,$.jsxs)(p,{type:`button`,variant:`secondary`,disabled:b||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[b?(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)(he,{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`,!B&&!F?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:B,disabled:l||!B&&!F?.canAutoStart,onChange:q}),n.autoStart]}),!F?.canAutoStart&&!B?(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)(J,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]}),be]})}function lt(e,t){return e.tabs[t]}function ut(e,t){return e.tabIntro[t]}function dt(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 ft(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)(De,{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)(ce,{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)(ct,{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)(ae,{}),t[4]=e):e=t[4],e}case`ssh`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Fe,{}),t[5]=e):e=t[5],e}case`lan`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(je,{}),t[6]=e):e=t[6],e}}}function pt(){let e=(0,Q.c)(3),t=i(),n=g(ht),r=h(n).remoteAccess,o=!!_(mt),[s,c]=a(),l=Le(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=E(u?`mobile-pairing-readiness`:null,oe,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 v=m,y=ut(r,l),b=Ie.map(e=>({id:e,label:lt(r,e)}));return(0,$.jsxs)(K,{children:[(0,$.jsx)(G,{title:r.pageTitle,subtitle:r.pageSubtitle,meta:(0,$.jsx)(J,{language:n,label:r.docsLink,section:dt(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)(H,{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)(te,{className:`size-4`,"aria-hidden":!0})]})]}):null,(0,$.jsx)(ye,{items:b,activeTab:l,onChange:v,ariaLabel:r.tabsAria,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`}),(0,$.jsx)(q,{id:l,activeTab:l,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`,title:lt(r,l),hint:l===`public`?void 0:y,children:(0,$.jsx)(ft,{tab:l,onOpenTab:v})})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.guide.needToken})]})}function mt(e){return e.token}function ht(e){return e.language}export{pt 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-DBrVS3tZ.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-B1HDp_j8.js";import{a as l,i as u,n as d,r as f}from"./locale-store-XDFAPNNu.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{Qc as m,ms as h,ps as g}from"./index-C73V7tJP.js";import{n as _,r as v}from"./settings-page-layout-BRQNel6r.js";import{n as y}from"./settings-loading-skeleton-CAmWMaOT.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,`
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-DBrVS3tZ.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-B1HDp_j8.js";import{a as l,i as u,n as d,r as f}from"./locale-store-XDFAPNNu.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{Qc as m,ms as h,ps as g}from"./index-DKP23eMn.js";import{n as _,r as v}from"./settings-page-layout-BRQNel6r.js";import{n as y}from"./settings-loading-skeleton-CAmWMaOT.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-DBrVS3tZ.js";import{t as a}from"./cn-JdwAhgNB.js";import{wo as o,xo as s}from"./index-C73V7tJP.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)(o,{value:a,onChange:u,placeholder:p,labels:s,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-DBrVS3tZ.js";import{t as a}from"./cn-JdwAhgNB.js";import{wo as o,xo as s}from"./index-DKP23eMn.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)(o,{value:a,onChange:u,placeholder:p,labels:s,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};