@undefineds.co/xpod 0.4.25 → 0.4.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/ApiServer.d.ts +1 -0
- package/dist/api/ApiServer.js +38 -0
- package/dist/api/ai-config/AiConfigStore.js +18 -6
- package/dist/api/ai-gateway/connect/index.d.ts +1 -0
- package/dist/api/ai-gateway/connect/index.js +39 -18
- package/dist/api/ai-gateway/models/ProviderModelsAdapter.js +5 -2
- package/dist/api/container/common.js +8 -2
- package/dist/api/container/index.js +2 -2
- package/dist/api/container/local.js +6 -3
- package/dist/api/handlers/AiGatewayHandler.d.ts +1 -0
- package/dist/api/handlers/AiGatewayHandler.js +53 -3
- package/dist/api/handlers/AiGatewayManagementHandler.js +9 -0
- package/dist/api/handlers/TaskHandler.js +15 -10
- package/dist/api/network/NetworkEnvironmentConfigurationStore.js +1 -1
- package/dist/api/runs/ManagedRunWorker.d.ts +0 -1
- package/dist/api/runs/ManagedRunWorker.js +2 -14
- package/dist/api/runs/PiAgentRuntimeDriver.d.ts +0 -8
- package/dist/api/runs/PiAgentRuntimeDriver.js +65 -21
- package/dist/api/runs/RunStateCenter.js +1 -0
- package/dist/api/runs/store.d.ts +1 -0
- package/dist/api/runs/store.js +13 -0
- package/dist/api/tasks/TaskMaterializer.js +13 -6
- package/dist/api/tasks/TaskResumeDiagnostics.d.ts +28 -0
- package/dist/api/tasks/TaskResumeDiagnostics.js +148 -0
- package/dist/api/tasks/TaskService.js +40 -23
- package/dist/storage/conditions/StorageETagHandler.d.ts +1 -1
- package/dist/storage/conditions/StorageETagHandler.js +13 -4
- package/dist/util/task-model-diagnostics.d.ts +67 -0
- package/dist/util/task-model-diagnostics.js +118 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiApiKeyPool.d.ts +1 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiApiKeyPool.js +2 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiConnectDialog.d.ts +1 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiCredentialPoolSection.d.ts +1 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiCredentialPoolSection.js +10 -10
- package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeyRow.d.ts +3 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeyRow.js +2 -2
- package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeysSection.js +77 -23
- package/node_modules/@undefineds.co/ai-connections/dist/AiProviderCard.d.ts +1 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiSortableCredentialList.js +59 -59
- package/node_modules/@undefineds.co/ai-connections/dist/collection-runtime.js +2 -0
- package/node_modules/@undefineds.co/ai-connections/dist/collections.js +14 -6
- package/node_modules/@undefineds.co/ai-connections/dist/contract/ai-connections-client.d.ts +2 -1
- package/node_modules/@undefineds.co/ai-connections/dist/contract/ai-connections-client.js +1 -0
- package/node_modules/@undefineds.co/ai-connections/dist/contract/client/gateway-model-roles.d.ts +11 -0
- package/node_modules/@undefineds.co/ai-connections/dist/contract/client/gateway-model-roles.js +11 -0
- package/node_modules/@undefineds.co/ai-connections/dist/contract/client/normalize.d.ts +2 -1
- package/node_modules/@undefineds.co/ai-connections/dist/contract/client/normalize.js +12 -5
- package/node_modules/@undefineds.co/ai-connections/dist/contract/client/request.js +10 -2
- package/node_modules/@undefineds.co/ai-connections/dist/contract/client/types.d.ts +10 -0
- package/node_modules/@undefineds.co/ai-connections/package.json +1 -1
- package/node_modules/@undefineds.co/extension-sdk/dist/web.d.ts +1 -0
- package/node_modules/@undefineds.co/extension-sdk/package.json +1 -1
- package/node_modules/@undefineds.co/pod-collections/dist/index.cjs +60 -13
- package/node_modules/@undefineds.co/pod-collections/dist/mapping.d.ts +16 -1
- package/node_modules/@undefineds.co/pod-collections/dist/mapping.js +51 -0
- package/node_modules/@undefineds.co/pod-collections/dist/mutations.js +14 -18
- package/node_modules/@undefineds.co/pod-collections/package.json +1 -1
- package/node_modules/@undefineds.co/shared-ui/dist/list.d.ts +8 -1
- package/node_modules/@undefineds.co/shared-ui/dist/list.js +4 -1
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/IdpChrome.d.ts +1 -1
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/IdpChrome.js +2 -2
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/IdpViews.js +2 -2
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/PodSignInFrame.d.ts +3 -3
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/PodSignInFrame.js +5 -5
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/parts.d.ts +5 -5
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/parts.js +5 -5
- package/node_modules/@undefineds.co/shared-ui/dist/section-header.js +1 -1
- package/node_modules/@undefineds.co/shared-ui/dist/theme.css +5 -32
- package/node_modules/@undefineds.co/shared-ui/package.json +1 -1
- package/node_modules/@undefineds.co/solid-sdk/package.json +1 -1
- package/package.json +2 -2
- package/static/app/assets/main.css +1 -1
- package/static/app/assets/main.js +1 -1
- package/static/dashboard/assets/AccountAuthBoundary-Dv52SZc6.js +1 -0
- package/static/dashboard/assets/DesktopOidcCallback-DaT_Rumf.js +1 -0
- package/static/dashboard/assets/DevicePages-HjclpIVm.js +2 -0
- package/static/dashboard/assets/ModelsPage-Be2TPd-x.js +11 -0
- package/static/dashboard/assets/{PaneListHeader-Dn5O0mwy.js → PaneListHeader-DtvnRmFq.js} +1 -1
- package/static/dashboard/assets/{PodDeletionAuthorizationPanel-D3NOG6ZM.js → PodDeletionAuthorizationPanel-BJk_8rJq.js} +3 -3
- package/static/dashboard/assets/PodPage-C4gzEspV.js +1 -0
- package/static/dashboard/assets/{SystemSettingsPage-BNQP_Yuc.js → SystemSettingsPage-HaNrP1H1.js} +1 -1
- package/static/dashboard/assets/TasksPage-BdO5K2L7.js +1 -0
- package/static/dashboard/assets/{WebDesktopEntry-vnb4CZWp.js → WebDesktopEntry-Cj9_ZfJU.js} +1 -1
- package/static/dashboard/assets/XpodAiConnectionsPodStore-B7gmXBmC.js +3 -0
- package/static/dashboard/assets/XpodShellApp-D_KY4nCW.js +4 -0
- package/static/dashboard/assets/{account-session-DCUmCop1.js → account-session-DlcKNG7k.js} +1 -1
- package/static/dashboard/assets/{button-By5Bgvmb.js → button-wslF55uZ.js} +1 -1
- package/static/dashboard/assets/collection-runtime-uxxgEu13.js +1 -0
- package/static/dashboard/assets/{createLucideIcon-bunMzPms.js → createLucideIcon-BJQl82Qk.js} +1 -1
- package/static/dashboard/assets/dashboard-CbJ-JkrI.css +1 -0
- package/static/dashboard/assets/{dashboard-mlsg3yaw.js → dashboard-Or0gnkou.js} +2 -2
- package/static/dashboard/assets/index-BqFeOML9.js +1 -0
- package/static/dashboard/assets/{index-DvMG5pHk.js → index-DgKn1twH.js} +2 -2
- package/static/dashboard/assets/{label-Bj03L9xs.js → label-CS6Sx6Zb.js} +1 -1
- package/static/dashboard/assets/list-UyhlCFKk.js +1 -0
- package/static/dashboard/assets/{nav-item-style-BNqWQY6p.js → nav-item-style-CW1Nnorq.js} +1 -1
- package/static/dashboard/assets/{pod-collections-host-KnnGFZHL.js → pod-collections-host-DjK2xf-b.js} +6 -6
- package/static/dashboard/assets/{safe-continuation-D9AhcWiB.js → safe-continuation-ClWAhcma.js} +1 -1
- package/static/dashboard/assets/{section-header-CLCzbOp_.js → section-header-CEIEcco-.js} +1 -1
- package/static/dashboard/assets/{setting-row-DTCec8A2.js → setting-row-CaYv3dfF.js} +1 -1
- package/static/dashboard/assets/xpod-remembered-login-BUF9fin1.js +310 -0
- package/static/dashboard/dashboard.html +2 -2
- package/static/settings/assets/{AccountAuthBoundary-C0og_gIA.js → AccountAuthBoundary-Chqd38oU.js} +1 -1
- package/static/settings/assets/{DesktopOidcCallback-C5q4oFZ0.js → DesktopOidcCallback-VUrOSM_q.js} +1 -1
- package/static/settings/assets/DevicePages-C6qwvWwu.js +2 -0
- package/static/settings/assets/ModelsPage-Ry_dObRQ.js +11 -0
- package/static/settings/assets/{PaneListHeader-DqVlMe2D.js → PaneListHeader-B5RkRqr4.js} +1 -1
- package/static/settings/assets/{PodDeletionAuthorizationPanel-DgVvarVY.js → PodDeletionAuthorizationPanel-DPM-5Izt.js} +3 -3
- package/static/settings/assets/PodPage-CxND6wwc.js +1 -0
- package/static/settings/assets/{SystemSettingsPage-Crzm_DrI.js → SystemSettingsPage-C8EdMkW7.js} +1 -1
- package/static/settings/assets/TasksPage-DuqptEm8.js +1 -0
- package/static/settings/assets/{WebDesktopEntry-BGC5eRF2.js → WebDesktopEntry-BRcyktkv.js} +1 -1
- package/static/settings/assets/XpodAiConnectionsPodStore-CyA_BJVC.js +3 -0
- package/static/settings/assets/XpodShellApp-CsivHJl0.js +4 -0
- package/static/settings/assets/XpodThemeProvider-CbJ-JkrI.css +1 -0
- package/static/settings/assets/{XpodThemeProvider-CB6LepTA.js → XpodThemeProvider-DK3pIdRG.js} +2 -2
- package/static/settings/assets/{account-session-BcLjCj0x.js → account-session-DJOZ03xr.js} +1 -1
- package/static/settings/assets/auth-callback-GIBYEz_7.js +1 -0
- package/static/settings/assets/{button-BObT8pTE.js → button-D3yW-2o1.js} +1 -1
- package/static/settings/assets/collection-runtime-DfGo25mh.js +1 -0
- package/static/settings/assets/{createLucideIcon-BVsUxXpZ.js → createLucideIcon-CacwLsmB.js} +1 -1
- package/static/settings/assets/{index-ktjMkj7-.js → index-r5KRYsKC.js} +1 -1
- package/static/settings/assets/{label-BrqO8_m_.js → label-MJjUmvzG.js} +1 -1
- package/static/settings/assets/list-Ce-5k1MX.js +1 -0
- package/static/settings/assets/{nav-item-style-Di2CxkDU.js → nav-item-style-ZUbL8KOZ.js} +1 -1
- package/static/settings/assets/{pod-collections-host-KnnGFZHL.js → pod-collections-host-DjK2xf-b.js} +6 -6
- package/static/settings/assets/{safe-continuation-Dx6ceJpY.js → safe-continuation-vlBZFSlU.js} +1 -1
- package/static/settings/assets/{section-header-Dtl7yjVr.js → section-header-DGJdEvQw.js} +1 -1
- package/static/settings/assets/{setting-row-BL6Hhe8N.js → setting-row-C7tuFiho.js} +1 -1
- package/static/settings/assets/{settings-DaRBxoZk.js → settings-CyQPih1O.js} +1 -1
- package/static/settings/assets/xpod-remembered-login-D-TzzT5K.js +567 -0
- package/static/settings/auth-callback.html +3 -3
- package/static/settings/settings.html +3 -3
- package/static/dashboard/assets/AccountAuthBoundary-BvoDydRz.js +0 -1
- package/static/dashboard/assets/DesktopOidcCallback-BwIj874x.js +0 -1
- package/static/dashboard/assets/DevicePages-jOjMcvsr.js +0 -2
- package/static/dashboard/assets/ModelsPage-CMTdfqBR.js +0 -11
- package/static/dashboard/assets/PodPage-BueBdJ9_.js +0 -1
- package/static/dashboard/assets/TasksPage-CxtLJiSF.js +0 -1
- package/static/dashboard/assets/XpodAiConnectionsPodStore-wx3Ttupm.js +0 -18
- package/static/dashboard/assets/XpodShellApp-5FWY8-d5.js +0 -4
- package/static/dashboard/assets/collection-runtime-BnomuB0E.js +0 -1
- package/static/dashboard/assets/dashboard-C64R553B.css +0 -1
- package/static/dashboard/assets/xpod-remembered-login-Dr69A0Rv.js +0 -295
- package/static/settings/assets/DevicePages-fyHjjucT.js +0 -2
- package/static/settings/assets/ModelsPage-EyOByLyE.js +0 -11
- package/static/settings/assets/PodPage-DY4Oi9wg.js +0 -1
- package/static/settings/assets/TasksPage-CfXJbnlt.js +0 -1
- package/static/settings/assets/XpodAiConnectionsPodStore-CXcmgKmQ.js +0 -3
- package/static/settings/assets/XpodShellApp-D1PS3Iut.js +0 -4
- package/static/settings/assets/XpodThemeProvider-C64R553B.css +0 -1
- package/static/settings/assets/auth-callback-DSPQ28ar.js +0 -1
- package/static/settings/assets/collection-runtime-DzNbdZGe.js +0 -1
- package/static/settings/assets/index-browser-3WfrNbcG.js +0 -273
- package/static/settings/assets/xpod-remembered-login-Q66DH12t.js +0 -295
|
@@ -48,7 +48,7 @@ Please change the parent <Route path="${R}"> to <Route path="${R==="/"?"*":`${R}
|
|
|
48
48
|
`)},Xb=function(){var n=parseInt(document.body.getAttribute(hl)||"0",10);return isFinite(n)?n:0},HO=function(){g.useEffect(function(){return document.body.setAttribute(hl,(Xb()+1).toString()),function(){var n=Xb()-1;n<=0?document.body.removeAttribute(hl):document.body.setAttribute(hl,n.toString())}},[])},XO=function(n){var a=n.noRelative,o=n.noImportant,i=n.gapMode,s=i===void 0?"margin":i;HO();var u=g.useMemo(function(){return IO(s)},[s]);return g.createElement(PO,{styles:BO(u,!a,s,o?"":"!important")})},_m=!1;if(typeof window<"u")try{var xc=Object.defineProperty({},"passive",{get:function(){return _m=!0,!0}});window.addEventListener("test",xc,xc),window.removeEventListener("test",xc,xc)}catch{_m=!1}var ol=_m?{passive:!1}:!1,YO=function(n){return n.tagName==="TEXTAREA"},B0=function(n,a){if(!(n instanceof Element))return!1;var o=window.getComputedStyle(n);return o[a]!=="hidden"&&!(o.overflowY===o.overflowX&&!YO(n)&&o[a]==="visible")},qO=function(n){return B0(n,"overflowY")},VO=function(n){return B0(n,"overflowX")},Yb=function(n,a){var o=a.ownerDocument,i=a;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var s=H0(n,i);if(s){var u=X0(n,i),f=u[1],h=u[2];if(f>h)return!0}i=i.parentNode}while(i&&i!==o.body);return!1},GO=function(n){var a=n.scrollTop,o=n.scrollHeight,i=n.clientHeight;return[a,o,i]},WO=function(n){var a=n.scrollLeft,o=n.scrollWidth,i=n.clientWidth;return[a,o,i]},H0=function(n,a){return n==="v"?qO(a):VO(a)},X0=function(n,a){return n==="v"?GO(a):WO(a)},$O=function(n,a){return n==="h"&&a==="rtl"?-1:1},FO=function(n,a,o,i,s){var u=$O(n,window.getComputedStyle(a).direction),f=u*i,h=o.target,p=a.contains(h),v=!1,b=f>0,x=0,w=0;do{if(!h)break;var S=X0(n,h),A=S[0],E=S[1],R=S[2],T=E-R-u*A;(A||T)&&H0(n,h)&&(x+=T,w+=A);var _=h.parentNode;h=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}while(!p&&h!==document.body||p&&(a.contains(h)||a===h));return(b&&Math.abs(x)<1||!b&&Math.abs(w)<1)&&(v=!0),v},wc=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},qb=function(n){return[n.deltaX,n.deltaY]},Vb=function(n){return n&&"current"in n?n.current:n},QO=function(n,a){return n[0]===a[0]&&n[1]===a[1]},ZO=function(n){return`
|
|
49
49
|
.block-interactivity-`.concat(n,` {pointer-events: none;}
|
|
50
50
|
.allow-interactivity-`).concat(n,` {pointer-events: all;}
|
|
51
|
-
`)},KO=0,ll=[];function JO(n){var a=g.useRef([]),o=g.useRef([0,0]),i=g.useRef(),s=g.useState(KO++)[0],u=g.useState(P0)[0],f=g.useRef(n);g.useEffect(function(){f.current=n},[n]),g.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(s));var E=xO([n.lockRef.current],(n.shards||[]).map(Vb),!0).filter(Boolean);return E.forEach(function(R){return R.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),E.forEach(function(R){return R.classList.remove("allow-interactivity-".concat(s))})}}},[n.inert,n.lockRef.current,n.shards]);var h=g.useCallback(function(E,R){if("touches"in E&&E.touches.length===2||E.type==="wheel"&&E.ctrlKey)return!f.current.allowPinchZoom;var T=wc(E),_=o.current,N="deltaX"in E?E.deltaX:_[0]-T[0],k="deltaY"in E?E.deltaY:_[1]-T[1],B,X=E.target,z=Math.abs(N)>Math.abs(k)?"h":"v";if("touches"in E&&z==="h"&&X.type==="range")return!1;var H=window.getSelection(),re=H&&H.anchorNode,J=re?re===X||re.contains(X):!1;if(J)return!1;var oe=Yb(z,X);if(!oe)return!0;if(oe?B=z:(B=z==="v"?"h":"v",oe=Yb(z,X)),!oe)return!1;if(!i.current&&"changedTouches"in E&&(N||k)&&(i.current=B),!B)return!0;var ne=i.current||B;return FO(ne,R,E,ne==="h"?N:k)},[]),p=g.useCallback(function(E){var R=E;if(!(!ll.length||ll[ll.length-1]!==u)){var T="deltaY"in R?qb(R):wc(R),_=a.current.filter(function(B){return B.name===R.type&&(B.target===R.target||R.target===B.shadowParent)&&QO(B.delta,T)})[0];if(_&&_.should){R.cancelable&&R.preventDefault();return}if(!_){var N=(f.current.shards||[]).map(Vb).filter(Boolean).filter(function(B){return B.contains(R.target)}),k=N.length>0?h(R,N[0]):!f.current.noIsolation;k&&R.cancelable&&R.preventDefault()}}},[]),v=g.useCallback(function(E,R,T,_){var N={name:E,delta:R,target:T,should:_,shadowParent:e_(T)};a.current.push(N),setTimeout(function(){a.current=a.current.filter(function(k){return k!==N})},1)},[]),b=g.useCallback(function(E){o.current=wc(E),i.current=void 0},[]),x=g.useCallback(function(E){v(E.type,qb(E),E.target,h(E,n.lockRef.current))},[]),w=g.useCallback(function(E){v(E.type,wc(E),E.target,h(E,n.lockRef.current))},[]);g.useEffect(function(){return ll.push(u),n.setCallbacks({onScrollCapture:x,onWheelCapture:x,onTouchMoveCapture:w}),document.addEventListener("wheel",p,ol),document.addEventListener("touchmove",p,ol),document.addEventListener("touchstart",b,ol),function(){ll=ll.filter(function(E){return E!==u}),document.removeEventListener("wheel",p,ol),document.removeEventListener("touchmove",p,ol),document.removeEventListener("touchstart",b,ol)}},[]);var S=n.removeScrollBar,A=n.inert;return g.createElement(g.Fragment,null,A?g.createElement(u,{styles:ZO(s)}):null,S?g.createElement(XO,{noRelative:n.noRelative,gapMode:n.gapMode}):null)}function e_(n){for(var a=null;n!==null;)n instanceof ShadowRoot&&(a=n.host,n=n.host),n=n.parentNode;return a}const t_=jO(I0,JO);var Y0=g.forwardRef(function(n,a){return g.createElement(uu,ha({},n,{ref:a,sideCar:t_}))});Y0.classNames=uu.classNames;var n_=function(n){if(typeof document>"u")return null;var a=Array.isArray(n)?n[0]:n;return a.ownerDocument.body},il=new WeakMap,Sc=new WeakMap,Cc={},nm=0,q0=function(n){return n&&(n.host||q0(n.parentNode))},a_=function(n,a){return a.map(function(o){if(n.contains(o))return o;var i=q0(o);return i&&n.contains(i)?i:(console.error("aria-hidden",o,"in not contained inside",n,". Doing nothing"),null)}).filter(function(o){return!!o})},r_=function(n,a,o,i){var s=a_(a,Array.isArray(n)?n:[n]);Cc[o]||(Cc[o]=new WeakMap);var u=Cc[o],f=[],h=new Set,p=new Set(s),v=function(x){!x||h.has(x)||(h.add(x),v(x.parentNode))};s.forEach(v);var b=function(x){!x||p.has(x)||Array.prototype.forEach.call(x.children,function(w){if(h.has(w))b(w);else try{var S=w.getAttribute(i),A=S!==null&&S!=="false",E=(il.get(w)||0)+1,R=(u.get(w)||0)+1;il.set(w,E),u.set(w,R),f.push(w),E===1&&A&&Sc.set(w,!0),R===1&&w.setAttribute(o,"true"),A||w.setAttribute(i,"true")}catch(T){console.error("aria-hidden: cannot operate on ",w,T)}})};return b(a),h.clear(),nm++,function(){f.forEach(function(x){var w=il.get(x)-1,S=u.get(x)-1;il.set(x,w),u.set(x,S),w||(Sc.has(x)||x.removeAttribute(i),Sc.delete(x)),S||x.removeAttribute(o)}),nm--,nm||(il=new WeakMap,il=new WeakMap,Sc=new WeakMap,Cc={})}},o_=function(n,a,o){o===void 0&&(o="data-aria-hidden");var i=Array.from(Array.isArray(n)?n:[n]),s=n_(n);return s?(i.push.apply(i,Array.from(s.querySelectorAll("[aria-live], script"))),r_(i,s,o,"aria-hidden")):function(){return null}},l_=Object.defineProperty,Gn=(n,a)=>l_(n,"name",{value:a,configurable:!0}),Th="Dialog",[V0,jz]=Sl(Th),[i_,Sa]=V0(Th),s_=Gn(n=>{const{__scopeDialog:a,children:o,open:i,defaultOpen:s,onOpenChange:u,modal:f=!0}=n,h=g.useRef(null),p=g.useRef(null),[v,b]=xh({prop:i,defaultProp:s??!1,onChange:u,caller:Th}),[x,w]=g.useState(0),[S,A]=g.useState(0);return m.jsx(i_,{scope:a,triggerRef:h,contentRef:p,contentId:Ni(),titleId:Ni(),descriptionId:Ni(),titlePresent:x>0,descriptionPresent:S>0,setTitleCount:w,setDescriptionCount:A,open:v,onOpenChange:b,onOpenToggle:g.useCallback(()=>b(E=>!E),[b]),modal:f,children:o})},"Dialog"),G0="DialogPortal",[c_,W0]=V0(G0,{forceMount:void 0}),u_=Gn(n=>{const{__scopeDialog:a,forceMount:o,children:i,container:s}=n,u=Sa(G0,a);return m.jsx(c_,{scope:a,forceMount:o,children:g.Children.map(i,f=>m.jsx(rr,{present:o||u.open,children:m.jsx(f0,{asChild:!0,container:s,children:f})}))})},"DialogPortal"),Dm="DialogOverlay",$0=g.forwardRef(Gn(function(a,o){const i=W0(Dm,a.__scopeDialog),{forceMount:s=i.forceMount,...u}=a,f=Sa(Dm,a.__scopeDialog);return f.modal?m.jsx(rr,{present:s||f.open,children:m.jsx(f_,{...u,ref:o})}):null},"DialogOverlay")),d_=au("DialogOverlay.RemoveScroll"),f_=g.forwardRef(Gn(function(a,o){const{__scopeDialog:i,...s}=a,u=Sa(Dm,i),f=Vw(),h=Zt(o,f);return m.jsx(Y0,{as:d_,allowPinchZoom:!0,shards:[u.contentRef],children:m.jsx(_t.div,{"data-state":Nh(u.open),...s,ref:h,style:{pointerEvents:"auto",...s.style}})})},"DialogOverlayImpl")),ki="DialogContent",F0=g.forwardRef(Gn(function(a,o){const i=W0(ki,a.__scopeDialog),{forceMount:s=i.forceMount,...u}=a,f=Sa(ki,a.__scopeDialog);return m.jsx(rr,{present:s||f.open,children:f.modal?m.jsx(m_,{...u,ref:o}):m.jsx(h_,{...u,ref:o})})},"DialogContent")),m_=g.forwardRef(Gn(function(a,o){const i=Sa(ki,a.__scopeDialog),s=g.useRef(null),u=Zt(o,i.contentRef,s);return g.useEffect(()=>{const f=s.current;if(f)return o_(f)},[]),m.jsx(Q0,{...a,ref:u,trapFocus:i.open,disableOutsidePointerEvents:i.open,onCloseAutoFocus:St(a.onCloseAutoFocus,f=>{f.preventDefault(),i.triggerRef.current?.focus()}),onPointerDownOutside:St(a.onPointerDownOutside,f=>{const h=f.detail.originalEvent,p=h.button===0&&h.ctrlKey===!0;(h.button===2||p)&&f.preventDefault()}),onFocusOutside:St(a.onFocusOutside,f=>f.preventDefault())})},"DialogContentModal")),h_=g.forwardRef(Gn(function(a,o){const i=Sa(ki,a.__scopeDialog),s=g.useRef(!1),u=g.useRef(!1);return m.jsx(Q0,{...a,ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:f=>{a.onCloseAutoFocus?.(f),f.defaultPrevented||(s.current||i.triggerRef.current?.focus(),f.preventDefault()),s.current=!1,u.current=!1},onInteractOutside:f=>{a.onInteractOutside?.(f),f.defaultPrevented||(s.current=!0,f.detail.originalEvent.type==="pointerdown"&&(u.current=!0));const h=f.target;i.triggerRef.current?.contains(h)&&f.preventDefault(),f.detail.originalEvent.type==="focusin"&&u.current&&f.preventDefault()}})},"DialogContentNonModal")),Q0=g.forwardRef(Gn(function(a,o){const{__scopeDialog:i,trapFocus:s,onOpenAutoFocus:u,onCloseAutoFocus:f,...h}=a,p=Sa(ki,i);return Rh(),m.jsx(m.Fragment,{children:m.jsx(vO,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:u,onUnmountAutoFocus:f,children:m.jsx(qw,{role:"dialog",id:p.contentId,"aria-describedby":p.descriptionPresent?p.descriptionId:void 0,"aria-labelledby":p.titlePresent?p.titleId:void 0,"data-state":Nh(p.open),...h,ref:o,deferPointerDownOutside:!0,onDismiss:()=>p.onOpenChange(!1)})})})},"DialogContentImpl")),p_="DialogTitle",Z0=g.forwardRef(Gn(function(a,o){const{__scopeDialog:i,...s}=a,u=Sa(p_,i),{setTitleCount:f}=u;return Qt(()=>(f(h=>h+1),()=>f(h=>h-1)),[f]),m.jsx(_t.h2,{id:u.titleId,...s,ref:o})},"DialogTitle")),g_="DialogDescription",K0=g.forwardRef(Gn(function(a,o){const{__scopeDialog:i,...s}=a,u=Sa(g_,i),{setDescriptionCount:f}=u;return Qt(()=>(f(h=>h+1),()=>f(h=>h-1)),[f]),m.jsx(_t.p,{id:u.descriptionId,...s,ref:o})},"DialogDescription")),v_="DialogClose",y_=g.forwardRef(Gn(function(a,o){const{__scopeDialog:i,...s}=a,u=Sa(v_,i);return m.jsx(_t.button,{type:"button",...s,ref:o,onClick:St(a.onClick,()=>u.onOpenChange(!1))})},"DialogClose"));function Nh(n){return n?"open":"closed"}Gn(Nh,"getState");const J0=s_,b_=u_,eS=g.forwardRef(({className:n,...a},o)=>m.jsx($0,{ref:o,className:Ce("fixed inset-0 z-[var(--layer-backdrop)] xpod-overlay-scrim","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...a}));eS.displayName=$0.displayName;const jh=g.forwardRef(({className:n,children:a,variant:o="center",closeLabel:i="Close",closeDisabled:s=!1,hideCloseButton:u=!1,...f},h)=>m.jsxs(b_,{children:[m.jsx(eS,{}),m.jsxs(F0,{ref:h,className:Ce(o==="sheet-left"?"fixed inset-y-0 left-0 z-[var(--layer-modal)] flex h-dvh w-[min(88vw,320px)] flex-col border-r bg-background p-0 shadow-[16px_0_30px_rgba(15,23,42,0.08)] duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-left-full data-[state=open]:slide-in-from-left-full rounded-none":o==="sheet-right"?"fixed inset-y-0 right-0 z-[var(--layer-modal)] flex h-dvh w-full max-w-4xl flex-col border-l bg-background p-0 shadow-[-16px_0_30px_rgba(15,23,42,0.08)] duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-right-full rounded-none":"fixed left-[50%] top-[50%] z-[var(--layer-modal)] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",n),...f,children:[a,u?null:m.jsxs(y_,{disabled:s,className:Ce("absolute right-4 top-4 rounded-xl opacity-70 transition-all hover:opacity-100 hover:bg-muted/50 p-1 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",UN),children:[m.jsx(oj,{className:"h-4 w-4"}),m.jsx("span",{className:"sr-only",children:i})]})]})]}));jh.displayName=F0.displayName;const tS=({className:n,...a})=>m.jsx("div",{className:Ce("flex flex-col space-y-1.5 text-center sm:text-left",n),...a});tS.displayName="DialogHeader";const nS=({className:n,...a})=>m.jsx("div",{className:Ce("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...a});nS.displayName="DialogFooter";const Oh=g.forwardRef(({className:n,...a},o)=>m.jsx(Z0,{ref:o,className:Ce("text-lg font-semibold leading-none tracking-tight",n),...a}));Oh.displayName=Z0.displayName;const aS=g.forwardRef(({className:n,...a},o)=>m.jsx(K0,{ref:o,className:Ce("text-sm text-muted-foreground",n),...a}));aS.displayName=K0.displayName;function x_({open:n,onOpenChange:a,title:o,description:i,children:s,confirmLabel:u,cancelLabel:f,pending:h=!1,error:p,onConfirm:v,confirmVariant:b="destructive"}){const x=g.useRef(null),w=g.useRef(null);return m.jsx(J0,{open:n,onOpenChange:S=>{h||a(S)},children:m.jsxs(jh,{hideCloseButton:!0,className:"w-[calc(100%_-_2rem)] max-h-[calc(100dvh_-_2rem)] overflow-y-auto","aria-busy":h,onOpenAutoFocus:S=>{w.current=document.activeElement instanceof HTMLElement?document.activeElement:null,S.preventDefault(),x.current?.focus()},onCloseAutoFocus:S=>{w.current?.isConnected&&(S.preventDefault(),w.current.focus())},onEscapeKeyDown:S=>{h&&S.preventDefault()},onInteractOutside:S=>{h&&S.preventDefault()},children:[m.jsxs(tS,{children:[m.jsx(Oh,{children:o}),m.jsx(aS,{children:i})]}),s,p?m.jsx("p",{role:"alert",className:"text-sm text-destructive",children:p}):null,m.jsxs(nS,{className:"gap-2",children:[m.jsx(Qe,{ref:x,variant:"outline",disabled:h,onClick:()=>a(!1),children:f}),m.jsx(Qe,{variant:b,disabled:h,onClick:v,children:u})]})]})})}const w_=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm transition-[border-color] placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50 ${Lw}`,ra=g.forwardRef(({className:n,type:a="text",...o},i)=>m.jsx("input",{ref:i,type:a,className:Ce(w_,"flex min-h-10 file:border-0 file:bg-transparent file:text-sm file:font-medium",n),...o}));ra.displayName="Input";var S_=Object.defineProperty,C_=(n,a)=>S_(n,"name",{value:a,configurable:!0});function rS(n,[a,o]){return Math.min(o,Math.max(a,n))}C_(rS,"clamp");var E_=Object.defineProperty,A_=(n,a)=>E_(n,"name",{value:a,configurable:!0}),R_=g.createContext(void 0);function oS(n){const a=g.useContext(R_);return n||a||"ltr"}A_(oS,"useDirection");const lS=g.forwardRef(({className:n,indeterminate:a=!1,...o},i)=>{const s=g.useRef(null);return g.useImperativeHandle(i,()=>s.current),g.useEffect(()=>{s.current&&(s.current.indeterminate=a)}),m.jsxs("span",{className:"relative inline-flex shrink-0 items-center justify-center align-middle",children:[m.jsx("input",{...o,ref:s,type:"checkbox",className:Ce("peer m-0 h-4 w-4 shrink-0 appearance-none rounded border border-input bg-background checked:border-primary checked:bg-primary checked:bg-none indeterminate:border-primary indeterminate:bg-primary indeterminate:bg-none disabled:cursor-not-allowed disabled:opacity-50",Lw,n)}),m.jsx(YN,{"aria-hidden":"true",className:"pointer-events-none absolute hidden h-3 w-3 text-primary-foreground peer-checked:block peer-indeterminate:hidden peer-disabled:opacity-50",strokeWidth:3}),m.jsx(JN,{"aria-hidden":"true",className:"pointer-events-none absolute hidden h-3 w-3 text-primary-foreground peer-indeterminate:block peer-disabled:opacity-50",strokeWidth:3})]})});lS.displayName="Checkbox";function T_({label:n,error:a,hint:o,labelAside:i,children:s,className:u,...f}){const h=g.useId(),p=`${h}-error`,v=`${h}-hint`,b=[a?p:void 0,o?v:void 0].filter(Boolean).join(" ")||void 0;return m.jsxs("div",{...f,className:Ce("flex flex-col gap-1.5",u),children:[m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsx("label",{htmlFor:h,className:"text-[13px] font-medium text-foreground",children:n}),i]}),s({id:h,...a?{"aria-invalid":!0}:{},"aria-describedby":b}),a?m.jsx("p",{id:p,role:"alert",className:"text-[13px] text-destructive",children:a}):null,o?m.jsx("div",{id:v,className:"text-[13px] text-muted-foreground",children:o}):null]})}const du=g.forwardRef(({onInput:n,onChange:a,autoCapitalize:o="none",spellCheck:i=!1,...s},u)=>{const f=g.useRef(null),h=g.useRef(null);g.useImperativeHandle(u,()=>f.current,[]);const p=g.useCallback(b=>{const x=h.current??(h.current=b.ownerDocument.createElement("input"));x.type="email",x.multiple=b.multiple,x.required=b.required,x.value=b.value,b.setCustomValidity(x.validity.valid?"":x.validationMessage)},[]);g.useLayoutEffect(()=>{f.current&&p(f.current)}),g.useEffect(()=>{const b=f.current,x=b?.form;if(!b||!x)return;const w=()=>queueMicrotask(()=>p(b));return x.addEventListener("reset",w),()=>x.removeEventListener("reset",w)},[s.form,p]);const v=b=>{p(b),queueMicrotask(()=>p(b))};return m.jsx(ra,{...s,ref:f,type:"text",inputMode:"email",autoCapitalize:o,spellCheck:i,onInput:b=>{v(b.currentTarget),n?.(b)},onChange:b=>{v(b.currentTarget),a?.(b)}})});du.displayName="EmailInput";const Pc=g.forwardRef(({className:n,...a},o)=>m.jsx("label",{ref:o,className:Ce("text-sm font-medium leading-none text-muted-foreground",n),...a}));Pc.displayName="Label";var N_=Object.defineProperty,ke=(n,a)=>N_(n,"name",{value:a,configurable:!0});function iS(n,a){return g.useReducer((o,i)=>a[o][i]??o,n)}ke(iS,"useStateMachine");var sS="ScrollArea",[cS,Oz]=Sl(sS),[j_,Wn]=cS(sS),O_=g.forwardRef(ke(function(a,o){const{__scopeScrollArea:i,type:s="hover",dir:u,scrollHideDelay:f=600,...h}=a,[p,v]=g.useState(null),[b,x]=g.useState(null),[w,S]=g.useState(null),[A,E]=g.useState(null),[R,T]=g.useState(null),[_,N]=g.useState(0),[k,B]=g.useState(0),[X,z]=g.useState(!1),[H,re]=g.useState(!1),J=Zt(o,v),oe=oS(u);return m.jsx(j_,{scope:i,type:s,dir:oe,scrollHideDelay:f,scrollArea:p,viewport:b,onViewportChange:x,content:w,onContentChange:S,scrollbarX:A,onScrollbarXChange:E,scrollbarXEnabled:X,onScrollbarXEnabledChange:z,scrollbarY:R,onScrollbarYChange:T,scrollbarYEnabled:H,onScrollbarYEnabledChange:re,onCornerWidthChange:N,onCornerHeightChange:B,children:m.jsx(_t.div,{dir:oe,...h,ref:J,style:{position:"relative","--radix-scroll-area-corner-width":_+"px","--radix-scroll-area-corner-height":k+"px",...a.style}})})},"ScrollArea")),__="ScrollAreaViewport",D_=g.forwardRef(ke(function(a,o){const{__scopeScrollArea:i,children:s,nonce:u,...f}=a,h=Wn(__,i),p=g.useRef(null),v=Zt(o,p,h.onViewportChange);return m.jsxs(m.Fragment,{children:[m.jsx(U_,{nonce:u}),m.jsx(_t.div,{"data-radix-scroll-area-viewport":"",...f,ref:v,style:{overflowX:h.scrollbarXEnabled?"scroll":"hidden",overflowY:h.scrollbarYEnabled?"scroll":"hidden",...a.style},children:m.jsx("div",{ref:h.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})},"ScrollAreaViewport")),U_=g.memo(ke(function({nonce:a}){return m.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a})},"ScrollAreaViewportStyle"),(n,a)=>n.nonce===a.nonce),or="ScrollAreaScrollbar",uS=g.forwardRef(ke(function(a,o){const{forceMount:i,...s}=a,u=Wn(or,a.__scopeScrollArea),{onScrollbarXEnabledChange:f,onScrollbarYEnabledChange:h}=u,p=a.orientation==="horizontal";return g.useEffect(()=>(p?f(!0):h(!0),()=>{p?f(!1):h(!1)}),[p,f,h]),u.type==="hover"?m.jsx(z_,{...s,ref:o,forceMount:i}):u.type==="scroll"?m.jsx(L_,{...s,ref:o,forceMount:i}):u.type==="auto"?m.jsx(dS,{...s,ref:o,forceMount:i}):u.type==="always"?m.jsx(_h,{...s,ref:o,"data-state":"visible"}):null},"ScrollAreaScrollbar")),z_=g.forwardRef(ke(function(a,o){const{forceMount:i,...s}=a,u=Wn(or,a.__scopeScrollArea),[f,h]=g.useState(!1);return g.useEffect(()=>{const p=u.scrollArea;let v=0;if(p){const b=ke(()=>{window.clearTimeout(v),h(!0)},"handlePointerEnter"),x=ke(()=>{v=window.setTimeout(()=>h(!1),u.scrollHideDelay)},"handlePointerLeave");return p.addEventListener("pointerenter",b),p.addEventListener("pointerleave",x),()=>{window.clearTimeout(v),p.removeEventListener("pointerenter",b),p.removeEventListener("pointerleave",x)}}},[u.scrollArea,u.scrollHideDelay]),m.jsx(rr,{present:i||f,children:m.jsx(dS,{"data-state":f?"visible":"hidden",...s,ref:o})})},"ScrollAreaScrollbarHover")),L_=g.forwardRef(ke(function(a,o){const{forceMount:i,...s}=a,u=Wn(or,a.__scopeScrollArea),f=a.orientation==="horizontal",h=Qi(()=>v("SCROLL_END"),100),[p,v]=iS("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return g.useEffect(()=>{if(p==="idle"){const b=window.setTimeout(()=>v("HIDE"),u.scrollHideDelay);return()=>window.clearTimeout(b)}},[p,u.scrollHideDelay,v]),g.useEffect(()=>{const b=u.viewport,x=f?"scrollLeft":"scrollTop";if(b){let w=b[x];const S=ke(()=>{const A=b[x];w!==A&&(v("SCROLL"),h()),w=A},"handleScroll");return b.addEventListener("scroll",S),()=>b.removeEventListener("scroll",S)}},[u.viewport,f,v,h]),m.jsx(rr,{present:i||p!=="hidden",children:m.jsx(_h,{"data-state":p==="hidden"?"hidden":"visible",...s,ref:o,onPointerEnter:St(a.onPointerEnter,()=>v("POINTER_ENTER")),onPointerLeave:St(a.onPointerLeave,()=>v("POINTER_LEAVE"))})})},"ScrollAreaScrollbarScroll")),dS=g.forwardRef(ke(function(a,o){const i=Wn(or,a.__scopeScrollArea),{forceMount:s,...u}=a,[f,h]=g.useState(!1),p=a.orientation==="horizontal",v=Qi(()=>{if(i.viewport){const b=i.viewport.offsetWidth<i.viewport.scrollWidth,x=i.viewport.offsetHeight<i.viewport.scrollHeight;h(p?b:x)}},10);return go(i.viewport,v),go(i.content,v),m.jsx(rr,{present:s||f,children:m.jsx(_h,{"data-state":f?"visible":"hidden",...u,ref:o})})},"ScrollAreaScrollbarAuto")),_h=g.forwardRef(ke(function(a,o){const{orientation:i="vertical",...s}=a,u=Wn(or,a.__scopeScrollArea),f=g.useRef(null),h=g.useRef(0),[p,v]=g.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),b=Dh(p.viewport,p.content),x={...s,sizes:p,onSizesChange:v,hasThumb:b>0&&b<1,onThumbChange:ke(S=>f.current=S,"onThumbChange"),onThumbPointerUp:ke(()=>h.current=0,"onThumbPointerUp"),onThumbPointerDown:ke(S=>h.current=S,"onThumbPointerDown")};function w(S,A){return pS(S,h.current,p,A)}return ke(w,"getScrollPosition"),i==="horizontal"?m.jsx(k_,{...x,ref:o,onThumbPositionChange:()=>{if(u.viewport&&f.current){const S=u.viewport.scrollLeft,A=zm(S,p,u.dir);f.current.style.transform=`translate3d(${A}px, 0, 0)`}},onWheelScroll:S=>{u.viewport&&(u.viewport.scrollLeft=S)},onDragScroll:S=>{u.viewport&&(u.viewport.scrollLeft=w(S,u.dir))}}):i==="vertical"?m.jsx(M_,{...x,ref:o,onThumbPositionChange:()=>{if(u.viewport&&f.current){const S=u.viewport.scrollTop,A=zm(S,p);f.current.style.transform=`translate3d(0, ${A}px, 0)`}},onWheelScroll:S=>{u.viewport&&(u.viewport.scrollTop=S)},onDragScroll:S=>{u.viewport&&(u.viewport.scrollTop=w(S))}}):null},"ScrollAreaScrollbarVisible")),k_=g.forwardRef(ke(function(a,o){const{sizes:i,onSizesChange:s,...u}=a,f=Wn(or,a.__scopeScrollArea),[h,p]=g.useState(),v=g.useRef(null),b=Zt(o,v,f.onScrollbarXChange);return g.useEffect(()=>{v.current&&p(getComputedStyle(v.current))},[v]),m.jsx(mS,{"data-orientation":"horizontal",...u,ref:b,sizes:i,style:{bottom:0,left:f.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:f.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Fi(i)+"px",...a.style},onThumbPointerDown:x=>a.onThumbPointerDown(x.x),onDragScroll:x=>a.onDragScroll(x.x),onWheelScroll:(x,w)=>{if(f.viewport){const S=f.viewport.scrollLeft+x.deltaX;a.onWheelScroll(S),zh(S,w)&&x.preventDefault()}},onResize:()=>{v.current&&f.viewport&&h&&s({content:f.viewport.scrollWidth,viewport:f.viewport.offsetWidth,scrollbar:{size:v.current.clientWidth,paddingStart:Mi(h.paddingLeft),paddingEnd:Mi(h.paddingRight)}})}})},"ScrollAreaScrollbarX")),M_=g.forwardRef(ke(function(a,o){const{sizes:i,onSizesChange:s,...u}=a,f=Wn(or,a.__scopeScrollArea),[h,p]=g.useState(),v=g.useRef(null),b=Zt(o,v,f.onScrollbarYChange);return g.useEffect(()=>{v.current&&p(getComputedStyle(v.current))},[v]),m.jsx(mS,{"data-orientation":"vertical",...u,ref:b,sizes:i,style:{top:0,right:f.dir==="ltr"?0:void 0,left:f.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Fi(i)+"px",...a.style},onThumbPointerDown:x=>a.onThumbPointerDown(x.y),onDragScroll:x=>a.onDragScroll(x.y),onWheelScroll:(x,w)=>{if(f.viewport){const S=f.viewport.scrollTop+x.deltaY;a.onWheelScroll(S),zh(S,w)&&x.preventDefault()}},onResize:()=>{v.current&&f.viewport&&h&&s({content:f.viewport.scrollHeight,viewport:f.viewport.offsetHeight,scrollbar:{size:v.current.clientHeight,paddingStart:Mi(h.paddingTop),paddingEnd:Mi(h.paddingBottom)}})}})},"ScrollAreaScrollbarY")),[I_,fS]=cS(or),mS=g.forwardRef(ke(function(a,o){const{__scopeScrollArea:i,sizes:s,hasThumb:u,onThumbChange:f,onThumbPointerUp:h,onThumbPointerDown:p,onThumbPositionChange:v,onDragScroll:b,onWheelScroll:x,onResize:w,...S}=a,A=Wn(or,i),[E,R]=g.useState(null),T=Zt(o,R),_=g.useRef(null),N=g.useRef(""),k=A.viewport,B=s.content-s.viewport,X=nn(x),z=nn(v),H=Qi(w,10);function re(J){if(_.current){const oe=J.clientX-_.current.left,ne=J.clientY-_.current.top;b({x:oe,y:ne})}}return ke(re,"handleDragScroll"),g.useEffect(()=>{const J=ke(oe=>{const ne=oe.target;E?.contains(ne)&&X(oe,B)},"handleWheel");return document.addEventListener("wheel",J,{passive:!1}),()=>document.removeEventListener("wheel",J,{passive:!1})},[k,E,B,X]),g.useEffect(z,[s,z]),go(E,H),go(A.content,H),m.jsx(I_,{scope:i,scrollbar:E,hasThumb:u,onThumbChange:nn(f),onThumbPointerUp:nn(h),onThumbPositionChange:z,onThumbPointerDown:nn(p),children:m.jsx(_t.div,{...S,ref:T,style:{position:"absolute",...S.style},onPointerDown:St(a.onPointerDown,J=>{J.button===0&&(J.target.setPointerCapture(J.pointerId),_.current=E.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",A.viewport&&(A.viewport.style.scrollBehavior="auto"),re(J))}),onPointerMove:St(a.onPointerMove,re),onPointerUp:St(a.onPointerUp,J=>{const oe=J.target;oe.hasPointerCapture(J.pointerId)&&oe.releasePointerCapture(J.pointerId),document.body.style.webkitUserSelect=N.current,A.viewport&&(A.viewport.style.scrollBehavior=""),_.current=null})})})},"ScrollAreaScrollbarImpl")),Um="ScrollAreaThumb",P_=g.forwardRef(ke(function(a,o){const{forceMount:i,...s}=a,u=fS(Um,a.__scopeScrollArea);return m.jsx(rr,{present:i||u.hasThumb,children:m.jsx(B_,{ref:o,...s})})},"ScrollAreaThumb")),B_=g.forwardRef(ke(function(a,o){const{__scopeScrollArea:i,style:s,...u}=a,f=Wn(Um,i),h=fS(Um,i),{onThumbPositionChange:p}=h,v=Zt(o,h.onThumbChange),b=g.useRef(void 0),x=Qi(()=>{b.current&&(b.current(),b.current=void 0)},100);return g.useEffect(()=>{const w=f.viewport;if(w){const S=ke(()=>{if(x(),!b.current){const A=Y_(w,p);b.current=A,p()}},"handleScroll");return p(),w.addEventListener("scroll",S),()=>w.removeEventListener("scroll",S)}},[f.viewport,x,p]),m.jsx(_t.div,{"data-state":h.hasThumb?"visible":"hidden",...u,ref:v,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:St(a.onPointerDownCapture,w=>{const A=w.target.getBoundingClientRect(),E=w.clientX-A.left,R=w.clientY-A.top;h.onThumbPointerDown({x:E,y:R})}),onPointerUp:St(a.onPointerUp,h.onThumbPointerUp)})},"ScrollAreaThumbImpl")),hS="ScrollAreaCorner",H_=g.forwardRef(ke(function(a,o){const i=Wn(hS,a.__scopeScrollArea),s=!!(i.scrollbarX&&i.scrollbarY);return i.type!=="scroll"&&s?m.jsx(X_,{...a,ref:o}):null},"ScrollAreaCorner")),X_=g.forwardRef(ke(function(a,o){const{__scopeScrollArea:i,...s}=a,u=Wn(hS,i),[f,h]=g.useState(0),[p,v]=g.useState(0),b=!!(f&&p),{onCornerWidthChange:x,onCornerHeightChange:w}=u;return go(u.scrollbarX,()=>{const S=u.scrollbarX?.offsetHeight||0;u.onCornerHeightChange(S),v(S)}),go(u.scrollbarY,()=>{const S=u.scrollbarY?.offsetWidth||0;u.onCornerWidthChange(S),h(S)}),g.useEffect(()=>()=>{x(0),w(0)},[x,w]),b?m.jsx(_t.div,{...s,ref:o,style:{width:f,height:p,position:"absolute",right:u.dir==="ltr"?0:void 0,left:u.dir==="rtl"?0:void 0,bottom:0,...a.style}}):null},"ScrollAreaCornerImpl"));function Mi(n){return n?parseInt(n,10):0}ke(Mi,"toInt");function Dh(n,a){const o=n/a;return isNaN(o)?0:o}ke(Dh,"getThumbRatio");function Fi(n){const a=Dh(n.viewport,n.content),o=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,i=(n.scrollbar.size-o)*a;return Math.max(i,18)}ke(Fi,"getThumbSize");function pS(n,a,o,i="ltr"){const s=Fi(o),u=s/2,f=a||u,h=s-f,p=o.scrollbar.paddingStart+f,v=o.scrollbar.size-o.scrollbar.paddingEnd-h,b=o.content-o.viewport,x=i==="ltr"?[0,b]:[b*-1,0];return Uh([p,v],x)(n)}ke(pS,"getScrollPositionFromPointer");function zm(n,a,o="ltr"){const i=Fi(a),s=a.scrollbar.paddingStart+a.scrollbar.paddingEnd,u=a.scrollbar.size-s,f=a.content-a.viewport,h=u-i,p=o==="ltr"?[0,f]:[f*-1,0],v=rS(n,p);return Uh([0,f],[0,h])(v)}ke(zm,"getThumbOffsetFromScroll");function Uh(n,a){return o=>{if(n[0]===n[1]||a[0]===a[1])return a[0];const i=(a[1]-a[0])/(n[1]-n[0]);return a[0]+i*(o-n[0])}}ke(Uh,"linearScale");function zh(n,a){return n>0&&n<a}ke(zh,"isScrollingWithinScrollbarBounds");var Y_=ke((n,a=()=>{})=>{let o={left:n.scrollLeft,top:n.scrollTop},i=0;return ke((function s(){const u={left:n.scrollLeft,top:n.scrollTop},f=o.left!==u.left,h=o.top!==u.top;(f||h)&&a(),o=u,i=window.requestAnimationFrame(s)}),"loop")(),()=>window.cancelAnimationFrame(i)},"addUnlinkedScrollListener");function Qi(n,a){const o=nn(n),i=g.useRef(0);return g.useEffect(()=>()=>window.clearTimeout(i.current),[]),g.useCallback(()=>{window.clearTimeout(i.current),i.current=window.setTimeout(o,a)},[o,a])}ke(Qi,"useDebounceCallback");function go(n,a){const o=nn(a);Qt(()=>{let i=0;if(n){const s=new ResizeObserver(()=>{cancelAnimationFrame(i),i=window.requestAnimationFrame(o)});return s.observe(n),()=>{window.cancelAnimationFrame(i),s.unobserve(n)}}},[n,o])}ke(go,"useResizeObserver");var gS=O_,q_=D_,V_=H_;const vS=g.forwardRef(({className:n,children:a,...o},i)=>m.jsxs(gS,{ref:i,className:Ce("relative overflow-hidden",n),...o,children:[m.jsx(q_,{"data-scroll-area-viewport":"true",className:"h-full w-full overflow-x-hidden rounded-[inherit] [&>div]:!block [&>div]:!w-full [&>div]:!min-w-0",children:a}),m.jsx(yS,{}),m.jsx(V_,{})]}));vS.displayName=gS.displayName;const yS=g.forwardRef(({className:n,orientation:a="vertical",...o},i)=>m.jsx(uS,{ref:i,orientation:a,className:Ce("flex touch-none select-none transition-colors",a==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",a==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",n),...o,children:m.jsx(P_,{className:"relative flex-1 rounded-full bg-border"})}));yS.displayName=uS.displayName;const G_=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","summary",'[tabindex]:not([tabindex="-1"])'].join(","),W_="[data-pod-sign-in-primary]";function $_(n){if(n.hidden||n.closest("[hidden]")||n.matches(":disabled"))return!1;const a=n.ownerDocument.defaultView?.getComputedStyle(n);if(a&&(a.display==="none"||a.visibility==="hidden"))return!1;for(let o=n.parentElement;o;o=o.parentElement){if(o.tagName!=="DETAILS"||o.open)continue;const i=Array.from(o.children).find(s=>s.tagName==="SUMMARY");if(!i||!(i===n||i.contains(n)))return!1}return!0}function F_(n,a){const o=g.useRef(null),i=g.useRef(a);return i.current=a,g.useEffect(()=>{if(!n)return;const s=document.activeElement instanceof HTMLElement?document.activeElement:null;o.current?.focus();const u=f=>{if(f.key==="Escape"&&i.current){f.preventDefault(),i.current();return}if(f.key!=="Tab")return;const h=o.current;if(!h)return;const p=Array.from(h.querySelectorAll(G_)).filter($_);if(p.length===0){f.preventDefault(),h.focus();return}const v=p.indexOf(document.activeElement);if(!f.shiftKey&&document.activeElement===h){const x=p.find(w=>w.matches(W_));if(x){f.preventDefault(),x.focus();return}}const b=f.shiftKey?v<=0?p.length-1:v-1:v===p.length-1?0:v+1;f.preventDefault(),p[b]?.focus()};return document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u),s?.focus()}},[n]),o}const am="flex min-h-0 w-full max-w-[480px] flex-1 flex-col";function Q_({presentation:n,ariaLabel:a,appIntro:o,children:i,modal:s=!0,onClose:u,closeLabel:f,dataAttributes:h}){const p=n==="dialog"&&s,v=F_(p,u),b=o;if(n==="window")return m.jsx("div",{role:"region","aria-label":a,"data-pod-sign-in-frame":"window",...h,className:"pod-sign-in flex h-full min-h-0 w-full min-w-0 justify-center overflow-hidden bg-background text-foreground",children:m.jsx("div",{className:am,children:i})});if(n==="page")return m.jsxs("div",{role:"region","aria-label":a,"data-pod-sign-in-frame":"page",...h,className:"pod-sign-in grid min-h-[100dvh] w-full bg-background text-foreground md:grid-cols-2",children:[b?m.jsx("aside",{"data-pod-sign-in":"intro",className:"hidden flex-col justify-center gap-6 bg-[hsl(var(--sunken))] px-12 py-10 md:flex",children:b}):null,m.jsx("div",{className:Ce("flex min-w-0 items-center justify-center px-4 py-8",b?"":"md:col-span-2"),children:m.jsx("div",{className:Ce(am,"min-h-[520px]"),children:i})})]});const x=m.jsxs("div",{ref:v,role:p?"dialog":"region","aria-modal":p?!0:void 0,"aria-label":a,tabIndex:-1,"data-pod-sign-in-frame":"dialog",...h,className:Ce("pod-sign-in relative flex min-h-[min(440px,90dvh)] max-h-[90dvh] w-[min(480px,calc(100vw-2rem))] flex-col overflow-hidden rounded-xl border border-border bg-card text-card-foreground shadow-lg focus:outline-none motion-safe:animate-in motion-safe:fade-in-0"),children:[p&&u&&f?m.jsx("button",{type:"button","aria-label":f,className:"absolute right-2 top-2 flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground hover:bg-accent",onClick:u,children:m.jsx("span",{"aria-hidden":"true",children:"×"})}):null,m.jsx("div",{className:Ce(am,"mx-auto"),children:i})]});return p?m.jsx("div",{className:"fixed inset-0 z-[var(--layer-modal)] flex items-center justify-center bg-background/80 p-4",children:x}):m.jsx("div",{className:"flex w-full items-center justify-center p-4",children:x})}function Z_({kind:n,label:a}){const o=n==="cloud"?Iw:Pw;return m.jsx("span",{role:"img","aria-label":a,title:a,"data-storage-kind":n,className:"flex h-[18px] w-[18px] items-center justify-center rounded-full border border-background bg-card text-foreground",children:m.jsx(o,{"aria-hidden":"true",className:"h-3 w-3"})})}const K_={restoring:"正在恢复登录…",enterApp:"进入 {app}",reauthenticate:"重新登录",useAnother:"使用其他账号",expiredLine:"登录已过期,需要重新确认",chooseTitle:"登录",chooseLead:"用你的 WebID 账号登录,数据保存在你自己的 Pod 里",useXpod:"使用 Xpod 账号登录",useOtherSolid:"使用其他 Solid 账号",customLabel:"账号服务地址或 WebID",customPlaceholder:"https://example.com/",customSubmit:"继续",noAccount:"没有账号?",register:"注册 Xpod",noticeDetailsToggle:"详情",noticeCopy:"复制",noticeCopied:"已复制",whatIsPod:"什么是 Pod?",whatIsPodBody:"Pod 是保存你数据的个人空间。",whatIsWebId:"什么是 WebID?",whatIsWebIdBody:"WebID 是登录用的身份,它指向你的个人资料和 Pod。",signInWith:"使用 {service} 登录",select:"选择",selected:"已选择",choosePodTitle:"选择 Pod",choosePodLead:"选择要继续使用的 Pod",retry:"重试",goCreate:"去创建",refreshPage:"刷新页面",startAndEnter:"启动 Xpod 并进入",openXpod:"打开 Xpod",noticeUnreachable:"暂时连不上 Xpod,请稍后再试",noticeIncomplete:"登录没有完成,请再试一次",noticeNoWebId:"还没有 WebID",noticeCancelled:"登录已取消",noticeLocalStopped:"这台电脑上的 Xpod 没有运行",noticePending:"上次登录尚未结束",serviceLabel:"账号服务",signInTitle:"登录 {service}",returnToApp:"完成后回到 {app}",email:"邮箱",password:"密码",forgotPassword:"忘记密码?",rememberDevice:"在这台设备上保持登录",signIn:"登录",registerLink:"注册账号",registerTitle:"注册 {service}",username:"用户名",registerSubmit:"注册",haveAccount:"已有账号?登录",podElsewhereSummary:"想用你自己的独立部署存放 Pod?",podElsewhereBody:"注册后,可以在账号页的“存储”里把 Pod 建到你自己的独立部署上;它和当前账号服务是分开的,普通浏览器不会自动把 Pod 转到本机。",noWebIdTitle:"还没有 WebID",noWebIdLead:"新建一个 WebID 来登录 {app},数据存在它的 Pod 里",webIdName:"WebID 名称",noWebIdLocation:"存放在当前服务",createAndContinue:"创建并继续",chooseOtherLocation:"存到边缘设备(打开账号页)",consentTitle:"授权 {app}",unverifiedWarning:"未能验证这个应用的来源,请确认是你要使用的应用",chooseWebId:"用哪个 WebID 登录?",consentConsequence:"{app} 将以这个身份读写你的数据,之后可以在 Xpod 中收回。",requestDetails:"请求详情",scopes:"权限范围",clientId:"应用标识",webIdFull:"WebID",rememberChoice:"以后不再询问",manageAccount:"管理账号",switchAccount:"换一个账号",deny:"拒绝",allow:"允许",storageCloud:"数据存在 Xpod 云端",storageEdge:"数据存在边缘设备上",hostedStorage:"账号服务托管",independentStorage:"独立部署",identityAddress:"WebID(身份地址)",storageAddress:"Pod(存储地址)",showAddresses:"查看地址",webIdSectionTitle:"WebID",webIdEmpty:"还没有 WebID。新建一个,用它登录应用。",createWebId:"新建 WebID",linkExistingWebId:"关联已有 WebID",podOnDevice:"Pod 在 {device}",authorizedApps:"已授权 {count} 个应用",createStepName:"名称",createStepLocation:"存放在",createNameHint:"WebID 地址",changeDevice:"更换 ›",cannotChangeLater:"创建后不能直接更换,以后要换请使用迁移",createPod:"创建 WebID 和 Pod",startDeviceXpod:"启动这台设备上的 Xpod",creatingNote:"关闭页面不会中断创建",cancel:"取消",devicePickerTitle:"选择存放设备",addDevice:"+ 添加设备",deviceSectionTitle:"设备",deviceStatusOk:"正常",deviceStatusUnreachable:"⚠ 其他设备访问不到",deviceStatusStopped:"Xpod 已停止",deviceStatusOffline:"离线",deviceCloud:"Xpod 云端",deviceEdge:"边缘",podCount:"{count} 个 Pod",networkAction:"网络",fixAction:"处理",collapseAction:"收起",webIdSectionHint:"登录应用时使用的身份,数据存在它的 Pod 里",deviceSectionHint:"Pod 可以存放的地方,网络设置跟着设备走",credentialSectionHint:"让脚本或服务以某个 WebID 直接访问 Pod",startAction:"启动",networkTitle:"网络访问",probeLocal:"这台电脑",probeLan:"局域网",probeWan:"其他网络",probeIdle:"未检测",probeChecking:"检测中",probeOk:"可以访问",probeFailed:"不通",tunnelTitle:"选择隧道",enableAndRecheck:"开启并重新检测",enableAndCheck:"开启并检测",recheck:"重新检测",skipForNow:"跳过,稍后设置",reachableVia:"通过 {tunnel} 可以访问",networkFootnote:"只影响其他设备;这台电脑上照常可用",addDeviceTitle:"添加设备",stepInstall:"安装并登录",stepNetwork:"检查网络",stepDone:"完成",joinThisComputer:"把这台电脑加入",installOnOther:"在那台设备上安装 Xpod 边缘并登录本账号",waitingForDevice:"正在等待新设备上线,登录后这里会自动继续",deviceOnline:"已上线",finish:"完成",useThisDevice:"用这台设备",credentialSectionTitle:"密钥",credentialEmpty:"还没有密钥。",createCredential:"新建密钥",revokeCredential:"删除",resumeTitle:"{app} 正在等你完成授权",resumeWaiting:"在下面新建一个 WebID,完成后就能回去授权",resumeReady:"WebID 已就绪,可以回去授权了",resumeCancel:"取消授权",resumeContinue:"继续授权 {app}",close:"关闭"},J_={restoring:"Restoring your sign-in…",enterApp:"Open {app}",reauthenticate:"Sign in again",useAnother:"Use another account",expiredLine:"Your sign-in expired. Please confirm again.",chooseTitle:"Sign in",chooseLead:"Sign in with your WebID account. Your data stays in your own Pod.",useXpod:"Sign in with Xpod",useOtherSolid:"Use another Solid account",customLabel:"Sign-in service address or WebID",customPlaceholder:"https://example.com/",customSubmit:"Continue",noAccount:"No account?",register:"Register for Xpod",noticeDetailsToggle:"Details",noticeCopy:"Copy",noticeCopied:"Copied",whatIsPod:"What is a Pod?",whatIsPodBody:"A Pod is a personal space that holds your data.",whatIsWebId:"What is a WebID?",whatIsWebIdBody:"A WebID is the identity you sign in with. It points to your profile and your Pod.",signInWith:"Sign in with {service}",select:"Select",selected:"Selected",choosePodTitle:"Choose a Pod",choosePodLead:"Choose the Pod to continue with",retry:"Retry",goCreate:"Create one",refreshPage:"Refresh page",startAndEnter:"Start Xpod and open",openXpod:"Open Xpod",noticeUnreachable:"Cannot reach Xpod right now. Please try again later.",noticeIncomplete:"Sign-in did not finish. Please try again.",noticeNoWebId:"No WebID yet",noticeCancelled:"Sign-in cancelled",noticeLocalStopped:"Xpod is not running on this computer",noticePending:"The previous sign-in has not finished",serviceLabel:"Sign-in service",signInTitle:"Sign in to {service}",returnToApp:"You will return to {app}",email:"Email",password:"Password",forgotPassword:"Forgot password?",rememberDevice:"Keep me signed in on this device",signIn:"Sign in",registerLink:"Register",registerTitle:"Register for {service}",username:"Username",registerSubmit:"Register",haveAccount:"Already have an account? Sign in",podElsewhereSummary:"Want it on your own standalone deployment?",podElsewhereBody:"After registering, create the Pod on your own standalone deployment under Storage on the account page; it is separate from this account service.",noWebIdTitle:"No WebID yet",noWebIdLead:"Create a WebID to sign in to {app}. Your data lives in its Pod.",webIdName:"WebID name",noWebIdLocation:"Stored on the current service",createAndContinue:"Create and continue",chooseOtherLocation:"Store on an edge device (open account page)",consentTitle:"Authorize {app}",unverifiedWarning:"We could not verify this application. Make sure it is the one you meant to use.",chooseWebId:"Which WebID do you sign in with?",consentConsequence:"{app} will read and write your data as this identity. You can revoke it later in Xpod.",requestDetails:"Request details",scopes:"Permissions",clientId:"Application ID",webIdFull:"WebID",rememberChoice:"Do not ask again",manageAccount:"Manage account",switchAccount:"Switch account",deny:"Deny",allow:"Allow",storageCloud:"Data is stored on Xpod Cloud",storageEdge:"Data is stored on an edge device",hostedStorage:"Hosted by account service",independentStorage:"Independent deployment",identityAddress:"WebID (identity address)",storageAddress:"Pod (storage address)",showAddresses:"View addresses",webIdSectionTitle:"WebID",webIdEmpty:"No WebID yet. Create one to sign in to applications.",createWebId:"New WebID",linkExistingWebId:"Link an existing WebID",podOnDevice:"Pod on {device}",authorizedApps:"{count} authorized apps",createStepName:"Name",createStepLocation:"Store on",createNameHint:"WebID address",changeDevice:"Change ›",cannotChangeLater:"It cannot be changed directly after creation. Use migration later.",createPod:"Create WebID and Pod",startDeviceXpod:"Start Xpod on this device",creatingNote:"Closing this page will not interrupt creation",cancel:"Cancel",devicePickerTitle:"Choose where to store",addDevice:"+ Add device",deviceSectionTitle:"Devices",deviceStatusOk:"Healthy",deviceStatusUnreachable:"⚠ Not reachable from other devices",deviceStatusStopped:"Xpod stopped",deviceStatusOffline:"Offline",deviceCloud:"Xpod Cloud",deviceEdge:"Edge",podCount:"{count} Pods",networkAction:"Network",fixAction:"Fix",collapseAction:"Collapse",webIdSectionHint:"The identity you sign in to apps with. Your data lives in its Pod.",deviceSectionHint:"Places a Pod can live. Network settings follow the device.",credentialSectionHint:"Let a script or service reach a Pod directly as one WebID.",startAction:"Start",networkTitle:"Network access",probeLocal:"This computer",probeLan:"Local network",probeWan:"Other networks",probeIdle:"Not checked",probeChecking:"Checking",probeOk:"Reachable",probeFailed:"Unreachable",tunnelTitle:"Choose a tunnel",enableAndRecheck:"Enable and recheck",enableAndCheck:"Enable and check",recheck:"Recheck",skipForNow:"Skip, set up later",reachableVia:"Reachable through {tunnel}",networkFootnote:"Only affects other devices. This computer keeps working as usual.",addDeviceTitle:"Add a device",stepInstall:"Install and sign in",stepNetwork:"Check network",stepDone:"Done",joinThisComputer:"Add this computer",installOnOther:"Install Xpod Edge on that device and sign in to this account",waitingForDevice:"Waiting for the new device to come online. This continues automatically after sign-in.",deviceOnline:"Online",finish:"Done",useThisDevice:"Use this device",credentialSectionTitle:"Credentials",credentialEmpty:"No credentials yet.",createCredential:"New credential",revokeCredential:"Delete",resumeTitle:"{app} is waiting for you to finish authorizing",resumeWaiting:"Create a WebID below, then you can go back and authorize",resumeReady:"Your WebID is ready. You can go back and authorize.",resumeCancel:"Cancel authorization",resumeContinue:"Continue authorizing {app}",close:"Close"},eD={"zh-CN":K_,en:J_};function Ca(n="zh-CN",a){return{...eD[n],...a}}function qn(n,a){return n.replace(/\{(\w+)\}/g,(o,i)=>{const s=a[i];return s===void 0?o:String(s)})}function fu({size:n=24,...a}){return m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100",width:n,height:n,"aria-hidden":"true",focusable:"false",...a,children:[m.jsx("rect",{x:"10",y:"10",width:"80",height:"80",rx:"18",fill:"#563E84"}),m.jsxs("g",{fill:"#F7F4ED",children:[m.jsx("path",{d:"M31 24H52V45H73V73Q73 76 70 76H31Q28 76 28 73V27Q28 24 31 24Z"}),m.jsx("path",{d:"M58 24L76 39H58Z"})]})]})}function Lh({serviceName:n,serviceHost:a,icon:o,serviceLabel:i,locale:s}){const u=i??Ca(s).serviceLabel;return m.jsxs("div",{"data-pod-sign-in":"idp-chrome",className:"flex min-h-14 shrink-0 items-center gap-3 border-b border-border bg-[hsl(var(--sunken))] px-6 py-2 text-[13px] text-foreground min-[400px]:px-8",children:[m.jsx("span",{className:"flex shrink-0 items-center justify-center",children:o??m.jsx(fu,{size:24})}),m.jsxs("span",{className:"min-w-0 max-w-[50%] shrink-0 truncate font-medium",children:[n," · ",u]}),a?m.jsx("span",{className:"ml-auto truncate font-mono text-xs text-muted-foreground",children:a}):null]})}const Rl="h-auto min-h-12 w-full whitespace-normal break-normal rounded-lg py-2 text-base font-medium leading-snug",mu=Rl,Ir="h-9 rounded-lg px-2 text-sm font-medium",tD="h-12 w-full rounded-lg border border-input bg-card px-4 text-base text-foreground placeholder:text-muted-foreground disabled:opacity-60";function bS({className:n}){return m.jsx(ZN,{"aria-hidden":"true",className:Ce("h-4 w-4 shrink-0 animate-spin motion-reduce:animate-none",n)})}function Mt({busy:n=!1,children:a,disabled:o,...i}){return m.jsxs(Qe,{type:"button",...i,disabled:o||n,"aria-busy":n||void 0,children:[n?m.jsx(bS,{className:"mr-2"}):null,a]})}function pl({children:n,className:a}){return m.jsx("span",{className:Ce("font-mono text-xs text-muted-foreground",a),children:n})}function Lm({name:n,avatarUrl:a,storage:o,size:i=56}){return m.jsxs("span",{className:"relative inline-flex shrink-0",style:{width:i,height:i},"data-pod-sign-in":"avatar",children:[m.jsxs(Dw,{className:"h-full w-full rounded-full","aria-hidden":"true",children:[a?m.jsx(Uw,{src:a,alt:""}):null,m.jsx(zw,{className:"text-base",children:Array.from(n.trim())[0]?.toUpperCase()??"?"})]}),o?m.jsx("span",{className:"absolute -bottom-0.5 -right-0.5",children:m.jsx(Z_,{kind:o.kind,label:o.label})}):null]})}function mo(n){return m.jsx(T_,{...n,"data-pod-sign-in":"field"})}function xS({summary:n,children:a,className:o}){return m.jsxs("details",{className:Ce("text-[13px] text-muted-foreground",o),children:[m.jsx("summary",{className:"cursor-pointer select-none rounded py-1 text-[13px] font-medium text-primary focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",children:n}),m.jsx("div",{className:"pt-1 leading-5",children:a})]})}function wS({checked:n,onChange:a,label:o,disabled:i}){return m.jsxs("label",{className:"flex min-h-9 cursor-pointer items-center gap-2 text-sm text-foreground",children:[m.jsx(lS,{checked:n,disabled:i,onChange:s=>a(s.target.checked)}),o]})}function Zi({chrome:n,children:a,actions:o,onSubmit:i,mainClassName:s,...u}){const f=m.jsxs(m.Fragment,{children:[n,m.jsx("div",{"data-pod-sign-in":"main",className:Ce("flex min-h-0 flex-1 flex-col gap-7 overflow-y-auto px-6 pb-3 pt-7 min-[400px]:px-8 min-[400px]:pt-8",s),children:a}),o?m.jsx("div",{"data-pod-sign-in":"actions",className:"flex shrink-0 flex-col gap-4 px-6 pb-7 pt-5 min-[400px]:px-8 min-[400px]:pb-8",children:o}):null]}),h="flex min-h-0 flex-1 flex-col";return i?m.jsx("form",{...u,onSubmit:i,className:h,noValidate:!0,children:f}):m.jsx("div",{...u,className:h,children:f})}function kh({locale:n,copy:a}){return Ca(n,a)}function hu({serviceName:n="Xpod",serviceHost:a,serviceIcon:o,locale:i,copy:s}){return m.jsx(Lh,{serviceName:n,serviceHost:a,icon:o,locale:i,serviceLabel:s?.serviceLabel})}const gl=tD;function Gb({href:n,onClick:a,disabled:o,className:i,children:s}){const u=Ce(Ir,"inline-flex shrink-0 items-center justify-center text-primary hover:underline",i);return n&&!o?m.jsx("a",{href:n,className:u,children:s}):m.jsx("button",{type:"button",className:u,disabled:o,onClick:a,children:s})}function nD(n){const{serviceName:a,returnToAppName:o,error:i,fieldErrors:s,pending:u=!1,remember:f,defaultEmail:h="",defaultPassword:p="",onFieldChange:v,onRememberChange:b,onSubmit:x,onForgot:w,forgotHref:S,onRegister:A,registerHref:E,onUseOtherSolid:R}=n,T=kh(n),[_,N]=g.useState(h),[k,B]=g.useState(p),X=z=>{z.preventDefault(),u||x({email:_.trim(),password:k})};return m.jsxs(Zi,{"data-pod-sign-in-state":"idp-sign-in",chrome:m.jsx(hu,{...n}),onSubmit:X,actions:m.jsxs(m.Fragment,{children:[i?m.jsx("p",{role:"alert",className:"text-[13px] text-destructive",children:i}):null,m.jsx(Mt,{type:"submit",className:Rl,busy:u,children:T.signIn}),m.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[A||E?m.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-x-1 gap-y-0",children:[m.jsx("span",{className:"whitespace-nowrap text-xs text-muted-foreground",children:T.noAccount}),m.jsx(Gb,{href:E,disabled:u,onClick:A,children:T.registerLink})]}):m.jsx("span",{}),R?m.jsx("button",{type:"button",className:Ce(Ir,"text-primary hover:underline"),disabled:u,onClick:R,children:T.useOtherSolid}):null]})]}),children:[m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx("h1",{className:"text-[17px] font-semibold text-foreground",children:qn(T.signInTitle,{service:a})}),o?m.jsx("p",{className:"text-sm text-muted-foreground",children:qn(T.returnToApp,{app:o})}):null]}),m.jsxs("div",{"data-pod-sign-in":"fields",className:"flex flex-col gap-5",children:[m.jsx(mo,{label:T.email,error:s?.email,children:z=>m.jsx(du,{...z,name:"email",autoComplete:"username",autoCapitalize:"none",spellCheck:!1,className:gl,value:_,disabled:u,onChange:H=>{N(H.target.value),v?.("email",H.target.value)}})}),m.jsx(mo,{label:T.password,error:s?.password,labelAside:w||S?m.jsx(Gb,{className:"min-h-7 text-[13px]",href:S,onClick:w,children:T.forgotPassword}):void 0,children:z=>m.jsx(ra,{...z,name:"password",type:"password",autoComplete:"current-password",className:gl,value:k,disabled:u,onChange:H=>{B(H.target.value),v?.("password",H.target.value)}})}),b?m.jsx(wS,{checked:f,onChange:b,label:T.rememberDevice,disabled:u}):null]})]})}function aD(n){const{serviceName:a,returnToAppName:o,usernamePreview:i,requireUsername:s,fieldErrors:u,error:f,pending:h=!1,defaultEmail:p="",defaultPassword:v="",defaultUsername:b="",onFieldChange:x,onSubmit:w,onSignIn:S}=n,A=kh(n),[E,R]=g.useState(b),[T,_]=g.useState(p),[N,k]=g.useState(v),B=X=>{X.preventDefault(),!h&&w({...s?{username:E.trim()}:{},email:T.trim(),password:N})};return m.jsxs(Zi,{"data-pod-sign-in-state":"idp-register",chrome:m.jsx(hu,{...n}),onSubmit:B,actions:m.jsxs(m.Fragment,{children:[f?m.jsx("p",{role:"alert",className:"text-[13px] text-destructive",children:f}):null,m.jsx(Mt,{type:"submit",className:Rl,busy:h,children:A.registerSubmit}),S?m.jsx("button",{type:"button",className:Ce(Ir,"self-center text-primary hover:underline"),disabled:h,onClick:S,children:A.haveAccount}):null]}),children:[m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx("h1",{className:"text-[17px] font-semibold text-foreground",children:qn(A.registerTitle,{service:a})}),o?m.jsx("p",{className:"text-sm text-muted-foreground",children:qn(A.returnToApp,{app:o})}):null]}),m.jsxs("div",{className:"flex flex-col gap-5",children:[s?m.jsx(mo,{label:A.username,error:u?.username,hint:i?m.jsx("span",{role:"status",className:"font-mono text-xs",children:i}):void 0,children:X=>m.jsx(ra,{...X,name:"username",type:"text",autoComplete:"username",autoCapitalize:"none",spellCheck:!1,className:gl,value:E,disabled:h,onChange:z=>{R(z.target.value),x?.("username",z.target.value)}})}):null,m.jsx(mo,{label:A.email,error:u?.email,children:X=>m.jsx(du,{...X,name:"email",autoComplete:"email",autoCapitalize:"none",spellCheck:!1,className:gl,value:T,disabled:h,onChange:z=>{_(z.target.value),x?.("email",z.target.value)}})}),m.jsx(mo,{label:A.password,error:u?.password,children:X=>m.jsx(ra,{...X,name:"password",type:"password",autoComplete:"new-password",className:gl,value:N,disabled:h,onChange:z=>{k(z.target.value),x?.("password",z.target.value)}})}),m.jsx(xS,{summary:A.podElsewhereSummary,children:A.podElsewhereBody})]})]})}function rD(n){const{appName:a,defaultName:o,nameHint:i,error:s,pending:u=!1,onNameChange:f,onCreate:h,onChooseOtherLocation:p}=n,v=kh(n),[b,x]=g.useState(o??""),w=o!==void 0,S=b.trim(),A=!w||!!S&&i?.tone!=="error",E=R=>{R.preventDefault(),!u&&A&&h(S)};return m.jsxs(Zi,{"data-pod-sign-in-state":"idp-no-webid",chrome:m.jsx(hu,{...n}),onSubmit:E,actions:m.jsxs(m.Fragment,{children:[s?m.jsx("p",{role:"alert",className:"text-[13px] text-destructive",children:s}):null,m.jsx(Mt,{type:"submit",className:Rl,busy:u,disabled:!A,children:v.createAndContinue}),p?m.jsx(Mt,{type:"button",variant:"outline",className:mu,disabled:u,onClick:p,children:v.chooseOtherLocation}):null]}),children:[m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx("h1",{className:"text-[17px] font-semibold text-foreground",children:v.noWebIdTitle}),m.jsx("p",{className:"text-sm leading-[22px] text-muted-foreground",children:qn(v.noWebIdLead,{app:a})})]}),m.jsx("div",{className:"flex flex-col gap-4",children:w?m.jsx(mo,{label:v.webIdName,error:i?.tone==="error"?i.text:void 0,hint:i&&i.tone!=="error"?m.jsx("span",{role:"status",children:i.text}):m.jsx("span",{children:v.noWebIdLocation}),children:R=>m.jsx(ra,{...R,name:"webIdName",type:"text",autoComplete:"off",autoCapitalize:"none",spellCheck:!1,className:gl,value:b,disabled:u,onChange:T=>{x(T.target.value),f?.(T.target.value)}})}):null})]})}function oD(n){const{app:a,webIds:o,selectedWebId:i,scopes:s,rememberChoice:u,allowRememberChoice:f=a.verified,pending:h,disabled:p=!1,approveDisabled:v=!1,automationSelectId:b,onSelectWebId:x,onRememberChange:w,onApprove:S,onDeny:A,onManageAccount:E,onSwitchAccount:R}=n,T=Ca(n.locale,n.copy),_=g.useId(),N=h!==void 0||p,k=o.length===1,B=(o.find(z=>z.id===i)??o[0])?.webId,X=m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex flex-wrap gap-3",children:[m.jsx(Mt,{variant:"outline",className:Ce(mu,"w-auto min-w-max flex-1 whitespace-nowrap px-2"),busy:h==="deny",disabled:N,onClick:A,children:T.deny}),m.jsx(Mt,{className:Ce(Rl,"w-auto min-w-max flex-1 whitespace-nowrap px-2"),busy:h==="approve",disabled:N||v,onClick:S,children:T.allow})]}),E||R?m.jsxs("div",{className:"flex flex-wrap justify-center gap-2",children:[E?m.jsx("button",{type:"button",className:Ce(Ir,"text-muted-foreground hover:text-foreground"),disabled:N,onClick:E,children:T.manageAccount}):null,R?m.jsx("button",{type:"button",className:Ce(Ir,"text-muted-foreground hover:text-foreground"),disabled:N,onClick:R,children:T.switchAccount}):null]}):null]});return m.jsxs(Zi,{"data-pod-sign-in-state":"consent",chrome:m.jsx(hu,{...n}),actions:X,children:[m.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[a.icon?m.jsx("span",{"aria-hidden":"true",className:"flex h-12 w-12 items-center justify-center overflow-hidden rounded-xl",children:a.icon}):null,m.jsx("h1",{className:"text-[17px] font-semibold text-foreground",children:qn(T.consentTitle,{app:a.name})}),a.host?m.jsx(pl,{children:a.host}):null,a.verified?null:m.jsxs("p",{role:"alert",className:"flex items-start gap-1.5 text-left text-[13px] text-warning",children:[m.jsx(tj,{"aria-hidden":"true",className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),T.unverifiedWarning]})]}),m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsx("p",{id:_,className:"text-[13px] font-medium text-foreground",children:T.chooseWebId}),k?m.jsx("div",{className:"rounded-lg border border-border bg-card p-3",children:m.jsx(Wb,{webId:o[0]})}):m.jsx("div",{role:"radiogroup","aria-labelledby":_,className:"flex flex-col gap-2",children:o.map(z=>{const H=z.id===i;return m.jsxs("label",{className:Ce("flex min-h-11 cursor-pointer items-center gap-3 rounded-lg border p-3 focus-within:outline focus-within:outline-2 focus-within:outline-offset-2 focus-within:outline-ring",H?"border-primary bg-accent":"border-border bg-card"),children:[m.jsx("input",{type:"radio",name:"consent-webid",className:"sr-only",value:z.id,checked:H,disabled:N,onChange:()=>x(z.id)}),m.jsx(Wb,{webId:z})]},z.id)})}),!k&&b?m.jsxs("select",{id:b,"aria-hidden":"true","aria-label":T.chooseWebId,tabIndex:-1,className:"sr-only",value:i,disabled:N,onChange:z=>x(z.target.value),children:[i?null:m.jsx("option",{value:"",disabled:!0,children:T.chooseWebId}),o.map(z=>m.jsxs("option",{value:z.id,children:[z.displayName," ",z.shortName]},z.id))]}):null,m.jsx("p",{className:"text-[13px] leading-5 text-muted-foreground",children:qn(T.consentConsequence,{app:a.name})})]}),m.jsx(xS,{summary:T.requestDetails,children:m.jsxs("div",{className:"flex flex-col gap-2",children:[s.length>0?m.jsxs("div",{children:[m.jsx("p",{className:"font-medium text-foreground",children:T.scopes}),m.jsx("ul",{className:"list-disc pl-5",children:s.map(z=>m.jsx("li",{children:z.label},z.id))})]}):null,B?m.jsxs("p",{children:[m.jsx("span",{className:"font-medium text-foreground",children:T.webIdFull})," ",m.jsx(pl,{className:"break-all",children:B})]}):null,a.clientId?m.jsxs("p",{children:[m.jsx("span",{className:"font-medium text-foreground",children:T.clientId})," ",m.jsx(pl,{className:"break-all",children:a.clientId})]}):null,f?m.jsx(wS,{checked:u,onChange:w,label:T.rememberChoice,disabled:N}):null]})})]})}function Wb({webId:n}){return m.jsxs("span",{className:"flex min-w-0 items-center gap-3","data-pod-sign-in":"webid-row",children:[m.jsx(Lm,{name:n.displayName,avatarUrl:n.avatarUrl,storage:n.storage,size:40}),m.jsxs("span",{className:"flex min-w-0 flex-col",children:[m.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:n.displayName}),n.shortName!==n.displayName?m.jsx("span",{className:"truncate font-mono text-xs text-muted-foreground",children:n.shortName}):null]})]})}const lD={ok:"bg-success",unreachable:"bg-warning",stopped:"bg-muted-foreground",offline:"bg-border"};function iD(n,a){switch(n){case"ok":return a.deviceStatusOk;case"unreachable":return a.deviceStatusUnreachable;case"stopped":return a.deviceStatusStopped;case"offline":return a.deviceStatusOffline}}function sD(n,a){return n==="cloud"?a.deviceCloud:a.deviceEdge}function SS({device:n,copy:a,showStatus:o=!0}){const i=n.kind==="cloud"?Iw:Pw;return m.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-3 text-left","data-device-id":n.id,children:[m.jsx("span",{"aria-hidden":"true",className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground",children:n.icon??m.jsx(i,{className:"h-4 w-4"})}),m.jsxs("span",{className:"flex min-w-0 flex-col",children:[m.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[m.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:n.name}),m.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 text-xs text-muted-foreground",children:sD(n.kind,a)})]}),m.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-x-2 text-xs text-muted-foreground",children:[n.address?m.jsx(pl,{className:"truncate",children:n.address}):null,n.podCount!==void 0?m.jsx("span",{children:a.podCount.replace("{count}",String(n.podCount))}):null,o?m.jsxs("span",{className:"flex items-center gap-1",children:[m.jsx("span",{"aria-hidden":"true",className:Ce("h-2 w-2 rounded-full",lD[n.status])}),iD(n.status,a)]}):null]})]})]})}const CS="pod-sign-in flex flex-col gap-3 text-foreground",Bc="flex min-h-14 items-center gap-3 rounded-lg border border-border bg-card px-3 py-2",cD="text-[17px] font-semibold text-foreground";function ES({id:n,icon:a,title:o,hint:i,actions:s}){return m.jsxs("div",{className:"flex items-start justify-between gap-3",children:[m.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[m.jsx(a,{"aria-hidden":"true",className:"mt-0.5 h-[18px] w-[18px] shrink-0 text-primary"}),m.jsxs("div",{className:"min-w-0",children:[m.jsx("h2",{id:n,className:cD,children:o}),m.jsx("p",{className:"text-[13px] text-muted-foreground",children:i})]})]}),s]})}const uD="pod-sign-in max-h-[90dvh] w-[min(400px,calc(100vw-2rem))] max-w-[400px] gap-4 overflow-y-auto rounded-xl bg-card p-5";function dD({open:n,onOpenChange:a,devices:o,selectedDeviceId:i,onSelect:s,onAddDevice:u,locale:f,copy:h}){const p=Ca(f,h);return m.jsx(J0,{open:n,onOpenChange:a,children:m.jsxs(jh,{className:uD,"aria-describedby":void 0,children:[m.jsx(Oh,{className:"text-[17px] leading-6",children:p.devicePickerTitle}),m.jsx("div",{role:"radiogroup","aria-label":p.devicePickerTitle,className:"flex flex-col gap-2",children:o.map(v=>{const b=v.status!=="offline",x=v.id===i;return m.jsx("button",{type:"button",role:"radio","aria-checked":x,disabled:!b,className:Ce("flex min-h-14 w-full items-center rounded-lg border px-3 py-2 text-left",x?"border-primary bg-accent":"border-border bg-card",b?"hover:bg-accent":"cursor-not-allowed opacity-50"),onClick:()=>{s(v.id),a(!1)},children:m.jsx(SS,{device:v,copy:p})},v.id)})}),m.jsx(Mt,{variant:"outline",className:mu,onClick:u,children:p.addDevice})]})})}const Dr="h-9 rounded-lg px-3 text-sm font-medium";function $b({webId:n,podUrl:a,copy:o}){return m.jsxs("details",{className:"mt-1 min-w-0 text-xs",children:[m.jsx("summary",{className:"w-fit cursor-pointer rounded py-1 text-primary underline-offset-4 hover:underline",children:o.showAddresses}),m.jsx("dl",{className:"mt-1 grid min-w-0 gap-2",children:[{label:o.identityAddress,url:n},{label:o.storageAddress,url:a}].filter(i=>i.url).map(({label:i,url:s})=>m.jsxs("div",{className:"min-w-0",children:[m.jsx("dt",{className:"text-muted-foreground",children:i}),m.jsx("dd",{className:"min-w-0",children:m.jsx("a",{className:"break-all text-primary underline underline-offset-4",href:s,target:"_blank",rel:"noopener noreferrer",children:m.jsx(pl,{className:"text-inherit",children:s})})})]},i))})]})}function fD({name:n,onNameChange:a,addressPreview:o,nameHint:i,devices:s,selectedDeviceId:u,onSelectDevice:f,onAddDevice:h,creating:p=!1,starting:v=!1,onStartDevice:b,onSubmit:x,onCancel:w,locale:S,copy:A}){const E=Ca(S,A),[R,T]=g.useState(!1),_=s.find(z=>z.id===u),N=_?.status==="stopped",k=p||v,B=n.trim(),X=z=>{z.preventDefault(),!(k||!_)&&(N?b?.(_.id):B&&i?.tone!=="error"&&x())};return m.jsxs("form",{onSubmit:X,"aria-label":E.createWebId,"data-pod-sign-in":"create-webid",className:"flex flex-col gap-4 border-t border-border bg-muted p-4",noValidate:!0,children:[m.jsx(mo,{label:`1 · ${E.createStepName}`,error:i?.tone==="error"?i.text:void 0,hint:i?.tone==="ok"?m.jsx("span",{role:"status",children:i.text}):o?m.jsxs("span",{children:[m.jsxs("span",{className:"sr-only",children:[E.createNameHint,": "]}),m.jsx(pl,{children:o})]}):void 0,children:z=>m.jsx(ra,{...z,name:"webIdName",type:"text",autoComplete:"off",autoCapitalize:"none",spellCheck:!1,value:n,disabled:k,onChange:H=>a(H.target.value)})}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx("p",{className:"text-[13px] font-medium text-foreground",children:`2 · ${E.createStepLocation}`}),_?m.jsxs("div",{className:Bc,"data-pod-sign-in":"selected-device",children:[m.jsx(SS,{device:_,copy:E}),m.jsx("button",{type:"button",className:Ce(Ir,"shrink-0 text-primary hover:underline"),disabled:k,onClick:()=>T(!0),children:E.changeDevice})]}):null,m.jsx("p",{className:"text-[13px] text-muted-foreground",children:E.cannotChangeLater})]}),p?m.jsxs("p",{role:"status","aria-live":"polite",className:"flex items-center gap-2 text-[13px] text-muted-foreground",children:[m.jsx(bS,{}),E.creatingNote]}):null,m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsx(Mt,{type:"submit",className:Rl,busy:k,disabled:!_||(N?!b:!B||i?.tone==="error"),children:N?E.startDeviceXpod:E.createPod}),w?m.jsx(Mt,{variant:"outline",className:mu,disabled:k,onClick:w,children:E.cancel}):null]}),m.jsx(dD,{open:R,onOpenChange:T,devices:s,selectedDeviceId:u,onSelect:f,onAddDevice:()=>{T(!1),h()},locale:S,copy:A})]})}function mD({webIds:n,createOpen:a=!1,onCreateOpenChange:o,createForm:i,onCreateExternal:s,createExternalLabel:u,onLinkExisting:f,onGoToDevice:h,onRemoveStorage:p,removeStorageLabel:v,authorizeStorageLabel:b,onAuthorizeStorage:x,onAuthorizeUnlinkedPod:w,unlinkedPods:S,onRemoveUnlinkedPod:A,locale:E,copy:R}){const T=Ca(E,R),_=g.useId();return m.jsxs("section",{"aria-labelledby":_,"data-pod-sign-in":"webid-section",className:CS,children:[m.jsx(ES,{id:_,icon:aj,title:T.webIdSectionTitle,hint:T.webIdSectionHint,actions:m.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[f?m.jsx(Mt,{variant:"ghost",className:Dr,onClick:f,children:T.linkExistingWebId}):null,i&&!a?m.jsx(Mt,{variant:"outline",className:Dr,onClick:()=>o?.(!0),children:T.createWebId}):null,!i&&s?m.jsx(Mt,{variant:"outline",className:Dr,onClick:s,children:u??T.createWebId}):null]})}),n.length===0?m.jsx("p",{className:"rounded-lg border border-border bg-card px-3 py-3 text-sm text-muted-foreground",children:T.webIdEmpty}):m.jsx("ul",{className:"flex flex-col gap-2",children:n.map(N=>m.jsxs("li",{className:Bc,"data-webid-id":N.id,children:[m.jsx(Lm,{name:N.displayName,avatarUrl:N.avatarUrl,storage:N.storage,size:40}),m.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[m.jsx("a",{className:"truncate text-sm font-medium text-primary hover:underline",href:N.webId,target:"_blank",rel:"noopener noreferrer",children:N.displayName}),N.storage?m.jsx("span",{className:"text-xs text-muted-foreground",children:N.storage.label}):null,m.jsx($b,{webId:N.webId,podUrl:N.podUrl,copy:T}),m.jsxs("span",{className:"flex flex-wrap items-center gap-x-3 text-xs text-muted-foreground",children:[N.deviceName?N.deviceId&&h?m.jsx("button",{type:"button",className:"rounded text-xs text-primary hover:underline",onClick:()=>h(N.deviceId),children:qn(T.podOnDevice,{device:N.deviceName})}):m.jsx("span",{children:qn(T.podOnDevice,{device:N.deviceName})}):null,N.authorizedAppCount!==void 0?m.jsx("span",{children:qn(T.authorizedApps,{count:N.authorizedAppCount})}):null]})]}),!N.removable&&N.authorizable&&x&&b?m.jsx(Mt,{variant:"outline",className:Ce(Dr,"shrink-0"),"aria-label":`${b} ${N.displayName}`,onClick:()=>x(N),children:b}):null,N.removable&&p?m.jsx(Mt,{variant:"outline","aria-label":`${v??T.revokeCredential} ${N.displayName}`,className:Ce(Dr,"shrink-0 border-destructive/50 text-destructive hover:text-destructive"),onClick:()=>p(N),children:v??T.revokeCredential}):null]},N.id))}),S&&S.length>0?m.jsx("ul",{className:"flex flex-col gap-2","data-pod-sign-in":"unlinked-pods",children:S.map(N=>m.jsxs("li",{className:Bc,"data-unlinked-pod-id":N.id,children:[m.jsx(Lm,{name:N.displayName,storage:N.storage,size:40}),m.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[m.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:N.displayName}),N.storage?m.jsx("span",{className:"text-xs text-muted-foreground",children:N.storage.label}):null,m.jsx($b,{podUrl:N.storageUrl,copy:T})]}),!N.removable&&N.authorizable&&w&&b?m.jsx(Mt,{variant:"outline",className:Ce(Dr,"shrink-0"),"aria-label":`${b} ${N.displayName}`,onClick:()=>w(N),children:b}):null,N.removable&&A?m.jsx(Mt,{variant:"outline","aria-label":`${v??T.revokeCredential} ${N.displayName}`,className:Ce(Dr,"shrink-0 border-destructive/50 text-destructive hover:text-destructive"),onClick:()=>A(N),children:v??T.revokeCredential}):null]},N.id))}):null,i&&a?m.jsx(fD,{...i,locale:i.locale??E,copy:i.copy??R,onCancel:i.onCancel??(n.length>0?()=>o?.(!1):void 0)}):null]})}function hD({credentials:n,canCreate:a,onCreate:o,onRevoke:i,locale:s,copy:u}){const f=Ca(s,u),h=g.useId();return m.jsxs("section",{"aria-labelledby":h,"data-pod-sign-in":"credential-section",className:CS,children:[m.jsx(ES,{id:h,icon:$N,title:f.credentialSectionTitle,hint:f.credentialSectionHint,actions:m.jsx(Mt,{variant:"outline",className:Ce(Dr,"shrink-0"),disabled:!a,onClick:o,children:f.createCredential})}),n.length===0?m.jsx("p",{className:"rounded-lg border border-border bg-card px-3 py-3 text-sm text-muted-foreground",children:f.credentialEmpty}):m.jsx("ul",{className:"flex flex-col gap-2",children:n.map(p=>m.jsxs("li",{className:Bc,children:[m.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[m.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:p.label}),m.jsxs("span",{className:"truncate text-xs text-muted-foreground",children:[p.webIdName,p.createdLabel?` · ${p.createdLabel}`:""]})]}),i?m.jsx("button",{type:"button","aria-label":`${f.revokeCredential} ${p.label}`,className:Ce(Ir,"shrink-0 text-destructive hover:underline"),onClick:()=>i(p.id),children:f.revokeCredential}):null]},p.id))})]})}function pD({app:n,podReady:a,onContinue:o,onCancel:i,statusText:s,pending:u=!1,locale:f,copy:h}){const p=Ca(f,h),v=g.useId();return m.jsxs("section",{"aria-labelledby":v,"data-pod-sign-in":"consent-resume",className:"pod-sign-in flex flex-wrap items-center gap-3 rounded-lg bg-muted px-4 py-3 text-foreground",children:[n.icon?m.jsx("span",{"aria-hidden":"true",className:"flex h-8 w-8 shrink-0 items-center justify-center overflow-hidden rounded-lg",children:n.icon}):null,m.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[m.jsx("p",{id:v,className:"text-sm font-semibold",children:qn(p.resumeTitle,{app:n.name})}),m.jsx("p",{role:"status","aria-live":"polite",className:"text-[13px] text-muted-foreground",children:s??(a?p.resumeReady:p.resumeWaiting)})]}),m.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[m.jsx("button",{type:"button",className:Ce(Ir,"text-primary hover:underline"),disabled:u,onClick:i,children:p.resumeCancel}),m.jsx(Mt,{className:"h-11 rounded-lg px-4 text-sm font-medium",busy:u,disabled:!a,onClick:o,children:qn(p.resumeContinue,{app:n.name})})]})]})}function Hc(n){try{const a=new URL(n),o=a.pathname.split("/").filter(i=>i&&!["profile","card"].includes(i));return o[o.length-1]??a.hostname}catch{return n}}function AS({frame:n,testId:a,children:o}){return n==="bare"?m.jsx("div",{"data-testid":a,"data-account-auxiliary-frame":"bare",className:"w-full text-card-foreground",children:o}):m.jsx(kw,{className:"w-full border-border bg-card text-card-foreground",children:m.jsx(vS,{"data-testid":a,className:"max-h-[min(70vh,36rem)] overflow-y-auto",children:o})})}function gD({email:n,onEmailChange:a,onSubmit:o,onRecover:i,pending:s=!1,status:u="idle",error:f,copy:h,frame:p="card",showHeader:v=!0}){const b=g.useId(),x=s||u==="submitting",w=o??i,S=E=>{E.preventDefault(),x||w?.(n)},A=m.jsxs(m.Fragment,{children:[v?m.jsxs(uh,{className:p==="bare"?"p-0 pb-4":void 0,children:[m.jsx(dh,{children:h.title}),h.description?m.jsx(fh,{children:h.description}):null]}):null,m.jsx(zc,{className:p==="bare"?"p-0":void 0,children:u==="success"?m.jsxs("div",{role:"status","aria-live":"polite",className:"space-y-2",children:[m.jsx("p",{className:"font-medium text-foreground",children:h.successTitle}),m.jsx("p",{className:"text-sm text-muted-foreground",children:h.successMessage})]}):m.jsxs("form",{onSubmit:S,className:"space-y-4",children:[m.jsxs("div",{className:"space-y-2",children:[m.jsx(Pc,{htmlFor:b,children:h.emailLabel}),m.jsx(du,{id:b,name:"email",autoComplete:"email",placeholder:h.emailPlaceholder,value:n,disabled:x,onChange:E=>a(E.currentTarget.value)})]}),f?m.jsx("p",{role:"alert","aria-live":"polite",className:"text-sm text-destructive",children:f}):null,m.jsxs(Qe,{type:"submit",className:"w-full",disabled:x||!n.trim()||!w,children:[x?m.jsx(nu,{"aria-hidden":"true",className:"mr-2 h-4 w-4 animate-spin"}):null,h.actionLabel]})]})})]});return m.jsx(AS,{frame:p,testId:"password-recovery-scroll",children:A})}function vD({password:n,confirmation:a,onPasswordChange:o,onConfirmationChange:i,onSubmit:s,onReset:u,pending:f=!1,status:h="idle",error:p,copy:v,frame:b="card",showHeader:x=!0}){const w=g.useId(),S=g.useId(),A=f||h==="submitting",E=s??u,R=n.length>0&&n!==a,T=N=>{N?.preventDefault(),!A&&(R||E?.({password:n,confirmation:a}))},_=h==="success"?m.jsx(zc,{className:b==="bare"?"p-0":void 0,children:m.jsx("p",{role:"status","aria-live":"polite",children:v.successMessage})}):m.jsxs(m.Fragment,{children:[x?m.jsxs(uh,{className:b==="bare"?"p-0 pb-4":void 0,children:[m.jsx(dh,{children:v.title}),v.description?m.jsx(fh,{children:v.description}):null]}):null,m.jsx(zc,{className:b==="bare"?"p-0":void 0,children:m.jsxs("form",{onSubmit:T,className:"space-y-4",children:[m.jsxs("div",{className:"space-y-2",children:[m.jsx(Pc,{htmlFor:w,children:v.passwordLabel}),m.jsx(ra,{id:w,type:"password",autoComplete:"new-password",placeholder:v.passwordPlaceholder,value:n,disabled:A,onChange:N=>o(N.currentTarget.value)})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(Pc,{htmlFor:S,children:v.confirmationLabel}),m.jsx(ra,{id:S,type:"password",autoComplete:"new-password",placeholder:v.confirmationPlaceholder,value:a,disabled:A,"aria-invalid":R?!0:void 0,onChange:N=>i(N.currentTarget.value)})]}),p?m.jsx("p",{role:"alert","aria-live":"polite",className:"text-sm text-destructive",children:p}):null,R?m.jsx("p",{role:"alert","aria-live":"polite",className:"text-sm text-destructive",children:v.mismatchError}):null,m.jsxs(Qe,{type:"submit",className:"w-full",disabled:A||!E,children:[A?m.jsx(nu,{"aria-hidden":"true",className:"mr-2 h-4 w-4 animate-spin"}):null,v.actionLabel]})]})})]});return m.jsx(AS,{frame:b,testId:"password-reset-scroll",children:_})}function Ki(){return globalThis.xpodDesktop?"window":"document"}function RS(n=!0,a="auth"){g.useEffect(()=>{if(n)return globalThis.xpodDesktop?.setWindowMode?.(a),()=>{globalThis.xpodDesktop?.setWindowMode?.("workspace")}},[n,a])}function TS({title:n,description:a,children:o,host:i="document",bare:s=!1,intro:u,serviceIcon:f}){const h=g.useId(),p=i==="window",v=p?"window":"page";return m.jsx("main",{"data-testid":"web-account-page",className:p?"h-dvh w-full overflow-hidden":void 0,children:m.jsx(Q_,{presentation:p?"window":"page",ariaLabel:n,appIntro:u,dataAttributes:{"data-web-account-layout":v,"data-web-account-host":p?"window":"document"},children:m.jsx("div",{"data-testid":"web-account-panel","data-web-account-layout":v,"data-web-account-host":p?"window":"document",className:"flex min-h-0 min-w-0 flex-1 flex-col",children:s?o:m.jsxs(Zi,{chrome:m.jsx(Lh,{serviceName:"Xpod",serviceHost:window.location.host,icon:f}),children:[m.jsxs("header",{className:"flex flex-col gap-1",children:[m.jsx("h1",{id:h,className:"text-[17px] font-semibold text-foreground",children:n}),a?m.jsx("p",{className:"text-sm leading-[22px] text-muted-foreground",children:a}):null]}),o]})})})})}const yD={"zh-CN":{name:"Xpod 账号服务",proposition:"一个账号,管理你的 WebID 和它背后的 Pod。",points:[{title:"WebID 是你的身份",detail:"登录应用时使用它;数据存在你自己的 Pod 里。"},{title:"Pod 存在哪里由你决定",detail:"Xpod 云端或你自己的设备,创建后可以在这里查看。"},{title:"密钥按需签发",detail:"为脚本或服务单独创建凭据,不再需要就撤销。"}]},en:{name:"Xpod accounts",proposition:"One account for your WebID and the Pod behind it.",points:[{title:"Your WebID is your identity",detail:"Apps sign you in with it; your data stays in your own Pod."},{title:"You choose where the Pod lives",detail:"Xpod cloud or your own device, reviewable here after creation."},{title:"Credentials on demand",detail:"Issue a key per script or service, and revoke it when it is done."}]}};function NS({serviceHost:n,locale:a="zh-CN"}){const o=yD[a];return m.jsxs("div",{"data-testid":"web-account-introduction",className:"flex max-w-[460px] flex-col gap-7",children:[m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx(fu,{size:44}),m.jsx("span",{className:"text-[22px] font-semibold leading-none text-foreground",children:o.name})]}),m.jsxs("div",{className:"flex flex-col gap-3",children:[m.jsx("h2",{className:"m-0 text-[28px] font-semibold leading-[38px] text-foreground",children:o.proposition}),n?m.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:n}):null]}),m.jsx("ul",{className:"m-0 flex list-none flex-col gap-4 p-0",children:o.points.map(i=>m.jsxs("li",{className:"flex gap-3",children:[m.jsx("span",{"aria-hidden":"true",className:"mt-2 h-2 w-2 shrink-0 rounded-full bg-primary"}),m.jsxs("span",{className:"flex flex-col gap-0.5",children:[m.jsx("span",{className:"text-[15px] font-semibold text-foreground",children:i.title}),m.jsx("span",{className:"text-sm leading-[22px] text-muted-foreground",children:i.detail})]})]},i.title))})]})}function bD(n){if(!n||typeof n!="object")throw new Error("Missing deployment identity");const a=n;if(a.edition!=="cloud"&&a.edition!=="local"||typeof a.managed!="boolean")throw new Error("Invalid deployment identity");let o;if(a.edition==="local"&&a.managed&&typeof a.oidcIssuer=="string"){const s=new URL(a.oidcIssuer);if(!["http:","https:"].includes(s.protocol)||s.username||s.password||s.search||s.hash)throw new Error("Invalid account service");o=s.href.replace(/\/$/u,"")}let i;if(typeof a.publicUrl=="string"){const s=new URL(a.publicUrl);if(!["http:","https:"].includes(s.protocol)||s.username||s.password||s.search||s.hash)throw new Error("Invalid public service address");i=s.href}return{edition:a.edition,managed:a.managed,oidcIssuer:o,publicUrl:i}}function Xc({renderLogo:n,className:a}={}){const[o,i]=g.useState();g.useEffect(()=>{const f=new AbortController;return(async()=>{try{const h=await fetch("/api/service-info",{headers:{accept:"application/json"},cache:"no-store",signal:f.signal});if(!h.ok)throw new Error("Deployment identity unavailable");const p=bD(await h.json());f.signal.aborted||i(p)}catch{f.signal.aborted||i(null)}})(),()=>f.abort()},[]);const s=o?o.edition==="cloud"?"云端":o.managed?"托管部署":"独立部署":o===null?"部署信息暂不可用":"正在识别部署…",u=n?n(s):m.jsxs("span",{"data-testid":"xpod-deployment-logo",className:"inline-flex flex-col items-center gap-0.5",children:[m.jsx(fu,{size:24}),m.jsx("span",{className:"text-[8px] font-medium leading-none text-primary",children:o?s:o===null?"未知":"…"}),o?null:m.jsx("span",{className:"sr-only",children:s})]});return m.jsx("div",{"data-testid":"xpod-deployment-identity",className:a,children:m.jsx(pO,{logo:u,infoLabel:"部署详情",info:m.jsxs("div",{className:"space-y-2 leading-relaxed",children:[m.jsx("p",{className:"font-semibold",children:"部署详情"}),o?m.jsxs("p",{children:["部署类型:",o.edition==="cloud"?"Cloud":o.managed?"Local · 云端托管":"Local · 独立部署"]}):m.jsx("p",{children:s}),m.jsxs("p",{children:["当前访问:",m.jsx("span",{className:"font-mono",children:window.location.origin})]}),o?m.jsxs("p",{children:[o.edition==="local"?"节点地址":"服务地址",":",m.jsx("span",{className:"font-mono",children:o.publicUrl??(o.managed?"尚未分配":"尚未配置")})]}):null,o?.oidcIssuer&&o.oidcIssuer!==window.location.origin?m.jsxs("p",{children:["账号服务:",m.jsx("span",{className:"font-mono",children:o.oidcIssuer})]}):null]})})})}function yo({title:n,children:a,bare:o=!1,intro:i,presentation:s="compact"}){const u=Ki(),f=s==="compact";return RS(u==="window",f?"account":"workspace"),m.jsx(TS,{title:n,host:f?u:"document",bare:o,intro:i??m.jsx(NS,{serviceHost:window.location.host}),serviceIcon:m.jsx(Xc,{}),children:a})}function xD(n){return{email:n.emailLabel,password:n.passwordLabel,username:n.usernameLabel,signIn:n.loginAction,registerSubmit:n.registerAction,rememberDevice:"记住账号"}}function wD(n){const a=Ki(),o=n.mode!=="register";RS(a==="window",o?"account":"workspace");const{mode:i,values:s,onChange:u,onSubmit:f,onFieldChange:h,onModeChange:p,rememberAccount:v=!0,onRememberAccountChange:b,pending:x=!1,errors:w,copy:S,surfaceTitle:A,footer:E,onForgot:R,onRegister:T,forgotHref:_,registerHref:N}=n,k={serviceName:"Xpod",serviceHost:window.location.host,serviceIcon:m.jsx(Xc,{}),copy:xD(S)},B=(X,z)=>{u({...s,[X]:z}),h?.(X,z)};return m.jsxs(TS,{title:A,host:o?a:"document",bare:!0,intro:m.jsx(NS,{serviceHost:window.location.host}),children:[i==="register"?m.jsx(aD,{...k,requireUsername:!1,pending:x,defaultEmail:s.email,defaultPassword:s.password,error:w?.form,fieldErrors:{email:w?.email,password:w?.password},onFieldChange:B,onSubmit:X=>{f({...s,...X})},onSignIn:p?()=>p("login"):void 0}):m.jsx(nD,{...k,pending:x,remember:v,defaultEmail:s.email,defaultPassword:s.password,error:w?.form,fieldErrors:{email:w?.email,password:w?.password},onFieldChange:B,onRememberChange:b,onSubmit:X=>{f({...s,...X})},onForgot:R,forgotHref:_,registerHref:N,onRegister:T??(p?()=>p("register"):void 0)}),E?m.jsx("div",{className:"space-y-3",children:E}):null]})}function SD(){return m.jsx(yo,{title:"正在加载 Xpod",children:m.jsxs("div",{role:"status","aria-live":"polite",className:"flex flex-1 items-center justify-center p-5 text-sm text-muted-foreground",children:[m.jsx(nu,{"aria-hidden":"true",className:"mr-2 h-5 w-5 animate-spin"}),"正在加载…"]})})}function CD(){const[n,a]=g.useState(!1),[o,i]=g.useState(!1),s=g.useRef(!1);if(!window.xpodDesktop?.cancelLogin)return null;const u=async()=>{const f=window.xpodDesktop;if(!(s.current||!f?.cancelLogin)){s.current=!0,a(!0),i(!1);try{await f.cancelLogin()}catch{i(!0)}finally{s.current=!1,a(!1)}}};return m.jsxs("div",{className:"space-y-2",children:[o&&m.jsx("p",{role:"alert",className:"text-sm text-destructive",children:"返回应用未完成,请重试。"}),m.jsx(Qe,{type:"button",variant:"ghost",className:"w-full",disabled:n,"aria-busy":n,onClick:()=>{u()},children:n?"正在返回…":"返回应用"})]})}function ED({message:n,retry:a}){return m.jsx(yo,{title:"账号服务暂时不可用",children:m.jsxs("div",{className:"space-y-6",children:[m.jsx("p",{role:"alert",className:"text-sm leading-relaxed text-muted-foreground",children:"无法读取账号服务信息。请重试当前步骤,无需重新注册或清除登录状态。"}),m.jsxs("details",{className:"text-xs text-muted-foreground",children:[m.jsx("summary",{className:"cursor-pointer",children:"技术详情"}),m.jsx("p",{className:"mt-2 break-words",children:n})]}),m.jsx(Qe,{type:"button",className:"w-full",onClick:()=>a?void a():window.location.reload(),children:"重试"}),m.jsx(CD,{})]})})}const km="xpod:returnTo";function ji(n){try{n&&sessionStorage.setItem(km,n)}catch{return}}function Mh(){try{const n=sessionStorage.getItem(km);return n&&sessionStorage.removeItem(km),n}catch{return null}}function AD(){try{const n=new URLSearchParams(window.location.search).get("returnTo");return!n||new URL(n,window.location.origin).origin!==window.location.origin?null:n}catch{return null}}function RD(n,a){return ee(n?"/.account/oidc/consent/":Mh()??a)}function TD(n,a,o=!1){return n&&a&&!o}function rm({children:n,allowOidcPending:a=!1}){const{controls:o,isLoggedIn:i,hasOidcPending:s}=vn(),u=gn();if(TD(i,s,a))return m.jsx(aa,{to:ee("/.account/oidc/consent/"),replace:!0});if(!i){ji(u.pathname+u.search);const f=o?.html?.password?.login||o?.password?.login||ee("/.account/login/password/");return m.jsx(aa,{to:ee(f),replace:!0})}return m.jsx(m.Fragment,{children:n})}function jS(n){if(n)try{const a=new URL(n,window.location.origin);return!["https:","http:"].includes(a.protocol)||a.username||a.password||a.pathname!=="/.account/"?void 0:(a.search="",a.hash="",new URL("account/",a).href)}catch{return}}function Tl(n){return n!==n.trim()||/[\r\n\t]/.test(n)}const ND=["/dashboard","/status","/network","/settings","/ai-config","/ai-connections","/tasks","/pod","/device","/inbox","/notifications"],jD=new Set(["/tasks","/pod","/pod/models","/pod/search","/pod/apps","/pod/data","/device","/device/network","/device/services","/device/runtime","/device/logs","/inbox","/notifications"]);function OD(n){const a=n.replace(/\/$/u,"");return jD.has(a)?!0:ND.slice(0,6).some(o=>a===o||a.startsWith(`${o}/`))}function _D(n){if(n===void 0)return;if(typeof n!="string"||n.trim()==="")throw new TypeError("returnTo must be a non-empty application path");const a=n.trim(),o=DD(a),i=o.split(/[?#]/,1)[0];if(!a.startsWith("/")||a.startsWith("//")||a.includes("\\")||o.includes("\\")||/^[a-z][a-z\d+.-]*:/i.test(o)||o.startsWith("//")||i.split("/").some(s=>s==="..")||!OD(i))throw new TypeError("returnTo must be a safe path within the application allow-list");return a}function DD(n){let a=n;for(let o=0;o<4;o+=1){let i;try{i=decodeURIComponent(a)}catch{throw new TypeError("returnTo contains malformed percent encoding")}if(i===a)return a;a=i}return a}const Mm="xpod-current-origin";function UD(n){return _D(n)}function zD(n,a){const o=Xx(n),i=new URL(a).origin,s=new URL(o.identityProvider.url).origin,u=o.storageProvider?new URL(o.storageProvider.url).origin:void 0;if(o.id!==Mm||s!==i||u!==i||o.identityProvider.url!==o.storageProvider?.url)throw new TypeError("Xpod login route must use the current origin for identity and storage");return{...o,identityProvider:{...o.identityProvider,url:i},storageProvider:o.storageProvider?{...o.storageProvider,url:i}:void 0}}const jc="xpod.remembered-login.v1",Oi="xpod.pending-account-email.v1",Ii="xpod.pending-account-issuer.v1",Im="xpod.account-remember-choice.v1";function pu(){if(!(typeof window>"u"))try{return window.localStorage}catch{return}}function LD(n={}){const a=n.storage??pu();if(a)try{const o=a.getItem(jc);if(!o)return;const i=ID(JSON.parse(o),n.origin??vu());return i||a.removeItem(jc),i}catch{try{a.removeItem(jc)}catch{}return}}function OS(n,a=pu()){try{const i=JSON.parse(a?.getItem(Im)??"{}")[gu(n??vu()??"")];return typeof i=="boolean"?i:void 0}catch{return}}function _S(){try{return typeof window>"u"?void 0:window.sessionStorage}catch{return}}function Fb(n,a){const o=n?.getItem(Ii);(!o||o===a)&&(n?.removeItem(Oi),n?.removeItem(Ii))}function kD(n,a=pu(),o,i=!0,s=_S()){const u=Ih(n);if(!u)return;const f=gu(o??vu()??"");try{const h=JSON.parse(a?.getItem(Im)??"{}"),p=h&&typeof h=="object"&&!Array.isArray(h)?h:{};if(a?.setItem(Im,JSON.stringify({...p,[f]:i})),!i){Fb(a,f);const b=LD({storage:a});(!b?.issuer||b.issuer===f)&&a?.removeItem(jc)}const v=i?a:s;return v?(v.setItem(Oi,u),v.setItem(Ii,f),i&&Fb(s,f),u):void 0}catch{return}}function MD(n=pu(),a,o=_S()){const i=OS(a,n)===!1?o:n;if(i)try{const s=Ih(i.getItem(Oi));if(a){const u=i.getItem(Ii);if(!u){i.removeItem(Oi),i.removeItem(Ii);return}if(u!==gu(a))return}return s||i.removeItem(Oi),s}catch{return}}function gu(n){try{const a=vu();return a?new URL(n,a).origin:new URL(n).origin}catch{return n.trim()}}function ID(n,a){if(!n||typeof n!="object")return;const o=n;if(o.routeId!==Mm||o.issuer!==void 0&&!Pi(o.issuer)||!o.account||typeof o.account!="object"||!o.storageBinding||typeof o.storageBinding!="object")return;const i=o.account,s=o.storageBinding,u=Ih(i.email),f=Qb(o.webId),h=Qb(s.webId),p=Pi(s.storageUrl,!0);if(i.email!==void 0&&!u||!f||!h||!p||f!==h)return;const v=PD(i.avatarUrl,[f,p,a]);return{...typeof o.issuer=="string"?{issuer:gu(o.issuer)}:{},account:{...u?{email:u}:{},...sl(i.id)?{id:sl(i.id)}:{},...sl(i.username)?{username:sl(i.username)}:{},...sl(i.displayName)?{displayName:sl(i.displayName)}:{},...v?{avatarUrl:v}:{}},webId:f,storageBinding:{webId:f,storageUrl:p},routeId:Mm}}function Ih(n){if(typeof n!="string")return;const a=n.trim();return a&&a.length<=320&&a.includes("@")?a:void 0}function sl(n){if(typeof n!="string")return;const a=n.replace(/\s+/g," ").trim();return a?Array.from(a).slice(0,160).join(""):void 0}function Qb(n){return typeof n=="string"&&!Tl(n)&&Pi(n)?n:void 0}function Pi(n,a=!1){if(!(typeof n!="string"||n.length>2048))try{const o=new URL(n);return o.username||o.password||o.protocol!=="http:"&&o.protocol!=="https:"?void 0:(a&&(o.hash="",o.pathname.endsWith("/")||(o.pathname+="/")),o.href)}catch{return}}function PD(n,a){const o=Pi(n);if(!o)return;const i=new URL(o).origin;return a.some(s=>{const u=Pi(s);return u&&new URL(u).origin===i})?o:void 0}function vu(){return typeof window>"u"?void 0:window.location.origin}function BD(n,a){const o=DS(n,a),[i,s]=g.useState();o&&i&&i.issuer===void 0&&s({issuer:o,value:i.value});const u=o?OS(o):void 0;return[i&&(i.issuer===o||i.issuer===void 0)?i.value:u??!1,p=>s({issuer:o,value:p})]}function DS(n,a){const o=a?void 0:jS(n);return o?new URL(o).origin:void 0}function HD(n,a,o){const i=DS(n,a),s=v=>MD(void 0,v)??"",[u,f]=g.useState(()=>({issuer:i,values:{email:i?s(i):"",password:"",confirmation:""},emailEdited:!1}));let h=u;if(i&&u.issuer!==i){const v=u.issuer===void 0;h={issuer:i,values:v?{...u.values,email:u.emailEdited?u.values.email:s(i)}:{email:s(i),password:"",confirmation:""},emailEdited:v&&u.emailEdited},f(h)}const p=v=>{f(b=>{const x=typeof v=="function"?v(b.values):v;return{...b,values:x,emailEdited:b.emailEdited||x.email!==b.values.email}})};return[h.values,p,i]}const XD={productName:"Xpod 账号",loginTitle:"登录",registerTitle:"创建账号",usernameLabel:"Pod 名称",usernamePlaceholder:"选择 Pod 名称",emailLabel:"邮箱",emailPlaceholder:"you@example.com",passwordLabel:"密码",passwordPlaceholder:"输入密码",confirmationLabel:"确认密码",confirmationPlaceholder:"再次输入密码",loginAction:"登录",registerAction:"创建账号",switchToRegister:"切换用户",switchToLogin:"返回登录",usernameChecking:"正在检查 Pod 名称…",usernameAvailable:"Pod 名称可用",usernameUnavailable:"Pod 名称不可用",suggestionsLabel:"可用建议",mismatchError:"两次输入的密码不一致"},Zb={title:"找回密码",description:"如果这个邮箱已注册,我们会发送重置链接。",emailLabel:"邮箱",emailPlaceholder:"you@example.com",actionLabel:"发送重置链接",successTitle:"请查收邮件",successMessage:"如果该邮箱已注册,重置链接已经发出。"},Kb={title:"设置新密码",description:"为你的账号选择一个新密码。",passwordLabel:"新密码",passwordPlaceholder:"输入新密码",confirmationLabel:"确认密码",confirmationPlaceholder:"再次输入密码",actionLabel:"重设密码",successMessage:"密码已重设。",mismatchError:"两次输入的密码不一致"},Fa={loginSurfaceTitle:"登录",registerSurfaceTitle:"创建账号",recoverSurfaceTitle:"找回密码",resetSurfaceTitle:"重设密码",backToSignIn:"返回登录",cancelAuthorization:"取消授权",cancellingAuthorization:"正在取消…",resend:"重新发送"},Wt={surfaceTitle:"授权",signInRequiredTitle:"需要先登录",signInRequiredDescription:"请先登录,再批准这次请求并选择要共享的 WebID。",goToSignIn:"去登录",unavailableTitle:"暂时无法授权",tryAgain:"重试",dismiss:"关闭",restoring:"正在恢复授权…",applicationFallback:"这个应用",denyLabel:"拒绝",switchAccountLabel:"换一个账号",conflictMessage:"所选存储空间与当前身份不匹配。",retryLabel:"重试",goToPodManagementLabel:"前往 Pod 管理"},ga={usernameRequired:"请填写 Pod 名称",usernameLength:"Pod 名称需为 3-63 个字符",usernameCharset:"Pod 名称只能包含小写字母、数字和连字符",usernameHyphen:"Pod 名称不能以连字符开头或结尾",emailAlreadyRegistered:"该邮箱已注册,请登录或重置密码。",emailAlreadyRegisteredPasswordMismatch:"该邮箱已注册,但密码不正确,请登录或重置密码。",podNameTaken:"Pod 名称已被占用,请换一个。"};function Jb(n){return n===401||n===403?"邮箱或密码不正确。":n===429?"尝试次数过多,请稍后再试。":"登录失败,请重试。"}function YD(){return"无法完成注册,请重试。"}function ex(){return"取消授权失败,请重试。"}const Ue={invalidTransaction:"登录状态无效。",expiredInteraction:"本次授权请求已失效,请返回应用重新发起登录。",bindingUnavailable:"应用选择的身份与存储空间已不可用,请返回应用重新选择。",returnFailed:"无法返回应用,请重试。",signInRequired:"请先登录,再继续授权。",loadFailed:"无法加载授权信息,请重试。",clientUnavailable:"无法获取应用信息。",bindingsFailed:"无法加载 WebID 绑定,请重试。",signOutIncomplete:"退出未完成,请重试。",cancelFailed:"取消授权失败,请重试。",chooseStorage:"批准前请先选择存储空间。",cannotPersistStorage:"当前浏览器无法保存这次存储选择。",webIdSelectionFailed:"无法完成 WebID 选择,请重试。",authorizationFailed:"无法完成授权,请重试。",missingRedirect:"授权已完成,但没有返回跳转地址,请重新登录。",choosePodName:"创建存储空间前请先填写 Pod 名称。",storageCreationUnavailable:"暂时无法创建存储空间。",storageCreateFailed:"无法创建存储空间,请重试。"},$t={checkFailed:"无法检查存储空间状态,请重试。",accountIdentityMissing:"当前账号信息不完整,暂时无法创建 Pod。请刷新后重试。",createEndpointMissing:"找不到创建 Pod 的接口,请刷新后重试。",cloudRouteUnavailable:"本机 Xpod 还没有和 Cloud 打通,暂时不能准备存储空间。请保持 Xpod 运行,稍后重试。",storageCreateFailed:"无法创建存储空间,请重试。",cancelFailed:"取消授权失败,请重试或直接关闭此页面。",authorizationUnavailable:"原来的授权已经失效,或暂时无法确认它仍然有效。请回到授权页面重试或重新发起。"};function tx(n){return n===429?"请求过多,请稍后再试。":"无法发送重置链接,请重试。"}function nx(n){return n===400||n===404?"重置链接无效或已过期。":"无法重设密码,请重试。"}const qD="xpod.account.locale";function ax(n){if(n==="en"||n==="zh-CN")return n;try{if(window.localStorage.getItem(qD)==="en")return"en"}catch{}return"zh-CN"}const VD={"zh-CN":{serviceName:"账号服务",brandName:"Xpod",dashboardTitle:"账号总览",about:"关于",signOut:"退出登录",authorizationPendingTitle:"等待授权",authorizationPendingLead:"有应用正在等待你的授权",continueAuthorization:"继续授权",cancelAuthorization:"取消授权",cancelAuthorizationFailed:"取消授权失败,请重试。",authorizationUnavailable:"当前授权已失效,请回到应用重新发起。",storageTitle:"存储空间",storageLead:"你的个人数据存储(Pod)。这里的数据由你拥有和控制。",managePods:"管理 Pod",workspaceTitle:"桌面 Xpod",openWorkspace:"桌面管理入口",workspaceHint:"使用桌面 Xpod 管理自己的部署、AI 连接和系统设置。",noPodOnDevice:"这台设备还没有 Pod。创建一个即可在这里存储数据。",noPodsFound:"还没有 Pod。创建一个即可开始。",podLabel:"Pod",deletePod:"删除 Pod",enablePodDeletion:"启用删除",enablePodDeletionFailed:"无法打开设备授权页面,请重试。",identityTitle:"身份",identityLead:"你的去中心化标识(WebID)。这是你在 Solid 网络上的身份。",noWebIds:"还没有 WebID。先创建存储空间即可获得 WebID。",credentialsTitle:"Solid 客户端凭据",credentialsLead:"供需要直接访问 Pod 的客户端使用的 Solid 凭据。Xpod API Key 在 AI 连接中管理。",newCredential:"新建凭据",credentialEndpointMissing:"尚未配置客户端凭据接口。",credentialName:"凭据名称",selectWebId:"选择 WebID",cancel:"取消",create:"创建",creating:"正在创建…",credentialCreated:"新的 Solid 客户端凭据已创建",credentialCreatedLead:"请立即复制 Client ID 与 Client Secret。Secret 不会再次显示。",clientId:"Client ID",clientSecret:"Client Secret",copyClientId:"复制 Client ID",copyClientSecret:"复制 Client Secret",done:"完成",noCredentials:"还没有客户端凭据。",revokeCredential:"吊销凭据",securityTitle:"安全",passwordLabel:"密码",passwordLead:"更新你的账号密码",changePassword:"修改密码",closeError:"关闭错误提示",deletePodConfirm:n=>`删除 Pod ${n}?此操作无法撤销。`,deletePodWarning:"此操作会永久删除这个 Pod 的数据,无法撤销。请确认下面的存储地址。",deletePodFailed:"无法删除 Pod,请重试。",deletePodNodeUnavailable:"无法连接这个 Pod 所在的设备。请确认设备在线后重试。",deletePodNodeFailed:"设备未能完成删除。请检查设备状态后重试。",deletePodNotAcknowledged:"尚未收到设备的删除确认,请重试以确认结果。",deletePodUnsupported:"这个存储服务暂不支持在此删除 Pod。",deleting:"正在删除…",revokeCredentialFailed:"无法吊销客户端凭据,请重试。",actionUnavailable:"当前账号或操作已失效,请刷新后重试。",deleteCredentialConfirm:"删除这条凭据?此操作无法撤销。"},en:{serviceName:"Account service",brandName:"Xpod",dashboardTitle:"Account Dashboard",about:"About",signOut:"Sign out",authorizationPendingTitle:"Authorization Pending",authorizationPendingLead:"An application is waiting for your authorization",continueAuthorization:"Continue",cancelAuthorization:"Cancel authorization",cancelAuthorizationFailed:"Could not cancel the authorization. Try again.",authorizationUnavailable:"This authorization is no longer valid. Start again from the application.",storageTitle:"Storage",storageLead:"Your personal data stores (Pods). You own and control all data stored here.",managePods:"Manage Pods",workspaceTitle:"Xpod workspace",openWorkspace:"Open Xpod workspace",workspaceHint:"Manage Pods, AI connections and system settings in the workspace.",noPodOnDevice:"This device has no Pod yet. Create one to store data here.",noPodsFound:"No Pods found. Create one to get started.",podLabel:"Pod",deletePod:"Delete Pod",enablePodDeletion:"Enable deletion",enablePodDeletionFailed:"Could not open device authorization. Try again.",identityTitle:"Identity",identityLead:"Your unique decentralized identifiers (WebIDs). This is your identity on the Solid network.",noWebIds:"No WebIDs found. Create a Pod first to get a WebID.",credentialsTitle:"Solid Client Credentials",credentialsLead:"Solid credentials for clients that need direct Pod access. Xpod API Keys are managed in AI Connections.",newCredential:"New Credential",credentialEndpointMissing:"Client credential endpoint not configured.",credentialName:"Credential Name",selectWebId:"Select WebID",cancel:"Cancel",create:"Create",creating:"Creating...",credentialCreated:"New Solid Client Credential Created",credentialCreatedLead:"Copy the Client ID and Client Secret now. The secret will not be shown again.",clientId:"Client ID",clientSecret:"Client Secret",copyClientId:"Copy Client ID",copyClientSecret:"Copy Client Secret",done:"Done",noCredentials:"No client credentials found.",revokeCredential:"Revoke Credential",securityTitle:"Security",passwordLabel:"Password",passwordLead:"Update your account password",changePassword:"Change Password",closeError:"Dismiss error",deletePodConfirm:n=>`Delete pod ${n}? This cannot be undone.`,deletePodWarning:"This permanently deletes the data in this Pod and cannot be undone. Check the storage address below.",deletePodFailed:"Could not delete the Pod. Try again.",deletePodNodeUnavailable:"Cannot connect to the device hosting this Pod. Check that it is online and try again.",deletePodNodeFailed:"The device could not finish deleting the Pod. Check its status and try again.",deletePodNotAcknowledged:"The device has not confirmed deletion yet. Retry to check the result.",deletePodUnsupported:"This storage service does not support deleting Pods here yet.",deleting:"Deleting…",revokeCredentialFailed:"Could not revoke the client credential. Try again.",actionUnavailable:"This account or action is no longer valid. Refresh and try again.",deleteCredentialConfirm:"Delete this credential? This cannot be undone."}};function GD(n="zh-CN"){return VD[n]}const WD=3,$D=63,FD=/^[a-z0-9-]+$/;function yu(n){return n.trim().toLowerCase()}function Yc(n){const a=yu(n);if(!a)return ga.usernameRequired;if(a.length<WD||a.length>$D)return ga.usernameLength;if(!FD.test(a))return ga.usernameCharset;if(a.startsWith("-")||a.endsWith("-"))return ga.usernameHyphen}class Hn extends Error{code;constructor(a,o){super(o),this.name="AccountStorageBindingsError",this.code=a}}async function Ph(n){const a=ZD(n.origin),o=n.controls?.account?.bindings;if(typeof o!="string"||o.trim()==="")throw new Hn("missing-control","Account storage bindings control is unavailable");const i=n.fetchImpl??fetch,s=KD(o,a),u=s.origin===a?s.href:await Lt(s.href,i,n.trustedAccountIndex);if(!u)throw new Hn("cross-origin","Account storage bindings control is not hosted by this Xpod");const f=tt({Accept:"application/json",...n.headers});let h;try{h=await i(u,{headers:f,credentials:"include"})}catch(v){throw new Hn("request-failed",v instanceof Error?v.message:"Failed to load Account storage bindings")}if(h.status===401||h.status===403)throw new Hn("forbidden","Account storage bindings require an authenticated Account");if(!h.ok)throw new Hn("request-failed",`Account storage bindings request failed (${h.status})`);let p;try{p=await h.json()}catch{throw new Hn("invalid-response","Account storage bindings response is not valid JSON")}return QD(p,s.origin,tU(s,n.trustedAccountIndex,a))}function QD(n,a,o=!1){if(!rx(n)||!Array.isArray(n.bindings))throw new Hn("invalid-response","Account storage bindings response is malformed");const i=[],s=new Set;for(const u of n.bindings){if(!rx(u)||typeof u.webId!="string"||typeof u.storageUrl!="string")throw new Hn("invalid-response","Account storage binding row is malformed");const f=JD(u.webId),h=eU(u.storageUrl,o?void 0:a);if(!f||!h)throw new Hn("cross-origin","Account storage binding is outside the trusted storage scope");const p={webId:f,storageUrl:h,...typeof u.label=="string"?{label:u.label}:{}},v=`${p.webId}
|
|
51
|
+
`)},KO=0,ll=[];function JO(n){var a=g.useRef([]),o=g.useRef([0,0]),i=g.useRef(),s=g.useState(KO++)[0],u=g.useState(P0)[0],f=g.useRef(n);g.useEffect(function(){f.current=n},[n]),g.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(s));var E=xO([n.lockRef.current],(n.shards||[]).map(Vb),!0).filter(Boolean);return E.forEach(function(R){return R.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),E.forEach(function(R){return R.classList.remove("allow-interactivity-".concat(s))})}}},[n.inert,n.lockRef.current,n.shards]);var h=g.useCallback(function(E,R){if("touches"in E&&E.touches.length===2||E.type==="wheel"&&E.ctrlKey)return!f.current.allowPinchZoom;var T=wc(E),_=o.current,N="deltaX"in E?E.deltaX:_[0]-T[0],k="deltaY"in E?E.deltaY:_[1]-T[1],B,X=E.target,z=Math.abs(N)>Math.abs(k)?"h":"v";if("touches"in E&&z==="h"&&X.type==="range")return!1;var H=window.getSelection(),re=H&&H.anchorNode,J=re?re===X||re.contains(X):!1;if(J)return!1;var oe=Yb(z,X);if(!oe)return!0;if(oe?B=z:(B=z==="v"?"h":"v",oe=Yb(z,X)),!oe)return!1;if(!i.current&&"changedTouches"in E&&(N||k)&&(i.current=B),!B)return!0;var ne=i.current||B;return FO(ne,R,E,ne==="h"?N:k)},[]),p=g.useCallback(function(E){var R=E;if(!(!ll.length||ll[ll.length-1]!==u)){var T="deltaY"in R?qb(R):wc(R),_=a.current.filter(function(B){return B.name===R.type&&(B.target===R.target||R.target===B.shadowParent)&&QO(B.delta,T)})[0];if(_&&_.should){R.cancelable&&R.preventDefault();return}if(!_){var N=(f.current.shards||[]).map(Vb).filter(Boolean).filter(function(B){return B.contains(R.target)}),k=N.length>0?h(R,N[0]):!f.current.noIsolation;k&&R.cancelable&&R.preventDefault()}}},[]),v=g.useCallback(function(E,R,T,_){var N={name:E,delta:R,target:T,should:_,shadowParent:e_(T)};a.current.push(N),setTimeout(function(){a.current=a.current.filter(function(k){return k!==N})},1)},[]),b=g.useCallback(function(E){o.current=wc(E),i.current=void 0},[]),x=g.useCallback(function(E){v(E.type,qb(E),E.target,h(E,n.lockRef.current))},[]),w=g.useCallback(function(E){v(E.type,wc(E),E.target,h(E,n.lockRef.current))},[]);g.useEffect(function(){return ll.push(u),n.setCallbacks({onScrollCapture:x,onWheelCapture:x,onTouchMoveCapture:w}),document.addEventListener("wheel",p,ol),document.addEventListener("touchmove",p,ol),document.addEventListener("touchstart",b,ol),function(){ll=ll.filter(function(E){return E!==u}),document.removeEventListener("wheel",p,ol),document.removeEventListener("touchmove",p,ol),document.removeEventListener("touchstart",b,ol)}},[]);var S=n.removeScrollBar,A=n.inert;return g.createElement(g.Fragment,null,A?g.createElement(u,{styles:ZO(s)}):null,S?g.createElement(XO,{noRelative:n.noRelative,gapMode:n.gapMode}):null)}function e_(n){for(var a=null;n!==null;)n instanceof ShadowRoot&&(a=n.host,n=n.host),n=n.parentNode;return a}const t_=jO(I0,JO);var Y0=g.forwardRef(function(n,a){return g.createElement(uu,ha({},n,{ref:a,sideCar:t_}))});Y0.classNames=uu.classNames;var n_=function(n){if(typeof document>"u")return null;var a=Array.isArray(n)?n[0]:n;return a.ownerDocument.body},il=new WeakMap,Sc=new WeakMap,Cc={},nm=0,q0=function(n){return n&&(n.host||q0(n.parentNode))},a_=function(n,a){return a.map(function(o){if(n.contains(o))return o;var i=q0(o);return i&&n.contains(i)?i:(console.error("aria-hidden",o,"in not contained inside",n,". Doing nothing"),null)}).filter(function(o){return!!o})},r_=function(n,a,o,i){var s=a_(a,Array.isArray(n)?n:[n]);Cc[o]||(Cc[o]=new WeakMap);var u=Cc[o],f=[],h=new Set,p=new Set(s),v=function(x){!x||h.has(x)||(h.add(x),v(x.parentNode))};s.forEach(v);var b=function(x){!x||p.has(x)||Array.prototype.forEach.call(x.children,function(w){if(h.has(w))b(w);else try{var S=w.getAttribute(i),A=S!==null&&S!=="false",E=(il.get(w)||0)+1,R=(u.get(w)||0)+1;il.set(w,E),u.set(w,R),f.push(w),E===1&&A&&Sc.set(w,!0),R===1&&w.setAttribute(o,"true"),A||w.setAttribute(i,"true")}catch(T){console.error("aria-hidden: cannot operate on ",w,T)}})};return b(a),h.clear(),nm++,function(){f.forEach(function(x){var w=il.get(x)-1,S=u.get(x)-1;il.set(x,w),u.set(x,S),w||(Sc.has(x)||x.removeAttribute(i),Sc.delete(x)),S||x.removeAttribute(o)}),nm--,nm||(il=new WeakMap,il=new WeakMap,Sc=new WeakMap,Cc={})}},o_=function(n,a,o){o===void 0&&(o="data-aria-hidden");var i=Array.from(Array.isArray(n)?n:[n]),s=n_(n);return s?(i.push.apply(i,Array.from(s.querySelectorAll("[aria-live], script"))),r_(i,s,o,"aria-hidden")):function(){return null}},l_=Object.defineProperty,Gn=(n,a)=>l_(n,"name",{value:a,configurable:!0}),Th="Dialog",[V0,jz]=Sl(Th),[i_,Sa]=V0(Th),s_=Gn(n=>{const{__scopeDialog:a,children:o,open:i,defaultOpen:s,onOpenChange:u,modal:f=!0}=n,h=g.useRef(null),p=g.useRef(null),[v,b]=xh({prop:i,defaultProp:s??!1,onChange:u,caller:Th}),[x,w]=g.useState(0),[S,A]=g.useState(0);return m.jsx(i_,{scope:a,triggerRef:h,contentRef:p,contentId:Ni(),titleId:Ni(),descriptionId:Ni(),titlePresent:x>0,descriptionPresent:S>0,setTitleCount:w,setDescriptionCount:A,open:v,onOpenChange:b,onOpenToggle:g.useCallback(()=>b(E=>!E),[b]),modal:f,children:o})},"Dialog"),G0="DialogPortal",[c_,W0]=V0(G0,{forceMount:void 0}),u_=Gn(n=>{const{__scopeDialog:a,forceMount:o,children:i,container:s}=n,u=Sa(G0,a);return m.jsx(c_,{scope:a,forceMount:o,children:g.Children.map(i,f=>m.jsx(rr,{present:o||u.open,children:m.jsx(f0,{asChild:!0,container:s,children:f})}))})},"DialogPortal"),Dm="DialogOverlay",$0=g.forwardRef(Gn(function(a,o){const i=W0(Dm,a.__scopeDialog),{forceMount:s=i.forceMount,...u}=a,f=Sa(Dm,a.__scopeDialog);return f.modal?m.jsx(rr,{present:s||f.open,children:m.jsx(f_,{...u,ref:o})}):null},"DialogOverlay")),d_=au("DialogOverlay.RemoveScroll"),f_=g.forwardRef(Gn(function(a,o){const{__scopeDialog:i,...s}=a,u=Sa(Dm,i),f=Vw(),h=Zt(o,f);return m.jsx(Y0,{as:d_,allowPinchZoom:!0,shards:[u.contentRef],children:m.jsx(_t.div,{"data-state":Nh(u.open),...s,ref:h,style:{pointerEvents:"auto",...s.style}})})},"DialogOverlayImpl")),ki="DialogContent",F0=g.forwardRef(Gn(function(a,o){const i=W0(ki,a.__scopeDialog),{forceMount:s=i.forceMount,...u}=a,f=Sa(ki,a.__scopeDialog);return m.jsx(rr,{present:s||f.open,children:f.modal?m.jsx(m_,{...u,ref:o}):m.jsx(h_,{...u,ref:o})})},"DialogContent")),m_=g.forwardRef(Gn(function(a,o){const i=Sa(ki,a.__scopeDialog),s=g.useRef(null),u=Zt(o,i.contentRef,s);return g.useEffect(()=>{const f=s.current;if(f)return o_(f)},[]),m.jsx(Q0,{...a,ref:u,trapFocus:i.open,disableOutsidePointerEvents:i.open,onCloseAutoFocus:St(a.onCloseAutoFocus,f=>{f.preventDefault(),i.triggerRef.current?.focus()}),onPointerDownOutside:St(a.onPointerDownOutside,f=>{const h=f.detail.originalEvent,p=h.button===0&&h.ctrlKey===!0;(h.button===2||p)&&f.preventDefault()}),onFocusOutside:St(a.onFocusOutside,f=>f.preventDefault())})},"DialogContentModal")),h_=g.forwardRef(Gn(function(a,o){const i=Sa(ki,a.__scopeDialog),s=g.useRef(!1),u=g.useRef(!1);return m.jsx(Q0,{...a,ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:f=>{a.onCloseAutoFocus?.(f),f.defaultPrevented||(s.current||i.triggerRef.current?.focus(),f.preventDefault()),s.current=!1,u.current=!1},onInteractOutside:f=>{a.onInteractOutside?.(f),f.defaultPrevented||(s.current=!0,f.detail.originalEvent.type==="pointerdown"&&(u.current=!0));const h=f.target;i.triggerRef.current?.contains(h)&&f.preventDefault(),f.detail.originalEvent.type==="focusin"&&u.current&&f.preventDefault()}})},"DialogContentNonModal")),Q0=g.forwardRef(Gn(function(a,o){const{__scopeDialog:i,trapFocus:s,onOpenAutoFocus:u,onCloseAutoFocus:f,...h}=a,p=Sa(ki,i);return Rh(),m.jsx(m.Fragment,{children:m.jsx(vO,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:u,onUnmountAutoFocus:f,children:m.jsx(qw,{role:"dialog",id:p.contentId,"aria-describedby":p.descriptionPresent?p.descriptionId:void 0,"aria-labelledby":p.titlePresent?p.titleId:void 0,"data-state":Nh(p.open),...h,ref:o,deferPointerDownOutside:!0,onDismiss:()=>p.onOpenChange(!1)})})})},"DialogContentImpl")),p_="DialogTitle",Z0=g.forwardRef(Gn(function(a,o){const{__scopeDialog:i,...s}=a,u=Sa(p_,i),{setTitleCount:f}=u;return Qt(()=>(f(h=>h+1),()=>f(h=>h-1)),[f]),m.jsx(_t.h2,{id:u.titleId,...s,ref:o})},"DialogTitle")),g_="DialogDescription",K0=g.forwardRef(Gn(function(a,o){const{__scopeDialog:i,...s}=a,u=Sa(g_,i),{setDescriptionCount:f}=u;return Qt(()=>(f(h=>h+1),()=>f(h=>h-1)),[f]),m.jsx(_t.p,{id:u.descriptionId,...s,ref:o})},"DialogDescription")),v_="DialogClose",y_=g.forwardRef(Gn(function(a,o){const{__scopeDialog:i,...s}=a,u=Sa(v_,i);return m.jsx(_t.button,{type:"button",...s,ref:o,onClick:St(a.onClick,()=>u.onOpenChange(!1))})},"DialogClose"));function Nh(n){return n?"open":"closed"}Gn(Nh,"getState");const J0=s_,b_=u_,eS=g.forwardRef(({className:n,...a},o)=>m.jsx($0,{ref:o,className:Ce("fixed inset-0 z-[var(--layer-backdrop)] xpod-overlay-scrim","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...a}));eS.displayName=$0.displayName;const jh=g.forwardRef(({className:n,children:a,variant:o="center",closeLabel:i="Close",closeDisabled:s=!1,hideCloseButton:u=!1,...f},h)=>m.jsxs(b_,{children:[m.jsx(eS,{}),m.jsxs(F0,{ref:h,className:Ce(o==="sheet-left"?"fixed inset-y-0 left-0 z-[var(--layer-modal)] flex h-dvh w-[min(88vw,320px)] flex-col border-r bg-background p-0 shadow-[16px_0_30px_rgba(15,23,42,0.08)] duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-left-full data-[state=open]:slide-in-from-left-full rounded-none":o==="sheet-right"?"fixed inset-y-0 right-0 z-[var(--layer-modal)] flex h-dvh w-full max-w-4xl flex-col border-l bg-background p-0 shadow-[-16px_0_30px_rgba(15,23,42,0.08)] duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-right-full rounded-none":"fixed left-[50%] top-[50%] z-[var(--layer-modal)] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",n),...f,children:[a,u?null:m.jsxs(y_,{disabled:s,className:Ce("absolute right-4 top-4 rounded-xl opacity-70 transition-all hover:opacity-100 hover:bg-muted/50 p-1 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",UN),children:[m.jsx(oj,{className:"h-4 w-4"}),m.jsx("span",{className:"sr-only",children:i})]})]})]}));jh.displayName=F0.displayName;const tS=({className:n,...a})=>m.jsx("div",{className:Ce("flex flex-col space-y-1.5 text-center sm:text-left",n),...a});tS.displayName="DialogHeader";const nS=({className:n,...a})=>m.jsx("div",{className:Ce("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...a});nS.displayName="DialogFooter";const Oh=g.forwardRef(({className:n,...a},o)=>m.jsx(Z0,{ref:o,className:Ce("text-lg font-semibold leading-none tracking-tight",n),...a}));Oh.displayName=Z0.displayName;const aS=g.forwardRef(({className:n,...a},o)=>m.jsx(K0,{ref:o,className:Ce("text-sm text-muted-foreground",n),...a}));aS.displayName=K0.displayName;function x_({open:n,onOpenChange:a,title:o,description:i,children:s,confirmLabel:u,cancelLabel:f,pending:h=!1,error:p,onConfirm:v,confirmVariant:b="destructive"}){const x=g.useRef(null),w=g.useRef(null);return m.jsx(J0,{open:n,onOpenChange:S=>{h||a(S)},children:m.jsxs(jh,{hideCloseButton:!0,className:"w-[calc(100%_-_2rem)] max-h-[calc(100dvh_-_2rem)] overflow-y-auto","aria-busy":h,onOpenAutoFocus:S=>{w.current=document.activeElement instanceof HTMLElement?document.activeElement:null,S.preventDefault(),x.current?.focus()},onCloseAutoFocus:S=>{w.current?.isConnected&&(S.preventDefault(),w.current.focus())},onEscapeKeyDown:S=>{h&&S.preventDefault()},onInteractOutside:S=>{h&&S.preventDefault()},children:[m.jsxs(tS,{children:[m.jsx(Oh,{children:o}),m.jsx(aS,{children:i})]}),s,p?m.jsx("p",{role:"alert",className:"text-sm text-destructive",children:p}):null,m.jsxs(nS,{className:"gap-2",children:[m.jsx(Qe,{ref:x,variant:"outline",disabled:h,onClick:()=>a(!1),children:f}),m.jsx(Qe,{variant:b,disabled:h,onClick:v,children:u})]})]})})}const w_=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm transition-[border-color] placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50 ${Lw}`,ra=g.forwardRef(({className:n,type:a="text",...o},i)=>m.jsx("input",{ref:i,type:a,className:Ce(w_,"flex min-h-10 file:border-0 file:bg-transparent file:text-sm file:font-medium",n),...o}));ra.displayName="Input";var S_=Object.defineProperty,C_=(n,a)=>S_(n,"name",{value:a,configurable:!0});function rS(n,[a,o]){return Math.min(o,Math.max(a,n))}C_(rS,"clamp");var E_=Object.defineProperty,A_=(n,a)=>E_(n,"name",{value:a,configurable:!0}),R_=g.createContext(void 0);function oS(n){const a=g.useContext(R_);return n||a||"ltr"}A_(oS,"useDirection");const lS=g.forwardRef(({className:n,indeterminate:a=!1,...o},i)=>{const s=g.useRef(null);return g.useImperativeHandle(i,()=>s.current),g.useEffect(()=>{s.current&&(s.current.indeterminate=a)}),m.jsxs("span",{className:"relative inline-flex shrink-0 items-center justify-center align-middle",children:[m.jsx("input",{...o,ref:s,type:"checkbox",className:Ce("peer m-0 h-4 w-4 shrink-0 appearance-none rounded border border-input bg-background checked:border-primary checked:bg-primary checked:bg-none indeterminate:border-primary indeterminate:bg-primary indeterminate:bg-none disabled:cursor-not-allowed disabled:opacity-50",Lw,n)}),m.jsx(YN,{"aria-hidden":"true",className:"pointer-events-none absolute hidden h-3 w-3 text-primary-foreground peer-checked:block peer-indeterminate:hidden peer-disabled:opacity-50",strokeWidth:3}),m.jsx(JN,{"aria-hidden":"true",className:"pointer-events-none absolute hidden h-3 w-3 text-primary-foreground peer-indeterminate:block peer-disabled:opacity-50",strokeWidth:3})]})});lS.displayName="Checkbox";function T_({label:n,error:a,hint:o,labelAside:i,children:s,className:u,...f}){const h=g.useId(),p=`${h}-error`,v=`${h}-hint`,b=[a?p:void 0,o?v:void 0].filter(Boolean).join(" ")||void 0;return m.jsxs("div",{...f,className:Ce("flex flex-col gap-1.5",u),children:[m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsx("label",{htmlFor:h,className:"text-[13px] font-medium text-foreground",children:n}),i]}),s({id:h,...a?{"aria-invalid":!0}:{},"aria-describedby":b}),a?m.jsx("p",{id:p,role:"alert",className:"text-[13px] text-destructive",children:a}):null,o?m.jsx("div",{id:v,className:"text-[13px] text-muted-foreground",children:o}):null]})}const du=g.forwardRef(({onInput:n,onChange:a,autoCapitalize:o="none",spellCheck:i=!1,...s},u)=>{const f=g.useRef(null),h=g.useRef(null);g.useImperativeHandle(u,()=>f.current,[]);const p=g.useCallback(b=>{const x=h.current??(h.current=b.ownerDocument.createElement("input"));x.type="email",x.multiple=b.multiple,x.required=b.required,x.value=b.value,b.setCustomValidity(x.validity.valid?"":x.validationMessage)},[]);g.useLayoutEffect(()=>{f.current&&p(f.current)}),g.useEffect(()=>{const b=f.current,x=b?.form;if(!b||!x)return;const w=()=>queueMicrotask(()=>p(b));return x.addEventListener("reset",w),()=>x.removeEventListener("reset",w)},[s.form,p]);const v=b=>{p(b),queueMicrotask(()=>p(b))};return m.jsx(ra,{...s,ref:f,type:"text",inputMode:"email",autoCapitalize:o,spellCheck:i,onInput:b=>{v(b.currentTarget),n?.(b)},onChange:b=>{v(b.currentTarget),a?.(b)}})});du.displayName="EmailInput";const Pc=g.forwardRef(({className:n,...a},o)=>m.jsx("label",{ref:o,className:Ce("text-sm font-medium leading-none text-muted-foreground",n),...a}));Pc.displayName="Label";var N_=Object.defineProperty,ke=(n,a)=>N_(n,"name",{value:a,configurable:!0});function iS(n,a){return g.useReducer((o,i)=>a[o][i]??o,n)}ke(iS,"useStateMachine");var sS="ScrollArea",[cS,Oz]=Sl(sS),[j_,Wn]=cS(sS),O_=g.forwardRef(ke(function(a,o){const{__scopeScrollArea:i,type:s="hover",dir:u,scrollHideDelay:f=600,...h}=a,[p,v]=g.useState(null),[b,x]=g.useState(null),[w,S]=g.useState(null),[A,E]=g.useState(null),[R,T]=g.useState(null),[_,N]=g.useState(0),[k,B]=g.useState(0),[X,z]=g.useState(!1),[H,re]=g.useState(!1),J=Zt(o,v),oe=oS(u);return m.jsx(j_,{scope:i,type:s,dir:oe,scrollHideDelay:f,scrollArea:p,viewport:b,onViewportChange:x,content:w,onContentChange:S,scrollbarX:A,onScrollbarXChange:E,scrollbarXEnabled:X,onScrollbarXEnabledChange:z,scrollbarY:R,onScrollbarYChange:T,scrollbarYEnabled:H,onScrollbarYEnabledChange:re,onCornerWidthChange:N,onCornerHeightChange:B,children:m.jsx(_t.div,{dir:oe,...h,ref:J,style:{position:"relative","--radix-scroll-area-corner-width":_+"px","--radix-scroll-area-corner-height":k+"px",...a.style}})})},"ScrollArea")),__="ScrollAreaViewport",D_=g.forwardRef(ke(function(a,o){const{__scopeScrollArea:i,children:s,nonce:u,...f}=a,h=Wn(__,i),p=g.useRef(null),v=Zt(o,p,h.onViewportChange);return m.jsxs(m.Fragment,{children:[m.jsx(U_,{nonce:u}),m.jsx(_t.div,{"data-radix-scroll-area-viewport":"",...f,ref:v,style:{overflowX:h.scrollbarXEnabled?"scroll":"hidden",overflowY:h.scrollbarYEnabled?"scroll":"hidden",...a.style},children:m.jsx("div",{ref:h.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})},"ScrollAreaViewport")),U_=g.memo(ke(function({nonce:a}){return m.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a})},"ScrollAreaViewportStyle"),(n,a)=>n.nonce===a.nonce),or="ScrollAreaScrollbar",uS=g.forwardRef(ke(function(a,o){const{forceMount:i,...s}=a,u=Wn(or,a.__scopeScrollArea),{onScrollbarXEnabledChange:f,onScrollbarYEnabledChange:h}=u,p=a.orientation==="horizontal";return g.useEffect(()=>(p?f(!0):h(!0),()=>{p?f(!1):h(!1)}),[p,f,h]),u.type==="hover"?m.jsx(z_,{...s,ref:o,forceMount:i}):u.type==="scroll"?m.jsx(L_,{...s,ref:o,forceMount:i}):u.type==="auto"?m.jsx(dS,{...s,ref:o,forceMount:i}):u.type==="always"?m.jsx(_h,{...s,ref:o,"data-state":"visible"}):null},"ScrollAreaScrollbar")),z_=g.forwardRef(ke(function(a,o){const{forceMount:i,...s}=a,u=Wn(or,a.__scopeScrollArea),[f,h]=g.useState(!1);return g.useEffect(()=>{const p=u.scrollArea;let v=0;if(p){const b=ke(()=>{window.clearTimeout(v),h(!0)},"handlePointerEnter"),x=ke(()=>{v=window.setTimeout(()=>h(!1),u.scrollHideDelay)},"handlePointerLeave");return p.addEventListener("pointerenter",b),p.addEventListener("pointerleave",x),()=>{window.clearTimeout(v),p.removeEventListener("pointerenter",b),p.removeEventListener("pointerleave",x)}}},[u.scrollArea,u.scrollHideDelay]),m.jsx(rr,{present:i||f,children:m.jsx(dS,{"data-state":f?"visible":"hidden",...s,ref:o})})},"ScrollAreaScrollbarHover")),L_=g.forwardRef(ke(function(a,o){const{forceMount:i,...s}=a,u=Wn(or,a.__scopeScrollArea),f=a.orientation==="horizontal",h=Qi(()=>v("SCROLL_END"),100),[p,v]=iS("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return g.useEffect(()=>{if(p==="idle"){const b=window.setTimeout(()=>v("HIDE"),u.scrollHideDelay);return()=>window.clearTimeout(b)}},[p,u.scrollHideDelay,v]),g.useEffect(()=>{const b=u.viewport,x=f?"scrollLeft":"scrollTop";if(b){let w=b[x];const S=ke(()=>{const A=b[x];w!==A&&(v("SCROLL"),h()),w=A},"handleScroll");return b.addEventListener("scroll",S),()=>b.removeEventListener("scroll",S)}},[u.viewport,f,v,h]),m.jsx(rr,{present:i||p!=="hidden",children:m.jsx(_h,{"data-state":p==="hidden"?"hidden":"visible",...s,ref:o,onPointerEnter:St(a.onPointerEnter,()=>v("POINTER_ENTER")),onPointerLeave:St(a.onPointerLeave,()=>v("POINTER_LEAVE"))})})},"ScrollAreaScrollbarScroll")),dS=g.forwardRef(ke(function(a,o){const i=Wn(or,a.__scopeScrollArea),{forceMount:s,...u}=a,[f,h]=g.useState(!1),p=a.orientation==="horizontal",v=Qi(()=>{if(i.viewport){const b=i.viewport.offsetWidth<i.viewport.scrollWidth,x=i.viewport.offsetHeight<i.viewport.scrollHeight;h(p?b:x)}},10);return go(i.viewport,v),go(i.content,v),m.jsx(rr,{present:s||f,children:m.jsx(_h,{"data-state":f?"visible":"hidden",...u,ref:o})})},"ScrollAreaScrollbarAuto")),_h=g.forwardRef(ke(function(a,o){const{orientation:i="vertical",...s}=a,u=Wn(or,a.__scopeScrollArea),f=g.useRef(null),h=g.useRef(0),[p,v]=g.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),b=Dh(p.viewport,p.content),x={...s,sizes:p,onSizesChange:v,hasThumb:b>0&&b<1,onThumbChange:ke(S=>f.current=S,"onThumbChange"),onThumbPointerUp:ke(()=>h.current=0,"onThumbPointerUp"),onThumbPointerDown:ke(S=>h.current=S,"onThumbPointerDown")};function w(S,A){return pS(S,h.current,p,A)}return ke(w,"getScrollPosition"),i==="horizontal"?m.jsx(k_,{...x,ref:o,onThumbPositionChange:()=>{if(u.viewport&&f.current){const S=u.viewport.scrollLeft,A=zm(S,p,u.dir);f.current.style.transform=`translate3d(${A}px, 0, 0)`}},onWheelScroll:S=>{u.viewport&&(u.viewport.scrollLeft=S)},onDragScroll:S=>{u.viewport&&(u.viewport.scrollLeft=w(S,u.dir))}}):i==="vertical"?m.jsx(M_,{...x,ref:o,onThumbPositionChange:()=>{if(u.viewport&&f.current){const S=u.viewport.scrollTop,A=zm(S,p);f.current.style.transform=`translate3d(0, ${A}px, 0)`}},onWheelScroll:S=>{u.viewport&&(u.viewport.scrollTop=S)},onDragScroll:S=>{u.viewport&&(u.viewport.scrollTop=w(S))}}):null},"ScrollAreaScrollbarVisible")),k_=g.forwardRef(ke(function(a,o){const{sizes:i,onSizesChange:s,...u}=a,f=Wn(or,a.__scopeScrollArea),[h,p]=g.useState(),v=g.useRef(null),b=Zt(o,v,f.onScrollbarXChange);return g.useEffect(()=>{v.current&&p(getComputedStyle(v.current))},[v]),m.jsx(mS,{"data-orientation":"horizontal",...u,ref:b,sizes:i,style:{bottom:0,left:f.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:f.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Fi(i)+"px",...a.style},onThumbPointerDown:x=>a.onThumbPointerDown(x.x),onDragScroll:x=>a.onDragScroll(x.x),onWheelScroll:(x,w)=>{if(f.viewport){const S=f.viewport.scrollLeft+x.deltaX;a.onWheelScroll(S),zh(S,w)&&x.preventDefault()}},onResize:()=>{v.current&&f.viewport&&h&&s({content:f.viewport.scrollWidth,viewport:f.viewport.offsetWidth,scrollbar:{size:v.current.clientWidth,paddingStart:Mi(h.paddingLeft),paddingEnd:Mi(h.paddingRight)}})}})},"ScrollAreaScrollbarX")),M_=g.forwardRef(ke(function(a,o){const{sizes:i,onSizesChange:s,...u}=a,f=Wn(or,a.__scopeScrollArea),[h,p]=g.useState(),v=g.useRef(null),b=Zt(o,v,f.onScrollbarYChange);return g.useEffect(()=>{v.current&&p(getComputedStyle(v.current))},[v]),m.jsx(mS,{"data-orientation":"vertical",...u,ref:b,sizes:i,style:{top:0,right:f.dir==="ltr"?0:void 0,left:f.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Fi(i)+"px",...a.style},onThumbPointerDown:x=>a.onThumbPointerDown(x.y),onDragScroll:x=>a.onDragScroll(x.y),onWheelScroll:(x,w)=>{if(f.viewport){const S=f.viewport.scrollTop+x.deltaY;a.onWheelScroll(S),zh(S,w)&&x.preventDefault()}},onResize:()=>{v.current&&f.viewport&&h&&s({content:f.viewport.scrollHeight,viewport:f.viewport.offsetHeight,scrollbar:{size:v.current.clientHeight,paddingStart:Mi(h.paddingTop),paddingEnd:Mi(h.paddingBottom)}})}})},"ScrollAreaScrollbarY")),[I_,fS]=cS(or),mS=g.forwardRef(ke(function(a,o){const{__scopeScrollArea:i,sizes:s,hasThumb:u,onThumbChange:f,onThumbPointerUp:h,onThumbPointerDown:p,onThumbPositionChange:v,onDragScroll:b,onWheelScroll:x,onResize:w,...S}=a,A=Wn(or,i),[E,R]=g.useState(null),T=Zt(o,R),_=g.useRef(null),N=g.useRef(""),k=A.viewport,B=s.content-s.viewport,X=nn(x),z=nn(v),H=Qi(w,10);function re(J){if(_.current){const oe=J.clientX-_.current.left,ne=J.clientY-_.current.top;b({x:oe,y:ne})}}return ke(re,"handleDragScroll"),g.useEffect(()=>{const J=ke(oe=>{const ne=oe.target;E?.contains(ne)&&X(oe,B)},"handleWheel");return document.addEventListener("wheel",J,{passive:!1}),()=>document.removeEventListener("wheel",J,{passive:!1})},[k,E,B,X]),g.useEffect(z,[s,z]),go(E,H),go(A.content,H),m.jsx(I_,{scope:i,scrollbar:E,hasThumb:u,onThumbChange:nn(f),onThumbPointerUp:nn(h),onThumbPositionChange:z,onThumbPointerDown:nn(p),children:m.jsx(_t.div,{...S,ref:T,style:{position:"absolute",...S.style},onPointerDown:St(a.onPointerDown,J=>{J.button===0&&(J.target.setPointerCapture(J.pointerId),_.current=E.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",A.viewport&&(A.viewport.style.scrollBehavior="auto"),re(J))}),onPointerMove:St(a.onPointerMove,re),onPointerUp:St(a.onPointerUp,J=>{const oe=J.target;oe.hasPointerCapture(J.pointerId)&&oe.releasePointerCapture(J.pointerId),document.body.style.webkitUserSelect=N.current,A.viewport&&(A.viewport.style.scrollBehavior=""),_.current=null})})})},"ScrollAreaScrollbarImpl")),Um="ScrollAreaThumb",P_=g.forwardRef(ke(function(a,o){const{forceMount:i,...s}=a,u=fS(Um,a.__scopeScrollArea);return m.jsx(rr,{present:i||u.hasThumb,children:m.jsx(B_,{ref:o,...s})})},"ScrollAreaThumb")),B_=g.forwardRef(ke(function(a,o){const{__scopeScrollArea:i,style:s,...u}=a,f=Wn(Um,i),h=fS(Um,i),{onThumbPositionChange:p}=h,v=Zt(o,h.onThumbChange),b=g.useRef(void 0),x=Qi(()=>{b.current&&(b.current(),b.current=void 0)},100);return g.useEffect(()=>{const w=f.viewport;if(w){const S=ke(()=>{if(x(),!b.current){const A=Y_(w,p);b.current=A,p()}},"handleScroll");return p(),w.addEventListener("scroll",S),()=>w.removeEventListener("scroll",S)}},[f.viewport,x,p]),m.jsx(_t.div,{"data-state":h.hasThumb?"visible":"hidden",...u,ref:v,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:St(a.onPointerDownCapture,w=>{const A=w.target.getBoundingClientRect(),E=w.clientX-A.left,R=w.clientY-A.top;h.onThumbPointerDown({x:E,y:R})}),onPointerUp:St(a.onPointerUp,h.onThumbPointerUp)})},"ScrollAreaThumbImpl")),hS="ScrollAreaCorner",H_=g.forwardRef(ke(function(a,o){const i=Wn(hS,a.__scopeScrollArea),s=!!(i.scrollbarX&&i.scrollbarY);return i.type!=="scroll"&&s?m.jsx(X_,{...a,ref:o}):null},"ScrollAreaCorner")),X_=g.forwardRef(ke(function(a,o){const{__scopeScrollArea:i,...s}=a,u=Wn(hS,i),[f,h]=g.useState(0),[p,v]=g.useState(0),b=!!(f&&p),{onCornerWidthChange:x,onCornerHeightChange:w}=u;return go(u.scrollbarX,()=>{const S=u.scrollbarX?.offsetHeight||0;u.onCornerHeightChange(S),v(S)}),go(u.scrollbarY,()=>{const S=u.scrollbarY?.offsetWidth||0;u.onCornerWidthChange(S),h(S)}),g.useEffect(()=>()=>{x(0),w(0)},[x,w]),b?m.jsx(_t.div,{...s,ref:o,style:{width:f,height:p,position:"absolute",right:u.dir==="ltr"?0:void 0,left:u.dir==="rtl"?0:void 0,bottom:0,...a.style}}):null},"ScrollAreaCornerImpl"));function Mi(n){return n?parseInt(n,10):0}ke(Mi,"toInt");function Dh(n,a){const o=n/a;return isNaN(o)?0:o}ke(Dh,"getThumbRatio");function Fi(n){const a=Dh(n.viewport,n.content),o=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,i=(n.scrollbar.size-o)*a;return Math.max(i,18)}ke(Fi,"getThumbSize");function pS(n,a,o,i="ltr"){const s=Fi(o),u=s/2,f=a||u,h=s-f,p=o.scrollbar.paddingStart+f,v=o.scrollbar.size-o.scrollbar.paddingEnd-h,b=o.content-o.viewport,x=i==="ltr"?[0,b]:[b*-1,0];return Uh([p,v],x)(n)}ke(pS,"getScrollPositionFromPointer");function zm(n,a,o="ltr"){const i=Fi(a),s=a.scrollbar.paddingStart+a.scrollbar.paddingEnd,u=a.scrollbar.size-s,f=a.content-a.viewport,h=u-i,p=o==="ltr"?[0,f]:[f*-1,0],v=rS(n,p);return Uh([0,f],[0,h])(v)}ke(zm,"getThumbOffsetFromScroll");function Uh(n,a){return o=>{if(n[0]===n[1]||a[0]===a[1])return a[0];const i=(a[1]-a[0])/(n[1]-n[0]);return a[0]+i*(o-n[0])}}ke(Uh,"linearScale");function zh(n,a){return n>0&&n<a}ke(zh,"isScrollingWithinScrollbarBounds");var Y_=ke((n,a=()=>{})=>{let o={left:n.scrollLeft,top:n.scrollTop},i=0;return ke((function s(){const u={left:n.scrollLeft,top:n.scrollTop},f=o.left!==u.left,h=o.top!==u.top;(f||h)&&a(),o=u,i=window.requestAnimationFrame(s)}),"loop")(),()=>window.cancelAnimationFrame(i)},"addUnlinkedScrollListener");function Qi(n,a){const o=nn(n),i=g.useRef(0);return g.useEffect(()=>()=>window.clearTimeout(i.current),[]),g.useCallback(()=>{window.clearTimeout(i.current),i.current=window.setTimeout(o,a)},[o,a])}ke(Qi,"useDebounceCallback");function go(n,a){const o=nn(a);Qt(()=>{let i=0;if(n){const s=new ResizeObserver(()=>{cancelAnimationFrame(i),i=window.requestAnimationFrame(o)});return s.observe(n),()=>{window.cancelAnimationFrame(i),s.unobserve(n)}}},[n,o])}ke(go,"useResizeObserver");var gS=O_,q_=D_,V_=H_;const vS=g.forwardRef(({className:n,children:a,...o},i)=>m.jsxs(gS,{ref:i,className:Ce("relative overflow-hidden",n),...o,children:[m.jsx(q_,{"data-scroll-area-viewport":"true",className:"h-full w-full overflow-x-hidden rounded-[inherit] [&>div]:!block [&>div]:!w-full [&>div]:!min-w-0",children:a}),m.jsx(yS,{}),m.jsx(V_,{})]}));vS.displayName=gS.displayName;const yS=g.forwardRef(({className:n,orientation:a="vertical",...o},i)=>m.jsx(uS,{ref:i,orientation:a,className:Ce("flex touch-none select-none transition-colors",a==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",a==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",n),...o,children:m.jsx(P_,{className:"relative flex-1 rounded-full bg-border"})}));yS.displayName=uS.displayName;const G_=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","summary",'[tabindex]:not([tabindex="-1"])'].join(","),W_="[data-pod-sign-in-primary]";function $_(n){if(n.hidden||n.closest("[hidden]")||n.matches(":disabled"))return!1;const a=n.ownerDocument.defaultView?.getComputedStyle(n);if(a&&(a.display==="none"||a.visibility==="hidden"))return!1;for(let o=n.parentElement;o;o=o.parentElement){if(o.tagName!=="DETAILS"||o.open)continue;const i=Array.from(o.children).find(s=>s.tagName==="SUMMARY");if(!i||!(i===n||i.contains(n)))return!1}return!0}function F_(n,a){const o=g.useRef(null),i=g.useRef(a);return i.current=a,g.useEffect(()=>{if(!n)return;const s=document.activeElement instanceof HTMLElement?document.activeElement:null;o.current?.focus();const u=f=>{if(f.key==="Escape"&&i.current){f.preventDefault(),i.current();return}if(f.key!=="Tab")return;const h=o.current;if(!h)return;const p=Array.from(h.querySelectorAll(G_)).filter($_);if(p.length===0){f.preventDefault(),h.focus();return}const v=p.indexOf(document.activeElement);if(!f.shiftKey&&document.activeElement===h){const x=p.find(w=>w.matches(W_));if(x){f.preventDefault(),x.focus();return}}const b=f.shiftKey?v<=0?p.length-1:v-1:v===p.length-1?0:v+1;f.preventDefault(),p[b]?.focus()};return document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u),s?.focus()}},[n]),o}const am="flex min-h-0 w-full max-w-[360px] flex-1 flex-col";function Q_({presentation:n,ariaLabel:a,appIntro:o,children:i,modal:s=!0,onClose:u,closeLabel:f,dataAttributes:h}){const p=n==="dialog"&&s,v=F_(p,u),b=o;if(n==="window")return m.jsx("div",{role:"region","aria-label":a,"data-pod-sign-in-frame":"window",...h,className:"pod-sign-in flex h-full min-h-0 w-full min-w-0 justify-center overflow-hidden bg-background text-foreground",children:m.jsx("div",{className:am,children:i})});if(n==="page")return m.jsxs("div",{role:"region","aria-label":a,"data-pod-sign-in-frame":"page",...h,className:"pod-sign-in grid min-h-[100dvh] w-full bg-background text-foreground md:grid-cols-2",children:[b?m.jsx("aside",{"data-pod-sign-in":"intro",className:"hidden flex-col justify-center gap-6 bg-[hsl(var(--sunken))] px-12 py-10 md:flex",children:b}):null,m.jsx("div",{className:Ce("flex min-w-0 items-center justify-center px-4 py-8",b?"":"md:col-span-2"),children:m.jsx("div",{className:am,children:i})})]});const x=m.jsxs("div",{ref:v,role:p?"dialog":"region","aria-modal":p?!0:void 0,"aria-label":a,tabIndex:-1,"data-pod-sign-in-frame":"dialog",...h,className:Ce("pod-sign-in relative flex max-h-[90dvh] w-[min(400px,calc(100vw-2rem))] flex-col overflow-hidden rounded-xl border border-border bg-card text-card-foreground shadow-lg focus:outline-none motion-safe:animate-in motion-safe:fade-in-0"),children:[p&&u&&f?m.jsx("button",{type:"button","aria-label":f,className:"absolute right-2 top-2 flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground hover:bg-accent",onClick:u,children:m.jsx("span",{"aria-hidden":"true",children:"×"})}):null,m.jsx("div",{className:Ce(am,"mx-auto"),children:i})]});return p?m.jsx("div",{className:"fixed inset-0 z-[var(--layer-modal)] flex items-center justify-center bg-background/80 p-4",children:x}):m.jsx("div",{className:"flex w-full items-center justify-center p-4",children:x})}function Z_({kind:n,label:a}){const o=n==="cloud"?Iw:Pw;return m.jsx("span",{role:"img","aria-label":a,title:a,"data-storage-kind":n,className:"flex h-[18px] w-[18px] items-center justify-center rounded-full border border-background bg-card text-foreground",children:m.jsx(o,{"aria-hidden":"true",className:"h-3 w-3"})})}const K_={restoring:"正在恢复登录…",enterApp:"进入 {app}",reauthenticate:"重新登录",useAnother:"使用其他账号",expiredLine:"登录已过期,需要重新确认",chooseTitle:"登录",chooseLead:"用你的 WebID 账号登录,数据保存在你自己的 Pod 里",useXpod:"使用 Xpod 账号登录",useOtherSolid:"使用其他 Solid 账号",customLabel:"账号服务地址或 WebID",customPlaceholder:"https://example.com/",customSubmit:"继续",noAccount:"没有账号?",register:"注册 Xpod",noticeDetailsToggle:"详情",noticeCopy:"复制",noticeCopied:"已复制",whatIsPod:"什么是 Pod?",whatIsPodBody:"Pod 是保存你数据的个人空间。",whatIsWebId:"什么是 WebID?",whatIsWebIdBody:"WebID 是登录用的身份,它指向你的个人资料和 Pod。",signInWith:"使用 {service} 登录",select:"选择",selected:"已选择",choosePodTitle:"选择 Pod",choosePodLead:"选择要继续使用的 Pod",retry:"重试",goCreate:"去创建",refreshPage:"刷新页面",startAndEnter:"启动 Xpod 并进入",openXpod:"打开 Xpod",noticeUnreachable:"暂时连不上 Xpod,请稍后再试",noticeIncomplete:"登录没有完成,请再试一次",noticeNoWebId:"还没有 WebID",noticeCancelled:"登录已取消",noticeLocalStopped:"这台电脑上的 Xpod 没有运行",noticePending:"上次登录尚未结束",serviceLabel:"账号服务",signInTitle:"登录 {service}",returnToApp:"完成后回到 {app}",email:"邮箱",password:"密码",forgotPassword:"忘记密码?",rememberDevice:"在这台设备上保持登录",signIn:"登录",registerLink:"注册账号",registerTitle:"注册 {service}",username:"用户名",registerSubmit:"注册",haveAccount:"已有账号?登录",podElsewhereSummary:"想用你自己的独立部署存放 Pod?",podElsewhereBody:"注册后,可以在账号页的“存储”里把 Pod 建到你自己的独立部署上;它和当前账号服务是分开的,普通浏览器不会自动把 Pod 转到本机。",noWebIdTitle:"还没有 WebID",noWebIdLead:"新建一个 WebID 来登录 {app},数据存在它的 Pod 里",webIdName:"WebID 名称",noWebIdLocation:"存放在当前服务",createAndContinue:"创建并继续",chooseOtherLocation:"存到边缘设备(打开账号页)",consentTitle:"授权 {app}",unverifiedWarning:"未能验证这个应用的来源,请确认是你要使用的应用",chooseWebId:"用哪个 WebID 登录?",consentConsequence:"{app} 将以这个身份读写你的数据,之后可以在 Xpod 中收回。",requestDetails:"请求详情",scopes:"权限范围",clientId:"应用标识",webIdFull:"WebID",rememberChoice:"以后不再询问",manageAccount:"管理账号",switchAccount:"换一个账号",deny:"拒绝",allow:"允许",storageCloud:"数据存在 Xpod 云端",storageEdge:"数据存在边缘设备上",hostedStorage:"账号服务托管",independentStorage:"独立部署",identityAddress:"WebID(身份地址)",storageAddress:"Pod(存储地址)",showAddresses:"查看地址",webIdSectionTitle:"WebID",webIdEmpty:"还没有 WebID。新建一个,用它登录应用。",createWebId:"新建 WebID",linkExistingWebId:"关联已有 WebID",podOnDevice:"Pod 在 {device}",authorizedApps:"已授权 {count} 个应用",createStepName:"名称",createStepLocation:"存放在",createNameHint:"WebID 地址",changeDevice:"更换 ›",cannotChangeLater:"创建后不能直接更换,以后要换请使用迁移",createPod:"创建 WebID 和 Pod",startDeviceXpod:"启动这台设备上的 Xpod",creatingNote:"关闭页面不会中断创建",cancel:"取消",devicePickerTitle:"选择存放设备",addDevice:"+ 添加设备",deviceSectionTitle:"设备",deviceStatusOk:"正常",deviceStatusUnreachable:"⚠ 其他设备访问不到",deviceStatusStopped:"Xpod 已停止",deviceStatusOffline:"离线",deviceCloud:"Xpod 云端",deviceEdge:"边缘",podCount:"{count} 个 Pod",networkAction:"网络",fixAction:"处理",collapseAction:"收起",webIdSectionHint:"登录应用时使用的身份,数据存在它的 Pod 里",deviceSectionHint:"Pod 可以存放的地方,网络设置跟着设备走",credentialSectionHint:"让脚本或服务以某个 WebID 直接访问 Pod",startAction:"启动",networkTitle:"网络访问",probeLocal:"这台电脑",probeLan:"局域网",probeWan:"其他网络",probeIdle:"未检测",probeChecking:"检测中",probeOk:"可以访问",probeFailed:"不通",tunnelTitle:"选择隧道",enableAndRecheck:"开启并重新检测",enableAndCheck:"开启并检测",recheck:"重新检测",skipForNow:"跳过,稍后设置",reachableVia:"通过 {tunnel} 可以访问",networkFootnote:"只影响其他设备;这台电脑上照常可用",addDeviceTitle:"添加设备",stepInstall:"安装并登录",stepNetwork:"检查网络",stepDone:"完成",joinThisComputer:"把这台电脑加入",installOnOther:"在那台设备上安装 Xpod 边缘并登录本账号",waitingForDevice:"正在等待新设备上线,登录后这里会自动继续",deviceOnline:"已上线",finish:"完成",useThisDevice:"用这台设备",credentialSectionTitle:"密钥",credentialEmpty:"还没有密钥。",createCredential:"新建密钥",revokeCredential:"删除",resumeTitle:"{app} 正在等你完成授权",resumeWaiting:"在下面新建一个 WebID,完成后就能回去授权",resumeReady:"WebID 已就绪,可以回去授权了",resumeCancel:"取消授权",resumeContinue:"继续授权 {app}",close:"关闭"},J_={restoring:"Restoring your sign-in…",enterApp:"Open {app}",reauthenticate:"Sign in again",useAnother:"Use another account",expiredLine:"Your sign-in expired. Please confirm again.",chooseTitle:"Sign in",chooseLead:"Sign in with your WebID account. Your data stays in your own Pod.",useXpod:"Sign in with Xpod",useOtherSolid:"Use another Solid account",customLabel:"Sign-in service address or WebID",customPlaceholder:"https://example.com/",customSubmit:"Continue",noAccount:"No account?",register:"Register for Xpod",noticeDetailsToggle:"Details",noticeCopy:"Copy",noticeCopied:"Copied",whatIsPod:"What is a Pod?",whatIsPodBody:"A Pod is a personal space that holds your data.",whatIsWebId:"What is a WebID?",whatIsWebIdBody:"A WebID is the identity you sign in with. It points to your profile and your Pod.",signInWith:"Sign in with {service}",select:"Select",selected:"Selected",choosePodTitle:"Choose a Pod",choosePodLead:"Choose the Pod to continue with",retry:"Retry",goCreate:"Create one",refreshPage:"Refresh page",startAndEnter:"Start Xpod and open",openXpod:"Open Xpod",noticeUnreachable:"Cannot reach Xpod right now. Please try again later.",noticeIncomplete:"Sign-in did not finish. Please try again.",noticeNoWebId:"No WebID yet",noticeCancelled:"Sign-in cancelled",noticeLocalStopped:"Xpod is not running on this computer",noticePending:"The previous sign-in has not finished",serviceLabel:"Sign-in service",signInTitle:"Sign in to {service}",returnToApp:"You will return to {app}",email:"Email",password:"Password",forgotPassword:"Forgot password?",rememberDevice:"Keep me signed in on this device",signIn:"Sign in",registerLink:"Register",registerTitle:"Register for {service}",username:"Username",registerSubmit:"Register",haveAccount:"Already have an account? Sign in",podElsewhereSummary:"Want it on your own standalone deployment?",podElsewhereBody:"After registering, create the Pod on your own standalone deployment under Storage on the account page; it is separate from this account service.",noWebIdTitle:"No WebID yet",noWebIdLead:"Create a WebID to sign in to {app}. Your data lives in its Pod.",webIdName:"WebID name",noWebIdLocation:"Stored on the current service",createAndContinue:"Create and continue",chooseOtherLocation:"Store on an edge device (open account page)",consentTitle:"Authorize {app}",unverifiedWarning:"We could not verify this application. Make sure it is the one you meant to use.",chooseWebId:"Which WebID do you sign in with?",consentConsequence:"{app} will read and write your data as this identity. You can revoke it later in Xpod.",requestDetails:"Request details",scopes:"Permissions",clientId:"Application ID",webIdFull:"WebID",rememberChoice:"Do not ask again",manageAccount:"Manage account",switchAccount:"Switch account",deny:"Deny",allow:"Allow",storageCloud:"Data is stored on Xpod Cloud",storageEdge:"Data is stored on an edge device",hostedStorage:"Hosted by account service",independentStorage:"Independent deployment",identityAddress:"WebID (identity address)",storageAddress:"Pod (storage address)",showAddresses:"View addresses",webIdSectionTitle:"WebID",webIdEmpty:"No WebID yet. Create one to sign in to applications.",createWebId:"New WebID",linkExistingWebId:"Link an existing WebID",podOnDevice:"Pod on {device}",authorizedApps:"{count} authorized apps",createStepName:"Name",createStepLocation:"Store on",createNameHint:"WebID address",changeDevice:"Change ›",cannotChangeLater:"It cannot be changed directly after creation. Use migration later.",createPod:"Create WebID and Pod",startDeviceXpod:"Start Xpod on this device",creatingNote:"Closing this page will not interrupt creation",cancel:"Cancel",devicePickerTitle:"Choose where to store",addDevice:"+ Add device",deviceSectionTitle:"Devices",deviceStatusOk:"Healthy",deviceStatusUnreachable:"⚠ Not reachable from other devices",deviceStatusStopped:"Xpod stopped",deviceStatusOffline:"Offline",deviceCloud:"Xpod Cloud",deviceEdge:"Edge",podCount:"{count} Pods",networkAction:"Network",fixAction:"Fix",collapseAction:"Collapse",webIdSectionHint:"The identity you sign in to apps with. Your data lives in its Pod.",deviceSectionHint:"Places a Pod can live. Network settings follow the device.",credentialSectionHint:"Let a script or service reach a Pod directly as one WebID.",startAction:"Start",networkTitle:"Network access",probeLocal:"This computer",probeLan:"Local network",probeWan:"Other networks",probeIdle:"Not checked",probeChecking:"Checking",probeOk:"Reachable",probeFailed:"Unreachable",tunnelTitle:"Choose a tunnel",enableAndRecheck:"Enable and recheck",enableAndCheck:"Enable and check",recheck:"Recheck",skipForNow:"Skip, set up later",reachableVia:"Reachable through {tunnel}",networkFootnote:"Only affects other devices. This computer keeps working as usual.",addDeviceTitle:"Add a device",stepInstall:"Install and sign in",stepNetwork:"Check network",stepDone:"Done",joinThisComputer:"Add this computer",installOnOther:"Install Xpod Edge on that device and sign in to this account",waitingForDevice:"Waiting for the new device to come online. This continues automatically after sign-in.",deviceOnline:"Online",finish:"Done",useThisDevice:"Use this device",credentialSectionTitle:"Credentials",credentialEmpty:"No credentials yet.",createCredential:"New credential",revokeCredential:"Delete",resumeTitle:"{app} is waiting for you to finish authorizing",resumeWaiting:"Create a WebID below, then you can go back and authorize",resumeReady:"Your WebID is ready. You can go back and authorize.",resumeCancel:"Cancel authorization",resumeContinue:"Continue authorizing {app}",close:"Close"},eD={"zh-CN":K_,en:J_};function Ca(n="zh-CN",a){return{...eD[n],...a}}function qn(n,a){return n.replace(/\{(\w+)\}/g,(o,i)=>{const s=a[i];return s===void 0?o:String(s)})}function fu({size:n=24,...a}){return m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100",width:n,height:n,"aria-hidden":"true",focusable:"false",...a,children:[m.jsx("rect",{x:"10",y:"10",width:"80",height:"80",rx:"18",fill:"#563E84"}),m.jsxs("g",{fill:"#F7F4ED",children:[m.jsx("path",{d:"M31 24H52V45H73V73Q73 76 70 76H31Q28 76 28 73V27Q28 24 31 24Z"}),m.jsx("path",{d:"M58 24L76 39H58Z"})]})]})}function Lh({serviceName:n,serviceHost:a,icon:o,serviceLabel:i,locale:s}){const u=i??Ca(s).serviceLabel;return m.jsxs("div",{"data-pod-sign-in":"idp-chrome",className:"flex h-11 shrink-0 items-center gap-2 border-b border-border bg-[hsl(var(--sunken))] px-4 text-[13px] text-foreground",children:[m.jsx("span",{className:"flex shrink-0 items-center justify-center",children:o??m.jsx(fu,{size:24})}),m.jsxs("span",{className:"min-w-0 truncate font-medium",children:[n," · ",u]}),a?m.jsx("span",{className:"ml-auto truncate font-mono text-xs text-muted-foreground",children:a}):null]})}const Rl="h-auto min-h-11 w-full whitespace-normal break-normal rounded-lg py-2 text-sm font-medium leading-snug",mu=Rl,Ir="h-auto min-h-9 max-w-full whitespace-normal break-normal rounded-lg px-2 py-1 text-sm font-medium leading-snug",tD="h-11 w-full rounded-lg border border-input bg-card px-3 text-sm text-foreground placeholder:text-muted-foreground disabled:opacity-60";function bS({className:n}){return m.jsx(ZN,{"aria-hidden":"true",className:Ce("h-4 w-4 shrink-0 animate-spin motion-reduce:animate-none",n)})}function Mt({busy:n=!1,children:a,disabled:o,...i}){return m.jsxs(Qe,{type:"button",...i,disabled:o||n,"aria-busy":n||void 0,children:[n?m.jsx(bS,{className:"mr-2"}):null,a]})}function pl({children:n,className:a}){return m.jsx("span",{className:Ce("font-mono text-xs text-muted-foreground",a),children:n})}function Lm({name:n,avatarUrl:a,storage:o,size:i=56}){return m.jsxs("span",{className:"relative inline-flex shrink-0",style:{width:i,height:i},"data-pod-sign-in":"avatar",children:[m.jsxs(Dw,{className:"h-full w-full rounded-full","aria-hidden":"true",children:[a?m.jsx(Uw,{src:a,alt:""}):null,m.jsx(zw,{className:"text-base",children:Array.from(n.trim())[0]?.toUpperCase()??"?"})]}),o?m.jsx("span",{className:"absolute -bottom-0.5 -right-0.5",children:m.jsx(Z_,{kind:o.kind,label:o.label})}):null]})}function mo(n){return m.jsx(T_,{...n,"data-pod-sign-in":"field"})}function xS({summary:n,children:a,className:o}){return m.jsxs("details",{className:Ce("text-[13px] text-muted-foreground",o),children:[m.jsx("summary",{className:"cursor-pointer select-none rounded py-1 text-[13px] font-medium text-primary focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",children:n}),m.jsx("div",{className:"pt-1 leading-5",children:a})]})}function wS({checked:n,onChange:a,label:o,disabled:i}){return m.jsxs("label",{className:"flex min-h-9 cursor-pointer items-center gap-2 text-sm text-foreground",children:[m.jsx(lS,{checked:n,disabled:i,onChange:s=>a(s.target.checked)}),o]})}function Zi({chrome:n,children:a,actions:o,onSubmit:i,mainClassName:s,...u}){const f=m.jsxs(m.Fragment,{children:[n,m.jsx("div",{"data-pod-sign-in":"main",className:Ce("flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto px-6 pb-2 pt-5",s),children:a}),o?m.jsx("div",{"data-pod-sign-in":"actions",className:"flex shrink-0 flex-col gap-3 px-6 pb-6 pt-3",children:o}):null]}),h="flex min-h-0 flex-1 flex-col";return i?m.jsx("form",{...u,onSubmit:i,className:h,noValidate:!0,children:f}):m.jsx("div",{...u,className:h,children:f})}function kh({locale:n,copy:a}){return Ca(n,a)}function hu({serviceName:n="Xpod",serviceHost:a,serviceIcon:o,locale:i,copy:s}){return m.jsx(Lh,{serviceName:n,serviceHost:a,icon:o,locale:i,serviceLabel:s?.serviceLabel})}const gl=tD;function Gb({href:n,onClick:a,disabled:o,className:i,children:s}){const u=Ce(Ir,"inline-flex shrink-0 items-center justify-center text-primary hover:underline",i);return n&&!o?m.jsx("a",{href:n,className:u,children:s}):m.jsx("button",{type:"button",className:u,disabled:o,onClick:a,children:s})}function nD(n){const{serviceName:a,returnToAppName:o,error:i,fieldErrors:s,pending:u=!1,remember:f,defaultEmail:h="",defaultPassword:p="",onFieldChange:v,onRememberChange:b,onSubmit:x,onForgot:w,forgotHref:S,onRegister:A,registerHref:E,onUseOtherSolid:R}=n,T=kh(n),[_,N]=g.useState(h),[k,B]=g.useState(p),X=z=>{z.preventDefault(),u||x({email:_.trim(),password:k})};return m.jsxs(Zi,{"data-pod-sign-in-state":"idp-sign-in",chrome:m.jsx(hu,{...n}),onSubmit:X,actions:m.jsxs(m.Fragment,{children:[i?m.jsx("p",{role:"alert",className:"text-[13px] text-destructive",children:i}):null,m.jsx(Mt,{type:"submit",className:Rl,busy:u,children:T.signIn}),m.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[A||E?m.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-x-1 gap-y-0",children:[m.jsx("span",{className:"whitespace-nowrap text-xs text-muted-foreground",children:T.noAccount}),m.jsx(Gb,{href:E,disabled:u,onClick:A,children:T.registerLink})]}):m.jsx("span",{}),R?m.jsx("button",{type:"button",className:Ce(Ir,"text-primary hover:underline"),disabled:u,onClick:R,children:T.useOtherSolid}):null]})]}),children:[m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx("h1",{className:"text-[17px] font-semibold text-foreground",children:qn(T.signInTitle,{service:a})}),o?m.jsx("p",{className:"text-sm text-muted-foreground",children:qn(T.returnToApp,{app:o})}):null]}),m.jsxs("div",{"data-pod-sign-in":"fields",className:"flex flex-col gap-4",children:[m.jsx(mo,{label:T.email,error:s?.email,children:z=>m.jsx(du,{...z,name:"email",autoComplete:"username",autoCapitalize:"none",spellCheck:!1,className:gl,value:_,disabled:u,onChange:H=>{N(H.target.value),v?.("email",H.target.value)}})}),m.jsx(mo,{label:T.password,error:s?.password,labelAside:w||S?m.jsx(Gb,{className:"min-h-7 text-[13px]",href:S,onClick:w,children:T.forgotPassword}):void 0,children:z=>m.jsx(ra,{...z,name:"password",type:"password",autoComplete:"current-password",className:gl,value:k,disabled:u,onChange:H=>{B(H.target.value),v?.("password",H.target.value)}})}),b?m.jsx(wS,{checked:f,onChange:b,label:T.rememberDevice,disabled:u}):null]})]})}function aD(n){const{serviceName:a,returnToAppName:o,usernamePreview:i,requireUsername:s,fieldErrors:u,error:f,pending:h=!1,defaultEmail:p="",defaultPassword:v="",defaultUsername:b="",onFieldChange:x,onSubmit:w,onSignIn:S}=n,A=kh(n),[E,R]=g.useState(b),[T,_]=g.useState(p),[N,k]=g.useState(v),B=X=>{X.preventDefault(),!h&&w({...s?{username:E.trim()}:{},email:T.trim(),password:N})};return m.jsxs(Zi,{"data-pod-sign-in-state":"idp-register",chrome:m.jsx(hu,{...n}),onSubmit:B,actions:m.jsxs(m.Fragment,{children:[f?m.jsx("p",{role:"alert",className:"text-[13px] text-destructive",children:f}):null,m.jsx(Mt,{type:"submit",className:Rl,busy:h,children:A.registerSubmit}),S?m.jsx("button",{type:"button",className:Ce(Ir,"self-center text-primary hover:underline"),disabled:h,onClick:S,children:A.haveAccount}):null]}),children:[m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx("h1",{className:"text-[17px] font-semibold text-foreground",children:qn(A.registerTitle,{service:a})}),o?m.jsx("p",{className:"text-sm text-muted-foreground",children:qn(A.returnToApp,{app:o})}):null]}),m.jsxs("div",{className:"flex flex-col gap-4",children:[s?m.jsx(mo,{label:A.username,error:u?.username,hint:i?m.jsx("span",{role:"status",className:"font-mono text-xs",children:i}):void 0,children:X=>m.jsx(ra,{...X,name:"username",type:"text",autoComplete:"username",autoCapitalize:"none",spellCheck:!1,className:gl,value:E,disabled:h,onChange:z=>{R(z.target.value),x?.("username",z.target.value)}})}):null,m.jsx(mo,{label:A.email,error:u?.email,children:X=>m.jsx(du,{...X,name:"email",autoComplete:"email",autoCapitalize:"none",spellCheck:!1,className:gl,value:T,disabled:h,onChange:z=>{_(z.target.value),x?.("email",z.target.value)}})}),m.jsx(mo,{label:A.password,error:u?.password,children:X=>m.jsx(ra,{...X,name:"password",type:"password",autoComplete:"new-password",className:gl,value:N,disabled:h,onChange:z=>{k(z.target.value),x?.("password",z.target.value)}})}),m.jsx(xS,{summary:A.podElsewhereSummary,children:A.podElsewhereBody})]})]})}function rD(n){const{appName:a,defaultName:o,nameHint:i,error:s,pending:u=!1,onNameChange:f,onCreate:h,onChooseOtherLocation:p}=n,v=kh(n),[b,x]=g.useState(o??""),w=o!==void 0,S=b.trim(),A=!w||!!S&&i?.tone!=="error",E=R=>{R.preventDefault(),!u&&A&&h(S)};return m.jsxs(Zi,{"data-pod-sign-in-state":"idp-no-webid",chrome:m.jsx(hu,{...n}),onSubmit:E,actions:m.jsxs(m.Fragment,{children:[s?m.jsx("p",{role:"alert",className:"text-[13px] text-destructive",children:s}):null,m.jsx(Mt,{type:"submit",className:Rl,busy:u,disabled:!A,children:v.createAndContinue}),p?m.jsx(Mt,{type:"button",variant:"outline",className:mu,disabled:u,onClick:p,children:v.chooseOtherLocation}):null]}),children:[m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx("h1",{className:"text-[17px] font-semibold text-foreground",children:v.noWebIdTitle}),m.jsx("p",{className:"text-sm leading-[22px] text-muted-foreground",children:qn(v.noWebIdLead,{app:a})})]}),m.jsx("div",{className:"flex flex-col gap-4",children:w?m.jsx(mo,{label:v.webIdName,error:i?.tone==="error"?i.text:void 0,hint:i&&i.tone!=="error"?m.jsx("span",{role:"status",children:i.text}):m.jsx("span",{children:v.noWebIdLocation}),children:R=>m.jsx(ra,{...R,name:"webIdName",type:"text",autoComplete:"off",autoCapitalize:"none",spellCheck:!1,className:gl,value:b,disabled:u,onChange:T=>{x(T.target.value),f?.(T.target.value)}})}):null})]})}function oD(n){const{app:a,webIds:o,selectedWebId:i,scopes:s,rememberChoice:u,allowRememberChoice:f=a.verified,pending:h,disabled:p=!1,approveDisabled:v=!1,automationSelectId:b,onSelectWebId:x,onRememberChange:w,onApprove:S,onDeny:A,onManageAccount:E,onSwitchAccount:R}=n,T=Ca(n.locale,n.copy),_=g.useId(),N=h!==void 0||p,k=o.length===1,B=(o.find(z=>z.id===i)??o[0])?.webId,X=m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex flex-wrap gap-3",children:[m.jsx(Mt,{variant:"outline",className:Ce(mu,"w-auto min-w-max flex-1 whitespace-nowrap px-2"),busy:h==="deny",disabled:N,onClick:A,children:T.deny}),m.jsx(Mt,{className:Ce(Rl,"w-auto min-w-max flex-1 whitespace-nowrap px-2"),busy:h==="approve",disabled:N||v,onClick:S,children:T.allow})]}),E||R?m.jsxs("div",{className:"flex flex-wrap justify-center gap-2",children:[E?m.jsx("button",{type:"button",className:Ce(Ir,"text-muted-foreground hover:text-foreground"),disabled:N,onClick:E,children:T.manageAccount}):null,R?m.jsx("button",{type:"button",className:Ce(Ir,"text-muted-foreground hover:text-foreground"),disabled:N,onClick:R,children:T.switchAccount}):null]}):null]});return m.jsxs(Zi,{"data-pod-sign-in-state":"consent",chrome:m.jsx(hu,{...n}),actions:X,children:[m.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[a.icon?m.jsx("span",{"aria-hidden":"true",className:"flex h-12 w-12 items-center justify-center overflow-hidden rounded-xl",children:a.icon}):null,m.jsx("h1",{className:"text-[17px] font-semibold text-foreground",children:qn(T.consentTitle,{app:a.name})}),a.host?m.jsx(pl,{children:a.host}):null,a.verified?null:m.jsxs("p",{role:"alert",className:"flex items-start gap-1.5 text-left text-[13px] text-warning",children:[m.jsx(tj,{"aria-hidden":"true",className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),T.unverifiedWarning]})]}),m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsx("p",{id:_,className:"text-[13px] font-medium text-foreground",children:T.chooseWebId}),k?m.jsx("div",{className:"rounded-lg border border-border bg-card p-3",children:m.jsx(Wb,{webId:o[0]})}):m.jsx("div",{role:"radiogroup","aria-labelledby":_,className:"flex flex-col gap-2",children:o.map(z=>{const H=z.id===i;return m.jsxs("label",{className:Ce("flex min-h-11 cursor-pointer items-center gap-3 rounded-lg border p-3 focus-within:outline focus-within:outline-2 focus-within:outline-offset-2 focus-within:outline-ring",H?"border-primary bg-accent":"border-border bg-card"),children:[m.jsx("input",{type:"radio",name:"consent-webid",className:"sr-only",value:z.id,checked:H,disabled:N,onChange:()=>x(z.id)}),m.jsx(Wb,{webId:z})]},z.id)})}),!k&&b?m.jsxs("select",{id:b,"aria-hidden":"true","aria-label":T.chooseWebId,tabIndex:-1,className:"sr-only",value:i,disabled:N,onChange:z=>x(z.target.value),children:[i?null:m.jsx("option",{value:"",disabled:!0,children:T.chooseWebId}),o.map(z=>m.jsxs("option",{value:z.id,children:[z.displayName," ",z.shortName]},z.id))]}):null,m.jsx("p",{className:"text-[13px] leading-5 text-muted-foreground",children:qn(T.consentConsequence,{app:a.name})})]}),m.jsx(xS,{summary:T.requestDetails,children:m.jsxs("div",{className:"flex flex-col gap-2",children:[s.length>0?m.jsxs("div",{children:[m.jsx("p",{className:"font-medium text-foreground",children:T.scopes}),m.jsx("ul",{className:"list-disc pl-5",children:s.map(z=>m.jsx("li",{children:z.label},z.id))})]}):null,B?m.jsxs("p",{children:[m.jsx("span",{className:"font-medium text-foreground",children:T.webIdFull})," ",m.jsx(pl,{className:"break-all",children:B})]}):null,a.clientId?m.jsxs("p",{children:[m.jsx("span",{className:"font-medium text-foreground",children:T.clientId})," ",m.jsx(pl,{className:"break-all",children:a.clientId})]}):null,f?m.jsx(wS,{checked:u,onChange:w,label:T.rememberChoice,disabled:N}):null]})})]})}function Wb({webId:n}){return m.jsxs("span",{className:"flex min-w-0 items-center gap-3","data-pod-sign-in":"webid-row",children:[m.jsx(Lm,{name:n.displayName,avatarUrl:n.avatarUrl,storage:n.storage,size:40}),m.jsxs("span",{className:"flex min-w-0 flex-col",children:[m.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:n.displayName}),n.shortName!==n.displayName?m.jsx("span",{className:"truncate font-mono text-xs text-muted-foreground",children:n.shortName}):null]})]})}const lD={ok:"bg-success",unreachable:"bg-warning",stopped:"bg-muted-foreground",offline:"bg-border"};function iD(n,a){switch(n){case"ok":return a.deviceStatusOk;case"unreachable":return a.deviceStatusUnreachable;case"stopped":return a.deviceStatusStopped;case"offline":return a.deviceStatusOffline}}function sD(n,a){return n==="cloud"?a.deviceCloud:a.deviceEdge}function SS({device:n,copy:a,showStatus:o=!0}){const i=n.kind==="cloud"?Iw:Pw;return m.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-3 text-left","data-device-id":n.id,children:[m.jsx("span",{"aria-hidden":"true",className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground",children:n.icon??m.jsx(i,{className:"h-4 w-4"})}),m.jsxs("span",{className:"flex min-w-0 flex-col",children:[m.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[m.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:n.name}),m.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 text-xs text-muted-foreground",children:sD(n.kind,a)})]}),m.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-x-2 text-xs text-muted-foreground",children:[n.address?m.jsx(pl,{className:"truncate",children:n.address}):null,n.podCount!==void 0?m.jsx("span",{children:a.podCount.replace("{count}",String(n.podCount))}):null,o?m.jsxs("span",{className:"flex items-center gap-1",children:[m.jsx("span",{"aria-hidden":"true",className:Ce("h-2 w-2 rounded-full",lD[n.status])}),iD(n.status,a)]}):null]})]})]})}const CS="pod-sign-in flex flex-col gap-3 text-foreground",Bc="flex min-h-14 items-center gap-3 rounded-lg border border-border bg-card px-3 py-2",cD="text-[17px] font-semibold text-foreground";function ES({id:n,icon:a,title:o,hint:i,actions:s}){return m.jsxs("div",{className:"flex items-start justify-between gap-3",children:[m.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[m.jsx(a,{"aria-hidden":"true",className:"mt-0.5 h-[18px] w-[18px] shrink-0 text-primary"}),m.jsxs("div",{className:"min-w-0",children:[m.jsx("h2",{id:n,className:cD,children:o}),m.jsx("p",{className:"text-[13px] text-muted-foreground",children:i})]})]}),s]})}const uD="pod-sign-in max-h-[90dvh] w-[min(400px,calc(100vw-2rem))] max-w-[400px] gap-4 overflow-y-auto rounded-xl bg-card p-5";function dD({open:n,onOpenChange:a,devices:o,selectedDeviceId:i,onSelect:s,onAddDevice:u,locale:f,copy:h}){const p=Ca(f,h);return m.jsx(J0,{open:n,onOpenChange:a,children:m.jsxs(jh,{className:uD,"aria-describedby":void 0,children:[m.jsx(Oh,{className:"text-[17px] leading-6",children:p.devicePickerTitle}),m.jsx("div",{role:"radiogroup","aria-label":p.devicePickerTitle,className:"flex flex-col gap-2",children:o.map(v=>{const b=v.status!=="offline",x=v.id===i;return m.jsx("button",{type:"button",role:"radio","aria-checked":x,disabled:!b,className:Ce("flex min-h-14 w-full items-center rounded-lg border px-3 py-2 text-left",x?"border-primary bg-accent":"border-border bg-card",b?"hover:bg-accent":"cursor-not-allowed opacity-50"),onClick:()=>{s(v.id),a(!1)},children:m.jsx(SS,{device:v,copy:p})},v.id)})}),m.jsx(Mt,{variant:"outline",className:mu,onClick:u,children:p.addDevice})]})})}const Dr="h-9 rounded-lg px-3 text-sm font-medium";function $b({webId:n,podUrl:a,copy:o}){return m.jsxs("details",{className:"mt-1 min-w-0 text-xs",children:[m.jsx("summary",{className:"w-fit cursor-pointer rounded py-1 text-primary underline-offset-4 hover:underline",children:o.showAddresses}),m.jsx("dl",{className:"mt-1 grid min-w-0 gap-2",children:[{label:o.identityAddress,url:n},{label:o.storageAddress,url:a}].filter(i=>i.url).map(({label:i,url:s})=>m.jsxs("div",{className:"min-w-0",children:[m.jsx("dt",{className:"text-muted-foreground",children:i}),m.jsx("dd",{className:"min-w-0",children:m.jsx("a",{className:"break-all text-primary underline underline-offset-4",href:s,target:"_blank",rel:"noopener noreferrer",children:m.jsx(pl,{className:"text-inherit",children:s})})})]},i))})]})}function fD({name:n,onNameChange:a,addressPreview:o,nameHint:i,devices:s,selectedDeviceId:u,onSelectDevice:f,onAddDevice:h,creating:p=!1,starting:v=!1,onStartDevice:b,onSubmit:x,onCancel:w,locale:S,copy:A}){const E=Ca(S,A),[R,T]=g.useState(!1),_=s.find(z=>z.id===u),N=_?.status==="stopped",k=p||v,B=n.trim(),X=z=>{z.preventDefault(),!(k||!_)&&(N?b?.(_.id):B&&i?.tone!=="error"&&x())};return m.jsxs("form",{onSubmit:X,"aria-label":E.createWebId,"data-pod-sign-in":"create-webid",className:"flex flex-col gap-4 border-t border-border bg-muted p-4",noValidate:!0,children:[m.jsx(mo,{label:`1 · ${E.createStepName}`,error:i?.tone==="error"?i.text:void 0,hint:i?.tone==="ok"?m.jsx("span",{role:"status",children:i.text}):o?m.jsxs("span",{children:[m.jsxs("span",{className:"sr-only",children:[E.createNameHint,": "]}),m.jsx(pl,{children:o})]}):void 0,children:z=>m.jsx(ra,{...z,name:"webIdName",type:"text",autoComplete:"off",autoCapitalize:"none",spellCheck:!1,value:n,disabled:k,onChange:H=>a(H.target.value)})}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx("p",{className:"text-[13px] font-medium text-foreground",children:`2 · ${E.createStepLocation}`}),_?m.jsxs("div",{className:Bc,"data-pod-sign-in":"selected-device",children:[m.jsx(SS,{device:_,copy:E}),m.jsx("button",{type:"button",className:Ce(Ir,"shrink-0 text-primary hover:underline"),disabled:k,onClick:()=>T(!0),children:E.changeDevice})]}):null,m.jsx("p",{className:"text-[13px] text-muted-foreground",children:E.cannotChangeLater})]}),p?m.jsxs("p",{role:"status","aria-live":"polite",className:"flex items-center gap-2 text-[13px] text-muted-foreground",children:[m.jsx(bS,{}),E.creatingNote]}):null,m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsx(Mt,{type:"submit",className:Rl,busy:k,disabled:!_||(N?!b:!B||i?.tone==="error"),children:N?E.startDeviceXpod:E.createPod}),w?m.jsx(Mt,{variant:"outline",className:mu,disabled:k,onClick:w,children:E.cancel}):null]}),m.jsx(dD,{open:R,onOpenChange:T,devices:s,selectedDeviceId:u,onSelect:f,onAddDevice:()=>{T(!1),h()},locale:S,copy:A})]})}function mD({webIds:n,createOpen:a=!1,onCreateOpenChange:o,createForm:i,onCreateExternal:s,createExternalLabel:u,onLinkExisting:f,onGoToDevice:h,onRemoveStorage:p,removeStorageLabel:v,authorizeStorageLabel:b,onAuthorizeStorage:x,onAuthorizeUnlinkedPod:w,unlinkedPods:S,onRemoveUnlinkedPod:A,locale:E,copy:R}){const T=Ca(E,R),_=g.useId();return m.jsxs("section",{"aria-labelledby":_,"data-pod-sign-in":"webid-section",className:CS,children:[m.jsx(ES,{id:_,icon:aj,title:T.webIdSectionTitle,hint:T.webIdSectionHint,actions:m.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[f?m.jsx(Mt,{variant:"ghost",className:Dr,onClick:f,children:T.linkExistingWebId}):null,i&&!a?m.jsx(Mt,{variant:"outline",className:Dr,onClick:()=>o?.(!0),children:T.createWebId}):null,!i&&s?m.jsx(Mt,{variant:"outline",className:Dr,onClick:s,children:u??T.createWebId}):null]})}),n.length===0?m.jsx("p",{className:"rounded-lg border border-border bg-card px-3 py-3 text-sm text-muted-foreground",children:T.webIdEmpty}):m.jsx("ul",{className:"flex flex-col gap-2",children:n.map(N=>m.jsxs("li",{className:Bc,"data-webid-id":N.id,children:[m.jsx(Lm,{name:N.displayName,avatarUrl:N.avatarUrl,storage:N.storage,size:40}),m.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[m.jsx("a",{className:"truncate text-sm font-medium text-primary hover:underline",href:N.webId,target:"_blank",rel:"noopener noreferrer",children:N.displayName}),N.storage?m.jsx("span",{className:"text-xs text-muted-foreground",children:N.storage.label}):null,m.jsx($b,{webId:N.webId,podUrl:N.podUrl,copy:T}),m.jsxs("span",{className:"flex flex-wrap items-center gap-x-3 text-xs text-muted-foreground",children:[N.deviceName?N.deviceId&&h?m.jsx("button",{type:"button",className:"rounded text-xs text-primary hover:underline",onClick:()=>h(N.deviceId),children:qn(T.podOnDevice,{device:N.deviceName})}):m.jsx("span",{children:qn(T.podOnDevice,{device:N.deviceName})}):null,N.authorizedAppCount!==void 0?m.jsx("span",{children:qn(T.authorizedApps,{count:N.authorizedAppCount})}):null]})]}),!N.removable&&N.authorizable&&x&&b?m.jsx(Mt,{variant:"outline",className:Ce(Dr,"shrink-0"),"aria-label":`${b} ${N.displayName}`,onClick:()=>x(N),children:b}):null,N.removable&&p?m.jsx(Mt,{variant:"outline","aria-label":`${v??T.revokeCredential} ${N.displayName}`,className:Ce(Dr,"shrink-0 border-destructive/50 text-destructive hover:text-destructive"),onClick:()=>p(N),children:v??T.revokeCredential}):null]},N.id))}),S&&S.length>0?m.jsx("ul",{className:"flex flex-col gap-2","data-pod-sign-in":"unlinked-pods",children:S.map(N=>m.jsxs("li",{className:Bc,"data-unlinked-pod-id":N.id,children:[m.jsx(Lm,{name:N.displayName,storage:N.storage,size:40}),m.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[m.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:N.displayName}),N.storage?m.jsx("span",{className:"text-xs text-muted-foreground",children:N.storage.label}):null,m.jsx($b,{podUrl:N.storageUrl,copy:T})]}),!N.removable&&N.authorizable&&w&&b?m.jsx(Mt,{variant:"outline",className:Ce(Dr,"shrink-0"),"aria-label":`${b} ${N.displayName}`,onClick:()=>w(N),children:b}):null,N.removable&&A?m.jsx(Mt,{variant:"outline","aria-label":`${v??T.revokeCredential} ${N.displayName}`,className:Ce(Dr,"shrink-0 border-destructive/50 text-destructive hover:text-destructive"),onClick:()=>A(N),children:v??T.revokeCredential}):null]},N.id))}):null,i&&a?m.jsx(fD,{...i,locale:i.locale??E,copy:i.copy??R,onCancel:i.onCancel??(n.length>0?()=>o?.(!1):void 0)}):null]})}function hD({credentials:n,canCreate:a,onCreate:o,onRevoke:i,locale:s,copy:u}){const f=Ca(s,u),h=g.useId();return m.jsxs("section",{"aria-labelledby":h,"data-pod-sign-in":"credential-section",className:CS,children:[m.jsx(ES,{id:h,icon:$N,title:f.credentialSectionTitle,hint:f.credentialSectionHint,actions:m.jsx(Mt,{variant:"outline",className:Ce(Dr,"shrink-0"),disabled:!a,onClick:o,children:f.createCredential})}),n.length===0?m.jsx("p",{className:"rounded-lg border border-border bg-card px-3 py-3 text-sm text-muted-foreground",children:f.credentialEmpty}):m.jsx("ul",{className:"flex flex-col gap-2",children:n.map(p=>m.jsxs("li",{className:Bc,children:[m.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[m.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:p.label}),m.jsxs("span",{className:"truncate text-xs text-muted-foreground",children:[p.webIdName,p.createdLabel?` · ${p.createdLabel}`:""]})]}),i?m.jsx("button",{type:"button","aria-label":`${f.revokeCredential} ${p.label}`,className:Ce(Ir,"shrink-0 text-destructive hover:underline"),onClick:()=>i(p.id),children:f.revokeCredential}):null]},p.id))})]})}function pD({app:n,podReady:a,onContinue:o,onCancel:i,statusText:s,pending:u=!1,locale:f,copy:h}){const p=Ca(f,h),v=g.useId();return m.jsxs("section",{"aria-labelledby":v,"data-pod-sign-in":"consent-resume",className:"pod-sign-in flex flex-wrap items-center gap-3 rounded-lg bg-muted px-4 py-3 text-foreground",children:[n.icon?m.jsx("span",{"aria-hidden":"true",className:"flex h-8 w-8 shrink-0 items-center justify-center overflow-hidden rounded-lg",children:n.icon}):null,m.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[m.jsx("p",{id:v,className:"text-sm font-semibold",children:qn(p.resumeTitle,{app:n.name})}),m.jsx("p",{role:"status","aria-live":"polite",className:"text-[13px] text-muted-foreground",children:s??(a?p.resumeReady:p.resumeWaiting)})]}),m.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[m.jsx("button",{type:"button",className:Ce(Ir,"text-primary hover:underline"),disabled:u,onClick:i,children:p.resumeCancel}),m.jsx(Mt,{className:"h-11 rounded-lg px-4 text-sm font-medium",busy:u,disabled:!a,onClick:o,children:qn(p.resumeContinue,{app:n.name})})]})]})}function Hc(n){try{const a=new URL(n),o=a.pathname.split("/").filter(i=>i&&!["profile","card"].includes(i));return o[o.length-1]??a.hostname}catch{return n}}function AS({frame:n,testId:a,children:o}){return n==="bare"?m.jsx("div",{"data-testid":a,"data-account-auxiliary-frame":"bare",className:"w-full text-card-foreground",children:o}):m.jsx(kw,{className:"w-full border-border bg-card text-card-foreground",children:m.jsx(vS,{"data-testid":a,className:"max-h-[min(70vh,36rem)] overflow-y-auto",children:o})})}function gD({email:n,onEmailChange:a,onSubmit:o,onRecover:i,pending:s=!1,status:u="idle",error:f,copy:h,frame:p="card",showHeader:v=!0}){const b=g.useId(),x=s||u==="submitting",w=o??i,S=E=>{E.preventDefault(),x||w?.(n)},A=m.jsxs(m.Fragment,{children:[v?m.jsxs(uh,{className:p==="bare"?"p-0 pb-4":void 0,children:[m.jsx(dh,{children:h.title}),h.description?m.jsx(fh,{children:h.description}):null]}):null,m.jsx(zc,{className:p==="bare"?"p-0":void 0,children:u==="success"?m.jsxs("div",{role:"status","aria-live":"polite",className:"space-y-2",children:[m.jsx("p",{className:"font-medium text-foreground",children:h.successTitle}),m.jsx("p",{className:"text-sm text-muted-foreground",children:h.successMessage})]}):m.jsxs("form",{onSubmit:S,className:"space-y-4",children:[m.jsxs("div",{className:"space-y-2",children:[m.jsx(Pc,{htmlFor:b,children:h.emailLabel}),m.jsx(du,{id:b,name:"email",autoComplete:"email",placeholder:h.emailPlaceholder,value:n,disabled:x,onChange:E=>a(E.currentTarget.value)})]}),f?m.jsx("p",{role:"alert","aria-live":"polite",className:"text-sm text-destructive",children:f}):null,m.jsxs(Qe,{type:"submit",className:"w-full",disabled:x||!n.trim()||!w,children:[x?m.jsx(nu,{"aria-hidden":"true",className:"mr-2 h-4 w-4 animate-spin"}):null,h.actionLabel]})]})})]});return m.jsx(AS,{frame:p,testId:"password-recovery-scroll",children:A})}function vD({password:n,confirmation:a,onPasswordChange:o,onConfirmationChange:i,onSubmit:s,onReset:u,pending:f=!1,status:h="idle",error:p,copy:v,frame:b="card",showHeader:x=!0}){const w=g.useId(),S=g.useId(),A=f||h==="submitting",E=s??u,R=n.length>0&&n!==a,T=N=>{N?.preventDefault(),!A&&(R||E?.({password:n,confirmation:a}))},_=h==="success"?m.jsx(zc,{className:b==="bare"?"p-0":void 0,children:m.jsx("p",{role:"status","aria-live":"polite",children:v.successMessage})}):m.jsxs(m.Fragment,{children:[x?m.jsxs(uh,{className:b==="bare"?"p-0 pb-4":void 0,children:[m.jsx(dh,{children:v.title}),v.description?m.jsx(fh,{children:v.description}):null]}):null,m.jsx(zc,{className:b==="bare"?"p-0":void 0,children:m.jsxs("form",{onSubmit:T,className:"space-y-4",children:[m.jsxs("div",{className:"space-y-2",children:[m.jsx(Pc,{htmlFor:w,children:v.passwordLabel}),m.jsx(ra,{id:w,type:"password",autoComplete:"new-password",placeholder:v.passwordPlaceholder,value:n,disabled:A,onChange:N=>o(N.currentTarget.value)})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(Pc,{htmlFor:S,children:v.confirmationLabel}),m.jsx(ra,{id:S,type:"password",autoComplete:"new-password",placeholder:v.confirmationPlaceholder,value:a,disabled:A,"aria-invalid":R?!0:void 0,onChange:N=>i(N.currentTarget.value)})]}),p?m.jsx("p",{role:"alert","aria-live":"polite",className:"text-sm text-destructive",children:p}):null,R?m.jsx("p",{role:"alert","aria-live":"polite",className:"text-sm text-destructive",children:v.mismatchError}):null,m.jsxs(Qe,{type:"submit",className:"w-full",disabled:A||!E,children:[A?m.jsx(nu,{"aria-hidden":"true",className:"mr-2 h-4 w-4 animate-spin"}):null,v.actionLabel]})]})})]});return m.jsx(AS,{frame:b,testId:"password-reset-scroll",children:_})}function Ki(){return globalThis.xpodDesktop?"window":"document"}function RS(n=!0,a="auth"){g.useEffect(()=>{if(n)return globalThis.xpodDesktop?.setWindowMode?.(a),()=>{globalThis.xpodDesktop?.setWindowMode?.("workspace")}},[n,a])}function TS({title:n,description:a,children:o,host:i="document",bare:s=!1,intro:u,serviceIcon:f}){const h=g.useId(),p=i==="window",v=p?"window":"page";return m.jsx("main",{"data-testid":"web-account-page",className:p?"h-dvh w-full overflow-hidden":void 0,children:m.jsx(Q_,{presentation:p?"window":"page",ariaLabel:n,appIntro:u,dataAttributes:{"data-web-account-layout":v,"data-web-account-host":p?"window":"document"},children:m.jsx("div",{"data-testid":"web-account-panel","data-web-account-layout":v,"data-web-account-host":p?"window":"document",className:"flex min-h-0 min-w-0 flex-1 flex-col",children:s?o:m.jsxs(Zi,{chrome:m.jsx(Lh,{serviceName:"Xpod",serviceHost:window.location.host,icon:f}),children:[m.jsxs("header",{className:"flex flex-col gap-1",children:[m.jsx("h1",{id:h,className:"text-[17px] font-semibold text-foreground",children:n}),a?m.jsx("p",{className:"text-sm leading-[22px] text-muted-foreground",children:a}):null]}),o]})})})})}const yD={"zh-CN":{name:"Xpod 账号服务",proposition:"一个账号,管理你的 WebID 和它背后的 Pod。",points:[{title:"WebID 是你的身份",detail:"登录应用时使用它;数据存在你自己的 Pod 里。"},{title:"Pod 存在哪里由你决定",detail:"Xpod 云端或你自己的设备,创建后可以在这里查看。"},{title:"密钥按需签发",detail:"为脚本或服务单独创建凭据,不再需要就撤销。"}]},en:{name:"Xpod accounts",proposition:"One account for your WebID and the Pod behind it.",points:[{title:"Your WebID is your identity",detail:"Apps sign you in with it; your data stays in your own Pod."},{title:"You choose where the Pod lives",detail:"Xpod cloud or your own device, reviewable here after creation."},{title:"Credentials on demand",detail:"Issue a key per script or service, and revoke it when it is done."}]}};function NS({serviceHost:n,locale:a="zh-CN"}){const o=yD[a];return m.jsxs("div",{"data-testid":"web-account-introduction",className:"flex max-w-[460px] flex-col gap-7",children:[m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx(fu,{size:44}),m.jsx("span",{className:"text-[22px] font-semibold leading-none text-foreground",children:o.name})]}),m.jsxs("div",{className:"flex flex-col gap-3",children:[m.jsx("h2",{className:"m-0 text-[28px] font-semibold leading-[38px] text-foreground",children:o.proposition}),n?m.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:n}):null]}),m.jsx("ul",{className:"m-0 flex list-none flex-col gap-4 p-0",children:o.points.map(i=>m.jsxs("li",{className:"flex gap-3",children:[m.jsx("span",{"aria-hidden":"true",className:"mt-2 h-2 w-2 shrink-0 rounded-full bg-primary"}),m.jsxs("span",{className:"flex flex-col gap-0.5",children:[m.jsx("span",{className:"text-[15px] font-semibold text-foreground",children:i.title}),m.jsx("span",{className:"text-sm leading-[22px] text-muted-foreground",children:i.detail})]})]},i.title))})]})}function bD(n){if(!n||typeof n!="object")throw new Error("Missing deployment identity");const a=n;if(a.edition!=="cloud"&&a.edition!=="local"||typeof a.managed!="boolean")throw new Error("Invalid deployment identity");let o;if(a.edition==="local"&&a.managed&&typeof a.oidcIssuer=="string"){const s=new URL(a.oidcIssuer);if(!["http:","https:"].includes(s.protocol)||s.username||s.password||s.search||s.hash)throw new Error("Invalid account service");o=s.href.replace(/\/$/u,"")}let i;if(typeof a.publicUrl=="string"){const s=new URL(a.publicUrl);if(!["http:","https:"].includes(s.protocol)||s.username||s.password||s.search||s.hash)throw new Error("Invalid public service address");i=s.href}return{edition:a.edition,managed:a.managed,oidcIssuer:o,publicUrl:i}}function Xc({renderLogo:n,className:a}={}){const[o,i]=g.useState();g.useEffect(()=>{const f=new AbortController;return(async()=>{try{const h=await fetch("/api/service-info",{headers:{accept:"application/json"},cache:"no-store",signal:f.signal});if(!h.ok)throw new Error("Deployment identity unavailable");const p=bD(await h.json());f.signal.aborted||i(p)}catch{f.signal.aborted||i(null)}})(),()=>f.abort()},[]);const s=o?o.edition==="cloud"?"云端":o.managed?"托管部署":"独立部署":o===null?"部署信息暂不可用":"正在识别部署…",u=n?n(s):m.jsxs("span",{"data-testid":"xpod-deployment-logo",className:"inline-flex flex-col items-center gap-0.5",children:[m.jsx(fu,{size:24}),m.jsx("span",{className:"text-[8px] font-medium leading-none text-primary",children:o?s:o===null?"未知":"…"}),o?null:m.jsx("span",{className:"sr-only",children:s})]});return m.jsx("div",{"data-testid":"xpod-deployment-identity",className:a,children:m.jsx(pO,{logo:u,infoLabel:"部署详情",info:m.jsxs("div",{className:"space-y-2 leading-relaxed",children:[m.jsx("p",{className:"font-semibold",children:"部署详情"}),o?m.jsxs("p",{children:["部署类型:",o.edition==="cloud"?"Cloud":o.managed?"Local · 云端托管":"Local · 独立部署"]}):m.jsx("p",{children:s}),m.jsxs("p",{children:["当前访问:",m.jsx("span",{className:"font-mono",children:window.location.origin})]}),o?m.jsxs("p",{children:[o.edition==="local"?"节点地址":"服务地址",":",m.jsx("span",{className:"font-mono",children:o.publicUrl??(o.managed?"尚未分配":"尚未配置")})]}):null,o?.oidcIssuer&&o.oidcIssuer!==window.location.origin?m.jsxs("p",{children:["账号服务:",m.jsx("span",{className:"font-mono",children:o.oidcIssuer})]}):null]})})})}function yo({title:n,children:a,bare:o=!1,intro:i,presentation:s="compact"}){const u=Ki(),f=s==="compact";return RS(u==="window",f?"account":"workspace"),m.jsx(TS,{title:n,host:f?u:"document",bare:o,intro:i??m.jsx(NS,{serviceHost:window.location.host}),serviceIcon:m.jsx(Xc,{}),children:a})}function xD(n){return{email:n.emailLabel,password:n.passwordLabel,username:n.usernameLabel,signIn:n.loginAction,registerSubmit:n.registerAction,rememberDevice:"记住账号"}}function wD(n){const a=Ki(),o=n.mode!=="register";RS(a==="window",o?"account":"workspace");const{mode:i,values:s,onChange:u,onSubmit:f,onFieldChange:h,onModeChange:p,rememberAccount:v=!0,onRememberAccountChange:b,pending:x=!1,errors:w,copy:S,surfaceTitle:A,footer:E,onForgot:R,onRegister:T,forgotHref:_,registerHref:N}=n,k={serviceName:"Xpod",serviceHost:window.location.host,serviceIcon:m.jsx(Xc,{}),copy:xD(S)},B=(X,z)=>{u({...s,[X]:z}),h?.(X,z)};return m.jsxs(TS,{title:A,host:o?a:"document",bare:!0,intro:m.jsx(NS,{serviceHost:window.location.host}),children:[i==="register"?m.jsx(aD,{...k,requireUsername:!1,pending:x,defaultEmail:s.email,defaultPassword:s.password,error:w?.form,fieldErrors:{email:w?.email,password:w?.password},onFieldChange:B,onSubmit:X=>{f({...s,...X})},onSignIn:p?()=>p("login"):void 0}):m.jsx(nD,{...k,pending:x,remember:v,defaultEmail:s.email,defaultPassword:s.password,error:w?.form,fieldErrors:{email:w?.email,password:w?.password},onFieldChange:B,onRememberChange:b,onSubmit:X=>{f({...s,...X})},onForgot:R,forgotHref:_,registerHref:N,onRegister:T??(p?()=>p("register"):void 0)}),E?m.jsx("div",{className:"space-y-3",children:E}):null]})}function SD(){return m.jsx(yo,{title:"正在加载 Xpod",children:m.jsxs("div",{role:"status","aria-live":"polite",className:"flex flex-1 items-center justify-center p-5 text-sm text-muted-foreground",children:[m.jsx(nu,{"aria-hidden":"true",className:"mr-2 h-5 w-5 animate-spin"}),"正在加载…"]})})}function CD(){const[n,a]=g.useState(!1),[o,i]=g.useState(!1),s=g.useRef(!1);if(!window.xpodDesktop?.cancelLogin)return null;const u=async()=>{const f=window.xpodDesktop;if(!(s.current||!f?.cancelLogin)){s.current=!0,a(!0),i(!1);try{await f.cancelLogin()}catch{i(!0)}finally{s.current=!1,a(!1)}}};return m.jsxs("div",{className:"space-y-2",children:[o&&m.jsx("p",{role:"alert",className:"text-sm text-destructive",children:"返回应用未完成,请重试。"}),m.jsx(Qe,{type:"button",variant:"ghost",className:"w-full",disabled:n,"aria-busy":n,onClick:()=>{u()},children:n?"正在返回…":"返回应用"})]})}function ED({message:n,retry:a}){return m.jsx(yo,{title:"账号服务暂时不可用",children:m.jsxs("div",{className:"space-y-6",children:[m.jsx("p",{role:"alert",className:"text-sm leading-relaxed text-muted-foreground",children:"无法读取账号服务信息。请重试当前步骤,无需重新注册或清除登录状态。"}),m.jsxs("details",{className:"text-xs text-muted-foreground",children:[m.jsx("summary",{className:"cursor-pointer",children:"技术详情"}),m.jsx("p",{className:"mt-2 break-words",children:n})]}),m.jsx(Qe,{type:"button",className:"w-full",onClick:()=>a?void a():window.location.reload(),children:"重试"}),m.jsx(CD,{})]})})}const km="xpod:returnTo";function ji(n){try{n&&sessionStorage.setItem(km,n)}catch{return}}function Mh(){try{const n=sessionStorage.getItem(km);return n&&sessionStorage.removeItem(km),n}catch{return null}}function AD(){try{const n=new URLSearchParams(window.location.search).get("returnTo");return!n||new URL(n,window.location.origin).origin!==window.location.origin?null:n}catch{return null}}function RD(n,a){return ee(n?"/.account/oidc/consent/":Mh()??a)}function TD(n,a,o=!1){return n&&a&&!o}function rm({children:n,allowOidcPending:a=!1}){const{controls:o,isLoggedIn:i,hasOidcPending:s}=vn(),u=gn();if(TD(i,s,a))return m.jsx(aa,{to:ee("/.account/oidc/consent/"),replace:!0});if(!i){ji(u.pathname+u.search);const f=o?.html?.password?.login||o?.password?.login||ee("/.account/login/password/");return m.jsx(aa,{to:ee(f),replace:!0})}return m.jsx(m.Fragment,{children:n})}function jS(n){if(n)try{const a=new URL(n,window.location.origin);return!["https:","http:"].includes(a.protocol)||a.username||a.password||a.pathname!=="/.account/"?void 0:(a.search="",a.hash="",new URL("account/",a).href)}catch{return}}function Tl(n){return n!==n.trim()||/[\r\n\t]/.test(n)}const ND=["/dashboard","/status","/network","/settings","/ai-config","/ai-connections","/tasks","/pod","/device","/inbox","/notifications"],jD=new Set(["/tasks","/pod","/pod/models","/pod/search","/pod/apps","/pod/data","/device","/device/network","/device/services","/device/runtime","/device/logs","/inbox","/notifications"]);function OD(n){const a=n.replace(/\/$/u,"");return jD.has(a)?!0:ND.slice(0,6).some(o=>a===o||a.startsWith(`${o}/`))}function _D(n){if(n===void 0)return;if(typeof n!="string"||n.trim()==="")throw new TypeError("returnTo must be a non-empty application path");const a=n.trim(),o=DD(a),i=o.split(/[?#]/,1)[0];if(!a.startsWith("/")||a.startsWith("//")||a.includes("\\")||o.includes("\\")||/^[a-z][a-z\d+.-]*:/i.test(o)||o.startsWith("//")||i.split("/").some(s=>s==="..")||!OD(i))throw new TypeError("returnTo must be a safe path within the application allow-list");return a}function DD(n){let a=n;for(let o=0;o<4;o+=1){let i;try{i=decodeURIComponent(a)}catch{throw new TypeError("returnTo contains malformed percent encoding")}if(i===a)return a;a=i}return a}const Mm="xpod-current-origin";function UD(n){return _D(n)}function zD(n,a){const o=Xx(n),i=new URL(a).origin,s=new URL(o.identityProvider.url).origin,u=o.storageProvider?new URL(o.storageProvider.url).origin:void 0;if(o.id!==Mm||s!==i||u!==i||o.identityProvider.url!==o.storageProvider?.url)throw new TypeError("Xpod login route must use the current origin for identity and storage");return{...o,identityProvider:{...o.identityProvider,url:i},storageProvider:o.storageProvider?{...o.storageProvider,url:i}:void 0}}const jc="xpod.remembered-login.v1",Oi="xpod.pending-account-email.v1",Ii="xpod.pending-account-issuer.v1",Im="xpod.account-remember-choice.v1";function pu(){if(!(typeof window>"u"))try{return window.localStorage}catch{return}}function LD(n={}){const a=n.storage??pu();if(a)try{const o=a.getItem(jc);if(!o)return;const i=ID(JSON.parse(o),n.origin??vu());return i||a.removeItem(jc),i}catch{try{a.removeItem(jc)}catch{}return}}function OS(n,a=pu()){try{const i=JSON.parse(a?.getItem(Im)??"{}")[gu(n??vu()??"")];return typeof i=="boolean"?i:void 0}catch{return}}function _S(){try{return typeof window>"u"?void 0:window.sessionStorage}catch{return}}function Fb(n,a){const o=n?.getItem(Ii);(!o||o===a)&&(n?.removeItem(Oi),n?.removeItem(Ii))}function kD(n,a=pu(),o,i=!0,s=_S()){const u=Ih(n);if(!u)return;const f=gu(o??vu()??"");try{const h=JSON.parse(a?.getItem(Im)??"{}"),p=h&&typeof h=="object"&&!Array.isArray(h)?h:{};if(a?.setItem(Im,JSON.stringify({...p,[f]:i})),!i){Fb(a,f);const b=LD({storage:a});(!b?.issuer||b.issuer===f)&&a?.removeItem(jc)}const v=i?a:s;return v?(v.setItem(Oi,u),v.setItem(Ii,f),i&&Fb(s,f),u):void 0}catch{return}}function MD(n=pu(),a,o=_S()){const i=OS(a,n)===!1?o:n;if(i)try{const s=Ih(i.getItem(Oi));if(a){const u=i.getItem(Ii);if(!u){i.removeItem(Oi),i.removeItem(Ii);return}if(u!==gu(a))return}return s||i.removeItem(Oi),s}catch{return}}function gu(n){try{const a=vu();return a?new URL(n,a).origin:new URL(n).origin}catch{return n.trim()}}function ID(n,a){if(!n||typeof n!="object")return;const o=n;if(o.routeId!==Mm||o.issuer!==void 0&&!Pi(o.issuer)||!o.account||typeof o.account!="object"||!o.storageBinding||typeof o.storageBinding!="object")return;const i=o.account,s=o.storageBinding,u=Ih(i.email),f=Qb(o.webId),h=Qb(s.webId),p=Pi(s.storageUrl,!0);if(i.email!==void 0&&!u||!f||!h||!p||f!==h)return;const v=PD(i.avatarUrl,[f,p,a]);return{...typeof o.issuer=="string"?{issuer:gu(o.issuer)}:{},account:{...u?{email:u}:{},...sl(i.id)?{id:sl(i.id)}:{},...sl(i.username)?{username:sl(i.username)}:{},...sl(i.displayName)?{displayName:sl(i.displayName)}:{},...v?{avatarUrl:v}:{}},webId:f,storageBinding:{webId:f,storageUrl:p},routeId:Mm}}function Ih(n){if(typeof n!="string")return;const a=n.trim();return a&&a.length<=320&&a.includes("@")?a:void 0}function sl(n){if(typeof n!="string")return;const a=n.replace(/\s+/g," ").trim();return a?Array.from(a).slice(0,160).join(""):void 0}function Qb(n){return typeof n=="string"&&!Tl(n)&&Pi(n)?n:void 0}function Pi(n,a=!1){if(!(typeof n!="string"||n.length>2048))try{const o=new URL(n);return o.username||o.password||o.protocol!=="http:"&&o.protocol!=="https:"?void 0:(a&&(o.hash="",o.pathname.endsWith("/")||(o.pathname+="/")),o.href)}catch{return}}function PD(n,a){const o=Pi(n);if(!o)return;const i=new URL(o).origin;return a.some(s=>{const u=Pi(s);return u&&new URL(u).origin===i})?o:void 0}function vu(){return typeof window>"u"?void 0:window.location.origin}function BD(n,a){const o=DS(n,a),[i,s]=g.useState();o&&i&&i.issuer===void 0&&s({issuer:o,value:i.value});const u=o?OS(o):void 0;return[i&&(i.issuer===o||i.issuer===void 0)?i.value:u??!1,p=>s({issuer:o,value:p})]}function DS(n,a){const o=a?void 0:jS(n);return o?new URL(o).origin:void 0}function HD(n,a,o){const i=DS(n,a),s=v=>MD(void 0,v)??"",[u,f]=g.useState(()=>({issuer:i,values:{email:i?s(i):"",password:"",confirmation:""},emailEdited:!1}));let h=u;if(i&&u.issuer!==i){const v=u.issuer===void 0;h={issuer:i,values:v?{...u.values,email:u.emailEdited?u.values.email:s(i)}:{email:s(i),password:"",confirmation:""},emailEdited:v&&u.emailEdited},f(h)}const p=v=>{f(b=>{const x=typeof v=="function"?v(b.values):v;return{...b,values:x,emailEdited:b.emailEdited||x.email!==b.values.email}})};return[h.values,p,i]}const XD={productName:"Xpod 账号",loginTitle:"登录",registerTitle:"创建账号",usernameLabel:"Pod 名称",usernamePlaceholder:"选择 Pod 名称",emailLabel:"邮箱",emailPlaceholder:"you@example.com",passwordLabel:"密码",passwordPlaceholder:"输入密码",confirmationLabel:"确认密码",confirmationPlaceholder:"再次输入密码",loginAction:"登录",registerAction:"创建账号",switchToRegister:"切换用户",switchToLogin:"返回登录",usernameChecking:"正在检查 Pod 名称…",usernameAvailable:"Pod 名称可用",usernameUnavailable:"Pod 名称不可用",suggestionsLabel:"可用建议",mismatchError:"两次输入的密码不一致"},Zb={title:"找回密码",description:"如果这个邮箱已注册,我们会发送重置链接。",emailLabel:"邮箱",emailPlaceholder:"you@example.com",actionLabel:"发送重置链接",successTitle:"请查收邮件",successMessage:"如果该邮箱已注册,重置链接已经发出。"},Kb={title:"设置新密码",description:"为你的账号选择一个新密码。",passwordLabel:"新密码",passwordPlaceholder:"输入新密码",confirmationLabel:"确认密码",confirmationPlaceholder:"再次输入密码",actionLabel:"重设密码",successMessage:"密码已重设。",mismatchError:"两次输入的密码不一致"},Fa={loginSurfaceTitle:"登录",registerSurfaceTitle:"创建账号",recoverSurfaceTitle:"找回密码",resetSurfaceTitle:"重设密码",backToSignIn:"返回登录",cancelAuthorization:"取消授权",cancellingAuthorization:"正在取消…",resend:"重新发送"},Wt={surfaceTitle:"授权",signInRequiredTitle:"需要先登录",signInRequiredDescription:"请先登录,再批准这次请求并选择要共享的 WebID。",goToSignIn:"去登录",unavailableTitle:"暂时无法授权",tryAgain:"重试",dismiss:"关闭",restoring:"正在恢复授权…",applicationFallback:"这个应用",denyLabel:"拒绝",switchAccountLabel:"换一个账号",conflictMessage:"所选存储空间与当前身份不匹配。",retryLabel:"重试",goToPodManagementLabel:"前往 Pod 管理"},ga={usernameRequired:"请填写 Pod 名称",usernameLength:"Pod 名称需为 3-63 个字符",usernameCharset:"Pod 名称只能包含小写字母、数字和连字符",usernameHyphen:"Pod 名称不能以连字符开头或结尾",emailAlreadyRegistered:"该邮箱已注册,请登录或重置密码。",emailAlreadyRegisteredPasswordMismatch:"该邮箱已注册,但密码不正确,请登录或重置密码。",podNameTaken:"Pod 名称已被占用,请换一个。"};function Jb(n){return n===401||n===403?"邮箱或密码不正确。":n===429?"尝试次数过多,请稍后再试。":"登录失败,请重试。"}function YD(){return"无法完成注册,请重试。"}function ex(){return"取消授权失败,请重试。"}const Ue={invalidTransaction:"登录状态无效。",expiredInteraction:"本次授权请求已失效,请返回应用重新发起登录。",bindingUnavailable:"应用选择的身份与存储空间已不可用,请返回应用重新选择。",returnFailed:"无法返回应用,请重试。",signInRequired:"请先登录,再继续授权。",loadFailed:"无法加载授权信息,请重试。",clientUnavailable:"无法获取应用信息。",bindingsFailed:"无法加载 WebID 绑定,请重试。",signOutIncomplete:"退出未完成,请重试。",cancelFailed:"取消授权失败,请重试。",chooseStorage:"批准前请先选择存储空间。",cannotPersistStorage:"当前浏览器无法保存这次存储选择。",webIdSelectionFailed:"无法完成 WebID 选择,请重试。",authorizationFailed:"无法完成授权,请重试。",missingRedirect:"授权已完成,但没有返回跳转地址,请重新登录。",choosePodName:"创建存储空间前请先填写 Pod 名称。",storageCreationUnavailable:"暂时无法创建存储空间。",storageCreateFailed:"无法创建存储空间,请重试。"},$t={checkFailed:"无法检查存储空间状态,请重试。",accountIdentityMissing:"当前账号信息不完整,暂时无法创建 Pod。请刷新后重试。",createEndpointMissing:"找不到创建 Pod 的接口,请刷新后重试。",cloudRouteUnavailable:"本机 Xpod 还没有和 Cloud 打通,暂时不能准备存储空间。请保持 Xpod 运行,稍后重试。",storageCreateFailed:"无法创建存储空间,请重试。",cancelFailed:"取消授权失败,请重试或直接关闭此页面。",authorizationUnavailable:"原来的授权已经失效,或暂时无法确认它仍然有效。请回到授权页面重试或重新发起。"};function tx(n){return n===429?"请求过多,请稍后再试。":"无法发送重置链接,请重试。"}function nx(n){return n===400||n===404?"重置链接无效或已过期。":"无法重设密码,请重试。"}const qD="xpod.account.locale";function ax(n){if(n==="en"||n==="zh-CN")return n;try{if(window.localStorage.getItem(qD)==="en")return"en"}catch{}return"zh-CN"}const VD={"zh-CN":{serviceName:"账号服务",brandName:"Xpod",dashboardTitle:"账号总览",about:"关于",signOut:"退出登录",authorizationPendingTitle:"等待授权",authorizationPendingLead:"有应用正在等待你的授权",continueAuthorization:"继续授权",cancelAuthorization:"取消授权",cancelAuthorizationFailed:"取消授权失败,请重试。",authorizationUnavailable:"当前授权已失效,请回到应用重新发起。",storageTitle:"存储空间",storageLead:"你的个人数据存储(Pod)。这里的数据由你拥有和控制。",managePods:"管理 Pod",workspaceTitle:"桌面 Xpod",openWorkspace:"桌面管理入口",workspaceHint:"使用桌面 Xpod 管理自己的部署、AI 连接和系统设置。",noPodOnDevice:"这台设备还没有 Pod。创建一个即可在这里存储数据。",noPodsFound:"还没有 Pod。创建一个即可开始。",podLabel:"Pod",deletePod:"删除 Pod",enablePodDeletion:"启用删除",enablePodDeletionFailed:"无法打开设备授权页面,请重试。",identityTitle:"身份",identityLead:"你的去中心化标识(WebID)。这是你在 Solid 网络上的身份。",noWebIds:"还没有 WebID。先创建存储空间即可获得 WebID。",credentialsTitle:"Solid 客户端凭据",credentialsLead:"供需要直接访问 Pod 的客户端使用的 Solid 凭据。Xpod API Key 在 AI 连接中管理。",newCredential:"新建凭据",credentialEndpointMissing:"尚未配置客户端凭据接口。",credentialName:"凭据名称",selectWebId:"选择 WebID",cancel:"取消",create:"创建",creating:"正在创建…",credentialCreated:"新的 Solid 客户端凭据已创建",credentialCreatedLead:"请立即复制 Client ID 与 Client Secret。Secret 不会再次显示。",clientId:"Client ID",clientSecret:"Client Secret",copyClientId:"复制 Client ID",copyClientSecret:"复制 Client Secret",done:"完成",noCredentials:"还没有客户端凭据。",revokeCredential:"吊销凭据",securityTitle:"安全",passwordLabel:"密码",passwordLead:"更新你的账号密码",changePassword:"修改密码",closeError:"关闭错误提示",deletePodConfirm:n=>`删除 Pod ${n}?此操作无法撤销。`,deletePodWarning:"此操作会永久删除这个 Pod 的数据,无法撤销。请确认下面的存储地址。",deletePodFailed:"无法删除 Pod,请重试。",deletePodNodeUnavailable:"无法连接这个 Pod 所在的设备。请确认设备在线后重试。",deletePodNodeFailed:"设备未能完成删除。请检查设备状态后重试。",deletePodNotAcknowledged:"尚未收到设备的删除确认,请重试以确认结果。",deletePodUnsupported:"这个存储服务暂不支持在此删除 Pod。",deleting:"正在删除…",revokeCredentialFailed:"无法吊销客户端凭据,请重试。",actionUnavailable:"当前账号或操作已失效,请刷新后重试。",deleteCredentialConfirm:"删除这条凭据?此操作无法撤销。"},en:{serviceName:"Account service",brandName:"Xpod",dashboardTitle:"Account Dashboard",about:"About",signOut:"Sign out",authorizationPendingTitle:"Authorization Pending",authorizationPendingLead:"An application is waiting for your authorization",continueAuthorization:"Continue",cancelAuthorization:"Cancel authorization",cancelAuthorizationFailed:"Could not cancel the authorization. Try again.",authorizationUnavailable:"This authorization is no longer valid. Start again from the application.",storageTitle:"Storage",storageLead:"Your personal data stores (Pods). You own and control all data stored here.",managePods:"Manage Pods",workspaceTitle:"Xpod workspace",openWorkspace:"Open Xpod workspace",workspaceHint:"Manage Pods, AI connections and system settings in the workspace.",noPodOnDevice:"This device has no Pod yet. Create one to store data here.",noPodsFound:"No Pods found. Create one to get started.",podLabel:"Pod",deletePod:"Delete Pod",enablePodDeletion:"Enable deletion",enablePodDeletionFailed:"Could not open device authorization. Try again.",identityTitle:"Identity",identityLead:"Your unique decentralized identifiers (WebIDs). This is your identity on the Solid network.",noWebIds:"No WebIDs found. Create a Pod first to get a WebID.",credentialsTitle:"Solid Client Credentials",credentialsLead:"Solid credentials for clients that need direct Pod access. Xpod API Keys are managed in AI Connections.",newCredential:"New Credential",credentialEndpointMissing:"Client credential endpoint not configured.",credentialName:"Credential Name",selectWebId:"Select WebID",cancel:"Cancel",create:"Create",creating:"Creating...",credentialCreated:"New Solid Client Credential Created",credentialCreatedLead:"Copy the Client ID and Client Secret now. The secret will not be shown again.",clientId:"Client ID",clientSecret:"Client Secret",copyClientId:"Copy Client ID",copyClientSecret:"Copy Client Secret",done:"Done",noCredentials:"No client credentials found.",revokeCredential:"Revoke Credential",securityTitle:"Security",passwordLabel:"Password",passwordLead:"Update your account password",changePassword:"Change Password",closeError:"Dismiss error",deletePodConfirm:n=>`Delete pod ${n}? This cannot be undone.`,deletePodWarning:"This permanently deletes the data in this Pod and cannot be undone. Check the storage address below.",deletePodFailed:"Could not delete the Pod. Try again.",deletePodNodeUnavailable:"Cannot connect to the device hosting this Pod. Check that it is online and try again.",deletePodNodeFailed:"The device could not finish deleting the Pod. Check its status and try again.",deletePodNotAcknowledged:"The device has not confirmed deletion yet. Retry to check the result.",deletePodUnsupported:"This storage service does not support deleting Pods here yet.",deleting:"Deleting…",revokeCredentialFailed:"Could not revoke the client credential. Try again.",actionUnavailable:"This account or action is no longer valid. Refresh and try again.",deleteCredentialConfirm:"Delete this credential? This cannot be undone."}};function GD(n="zh-CN"){return VD[n]}const WD=3,$D=63,FD=/^[a-z0-9-]+$/;function yu(n){return n.trim().toLowerCase()}function Yc(n){const a=yu(n);if(!a)return ga.usernameRequired;if(a.length<WD||a.length>$D)return ga.usernameLength;if(!FD.test(a))return ga.usernameCharset;if(a.startsWith("-")||a.endsWith("-"))return ga.usernameHyphen}class Hn extends Error{code;constructor(a,o){super(o),this.name="AccountStorageBindingsError",this.code=a}}async function Ph(n){const a=ZD(n.origin),o=n.controls?.account?.bindings;if(typeof o!="string"||o.trim()==="")throw new Hn("missing-control","Account storage bindings control is unavailable");const i=n.fetchImpl??fetch,s=KD(o,a),u=s.origin===a?s.href:await Lt(s.href,i,n.trustedAccountIndex);if(!u)throw new Hn("cross-origin","Account storage bindings control is not hosted by this Xpod");const f=tt({Accept:"application/json",...n.headers});let h;try{h=await i(u,{headers:f,credentials:"include"})}catch(v){throw new Hn("request-failed",v instanceof Error?v.message:"Failed to load Account storage bindings")}if(h.status===401||h.status===403)throw new Hn("forbidden","Account storage bindings require an authenticated Account");if(!h.ok)throw new Hn("request-failed",`Account storage bindings request failed (${h.status})`);let p;try{p=await h.json()}catch{throw new Hn("invalid-response","Account storage bindings response is not valid JSON")}return QD(p,s.origin,tU(s,n.trustedAccountIndex,a))}function QD(n,a,o=!1){if(!rx(n)||!Array.isArray(n.bindings))throw new Hn("invalid-response","Account storage bindings response is malformed");const i=[],s=new Set;for(const u of n.bindings){if(!rx(u)||typeof u.webId!="string"||typeof u.storageUrl!="string")throw new Hn("invalid-response","Account storage binding row is malformed");const f=JD(u.webId),h=eU(u.storageUrl,o?void 0:a);if(!f||!h)throw new Hn("cross-origin","Account storage binding is outside the trusted storage scope");const p={webId:f,storageUrl:h,...typeof u.label=="string"?{label:u.label}:{}},v=`${p.webId}
|
|
52
52
|
${p.storageUrl}`;s.has(v)||(s.add(v),i.push(p))}return i}function ZD(n){try{return new URL(n??(typeof window>"u"?"http://localhost":window.location.origin)).origin}catch{throw new Hn("cross-origin","Current Xpod origin is invalid")}}function KD(n,a){try{const o=new URL(n,a);if(!["http:","https:"].includes(o.protocol)||o.username||o.password||o.hash)throw new Error("unsafe control URL");return o}catch{throw new Hn("cross-origin","Account storage bindings control is not a valid URL")}}function JD(n){if(!Tl(n))try{const a=new URL(n);return!["http:","https:"].includes(a.protocol)||a.username||a.password?void 0:n}catch{return}}function eU(n,a){try{const o=new URL(n.trim());return a!==void 0&&o.origin!==a||!["http:","https:"].includes(o.protocol)||o.username||o.password||o.search||o.hash?void 0:(o.pathname=o.pathname.endsWith("/")?o.pathname:`${o.pathname}/`,o.href)}catch{return}}function tU(n,a,o){if(!a)return!1;try{const i=new URL(a,o);return i.pathname.startsWith("/.account/")&&n.origin===i.origin&&n.pathname.startsWith("/.account/")}catch{return!1}}function rx(n){return!!(n&&typeof n=="object"&&!Array.isArray(n))}function Nl(n){return typeof n=="object"&&n!==null}function Pm(n){return Nl(n)&&typeof n.message=="string"?n.message:""}function ox(n,a){if(n)try{const o=new URL(a,globalThis.location?.origin??"http://localhost"),i=new URL(n,o);return i.origin===o.origin?i.href:new URL(`${i.pathname}${i.search}${i.hash}`,o.origin).href}catch{return}}class Bi extends Error{code;constructor(a,o){super(a),this.name="RegistrationError",this.code=o}}async function US(n){const a=await n.json().catch(()=>{});return a?.message||a?.error}async function lx(n){const a=await n.json().catch(()=>({}));return Nl(a)?a:{}}function nU(n){return n?/already is a login for this e-mail address/i.test(n)||/email(?: address)? is already/i.test(n)||/already registered/i.test(n):!1}async function aU(n){const a=n.fetchImpl??fetch;let o=await a(ee(n.accountCreateUrl),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"include",body:JSON.stringify({})});if(!o.ok)throw new Error(Pm(await lx(o))||"Failed to create account");const i=await o.json().catch(()=>({})),s=typeof i.authorization=="string"?i.authorization:"";if(!s)throw new Error("Account token not returned");const u=new URL(n.accountCreateUrl,globalThis.location?.origin??"http://localhost"),f=new URL("/.account/",u).href;if(o=await a(ee(f),{headers:Di(s),credentials:"include"}),!o.ok)throw new Error(Pm(await lx(o))||"Failed to load account controls");const h=await o.json().catch(()=>({})),p=ox(h.controls?.password?.create,f),v=ox(h.controls?.password?.login,f);if(!p)throw new Error("Password endpoint not found");if(!v)throw new Error("Login endpoint not found");if(o=await a(ee(p),{method:"POST",headers:{...Di(s),"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({email:n.email,password:n.password})}),!o.ok){const b=await US(o);throw nU(b)?new Bi(ga.emailAlreadyRegistered,"EMAIL_ALREADY_REGISTERED"):new Error(b||"Failed to set password")}return{accountToken:s,loginUrl:v}}async function rU(n){const o=await(n.fetchImpl??fetch)(ee(n.loginUrl),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"include",body:JSON.stringify({email:n.email,password:n.password,...n.remember===void 0?{}:{remember:n.remember}})});if(!o.ok){const u=await US(o);throw n.duplicateEmailRecovery?new Bi(ga.emailAlreadyRegisteredPasswordMismatch,"EMAIL_ALREADY_REGISTERED"):new Error(u||"Auto-login failed")}const i=await o.json().catch(()=>({})),s=typeof i.authorization=="string"?i.authorization:"";if(!s)throw new Error("Account token not returned after login");return{accountToken:s}}function oU(n){return n instanceof Bi?n.message:YD()}function zS({initialIsRegister:n=!1}){const{controls:a,idpIndex:o,isLoggedIn:i,hasOidcPending:s,isInitializing:u}=vn(),f=xa(),h=gn(),[p,v]=g.useState(),b=p&&p.from===n?p.register:n,[x,w,S]=HD(o,u),[A,E]=g.useState(!1),[R,T]=BD(o,u),[_,N]=g.useState(!1),[k,B]=g.useState(null),[X,z]=g.useState(null);if(g.useEffect(()=>{const le=AD();le&&ji(le)},[]),i)return m.jsx(aa,{to:ee("/.account/account/"),replace:!0,state:{next:ee(s?"/.account/oidc/consent/":"/.account/account/")}});const H=le=>{w(le),le.email!==x.email&&B(null),z(null)},re=(le,fe)=>{le==="email"&&B(null),z(null),w(D=>({...D,[le]:fe}))},J=()=>{window.location.href=RD(s,ee("/.account/account/"))},oe=async le=>{if(A||u)return;E(!0),B(null),z(null);const fe=le.email?.trim()??"",D=le.password;try{if(b){const Y=await Lt(a?.password?.login,fetch,o)??ee("/.account/login/password/"),ae=async(ie=!1)=>{const ye=await rU({duplicateEmailRecovery:ie,email:fe,fetchImpl:fetch,loginUrl:Y,password:D,remember:!0});return qf(ye.accountToken),ye.accountToken};let $;const te=await ae().catch(()=>{});if(te)$=te;else try{$=(await aU({accountCreateUrl:await Lt(a?.account?.create,fetch,o)??ee("/.account/account/"),email:fe,password:D})).accountToken,qf($)}catch(ie){if(!(ie instanceof Bi)||ie.code!=="EMAIL_ALREADY_REGISTERED")throw ie;$=await ae(!0)}J();return}const V=await Lt(a?.password?.login,fetch,o)??ee("/.account/login/password/"),Q=await fetch(ee(V),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"include",body:JSON.stringify({email:fe,password:D,remember:R})}),ue=await Q.json().catch(()=>({}));if(!Q.ok){z(Jb(Q.status));return}qf(typeof ue.authorization=="string"?ue.authorization:void 0),kD(fe,void 0,o,R);const F=Q.headers.get("Location");if(typeof ue.location=="string"&&ue.location){window.location.href=ee(ue.location);return}if(F){window.location.href=ee(F);return}const O=Mh();if(O){window.location.href=ee(O);return}try{if((await fetch(ee("/.account/oidc/consent/"),{headers:tt(),credentials:"include"})).ok){window.location.href=ee("/.account/oidc/consent/");return}}catch{}window.location.href=ee("/.account/account/")}catch(V){V instanceof Bi&&V.code==="EMAIL_ALREADY_REGISTERED"?B(V.message):z(b?oU(V):Jb(500))}finally{E(!1)}},ne=le=>{v({from:n,register:le==="register"}),f({pathname:ee(le==="register"?"/.account/login/password/register/":"/.account/login/password/"),search:h.search}),w({email:"",password:"",confirmation:""}),B(null),z(null)},se=async()=>{const le=a?.oidc?.cancel;if(!(!le||!s||_)){N(!0),z(null);try{const fe=await fetch(ee(le),{method:"POST",headers:tt({"Content-Type":"application/json",Accept:"application/json"}),credentials:"include"}),D=await fe.json().catch(()=>({}));if(!fe.ok||typeof D.location!="string"||!D.location){z(ex());return}window.location.href=ee(D.location)}catch{z(ex())}finally{N(!1)}}};return m.jsx(wD,{surface:"page",surfaceTitle:b?Fa.registerSurfaceTitle:Fa.loginSurfaceTitle,mode:b?"register":"login",values:x,onChange:H,onFieldChange:re,onSubmit:oe,onModeChange:b?ne:void 0,pending:A||_,rememberAccount:R,onRememberAccountChange:T,errors:{...k?{email:k}:{},...X?{form:X}:{}},copy:XD,onRegister:()=>ne("register"),onForgot:()=>f({pathname:ee("/.account/login/password/forgot/"),search:h.search}),footer:!b&&s&&a?.oidc?.cancel?m.jsx(Qe,{type:"button",variant:"outline",className:"h-11 w-full rounded-lg",disabled:A||_,onClick:se,children:_?Fa.cancellingAuthorization:Fa.cancelAuthorization}):void 0},S??"bootstrap")}function lU(){const{isLoggedIn:n,hasOidcPending:a}=vn();return n&&a?m.jsx(aa,{to:ee("/.account/oidc/consent/"),replace:!0}):n?m.jsx(aa,{to:ee("/.account/account/"),replace:!0}):m.jsx(zS,{})}const ix="flex items-center justify-center rounded-xl bg-primary text-primary-foreground",om="bg-card border border-border rounded-lg flex items-center justify-center shadow-sm",sx="flex items-center gap-3 p-3 bg-muted border border-border rounded-xl hover:border-primary/50 transition-colors group";function iU(){const n=xa(),{isLoggedIn:a}=vn(),o=[{icon:rT,title:"Your AI Secretary Never Stops",desc:"Runs 24/7, even when you're not talking to it"},{icon:fT,title:"One Place for Your Whole Life",desc:"All your messages together in one place"},{icon:vT,title:"One Secretary, Many Agents",desc:"Full power, full privacy"}];return m.jsxs("div",{className:"min-h-screen bg-background text-foreground font-sans flex items-center justify-center p-4 lg:p-8",children:[m.jsxs("div",{className:"fixed inset-0 overflow-hidden pointer-events-none",children:[m.jsx("div",{className:"absolute top-0 left-1/4 w-[800px] h-[600px] bg-primary/5 rounded-full blur-[150px]"}),m.jsx("div",{className:"absolute bottom-0 right-1/4 w-[600px] h-[400px] bg-primary/5 rounded-full blur-[100px]"})]}),m.jsxs("div",{className:"w-full max-w-6xl grid lg:grid-cols-2 gap-8 lg:gap-16 items-center relative z-10",children:[m.jsx("div",{className:"hidden lg:block px-8",children:m.jsxs("div",{className:"max-w-md ml-auto",children:[m.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[m.jsx("div",{className:`w-12 h-12 shadow-lg shadow-primary/20 ${ix}`,children:m.jsx("div",{className:"w-6 h-6 border-2 border-primary-foreground rounded opacity-90"})}),m.jsxs("div",{children:[m.jsx("div",{className:"text-2xl font-bold leading-tight",children:"Xpod"}),m.jsx("div",{className:"text-[10px] text-muted-foreground leading-tight",children:"Personal Messages Platform"})]})]}),m.jsxs("h1",{className:"text-2xl xl:text-3xl font-bold leading-tight mb-4",children:["Simplify Life with ",m.jsx("span",{className:"text-primary",children:"Your AI Secretary"})]}),m.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed mb-10",children:"An AI that never stops, knows your whole life, works for you—while guarding your privacy."}),m.jsx("div",{className:"space-y-4",children:m.jsx("div",{className:"space-y-3",children:o.map(({icon:i,title:s,desc:u})=>m.jsxs("div",{className:"flex gap-3",children:[m.jsx("div",{className:`w-8 h-8 shrink-0 ${om}`,children:m.jsx(i,{className:"w-4 h-4 text-primary"})}),m.jsxs("div",{children:[m.jsx("h3",{className:"text-xs font-medium text-foreground",children:s}),m.jsx("p",{className:"text-[10px] text-muted-foreground",children:u})]})]},s))})}),m.jsx("div",{className:"mt-12",children:m.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Powered by ",m.jsx("a",{href:"https://solidproject.org",target:"_blank",rel:"noopener",className:"text-primary hover:text-primary/80",children:"Solid Protocol"})]})})]})}),m.jsx("div",{className:"w-full max-w-sm mx-auto lg:mx-0",children:m.jsxs("div",{className:"bg-card border border-border rounded-3xl p-6 lg:p-8 shadow-xl shadow-black/10",children:[m.jsxs("div",{className:"lg:hidden flex items-center gap-3 mb-8",children:[m.jsx("div",{className:`w-10 h-10 ${ix}`,children:m.jsx("div",{className:"w-5 h-5 border-2 border-primary-foreground rounded opacity-90"})}),m.jsxs("div",{children:[m.jsx("div",{className:"text-xl font-bold leading-tight",children:"Xpod"}),m.jsx("div",{className:"text-[10px] text-muted-foreground leading-tight",children:"Personal Messages Platform"})]})]}),m.jsxs("div",{className:"lg:hidden mb-8",children:[m.jsxs("h1",{className:"text-xl font-bold leading-tight mb-3",children:["Simplify Life with ",m.jsx("span",{className:"text-primary",children:"Your AI Secretary"})]}),m.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed mb-6",children:"An AI that never stops, knows your whole life, works for you—while guarding your privacy."}),m.jsx("div",{className:"space-y-2",children:o.map(({icon:i,title:s,desc:u})=>m.jsxs("div",{className:"flex gap-2",children:[m.jsx(i,{className:"w-4 h-4 text-primary shrink-0 mt-0.5"}),m.jsxs("div",{children:[m.jsx("span",{className:"text-xs font-medium text-foreground",children:s}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:[" - ",u]})]})]},s))})]}),m.jsxs("div",{className:"mb-6",children:[m.jsx("h2",{className:"text-xl font-bold",children:"About Xpod"}),m.jsx("p",{className:"text-muted-foreground text-xs mt-1",children:"Learn more about the platform and resources."})]}),m.jsxs("div",{className:"space-y-3 mb-6",children:[m.jsxs("a",{href:"https://solidproject.org",target:"_blank",rel:"noopener noreferrer",className:sx,children:[m.jsx("div",{className:`w-8 h-8 ${om}`,children:m.jsx(hb,{className:"w-4 h-4 text-muted-foreground group-hover:text-primary"})}),m.jsxs("div",{children:[m.jsx("div",{className:"text-sm font-medium text-foreground",children:"Solid Project"}),m.jsx("div",{className:"text-xs text-muted-foreground",children:"Learn about the protocol"})]})]}),m.jsxs("a",{href:"https://github.com",target:"_blank",rel:"noopener noreferrer",className:sx,children:[m.jsx("div",{className:`w-8 h-8 ${om}`,children:m.jsx(hb,{className:"w-4 h-4 text-muted-foreground group-hover:text-primary"})}),m.jsxs("div",{children:[m.jsx("div",{className:"text-sm font-medium text-foreground",children:"GitHub"}),m.jsx("div",{className:"text-xs text-muted-foreground",children:"View source code"})]})]})]}),m.jsxs("div",{className:"pt-4 border-t border-border",children:[m.jsx("p",{className:"text-[10px] text-muted-foreground mb-4",children:"Version 0.1.0 · Built with Solid Protocol"}),m.jsxs("button",{onClick:()=>n(ee(a?"/.account/account/":"/.account/login/password/")),className:"w-full py-3 border border-border hover:bg-muted text-foreground rounded-xl text-sm font-medium flex items-center justify-center gap-2 transition-colors",children:[m.jsx(KR,{className:"w-4 h-4"}),a?"Back to Account":"Back to Login"]})]})]})})]})]})}function LS(n){return n.replace(/\/+$/u,"")+"/"}function Pr(n){if(n)try{return new URL(n)}catch{return}}function Bm(n,a){const o=Pr(n),i=Pr(a);if(!o||!i||o.origin!==i.origin)return!1;const s=fU(i.pathname);return o.pathname===s||o.pathname.startsWith(s)}function Hi(n,a){const o=Pr(n),i=Pr(a);return!o||!i?"custom":o.origin===i.origin?"cloud":"local"}function sU(n){const a=Gi(n);return a?{root:a.storageRoot,lookupUrl:a.lookupUrl,serviceToken:a.serviceToken,mode:"local"}:void 0}function cU(n,a){const o=sU(a);if(o)return o}async function uU(n,a,o){if(a.length===0)return[];if(!o.lookupUrl||!o.serviceToken)throw new Error("Local storage lookup context is incomplete");return(await $x(n,a,{lookupUrl:o.lookupUrl,storageRoot:o.root,serviceToken:o.serviceToken})).map(s=>({webId:s.webId,storageUrl:LS(s.storageUrl),storageMode:s.storageMode??Hi(s.webId,s.storageUrl)}))}function dU(n,a,o){const i=a.filter(u=>Bm(u,o.root));if(i.length===0)return[];const s=[];for(const u of n){const f=Hi(u,o.root);if(o.mode!=="local"&&f!==o.mode)continue;const h=f==="cloud"?i.filter(p=>mU(p,u)):i.filter(p=>hU(p,u));for(const p of h)s.push({webId:u,storageUrl:LS(p),storageMode:Hi(u,p)})}return kS(s)}function kS(n){const a=new Set,o=[];for(const i of n){const s=`${i.webId}
|
|
53
53
|
${i.storageUrl}`;a.has(s)||(a.add(s),o.push(i))}return o}function fU(n){return!n||n==="/"?"/":n.endsWith("/")?n:`${n}/`}function mU(n,a){const o=Pr(n),i=Pr(a);if(!o||!i||o.origin!==i.origin)return!1;const[s]=o.pathname.split("/").filter(Boolean),[u]=i.pathname.split("/").filter(Boolean);return!!(s&&u&&s===u)}function hU(n,a){const o=Pr(n),i=Pr(a);if(!o||!i)return!1;const[s]=o.pathname.split("/").filter(Boolean),[u]=i.pathname.split("/").filter(Boolean);return!!(s&&u&&s===u)}function cx(n,a=[]){if(!Array.isArray(n))return[];const o=[];for(const i of n){if(!Nl(i)||typeof i.webId!="string"||typeof i.storageUrl!="string")continue;const s=yU(i.webId,i.storageUrl,typeof i.label=="string"?i.label:void 0);if(!s)continue;const u=`${s.webId}
|
|
54
54
|
${s.storageUrl}`,f=o.find(h=>`${h.webId}
|